soonspacejs 2.6.5 → 2.6.6

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/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import*as e from"three";import{Vector3 as t,Euler as n,Box3 as i,Quaternion as r,CubeTextureLoader as s,RGBAFormat as o,Color as a,Texture as l,Scene as c,Fog as h,Mesh as u,EdgesGeometry as d,LineSegments as f,LineBasicMaterial as p,MeshStandardMaterial as g,Matrix4 as m,Object3D as v,PerspectiveCamera as y,OrthographicCamera as b,Vector2 as w,WebGLRenderer as A,PCFSoftShadowMap as x,Sphere as S,Camera as E,sRGBEncoding as T,UnsignedByteType as D,MeshNormalMaterial as C,WebGLRenderTarget as B,NearestFilter as I,DepthTexture as M,DepthStencilFormat as O,UnsignedInt248Type as P,UnsignedIntType as R,LinearEncoding as _,Uniform as L,RepeatWrapping as N,LoadingManager as k,LinearFilter as U,ShaderMaterial as j,NoBlending as z,RGBADepthPacking as F,REVISION as H,EventDispatcher as G,BackSide as V,DoubleSide as Y,FrontSide as Q,MeshDepthMaterial as W,FloatType as X,BasicDepthPacking as Z,DataTexture as K,Vector4 as q,BufferGeometry as J,BufferAttribute as $,Material as ee,LuminanceFormat as te,RedFormat as ne,RGFormat as ie,ShaderChunk as re,WebGLCubeRenderTarget as se,CubeCamera as oe,PMREMGenerator as ae,HalfFloatType as le,WebGLMultipleRenderTargets as ce,FramebufferTexture as he,Matrix3 as ue,TangentSpaceNormalMap as de,GLSL3 as fe,VideoTexture as pe,GLBufferAttribute as ge,InterleavedBufferAttribute as me,Frustum as ve,MOUSE as ye,TOUCH as be,Spherical as we,TextureLoader as Ae,MeshBasicMaterial as xe,PlaneGeometry as Se,Raycaster as Ee,Clock as Te,AnimationMixer as De,EquirectangularReflectionMapping as Ce,ACESFilmicToneMapping as Be,AnimationClip as Ie,NoToneMapping as Me,LinearToneMapping as Oe,ReinhardToneMapping as Pe,CineonToneMapping as Re,Sprite as _e,SpriteMaterial as Le,SphereGeometry as Ne,CircleGeometry as ke,Float32BufferAttribute as Ue,ShapeGeometry as je,Shape as ze,AmbientLight as Fe,DirectionalLight as He,HemisphereLight as Ge,SpotLight as Ve,PointLight as Ye,RectAreaLight as Qe,Loader as We,Group as Xe,LinearMipMapLinearFilter as Ze,ImageLoader as Ke,SkinnedMesh as qe,GridHelper as Je,AxesHelper as $e,Box3Helper as et,DirectionalLightHelper as tt,HemisphereLightHelper as nt,SpotLightHelper as it,PointLightHelper as rt,Box2 as st,Plane as ot,CanvasTexture as at,Line3 as lt,MeshPhongMaterial as ct}from"three";export*from"three";import{GLTFExporter as ht}from"three/examples/jsm/exporters/GLTFExporter.js";import{MeshBVH as ut,computeBoundsTree as dt,disposeBoundsTree as ft,acceleratedRaycast as pt}from"three-mesh-bvh";import{RoomEnvironment as gt}from"three/examples/jsm/environments/RoomEnvironment.js";import{RGBELoader as mt}from"three/examples/jsm/loaders/RGBELoader.js";import vt from"three/examples/jsm/libs/stats.module.js";import{Sky as yt}from"three/examples/jsm/objects/Sky.js";import{deinterleaveGeometry as bt}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{WorkerPool as wt}from"three/examples/jsm/utils/WorkerPool.js";import{RectAreaLightUniformsLib as At}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{FBXLoader as xt}from"three/examples/jsm/loaders/FBXLoader.js";import{TGALoader as St}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as Et}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Tt}from"three/examples/jsm/loaders/DRACOLoader.js";import{RectAreaLightHelper as Dt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Ct,Bt="soonspacejs",It="2.6.5",Mt={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-Mt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*Mt.Bounce.In(2*e):.5*Mt.Bounce.Out(2*e-1)+.5}}},Ot="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},Pt=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=Ot()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],s=!t;r&&!1===r.update(e,s)&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),Rt={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=Rt.Utils.Linear;return t<0?s(e[0],e[1],i):t>1?s(e[n],e[n-1],n-i):s(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,s=Rt.Utils.Bernstein,o=0;o<=i;o++)n+=r(1-t,i-o)*r(t,o)*e[o]*s(i,o);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=Rt.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),s(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(s(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):s(e[r?r-1:0],e[r],e[n<r+1?n:r+1],e[n<r+2?n:r+2],i-r)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=Rt.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(Ct=[1],function(e){var t=1;if(Ct[e])return Ct[e];for(var n=e;n>1;n--)t*=n;return Ct[e]=t,t}),CatmullRom:function(e,t,n,i,r){var s=.5*(n-e),o=.5*(i-t),a=r*r;return(2*t-2*n+s+o)*(r*a)+(-3*t+3*n-2*s-o)*a+s*r+t}}},_t=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Lt=new Pt,Nt=function(){function e(e,t){void 0===t&&(t=Lt),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Mt.Linear.None,this._interpolationFunction=Rt.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=_t.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?Ot()+parseFloat(e):e:Ot(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,i){for(var r in n){var s=e[r],o=Array.isArray(s),a=o?"array":typeof s,l=!o&&Array.isArray(n[r]);if("undefined"!==a&&"function"!==a){if(l){var c=n[r];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,s)),n[r]=[s].concat(c)}if("object"!==a&&!o||!s||l)void 0===t[r]&&(t[r]=s),o||(t[r]*=1),i[r]=l?n[r].slice().reverse():t[r]||0;else{for(var h in t[r]=o?[]:{},s)t[r][h]=s[h];i[r]=o?[]:{},this._setupProperties(s,t[r],n[r],i[r])}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=Ot()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=Ot()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=Ot()),void 0===t&&(t=!0),this._isPaused)return!0;var n,i,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>r)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),i=(e-this._startTime)/this._duration,i=0===this._duration||i>1?1:i;var s=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),1===i){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,a=this._chainedTweens.length;o<a;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,i){for(var r in n)if(void 0!==t[r]){var s=t[r]||0,o=n[r],a=Array.isArray(e[r]),l=Array.isArray(o);!a&&l?e[r]=this._interpolationFunction(o,i):"object"==typeof o&&o?this._updateProperties(e[r],s,o,i):"number"==typeof(o=this._handleRelativeValue(s,o))&&(e[r]=s+(o-s)*i)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),kt=_t.nextId,Ut=Lt,jt=Ut.getAll.bind(Ut),zt=Ut.removeAll.bind(Ut),Ft=Ut.add.bind(Ut),Ht=Ut.remove.bind(Ut),Gt=Ut.update.bind(Ut),Vt={Easing:Mt,Group:Pt,Interpolation:Rt,now:Ot,Sequence:_t,nextId:kt,Tween:Nt,VERSION:"18.6.4",getAll:jt,removeAll:zt,add:Ft,remove:Ht,update:Gt};const Yt="[soonspacejs]: ",Qt="Group",Wt="Light",Xt="Model",Zt="Poi",Kt="PoiNode",qt="Canvas3D",Jt="Topology",$t="Helper",en="PluginObject",tn="In soonspacejs: ",nn=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},rn=e=>{console.warn(tn+e)};function sn(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function on(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function an(e){return new i(new t(0,0,0),new t(500,500,500)).setFromObject(e)}function ln(e,t,n){const i=n.clone();return Math.abs(t[e]-n[e])>Math.PI&&(t[e]>n[e]?i[e]+=2*Math.PI:i[e]-=2*Math.PI),i}function cn(e,t){const i=ln("x",e,t),r=ln("y",e,t),s=ln("z",e,t);return new n(i.x,r.y,s.z,t.order)}function hn(e){return Math.PI/180*e}function un(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function dn(e,t){const n=un(t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);e.position.copy(n.position),e.rotation.copy(n.rotation),e.scale.copy(n.scale)}function fn(e){return!!e.visible&&(!e.parent||fn(e.parent))}class pn{constructor(){this.min=null,this.roots=[],this.nodes=new Map}shift(){const e=this.min;if(null===e||this.roots.length<1)return this.min=null,e;this.remove(e),this.roots.length>50&&this.consolidate();let t=1/0;const n=this.roots.length;for(let e=0;e<n;e++){const n=this.roots[e],i=this.getDistance(n);i<t&&(t=i,this.min=n)}return e}consolidate(){const e=[[],[],[],[],[],[],[]],t=e.length-1,n=this.roots.length;for(let i=0;i<n;i++){const n=this.roots[i],r=this.nodes.get(n);r&&r.depth<t&&e[r.depth].push(n)}for(let n=0;n<=t;n++)for(;e[n].length>1;){const i=e[n].shift(),r=e[n].shift(),s=n+1;let o=-1;if(void 0!==i&&void 0!==r){const n=this.nodes.get(i),a=this.nodes.get(r);n&&a&&(n.distance<a.distance?(n.depth=s,n.children.push(r),a.parent=i,s<=t&&e[s].push(i),o=this.roots.indexOf(r)):(a.depth=s,a.children.push(i),n.parent=r,s<=t&&e[s].push(r),o=this.roots.indexOf(i)))}o>-1&&this.roots.splice(o,1)}}add(e,t){if(this.nodes.set(e,{nodeIndex:e,distance:t,depth:0,parent:null,children:[]}),null===this.min)this.min=e;else{const n=this.nodes.get(this.min);n&&t<n.distance&&(this.min=e)}this.roots.push(e)}update(e,t){this.remove(e),this.add(e,t)}remove(e){var t,n;if(!this.nodes.has(e))return;const i=null===(t=this.nodes.get(e))||void 0===t?void 0:t.children;if(i&&i.length>0)for(let t=0;t<i.length;t++){const n=i[t],r=this.nodes.get(n),s=this.nodes.get(e);r&&s&&(r.parent=s.parent),r&&null===r.parent&&this.roots.push(n)}let r=null===(n=this.nodes.get(e))||void 0===n?void 0:n.parent;if(null===r){const t=this.roots.indexOf(e);t>-1&&this.roots.splice(t,1)}else for(;r;){const e=this.nodes.get(r);e&&(e.depth--,r=e.parent)}}getDistance(e){const t=this.nodes.get(e);return t?t.distance:1/0}}function gn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"];return new Promise((n=>{(new s).setPath(e).load(t,(e=>{e.format=o,n(e)}))}))}function mn(e){if(!e)return null;const{colors:t,stops:n,size:i=1024}=e,r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;r.width=16,r.height=i;const o=s.createLinearGradient(0,0,0,i),c=new a,h=t.map((e=>c.set(e).getStyle()));for(let e=0,t=h.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,h[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const u=new l(r);return u.needsUpdate=!0,u}const vn=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function yn(e){return Ln(e)?function(e){return e.map((e=>yn(e)))}(e):Nn(e)?function(e){if(Nn(e)){const t={};for(const n in e)t[n]=yn(e[n]);return t}return e}(e):e}const bn=(e,t)=>Ln(e)?e.map(t):t(e),wn=e=>bn(e,(e=>e.clone())),An=e=>bn(e,(e=>e.dispose())),xn=async e=>{const t=await fetch(e);if(200===t.status)return t;throw new Error(`Failed to fetch file: ${e}`)},Sn=new t,En=new t,Tn=new t;function Dn(e,t){const n=Sn.setFromMatrixPosition(e.matrixWorld),i=En.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(Tn);return r.angleTo(s)>Math.PI/2}function Cn(e,t,n,i){const r=Sn.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(s,t);const o=n.intersectObjects(i,!0);if(o.length){const e=o[0].distance;return r.distanceTo(n.ray.origin)<e}return!0}const Bn=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var In=function(){function e(){}return e.prototype.toJson=function(e,t){var n=this.xmlStringToXmlDom(e),i=this.xmlToJson(n);return t?(t.removeLineBreaks&&this.removeLineBreaks(i),t.removeComments&&this.removeCommentProperties(i),t.transformTextOnly&&this.transformTextOnly(i),i):i},e.prototype.xmlStringToXmlDom=function(e){return(new DOMParser).parseFromString(e,"text/xml")},e.prototype.removeLineBreaks=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#text"===n&&Array.isArray(e[n])&&delete e[n],"object"==typeof e[n]&&t.removeLineBreaks(e[n])}))},e.prototype.removeCommentProperties=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#comment"===n&&delete e[n],"object"==typeof e[n]&&t.removeCommentProperties(e[n])}))},e.prototype.transformTextOnly=function(e){var t=this;Object.keys(e).forEach((function(n,i){var r=Object.keys(e[n]).length>1,s=Object.keys(e[n])[0];r||"object"==typeof e[n][s]?t.transformTextOnly(e[n]):"object"==typeof e[n]&&e[n]["#text"]&&(e[n]=e[n]["#text"])}))},e.prototype.xmlToJson=function(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t._attributes={};for(var n=0;n<e.attributes.length;n++){var i=e.attributes.item(n);t._attributes[i.nodeName]=i.nodeValue}}}else 3==e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var r=0;r<e.childNodes.length;r++){var s=e.childNodes.item(r),o=s.nodeName;if(void 0===t[o])t[o]=this.xmlToJson(s);else{if(void 0===t[o].push){var a=t[o];t[o]=[],t[o].push(a)}t[o].push(this.xmlToJson(s))}}return t},e}();function Mn(e){return xn(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new In).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}const On=Object.prototype.hasOwnProperty,Pn=e=>"String"===Un(e),Rn=e=>"Boolean"===Un(e),_n=e=>"Number"===Un(e),Ln=Array.isArray,Nn=e=>"Object"===Un(e),kn=e=>"Function"===Un(e),Un=e=>Object.prototype.toString.call(e).slice(8,-1),jn=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),zn=()=>Yt+Math.random().toString(36).substring(7).split("").join("_"),Fn=e=>{var t;const{pathname:n}=new URL(e,location.origin);return null===(t=n.split(".").pop())||void 0===t?void 0:t.toLowerCase()};var Hn=Object.freeze({__proto__:null,IVector3ToEuler:on,IVector3ToVector3:sn,MinHeap:pn,cloneDeep:yn,cloneMaterials:wn,deg2Euler:hn,disposeMaterials:An,error:e=>{console.error(tn+e)},euler2Deg:function(e){return e/(Math.PI/180)},exportGltf:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,i)=>{(new ht).parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:xn,getAsciiString:jn,getBoundingBox:an,getCubeTexture:gn,getExtension:Fn,getSpaceAttributeFromObject:un,getValueType:Un,gradientTexture:mn,hasOwn:(e,t)=>On.call(e,t),idleTask:Bn,isArray:Ln,isBoolean:Rn,isDate:e=>"Date"===Un(e),isFunction:kn,isNull:e=>"Null"===Un(e),isNumber:_n,isObject:Nn,isObjectBehindCamera:Dn,isObjectOccludeVisible:Cn,isObjectVisible:fn,isPromise:e=>"Promise"===Un(e),isString:Pn,isSymbol:e=>"Symbol"===Un(e),isUndefined:e=>"Undefined"===Un(e),log:nn,materialHandle:bn,parseFilePath:vn,randomString:zn,rotationAFix:cn,rotationAxisFix:ln,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:dn,warn:rn,xmlToJson:Mn});const Gn={"Linear.None":Mt.Linear.None,"Quadratic.In":Mt.Quadratic.In,"Quadratic.Out":Mt.Quadratic.Out,"Quadratic.InOut":Mt.Quadratic.InOut,"Cubic.In":Mt.Cubic.In,"Cubic.Out":Mt.Cubic.Out,"Cubic.InOut":Mt.Cubic.InOut,"Quartic.In":Mt.Quartic.In,"Quartic.Out":Mt.Quartic.Out,"Quartic.InOut":Mt.Quartic.InOut,"Quintic.In":Mt.Quintic.In,"Quintic.Out":Mt.Quintic.Out,"Quintic.InOut":Mt.Quintic.InOut,"Sinusoidal.In":Mt.Sinusoidal.In,"Sinusoidal.Out":Mt.Sinusoidal.Out,"Sinusoidal.InOut":Mt.Sinusoidal.InOut,"Exponential.In":Mt.Exponential.In,"Exponential.Out":Mt.Exponential.Out,"Exponential.InOut":Mt.Exponential.InOut,"Circular.In":Mt.Circular.In,"Circular.Out":Mt.Circular.Out,"Circular.InOut":Mt.Circular.InOut,"Elastic.In":Mt.Elastic.In,"Elastic.Out":Mt.Elastic.Out,"Elastic.InOut":Mt.Elastic.InOut,"Back.In":Mt.Back.In,"Back.Out":Mt.Back.Out,"Back.InOut":Mt.Back.InOut,"Bounce.In":Mt.Bounce.In,"Bounce.Out":Mt.Bounce.Out,"Bounce.InOut":Mt.Bounce.InOut};function Vn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return new Promise(((o,a)=>{const{duration:l=1e3,delay:c=0,repeat:h=!1,mode:u="Linear.None",yoyo:d=!1}=i,f=Gn[u],p=new Nt(e).to(t,l).easing(f).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));_n(h)?p.repeat(h):Rn(h)&&h&&p.repeat(1/0),p.yoyo(d),p.start()}))}class Yn{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.target=e,this.points=t,this.speed=1,this.reverse=!1,this.needsRotate=!0,this.index=1,this._tween=null,Object.assign(this,n)}get isPlaying(){var e;return!!(null===(e=this._tween)||void 0===e?void 0:e.isPlaying())}async play(){if(this.isPlaying)return!1;this.index=1;let e=this.points.slice();return this.reverse&&(e=e.reverse()),this._play(e)}async _play(e){var t,n;const{target:i}=this,r=null!==(t=this.speed)&&void 0!==t?t:1,s=this.index;let o=e[s-1];if(!o)return!0;o.isVector3||(o=sn(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=sn(a).clone()),a=a.clone();const l=o.distanceTo(a)/r;this.needsRotate&&(1===s&&i.parent&&i.position.copy(i.parent.worldToLocal(o.clone())),i.lookAt(a)),await Vn(o,a,{duration:l},((e,t)=>{var n;if(i.parent){const t=i.parent.worldToLocal(e.clone());i.position.copy(t)}null===(n=this.onUpdate)||void 0===n||n.call(this,e,t)}),(e=>{var t,n;1===s&&(null===(t=this.onStart)||void 0===t||t.call(this,e)),null===(n=this.onEveryStart)||void 0===n||n.call(this,e),this._tween=e})),null===(n=this.onPoint)||void 0===n||n.call(this,s,a),this.index++,await this._play(e)}pause(){var e;null===(e=this._tween)||void 0===e||e.pause()}resume(){var e;null===(e=this._tween)||void 0===e||e.resume()}stop(){var e;null===(e=this._tween)||void 0===e||e.stop(),this._tween=null}}var Qn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Wn(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}var Xn={},Zn={},Kn=function(e,t){return Kn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Kn(e,t)};var qn=function(){return qn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},qn.apply(this,arguments)};function Jn(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}var $n=Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function ei(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ti(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function ni(e){return this instanceof ni?(this.v=e,this):new ni(e)}var ii=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function ri(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function si(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var oi=Object.freeze({__proto__:null,get __assign(){return qn},__asyncDelegator:function(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:ni(e[i](t)),done:!1}:r?r(t):t}:r}},__asyncGenerator:function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof ni?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ei(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}},__await:ni,__awaiter:function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},__classPrivateFieldGet:ri,__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:si,__createBinding:$n,__decorate:function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},__esDecorate:function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",h=!t&&e?i.static?e:e.prototype:null,u=t||(h?Object.getOwnPropertyDescriptor(h,i.name):{}),d=!1,f=n.length-1;f>=0;f--){var p={};for(var g in i)p[g]="access"===g?{}:i[g];for(var g in i.access)p.access[g]=i.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[f])("accessor"===l?{get:u.get,set:u.set}:u[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(u.get=a),(a=o(m.set))&&(u.set=a),(a=o(m.init))&&r.push(a)}else(a=o(m))&&("field"===l?r.push(a):u[c]=a)}h&&Object.defineProperty(h,i.name,u),d=!0},__exportStar:function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||$n(t,e,n)},__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Kn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},__generator:function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&$n(t,e,n);return ii(t,e),t},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:function(e,t){return function(n,i){t(n,i,e)}},__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:ti,__rest:Jn,__runInitializers:function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ti(arguments[t]));return e},__spreadArray:function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},__spreadArrays:function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i},__values:ei}),ai=Wn(oi),li={},ci={},hi={},ui={};Object.defineProperty(ui,"__esModule",{value:!0});var di=function(){function e(t,n){if(void 0===n&&(n=null),this.nonEmpty=!1,t||n){if(!t)throw new Error("Parameter head cannot be null.");this.head=t,this.tail=n||e.NIL,this.nonEmpty=!0}else{if(e.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(e.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===e.NIL)return 1;for(var t=0,n=this;n.nonEmpty;)++t,n=n.tail;return t},enumerable:!0,configurable:!0}),e.prototype.prepend=function(t){return new e(t,this)},e.prototype.append=function(t){if(!t)return this;if(!this.nonEmpty)return new e(t);if(this.tail===e.NIL)return new e(t).prepend(this.head);for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;)i=i.tail=new e(r.head),r=r.tail;return i.tail=new e(t),n},e.prototype.insertWithPriority=function(t){if(!this.nonEmpty)return new e(t);var n=t.priority;if(n>this.head.priority)return this.prepend(t);for(var i=new e(this.head),r=i,s=this.tail;s.nonEmpty;){if(n>s.head.priority)return r.tail=s.prepend(t),i;r=r.tail=new e(s.head),s=s.tail}return r.tail=new e(t),i},e.prototype.filterNot=function(t){if(!this.nonEmpty||null==t)return this;if(t===this.head.listener)return this.tail;for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;){if(r.head.listener===t)return i.tail=r.tail,n;i=i.tail=new e(r.head),r=r.tail}return this},e.prototype.contains=function(e){if(!this.nonEmpty)return!1;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return!0;t=t.tail}return!1},e.prototype.find=function(e){if(!this.nonEmpty)return null;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return t.head;t=t.tail}return null},e.prototype.toString=function(){for(var e="",t=this;t.nonEmpty;)e+=t.head+" -> ",t=t.tail;return"[List "+(e+="NIL")+"]"},e.NIL=new e(null,null),e}();ui.SlotList=di;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});var pi=function(){function e(e,t,n,i){void 0===n&&(n=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=e,this._once=n,this._signal=t,this._priority=i,this.verifyListener(e)}return e.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},e.prototype.execute1=function(e){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[e].concat(this._params)):this._listener(e))},e.prototype.execute=function(e){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(e=e.concat(this._params));var t=e.length;0===t?this._listener():1===t?this._listener(e[0]):2===t?this._listener(e[0],e[1]):3===t?this._listener(e[0],e[1],e[2]):this._listener.apply(null,e)}},Object.defineProperty(e.prototype,"listener",{get:function(){return this._listener},set:function(e){if(null==e)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(e),this._listener=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this._params},set:function(e){this._params=e},enumerable:!0,configurable:!0}),e.prototype.remove=function(){this._signal.remove(this._listener)},e.prototype.verifyListener=function(e){if(null==e)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},e}();fi.Slot=pi,Object.defineProperty(hi,"__esModule",{value:!0});var gi=ui,mi=fi,vi=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=gi.SlotList.NIL,this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if(!(this._valueClasses[t]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+">."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){var t=this.slots.find(e);return t?(this.slots=this.slots.filterNot(e),t):null},e.prototype.removeAll=function(){this.slots=gi.SlotList.NIL},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=this.slots;if(s.nonEmpty)for(;s.nonEmpty;)s.head.execute(e),s=s.tail},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.registrationPossible(e,t)){var n=new mi.Slot(e,this,t);return this.slots=this.slots.prepend(n),n}return this.slots.find(e)},e.prototype.registrationPossible=function(e,t){if(!this.slots.nonEmpty)return!0;var n=this.slots.find(e);if(!n)return!0;if(n.once!==t)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},e}();hi.OnceSignal=vi,Object.defineProperty(ci,"__esModule",{value:!0});var yi=ai,bi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return yi.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(hi.OnceSignal);ci.Signal=bi,Object.defineProperty(li,"__esModule",{value:!0});var wi=ai,Ai=fi,xi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wi.__extends(t,e),t.prototype.addWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!1,t)},t.prototype.addOnceWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!0,t)},t.prototype.registerListener=function(e,t){return void 0===t&&(t=!1),this.registerListenerWithPriority(e,t)},t.prototype.registerListenerWithPriority=function(e,t,n){if(void 0===n&&(n=0),this.registrationPossible(e,t)){var i=new Ai.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(ci.Signal);li.PrioritySignal=xi,Object.defineProperty(Zn,"__esModule",{value:!0});var Si=ai,Ei=function(e){function t(t){void 0===t&&(t=null);for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=this;return n=1===n.length&&n[0]instanceof Array?n[0]:n,(r=e.call(this,n)||this)._target=t,r}return Si.__extends(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){e!==this._target&&(this.removeAll(),this._target=e)},enumerable:!0,configurable:!0}),t.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(null!==e[r]&&e[r].constructor!==this._valueClasses[r])throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=e[0];s&&(s.target&&(s=s.clone(),e[0]=s),s.target=this.target,s.currentTarget=this.target,s.signal=this);for(var o=this.slots;o.nonEmpty;)o.head.execute(e),o=o.tail;if(s&&s.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(s.currentTarget=a,a.onEventBubbled(s))););},t}(li.PrioritySignal);Zn.DeluxeSignal=Ei;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});var Di=function(){function e(e){void 0===e&&(e=!1),this._bubbles=e}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},set:function(e){this._signal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(e){this._target=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(e){this._currentTarget=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bubbles",{get:function(){return this._bubbles},set:function(e){this._bubbles=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){return new e(this._bubbles)},e}();Ti.GenericEvent=Di;var Ci={};Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.IOnceSignal=Symbol("IOnceSignal");var Bi={};Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.IPrioritySignal=Symbol("IPrioritySignal");var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.ISignal=Symbol("ISignal");var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.ISlot=Symbol("ISlot");var Oi={};Object.defineProperty(Oi,"__esModule",{value:!0});var Pi=fi,Ri=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if("function"!=typeof this._valueClasses[t])throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+"'>."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){return this.registerListener(e)},e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){if(this.slot&&this.slot.listener===e){var t=this.slot;return this.slot=null,t}return null},e.prototype.removeAll=function(){this.slot&&this.slot.remove()},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");this.slot&&this.slot.execute(e)},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new Pi.Slot(e,this,t)},e}();Oi.MonoSignal=Ri;var _i={};Object.defineProperty(_i,"__esModule",{value:!0});var Li=ai,Ni=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Li.__extends(t,e),t.prototype.addOnce=function(t){var n=e.prototype.addOnce.call(this,t);return this.isDispatched&&(n.execute(this.valueObjects),n.remove()),n},t.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(this.isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this.isDispatched=!0,this.valueObjects=t,e.prototype.dispatch.apply(this,t)},t}(hi.OnceSignal);_i.Promise=Ni,Object.defineProperty(Xn,"__esModule",{value:!0});var ki=Zn;Xn.DeluxeSignal=ki.DeluxeSignal;var Ui=Ti;Xn.GenericEvent=Ui.GenericEvent;var ji=Ci;Xn.IOnceSignal=ji.IOnceSignal;var zi=Bi;Xn.IPrioritySignal=zi.IPrioritySignal;var Fi=Ii;Xn.ISignal=Fi.ISignal;var Hi=Mi;Xn.ISlot=Hi.ISlot;var Gi=Oi;Xn.MonoSignal=Gi.MonoSignal;var Vi=hi;Xn.OnceSignal=Vi.OnceSignal;var Yi=li;Xn.PrioritySignal=Yi.PrioritySignal;var Qi=_i;Xn.Promise=Qi.Promise;var Wi=ci,Xi=Xn.Signal=Wi.Signal,Zi=fi;Xn.Slot=Zi.Slot;var Ki=ui;Xn.SlotList=Ki.SlotList;const qi=new c;qi.name="Scene";class Ji{constructor(e,t){this.signals=e,this.viewportState=t,this.scene=qi.clone(),this.scene.castShadow=!0,this.scene.receiveShadow=!0,this.selectedObjects={edge:[],stroke:[],opacity:[],highlight:[],emissive:[]},this.intersectsList={meshOfModelList:[],poiIconList:[],otherObjList:[],getAll:function(){return[...this.meshOfModelList,...this.poiIconList,...this.otherObjList]}}}addObject(e,t){if(this.viewportState.isDisposed)return this.removeObject(e),void rn("Scene is disposed");t?t.add(e):this.scene.add(e),this._triggerObjectAdded(e),this.signals.objectAdded.dispatch(e)}removeObject(e){function t(e){var t;e.map&&((t=e.map)&&t.isTexture&&t.dispose()),e.dispose()}e.traverse((e=>{if("Mesh"===e.type){const n=e;n.geometry.dispose(),bn(n.material,t)}e instanceof hl&&e.element.remove();const{meshOfModelList:n,poiIconList:i,otherObjList:r}=this.intersectsList,s=n.findIndex((t=>t.uuid===e.uuid)),o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid));s>-1&&this.intersectsList.meshOfModelList.splice(s,1),o>-1&&this.intersectsList.poiIconList.splice(o,1),a>-1&&this.intersectsList.otherObjList.splice(a,1)})),e.removeFromParent(),this.signals.objectRemoved.dispatch(e)}openSceneFog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:t=13426943,near:n=500,far:i=5e4}=e;this.scene.fog=new h(t,n,i),this.signals.sceneChanged.dispatch()}closeSceneFog(){this.scene.fog=null,this.signals.sceneChanged.dispatch()}edgeShow(e,t){const n=[],i=e=>{-1===this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid))&&n.push(e)};return Ln(e)?e.forEach((e=>i(e))):Nn(e)&&i(e),this.selectedObjects.edge=[...this.selectedObjects.edge,...n],this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge,options:t}),Promise.resolve()}unEdgeShow(e){e||(e=[...this.selectedObjects.edge]);const t=e=>{const t=this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.edge.splice(t,1),this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge})),Promise.resolve()};return Ln(e)?Promise.all(e.map((e=>t(e)))):Nn(e)?t(e):Promise.resolve()}strokeShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{isOpacityShow:n=!0,color:i=4647927,opacity:r=.2,edgeColor:s=61183,edgeOpacity:o=1}=t,a=e=>{if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const t=new ll({id:e.uuid});return e.traverse((n=>{if(n instanceof u){const i=new d(n.geometry,89),r=new f(i,new p({color:s,transparent:!0,opacity:o}));dn(r,n),e.attach(r),t.add(r)}})),e.userData.strokeGroup=t,this.addObject(t,e),this.selectedObjects.stroke.push(e),Promise.resolve()};return n&&this.opacityShow(e,{color:i,opacity:r}),Ln(e)?Promise.all(e.map((e=>a(e)))):Nn(e)?a(e):Promise.resolve()}unStrokeShow(e){e||(e=[...this.selectedObjects.stroke]);const t=e=>{if(!e.userData.strokeGroup)return Promise.resolve();this.removeObject(e.userData.strokeGroup),Reflect.deleteProperty(e.userData,"strokeGroup");const t=this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch(),this.unOpacityShow(e)),Promise.resolve()};return Ln(e)?Promise.all(e.map((e=>t(e)))):Nn(e)?t(e):Promise.resolve()}opacityShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="#fff",opacity:i=.8}=t;function r(e){return Reflect.construct(e.constructor,[{transparent:!0,depthWrite:!1,side:e.side,color:n,opacity:i}])}const s=e=>(-1!==this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof u){if(e.userData.material)return;e.userData.material=e.material,e.material=bn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return Ln(e)?Promise.all(e.map((e=>s(e)))):Nn(e)?s(e):Promise.resolve()}unOpacityShow(e){e||(e=[...this.selectedObjects.opacity]);const t=e=>new Promise((t=>{const n=this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.opacity.splice(n,1),e.traverse((e=>{if(e instanceof u){if(!e.userData.material)return;An(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ln(e)?Promise.all(e.map((e=>t(e)))):Nn(e)?t(e):Promise.resolve()}highlightShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=1}=t;function r(e){e instanceof g&&(e.color=new a(n),e.opacity=i,e.transparent=i<1)}const s=e=>(-1!==this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof u){if(e.userData.material)return;e.userData.material=e.material,e.material=wn(e.material),bn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return Ln(e)?Promise.all(e.map((e=>s(e)))):Nn(e)?s(e):Promise.resolve()}unHighlightShow(e){e||(e=[...this.selectedObjects.highlight]);const t=e=>new Promise((t=>{const n=this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.highlight.splice(n,1),e.traverse((e=>{if(e instanceof u){if(!e.userData.material)return;An(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ln(e)?Promise.all(e.map((e=>t(e)))):Nn(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=.3,maxOpacity:r=1,minOpacity:s=0,duration:o=1e3}=t;function a(e){e instanceof g&&(e.emissive.set(n),e.emissiveIntensity=i,0!==o&&Vn({emissiveIntensity:r},{emissiveIntensity:s},{duration:o,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const l=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof u){if(e.userData.material)return;e.userData.material=e.material,e.material=wn(e.material),bn(e.material,a)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return Ln(e)?Promise.all(e.map((e=>l(e)))):Nn(e)?l(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&Vt.remove(e.userData.animation)}e||(e=[...this.selectedObjects.emissive]);const n=e=>new Promise((n=>{const i=this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid));-1===i&&n(),this.selectedObjects.emissive.splice(i,1),e.traverse((e=>{if(e instanceof u){if(!e.userData.material)return;bn(e.material,t),An(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return Ln(e)?Promise.all(e.map((e=>n(e)))):Nn(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof al)if("Model"===e.stype)e.traverse((e=>{if(e instanceof u){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype){-1===this.intersectsList.poiIconList.findIndex((t=>t.uuid===e.icon.uuid))&&this.intersectsList.poiIconList.push(e.icon)}else"Group"===e.stype?e.children.forEach((e=>this._triggerObjectAdded(e))):e.isObject3D&&e.traverse((e=>{if(e instanceof u){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof u){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class $i extends v{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof $i&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const er=new t,tr=new m,nr=new m,ir=new t,rr=new t;class sr{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={objects:new WeakMap};this.domElement.style.overflow="hidden",this.getSize=function(){return{width:t,height:n}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),tr.copy(t.matrixWorldInverse),nr.multiplyMatrices(t.projectionMatrix,tr),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof $i&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared})),n=t.length;for(let e=0,i=t.length;e<i;e++)t[e].element.style.zIndex=""+(n-e)}(e)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px"};const o=(e,t,n)=>{var l;if(e instanceof $i){const t=e.parent;if(t.occlude){const t=!Dn(e,this.viewport.camera)&&Cn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}er.setFromMatrixPosition(e.matrixWorld),er.applyMatrix4(nr);const o=fn(e)&&er.z>=-1&&er.z<=1&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==o&&(null===(l=t.onChange)||void 0===l||l.call(t,o),t.elementAutoDisplay&&(e.element.style.display=!0===o?"":"none")),e.userData.prevVisible=o,!0===o){const t=e.element;t.style.transform="translate(-50%,-50%) translate("+(er.x*i+i)+"px,"+(-er.y*r+r)+"px)",t.parentNode!==this.domElement&&this.domElement.appendChild(t)}const c={distanceToCameraSquared:a(n,e)};s.objects.set(e,c)}for(let i=0,r=e.children.length;i<r;i++)o(e.children[i],t,n)};function a(e,t){return ir.setFromMatrixPosition(e.matrixWorld),rr.setFromMatrixPosition(t.matrixWorld),ir.distanceToSquared(rr)}}}const or=new t,ar=new r,lr=new t;class cr extends v{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof cr&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}class hr extends cr{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const ur=new m,dr=new m;class fr{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={camera:{fov:0,style:""},objects:new WeakMap};this.domElement.style.overflow="hidden";const o=document.createElement("div");o.style.transformOrigin="0 0",this.domElement.appendChild(o);const a=document.createElement("div");function l(e){return Math.abs(e)<1e-10?0:e}function c(e){const t=e.elements;return"matrix3d("+l(t[0])+","+l(-t[1])+","+l(t[2])+","+l(t[3])+","+l(t[4])+","+l(-t[5])+","+l(t[6])+","+l(t[7])+","+l(t[8])+","+l(-t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(-t[13])+","+l(t[14])+","+l(t[15])+")"}function h(e){const t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+l(t[0])+","+l(t[1])+","+l(t[2])+","+l(t[3])+","+l(-t[4])+","+l(-t[5])+","+l(-t[6])+","+l(-t[7])+","+l(t[8])+","+l(t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(t[13])+","+l(t[14])+","+l(t[15])+")")}a.style.transformStyle="preserve-3d",o.appendChild(a),this.getSize=()=>({width:t,height:n}),this.render=(e,h)=>{const d=h.projectionMatrix.elements[5]*r;s.camera.fov!==d&&(o.style.perspective=h instanceof y?d+"px":"",s.camera.fov=d),h.view&&h.view.enabled?(o.style.transform=`translate( ${-h.view.offsetX*(t/h.view.width)}px, ${-h.view.offsetY*(n/h.view.height)}px )`,o.style.transform+=`scale( ${h.view.fullWidth/h.view.width}, ${h.view.fullHeight/h.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===h.parent&&!0===h.matrixWorldAutoUpdate&&h.updateMatrixWorld();let f=0,p=0;h instanceof b&&(f=-(h.right+h.left)/2,p=(h.top+h.bottom)/2);const g=h.view&&h.view.enabled?h.view.height/h.view.fullHeight:1,m=(h instanceof b?`scale( ${g} )scale(`+d+")translate("+l(f)+"px,"+l(p)+"px)"+c(h.matrixWorldInverse):`scale( ${g} )translateZ(`+d+"px)"+c(h.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==m&&(a.style.transform=m,s.camera.style=m),u(e,e,h)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px",o.style.width=e+"px",o.style.height=s+"px",a.style.width=e+"px",a.style.height=s+"px"};const u=(e,t,n,i)=>{var r;if(e instanceof cr){const t=e.parent;if(t.occlude){const t=!Dn(e,this.viewport.camera)&&Cn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=fn(e)&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==i&&(null===(r=t.onChange)||void 0===r||r.call(t,i),t.elementAutoDisplay&&(e.element.style.display=!0===i?"":"none")),e.userData.prevVisible=i,!0===i){let t;e instanceof hr?(ur.copy(n.matrixWorldInverse),ur.transpose(),0!==e.rotation2D&&ur.multiply(dr.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(or,ar,lr),ur.setPosition(or),ur.scale(lr),ur.elements[3]=0,ur.elements[7]=0,ur.elements[11]=0,ur.elements[15]=1,t=h(ur)):t=h(e.matrixWorld);const i=e.element,r=s.objects.get(e);if(void 0===r||r.style!==t){i.style.transform=t;const n={style:t};s.objects.set(e,n)}i.parentNode!==a&&a.appendChild(i)}}for(let i=0,r=e.children.length;i<r;i++)u(e.children[i],t,n)}}}class pr{constructor(e){this.viewport=e,this.internalOptions={enableRenderCss2D:!1,enableRenderCss3D:!1},this.container=this._initContainer(),this.renderer=this._initRenderer(),this.rendererCSS2D=this._initRenderCSS2D(),this.rendererCSS3D=this._initRenderCSS3D(),this.interactiveContainer=this._initInteractiveContainer()}setInternalState(e,t){this.internalOptions[e]=t}getWidth(){return this.renderer.domElement.width}getHeight(){return this.renderer.domElement.height}getMouseRelativeConRatio(e){const t=this.container.getBoundingClientRect();return[(e.offsetX-t.left)/t.width,(e.offsetY-t.top)/t.height]}getMousePoint(e){const t=new w(0,0);return t.fromArray(this.getMouseRelativeConRatio(e)),t}_initContainer(){const e=document.createElement("div");return e.style.position="relative",e.style.width="100%",e.style.height="100%",e}_initRenderer(){const{background:e={},logarithmicDepthBuffer:t}=this.viewport.options,{color:n,alpha:i}=e,r=new A({alpha:i,logarithmicDepthBuffer:t,preserveDrawingBuffer:!0,antialias:!1,stencil:!1,depth:!1,powerPreference:"high-performance"}),s=i?0:1,{offsetWidth:o,offsetHeight:a}=this.container;return r.setSize(o,a),r.setClearColor(n||0,s),r.setPixelRatio(self.devicePixelRatio),r.localClippingEnabled=!0,r.sortObjects=!0,r.shadowMap.enabled=!0,r.shadowMap.type=x,this.container.appendChild(r.domElement),r}_initRenderCSS2D(){const e=new sr(this.viewport);return e.domElement.id="ssp_view_2DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initRenderCSS3D(){const e=new fr(this.viewport);return e.domElement.id="ssp_view_3DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initInteractiveContainer(){return this.rendererCSS3D.domElement}}const gr=new m,mr=(e,t)=>{const i=gr.clone(),r=gr.clone(),s=gr.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},vr=mr(-Math.PI/2,-Math.PI/4),yr=mr(Math.PI/2,-Math.PI/4),br=mr(-Math.PI/4,-Math.PI/4),wr=mr(Math.PI/4,-Math.PI/4),Ar=mr(1.25*Math.PI,-Math.PI/4),xr=mr(.75*Math.PI,-Math.PI/4),Sr={LEFT:new n(0,-Math.PI/2,0),RIGHT:new n(0,Math.PI/2,0),FRONT:new n(0,0,0),BACK:new n(0,Math.PI,0),TOP:new n(-Math.PI/2,0,0),BOTTOM:new n(Math.PI/2,0,0),FRONTTOP:new n(-Math.PI/4,0,0),BACKTOP:new n(Math.PI/4,Math.PI,0),LEFTTOP:new n(vr.x,vr.y,vr.z),RIGHTTOP:new n(yr.x,yr.y,yr.z),LEFTFRONTTOP:new n(br.x,br.y,br.z),RIGHTFRONTTOP:new n(wr.x,wr.y,wr.z),LEFTBACKTOP:new n(Ar.x,Ar.y,Ar.z),RIGHTBACKTOP:new n(xr.x,xr.y,xr.z)},Er=e=>_n(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),Tr=new t,Dr=new n,Cr=new y(50,1,.1,5e5);Cr.position.set(500,1e3,500),Cr.lookAt(Tr.set(0,0,0)),Cr.name="Camera";class Br{constructor(e){this.viewport=e,this.mainCamera=Cr.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=Cr.clone();return t.name=e,this.cameras[e]=t,t}removeCamera(e){return"fullFreeCamera"!==e&&(delete this.cameras[e],!0)}setCurrentCamera(e){this.currentCamera=this.viewport.camera=e,this.viewport.signals.cameraObjectChange.dispatch()}getMainCamera(){return this.mainCamera}getCameraViewpoint(){if("free"===this.viewport.controls.options.type)return{position:this.currentCamera.position.clone(),rotation:{x:this.currentCamera.rotation.x,y:this.currentCamera.rotation.y,z:this.currentCamera.rotation.z}};{const e=this.viewport.controls.currentControls;return{position:this.currentCamera.position.clone(),target:e.target.clone()}}}setCameraViewpoint(e){if("free"===this.viewport.controls.options.type&&Nn(e)){const{position:t,rotation:n}=e;this.currentCamera.position.set(t.x,t.y,t.z),this.currentCamera.rotation.set(n.x,n.y,n.z)}else if(Nn(e)){const{position:t,target:n}=e,i=this.viewport.controls.currentControls;this.currentCamera.position.set(t.x,t.y,t.z),i.target.set(n.x,n.y,n.z)}this.viewport.signals.cameraChange.dispatch(this.currentCamera.position.clone())}moveTo(e,t){return Vn(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new r).setFromEuler(e);return Vn({t:0},{t:1},t,(e=>{let{t:t}=e;this.currentCamera.quaternion.slerpQuaternions(n,i,t)}))}async flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(Pn(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?Dr.copy(this.currentCamera.rotation):Sr[e]&&Dr.copy(Sr[e])}else t instanceof n?Dr.copy(t):Nn(t)&&Dr.set(t.x,t.y,t.z);Dr.copy(cn(this.currentCamera.rotation,Dr.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(Dr,i)])}async flyToBoundingBox(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(e.isEmpty())return void rn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Pn(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=Sr[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&rn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=on(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(Tr),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new m;r.lookAt(s,t,i.object.up),n=Dr.setFromRotationMatrix(r)}await this.flyTo(s,n,i)}flyToObj(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof pl||e instanceof hl){const{padding:t=50}=i,r=Er(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=an(e),o=s.getSize(Tr);let a=0;if(Pn(r)){const e=Math.max(o.x,o.y,o.z);a=Er(r)*e}else a=r;let l=a,c=a;if(a<0){const e=Math.min(o.x,o.z),t=o.y-1;l=Math.abs(a)>e?-e:a,c=Math.abs(l)>t?-t:l}return 0!==r&&(s.max.add(Tr.set(l/2,c/2,l/2)),s.min.sub(Tr.set(l/2,c/2,l/2))),s.isEmpty()&&(Tr.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(Tr,new t(0,0,0))),this.flyToBoundingBox(s,n,i)}}surroundOnTarget(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{speed:n=1,angle:i=360,onStart:r}=t,s=sn(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return Vn({angle:0},{angle:Math.PI/180*a},{duration:a/360*5e3/n},(e=>{const t=i>0?e.angle:2*Math.PI-e.angle;if(this.currentCamera.position.x=Math.sin(t)*o+s.x,this.currentCamera.position.z=Math.cos(t)*o+s.z,"orbit"===this.viewport.controls.options.type){const e=this.viewport.controls.currentControls;e.target.copy(s),e.update()}else this.currentCamera.lookAt(s)}),r)}surroundOnObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(new i).setFromObject(e).getCenter(Tr);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(Tr);(new t).subVectors(i,n).normalize();let r=new S;r=e.getBoundingSphere(r);const s=this.currentCamera.fov/2*Math.PI/180,o=Math.sin(s),a=r.radius/o,l=new t;this.currentCamera.getWorldDirection(l);const c=l.clone();return c.multiplyScalar(-a),i.clone().add(c)}getObjectLabelPos(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof al&&(e=(new i).setFromObject(e)),e.isEmpty())return rn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(Tr),i=e.max.clone().sub(e.min),r=Math.max(i.x,i.y,i.z),o=t.clone(),a=e=>{const t=(s-.5)*Math.abs(r),n=Math.max(t,this.viewport.camera.near);o.add(e.multiplyScalar(n))};let l;return l=Pn(n)?Sr[n.toLocaleUpperCase()]:on(n),a(Tr.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(Tr).clone():new t}}
1
+ import*as e from"three";import{Vector3 as t,Euler as n,Box3 as i,Quaternion as r,CubeTextureLoader as s,RGBAFormat as o,Color as a,Texture as l,Scene as c,Fog as h,Mesh as u,EdgesGeometry as d,LineSegments as f,LineBasicMaterial as p,MeshStandardMaterial as g,Matrix4 as m,Object3D as v,PerspectiveCamera as y,OrthographicCamera as b,Vector2 as w,WebGLRenderer as A,PCFSoftShadowMap as x,Sphere as S,Camera as E,sRGBEncoding as T,UnsignedByteType as D,MeshNormalMaterial as C,WebGLRenderTarget as B,NearestFilter as I,DepthTexture as M,DepthStencilFormat as O,UnsignedInt248Type as P,UnsignedIntType as R,LinearEncoding as _,Uniform as L,RepeatWrapping as N,LoadingManager as k,LinearFilter as U,ShaderMaterial as j,NoBlending as z,RGBADepthPacking as F,REVISION as H,EventDispatcher as G,BackSide as V,DoubleSide as Y,FrontSide as Q,MeshDepthMaterial as W,FloatType as X,BasicDepthPacking as Z,DataTexture as K,Vector4 as q,BufferGeometry as J,BufferAttribute as $,Material as ee,LuminanceFormat as te,RedFormat as ne,RGFormat as ie,ShaderChunk as re,WebGLCubeRenderTarget as se,CubeCamera as oe,PMREMGenerator as ae,HalfFloatType as le,WebGLMultipleRenderTargets as ce,FramebufferTexture as he,Matrix3 as ue,TangentSpaceNormalMap as de,GLSL3 as fe,VideoTexture as pe,GLBufferAttribute as ge,InterleavedBufferAttribute as me,Frustum as ve,MOUSE as ye,TOUCH as be,Spherical as we,TextureLoader as Ae,MeshBasicMaterial as xe,PlaneGeometry as Se,Raycaster as Ee,Clock as Te,AnimationMixer as De,EquirectangularReflectionMapping as Ce,ACESFilmicToneMapping as Be,AnimationClip as Ie,NoToneMapping as Me,LinearToneMapping as Oe,ReinhardToneMapping as Pe,CineonToneMapping as Re,Sprite as _e,SpriteMaterial as Le,SphereGeometry as Ne,CircleGeometry as ke,Float32BufferAttribute as Ue,ShapeGeometry as je,Shape as ze,AmbientLight as Fe,DirectionalLight as He,HemisphereLight as Ge,SpotLight as Ve,PointLight as Ye,RectAreaLight as Qe,Loader as We,Group as Xe,LinearMipMapLinearFilter as Ze,ImageLoader as Ke,SkinnedMesh as qe,GridHelper as Je,AxesHelper as $e,Box3Helper as et,DirectionalLightHelper as tt,HemisphereLightHelper as nt,SpotLightHelper as it,PointLightHelper as rt,Box2 as st,Plane as ot,CanvasTexture as at,Line3 as lt,MeshPhongMaterial as ct}from"three";export*from"three";import{GLTFExporter as ht}from"three/examples/jsm/exporters/GLTFExporter.js";import{MeshBVH as ut,computeBoundsTree as dt,disposeBoundsTree as ft,acceleratedRaycast as pt}from"three-mesh-bvh";import{RoomEnvironment as gt}from"three/examples/jsm/environments/RoomEnvironment.js";import{RGBELoader as mt}from"three/examples/jsm/loaders/RGBELoader.js";import vt from"three/examples/jsm/libs/stats.module.js";import{Sky as yt}from"three/examples/jsm/objects/Sky.js";import{deinterleaveGeometry as bt}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{WorkerPool as wt}from"three/examples/jsm/utils/WorkerPool.js";import{RectAreaLightUniformsLib as At}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{FBXLoader as xt}from"three/examples/jsm/loaders/FBXLoader.js";import{TGALoader as St}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as Et}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Tt}from"three/examples/jsm/loaders/DRACOLoader.js";import{RectAreaLightHelper as Dt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Ct,Bt="soonspacejs",It="2.6.6",Mt={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-Mt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*Mt.Bounce.In(2*e):.5*Mt.Bounce.Out(2*e-1)+.5}}},Ot="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},Pt=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=Ot()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],s=!t;r&&!1===r.update(e,s)&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),Rt={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=Rt.Utils.Linear;return t<0?s(e[0],e[1],i):t>1?s(e[n],e[n-1],n-i):s(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,s=Rt.Utils.Bernstein,o=0;o<=i;o++)n+=r(1-t,i-o)*r(t,o)*e[o]*s(i,o);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=Rt.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),s(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(s(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):s(e[r?r-1:0],e[r],e[n<r+1?n:r+1],e[n<r+2?n:r+2],i-r)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=Rt.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(Ct=[1],function(e){var t=1;if(Ct[e])return Ct[e];for(var n=e;n>1;n--)t*=n;return Ct[e]=t,t}),CatmullRom:function(e,t,n,i,r){var s=.5*(n-e),o=.5*(i-t),a=r*r;return(2*t-2*n+s+o)*(r*a)+(-3*t+3*n-2*s-o)*a+s*r+t}}},_t=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Lt=new Pt,Nt=function(){function e(e,t){void 0===t&&(t=Lt),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Mt.Linear.None,this._interpolationFunction=Rt.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=_t.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?Ot()+parseFloat(e):e:Ot(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,i){for(var r in n){var s=e[r],o=Array.isArray(s),a=o?"array":typeof s,l=!o&&Array.isArray(n[r]);if("undefined"!==a&&"function"!==a){if(l){var c=n[r];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,s)),n[r]=[s].concat(c)}if("object"!==a&&!o||!s||l)void 0===t[r]&&(t[r]=s),o||(t[r]*=1),i[r]=l?n[r].slice().reverse():t[r]||0;else{for(var h in t[r]=o?[]:{},s)t[r][h]=s[h];i[r]=o?[]:{},this._setupProperties(s,t[r],n[r],i[r])}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=Ot()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=Ot()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=Ot()),void 0===t&&(t=!0),this._isPaused)return!0;var n,i,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>r)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),i=(e-this._startTime)/this._duration,i=0===this._duration||i>1?1:i;var s=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),1===i){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,a=this._chainedTweens.length;o<a;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,i){for(var r in n)if(void 0!==t[r]){var s=t[r]||0,o=n[r],a=Array.isArray(e[r]),l=Array.isArray(o);!a&&l?e[r]=this._interpolationFunction(o,i):"object"==typeof o&&o?this._updateProperties(e[r],s,o,i):"number"==typeof(o=this._handleRelativeValue(s,o))&&(e[r]=s+(o-s)*i)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),kt=_t.nextId,Ut=Lt,jt=Ut.getAll.bind(Ut),zt=Ut.removeAll.bind(Ut),Ft=Ut.add.bind(Ut),Ht=Ut.remove.bind(Ut),Gt=Ut.update.bind(Ut),Vt={Easing:Mt,Group:Pt,Interpolation:Rt,now:Ot,Sequence:_t,nextId:kt,Tween:Nt,VERSION:"18.6.4",getAll:jt,removeAll:zt,add:Ft,remove:Ht,update:Gt};const Yt="[soonspacejs]: ",Qt="Group",Wt="Light",Xt="Model",Zt="Poi",Kt="PoiNode",qt="Canvas3D",Jt="Topology",$t="Helper",en="PluginObject",tn="In soonspacejs: ",nn=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},rn=e=>{console.warn(tn+e)};function sn(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function on(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function an(e){return new i(new t(0,0,0),new t(500,500,500)).setFromObject(e)}function ln(e,t,n){const i=n.clone();return Math.abs(t[e]-n[e])>Math.PI&&(t[e]>n[e]?i[e]+=2*Math.PI:i[e]-=2*Math.PI),i}function cn(e,t){const i=ln("x",e,t),r=ln("y",e,t),s=ln("z",e,t);return new n(i.x,r.y,s.z,t.order)}function hn(e){return Math.PI/180*e}function un(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function dn(e,t){const n=un(t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);e.position.copy(n.position),e.rotation.copy(n.rotation),e.scale.copy(n.scale)}function fn(e){return!!e.visible&&(!e.parent||fn(e.parent))}class pn{constructor(){this.min=null,this.roots=[],this.nodes=new Map}shift(){const e=this.min;if(null===e||this.roots.length<1)return this.min=null,e;this.remove(e),this.roots.length>50&&this.consolidate();let t=1/0;const n=this.roots.length;for(let e=0;e<n;e++){const n=this.roots[e],i=this.getDistance(n);i<t&&(t=i,this.min=n)}return e}consolidate(){const e=[[],[],[],[],[],[],[]],t=e.length-1,n=this.roots.length;for(let i=0;i<n;i++){const n=this.roots[i],r=this.nodes.get(n);r&&r.depth<t&&e[r.depth].push(n)}for(let n=0;n<=t;n++)for(;e[n].length>1;){const i=e[n].shift(),r=e[n].shift(),s=n+1;let o=-1;if(void 0!==i&&void 0!==r){const n=this.nodes.get(i),a=this.nodes.get(r);n&&a&&(n.distance<a.distance?(n.depth=s,n.children.push(r),a.parent=i,s<=t&&e[s].push(i),o=this.roots.indexOf(r)):(a.depth=s,a.children.push(i),n.parent=r,s<=t&&e[s].push(r),o=this.roots.indexOf(i)))}o>-1&&this.roots.splice(o,1)}}add(e,t){if(this.nodes.set(e,{nodeIndex:e,distance:t,depth:0,parent:null,children:[]}),null===this.min)this.min=e;else{const n=this.nodes.get(this.min);n&&t<n.distance&&(this.min=e)}this.roots.push(e)}update(e,t){this.remove(e),this.add(e,t)}remove(e){var t,n;if(!this.nodes.has(e))return;const i=null===(t=this.nodes.get(e))||void 0===t?void 0:t.children;if(i&&i.length>0)for(let t=0;t<i.length;t++){const n=i[t],r=this.nodes.get(n),s=this.nodes.get(e);r&&s&&(r.parent=s.parent),r&&null===r.parent&&this.roots.push(n)}let r=null===(n=this.nodes.get(e))||void 0===n?void 0:n.parent;if(null===r){const t=this.roots.indexOf(e);t>-1&&this.roots.splice(t,1)}else for(;r;){const e=this.nodes.get(r);e&&(e.depth--,r=e.parent)}}getDistance(e){const t=this.nodes.get(e);return t?t.distance:1/0}}function gn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"];return new Promise((n=>{(new s).setPath(e).load(t,(e=>{e.format=o,n(e)}))}))}function mn(e){if(!e)return null;const{colors:t,stops:n,size:i=1024}=e,r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;r.width=16,r.height=i;const o=s.createLinearGradient(0,0,0,i),c=new a,h=t.map((e=>c.set(e).getStyle()));for(let e=0,t=h.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,h[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const u=new l(r);return u.needsUpdate=!0,u}const vn=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function yn(e){return Ln(e)?function(e){return e.map((e=>yn(e)))}(e):Nn(e)?function(e){if(Nn(e)){const t={};for(const n in e)t[n]=yn(e[n]);return t}return e}(e):e}const bn=(e,t)=>Ln(e)?e.map(t):t(e),wn=e=>bn(e,(e=>e.clone())),An=e=>bn(e,(e=>e.dispose())),xn=async e=>{const t=await fetch(e);if(200===t.status)return t;throw new Error(`Failed to fetch file: ${e}`)},Sn=new t,En=new t,Tn=new t;function Dn(e,t){const n=Sn.setFromMatrixPosition(e.matrixWorld),i=En.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(Tn);return r.angleTo(s)>Math.PI/2}function Cn(e,t,n,i){const r=Sn.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(s,t);const o=n.intersectObjects(i,!0);if(o.length){const e=o[0].distance;return r.distanceTo(n.ray.origin)<e}return!0}const Bn=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var In=function(){function e(){}return e.prototype.toJson=function(e,t){var n=this.xmlStringToXmlDom(e),i=this.xmlToJson(n);return t?(t.removeLineBreaks&&this.removeLineBreaks(i),t.removeComments&&this.removeCommentProperties(i),t.transformTextOnly&&this.transformTextOnly(i),i):i},e.prototype.xmlStringToXmlDom=function(e){return(new DOMParser).parseFromString(e,"text/xml")},e.prototype.removeLineBreaks=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#text"===n&&Array.isArray(e[n])&&delete e[n],"object"==typeof e[n]&&t.removeLineBreaks(e[n])}))},e.prototype.removeCommentProperties=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#comment"===n&&delete e[n],"object"==typeof e[n]&&t.removeCommentProperties(e[n])}))},e.prototype.transformTextOnly=function(e){var t=this;Object.keys(e).forEach((function(n,i){var r=Object.keys(e[n]).length>1,s=Object.keys(e[n])[0];r||"object"==typeof e[n][s]?t.transformTextOnly(e[n]):"object"==typeof e[n]&&e[n]["#text"]&&(e[n]=e[n]["#text"])}))},e.prototype.xmlToJson=function(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t._attributes={};for(var n=0;n<e.attributes.length;n++){var i=e.attributes.item(n);t._attributes[i.nodeName]=i.nodeValue}}}else 3==e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var r=0;r<e.childNodes.length;r++){var s=e.childNodes.item(r),o=s.nodeName;if(void 0===t[o])t[o]=this.xmlToJson(s);else{if(void 0===t[o].push){var a=t[o];t[o]=[],t[o].push(a)}t[o].push(this.xmlToJson(s))}}return t},e}();function Mn(e){return xn(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new In).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}const On=Object.prototype.hasOwnProperty,Pn=e=>"String"===Un(e),Rn=e=>"Boolean"===Un(e),_n=e=>"Number"===Un(e),Ln=Array.isArray,Nn=e=>"Object"===Un(e),kn=e=>"Function"===Un(e),Un=e=>Object.prototype.toString.call(e).slice(8,-1),jn=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),zn=()=>Yt+Math.random().toString(36).substring(7).split("").join("_"),Fn=e=>{var t;const{pathname:n}=new URL(e,location.origin);return null===(t=n.split(".").pop())||void 0===t?void 0:t.toLowerCase()};var Hn=Object.freeze({__proto__:null,IVector3ToEuler:on,IVector3ToVector3:sn,MinHeap:pn,cloneDeep:yn,cloneMaterials:wn,deg2Euler:hn,disposeMaterials:An,error:e=>{console.error(tn+e)},euler2Deg:function(e){return e/(Math.PI/180)},exportGltf:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,i)=>{(new ht).parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:xn,getAsciiString:jn,getBoundingBox:an,getCubeTexture:gn,getExtension:Fn,getSpaceAttributeFromObject:un,getValueType:Un,gradientTexture:mn,hasOwn:(e,t)=>On.call(e,t),idleTask:Bn,isArray:Ln,isBoolean:Rn,isDate:e=>"Date"===Un(e),isFunction:kn,isNull:e=>"Null"===Un(e),isNumber:_n,isObject:Nn,isObjectBehindCamera:Dn,isObjectOccludeVisible:Cn,isObjectVisible:fn,isPromise:e=>"Promise"===Un(e),isString:Pn,isSymbol:e=>"Symbol"===Un(e),isUndefined:e=>"Undefined"===Un(e),log:nn,materialHandle:bn,parseFilePath:vn,randomString:zn,rotationAFix:cn,rotationAxisFix:ln,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:dn,warn:rn,xmlToJson:Mn});const Gn={"Linear.None":Mt.Linear.None,"Quadratic.In":Mt.Quadratic.In,"Quadratic.Out":Mt.Quadratic.Out,"Quadratic.InOut":Mt.Quadratic.InOut,"Cubic.In":Mt.Cubic.In,"Cubic.Out":Mt.Cubic.Out,"Cubic.InOut":Mt.Cubic.InOut,"Quartic.In":Mt.Quartic.In,"Quartic.Out":Mt.Quartic.Out,"Quartic.InOut":Mt.Quartic.InOut,"Quintic.In":Mt.Quintic.In,"Quintic.Out":Mt.Quintic.Out,"Quintic.InOut":Mt.Quintic.InOut,"Sinusoidal.In":Mt.Sinusoidal.In,"Sinusoidal.Out":Mt.Sinusoidal.Out,"Sinusoidal.InOut":Mt.Sinusoidal.InOut,"Exponential.In":Mt.Exponential.In,"Exponential.Out":Mt.Exponential.Out,"Exponential.InOut":Mt.Exponential.InOut,"Circular.In":Mt.Circular.In,"Circular.Out":Mt.Circular.Out,"Circular.InOut":Mt.Circular.InOut,"Elastic.In":Mt.Elastic.In,"Elastic.Out":Mt.Elastic.Out,"Elastic.InOut":Mt.Elastic.InOut,"Back.In":Mt.Back.In,"Back.Out":Mt.Back.Out,"Back.InOut":Mt.Back.InOut,"Bounce.In":Mt.Bounce.In,"Bounce.Out":Mt.Bounce.Out,"Bounce.InOut":Mt.Bounce.InOut};function Vn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return new Promise(((o,a)=>{const{duration:l=1e3,delay:c=0,repeat:h=!1,mode:u="Linear.None",yoyo:d=!1}=i,f=Gn[u],p=new Nt(e).to(t,l).easing(f).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));_n(h)?p.repeat(h):Rn(h)&&h&&p.repeat(1/0),p.yoyo(d),p.start()}))}class Yn{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.target=e,this.points=t,this.speed=1,this.reverse=!1,this.needsRotate=!0,this.index=1,this._tween=null,Object.assign(this,n)}get isPlaying(){var e;return!!(null===(e=this._tween)||void 0===e?void 0:e.isPlaying())}async play(){if(this.isPlaying)return!1;this.index=1;let e=this.points.slice();return this.reverse&&(e=e.reverse()),this._play(e)}async _play(e){var t,n;const{target:i}=this,r=null!==(t=this.speed)&&void 0!==t?t:1,s=this.index;let o=e[s-1];if(!o)return!0;o.isVector3||(o=sn(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=sn(a).clone()),a=a.clone();const l=o.distanceTo(a)/r;this.needsRotate&&(1===s&&i.parent&&i.position.copy(i.parent.worldToLocal(o.clone())),i.lookAt(a)),await Vn(o,a,{duration:l},((e,t)=>{var n;if(i.parent){const t=i.parent.worldToLocal(e.clone());i.position.copy(t)}null===(n=this.onUpdate)||void 0===n||n.call(this,e,t)}),(e=>{var t,n;1===s&&(null===(t=this.onStart)||void 0===t||t.call(this,e)),null===(n=this.onEveryStart)||void 0===n||n.call(this,e),this._tween=e})),null===(n=this.onPoint)||void 0===n||n.call(this,s,a),this.index++,await this._play(e)}pause(){var e;null===(e=this._tween)||void 0===e||e.pause()}resume(){var e;null===(e=this._tween)||void 0===e||e.resume()}stop(){var e;null===(e=this._tween)||void 0===e||e.stop(),this._tween=null}}var Qn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Wn(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}var Xn={},Zn={},Kn=function(e,t){return Kn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Kn(e,t)};var qn=function(){return qn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},qn.apply(this,arguments)};function Jn(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}var $n=Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function ei(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ti(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function ni(e){return this instanceof ni?(this.v=e,this):new ni(e)}var ii=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function ri(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function si(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var oi=Object.freeze({__proto__:null,get __assign(){return qn},__asyncDelegator:function(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:ni(e[i](t)),done:!1}:r?r(t):t}:r}},__asyncGenerator:function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof ni?Promise.resolve(n.value.v).then(l,c):h(s[0][2],n)}catch(e){h(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ei(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}},__await:ni,__awaiter:function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},__classPrivateFieldGet:ri,__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:si,__createBinding:$n,__decorate:function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},__esDecorate:function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",h=!t&&e?i.static?e:e.prototype:null,u=t||(h?Object.getOwnPropertyDescriptor(h,i.name):{}),d=!1,f=n.length-1;f>=0;f--){var p={};for(var g in i)p[g]="access"===g?{}:i[g];for(var g in i.access)p.access[g]=i.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[f])("accessor"===l?{get:u.get,set:u.set}:u[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(u.get=a),(a=o(m.set))&&(u.set=a),(a=o(m.init))&&r.push(a)}else(a=o(m))&&("field"===l?r.push(a):u[c]=a)}h&&Object.defineProperty(h,i.name,u),d=!0},__exportStar:function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||$n(t,e,n)},__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Kn(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},__generator:function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&$n(t,e,n);return ii(t,e),t},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:function(e,t){return function(n,i){t(n,i,e)}},__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:ti,__rest:Jn,__runInitializers:function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ti(arguments[t]));return e},__spreadArray:function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},__spreadArrays:function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i},__values:ei}),ai=Wn(oi),li={},ci={},hi={},ui={};Object.defineProperty(ui,"__esModule",{value:!0});var di=function(){function e(t,n){if(void 0===n&&(n=null),this.nonEmpty=!1,t||n){if(!t)throw new Error("Parameter head cannot be null.");this.head=t,this.tail=n||e.NIL,this.nonEmpty=!0}else{if(e.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(e.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===e.NIL)return 1;for(var t=0,n=this;n.nonEmpty;)++t,n=n.tail;return t},enumerable:!0,configurable:!0}),e.prototype.prepend=function(t){return new e(t,this)},e.prototype.append=function(t){if(!t)return this;if(!this.nonEmpty)return new e(t);if(this.tail===e.NIL)return new e(t).prepend(this.head);for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;)i=i.tail=new e(r.head),r=r.tail;return i.tail=new e(t),n},e.prototype.insertWithPriority=function(t){if(!this.nonEmpty)return new e(t);var n=t.priority;if(n>this.head.priority)return this.prepend(t);for(var i=new e(this.head),r=i,s=this.tail;s.nonEmpty;){if(n>s.head.priority)return r.tail=s.prepend(t),i;r=r.tail=new e(s.head),s=s.tail}return r.tail=new e(t),i},e.prototype.filterNot=function(t){if(!this.nonEmpty||null==t)return this;if(t===this.head.listener)return this.tail;for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;){if(r.head.listener===t)return i.tail=r.tail,n;i=i.tail=new e(r.head),r=r.tail}return this},e.prototype.contains=function(e){if(!this.nonEmpty)return!1;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return!0;t=t.tail}return!1},e.prototype.find=function(e){if(!this.nonEmpty)return null;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return t.head;t=t.tail}return null},e.prototype.toString=function(){for(var e="",t=this;t.nonEmpty;)e+=t.head+" -> ",t=t.tail;return"[List "+(e+="NIL")+"]"},e.NIL=new e(null,null),e}();ui.SlotList=di;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});var pi=function(){function e(e,t,n,i){void 0===n&&(n=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=e,this._once=n,this._signal=t,this._priority=i,this.verifyListener(e)}return e.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},e.prototype.execute1=function(e){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[e].concat(this._params)):this._listener(e))},e.prototype.execute=function(e){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(e=e.concat(this._params));var t=e.length;0===t?this._listener():1===t?this._listener(e[0]):2===t?this._listener(e[0],e[1]):3===t?this._listener(e[0],e[1],e[2]):this._listener.apply(null,e)}},Object.defineProperty(e.prototype,"listener",{get:function(){return this._listener},set:function(e){if(null==e)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(e),this._listener=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this._params},set:function(e){this._params=e},enumerable:!0,configurable:!0}),e.prototype.remove=function(){this._signal.remove(this._listener)},e.prototype.verifyListener=function(e){if(null==e)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},e}();fi.Slot=pi,Object.defineProperty(hi,"__esModule",{value:!0});var gi=ui,mi=fi,vi=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=gi.SlotList.NIL,this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if(!(this._valueClasses[t]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+">."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){var t=this.slots.find(e);return t?(this.slots=this.slots.filterNot(e),t):null},e.prototype.removeAll=function(){this.slots=gi.SlotList.NIL},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=this.slots;if(s.nonEmpty)for(;s.nonEmpty;)s.head.execute(e),s=s.tail},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.registrationPossible(e,t)){var n=new mi.Slot(e,this,t);return this.slots=this.slots.prepend(n),n}return this.slots.find(e)},e.prototype.registrationPossible=function(e,t){if(!this.slots.nonEmpty)return!0;var n=this.slots.find(e);if(!n)return!0;if(n.once!==t)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},e}();hi.OnceSignal=vi,Object.defineProperty(ci,"__esModule",{value:!0});var yi=ai,bi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return yi.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(hi.OnceSignal);ci.Signal=bi,Object.defineProperty(li,"__esModule",{value:!0});var wi=ai,Ai=fi,xi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return wi.__extends(t,e),t.prototype.addWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!1,t)},t.prototype.addOnceWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!0,t)},t.prototype.registerListener=function(e,t){return void 0===t&&(t=!1),this.registerListenerWithPriority(e,t)},t.prototype.registerListenerWithPriority=function(e,t,n){if(void 0===n&&(n=0),this.registrationPossible(e,t)){var i=new Ai.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(ci.Signal);li.PrioritySignal=xi,Object.defineProperty(Zn,"__esModule",{value:!0});var Si=ai,Ei=function(e){function t(t){void 0===t&&(t=null);for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=this;return n=1===n.length&&n[0]instanceof Array?n[0]:n,(r=e.call(this,n)||this)._target=t,r}return Si.__extends(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){e!==this._target&&(this.removeAll(),this._target=e)},enumerable:!0,configurable:!0}),t.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(null!==e[r]&&e[r].constructor!==this._valueClasses[r])throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=e[0];s&&(s.target&&(s=s.clone(),e[0]=s),s.target=this.target,s.currentTarget=this.target,s.signal=this);for(var o=this.slots;o.nonEmpty;)o.head.execute(e),o=o.tail;if(s&&s.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(s.currentTarget=a,a.onEventBubbled(s))););},t}(li.PrioritySignal);Zn.DeluxeSignal=Ei;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});var Di=function(){function e(e){void 0===e&&(e=!1),this._bubbles=e}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},set:function(e){this._signal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(e){this._target=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(e){this._currentTarget=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bubbles",{get:function(){return this._bubbles},set:function(e){this._bubbles=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){return new e(this._bubbles)},e}();Ti.GenericEvent=Di;var Ci={};Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.IOnceSignal=Symbol("IOnceSignal");var Bi={};Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.IPrioritySignal=Symbol("IPrioritySignal");var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.ISignal=Symbol("ISignal");var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.ISlot=Symbol("ISlot");var Oi={};Object.defineProperty(Oi,"__esModule",{value:!0});var Pi=fi,Ri=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if("function"!=typeof this._valueClasses[t])throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+"'>."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){return this.registerListener(e)},e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){if(this.slot&&this.slot.listener===e){var t=this.slot;return this.slot=null,t}return null},e.prototype.removeAll=function(){this.slot&&this.slot.remove()},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");this.slot&&this.slot.execute(e)},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new Pi.Slot(e,this,t)},e}();Oi.MonoSignal=Ri;var _i={};Object.defineProperty(_i,"__esModule",{value:!0});var Li=ai,Ni=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Li.__extends(t,e),t.prototype.addOnce=function(t){var n=e.prototype.addOnce.call(this,t);return this.isDispatched&&(n.execute(this.valueObjects),n.remove()),n},t.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(this.isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this.isDispatched=!0,this.valueObjects=t,e.prototype.dispatch.apply(this,t)},t}(hi.OnceSignal);_i.Promise=Ni,Object.defineProperty(Xn,"__esModule",{value:!0});var ki=Zn;Xn.DeluxeSignal=ki.DeluxeSignal;var Ui=Ti;Xn.GenericEvent=Ui.GenericEvent;var ji=Ci;Xn.IOnceSignal=ji.IOnceSignal;var zi=Bi;Xn.IPrioritySignal=zi.IPrioritySignal;var Fi=Ii;Xn.ISignal=Fi.ISignal;var Hi=Mi;Xn.ISlot=Hi.ISlot;var Gi=Oi;Xn.MonoSignal=Gi.MonoSignal;var Vi=hi;Xn.OnceSignal=Vi.OnceSignal;var Yi=li;Xn.PrioritySignal=Yi.PrioritySignal;var Qi=_i;Xn.Promise=Qi.Promise;var Wi=ci,Xi=Xn.Signal=Wi.Signal,Zi=fi;Xn.Slot=Zi.Slot;var Ki=ui;Xn.SlotList=Ki.SlotList;const qi=new c;qi.name="Scene";class Ji{constructor(e,t){this.signals=e,this.viewportState=t,this.scene=qi.clone(),this.scene.castShadow=!0,this.scene.receiveShadow=!0,this.selectedObjects={edge:[],stroke:[],opacity:[],highlight:[],emissive:[]},this.intersectsList={meshOfModelList:[],poiIconList:[],otherObjList:[],getAll:function(){return[...this.meshOfModelList,...this.poiIconList,...this.otherObjList]}}}addObject(e,t){if(this.viewportState.isDisposed)return this.removeObject(e),void rn("Scene is disposed");t?t.add(e):this.scene.add(e),this._triggerObjectAdded(e),this.signals.objectAdded.dispatch(e)}removeObject(e){function t(e){var t;e.map&&((t=e.map)&&t.isTexture&&t.dispose()),e.dispose()}e.traverse((e=>{if("Mesh"===e.type){const n=e;n.geometry.dispose(),bn(n.material,t)}e instanceof hl&&e.element.remove();const{meshOfModelList:n,poiIconList:i,otherObjList:r}=this.intersectsList,s=n.findIndex((t=>t.uuid===e.uuid)),o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid));s>-1&&this.intersectsList.meshOfModelList.splice(s,1),o>-1&&this.intersectsList.poiIconList.splice(o,1),a>-1&&this.intersectsList.otherObjList.splice(a,1)})),e.removeFromParent(),this.signals.objectRemoved.dispatch(e)}openSceneFog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:t=13426943,near:n=500,far:i=5e4}=e;this.scene.fog=new h(t,n,i),this.signals.sceneChanged.dispatch()}closeSceneFog(){this.scene.fog=null,this.signals.sceneChanged.dispatch()}edgeShow(e,t){const n=[],i=e=>{-1===this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid))&&n.push(e)};return Ln(e)?e.forEach((e=>i(e))):Nn(e)&&i(e),this.selectedObjects.edge=[...this.selectedObjects.edge,...n],this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge,options:t}),Promise.resolve()}unEdgeShow(e){e||(e=[...this.selectedObjects.edge]);const t=e=>{const t=this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.edge.splice(t,1),this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge})),Promise.resolve()};return Ln(e)?Promise.all(e.map((e=>t(e)))):Nn(e)?t(e):Promise.resolve()}strokeShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{isOpacityShow:n=!0,color:i=4647927,opacity:r=.2,edgeColor:s=61183,edgeOpacity:o=1}=t,a=e=>{if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const t=new ll({id:e.uuid});return e.traverse((n=>{if(n instanceof u){const i=new d(n.geometry,89),r=new f(i,new p({color:s,transparent:!0,opacity:o}));dn(r,n),e.attach(r),t.add(r)}})),e.userData.strokeGroup=t,this.addObject(t,e),this.selectedObjects.stroke.push(e),Promise.resolve()};return n&&this.opacityShow(e,{color:i,opacity:r}),Ln(e)?Promise.all(e.map((e=>a(e)))):Nn(e)?a(e):Promise.resolve()}unStrokeShow(e){e||(e=[...this.selectedObjects.stroke]);const t=e=>{if(!e.userData.strokeGroup)return Promise.resolve();this.removeObject(e.userData.strokeGroup),Reflect.deleteProperty(e.userData,"strokeGroup");const t=this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch(),this.unOpacityShow(e)),Promise.resolve()};return Ln(e)?Promise.all(e.map((e=>t(e)))):Nn(e)?t(e):Promise.resolve()}opacityShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="#fff",opacity:i=.8}=t;function r(e){return Reflect.construct(e.constructor,[{transparent:!0,depthWrite:!1,side:e.side,color:n,opacity:i}])}const s=e=>(-1!==this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof u){if(e.userData.material)return;e.userData.material=e.material,e.material=bn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return Ln(e)?Promise.all(e.map((e=>s(e)))):Nn(e)?s(e):Promise.resolve()}unOpacityShow(e){e||(e=[...this.selectedObjects.opacity]);const t=e=>new Promise((t=>{const n=this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.opacity.splice(n,1),e.traverse((e=>{if(e instanceof u){if(!e.userData.material)return;An(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ln(e)?Promise.all(e.map((e=>t(e)))):Nn(e)?t(e):Promise.resolve()}highlightShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=1}=t;function r(e){e instanceof g&&(e.color=new a(n),e.opacity=i,e.transparent=i<1)}const s=e=>(-1!==this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof u){if(e.userData.material)return;e.userData.material=e.material,e.material=wn(e.material),bn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return Ln(e)?Promise.all(e.map((e=>s(e)))):Nn(e)?s(e):Promise.resolve()}unHighlightShow(e){e||(e=[...this.selectedObjects.highlight]);const t=e=>new Promise((t=>{const n=this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.highlight.splice(n,1),e.traverse((e=>{if(e instanceof u){if(!e.userData.material)return;An(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ln(e)?Promise.all(e.map((e=>t(e)))):Nn(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=.3,maxOpacity:r=1,minOpacity:s=0,duration:o=1e3}=t;function a(e){e instanceof g&&(e.emissive.set(n),e.emissiveIntensity=i,0!==o&&Vn({emissiveIntensity:r},{emissiveIntensity:s},{duration:o,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const l=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof u){if(e.userData.material)return;e.userData.material=e.material,e.material=wn(e.material),bn(e.material,a)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return Ln(e)?Promise.all(e.map((e=>l(e)))):Nn(e)?l(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&Vt.remove(e.userData.animation)}e||(e=[...this.selectedObjects.emissive]);const n=e=>new Promise((n=>{const i=this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid));-1===i&&n(),this.selectedObjects.emissive.splice(i,1),e.traverse((e=>{if(e instanceof u){if(!e.userData.material)return;bn(e.material,t),An(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return Ln(e)?Promise.all(e.map((e=>n(e)))):Nn(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof al)if("Model"===e.stype)e.traverse((e=>{if(e instanceof u){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype){-1===this.intersectsList.poiIconList.findIndex((t=>t.uuid===e.icon.uuid))&&this.intersectsList.poiIconList.push(e.icon)}else"Group"===e.stype?e.children.forEach((e=>this._triggerObjectAdded(e))):e.isObject3D&&e.traverse((e=>{if(e instanceof u){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof u){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class $i extends v{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof $i&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const er=new t,tr=new m,nr=new m,ir=new t,rr=new t;class sr{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={objects:new WeakMap};this.domElement.style.overflow="hidden",this.getSize=function(){return{width:t,height:n}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),tr.copy(t.matrixWorldInverse),nr.multiplyMatrices(t.projectionMatrix,tr),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof $i&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared})),n=t.length;for(let e=0,i=t.length;e<i;e++)t[e].element.style.zIndex=""+(n-e)}(e)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px"};const o=(e,t,n)=>{var l;if(e instanceof $i){const t=e.parent;if(t.occlude){const t=!Dn(e,this.viewport.camera)&&Cn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}er.setFromMatrixPosition(e.matrixWorld),er.applyMatrix4(nr);const o=fn(e)&&er.z>=-1&&er.z<=1&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==o&&(null===(l=t.onChange)||void 0===l||l.call(t,o),t.elementAutoDisplay&&(e.element.style.display=!0===o?"":"none")),e.userData.prevVisible=o,!0===o){const t=e.element;t.style.transform="translate(-50%,-50%) translate("+(er.x*i+i)+"px,"+(-er.y*r+r)+"px)",t.parentNode!==this.domElement&&this.domElement.appendChild(t)}const c={distanceToCameraSquared:a(n,e)};s.objects.set(e,c)}for(let i=0,r=e.children.length;i<r;i++)o(e.children[i],t,n)};function a(e,t){return ir.setFromMatrixPosition(e.matrixWorld),rr.setFromMatrixPosition(t.matrixWorld),ir.distanceToSquared(rr)}}}const or=new t,ar=new r,lr=new t;class cr extends v{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof cr&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}class hr extends cr{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const ur=new m,dr=new m;class fr{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={camera:{fov:0,style:""},objects:new WeakMap};this.domElement.style.overflow="hidden";const o=document.createElement("div");o.style.transformOrigin="0 0",this.domElement.appendChild(o);const a=document.createElement("div");function l(e){return Math.abs(e)<1e-10?0:e}function c(e){const t=e.elements;return"matrix3d("+l(t[0])+","+l(-t[1])+","+l(t[2])+","+l(t[3])+","+l(t[4])+","+l(-t[5])+","+l(t[6])+","+l(t[7])+","+l(t[8])+","+l(-t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(-t[13])+","+l(t[14])+","+l(t[15])+")"}function h(e){const t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+l(t[0])+","+l(t[1])+","+l(t[2])+","+l(t[3])+","+l(-t[4])+","+l(-t[5])+","+l(-t[6])+","+l(-t[7])+","+l(t[8])+","+l(t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(t[13])+","+l(t[14])+","+l(t[15])+")")}a.style.transformStyle="preserve-3d",o.appendChild(a),this.getSize=()=>({width:t,height:n}),this.render=(e,h)=>{const d=h.projectionMatrix.elements[5]*r;s.camera.fov!==d&&(o.style.perspective=h instanceof y?d+"px":"",s.camera.fov=d),h.view&&h.view.enabled?(o.style.transform=`translate( ${-h.view.offsetX*(t/h.view.width)}px, ${-h.view.offsetY*(n/h.view.height)}px )`,o.style.transform+=`scale( ${h.view.fullWidth/h.view.width}, ${h.view.fullHeight/h.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===h.parent&&!0===h.matrixWorldAutoUpdate&&h.updateMatrixWorld();let f=0,p=0;h instanceof b&&(f=-(h.right+h.left)/2,p=(h.top+h.bottom)/2);const g=h.view&&h.view.enabled?h.view.height/h.view.fullHeight:1,m=(h instanceof b?`scale( ${g} )scale(`+d+")translate("+l(f)+"px,"+l(p)+"px)"+c(h.matrixWorldInverse):`scale( ${g} )translateZ(`+d+"px)"+c(h.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==m&&(a.style.transform=m,s.camera.style=m),u(e,e,h)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px",o.style.width=e+"px",o.style.height=s+"px",a.style.width=e+"px",a.style.height=s+"px"};const u=(e,t,n,i)=>{var r;if(e instanceof cr){const t=e.parent;if(t.occlude){const t=!Dn(e,this.viewport.camera)&&Cn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=fn(e)&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==i&&(null===(r=t.onChange)||void 0===r||r.call(t,i),t.elementAutoDisplay&&(e.element.style.display=!0===i?"":"none")),e.userData.prevVisible=i,!0===i){let t;e instanceof hr?(ur.copy(n.matrixWorldInverse),ur.transpose(),0!==e.rotation2D&&ur.multiply(dr.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(or,ar,lr),ur.setPosition(or),ur.scale(lr),ur.elements[3]=0,ur.elements[7]=0,ur.elements[11]=0,ur.elements[15]=1,t=h(ur)):t=h(e.matrixWorld);const i=e.element,r=s.objects.get(e);if(void 0===r||r.style!==t){i.style.transform=t;const n={style:t};s.objects.set(e,n)}i.parentNode!==a&&a.appendChild(i)}}for(let i=0,r=e.children.length;i<r;i++)u(e.children[i],t,n)}}}class pr{constructor(e){this.viewport=e,this.internalOptions={enableRenderCss2D:!1,enableRenderCss3D:!1},this.container=this._initContainer(),this.renderer=this._initRenderer(),this.rendererCSS2D=this._initRenderCSS2D(),this.rendererCSS3D=this._initRenderCSS3D(),this.interactiveContainer=this._initInteractiveContainer()}setInternalState(e,t){this.internalOptions[e]=t}getWidth(){return this.renderer.domElement.width}getHeight(){return this.renderer.domElement.height}getMouseRelativeConRatio(e){const t=this.container.getBoundingClientRect();return[(e.offsetX-t.left)/t.width,(e.offsetY-t.top)/t.height]}getMousePoint(e){const t=new w(0,0);return t.fromArray(this.getMouseRelativeConRatio(e)),t}_initContainer(){const e=document.createElement("div");return e.style.position="relative",e.style.width="100%",e.style.height="100%",e}_initRenderer(){const{background:e={},logarithmicDepthBuffer:t}=this.viewport.options,{color:n,alpha:i}=e,r=new A({alpha:i,logarithmicDepthBuffer:t,preserveDrawingBuffer:!0,antialias:!1,stencil:!1,depth:!1,powerPreference:"high-performance"}),s=i?0:1,{offsetWidth:o,offsetHeight:a}=this.container;return r.setSize(o,a),r.setClearColor(n||0,s),r.setPixelRatio(self.devicePixelRatio),r.localClippingEnabled=!0,r.sortObjects=!0,r.shadowMap.enabled=!0,r.shadowMap.type=x,this.container.appendChild(r.domElement),r}_initRenderCSS2D(){const e=new sr(this.viewport);return e.domElement.id="ssp_view_2DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initRenderCSS3D(){const e=new fr(this.viewport);return e.domElement.id="ssp_view_3DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initInteractiveContainer(){return this.rendererCSS3D.domElement}}const gr=new m,mr=(e,t)=>{const i=gr.clone(),r=gr.clone(),s=gr.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},vr=mr(-Math.PI/2,-Math.PI/4),yr=mr(Math.PI/2,-Math.PI/4),br=mr(-Math.PI/4,-Math.PI/4),wr=mr(Math.PI/4,-Math.PI/4),Ar=mr(1.25*Math.PI,-Math.PI/4),xr=mr(.75*Math.PI,-Math.PI/4),Sr={LEFT:new n(0,-Math.PI/2,0),RIGHT:new n(0,Math.PI/2,0),FRONT:new n(0,0,0),BACK:new n(0,Math.PI,0),TOP:new n(-Math.PI/2,0,0),BOTTOM:new n(Math.PI/2,0,0),FRONTTOP:new n(-Math.PI/4,0,0),BACKTOP:new n(Math.PI/4,Math.PI,0),LEFTTOP:new n(vr.x,vr.y,vr.z),RIGHTTOP:new n(yr.x,yr.y,yr.z),LEFTFRONTTOP:new n(br.x,br.y,br.z),RIGHTFRONTTOP:new n(wr.x,wr.y,wr.z),LEFTBACKTOP:new n(Ar.x,Ar.y,Ar.z),RIGHTBACKTOP:new n(xr.x,xr.y,xr.z)},Er=e=>_n(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),Tr=new t,Dr=new n,Cr=new y(50,1,.1,5e5);Cr.position.set(500,1e3,500),Cr.lookAt(Tr.set(0,0,0)),Cr.name="Camera";class Br{constructor(e){this.viewport=e,this.mainCamera=Cr.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=Cr.clone();return t.name=e,this.cameras[e]=t,t}removeCamera(e){return"fullFreeCamera"!==e&&(delete this.cameras[e],!0)}setCurrentCamera(e){this.currentCamera=this.viewport.camera=e,this.viewport.signals.cameraObjectChange.dispatch()}getMainCamera(){return this.mainCamera}getCameraViewpoint(){if("free"===this.viewport.controls.options.type)return{position:this.currentCamera.position.clone(),rotation:{x:this.currentCamera.rotation.x,y:this.currentCamera.rotation.y,z:this.currentCamera.rotation.z}};{const e=this.viewport.controls.currentControls;return{position:this.currentCamera.position.clone(),target:e.target.clone()}}}setCameraViewpoint(e){if("free"===this.viewport.controls.options.type&&Nn(e)){const{position:t,rotation:n}=e;this.currentCamera.position.set(t.x,t.y,t.z),this.currentCamera.rotation.set(n.x,n.y,n.z)}else if(Nn(e)){const{position:t,target:n}=e,i=this.viewport.controls.currentControls;this.currentCamera.position.set(t.x,t.y,t.z),i.target.set(n.x,n.y,n.z)}this.viewport.signals.cameraChange.dispatch(this.currentCamera.position.clone())}moveTo(e,t){return Vn(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new r).setFromEuler(e);return Vn({t:0},{t:1},t,(e=>{let{t:t}=e;this.currentCamera.quaternion.slerpQuaternions(n,i,t)}))}async flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(Pn(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?Dr.copy(this.currentCamera.rotation):Sr[e]&&Dr.copy(Sr[e])}else t instanceof n?Dr.copy(t):Nn(t)&&Dr.set(t.x,t.y,t.z);Dr.copy(cn(this.currentCamera.rotation,Dr.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(Dr,i)])}async flyToBoundingBox(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(e.isEmpty())return void rn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Pn(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=Sr[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&rn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=on(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(Tr),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new m;r.lookAt(s,t,i.object.up),n=Dr.setFromRotationMatrix(r)}await this.flyTo(s,n,i)}flyToObj(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof pl||e instanceof hl){const{padding:t=50}=i,r=Er(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=an(e),o=s.getSize(Tr);let a=0;if(Pn(r)){const e=Math.max(o.x,o.y,o.z);a=Er(r)*e}else a=r;let l=a,c=a;if(a<0){const e=Math.min(o.x,o.z),t=o.y-1;l=Math.abs(a)>e?-e:a,c=Math.abs(l)>t?-t:l}return 0!==r&&(s.max.add(Tr.set(l/2,c/2,l/2)),s.min.sub(Tr.set(l/2,c/2,l/2))),s.isEmpty()&&(Tr.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(Tr,new t(0,0,0))),this.flyToBoundingBox(s,n,i)}}surroundOnTarget(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{speed:n=1,angle:i=360,onStart:r}=t,s=sn(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return Vn({angle:0},{angle:Math.PI/180*a},{duration:a/360*5e3/n},(e=>{const t=i>0?e.angle:2*Math.PI-e.angle;if(this.currentCamera.position.x=Math.sin(t)*o+s.x,this.currentCamera.position.z=Math.cos(t)*o+s.z,"orbit"===this.viewport.controls.options.type){const e=this.viewport.controls.currentControls;e.target.copy(s),e.update()}else this.currentCamera.lookAt(s)}),r)}surroundOnObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(new i).setFromObject(e).getCenter(Tr);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(Tr);(new t).subVectors(i,n).normalize();let r=new S;r=e.getBoundingSphere(r);const s=this.currentCamera.fov/2*Math.PI/180,o=Math.sin(s),a=r.radius/o,l=new t;this.currentCamera.getWorldDirection(l);const c=l.clone();return c.multiplyScalar(-a),i.clone().add(c)}getObjectLabelPos(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof al&&(e=(new i).setFromObject(e)),e.isEmpty())return rn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(Tr),i=e.max.clone().sub(e.min),r=Math.max(i.x,i.y,i.z),o=t.clone(),a=e=>{const t=(s-.5)*Math.abs(r),n=Math.max(t,this.viewport.camera.near);o.add(e.multiplyScalar(n))};let l;return l=Pn(n)?Sr[n.toLocaleUpperCase()]:on(n),a(Tr.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(Tr).clone():new t}}
2
2
  /**
3
3
  * postprocessing v6.29.3 build Thu Feb 09 2023
4
4
  * https://github.com/pmndrs/postprocessing
@@ -19,4 +19,4 @@ version: 2.9.0
19
19
  * @since jsrsasign 2.1
20
20
  * @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
21
21
  */
22
- var Da={};void 0!==Da.asn1&&Da.asn1||(Da.asn1={}),Da.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var i="",r=0;r<n;r++)i+="f";t=new Jo(i,16).xor(e).add(Jo.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=Da.asn1,n=t.DERBoolean,i=t.DERInteger,r=t.DERBitString,s=t.DEROctetString,o=t.DERNull,a=t.DERObjectIdentifier,l=t.DEREnumerated,c=t.DERUTF8String,h=t.DERNumericString,u=t.DERPrintableString,d=t.DERTeletexString,f=t.DERIA5String,p=t.DERUTCTime,g=t.DERGeneralizedTime,m=t.DERSequence,v=t.DERSet,y=t.DERTaggedObject,b=t.ASN1Util.newObject,w=Object.keys(e);if(1!=w.length)throw"key of param shall be only one.";var A=w[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+A+":"))throw"undefined key: "+A;if("bool"==A)return new n(e[A]);if("int"==A)return new i(e[A]);if("bitstr"==A)return new r(e[A]);if("octstr"==A)return new s(e[A]);if("null"==A)return new o(e[A]);if("oid"==A)return new a(e[A]);if("enum"==A)return new l(e[A]);if("utf8str"==A)return new c(e[A]);if("numstr"==A)return new h(e[A]);if("prnstr"==A)return new u(e[A]);if("telstr"==A)return new d(e[A]);if("ia5str"==A)return new f(e[A]);if("utctime"==A)return new p(e[A]);if("gentime"==A)return new g(e[A]);if("seq"==A){for(var x=e[A],S=[],E=0;E<x.length;E++){var T=b(x[E]);S.push(T)}return new m({array:S})}if("set"==A){for(x=e[A],S=[],E=0;E<x.length;E++){T=b(x[E]);S.push(T)}return new v({array:S})}if("tag"==A){var D=e[A];if("[object Array]"===Object.prototype.toString.call(D)&&3==D.length){var C=b(D[2]);return new y({tag:D[0],explicit:D[1],obj:C})}var B={};if(void 0!==D.explicit&&(B.explicit=D.explicit),void 0!==D.tag&&(B.tag=D.tag),void 0===D.obj)throw"obj shall be specified for 'tag'.";return B.obj=b(D.obj),new y(B)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},Da.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),i=(t=Math.floor(n/40)+"."+n%40,""),r=2;r<e.length;r+=2){var s=("00000000"+parseInt(e.substr(r,2),16).toString(2)).slice(-8);if(i+=s.substr(1,7),"0"==s.substr(0,1))t=t+"."+new Jo(i,2).toString(10),i=""}return t},Da.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",i=new Jo(e,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var s="",o=0;o<r;o++)s+="0";i=s+i;for(o=0;o<i.length-1;o+=7){var a=i.substr(o,7);o!=i.length-7&&(a="1"+a),n+=t(parseInt(a,2))}return n};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var i="",r=e.split("."),s=40*parseInt(r[0])+parseInt(r[1]);i+=t(s),r.splice(0,2);for(var o=0;o<r.length;o++)i+=n(r[o]);return i},Da.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var n=t.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},Da.asn1.DERAbstractString=function(e){Da.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},Ta.lang.extend(Da.asn1.DERAbstractString,Da.asn1.ASN1Object),Da.asn1.DERAbstractTime=function(e){Da.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+6e4*e.getTimezoneOffset(),new Date(utc)},this.formatDate=function(e,t,n){var i=this.zeroPadding,r=this.localDateToUTC(e),s=String(r.getFullYear());"utc"==t&&(s=s.substr(2,2));var o=s+i(String(r.getMonth()+1),2)+i(String(r.getDate()),2)+i(String(r.getHours()),2)+i(String(r.getMinutes()),2)+i(String(r.getSeconds()),2);if(!0===n){var a=r.getMilliseconds();if(0!=a){var l=i(String(a),3);o=o+"."+(l=l.replace(/[0]+$/,""))}}return o+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,n,i,r,s){var o=new Date(Date.UTC(e,t-1,n,i,r,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},Ta.lang.extend(Da.asn1.DERAbstractTime,Da.asn1.ASN1Object),Da.asn1.DERAbstractStructured=function(e){Da.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},Ta.lang.extend(Da.asn1.DERAbstractStructured,Da.asn1.ASN1Object),Da.asn1.DERBoolean=function(){Da.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},Ta.lang.extend(Da.asn1.DERBoolean,Da.asn1.ASN1Object),Da.asn1.DERInteger=function(e){Da.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Da.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Jo(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},Ta.lang.extend(Da.asn1.DERInteger,Da.asn1.ASN1Object),Da.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=Da.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}Da.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var n=0;n<=t;n++)e+="0";var i="";for(n=0;n<e.length-1;n+=8){var r=e.substr(n,8),s=parseInt(r,2).toString(16);1==s.length&&(s="0"+s),i+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+t+i},this.setByBooleanArray=function(e){for(var t="",n=0;n<e.length;n++)1==e[n]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},Ta.lang.extend(Da.asn1.DERBitString,Da.asn1.ASN1Object),Da.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=Da.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}Da.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},Ta.lang.extend(Da.asn1.DEROctetString,Da.asn1.DERAbstractString),Da.asn1.DERNull=function(){Da.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Ta.lang.extend(Da.asn1.DERNull,Da.asn1.ASN1Object),Da.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",i=new Jo(e,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var s="",o=0;o<r;o++)s+="0";i=s+i;for(o=0;o<i.length-1;o+=7){var a=i.substr(o,7);o!=i.length-7&&(a="1"+a),n+=t(parseInt(a,2))}return n};Da.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var i="",r=e.split("."),s=40*parseInt(r[0])+parseInt(r[1]);i+=t(s),r.splice(0,2);for(var o=0;o<r.length;o++)i+=n(r[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.setValueName=function(e){var t=Da.asn1.x509.OID.name2oid(e);if(""===t)throw"DERObjectIdentifier oidName undefined: "+e;this.setValueOidString(t)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):void 0!==e.oid?this.setValueOidString(e.oid):void 0!==e.hex?this.setValueHex(e.hex):void 0!==e.name&&this.setValueName(e.name))},Ta.lang.extend(Da.asn1.DERObjectIdentifier,Da.asn1.ASN1Object),Da.asn1.DEREnumerated=function(e){Da.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Da.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Jo(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},Ta.lang.extend(Da.asn1.DEREnumerated,Da.asn1.ASN1Object),Da.asn1.DERUTF8String=function(e){Da.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},Ta.lang.extend(Da.asn1.DERUTF8String,Da.asn1.DERAbstractString),Da.asn1.DERNumericString=function(e){Da.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},Ta.lang.extend(Da.asn1.DERNumericString,Da.asn1.DERAbstractString),Da.asn1.DERPrintableString=function(e){Da.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},Ta.lang.extend(Da.asn1.DERPrintableString,Da.asn1.DERAbstractString),Da.asn1.DERTeletexString=function(e){Da.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},Ta.lang.extend(Da.asn1.DERTeletexString,Da.asn1.DERAbstractString),Da.asn1.DERIA5String=function(e){Da.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},Ta.lang.extend(Da.asn1.DERIA5String,Da.asn1.DERAbstractString),Da.asn1.DERUTCTime=function(e){Da.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},Ta.lang.extend(Da.asn1.DERUTCTime,Da.asn1.DERAbstractTime),Da.asn1.DERGeneralizedTime=function(e){Da.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},Ta.lang.extend(Da.asn1.DERGeneralizedTime,Da.asn1.DERAbstractTime),Da.asn1.DERSequence=function(e){Da.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},Ta.lang.extend(Da.asn1.DERSequence,Da.asn1.DERAbstractStructured),Da.asn1.DERSet=function(e){Da.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},Ta.lang.extend(Da.asn1.DERSet,Da.asn1.DERAbstractStructured),Da.asn1.DERTaggedObject=function(e){Da.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.tag&&(this.hT=e.tag),void 0!==e.explicit&&(this.isExplicit=e.explicit),void 0!==e.obj&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},Ta.lang.extend(Da.asn1.DERTaggedObject,Da.asn1.ASN1Object);var Ca,Ba,Ia,Ma=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Oa=function(e){function t(n){var i=e.call(this)||this;return n&&("string"==typeof n?i.parseKey(n):(t.hasPrivateKeyProperty(n)||t.hasPublicKeyProperty(n))&&i.parsePropertiesFrom(n)),i}return Ma(t,e),t.prototype.parseKey=function(e){try{var t=0,n=0,i=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?Uo(e):jo.unarmor(e),r=Xo.decode(i);if(3===r.sub.length&&(r=r.sub[2].sub[0]),9===r.sub.length){t=r.sub[1].getHexStringValue(),this.n=ra(t,16),n=r.sub[2].getHexStringValue(),this.e=parseInt(n,16);var s=r.sub[3].getHexStringValue();this.d=ra(s,16);var o=r.sub[4].getHexStringValue();this.p=ra(o,16);var a=r.sub[5].getHexStringValue();this.q=ra(a,16);var l=r.sub[6].getHexStringValue();this.dmp1=ra(l,16);var c=r.sub[7].getHexStringValue();this.dmq1=ra(c,16);var h=r.sub[8].getHexStringValue();this.coeff=ra(h,16)}else{if(2!==r.sub.length)return!1;if(r.sub[0].sub){var u=r.sub[1].sub[0];t=u.sub[0].getHexStringValue(),this.n=ra(t,16),n=u.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else t=r.sub[0].getHexStringValue(),this.n=ra(t,16),n=r.sub[1].getHexStringValue(),this.e=parseInt(n,16)}return!0}catch(e){return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new Da.asn1.DERInteger({int:0}),new Da.asn1.DERInteger({bigint:this.n}),new Da.asn1.DERInteger({int:this.e}),new Da.asn1.DERInteger({bigint:this.d}),new Da.asn1.DERInteger({bigint:this.p}),new Da.asn1.DERInteger({bigint:this.q}),new Da.asn1.DERInteger({bigint:this.dmp1}),new Da.asn1.DERInteger({bigint:this.dmq1}),new Da.asn1.DERInteger({bigint:this.coeff})]};return new Da.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return Lo(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new Da.asn1.DERSequence({array:[new Da.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new Da.asn1.DERNull]}),t=new Da.asn1.DERSequence({array:[new Da.asn1.DERInteger({bigint:this.n}),new Da.asn1.DERInteger({int:this.e})]}),n=new Da.asn1.DERBitString({hex:"00"+t.getEncodedHex()});return new Da.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return Lo(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(!e)return e;var n="(.{1,"+(t=t||64)+"})( +|$\n?)|(.{1,"+t+"})";return e.match(RegExp(n,"g")).join("\n")},t.prototype.getPrivateKey=function(){var e="-----BEGIN RSA PRIVATE KEY-----\n";return e+=t.wordwrap(this.getPrivateBaseKeyB64())+"\n",e+="-----END RSA PRIVATE KEY-----"},t.prototype.getPublicKey=function(){var e="-----BEGIN PUBLIC KEY-----\n";return e+=t.wordwrap(this.getPublicBaseKeyB64())+"\n",e+="-----END PUBLIC KEY-----"},t.hasPublicKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(Sa),Pa="undefined"!=typeof process?null===(Ca=process.env)||void 0===Ca?void 0:Ca.npm_package_version:void 0,Ra=function(){function e(e){void 0===e&&(e={}),e=e||{},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Oa(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(No(e))}catch(e){return!1}},e.prototype.encrypt=function(e){try{return Lo(this.getKey().encrypt(e))}catch(e){return!1}},e.prototype.sign=function(e,t,n){try{return Lo(this.getKey().sign(e,t,n))}catch(e){return!1}},e.prototype.verify=function(e,t,n){try{return this.getKey().verify(e,No(t),n)}catch(e){return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new Oa,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},e.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},e.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},e.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},e.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},e.version=Pa,e}(),_a={},La={get exports(){return _a},set exports(e){_a=e}},Na={};Ba="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ia={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&Ia.rotl(e,8)|4278255360&Ia.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=Ia.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,i=0;n<e.length;n++,i+=8)t[i>>>5]|=e[n]<<24-i%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],n=0;n<e.length;n+=3)for(var i=e[n]<<16|e[n+1]<<8|e[n+2],r=0;r<4;r++)8*n+6*r<=8*e.length?t.push(Ba.charAt(i>>>6*(3-r)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,i=0;n<e.length;i=++n%4)0!=i&&t.push((Ba.indexOf(e.charAt(n-1))&Math.pow(2,-2*i+8)-1)<<2*i|Ba.indexOf(e.charAt(n))>>>6-2*i);return t}},{get exports(){return Na},set exports(e){Na=e}}.exports=Ia;var ka={utf8:{stringToBytes:function(e){return ka.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(ka.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},Ua=ka,ja=function(e){return null!=e&&(za(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&za(e.slice(0,0))}(e)||!!e._isBuffer)};function za(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}!function(){var e=Na,t=Ua.utf8,n=ja,i=Ua.bin,r=function(s,o){s.constructor==String?s=o&&"binary"===o.encoding?i.stringToBytes(s):t.stringToBytes(s):n(s)?s=Array.prototype.slice.call(s,0):Array.isArray(s)||s.constructor===Uint8Array||(s=s.toString());for(var a=e.bytesToWords(s),l=8*s.length,c=1732584193,h=-271733879,u=-1732584194,d=271733878,f=0;f<a.length;f++)a[f]=16711935&(a[f]<<8|a[f]>>>24)|4278255360&(a[f]<<24|a[f]>>>8);a[l>>>5]|=128<<l%32,a[14+(l+64>>>9<<4)]=l;var p=r._ff,g=r._gg,m=r._hh,v=r._ii;for(f=0;f<a.length;f+=16){var y=c,b=h,w=u,A=d;c=p(c,h,u,d,a[f+0],7,-680876936),d=p(d,c,h,u,a[f+1],12,-389564586),u=p(u,d,c,h,a[f+2],17,606105819),h=p(h,u,d,c,a[f+3],22,-1044525330),c=p(c,h,u,d,a[f+4],7,-176418897),d=p(d,c,h,u,a[f+5],12,1200080426),u=p(u,d,c,h,a[f+6],17,-1473231341),h=p(h,u,d,c,a[f+7],22,-45705983),c=p(c,h,u,d,a[f+8],7,1770035416),d=p(d,c,h,u,a[f+9],12,-1958414417),u=p(u,d,c,h,a[f+10],17,-42063),h=p(h,u,d,c,a[f+11],22,-1990404162),c=p(c,h,u,d,a[f+12],7,1804603682),d=p(d,c,h,u,a[f+13],12,-40341101),u=p(u,d,c,h,a[f+14],17,-1502002290),c=g(c,h=p(h,u,d,c,a[f+15],22,1236535329),u,d,a[f+1],5,-165796510),d=g(d,c,h,u,a[f+6],9,-1069501632),u=g(u,d,c,h,a[f+11],14,643717713),h=g(h,u,d,c,a[f+0],20,-373897302),c=g(c,h,u,d,a[f+5],5,-701558691),d=g(d,c,h,u,a[f+10],9,38016083),u=g(u,d,c,h,a[f+15],14,-660478335),h=g(h,u,d,c,a[f+4],20,-405537848),c=g(c,h,u,d,a[f+9],5,568446438),d=g(d,c,h,u,a[f+14],9,-1019803690),u=g(u,d,c,h,a[f+3],14,-187363961),h=g(h,u,d,c,a[f+8],20,1163531501),c=g(c,h,u,d,a[f+13],5,-1444681467),d=g(d,c,h,u,a[f+2],9,-51403784),u=g(u,d,c,h,a[f+7],14,1735328473),c=m(c,h=g(h,u,d,c,a[f+12],20,-1926607734),u,d,a[f+5],4,-378558),d=m(d,c,h,u,a[f+8],11,-2022574463),u=m(u,d,c,h,a[f+11],16,1839030562),h=m(h,u,d,c,a[f+14],23,-35309556),c=m(c,h,u,d,a[f+1],4,-1530992060),d=m(d,c,h,u,a[f+4],11,1272893353),u=m(u,d,c,h,a[f+7],16,-155497632),h=m(h,u,d,c,a[f+10],23,-1094730640),c=m(c,h,u,d,a[f+13],4,681279174),d=m(d,c,h,u,a[f+0],11,-358537222),u=m(u,d,c,h,a[f+3],16,-722521979),h=m(h,u,d,c,a[f+6],23,76029189),c=m(c,h,u,d,a[f+9],4,-640364487),d=m(d,c,h,u,a[f+12],11,-421815835),u=m(u,d,c,h,a[f+15],16,530742520),c=v(c,h=m(h,u,d,c,a[f+2],23,-995338651),u,d,a[f+0],6,-198630844),d=v(d,c,h,u,a[f+7],10,1126891415),u=v(u,d,c,h,a[f+14],15,-1416354905),h=v(h,u,d,c,a[f+5],21,-57434055),c=v(c,h,u,d,a[f+12],6,1700485571),d=v(d,c,h,u,a[f+3],10,-1894986606),u=v(u,d,c,h,a[f+10],15,-1051523),h=v(h,u,d,c,a[f+1],21,-2054922799),c=v(c,h,u,d,a[f+8],6,1873313359),d=v(d,c,h,u,a[f+15],10,-30611744),u=v(u,d,c,h,a[f+6],15,-1560198380),h=v(h,u,d,c,a[f+13],21,1309151649),c=v(c,h,u,d,a[f+4],6,-145523070),d=v(d,c,h,u,a[f+11],10,-1120210379),u=v(u,d,c,h,a[f+2],15,718787259),h=v(h,u,d,c,a[f+9],21,-343485551),c=c+y>>>0,h=h+b>>>0,u=u+w>>>0,d=d+A>>>0}return e.endian([c,h,u,d])};r._ff=function(e,t,n,i,r,s,o){var a=e+(t&n|~t&i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._gg=function(e,t,n,i,r,s,o){var a=e+(t&i|n&~i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._hh=function(e,t,n,i,r,s,o){var a=e+(t^n^i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._ii=function(e,t,n,i,r,s,o){var a=e+(n^(t|~i))+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._blocksize=16,r._digestsize=16,La.exports=function(t,n){if(null==t)throw new Error("Illegal argument "+t);var s=e.wordsToBytes(r(t,n));return n&&n.asBytes?s:n&&n.asString?i.bytesToString(s):e.bytesToHex(s)}}();var Fa,Ha,Ga={serialNums:[],key:"",verified:!0};class Va{constructor(e){this.viewport=e,this.encryptInfo=Ga,Fa.set(this,!0),Ha.set(this,setTimeout((()=>{si(this,Fa,!1,"f"),this.viewport.triggerRender()}),5e3))}verify(e,t){var n;clearTimeout(ri(this,Ha,"f"));const i=new Ra;i.setPublicKey(null===(n=this.encryptInfo)||void 0===n?void 0:n.key);const r=i.verify(e,t,_a);return si(this,Fa,r,"f"),this.viewport.triggerRender(),r}getVerified(){return!!Ga.verified||ri(this,Fa,"f")}}Fa=new WeakMap,Ha=new WeakMap;class Ya{constructor(e,t){this.scene=e,this.signals=t;const n=document.createElement("div");n.style.position="absolute",n.style.left="12px",n.style.bottom="12px",n.style.fontSize="12px",n.style.color="#fff",n.style.pointerEvents="none",this.container=n,this.state={objects:0,vertices:0,triangles:0,frametime:0,lodFrametime:0}}addListeners(){const{scene:e,signals:t}=this;function n(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=document.createElement("span");return t&&(n.style.marginLeft="6px"),n.innerText=e,n}function i(){return document.createElement("br")}const r=n("0"),s=n("0"),o=n("0"),a=n("0"),l=n("0");this.container.appendChild(n("objects",!1)),this.container.appendChild(r),this.container.appendChild(i()),this.container.appendChild(n("triangles",!1)),this.container.appendChild(s),this.container.appendChild(i()),this.container.appendChild(n("vertices",!1)),this.container.appendChild(o),this.container.appendChild(i()),this.container.appendChild(n("frametime",!1)),this.container.appendChild(a),this.container.appendChild(i()),this.container.appendChild(n("lodFrametime",!1)),this.container.appendChild(l);const c=()=>{this.state.objects=0,this.state.vertices=0,this.state.triangles=0;for(let t=0;t<e.children.length;t++){e.children[t].traverseVisible((e=>{var t,n,i,r;if("SceneManager"!==e.stype&&this.state.objects++,e.isMesh){const s=e.geometry;s.isGeometry?(this.state.vertices+=(null===(t=s.vertices)||void 0===t?void 0:t.length)||0,this.state.triangles+=(null===(n=s.faces)||void 0===n?void 0:n.length)||0):s.isBufferGeometry&&(this.state.vertices+=(null===(i=s.attributes.position)||void 0===i?void 0:i.count)||0,null!==s.index?this.state.triangles+=s.index.count/3:this.state.triangles+=(null===(r=s.attributes.position)||void 0===r?void 0:r.count)/3||0)}}))}r.innerText=String(this.state.objects),o.innerText=String(this.state.vertices),s.innerText=String(this.state.triangles)};t.objectAdded.add(c),t.objectRemoved.add(c),t.geometryChanged.add(c);t.sceneRendered.add((e=>{this.state.frametime=e,a.innerText=Number(e).toFixed(2)+" ms"}));t.loadRendered.add((e=>{this.state.lodFrametime=e,l.innerText=Number(e).toFixed(2)+" ms"}))}}const Qa=new e.Vector4;class Wa extends e.Object3D{constructor(t,n){super();const i=new e.Color("#ff3653"),r=new e.Color("#8adb00"),s=new e.Color("#2c8fff"),o=new e.OrthographicCamera(-2,2,2,-2,0,4);o.position.set(0,0,2);const a=new e.BoxGeometry(.8,.05,.05).translate(.4,0,0),l=new e.Mesh(a,y(i)),c=new e.Mesh(a,y(r)),h=new e.Mesh(a,y(s));c.rotation.z=Math.PI/2,h.rotation.y=-Math.PI/2,this.add(l),this.add(h),this.add(c);const u=new e.Sprite(b(i,"X"));u.userData.type="posX";const d=new e.Sprite(b(r,"Y"));d.userData.type="posY";const f=new e.Sprite(b(s,"Z"));f.userData.type="posZ";const p=new e.Sprite(b(i));p.userData.type="negX";const g=new e.Sprite(b(r));g.userData.type="negY";const m=new e.Sprite(b(s));m.userData.type="negZ",u.position.x=1,d.position.y=1,f.position.z=1,p.position.x=-1,p.scale.setScalar(.8),g.position.y=-1,g.scale.setScalar(.8),m.position.z=-1,m.scale.setScalar(.8),this.add(u),this.add(d),this.add(f),this.add(p),this.add(g),this.add(m);const v=new e.Vector3;function y(t){return new e.MeshBasicMaterial({color:t,toneMapped:!1})}function b(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=document.createElement("canvas");i.width=64,i.height=64;const r=i.getContext("2d");if(!r)return;r.beginPath(),r.arc(32,32,16,0,2*Math.PI),r.closePath(),r.fillStyle=t.getStyle(),r.fill(),null!==n&&(r.font="24px Arial",r.textAlign="center",r.fillStyle="#000000",r.fillText(n,32,41));const s=new e.CanvasTexture(i);return new e.SpriteMaterial({map:s,toneMapped:!1})}this.render=function(e){this.quaternion.copy(t.quaternion).invert(),this.updateMatrixWorld(),v.set(0,0,1),v.applyQuaternion(t.quaternion),v.x>=0?(u.material.opacity=1,p.material.opacity=.5):(u.material.opacity=.5,p.material.opacity=1),v.y>=0?(d.material.opacity=1,g.material.opacity=.5):(d.material.opacity=.5,g.material.opacity=1),v.z>=0?(f.material.opacity=1,m.material.opacity=.5):(f.material.opacity=.5,m.material.opacity=1);const i=n.offsetWidth-128;e.clearDepth(),e.getViewport(Qa),e.setViewport(i,0,128,128),e.render(this,o),e.setViewport(Qa.x,Qa.y,Qa.z,Qa.w)}}}const Xa="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAApCAYAAADDJIzmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAASwAAAABAAABLAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAZKADAAQAAAABAAAAKQAAAAAaAV+RAAAACXBIWXMAAC4jAAAuIwF4pT92AAACy2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj4zMDA8L3RpZmY6WVJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjMwMDwvdGlmZjpYUmVzb2x1dGlvbj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjIwMDwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAgICAgICAgIDxleGlmOkNvbG9yU3BhY2U+MTwvZXhpZjpDb2xvclNwYWNlPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+ODI8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4K80N3zgAAElhJREFUeAHtO1lsXNd1d3vbvFnIISmKNm0xXuBWQl24Qly4dQCiTmwYRfrHfLcokPy0AVo0RWt/eAK0dl0Hjuu0H/FP+2391WiDpFbLIq0NFNBPACpwLUuUQ4uSKA5neW/edpeec4dvOENRCuVFFmpdYOa9ueu5Zz/n3qFfeuq1ecYLExESX2kcS8mpbyhyt3xuGKCLv/NX9+LqWhLGREUbmqZ04A823u1lhLT05wbZF3RhYbRDudTxfNKMtmuD0HgmKGqmct/XAkXdlxJXh4NzP/p2DvgxX1Ac3dZtCxIQIgqqz/zXtwpYuQN47y4+8X1fV1SFJroykEV1aflvCxH4g8ZVLzlzxva7rUB+kRYT+zZLCaFm412SQH1CVlb4fPdxP+WywpOkntSS+oNPv5L7eWWwRrZSstqS+8bf/fkJMUDvffblRa8w/fNv/0X3ZnMtL7fEZhEEuS8ruSscmjlGa52xjMUb7/4pEvBu+RQwwOsPf60uNMl3zr8NRvzGZX19VW//4u28c+Hf4/sfezI1GTXUcXyPFOFC+GS6tbV61zu7MfoO3cIO3XOs49qpVo4SNet2u1Y0jo813n39RBj4WASBFcHWELL5iZa+O/ggDHxcglgXeMHOCG7a3fKpYeDjEuRTA+DuRJMYuEuQSXx87r8OiEPuRuSHp4qhJ1a+64z3z6ImPZe01f4YbWXlTX6qzBNCCPFQ0OTluEXov7ob0wkbAu6R5U5Mj9DFJ1719WxIL731rUG5iRs9H3r2dY8leS3muQmVS3PC5frqn0AGghBoq4s8ciLhH3qfVZlS3sz76FlevyY1WfR6I0kSjzlkN++XkJP9S1tnhut5pN32TCP032mfw7BgG+dY9Or1hCQVJolWtOAbQRNjwB58qKDMMQUtwge++jckmE6TgxfGaW5vObHScpMdPzBG+bkqHJ52NHBZNuKyG4Djfdg23fm6R41PBqCQKc9dsvJmH7PYhVbhgHuCZsX1BBn3TcbC3D7hZIqQ/kHLIfEzmThIDMZcI1nOqz3SLWYedo8989ezaSYZCetAKcMqbnUUeMtByoXjG+ZQYwpHy7xWEtughLSVx0NNVC2LghqmRkSskwUnSUoxOgiYz6KuzAaouvK729o1mlLKDAA+3PBh1lxbe6FYmntF5W7uWA40QixubLgbxKRM/p32CM+1lzKthXXdcU7GpGE5oACKUTlVjmGIYK1zyiHPt0bWDgp6qVFZwyhIzjpUq8IwX7D8vf/+TjT/9CtzgglAOh2OKwZkkPfdR37v5ZoqAlpEfaHhyENrQiknRgeXA2hzsE3spj0SAnrtkV4QyJAEfV5MRSRo3LP8vZTUaoNLPkTxp06NA4WbuZ7LcEe3WnbzZUIF/gcs9gArjGa+AUzAB9eYUNGHmJ0amb3azQsjqFM1zWpEqzuh3IAc3YXTrS1CXjBHv/LSrHAct0Rk4fP80o87bTxuePTpV8JtbqYZcCgim/LE7Nu7haH57Ou1lCSuoEIh4RBOyj0rBUBKQUAdQQLEEh0oZkBYvaggPqYIgXITxxo68SqRV1AR9dWe9QCj8t5QNPsnToC6WBCBljrIs2hmMf51TZ55IhFZb7C++gKkWKglxuYleKuNyfch0DXsYujS8j95Orwc0J72JdecyhznNMJzlSpigP9WCWFnpqBGXFBbqkGIIsdL2EDp2ILnOy0auK8xeyRHQmBPQMSOBmYbnv2ASuMkgXHecESmvHFGtJUnT/7QuSo7VfihCUAK6GdOQSM4psgwIevsmLigNBzOsPeNqhKJs1czfEPmMwmh0m3kewQZ67W2BgZsjYBeM72l5e96WnqB4UWQu7Xw2DOvSZp9P5np/zwuZkK6nU8Qe2yW619R5+pi4Bvzol+YQJiYgQljsB8gAonhxWEmiw3wpYQ08sgLuX6mg2sAUeJKtjXL5uuEVKAPmFAlDOtMbaMzYA0q2BOme+8zqvcQExhQbrsl1dLaVfyJxHKJO2or+2zW+g02UlUxc2m1uLDaQaNMUJqClRNJvl2vIqKxClWiiio783kou0eyAGxLrZROT6jCbxzrZNFlupicGJMQHAkFjal/fsEMzz2oWV8lKVTDp9W95+vEl4PZgILCvVx7sMpAC6JTALZnpI/tJPu/Wi320Gl3BgCxdoE5oEIBJahDkbt0khPf9UC+4zRN6gWfEjoTHgdDXrL2/hkP/H3Fje2BW+ZRpbMcQANDmxUUctR41oOFPhRdFino+6E6hIqqY/o03JUCQyX7AUd9UxavyEsJsWoamQr24SGyhzbAAcOc03uWq02Pv8aN6nS7G3VqQAVxx7W2BSgsL0JGfAMmnVtueS5BfEkguKDFQBcf/OQb1qifQwDLhe0TEHfs3cY86kStVWYqeXLJX9tvPwjamzlC/EbgBoU24uK1i9fImTfKTU9MiT9QBYLnM4dcYecuQNDBq3ESCjt3UpkZwH/PiKDpgqGE8xft0o6zLUVaBW/Exc2jkX28fu/Vm3pZ4Ovfv/lBXbtepeRO4zl0noY7WzttD+ysVURotMeBRMPNXdxyDgQRI8nUAKfpJ+1LZ1ooYZYgYLBDwfU0Ogzjc1i1BZK9/q9/fvmR3365FtVJQ2jX2hecX8tqxkRmuCvdTGboCYADWVBPeIXKRS49wxobvWhSZa0dh0Xfh3UEWAnfJ30eLPW/LPWTv4GTJSP7AfYGrGOEHwJEJK03JoAbBxTffX/BdHQHNkuA+1wFx8QDLUKQuk0dkjmxPdWtkky4BUnAqYKNggpv1hQbwBPF85CFomtbW24VHQ0CANxpjS2g8koSg23iXg5mnEmqKZl0e2VVcOAMTgYBYH2vDaU/OBKUEmLBmM1jGlcqkgD7jRMWz4eI7tl4J5kC8oAZ1M7QqGM/HfStGILEjuwIEiWT8AXGgACHZvc30XhOFuyENZYrwd1E31oJFkpWn/nSUy8egXilgWoNu9iRraExtO83+QoJT/Mk6TiMtwsQAzrYDpQTNDtBNCUylAKAeozrHC82jLvXGcCbLGH79qVnvYGh5wNYBqn0QQUWXBbEM4nQcgLBNn5Qaa6pzlCfj8+POMAoerfOzr+22orWwyXgxWGx7jGoXRZk4PC0LP/I2OFIzLIPPnFd/JT4LdsQPpQkJ0nlY9WjwLP7CorReJVFFBAGgQNfQGSS1rrbYg506SyKJgGPY7z/Qe9nvr6pon40CABZ4IM3Ra6nieI2FEMilOplfGyRRRNwjLfd7F2KPWTgXtCzOfeb7eKj089tX3rrz64hYdCdRUTiM2NcXv7Rc9ewLdmOI1RTwzbwvrQHKY0XSoKMlkW1WIBDiP3QI0SEflh5cGjUiaEeR7U3gImGa9SLpHfxx8WVav3hbTTwo4ngBRn0IqjiL88tbaE6nlRZ4z0PeEfilLGBNdAO8e6rdGr6qb8HyUvSyXtdhloPLfQCtso92RBcgaFjkmn0FA+Y/tOoAmRkwDpl2F0hHNQ4qNXRej53eLZrs63LC/EGLGyRVLs34NEuWtFNS9wBjBu6+CVwkMYJtEsqcJdtqBKhn6qbzug+28op8OLAfQQvbiilDsmCJkjetzU52yJqXliHApkFCXnu3/4YDDo1p3YXuCWClEDhE7m61NPU5D5wfXCs95Eyv/tSKjKq0bXNVQCyBbsF2FA3gwmf4I7x+T6V95FLO7QDiPBUgUddFrB3ahU8LAfbUevCtxp5USRpg+4Xe0pDaH9vrO3dYk4F3ECD23Agqi+oQz1ptjoGCdXo9RS6rxNeHOBJ5ckUOANmgIEmyywOkLmN49Cjz/5gNshfYxTuw+Ep7N7qdsFb+yr1NBIH0xv4G6NO8CFqqN5symPMLtza7JO96SHsyYmzZzmmMMZHeiCT5e+Tby3w0hCXsFdBZZXtpbrDNtwT6GcXb3YuLf8jRNiYnGwCKY3gTmhzV/iULIM5g6aumdnuYr2adiRDz66cE5+5Eg54Zi44yhMCgOoObvN4GU0h1kvtmIkO45N83HfciJUE/ktNyy0toYqIbW1tTWx0/wTdep2jVJQxBrYHMh1x+XZtE+KEukW21e+QJ2s3RuoTInjDMoke7hB26x0VGfDVRbtUX2WCo1sMAobr2Er4sgac5TSs0KJTgwugUIfzI2HxKfigYArsjS8ZuA0jhrEG3TClckil1TAQR//2Di2OVzVXE9iQ6zHIoZtAqWz1p2hgWzeEuOH1eAcDnLHSzeojguS1BVaRHQo2BOK2mCWgNo6cn4I8FxRQd3ClBvBRgca9+IyRQi8VRK5Dl8Wleh5d7uy0e54hc7u5FRwLPheszRZ6JCmEH2Z8SCsbx4CLf/H085AnI+Tep16cQWcG00Myy3mdFJ211efhWvUwxsE+dyxBiiykosIRmbEfBPHwOutzN7VBifC5Ze5dJUQhYyW8IwaQzVdgorPkrNw5v9BmbmyiHGIet2JqtU2zAvmn8+d3WASR1/bMmOcLyRbqJAay3paoZ96wtzbHOiAKhwX94HPwgYQsJIMgmkIhA95wy0gf7Jf/DjgUhg9tCGQIduBqqB3dalFwPIb1tqL8AsCP9d4/Mp6aLptu5xM562htqn3mEAdSY3BRODqYK6Pgsn7PzayQYXJvaPDLdtDqIxUyHgdhOxrtgrvWZcbfi8+8Csd81MPgEn+PF/wHwX153P65Gzad3Ugc23F9GzTCe2m/ynEYweM7qvkLXym20Bu8YyWkBBrhhc9NJQP7Qo4ohMQ2JMAcmzbHOixqZGBhCge3e+MtS1aM0iboBencZyQ3pdGnaOQLSLPSAJKgGONAH1zDurARBJwwGlPvpgJqbzBUe3b90pyieRormLnAnJeTOJK0nrfEuQ46uwj8KWFs3OfyOnbn65cSAwCkLnc9n+gsFsoQMTIbQJGPCT54y4EyzC3E7o3OFkgLBJWJK00NcAe2HbM8WAKVMMUbeb9foe5MT8YqNWX6fmL9MbOD45hwTZAxBplua9CxbhLxd4DKQhGX4MzMuGznZz/5ToxAHrIcSpIOOdfn1m2kPy0Ep1Y0kyGYEMhyQhCDdei23S7oUPSRGLheL5+9Vd6+bXB+lvjYp7LgmLP55rUTW1tBprpBBgoZk4u02MtQfhbAYCBlItClcBgEiaEkmH4ALlsMzwgOu96J5X+ors3NJY92L/qqERe8Gzpw+id5L7EheawdiRnkSGOObx7U0EUC6X5LRJm0KWayH/jqy/X52M23IBlZgZgDJfTkN3/odH+xGfBeYHAOPduj0z6ROykRFdlU2A/XGfWH3N7O9E6F9VM4xK8XwpuGY4W+C2vkuB7CoySchzRJhmOyWDMBnhwmLXGv+wgCNZDgWsO0Onwwqwv3jHxFZVAoBw5/wJCBK1kaM5zgVksZMKEnhW4h5nOMSRNGjkJ6//dHx8O3Om/Xy9yl4iMBN1S4jJpSKOZzP86Nwz28EiQ504g4SrJwffUPur/25EvTOx2ZumHu1t1QPvr09yqDpOJueooCUnQvH+ZQ0v/d9EjQ9OKqVD4TNM3rYNsvxPV8IeCqDSe8dSQ47wwkSnac1jY9mXosa4R5kFOwGh3CEiVm+peSbtAMAB5X+JHhSa5zsHuqXi0UHDuU+51UWWXt7hOvBIH/37tw+vmrQve2gYMji0BQZ6VK2zfkpj9xDEqc7cTDRCq2c7H+ztUP/+UvdwBJkLqeTOTddLJ9jU1I6bMoq+MdKkxfpAr2iUe4EH3j/awrwO3IkRUntHFE4dWYP9VzWKbddp/D/Sg4TJ8O04InPO/HXIcpXV7+DwFGTMCxrsL7WV7CtcFn9VccDXPu1BZ0DHk7uHsF3pxhJ09+08H+DO59BRXh4GmjnQ/uhhFykoCUYMDO8E7R2tzxhKs8gztkbqr3BOOmBBnbMxzltlK8cLa+OriKV4cg8EkstwOnl8Q5yN6gXRjapIL6nsjx3tKDRXL1o9N/tI1IOuhGx9i6h379WeN/AG/pVWSijcXFfJ10owXn8eSD34qvOVuYwzX0EfiX8Uz8q/aOVdhxemkHsujVam/jmV7mXwv77/3zH/aPdtZ7c8mFSLevpuvkP4GzF2K83JGqPF5b3hpMAcG7JFPOXNS75E9nuM5j9x+P8Y+y27V7OPYnpJuSzlT63teSGPvjiSghZwi2ITxHH5yxOWXoKHMyE23Uj4/ubI1E5dA7H+8IXtnc1tmgodwgg7y2PUuw+V3YPvr/4Hc7NJHgsKd30iW88S3cae+fjCBju8GrMd0jm4FMKhVrpEWashiPfVvox/+/8IDGtvuZvf4f1azOqNpo8RwAAAAASUVORK5CYII=",Za=100,Ka=41,qa=new q,Ja=new Ae;class $a extends v{get size(){var e;return null!==(e=this._size)&&void 0!==e?e:this.size=new w(100,100)}set size(e){this._size=e;const{x:t,y:n}=e,{camera:i,currViewport:r}=this;r.set(t*Math.random(),n*Math.random(),t,n),i.left=i.right=t/2,i.left=-i.left,i.top=i.bottom=n/2,i.bottom=-i.bottom,i.updateProjectionMatrix()}get velocity(){var e;return null!==(e=this._velocity)&&void 0!==e?e:this._velocity=this.direction.clone().multiplyScalar(this.speed)}set velocity(e){this._velocity=e}constructor(e){super(),this.viewport=e,this.fontSize=50,this.imageWidth=200,this.camera=new b(-1.6,1.6,.8,-.8,0,4),this.direction=(new w).random().normalize(),this.speed=2,this.currViewport=new q,this.lastRenderTime=0,this.autoRender=e=>{e-this.lastRenderTime>30&&this.render(),requestAnimationFrame(this.autoRender)},this.camera.position.z=2,this._generateMarkForImage()}_generateMark(){}_generateMarkForString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[28145,22323,36805,32500,25968,23383,23402,29983,25216,26415,26377,38480,20844,21496];const t=Array.isArray(e)?String.fromCodePoint(...e):e,n=t.length,{fontSize:i}=this,r=i/4,s=2*r,{x:o,y:a}=this.size=new w(i*n+s,i+s),l=document.createElement("canvas");l.width=o,l.height=a;const c=l.getContext("2d");if(!c)return;const h=c.createLinearGradient(0,0,o,a);h.addColorStop(0,"#ff3653"),h.addColorStop(.5,"#8adb00"),h.addColorStop(1,"#2c8fff"),c.fillStyle=h,c.font=`bold ${i}px/1 serif`,c.fillText(t,r,a-1.5*r);const d=Ja.load(l.toDataURL()),f=new xe({map:d,toneMapped:!1,transparent:!0}),p=new u(new Se(o,a),f);this.add(p)}_generateMarkForImage(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xa,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Za,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ka;const i=this.imageWidth,r=i*(n/t);this.size=new w(i,r);const s=Ja.load(e),o=new xe({map:s,toneMapped:!1,transparent:!0}),a=new u(new Se(i,r),o);this.add(a)}render(){const{renderer:e}=this.viewport;e.getViewport(qa);const{width:t,height:n}=e.domElement,i=new w(t,n),{position:r,velocity:s}=function(e,t,n,i){i=null!=i?i:n.length();let{x:r,y:s}=e,{x:o,y:a}=n;r+=o,s+=a,(r+e.width>=t.x&&o>0||r<=0&&o<0)&&(o=-o*Math.random());(s+e.height>=t.y&&a>0||s<=0&&a<0)&&(a=-a*Math.random());const l=new w(o,a);l.normalize().multiplyScalar(i);const c=new w(e.x,e.y).add(l);return{position:c,velocity:l}}(this.currViewport,i,this.velocity,this.speed),o=this.currViewport;o.x=r.x,o.y=r.y,this.velocity=s,e.clearDepth(),e.setViewport(o.x,o.y,o.z,o.w),e.render(this,this.camera),e.setViewport(qa.x,qa.y,qa.z,qa.w)}}J.prototype.computeBoundsTree=dt,J.prototype.disposeBoundsTree=ft,u.prototype.raycast=pt,Ee.prototype.firstHitOnly=!0;const el={needsUpdate:!1};let tl=0,nl=0;const il=e=>{e instanceof l&&e.dispose()};class rl{constructor(e){this.clock=new Te,this.raycaster=new Ee,this.sky=null,this.options=e,this.state={useFreq:1,isPausedRender:!1,isDisposed:!1},this.signals={windowResize:new Xi,cameraObjectChange:new Xi,sceneChanged:new Xi,backgroundChanged:new Xi,beforeRender:new Xi,sceneRendered:new Xi,loadRendered:new Xi,tweenUpdate:new Xi,hover:new Xi,click:new Xi,dblClick:new Xi,rightClick:new Xi,mouseDown:new Xi,mouseMove:new Xi,mouseUp:new Xi,mouseWheel:new Xi,keyDown:new Xi,keyUp:new Xi,modelHover:new Xi,modelUnHover:new Xi,modelClick:new Xi,modelDblClick:new Xi,modelRightClick:new Xi,poiHover:new Xi,poiUnHover:new Xi,poiClick:new Xi,poiDblClick:new Xi,poiRightClick:new Xi,selectPosition:new Xi,sceneClick:new Xi,objectAdded:new Xi,objectRemoved:new Xi,objectChanged:new Xi,geometryChanged:new Xi,materialAdded:new Xi,materialChanged:new Xi,materialRemoved:new Xi,cameraChange:new Xi,outlineChange:new Xi,modelAnimation:new Xi,getSceneInfo:new Xi},this.scener=new Ji(this.signals,this.state),this.scene=this.scener.scene,this.cameraManager=new Br(this),this.camera=this.cameraManager.currentCamera,this.rendererManager=new pr(this),this.container=this.rendererManager.container,this.interactiveContainer=this.rendererManager.interactiveContainer,this.renderer=this.rendererManager.renderer,this.rendererCSS3D=this.rendererManager.rendererCSS3D,this.rendererCSS2D=this.rendererManager.rendererCSS2D,this.pmremGenerator=new ae(this.renderer),this.pmremGenerator.compileEquirectangularShader(),this.effectManager=new lo(this.renderer,this.scene,this.camera),this.effectComposer=this.effectManager.effectComposer,this.bvh=new ho(this),this.controls=new So(this),this.info=new Ya(this.scene,this.signals),this.stats=vt(),this.mixer=new De(this.scene),this.clipsSet=new Set,this.postUpdate=new Map,this.postRender=new Map,this.selectModel=null,this.selectPoi=null,this._loop=0,this.viewHelper=new Wa(this.camera,this.container),this.license=new Va(this),this.waterMark=new $a(this),this._initInfo(),this._initStats(),this._signalsEventListenr(),this._containerAddEventListener(this.container),this.animate(0)}_initInfo(){if(this.options.showInfo){this.info.addListeners();const{container:e}=this.info;e.style.zIndex="1",this.container.appendChild(e)}}_initStats(){if(this.options.showStats){const{dom:e}=this.stats;e.style.zIndex="1",this.container.appendChild(e),this.signals.sceneRendered.add((()=>{this.stats.update()}))}}setSSR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:t=!0,intensity:n=1,exponent:i=1.75,distance:r=20,fade:s=0,roughnessFade:o=1,thickness:a=3.5,ior:l=1.75,maxRoughness:c=.1,maxDepthDifference:h=20,blend:u=.95,correction:d=1,correctionRadius:f=1,blur:p=1,blurKernel:g=1,blurSharpness:m=10,jitter:v=0,jitterRoughness:y=2,steps:b=20,refineSteps:w=10,missedRays:A=!1,useNormalMap:x=!0,useRoughnessMap:S=!0,resolutionScale:E=1,velocityResolutionScale:T=1}=e,{effectManager:D}=this;D.effectsNeedsUpddate=!0;const C=D.effectsMap.get(lo.CONSTANTS.ssrEffect);C.enabled=t;const{effect:B}=C;B.usingBoxProjectedEnvMap=!0,B.intensity=n,B.exponent=i,B.distance=r,B.fade=s,B.roughnessFade=o,B.thickness=a,B.ior=l,B.maxRoughness=c,B.maxDepthDifference=h,B.blend=u,B.correction=d,B.correctionRadius=f,B.blur=p,B.blurKernel=g,B.blurSharpness=m,B.jitter=v,B.jitterRoughness=y,B.steps=b,B.refineSteps=w,B.missedRays=A,B.useNormalMap=x,B.useRoughnessMap=S,B.resolutionScale=E,B.velocityResolutionScale=T,this.triggerRender()}setBloom(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const{enabled:n=!0,mipmapBlur:i=!0,radius:r=.85,intensity:s=3,threshold:o=1,smoothing:a=0,scalar:l=2,opacity:c=1,selection:h=[]}=e,{effectManager:d}=this;d.effectsNeedsUpddate=!0;const f=d.effectsMap.get(lo.CONSTANTS.bloomEffect);f.enabled=n;const{effect:p}=f;p.intensity=s;const{mipmapBlurPass:g,renderTarget:m}=p;g.enabled=i,g.radius=r;const v=p.uniforms.get("map");v&&(v.value=i?g.texture:m.texture),p.luminanceMaterial.threshold=o,p.luminanceMaterial.smoothing=a,p.blendMode.opacity.value=c,null===(t=p.luminanceMaterial.userData.bloomSelection)||void 0===t||t.forEach((e=>{e instanceof u&&e.material.color&&(e.material.toneMapped=!0,e.material.color.multiplyScalar(1/l))})),p.luminanceMaterial.userData.bloomSelection=[],n&&h.forEach((e=>{e.traverse((e=>{e instanceof u&&e.material.color&&(e.material.toneMapped=!1,e.material.color.multiplyScalar(l),p.luminanceMaterial.userData.bloomSelection.push(e))}))})),this.triggerRender()}setSSAO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:t=!0,depthAwareUpsampling:n=!0,samples:i=32,rings:r=7,distanceThreshold:s=.02,distanceFalloff:o=.0025,rangeThreshold:l=3e-4,rangeFalloff:c=1e-4,luminanceInfluence:h=.7,minRadiusScale:u=.33,radius:d=.1,intensity:f=3,bias:p=.004,fade:g=.01,color:m=null,resolutionScale:v=1}=e,{effectManager:y}=this;y.effectsNeedsUpddate=!0;const b=y.passesMap.get(lo.CONSTANTS.normalPass),w=y.effectsMap.get(lo.CONSTANTS.ssaoEffect);b.enabled=t,w.enabled=t;const{effect:A}=w,{ssaoMaterial:x}=A;A.depthAwareUpsampling=n,A.luminanceInfluence=h,A.resolution.scale=v,A.intensity=f,x.samples=i,x.rings=r,x.distanceThreshold=s,x.distanceFalloff=o,x.proximityThreshold=l,x.proximityFalloff=c,x.minRadiusScale=u,x.fade=g,x.bias=p,x.radius=d,m&&(A.color=new a(m)),this.triggerRender()}setColorSpace(e){this.renderer.outputEncoding="sRGB"===e?T:_,this.signals.sceneChanged.dispatch()}setToneMapping(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:t="ACESFilmic",exposure:n=.8}=e,i={None:Me,Linear:Oe,Reinhard:Pe,Cineon:Re,ACESFilmic:Be};this.renderer.toneMapping=i[t],this.renderer.toneMappingExposure=n,this.signals.sceneChanged.dispatch()}async setSphereSkyBackground(e){const t=Fn(e);if("hdr"===t||"pic"===t){const t=await(new mt).loadAsync(e);t.mapping=Ce,il(this.scene.background),this.scene.background=t}else{const t=await(new Ae).loadAsync(e);t.mapping=Ce,il(this.scene.background),this.scene.background=t}this.signals.backgroundChanged.dispatch()}async setSkyBackground(e,t){const n=await gn(e,t);il(this.scene.background),this.scene.background=n,this.signals.backgroundChanged.dispatch()}setBackgroundColor(e){il(this.scene.background),this.scene.background=new a(e),this.signals.backgroundChanged.dispatch()}setBackgroundColorAlpha(e,t){il(this.scene.background),this.scene.background=null,this.renderer.setClearColor(new a(e),t),this.signals.backgroundChanged.dispatch()}async setBackgroundImage(e){const t=new Ae,n=await t.loadAsync(e);this.scene.background=n,this.signals.backgroundChanged.dispatch()}setSky(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:n=!0,position:i={x:0,y:0,z:0},scalar:r=45e4,turbidity:s=10,rayleigh:o=3,elevation:a=2,azimuth:l=180,exposure:c=.6}=e;if(!n)return void this.closeSky();this.sky||(this.sky=new yt,this.scene.add(this.sky)),this.sky.name="sky",this.sky.position.set(i.x,i.y,i.z),this.sky.scale.setScalar(r);const h=this.sky.material.uniforms;h.turbidity.value=s,h.rayleigh.value=o,h.mieCoefficient.value=.005,h.mieDirectionalG.value=.7;const u=new t,d=hn(90-a),f=hn(l);return u.setFromSphericalCoords(1,d,f),h.sunPosition.value.copy(u),this.sky.userData.toneMapping=this.renderer.toneMapping,this.sky.userData.toneMappingExposure=this.renderer.toneMappingExposure,this.renderer.toneMapping=Be,this.renderer.toneMappingExposure=c,this.signals.objectAdded.dispatch(),this.sky}closeSky(){if(!this.sky)return!1;const{toneMapping:e,toneMappingExposure:t}=this.sky.userData;return this.renderer.toneMapping=e,this.renderer.toneMappingExposure=t,this.sky.removeFromParent(),this.sky=null,this.signals.objectRemoved.dispatch(),!0}screenshot(){return new Promise((e=>{this.renderer.domElement.toBlob((t=>{e(t)}))}))}setEnvironment(){return this.scene.environment=this.pmremGenerator.fromScene(new gt,.04).texture,this.signals.sceneChanged.dispatch(),this.scene.environment}playModelAnimation(e,t){let n;if(t instanceof Ie?n=t:_n(t)?n=e.animations[t]:kn(t)&&(n=e.animations.find(t)),!n)return;const i=this.mixer.clipAction(n,e);return i.play(),this.clipsSet.add(n),i}stopModelAnimation(e,t){var n;let i;t instanceof Ie?i=t:_n(t)?i=e.animations[t]:kn(t)&&(i=e.animations.find(t)),i&&(null===(n=this.mixer.existingAction(i))||void 0===n||n.stop(),this.mixer.uncacheAction(i,e),this.clipsSet.delete(i))}async render(e){return await(null==e?void 0:e()),new Promise((e=>{this.signals.sceneRendered.addOnce(e),this.triggerRender()}))}triggerRender(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.state.useFreq=e}async setPauseRender(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.state.isPausedRender=e,!1===e)return this.render()}_passesObserver(){this.effectManager.updateEffectPass()}autoRender(e){if(this.state.useFreq<=0&&!el.needsUpdate)return;if(this.state.useFreq>0&&this.state.useFreq--,el.needsUpdate&&(el.needsUpdate=!1),this.state.isPausedRender)return;tl=performance.now(),this.signals.beforeRender.dispatch(),this._passesObserver(),this.effectComposer.render();const t=this.scene.matrixWorldAutoUpdate;this.scene.matrixWorldAutoUpdate=!1,this.rendererCSS2D&&this.rendererManager.internalOptions.enableRenderCss2D&&this.rendererCSS2D.render(this.scene,this.camera),this.rendererCSS3D&&this.rendererManager.internalOptions.enableRenderCss3D&&this.rendererCSS3D.render(this.scene,this.camera),this.scene.matrixWorldAutoUpdate=t,this.options.showViewHelper&&this.camera===this.cameraManager.mainCamera&&this.viewHelper.render(this.renderer),this.license.getVerified()||this.waterMark.render(),this.postRender.forEach((t=>t(e))),nl=performance.now(),this.signals.sceneRendered.dispatch(nl-tl)}animate(e){this._loop=requestAnimationFrame((e=>{this.animate(e)}));const t=this.clock.getDelta();this.clipsSet.size>0&&(this.mixer.update(t),this.signals.modelAnimation.dispatch()),Vt.update()&&this.signals.tweenUpdate.dispatch(),this.postUpdate.forEach((t=>t(e))),this.autoRender(e),this.signals.getSceneInfo.dispatch(this.info.state)}getOffsetByPosition(e){const n=new t(e.x,e.y,e.z).project(this.camera),i=this.renderer.domElement.getBoundingClientRect();return{left:Math.round(i.left+i.width/2*(n.x+1)),top:Math.round(i.top+i.height/2*(1-n.y))}}getPositionByOffset(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1;const i=new t(0,0,0),r=new t(0,0,0),s=this.renderer.domElement.getBoundingClientRect();r.set(e.offsetX/s.width*2-1,-e.offsetY/s.height*2+1,n),r.unproject(this.camera),r.sub(this.camera.position).normalize();const o=r.distanceTo(this.camera.position);return i.copy(this.camera.position).add(r.multiplyScalar(o)),i}getIntersects(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scener.intersectsList.getAll(),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{isFilterHideObject:i=!0}=n,r=this.container.getBoundingClientRect();let s={offsetX:0,offsetY:0};if(e instanceof MouseEvent)s={offsetX:e.clientX-r.left,offsetY:e.clientY-r.top};else if(e instanceof TouchEvent){const t=e.changedTouches[0];s={offsetX:t.clientX-r.left,offsetY:t.clientY-r.top}}else s=e;const o=new w;o.set(s.offsetX/r.width*2-1,-s.offsetY/r.height*2+1),this.raycaster.setFromCamera(o,this.camera);let a=[];return a=Ln(t)?this.raycaster.intersectObjects(t,!0):this.raycaster.intersectObject(t,!0),i?a.filter((e=>{let{object:t}=e;return fn(t)})):a}rayClash(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.camera.position,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new t(0,-1,0),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.scener.intersectsList.meshOfModelList;const r=new Ee;return r.set(e,n),Ln(i)?r.intersectObjects(i,!0):r.intersectObject(i,!0)}setHoverEnabled(e){this.options.hoverEnabled=e}clearSignals(){for(const e in this.signals)this.signals[e].removeAll()}dispose(){cancelAnimationFrame(this._loop),this.bvh.dispose(),this.mixer.stopAllAction(),this.clipsSet.forEach((e=>{this.mixer.uncacheAction(e),this.mixer.uncacheClip(e)})),this.mixer.uncacheRoot(this.scene),this.clipsSet.clear(),this.controls.dispose(),Vt.removeAll(),this.clearSignals(),this.scene.clear(),this.pmremGenerator.dispose(),this.effectComposer.dispose(),this.renderer.dispose(),this.renderer.forceContextLoss(),this.container.remove(),this.state.isDisposed=!0}_signalsEventListenr(){const e=()=>{const{offsetWidth:e,offsetHeight:t}=this.container;this.effectManager.updateCamera(this.camera),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.effectComposer.setSize(e,t),this.rendererCSS3D&&this.rendererCSS3D.setSize(e,t),this.rendererCSS2D&&this.rendererCSS2D.setSize(e,t),this.triggerRender()};setTimeout((()=>e())),this.signals.windowResize.add(e),this.signals.cameraObjectChange.add(e),this.signals.sceneChanged.add((()=>this.triggerRender())),this.signals.backgroundChanged.add((()=>this.triggerRender())),this.signals.objectAdded.add((()=>this.triggerRender())),this.signals.objectRemoved.add((()=>this.triggerRender())),this.signals.objectChanged.add((()=>this.triggerRender())),this.signals.materialAdded.add((()=>this.triggerRender())),this.signals.materialRemoved.add((()=>this.triggerRender())),this.signals.materialChanged.add((()=>this.triggerRender())),this.signals.geometryChanged.add((()=>this.triggerRender())),this.signals.cameraChange.add((()=>this.triggerRender())),this.signals.tweenUpdate.add((()=>this.triggerRender())),this.signals.modelAnimation.add((()=>this.triggerRender()));this.signals.outlineChange.add((e=>{const{objects:t,options:n}=e,{color:i,hideColor:r,edgeThickness:s,edgeStrength:o}=Object.assign(Object.assign({},{color:16777215,hideColor:10066329,edgeThickness:3,edgeStrength:10}),n),{effectManager:a}=this;a.effectsNeedsUpddate=!0;const l=a.effectsMap.get(lo.CONSTANTS.outlineEffect),c=t.length>0;l.enabled=c;const{effect:h}=l,{uniforms:d}=h,f=[];t.forEach((e=>{e.traverse((e=>{e instanceof u&&f.push(e)}))})),h.selection.set(f),h.blur=s>0,h.blurPass.kernelSize=s;const p=d.get("visibleEdgeColor"),g=d.get("hiddenEdgeColor"),m=d.get("edgeStrength");p&&p.value.set(i),g&&g.value.set(r),m&&(m.value=o),this.triggerRender()}))}_containerAddEventListener(e){const t=[0,0];let n=null;const i=r=>{var s,o;this.signals.mouseUp.dispatch(r);const a=r.offsetX-(null!==(s=null==n?void 0:n.offsetX)&&void 0!==s?s:0),l=r.offsetY-(null!==(o=null==n?void 0:n.offsetY)&&void 0!==o?o:0);if(Math.abs(a)>2||Math.abs(l)>2)return t[0]=0,void(t[1]=0);setTimeout((()=>{0!==t[0]&&0===t[1]&&(0===r.button?(this.signals.click.dispatch(r),this._triggerSceneEventInAllObject("click",r)):2===r.button&&(this.signals.rightClick.dispatch(r),this._triggerSceneEventInAllObject("rightClick",r))),t[0]=0,t[1]=0}),300),e.removeEventListener("mouseup",i,!1)};let r=!1,s=null,o=null;const a=[0,0],l=e=>{var t,n;s&&clearTimeout(s);const i=()=>{r=!1,a[0]=0,a[1]=0},l=e.changedTouches[0].clientX-(null!==(t=null==o?void 0:o.changedTouches[0].clientX)&&void 0!==t?t:0),c=e.changedTouches[0].clientY-(null!==(n=null==o?void 0:o.changedTouches[0].clientY)&&void 0!==n?n:0);Math.abs(l)>2||Math.abs(c)>2?i():r?(i(),this.signals.rightClick.dispatch(e),this._triggerSceneEventInAllObject("rightClick",e)):setTimeout((()=>{0!==a[0]&&0===a[1]?(this.signals.click.dispatch(e),this._triggerSceneEventInAllObject("click",e)):0!==a[0]&&0!==a[1]&&a[1]-a[0]<=300&&(this.signals.dblClick.dispatch(e),this._triggerSceneEventInAllObject("dblClick",e)),i()}),300)};e.addEventListener("mousedown",(r=>{n=r,this.signals.mouseDown.dispatch(r),0===t[0]?t[0]=performance.now():0===t[1]&&(t[1]=performance.now()),e.addEventListener("mouseup",i,!1)}),!1),e.addEventListener("mousemove",(e=>{this.signals.mouseMove.dispatch(e),this.options.hoverEnabled&&this._triggerSceneEventInAllObject("hover",e)}),!1),e.addEventListener("dblclick",(e=>{this.signals.dblClick.dispatch(e),this._triggerSceneEventInAllObject("dblClick",e)}),!1),e.addEventListener("wheel",(e=>{this.signals.mouseWheel.dispatch(e)}),{passive:!0}),e.addEventListener("touchstart",(t=>{0===a[0]?a[0]=performance.now():0===a[1]&&(a[1]=performance.now()),o=t,s&&clearTimeout(s),s=setTimeout((()=>{r=!0}),800),e.addEventListener("touchend",l,{once:!0})}),{passive:!0}),e.addEventListener("contextmenu",(e=>e.preventDefault()),!1),document.addEventListener("keydown",(e=>{this.signals.keyDown.dispatch(e)}),!1),document.addEventListener("keyup",(e=>{this.signals.keyUp.dispatch(e)}),!1)}_triggerSceneEventInAllObject(e,t){const n=this.getIntersects(t,this.scener.intersectsList.getAll());if(0===n.length)return this.selectModel&&this.signals.modelHover.numListeners>0&&this.signals.modelUnHover.dispatch(this.selectModel),this.selectPoi&&this.signals.poiHover.numListeners>0&&this.signals.poiUnHover.dispatch(this.selectPoi),this.selectModel=null,this.selectPoi=null,void this.signals.sceneClick.dispatch({type:e,event:t});const i={object:null,type:null,point:null},r=[],s=[];function o(e){return e.parent?"Model"===e.parent.stype?e.parent:o(e.parent):void 0}n.forEach((e=>{if(e.object.parent instanceof pl){const t=e.object.parent;i.object||(i.type="Poi",i.object=e.object,i.point=e.point);-1===r.findIndex((e=>e.poi.uuid===t.uuid))&&r.push({poi:t,sourceData:e})}else if(e.object instanceof v){const t=o(e.object);t&&(i.object||(i.type="Model",i.object=e.object,i.point=e.point),s.push({model:t,sourceData:e}))}})),"click"===e&&i.point&&this.signals.selectPosition.dispatch(i.point);const a=e.slice(0,1).toUpperCase()+e.slice(1),l=e=>{var n;const{model:r}=e[0];if(r)if("Hover"===a)(null===(n=this.selectModel)||void 0===n?void 0:n.uuid)!==r.uuid&&(this.signals.modelHover.dispatch({target:r,currentTarget:i.object,intersects:e,event:t}),this.selectModel=r);else{let n=null;"Click"===a?(n=r.onClick,r.dispatchEvent({type:"click"})):"RightClick"===a?(n=r.onRightClick,r.dispatchEvent({type:"rightClick"})):"DblClick"===a&&(n=r.onDblClick,r.dispatchEvent({type:"dblClick"})),n?n(r):r.isEventPropagation=!0,r.isEventPropagation&&(this.signals[`model${a}`].dispatch({target:r,currentTarget:i.object,intersects:e,event:t}),r.isEventPropagation=!1)}},c=e=>{var n;const{poi:i}=e[0];if(i)if("Hover"===a)(null===(n=this.selectPoi)||void 0===n?void 0:n.uuid)!==i.uuid&&(this.signals.poiHover.dispatch({target:i,event:t}),this.selectPoi=i);else{let e=null;"Click"===a?(e=i.onClick,i.dispatchEvent({type:"click"})):"RightClick"===a?(e=i.onRightClick,i.dispatchEvent({type:"rightClick"})):"DblClick"===a&&(e=i.onDblClick,i.dispatchEvent({type:"dblClick"})),e?e(i):i.isEventPropagation=!0,i.isEventPropagation&&(this.signals[`poi${a}`].dispatch({target:i,event:t}),i.isEventPropagation=!1)}};if("Hover"===a){if(s.length>0){const[{model:e}]=s;this.selectModel&&this.selectModel.uuid!==e.uuid&&(this.signals.modelUnHover.dispatch(this.selectModel),this.selectModel=null)}if(r.length>0){const[{poi:e}]=r;this.selectPoi&&this.selectPoi.uuid!==e.uuid&&(this.signals.poiUnHover.dispatch(this.selectPoi),this.selectPoi=null)}}"Model"===i.type?l(s):"Poi"===i.type&&c(r)}}class sl extends u{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"BaseMesh";super(e,t);const{id:r,name:s="",level:o={max:null,min:null},visible:a=!0,position:l={x:0,y:0,z:0},rotation:c={x:0,y:0,z:0},scale:h={x:1,y:1,z:1},userData:u={}}=n;if(void 0===r)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=r,this.name=s,this.stype=i,this.level=o,this.visible=null==a||a,this.handleHide=!a,this.position.set(l.x,l.y,l.z),this.rotation.set(c.x,c.y,c.z),this.scale.set(h.x,h.y,h.z),this.castShadow=!0,this.receiveShadow=!0,this.userData=u,this.isEventPropagation=!1,this.autoUpdate=!1}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0,el.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,el.needsUpdate=!0}setMove(e,t,n,i){return Vn(this.position,sn(e),t,n,i)}setRotate(e,t,n,i){const s=on(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return Vn({t:0},{t:1},t,((e,t)=>{let{t:i}=e;this.quaternion.slerpQuaternions(o,a,i),null==n||n(this.rotation,t)}),i)}setScale(e,t,n,i){return Vn(this.scale,sn(e),t,n,i)}getBoundingBox(){return new i(new t,new t).setFromObject(this)}eventPropagation(){this.isEventPropagation=!0}sClone(e){return new sl(this.geometry,this.material,{id:`clone_${zn()}`}).sCopy(this,e)}sCopy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.geometry=e.geometry,this.material=e.material,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++)e.children[t]instanceof al||e.children[t]instanceof sl?this.add(e.children[t].sClone()):this.add(e.children[t].clone());return this}}const ol={onLoad:null,onClick:null,onDblClick:null,onRightClick:null};class al extends v{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BaseObject3D";super();const{id:n,name:i="",level:r={max:null,min:null},visible:s=!0,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},userData:c={},onLoad:h,onClick:u,onDblClick:d,onRightClick:f}=Object.assign(Object.assign({},ol),e);if(void 0===n)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=n,this.name=i,this.stype=t,this.level=r,this.visible=null==s||s,this.handleHide=!s,this.isEventPropagation=!1,this.position.set(o.x,o.y,o.z),this.rotation.set(a.x,a.y,a.z),this.scale.set(l.x,l.y,l.z),this.castShadow=!0,this.receiveShadow=!0,this.userData=c,this.autoUpdate=!1,this.onLoad=(null==h?void 0:h.bind(this))||null,this.onClick=(null==u?void 0:u.bind(this))||null,this.onDblClick=(null==d?void 0:d.bind(this))||null,this.onRightClick=(null==f?void 0:f.bind(this))||null}eventPropagation(){this.isEventPropagation=!0}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0,el.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,el.needsUpdate=!0}setMove(e,t,n,i){return Vn(this.position,sn(e),t,n,i)}setRotate(e,t,n,i){const s=on(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return Vn({t:0},{t:1},t,((e,t)=>{let{t:i}=e;this.quaternion.slerpQuaternions(o,a,i),null==n||n(this.rotation,t)}),i)}setScale(e,t,n,i){return Vn(this.scale,sn(e),t,n,i)}sClone(e){return new al({id:`clone_${zn()}`}).sCopy(this,e)}sCopy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),this.animations=e.animations,!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];n instanceof al||n instanceof sl?this.add(n.sClone()):this.add(n.clone())}return this}getBoundingBox(){return new i(new t,new t).setFromObject(this)}getSpaceAttribute(){return un(this,!(arguments.length>0&&void 0!==arguments[0])||arguments[0])}syncSpaceAttribute(e){e instanceof al?dn(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1]):rn("In soonspacejs: BaseObject3D 对象原型方法 'syncSpaceAttribute' 第一个参数对象类型错误!")}}class ll extends al{constructor(e){super(e,"Group")}showAllChild(){this.children.forEach((e=>{e instanceof al&&e.show()}))}hideAllChild(){this.children.forEach((e=>{e instanceof al&&e.hide()}))}}class cl extends al{constructor(e){super(e,"PluginObject")}}class hl extends al{constructor(e){super(e,"PoiNode");const{type:t,element:n,elementAutoDisplay:i=!0,occlude:r=!1,onChange:s}=e;this.elementType=t,this.element=n,this.elementAutoDisplay=i,this.occlude=r,this.onChange=s,this.create(t)}create(e){"2D"===e||"2d"===e?this._create2D():"2.5D"===e||"2.5d"===e?this._create2DHalf():"3D"!==e&&"3d"!==e||this._create3D()}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0}getBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;e=e<=0?50:e;const n=new t,r=new t,s=new t(e,e,e);return n.copy(this.position),r.copy(this.position),n.sub(s),r.add(s),new i(n,r)}_create2D(){this.add(new $i(this.element))}_create2DHalf(){this.add(new hr(this.element))}_create3D(){this.add(new cr(this.element))}}class ul extends al{constructor(e){super(e,"Model");const{format:t}=e;this.formatType=t}setEnvMap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};gn(e,t).then((e=>{this.traverse((t=>{if(t instanceof u&&t.material instanceof g){const{reflectivity:i=.5}=n;t.material.envMap=e,t.material.envMapIntensity=i,el.needsUpdate=!0}}))}))}sClone(e){return new ul({id:`${this.sid}_clone`,url:"",format:this.formatType}).sCopy(this,e)}}const dl={position:{x:0,y:0,z:0},scale:{x:16,y:16,z:1},stype:"Icon"};class fl extends _e{constructor(e,t){super(e);const{position:n,scale:i,stype:r}=Object.assign(Object.assign({},dl),t);this.stype=r,this.position.set(n.x,n.y,n.z),this.scale.set(i.x,i.y,i.z),this.renderOrder=1}}class pl extends al{constructor(e,t){super(t,"Poi");const{name:n,type:i="2.5d",nameScale:r={x:16,y:16,z:1}}=t;this.iconType=i,this.icon=this._createIcon(e);const s={position:{x:0,y:10,z:0},name:n,scale:r};this.text=this.name?this._createText(s):null,this.renderOrder=11}getBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;e=e<=0?50:e;const n=new t,r=new t,s=new t(e,e,e);return n.copy(this.position),r.copy(this.position),n.sub(s),r.add(s),new i(n,r)}sClone(e,t){return new pl(this.icon.material,{id:`${this.sid}_clone`,url:"",type:null!=t?t:this.iconType,name:this.name}).sCopy(this,e)}_createIcon(e){const t=new fl(this._computeMaterialSizeAttenuation(e));return this.add(t),t}_createText(e){const t=this._createTextMaterial(e),n=new fl(this._computeMaterialSizeAttenuation(t),e);return this.add(n),n}_createTextMaterial(e){const t=this._createTextCanvas(e.name||""),n=new l(t);n.flipY=!0,n.version+=1;return new Le({map:n,depthTest:!0})}_createTextCanvas(e,t){const n=256,i=document.createElement("canvas");i.width=n,i.height=n;const r=i.getContext("2d"),{fontFamily:s,fontSize:o,color:a,textAlign:l,textBaseline:c}=Object.assign(Object.assign({},{fontFamily:"Microsoft YaHei",fontSize:32,color:"#fff",textAlign:"center",textBaseline:"bottom"}),t);return r&&(r.save(),r.font=o+"px "+s,r.textAlign=l,r.textBaseline=c,r.shadowColor="black",r.strokeStyle="black",r.lineWidth=3,r.fillStyle=a,r.strokeText(e,128,128),r.fillText(e,128,128),r.restore()),i}_computeMaterialSizeAttenuation(e){return"2D"===this.iconType||"2d"===this.iconType?e.sizeAttenuation=!1:"2.5D"!==this.iconType&&"2.5d"!==this.iconType||(e.sizeAttenuation=!0),e}}class gl extends sl{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Point";const{radius:n=10,color:i=16777215,opacity:r=1,gradient:s}=e;super(function(e){return new Ne(e,32,32)}(n),function(e,t,n){return new xe({color:e,opacity:t,transparent:t<1,map:mn(n)})}(i,r,s),e,t)}setOptions(e){const{color:t,opacity:n,radius:i,position:r,gradient:s}=e,o=this.material;t&&(o.color=new a(t)),n&&(o.opacity=n),i&&(this.geometry=new Ne(i,32,32)),r&&this.position.copy(sn(r)),s&&(o.map=mn(s)),o.needsUpdate=!0,el.needsUpdate=!0}}class ml extends gl{constructor(e){super(e,"Node"),this.graphs=e.graphs}}class vl extends sl{constructor(e){const{radius:t=50,color:n=16777215,opacity:i=1,gradient:r}=e;super(function(e){return new ke(e,64)}(t),function(e,t,n){return new xe({color:e,opacity:t,transparent:t<1,side:Y,map:mn(n)})}(n,i,r),e,"Circle"),this.rotation.set(Math.PI/2,0,0)}setOptions(e){const{color:t,opacity:n,radius:i,position:r,gradient:s}=e,o=this.material;t&&(o.color=new a(t)),n&&(o.opacity=n),i&&(this.geometry=new ke(i,64)),r&&this.position.copy(sn(r)),s&&(o.map=mn(s)),o.needsUpdate=!0,el.needsUpdate=!0}}class yl extends sl{constructor(e){const{start:n,end:i,imgUrl:r,width:s=20,color:o=65280,opacity:a=1,animation:l=!1,passable:c=0,restrict:h=0}=e,u=sn(n),d=sn(i),f=u.distanceTo(d);super(function(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new t(0,1,0);const s=i/2,o=new t,a=new t;o.subVectors(n,e),o.normalize(),a.crossVectors(o,r),0===a.length()&&a.crossVectors(o,new t(0,0,-1));const l=new t(a.x*s,a.y*s,a.z*s),c=new t(-a.x*s,-a.y*s,-a.z*s),h=new t;h.addVectors(e,l);const u=new t;u.addVectors(e,c);const d=new t;d.addVectors(n,c);const f=new t;f.addVectors(n,l);const p=new J;return p.setAttribute("position",new Ue([h.x,h.y,h.z,u.x,u.y,u.z,d.x,d.y,d.z,d.x,d.y,d.z,f.x,f.y,f.z,h.x,h.y,h.z],3)),p.setAttribute("uv",new Ue([0,0,1,0,1,1,1,1,0,1,0,0],2)),p}(u,d,s),function(e,t,n,i,r,s){const o=new xe({color:n,side:Y,transparent:void 0!==i&&i<1,opacity:i});let a;return r&&(a=(new Ae).load(r,(n=>{a.repeat.set(1,e/(t*(n.image.height/n.image.width))*.63*(n.image.height/n.image.height)),o.color.set(16777215)})),a.wrapS=N,a.wrapT=N,a.flipY=!0,a.matrixAutoUpdate=!0,Rn(s)&&s?Vn(a.offset,{y:-1,x:0},{repeat:!0,duration:500}):Nn(s)&&Vn(a.offset,{y:-1,x:0},Object.assign(Object.assign({},s),{repeat:!0})),o.map=a),o}(f,s,o,a,r,l),e,"Link"),this.passable=c,this.restrict=h}}class bl extends al{constructor(e){super(e,"Topology");const{type:t="line"}=e;this.topologyType=t,this.nodes=[],this.links=[],this.info=e,this.create()}create(){var e,t;const{nodes:n,renderLink:i=!0,linkWidth:r=20,linkColor:s=65280,renderNode:o=!0,nodeColor:a=255,nodeRadius:l=r/2,imgUrl:c,animation:h=!1}=this.info,u=[];for(const d of n){const n=this.createNode(Object.assign(Object.assign({},d),{radius:l,color:a}));if(!1===o&&n.hide(),this.nodes.push(n),!c&&i){const n=Ln(s)?s[null===(e=d.graphs[0])||void 0===e?void 0:e.passable]?s[null===(t=d.graphs[0])||void 0===t?void 0:t.passable]:s[0]:s;!o&&this.createCircle({id:`${d.id}_circle`,name:`${d.name||d.id}_circle`,position:d.position,radius:r/2,color:n})}if(i)for(let e=0;e<d.graphs.length;e++){const{linkInfo:t,targetNodeId:n,passable:i,restrict:o}=d.graphs[e],{id:a,name:l}=t,f=this.info.nodes.find((e=>e.id===n));if(!u.includes(a)&&f){u.push(a);const e=Ln(s)?s[i]?s[i]:s[0]:s,t=this.createLink({id:a,name:l,start:d.position,end:f.position,width:r,color:e,imgUrl:c,opacity:c?.99:1,animation:h,passable:i,restrict:o,userData:{startNodeId:d.id,endNodeId:f.id}});this.links.push(t)}}}}createNode(e){const t=new ml(Object.assign({},e));return this.add(t),t}createCircle(e){const t=new vl(Object.assign(Object.assign({},e),{rotation:{x:Math.PI/2,y:0,z:0}}));return this.add(t),t}createLink(e){const t=new yl(Object.assign({},e));return this.add(t),t}resetNodes(e){const{renderLink:t=!0,linkWidth:n=20,linkColor:i=65280,renderNode:r=!0,nodeColor:s=255,nodeRadius:o=n/2,imgUrl:a,animation:l=!1}=this.info,c=[],h=[...this.info.nodes];this.info.nodes=[...e];const u=[];for(let t=0;t<h.length;t++){const n=e.find((e=>e.id===h[t].id));n&&sn(n.position).equals(sn(h[t].position))||u.push(h[t])}for(let e=0;e<u.length;e++){const t=this.nodes.findIndex((t=>u[e].id===t.sid));this.remove(this.nodes[t]),this.nodes.splice(t,1)}const d=[];for(let t=0;t<e.length;t++){const n=h.find((n=>n.id===e[t].id));n&&sn(n.position).equals(sn(e[t].position))||d.push(e[t])}for(let e=0;e<d.length;e++){const t=this.createNode(Object.assign(Object.assign({},d[e]),{radius:o,color:s}));this.nodes.push(t)}this.remove(...this.links),this.links.length=0;for(const r of e)if(t)for(let e=0;e<r.graphs.length;e++){const{linkInfo:t,targetNodeId:s,passable:o,restrict:h}=r.graphs[e],{id:u,name:d}=t,f=this.info.nodes.find((e=>e.id===s));if(!c.includes(u)&&f){c.push(u);const e=Ln(i)?i[o]?i[o]:i[0]:i,t=this.createLink({id:u,name:d,start:r.position,end:f.position,width:n,color:e,imgUrl:a,opacity:a?.99:1,animation:l,passable:o,restrict:h});this.links.push(t)}}}getLength(){let e=0;for(let t=1;t<this.nodes.length;t++)e+=this.nodes[t].position.distanceTo(this.nodes[t-1].position);return e}}function wl(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t(0,1,0);const r=n/2,s=new J;let o=[],a=[];if(e.length<2)return s;for(let n=0;n<e.length-1;n++){const s=sn(e[n]),l=sn(e[n+1]),c=new t,h=new t;c.subVectors(l,s),c.normalize(),h.crossVectors(c,i);const u=new t(h.x*r,h.y*r,h.z*r),d=new t(-h.x*r,-h.y*r,-h.z*r),f=new t;f.addVectors(s,u);const p=new t;p.addVectors(s,d);const g=new t;g.addVectors(l,d);const m=new t;m.addVectors(l,u),o=[...o,f.x,f.y,f.z,p.x,p.y,p.z,g.x,g.y,g.z,g.x,g.y,g.z,m.x,m.y,m.z,f.x,f.y,f.z],a=[...a,0,0,1,0,1,1,1,1,0,1,0,0]}return s.setAttribute("position",new Ue(o,3)),s.setAttribute("uv",new Ue(a,2)),s}class Al extends sl{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Line";const{points:n,width:i=20,color:r=16777215,opacity:s=1,gradient:o}=e;super(wl(n,i),function(e,t,n){return new xe({color:e,side:Y,transparent:t<1,opacity:t,map:mn(n)})}(r,s,o),e,t),this.params=e,this.points=n,this.frustumCulled=!1}setOptions(e){var t;const{color:n,opacity:i,points:r,width:s,gradient:o}=e;this.points=r;const l=this.material;n&&(l.color=new a(n)),i&&(l.opacity=i),o&&(l.map=mn(o)),r&&s?this.geometry=wl(r,s):r?this.geometry=wl(r,null!==(t=this.params.width)&&void 0!==t?t:20):s&&(this.geometry=wl(this.points,s)),l.needsUpdate=!0,el.needsUpdate=!0}}function xl(e){const t=[];for(let n=0;n<e.length;n++)t.push(new w(e[n].x,e[n].z));return t.length>2?new je(new ze(t)):new J}class Sl extends sl{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Polygon";const{yHeight:n,points:i,color:r=16777215,opacity:s=1,gradient:o}=e;super(xl(i),function(e,t,n){return new xe({color:e,opacity:t,transparent:t<1,side:Y,map:mn(n)})}(r,s,o),e,t),this.points=i,this.position.set(0,n,0),this.rotation.set(Math.PI/2,0,0)}setOptions(e){const{color:t,opacity:n,yHeight:i,points:r,gradient:s}=e,o=this.material;t&&(o.color=new a(t)),n&&(o.opacity=n),i&&this.position.set(0,i,0),r&&(this.geometry=xl(r)),s&&(o.map=mn(s)),o.needsUpdate=!0,el.needsUpdate=!0}}class El extends al{constructor(e){super(e,"Canvas3D"),this.create(e)}create(e){const{points:t=[],lines:n=[],polygons:i=[],circles:r=[]}=e;for(let e=0;e<t.length;e++)this.createPoint(t[e]);for(let e=0;e<n.length;e++)this.createLine(n[e]);for(let e=0;e<i.length;e++)this.createPolygon(i[e]);for(let e=0;e<r.length;e++)this.createCircle(r[e])}createPoint(e){const t=new gl(e);return this.add(t),el.needsUpdate=!0,t}getPoint(e){return this.getChildForType("Point",e)}removePoint(e){const t=this.getPoint(e);t&&this.remove(t),el.needsUpdate=!0}createLine(e){const t=new Al(e);return this.add(t),el.needsUpdate=!0,t}getLine(e){return this.getChildForType("Line",e)}removeLine(e){const t=this.getLine(e);t&&this.remove(t),el.needsUpdate=!0}createPolygon(e){const t=new Sl(e);return this.add(t),el.needsUpdate=!0,t}getPolygon(e){return this.getChildForType("Polygon",e)}removePolygon(e){const t=this.getPolygon(e);t&&this.remove(t),el.needsUpdate=!0}createCircle(e){const t=new vl(e);return this.add(t),el.needsUpdate=!0,t}getCircle(e){return this.getChildForType("Circle",e)}removeCircle(e){const t=this.getCircle(e);t&&this.remove(t),el.needsUpdate=!0}getChildForType(e,t){for(let n=0;n<this.children.length;n++)if(this.children[n].stype===e&&this.children[n].sid===t)return this.children[n];return null}}class Tl extends sl{constructor(e,t,n){super(e,t,n,"Ground")}}var Dl=Object.freeze({__proto__:null,BaseMesh:sl,BaseObject3D:al,Canvas3D:El,Circle:vl,Ground:Tl,Group:ll,Icon:fl,Line:Al,Link:yl,Model:ul,Node:ml,PluginObject:cl,Poi:pl,PoiNode:hl,Point:gl,Polygon:Sl,Topology:bl});class Cl{constructor(e,t,n){this.type=e,this.scene=n,this.viewport=t}createGroup(e,t){const n=new ll(e);return null!==t&&this.viewport.scener.addObject(n,null!=t?t:this.scene),n}clear(){this.getAll().forEach((e=>{this.viewport.scener.removeObject(e)}))}getAll(){const e=[];return this.scene.traverse((t=>{((t instanceof al||t instanceof sl)&&Nn(t)&&t.stype===this.type||Nn(t)&&t.userData.stype===this.type)&&e.push(t)})),e}hideAll(){this.getAll().forEach((e=>{e.hide?e.hide():e.visible=!1})),this.viewport.signals.objectChanged.dispatch()}showAll(){this.getAll().forEach((e=>{e.show?e.show():e.visible=!0})),this.viewport.signals.objectChanged.dispatch()}}class Bl extends Cl{constructor(e,t){super(Wt,e,t),At.init()}createAmbientLight(e){const{id:t,name:n="",color:i=10132122,intensity:r=1}=e,s=new Fe(i,r);return s.name=n,s.userData.sid=t,s.userData.stype="Light",this.viewport.scener.addObject(s,this.scene),s}setAmbientLight(e,t){const{name:n="",color:i=10132122,intensity:r=1}=t;return!!e&&(e.name=n,e.color=new a(i),e.intensity=r,this.viewport.signals.objectChanged.dispatch(),!0)}createDirectionalLight(e){const{id:t,name:n="",color:i=10132122,intensity:r=1,position:s={x:1e3,y:1e3,z:1e3},target:o={x:-1e3,y:-1e3,z:-1e3},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:c=4096}=e,h=new He(i,r);if(h.name=n,h.userData.sid=t,h.userData.stype="Light",h.position.set(s.x,s.y,s.z),h.target.name=`${n}-target`,h.target.position.set(o.x,o.y,o.z),h.castShadow=a,a){const e=h.position.distanceTo(h.target.position);h.shadow.bias=-.005,h.shadow.camera.left=-e,h.shadow.camera.right=e,h.shadow.camera.top=e,h.shadow.camera.bottom=-e,h.shadow.camera.far=e,h.shadow.autoUpdate=l,h.shadow.mapSize.width=c,h.shadow.mapSize.height=c,h.shadow.camera.updateProjectionMatrix()}return this.viewport.scener.addObject(h,this.scene),this.viewport.scener.addObject(h.target,this.scene),h}setDirectionalLight(e,t){const{name:n="",color:i=10132122,intensity:r=1,position:s={x:1e3,y:1e3,z:1e3},target:o={x:-1e3,y:-1e3,z:-1e3},openShadow:l=!1,shadowAutoUpdate:c=!1,mapSize:h=4096}=t;if(!e)return!1;if(e.name=n,e.color=new a(i),e.intensity=r,e.position.set(s.x,s.y,s.z),e.target.position.set(o.x,o.y,o.z),e.castShadow=l,l){const t=e.position.distanceTo(e.target.position);e.shadow.bias=-.005,e.shadow.camera.left=-t,e.shadow.camera.right=t,e.shadow.camera.top=t,e.shadow.camera.bottom=-t,e.shadow.camera.far=t,e.shadow.autoUpdate=c,e.shadow.mapSize.width=h,e.shadow.mapSize.height=h,e.shadow.camera.updateProjectionMatrix()}return this.viewport.signals.objectChanged.dispatch(),!0}createHemisphereLight(e){const{id:t,name:n="",skyColor:i=16777215,groundColor:r=14540253,intensity:s=1,position:o={x:0,y:0,z:0}}=e,a=new Ge(i,r,s);return a.name=n,a.position.set(o.x,o.y,o.z),a.userData.sid=t,a.userData.stype="Light",this.viewport.scener.addObject(a,this.scene),a}setHemisphereLight(e,t){const{name:n="",skyColor:i=16777215,groundColor:r=14540253,intensity:s=1,position:o={x:0,y:0,z:0}}=t;return!!e&&(e.name=n,e.color=new a(i),e.groundColor=new a(r),e.intensity=s,e.position.set(o.x,o.y,o.z),this.viewport.signals.objectChanged.dispatch(),!0)}createSpotLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,angle:s=45,position:o={x:0,y:500,z:0},target:a={x:0,y:0,z:0},openShadow:l=!1,shadowAutoUpdate:c=!1,mapSize:h=4096}=e,u=sn(o).distanceTo(sn(a)),d=new Ve(i,r,u,Math.PI/360*s,0,0);if(d.name=n,d.position.set(o.x,o.y,o.z),d.userData.sid=t,d.userData.stype="Light",d.castShadow=l,d.target.position.set(a.x,a.y,a.z),d.target.castShadow=l,d.target.receiveShadow=!0,d.target.updateMatrixWorld(),l){const e=d.position.distanceTo(d.target.position);d.shadow.autoUpdate=c,d.shadow.mapSize.width=h,d.shadow.mapSize.height=h,d.shadow.bias=-.005,d.shadow.focus=.6,d.shadow.camera.far=e,d.shadow.camera.updateProjectionMatrix()}return this.viewport.scener.addObject(d,this.scene),d}setSpotLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,angle:s=45,position:o={x:0,y:500,z:0},target:l={x:0,y:0,z:0},openShadow:c=!1,shadowAutoUpdate:h=!1,mapSize:u=4096}=t;if(!e)return!1;const d=sn(o).distanceTo(sn(l));if(e.name=n,e.color=new a(i),e.intensity=r,e.distance=d,e.angle=Math.PI/360*s,e.position.set(o.x,o.y,o.z),e.castShadow=c,e.target.position.set(l.x,l.y,l.z),e.target.castShadow=c,e.target.updateMatrixWorld(),c){const t=e.position.distanceTo(e.target.position);e.shadow.autoUpdate=h,e.shadow.mapSize.width=u,e.shadow.mapSize.height=u,e.shadow.bias=-.005,e.shadow.focus=.6,e.shadow.camera.far=t,e.shadow.camera.updateProjectionMatrix()}return this.viewport.signals.objectChanged.dispatch(),!0}createPointLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,distance:s=5e3,position:o={x:0,y:500,z:0},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:c=4096}=e,h=new Ye(i,r,s);return h.name=n,h.userData.sid=t,h.userData.stype="Light",h.position.set(o.x,o.y,o.z),h.castShadow=a,a&&(h.shadow.bias=-.005,h.shadow.camera.far=s,h.shadow.autoUpdate=l,h.shadow.mapSize.width=c,h.shadow.mapSize.height=c,h.shadow.camera.updateProjectionMatrix()),this.viewport.scener.addObject(h,this.scene),h}setPointLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,distance:s=5e3,position:o={x:0,y:500,z:0},openShadow:l=!1,shadowAutoUpdate:c=!1,mapSize:h=4096}=t;return!!e&&(e.name=n,e.color=new a(i),e.intensity=r,e.distance=s,e.position.set(o.x,o.y,o.z),e.castShadow=l,l&&(e.shadow.bias=-.005,e.shadow.camera.far=s,e.shadow.autoUpdate=c,e.shadow.mapSize.width=h,e.shadow.mapSize.height=h,e.shadow.camera.updateProjectionMatrix()),this.viewport.signals.objectChanged.dispatch(),!0)}createRectAreaLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,width:s=10,height:o=10,position:a={x:0,y:0,z:0}}=e,l=new Qe(i,r,s,o);return l.name=n,l.userData.sid=t,l.userData.stype="Light",l.position.set(a.x,a.y,a.z),this.viewport.scener.addObject(l,this.scene),l}setRectAreaLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,width:s=10,height:o=10,position:l={x:0,y:0,z:0}}=t;return!!e&&(e.name=n,e.color=new a(i),e.intensity=r,e.width=s,e.height=o,e.position.set(l.x,l.y,l.z),this.viewport.signals.objectChanged.dispatch(),!0)}updateAllShadow(){this.getAll().forEach((e=>{var t;!1===(null===(t=e.shadow)||void 0===t?void 0:t.autoUpdate)&&(e.shadow.needsUpdate=!0)})),this.viewport.signals.objectChanged.dispatch()}}function Il(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ml={};({get exports(){return Ml},set exports(e){Ml=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&Il)return Il(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){var n=t[o][1][e];return r(n||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=Il,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){(function(e){var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var s=0,o=new r(h),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var l=new e.MessageChannel;l.port1.onmessage=h,n=function(){l.port2.postMessage(0)}}var c=[];function h(){var e,t;i=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}i=!1}function u(e){1!==c.push(e)||i||n()}t.exports=u}).call(this,void 0!==Qn?Qn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var i=e(1);function r(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==r&&f(this,e)}function h(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){i((function(){var i;try{i=t(n)}catch(t){return s.reject(e,t)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var n=!1;function i(t){n||(n=!0,s.reject(e,t))}function r(t){n||(n=!0,s.resolve(e,t))}function o(){t(r,i)}var a=p(o);"error"===a.status&&i(a.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function g(e){return e instanceof this?e:s.resolve(new this(r),e)}function m(e){var t=new this(r);return s.reject(t,e)}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,c=new this(r);++l<n;)h(e[l],l);return c;function h(e,r){function l(e){o[r]=e,++a!==n||i||(i=!0,s.resolve(c,o))}t.resolve(e).then(l,(function(e){i||(i=!0,s.reject(c,e))}))}}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=-1,a=new this(r);++o<n;)l(e[o]);return a;function l(e){t.resolve(e).then((function(e){i||(i=!0,s.resolve(a,e))}),(function(e){i||(i=!0,s.reject(a,e))}))}}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(r);return this.state!==l?u(n,this.state===a?e:t,this.outcome):this.queue.push(new h(n,e,t)),n},h.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){s.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=p(d,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)f(e,i);else{e.state=a,e.outcome=t;for(var r=-1,o=e.queue.length;++r<o;)e.queue[r].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},c.resolve=g,c.reject=m,c.all=v,c.race=y},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==Qn?Qn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var o=s();function a(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(r){if("TypeError"!==r.name)throw r;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var c=Promise;function h(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",g=void 0,m={},v=Object.prototype.toString,y="readonly",b="readwrite";function w(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),r=0;r<t;r++)i[r]=e.charCodeAt(r);return n}function A(e){return new c((function(t){var n=e.transaction(p,b),i=l([""]);n.objectStore(p).put(i,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function x(e){return"boolean"==typeof g?c.resolve(g):A(e).then((function(e){return g=e}))}function S(e){var t=m[e.name],n={};n.promise=new c((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function E(e){var t=m[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function T(e,t){var n=m[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(m[e.name]=m[e.name]||N(),e.db){if(!t)return n(e.db);S(e),e.db.close()}var r=[e.name];t&&r.push(e.version);var s=o.open.apply(o,r);t&&(s.onupgradeneeded=function(t){var n=s.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(p)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),s.onerror=function(e){e.preventDefault(),i(s.error)},s.onsuccess=function(){n(s.result),E(e)}}))}function C(e){return D(e,!1)}function B(e){return D(e,!0)}function I(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,r=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),r||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function M(e){return new c((function(t,n){var i=new FileReader;i.onerror=n,i.onloadend=function(n){var i=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:i,type:e.type})},i.readAsBinaryString(e)}))}function O(e){return l([w(atob(e.data))],{type:e.type})}function P(e){return e&&e.__local_forage_encoded_blob}function R(e){var t=this,n=t._initReady().then((function(){var e=m[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(n,e,e),n}function _(e){S(e);for(var t=m[e.name],n=t.forages,i=0;i<n.length;i++){var r=n[i];r._dbInfo.db&&(r._dbInfo.db.close(),r._dbInfo.db=null)}return e.db=null,C(e).then((function(t){return e.db=t,I(e)?B(e):t})).then((function(i){e.db=t.db=i;for(var r=0;r<n.length;r++)n[r]._dbInfo.db=i})).catch((function(t){throw T(e,t),t}))}function L(e,t,n,i){void 0===i&&(i=1);try{var r=e.db.transaction(e.storeName,t);n(null,r)}catch(r){if(i>0&&(!e.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return c.resolve().then((function(){if(!e.db||"NotFoundError"===r.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),B(e)})).then((function(){return _(e).then((function(){L(e,t,n,i-1)}))})).catch(n);n(r)}}function N(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function k(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=m[n.name];r||(r=N(),m[n.name]=r),r.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=R);var s=[];function o(){return c.resolve()}for(var a=0;a<r.forages.length;a++){var l=r.forages[a];l!==t&&s.push(l._initReady().catch(o))}var h=r.forages.slice(0);return c.all(s).then((function(){return n.db=r.db,C(n)})).then((function(e){return n.db=e,I(n,t._defaultConfig.version)?B(n):e})).then((function(e){n.db=r.db=e,t._dbInfo=n;for(var i=0;i<h.length;i++){var s=h[i];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}}))}function U(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){L(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),P(e)&&(e=O(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return h(i,t),i}function j(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){L(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var i=n.value;P(i)&&(i=O(i));var r=e(i,n.key,a++);void 0!==r?t(r):n.continue()}else t()},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return h(i,t),i}function z(e,t,n){var i=this;e=d(e);var r=new c((function(n,r){var s;i.ready().then((function(){return s=i._dbInfo,"[object Blob]"===v.call(t)?x(s.db).then((function(e){return e?t:M(t)})):t})).then((function(t){L(i._dbInfo,b,(function(s,o){if(s)return r(s);try{var a=o.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var l=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=l.error?l.error:l.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return h(r,n),r}function F(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){L(n._dbInfo,b,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){i(o.error)},s.onabort=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return h(i,t),i}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){L(t._dbInfo,b,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).clear();r.oncomplete=function(){e()},r.onabort=r.onerror=function(){var e=s.error?s.error:s.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function G(e){var t=this,n=new c((function(e,n){t.ready().then((function(){L(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function V(e,t){var n=this,i=new c((function(t,i){e<0?t(null):n.ready().then((function(){L(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName),a=!1,l=o.openKeyCursor();l.onsuccess=function(){var n=l.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},l.onerror=function(){i(l.error)}}catch(e){i(e)}}))})).catch(i)}));return h(i,t),i}function Y(e){var t=this,n=new c((function(e,n){t.ready().then((function(){L(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;t?(o.push(t.key),t.continue()):e(o)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function Q(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;if(e.name){var s=e.name===n.name&&r._dbInfo.db?c.resolve(r._dbInfo.db):C(e).then((function(t){var n=m[e.name],i=n.forages;n.db=t;for(var r=0;r<i.length;r++)i[r]._dbInfo.db=t;return t}));i=e.storeName?s.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;S(e);var i=m[e.name],r=i.forages;t.close();for(var s=0;s<r.length;s++){var a=r[s];a._dbInfo.db=null,a._dbInfo.version=n}var l=new c((function(t,i){var r=o.open(e.name,n);r.onerror=function(e){r.result.close(),i(e)},r.onupgradeneeded=function(){r.result.deleteObjectStore(e.storeName)},r.onsuccess=function(){var e=r.result;e.close(),t(e)}}));return l.then((function(e){i.db=e;for(var t=0;t<r.length;t++){var n=r[t];n._dbInfo.db=e,E(n._dbInfo)}})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}})):s.then((function(t){S(e);var n=m[e.name],i=n.forages;t.close();for(var r=0;r<i.length;r++)i[r]._dbInfo.db=null;var s=new c((function(t,n){var i=o.deleteDatabase(e.name);i.onerror=i.onblocked=function(e){var t=i.result;t&&t.close(),n(e)},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}));return s.then((function(e){n.db=e;for(var t=0;t<i.length;t++)E(i[t]._dbInfo)})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}))}else i=c.reject("Invalid arguments");return h(i,t),i}var W={_driver:"asyncStorage",_initStorage:k,_support:a(),iterate:j,getItem:U,setItem:z,removeItem:F,clear:H,length:G,key:V,keys:Y,dropInstance:Q};function X(){return"function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K="~~local_forage_type~",q=/^~~local_forage_type~([^~]+)~/,J="__lfsc__:",$=J.length,ee="arbf",te="blob",ne="si08",ie="ui08",re="uic8",se="si16",oe="si32",ae="ur16",le="ui32",ce="fl32",he="fl64",ue=$+ee.length,de=Object.prototype.toString;function fe(e){var t,n,i,r,s,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var c=new ArrayBuffer(o),h=new Uint8Array(c);for(t=0;t<a;t+=4)n=Z.indexOf(e[t]),i=Z.indexOf(e[t+1]),r=Z.indexOf(e[t+2]),s=Z.indexOf(e[t+3]),h[l++]=n<<2|i>>4,h[l++]=(15&i)<<4|r>>2,h[l++]=(3&r)<<6|63&s;return c}function pe(e){var t,n=new Uint8Array(e),i="";for(t=0;t<n.length;t+=3)i+=Z[n[t]>>2],i+=Z[(3&n[t])<<4|n[t+1]>>4],i+=Z[(15&n[t+1])<<2|n[t+2]>>6],i+=Z[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}function ge(e,t){var n="";if(e&&(n=de.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var i,r=J;e instanceof ArrayBuffer?(i=e,r+=ee):(i=e.buffer,"[object Int8Array]"===n?r+=ne:"[object Uint8Array]"===n?r+=ie:"[object Uint8ClampedArray]"===n?r+=re:"[object Int16Array]"===n?r+=se:"[object Uint16Array]"===n?r+=ae:"[object Int32Array]"===n?r+=oe:"[object Uint32Array]"===n?r+=le:"[object Float32Array]"===n?r+=ce:"[object Float64Array]"===n?r+=he:t(new Error("Failed to get type for BinaryArray"))),t(r+pe(i))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n=K+e.type+"~"+pe(this.result);t(J+te+n)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function me(e){if(e.substring(0,$)!==J)return JSON.parse(e);var t,n=e.substring(ue),i=e.substring($,ue);if(i===te&&q.test(n)){var r=n.match(q);t=r[1],n=n.substring(r[0].length)}var s=fe(n);switch(i){case ee:return s;case te:return l([s],{type:t});case ne:return new Int8Array(s);case ie:return new Uint8Array(s);case re:return new Uint8ClampedArray(s);case se:return new Int16Array(s);case ae:return new Uint16Array(s);case oe:return new Int32Array(s);case le:return new Uint32Array(s);case ce:return new Float32Array(s);case he:return new Float64Array(s);default:throw new Error("Unkown type: "+i)}}var ve={serialize:ge,deserialize:me,stringToBuffer:fe,bufferToString:pe};function ye(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function be(e){var t=this,n={db:null};if(e)for(var i in e)n[i]="string"!=typeof e[i]?e[i].toString():e[i];var r=new c((function(e,i){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return i(e)}n.db.transaction((function(r){ye(r,n,(function(){t._dbInfo=n,e()}),(function(e,t){i(t)}))}),i)}));return n.serializer=ve,r}function we(e,t,n,i,r,s){e.executeSql(n,i,r,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?s(e,o):ye(e,t,(function(){e.executeSql(n,i,r,s)}),s)}),s):s(e,o)}),s)}function Ae(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){we(n,r,"SELECT * FROM "+r.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var i=n.rows.length?n.rows.item(0).value:null;i&&(i=r.serializer.deserialize(i)),t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return h(i,t),i}function xe(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){we(n,r,"SELECT * FROM "+r.storeName,[],(function(n,i){for(var s=i.rows,o=s.length,a=0;a<o;a++){var l=s.item(a),c=l.value;if(c&&(c=r.serializer.deserialize(c)),void 0!==(c=e(c,l.key,a+1)))return void t(c)}t()}),(function(e,t){i(t)}))}))})).catch(i)}));return h(i,t),i}function Se(e,t,n,i){var r=this;e=d(e);var s=new c((function(s,o){r.ready().then((function(){void 0===t&&(t=null);var a=t,l=r._dbInfo;l.serializer.serialize(t,(function(t,c){c?o(c):l.db.transaction((function(n){we(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){s(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void s(Se.apply(r,[e,a,n,i-1]));o(t)}}))}))})).catch(o)}));return h(s,n),s}function Ee(e,t,n){return Se.apply(this,[e,t,n,1])}function Te(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){we(n,r,"DELETE FROM "+r.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){i(t)}))}))})).catch(i)}));return h(i,t),i}function De(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){we(t,i,"DELETE FROM "+i.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Ce(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){we(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],(function(t,n){var i=n.rows.item(0).c;e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Be(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){we(n,r,"SELECT key FROM "+r.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var i=n.rows.length?n.rows.item(0).key:null;t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return h(i,t),i}function Ie(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){we(t,i,"SELECT key FROM "+i.storeName,[],(function(t,n){for(var i=[],r=0;r<n.rows.length;r++)i.push(n.rows.item(r).key);e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Me(e){return new c((function(t,n){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,i){for(var r=[],s=0;s<i.rows.length;s++)r.push(i.rows.item(s).name);t({db:e,storeNames:r})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}function Oe(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;return i=e.name?new c((function(t){var i;i=e.name===n.name?r._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(Me(i))})).then((function(e){return new c((function(t,n){e.db.transaction((function(i){function r(e){return new c((function(t,n){i.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var s=[],o=0,a=e.storeNames.length;o<a;o++)s.push(r(e.storeNames[o]));c.all(s).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):c.reject("Invalid arguments"),h(i,t),i}var Pe={_driver:"webSQLStorage",_initStorage:be,_support:X(),iterate:xe,getItem:Ae,setItem:Ee,removeItem:Te,clear:De,length:Ce,key:Be,keys:Ie,dropInstance:Oe};function Re(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function _e(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function Le(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Ne(){return!Le()||localStorage.length>0}function ke(e){var t=this,n={};if(e)for(var i in e)n[i]=e[i];return n.keyPrefix=_e(e,t._defaultConfig),Ne()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function Ue(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}}));return h(n,e),n}function je(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i}));return h(i,t),i}function ze(e,t){var n=this,i=n.ready().then((function(){for(var t=n._dbInfo,i=t.keyPrefix,r=i.length,s=localStorage.length,o=1,a=0;a<s;a++){var l=localStorage.key(a);if(0===l.indexOf(i)){var c=localStorage.getItem(l);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,l.substring(r),o++)))return c}}}));return h(i,t),i}function Fe(e,t){var n=this,i=n.ready().then((function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t}));return h(i,t),i}function He(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,i=[],r=0;r<n;r++){var s=localStorage.key(r);0===s.indexOf(e.keyPrefix)&&i.push(s.substring(e.keyPrefix.length))}return i}));return h(n,e),n}function Ge(e){var t=this.keys().then((function(e){return e.length}));return h(t,e),t}function Ve(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return h(i,t),i}function Ye(e,t,n){var i=this;e=d(e);var r=i.ready().then((function(){void 0===t&&(t=null);var n=t;return new c((function(r,s){var o=i._dbInfo;o.serializer.serialize(t,(function(t,i){if(i)s(i);else try{localStorage.setItem(o.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||s(e),s(e)}}))}))}));return h(r,n),r}function Qe(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var i,r=this;return i=e.name?new c((function(t){e.storeName?t(_e(e,r._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):c.reject("Invalid arguments"),h(i,t),i}var We={_driver:"localStorageWrapper",_initStorage:ke,_support:Re(),iterate:ze,getItem:je,setItem:Ye,removeItem:Ve,clear:Ue,length:Ge,key:Fe,keys:He,dropInstance:Qe},Xe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ze=function(e,t){for(var n=e.length,i=0;i<n;){if(Xe(e[i],t))return!0;i++}return!1},Ke=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},qe={},Je={},$e={INDEXEDDB:W,WEBSQL:Pe,LOCALSTORAGE:We},et=[$e.INDEXEDDB._driver,$e.WEBSQL._driver,$e.LOCALSTORAGE._driver],tt=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),it={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function rt(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function st(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(Ke(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ot=function(){function e(t){for(var n in r(this,e),$e)if($e.hasOwnProperty(n)){var i=$e[n],s=i._driver;this[n]=s,qe[s]||this.defineDriver(i)}this._defaultConfig=st({},it),this._config=st({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":i(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var i=new c((function(t,n){try{var i=e._driver,r=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(r);for(var s=nt.concat("_initStorage"),o=0,a=s.length;o<a;o++){var l=s[o];if((!Ze(tt,l)||e[l])&&"function"!=typeof e[l])return void n(r)}var u=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=c.reject(t);return h(n,arguments[arguments.length-1]),n}},n=0,i=tt.length;n<i;n++){var r=tt[n];e[r]||(e[r]=t(r))}};u();var d=function(n){qe[i]&&console.info("Redefining LocalForage driver: "+i),qe[i]=e,Je[i]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return u(i,t,n),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var i=qe[e]?c.resolve(qe[e]):c.reject(new Error("Driver not found."));return u(i,t,n),i},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var i=this;Ke(e)||(e=[e]);var r=this._getSupportedDrivers(e);function s(){i._config.driver=i.driver()}function o(e){return i._extend(e),s(),i._ready=i._initStorage(i._config),i._ready}function a(e){return function(){var t=0;function n(){for(;t<e.length;){var r=e[t];return t++,i._dbInfo=null,i._ready=null,i.getDriver(r).then(o).catch(n)}s();var a=new Error("No available storage method found.");return i._driverSet=c.reject(a),i._driverSet}return n()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return c.resolve()})):c.resolve();return this._driverSet=l.then((function(){var e=r[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then((function(e){i._driver=e._driver,s(),i._wrapLibraryMethodsWithReady(),i._initDriver=a(r)}))})).catch((function(){s();var e=new Error("No available storage method found.");return i._driverSet=c.reject(e),i._driverSet})),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!Je[e]},e.prototype._extend=function(e){st(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];this.supports(r)&&t.push(r)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=nt.length;e<t;e++)rt(this,nt[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),at=new ot;t.exports=at},{3:3}]},{},[4])(4);const Ol=()=>{self.noCompressWorker=function(e,t){const[n]=new Uint32Array(e,t,1),i={byteOffset:t+=4,length:3*n},r={byteOffset:t+=3*n*4,length:2*n},s={byteOffset:t+=2*n*4,length:4*n},o={byteOffset:t+=4*n*1,length:3*n};t+=3*n*1;let a=(s.length+o.length)%4;a>0&&(a=4-a,t+=a);const l=new Uint32Array(e,t,1);t+=4;const[c]=l,h={byteOffset:t,length:c};t+=4*c;const u=new Uint32Array(e,t,1);t+=4;const[d]=u,f=[];if(d>0)for(let n=0;n<d;n++){const[n]=new Uint32Array(e,t,1);t+=4;const[i]=new Uint32Array(e,t,1);t+=4;const[r]=new Uint32Array(e,t,1);t+=4;const[s]=new Uint32Array(e,t,1);t+=4;const o=new Uint8Array(e,t,s);t+=s;const a=(new TextDecoder).decode(o);f.push({start:n,count:i,uuid:a,alphaMode:r})}return{buffer:e,position:i,normal:o,color:s,texcoord:r,indice:h,sub_mesh:f}}},Pl=()=>{self.gzipCompressWorker=function(e){const t=new Uint8Array(e,4,e.byteLength-4),n=new pako.Inflate;n.push(t,!0);const{result:i}=n;if(i instanceof Uint8Array){const{buffer:e}=i;let t=0;const[n]=new Uint32Array(e,t,1);t+=4;const r={byteOffset:t,length:3*n};t+=3*n*4;const s={byteOffset:t,length:2*n};t+=2*n*4;const o={byteOffset:t,length:4*n};t+=4*n*1;const a={byteOffset:t,length:3*n};t+=3*n*1;let l=(o.length+a.length)%4;l>0&&(l=4-l,t+=l);const c=new Uint32Array(e,t,1);t+=4;const[h]=c,u={byteOffset:t,length:h};t+=4*h;const d=new Uint32Array(e,t,1);t+=4;const[f]=d,p=[];if(f>0)for(let n=0;n<f;n++){const[n]=new Uint32Array(e,t,1);t+=4;const[i]=new Uint32Array(e,t,1);t+=4;const[r]=new Uint32Array(e,t,1);t+=4;const[s]=new Uint32Array(e,t,1);t+=4;const o=new Uint8Array(e,t,s);t+=s;const a=(new TextDecoder).decode(o);p.push({start:n,count:i,uuid:a,alphaMode:r})}return{buffer:e,position:r,normal:a,color:o,texcoord:s,indice:u,sub_mesh:p}}}},Rl=()=>{self.parseChunkWorker=function(e){let t=0;const n=new Int8Array(e,t,128);t+=128,(new TextDecoder).decode(n.slice(0,4));const[i]=n.slice(4,8);if(0===i)return self.noCompressWorker(e,t);if(1===i){const t=e.slice(128);return self.gzipCompressWorker(t)}throw new Error("unknown compress mode [ .sbmx model ]")}},_l="\n onmessage = function ( e ) {\n \n const message = e.data\n\n switch ( message.type ) {\n\n case 'decode': {\n\n const chunkInfo = self.parseChunkWorker( message.data )\n\n if ( chunkInfo ) { \n\n self.postMessage( \n { type: 'decode', data: chunkInfo, }, \n [ chunkInfo.buffer ]\n )\n\n } else {\n\n self.postMessage( { type: 'decode', data: {}, } )\n\n }\n\n break\n \n }\n \n }\n\n }\n\n",Ll="textureIndex.json";class Nl extends We{constructor(e){super(),this.store=e,this.loadedTextures=new Map,this.loadedMaterialsMap=new Map,this.defaultMaterial=new g({name:"defaultDatMaterial",color:0}),this.loadedMaterials=[this.defaultMaterial],this.dracoDecoderPath=null,this.workerPool=new wt(4),this.workerSourceURL="";const t=this._initWorkerCreator();this.workerPool.setWorkerCreator(t)}async parseAsync(e,t){const[n]=await Promise.allSettled([this._decodeBuffer(e,t),this._createMaterial(t)]);if("fulfilled"===n.status&&n.value){const e=vn(t),i=this._createMesh(n.value,e),r=new Xe;return r.add(i),r}}async _decodeBuffer(e,t){const n=await this.store.getItem(`${t}_object`);if(n)return n;const[{data:i}]=await Promise.all([this.workerPool.postMessage({type:"decode",data:e},[e])]);if(i){const{type:e,data:n}=null!=i?i:{};if("decode"===e&&n){const{buffer:{byteLength:e}}=n;return _n(e)&&e/1024/1024<=500&&Bn((()=>{this.store.setItem(`${t}_object`,n)})),n}}}_initWorkerCreator(){if(!this.workerSourceURL){const e=Ol.toString(),t=Pl.toString(),n=Rl.toString(),i=["/* dat decoder */",["/* pako */","\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pako = {}));\n}(this, (function (exports) { 'use strict';\n\n // Note: adler32 takes 12% for level 0 and 2% for level 6.\n // It isn't worth it to make additional optimizations as in original.\n // Small size is preferable.\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express ofr implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n const adler32 = (adler, buf, len, pos) => {\n let s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n };\n\n\n var adler32_1 = adler32;\n\n // Note: we can't get significant speed boost here.\n // So write code to minimize size - no pregenerated tables\n // and array tools dependencies.\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n // Use ordinary array, since untyped makes no boost here\n const makeTable = () => {\n let c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n };\n\n // Create table on load. Just 255 signed longs. Not a problem.\n const crcTable = new Uint32Array(makeTable());\n\n\n const crc32 = (crc, buf, len, pos) => {\n const t = crcTable;\n const end = pos + len;\n\n crc ^= -1;\n\n for (let i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n };\n\n\n var crc32_1 = crc32;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n // See state defs from inflate.js\n const BAD$1 = 30; /* got a data error -- remain here until reset */\n const TYPE$1 = 12; /* i: waiting for type bits, including last-flag bit */\n\n /*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\n var inffast = function inflate_fast(strm, start) {\n let _in; /* local strm.input */\n let last; /* have enough input while in < last */\n let _out; /* local strm.output */\n let beg; /* inflate()'s initial strm.output */\n let end; /* while out < end, enough space available */\n //#ifdef INFLATE_STRICT\n let dmax; /* maximum distance from zlib header */\n //#endif\n let wsize; /* window size or zero if not using window */\n let whave; /* valid bytes in the window */\n let wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n let s_window; /* allocated sliding window, if wsize != 0 */\n let hold; /* local strm.hold */\n let bits; /* local strm.bits */\n let lcode; /* local strm.lencode */\n let dcode; /* local strm.distcode */\n let lmask; /* mask for first level of length codes */\n let dmask; /* mask for first level of distance codes */\n let here; /* retrieved table entry */\n let op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n let len; /* match length, unused bytes */\n let dist; /* match distance */\n let from; /* where to copy match from */\n let from_source;\n\n\n let input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n const state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n //#ifdef INFLATE_STRICT\n dmax = state.dmax;\n //#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\" :\n // \"inflate: literal 0x%02x\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n //#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n //#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // if (len <= op - whave) {\n // do {\n // output[_out++] = 0;\n // } while (--len);\n // continue top;\n // }\n // len -= op - whave;\n // do {\n // output[_out++] = 0;\n // } while (--op > whave);\n // if (op === 0) {\n // from = _out - dist;\n // do {\n // output[_out++] = output[from++];\n // } while (--len);\n // continue top;\n // }\n //#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\"));\n state.mode = TYPE$1;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n const MAXBITS = 15;\n const ENOUGH_LENS$1 = 852;\n const ENOUGH_DISTS$1 = 592;\n //const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\n const CODES$1 = 0;\n const LENS$1 = 1;\n const DISTS$1 = 2;\n\n const lbase = new Uint16Array([ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n ]);\n\n const lext = new Uint8Array([ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n ]);\n\n const dbase = new Uint16Array([ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n ]);\n\n const dext = new Uint8Array([ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n ]);\n\n const inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>\n {\n const bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n let len = 0; /* a code's length in bits */\n let sym = 0; /* index of code symbols */\n let min = 0, max = 0; /* minimum and maximum code lengths */\n let root = 0; /* number of index bits for root table */\n let curr = 0; /* number of index bits for current table */\n let drop = 0; /* code bits to drop for sub-table */\n let left = 0; /* number of prefix codes available */\n let used = 0; /* code entries in table used */\n let huff = 0; /* Huffman code */\n let incr; /* for incrementing code, index */\n let fill; /* index for replicating entries */\n let low; /* low bits for current root entry */\n let mask; /* mask for low root bits */\n let next; /* next available space in table */\n let base = null; /* base value table to use */\n let base_index = 0;\n // let shoextra; /* extra bits table to use */\n let end; /* use base and extra for symbol > end */\n const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n let extra = null;\n let extra_index = 0;\n\n let here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES$1 || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES$1) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS$1) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n };\n\n\n var inftrees = inflate_table;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n var constants$1 = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n\n\n\n\n\n const CODES = 0;\n const LENS = 1;\n const DISTS = 2;\n\n /* Public constants ==========================================================*/\n /* ===========================================================================*/\n\n const {\n Z_FINISH: Z_FINISH$1, Z_BLOCK, Z_TREES,\n Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR,\n Z_DEFLATED\n } = constants$1;\n\n\n /* STATES ====================================================================*/\n /* ===========================================================================*/\n\n\n const HEAD = 1; /* i: waiting for magic header */\n const FLAGS = 2; /* i: waiting for method and flags (gzip) */\n const TIME = 3; /* i: waiting for modification time (gzip) */\n const OS = 4; /* i: waiting for extra flags and operating system (gzip) */\n const EXLEN = 5; /* i: waiting for extra length (gzip) */\n const EXTRA = 6; /* i: waiting for extra bytes (gzip) */\n const NAME = 7; /* i: waiting for end of file name (gzip) */\n const COMMENT = 8; /* i: waiting for end of comment (gzip) */\n const HCRC = 9; /* i: waiting for header crc (gzip) */\n const DICTID = 10; /* i: waiting for dictionary check value */\n const DICT = 11; /* waiting for inflateSetDictionary() call */\n const TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n const TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\n const STORED = 14; /* i: waiting for stored size (length and complement) */\n const COPY_ = 15; /* i/o: same as COPY below, but only first time in */\n const COPY = 16; /* i/o: waiting for input or output to copy stored block */\n const TABLE = 17; /* i: waiting for dynamic block table lengths */\n const LENLENS = 18; /* i: waiting for code length code lengths */\n const CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\n const LEN_ = 20; /* i: same as LEN below, but only first time in */\n const LEN = 21; /* i: waiting for length/lit/eob code */\n const LENEXT = 22; /* i: waiting for length extra bits */\n const DIST = 23; /* i: waiting for distance code */\n const DISTEXT = 24; /* i: waiting for distance extra bits */\n const MATCH = 25; /* o: waiting for output space to copy string */\n const LIT = 26; /* o: waiting for output space to write literal */\n const CHECK = 27; /* i: waiting for 32-bit check value */\n const LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\n const DONE = 29; /* finished check, done -- remain here until reset */\n const BAD = 30; /* got a data error -- remain here until reset */\n const MEM = 31; /* got an inflate() memory error -- remain here until reset */\n const SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n /* ===========================================================================*/\n\n\n\n const ENOUGH_LENS = 852;\n const ENOUGH_DISTS = 592;\n //const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\n const MAX_WBITS = 15;\n /* 32K LZ77 window */\n const DEF_WBITS = MAX_WBITS;\n\n\n const zswap32 = (q) => {\n\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n };\n\n\n function InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new Uint16Array(320); /* temporary storage for code lengths */\n this.work = new Uint16Array(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new Int32Array(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n }\n\n\n const inflateResetKeep = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS);\n state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\"));\n return Z_OK$1;\n };\n\n\n const inflateReset = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n };\n\n\n const inflateReset2 = (strm, windowBits) => {\n let wrap;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR$1;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n };\n\n\n const inflateInit2 = (strm, windowBits) => {\n\n if (!strm) { return Z_STREAM_ERROR$1; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n const state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n const ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK$1) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n };\n\n\n const inflateInit = (strm) => {\n\n return inflateInit2(strm, DEF_WBITS);\n };\n\n\n /*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\n let virgin = true;\n\n let lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\n\n const fixedtables = (state) => {\n\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n lenfix = new Int32Array(512);\n distfix = new Int32Array(32);\n\n /* literal/length table */\n let sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inftrees(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n };\n\n\n /*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\n const updatewindow = (strm, src, end, copy) => {\n\n let dist;\n const state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new Uint8Array(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n state.window.set(src.subarray(end - state.wsize, end), 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n state.window.set(src.subarray(end - copy, end), 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n };\n\n\n const inflate$1 = (strm, flush) => {\n\n let state;\n let input, output; // input/output buffers\n let next; /* next input INDEX */\n let put; /* next output INDEX */\n let have, left; /* available input and output */\n let hold; /* bit buffer */\n let bits; /* bits in bit buffer */\n let _in, _out; /* save starting available input and output */\n let copy; /* number of stored or match bytes to copy */\n let from; /* where to copy match bytes from */\n let from_source;\n let here = 0; /* current decoding table entry */\n let here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //let last; /* parent table entry */\n let last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n let len; /* length to copy for repeats, bits to drop */\n let ret; /* return code */\n const hbuf = new Uint8Array(4); /* buffer for gzip header crc calculation */\n let opts;\n\n let n; // temporary variable for NEED_BITS\n\n const order = /* permutation of code lengths */\n new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR$1;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK$1;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n\n // !!! pako patch. Force use `options.windowBits` if passed.\n // Required to always use max window size by default.\n state.dmax = 1 << state.wbits;\n //state.dmax = 1 << len;\n\n //Tracev((stderr, \"inflate: zlib header ok\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32_1(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Uint8Array(state.head.extra_len);\n }\n state.head.extra.set(\n input.subarray(\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n next + copy\n ),\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT$1;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n output.set(input.subarray(next, next + copy), put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n //#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracev((stderr, \"inflate: table sizes ok\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inffast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\" :\n // \"inflate: literal 0x%02x\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracevv((stderr, \"inflate: distance %u\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // Trace((stderr, \"inflate.c too far\"));\n // copy -= state.whave;\n // if (copy > state.length) { copy = state.length; }\n // if (copy > left) { copy = left; }\n // left -= copy;\n // state.length -= copy;\n // do {\n // output[put++] = 0;\n // } while (--copy);\n // if (state.length === 0) { state.mode = LEN; }\n // break;\n //#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END$1;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR$1;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR$1;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR$1;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH$1))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n };\n\n\n const inflateEnd = (strm) => {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR$1;\n }\n\n let state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK$1;\n };\n\n\n const inflateGetHeader = (strm, head) => {\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK$1;\n };\n\n\n const inflateSetDictionary = (strm, dictionary) => {\n const dictLength = dictionary.length;\n\n let state;\n let dictid;\n let ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR$1;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32_1(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR$1;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR$1;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\"));\n return Z_OK$1;\n };\n\n\n var inflateReset_1 = inflateReset;\n var inflateReset2_1 = inflateReset2;\n var inflateResetKeep_1 = inflateResetKeep;\n var inflateInit_1 = inflateInit;\n var inflateInit2_1 = inflateInit2;\n var inflate_2$1 = inflate$1;\n var inflateEnd_1 = inflateEnd;\n var inflateGetHeader_1 = inflateGetHeader;\n var inflateSetDictionary_1 = inflateSetDictionary;\n var inflateInfo = 'pako inflate (from Nodeca project)';\n\n /* Not implemented\n module.exports.inflateCopy = inflateCopy;\n module.exports.inflateGetDictionary = inflateGetDictionary;\n module.exports.inflateMark = inflateMark;\n module.exports.inflatePrime = inflatePrime;\n module.exports.inflateSync = inflateSync;\n module.exports.inflateSyncPoint = inflateSyncPoint;\n module.exports.inflateUndermine = inflateUndermine;\n */\n\n var inflate_1$1 = {\n \tinflateReset: inflateReset_1,\n \tinflateReset2: inflateReset2_1,\n \tinflateResetKeep: inflateResetKeep_1,\n \tinflateInit: inflateInit_1,\n \tinflateInit2: inflateInit2_1,\n \tinflate: inflate_2$1,\n \tinflateEnd: inflateEnd_1,\n \tinflateGetHeader: inflateGetHeader_1,\n \tinflateSetDictionary: inflateSetDictionary_1,\n \tinflateInfo: inflateInfo\n };\n\n const _has = (obj, key) => {\n return Object.prototype.hasOwnProperty.call(obj, key);\n };\n\n var assign = function (obj /*from1, from2, from3, ...*/) {\n const sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n const source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (const p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n };\n\n\n // Join array of chunks to single array.\n var flattenChunks = (chunks) => {\n // calculate data length\n let len = 0;\n\n for (let i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n const result = new Uint8Array(len);\n\n for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {\n let chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n };\n\n var common = {\n \tassign: assign,\n \tflattenChunks: flattenChunks\n };\n\n // String encode/decode helpers\n\n\n // Quick check if we can use fast array to bin string conversion\n //\n // - apply(Array) can fail on Android 2.2\n // - apply(Uint8Array) can fail on iOS 5.1 Safari\n //\n let STR_APPLY_UIA_OK = true;\n\n try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n // Table with utf8 lengths (calculated by first byte of sequence)\n // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n // because max possible codepoint is 0x10ffff\n const _utf8len = new Uint8Array(256);\n for (let q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n }\n _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n // convert string to array (typed, when possible)\n var string2buf = (str) => {\n if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {\n return new TextEncoder().encode(str);\n }\n\n let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n };\n\n // Helper\n const buf2binstring = (buf, len) => {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if (buf.subarray && STR_APPLY_UIA_OK) {\n return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));\n }\n }\n\n let result = '';\n for (let i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n };\n\n\n // convert array to string\n var buf2string = (buf, max) => {\n const len = max || buf.length;\n\n if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {\n return new TextDecoder().decode(buf.subarray(0, max));\n }\n\n let i, out;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n const utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n let c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n let c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n };\n\n\n // Calculate max possible position in utf8 buffer,\n // that will not break sequence. If that's not possible\n // - (very small limits) return max size as is.\n //\n // buf[] - utf8 bytes array\n // max - length limit (mandatory);\n var utf8border = (buf, max) => {\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n let pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n };\n\n var strings = {\n \tstring2buf: string2buf,\n \tbuf2string: buf2string,\n \tutf8border: utf8border\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n var messages = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n function ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n }\n\n var zstream = ZStream;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n function GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n }\n\n var gzheader = GZheader;\n\n const toString = Object.prototype.toString;\n\n /* Public constants ==========================================================*/\n /* ===========================================================================*/\n\n const {\n Z_NO_FLUSH, Z_FINISH,\n Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR\n } = constants$1;\n\n /* ===========================================================================*/\n\n\n /**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n /* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n /**\n * Inflate.result -> Uint8Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n /**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n /**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n /**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\n function Inflate(options) {\n this.options = common.assign({\n chunkSize: 1024 * 64,\n windowBits: 15,\n to: ''\n }, options || {});\n\n const opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = inflate_1$1.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n\n this.header = new gzheader();\n\n inflate_1$1.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = inflate_1$1.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n }\n }\n }\n\n /**\n * Inflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer): input data\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE\n * flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,\n * `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. If end of stream detected,\n * [[Inflate#onEnd]] will be called.\n *\n * `flush_mode` is not needed for normal operation, because end of stream\n * detected automatically. You may try to use it for advanced things, but\n * this functionality was not tested.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\n Inflate.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n const dictionary = this.options.dictionary;\n let status, _flush_mode, last_avail_out;\n\n if (this.ended) return false;\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = inflate_1$1.inflate(strm, _flush_mode);\n\n if (status === Z_NEED_DICT && dictionary) {\n status = inflate_1$1.inflateSetDictionary(strm, dictionary);\n\n if (status === Z_OK) {\n status = inflate_1$1.inflate(strm, _flush_mode);\n } else if (status === Z_DATA_ERROR) {\n // Replace code with more verbose\n status = Z_NEED_DICT;\n }\n }\n\n // Skip snyc markers if more data follows and not raw mode\n while (strm.avail_in > 0 &&\n status === Z_STREAM_END &&\n strm.state.wrap > 0 &&\n data[strm.next_in] !== 0)\n {\n inflate_1$1.inflateReset(strm);\n status = inflate_1$1.inflate(strm, _flush_mode);\n }\n\n switch (status) {\n case Z_STREAM_ERROR:\n case Z_DATA_ERROR:\n case Z_NEED_DICT:\n case Z_MEM_ERROR:\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n // Remember real `avail_out` value, because we may patch out buffer content\n // to align utf8 strings boundaries.\n last_avail_out = strm.avail_out;\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === Z_STREAM_END) {\n\n if (this.options.to === 'string') {\n\n let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n let tail = strm.next_out - next_out_utf8;\n let utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail & realign counters\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);\n\n this.onData(utf8str);\n\n } else {\n this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));\n }\n }\n }\n\n // Must repeat iteration if out buffer is full\n if (status === Z_OK && last_avail_out === 0) continue;\n\n // Finalize if end of stream reached.\n if (status === Z_STREAM_END) {\n status = inflate_1$1.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return true;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n };\n\n\n /**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|String): output data. When string output requested,\n * each chunk will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\n Inflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n };\n\n\n /**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\n Inflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = common.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n };\n\n\n /**\n * inflate(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako');\n * const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));\n * let output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err) {\n * console.log(err);\n * }\n * ```\n **/\n function inflate(input, options) {\n const inflator = new Inflate(options);\n\n inflator.push(input);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) throw inflator.msg || messages[inflator.err];\n\n return inflator.result;\n }\n\n\n /**\n * inflateRaw(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\n function inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n }\n\n\n /**\n * ungzip(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\n var Inflate_1 = Inflate;\n var inflate_2 = inflate;\n var inflateRaw_1 = inflateRaw;\n var ungzip = inflate;\n var constants = constants$1;\n\n var inflate_1 = {\n \tInflate: Inflate_1,\n \tinflate: inflate_2,\n \tinflateRaw: inflateRaw_1,\n \tungzip: ungzip,\n \tconstants: constants\n };\n\n exports.Inflate = Inflate_1;\n exports.constants = constants;\n exports['default'] = inflate_1;\n exports.inflate = inflate_2;\n exports.inflateRaw = inflateRaw_1;\n exports.ungzip = ungzip;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n\n","/* noCompress */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}")),"/* gzipCompress */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}")),"/* parseChunk */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n"),"","/* worker */",_l].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}return()=>new Worker(this.workerSourceURL)}_createMesh(e,t){const{buffer:n,position:i,normal:r,texcoord:s,indice:o,sub_mesh:a}=e,l=new Uint32Array(n,o.byteOffset,o.length),c=new Float32Array(n,i.byteOffset,i.length),h=new Int8Array(n,r.byteOffset,r.length),d=new Float32Array(n,s.byteOffset,s.length),f=new J;f.setIndex(new $(l,1)),f.setAttribute("position",new $(c,3)),f.setAttribute("normal",new $(h,3,!0)),f.setAttribute("uv",new $(d,2));for(let e=0;e<a.length;e++){const{uuid:n,start:i,count:r}=a[e],s=this.loadedMaterialsMap.get(n);if(s){const{materialIndex:e}=s;f.addGroup(i,r,e)}else f.addGroup(i,r,0),rn(`sbmx material: not found uuid: ${n} in file: ${t+Ll}`)}const p=new u(f,this.loadedMaterials);return p.castShadow=!0,p.receiveShadow=!0,p}async _createMaterial(e){const t=vn(e),n=t+Ll,i=this.loadedTextures.get(n);if(i)return i;const r=await this.store.getItem(`${e}_texture`);let s;if(r)s=r,this.loadedTextures.set(n,Promise.resolve(s));else{const t=this.loadedTextures.get(n);if(t)return t;const i=xn(n).then((e=>e.json()));this.loadedTextures.set(n,i),s=await i,Bn((()=>{this.store.setItem(`${e}_texture`,s)}))}Object.entries(s).forEach((e=>{let[n,i]=e;if(this.loadedMaterialsMap.has(n))return;const{name:r,base_map:s,nor_map:o,alphamode:l,color:c={r:1,g:1,b:1,a:1},metallic:h=.5,roughness:u=.5}=i,{r:d,g:f,b:p,a:m}=c,v=0!==l,y=new g({name:r,color:new a(d,f,p),side:Q,metalness:h,roughness:u,opacity:m,transparent:v,depthWrite:!v});if(s){const e=t+s;(new Ae).load(e,(e=>{e.flipY=!0,e.encoding=T,e.wrapS=N,e.wrapT=N,e.minFilter=Ze,e.magFilter=U,e.needsUpdate=!0,y.map=e,y.needsUpdate=!0,el.needsUpdate=!0}))}if(o){const e=t+o;(new Ae).load(e,(e=>{e.flipY=!0,e.encoding=T,e.wrapS=N,e.wrapT=N,e.needsUpdate=!0,y.normalMap=e,y.needsUpdate=!0,el.needsUpdate=!0}))}const b=this.loadedMaterials.push(y)-1;this.loadedMaterialsMap.set(n,{material:y,materialIndex:b})}))}dispose(){this.workerPool.dispose(),URL.revokeObjectURL(this.workerSourceURL)}}const kl=new Map,Ul=e=>{var t;return null!==(t=null==e?void 0:e.toLowerCase().endsWith(".png"))&&void 0!==t&&t},jl=e=>{if(kl.has(e))return kl.get(e);const t=new l;return kl.set(e,t),(new Ke).load(e,(e=>{t.image=e,t.needsUpdate=!0,el.needsUpdate=!0})),t.encoding=T,t.wrapS=N,t.wrapT=N,t.flipY=!1,t.anisotropy=16,t.mipmaps=[],t.generateMipmaps=!0,t},zl=(e,t,n,i)=>{const[r,s,o,l,c]=t,h=i||l<1;return new g({name:e,color:new a(r,s,o),opacity:l,transparent:h,depthWrite:!h,alphaTest:.01,map:n,side:c})};class Fl extends DataView{constructor(e,t){super(e),this.isLE=!0,this.appKeys=t}byteRevers(e,t){const n=t%this.appKeys.length;return e^this.appKeys[n]}getSoonUint8(e){return this.byteRevers(this.getUint8(e),e)}getSoonUint16(e){const t=new DataView(new Uint8Array(2).buffer);for(let n=0;n<2;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getUint16(0,this.isLE)}getSoonUint32(e){const t=new DataView(new Uint8Array(4).buffer);for(let n=0;n<4;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getUint32(0,this.isLE)}getSoonFloat32(e){const t=new DataView(new Uint8Array(4).buffer);for(let n=0;n<4;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getFloat32(0,this.isLE)}}const Hl=new TextDecoder;new TextDecoder;class Gl{constructor(){this.materials=new Map}parseObject(e,t){const n=new ul(Object.assign(Object.assign({},t),{format:"sbm"})),i=new ll({id:zn()});n.add(i);const{materialsCache:r,meshsCache:s}=e;for(const[e,t]of Object.entries(r)){if(this.materials.has(e))continue;const{textureUrl:n,materialInfo:i}=t;let r=null;n&&(r=jl(n));const s=zl(e,i,r,Ul(n));this.materials.set(e,s)}for(const[e,t]of Object.entries(s)){const{meshName:n,materialId:r,position:s,uv:o}=t,a=this.materials.get(r.toString());if(a){const t=new J,r=new Float32Array(s),l=new Float32Array(o);r.length>0&&t.setAttribute("position",new $(r,3)),l.length>0&&t.setAttribute("uv",new $(l,2)),t.computeVertexNormals();const c=new sl(t,a,{id:`${e}_${zn()}`,name:n||e});i.add(c)}}return n}}var Vl=class{constructor(){this.materials=new Map,this.sbmInfo=null}async parseBuffer(e,t,n){this.sbmInfo=t;const i=new DataView(e);let r=0;const s=[];for(let e=0;e<8;e++)s.push(i.getUint8(r)),r+=1;if("SBK-----"!==String.fromCharCode(...s))return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})格式或数据错误!`);const o=[],a=[],l=[];for(let e=0;e<32;e++)o.push(i.getUint8(r)),r+=1;const c=i.getUint8(r);r+=1;const h=i.getUint8(r);r+=1;for(let e=0;e<32;e++)a.push(i.getUint8(r)),r+=1;for(let e=0;e<64;e++)l.push(i.getUint8(r)),r+=1;const u=[...a,...l,...o],d=[];for(let e=0;e<u.length;e++)(e<=7||e>23&&e<=31||e>39&&e<=55||e>63&&e<=87||e>95&&e<=103)&&d.push(u[e]);if(64!==d.length)return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url} 数据错误!`);if(1===c){const e=i.buffer.slice(r,i.buffer.byteLength),t=new Fl(e,d);return 1===h||2===h?this._parseV2(t,n):3===h?this._parseV3(t,n):Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})版本错误!`)}return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})key 错误!`)}_parseV2(e,n){let i=0;const r=performance.now();i+=66;const s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new ul(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new ll({id:zn()});o.add(a);const l=e.getSoonUint16(i);i+=2;const c=e.getSoonUint16(i);i+=2,s.total=c;const h={};for(let t=0;t<l;++t){const t=e.getSoonUint16(i).toString();i+=2,h[t]={materialInfo:[]},i+=4,i+=4,i+=4,i+=4;const n=e.getSoonFloat32(i);i+=4;const r=e.getSoonFloat32(i);i+=4;const s=e.getSoonFloat32(i);i+=4;const o=e.getSoonFloat32(i);i+=4,i+=4,i+=4,i+=4,i+=4;let a=e.getSoonUint8(i);i+=1,0===a?a=Q:1===a?a=V:2===a&&(a=Y);const l=e.getSoonUint16(i);i+=2;let c=null;if(l>0){let n="",r="";for(let t=0;t<l;t++){const t=e.getSoonUint8(i);t>127?r=r+"%"+t.toString(16).toUpperCase():r.length>0?(n+=decodeURIComponent(r)+String.fromCharCode(t),r=""):n+=String.fromCharCode(t),i+=1}n=n.replace("\\","/");const{url:s,isPlatform:o}=this.sbmInfo,a=this.getTextureUrl(s,n,o);h[t].textureUrl=a,c=jl(a)}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=zl(t,e,c,Ul(h[t].textureUrl));this.materials.set(t,i),h[t].materialInfo=e}}const u={};for(let o=0;o<c;++o){const o=e.getSoonUint16(i);i+=2;const l=e.getSoonUint16(i).toString();i+=2,u[o]={materialId:l,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const c=[],h=[],d=[],f=[],p=e.getSoonUint16(i);if(i+=2,p>0)for(let n=0;n<p;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4,c.push(n)}const g=e.getSoonUint16(i);if(i+=2,g>0)for(let n=0;n<g;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4}const m=e.getSoonUint16(i);if(i+=2,m>0)for(let t=0;t<m;t++){const t=new w;t.setX(e.getSoonFloat32(i)),i+=4,t.setY(e.getSoonFloat32(i)),i+=4,h.push(t)}const v=e.getSoonUint16(i);if(i+=2,v>0)for(let t=0;t<v;t++){const t=e.getSoonUint16(i);i+=2;const n=e.getSoonUint16(i);i+=2;const r=e.getSoonUint16(i);i+=2;const s=[t,n,r];d.push(s),h.length>0&&f.push([h[s[0]],h[s[1]],h[s[2]]])}const y=[],b=[];for(let e=0;e<d.length;e++){const t=d[e],n=c[t[0]],i=c[t[1]],r=c[t[2]];y.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new w,o=new w,a=new w;const l=f[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),b.push(...s.toArray(),...o.toArray(),...a.toArray())}const A=new Float32Array(y),x=new Float32Array(b);u[o].position=A.buffer,u[o].uv=x.buffer;const S=new J;A.length>0&&S.setAttribute("position",new $(A,3)),x.length>0&&S.setAttribute("uv",new $(x,2)),S.computeVertexNormals();const E=this.materials.get(l);if(E){const e=new sl(S,E,{id:`${o}_${zn()}`,name:o.toString()});a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==n||n(s)}const d={materialsCache:h,meshsCache:u};return Promise.resolve({model:o,caches:d})}_parseV3(e,n){let i=0;i+=66;const r=performance.now(),s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new ul(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new ll({id:zn()});o.add(a);const l=e.getSoonUint16(i);i+=2;const c=e.getSoonUint16(i);i+=2,s.total=c;const h={};for(let t=0;t<l;++t){const t=e.getSoonUint16(i).toString();i+=2,h[t]={materialInfo:[]},i+=4,i+=4,i+=4,i+=4;const n=e.getSoonFloat32(i);i+=4;const r=e.getSoonFloat32(i);i+=4;const s=e.getSoonFloat32(i);i+=4;const o=e.getSoonFloat32(i);i+=4,i+=4,i+=4,i+=4,i+=4;let a=e.getSoonUint8(i);i+=1,0===a?a=Q:1===a?a=V:2===a&&(a=Y);const l=e.getSoonUint16(i);i+=2;let c=null;if(l>0){let n="",r="";for(let t=0;t<l;t++){const t=e.getSoonUint8(i);t>127?r=r+"%"+t.toString(16).toUpperCase():r.length>0?(n+=decodeURIComponent(r)+String.fromCharCode(t),r=""):n+=String.fromCharCode(t),i+=1}n=n.replace("\\","/");const{url:s,isPlatform:o}=this.sbmInfo,a=this.getTextureUrl(s,n,o);h[t].textureUrl=a,c=jl(a)}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=zl(t,e,c,Ul(h[t].textureUrl));this.materials.set(t,i),h[t].materialInfo=e}}const u={};for(let o=0;o<c;++o){const o=e.getSoonUint16(i).toString();i+=2;const l=e.getSoonUint16(i);i+=2;let c="";if(l>0){const t=[];for(let n=0;n<l;n++){const n=e.getSoonUint8(i);t.push(n),i+=1}const n=new Uint8Array(t);c=Hl.decode(n)}const h=e.getSoonUint16(i).toString();i+=2,u[o]={meshName:c,materialId:h,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const d=[],f=[],p=[],g=[],m=e.getSoonUint32(i);if(i+=4,m>0)for(let n=0;n<m;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4,d.push(n)}const v=e.getSoonUint32(i);if(i+=4,v>0)for(let n=0;n<v;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4}const y=e.getSoonUint32(i);if(i+=4,y>0)for(let t=0;t<y;t++){const t=new w;t.setX(e.getSoonFloat32(i)),i+=4,t.setY(e.getSoonFloat32(i)),i+=4,f.push(t)}const b=e.getSoonUint32(i);if(i+=4,b>0)for(let t=0;t<b;t++){const t=e.getSoonUint32(i);i+=4;const n=e.getSoonUint32(i);i+=4;const r=e.getSoonUint32(i);i+=4;const s=[t,n,r];p.push(s),f.length>0&&g.push([f[s[0]],f[s[1]],f[s[2]]])}const A=[],x=[];for(let e=0;e<p.length;e++){const t=p[e],n=d[t[0]],i=d[t[1]],r=d[t[2]];A.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new w,o=new w,a=new w;const l=g[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),x.push(...s.toArray(),...o.toArray(),...a.toArray())}const S=new Float32Array(A),E=new Float32Array(x);u[o].position=S.buffer,u[o].uv=E.buffer;const T=new J;if(S.length>0&&T.setAttribute("position",new $(S,3)),E.length>0&&T.setAttribute("uv",new $(E,2)),T.computeVertexNormals(),this.materials.has(h)){const e=new sl(T,this.materials.get(h),{id:`${o}_${zn()}`,name:c});a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==n||n(s)}const d={materialsCache:h,meshsCache:u};return Promise.resolve({model:o,caches:d})}getTextureUrl(e,t,n){let i="",r=t;const s=r.lastIndexOf("/");if(-1!==s&&(r=r.substring(s+1)),i=e,n){const e=i.split("/");e.length>1&&(e.splice(e.length-3,e.length),i=e.join("/")+"/Maps/"+r)}else{const e=i.lastIndexOf("/");-1!==e&&(i=i.substring(0,e+1)+"Maps/"+r)}return i}};class Yl extends Cl{constructor(e,t){super(Xt,e,t),this.viewport=e,this.isDisposed=!1,this.modelsPromiseMap=new Map,this.modelsMap=new Map,this.store=Ml.createInstance({name:"soonspace",storeName:"modelData"}),this.cacheStore=Ml.createInstance({name:"soonspace",storeName:"modelCache"}),this.loadingManager=new k,this.datLoader=new Nl(this.cacheStore),this.gltfLoader=new Et(this.loadingManager),this.fbxLoader=new xt(this.loadingManager),this.dracoDecoderPath=null,this._initLoadingManager(this.loadingManager)}setDracoDecoderPath(e){this.dracoDecoderPath=e;const t=new Tt;t.setDecoderPath(e),this.gltfLoader.setDRACOLoader(t),this.datLoader.dracoDecoderPath=e}async load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scene;const{url:n}=e,i=this.modelsPromiseMap.get(n);if(i){if(await i,this.isDisposed)return this.dispose(),null;const r=this.modelsMap.get(n);return r?this.clone(r,e,t):null}const r=this._innerLoad(e,t);return this.modelsPromiseMap.set(n,r),r}async parse(e){const{url:t,id:n}=e;if(!t)return rn(`id: ${n} url: ${t} is empty`),null;switch(t.slice(t.lastIndexOf(".")+1).toLocaleUpperCase()){case"SBM":return this._parseSbm(e);case"SBMX":return this._parseSbmx(e);case"DAT":return this._parseDat(e);case"GLB":case"GLTF":return this._parseGltf(e);case"FBX":return this._parseFbx(e);default:return rn(`模型资源( id: ${n}, url: ${t} )格式错误,当前格式支持 sbm、sbmx、fbx、gltf、glb !`),null}}clone(e,t,n){return new Promise(((i,r)=>{var s;"Model"!==e.stype&&r("In soonspacejs: 方法 cloneModel 参入对象类型错误!");const{id:o,name:a,level:l,visible:c,position:h,rotation:u,scale:d,onClick:f,onDblClick:p,onRightClick:g,onLoad:m,userData:v}=t;function y(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)y(e.children[i],t.children[i],n)}const b=function(e){const t=new Map,n=new Map,i=e.sClone();return y(e,i,(function(e,i){t.set(i,e),n.set(e,i)})),i.traverse((function(e){if(e instanceof qe){const i=e,r=t.get(e),s=r.skeleton.bones;i.skeleton=r.skeleton.clone(),i.bindMatrix.copy(r.bindMatrix),i.skeleton.bones=s.map((function(e){return n.get(e)})),i.bind(i.skeleton,i.bindMatrix)}})),i}(e);b.animations=b.animations.map((e=>e.clone())),o&&(b.sid=o),a&&(b.name=a),l&&(b.level=l),!1===c&&b.hide(),h&&b.position.set(h.x,h.y,h.z),u&&b.rotation.set(u.x,u.y,u.z),d&&b.scale.set(d.x,d.y,d.z),b.onClick=f?f.bind(b):null,b.onDblClick=p?p.bind(b):null,b.onRightClick=g?g.bind(b):null,b.onLoad=m?m.bind(b):null,null===(s=b.onLoad)||void 0===s||s.call(b,b),v&&(b.userData=v),null!==n&&this.viewport.scener.addObject(b,n||this.scene||e.parent),i(b)}))}async loadToGroup(e,t){const n=this.createGroup(e,null);return await Promise.allSettled(t.map((e=>this.load(e,null).then((e=>e&&n.add(e))).catch(console.error)))),this.viewport.scener.addObject(n,this.scene),n}async addForGroup(e,t){return e&&await Promise.allSettled(t.map((async t=>this.load(t,null).then((t=>t&&this.viewport.scener.addObject(t,e))).catch(console.error)))),e}async clearIdb(){await this.store.clear(),await this.cacheStore.clear()}dispose(){var e;this.isDisposed=!0,this.modelsPromiseMap.clear(),this.modelsMap.clear(),null===(e=this.gltfLoader.dracoLoader)||void 0===e||e.dispose(),this.datLoader.dispose()}_initLoadingManager(e){e.addHandler(/\.tga$/i,new St)}_setModelsMap(e,t){this.modelsMap.has(e)||this.modelsMap.set(e,t)}async _parseSbm(e){const{useIndexedDB:t}=this.viewport.options,{url:n}=e,i=async t=>{const i=await(new Vl).parseBuffer(t,e),{model:r,caches:s}=i;return s&&Bn((()=>{this.cacheStore.setItem(n,s)})),r},r=e=>{var t;null===(t=e.onLoad)||void 0===t||t.call(e,e)};if(t){const t=await this.cacheStore.getItem(n);if(t){const n=(new Gl).parseObject(t,e);return r(n),n}{const e=await this.store.getItem(n)||await this._fetchBuffer(n),t=await i(e);return r(t),t}}{const e=await this._fetchBuffer(n),t=await i(e);return r(t),t}}async _parseSbmx(e){const{url:t}=e,n=await this._getBuffer(t),i=jn(n,0,8),r=new DataView(n.slice(8));switch(i){case"SBMG----":for(let e=0;e<r.byteLength;e++){const t=r.getUint8(e),n=(t>>4&15)+(t<<4&240);r.setUint8(e,n)}return this._parseGltf(e,r.buffer);case"SBMD----":return this._parseDat(e,r.buffer);default:return this._parseGltf(e,r.buffer)}}async _parseDat(e,t){const{url:n}=e,i=t||await this._getBuffer(n),r=new ul(Object.assign(Object.assign({},e),{format:"dat"})),s=await this.datLoader.parseAsync(i,n);return s&&r.add(s),r}async _parseGltf(e,t){const{url:n}=e,i=vn(n),r=t||await this._getBuffer(n),s=new ul(Object.assign(Object.assign({},e),{format:"gltf"})),o=await this.gltfLoader.parseAsync(r,i),{animations:a}=o;return a&&a.length>0&&(s.animations=a),o.scene.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e.castShadow=!0,e.receiveShadow=!0})),s.add(o.scene),s}async _parseFbx(e){const{url:t}=e,n=vn(t),i=await this._getBuffer(t),r=new ul(Object.assign(Object.assign({},e),{format:"gltf"})),s=this.fbxLoader.parse(i,n),{animations:o}=s;return o&&o.length>0&&(r.animations=o),s.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e.castShadow=!0,e.receiveShadow=!0})),r.add(s),r}async _innerLoad(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scene;var n;const{url:i}=e,r=await this.parse(e);return r?(null===(n=r.onLoad)||void 0===n||n.call(r,r),this._setModelsMap(i,r.sClone()),null!==t&&this.viewport.scener.addObject(r,t),r):null}async _fetchBuffer(e){const{useIndexedDB:t}=this.viewport.options,n=await xn(e),i=await n.arrayBuffer();return t&&this.store.setItem(e,i),i}async _getBuffer(e){const{useIndexedDB:t}=this.viewport.options;if(t){const t=await this.store.getItem(e);return t||this._fetchBuffer(e)}return this._fetchBuffer(e)}}class Ql extends Cl{constructor(e,t){super(Zt,e,t),this.materials=new Map}create(e){const t=this._createMaterial(e.url),n=new pl(t,e);return this.viewport.scener.addObject(n,this.scene),n}clone(e,t,n){"Poi"!==e.stype&&console.error("In soonspacejs: 方法 clonePoi 参入对象类型错误!");const{id:i,type:r,name:s,level:o,visible:a,position:l,rotation:c,scale:h,onClick:u,onDblClick:d,onRightClick:f,userData:p}=t,g=e.sClone(!1,r);return this._copyMaterial(g),i&&(g.sid=i),s&&(g.name=s),o&&(g.level=o),Rn(a)&&(g.visible=a),l&&g.position.set(l.x,l.y,l.z),c&&g.rotation.set(c.x,c.y,c.z),h&&g.scale.set(h.x,h.y,h.z),g.onClick=u?u.bind(g):null,g.onDblClick=d?d.bind(g):null,g.onRightClick=f?f.bind(g):null,p&&(g.userData=p),null!==n&&this.viewport.scener.addObject(g,n||this.scene||e.parent),g}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=this._createMaterial(e.url),i=new pl(t,e);n.add(i)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{const n=this._createMaterial(t.url),i=new pl(n,t);e.add(i)})),this.viewport.scener.addObject(e,this.scene)),e}_createMaterial(e){const t=this.materials.get(e);if(!t){const t=(new Ae).load(e);t.flipY=!0;const n=new Le({map:t,color:16777215});return this.materials.set(e,n),n}return t}_copyMaterial(e){e.traverse((e=>{(e instanceof u||e instanceof _e)&&(Ln(e.material)?e.material=e.material.map((e=>e.clone())):e.material instanceof ee&&(e.material=e.material.clone()))}))}}class Wl extends Cl{constructor(e,t){super(Kt,e,t)}create(e){this._openEnableRenderCss(e);const t=new hl(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{this._openEnableRenderCss(e);const t=new hl(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{this._openEnableRenderCss(t);const n=new hl(t);e.add(n)})),this.viewport.scener.addObject(e,this.scene)),e}_openEnableRenderCss(e){switch(e.type){case"2d":case"2D":this.viewport.rendererManager.setInternalState("enableRenderCss2D",!0);break;case"2.5d":case"2.5D":case"3d":case"3D":this.viewport.rendererManager.setInternalState("enableRenderCss3D",!0)}}}class Xl extends Cl{constructor(e,t){super(qt,e,t)}create(e){const t=new El(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=new El(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{const n=new El(t);e.add(n)})),this.viewport.scener.addObject(e,this.scene)),e}}class Zl{constructor(){this.graph=new Map,this.queue=null,this.previous=new Map}setGraph(e){if(!(e.length<1))for(const t of e){const[e,n]=t;this.graph.set(e,new Map);for(const t of n){const[n,i]=t,r=this.graph.get(e);null==r||r.set(n,i)}}}getPath(e,t){var n;if(e===t)return[];const i=this.queue=new pn;i.add(e,0),this.previous.set(e,null);let r=null;for(;r=i.shift();){if(r===t){const e=[];for(;null!==r&&null!==this.previous.get(r);)e.unshift(r),r=null!==(n=this.previous.get(r))&&void 0!==n?n:null;return e}const e=i.getDistance(r);if(e===1/0)return[];const s=this.graph.get(r);s&&s.forEach(((t,n)=>{const s=i.getDistance(n),o=e+t;o<s&&(i.update(n,o),this.previous.set(n,r))}))}return[]}}class Kl extends Cl{constructor(e,t){super(Jt,e,t),this.dijkstra=new Zl}async createFromGml(e){const{url:t,linkWidth:n=20,linkColor:i=65280,renderNode:r=!0,nodeColor:s=255}=e;return Mn(t).then((t=>{if(!t||!t.MultiLayeredGraph)return Promise.reject('In soonspace: createTopologyFromGml "url" path error!');const o=[],a=new Map;let l=[],c=[];const h=t.MultiLayeredGraph.SpaceLayerMember.SpaceLayer.X_floor;Ln(h)?h.forEach((e=>{l=[...l,...e.state],c=[...c,...e.transition]})):(l=[...l,...h.state],c=[...c,...h.transition]),l.forEach(((e,t)=>{const n=e.State._attributes["gml:id"],i=e.State.topoNode["gml:Node"].node_name;o.push({id:Pn(n)?n:"",name:Pn(i)?i:"",position:{x:Number(e.State.topoNode["gml:Node"].xcoord["#text"]),y:Number(e.State.topoNode["gml:Node"].zcoord["#text"]),z:-1*Number(e.State.topoNode["gml:Node"].ycoord["#text"])},graphs:[]}),a.set(n,t)})),c.forEach((e=>{const t=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][0]._attributes["xlink:href"],n=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][1]._attributes["xlink:href"],i=e.Transition.topoEdge["gml:Edge"].restrict["#text"],r=e.Transition.topoEdge["gml:Edge"].passable["#text"],s=a.get(t),l=a.get(n),c=e.Transition._attributes["gml:id"],h=e.Transition.topoEdge["gml:Edge"].link_name["#text"];void 0!==s&&void 0!==l&&("2"!==r&&"3"!==r&&o[s].graphs.push({targetNodeId:n,linkInfo:{id:c,name:h},enable:!0,restrict:parseInt(i),passable:parseInt(r)}),"1"!==r&&"3"!==r&&o[l].graphs.push({targetNodeId:t,linkInfo:{id:c,name:h},enable:!0,restrict:parseInt(i),passable:parseInt(r)}))}));const u=new bl(Object.assign(Object.assign({},e),{type:"network",nodes:o,linkWidth:n,renderLink:!0,linkColor:i,renderNode:r,nodeColor:s}));return this.setDijkstraGraph(u.nodes),this.viewport.scener.addObject(u,this.scene),Promise.resolve(u)}))}create(e){const t=this.generateLineTopologyInfoNodeGraphs(e),n=new bl(t);return this.setDijkstraGraph(n.nodes),this.viewport.scener.addObject(n,this.scene),n}resetNodes(e,t){const n=this.generateLineTopologyInfoNodeGraphs(Object.assign(Object.assign({},e.info),{nodes:t}));return e.resetNodes(n.nodes),this.viewport.signals.objectChanged.dispatch(),e}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=this.generateLineTopologyInfoNodeGraphs(e),i=new bl(t);this.setDijkstraGraph(i.nodes),n.add(i)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&t.forEach((t=>{const n=this.generateLineTopologyInfoNodeGraphs(t),i=new bl(n);this.setDijkstraGraph(i.nodes),e.add(i)})),e}getShortestPath(e,n){const i=yn(e.info.nodes),r=sn(n.start),s=sn(n.end);let o=null,a=1/0,l=null,c=1/0;for(let n=0;n<i.length;n++){const h=i[n];if(0===h.graphs.length)continue;const u=e.nodes.find((e=>e.sid===h.id));if(!u)continue;const d=u.getWorldPosition(new t),f=d.distanceTo(r),p=d.distanceTo(s);f<a&&(a=f,o=h),p<c&&(c=p,l=h)}if(!o||!l||o.id===l.id)return null;const h=o.id,u=l.id,d=this.dijkstra.getPath(h,u);if(0===d.length)return null;d.unshift(o.id);const f=[];for(let e=0;e<d.length;e++){const t=i.find((t=>t.id==d[e]));t&&(t.id+=zn(),t.position.y+=.01,f.push(t))}const p=Object.assign(Object.assign(Object.assign({},n),{type:"line",nodes:f}),e.getSpaceAttribute(!0));this.generateLineTopologyInfoNodeGraphs(p);const g=new bl(p);return this.viewport.scener.addObject(g,this.scene),g}getShortestPathByMultipleStartPoints(e,i){const{nodes:s}=e.info,o=[];i.start.forEach((e=>{const t=sn(e),n=sn(i.end);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=sn(e.position),s=i.distanceTo(t),o=i.distanceTo(n);s<a&&(a=s,r=e.id),o<c&&(c=o,l=e.id)}})),r&&l){let e=0;const i=this.dijkstra.getPath(r,l);if(i.length>0){const r=[{id:"startPoint",position:t,graphs:[]}];i.forEach(((n,i)=>{const o=s.find((e=>e.id==n));o&&(e+=0===i?sn(o.position).distanceTo(t):sn(o.position).distanceTo(sn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(sn(r[r.length-1].position)),o.push({nodeInfo:r,pathLength:e})}}}));let a=[],l=1/0;if(o.forEach((e=>{let{nodeInfo:t,pathLength:n}=e;n<l&&(l=n,a=t)})),a.length){for(let e=0;e<a.length;e++)a[e].position.y+=.01;const s=Object.assign(Object.assign({},i),{type:"line",nodes:a,position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)});this.generateLineTopologyInfoNodeGraphs(s);const o=new bl(s);return this.viewport.scener.addObject(o,this.scene),o}return null}getShortestPathByMultipleEndPoints(e,i){const{nodes:s}=e.info,o=[];i.end.forEach((e=>{const t=sn(i.start),n=sn(e);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=sn(e.position),s=i.distanceTo(t),o=i.distanceTo(n);s<a&&(a=s,r=e.id),o<c&&(c=o,l=e.id)}})),r&&l){let e=0;const i=this.dijkstra.getPath(r,l);if(i.length>0){const r=[{id:"startPoint",position:t,graphs:[]}];i.forEach(((n,i)=>{const o=s.find((e=>e.id==n));o&&(e+=0===i?sn(o.position).distanceTo(t):sn(o.position).distanceTo(sn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(sn(r[r.length-1].position)),o.push({nodeInfo:r,pathLength:e})}}}));let a=[],l=1/0;if(o.forEach((e=>{let{nodeInfo:t,pathLength:n}=e;n<l&&(l=n,a=t)})),a.length){for(let e=0;e<a.length;e++)a[e].position.y+=.01;const s=Object.assign(Object.assign({},i),{type:"line",nodes:a,position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)});this.generateLineTopologyInfoNodeGraphs(s);const o=new bl(s);return this.viewport.scener.addObject(o,this.scene),o}return null}setDijkstraGraph(e){const n=[];for(let i=0;i<e.length;i++){const r=e[i];if(0===r.graphs.length)continue;const s=[];for(let n=0;n<r.graphs.length;n++){const i=r.graphs[n],o=e.find((e=>e.sid===i.targetNodeId));if(!o)continue;const a=r.getWorldPosition(new t),l=o.getWorldPosition(new t);s.push([i.targetNodeId,a.distanceTo(l)])}n.push([r.sid,s])}n.length>0&&this.dijkstra.setGraph(n)}generateLineTopologyInfoNodeGraphs(e){const{type:t,nodes:n}=e;if("line"===t)for(let t=0;t<n.length;t++)if(t===n.length-1)n[t].graphs=[];else{const i=e.nodes[t],r=e.nodes[t+1];n[t].graphs=[{targetNodeId:r.id,linkInfo:{id:`${i.id}_to_${r.id}`,name:`${i.name||i.id}_to_${r.name||r.id}`},enable:!0,restrict:0,passable:0}]}return Object.assign(Object.assign({},e),{nodes:n})}}class ql extends Cl{constructor(e,t){super($t,e,t)}addGridHelper(e){const{id:t,size:n=1e3,divisions:i=20,color:r="#fff",position:s={x:0,y:0,z:0},rotation:o={x:0,y:0,z:0},scale:a={x:1,y:1,z:1}}=e,l=new Je(n,i,r,r);return l.position.set(s.x,s.y,s.z),l.rotation.set(o.x,o.y,o.z),l.scale.set(a.x,a.y,a.z),l.userData.sid=t,l.userData.stype="Helper",this.viewport.scener.addObject(l,this.scene),l}addAxesHelper(e){const{id:t,axesLength:n=1e3}=e,i=new $e(n);return i.userData.sid=t,i.userData.stype="Helper",this.viewport.scener.addObject(i,this.scene),i}addBoxHelper(e){const{id:t,box:n,color:i="#00ff00"}=e,r=new et(n,new a(i));return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addPlaneHelper(e){const{id:t,width:n=500,height:i=500,color:r="#00ff00",opacity:s=.2,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1}}=e,c=new sl(new Se(n,i),new xe({color:r,opacity:s,transparent:s<1,side:Y}),{id:t,position:o,rotation:a,scale:l});return c.userData.sid=t,c.userData.stype="Helper",this.viewport.scener.addObject(c,this.scene),c}addGroundHelper(e){const{imgUrl:t,id:n,width:i=500,height:r=500,opacity:s=1,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},repeat:c={x:10,y:10}}=e,h=(new Ae).load(t),u=new Se(i,r);u.computeBoundingBox();const d=new g({side:Y,map:h,transparent:s<1,opacity:s,roughness:.8});d.map&&(d.map.repeat.set(c.x,c.x),d.map.wrapS=N,d.map.wrapT=N,d.map.version++),a.x-=Math.PI/2,d.version++;const f=new Tl(u,d,{id:n,position:o,rotation:a,scale:l});return f.userData.sid=n,f.userData.stype="Helper",this.viewport.scener.addObject(f,this.scene),f}addDirectionalLightHelper(e){const{id:t,light:n,color:i,size:r=50}=e,s=new tt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addHemisphereLightHelper(e){const{id:t,light:n,color:i,size:r=20}=e,s=new nt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addSpotLightHelper(e){const{id:t,light:n,color:i}=e,r=new it(n,i);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addPointLightHelper(e){const{id:t,light:n,color:i,size:r=20}=e,s=new rt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addRectAreaLightHelper(e){const{id:t,light:n,color:i}=e,r=new Dt(n,i);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}}class Jl extends Cl{constructor(e,t){super(en,e,t)}createObject(e,t){const n=new cl(e);return t&&n.add(t),this.viewport.scener.addObject(n,this.scene),n}addToObject(e,t){return e?(this.viewport.scener.addObject(t,e),e):null}}class $l extends Cl{constructor(e,t){super(Qt,e,t)}}class ec{constructor(e){this.viewport=e,this.cache={objects:new Map,classified:{Group:new Set,Light:new Set,Model:new Set,Poi:new Set,PoiNode:new Set,Canvas3D:new Set,Topology:new Set,Helper:new Set,PluginObject:new Set}},this.scene=e.scene,this.store={groupManager:new $l(e,this.scene),lightManager:new Bl(e,this.scene),modelManager:new Yl(e,this.scene),poiManager:new Ql(e,this.scene),poiNodeManager:new Wl(e,this.scene),canvas3DManager:new Xl(e,this.scene),topologyManager:new Kl(e,this.scene),helperManager:new ql(e,this.scene),pluginObjectManager:new Jl(e,this.scene)},e.postUpdate.set("ManagerRender",this.update.bind(this)),e.signals.objectAdded.add(this.setObjectCache.bind(this)),e.signals.objectRemoved.add(this.deleteObjectCache.bind(this))}levelUpdate(){const e=(e,t)=>{e.visible!==t&&(e.visible=t,e.matrixAutoUpdate=t,e.autoUpdate=!0)},t=t=>{const{level:n,handleHide:i,autoUpdate:r}=t,{max:s=null,min:o=null}=n;if(r)t.autoUpdate=!1,this.viewport.signals.objectChanged.dispatch();else if(!i&&(_n(s)||_n(o))){const n=this.viewport.camera.position.distanceTo(t.position);_n(s)&&n>s||_n(o)&&n<o?e(t,!1):e(t,!0)}};this.scene.traverse((e=>{(e instanceof al||e instanceof sl)&&t(e)}))}update(){if(0===this.scene.children.length)return;const e=performance.now();this.viewport.options.levelEnabled&&this.levelUpdate(),this.viewport.signals.loadRendered.dispatch(performance.now()-e)}isObjectInScene(e){let t=!1;return e.traverseAncestors((e=>{e===this.scene&&(t=!0)})),t}getObjectById(e){const t=this.getObjectCache(e);if(t){if(this.isObjectInScene(t))return t}return null}getObjectByName(e){return this._getObjectByProps("name",e)}getObjectByUserDataProperty(e,t){const n=[];return this.cache.objects.forEach((i=>{this.isObjectInScene(i)&&Nn(i)&&(i instanceof al||i instanceof sl||i.userData.stype)&&(kn(e)&&e(i.userData)||Pn(e)&&i.userData[e]===t)&&n.push(i)})),n}removeObjectById(e){const t=this.getObjectById(e);return!!t&&(this.viewport.scener.removeObject(t),!0)}_getObjectByProps(e,t){const n=[];return this.cache.objects.forEach((i=>{this.isObjectInScene(i)&&((i instanceof al||i instanceof sl)&&Nn(i)&&i[e]===t||Nn(i)&&i.userData.stype&&("name"===e&&i.name===t||"sid"===e&&i.userData.sid===t))&&n.push(i)})),n}getObjectCache(e){return this.cache.objects.get(e)}setObjectCache(e){const t=(e,t)=>{const n=this.cache.objects.get(t);n&&n!==e&&rn(`object id ${t} already exists in scene`)};null==e||e.traverse((n=>{if(n instanceof al||n instanceof sl){if("string"==typeof n.sid&&n.sid.startsWith(Yt))return;t(n,n.sid),this.cache.objects.set(n.sid,n);const e=n.stype;this.cache.classified[e]&&this.cache.classified[e].add(n)}else if(n.userData.sid&&e.userData.stype){t(n,n.userData.sid),this.cache.objects.set(n.userData.sid,n);const e=n.userData.stype;this.cache.classified[e]&&this.cache.classified[e].add(n)}}))}deleteObjectCache(e){null==e||e.traverse((t=>{if(t instanceof al||t instanceof sl){this.cache.objects.delete(t.sid);const e=t.stype;this.cache.classified[e]&&this.cache.classified[e].delete(t)}else if(t.userData.sid&&e.userData.stype){this.cache.objects.delete(t.userData.sid);const e=t.userData.stype;this.cache.classified[e]&&this.cache.classified[e].delete(t)}}))}clearObject(){this.store.modelManager.clear(),this.store.poiManager.clear(),this.store.poiNodeManager.clear(),this.store.canvas3DManager.clear(),this.store.topologyManager.clear(),this.store.helperManager.clear(),this.store.pluginObjectManager.clear()}clear(){this.clearObject(),this.store.lightManager.clear()}dispose(){this.store.modelManager.dispose(),this.cache.objects.clear(),this.clear()}}function tc(e){const t=nc(e),n=new m;n.setFromMatrix3(t);const i=e[0],r=n.clone();r.setPosition(i);const s=r.clone().invert(),o=e.map((e=>{const t=e.clone().applyMatrix4(s);return new w(t.x,t.y)})),a=new ze(o),l=new je(a),c=new st;c.setFromPoints(o);const h=ic(c);return l.getAttribute("uv").applyMatrix3(h),l.applyMatrix4(n),{geometry:l,polygonBox:c,modelMatrix:n,planeMatrix:r,projectionMatrix:s,position:i}}function nc(e){const[n,i,r]=e,s=new ot;s.setFromCoplanarPoints(i,n,r);const o=s.normal,a=o.clone().cross(new t(0,0,1));a.equals(new t)&&a.set(1,0,0);const l=o.clone().cross(a);a.normalize(),l.normalize(),o.normalize();const c=new ue;return c.elements=[a.x,a.y,a.z,l.x,l.y,l.z,o.x,o.y,o.z],c}function ic(e){const t=e.min,n=e.getSize(new w),i=new ue;return i.elements=[n.x,0,0,0,n.y,0,t.x,t.y,1],i.invert()}function rc(e,t){const n=sc(t);return e.intersectsBox(n)}function sc(e){const n=new i,r=n.min.clone(),s=n.max.clone();if(n.setFromObject(e),n.min.equals(r)&&n.max.equals(s)){const i=new t;e.getWorldPosition(i),n.min.copy(i),n.max.copy(i)}if(e.isInstancedMesh){const{count:t,matrixWorld:i,geometry:r}=e;let s=r.boundingBox;if(s||(r.computeBoundingBox(),s=r.boundingBox),s){const r=i.clone();for(let i=0;i<t;i++){const t=new m;e.getMatrixAt(i,t),t.premultiply(r);const o=s.clone();o.applyMatrix4(r),n.union(o)}}}return n}function oc(e,t,n){if("string"==typeof e){let i=t?null==n?void 0:n.get(e):null;if(!i){i=(new Ae).load(e),null==n||n.set(e,i)}return i}return e instanceof HTMLImageElement?new l(e):e instanceof HTMLCanvasElement?new at(e):new pe(e)}function ac(e,t,n,i){const r=e.map,s=oc(t,n,i);if(!r)return e.map=s,s;const o=s.source;return s.copy(r),s.source=o,e.map=s,s}function lc(e,n){const{top:r,left:s,bottom:o,right:a,front:l,back:c}=e,h=new t(a,r,l),u=new t(s,o,c),d=new i;return function(e){return d.max.addVectors(e,h),d.min.subVectors(e,u),n.filter((e=>rc(d,e)))}}function cc(e,n){const i=new S(new t,e);return function(e){return i.center.copy(e),n.filter((e=>rc(i,e)))}}function hc(e,n){const i=e.length-1,r=[];for(let t=0;t<i;t++){const n=e[t],i=e[t+1],s=new lt(n,i);r.push(s)}const s=new S(new t,n);return function(e){return e.filter((e=>{const n=sc(e),i=new t;n.getCenter(i);const o=r.filter((e=>{const t=e.closestPointToPointParameter(i);return 0<=t||t>=1}));if(0===o.length)return!1;let a=1/0,l=i;for(const e of o){const n=e.closestPointToPoint(i,!0,new t),r=i.distanceToSquared(n);r<a&&(a=r,l=n)}return s.center.copy(l),s.intersectsBox(n)}))}}function uc(e,t){const{image:n,color:i,width:r,height:s,position:o,rotation:a,needLight:l,id:c,name:h,userData:u,level:d,visible:f,cache:p}=e,g=Jn(e,["image","color","width","height","position","rotation","needLight","id","name","userData","level","visible","cache"]),m=new Se(r,s),v=n?Object.assign(Object.assign({transparent:!0},g),{map:oc(n,null==p||p,t)}):g,y=l?new ct(v):new xe(v),b=new sl(m,y,{id:c,name:h,userData:u,level:d,visible:f});return o&&b.position.set(o.x,o.y,o.z),a&&b.rotation.set(a.x,a.y,a.z),b}function dc(e,n){const{points:i,image:r,color:s,needLight:o,id:a,name:l,userData:c,level:h,visible:u,cache:d}=e,f=Jn(e,["points","image","color","needLight","id","name","userData","level","visible","cache"]),p=i.map((e=>new t(e.x,e.y,e.z))),g=r?Object.assign(Object.assign({transparent:!0},f),{map:oc(r,null==d||d,n)}):f,m=o?new ct(g):new xe(g),{geometry:v,position:y}=tc(p),b=new sl(v,m,{id:a,name:l,userData:c,level:h,visible:u});return b.position.copy(y),b}class fc{constructor(t){this.THREE=e,this.TWEEN=Vt,this.utils=Hn,this.version=It,this.animation=Vn,this.library=Dl,this.plugins={},this.textureCache=new Map;const{el:n,options:i={},events:r={}}=t;if(this.domElement=document.querySelector(n),this.options=Object.assign(Object.assign({},{showInfo:!1,showStats:!1,showViewHelper:!1,showGrid:!1,background:{color:11459572,alpha:!1},fog:!1,controls:{type:"free"},hoverEnabled:!1,levelEnabled:!1,closeInfoLog:!1,closeWarnLog:!1,useIndexedDB:!0,logarithmicDepthBuffer:!0}),i),this.viewport=new rl(this.options),this.signals=this.viewport.signals,this.manager=new ec(this.viewport),!this.domElement)throw new Error(`In SoonSpace: Can't find element by "${n}"!`);this.domElement.appendChild(this.viewport.container),this._init(),this._initEvents(r),this._initDefaultSettings()}_init(){const{showGrid:e,background:t,fog:n,controls:i,closeInfoLog:r,closeWarnLog:s,useIndexedDB:o}=this.options;if(!r){nn(" ____ ____ _ \n / ___| ___ ___ _ __ / ___| _ __ __ _ ___ ___ (_)___ \n \\___ \\ / _ \\ / _ \\| '_ \\\\___ \\| '_ \\ / _` |/ __/ _ \\ | / __| \n ___) | (_) | (_) | | | |___) | |_) | (_| | (_| __/_ | \\__ \\ \n |____/ \\___/ \\___/|_| |_|____/| .__/ \\__,_|\\___\\___(_)/ |___/ \n |_| |__/ \n",{color:"#3eaf7c"}),nn(Bt,{color:"#3eaf7c","font-size":"24px"}),nn(`当前版本: ${this.version}`,{color:"#3eaf7c","font-size":"12px"}),nn("文档: http://www.xwbuilders.com:8800",{color:"#3eaf7c","font-size":"12px"}),nn("样例: http://www.xwbuilders.com:8800/examples",{color:"#3eaf7c","font-size":"12px"}),nn("GitHub: https://github.com/soonspacejs",{color:"#3eaf7c","font-size":"12px"})}e&&this.addGridHelper(!0===e?{id:"defaultGridHelper"}:e),(null==t?void 0:t.skyBox)?Pn(null==t?void 0:t.skyBox)?this.setSphereSkyBackground(null==t?void 0:t.skyBox):Nn(null==t?void 0:t.skyBox)&&this.setSkyBackground(t.skyBox.dirPath,t.skyBox.fileNames):(null==t?void 0:t.img)?this.setBackgroundImage(t.img):(null==t?void 0:t.color)&&this.setBackgroundColor(t.color),n&&this.openSceneFog(!0===n?void 0:n),i&&this.setControlsOptions(i),s&&(window.console.warn=function(){}),o&&!window.indexedDB&&(this.options.useIndexedDB=!1,window.console.warn("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available."))}_initEvents(e){const{modelHover:t,modelUnHover:n,modelClick:i,modelRightClick:r,modelDblClick:s,poiHover:o,poiUnHover:a,poiClick:l,poiRightClick:c,poiDblClick:h,selectPosition:u,sceneClick:d,resize:f}=e;t&&this.signals.modelHover.add(t),n&&this.signals.modelUnHover.add(n),i&&this.signals.modelClick.add(i),r&&this.signals.modelRightClick.add(r),s&&this.signals.modelDblClick.add(s),o&&this.signals.poiHover.add(o),a&&this.signals.poiUnHover.add(a),l&&this.signals.poiClick.add(l),c&&this.signals.poiRightClick.add(c),h&&this.signals.poiDblClick.add(h),u&&this.signals.selectPosition.add(u),d&&this.signals.sceneClick.add(d),f&&this.signals.windowResize.add(f),this.signals.windowResize.dispatch(),window.addEventListener("resize",(()=>this.signals.windowResize.dispatch()),!1)}_initDefaultSettings(){this.setEnvironment(),this.setColorSpace("sRGB"),this.setToneMapping({type:"ACESFilmic",exposure:.8})}registerPlugin(e,t){const n=new e(this);return this.plugins[t]=n,n}getPlugin(e){return this.plugins[e]?this.plugins[e]:null}createPluginObject(e,t){return this.manager.store.pluginObjectManager.createObject(e,t)}addToPluginObject(e,t){const n=this.getObjectById(e);return this.manager.store.pluginObjectManager.addToObject(n,t)}getPluginObjectById(e){return rn("getPluginObjectById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPluginObjectByName(e){return rn("getPluginObjectByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}removePluginObjectById(e){return rn("removePluginObjectById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}setSSR(e){this.viewport.setSSR(e)}setBloom(e){this.viewport.setBloom(e)}setSSAO(e){this.viewport.setSSAO(e)}setColorSpace(e){this.viewport.setColorSpace(e)}setToneMapping(e){this.viewport.setToneMapping(e)}setHoverEnabled(e){this.viewport.setHoverEnabled(e)}setBackgroundColor(e){this.viewport.setBackgroundColor(e)}setBackgroundColorAlpha(e,t){this.viewport.setBackgroundColorAlpha(e,t)}setBackgroundImage(e){return this.viewport.setBackgroundImage(e)}setSphereSkyBackground(e){return this.viewport.setSphereSkyBackground(e)}setSkyBackground(e,t){return this.viewport.setSkyBackground(e,t)}setEnvironment(){return this.viewport.setEnvironment()}playModelAnimation(e,t){return this.viewport.playModelAnimation(e,t)}stopModelAnimation(e,t){this.viewport.stopModelAnimation(e,t)}getOffsetByPosition(e){return this.viewport.getOffsetByPosition(e)}getPositionByOffset(e,t){return this.viewport.getPositionByOffset(e,t)}render(e){return this.viewport.render(e)}clearSignals(){this.viewport.clearSignals()}dispose(){this.manager.dispose(),this.viewport.dispose()}getCameraViewpoint(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraViewpoint(e){this.viewport.cameraManager.setCameraViewpoint(e)}getCameraTargetView(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraTargetView(e){this.viewport.cameraManager.setCameraViewpoint(e)}flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return"orbit"===this.viewport.controls.options.type&&this.utils.warn("flyTo 方法不适用于 orbit 控制器"),this.viewport.cameraManager.flyTo(e,t,n)}flyToBoundingBox(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.flyToBoundingBox(e,t,n)}flyToObj(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.flyToObj(e,t,n)}flyMainViewpoint(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"frontTop",t=arguments.length>1?arguments[1]:void 0;return this.flyToObj(this.manager.scene,e,t)}surroundOnTarget(e,t){return this.viewport.cameraManager.surroundOnTarget(e,t)}surroundOnObject(e,t){return this.viewport.cameraManager.surroundOnObject(e,t)}getObjectLabelPos(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.getObjectLabelPos(e,t,n)}setControlsOptions(e){return this.viewport.controls.setOptions(e)}addObject(e,t){this.viewport.scener.addObject(e,t)}removeObject(e){this.viewport.scener.removeObject(e)}openSceneFog(e){this.viewport.scener.openSceneFog(e)}closeSceneFog(){this.viewport.scener.closeSceneFog()}setSky(e){return this.viewport.setSky(e)}getScreenshot(){return this.screenshot()}screenshot(){return this.viewport.screenshot()}edgeShow(e,t){return this.viewport.scener.edgeShow(e,t)}unEdgeShow(e){return this.viewport.scener.unEdgeShow(e)}strokeShow(e,t){return this.viewport.scener.strokeShow(e,t)}unStrokeShow(e){return this.viewport.scener.unStrokeShow(e)}opacityShow(e,t){return this.viewport.scener.opacityShow(e,t)}unOpacityShow(e){return this.viewport.scener.unOpacityShow(e)}highlightShow(e,t){return this.viewport.scener.highlightShow(e,t)}unHighlightShow(e){return this.viewport.scener.unHighlightShow(e)}emissiveShow(e,t){return this.viewport.scener.emissiveShow(e,t)}unEmissiveShow(e){return this.viewport.scener.unEmissiveShow(e)}clearObject(){this.manager.clearObject()}clear(){this.manager.clear()}createAmbientLight(e){return this.manager.store.lightManager.createAmbientLight(e)}setAmbientLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setAmbientLight(t,e)}createDirectionalLight(e){return this.manager.store.lightManager.createDirectionalLight(e)}setDirectionalLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setDirectionalLight(t,e)}createHemisphereLight(e){return this.manager.store.lightManager.createHemisphereLight(e)}setHemisphereLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setHemisphereLight(t,e)}createSpotLight(e){return this.manager.store.lightManager.createSpotLight(e)}setSpotLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setSpotLight(t,e)}createPointLight(e){return this.manager.store.lightManager.createPointLight(e)}setPointLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setPointLight(t,e)}createRectAreaLight(e){return this.manager.store.lightManager.createRectAreaLight(e)}setRectAreaLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setRectAreaLight(t,e)}getLightById(e){return rn("getLightById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeLightById(e){return rn("removeLightById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}getAllLight(){return this.manager.store.lightManager.getAll()}clearLight(){return this.manager.store.lightManager.clear()}showAllLight(){return this.manager.store.lightManager.showAll()}hideAllLight(){return this.manager.store.lightManager.hideAll()}updateAllShadow(){return this.manager.store.lightManager.updateAllShadow()}getObjectById(e){return this.manager.getObjectById(e)}getObjectByName(e){return this.manager.getObjectByName(e)}getObjectByUserDataProperty(e,t){return this.manager.getObjectByUserDataProperty(e,t)}removeObjectById(e){return this.manager.removeObjectById(e)}createGroup(e){return this.manager.store.groupManager.createGroup(e)}getGroupById(e){return rn("getGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getGroupByName(e){return rn("getGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllGroup(){return this.manager.store.groupManager.getAll()}showAllGroup(){return this.manager.store.groupManager.showAll()}hideAllGroup(){return this.manager.store.groupManager.hideAll()}removeGroupById(e){return rn("removeGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}loadSbm(e){return rn("loadSbm is deprecated, use loadModel instead"),this.loadModel(e)}parseSbm(){rn("parseSbm is deprecated!")}cloneSbm(e,t,n){return rn("cloneSbm is deprecated, use cloneModel instead"),this.cloneModel(e,t,n)}getSbmById(e){return rn("getSbmById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmByName(e){return rn("getSbmByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getSbmByUserDataProperty(e,t){return rn("getSbmByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeSbmById(e){return rn("removeSbmById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForSbm(e){return rn("createGroupForSbm is deprecated, use createGroup instead"),this.createGroup(e)}loadSbmToGroup(e,t){return rn("loadSbmToGroup is deprecated, use loadModelToGroup instead"),this.loadModelToGroup(e,t)}addSbmForGroup(e,t){return rn("addSbmForGroup is deprecated, use addModelForGroup instead"),this.addModelForGroup(e,t)}createSbmGroupFromXml(){rn("createGroupForSbm is deprecated!")}getSbmGroupById(e){return rn("getSbmGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmGroupByName(e){return rn("getSbmGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllSbmGroup(){return rn("getAllSbmGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeSbmGroupById(e){return rn("removeSbmGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearSbm(){return rn("clearSbm is deprecated, use clearModel instead"),this.clearModel()}getAllSbm(){return rn("getAllSbm is deprecated, use getAllModel instead"),this.getAllModel()}showAllSbm(){return rn("showAllSbm is deprecated, use showAllModel instead"),this.showAllModel()}hideAllSbm(){return rn("hideAllSbm is deprecated, use hideAllModel instead"),this.hideAllModel()}getSbmModelMaps(){return rn("getSbmModelMaps is deprecated, use getModelsMap instead"),this.getModelsMap()}setSbmModelMaps(e){return rn("setSbmModelMaps is deprecated, use setModelsMap instead"),this.setModelsMap(e)}setModelDracoDecoderPath(e){return this.manager.store.modelManager.setDracoDecoderPath(e)}loadModel(e){return this.manager.store.modelManager.load(e)}cloneModel(e,t,n){return this.manager.store.modelManager.clone(e,t,n)}getModelById(e){return rn("getModelById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelByName(e){return rn("getModelByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getModelByUserDataProperty(e,t){return rn("getModelByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeModelById(e){return rn("removeModelById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForModel(e){return rn("createGroupForModel is deprecated, use createGroup instead"),this.createGroup(e)}loadModelToGroup(e,t){return this.manager.store.modelManager.loadToGroup(e,t)}addModelForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.modelManager.addForGroup(n,t)}getModelGroupById(e){return rn("getModelGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelGroupByName(e){return rn("getModelGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllModelGroup(){return rn("getAllModelGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeModelGroupById(e){return rn("removeModelGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearModel(){return this.manager.store.modelManager.clear()}getAllModel(){return this.manager.store.modelManager.getAll()}showAllModel(){return this.manager.store.modelManager.showAll()}hideAllModel(){return this.manager.store.modelManager.hideAll()}computeModelsBoundsTree(e){return this.viewport.bvh.computeModelsBoundsTree(e)}clearIdb(){return this.manager.store.modelManager.clearIdb()}getModelsMap(){return this.manager.store.modelManager.modelsMap}setModelsMap(e){this.manager.store.modelManager.modelsMap=e}createPoi(e){return this.manager.store.poiManager.create(e)}clonePoi(e,t,n){return this.manager.store.poiManager.clone(e,t,n)}getPoiById(e){return rn("getPoiById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiByName(e){return rn("getPoiByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiByUserDataProperty(e,t){return rn("getPoiByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiById(e){return rn("removePoiById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoi(e){return rn("createGroupForPoi is deprecated, use createGroup instead"),this.createGroup(e)}createPoiToGroup(e,t){return this.manager.store.poiManager.createToGroup(e,t)}addPoiForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.poiManager.addForGroup(n,t)}getPoiGroupById(e){return rn("getPoiGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiGroupByName(e){return rn("getPoiGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiGroup(){return rn("getAllPoiGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiGroupById(e){return rn("removePoiGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearPoi(){return this.manager.store.poiManager.clear()}getAllPoi(){return this.manager.store.poiManager.getAll()}showAllPoi(){return this.manager.store.poiManager.showAll()}hideAllPoi(){return this.manager.store.poiManager.hideAll()}createPoiNode(e){return this.manager.store.poiNodeManager.create(e)}getPoiNodeById(e){return rn("getPoiNodeById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeByName(e){return rn("getPoiNodeByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiNodeByUserDataProperty(e,t){return rn("getPoiNodeByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiNodeById(e){return rn("removePoiNodeById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoiNode(e){return rn("createGroupForPoiNode is deprecated, use createGroup instead"),this.createGroup(e)}createPoiNodeToGroup(e,t){return this.manager.store.poiNodeManager.createToGroup(e,t)}addPoiNodeForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.poiNodeManager.addForGroup(n,t)}getPoiNodeGroupById(e){return rn("getPoiNodeGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeGroupByName(e){return rn("getPoiNodeGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiNodeGroup(){return rn("getAllPoiNodeGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiNodeGroupById(e){return rn("removePoiNodeGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearPoiNode(){return this.manager.store.poiNodeManager.clear()}getAllPoiNode(){return this.manager.store.poiNodeManager.getAll()}showAllPoiNode(){return this.manager.store.poiNodeManager.showAll()}hideAllPoiNode(){return this.manager.store.poiNodeManager.hideAll()}createPoiMesh(e){const t=uc(e,this.textureCache);return this.addObject(t),t}createPolygonPoiMesh(e){const t=dc(e,this.textureCache);return this.addObject(t),t}setTexture(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{cache:i=!0,independ:r=!0}=n||{};let s=e.material;if(r&&(s=s.clone(),e.material=s),null===t)return s.map=null,this.render(),null;const o=ac(s,t,i,this.textureCache);return this.render(),o}createCanvas3D(e){return this.manager.store.canvas3DManager.create(e)}getCanvas3DById(e){return rn("getCanvas3DById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DByName(e){return rn("getCanvas3DByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getCanvas3DByUserDataProperty(e,t){return rn("getCanvas3DByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeCanvas3DById(e){return rn("removeCanvas3DById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForCanvas3D(e){return rn("createGroupForCanvas3D is deprecated, use createGroup instead"),this.createGroup(e)}createCanvas3DToGroup(e,t){return this.manager.store.canvas3DManager.createToGroup(e,t)}addCanvas3DForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.canvas3DManager.addForGroup(n,t)}getCanvas3DGroupById(e){return rn("getCanvas3DGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DGroupByName(e){return rn("getCanvas3DGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllCanvas3DGroup(){return rn("getAllCanvas3DGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeCanvas3DGroupById(e){return rn("removeCanvas3DGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearCanvas3D(){return this.manager.store.canvas3DManager.clear()}getAllCanvas3D(){return this.manager.store.canvas3DManager.getAll()}showAllCanvas3D(){return this.manager.store.canvas3DManager.showAll()}hideAllCanvas3D(){return this.manager.store.canvas3DManager.hideAll()}getShortestPath(e,t){return this.manager.store.topologyManager.getShortestPath(e,t)}getShortestPathByMultipleStartPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleStartPoints(e,t)}getShortestPathByMultipleEndPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleEndPoints(e,t)}createTopologyFromGml(e){return this.manager.store.topologyManager.createFromGml(e)}createTopology(e){return this.manager.store.topologyManager.create(e)}resetTopologyNodes(e,t){return this.manager.store.topologyManager.resetNodes(e,t)}getTopologyById(e){return rn("getTopologyById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyByName(e){return rn("getTopologyByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getTopologyByUserDataProperty(e,t){return rn("getTopologyByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeTopologyById(e){return rn("removeTopologyById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForTopology(e){return rn("createGroupForTopology is deprecated, use createGroup instead"),this.createGroup(e)}createTopologyToGroup(e,t){return this.manager.store.topologyManager.createToGroup(e,t)}addTopologyForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.topologyManager.addForGroup(n,t)}getTopologyGroupById(e){return rn("getTopologyGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyGroupByName(e){return rn("getTopologyGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllTopologyGroup(){return rn("getAllTopologyGroup is deprecated, use getAllGroups instead"),this.getAllGroup()}removeTopologyGroupById(e){return rn("removeTopologyGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearTopology(){return this.manager.store.topologyManager.clear()}getAllTopology(){return this.manager.store.topologyManager.getAll()}showAllTopology(){return this.manager.store.topologyManager.showAll()}hideAllTopology(){return this.manager.store.topologyManager.hideAll()}addGridHelper(e){return this.manager.store.helperManager.addGridHelper(e)}addAxesHelper(e){return this.manager.store.helperManager.addAxesHelper(e)}addBoxHelper(e){return this.manager.store.helperManager.addBoxHelper(e)}addPlaneHelper(e){return this.manager.store.helperManager.addPlaneHelper(e)}createGround(e){return rn("In soonspacejs: 'createGround' 已弃用,请使用 'addGroundHelper'!"),this.addGroundHelper(e)}addGroundHelper(e){return this.manager.store.helperManager.addGroundHelper(e)}addDirectionalLightHelper(e){return this.manager.store.helperManager.addDirectionalLightHelper(e)}addHemisphereLightHelper(e){return this.manager.store.helperManager.addHemisphereLightHelper(e)}addSpotLightHelper(e){return this.manager.store.helperManager.addSpotLightHelper(e)}addPointLightHelper(e){return this.manager.store.helperManager.addPointLightHelper(e)}addRectAreaLightHelper(e){return this.manager.store.helperManager.addRectAreaLightHelper(e)}getHelperById(e){return rn("getHelperById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeHelperById(e){return rn("removeHelperById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearHelper(){return this.manager.store.helperManager.clear()}showAllHelper(){return this.manager.store.helperManager.showAll()}hideAllHelper(){return this.manager.store.helperManager.hideAll()}createFindObjectsInBoxNearPosition(e,t){return lc(e,t)}createFindObjectsInSphereNearPosition(e,t){return cc(e,t)}createFindObjectsNearPath(e,t){return hc(e,t)}createPathAnimation(e,t,n){return new Yn(e,t,n)}createTopologyAnimation(e,n,i){const r=n.nodes.map((e=>e.getWorldPosition(new t)));return new Yn(e,r,i)}}fc.THREE=e,fc.TWEEN=Vt,fc.utils=Hn;export{fc as SoonSpace,rc as boundingIsIntersected,lc as createFindObjectsInBoxNearPosition,cc as createFindObjectsInSphereNearPosition,hc as createFindObjectsNearPath,nc as createPlaneMatrix,uc as createPoiMesh,dc as createPolygonPoiMesh,oc as createTexture,ic as createUVMatrix,fc as default,sc as getBoundingBox,tc as getPolygonGeometryInfo,ac as setTexture};
22
+ var Da={};void 0!==Da.asn1&&Da.asn1||(Da.asn1={}),Da.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var i="",r=0;r<n;r++)i+="f";t=new Jo(i,16).xor(e).add(Jo.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=Da.asn1,n=t.DERBoolean,i=t.DERInteger,r=t.DERBitString,s=t.DEROctetString,o=t.DERNull,a=t.DERObjectIdentifier,l=t.DEREnumerated,c=t.DERUTF8String,h=t.DERNumericString,u=t.DERPrintableString,d=t.DERTeletexString,f=t.DERIA5String,p=t.DERUTCTime,g=t.DERGeneralizedTime,m=t.DERSequence,v=t.DERSet,y=t.DERTaggedObject,b=t.ASN1Util.newObject,w=Object.keys(e);if(1!=w.length)throw"key of param shall be only one.";var A=w[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+A+":"))throw"undefined key: "+A;if("bool"==A)return new n(e[A]);if("int"==A)return new i(e[A]);if("bitstr"==A)return new r(e[A]);if("octstr"==A)return new s(e[A]);if("null"==A)return new o(e[A]);if("oid"==A)return new a(e[A]);if("enum"==A)return new l(e[A]);if("utf8str"==A)return new c(e[A]);if("numstr"==A)return new h(e[A]);if("prnstr"==A)return new u(e[A]);if("telstr"==A)return new d(e[A]);if("ia5str"==A)return new f(e[A]);if("utctime"==A)return new p(e[A]);if("gentime"==A)return new g(e[A]);if("seq"==A){for(var x=e[A],S=[],E=0;E<x.length;E++){var T=b(x[E]);S.push(T)}return new m({array:S})}if("set"==A){for(x=e[A],S=[],E=0;E<x.length;E++){T=b(x[E]);S.push(T)}return new v({array:S})}if("tag"==A){var D=e[A];if("[object Array]"===Object.prototype.toString.call(D)&&3==D.length){var C=b(D[2]);return new y({tag:D[0],explicit:D[1],obj:C})}var B={};if(void 0!==D.explicit&&(B.explicit=D.explicit),void 0!==D.tag&&(B.tag=D.tag),void 0===D.obj)throw"obj shall be specified for 'tag'.";return B.obj=b(D.obj),new y(B)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},Da.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),i=(t=Math.floor(n/40)+"."+n%40,""),r=2;r<e.length;r+=2){var s=("00000000"+parseInt(e.substr(r,2),16).toString(2)).slice(-8);if(i+=s.substr(1,7),"0"==s.substr(0,1))t=t+"."+new Jo(i,2).toString(10),i=""}return t},Da.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",i=new Jo(e,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var s="",o=0;o<r;o++)s+="0";i=s+i;for(o=0;o<i.length-1;o+=7){var a=i.substr(o,7);o!=i.length-7&&(a="1"+a),n+=t(parseInt(a,2))}return n};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var i="",r=e.split("."),s=40*parseInt(r[0])+parseInt(r[1]);i+=t(s),r.splice(0,2);for(var o=0;o<r.length;o++)i+=n(r[o]);return i},Da.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var n=t.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},Da.asn1.DERAbstractString=function(e){Da.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},Ta.lang.extend(Da.asn1.DERAbstractString,Da.asn1.ASN1Object),Da.asn1.DERAbstractTime=function(e){Da.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){return utc=e.getTime()+6e4*e.getTimezoneOffset(),new Date(utc)},this.formatDate=function(e,t,n){var i=this.zeroPadding,r=this.localDateToUTC(e),s=String(r.getFullYear());"utc"==t&&(s=s.substr(2,2));var o=s+i(String(r.getMonth()+1),2)+i(String(r.getDate()),2)+i(String(r.getHours()),2)+i(String(r.getMinutes()),2)+i(String(r.getSeconds()),2);if(!0===n){var a=r.getMilliseconds();if(0!=a){var l=i(String(a),3);o=o+"."+(l=l.replace(/[0]+$/,""))}}return o+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,n,i,r,s){var o=new Date(Date.UTC(e,t-1,n,i,r,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},Ta.lang.extend(Da.asn1.DERAbstractTime,Da.asn1.ASN1Object),Da.asn1.DERAbstractStructured=function(e){Da.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},Ta.lang.extend(Da.asn1.DERAbstractStructured,Da.asn1.ASN1Object),Da.asn1.DERBoolean=function(){Da.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},Ta.lang.extend(Da.asn1.DERBoolean,Da.asn1.ASN1Object),Da.asn1.DERInteger=function(e){Da.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Da.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Jo(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},Ta.lang.extend(Da.asn1.DERInteger,Da.asn1.ASN1Object),Da.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=Da.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}Da.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var n=0;n<=t;n++)e+="0";var i="";for(n=0;n<e.length-1;n+=8){var r=e.substr(n,8),s=parseInt(r,2).toString(16);1==s.length&&(s="0"+s),i+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+t+i},this.setByBooleanArray=function(e){for(var t="",n=0;n<e.length;n++)1==e[n]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},Ta.lang.extend(Da.asn1.DERBitString,Da.asn1.ASN1Object),Da.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=Da.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}Da.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},Ta.lang.extend(Da.asn1.DEROctetString,Da.asn1.DERAbstractString),Da.asn1.DERNull=function(){Da.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Ta.lang.extend(Da.asn1.DERNull,Da.asn1.ASN1Object),Da.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",i=new Jo(e,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var s="",o=0;o<r;o++)s+="0";i=s+i;for(o=0;o<i.length-1;o+=7){var a=i.substr(o,7);o!=i.length-7&&(a="1"+a),n+=t(parseInt(a,2))}return n};Da.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var i="",r=e.split("."),s=40*parseInt(r[0])+parseInt(r[1]);i+=t(s),r.splice(0,2);for(var o=0;o<r.length;o++)i+=n(r[o]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.setValueName=function(e){var t=Da.asn1.x509.OID.name2oid(e);if(""===t)throw"DERObjectIdentifier oidName undefined: "+e;this.setValueOidString(t)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):void 0!==e.oid?this.setValueOidString(e.oid):void 0!==e.hex?this.setValueHex(e.hex):void 0!==e.name&&this.setValueName(e.name))},Ta.lang.extend(Da.asn1.DERObjectIdentifier,Da.asn1.ASN1Object),Da.asn1.DEREnumerated=function(e){Da.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=Da.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new Jo(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},Ta.lang.extend(Da.asn1.DEREnumerated,Da.asn1.ASN1Object),Da.asn1.DERUTF8String=function(e){Da.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},Ta.lang.extend(Da.asn1.DERUTF8String,Da.asn1.DERAbstractString),Da.asn1.DERNumericString=function(e){Da.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},Ta.lang.extend(Da.asn1.DERNumericString,Da.asn1.DERAbstractString),Da.asn1.DERPrintableString=function(e){Da.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},Ta.lang.extend(Da.asn1.DERPrintableString,Da.asn1.DERAbstractString),Da.asn1.DERTeletexString=function(e){Da.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},Ta.lang.extend(Da.asn1.DERTeletexString,Da.asn1.DERAbstractString),Da.asn1.DERIA5String=function(e){Da.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},Ta.lang.extend(Da.asn1.DERIA5String,Da.asn1.DERAbstractString),Da.asn1.DERUTCTime=function(e){Da.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},Ta.lang.extend(Da.asn1.DERUTCTime,Da.asn1.DERAbstractTime),Da.asn1.DERGeneralizedTime=function(e){Da.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},Ta.lang.extend(Da.asn1.DERGeneralizedTime,Da.asn1.DERAbstractTime),Da.asn1.DERSequence=function(e){Da.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},Ta.lang.extend(Da.asn1.DERSequence,Da.asn1.DERAbstractStructured),Da.asn1.DERSet=function(e){Da.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},Ta.lang.extend(Da.asn1.DERSet,Da.asn1.DERAbstractStructured),Da.asn1.DERTaggedObject=function(e){Da.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.tag&&(this.hT=e.tag),void 0!==e.explicit&&(this.isExplicit=e.explicit),void 0!==e.obj&&(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},Ta.lang.extend(Da.asn1.DERTaggedObject,Da.asn1.ASN1Object);var Ca,Ba,Ia,Ma=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Oa=function(e){function t(n){var i=e.call(this)||this;return n&&("string"==typeof n?i.parseKey(n):(t.hasPrivateKeyProperty(n)||t.hasPublicKeyProperty(n))&&i.parsePropertiesFrom(n)),i}return Ma(t,e),t.prototype.parseKey=function(e){try{var t=0,n=0,i=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?Uo(e):jo.unarmor(e),r=Xo.decode(i);if(3===r.sub.length&&(r=r.sub[2].sub[0]),9===r.sub.length){t=r.sub[1].getHexStringValue(),this.n=ra(t,16),n=r.sub[2].getHexStringValue(),this.e=parseInt(n,16);var s=r.sub[3].getHexStringValue();this.d=ra(s,16);var o=r.sub[4].getHexStringValue();this.p=ra(o,16);var a=r.sub[5].getHexStringValue();this.q=ra(a,16);var l=r.sub[6].getHexStringValue();this.dmp1=ra(l,16);var c=r.sub[7].getHexStringValue();this.dmq1=ra(c,16);var h=r.sub[8].getHexStringValue();this.coeff=ra(h,16)}else{if(2!==r.sub.length)return!1;if(r.sub[0].sub){var u=r.sub[1].sub[0];t=u.sub[0].getHexStringValue(),this.n=ra(t,16),n=u.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else t=r.sub[0].getHexStringValue(),this.n=ra(t,16),n=r.sub[1].getHexStringValue(),this.e=parseInt(n,16)}return!0}catch(e){return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new Da.asn1.DERInteger({int:0}),new Da.asn1.DERInteger({bigint:this.n}),new Da.asn1.DERInteger({int:this.e}),new Da.asn1.DERInteger({bigint:this.d}),new Da.asn1.DERInteger({bigint:this.p}),new Da.asn1.DERInteger({bigint:this.q}),new Da.asn1.DERInteger({bigint:this.dmp1}),new Da.asn1.DERInteger({bigint:this.dmq1}),new Da.asn1.DERInteger({bigint:this.coeff})]};return new Da.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return Lo(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new Da.asn1.DERSequence({array:[new Da.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new Da.asn1.DERNull]}),t=new Da.asn1.DERSequence({array:[new Da.asn1.DERInteger({bigint:this.n}),new Da.asn1.DERInteger({int:this.e})]}),n=new Da.asn1.DERBitString({hex:"00"+t.getEncodedHex()});return new Da.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return Lo(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(!e)return e;var n="(.{1,"+(t=t||64)+"})( +|$\n?)|(.{1,"+t+"})";return e.match(RegExp(n,"g")).join("\n")},t.prototype.getPrivateKey=function(){var e="-----BEGIN RSA PRIVATE KEY-----\n";return e+=t.wordwrap(this.getPrivateBaseKeyB64())+"\n",e+="-----END RSA PRIVATE KEY-----"},t.prototype.getPublicKey=function(){var e="-----BEGIN PUBLIC KEY-----\n";return e+=t.wordwrap(this.getPublicBaseKeyB64())+"\n",e+="-----END PUBLIC KEY-----"},t.hasPublicKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(Sa),Pa="undefined"!=typeof process?null===(Ca=process.env)||void 0===Ca?void 0:Ca.npm_package_version:void 0,Ra=function(){function e(e){void 0===e&&(e={}),e=e||{},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Oa(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(No(e))}catch(e){return!1}},e.prototype.encrypt=function(e){try{return Lo(this.getKey().encrypt(e))}catch(e){return!1}},e.prototype.sign=function(e,t,n){try{return Lo(this.getKey().sign(e,t,n))}catch(e){return!1}},e.prototype.verify=function(e,t,n){try{return this.getKey().verify(e,No(t),n)}catch(e){return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new Oa,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},e.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},e.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},e.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},e.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},e.version=Pa,e}(),_a={},La={get exports(){return _a},set exports(e){_a=e}},Na={};Ba="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ia={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&Ia.rotl(e,8)|4278255360&Ia.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=Ia.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,i=0;n<e.length;n++,i+=8)t[i>>>5]|=e[n]<<24-i%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var t=[],n=0;n<e.length;n+=3)for(var i=e[n]<<16|e[n+1]<<8|e[n+2],r=0;r<4;r++)8*n+6*r<=8*e.length?t.push(Ba.charAt(i>>>6*(3-r)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,i=0;n<e.length;i=++n%4)0!=i&&t.push((Ba.indexOf(e.charAt(n-1))&Math.pow(2,-2*i+8)-1)<<2*i|Ba.indexOf(e.charAt(n))>>>6-2*i);return t}},{get exports(){return Na},set exports(e){Na=e}}.exports=Ia;var ka={utf8:{stringToBytes:function(e){return ka.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(ka.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}},Ua=ka,ja=function(e){return null!=e&&(za(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&za(e.slice(0,0))}(e)||!!e._isBuffer)};function za(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}!function(){var e=Na,t=Ua.utf8,n=ja,i=Ua.bin,r=function(s,o){s.constructor==String?s=o&&"binary"===o.encoding?i.stringToBytes(s):t.stringToBytes(s):n(s)?s=Array.prototype.slice.call(s,0):Array.isArray(s)||s.constructor===Uint8Array||(s=s.toString());for(var a=e.bytesToWords(s),l=8*s.length,c=1732584193,h=-271733879,u=-1732584194,d=271733878,f=0;f<a.length;f++)a[f]=16711935&(a[f]<<8|a[f]>>>24)|4278255360&(a[f]<<24|a[f]>>>8);a[l>>>5]|=128<<l%32,a[14+(l+64>>>9<<4)]=l;var p=r._ff,g=r._gg,m=r._hh,v=r._ii;for(f=0;f<a.length;f+=16){var y=c,b=h,w=u,A=d;c=p(c,h,u,d,a[f+0],7,-680876936),d=p(d,c,h,u,a[f+1],12,-389564586),u=p(u,d,c,h,a[f+2],17,606105819),h=p(h,u,d,c,a[f+3],22,-1044525330),c=p(c,h,u,d,a[f+4],7,-176418897),d=p(d,c,h,u,a[f+5],12,1200080426),u=p(u,d,c,h,a[f+6],17,-1473231341),h=p(h,u,d,c,a[f+7],22,-45705983),c=p(c,h,u,d,a[f+8],7,1770035416),d=p(d,c,h,u,a[f+9],12,-1958414417),u=p(u,d,c,h,a[f+10],17,-42063),h=p(h,u,d,c,a[f+11],22,-1990404162),c=p(c,h,u,d,a[f+12],7,1804603682),d=p(d,c,h,u,a[f+13],12,-40341101),u=p(u,d,c,h,a[f+14],17,-1502002290),c=g(c,h=p(h,u,d,c,a[f+15],22,1236535329),u,d,a[f+1],5,-165796510),d=g(d,c,h,u,a[f+6],9,-1069501632),u=g(u,d,c,h,a[f+11],14,643717713),h=g(h,u,d,c,a[f+0],20,-373897302),c=g(c,h,u,d,a[f+5],5,-701558691),d=g(d,c,h,u,a[f+10],9,38016083),u=g(u,d,c,h,a[f+15],14,-660478335),h=g(h,u,d,c,a[f+4],20,-405537848),c=g(c,h,u,d,a[f+9],5,568446438),d=g(d,c,h,u,a[f+14],9,-1019803690),u=g(u,d,c,h,a[f+3],14,-187363961),h=g(h,u,d,c,a[f+8],20,1163531501),c=g(c,h,u,d,a[f+13],5,-1444681467),d=g(d,c,h,u,a[f+2],9,-51403784),u=g(u,d,c,h,a[f+7],14,1735328473),c=m(c,h=g(h,u,d,c,a[f+12],20,-1926607734),u,d,a[f+5],4,-378558),d=m(d,c,h,u,a[f+8],11,-2022574463),u=m(u,d,c,h,a[f+11],16,1839030562),h=m(h,u,d,c,a[f+14],23,-35309556),c=m(c,h,u,d,a[f+1],4,-1530992060),d=m(d,c,h,u,a[f+4],11,1272893353),u=m(u,d,c,h,a[f+7],16,-155497632),h=m(h,u,d,c,a[f+10],23,-1094730640),c=m(c,h,u,d,a[f+13],4,681279174),d=m(d,c,h,u,a[f+0],11,-358537222),u=m(u,d,c,h,a[f+3],16,-722521979),h=m(h,u,d,c,a[f+6],23,76029189),c=m(c,h,u,d,a[f+9],4,-640364487),d=m(d,c,h,u,a[f+12],11,-421815835),u=m(u,d,c,h,a[f+15],16,530742520),c=v(c,h=m(h,u,d,c,a[f+2],23,-995338651),u,d,a[f+0],6,-198630844),d=v(d,c,h,u,a[f+7],10,1126891415),u=v(u,d,c,h,a[f+14],15,-1416354905),h=v(h,u,d,c,a[f+5],21,-57434055),c=v(c,h,u,d,a[f+12],6,1700485571),d=v(d,c,h,u,a[f+3],10,-1894986606),u=v(u,d,c,h,a[f+10],15,-1051523),h=v(h,u,d,c,a[f+1],21,-2054922799),c=v(c,h,u,d,a[f+8],6,1873313359),d=v(d,c,h,u,a[f+15],10,-30611744),u=v(u,d,c,h,a[f+6],15,-1560198380),h=v(h,u,d,c,a[f+13],21,1309151649),c=v(c,h,u,d,a[f+4],6,-145523070),d=v(d,c,h,u,a[f+11],10,-1120210379),u=v(u,d,c,h,a[f+2],15,718787259),h=v(h,u,d,c,a[f+9],21,-343485551),c=c+y>>>0,h=h+b>>>0,u=u+w>>>0,d=d+A>>>0}return e.endian([c,h,u,d])};r._ff=function(e,t,n,i,r,s,o){var a=e+(t&n|~t&i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._gg=function(e,t,n,i,r,s,o){var a=e+(t&i|n&~i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._hh=function(e,t,n,i,r,s,o){var a=e+(t^n^i)+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._ii=function(e,t,n,i,r,s,o){var a=e+(n^(t|~i))+(r>>>0)+o;return(a<<s|a>>>32-s)+t},r._blocksize=16,r._digestsize=16,La.exports=function(t,n){if(null==t)throw new Error("Illegal argument "+t);var s=e.wordsToBytes(r(t,n));return n&&n.asBytes?s:n&&n.asString?i.bytesToString(s):e.bytesToHex(s)}}();var Fa,Ha,Ga={serialNums:[],key:"",verified:!0};class Va{constructor(e){this.viewport=e,this.encryptInfo=Ga,Fa.set(this,!0),Ha.set(this,setTimeout((()=>{si(this,Fa,!1,"f"),this.viewport.triggerRender()}),5e3))}verify(e,t){var n;clearTimeout(ri(this,Ha,"f"));const i=new Ra;i.setPublicKey(null===(n=this.encryptInfo)||void 0===n?void 0:n.key);const r=i.verify(e,t,_a);return si(this,Fa,r,"f"),this.viewport.triggerRender(),r}getVerified(){return!!Ga.verified||ri(this,Fa,"f")}}Fa=new WeakMap,Ha=new WeakMap;class Ya{constructor(e,t){this.scene=e,this.signals=t;const n=document.createElement("div");n.style.position="absolute",n.style.left="12px",n.style.bottom="12px",n.style.fontSize="12px",n.style.color="#fff",n.style.pointerEvents="none",this.container=n,this.state={objects:0,vertices:0,triangles:0,frametime:0,lodFrametime:0}}addListeners(){const{scene:e,signals:t}=this;function n(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=document.createElement("span");return t&&(n.style.marginLeft="6px"),n.innerText=e,n}function i(){return document.createElement("br")}const r=n("0"),s=n("0"),o=n("0"),a=n("0"),l=n("0");this.container.appendChild(n("objects",!1)),this.container.appendChild(r),this.container.appendChild(i()),this.container.appendChild(n("triangles",!1)),this.container.appendChild(s),this.container.appendChild(i()),this.container.appendChild(n("vertices",!1)),this.container.appendChild(o),this.container.appendChild(i()),this.container.appendChild(n("frametime",!1)),this.container.appendChild(a),this.container.appendChild(i()),this.container.appendChild(n("lodFrametime",!1)),this.container.appendChild(l);const c=()=>{this.state.objects=0,this.state.vertices=0,this.state.triangles=0;for(let t=0;t<e.children.length;t++){e.children[t].traverseVisible((e=>{var t,n,i,r;if("SceneManager"!==e.stype&&this.state.objects++,e.isMesh){const s=e.geometry;s.isGeometry?(this.state.vertices+=(null===(t=s.vertices)||void 0===t?void 0:t.length)||0,this.state.triangles+=(null===(n=s.faces)||void 0===n?void 0:n.length)||0):s.isBufferGeometry&&(this.state.vertices+=(null===(i=s.attributes.position)||void 0===i?void 0:i.count)||0,null!==s.index?this.state.triangles+=s.index.count/3:this.state.triangles+=(null===(r=s.attributes.position)||void 0===r?void 0:r.count)/3||0)}}))}r.innerText=String(this.state.objects),o.innerText=String(this.state.vertices),s.innerText=String(this.state.triangles)};t.objectAdded.add(c),t.objectRemoved.add(c),t.geometryChanged.add(c);t.sceneRendered.add((e=>{this.state.frametime=e,a.innerText=Number(e).toFixed(2)+" ms"}));t.loadRendered.add((e=>{this.state.lodFrametime=e,l.innerText=Number(e).toFixed(2)+" ms"}))}}const Qa=new e.Vector4;class Wa extends e.Object3D{constructor(t,n){super();const i=new e.Color("#ff3653"),r=new e.Color("#8adb00"),s=new e.Color("#2c8fff"),o=new e.OrthographicCamera(-2,2,2,-2,0,4);o.position.set(0,0,2);const a=new e.BoxGeometry(.8,.05,.05).translate(.4,0,0),l=new e.Mesh(a,y(i)),c=new e.Mesh(a,y(r)),h=new e.Mesh(a,y(s));c.rotation.z=Math.PI/2,h.rotation.y=-Math.PI/2,this.add(l),this.add(h),this.add(c);const u=new e.Sprite(b(i,"X"));u.userData.type="posX";const d=new e.Sprite(b(r,"Y"));d.userData.type="posY";const f=new e.Sprite(b(s,"Z"));f.userData.type="posZ";const p=new e.Sprite(b(i));p.userData.type="negX";const g=new e.Sprite(b(r));g.userData.type="negY";const m=new e.Sprite(b(s));m.userData.type="negZ",u.position.x=1,d.position.y=1,f.position.z=1,p.position.x=-1,p.scale.setScalar(.8),g.position.y=-1,g.scale.setScalar(.8),m.position.z=-1,m.scale.setScalar(.8),this.add(u),this.add(d),this.add(f),this.add(p),this.add(g),this.add(m);const v=new e.Vector3;function y(t){return new e.MeshBasicMaterial({color:t,toneMapped:!1})}function b(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=document.createElement("canvas");i.width=64,i.height=64;const r=i.getContext("2d");if(!r)return;r.beginPath(),r.arc(32,32,16,0,2*Math.PI),r.closePath(),r.fillStyle=t.getStyle(),r.fill(),null!==n&&(r.font="24px Arial",r.textAlign="center",r.fillStyle="#000000",r.fillText(n,32,41));const s=new e.CanvasTexture(i);return new e.SpriteMaterial({map:s,toneMapped:!1})}this.render=function(e){this.quaternion.copy(t.quaternion).invert(),this.updateMatrixWorld(),v.set(0,0,1),v.applyQuaternion(t.quaternion),v.x>=0?(u.material.opacity=1,p.material.opacity=.5):(u.material.opacity=.5,p.material.opacity=1),v.y>=0?(d.material.opacity=1,g.material.opacity=.5):(d.material.opacity=.5,g.material.opacity=1),v.z>=0?(f.material.opacity=1,m.material.opacity=.5):(f.material.opacity=.5,m.material.opacity=1);const i=n.offsetWidth-128;e.clearDepth(),e.getViewport(Qa),e.setViewport(i,0,128,128),e.render(this,o),e.setViewport(Qa.x,Qa.y,Qa.z,Qa.w)}}}const Xa="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAApCAYAAADDJIzmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAASwAAAABAAABLAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAZKADAAQAAAABAAAAKQAAAAAaAV+RAAAACXBIWXMAAC4jAAAuIwF4pT92AAACy2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj4zMDA8L3RpZmY6WVJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjMwMDwvdGlmZjpYUmVzb2x1dGlvbj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjIwMDwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAgICAgICAgIDxleGlmOkNvbG9yU3BhY2U+MTwvZXhpZjpDb2xvclNwYWNlPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+ODI8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4K80N3zgAAElhJREFUeAHtO1lsXNd1d3vbvFnIISmKNm0xXuBWQl24Qly4dQCiTmwYRfrHfLcokPy0AVo0RWt/eAK0dl0Hjuu0H/FP+2391WiDpFbLIq0NFNBPACpwLUuUQ4uSKA5neW/edpeec4dvOENRCuVFFmpdYOa9ueu5Zz/n3qFfeuq1ecYLExESX2kcS8mpbyhyt3xuGKCLv/NX9+LqWhLGREUbmqZ04A823u1lhLT05wbZF3RhYbRDudTxfNKMtmuD0HgmKGqmct/XAkXdlxJXh4NzP/p2DvgxX1Ac3dZtCxIQIgqqz/zXtwpYuQN47y4+8X1fV1SFJroykEV1aflvCxH4g8ZVLzlzxva7rUB+kRYT+zZLCaFm412SQH1CVlb4fPdxP+WywpOkntSS+oNPv5L7eWWwRrZSstqS+8bf/fkJMUDvffblRa8w/fNv/0X3ZnMtL7fEZhEEuS8ruSscmjlGa52xjMUb7/4pEvBu+RQwwOsPf60uNMl3zr8NRvzGZX19VW//4u28c+Hf4/sfezI1GTXUcXyPFOFC+GS6tbV61zu7MfoO3cIO3XOs49qpVo4SNet2u1Y0jo813n39RBj4WASBFcHWELL5iZa+O/ggDHxcglgXeMHOCG7a3fKpYeDjEuRTA+DuRJMYuEuQSXx87r8OiEPuRuSHp4qhJ1a+64z3z6ImPZe01f4YbWXlTX6qzBNCCPFQ0OTluEXov7ob0wkbAu6R5U5Mj9DFJ1719WxIL731rUG5iRs9H3r2dY8leS3muQmVS3PC5frqn0AGghBoq4s8ciLhH3qfVZlS3sz76FlevyY1WfR6I0kSjzlkN++XkJP9S1tnhut5pN32TCP032mfw7BgG+dY9Or1hCQVJolWtOAbQRNjwB58qKDMMQUtwge++jckmE6TgxfGaW5vObHScpMdPzBG+bkqHJ52NHBZNuKyG4Djfdg23fm6R41PBqCQKc9dsvJmH7PYhVbhgHuCZsX1BBn3TcbC3D7hZIqQ/kHLIfEzmThIDMZcI1nOqz3SLWYedo8989ezaSYZCetAKcMqbnUUeMtByoXjG+ZQYwpHy7xWEtughLSVx0NNVC2LghqmRkSskwUnSUoxOgiYz6KuzAaouvK729o1mlLKDAA+3PBh1lxbe6FYmntF5W7uWA40QixubLgbxKRM/p32CM+1lzKthXXdcU7GpGE5oACKUTlVjmGIYK1zyiHPt0bWDgp6qVFZwyhIzjpUq8IwX7D8vf/+TjT/9CtzgglAOh2OKwZkkPfdR37v5ZoqAlpEfaHhyENrQiknRgeXA2hzsE3spj0SAnrtkV4QyJAEfV5MRSRo3LP8vZTUaoNLPkTxp06NA4WbuZ7LcEe3WnbzZUIF/gcs9gArjGa+AUzAB9eYUNGHmJ0amb3azQsjqFM1zWpEqzuh3IAc3YXTrS1CXjBHv/LSrHAct0Rk4fP80o87bTxuePTpV8JtbqYZcCgim/LE7Nu7haH57Ou1lCSuoEIh4RBOyj0rBUBKQUAdQQLEEh0oZkBYvaggPqYIgXITxxo68SqRV1AR9dWe9QCj8t5QNPsnToC6WBCBljrIs2hmMf51TZ55IhFZb7C++gKkWKglxuYleKuNyfch0DXsYujS8j95Orwc0J72JdecyhznNMJzlSpigP9WCWFnpqBGXFBbqkGIIsdL2EDp2ILnOy0auK8xeyRHQmBPQMSOBmYbnv2ASuMkgXHecESmvHFGtJUnT/7QuSo7VfihCUAK6GdOQSM4psgwIevsmLigNBzOsPeNqhKJs1czfEPmMwmh0m3kewQZ67W2BgZsjYBeM72l5e96WnqB4UWQu7Xw2DOvSZp9P5np/zwuZkK6nU8Qe2yW619R5+pi4Bvzol+YQJiYgQljsB8gAonhxWEmiw3wpYQ08sgLuX6mg2sAUeJKtjXL5uuEVKAPmFAlDOtMbaMzYA0q2BOme+8zqvcQExhQbrsl1dLaVfyJxHKJO2or+2zW+g02UlUxc2m1uLDaQaNMUJqClRNJvl2vIqKxClWiiio783kou0eyAGxLrZROT6jCbxzrZNFlupicGJMQHAkFjal/fsEMzz2oWV8lKVTDp9W95+vEl4PZgILCvVx7sMpAC6JTALZnpI/tJPu/Wi320Gl3BgCxdoE5oEIBJahDkbt0khPf9UC+4zRN6gWfEjoTHgdDXrL2/hkP/H3Fje2BW+ZRpbMcQANDmxUUctR41oOFPhRdFino+6E6hIqqY/o03JUCQyX7AUd9UxavyEsJsWoamQr24SGyhzbAAcOc03uWq02Pv8aN6nS7G3VqQAVxx7W2BSgsL0JGfAMmnVtueS5BfEkguKDFQBcf/OQb1qifQwDLhe0TEHfs3cY86kStVWYqeXLJX9tvPwjamzlC/EbgBoU24uK1i9fImTfKTU9MiT9QBYLnM4dcYecuQNDBq3ESCjt3UpkZwH/PiKDpgqGE8xft0o6zLUVaBW/Exc2jkX28fu/Vm3pZ4Ovfv/lBXbtepeRO4zl0noY7WzttD+ysVURotMeBRMPNXdxyDgQRI8nUAKfpJ+1LZ1ooYZYgYLBDwfU0Ogzjc1i1BZK9/q9/fvmR3365FtVJQ2jX2hecX8tqxkRmuCvdTGboCYADWVBPeIXKRS49wxobvWhSZa0dh0Xfh3UEWAnfJ30eLPW/LPWTv4GTJSP7AfYGrGOEHwJEJK03JoAbBxTffX/BdHQHNkuA+1wFx8QDLUKQuk0dkjmxPdWtkky4BUnAqYKNggpv1hQbwBPF85CFomtbW24VHQ0CANxpjS2g8koSg23iXg5mnEmqKZl0e2VVcOAMTgYBYH2vDaU/OBKUEmLBmM1jGlcqkgD7jRMWz4eI7tl4J5kC8oAZ1M7QqGM/HfStGILEjuwIEiWT8AXGgACHZvc30XhOFuyENZYrwd1E31oJFkpWn/nSUy8egXilgWoNu9iRraExtO83+QoJT/Mk6TiMtwsQAzrYDpQTNDtBNCUylAKAeozrHC82jLvXGcCbLGH79qVnvYGh5wNYBqn0QQUWXBbEM4nQcgLBNn5Qaa6pzlCfj8+POMAoerfOzr+22orWwyXgxWGx7jGoXRZk4PC0LP/I2OFIzLIPPnFd/JT4LdsQPpQkJ0nlY9WjwLP7CorReJVFFBAGgQNfQGSS1rrbYg506SyKJgGPY7z/Qe9nvr6pon40CABZ4IM3Ra6nieI2FEMilOplfGyRRRNwjLfd7F2KPWTgXtCzOfeb7eKj089tX3rrz64hYdCdRUTiM2NcXv7Rc9ewLdmOI1RTwzbwvrQHKY0XSoKMlkW1WIBDiP3QI0SEflh5cGjUiaEeR7U3gImGa9SLpHfxx8WVav3hbTTwo4ngBRn0IqjiL88tbaE6nlRZ4z0PeEfilLGBNdAO8e6rdGr6qb8HyUvSyXtdhloPLfQCtso92RBcgaFjkmn0FA+Y/tOoAmRkwDpl2F0hHNQ4qNXRej53eLZrs63LC/EGLGyRVLs34NEuWtFNS9wBjBu6+CVwkMYJtEsqcJdtqBKhn6qbzug+28op8OLAfQQvbiilDsmCJkjetzU52yJqXliHApkFCXnu3/4YDDo1p3YXuCWClEDhE7m61NPU5D5wfXCs95Eyv/tSKjKq0bXNVQCyBbsF2FA3gwmf4I7x+T6V95FLO7QDiPBUgUddFrB3ahU8LAfbUevCtxp5USRpg+4Xe0pDaH9vrO3dYk4F3ECD23Agqi+oQz1ptjoGCdXo9RS6rxNeHOBJ5ckUOANmgIEmyywOkLmN49Cjz/5gNshfYxTuw+Ep7N7qdsFb+yr1NBIH0xv4G6NO8CFqqN5symPMLtza7JO96SHsyYmzZzmmMMZHeiCT5e+Tby3w0hCXsFdBZZXtpbrDNtwT6GcXb3YuLf8jRNiYnGwCKY3gTmhzV/iULIM5g6aumdnuYr2adiRDz66cE5+5Eg54Zi44yhMCgOoObvN4GU0h1kvtmIkO45N83HfciJUE/ktNyy0toYqIbW1tTWx0/wTdep2jVJQxBrYHMh1x+XZtE+KEukW21e+QJ2s3RuoTInjDMoke7hB26x0VGfDVRbtUX2WCo1sMAobr2Er4sgac5TSs0KJTgwugUIfzI2HxKfigYArsjS8ZuA0jhrEG3TClckil1TAQR//2Di2OVzVXE9iQ6zHIoZtAqWz1p2hgWzeEuOH1eAcDnLHSzeojguS1BVaRHQo2BOK2mCWgNo6cn4I8FxRQd3ClBvBRgca9+IyRQi8VRK5Dl8Wleh5d7uy0e54hc7u5FRwLPheszRZ6JCmEH2Z8SCsbx4CLf/H085AnI+Tep16cQWcG00Myy3mdFJ211efhWvUwxsE+dyxBiiykosIRmbEfBPHwOutzN7VBifC5Ze5dJUQhYyW8IwaQzVdgorPkrNw5v9BmbmyiHGIet2JqtU2zAvmn8+d3WASR1/bMmOcLyRbqJAay3paoZ96wtzbHOiAKhwX94HPwgYQsJIMgmkIhA95wy0gf7Jf/DjgUhg9tCGQIduBqqB3dalFwPIb1tqL8AsCP9d4/Mp6aLptu5xM562htqn3mEAdSY3BRODqYK6Pgsn7PzayQYXJvaPDLdtDqIxUyHgdhOxrtgrvWZcbfi8+8Csd81MPgEn+PF/wHwX153P65Gzad3Ugc23F9GzTCe2m/ynEYweM7qvkLXym20Bu8YyWkBBrhhc9NJQP7Qo4ohMQ2JMAcmzbHOixqZGBhCge3e+MtS1aM0iboBencZyQ3pdGnaOQLSLPSAJKgGONAH1zDurARBJwwGlPvpgJqbzBUe3b90pyieRormLnAnJeTOJK0nrfEuQ46uwj8KWFs3OfyOnbn65cSAwCkLnc9n+gsFsoQMTIbQJGPCT54y4EyzC3E7o3OFkgLBJWJK00NcAe2HbM8WAKVMMUbeb9foe5MT8YqNWX6fmL9MbOD45hwTZAxBplua9CxbhLxd4DKQhGX4MzMuGznZz/5ToxAHrIcSpIOOdfn1m2kPy0Ep1Y0kyGYEMhyQhCDdei23S7oUPSRGLheL5+9Vd6+bXB+lvjYp7LgmLP55rUTW1tBprpBBgoZk4u02MtQfhbAYCBlItClcBgEiaEkmH4ALlsMzwgOu96J5X+ors3NJY92L/qqERe8Gzpw+id5L7EheawdiRnkSGOObx7U0EUC6X5LRJm0KWayH/jqy/X52M23IBlZgZgDJfTkN3/odH+xGfBeYHAOPduj0z6ROykRFdlU2A/XGfWH3N7O9E6F9VM4xK8XwpuGY4W+C2vkuB7CoySchzRJhmOyWDMBnhwmLXGv+wgCNZDgWsO0Onwwqwv3jHxFZVAoBw5/wJCBK1kaM5zgVksZMKEnhW4h5nOMSRNGjkJ6//dHx8O3Om/Xy9yl4iMBN1S4jJpSKOZzP86Nwz28EiQ504g4SrJwffUPur/25EvTOx2ZumHu1t1QPvr09yqDpOJueooCUnQvH+ZQ0v/d9EjQ9OKqVD4TNM3rYNsvxPV8IeCqDSe8dSQ47wwkSnac1jY9mXosa4R5kFOwGh3CEiVm+peSbtAMAB5X+JHhSa5zsHuqXi0UHDuU+51UWWXt7hOvBIH/37tw+vmrQve2gYMji0BQZ6VK2zfkpj9xDEqc7cTDRCq2c7H+ztUP/+UvdwBJkLqeTOTddLJ9jU1I6bMoq+MdKkxfpAr2iUe4EH3j/awrwO3IkRUntHFE4dWYP9VzWKbddp/D/Sg4TJ8O04InPO/HXIcpXV7+DwFGTMCxrsL7WV7CtcFn9VccDXPu1BZ0DHk7uHsF3pxhJ09+08H+DO59BRXh4GmjnQ/uhhFykoCUYMDO8E7R2tzxhKs8gztkbqr3BOOmBBnbMxzltlK8cLa+OriKV4cg8EkstwOnl8Q5yN6gXRjapIL6nsjx3tKDRXL1o9N/tI1IOuhGx9i6h379WeN/AG/pVWSijcXFfJ10owXn8eSD34qvOVuYwzX0EfiX8Uz8q/aOVdhxemkHsujVam/jmV7mXwv77/3zH/aPdtZ7c8mFSLevpuvkP4GzF2K83JGqPF5b3hpMAcG7JFPOXNS75E9nuM5j9x+P8Y+y27V7OPYnpJuSzlT63teSGPvjiSghZwi2ITxHH5yxOWXoKHMyE23Uj4/ubI1E5dA7H+8IXtnc1tmgodwgg7y2PUuw+V3YPvr/4Hc7NJHgsKd30iW88S3cae+fjCBju8GrMd0jm4FMKhVrpEWashiPfVvox/+/8IDGtvuZvf4f1azOqNpo8RwAAAAASUVORK5CYII=",Za=100,Ka=41,qa=new q,Ja=new Ae;class $a extends v{get size(){var e;return null!==(e=this._size)&&void 0!==e?e:this.size=new w(100,100)}set size(e){this._size=e;const{x:t,y:n}=e,{camera:i,currViewport:r}=this;r.set(t*Math.random(),n*Math.random(),t,n),i.left=i.right=t/2,i.left=-i.left,i.top=i.bottom=n/2,i.bottom=-i.bottom,i.updateProjectionMatrix()}get velocity(){var e;return null!==(e=this._velocity)&&void 0!==e?e:this._velocity=this.direction.clone().multiplyScalar(this.speed)}set velocity(e){this._velocity=e}constructor(e){super(),this.viewport=e,this.fontSize=50,this.imageWidth=200,this.camera=new b(-1.6,1.6,.8,-.8,0,4),this.direction=(new w).random().normalize(),this.speed=2,this.currViewport=new q,this.lastRenderTime=0,this.autoRender=e=>{e-this.lastRenderTime>30&&this.render(),requestAnimationFrame(this.autoRender)},this.camera.position.z=2,this._generateMarkForImage()}_generateMark(){}_generateMarkForString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[28145,22323,36805,32500,25968,23383,23402,29983,25216,26415,26377,38480,20844,21496];const t=Array.isArray(e)?String.fromCodePoint(...e):e,n=t.length,{fontSize:i}=this,r=i/4,s=2*r,{x:o,y:a}=this.size=new w(i*n+s,i+s),l=document.createElement("canvas");l.width=o,l.height=a;const c=l.getContext("2d");if(!c)return;const h=c.createLinearGradient(0,0,o,a);h.addColorStop(0,"#ff3653"),h.addColorStop(.5,"#8adb00"),h.addColorStop(1,"#2c8fff"),c.fillStyle=h,c.font=`bold ${i}px/1 serif`,c.fillText(t,r,a-1.5*r);const d=Ja.load(l.toDataURL()),f=new xe({map:d,toneMapped:!1,transparent:!0}),p=new u(new Se(o,a),f);this.add(p)}_generateMarkForImage(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xa,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Za,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ka;const i=this.imageWidth,r=i*(n/t);this.size=new w(i,r);const s=Ja.load(e),o=new xe({map:s,toneMapped:!1,transparent:!0}),a=new u(new Se(i,r),o);this.add(a)}render(){const{renderer:e}=this.viewport;e.getViewport(qa);const{width:t,height:n}=e.domElement,i=new w(t,n),{position:r,velocity:s}=function(e,t,n,i){i=null!=i?i:n.length();let{x:r,y:s}=e,{x:o,y:a}=n;r+=o,s+=a,(r+e.width>=t.x&&o>0||r<=0&&o<0)&&(o=-o*Math.random());(s+e.height>=t.y&&a>0||s<=0&&a<0)&&(a=-a*Math.random());const l=new w(o,a);l.normalize().multiplyScalar(i);const c=new w(e.x,e.y).add(l);return{position:c,velocity:l}}(this.currViewport,i,this.velocity,this.speed),o=this.currViewport;o.x=r.x,o.y=r.y,this.velocity=s,e.clearDepth(),e.setViewport(o.x,o.y,o.z,o.w),e.render(this,this.camera),e.setViewport(qa.x,qa.y,qa.z,qa.w)}}J.prototype.computeBoundsTree=dt,J.prototype.disposeBoundsTree=ft,u.prototype.raycast=pt,Ee.prototype.firstHitOnly=!0;const el={needsUpdate:!1};let tl=0,nl=0;const il=e=>{e instanceof l&&e.dispose()};class rl{constructor(e){this.clock=new Te,this.raycaster=new Ee,this.sky=null,this.options=e,this.state={useFreq:1,isPausedRender:!1,isDisposed:!1},this.signals={windowResize:new Xi,cameraObjectChange:new Xi,sceneChanged:new Xi,backgroundChanged:new Xi,beforeRender:new Xi,sceneRendered:new Xi,loadRendered:new Xi,tweenUpdate:new Xi,hover:new Xi,click:new Xi,dblClick:new Xi,rightClick:new Xi,mouseDown:new Xi,mouseMove:new Xi,mouseUp:new Xi,mouseWheel:new Xi,keyDown:new Xi,keyUp:new Xi,modelHover:new Xi,modelUnHover:new Xi,modelClick:new Xi,modelDblClick:new Xi,modelRightClick:new Xi,poiHover:new Xi,poiUnHover:new Xi,poiClick:new Xi,poiDblClick:new Xi,poiRightClick:new Xi,selectPosition:new Xi,sceneClick:new Xi,objectAdded:new Xi,objectRemoved:new Xi,objectChanged:new Xi,geometryChanged:new Xi,materialAdded:new Xi,materialChanged:new Xi,materialRemoved:new Xi,cameraChange:new Xi,outlineChange:new Xi,modelAnimation:new Xi,getSceneInfo:new Xi},this.scener=new Ji(this.signals,this.state),this.scene=this.scener.scene,this.cameraManager=new Br(this),this.camera=this.cameraManager.currentCamera,this.rendererManager=new pr(this),this.container=this.rendererManager.container,this.interactiveContainer=this.rendererManager.interactiveContainer,this.renderer=this.rendererManager.renderer,this.rendererCSS3D=this.rendererManager.rendererCSS3D,this.rendererCSS2D=this.rendererManager.rendererCSS2D,this.pmremGenerator=new ae(this.renderer),this.pmremGenerator.compileEquirectangularShader(),this.effectManager=new lo(this.renderer,this.scene,this.camera),this.effectComposer=this.effectManager.effectComposer,this.bvh=new ho(this),this.controls=new So(this),this.info=new Ya(this.scene,this.signals),this.stats=vt(),this.mixer=new De(this.scene),this.clipsSet=new Set,this.postUpdate=new Map,this.postRender=new Map,this.selectModel=null,this.selectPoi=null,this._loop=0,this.viewHelper=new Wa(this.camera,this.container),this.license=new Va(this),this.waterMark=new $a(this),this._initInfo(),this._initStats(),this._signalsEventListenr(),this._containerAddEventListener(this.container),this.animate(0)}_initInfo(){if(this.options.showInfo){this.info.addListeners();const{container:e}=this.info;e.style.zIndex="1",this.container.appendChild(e)}}_initStats(){if(this.options.showStats){const{dom:e}=this.stats;e.style.zIndex="1",this.container.appendChild(e),this.signals.sceneRendered.add((()=>{this.stats.update()}))}}setSSR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:t=!0,intensity:n=1,exponent:i=1.75,distance:r=20,fade:s=0,roughnessFade:o=1,thickness:a=3.5,ior:l=1.75,maxRoughness:c=.1,maxDepthDifference:h=20,blend:u=.95,correction:d=1,correctionRadius:f=1,blur:p=1,blurKernel:g=1,blurSharpness:m=10,jitter:v=0,jitterRoughness:y=2,steps:b=20,refineSteps:w=10,missedRays:A=!1,useNormalMap:x=!0,useRoughnessMap:S=!0,resolutionScale:E=1,velocityResolutionScale:T=1}=e,{effectManager:D}=this;D.effectsNeedsUpddate=!0;const C=D.effectsMap.get(lo.CONSTANTS.ssrEffect);C.enabled=t;const{effect:B}=C;B.usingBoxProjectedEnvMap=!0,B.intensity=n,B.exponent=i,B.distance=r,B.fade=s,B.roughnessFade=o,B.thickness=a,B.ior=l,B.maxRoughness=c,B.maxDepthDifference=h,B.blend=u,B.correction=d,B.correctionRadius=f,B.blur=p,B.blurKernel=g,B.blurSharpness=m,B.jitter=v,B.jitterRoughness=y,B.steps=b,B.refineSteps=w,B.missedRays=A,B.useNormalMap=x,B.useRoughnessMap=S,B.resolutionScale=E,B.velocityResolutionScale=T,this.triggerRender()}setBloom(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const{enabled:n=!0,mipmapBlur:i=!0,radius:r=.85,intensity:s=3,threshold:o=1,smoothing:a=0,scalar:l=2,opacity:c=1,selection:h=[]}=e,{effectManager:d}=this;d.effectsNeedsUpddate=!0;const f=d.effectsMap.get(lo.CONSTANTS.bloomEffect);f.enabled=n;const{effect:p}=f;p.intensity=s;const{mipmapBlurPass:g,renderTarget:m}=p;g.enabled=i,g.radius=r;const v=p.uniforms.get("map");v&&(v.value=i?g.texture:m.texture),p.luminanceMaterial.threshold=o,p.luminanceMaterial.smoothing=a,p.blendMode.opacity.value=c,null===(t=p.luminanceMaterial.userData.bloomSelection)||void 0===t||t.forEach((e=>{e instanceof u&&e.material.color&&(e.material.toneMapped=!0,e.material.color.multiplyScalar(1/l))})),p.luminanceMaterial.userData.bloomSelection=[],n&&h.forEach((e=>{e.traverse((e=>{e instanceof u&&e.material.color&&(e.material.toneMapped=!1,e.material.color.multiplyScalar(l),p.luminanceMaterial.userData.bloomSelection.push(e))}))})),this.triggerRender()}setSSAO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:t=!0,depthAwareUpsampling:n=!0,samples:i=32,rings:r=7,distanceThreshold:s=.02,distanceFalloff:o=.0025,rangeThreshold:l=3e-4,rangeFalloff:c=1e-4,luminanceInfluence:h=.7,minRadiusScale:u=.33,radius:d=.1,intensity:f=3,bias:p=.004,fade:g=.01,color:m=null,resolutionScale:v=1}=e,{effectManager:y}=this;y.effectsNeedsUpddate=!0;const b=y.passesMap.get(lo.CONSTANTS.normalPass),w=y.effectsMap.get(lo.CONSTANTS.ssaoEffect);b.enabled=t,w.enabled=t;const{effect:A}=w,{ssaoMaterial:x}=A;A.depthAwareUpsampling=n,A.luminanceInfluence=h,A.resolution.scale=v,A.intensity=f,x.samples=i,x.rings=r,x.distanceThreshold=s,x.distanceFalloff=o,x.proximityThreshold=l,x.proximityFalloff=c,x.minRadiusScale=u,x.fade=g,x.bias=p,x.radius=d,m&&(A.color=new a(m)),this.triggerRender()}setColorSpace(e){this.renderer.outputEncoding="sRGB"===e?T:_,this.signals.sceneChanged.dispatch()}setToneMapping(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:t="ACESFilmic",exposure:n=.8}=e,i={None:Me,Linear:Oe,Reinhard:Pe,Cineon:Re,ACESFilmic:Be};this.renderer.toneMapping=i[t],this.renderer.toneMappingExposure=n,this.signals.sceneChanged.dispatch()}async setSphereSkyBackground(e){const t=Fn(e);if("hdr"===t||"pic"===t){const t=await(new mt).loadAsync(e);t.mapping=Ce,il(this.scene.background),this.scene.background=t}else{const t=await(new Ae).loadAsync(e);t.mapping=Ce,il(this.scene.background),this.scene.background=t}this.signals.backgroundChanged.dispatch()}async setSkyBackground(e,t){const n=await gn(e,t);il(this.scene.background),this.scene.background=n,this.signals.backgroundChanged.dispatch()}setBackgroundColor(e){il(this.scene.background),this.scene.background=new a(e),this.signals.backgroundChanged.dispatch()}setBackgroundColorAlpha(e,t){il(this.scene.background),this.scene.background=null,this.renderer.setClearColor(new a(e),t),this.signals.backgroundChanged.dispatch()}async setBackgroundImage(e){const t=new Ae,n=await t.loadAsync(e);this.scene.background=n,this.signals.backgroundChanged.dispatch()}setSky(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{enabled:n=!0,position:i={x:0,y:0,z:0},scalar:r=45e4,turbidity:s=10,rayleigh:o=3,elevation:a=2,azimuth:l=180,exposure:c=.6}=e;if(!n)return void this.closeSky();this.sky||(this.sky=new yt,this.scene.add(this.sky)),this.sky.name="sky",this.sky.position.set(i.x,i.y,i.z),this.sky.scale.setScalar(r);const h=this.sky.material.uniforms;h.turbidity.value=s,h.rayleigh.value=o,h.mieCoefficient.value=.005,h.mieDirectionalG.value=.7;const u=new t,d=hn(90-a),f=hn(l);return u.setFromSphericalCoords(1,d,f),h.sunPosition.value.copy(u),this.sky.userData.toneMapping=this.renderer.toneMapping,this.sky.userData.toneMappingExposure=this.renderer.toneMappingExposure,this.renderer.toneMapping=Be,this.renderer.toneMappingExposure=c,this.signals.objectAdded.dispatch(),this.sky}closeSky(){if(!this.sky)return!1;const{toneMapping:e,toneMappingExposure:t}=this.sky.userData;return this.renderer.toneMapping=e,this.renderer.toneMappingExposure=t,this.sky.removeFromParent(),this.sky=null,this.signals.objectRemoved.dispatch(),!0}screenshot(){return new Promise((e=>{this.renderer.domElement.toBlob((t=>{e(t)}))}))}setEnvironment(){return this.scene.environment=this.pmremGenerator.fromScene(new gt,.04).texture,this.signals.sceneChanged.dispatch(),this.scene.environment}playModelAnimation(e,t){let n;if(t instanceof Ie?n=t:_n(t)?n=e.animations[t]:kn(t)&&(n=e.animations.find(t)),!n)return;const i=this.mixer.clipAction(n,e);return i.play(),this.clipsSet.add(n),i}stopModelAnimation(e,t){var n;let i;t instanceof Ie?i=t:_n(t)?i=e.animations[t]:kn(t)&&(i=e.animations.find(t)),i&&(null===(n=this.mixer.existingAction(i))||void 0===n||n.stop(),this.mixer.uncacheAction(i,e),this.clipsSet.delete(i))}async render(e){return await(null==e?void 0:e()),new Promise((e=>{this.signals.sceneRendered.addOnce(e),this.triggerRender()}))}triggerRender(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.state.useFreq=e}async setPauseRender(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.state.isPausedRender=e,!1===e)return this.render()}_passesObserver(){this.effectManager.updateEffectPass()}autoRender(e){if(this.state.useFreq<=0&&!el.needsUpdate)return;if(this.state.useFreq>0&&this.state.useFreq--,el.needsUpdate&&(el.needsUpdate=!1),this.state.isPausedRender)return;tl=performance.now(),this.signals.beforeRender.dispatch(),this._passesObserver(),this.effectComposer.render();const t=this.scene.matrixWorldAutoUpdate;this.scene.matrixWorldAutoUpdate=!1,this.rendererCSS2D&&this.rendererManager.internalOptions.enableRenderCss2D&&this.rendererCSS2D.render(this.scene,this.camera),this.rendererCSS3D&&this.rendererManager.internalOptions.enableRenderCss3D&&this.rendererCSS3D.render(this.scene,this.camera),this.scene.matrixWorldAutoUpdate=t,this.options.showViewHelper&&this.camera===this.cameraManager.mainCamera&&this.viewHelper.render(this.renderer),this.license.getVerified()||this.waterMark.render(),this.postRender.forEach((t=>t(e))),nl=performance.now(),this.signals.sceneRendered.dispatch(nl-tl)}animate(e){this._loop=requestAnimationFrame((e=>{this.animate(e)}));const t=this.clock.getDelta();this.clipsSet.size>0&&(this.mixer.update(t),this.signals.modelAnimation.dispatch()),Vt.update()&&this.signals.tweenUpdate.dispatch(),this.postUpdate.forEach((t=>t(e))),this.autoRender(e),this.signals.getSceneInfo.dispatch(this.info.state)}getOffsetByPosition(e){const n=new t(e.x,e.y,e.z).project(this.camera),i=this.renderer.domElement.getBoundingClientRect();return{left:Math.round(i.left+i.width/2*(n.x+1)),top:Math.round(i.top+i.height/2*(1-n.y))}}getPositionByOffset(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1;const i=new t(0,0,0),r=new t(0,0,0),s=this.renderer.domElement.getBoundingClientRect();r.set(e.offsetX/s.width*2-1,-e.offsetY/s.height*2+1,n),r.unproject(this.camera),r.sub(this.camera.position).normalize();const o=r.distanceTo(this.camera.position);return i.copy(this.camera.position).add(r.multiplyScalar(o)),i}getIntersects(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scener.intersectsList.getAll(),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{isFilterHideObject:i=!0}=n,r=this.container.getBoundingClientRect();let s={offsetX:0,offsetY:0};if(e instanceof MouseEvent)s={offsetX:e.clientX-r.left,offsetY:e.clientY-r.top};else if(e instanceof TouchEvent){const t=e.changedTouches[0];s={offsetX:t.clientX-r.left,offsetY:t.clientY-r.top}}else s=e;const o=new w;o.set(s.offsetX/r.width*2-1,-s.offsetY/r.height*2+1),this.raycaster.setFromCamera(o,this.camera);let a=[];return a=Ln(t)?this.raycaster.intersectObjects(t,!0):this.raycaster.intersectObject(t,!0),i?a.filter((e=>{let{object:t}=e;return fn(t)})):a}rayClash(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.camera.position,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new t(0,-1,0),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.scener.intersectsList.meshOfModelList;const r=new Ee;return r.set(e,n),Ln(i)?r.intersectObjects(i,!0):r.intersectObject(i,!0)}setHoverEnabled(e){this.options.hoverEnabled=e}clearSignals(){for(const e in this.signals)this.signals[e].removeAll()}dispose(){cancelAnimationFrame(this._loop),this.bvh.dispose(),this.mixer.stopAllAction(),this.clipsSet.forEach((e=>{this.mixer.uncacheAction(e),this.mixer.uncacheClip(e)})),this.mixer.uncacheRoot(this.scene),this.clipsSet.clear(),this.controls.dispose(),Vt.removeAll(),this.clearSignals(),this.scene.clear(),this.pmremGenerator.dispose(),this.effectComposer.dispose(),this.renderer.dispose(),this.renderer.forceContextLoss(),this.container.remove(),this.state.isDisposed=!0}_signalsEventListenr(){const e=()=>{const{offsetWidth:e,offsetHeight:t}=this.container;this.effectManager.updateCamera(this.camera),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t),this.effectComposer.setSize(e,t),this.rendererCSS3D&&this.rendererCSS3D.setSize(e,t),this.rendererCSS2D&&this.rendererCSS2D.setSize(e,t),this.triggerRender()};setTimeout((()=>e())),this.signals.windowResize.add(e),this.signals.cameraObjectChange.add(e),this.signals.sceneChanged.add((()=>this.triggerRender())),this.signals.backgroundChanged.add((()=>this.triggerRender())),this.signals.objectAdded.add((()=>this.triggerRender())),this.signals.objectRemoved.add((()=>this.triggerRender())),this.signals.objectChanged.add((()=>this.triggerRender())),this.signals.materialAdded.add((()=>this.triggerRender())),this.signals.materialRemoved.add((()=>this.triggerRender())),this.signals.materialChanged.add((()=>this.triggerRender())),this.signals.geometryChanged.add((()=>this.triggerRender())),this.signals.cameraChange.add((()=>this.triggerRender())),this.signals.tweenUpdate.add((()=>this.triggerRender())),this.signals.modelAnimation.add((()=>this.triggerRender()));this.signals.outlineChange.add((e=>{const{objects:t,options:n}=e,{color:i,hideColor:r,edgeThickness:s,edgeStrength:o}=Object.assign(Object.assign({},{color:16777215,hideColor:10066329,edgeThickness:3,edgeStrength:10}),n),{effectManager:a}=this;a.effectsNeedsUpddate=!0;const l=a.effectsMap.get(lo.CONSTANTS.outlineEffect),c=t.length>0;l.enabled=c;const{effect:h}=l,{uniforms:d}=h,f=[];t.forEach((e=>{e.traverse((e=>{e instanceof u&&f.push(e)}))})),h.selection.set(f),h.blur=s>0,h.blurPass.kernelSize=s;const p=d.get("visibleEdgeColor"),g=d.get("hiddenEdgeColor"),m=d.get("edgeStrength");p&&p.value.set(i),g&&g.value.set(r),m&&(m.value=o),this.triggerRender()}))}_containerAddEventListener(e){const t=[0,0];let n=null;const i=r=>{var s,o;this.signals.mouseUp.dispatch(r);const a=r.offsetX-(null!==(s=null==n?void 0:n.offsetX)&&void 0!==s?s:0),l=r.offsetY-(null!==(o=null==n?void 0:n.offsetY)&&void 0!==o?o:0);if(Math.abs(a)>2||Math.abs(l)>2)return t[0]=0,void(t[1]=0);setTimeout((()=>{0!==t[0]&&0===t[1]&&(0===r.button?(this.signals.click.dispatch(r),this._triggerSceneEventInAllObject("click",r)):2===r.button&&(this.signals.rightClick.dispatch(r),this._triggerSceneEventInAllObject("rightClick",r))),t[0]=0,t[1]=0}),300),e.removeEventListener("mouseup",i,!1)};let r=!1,s=null,o=null;const a=[0,0],l=e=>{var t,n;s&&clearTimeout(s);const i=()=>{r=!1,a[0]=0,a[1]=0},l=e.changedTouches[0].clientX-(null!==(t=null==o?void 0:o.changedTouches[0].clientX)&&void 0!==t?t:0),c=e.changedTouches[0].clientY-(null!==(n=null==o?void 0:o.changedTouches[0].clientY)&&void 0!==n?n:0);Math.abs(l)>2||Math.abs(c)>2?i():r?(i(),this.signals.rightClick.dispatch(e),this._triggerSceneEventInAllObject("rightClick",e)):setTimeout((()=>{0!==a[0]&&0===a[1]?(this.signals.click.dispatch(e),this._triggerSceneEventInAllObject("click",e)):0!==a[0]&&0!==a[1]&&a[1]-a[0]<=300&&(this.signals.dblClick.dispatch(e),this._triggerSceneEventInAllObject("dblClick",e)),i()}),300)};e.addEventListener("mousedown",(r=>{n=r,this.signals.mouseDown.dispatch(r),0===t[0]?t[0]=performance.now():0===t[1]&&(t[1]=performance.now()),e.addEventListener("mouseup",i,!1)}),!1),e.addEventListener("mousemove",(e=>{this.signals.mouseMove.dispatch(e),this.options.hoverEnabled&&this._triggerSceneEventInAllObject("hover",e)}),!1),e.addEventListener("dblclick",(e=>{this.signals.dblClick.dispatch(e),this._triggerSceneEventInAllObject("dblClick",e)}),!1),e.addEventListener("wheel",(e=>{this.signals.mouseWheel.dispatch(e)}),{passive:!0}),e.addEventListener("touchstart",(t=>{0===a[0]?a[0]=performance.now():0===a[1]&&(a[1]=performance.now()),o=t,s&&clearTimeout(s),s=setTimeout((()=>{r=!0}),800),e.addEventListener("touchend",l,{once:!0})}),{passive:!0}),e.addEventListener("contextmenu",(e=>e.preventDefault()),!1),document.addEventListener("keydown",(e=>{this.signals.keyDown.dispatch(e)}),!1),document.addEventListener("keyup",(e=>{this.signals.keyUp.dispatch(e)}),!1)}_triggerSceneEventInAllObject(e,t){const n=this.getIntersects(t,this.scener.intersectsList.getAll());if(0===n.length)return this.selectModel&&this.signals.modelHover.numListeners>0&&this.signals.modelUnHover.dispatch(this.selectModel),this.selectPoi&&this.signals.poiHover.numListeners>0&&this.signals.poiUnHover.dispatch(this.selectPoi),this.selectModel=null,this.selectPoi=null,void this.signals.sceneClick.dispatch({type:e,event:t});const i={object:null,type:null,point:null},r=[],s=[];function o(e){return e.parent?"Model"===e.parent.stype?e.parent:o(e.parent):void 0}n.forEach((e=>{if(e.object.parent instanceof pl){const t=e.object.parent;i.object||(i.type="Poi",i.object=e.object,i.point=e.point);-1===r.findIndex((e=>e.poi.uuid===t.uuid))&&r.push({poi:t,sourceData:e})}else if(e.object instanceof v){const t=o(e.object);t&&(i.object||(i.type="Model",i.object=e.object,i.point=e.point),s.push({model:t,sourceData:e}))}})),"click"===e&&i.point&&this.signals.selectPosition.dispatch(i.point);const a=e.slice(0,1).toUpperCase()+e.slice(1),l=e=>{var n;const{model:r}=e[0];if(r)if("Hover"===a)(null===(n=this.selectModel)||void 0===n?void 0:n.uuid)!==r.uuid&&(this.signals.modelHover.dispatch({target:r,currentTarget:i.object,intersects:e,event:t}),this.selectModel=r);else{let n=null;"Click"===a?(n=r.onClick,r.dispatchEvent({type:"click"})):"RightClick"===a?(n=r.onRightClick,r.dispatchEvent({type:"rightClick"})):"DblClick"===a&&(n=r.onDblClick,r.dispatchEvent({type:"dblClick"})),n?n(r):r.isEventPropagation=!0,r.isEventPropagation&&(this.signals[`model${a}`].dispatch({target:r,currentTarget:i.object,intersects:e,event:t}),r.isEventPropagation=!1)}},c=e=>{var n;const{poi:i}=e[0];if(i)if("Hover"===a)(null===(n=this.selectPoi)||void 0===n?void 0:n.uuid)!==i.uuid&&(this.signals.poiHover.dispatch({target:i,event:t}),this.selectPoi=i);else{let e=null;"Click"===a?(e=i.onClick,i.dispatchEvent({type:"click"})):"RightClick"===a?(e=i.onRightClick,i.dispatchEvent({type:"rightClick"})):"DblClick"===a&&(e=i.onDblClick,i.dispatchEvent({type:"dblClick"})),e?e(i):i.isEventPropagation=!0,i.isEventPropagation&&(this.signals[`poi${a}`].dispatch({target:i,event:t}),i.isEventPropagation=!1)}};if("Hover"===a){if(s.length>0){const[{model:e}]=s;this.selectModel&&this.selectModel.uuid!==e.uuid&&(this.signals.modelUnHover.dispatch(this.selectModel),this.selectModel=null)}if(r.length>0){const[{poi:e}]=r;this.selectPoi&&this.selectPoi.uuid!==e.uuid&&(this.signals.poiUnHover.dispatch(this.selectPoi),this.selectPoi=null)}}"Model"===i.type?l(s):"Poi"===i.type&&c(r)}}class sl extends u{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"BaseMesh";super(e,t);const{id:r,name:s="",level:o={max:null,min:null},visible:a=!0,position:l={x:0,y:0,z:0},rotation:c={x:0,y:0,z:0},scale:h={x:1,y:1,z:1},userData:u={}}=n;if(void 0===r)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=r,this.name=s,this.stype=i,this.level=o,this.visible=null==a||a,this.handleHide=!a,this.position.set(l.x,l.y,l.z),this.rotation.set(c.x,c.y,c.z),this.scale.set(h.x,h.y,h.z),this.castShadow=!0,this.receiveShadow=!0,this.userData=u,this.isEventPropagation=!1,this.autoUpdate=!1}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0,el.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,el.needsUpdate=!0}setMove(e,t,n,i){return Vn(this.position,sn(e),t,n,i)}setRotate(e,t,n,i){const s=on(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return Vn({t:0},{t:1},t,((e,t)=>{let{t:i}=e;this.quaternion.slerpQuaternions(o,a,i),null==n||n(this.rotation,t)}),i)}setScale(e,t,n,i){return Vn(this.scale,sn(e),t,n,i)}getBoundingBox(){return new i(new t,new t).setFromObject(this)}eventPropagation(){this.isEventPropagation=!0}sClone(e){return new sl(this.geometry,this.material,{id:`clone_${zn()}`}).sCopy(this,e)}sCopy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.geometry=e.geometry,this.material=e.material,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++)e.children[t]instanceof al||e.children[t]instanceof sl?this.add(e.children[t].sClone()):this.add(e.children[t].clone());return this}}const ol={onLoad:null,onClick:null,onDblClick:null,onRightClick:null};class al extends v{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BaseObject3D";super();const{id:n,name:i="",level:r={max:null,min:null},visible:s=!0,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},userData:c={},onLoad:h,onClick:u,onDblClick:d,onRightClick:f}=Object.assign(Object.assign({},ol),e);if(void 0===n)throw new Error("In soonspacejs: 空间对象实例化失败,缺少必要字段 'id'!");this.sid=n,this.name=i,this.stype=t,this.level=r,this.visible=null==s||s,this.handleHide=!s,this.isEventPropagation=!1,this.position.set(o.x,o.y,o.z),this.rotation.set(a.x,a.y,a.z),this.scale.set(l.x,l.y,l.z),this.castShadow=!0,this.receiveShadow=!0,this.userData=c,this.autoUpdate=!1,this.onLoad=(null==h?void 0:h.bind(this))||null,this.onClick=(null==u?void 0:u.bind(this))||null,this.onDblClick=(null==d?void 0:d.bind(this))||null,this.onRightClick=(null==f?void 0:f.bind(this))||null}eventPropagation(){this.isEventPropagation=!0}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0,el.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,el.needsUpdate=!0}setMove(e,t,n,i){return Vn(this.position,sn(e),t,n,i)}setRotate(e,t,n,i){const s=on(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return Vn({t:0},{t:1},t,((e,t)=>{let{t:i}=e;this.quaternion.slerpQuaternions(o,a,i),null==n||n(this.rotation,t)}),i)}setScale(e,t,n,i){return Vn(this.scale,sn(e),t,n,i)}sClone(e){return new al({id:`clone_${zn()}`}).sCopy(this,e)}sCopy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.stype=e.stype,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),this.animations=e.animations,!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];n instanceof al||n instanceof sl?this.add(n.sClone()):this.add(n.clone())}return this}getBoundingBox(){return new i(new t,new t).setFromObject(this)}getSpaceAttribute(){return un(this,!(arguments.length>0&&void 0!==arguments[0])||arguments[0])}syncSpaceAttribute(e){e instanceof al?dn(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1]):rn("In soonspacejs: BaseObject3D 对象原型方法 'syncSpaceAttribute' 第一个参数对象类型错误!")}}class ll extends al{constructor(e){super(e,"Group")}showAllChild(){this.children.forEach((e=>{e instanceof al&&e.show()}))}hideAllChild(){this.children.forEach((e=>{e instanceof al&&e.hide()}))}}class cl extends al{constructor(e){super(e,"PluginObject")}}class hl extends al{constructor(e){super(e,"PoiNode");const{type:t,element:n,elementAutoDisplay:i=!0,occlude:r=!1,onChange:s}=e;this.elementType=t,this.element=n,this.elementAutoDisplay=i,this.occlude=r,this.onChange=s,this.create(t)}create(e){"2D"===e||"2d"===e?this._create2D():"2.5D"===e||"2.5d"===e?this._create2DHalf():"3D"!==e&&"3d"!==e||this._create3D()}show(){this.visible=!0,this.handleHide=!1,this.autoUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0}getBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;e=e<=0?50:e;const n=new t,r=new t,s=new t(e,e,e);return n.copy(this.position),r.copy(this.position),n.sub(s),r.add(s),new i(n,r)}_create2D(){this.add(new $i(this.element))}_create2DHalf(){this.add(new hr(this.element))}_create3D(){this.add(new cr(this.element))}}class ul extends al{constructor(e){super(e,"Model");const{format:t}=e;this.formatType=t}setEnvMap(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};gn(e,t).then((e=>{this.traverse((t=>{if(t instanceof u&&t.material instanceof g){const{reflectivity:i=.5}=n;t.material.envMap=e,t.material.envMapIntensity=i,el.needsUpdate=!0}}))}))}sClone(e){return new ul({id:`${this.sid}_clone`,url:"",format:this.formatType}).sCopy(this,e)}}const dl={position:{x:0,y:0,z:0},scale:{x:16,y:16,z:1},stype:"Icon"};class fl extends _e{constructor(e,t){super(e);const{position:n,scale:i,stype:r}=Object.assign(Object.assign({},dl),t);this.stype=r,this.position.set(n.x,n.y,n.z),this.scale.set(i.x,i.y,i.z),this.renderOrder=1}}class pl extends al{constructor(e,t){super(t,"Poi");const{name:n,type:i="2.5d",nameScale:r={x:16,y:16,z:1}}=t;this.iconType=i,this.icon=this._createIcon(e);const s={position:{x:0,y:10,z:0},name:n,scale:r};this.text=this.name?this._createText(s):null,this.renderOrder=11}getBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;e=e<=0?50:e;const n=new t,r=new t,s=new t(e,e,e);return n.copy(this.position),r.copy(this.position),n.sub(s),r.add(s),new i(n,r)}sClone(e,t){return new pl(this.icon.material,{id:`${this.sid}_clone`,url:"",type:null!=t?t:this.iconType,name:this.name}).sCopy(this,e)}_createIcon(e){const t=new fl(this._computeMaterialSizeAttenuation(e));return this.add(t),t}_createText(e){const t=this._createTextMaterial(e),n=new fl(this._computeMaterialSizeAttenuation(t),e);return this.add(n),n}_createTextMaterial(e){const t=this._createTextCanvas(e.name||""),n=new l(t);n.flipY=!0,n.version+=1;return new Le({map:n,depthTest:!0})}_createTextCanvas(e,t){const n=256,i=document.createElement("canvas");i.width=n,i.height=n;const r=i.getContext("2d"),{fontFamily:s,fontSize:o,color:a,textAlign:l,textBaseline:c}=Object.assign(Object.assign({},{fontFamily:"Microsoft YaHei",fontSize:32,color:"#fff",textAlign:"center",textBaseline:"bottom"}),t);return r&&(r.save(),r.font=o+"px "+s,r.textAlign=l,r.textBaseline=c,r.shadowColor="black",r.strokeStyle="black",r.lineWidth=3,r.fillStyle=a,r.strokeText(e,128,128),r.fillText(e,128,128),r.restore()),i}_computeMaterialSizeAttenuation(e){return"2D"===this.iconType||"2d"===this.iconType?e.sizeAttenuation=!1:"2.5D"!==this.iconType&&"2.5d"!==this.iconType||(e.sizeAttenuation=!0),e}}class gl extends sl{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Point";const{radius:n=10,color:i=16777215,opacity:r=1,gradient:s}=e;super(function(e){return new Ne(e,32,32)}(n),function(e,t,n){return new xe({color:e,opacity:t,transparent:t<1,map:mn(n)})}(i,r,s),e,t)}setOptions(e){const{color:t,opacity:n,radius:i,position:r,gradient:s}=e,o=this.material;t&&(o.color=new a(t)),n&&(o.opacity=n),i&&(this.geometry=new Ne(i,32,32)),r&&this.position.copy(sn(r)),s&&(o.map=mn(s)),o.needsUpdate=!0,el.needsUpdate=!0}}class ml extends gl{constructor(e){super(e,"Node"),this.graphs=e.graphs}}class vl extends sl{constructor(e){const{radius:t=50,color:n=16777215,opacity:i=1,gradient:r}=e;super(function(e){return new ke(e,64)}(t),function(e,t,n){return new xe({color:e,opacity:t,transparent:t<1,side:Y,map:mn(n)})}(n,i,r),e,"Circle"),this.rotation.set(Math.PI/2,0,0)}setOptions(e){const{color:t,opacity:n,radius:i,position:r,gradient:s}=e,o=this.material;t&&(o.color=new a(t)),n&&(o.opacity=n),i&&(this.geometry=new ke(i,64)),r&&this.position.copy(sn(r)),s&&(o.map=mn(s)),o.needsUpdate=!0,el.needsUpdate=!0}}class yl extends sl{constructor(e){const{start:n,end:i,imgUrl:r,width:s=20,color:o=65280,opacity:a=1,animation:l=!1,passable:c=0,restrict:h=0}=e,u=sn(n),d=sn(i),f=u.distanceTo(d);super(function(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new t(0,1,0);const s=i/2,o=new t,a=new t;o.subVectors(n,e),o.normalize(),a.crossVectors(o,r),0===a.length()&&a.crossVectors(o,new t(0,0,-1));const l=new t(a.x*s,a.y*s,a.z*s),c=new t(-a.x*s,-a.y*s,-a.z*s),h=new t;h.addVectors(e,l);const u=new t;u.addVectors(e,c);const d=new t;d.addVectors(n,c);const f=new t;f.addVectors(n,l);const p=new J;return p.setAttribute("position",new Ue([h.x,h.y,h.z,u.x,u.y,u.z,d.x,d.y,d.z,d.x,d.y,d.z,f.x,f.y,f.z,h.x,h.y,h.z],3)),p.setAttribute("uv",new Ue([0,0,1,0,1,1,1,1,0,1,0,0],2)),p}(u,d,s),function(e,t,n,i,r,s){const o=new xe({color:n,side:Y,transparent:void 0!==i&&i<1,opacity:i});let a;return r&&(a=(new Ae).load(r,(n=>{a.repeat.set(1,e/(t*(n.image.height/n.image.width))*.63*(n.image.height/n.image.height)),o.color.set(16777215)})),a.wrapS=N,a.wrapT=N,a.flipY=!0,a.matrixAutoUpdate=!0,Rn(s)&&s?Vn(a.offset,{y:-1,x:0},{repeat:!0,duration:500}):Nn(s)&&Vn(a.offset,{y:-1,x:0},Object.assign(Object.assign({},s),{repeat:!0})),o.map=a),o}(f,s,o,a,r,l),e,"Link"),this.passable=c,this.restrict=h}}class bl extends al{constructor(e){super(e,"Topology");const{type:t="line"}=e;this.topologyType=t,this.nodes=[],this.links=[],this.info=e,this.create()}create(){var e,t;const{nodes:n,renderLink:i=!0,linkWidth:r=20,linkColor:s=65280,renderNode:o=!0,nodeColor:a=255,nodeRadius:l=r/2,imgUrl:c,animation:h=!1}=this.info,u=[];for(const d of n){const n=this.createNode(Object.assign(Object.assign({},d),{radius:l,color:a}));if(!1===o&&n.hide(),this.nodes.push(n),!c&&i){const n=Ln(s)?s[null===(e=d.graphs[0])||void 0===e?void 0:e.passable]?s[null===(t=d.graphs[0])||void 0===t?void 0:t.passable]:s[0]:s;!o&&this.createCircle({id:`${d.id}_circle`,name:`${d.name||d.id}_circle`,position:d.position,radius:r/2,color:n})}if(i)for(let e=0;e<d.graphs.length;e++){const{linkInfo:t,targetNodeId:n,passable:i,restrict:o}=d.graphs[e],{id:a,name:l}=t,f=this.info.nodes.find((e=>e.id===n));if(!u.includes(a)&&f){u.push(a);const e=Ln(s)?s[i]?s[i]:s[0]:s,t=this.createLink({id:a,name:l,start:d.position,end:f.position,width:r,color:e,imgUrl:c,opacity:c?.99:1,animation:h,passable:i,restrict:o,userData:{startNodeId:d.id,endNodeId:f.id}});this.links.push(t)}}}}createNode(e){const t=new ml(Object.assign({},e));return this.add(t),t}createCircle(e){const t=new vl(Object.assign(Object.assign({},e),{rotation:{x:Math.PI/2,y:0,z:0}}));return this.add(t),t}createLink(e){const t=new yl(Object.assign({},e));return this.add(t),t}resetNodes(e){const{renderLink:t=!0,linkWidth:n=20,linkColor:i=65280,renderNode:r=!0,nodeColor:s=255,nodeRadius:o=n/2,imgUrl:a,animation:l=!1}=this.info,c=[],h=[...this.info.nodes];this.info.nodes=[...e];const u=[];for(let t=0;t<h.length;t++){const n=e.find((e=>e.id===h[t].id));n&&sn(n.position).equals(sn(h[t].position))||u.push(h[t])}for(let e=0;e<u.length;e++){const t=this.nodes.findIndex((t=>u[e].id===t.sid));this.remove(this.nodes[t]),this.nodes.splice(t,1)}const d=[];for(let t=0;t<e.length;t++){const n=h.find((n=>n.id===e[t].id));n&&sn(n.position).equals(sn(e[t].position))||d.push(e[t])}for(let e=0;e<d.length;e++){const t=this.createNode(Object.assign(Object.assign({},d[e]),{radius:o,color:s}));this.nodes.push(t)}this.remove(...this.links),this.links.length=0;for(const r of e)if(t)for(let e=0;e<r.graphs.length;e++){const{linkInfo:t,targetNodeId:s,passable:o,restrict:h}=r.graphs[e],{id:u,name:d}=t,f=this.info.nodes.find((e=>e.id===s));if(!c.includes(u)&&f){c.push(u);const e=Ln(i)?i[o]?i[o]:i[0]:i,t=this.createLink({id:u,name:d,start:r.position,end:f.position,width:n,color:e,imgUrl:a,opacity:a?.99:1,animation:l,passable:o,restrict:h});this.links.push(t)}}}getLength(){let e=0;for(let t=1;t<this.nodes.length;t++)e+=this.nodes[t].position.distanceTo(this.nodes[t-1].position);return e}}function wl(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t(0,1,0);const r=n/2,s=new J;let o=[],a=[];if(e.length<2)return s;for(let n=0;n<e.length-1;n++){const s=sn(e[n]),l=sn(e[n+1]),c=new t,h=new t;c.subVectors(l,s),c.normalize(),h.crossVectors(c,i);const u=new t(h.x*r,h.y*r,h.z*r),d=new t(-h.x*r,-h.y*r,-h.z*r),f=new t;f.addVectors(s,u);const p=new t;p.addVectors(s,d);const g=new t;g.addVectors(l,d);const m=new t;m.addVectors(l,u),o=[...o,f.x,f.y,f.z,p.x,p.y,p.z,g.x,g.y,g.z,g.x,g.y,g.z,m.x,m.y,m.z,f.x,f.y,f.z],a=[...a,0,0,1,0,1,1,1,1,0,1,0,0]}return s.setAttribute("position",new Ue(o,3)),s.setAttribute("uv",new Ue(a,2)),s}class Al extends sl{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Line";const{points:n,width:i=20,color:r=16777215,opacity:s=1,gradient:o}=e;super(wl(n,i),function(e,t,n){return new xe({color:e,side:Y,transparent:t<1,opacity:t,map:mn(n)})}(r,s,o),e,t),this.params=e,this.points=n,this.frustumCulled=!1}setOptions(e){var t;const{color:n,opacity:i,points:r,width:s,gradient:o}=e;this.points=r;const l=this.material;n&&(l.color=new a(n)),i&&(l.opacity=i),o&&(l.map=mn(o)),r&&s?this.geometry=wl(r,s):r?this.geometry=wl(r,null!==(t=this.params.width)&&void 0!==t?t:20):s&&(this.geometry=wl(this.points,s)),l.needsUpdate=!0,el.needsUpdate=!0}}function xl(e){const t=[];for(let n=0;n<e.length;n++)t.push(new w(e[n].x,e[n].z));return t.length>2?new je(new ze(t)):new J}class Sl extends sl{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Polygon";const{yHeight:n,points:i,color:r=16777215,opacity:s=1,gradient:o}=e;super(xl(i),function(e,t,n){return new xe({color:e,opacity:t,transparent:t<1,side:Y,map:mn(n)})}(r,s,o),e,t),this.points=i,this.position.set(0,n,0),this.rotation.set(Math.PI/2,0,0)}setOptions(e){const{color:t,opacity:n,yHeight:i,points:r,gradient:s}=e,o=this.material;t&&(o.color=new a(t)),n&&(o.opacity=n),i&&this.position.set(0,i,0),r&&(this.geometry=xl(r)),s&&(o.map=mn(s)),o.needsUpdate=!0,el.needsUpdate=!0}}class El extends al{constructor(e){super(e,"Canvas3D"),this.create(e)}create(e){const{points:t=[],lines:n=[],polygons:i=[],circles:r=[]}=e;for(let e=0;e<t.length;e++)this.createPoint(t[e]);for(let e=0;e<n.length;e++)this.createLine(n[e]);for(let e=0;e<i.length;e++)this.createPolygon(i[e]);for(let e=0;e<r.length;e++)this.createCircle(r[e])}createPoint(e){const t=new gl(e);return this.add(t),el.needsUpdate=!0,t}getPoint(e){return this.getChildForType("Point",e)}removePoint(e){const t=this.getPoint(e);t&&this.remove(t),el.needsUpdate=!0}createLine(e){const t=new Al(e);return this.add(t),el.needsUpdate=!0,t}getLine(e){return this.getChildForType("Line",e)}removeLine(e){const t=this.getLine(e);t&&this.remove(t),el.needsUpdate=!0}createPolygon(e){const t=new Sl(e);return this.add(t),el.needsUpdate=!0,t}getPolygon(e){return this.getChildForType("Polygon",e)}removePolygon(e){const t=this.getPolygon(e);t&&this.remove(t),el.needsUpdate=!0}createCircle(e){const t=new vl(e);return this.add(t),el.needsUpdate=!0,t}getCircle(e){return this.getChildForType("Circle",e)}removeCircle(e){const t=this.getCircle(e);t&&this.remove(t),el.needsUpdate=!0}getChildForType(e,t){for(let n=0;n<this.children.length;n++)if(this.children[n].stype===e&&this.children[n].sid===t)return this.children[n];return null}}class Tl extends sl{constructor(e,t,n){super(e,t,n,"Ground")}}var Dl=Object.freeze({__proto__:null,BaseMesh:sl,BaseObject3D:al,Canvas3D:El,Circle:vl,Ground:Tl,Group:ll,Icon:fl,Line:Al,Link:yl,Model:ul,Node:ml,PluginObject:cl,Poi:pl,PoiNode:hl,Point:gl,Polygon:Sl,Topology:bl});class Cl{constructor(e,t,n){this.type=e,this.scene=n,this.viewport=t}createGroup(e,t){const n=new ll(e);return null!==t&&this.viewport.scener.addObject(n,null!=t?t:this.scene),n}clear(){this.getAll().forEach((e=>{this.viewport.scener.removeObject(e)}))}getAll(){const e=[];return this.scene.traverse((t=>{((t instanceof al||t instanceof sl)&&Nn(t)&&t.stype===this.type||Nn(t)&&t.userData.stype===this.type)&&e.push(t)})),e}hideAll(){this.getAll().forEach((e=>{e.hide?e.hide():e.visible=!1})),this.viewport.signals.objectChanged.dispatch()}showAll(){this.getAll().forEach((e=>{e.show?e.show():e.visible=!0})),this.viewport.signals.objectChanged.dispatch()}}class Bl extends Cl{constructor(e,t){super(Wt,e,t),At.init()}createAmbientLight(e){const{id:t,name:n="",color:i=10132122,intensity:r=1}=e,s=new Fe(i,r);return s.name=n,s.userData.sid=t,s.userData.stype="Light",this.viewport.scener.addObject(s,this.scene),s}setAmbientLight(e,t){const{name:n="",color:i=10132122,intensity:r=1}=t;return!!e&&(e.name=n,e.color=new a(i),e.intensity=r,this.viewport.signals.objectChanged.dispatch(),!0)}createDirectionalLight(e){const{id:t,name:n="",color:i=10132122,intensity:r=1,position:s={x:1e3,y:1e3,z:1e3},target:o={x:-1e3,y:-1e3,z:-1e3},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:c=4096}=e,h=new He(i,r);if(h.name=n,h.userData.sid=t,h.userData.stype="Light",h.position.set(s.x,s.y,s.z),h.target.name=`${n}-target`,h.target.position.set(o.x,o.y,o.z),h.castShadow=a,a){const e=h.position.distanceTo(h.target.position);h.shadow.bias=-.005,h.shadow.camera.left=-e,h.shadow.camera.right=e,h.shadow.camera.top=e,h.shadow.camera.bottom=-e,h.shadow.camera.far=e,h.shadow.autoUpdate=l,h.shadow.mapSize.width=c,h.shadow.mapSize.height=c,h.shadow.camera.updateProjectionMatrix()}return this.viewport.scener.addObject(h,this.scene),this.viewport.scener.addObject(h.target,this.scene),h}setDirectionalLight(e,t){const{name:n="",color:i=10132122,intensity:r=1,position:s={x:1e3,y:1e3,z:1e3},target:o={x:-1e3,y:-1e3,z:-1e3},openShadow:l=!1,shadowAutoUpdate:c=!1,mapSize:h=4096}=t;if(!e)return!1;if(e.name=n,e.color=new a(i),e.intensity=r,e.position.set(s.x,s.y,s.z),e.target.position.set(o.x,o.y,o.z),e.castShadow=l,l){const t=e.position.distanceTo(e.target.position);e.shadow.bias=-.005,e.shadow.camera.left=-t,e.shadow.camera.right=t,e.shadow.camera.top=t,e.shadow.camera.bottom=-t,e.shadow.camera.far=t,e.shadow.autoUpdate=c,e.shadow.mapSize.width=h,e.shadow.mapSize.height=h,e.shadow.camera.updateProjectionMatrix()}return this.viewport.signals.objectChanged.dispatch(),!0}createHemisphereLight(e){const{id:t,name:n="",skyColor:i=16777215,groundColor:r=14540253,intensity:s=1,position:o={x:0,y:0,z:0}}=e,a=new Ge(i,r,s);return a.name=n,a.position.set(o.x,o.y,o.z),a.userData.sid=t,a.userData.stype="Light",this.viewport.scener.addObject(a,this.scene),a}setHemisphereLight(e,t){const{name:n="",skyColor:i=16777215,groundColor:r=14540253,intensity:s=1,position:o={x:0,y:0,z:0}}=t;return!!e&&(e.name=n,e.color=new a(i),e.groundColor=new a(r),e.intensity=s,e.position.set(o.x,o.y,o.z),this.viewport.signals.objectChanged.dispatch(),!0)}createSpotLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,angle:s=45,position:o={x:0,y:500,z:0},target:a={x:0,y:0,z:0},openShadow:l=!1,shadowAutoUpdate:c=!1,mapSize:h=4096}=e,u=sn(o).distanceTo(sn(a)),d=new Ve(i,r,u,Math.PI/360*s,0,0);if(d.name=n,d.position.set(o.x,o.y,o.z),d.userData.sid=t,d.userData.stype="Light",d.castShadow=l,d.target.position.set(a.x,a.y,a.z),d.target.castShadow=l,d.target.receiveShadow=!0,d.target.updateMatrixWorld(),l){const e=d.position.distanceTo(d.target.position);d.shadow.autoUpdate=c,d.shadow.mapSize.width=h,d.shadow.mapSize.height=h,d.shadow.bias=-.005,d.shadow.focus=.6,d.shadow.camera.far=e,d.shadow.camera.updateProjectionMatrix()}return this.viewport.scener.addObject(d,this.scene),d}setSpotLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,angle:s=45,position:o={x:0,y:500,z:0},target:l={x:0,y:0,z:0},openShadow:c=!1,shadowAutoUpdate:h=!1,mapSize:u=4096}=t;if(!e)return!1;const d=sn(o).distanceTo(sn(l));if(e.name=n,e.color=new a(i),e.intensity=r,e.distance=d,e.angle=Math.PI/360*s,e.position.set(o.x,o.y,o.z),e.castShadow=c,e.target.position.set(l.x,l.y,l.z),e.target.castShadow=c,e.target.updateMatrixWorld(),c){const t=e.position.distanceTo(e.target.position);e.shadow.autoUpdate=h,e.shadow.mapSize.width=u,e.shadow.mapSize.height=u,e.shadow.bias=-.005,e.shadow.focus=.6,e.shadow.camera.far=t,e.shadow.camera.updateProjectionMatrix()}return this.viewport.signals.objectChanged.dispatch(),!0}createPointLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,distance:s=5e3,position:o={x:0,y:500,z:0},openShadow:a=!1,shadowAutoUpdate:l=!1,mapSize:c=4096}=e,h=new Ye(i,r,s);return h.name=n,h.userData.sid=t,h.userData.stype="Light",h.position.set(o.x,o.y,o.z),h.castShadow=a,a&&(h.shadow.bias=-.005,h.shadow.camera.far=s,h.shadow.autoUpdate=l,h.shadow.mapSize.width=c,h.shadow.mapSize.height=c,h.shadow.camera.updateProjectionMatrix()),this.viewport.scener.addObject(h,this.scene),h}setPointLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,distance:s=5e3,position:o={x:0,y:500,z:0},openShadow:l=!1,shadowAutoUpdate:c=!1,mapSize:h=4096}=t;return!!e&&(e.name=n,e.color=new a(i),e.intensity=r,e.distance=s,e.position.set(o.x,o.y,o.z),e.castShadow=l,l&&(e.shadow.bias=-.005,e.shadow.camera.far=s,e.shadow.autoUpdate=c,e.shadow.mapSize.width=h,e.shadow.mapSize.height=h,e.shadow.camera.updateProjectionMatrix()),this.viewport.signals.objectChanged.dispatch(),!0)}createRectAreaLight(e){const{id:t,name:n="",color:i=16777215,intensity:r=1,width:s=10,height:o=10,position:a={x:0,y:0,z:0}}=e,l=new Qe(i,r,s,o);return l.name=n,l.userData.sid=t,l.userData.stype="Light",l.position.set(a.x,a.y,a.z),this.viewport.scener.addObject(l,this.scene),l}setRectAreaLight(e,t){const{name:n="",color:i=16777215,intensity:r=1,width:s=10,height:o=10,position:l={x:0,y:0,z:0}}=t;return!!e&&(e.name=n,e.color=new a(i),e.intensity=r,e.width=s,e.height=o,e.position.set(l.x,l.y,l.z),this.viewport.signals.objectChanged.dispatch(),!0)}updateAllShadow(){this.getAll().forEach((e=>{var t;!1===(null===(t=e.shadow)||void 0===t?void 0:t.autoUpdate)&&(e.shadow.needsUpdate=!0)})),this.viewport.signals.objectChanged.dispatch()}}function Il(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ml={};({get exports(){return Ml},set exports(e){Ml=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&Il)return Il(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){var n=t[o][1][e];return r(n||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=Il,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){(function(e){var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var s=0,o=new r(h),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var l=new e.MessageChannel;l.port1.onmessage=h,n=function(){l.port2.postMessage(0)}}var c=[];function h(){var e,t;i=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}i=!1}function u(e){1!==c.push(e)||i||n()}t.exports=u}).call(this,void 0!==Qn?Qn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var i=e(1);function r(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==r&&f(this,e)}function h(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){i((function(){var i;try{i=t(n)}catch(t){return s.reject(e,t)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var n=!1;function i(t){n||(n=!0,s.reject(e,t))}function r(t){n||(n=!0,s.resolve(e,t))}function o(){t(r,i)}var a=p(o);"error"===a.status&&i(a.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function g(e){return e instanceof this?e:s.resolve(new this(r),e)}function m(e){var t=new this(r);return s.reject(t,e)}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,c=new this(r);++l<n;)h(e[l],l);return c;function h(e,r){function l(e){o[r]=e,++a!==n||i||(i=!0,s.resolve(c,o))}t.resolve(e).then(l,(function(e){i||(i=!0,s.reject(c,e))}))}}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=-1,a=new this(r);++o<n;)l(e[o]);return a;function l(e){t.resolve(e).then((function(e){i||(i=!0,s.resolve(a,e))}),(function(e){i||(i=!0,s.reject(a,e))}))}}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(r);return this.state!==l?u(n,this.state===a?e:t,this.outcome):this.queue.push(new h(n,e,t)),n},h.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){s.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=p(d,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)f(e,i);else{e.state=a,e.outcome=t;for(var r=-1,o=e.queue.length;++r<o;)e.queue[r].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},c.resolve=g,c.reject=m,c.all=v,c.race=y},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==Qn?Qn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var o=s();function a(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(r){if("TypeError"!==r.name)throw r;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var c=Promise;function h(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",g=void 0,m={},v=Object.prototype.toString,y="readonly",b="readwrite";function w(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),r=0;r<t;r++)i[r]=e.charCodeAt(r);return n}function A(e){return new c((function(t){var n=e.transaction(p,b),i=l([""]);n.objectStore(p).put(i,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function x(e){return"boolean"==typeof g?c.resolve(g):A(e).then((function(e){return g=e}))}function S(e){var t=m[e.name],n={};n.promise=new c((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function E(e){var t=m[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function T(e,t){var n=m[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(m[e.name]=m[e.name]||N(),e.db){if(!t)return n(e.db);S(e),e.db.close()}var r=[e.name];t&&r.push(e.version);var s=o.open.apply(o,r);t&&(s.onupgradeneeded=function(t){var n=s.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(p)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),s.onerror=function(e){e.preventDefault(),i(s.error)},s.onsuccess=function(){n(s.result),E(e)}}))}function C(e){return D(e,!1)}function B(e){return D(e,!0)}function I(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,r=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),r||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function M(e){return new c((function(t,n){var i=new FileReader;i.onerror=n,i.onloadend=function(n){var i=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:i,type:e.type})},i.readAsBinaryString(e)}))}function O(e){return l([w(atob(e.data))],{type:e.type})}function P(e){return e&&e.__local_forage_encoded_blob}function R(e){var t=this,n=t._initReady().then((function(){var e=m[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(n,e,e),n}function _(e){S(e);for(var t=m[e.name],n=t.forages,i=0;i<n.length;i++){var r=n[i];r._dbInfo.db&&(r._dbInfo.db.close(),r._dbInfo.db=null)}return e.db=null,C(e).then((function(t){return e.db=t,I(e)?B(e):t})).then((function(i){e.db=t.db=i;for(var r=0;r<n.length;r++)n[r]._dbInfo.db=i})).catch((function(t){throw T(e,t),t}))}function L(e,t,n,i){void 0===i&&(i=1);try{var r=e.db.transaction(e.storeName,t);n(null,r)}catch(r){if(i>0&&(!e.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return c.resolve().then((function(){if(!e.db||"NotFoundError"===r.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),B(e)})).then((function(){return _(e).then((function(){L(e,t,n,i-1)}))})).catch(n);n(r)}}function N(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function k(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=m[n.name];r||(r=N(),m[n.name]=r),r.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=R);var s=[];function o(){return c.resolve()}for(var a=0;a<r.forages.length;a++){var l=r.forages[a];l!==t&&s.push(l._initReady().catch(o))}var h=r.forages.slice(0);return c.all(s).then((function(){return n.db=r.db,C(n)})).then((function(e){return n.db=e,I(n,t._defaultConfig.version)?B(n):e})).then((function(e){n.db=r.db=e,t._dbInfo=n;for(var i=0;i<h.length;i++){var s=h[i];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}}))}function U(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){L(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),P(e)&&(e=O(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return h(i,t),i}function j(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){L(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var i=n.value;P(i)&&(i=O(i));var r=e(i,n.key,a++);void 0!==r?t(r):n.continue()}else t()},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return h(i,t),i}function z(e,t,n){var i=this;e=d(e);var r=new c((function(n,r){var s;i.ready().then((function(){return s=i._dbInfo,"[object Blob]"===v.call(t)?x(s.db).then((function(e){return e?t:M(t)})):t})).then((function(t){L(i._dbInfo,b,(function(s,o){if(s)return r(s);try{var a=o.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var l=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=l.error?l.error:l.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return h(r,n),r}function F(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){L(n._dbInfo,b,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){i(o.error)},s.onabort=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return h(i,t),i}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){L(t._dbInfo,b,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).clear();r.oncomplete=function(){e()},r.onabort=r.onerror=function(){var e=s.error?s.error:s.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function G(e){var t=this,n=new c((function(e,n){t.ready().then((function(){L(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function V(e,t){var n=this,i=new c((function(t,i){e<0?t(null):n.ready().then((function(){L(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName),a=!1,l=o.openKeyCursor();l.onsuccess=function(){var n=l.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},l.onerror=function(){i(l.error)}}catch(e){i(e)}}))})).catch(i)}));return h(i,t),i}function Y(e){var t=this,n=new c((function(e,n){t.ready().then((function(){L(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;t?(o.push(t.key),t.continue()):e(o)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return h(n,e),n}function Q(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;if(e.name){var s=e.name===n.name&&r._dbInfo.db?c.resolve(r._dbInfo.db):C(e).then((function(t){var n=m[e.name],i=n.forages;n.db=t;for(var r=0;r<i.length;r++)i[r]._dbInfo.db=t;return t}));i=e.storeName?s.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;S(e);var i=m[e.name],r=i.forages;t.close();for(var s=0;s<r.length;s++){var a=r[s];a._dbInfo.db=null,a._dbInfo.version=n}var l=new c((function(t,i){var r=o.open(e.name,n);r.onerror=function(e){r.result.close(),i(e)},r.onupgradeneeded=function(){r.result.deleteObjectStore(e.storeName)},r.onsuccess=function(){var e=r.result;e.close(),t(e)}}));return l.then((function(e){i.db=e;for(var t=0;t<r.length;t++){var n=r[t];n._dbInfo.db=e,E(n._dbInfo)}})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}})):s.then((function(t){S(e);var n=m[e.name],i=n.forages;t.close();for(var r=0;r<i.length;r++)i[r]._dbInfo.db=null;var s=new c((function(t,n){var i=o.deleteDatabase(e.name);i.onerror=i.onblocked=function(e){var t=i.result;t&&t.close(),n(e)},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}));return s.then((function(e){n.db=e;for(var t=0;t<i.length;t++)E(i[t]._dbInfo)})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}))}else i=c.reject("Invalid arguments");return h(i,t),i}var W={_driver:"asyncStorage",_initStorage:k,_support:a(),iterate:j,getItem:U,setItem:z,removeItem:F,clear:H,length:G,key:V,keys:Y,dropInstance:Q};function X(){return"function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K="~~local_forage_type~",q=/^~~local_forage_type~([^~]+)~/,J="__lfsc__:",$=J.length,ee="arbf",te="blob",ne="si08",ie="ui08",re="uic8",se="si16",oe="si32",ae="ur16",le="ui32",ce="fl32",he="fl64",ue=$+ee.length,de=Object.prototype.toString;function fe(e){var t,n,i,r,s,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var c=new ArrayBuffer(o),h=new Uint8Array(c);for(t=0;t<a;t+=4)n=Z.indexOf(e[t]),i=Z.indexOf(e[t+1]),r=Z.indexOf(e[t+2]),s=Z.indexOf(e[t+3]),h[l++]=n<<2|i>>4,h[l++]=(15&i)<<4|r>>2,h[l++]=(3&r)<<6|63&s;return c}function pe(e){var t,n=new Uint8Array(e),i="";for(t=0;t<n.length;t+=3)i+=Z[n[t]>>2],i+=Z[(3&n[t])<<4|n[t+1]>>4],i+=Z[(15&n[t+1])<<2|n[t+2]>>6],i+=Z[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}function ge(e,t){var n="";if(e&&(n=de.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var i,r=J;e instanceof ArrayBuffer?(i=e,r+=ee):(i=e.buffer,"[object Int8Array]"===n?r+=ne:"[object Uint8Array]"===n?r+=ie:"[object Uint8ClampedArray]"===n?r+=re:"[object Int16Array]"===n?r+=se:"[object Uint16Array]"===n?r+=ae:"[object Int32Array]"===n?r+=oe:"[object Uint32Array]"===n?r+=le:"[object Float32Array]"===n?r+=ce:"[object Float64Array]"===n?r+=he:t(new Error("Failed to get type for BinaryArray"))),t(r+pe(i))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n=K+e.type+"~"+pe(this.result);t(J+te+n)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function me(e){if(e.substring(0,$)!==J)return JSON.parse(e);var t,n=e.substring(ue),i=e.substring($,ue);if(i===te&&q.test(n)){var r=n.match(q);t=r[1],n=n.substring(r[0].length)}var s=fe(n);switch(i){case ee:return s;case te:return l([s],{type:t});case ne:return new Int8Array(s);case ie:return new Uint8Array(s);case re:return new Uint8ClampedArray(s);case se:return new Int16Array(s);case ae:return new Uint16Array(s);case oe:return new Int32Array(s);case le:return new Uint32Array(s);case ce:return new Float32Array(s);case he:return new Float64Array(s);default:throw new Error("Unkown type: "+i)}}var ve={serialize:ge,deserialize:me,stringToBuffer:fe,bufferToString:pe};function ye(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function be(e){var t=this,n={db:null};if(e)for(var i in e)n[i]="string"!=typeof e[i]?e[i].toString():e[i];var r=new c((function(e,i){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return i(e)}n.db.transaction((function(r){ye(r,n,(function(){t._dbInfo=n,e()}),(function(e,t){i(t)}))}),i)}));return n.serializer=ve,r}function we(e,t,n,i,r,s){e.executeSql(n,i,r,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?s(e,o):ye(e,t,(function(){e.executeSql(n,i,r,s)}),s)}),s):s(e,o)}),s)}function Ae(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){we(n,r,"SELECT * FROM "+r.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var i=n.rows.length?n.rows.item(0).value:null;i&&(i=r.serializer.deserialize(i)),t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return h(i,t),i}function xe(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){we(n,r,"SELECT * FROM "+r.storeName,[],(function(n,i){for(var s=i.rows,o=s.length,a=0;a<o;a++){var l=s.item(a),c=l.value;if(c&&(c=r.serializer.deserialize(c)),void 0!==(c=e(c,l.key,a+1)))return void t(c)}t()}),(function(e,t){i(t)}))}))})).catch(i)}));return h(i,t),i}function Se(e,t,n,i){var r=this;e=d(e);var s=new c((function(s,o){r.ready().then((function(){void 0===t&&(t=null);var a=t,l=r._dbInfo;l.serializer.serialize(t,(function(t,c){c?o(c):l.db.transaction((function(n){we(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){s(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void s(Se.apply(r,[e,a,n,i-1]));o(t)}}))}))})).catch(o)}));return h(s,n),s}function Ee(e,t,n){return Se.apply(this,[e,t,n,1])}function Te(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){we(n,r,"DELETE FROM "+r.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){i(t)}))}))})).catch(i)}));return h(i,t),i}function De(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){we(t,i,"DELETE FROM "+i.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Ce(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){we(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],(function(t,n){var i=n.rows.item(0).c;e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Be(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){we(n,r,"SELECT key FROM "+r.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var i=n.rows.length?n.rows.item(0).key:null;t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return h(i,t),i}function Ie(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){we(t,i,"SELECT key FROM "+i.storeName,[],(function(t,n){for(var i=[],r=0;r<n.rows.length;r++)i.push(n.rows.item(r).key);e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return h(n,e),n}function Me(e){return new c((function(t,n){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,i){for(var r=[],s=0;s<i.rows.length;s++)r.push(i.rows.item(s).name);t({db:e,storeNames:r})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}function Oe(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;return i=e.name?new c((function(t){var i;i=e.name===n.name?r._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(Me(i))})).then((function(e){return new c((function(t,n){e.db.transaction((function(i){function r(e){return new c((function(t,n){i.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var s=[],o=0,a=e.storeNames.length;o<a;o++)s.push(r(e.storeNames[o]));c.all(s).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):c.reject("Invalid arguments"),h(i,t),i}var Pe={_driver:"webSQLStorage",_initStorage:be,_support:X(),iterate:xe,getItem:Ae,setItem:Ee,removeItem:Te,clear:De,length:Ce,key:Be,keys:Ie,dropInstance:Oe};function Re(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function _e(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function Le(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Ne(){return!Le()||localStorage.length>0}function ke(e){var t=this,n={};if(e)for(var i in e)n[i]=e[i];return n.keyPrefix=_e(e,t._defaultConfig),Ne()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function Ue(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}}));return h(n,e),n}function je(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i}));return h(i,t),i}function ze(e,t){var n=this,i=n.ready().then((function(){for(var t=n._dbInfo,i=t.keyPrefix,r=i.length,s=localStorage.length,o=1,a=0;a<s;a++){var l=localStorage.key(a);if(0===l.indexOf(i)){var c=localStorage.getItem(l);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,l.substring(r),o++)))return c}}}));return h(i,t),i}function Fe(e,t){var n=this,i=n.ready().then((function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t}));return h(i,t),i}function He(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,i=[],r=0;r<n;r++){var s=localStorage.key(r);0===s.indexOf(e.keyPrefix)&&i.push(s.substring(e.keyPrefix.length))}return i}));return h(n,e),n}function Ge(e){var t=this.keys().then((function(e){return e.length}));return h(t,e),t}function Ve(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return h(i,t),i}function Ye(e,t,n){var i=this;e=d(e);var r=i.ready().then((function(){void 0===t&&(t=null);var n=t;return new c((function(r,s){var o=i._dbInfo;o.serializer.serialize(t,(function(t,i){if(i)s(i);else try{localStorage.setItem(o.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||s(e),s(e)}}))}))}));return h(r,n),r}function Qe(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var i,r=this;return i=e.name?new c((function(t){e.storeName?t(_e(e,r._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):c.reject("Invalid arguments"),h(i,t),i}var We={_driver:"localStorageWrapper",_initStorage:ke,_support:Re(),iterate:ze,getItem:je,setItem:Ye,removeItem:Ve,clear:Ue,length:Ge,key:Fe,keys:He,dropInstance:Qe},Xe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ze=function(e,t){for(var n=e.length,i=0;i<n;){if(Xe(e[i],t))return!0;i++}return!1},Ke=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},qe={},Je={},$e={INDEXEDDB:W,WEBSQL:Pe,LOCALSTORAGE:We},et=[$e.INDEXEDDB._driver,$e.WEBSQL._driver,$e.LOCALSTORAGE._driver],tt=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),it={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function rt(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function st(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(Ke(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ot=function(){function e(t){for(var n in r(this,e),$e)if($e.hasOwnProperty(n)){var i=$e[n],s=i._driver;this[n]=s,qe[s]||this.defineDriver(i)}this._defaultConfig=st({},it),this._config=st({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":i(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var i=new c((function(t,n){try{var i=e._driver,r=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(r);for(var s=nt.concat("_initStorage"),o=0,a=s.length;o<a;o++){var l=s[o];if((!Ze(tt,l)||e[l])&&"function"!=typeof e[l])return void n(r)}var u=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=c.reject(t);return h(n,arguments[arguments.length-1]),n}},n=0,i=tt.length;n<i;n++){var r=tt[n];e[r]||(e[r]=t(r))}};u();var d=function(n){qe[i]&&console.info("Redefining LocalForage driver: "+i),qe[i]=e,Je[i]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return u(i,t,n),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var i=qe[e]?c.resolve(qe[e]):c.reject(new Error("Driver not found."));return u(i,t,n),i},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var i=this;Ke(e)||(e=[e]);var r=this._getSupportedDrivers(e);function s(){i._config.driver=i.driver()}function o(e){return i._extend(e),s(),i._ready=i._initStorage(i._config),i._ready}function a(e){return function(){var t=0;function n(){for(;t<e.length;){var r=e[t];return t++,i._dbInfo=null,i._ready=null,i.getDriver(r).then(o).catch(n)}s();var a=new Error("No available storage method found.");return i._driverSet=c.reject(a),i._driverSet}return n()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return c.resolve()})):c.resolve();return this._driverSet=l.then((function(){var e=r[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then((function(e){i._driver=e._driver,s(),i._wrapLibraryMethodsWithReady(),i._initDriver=a(r)}))})).catch((function(){s();var e=new Error("No available storage method found.");return i._driverSet=c.reject(e),i._driverSet})),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!Je[e]},e.prototype._extend=function(e){st(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];this.supports(r)&&t.push(r)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=nt.length;e<t;e++)rt(this,nt[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),at=new ot;t.exports=at},{3:3}]},{},[4])(4);const Ol=()=>{self.noCompressWorker=function(e,t){const[n]=new Uint32Array(e,t,1),i={byteOffset:t+=4,length:3*n},r={byteOffset:t+=3*n*4,length:2*n},s={byteOffset:t+=2*n*4,length:4*n},o={byteOffset:t+=4*n*1,length:3*n};t+=3*n*1;let a=(s.length+o.length)%4;a>0&&(a=4-a,t+=a);const l=new Uint32Array(e,t,1);t+=4;const[c]=l,h={byteOffset:t,length:c};t+=4*c;const u=new Uint32Array(e,t,1);t+=4;const[d]=u,f=[];if(d>0)for(let n=0;n<d;n++){const[n]=new Uint32Array(e,t,1);t+=4;const[i]=new Uint32Array(e,t,1);t+=4;const[r]=new Uint32Array(e,t,1);t+=4;const[s]=new Uint32Array(e,t,1);t+=4;const o=new Uint8Array(e,t,s);t+=s;const a=(new TextDecoder).decode(o);f.push({start:n,count:i,uuid:a,alphaMode:r})}return{buffer:e,position:i,normal:o,color:s,texcoord:r,indice:h,sub_mesh:f}}},Pl=()=>{self.gzipCompressWorker=function(e){const t=new Uint8Array(e,4,e.byteLength-4),n=new pako.Inflate;n.push(t,!0);const{result:i}=n;if(i instanceof Uint8Array){const{buffer:e}=i;let t=0;const[n]=new Uint32Array(e,t,1);t+=4;const r={byteOffset:t,length:3*n};t+=3*n*4;const s={byteOffset:t,length:2*n};t+=2*n*4;const o={byteOffset:t,length:4*n};t+=4*n*1;const a={byteOffset:t,length:3*n};t+=3*n*1;let l=(o.length+a.length)%4;l>0&&(l=4-l,t+=l);const c=new Uint32Array(e,t,1);t+=4;const[h]=c,u={byteOffset:t,length:h};t+=4*h;const d=new Uint32Array(e,t,1);t+=4;const[f]=d,p=[];if(f>0)for(let n=0;n<f;n++){const[n]=new Uint32Array(e,t,1);t+=4;const[i]=new Uint32Array(e,t,1);t+=4;const[r]=new Uint32Array(e,t,1);t+=4;const[s]=new Uint32Array(e,t,1);t+=4;const o=new Uint8Array(e,t,s);t+=s;const a=(new TextDecoder).decode(o);p.push({start:n,count:i,uuid:a,alphaMode:r})}return{buffer:e,position:r,normal:a,color:o,texcoord:s,indice:u,sub_mesh:p}}}},Rl=()=>{self.parseChunkWorker=function(e){let t=0;const n=new Int8Array(e,t,128);t+=128,(new TextDecoder).decode(n.slice(0,4));const[i]=n.slice(4,8);if(0===i)return self.noCompressWorker(e,t);if(1===i){const t=e.slice(128);return self.gzipCompressWorker(t)}throw new Error("unknown compress mode [ .sbmx model ]")}},_l="\n onmessage = function ( e ) {\n \n const message = e.data\n\n switch ( message.type ) {\n\n case 'decode': {\n\n const chunkInfo = self.parseChunkWorker( message.data )\n\n if ( chunkInfo ) { \n\n self.postMessage( \n { type: 'decode', data: chunkInfo, }, \n [ chunkInfo.buffer ]\n )\n\n } else {\n\n self.postMessage( { type: 'decode', data: {}, } )\n\n }\n\n break\n \n }\n \n }\n\n }\n\n",Ll="textureIndex.json";class Nl extends We{constructor(e){super(),this.store=e,this.loadedTextures=new Map,this.loadedMaterialsMap=new Map,this.defaultMaterial=new g({name:"defaultDatMaterial",color:0}),this.loadedMaterials=[this.defaultMaterial],this.dracoDecoderPath=null,this.workerPool=new wt(4),this.workerSourceURL="";const t=this._initWorkerCreator();this.workerPool.setWorkerCreator(t)}async parseAsync(e,t){const[n]=await Promise.allSettled([this._decodeBuffer(e,t),this._createMaterial(t)]);if("fulfilled"===n.status&&n.value){const e=vn(t),i=this._createMesh(n.value,e),r=new Xe;return r.add(i),r}}async _decodeBuffer(e,t){const n=await this.store.getItem(`${t}_object`);if(n)return n;const[{data:i}]=await Promise.all([this.workerPool.postMessage({type:"decode",data:e},[e])]);if(i){const{type:e,data:n}=null!=i?i:{};if("decode"===e&&n){const{buffer:{byteLength:e}}=n;return _n(e)&&e/1024/1024<=500&&Bn((()=>{this.store.setItem(`${t}_object`,n)})),n}}}_initWorkerCreator(){if(!this.workerSourceURL){const e=Ol.toString(),t=Pl.toString(),n=Rl.toString(),i=["/* dat decoder */",["/* pako */","\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pako = {}));\n}(this, (function (exports) { 'use strict';\n\n // Note: adler32 takes 12% for level 0 and 2% for level 6.\n // It isn't worth it to make additional optimizations as in original.\n // Small size is preferable.\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express ofr implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n const adler32 = (adler, buf, len, pos) => {\n let s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n };\n\n\n var adler32_1 = adler32;\n\n // Note: we can't get significant speed boost here.\n // So write code to minimize size - no pregenerated tables\n // and array tools dependencies.\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n // Use ordinary array, since untyped makes no boost here\n const makeTable = () => {\n let c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n };\n\n // Create table on load. Just 255 signed longs. Not a problem.\n const crcTable = new Uint32Array(makeTable());\n\n\n const crc32 = (crc, buf, len, pos) => {\n const t = crcTable;\n const end = pos + len;\n\n crc ^= -1;\n\n for (let i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n };\n\n\n var crc32_1 = crc32;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n // See state defs from inflate.js\n const BAD$1 = 30; /* got a data error -- remain here until reset */\n const TYPE$1 = 12; /* i: waiting for type bits, including last-flag bit */\n\n /*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\n var inffast = function inflate_fast(strm, start) {\n let _in; /* local strm.input */\n let last; /* have enough input while in < last */\n let _out; /* local strm.output */\n let beg; /* inflate()'s initial strm.output */\n let end; /* while out < end, enough space available */\n //#ifdef INFLATE_STRICT\n let dmax; /* maximum distance from zlib header */\n //#endif\n let wsize; /* window size or zero if not using window */\n let whave; /* valid bytes in the window */\n let wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n let s_window; /* allocated sliding window, if wsize != 0 */\n let hold; /* local strm.hold */\n let bits; /* local strm.bits */\n let lcode; /* local strm.lencode */\n let dcode; /* local strm.distcode */\n let lmask; /* mask for first level of length codes */\n let dmask; /* mask for first level of distance codes */\n let here; /* retrieved table entry */\n let op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n let len; /* match length, unused bytes */\n let dist; /* match distance */\n let from; /* where to copy match from */\n let from_source;\n\n\n let input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n const state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n //#ifdef INFLATE_STRICT\n dmax = state.dmax;\n //#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\" :\n // \"inflate: literal 0x%02x\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n //#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n //#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // if (len <= op - whave) {\n // do {\n // output[_out++] = 0;\n // } while (--len);\n // continue top;\n // }\n // len -= op - whave;\n // do {\n // output[_out++] = 0;\n // } while (--op > whave);\n // if (op === 0) {\n // from = _out - dist;\n // do {\n // output[_out++] = output[from++];\n // } while (--len);\n // continue top;\n // }\n //#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\"));\n state.mode = TYPE$1;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n const MAXBITS = 15;\n const ENOUGH_LENS$1 = 852;\n const ENOUGH_DISTS$1 = 592;\n //const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\n const CODES$1 = 0;\n const LENS$1 = 1;\n const DISTS$1 = 2;\n\n const lbase = new Uint16Array([ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n ]);\n\n const lext = new Uint8Array([ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n ]);\n\n const dbase = new Uint16Array([ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n ]);\n\n const dext = new Uint8Array([ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n ]);\n\n const inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>\n {\n const bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n let len = 0; /* a code's length in bits */\n let sym = 0; /* index of code symbols */\n let min = 0, max = 0; /* minimum and maximum code lengths */\n let root = 0; /* number of index bits for root table */\n let curr = 0; /* number of index bits for current table */\n let drop = 0; /* code bits to drop for sub-table */\n let left = 0; /* number of prefix codes available */\n let used = 0; /* code entries in table used */\n let huff = 0; /* Huffman code */\n let incr; /* for incrementing code, index */\n let fill; /* index for replicating entries */\n let low; /* low bits for current root entry */\n let mask; /* mask for low root bits */\n let next; /* next available space in table */\n let base = null; /* base value table to use */\n let base_index = 0;\n // let shoextra; /* extra bits table to use */\n let end; /* use base and extra for symbol > end */\n const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n let extra = null;\n let extra_index = 0;\n\n let here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES$1 || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES$1) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS$1) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n };\n\n\n var inftrees = inflate_table;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n var constants$1 = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n\n\n\n\n\n const CODES = 0;\n const LENS = 1;\n const DISTS = 2;\n\n /* Public constants ==========================================================*/\n /* ===========================================================================*/\n\n const {\n Z_FINISH: Z_FINISH$1, Z_BLOCK, Z_TREES,\n Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR,\n Z_DEFLATED\n } = constants$1;\n\n\n /* STATES ====================================================================*/\n /* ===========================================================================*/\n\n\n const HEAD = 1; /* i: waiting for magic header */\n const FLAGS = 2; /* i: waiting for method and flags (gzip) */\n const TIME = 3; /* i: waiting for modification time (gzip) */\n const OS = 4; /* i: waiting for extra flags and operating system (gzip) */\n const EXLEN = 5; /* i: waiting for extra length (gzip) */\n const EXTRA = 6; /* i: waiting for extra bytes (gzip) */\n const NAME = 7; /* i: waiting for end of file name (gzip) */\n const COMMENT = 8; /* i: waiting for end of comment (gzip) */\n const HCRC = 9; /* i: waiting for header crc (gzip) */\n const DICTID = 10; /* i: waiting for dictionary check value */\n const DICT = 11; /* waiting for inflateSetDictionary() call */\n const TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n const TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\n const STORED = 14; /* i: waiting for stored size (length and complement) */\n const COPY_ = 15; /* i/o: same as COPY below, but only first time in */\n const COPY = 16; /* i/o: waiting for input or output to copy stored block */\n const TABLE = 17; /* i: waiting for dynamic block table lengths */\n const LENLENS = 18; /* i: waiting for code length code lengths */\n const CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\n const LEN_ = 20; /* i: same as LEN below, but only first time in */\n const LEN = 21; /* i: waiting for length/lit/eob code */\n const LENEXT = 22; /* i: waiting for length extra bits */\n const DIST = 23; /* i: waiting for distance code */\n const DISTEXT = 24; /* i: waiting for distance extra bits */\n const MATCH = 25; /* o: waiting for output space to copy string */\n const LIT = 26; /* o: waiting for output space to write literal */\n const CHECK = 27; /* i: waiting for 32-bit check value */\n const LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\n const DONE = 29; /* finished check, done -- remain here until reset */\n const BAD = 30; /* got a data error -- remain here until reset */\n const MEM = 31; /* got an inflate() memory error -- remain here until reset */\n const SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n /* ===========================================================================*/\n\n\n\n const ENOUGH_LENS = 852;\n const ENOUGH_DISTS = 592;\n //const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\n const MAX_WBITS = 15;\n /* 32K LZ77 window */\n const DEF_WBITS = MAX_WBITS;\n\n\n const zswap32 = (q) => {\n\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n };\n\n\n function InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new Uint16Array(320); /* temporary storage for code lengths */\n this.work = new Uint16Array(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new Int32Array(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n }\n\n\n const inflateResetKeep = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS);\n state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\"));\n return Z_OK$1;\n };\n\n\n const inflateReset = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n };\n\n\n const inflateReset2 = (strm, windowBits) => {\n let wrap;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR$1;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n };\n\n\n const inflateInit2 = (strm, windowBits) => {\n\n if (!strm) { return Z_STREAM_ERROR$1; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n const state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n const ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK$1) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n };\n\n\n const inflateInit = (strm) => {\n\n return inflateInit2(strm, DEF_WBITS);\n };\n\n\n /*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\n let virgin = true;\n\n let lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\n\n const fixedtables = (state) => {\n\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n lenfix = new Int32Array(512);\n distfix = new Int32Array(32);\n\n /* literal/length table */\n let sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inftrees(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n };\n\n\n /*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\n const updatewindow = (strm, src, end, copy) => {\n\n let dist;\n const state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new Uint8Array(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n state.window.set(src.subarray(end - state.wsize, end), 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n state.window.set(src.subarray(end - copy, end), 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n };\n\n\n const inflate$1 = (strm, flush) => {\n\n let state;\n let input, output; // input/output buffers\n let next; /* next input INDEX */\n let put; /* next output INDEX */\n let have, left; /* available input and output */\n let hold; /* bit buffer */\n let bits; /* bits in bit buffer */\n let _in, _out; /* save starting available input and output */\n let copy; /* number of stored or match bytes to copy */\n let from; /* where to copy match bytes from */\n let from_source;\n let here = 0; /* current decoding table entry */\n let here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //let last; /* parent table entry */\n let last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n let len; /* length to copy for repeats, bits to drop */\n let ret; /* return code */\n const hbuf = new Uint8Array(4); /* buffer for gzip header crc calculation */\n let opts;\n\n let n; // temporary variable for NEED_BITS\n\n const order = /* permutation of code lengths */\n new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR$1;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK$1;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n\n // !!! pako patch. Force use `options.windowBits` if passed.\n // Required to always use max window size by default.\n state.dmax = 1 << state.wbits;\n //state.dmax = 1 << len;\n\n //Tracev((stderr, \"inflate: zlib header ok\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32_1(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Uint8Array(state.head.extra_len);\n }\n state.head.extra.set(\n input.subarray(\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n next + copy\n ),\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT$1;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n output.set(input.subarray(next, next + copy), put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n //#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracev((stderr, \"inflate: table sizes ok\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inffast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\" :\n // \"inflate: literal 0x%02x\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracevv((stderr, \"inflate: distance %u\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // Trace((stderr, \"inflate.c too far\"));\n // copy -= state.whave;\n // if (copy > state.length) { copy = state.length; }\n // if (copy > left) { copy = left; }\n // left -= copy;\n // state.length -= copy;\n // do {\n // output[put++] = 0;\n // } while (--copy);\n // if (state.length === 0) { state.mode = LEN; }\n // break;\n //#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END$1;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR$1;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR$1;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR$1;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH$1))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n };\n\n\n const inflateEnd = (strm) => {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR$1;\n }\n\n let state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK$1;\n };\n\n\n const inflateGetHeader = (strm, head) => {\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK$1;\n };\n\n\n const inflateSetDictionary = (strm, dictionary) => {\n const dictLength = dictionary.length;\n\n let state;\n let dictid;\n let ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR$1;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32_1(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR$1;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR$1;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\"));\n return Z_OK$1;\n };\n\n\n var inflateReset_1 = inflateReset;\n var inflateReset2_1 = inflateReset2;\n var inflateResetKeep_1 = inflateResetKeep;\n var inflateInit_1 = inflateInit;\n var inflateInit2_1 = inflateInit2;\n var inflate_2$1 = inflate$1;\n var inflateEnd_1 = inflateEnd;\n var inflateGetHeader_1 = inflateGetHeader;\n var inflateSetDictionary_1 = inflateSetDictionary;\n var inflateInfo = 'pako inflate (from Nodeca project)';\n\n /* Not implemented\n module.exports.inflateCopy = inflateCopy;\n module.exports.inflateGetDictionary = inflateGetDictionary;\n module.exports.inflateMark = inflateMark;\n module.exports.inflatePrime = inflatePrime;\n module.exports.inflateSync = inflateSync;\n module.exports.inflateSyncPoint = inflateSyncPoint;\n module.exports.inflateUndermine = inflateUndermine;\n */\n\n var inflate_1$1 = {\n \tinflateReset: inflateReset_1,\n \tinflateReset2: inflateReset2_1,\n \tinflateResetKeep: inflateResetKeep_1,\n \tinflateInit: inflateInit_1,\n \tinflateInit2: inflateInit2_1,\n \tinflate: inflate_2$1,\n \tinflateEnd: inflateEnd_1,\n \tinflateGetHeader: inflateGetHeader_1,\n \tinflateSetDictionary: inflateSetDictionary_1,\n \tinflateInfo: inflateInfo\n };\n\n const _has = (obj, key) => {\n return Object.prototype.hasOwnProperty.call(obj, key);\n };\n\n var assign = function (obj /*from1, from2, from3, ...*/) {\n const sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n const source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (const p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n };\n\n\n // Join array of chunks to single array.\n var flattenChunks = (chunks) => {\n // calculate data length\n let len = 0;\n\n for (let i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n const result = new Uint8Array(len);\n\n for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {\n let chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n };\n\n var common = {\n \tassign: assign,\n \tflattenChunks: flattenChunks\n };\n\n // String encode/decode helpers\n\n\n // Quick check if we can use fast array to bin string conversion\n //\n // - apply(Array) can fail on Android 2.2\n // - apply(Uint8Array) can fail on iOS 5.1 Safari\n //\n let STR_APPLY_UIA_OK = true;\n\n try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n // Table with utf8 lengths (calculated by first byte of sequence)\n // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n // because max possible codepoint is 0x10ffff\n const _utf8len = new Uint8Array(256);\n for (let q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n }\n _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n // convert string to array (typed, when possible)\n var string2buf = (str) => {\n if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {\n return new TextEncoder().encode(str);\n }\n\n let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n };\n\n // Helper\n const buf2binstring = (buf, len) => {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if (buf.subarray && STR_APPLY_UIA_OK) {\n return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));\n }\n }\n\n let result = '';\n for (let i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n };\n\n\n // convert array to string\n var buf2string = (buf, max) => {\n const len = max || buf.length;\n\n if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {\n return new TextDecoder().decode(buf.subarray(0, max));\n }\n\n let i, out;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n const utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n let c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n let c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n };\n\n\n // Calculate max possible position in utf8 buffer,\n // that will not break sequence. If that's not possible\n // - (very small limits) return max size as is.\n //\n // buf[] - utf8 bytes array\n // max - length limit (mandatory);\n var utf8border = (buf, max) => {\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n let pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n };\n\n var strings = {\n \tstring2buf: string2buf,\n \tbuf2string: buf2string,\n \tutf8border: utf8border\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n var messages = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n };\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n function ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n }\n\n var zstream = ZStream;\n\n // (C) 1995-2013 Jean-loup Gailly and Mark Adler\n // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n //\n // This software is provided 'as-is', without any express or implied\n // warranty. In no event will the authors be held liable for any damages\n // arising from the use of this software.\n //\n // Permission is granted to anyone to use this software for any purpose,\n // including commercial applications, and to alter it and redistribute it\n // freely, subject to the following restrictions:\n //\n // 1. The origin of this software must not be misrepresented; you must not\n // claim that you wrote the original software. If you use this software\n // in a product, an acknowledgment in the product documentation would be\n // appreciated but is not required.\n // 2. Altered source versions must be plainly marked as such, and must not be\n // misrepresented as being the original software.\n // 3. This notice may not be removed or altered from any source distribution.\n\n function GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n }\n\n var gzheader = GZheader;\n\n const toString = Object.prototype.toString;\n\n /* Public constants ==========================================================*/\n /* ===========================================================================*/\n\n const {\n Z_NO_FLUSH, Z_FINISH,\n Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR\n } = constants$1;\n\n /* ===========================================================================*/\n\n\n /**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n /* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n /**\n * Inflate.result -> Uint8Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n /**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n /**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n /**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\n function Inflate(options) {\n this.options = common.assign({\n chunkSize: 1024 * 64,\n windowBits: 15,\n to: ''\n }, options || {});\n\n const opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = inflate_1$1.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n\n this.header = new gzheader();\n\n inflate_1$1.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = inflate_1$1.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n }\n }\n }\n\n /**\n * Inflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer): input data\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE\n * flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,\n * `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. If end of stream detected,\n * [[Inflate#onEnd]] will be called.\n *\n * `flush_mode` is not needed for normal operation, because end of stream\n * detected automatically. You may try to use it for advanced things, but\n * this functionality was not tested.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\n Inflate.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n const dictionary = this.options.dictionary;\n let status, _flush_mode, last_avail_out;\n\n if (this.ended) return false;\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = inflate_1$1.inflate(strm, _flush_mode);\n\n if (status === Z_NEED_DICT && dictionary) {\n status = inflate_1$1.inflateSetDictionary(strm, dictionary);\n\n if (status === Z_OK) {\n status = inflate_1$1.inflate(strm, _flush_mode);\n } else if (status === Z_DATA_ERROR) {\n // Replace code with more verbose\n status = Z_NEED_DICT;\n }\n }\n\n // Skip snyc markers if more data follows and not raw mode\n while (strm.avail_in > 0 &&\n status === Z_STREAM_END &&\n strm.state.wrap > 0 &&\n data[strm.next_in] !== 0)\n {\n inflate_1$1.inflateReset(strm);\n status = inflate_1$1.inflate(strm, _flush_mode);\n }\n\n switch (status) {\n case Z_STREAM_ERROR:\n case Z_DATA_ERROR:\n case Z_NEED_DICT:\n case Z_MEM_ERROR:\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n // Remember real `avail_out` value, because we may patch out buffer content\n // to align utf8 strings boundaries.\n last_avail_out = strm.avail_out;\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === Z_STREAM_END) {\n\n if (this.options.to === 'string') {\n\n let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n let tail = strm.next_out - next_out_utf8;\n let utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail & realign counters\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);\n\n this.onData(utf8str);\n\n } else {\n this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));\n }\n }\n }\n\n // Must repeat iteration if out buffer is full\n if (status === Z_OK && last_avail_out === 0) continue;\n\n // Finalize if end of stream reached.\n if (status === Z_STREAM_END) {\n status = inflate_1$1.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return true;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n };\n\n\n /**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|String): output data. When string output requested,\n * each chunk will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\n Inflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n };\n\n\n /**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\n Inflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = common.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n };\n\n\n /**\n * inflate(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako');\n * const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));\n * let output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err) {\n * console.log(err);\n * }\n * ```\n **/\n function inflate(input, options) {\n const inflator = new Inflate(options);\n\n inflator.push(input);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) throw inflator.msg || messages[inflator.err];\n\n return inflator.result;\n }\n\n\n /**\n * inflateRaw(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\n function inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n }\n\n\n /**\n * ungzip(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\n var Inflate_1 = Inflate;\n var inflate_2 = inflate;\n var inflateRaw_1 = inflateRaw;\n var ungzip = inflate;\n var constants = constants$1;\n\n var inflate_1 = {\n \tInflate: Inflate_1,\n \tinflate: inflate_2,\n \tinflateRaw: inflateRaw_1,\n \tungzip: ungzip,\n \tconstants: constants\n };\n\n exports.Inflate = Inflate_1;\n exports.constants = constants;\n exports['default'] = inflate_1;\n exports.inflate = inflate_2;\n exports.inflateRaw = inflateRaw_1;\n exports.ungzip = ungzip;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n\n","/* noCompress */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}")),"/* gzipCompress */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}")),"/* parseChunk */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n"),"","/* worker */",_l].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}return()=>new Worker(this.workerSourceURL)}_createMesh(e,t){const{buffer:n,position:i,normal:r,texcoord:s,indice:o,sub_mesh:a}=e,l=new Uint32Array(n,o.byteOffset,o.length),c=new Float32Array(n,i.byteOffset,i.length),h=new Int8Array(n,r.byteOffset,r.length),d=new Float32Array(n,s.byteOffset,s.length),f=new J;f.setIndex(new $(l,1)),f.setAttribute("position",new $(c,3)),f.setAttribute("normal",new $(h,3,!0)),f.setAttribute("uv",new $(d,2));for(let e=0;e<a.length;e++){const{uuid:n,start:i,count:r}=a[e],s=this.loadedMaterialsMap.get(n);if(s){const{materialIndex:e}=s;f.addGroup(i,r,e)}else f.addGroup(i,r,0),rn(`sbmx material: not found uuid: ${n} in file: ${t+Ll}`)}const p=new u(f,this.loadedMaterials);return p.castShadow=!0,p.receiveShadow=!0,p}async _createMaterial(e){const t=vn(e),n=t+Ll,i=this.loadedTextures.get(n);if(i)return i;const r=await this.store.getItem(`${e}_texture`);let s;if(r)s=r,this.loadedTextures.set(n,Promise.resolve(s));else{const t=this.loadedTextures.get(n);if(t)return t;const i=xn(n).then((e=>e.json()));this.loadedTextures.set(n,i),s=await i,Bn((()=>{this.store.setItem(`${e}_texture`,s)}))}Object.entries(s).forEach((e=>{let[n,i]=e;if(this.loadedMaterialsMap.has(n))return;const{name:r,base_map:s,nor_map:o,alphamode:l,color:c={r:1,g:1,b:1,a:1},metallic:h=.5,roughness:u=.5}=i,{r:d,g:f,b:p,a:m}=c,v=0!==l,y=new g({name:r,color:new a(d,f,p),side:Q,metalness:h,roughness:u,opacity:m,transparent:v,depthWrite:!v});if(s){const e=t+s;(new Ae).load(e,(e=>{e.flipY=!0,e.encoding=T,e.wrapS=N,e.wrapT=N,e.minFilter=Ze,e.magFilter=U,e.needsUpdate=!0,y.map=e,y.needsUpdate=!0,el.needsUpdate=!0}))}if(o){const e=t+o;(new Ae).load(e,(e=>{e.flipY=!0,e.encoding=T,e.wrapS=N,e.wrapT=N,e.needsUpdate=!0,y.normalMap=e,y.needsUpdate=!0,el.needsUpdate=!0}))}const b=this.loadedMaterials.push(y)-1;this.loadedMaterialsMap.set(n,{material:y,materialIndex:b})}))}dispose(){this.workerPool.dispose(),URL.revokeObjectURL(this.workerSourceURL)}}const kl=new Map,Ul=e=>{var t;return null!==(t=null==e?void 0:e.toLowerCase().endsWith(".png"))&&void 0!==t&&t},jl=e=>{if(kl.has(e))return kl.get(e);const t=new l;return kl.set(e,t),(new Ke).load(e,(e=>{t.image=e,t.needsUpdate=!0,el.needsUpdate=!0})),t.encoding=T,t.wrapS=N,t.wrapT=N,t.flipY=!1,t.anisotropy=16,t.mipmaps=[],t.generateMipmaps=!0,t},zl=(e,t,n,i)=>{const[r,s,o,l,c]=t,h=i||l<1;return new g({name:e,color:new a(r,s,o),opacity:l,transparent:h,depthWrite:!h,alphaTest:.01,map:n,side:c})};class Fl extends DataView{constructor(e,t){super(e),this.isLE=!0,this.appKeys=t}byteRevers(e,t){const n=t%this.appKeys.length;return e^this.appKeys[n]}getSoonUint8(e){return this.byteRevers(this.getUint8(e),e)}getSoonUint16(e){const t=new DataView(new Uint8Array(2).buffer);for(let n=0;n<2;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getUint16(0,this.isLE)}getSoonUint32(e){const t=new DataView(new Uint8Array(4).buffer);for(let n=0;n<4;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getUint32(0,this.isLE)}getSoonFloat32(e){const t=new DataView(new Uint8Array(4).buffer);for(let n=0;n<4;n++)t.setUint8(n,this.getSoonUint8(e+n));return t.getFloat32(0,this.isLE)}}const Hl=new TextDecoder;new TextDecoder;class Gl{constructor(){this.materials=new Map}parseObject(e,t){const n=new ul(Object.assign(Object.assign({},t),{format:"sbm"})),i=new ll({id:zn()});n.add(i);const{materialsCache:r,meshsCache:s}=e;for(const[e,t]of Object.entries(r)){if(this.materials.has(e))continue;const{textureUrl:n,materialInfo:i}=t;let r=null;n&&(r=jl(n));const s=zl(e,i,r,Ul(n));this.materials.set(e,s)}for(const[e,t]of Object.entries(s)){const{meshName:n,materialId:r,position:s,uv:o}=t,a=this.materials.get(r.toString());if(a){const t=new J,r=new Float32Array(s),l=new Float32Array(o);r.length>0&&t.setAttribute("position",new $(r,3)),l.length>0&&t.setAttribute("uv",new $(l,2)),t.computeVertexNormals();const c=new sl(t,a,{id:`${e}_${zn()}`,name:n||e});i.add(c)}}return n}}var Vl=class{constructor(){this.materials=new Map,this.sbmInfo=null}async parseBuffer(e,t,n){this.sbmInfo=t;const i=new DataView(e);let r=0;const s=[];for(let e=0;e<8;e++)s.push(i.getUint8(r)),r+=1;if("SBK-----"!==String.fromCharCode(...s))return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})格式或数据错误!`);const o=[],a=[],l=[];for(let e=0;e<32;e++)o.push(i.getUint8(r)),r+=1;const c=i.getUint8(r);r+=1;const h=i.getUint8(r);r+=1;for(let e=0;e<32;e++)a.push(i.getUint8(r)),r+=1;for(let e=0;e<64;e++)l.push(i.getUint8(r)),r+=1;const u=[...a,...l,...o],d=[];for(let e=0;e<u.length;e++)(e<=7||e>23&&e<=31||e>39&&e<=55||e>63&&e<=87||e>95&&e<=103)&&d.push(u[e]);if(64!==d.length)return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url} 数据错误!`);if(1===c){const e=i.buffer.slice(r,i.buffer.byteLength),t=new Fl(e,d);return 1===h||2===h?this._parseV2(t,n):3===h?this._parseV3(t,n):Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})版本错误!`)}return Promise.reject(`In soonspacejs: sbm 资源模型(${this.sbmInfo.url})key 错误!`)}_parseV2(e,n){let i=0;const r=performance.now();i+=66;const s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new ul(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new ll({id:zn()});o.add(a);const l=e.getSoonUint16(i);i+=2;const c=e.getSoonUint16(i);i+=2,s.total=c;const h={};for(let t=0;t<l;++t){const t=e.getSoonUint16(i).toString();i+=2,h[t]={materialInfo:[]},i+=4,i+=4,i+=4,i+=4;const n=e.getSoonFloat32(i);i+=4;const r=e.getSoonFloat32(i);i+=4;const s=e.getSoonFloat32(i);i+=4;const o=e.getSoonFloat32(i);i+=4,i+=4,i+=4,i+=4,i+=4;let a=e.getSoonUint8(i);i+=1,0===a?a=Q:1===a?a=V:2===a&&(a=Y);const l=e.getSoonUint16(i);i+=2;let c=null;if(l>0){let n="",r="";for(let t=0;t<l;t++){const t=e.getSoonUint8(i);t>127?r=r+"%"+t.toString(16).toUpperCase():r.length>0?(n+=decodeURIComponent(r)+String.fromCharCode(t),r=""):n+=String.fromCharCode(t),i+=1}n=n.replace("\\","/");const{url:s,isPlatform:o}=this.sbmInfo,a=this.getTextureUrl(s,n,o);h[t].textureUrl=a,c=jl(a)}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=zl(t,e,c,Ul(h[t].textureUrl));this.materials.set(t,i),h[t].materialInfo=e}}const u={};for(let o=0;o<c;++o){const o=e.getSoonUint16(i);i+=2;const l=e.getSoonUint16(i).toString();i+=2,u[o]={materialId:l,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const c=[],h=[],d=[],f=[],p=e.getSoonUint16(i);if(i+=2,p>0)for(let n=0;n<p;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4,c.push(n)}const g=e.getSoonUint16(i);if(i+=2,g>0)for(let n=0;n<g;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4}const m=e.getSoonUint16(i);if(i+=2,m>0)for(let t=0;t<m;t++){const t=new w;t.setX(e.getSoonFloat32(i)),i+=4,t.setY(e.getSoonFloat32(i)),i+=4,h.push(t)}const v=e.getSoonUint16(i);if(i+=2,v>0)for(let t=0;t<v;t++){const t=e.getSoonUint16(i);i+=2;const n=e.getSoonUint16(i);i+=2;const r=e.getSoonUint16(i);i+=2;const s=[t,n,r];d.push(s),h.length>0&&f.push([h[s[0]],h[s[1]],h[s[2]]])}const y=[],b=[];for(let e=0;e<d.length;e++){const t=d[e],n=c[t[0]],i=c[t[1]],r=c[t[2]];y.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new w,o=new w,a=new w;const l=f[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),b.push(...s.toArray(),...o.toArray(),...a.toArray())}const A=new Float32Array(y),x=new Float32Array(b);u[o].position=A.buffer,u[o].uv=x.buffer;const S=new J;A.length>0&&S.setAttribute("position",new $(A,3)),x.length>0&&S.setAttribute("uv",new $(x,2)),S.computeVertexNormals();const E=this.materials.get(l);if(E){const e=new sl(S,E,{id:`${o}_${zn()}`,name:o.toString()});a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==n||n(s)}const d={materialsCache:h,meshsCache:u};return Promise.resolve({model:o,caches:d})}_parseV3(e,n){let i=0;i+=66;const r=performance.now(),s={total:0,loaded:0,timeStamp:0};if(!this.sbmInfo)return Promise.reject("In soonspacejs: sbm 模型资源解析时 'sbmInfo' 缺失!");const o=new ul(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new ll({id:zn()});o.add(a);const l=e.getSoonUint16(i);i+=2;const c=e.getSoonUint16(i);i+=2,s.total=c;const h={};for(let t=0;t<l;++t){const t=e.getSoonUint16(i).toString();i+=2,h[t]={materialInfo:[]},i+=4,i+=4,i+=4,i+=4;const n=e.getSoonFloat32(i);i+=4;const r=e.getSoonFloat32(i);i+=4;const s=e.getSoonFloat32(i);i+=4;const o=e.getSoonFloat32(i);i+=4,i+=4,i+=4,i+=4,i+=4;let a=e.getSoonUint8(i);i+=1,0===a?a=Q:1===a?a=V:2===a&&(a=Y);const l=e.getSoonUint16(i);i+=2;let c=null;if(l>0){let n="",r="";for(let t=0;t<l;t++){const t=e.getSoonUint8(i);t>127?r=r+"%"+t.toString(16).toUpperCase():r.length>0?(n+=decodeURIComponent(r)+String.fromCharCode(t),r=""):n+=String.fromCharCode(t),i+=1}n=n.replace("\\","/");const{url:s,isPlatform:o}=this.sbmInfo,a=this.getTextureUrl(s,n,o);h[t].textureUrl=a,c=jl(a)}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=zl(t,e,c,Ul(h[t].textureUrl));this.materials.set(t,i),h[t].materialInfo=e}}const u={};for(let o=0;o<c;++o){const o=e.getSoonUint16(i).toString();i+=2;const l=e.getSoonUint16(i);i+=2;let c="";if(l>0){const t=[];for(let n=0;n<l;n++){const n=e.getSoonUint8(i);t.push(n),i+=1}const n=new Uint8Array(t);c=Hl.decode(n)}const h=e.getSoonUint16(i).toString();i+=2,u[o]={meshName:c,materialId:h,position:new ArrayBuffer(0),uv:new ArrayBuffer(0)};const d=[],f=[],p=[],g=[],m=e.getSoonUint32(i);if(i+=4,m>0)for(let n=0;n<m;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4,d.push(n)}const v=e.getSoonUint32(i);if(i+=4,v>0)for(let n=0;n<v;n++){const n=new t;n.setX(e.getSoonFloat32(i)),i+=4,n.setY(e.getSoonFloat32(i)),i+=4,n.setZ(e.getSoonFloat32(i)),i+=4}const y=e.getSoonUint32(i);if(i+=4,y>0)for(let t=0;t<y;t++){const t=new w;t.setX(e.getSoonFloat32(i)),i+=4,t.setY(e.getSoonFloat32(i)),i+=4,f.push(t)}const b=e.getSoonUint32(i);if(i+=4,b>0)for(let t=0;t<b;t++){const t=e.getSoonUint32(i);i+=4;const n=e.getSoonUint32(i);i+=4;const r=e.getSoonUint32(i);i+=4;const s=[t,n,r];p.push(s),f.length>0&&g.push([f[s[0]],f[s[1]],f[s[2]]])}const A=[],x=[];for(let e=0;e<p.length;e++){const t=p[e],n=d[t[0]],i=d[t[1]],r=d[t[2]];A.push(...n.toArray(),...i.toArray(),...r.toArray());let s=new w,o=new w,a=new w;const l=g[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),x.push(...s.toArray(),...o.toArray(),...a.toArray())}const S=new Float32Array(A),E=new Float32Array(x);u[o].position=S.buffer,u[o].uv=E.buffer;const T=new J;if(S.length>0&&T.setAttribute("position",new $(S,3)),E.length>0&&T.setAttribute("uv",new $(E,2)),T.computeVertexNormals(),this.materials.has(h)){const e=new sl(T,this.materials.get(h),{id:`${o}_${zn()}`,name:c});a.add(e)}s.loaded++,s.timeStamp=performance.now()-r,null==n||n(s)}const d={materialsCache:h,meshsCache:u};return Promise.resolve({model:o,caches:d})}getTextureUrl(e,t,n){let i="",r=t;const s=r.lastIndexOf("/");if(-1!==s&&(r=r.substring(s+1)),i=e,n){const e=i.split("/");e.length>1&&(e.splice(e.length-3,e.length),i=e.join("/")+"/Maps/"+r)}else{const e=i.lastIndexOf("/");-1!==e&&(i=i.substring(0,e+1)+"Maps/"+r)}return i}};class Yl extends Cl{constructor(e,t){super(Xt,e,t),this.viewport=e,this.isDisposed=!1,this.modelsPromiseMap=new Map,this.modelsMap=new Map,this.store=Ml.createInstance({name:"soonspace",storeName:"modelData"}),this.cacheStore=Ml.createInstance({name:"soonspace",storeName:"modelCache"}),this.loadingManager=new k,this.datLoader=new Nl(this.cacheStore),this.gltfLoader=new Et(this.loadingManager),this.fbxLoader=new xt(this.loadingManager),this.dracoDecoderPath=null,this._initLoadingManager(this.loadingManager)}setDracoDecoderPath(e){this.dracoDecoderPath=e;const t=new Tt;t.setDecoderPath(e),this.gltfLoader.setDRACOLoader(t),this.datLoader.dracoDecoderPath=e}async load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scene;const{url:n}=e,i=this.modelsPromiseMap.get(n);if(i){if(await i,this.isDisposed)return this.dispose(),null;const r=this.modelsMap.get(n);return r?this.clone(r,e,t):null}const r=this._innerLoad(e,t);return this.modelsPromiseMap.set(n,r),r}async parse(e){const{url:t,id:n}=e;if(!t)return rn(`id: ${n} url: ${t} is empty`),null;switch(t.slice(t.lastIndexOf(".")+1).toLocaleUpperCase()){case"SBM":return this._parseSbm(e);case"SBMX":return this._parseSbmx(e);case"DAT":return this._parseDat(e);case"GLB":case"GLTF":return this._parseGltf(e);case"FBX":return this._parseFbx(e);default:return rn(`模型资源( id: ${n}, url: ${t} )格式错误,当前格式支持 sbm、sbmx、fbx、gltf、glb !`),null}}clone(e,t,n){return new Promise(((i,r)=>{var s;"Model"!==e.stype&&r("In soonspacejs: 方法 cloneModel 参入对象类型错误!");const{id:o,name:a,level:l,visible:c,position:h,rotation:u,scale:d,onClick:f,onDblClick:p,onRightClick:g,onLoad:m,userData:v}=t;function y(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)y(e.children[i],t.children[i],n)}const b=function(e){const t=new Map,n=new Map,i=e.sClone();return y(e,i,(function(e,i){t.set(i,e),n.set(e,i)})),i.traverse((function(e){if(e instanceof qe){const i=e,r=t.get(e),s=r.skeleton.bones;i.skeleton=r.skeleton.clone(),i.bindMatrix.copy(r.bindMatrix),i.skeleton.bones=s.map((function(e){return n.get(e)})),i.bind(i.skeleton,i.bindMatrix)}})),i}(e);b.animations=b.animations.map((e=>e.clone())),o&&(b.sid=o),a&&(b.name=a),l&&(b.level=l),!1===c&&b.hide(),h&&b.position.set(h.x,h.y,h.z),u&&b.rotation.set(u.x,u.y,u.z),d&&b.scale.set(d.x,d.y,d.z),b.onClick=f?f.bind(b):null,b.onDblClick=p?p.bind(b):null,b.onRightClick=g?g.bind(b):null,b.onLoad=m?m.bind(b):null,null===(s=b.onLoad)||void 0===s||s.call(b,b),v&&(b.userData=v),null!==n&&this.viewport.scener.addObject(b,n||this.scene||e.parent),i(b)}))}async loadToGroup(e,t){const n=this.createGroup(e,null);return await Promise.allSettled(t.map((e=>this.load(e,null).then((e=>e&&n.add(e))).catch(console.error)))),this.viewport.scener.addObject(n,this.scene),n}async addForGroup(e,t){return e&&await Promise.allSettled(t.map((async t=>this.load(t,null).then((t=>t&&this.viewport.scener.addObject(t,e))).catch(console.error)))),e}async clearIdb(){await this.store.clear(),await this.cacheStore.clear()}dispose(){var e;this.isDisposed=!0,this.modelsPromiseMap.clear(),this.modelsMap.clear(),null===(e=this.gltfLoader.dracoLoader)||void 0===e||e.dispose(),this.datLoader.dispose()}_initLoadingManager(e){e.addHandler(/\.tga$/i,new St)}_setModelsMap(e,t){this.modelsMap.has(e)||this.modelsMap.set(e,t)}async _parseSbm(e){const{useIndexedDB:t}=this.viewport.options,{url:n}=e,i=async t=>{const i=await(new Vl).parseBuffer(t,e),{model:r,caches:s}=i;return s&&Bn((()=>{this.cacheStore.setItem(n,s)})),r},r=e=>{var t;null===(t=e.onLoad)||void 0===t||t.call(e,e)};if(t){const t=await this.cacheStore.getItem(n);if(t){const n=(new Gl).parseObject(t,e);return r(n),n}{const e=await this.store.getItem(n)||await this._fetchBuffer(n),t=await i(e);return r(t),t}}{const e=await this._fetchBuffer(n),t=await i(e);return r(t),t}}async _parseSbmx(e){const{url:t}=e,n=await this._getBuffer(t),i=jn(n,0,8),r=new DataView(n.slice(8));switch(i){case"SBMG----":for(let e=0;e<r.byteLength;e++){const t=r.getUint8(e),n=(t>>4&15)+(t<<4&240);r.setUint8(e,n)}return this._parseGltf(e,r.buffer);case"SBMD----":return this._parseDat(e,r.buffer);default:return this._parseGltf(e,r.buffer)}}async _parseDat(e,t){const{url:n}=e,i=t||await this._getBuffer(n),r=new ul(Object.assign(Object.assign({},e),{format:"dat"})),s=await this.datLoader.parseAsync(i,n);return s&&r.add(s),r}async _parseGltf(e,t){const{url:n}=e,i=vn(n),r=t||await this._getBuffer(n),s=new ul(Object.assign(Object.assign({},e),{format:"gltf"})),o=await this.gltfLoader.parseAsync(r,i),{animations:a}=o;return a&&a.length>0&&(s.animations=a),o.scene.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e.castShadow=!0,e.receiveShadow=!0})),s.add(o.scene),s}async _parseFbx(e){const{url:t}=e,n=vn(t),i=await this._getBuffer(t),r=new ul(Object.assign(Object.assign({},e),{format:"gltf"})),s=this.fbxLoader.parse(i,n),{animations:o}=s;return o&&o.length>0&&(r.animations=o),s.traverse((e=>{"AmbientLight"!==e.type&&"DirectionalLight"!==e.type||(e.visible=!1),e.castShadow=!0,e.receiveShadow=!0})),r.add(s),r}async _innerLoad(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.scene;var n;const{url:i}=e,r=await this.parse(e);return r?(null===(n=r.onLoad)||void 0===n||n.call(r,r),this._setModelsMap(i,r.sClone()),null!==t&&this.viewport.scener.addObject(r,t),r):null}async _fetchBuffer(e){const{useIndexedDB:t}=this.viewport.options,n=await xn(e),i=await n.arrayBuffer();return t&&this.store.setItem(e,i),i}async _getBuffer(e){const{useIndexedDB:t}=this.viewport.options;if(t){const t=await this.store.getItem(e);return t||this._fetchBuffer(e)}return this._fetchBuffer(e)}}class Ql extends Cl{constructor(e,t){super(Zt,e,t),this.materials=new Map}create(e){const t=this._createMaterial(e.url),n=new pl(t,e);return this.viewport.scener.addObject(n,this.scene),n}clone(e,t,n){"Poi"!==e.stype&&console.error("In soonspacejs: 方法 clonePoi 参入对象类型错误!");const{id:i,type:r,name:s,level:o,visible:a,position:l,rotation:c,scale:h,onClick:u,onDblClick:d,onRightClick:f,userData:p}=t,g=e.sClone(!1,r);return this._copyMaterial(g),i&&(g.sid=i),s&&(g.name=s),o&&(g.level=o),Rn(a)&&(g.visible=a),l&&g.position.set(l.x,l.y,l.z),c&&g.rotation.set(c.x,c.y,c.z),h&&g.scale.set(h.x,h.y,h.z),g.onClick=u?u.bind(g):null,g.onDblClick=d?d.bind(g):null,g.onRightClick=f?f.bind(g):null,p&&(g.userData=p),null!==n&&this.viewport.scener.addObject(g,n||this.scene||e.parent),g}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=this._createMaterial(e.url),i=new pl(t,e);n.add(i)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{const n=this._createMaterial(t.url),i=new pl(n,t);e.add(i)})),this.viewport.scener.addObject(e,this.scene)),e}_createMaterial(e){const t=this.materials.get(e);if(!t){const t=(new Ae).load(e);t.flipY=!0;const n=new Le({map:t,color:16777215});return this.materials.set(e,n),n}return t}_copyMaterial(e){e.traverse((e=>{(e instanceof u||e instanceof _e)&&(Ln(e.material)?e.material=e.material.map((e=>e.clone())):e.material instanceof ee&&(e.material=e.material.clone()))}))}}class Wl extends Cl{constructor(e,t){super(Kt,e,t)}create(e){this._openEnableRenderCss(e);const t=new hl(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{this._openEnableRenderCss(e);const t=new hl(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{this._openEnableRenderCss(t);const n=new hl(t);e.add(n)})),this.viewport.scener.addObject(e,this.scene)),e}_openEnableRenderCss(e){switch(e.type){case"2d":case"2D":this.viewport.rendererManager.setInternalState("enableRenderCss2D",!0);break;case"2.5d":case"2.5D":case"3d":case"3D":this.viewport.rendererManager.setInternalState("enableRenderCss3D",!0)}}}class Xl extends Cl{constructor(e,t){super(qt,e,t)}create(e){const t=new El(e);return this.viewport.scener.addObject(t,this.scene),t}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=new El(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{const n=new El(t);e.add(n)})),this.viewport.scener.addObject(e,this.scene)),e}}class Zl{constructor(){this.graph=new Map,this.queue=null,this.previous=new Map}setGraph(e){if(!(e.length<1))for(const t of e){const[e,n]=t;this.graph.set(e,new Map);for(const t of n){const[n,i]=t,r=this.graph.get(e);null==r||r.set(n,i)}}}getPath(e,t){var n;if(e===t)return[];const i=this.queue=new pn;i.add(e,0),this.previous.set(e,null);let r=null;for(;r=i.shift();){if(r===t){const e=[];for(;null!==r&&null!==this.previous.get(r);)e.unshift(r),r=null!==(n=this.previous.get(r))&&void 0!==n?n:null;return e}const e=i.getDistance(r);if(e===1/0)return[];const s=this.graph.get(r);s&&s.forEach(((t,n)=>{const s=i.getDistance(n),o=e+t;o<s&&(i.update(n,o),this.previous.set(n,r))}))}return[]}}class Kl extends Cl{constructor(e,t){super(Jt,e,t),this.dijkstra=new Zl}async createFromGml(e){const{url:t,linkWidth:n=20,linkColor:i=65280,renderNode:r=!0,nodeColor:s=255}=e;return Mn(t).then((t=>{if(!t||!t.MultiLayeredGraph)return Promise.reject('In soonspace: createTopologyFromGml "url" path error!');const o=[],a=new Map;let l=[],c=[];const h=t.MultiLayeredGraph.SpaceLayerMember.SpaceLayer.X_floor;Ln(h)?h.forEach((e=>{l=[...l,...e.state],c=[...c,...e.transition]})):(l=[...l,...h.state],c=[...c,...h.transition]),l.forEach(((e,t)=>{const n=e.State._attributes["gml:id"],i=e.State.topoNode["gml:Node"].node_name;o.push({id:Pn(n)?n:"",name:Pn(i)?i:"",position:{x:Number(e.State.topoNode["gml:Node"].xcoord["#text"]),y:Number(e.State.topoNode["gml:Node"].zcoord["#text"]),z:-1*Number(e.State.topoNode["gml:Node"].ycoord["#text"])},graphs:[]}),a.set(n,t)})),c.forEach((e=>{const t=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][0]._attributes["xlink:href"],n=e.Transition.topoEdge["gml:Edge"]["gml:directedNode"][1]._attributes["xlink:href"],i=e.Transition.topoEdge["gml:Edge"].restrict["#text"],r=e.Transition.topoEdge["gml:Edge"].passable["#text"],s=a.get(t),l=a.get(n),c=e.Transition._attributes["gml:id"],h=e.Transition.topoEdge["gml:Edge"].link_name["#text"];void 0!==s&&void 0!==l&&("2"!==r&&"3"!==r&&o[s].graphs.push({targetNodeId:n,linkInfo:{id:c,name:h},enable:!0,restrict:parseInt(i),passable:parseInt(r)}),"1"!==r&&"3"!==r&&o[l].graphs.push({targetNodeId:t,linkInfo:{id:c,name:h},enable:!0,restrict:parseInt(i),passable:parseInt(r)}))}));const u=new bl(Object.assign(Object.assign({},e),{type:"network",nodes:o,linkWidth:n,renderLink:!0,linkColor:i,renderNode:r,nodeColor:s}));return this.setDijkstraGraph(u.nodes),this.viewport.scener.addObject(u,this.scene),Promise.resolve(u)}))}create(e){const t=this.generateLineTopologyInfoNodeGraphs(e),n=new bl(t);return this.setDijkstraGraph(n.nodes),this.viewport.scener.addObject(n,this.scene),n}resetNodes(e,t){const n=this.generateLineTopologyInfoNodeGraphs(Object.assign(Object.assign({},e.info),{nodes:t}));return e.resetNodes(n.nodes),this.viewport.signals.objectChanged.dispatch(),e}createToGroup(e,t){const n=this.createGroup(e,null);return t.forEach((e=>{const t=this.generateLineTopologyInfoNodeGraphs(e),i=new bl(t);this.setDijkstraGraph(i.nodes),n.add(i)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&t.forEach((t=>{const n=this.generateLineTopologyInfoNodeGraphs(t),i=new bl(n);this.setDijkstraGraph(i.nodes),e.add(i)})),e}getShortestPath(e,n){const i=yn(e.info.nodes),r=sn(n.start),s=sn(n.end);let o=null,a=1/0,l=null,c=1/0;for(let n=0;n<i.length;n++){const h=i[n];if(0===h.graphs.length)continue;const u=e.nodes.find((e=>e.sid===h.id));if(!u)continue;const d=u.getWorldPosition(new t),f=d.distanceTo(r),p=d.distanceTo(s);f<a&&(a=f,o=h),p<c&&(c=p,l=h)}if(!o||!l||o.id===l.id)return null;const h=o.id,u=l.id,d=this.dijkstra.getPath(h,u);if(0===d.length)return null;d.unshift(o.id);const f=[];for(let e=0;e<d.length;e++){const t=i.find((t=>t.id==d[e]));t&&(t.id+=zn(),t.position.y+=.01,f.push(t))}const p=Object.assign(Object.assign(Object.assign({},n),{type:"line",nodes:f}),e.getSpaceAttribute(!0));this.generateLineTopologyInfoNodeGraphs(p);const g=new bl(p);return this.viewport.scener.addObject(g,this.scene),g}getShortestPathByMultipleStartPoints(e,i){const{nodes:s}=e.info,o=[];i.start.forEach((e=>{const t=sn(e),n=sn(i.end);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=sn(e.position),s=i.distanceTo(t),o=i.distanceTo(n);s<a&&(a=s,r=e.id),o<c&&(c=o,l=e.id)}})),r&&l){let e=0;const i=this.dijkstra.getPath(r,l);if(i.length>0){const r=[{id:"startPoint",position:t,graphs:[]}];i.forEach(((n,i)=>{const o=s.find((e=>e.id==n));o&&(e+=0===i?sn(o.position).distanceTo(t):sn(o.position).distanceTo(sn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(sn(r[r.length-1].position)),o.push({nodeInfo:r,pathLength:e})}}}));let a=[],l=1/0;if(o.forEach((e=>{let{nodeInfo:t,pathLength:n}=e;n<l&&(l=n,a=t)})),a.length){for(let e=0;e<a.length;e++)a[e].position.y+=.01;const s=Object.assign(Object.assign({},i),{type:"line",nodes:a,position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)});this.generateLineTopologyInfoNodeGraphs(s);const o=new bl(s);return this.viewport.scener.addObject(o,this.scene),o}return null}getShortestPathByMultipleEndPoints(e,i){const{nodes:s}=e.info,o=[];i.end.forEach((e=>{const t=sn(i.start),n=sn(e);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=sn(e.position),s=i.distanceTo(t),o=i.distanceTo(n);s<a&&(a=s,r=e.id),o<c&&(c=o,l=e.id)}})),r&&l){let e=0;const i=this.dijkstra.getPath(r,l);if(i.length>0){const r=[{id:"startPoint",position:t,graphs:[]}];i.forEach(((n,i)=>{const o=s.find((e=>e.id==n));o&&(e+=0===i?sn(o.position).distanceTo(t):sn(o.position).distanceTo(sn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(sn(r[r.length-1].position)),o.push({nodeInfo:r,pathLength:e})}}}));let a=[],l=1/0;if(o.forEach((e=>{let{nodeInfo:t,pathLength:n}=e;n<l&&(l=n,a=t)})),a.length){for(let e=0;e<a.length;e++)a[e].position.y+=.01;const s=Object.assign(Object.assign({},i),{type:"line",nodes:a,position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)});this.generateLineTopologyInfoNodeGraphs(s);const o=new bl(s);return this.viewport.scener.addObject(o,this.scene),o}return null}setDijkstraGraph(e){const n=[];for(let i=0;i<e.length;i++){const r=e[i];if(0===r.graphs.length)continue;const s=[];for(let n=0;n<r.graphs.length;n++){const i=r.graphs[n],o=e.find((e=>e.sid===i.targetNodeId));if(!o)continue;const a=r.getWorldPosition(new t),l=o.getWorldPosition(new t);s.push([i.targetNodeId,a.distanceTo(l)])}n.push([r.sid,s])}n.length>0&&this.dijkstra.setGraph(n)}generateLineTopologyInfoNodeGraphs(e){const{type:t,nodes:n}=e;if("line"===t)for(let t=0;t<n.length;t++)if(t===n.length-1)n[t].graphs=[];else{const i=e.nodes[t],r=e.nodes[t+1];n[t].graphs=[{targetNodeId:r.id,linkInfo:{id:`${i.id}_to_${r.id}`,name:`${i.name||i.id}_to_${r.name||r.id}`},enable:!0,restrict:0,passable:0}]}return Object.assign(Object.assign({},e),{nodes:n})}}class ql extends Cl{constructor(e,t){super($t,e,t)}addGridHelper(e){const{id:t,size:n=1e3,divisions:i=20,color:r="#fff",position:s={x:0,y:0,z:0},rotation:o={x:0,y:0,z:0},scale:a={x:1,y:1,z:1}}=e,l=new Je(n,i,r,r);return l.position.set(s.x,s.y,s.z),l.rotation.set(o.x,o.y,o.z),l.scale.set(a.x,a.y,a.z),l.userData.sid=t,l.userData.stype="Helper",this.viewport.scener.addObject(l,this.scene),l}addAxesHelper(e){const{id:t,axesLength:n=1e3}=e,i=new $e(n);return i.userData.sid=t,i.userData.stype="Helper",this.viewport.scener.addObject(i,this.scene),i}addBoxHelper(e){const{id:t,box:n,color:i="#00ff00"}=e,r=new et(n,new a(i));return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addPlaneHelper(e){const{id:t,width:n=500,height:i=500,color:r="#00ff00",opacity:s=.2,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1}}=e,c=new sl(new Se(n,i),new xe({color:r,opacity:s,transparent:s<1,side:Y}),{id:t,position:o,rotation:a,scale:l});return c.userData.sid=t,c.userData.stype="Helper",this.viewport.scener.addObject(c,this.scene),c}addGroundHelper(e){const{imgUrl:t,id:n,width:i=500,height:r=500,opacity:s=1,position:o={x:0,y:0,z:0},rotation:a={x:0,y:0,z:0},scale:l={x:1,y:1,z:1},repeat:c={x:10,y:10}}=e,h=(new Ae).load(t),u=new Se(i,r);u.computeBoundingBox();const d=new g({side:Y,map:h,transparent:s<1,opacity:s,roughness:.8});d.map&&(d.map.repeat.set(c.x,c.x),d.map.wrapS=N,d.map.wrapT=N,d.map.version++),a.x-=Math.PI/2,d.version++;const f=new Tl(u,d,{id:n,position:o,rotation:a,scale:l});return f.userData.sid=n,f.userData.stype="Helper",this.viewport.scener.addObject(f,this.scene),f}addDirectionalLightHelper(e){const{id:t,light:n,color:i,size:r=50}=e,s=new tt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addHemisphereLightHelper(e){const{id:t,light:n,color:i,size:r=20}=e,s=new nt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addSpotLightHelper(e){const{id:t,light:n,color:i}=e,r=new it(n,i);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}addPointLightHelper(e){const{id:t,light:n,color:i,size:r=20}=e,s=new rt(n,r,i);return s.userData.sid=t,s.userData.stype="Helper",this.viewport.scener.addObject(s,this.scene),s}addRectAreaLightHelper(e){const{id:t,light:n,color:i}=e,r=new Dt(n,i);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}}class Jl extends Cl{constructor(e,t){super(en,e,t)}createObject(e,t){const n=new cl(e);return t&&n.add(t),this.viewport.scener.addObject(n,this.scene),n}addToObject(e,t){return e?(this.viewport.scener.addObject(t,e),e):null}}class $l extends Cl{constructor(e,t){super(Qt,e,t)}}class ec{constructor(e){this.viewport=e,this.cache={objects:new Map,classified:{Group:new Set,Light:new Set,Model:new Set,Poi:new Set,PoiNode:new Set,Canvas3D:new Set,Topology:new Set,Helper:new Set,PluginObject:new Set}},this.scene=e.scene,this.store={groupManager:new $l(e,this.scene),lightManager:new Bl(e,this.scene),modelManager:new Yl(e,this.scene),poiManager:new Ql(e,this.scene),poiNodeManager:new Wl(e,this.scene),canvas3DManager:new Xl(e,this.scene),topologyManager:new Kl(e,this.scene),helperManager:new ql(e,this.scene),pluginObjectManager:new Jl(e,this.scene)},e.postUpdate.set("ManagerRender",this.update.bind(this)),e.signals.objectAdded.add(this.setObjectCache.bind(this)),e.signals.objectRemoved.add(this.deleteObjectCache.bind(this))}levelUpdate(){const e=(e,t)=>{e.visible!==t&&(e.visible=t,e.matrixAutoUpdate=t,e.autoUpdate=!0)},t=t=>{const{level:n,handleHide:i,autoUpdate:r}=t,{max:s=null,min:o=null}=n;if(r)t.autoUpdate=!1,this.viewport.signals.objectChanged.dispatch();else if(!i&&(_n(s)||_n(o))){const n=this.viewport.camera.position.distanceTo(t.position);_n(s)&&n>s||_n(o)&&n<o?e(t,!1):e(t,!0)}};this.scene.traverse((e=>{(e instanceof al||e instanceof sl)&&t(e)}))}update(){if(0===this.scene.children.length)return;const e=performance.now();this.viewport.options.levelEnabled&&this.levelUpdate(),this.viewport.signals.loadRendered.dispatch(performance.now()-e)}isObjectInScene(e){let t=!1;return e.traverseAncestors((e=>{e===this.scene&&(t=!0)})),t}getObjectById(e){const t=this.getObjectCache(e);if(t){if(this.isObjectInScene(t))return t}return null}getObjectByName(e){return this._getObjectByProps("name",e)}getObjectByUserDataProperty(e,t){const n=[];return this.cache.objects.forEach((i=>{this.isObjectInScene(i)&&Nn(i)&&(i instanceof al||i instanceof sl||i.userData.stype)&&(kn(e)&&e(i.userData)||Pn(e)&&i.userData[e]===t)&&n.push(i)})),n}removeObjectById(e){const t=this.getObjectById(e);return!!t&&(this.viewport.scener.removeObject(t),!0)}_getObjectByProps(e,t){const n=[];return this.cache.objects.forEach((i=>{this.isObjectInScene(i)&&((i instanceof al||i instanceof sl)&&Nn(i)&&i[e]===t||Nn(i)&&i.userData.stype&&("name"===e&&i.name===t||"sid"===e&&i.userData.sid===t))&&n.push(i)})),n}getObjectCache(e){return this.cache.objects.get(e)}setObjectCache(e){const t=(e,t)=>{const n=this.cache.objects.get(t);n&&n!==e&&rn(`object id ${t} already exists in scene`)};null==e||e.traverse((n=>{if(n instanceof al||n instanceof sl){if("string"==typeof n.sid&&n.sid.startsWith(Yt))return;t(n,n.sid),this.cache.objects.set(n.sid,n);const e=n.stype;this.cache.classified[e]&&this.cache.classified[e].add(n)}else if(n.userData.sid&&e.userData.stype){t(n,n.userData.sid),this.cache.objects.set(n.userData.sid,n);const e=n.userData.stype;this.cache.classified[e]&&this.cache.classified[e].add(n)}}))}deleteObjectCache(e){null==e||e.traverse((t=>{if(t instanceof al||t instanceof sl){this.cache.objects.delete(t.sid);const e=t.stype;this.cache.classified[e]&&this.cache.classified[e].delete(t)}else if(t.userData.sid&&e.userData.stype){this.cache.objects.delete(t.userData.sid);const e=t.userData.stype;this.cache.classified[e]&&this.cache.classified[e].delete(t)}}))}clearObject(){this.store.modelManager.clear(),this.store.poiManager.clear(),this.store.poiNodeManager.clear(),this.store.canvas3DManager.clear(),this.store.topologyManager.clear(),this.store.helperManager.clear(),this.store.pluginObjectManager.clear()}clear(){this.clearObject(),this.store.lightManager.clear()}dispose(){this.store.modelManager.dispose(),this.cache.objects.clear(),this.clear()}}function tc(e){const t=nc(e),n=new m;n.setFromMatrix3(t);const i=e[0],r=n.clone();r.setPosition(i);const s=r.clone().invert(),o=e.map((e=>{const t=e.clone().applyMatrix4(s);return new w(t.x,t.y)})),a=new ze(o),l=new je(a),c=new st;c.setFromPoints(o);const h=ic(c);return l.getAttribute("uv").applyMatrix3(h),l.applyMatrix4(n),{geometry:l,polygonBox:c,modelMatrix:n,planeMatrix:r,projectionMatrix:s,position:i}}function nc(e){const[n,i,r]=e,s=new ot;s.setFromCoplanarPoints(i,n,r);const o=s.normal,a=o.clone().cross(new t(0,0,1));a.equals(new t)&&a.set(1,0,0);const l=o.clone().cross(a);a.normalize(),l.normalize(),o.normalize();const c=new ue;return c.elements=[a.x,a.y,a.z,l.x,l.y,l.z,o.x,o.y,o.z],c}function ic(e){const t=e.min,n=e.getSize(new w),i=new ue;return i.elements=[n.x,0,0,0,n.y,0,t.x,t.y,1],i.invert()}function rc(e,t){const n=sc(t);return e.intersectsBox(n)}function sc(e){const n=new i,r=n.min.clone(),s=n.max.clone();if(n.setFromObject(e),n.min.equals(r)&&n.max.equals(s)){const i=new t;e.getWorldPosition(i),n.min.copy(i),n.max.copy(i)}if(e.isInstancedMesh){const{count:t,matrixWorld:i,geometry:r}=e;let s=r.boundingBox;if(s||(r.computeBoundingBox(),s=r.boundingBox),s){const r=i.clone();for(let i=0;i<t;i++){const t=new m;e.getMatrixAt(i,t),t.premultiply(r);const o=s.clone();o.applyMatrix4(t),n.union(o)}}}return n}function oc(e,t,n){if("string"==typeof e){let i=t?null==n?void 0:n.get(e):null;if(!i){i=(new Ae).load(e),null==n||n.set(e,i)}return i}return e instanceof HTMLImageElement?new l(e):e instanceof HTMLCanvasElement?new at(e):new pe(e)}function ac(e,t,n,i){const r=e.map,s=oc(t,n,i);if(!r)return e.map=s,s;const o=s.source;return s.copy(r),s.source=o,e.map=s,s}function lc(e,n){const{top:r,left:s,bottom:o,right:a,front:l,back:c}=e,h=new t(a,r,l),u=new t(s,o,c),d=new i;return function(e){return d.max.addVectors(e,h),d.min.subVectors(e,u),n.filter((e=>rc(d,e)))}}function cc(e,n){const i=new S(new t,e);return function(e){return i.center.copy(e),n.filter((e=>rc(i,e)))}}function hc(e,n){const i=e.length-1,r=[];for(let t=0;t<i;t++){const n=e[t],i=e[t+1],s=new lt(n,i);r.push(s)}const s=new S(new t,n);return function(e){return e.filter((e=>{const n=sc(e),i=new t;n.getCenter(i);const o=r.filter((e=>{const t=e.closestPointToPointParameter(i);return 0<=t||t>=1}));if(0===o.length)return!1;let a=1/0,l=i;for(const e of o){const n=e.closestPointToPoint(i,!0,new t),r=i.distanceToSquared(n);r<a&&(a=r,l=n)}return s.center.copy(l),s.intersectsBox(n)}))}}function uc(e,t){const{image:n,color:i,width:r,height:s,position:o,rotation:a,needLight:l,id:c,name:h,userData:u,level:d,visible:f,cache:p}=e,g=Jn(e,["image","color","width","height","position","rotation","needLight","id","name","userData","level","visible","cache"]),m=new Se(r,s),v=n?Object.assign(Object.assign({transparent:!0},g),{map:oc(n,null==p||p,t)}):g,y=l?new ct(v):new xe(v),b=new sl(m,y,{id:c,name:h,userData:u,level:d,visible:f});return o&&b.position.set(o.x,o.y,o.z),a&&b.rotation.set(a.x,a.y,a.z),b}function dc(e,n){const{points:i,image:r,color:s,needLight:o,id:a,name:l,userData:c,level:h,visible:u,cache:d}=e,f=Jn(e,["points","image","color","needLight","id","name","userData","level","visible","cache"]),p=i.map((e=>new t(e.x,e.y,e.z))),g=r?Object.assign(Object.assign({transparent:!0},f),{map:oc(r,null==d||d,n)}):f,m=o?new ct(g):new xe(g),{geometry:v,position:y}=tc(p),b=new sl(v,m,{id:a,name:l,userData:c,level:h,visible:u});return b.position.copy(y),b}class fc{constructor(t){this.THREE=e,this.TWEEN=Vt,this.utils=Hn,this.version=It,this.animation=Vn,this.library=Dl,this.plugins={},this.textureCache=new Map;const{el:n,options:i={},events:r={}}=t;if(this.domElement=document.querySelector(n),this.options=Object.assign(Object.assign({},{showInfo:!1,showStats:!1,showViewHelper:!1,showGrid:!1,background:{color:11459572,alpha:!1},fog:!1,controls:{type:"free"},hoverEnabled:!1,levelEnabled:!1,closeInfoLog:!1,closeWarnLog:!1,useIndexedDB:!0,logarithmicDepthBuffer:!0}),i),this.viewport=new rl(this.options),this.signals=this.viewport.signals,this.manager=new ec(this.viewport),!this.domElement)throw new Error(`In SoonSpace: Can't find element by "${n}"!`);this.domElement.appendChild(this.viewport.container),this._init(),this._initEvents(r),this._initDefaultSettings()}_init(){const{showGrid:e,background:t,fog:n,controls:i,closeInfoLog:r,closeWarnLog:s,useIndexedDB:o}=this.options;if(!r){nn(" ____ ____ _ \n / ___| ___ ___ _ __ / ___| _ __ __ _ ___ ___ (_)___ \n \\___ \\ / _ \\ / _ \\| '_ \\\\___ \\| '_ \\ / _` |/ __/ _ \\ | / __| \n ___) | (_) | (_) | | | |___) | |_) | (_| | (_| __/_ | \\__ \\ \n |____/ \\___/ \\___/|_| |_|____/| .__/ \\__,_|\\___\\___(_)/ |___/ \n |_| |__/ \n",{color:"#3eaf7c"}),nn(Bt,{color:"#3eaf7c","font-size":"24px"}),nn(`当前版本: ${this.version}`,{color:"#3eaf7c","font-size":"12px"}),nn("文档: http://www.xwbuilders.com:8800",{color:"#3eaf7c","font-size":"12px"}),nn("样例: http://www.xwbuilders.com:8800/examples",{color:"#3eaf7c","font-size":"12px"}),nn("GitHub: https://github.com/soonspacejs",{color:"#3eaf7c","font-size":"12px"})}e&&this.addGridHelper(!0===e?{id:"defaultGridHelper"}:e),(null==t?void 0:t.skyBox)?Pn(null==t?void 0:t.skyBox)?this.setSphereSkyBackground(null==t?void 0:t.skyBox):Nn(null==t?void 0:t.skyBox)&&this.setSkyBackground(t.skyBox.dirPath,t.skyBox.fileNames):(null==t?void 0:t.img)?this.setBackgroundImage(t.img):(null==t?void 0:t.color)&&this.setBackgroundColor(t.color),n&&this.openSceneFog(!0===n?void 0:n),i&&this.setControlsOptions(i),s&&(window.console.warn=function(){}),o&&!window.indexedDB&&(this.options.useIndexedDB=!1,window.console.warn("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available."))}_initEvents(e){const{modelHover:t,modelUnHover:n,modelClick:i,modelRightClick:r,modelDblClick:s,poiHover:o,poiUnHover:a,poiClick:l,poiRightClick:c,poiDblClick:h,selectPosition:u,sceneClick:d,resize:f}=e;t&&this.signals.modelHover.add(t),n&&this.signals.modelUnHover.add(n),i&&this.signals.modelClick.add(i),r&&this.signals.modelRightClick.add(r),s&&this.signals.modelDblClick.add(s),o&&this.signals.poiHover.add(o),a&&this.signals.poiUnHover.add(a),l&&this.signals.poiClick.add(l),c&&this.signals.poiRightClick.add(c),h&&this.signals.poiDblClick.add(h),u&&this.signals.selectPosition.add(u),d&&this.signals.sceneClick.add(d),f&&this.signals.windowResize.add(f),this.signals.windowResize.dispatch(),window.addEventListener("resize",(()=>this.signals.windowResize.dispatch()),!1)}_initDefaultSettings(){this.setEnvironment(),this.setColorSpace("sRGB"),this.setToneMapping({type:"ACESFilmic",exposure:.8})}registerPlugin(e,t){const n=new e(this);return this.plugins[t]=n,n}getPlugin(e){return this.plugins[e]?this.plugins[e]:null}createPluginObject(e,t){return this.manager.store.pluginObjectManager.createObject(e,t)}addToPluginObject(e,t){const n=this.getObjectById(e);return this.manager.store.pluginObjectManager.addToObject(n,t)}getPluginObjectById(e){return rn("getPluginObjectById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPluginObjectByName(e){return rn("getPluginObjectByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}removePluginObjectById(e){return rn("removePluginObjectById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}setSSR(e){this.viewport.setSSR(e)}setBloom(e){this.viewport.setBloom(e)}setSSAO(e){this.viewport.setSSAO(e)}setColorSpace(e){this.viewport.setColorSpace(e)}setToneMapping(e){this.viewport.setToneMapping(e)}setHoverEnabled(e){this.viewport.setHoverEnabled(e)}setBackgroundColor(e){this.viewport.setBackgroundColor(e)}setBackgroundColorAlpha(e,t){this.viewport.setBackgroundColorAlpha(e,t)}setBackgroundImage(e){return this.viewport.setBackgroundImage(e)}setSphereSkyBackground(e){return this.viewport.setSphereSkyBackground(e)}setSkyBackground(e,t){return this.viewport.setSkyBackground(e,t)}setEnvironment(){return this.viewport.setEnvironment()}playModelAnimation(e,t){return this.viewport.playModelAnimation(e,t)}stopModelAnimation(e,t){this.viewport.stopModelAnimation(e,t)}getOffsetByPosition(e){return this.viewport.getOffsetByPosition(e)}getPositionByOffset(e,t){return this.viewport.getPositionByOffset(e,t)}render(e){return this.viewport.render(e)}clearSignals(){this.viewport.clearSignals()}dispose(){this.manager.dispose(),this.viewport.dispose()}getCameraViewpoint(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraViewpoint(e){this.viewport.cameraManager.setCameraViewpoint(e)}getCameraTargetView(){return this.viewport.cameraManager.getCameraViewpoint()}setCameraTargetView(e){this.viewport.cameraManager.setCameraViewpoint(e)}flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return"orbit"===this.viewport.controls.options.type&&this.utils.warn("flyTo 方法不适用于 orbit 控制器"),this.viewport.cameraManager.flyTo(e,t,n)}flyToBoundingBox(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.flyToBoundingBox(e,t,n)}flyToObj(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.flyToObj(e,t,n)}flyMainViewpoint(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"frontTop",t=arguments.length>1?arguments[1]:void 0;return this.flyToObj(this.manager.scene,e,t)}surroundOnTarget(e,t){return this.viewport.cameraManager.surroundOnTarget(e,t)}surroundOnObject(e,t){return this.viewport.cameraManager.surroundOnObject(e,t)}getObjectLabelPos(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",n=arguments.length>2?arguments[2]:void 0;return this.viewport.cameraManager.getObjectLabelPos(e,t,n)}setControlsOptions(e){return this.viewport.controls.setOptions(e)}addObject(e,t){this.viewport.scener.addObject(e,t)}removeObject(e){this.viewport.scener.removeObject(e)}openSceneFog(e){this.viewport.scener.openSceneFog(e)}closeSceneFog(){this.viewport.scener.closeSceneFog()}setSky(e){return this.viewport.setSky(e)}getScreenshot(){return this.screenshot()}screenshot(){return this.viewport.screenshot()}edgeShow(e,t){return this.viewport.scener.edgeShow(e,t)}unEdgeShow(e){return this.viewport.scener.unEdgeShow(e)}strokeShow(e,t){return this.viewport.scener.strokeShow(e,t)}unStrokeShow(e){return this.viewport.scener.unStrokeShow(e)}opacityShow(e,t){return this.viewport.scener.opacityShow(e,t)}unOpacityShow(e){return this.viewport.scener.unOpacityShow(e)}highlightShow(e,t){return this.viewport.scener.highlightShow(e,t)}unHighlightShow(e){return this.viewport.scener.unHighlightShow(e)}emissiveShow(e,t){return this.viewport.scener.emissiveShow(e,t)}unEmissiveShow(e){return this.viewport.scener.unEmissiveShow(e)}clearObject(){this.manager.clearObject()}clear(){this.manager.clear()}createAmbientLight(e){return this.manager.store.lightManager.createAmbientLight(e)}setAmbientLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setAmbientLight(t,e)}createDirectionalLight(e){return this.manager.store.lightManager.createDirectionalLight(e)}setDirectionalLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setDirectionalLight(t,e)}createHemisphereLight(e){return this.manager.store.lightManager.createHemisphereLight(e)}setHemisphereLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setHemisphereLight(t,e)}createSpotLight(e){return this.manager.store.lightManager.createSpotLight(e)}setSpotLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setSpotLight(t,e)}createPointLight(e){return this.manager.store.lightManager.createPointLight(e)}setPointLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setPointLight(t,e)}createRectAreaLight(e){return this.manager.store.lightManager.createRectAreaLight(e)}setRectAreaLight(e){const t=this.getObjectById(e.id);return this.manager.store.lightManager.setRectAreaLight(t,e)}getLightById(e){return rn("getLightById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeLightById(e){return rn("removeLightById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}getAllLight(){return this.manager.store.lightManager.getAll()}clearLight(){return this.manager.store.lightManager.clear()}showAllLight(){return this.manager.store.lightManager.showAll()}hideAllLight(){return this.manager.store.lightManager.hideAll()}updateAllShadow(){return this.manager.store.lightManager.updateAllShadow()}getObjectById(e){return this.manager.getObjectById(e)}getObjectByName(e){return this.manager.getObjectByName(e)}getObjectByUserDataProperty(e,t){return this.manager.getObjectByUserDataProperty(e,t)}removeObjectById(e){return this.manager.removeObjectById(e)}createGroup(e){return this.manager.store.groupManager.createGroup(e)}getGroupById(e){return rn("getGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getGroupByName(e){return rn("getGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllGroup(){return this.manager.store.groupManager.getAll()}showAllGroup(){return this.manager.store.groupManager.showAll()}hideAllGroup(){return this.manager.store.groupManager.hideAll()}removeGroupById(e){return rn("removeGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}loadSbm(e){return rn("loadSbm is deprecated, use loadModel instead"),this.loadModel(e)}parseSbm(){rn("parseSbm is deprecated!")}cloneSbm(e,t,n){return rn("cloneSbm is deprecated, use cloneModel instead"),this.cloneModel(e,t,n)}getSbmById(e){return rn("getSbmById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmByName(e){return rn("getSbmByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getSbmByUserDataProperty(e,t){return rn("getSbmByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeSbmById(e){return rn("removeSbmById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForSbm(e){return rn("createGroupForSbm is deprecated, use createGroup instead"),this.createGroup(e)}loadSbmToGroup(e,t){return rn("loadSbmToGroup is deprecated, use loadModelToGroup instead"),this.loadModelToGroup(e,t)}addSbmForGroup(e,t){return rn("addSbmForGroup is deprecated, use addModelForGroup instead"),this.addModelForGroup(e,t)}createSbmGroupFromXml(){rn("createGroupForSbm is deprecated!")}getSbmGroupById(e){return rn("getSbmGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmGroupByName(e){return rn("getSbmGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllSbmGroup(){return rn("getAllSbmGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeSbmGroupById(e){return rn("removeSbmGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearSbm(){return rn("clearSbm is deprecated, use clearModel instead"),this.clearModel()}getAllSbm(){return rn("getAllSbm is deprecated, use getAllModel instead"),this.getAllModel()}showAllSbm(){return rn("showAllSbm is deprecated, use showAllModel instead"),this.showAllModel()}hideAllSbm(){return rn("hideAllSbm is deprecated, use hideAllModel instead"),this.hideAllModel()}getSbmModelMaps(){return rn("getSbmModelMaps is deprecated, use getModelsMap instead"),this.getModelsMap()}setSbmModelMaps(e){return rn("setSbmModelMaps is deprecated, use setModelsMap instead"),this.setModelsMap(e)}setModelDracoDecoderPath(e){return this.manager.store.modelManager.setDracoDecoderPath(e)}loadModel(e){return this.manager.store.modelManager.load(e)}cloneModel(e,t,n){return this.manager.store.modelManager.clone(e,t,n)}getModelById(e){return rn("getModelById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelByName(e){return rn("getModelByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getModelByUserDataProperty(e,t){return rn("getModelByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeModelById(e){return rn("removeModelById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForModel(e){return rn("createGroupForModel is deprecated, use createGroup instead"),this.createGroup(e)}loadModelToGroup(e,t){return this.manager.store.modelManager.loadToGroup(e,t)}addModelForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.modelManager.addForGroup(n,t)}getModelGroupById(e){return rn("getModelGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelGroupByName(e){return rn("getModelGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllModelGroup(){return rn("getAllModelGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeModelGroupById(e){return rn("removeModelGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearModel(){return this.manager.store.modelManager.clear()}getAllModel(){return this.manager.store.modelManager.getAll()}showAllModel(){return this.manager.store.modelManager.showAll()}hideAllModel(){return this.manager.store.modelManager.hideAll()}computeModelsBoundsTree(e){return this.viewport.bvh.computeModelsBoundsTree(e)}clearIdb(){return this.manager.store.modelManager.clearIdb()}getModelsMap(){return this.manager.store.modelManager.modelsMap}setModelsMap(e){this.manager.store.modelManager.modelsMap=e}createPoi(e){return this.manager.store.poiManager.create(e)}clonePoi(e,t,n){return this.manager.store.poiManager.clone(e,t,n)}getPoiById(e){return rn("getPoiById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiByName(e){return rn("getPoiByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiByUserDataProperty(e,t){return rn("getPoiByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiById(e){return rn("removePoiById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoi(e){return rn("createGroupForPoi is deprecated, use createGroup instead"),this.createGroup(e)}createPoiToGroup(e,t){return this.manager.store.poiManager.createToGroup(e,t)}addPoiForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.poiManager.addForGroup(n,t)}getPoiGroupById(e){return rn("getPoiGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiGroupByName(e){return rn("getPoiGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiGroup(){return rn("getAllPoiGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiGroupById(e){return rn("removePoiGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearPoi(){return this.manager.store.poiManager.clear()}getAllPoi(){return this.manager.store.poiManager.getAll()}showAllPoi(){return this.manager.store.poiManager.showAll()}hideAllPoi(){return this.manager.store.poiManager.hideAll()}createPoiNode(e){return this.manager.store.poiNodeManager.create(e)}getPoiNodeById(e){return rn("getPoiNodeById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeByName(e){return rn("getPoiNodeByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiNodeByUserDataProperty(e,t){return rn("getPoiNodeByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiNodeById(e){return rn("removePoiNodeById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoiNode(e){return rn("createGroupForPoiNode is deprecated, use createGroup instead"),this.createGroup(e)}createPoiNodeToGroup(e,t){return this.manager.store.poiNodeManager.createToGroup(e,t)}addPoiNodeForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.poiNodeManager.addForGroup(n,t)}getPoiNodeGroupById(e){return rn("getPoiNodeGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeGroupByName(e){return rn("getPoiNodeGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiNodeGroup(){return rn("getAllPoiNodeGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiNodeGroupById(e){return rn("removePoiNodeGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearPoiNode(){return this.manager.store.poiNodeManager.clear()}getAllPoiNode(){return this.manager.store.poiNodeManager.getAll()}showAllPoiNode(){return this.manager.store.poiNodeManager.showAll()}hideAllPoiNode(){return this.manager.store.poiNodeManager.hideAll()}createPoiMesh(e){const t=uc(e,this.textureCache);return this.addObject(t),t}createPolygonPoiMesh(e){const t=dc(e,this.textureCache);return this.addObject(t),t}setTexture(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{cache:i=!0,independ:r=!0}=n||{};let s=e.material;if(r&&(s=s.clone(),e.material=s),null===t)return s.map=null,this.render(),null;const o=ac(s,t,i,this.textureCache);return this.render(),o}createCanvas3D(e){return this.manager.store.canvas3DManager.create(e)}getCanvas3DById(e){return rn("getCanvas3DById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DByName(e){return rn("getCanvas3DByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getCanvas3DByUserDataProperty(e,t){return rn("getCanvas3DByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeCanvas3DById(e){return rn("removeCanvas3DById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForCanvas3D(e){return rn("createGroupForCanvas3D is deprecated, use createGroup instead"),this.createGroup(e)}createCanvas3DToGroup(e,t){return this.manager.store.canvas3DManager.createToGroup(e,t)}addCanvas3DForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.canvas3DManager.addForGroup(n,t)}getCanvas3DGroupById(e){return rn("getCanvas3DGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DGroupByName(e){return rn("getCanvas3DGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllCanvas3DGroup(){return rn("getAllCanvas3DGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeCanvas3DGroupById(e){return rn("removeCanvas3DGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearCanvas3D(){return this.manager.store.canvas3DManager.clear()}getAllCanvas3D(){return this.manager.store.canvas3DManager.getAll()}showAllCanvas3D(){return this.manager.store.canvas3DManager.showAll()}hideAllCanvas3D(){return this.manager.store.canvas3DManager.hideAll()}getShortestPath(e,t){return this.manager.store.topologyManager.getShortestPath(e,t)}getShortestPathByMultipleStartPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleStartPoints(e,t)}getShortestPathByMultipleEndPoints(e,t){return this.manager.store.topologyManager.getShortestPathByMultipleEndPoints(e,t)}createTopologyFromGml(e){return this.manager.store.topologyManager.createFromGml(e)}createTopology(e){return this.manager.store.topologyManager.create(e)}resetTopologyNodes(e,t){return this.manager.store.topologyManager.resetNodes(e,t)}getTopologyById(e){return rn("getTopologyById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyByName(e){return rn("getTopologyByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getTopologyByUserDataProperty(e,t){return rn("getTopologyByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeTopologyById(e){return rn("removeTopologyById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForTopology(e){return rn("createGroupForTopology is deprecated, use createGroup instead"),this.createGroup(e)}createTopologyToGroup(e,t){return this.manager.store.topologyManager.createToGroup(e,t)}addTopologyForGroup(e,t){const n=this.getObjectById(e);return this.manager.store.topologyManager.addForGroup(n,t)}getTopologyGroupById(e){return rn("getTopologyGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyGroupByName(e){return rn("getTopologyGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllTopologyGroup(){return rn("getAllTopologyGroup is deprecated, use getAllGroups instead"),this.getAllGroup()}removeTopologyGroupById(e){return rn("removeTopologyGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearTopology(){return this.manager.store.topologyManager.clear()}getAllTopology(){return this.manager.store.topologyManager.getAll()}showAllTopology(){return this.manager.store.topologyManager.showAll()}hideAllTopology(){return this.manager.store.topologyManager.hideAll()}addGridHelper(e){return this.manager.store.helperManager.addGridHelper(e)}addAxesHelper(e){return this.manager.store.helperManager.addAxesHelper(e)}addBoxHelper(e){return this.manager.store.helperManager.addBoxHelper(e)}addPlaneHelper(e){return this.manager.store.helperManager.addPlaneHelper(e)}createGround(e){return rn("In soonspacejs: 'createGround' 已弃用,请使用 'addGroundHelper'!"),this.addGroundHelper(e)}addGroundHelper(e){return this.manager.store.helperManager.addGroundHelper(e)}addDirectionalLightHelper(e){return this.manager.store.helperManager.addDirectionalLightHelper(e)}addHemisphereLightHelper(e){return this.manager.store.helperManager.addHemisphereLightHelper(e)}addSpotLightHelper(e){return this.manager.store.helperManager.addSpotLightHelper(e)}addPointLightHelper(e){return this.manager.store.helperManager.addPointLightHelper(e)}addRectAreaLightHelper(e){return this.manager.store.helperManager.addRectAreaLightHelper(e)}getHelperById(e){return rn("getHelperById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeHelperById(e){return rn("removeHelperById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearHelper(){return this.manager.store.helperManager.clear()}showAllHelper(){return this.manager.store.helperManager.showAll()}hideAllHelper(){return this.manager.store.helperManager.hideAll()}createFindObjectsInBoxNearPosition(e,t){return lc(e,t)}createFindObjectsInSphereNearPosition(e,t){return cc(e,t)}createFindObjectsNearPath(e,t){return hc(e,t)}createPathAnimation(e,t,n){return new Yn(e,t,n)}createTopologyAnimation(e,n,i){const r=n.nodes.map((e=>e.getWorldPosition(new t)));return new Yn(e,r,i)}}fc.THREE=e,fc.TWEEN=Vt,fc.utils=Hn;export{fc as SoonSpace,rc as boundingIsIntersected,lc as createFindObjectsInBoxNearPosition,cc as createFindObjectsInSphereNearPosition,hc as createFindObjectsNearPath,nc as createPlaneMatrix,uc as createPoiMesh,dc as createPolygonPoiMesh,oc as createTexture,ic as createUVMatrix,fc as default,sc as getBoundingBox,tc as getPolygonGeometryInfo,ac as setTexture};