soonspacejs 2.6.6 → 2.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,16 +1,16 @@
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}}
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 w,Vector2 as b,WebGLRenderer as A,PCFSoftShadowMap as x,Sphere as S,Camera as E,sRGBEncoding as T,UnsignedByteType as D,MeshNormalMaterial as C,WebGLRenderTarget as I,NearestFilter as B,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 F,RGBADepthPacking as z,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 we,Spherical as be,TextureLoader as Ae,MeshBasicMaterial as xe,PlaneGeometry as Se,Raycaster as Ee,Clock as Te,AnimationMixer as De,EquirectangularReflectionMapping as Ce,ACESFilmicToneMapping as Ie,AnimationClip as Be,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 Fe,AmbientLight as ze,DirectionalLight as He,HemisphereLight as Ge,SpotLight as Ve,PointLight as Ye,RectAreaLight as Qe,Loader as We,LoaderUtils as Xe,FileLoader as Ze,ClampToEdgeWrapping as Ke,Group as qe,Bone as Je,PropertyBinding as $e,MathUtils as et,SkinnedMesh as tt,Line as nt,Skeleton as it,Uint16BufferAttribute as rt,VectorKeyframeTrack as st,QuaternionKeyframeTrack as ot,NumberKeyframeTrack as at,LinearMipMapLinearFilter as lt,ImageLoader as ct,GridHelper as ht,AxesHelper as ut,Box3Helper as dt,DirectionalLightHelper as ft,HemisphereLightHelper as pt,SpotLightHelper as gt,PointLightHelper as mt,Box2 as vt,Plane as yt,CanvasTexture as wt,Line3 as bt,MeshPhongMaterial as At}from"three";export*from"three";import{GLTFExporter as xt}from"three/examples/jsm/exporters/GLTFExporter.js";import{MeshBVH as St,computeBoundsTree as Et,disposeBoundsTree as Tt,acceleratedRaycast as Dt}from"three-mesh-bvh";import{RoomEnvironment as Ct}from"three/examples/jsm/environments/RoomEnvironment.js";import{RGBELoader as It}from"three/examples/jsm/loaders/RGBELoader.js";import Bt from"three/examples/jsm/libs/stats.module.js";import{Sky as Mt}from"three/examples/jsm/objects/Sky.js";import{deinterleaveGeometry as Ot}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{WorkerPool as Pt}from"three/examples/jsm/utils/WorkerPool.js";import{RectAreaLightUniformsLib as Rt}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as _t}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as Lt}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Nt}from"three/examples/jsm/loaders/DRACOLoader.js";import*as kt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Ut}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as jt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Ft,zt="soonspacejs",Ht="2.6.7",Gt={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-Gt.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*Gt.Bounce.In(2*e):.5*Gt.Bounce.Out(2*e-1)+.5}}},Vt="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()},Yt=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=Vt()),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}(),Qt={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=Qt.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=Qt.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=Qt.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=Qt.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(Ft=[1],function(e){var t=1;if(Ft[e])return Ft[e];for(var n=e;n>1;n--)t*=n;return Ft[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}}},Wt=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Xt=new Yt,Zt=function(){function e(e,t){void 0===t&&(t=Xt),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=Gt.Linear.None,this._interpolationFunction=Qt.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Wt.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?Vt()+parseFloat(e):e:Vt(),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=Vt()),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=Vt()),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=Vt()),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=Wt.nextId,qt=Xt,Jt=qt.getAll.bind(qt),$t=qt.removeAll.bind(qt),en=qt.add.bind(qt),tn=qt.remove.bind(qt),nn=qt.update.bind(qt),rn={Easing:Gt,Group:Yt,Interpolation:Qt,now:Vt,Sequence:Wt,nextId:Kt,Tween:Zt,VERSION:"18.6.4",getAll:Jt,removeAll:$t,add:en,remove:tn,update:nn};const sn="[soonspacejs]: ",on="Group",an="Light",ln="Model",cn="Poi",hn="PoiNode",un="Canvas3D",dn="Topology",fn="Helper",pn="PluginObject",gn="In soonspacejs: ",mn=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},vn=e=>{console.warn(gn+e)};function yn(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function wn(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function bn(e){return new i(new t(0,0,0),new t(500,500,500)).setFromObject(e)}function An(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 xn(e,t){const i=An("x",e,t),r=An("y",e,t),s=An("z",e,t);return new n(i.x,r.y,s.z,t.order)}function Sn(e){return Math.PI/180*e}function En(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 Tn(e,t){const n=En(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 Dn(e){return!!e.visible&&(!e.parent||Dn(e.parent))}class Cn{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 In(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 Bn(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 Mn=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function On(e){return Xn(e)?function(e){return e.map((e=>On(e)))}(e):Zn(e)?function(e){if(Zn(e)){const t={};for(const n in e)t[n]=On(e[n]);return t}return e}(e):e}const Pn=(e,t)=>Xn(e)?e.map(t):t(e),Rn=e=>Pn(e,(e=>e.clone())),_n=e=>Pn(e,(e=>e.dispose())),Ln=async e=>{const t=await fetch(e);if(200===t.status)return t;throw new Error(`Failed to fetch file: ${e}`)},Nn=new t,kn=new t,Un=new t;function jn(e,t){const n=Nn.setFromMatrixPosition(e.matrixWorld),i=kn.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(Un);return r.angleTo(s)>Math.PI/2}function Fn(e,t,n,i){const r=Nn.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 zn=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var Hn=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 Gn(e){return Ln(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new Hn).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}const Vn=Object.prototype.hasOwnProperty,Yn=e=>"String"===qn(e),Qn=e=>"Boolean"===qn(e),Wn=e=>"Number"===qn(e),Xn=Array.isArray,Zn=e=>"Object"===qn(e),Kn=e=>"Function"===qn(e),qn=e=>Object.prototype.toString.call(e).slice(8,-1),Jn=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),$n=()=>sn+Math.random().toString(36).substring(7).split("").join("_"),ei=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 ti=Object.freeze({__proto__:null,IVector3ToEuler:wn,IVector3ToVector3:yn,MinHeap:Cn,cloneDeep:On,cloneMaterials:Rn,deg2Euler:Sn,disposeMaterials:_n,error:e=>{console.error(gn+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 xt).parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:Ln,getAsciiString:Jn,getBoundingBox:bn,getCubeTexture:In,getExtension:ei,getSpaceAttributeFromObject:En,getValueType:qn,gradientTexture:Bn,hasOwn:(e,t)=>Vn.call(e,t),idleTask:zn,isArray:Xn,isBoolean:Qn,isDate:e=>"Date"===qn(e),isFunction:Kn,isNull:e=>"Null"===qn(e),isNumber:Wn,isObject:Zn,isObjectBehindCamera:jn,isObjectOccludeVisible:Fn,isObjectVisible:Dn,isPromise:e=>"Promise"===qn(e),isString:Yn,isSymbol:e=>"Symbol"===qn(e),isUndefined:e=>"Undefined"===qn(e),log:mn,materialHandle:Pn,parseFilePath:Mn,randomString:$n,rotationAFix:xn,rotationAxisFix:An,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:Tn,warn:vn,xmlToJson:Gn});const ni={"Linear.None":Gt.Linear.None,"Quadratic.In":Gt.Quadratic.In,"Quadratic.Out":Gt.Quadratic.Out,"Quadratic.InOut":Gt.Quadratic.InOut,"Cubic.In":Gt.Cubic.In,"Cubic.Out":Gt.Cubic.Out,"Cubic.InOut":Gt.Cubic.InOut,"Quartic.In":Gt.Quartic.In,"Quartic.Out":Gt.Quartic.Out,"Quartic.InOut":Gt.Quartic.InOut,"Quintic.In":Gt.Quintic.In,"Quintic.Out":Gt.Quintic.Out,"Quintic.InOut":Gt.Quintic.InOut,"Sinusoidal.In":Gt.Sinusoidal.In,"Sinusoidal.Out":Gt.Sinusoidal.Out,"Sinusoidal.InOut":Gt.Sinusoidal.InOut,"Exponential.In":Gt.Exponential.In,"Exponential.Out":Gt.Exponential.Out,"Exponential.InOut":Gt.Exponential.InOut,"Circular.In":Gt.Circular.In,"Circular.Out":Gt.Circular.Out,"Circular.InOut":Gt.Circular.InOut,"Elastic.In":Gt.Elastic.In,"Elastic.Out":Gt.Elastic.Out,"Elastic.InOut":Gt.Elastic.InOut,"Back.In":Gt.Back.In,"Back.Out":Gt.Back.Out,"Back.InOut":Gt.Back.InOut,"Bounce.In":Gt.Bounce.In,"Bounce.Out":Gt.Bounce.Out,"Bounce.InOut":Gt.Bounce.InOut};function ii(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=ni[u],p=new Zt(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)}));Wn(h)?p.repeat(h):Qn(h)&&h&&p.repeat(1/0),p.yoyo(d),p.start()}))}class ri{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=yn(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=yn(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 ii(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 si="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function oi(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 ai={},li={},ci=function(e,t){return ci=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])},ci(e,t)};var hi=function(){return hi=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},hi.apply(this,arguments)};function ui(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 di=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 fi(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 pi(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 gi(e){return this instanceof gi?(this.v=e,this):new gi(e)}var mi=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function vi(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 yi(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 wi=Object.freeze({__proto__:null,get __assign(){return hi},__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:gi(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 gi?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=fi(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:gi,__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:vi,__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:yi,__createBinding:di,__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)||di(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}ci(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)&&di(t,e,n);return mi(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:pi,__rest:ui,__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(pi(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:fi}),bi=oi(wi),Ai={},xi={},Si={},Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});var Ti=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}();Ei.SlotList=Ti;var Di={};Object.defineProperty(Di,"__esModule",{value:!0});var Ci=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}();Di.Slot=Ci,Object.defineProperty(Si,"__esModule",{value:!0});var Ii=Ei,Bi=Di,Mi=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=Ii.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=Ii.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 Bi.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}();Si.OnceSignal=Mi,Object.defineProperty(xi,"__esModule",{value:!0});var Oi=bi,Pi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Oi.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(Si.OnceSignal);xi.Signal=Pi,Object.defineProperty(Ai,"__esModule",{value:!0});var Ri=bi,_i=Di,Li=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ri.__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 _i.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(xi.Signal);Ai.PrioritySignal=Li,Object.defineProperty(li,"__esModule",{value:!0});var Ni=bi,ki=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 Ni.__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}(Ai.PrioritySignal);li.DeluxeSignal=ki;var Ui={};Object.defineProperty(Ui,"__esModule",{value:!0});var ji=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}();Ui.GenericEvent=ji;var Fi={};Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.IOnceSignal=Symbol("IOnceSignal");var zi={};Object.defineProperty(zi,"__esModule",{value:!0}),zi.IPrioritySignal=Symbol("IPrioritySignal");var Hi={};Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.ISignal=Symbol("ISignal");var Gi={};Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.ISlot=Symbol("ISlot");var Vi={};Object.defineProperty(Vi,"__esModule",{value:!0});var Yi=Di,Qi=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 Yi.Slot(e,this,t)},e}();Vi.MonoSignal=Qi;var Wi={};Object.defineProperty(Wi,"__esModule",{value:!0});var Xi=bi,Zi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xi.__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}(Si.OnceSignal);Wi.Promise=Zi,Object.defineProperty(ai,"__esModule",{value:!0});var Ki=li;ai.DeluxeSignal=Ki.DeluxeSignal;var qi=Ui;ai.GenericEvent=qi.GenericEvent;var Ji=Fi;ai.IOnceSignal=Ji.IOnceSignal;var $i=zi;ai.IPrioritySignal=$i.IPrioritySignal;var er=Hi;ai.ISignal=er.ISignal;var tr=Gi;ai.ISlot=tr.ISlot;var nr=Vi;ai.MonoSignal=nr.MonoSignal;var ir=Si;ai.OnceSignal=ir.OnceSignal;var rr=Ai;ai.PrioritySignal=rr.PrioritySignal;var sr=Wi;ai.Promise=sr.Promise;var or=xi,ar=ai.Signal=or.Signal,lr=Di;ai.Slot=lr.Slot;var cr=Ei;ai.SlotList=cr.SlotList;const hr=new c;hr.name="Scene";class ur{constructor(e,t){this.signals=e,this.viewportState=t,this.scene=hr.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 vn("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(),Pn(n.material,t)}e instanceof Sl&&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 Xn(e)?e.forEach((e=>i(e))):Zn(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 Xn(e)?Promise.all(e.map((e=>t(e)))):Zn(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 Al({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}));Tn(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}),Xn(e)?Promise.all(e.map((e=>a(e)))):Zn(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 Xn(e)?Promise.all(e.map((e=>t(e)))):Zn(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){const t=Rn(e);return t.map=null,t.transparent=i<1,t.depthWrite=!t.transparent,t.color.set(n),t.opacity=i,t}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=Pn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return Xn(e)?Promise.all(e.map((e=>s(e)))):Zn(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;_n(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Xn(e)?Promise.all(e.map((e=>t(e)))):Zn(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,e.depthWrite=!e.transparent)}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=Rn(e.material),Pn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return Xn(e)?Promise.all(e.map((e=>s(e)))):Zn(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;_n(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Xn(e)?Promise.all(e.map((e=>t(e)))):Zn(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&&ii({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=Rn(e.material),Pn(e.material,a)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return Xn(e)?Promise.all(e.map((e=>l(e)))):Zn(e)?l(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&rn.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;Pn(e.material,t),_n(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return Xn(e)?Promise.all(e.map((e=>n(e)))):Zn(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof bl)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 dr 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 dr&&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 fr=new t,pr=new m,gr=new m,mr=new t,vr=new t;class yr{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(),pr.copy(t.matrixWorldInverse),gr.multiplyMatrices(t.projectionMatrix,pr),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof dr&&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 dr){const t=e.parent;if(t.occlude){const t=!jn(e,this.viewport.camera)&&Fn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}fr.setFromMatrixPosition(e.matrixWorld),fr.applyMatrix4(gr);const o=Dn(e)&&fr.z>=-1&&fr.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("+(fr.x*i+i)+"px,"+(-fr.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 mr.setFromMatrixPosition(e.matrixWorld),vr.setFromMatrixPosition(t.matrixWorld),mr.distanceToSquared(vr)}}}const wr=new t,br=new r,Ar=new t;class xr 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 xr&&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 Sr extends xr{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const Er=new m,Tr=new m;class Dr{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 w&&(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 w?`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 xr){const t=e.parent;if(t.occlude){const t=!jn(e,this.viewport.camera)&&Fn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=Dn(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 Sr?(Er.copy(n.matrixWorldInverse),Er.transpose(),0!==e.rotation2D&&Er.multiply(Tr.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(wr,br,Ar),Er.setPosition(wr),Er.scale(Ar),Er.elements[3]=0,Er.elements[7]=0,Er.elements[11]=0,Er.elements[15]=1,t=h(Er)):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 Cr{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 b(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.autoClear=!1,r.localClippingEnabled=!0,r.sortObjects=!0,r.shadowMap.enabled=!0,r.shadowMap.type=x,this.container.appendChild(r.domElement),r}_initRenderCSS2D(){const e=new yr(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 Dr(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 Ir=new m,Br=(e,t)=>{const i=Ir.clone(),r=Ir.clone(),s=Ir.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},Mr=Br(-Math.PI/2,-Math.PI/4),Or=Br(Math.PI/2,-Math.PI/4),Pr=Br(-Math.PI/4,-Math.PI/4),Rr=Br(Math.PI/4,-Math.PI/4),_r=Br(1.25*Math.PI,-Math.PI/4),Lr=Br(.75*Math.PI,-Math.PI/4),Nr={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(Mr.x,Mr.y,Mr.z),RIGHTTOP:new n(Or.x,Or.y,Or.z),LEFTFRONTTOP:new n(Pr.x,Pr.y,Pr.z),RIGHTFRONTTOP:new n(Rr.x,Rr.y,Rr.z),LEFTBACKTOP:new n(_r.x,_r.y,_r.z),RIGHTBACKTOP:new n(Lr.x,Lr.y,Lr.z)},kr=e=>Wn(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),Ur=new t,jr=new n,Fr=new y(50,1,.1,5e5);Fr.position.set(500,1e3,500),Fr.lookAt(Ur.set(0,0,0)),Fr.name="Camera";class zr{constructor(e){this.viewport=e,this.mainCamera=Fr.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=Fr.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&&Zn(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(Zn(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 ii(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 ii({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(Yn(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?jr.copy(this.currentCamera.rotation):Nr[e]&&jr.copy(Nr[e])}else t instanceof n?jr.copy(t):Zn(t)&&jr.set(t.x,t.y,t.z);jr.copy(xn(this.currentCamera.rotation,jr.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(jr,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 vn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Yn(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=Nr[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&vn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=wn(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(Ur),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new m;r.lookAt(s,t,i.object.up),n=jr.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 Cl||e instanceof Sl){const{padding:t=50}=i,r=kr(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=bn(e),o=s.getSize(Ur);let a=0;if(Yn(r)){const e=Math.max(o.x,o.y,o.z);a=kr(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(Ur.set(l/2,c/2,l/2)),s.min.sub(Ur.set(l/2,c/2,l/2))),s.isEmpty()&&(Ur.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(Ur,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=yn(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return ii({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(Ur);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(Ur);(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 bl&&(e=(new i).setFromObject(e)),e.isEmpty())return vn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(Ur),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=Yn(n)?Nr[n.toLocaleUpperCase()]:wn(n),a(Ur.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(Ur).clone():new t}}
2
2
  /**
3
3
  * postprocessing v6.29.3 build Thu Feb 09 2023
4
4
  * https://github.com/pmndrs/postprocessing
5
5
  * Copyright 2015-2023 Raoul van Rüschen
6
6
  * @license Zlib
7
- */var Ir="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";function Mr(e,t){let n="texel";if(null!==e){const i=Number.parseInt(H);if(!(t&&i>=133&&135!==i&&e.format===o&&e.type===D&&e.encoding===T))switch(e.encoding){case T:n="sRGBToLinear(texel)";break;case _:n="texel";break;default:throw new Error(`Unsupported encoding: ${e.encoding}`)}}return n}function Or(e,t,n){return e*(t-n)-t}function Pr(e,t,n){return Math.min(Math.max((e+t)/(t-n),0),1)}var Rr={SKIP:9,SET:30,ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},_r={DEPTH:0,LUMA:1,COLOR:2},Lr={NONE:0,DEPTH:1,CONVOLUTION:2},Nr={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},kr={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},Ur={DISABLED:0,DEPTH:1,CUSTOM:2},jr={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3},zr=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],Fr=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new q;super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new L(null),texelSize:new L(new q),scale:new L(1),kernel:new L(0)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;\n#include <encodings_fragment>\n}",vertexShader:"uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.setTexelSize(e.x,e.y),this.kernelSize=kr.MEDIUM}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get kernelSequence(){return zr[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t,.5*e,.5*t)}setSize(e,t){const n=1/e,i=1/t;this.uniforms.texelSize.value.set(n,i,.5*n,.5*i)}},Hr=class extends j{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new L(null),opacity:new L(1)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <dithering_pars_fragment>\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include <encodings_fragment>\n#include <dithering_fragment>\n}",vertexShader:Ir}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},Gr=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;super({name:"DepthComparisonMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new L(null),cameraNear:new L(.3),cameraFar:new L(1e3)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#include <clipping_planes_pars_fragment>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float cameraNear;uniform float cameraFar;varying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <clipping_planes_fragment>\nvec2 projTexCoord=(vProjTexCoord.xy/vProjTexCoord.w)*0.5+0.5;projTexCoord=clamp(projTexCoord,0.002,0.998);\n#if DEPTH_PACKING == 3201\nfloat fragCoordZ=unpackRGBAToDepth(texture2D(depthBuffer,projTexCoord));\n#else\nfloat fragCoordZ=texture2D(depthBuffer,projTexCoord).r;\n#endif\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#else\nfloat viewZ=orthographicDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#endif\nfloat depthTest=(-vViewZ>-viewZ)?1.0:0.0;gl_FragColor.rg=vec2(0.0,depthTest);}",vertexShader:"#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <skinbase_vertex>\n#include <begin_vertex>\n#include <morphtarget_vertex>\n#include <skinning_vertex>\n#include <project_vertex>\nvViewZ=mvPosition.z;vProjTexCoord=gl_Position;\n#include <clipping_planes_vertex>\n}"}),this.toneMapped=!1,this.depthBuffer=e,this.depthPacking=F,this.copyCameraSettings(t)}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F;this.depthBuffer=e,this.depthPacking=t}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof y?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},Vr=class extends j{constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new L(null),normalBuffer:new L(null),texelSize:new L(new w)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\n#ifdef DOWNSAMPLE_NORMALS\nuniform lowp sampler2D normalBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[]=float[4](abs(c-samples[0]),abs(c-samples[1]),abs(c-samples[2]),abs(c-samples[3]));float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]<maxDistance){remaining[j++]=i;}else{rejected[k++]=i;}}for(;j<3;++j){remaining[j]=rejected[--k];}vec3 s=vec3(samples[remaining[0]],samples[remaining[1]],samples[remaining[2]]);c=(s.x+s.y+s.z)/3.0;distances[0]=abs(c-s.x);distances[1]=abs(c-s.y);distances[2]=abs(c-s.z);float minDistance=min(distances[0],min(distances[1],distances[2]));for(i=0;i<3;++i){if(distances[i]==minDistance){break;}}return remaining[i];}void main(){float d[]=float[4](readDepth(vUv0),readDepth(vUv1),readDepth(vUv2),readDepth(vUv3));int index=findBestDepth(d);\n#ifdef DOWNSAMPLE_NORMALS\nvec3 n[]=vec3[4](texture2D(normalBuffer,vUv0).rgb,texture2D(normalBuffer,vUv1).rgb,texture2D(normalBuffer,vUv2).rgb,texture2D(normalBuffer,vUv3).rgb);\n#else\nvec3 n[]=vec3[4](vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));\n#endif\ngl_FragColor=vec4(n[index],d[index]);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=uv;vUv1=vec2(uv.x,uv.y+texelSize.y);vUv2=vec2(uv.x+texelSize.x,uv.y);vUv3=uv+texelSize;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthBuffer=e,this.depthPacking=t}set normalBuffer(e){this.uniforms.normalBuffer.value=e,null!==e?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(e){this.normalBuffer=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Yr=class extends j{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new L(null),texelSize:new L(new w)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#define WEIGHT_INNER 0.125\n#define WEIGHT_OUTER 0.0555555\nvarying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;\n#include <encodings_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Qr=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new w,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_r.COLOR;super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:H.replace(/\D+/g,""),LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new L(null),depthBuffer:new L(null),predicationBuffer:new L(null),texelSize:new L(e)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\n#if EDGE_DETECTION_MODE == 1\n#include <common>\n#endif\n#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}\n#elif PREDICATION_MODE == 2\nuniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}\n#endif\n#if PREDICATION_MODE != 0\nvec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}\n#endif\n#if EDGE_DETECTION_MODE != 0\nuniform sampler2D inputBuffer;\n#endif\nvoid main(){\n#if EDGE_DETECTION_MODE == 0\nconst vec2 threshold=vec2(DEPTH_THRESHOLD);\n#elif PREDICATION_MODE != 0\nvec2 threshold=calculatePredicatedThreshold();\n#else\nconst vec2 threshold=vec2(EDGE_THRESHOLD);\n#endif\n#if EDGE_DETECTION_MODE == 0\nvec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 1\nfloat l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 2\nvec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#endif\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\nvoid main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);\n#if EDGE_DETECTION_MODE != 0\nvUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.edgeDetectionMode=t}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthBuffer=e,this.depthPacking=t}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(e){this.edgeDetectionMode=e}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(e){this.localContrastAdaptationFactor=e}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*e).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(e){this.edgeDetectionThreshold=e}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(e){this.predicationMode=e}set predicationBuffer(e){this.uniforms.predicationBuffer.value=e}setPredicationBuffer(e){this.uniforms.predicationBuffer.value=e}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(e){this.predicationThreshold=e}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(e){this.predicationScale=e}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(e){this.predicationStrength=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Wr=class extends j{constructor(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super({name:"EffectMaterial",defines:{THREE_REVISION:H.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new L(null),depthBuffer:new L(null),resolution:new L(new w),texelSize:new L(new w),cameraNear:new L(.3),cameraFar:new L(1e3),aspect:new L(1),time:new L(0)},blending:z,depthWrite:!1,depthTest:!1,dithering:r}),this.toneMapped=!1,e&&this.setShaderParts(e),t&&this.setDefines(t),n&&this.setUniforms(n),this.copyCameraSettings(i)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthBuffer=e,this.depthPacking=t}setShaderData(e){this.setShaderParts(e.shaderParts),this.setDefines(e.defines),this.setUniforms(e.uniforms),this.setExtensions(e.extensions)}setShaderParts(e){var t,n,i,r,s;return this.fragmentShader="#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if THREE_REVISION >= 137\nvec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include <encodings_fragment>\n#endif\n#include <dithering_fragment>\n}".replace(Nr.FRAGMENT_HEAD,null!=(t=e.get(Nr.FRAGMENT_HEAD))?t:"").replace(Nr.FRAGMENT_MAIN_UV,null!=(n=e.get(Nr.FRAGMENT_MAIN_UV))?n:"").replace(Nr.FRAGMENT_MAIN_IMAGE,null!=(i=e.get(Nr.FRAGMENT_MAIN_IMAGE))?i:""),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEADvoid main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORTgl_Position=vec4(position.xy,1.0,1.0);}".replace(Nr.VERTEX_HEAD,null!=(r=e.get(Nr.VERTEX_HEAD))?r:"").replace(Nr.VERTEX_MAIN_SUPPORT,null!=(s=e.get(Nr.VERTEX_MAIN_SUPPORT))?s:""),this.needsUpdate=!0,this}setDefines(e){for(const t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(const t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){this.extensions={};for(const t of e)this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof y?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const n=this.uniforms;n.resolution.value.set(e,t),n.texelSize.value.set(1/e,1/t),n.aspect.value=e/t}static get Section(){return Nr}},Xr=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super({name:"LuminanceMaterial",defines:{THREE_REVISION:H.replace(/\D+/g,"")},uniforms:{inputBuffer:new L(null),threshold:new L(0),smoothing:new L(1),range:new L(null)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);l*=low*high;\n#elif defined(THRESHOLD)\nl=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=vec4(texel.rgb*l,l);\n#else\ngl_FragColor=vec4(l);\n#endif\n}",vertexShader:Ir}),this.toneMapped=!1,this.colorOutput=e,this.luminanceRange=t}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}},Zr=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new w;super({name:"OutlineMaterial",uniforms:{inputBuffer:new L(null),texelSize:new L(new w)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"uniform lowp sampler2D inputBuffer;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 c0=texture2D(inputBuffer,vUv0).rg;vec2 c1=texture2D(inputBuffer,vUv1).rg;vec2 c2=texture2D(inputBuffer,vUv2).rg;vec2 c3=texture2D(inputBuffer,vUv3).rg;float d0=(c0.x-c1.x)*0.5;float d1=(c2.x-c3.x)*0.5;float d=length(vec2(d0,d1));float a0=min(c0.y,c1.y);float a1=min(c2.y,c3.y);float visibilityFactor=min(a0,a1);gl_FragColor.rg=(1.0-visibilityFactor>0.001)?vec2(d,0.0):vec2(0.0,d);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=vec2(uv.x+texelSize.x,uv.y);vUv1=vec2(uv.x-texelSize.x,uv.y);vUv2=vec2(uv.x,uv.y+texelSize.y);vUv3=vec2(uv.x,uv.y-texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.uniforms.texelSize.value.set(e.x,e.y),this.uniforms.maskTexture=this.uniforms.inputBuffer}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},Kr=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new w,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new w;super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new L(null),searchTexture:new L(null),areaTexture:new L(null),resolution:new L(t),texelSize:new L(e)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)\n#if __VERSION__ < 300\n#define round(v) floor(v + 0.5)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x>end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x<end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.y>end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;i++){if(!(texCoord.y<end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);\n#endif\n}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);\n#endif\n}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){\n#if !defined(DISABLE_DIAG_DETECTION)\nweights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){\n#endif\nvec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);\n#if !defined(DISABLE_DIAG_DETECTION)\n}else{e.r=0.0;}\n#endif\n}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}",vertexShader:"uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(e){this.uniforms.searchTexture.value=e}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(e){this.uniforms.areaTexture.value=e}setLookupTextures(e,t){this.searchTexture=e,this.areaTexture=t}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(e){const t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(e){this.orthogonalSearchSteps=e}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(e){const t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(e){this.diagonalSearchSteps=e}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(e){this.diagonalDetection=e}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(e){const t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(e){this.cornerRounding=e}get cornerDetection(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerDetection(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(e){this.cornerDetection=e}setSize(e,t){const n=this.uniforms;n.texelSize.value.set(1/e,1/t),n.resolution.value.set(e,t)}},qr=class extends j{constructor(e){super({name:"SSAOMaterial",defines:{SAMPLES_INT:"0",INV_SAMPLES_FLOAT:"0.0",SPIRAL_TURNS:"0.0",RADIUS:"1.0",RADIUS_SQ:"1.0",DISTANCE_SCALING:"1",DEPTH_PACKING:"0"},uniforms:{depthBuffer:new L(null),normalBuffer:new L(null),normalDepthBuffer:new L(null),noiseTexture:new L(null),inverseProjectionMatrix:new L(new m),projectionMatrix:new L(new m),texelSize:new L(new w),cameraNearFar:new L(new w),distanceCutoff:new L(new w),proximityCutoff:new L(new w),noiseScale:new L(new w),minRadiusScale:new L(.33),intensity:new L(1),fade:new L(.01),bias:new L(0)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <packing>\n#ifdef NORMAL_DEPTH\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){return texture2D(normalDepthBuffer,uv).a;}\n#else\nuniform lowp sampler2D normalBuffer;\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}\n#endif\nuniform lowp sampler2D noiseTexture;uniform mat4 inverseProjectionMatrix;uniform mat4 projectionMatrix;uniform vec2 texelSize;uniform vec2 cameraNearFar;uniform float intensity;uniform float minRadiusScale;uniform float fade;uniform float bias;uniform vec2 distanceCutoff;uniform vec2 proximityCutoff;varying vec2 vUv;varying vec2 vUv2;float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#endif\n}vec3 getViewPosition(const in vec2 screenPosition,const in float depth,const in float viewZ){vec4 clipPosition=vec4(vec3(screenPosition,depth)*2.0-1.0,1.0);float clipW=projectionMatrix[2][3]*viewZ+projectionMatrix[3][3];clipPosition*=clipW;return(inverseProjectionMatrix*clipPosition).xyz;}float getAmbientOcclusion(const in vec3 p,const in vec3 n,const in float depth,const in vec2 uv){float radiusScale=1.0-smoothstep(0.0,distanceCutoff.y,depth);radiusScale=radiusScale*(1.0-minRadiusScale)+minRadiusScale;float radius=RADIUS*radiusScale;float noise=texture2D(noiseTexture,vUv2).r;float baseAngle=noise*PI2;float rings=SPIRAL_TURNS*PI2;float occlusion=0.0;int taps=0;for(int i=0;i<SAMPLES_INT;++i){float alpha=(float(i)+0.5)*INV_SAMPLES_FLOAT;float angle=alpha*rings+baseAngle;vec2 rotation=vec2(cos(angle),sin(angle));vec2 coords=alpha*radius*rotation*texelSize+uv;if(coords.s<0.0||coords.s>1.0||coords.t<0.0||coords.t>1.0){continue;}float sampleDepth=readDepth(coords);float viewZ=getViewZ(sampleDepth);\n#ifdef PERSPECTIVE_CAMERA\nfloat linearSampleDepth=viewZToOrthographicDepth(viewZ,cameraNearFar.x,cameraNearFar.y);\n#else\nfloat linearSampleDepth=sampleDepth;\n#endif\nfloat proximity=abs(depth-linearSampleDepth);if(proximity<proximityCutoff.y){float falloff=1.0-smoothstep(proximityCutoff.x,proximityCutoff.y,proximity);vec3 Q=getViewPosition(coords,sampleDepth,viewZ);vec3 v=Q-p;float vv=dot(v,v);float vn=dot(v,n)-bias;float f=max(RADIUS_SQ-vv,0.0)/RADIUS_SQ;occlusion+=(f*f*f*max(vn/(fade+vv),0.0))*falloff;}++taps;}return occlusion/(4.0*max(float(taps),1.0));}void main(){\n#ifdef NORMAL_DEPTH\nvec4 normalDepth=texture2D(normalDepthBuffer,vUv);\n#else\nvec4 normalDepth=vec4(texture2D(normalBuffer,vUv).xyz,readDepth(vUv));\n#endif\nfloat ao=0.0;float depth=normalDepth.a;float viewZ=getViewZ(depth);\n#ifdef PERSPECTIVE_CAMERA\nfloat linearDepth=viewZToOrthographicDepth(viewZ,cameraNearFar.x,cameraNearFar.y);\n#else\nfloat linearDepth=depth;\n#endif\nif(linearDepth<distanceCutoff.y){vec3 viewPosition=getViewPosition(vUv,depth,viewZ);vec3 viewNormal=unpackRGBToNormal(normalDepth.rgb);ao+=getAmbientOcclusion(viewPosition,viewNormal,linearDepth,vUv);float d=smoothstep(distanceCutoff.x,distanceCutoff.y,linearDepth);ao=mix(ao,0.0,d);\n#ifdef LEGACY_INTENSITY\nao=clamp(1.0-pow(1.0-ao,abs(intensity)),0.0,1.0);\n#endif\n}gl_FragColor.r=ao;}",vertexShader:"uniform vec2 noiseScale;varying vec2 vUv;varying vec2 vUv2;void main(){vUv=position.xy*0.5+0.5;vUv2=vUv*noiseScale;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.copyCameraSettings(e),this.resolution=new w,this.r=1}get near(){return this.uniforms.cameraNearFar.value.x}get far(){return this.uniforms.cameraNearFar.value.y}set normalDepthBuffer(e){this.uniforms.normalDepthBuffer.value=e,null!==e?this.defines.NORMAL_DEPTH="1":delete this.defines.NORMAL_DEPTH,this.needsUpdate=!0}setNormalDepthBuffer(e){this.normalDepthBuffer=e}set normalBuffer(e){this.uniforms.normalBuffer.value=e}setNormalBuffer(e){this.uniforms.normalBuffer.value=e}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthBuffer=e,this.depthPacking=t}set noiseTexture(e){this.uniforms.noiseTexture.value=e}setNoiseTexture(e){this.uniforms.noiseTexture.value=e}get samples(){return Number(this.defines.SAMPLES_INT)}set samples(e){this.defines.SAMPLES_INT=e.toFixed(0),this.defines.INV_SAMPLES_FLOAT=(1/e).toFixed(9),this.needsUpdate=!0}getSamples(){return this.samples}setSamples(e){this.samples=e}get rings(){return Number(this.defines.SPIRAL_TURNS)}set rings(e){this.defines.SPIRAL_TURNS=e.toFixed(1),this.needsUpdate=!0}getRings(){return this.rings}setRings(e){this.rings=e}get intensity(){return this.uniforms.intensity.value}set intensity(e){this.uniforms.intensity.value=e,void 0===this.defines.LEGACY_INTENSITY&&(this.defines.LEGACY_INTENSITY="1",this.needsUpdate=!0)}getIntensity(){return this.uniforms.intensity.value}setIntensity(e){this.uniforms.intensity.value=e}get fade(){return this.uniforms.fade.value}set fade(e){this.uniforms.fade.value=e}getFade(){return this.uniforms.fade.value}setFade(e){this.uniforms.fade.value=e}get bias(){return this.uniforms.bias.value}set bias(e){this.uniforms.bias.value=e}getBias(){return this.uniforms.bias.value}setBias(e){this.uniforms.bias.value=e}get minRadiusScale(){return this.uniforms.minRadiusScale.value}set minRadiusScale(e){this.uniforms.minRadiusScale.value=e}getMinRadiusScale(){return this.uniforms.minRadiusScale.value}setMinRadiusScale(e){this.uniforms.minRadiusScale.value=e}updateRadius(){const e=this.r*this.resolution.height;this.defines.RADIUS=e.toFixed(11),this.defines.RADIUS_SQ=(e*e).toFixed(11),this.needsUpdate=!0}get radius(){return this.r}set radius(e){this.r=Math.min(Math.max(e,1e-6),1),this.updateRadius()}getRadius(){return this.radius}setRadius(e){this.radius=e}get distanceScaling(){return!0}set distanceScaling(e){}isDistanceScalingEnabled(){return this.distanceScaling}setDistanceScalingEnabled(e){this.distanceScaling=e}get distanceThreshold(){return this.uniforms.distanceCutoff.value.x}set distanceThreshold(e){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.distanceFalloff,0),1))}get worldDistanceThreshold(){return-Or(this.distanceThreshold,this.near,this.far)}set worldDistanceThreshold(e){this.distanceThreshold=Pr(-e,this.near,this.far)}get distanceFalloff(){return this.uniforms.distanceCutoff.value.y-this.distanceThreshold}set distanceFalloff(e){this.uniforms.distanceCutoff.value.y=Math.min(Math.max(this.distanceThreshold+e,0),1)}get worldDistanceFalloff(){return-Or(this.distanceFalloff,this.near,this.far)}set worldDistanceFalloff(e){this.distanceFalloff=Pr(-e,this.near,this.far)}setDistanceCutoff(e,t){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}get proximityThreshold(){return this.uniforms.proximityCutoff.value.x}set proximityThreshold(e){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.proximityFalloff,0),1))}get worldProximityThreshold(){return-Or(this.proximityThreshold,this.near,this.far)}set worldProximityThreshold(e){this.proximityThreshold=Pr(-e,this.near,this.far)}get proximityFalloff(){return this.uniforms.proximityCutoff.value.y-this.proximityThreshold}set proximityFalloff(e){this.uniforms.proximityCutoff.value.y=Math.min(Math.max(this.proximityThreshold+e,0),1)}get worldProximityFalloff(){return-Or(this.proximityFalloff,this.near,this.far)}set worldProximityFalloff(e){this.proximityFalloff=Pr(-e,this.near,this.far)}setProximityCutoff(e,t){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNearFar.value.set(e.near,e.far),this.uniforms.projectionMatrix.value.copy(e.projectionMatrix),this.uniforms.inverseProjectionMatrix.value.copy(e.projectionMatrix).invert(),e instanceof y?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const n=this.uniforms,i=n.noiseTexture.value;null!==i&&n.noiseScale.value.set(e/i.image.width,t/i.image.height),n.texelSize.value.set(1/e,1/t),this.resolution.set(e,t),this.updateRadius()}},Jr=class extends j{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new L(null),supportBuffer:new L(null),texelSize:new L(new w),radius:new L(.85)},blending:z,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;\n#else\nuniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;\n#endif\nuniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);\n#include <encodings_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}set supportBuffer(e){this.uniforms.supportBuffer.value=e}get radius(){return this.uniforms.radius.value}set radius(e){this.uniforms.radius.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},$r=new E,es=null;var ts=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Pass",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new c,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$r;this.name=e,this.renderer=null,this.scene=t,this.camera=n,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){const t=this.fullscreenMaterial;null!==t&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;null!==t?t.material=e:(t=new u(function(){if(null===es){const e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);void 0!==(es=new J).setAttribute?(es.setAttribute("position",new $(e,3)),es.setAttribute("uv",new $(t,2))):(es.addAttribute("position",new $(e,3)),es.addAttribute("uv",new $(t,2)))}return es}(),e),t.frustumCulled=!1,null===this.scene&&(this.scene=new c),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e){}render(e,t,n,i,r){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof B||t instanceof ee||t instanceof l||t instanceof ts)&&this[e].dispose()}}},ns=class extends ts{constructor(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];super("CopyPass"),this.fullscreenMaterial=new Hr,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new B(1,1,{minFilter:U,magFilter:U,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTarget.texture.type=n,n!==D?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":e.outputEncoding===T&&(this.renderTarget.texture.encoding=T))}},is=class extends ts{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(e,t,n,i,r){const s=e.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},rs=new a,ss=class extends ts{constructor(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=n,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,n){this.color=e,this.depth=t,this.stencil=n}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,n,i,r){const s=this.overrideClearColor,o=this.overrideClearAlpha,a=e.getClearAlpha(),l=null!==s,c=o>=0;l?(e.getClearColor(rs),e.setClearColor(s,c?o:a)):c&&e.setClearAlpha(o),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(rs,a):c&&e.setClearAlpha(a)}},os=-1,as=class extends G{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:os,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:os,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;super(),this.resizable=e,this.baseSize=new w(1,1),this.preferredSize=new w(t,n),this.target=this.preferredSize,this.s=i,this.effectiveSize=new w,this.addEventListener("change",(()=>this.updateEffectiveSize())),this.updateEffectiveSize()}updateEffectiveSize(){const e=this.baseSize,t=this.preferredSize,n=this.effectiveSize,i=this.scale;t.width!==os?n.width=t.width:t.height!==os?n.width=Math.round(t.height*(e.width/Math.max(e.height,1))):n.width=Math.round(e.width*i),t.height!==os?n.height=t.height:t.width!==os?n.height=Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):n.height=Math.round(e.height*i)}get width(){return this.effectiveSize.width}set width(e){this.preferredWidth=e}get height(){return this.effectiveSize.height}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferredSize.setScalar(os),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.baseSize.width}set baseWidth(e){this.baseSize.width!==e&&(this.baseSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(e){this.baseWidth=e}get baseHeight(){return this.baseSize.height}set baseHeight(e){this.baseSize.height!==e&&(this.baseSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){this.baseSize.width===e&&this.baseSize.height===t||(this.baseSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(e){this.preferredSize.width!==e&&(this.preferredSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferredSize.height}set preferredHeight(e){this.preferredSize.height!==e&&(this.preferredSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){this.preferredSize.width===e&&this.preferredSize.height===t||(this.preferredSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(e){this.s=e.scale,this.baseSize.set(e.baseWidth,e.baseHeight),this.preferredSize.set(e.preferredWidth,e.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return os}},ls=!1,cs=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case Y:t=this.materialsFlatShadedDoubleSide;break;case V:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case Y:t=this.materialsDoubleSide;break;case V:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){const t=this.materials=[e.clone(),e.clone(),e.clone()];for(const n of t)n.uniforms=Object.assign({},e.uniforms),n.side=Q;t[2].skinning=!0,this.materialsBackSide=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.side=V,n})),this.materialsDoubleSide=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.side=Y,n})),this.materialsFlatShaded=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n})),this.materialsFlatShadedBackSide=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=V,n})),this.materialsFlatShadedDoubleSide=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=Y,n}))}}render(e,t,n){const i=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,ls){const i=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,n);for(const e of i)e[0].material=e[1];this.meshCount!==i.size&&i.clear()}else{const i=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,n),t.overrideMaterial=i}e.shadowMap.enabled=i}disposeMaterials(){if(null!==this.material){const e=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const t of e)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return ls}static set workaroundEnabled(e){ls=e}},hs=class extends ts{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new ss,this.overrideMaterialManager=null===n?null:new cs(n),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){const e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){const t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new cs(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,n,i,r){const s=this.scene,o=this.camera,a=this.selection,l=o.layers.mask,c=s.background,h=e.shadowMap.autoUpdate,u=this.renderToScreen?null:t;null!==a&&o.layers.set(a.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(u),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,s,o):e.render(s,o),o.layers.mask=l,s.background=c,e.shadowMap.autoUpdate=h}},us=class extends ts{constructor(e,t){let{renderTarget:n,resolutionScale:i=1,width:r=as.AUTO_SIZE,height:s=as.AUTO_SIZE,resolutionX:o=r,resolutionY:l=s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super("DepthPass"),this.needsSwap=!1,this.renderPass=new hs(e,t,new W({depthPacking:F}));const c=this.renderPass;c.skipShadowMapUpdate=!0,c.ignoreBackground=!0;const h=c.getClearPass();h.overrideClearColor=new a(16777215),h.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new B(1,1,{minFilter:I,magFilter:I}),this.renderTarget.texture.name="DepthPass.Target");const u=this.resolution=new as(this,o,l,i);u.addEventListener("change",(e=>this.setSize(u.baseWidth,u.baseHeight)))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},ds=class extends ts{constructor(){let{normalBuffer:e=null,resolutionScale:t=.5,width:n=as.AUTO_SIZE,height:i=as.AUTO_SIZE,resolutionX:r=n,resolutionY:s=i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("DepthDownsamplingPass");const o=new Vr;o.normalBuffer=e,this.fullscreenMaterial=o,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new B(1,1,{minFilter:I,magFilter:I,depthBuffer:!1,type:X}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;const a=this.resolution=new as(this,r,s,t);a.addEventListener("change",(e=>this.setSize(a.baseWidth,a.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t}render(e,t,n,i,r){e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.fullscreenMaterial.setSize(e,t)}initialize(e,t,n){const i=e.getContext();if(!(i.getExtension("EXT_color_buffer_float")||i.getExtension("EXT_color_buffer_half_float")))throw new Error("Rendering to float texture is not supported.")}};function fs(e,t,n){for(const i of t){const t="$1"+e+i.charAt(0).toUpperCase()+i.slice(1),r=new RegExp("([^\\.])(\\b"+i+"\\b)","g");for(const e of n.entries())null!==e[1]&&n.set(e[0],e[1].replace(r,t))}}function ps(e,t,n){var i,r,s,o,a;let l=t.getFragmentShader(),c=t.getVertexShader();const h=void 0!==l&&/mainImage/.test(l),u=void 0!==l&&/mainUv/.test(l);if(n.attributes|=t.getAttributes(),void 0===l)throw new Error(`Missing fragment shader (${t.name})`);if(u&&0!=(n.attributes&Lr.CONVOLUTION))throw new Error(`Effects that transform UVs are incompatible with convolution effects (${t.name})`);if(!h&&!u)throw new Error(`Could not find mainImage or mainUv function (${t.name})`);{const d=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,f=n.shaderParts;let p=null!=(i=f.get(Nr.FRAGMENT_HEAD))?i:"",g=null!=(r=f.get(Nr.FRAGMENT_MAIN_UV))?r:"",m=null!=(s=f.get(Nr.FRAGMENT_MAIN_IMAGE))?s:"",v=null!=(o=f.get(Nr.VERTEX_HEAD))?o:"",y=null!=(a=f.get(Nr.VERTEX_MAIN_SUPPORT))?a:"";const b=new Set,w=new Set;if(u&&(g+=`\t${e}MainUv(UV);\n`,n.uvTransformation=!0),null!==c&&/mainSupport/.test(c)){const t=/mainSupport *\([\w\s]*?uv\s*?\)/.test(c);y+=`\t${e}MainSupport(`,y+=t?"vUv);\n":");\n";for(const e of c.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const t of e[1].split(/\s*,\s*/))n.varyings.add(t),b.add(t),w.add(t);for(const e of c.matchAll(d))w.add(e[1])}for(const e of l.matchAll(d))w.add(e[1]);for(const e of t.defines.keys())w.add(e.replace(/\([\w\s,]*\)/g,""));for(const e of t.uniforms.keys())w.add(e);w.delete("while"),w.delete("for"),w.delete("if"),t.uniforms.forEach(((t,i)=>n.uniforms.set(e+i.charAt(0).toUpperCase()+i.slice(1),t))),t.defines.forEach(((t,i)=>n.defines.set(e+i.charAt(0).toUpperCase()+i.slice(1),t)));const A=new Map([["fragment",l],["vertex",c]]);fs(e,w,n.defines),fs(e,w,A),l=A.get("fragment"),c=A.get("vertex");const x=t.blendMode;if(n.blendModes.set(x.blendFunction,x),h){null!==t.inputColorSpace&&t.inputColorSpace!==n.colorSpace&&(m+=t.inputColorSpace===T?"color0 = LinearTosRGB(color0);\n\t":"color0 = sRGBToLinear(color0);\n\t"),null!==t.outputColorSpace?n.colorSpace=t.outputColorSpace:null!==t.inputColorSpace&&(n.colorSpace=t.inputColorSpace);const i=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;m+=`${e}MainImage(color0, UV, `,0!=(n.attributes&Lr.DEPTH)&&i.test(l)&&(m+="depth, ",n.readDepth=!0),m+="color1);\n\t";const r=e+"BlendOpacity";n.uniforms.set(r,x.opacity),m+=`color0 = blend${x.blendFunction}(color0, color1, ${r});\n\n\t`,p+=`uniform float ${r};\n\n`}if(p+=l+"\n",null!==c&&(v+=c+"\n"),f.set(Nr.FRAGMENT_HEAD,p),f.set(Nr.FRAGMENT_MAIN_UV,g),f.set(Nr.FRAGMENT_MAIN_IMAGE,m),f.set(Nr.VERTEX_HEAD,v),f.set(Nr.VERTEX_MAIN_SUPPORT,y),null!==t.extensions)for(const e of t.extensions)n.extensions.add(e)}}var gs=class extends ts{constructor(e){super("EffectPass"),this.fullscreenMaterial=new Wr(null,null,null,e),this.listener=e=>this.handleEvent(e),this.effects=[];for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.setEffects(n),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(e){for(const t of this.effects)t.mainScene=e}set mainCamera(e){this.fullscreenMaterial.copyCameraSettings(e);for(const t of this.effects)t.mainCamera=e}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){const t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}setEffects(e){for(const e of this.effects)e.removeEventListener("change",this.listener);this.effects=e.sort(((e,t)=>t.attributes-e.attributes));for(const e of this.effects)e.addEventListener("change",this.listener)}updateMaterial(){const e=new Ss;let t=0;for(const n of this.effects)if(n.blendMode.blendFunction===Rr.DST)e.attributes|=n.getAttributes()&Lr.DEPTH;else{if(0!=(e.attributes&n.getAttributes()&Lr.CONVOLUTION))throw new Error(`Convolution effects cannot be merged (${n.name})`);ps("e"+t++,n,e)}let n=e.shaderParts.get(Nr.FRAGMENT_HEAD),i=e.shaderParts.get(Nr.FRAGMENT_MAIN_IMAGE),r=e.shaderParts.get(Nr.FRAGMENT_MAIN_UV);const s=/\bblend\b/g;for(const t of e.blendModes.values())n+=t.getShaderCode().replace(s,`blend${t.blendFunction}`)+"\n";0!=(e.attributes&Lr.DEPTH)?(e.readDepth&&(i="float depth = readDepth(UV);\n\n\t"+i),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,e.colorSpace===T&&(i+="color0 = sRGBToLinear(color0);\n\t"),e.uvTransformation?(r="vec2 transformedUv = vUv;\n"+r,e.defines.set("UV","transformedUv")):e.defines.set("UV","vUv"),e.shaderParts.set(Nr.FRAGMENT_HEAD,n),e.shaderParts.set(Nr.FRAGMENT_MAIN_IMAGE,i),e.shaderParts.set(Nr.FRAGMENT_MAIN_UV,r),e.shaderParts.forEach(((e,t,n)=>n.set(t,null==e?void 0:e.trim().replace(/^#/,"\n#")))),this.skipRendering=0===t,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(e)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t;for(const n of this.effects)n.setDepthTexture(e,t)}render(e,t,n,i,r){for(const n of this.effects)n.update(e,t,i);if(!this.skipRendering||this.renderToScreen){const r=this.fullscreenMaterial;r.inputBuffer=t.texture,r.time+=i*this.timeScale,e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}}setSize(e,t){this.fullscreenMaterial.setSize(e,t);for(const n of this.effects)n.setSize(e,t)}initialize(e,t,n){this.renderer=e;for(const i of this.effects)i.initialize(e,t,n);this.updateMaterial(),void 0!==n&&n!==D&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const e of this.effects)e.removeEventListener("change",this.listener),e.dispose()}handleEvent(e){if("change"===e.type)this.recompile()}},ms=class extends ts{constructor(){let{kernelSize:e=kr.MEDIUM,resolutionScale:t=.5,width:n=as.AUTO_SIZE,height:i=as.AUTO_SIZE,resolutionX:r=n,resolutionY:s=i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("KawaseBlurPass"),this.renderTargetA=new B(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const o=this.resolution=new as(this,r,s,t);o.addEventListener("change",(e=>this.setSize(o.baseWidth,o.baseHeight))),this._blurMaterial=new Fr,this._blurMaterial.kernelSize=e,this.copyMaterial=new Hr}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(e){this._blurMaterial=e}get dithering(){return this.copyMaterial.dithering}set dithering(e){this.copyMaterial.dithering=e}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(e){this.blurMaterial.kernelSize=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB,c=this.blurMaterial,h=c.kernelSequence;let u=t;this.fullscreenMaterial=c;for(let t=0,n=h.length;t<n;++t){const n=0==(1&t)?a:l;c.kernel=h[t],c.inputBuffer=u.texture,e.setRenderTarget(n),e.render(s,o),u=n}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=u.texture,e.setRenderTarget(this.renderToScreen?null:n),e.render(s,o)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.renderTargetA.setSize(i,r),this.renderTargetB.setSize(i,r),this.blurMaterial.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTargetA.texture.type=n,this.renderTargetB.texture.type=n,n!==D?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):e.outputEncoding===T&&(this.renderTargetA.texture.encoding=T,this.renderTargetB.texture.encoding=T))}static get AUTO_SIZE(){return as.AUTO_SIZE}},vs=class extends ts{constructor(){let{renderTarget:e,luminanceRange:t,colorOutput:n,resolutionScale:i=1,width:r=as.AUTO_SIZE,height:s=as.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("LuminancePass"),this.fullscreenMaterial=new Xr(n,t),this.needsSwap=!1,this.renderTarget=e,void 0===this.renderTarget&&(this.renderTarget=new B(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const l=this.resolution=new as(this,o,a,i);l.addEventListener("change",(e=>this.setSize(l.baseWidth,l.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}initialize(e,t,n){void 0!==n&&n!==D&&(this.renderTarget.texture.type=n,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},ys=class extends ts{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new ss(!1,!1,!0),this.inverse=!1}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,n,i,r){const s=e.getContext(),o=e.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,h=this.inverted?0:1,u=1-h;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.stencil.setFunc(s.ALWAYS,h,4294967295),o.stencil.setClear(u),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(e,null):(c.render(e,t),c.render(e,n))),this.renderToScreen?(e.setRenderTarget(null),e.render(a,l)):(e.setRenderTarget(t),e.render(a,l),e.setRenderTarget(n),e.render(a,l)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(s.EQUAL,1,4294967295),o.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.stencil.setLocked(!0)}},bs=class extends ts{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new B(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new Yr,this.upsamplingMaterial=new Jr,this.resolution=new w}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(e){if(this.levels!==e){const t=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let n=0;n<e;++n){const e=t.clone();e.texture.name="Downsampling.Mipmap"+n,this.downsamplingMipmaps.push(e)}this.upsamplingMipmaps.push(t);for(let n=1,i=e-1;n<i;++n){const e=t.clone();e.texture.name="Upsampling.Mipmap"+n,this.upsamplingMipmaps.push(e)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(e){this.upsamplingMaterial.radius=e}render(e,t,n,i,r){const{scene:s,camera:o}=this,{downsamplingMaterial:a,upsamplingMaterial:l}=this,{downsamplingMipmaps:c,upsamplingMipmaps:h}=this;let u=t;this.fullscreenMaterial=a;for(let t=0,n=c.length;t<n;++t){const n=c[t];a.setSize(u.width,u.height),a.inputBuffer=u.texture,e.setRenderTarget(n),e.render(s,o),u=n}this.fullscreenMaterial=l;for(let t=h.length-1;t>=0;--t){const n=h[t];l.setSize(u.width,u.height),l.inputBuffer=u.texture,l.supportBuffer=c[t].texture,e.setRenderTarget(n),e.render(s,o),u=n}}setSize(e,t){const n=this.resolution;n.set(e,t);let i=n.width,r=n.height;for(let e=0,t=this.downsamplingMipmaps.length;e<t;++e)i=Math.round(.5*i),r=Math.round(.5*r),this.downsamplingMipmaps[e].setSize(i,r),e<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[e].setSize(i,r)}initialize(e,t,n){if(void 0!==n){const t=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(const e of t)e.texture.type=n;if(n!==D)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(e.outputEncoding===T)for(const e of t)e.texture.encoding=T}}dispose(){super.dispose();for(const e of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))e.dispose()}},ws=class extends ts{constructor(e,t){let{renderTarget:n,resolutionScale:i=1,width:r=as.AUTO_SIZE,height:s=as.AUTO_SIZE,resolutionX:o=r,resolutionY:l=s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super("NormalPass"),this.needsSwap=!1,this.renderPass=new hs(e,t,new C);const c=this.renderPass;c.ignoreBackground=!0,c.skipShadowMapUpdate=!0;const h=c.getClearPass();h.overrideClearColor=new a(7829503),h.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new B(1,1,{minFilter:I,magFilter:I}),this.renderTarget.texture.name="NormalPass.Target");const u=this.resolution=new as(this,o,l,i);u.addEventListener("change",(e=>this.setSize(u.baseWidth,u.baseHeight)))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s,s)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},As=class extends ts{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"inputBuffer";super("ShaderPass"),this.fullscreenMaterial=e,this.input=t}setInput(e){this.input=e}render(e,t,n,i,r){const s=this.fullscreenMaterial.uniforms;null!==t&&void 0!==s&&void 0!==s[this.input]&&(s[this.input].value=t.texture),e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}initialize(e,t,n){void 0!==n&&n!==D&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},xs=.001,Ss=class{constructor(){this.shaderParts=new Map([[Nr.FRAGMENT_HEAD,null],[Nr.FRAGMENT_MAIN_UV,null],[Nr.FRAGMENT_MAIN_IMAGE,null],[Nr.VERTEX_HEAD,null],[Nr.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=Lr.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=_}},Es=class extends Set{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;super(),this.l=t,this.exclusive=!1,void 0!==e&&this.set(e)}get layer(){return this.l}set layer(e){const t=this.l;for(const n of this)n.layers.disable(t),n.layers.enable(e);this.l=e}getLayer(){return this.layer}setLayer(e){this.layer=e}isExclusive(){return this.exclusive}setExclusive(e){this.exclusive=e}clear(){const e=this.layer;for(const t of this)t.layers.disable(e);return super.clear()}set(e){this.clear();for(const t of e)this.add(t);return this}indexOf(e){return this.has(e)?0:-1}add(e){return this.exclusive?e.layers.set(this.layer):e.layers.enable(this.layer),super.add(e)}delete(e){return this.has(e)&&e.layers.disable(this.layer),super.delete(e)}toggle(e){let t;return this.has(e)?(this.delete(e),t=!1):(this.add(e),t=!0),t}setVisible(e){for(const t of this)e?t.layers.enable(0):t.layers.disable(0);return this}},Ts=new Map([[Rr.ADD,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}"],[Rr.ALPHA,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}"],[Rr.AVERAGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}"],[Rr.COLOR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Rr.COLOR_BURN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}"],[Rr.COLOR_DODGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}"],[Rr.DARKEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}"],[Rr.DIFFERENCE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}"],[Rr.DIVIDE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}"],[Rr.DST,null],[Rr.EXCLUSION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}"],[Rr.HARD_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}"],[Rr.HARD_MIX,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}"],[Rr.HUE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Rr.INVERT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}"],[Rr.INVERT_RGB,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}"],[Rr.LIGHTEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}"],[Rr.LINEAR_BURN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}"],[Rr.LINEAR_DODGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}"],[Rr.LINEAR_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}"],[Rr.LUMINOSITY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Rr.MULTIPLY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}"],[Rr.NEGATION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}"],[Rr.NORMAL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}"],[Rr.OVERLAY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}"],[Rr.PIN_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}"],[Rr.REFLECT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}"],[Rr.SATURATION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Rr.SCREEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}"],[Rr.SOFT_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}"],[Rr.SRC,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}"],[Rr.SUBTRACT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}"],[Rr.VIVID_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}"]]),Ds=class extends G{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;super(),this._blendFunction=e,this.opacity=new L(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this._blendFunction}set blendFunction(e){this._blendFunction=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return Ts.get(this.blendFunction)}},Cs=class extends G{constructor(e,t){let{attributes:n=Lr.NONE,blendFunction:i=Rr.NORMAL,defines:r=new Map,uniforms:s=new Map,extensions:o=null,vertexShader:a=null}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(),this.name=e,this.renderer=null,this.attributes=n,this.fragmentShader=t,this.vertexShader=a,this.defines=r,this.uniforms=s,this.extensions=o,this.blendMode=new Ds(i),this.blendMode.addEventListener("change",(e=>this.setChanged())),this._inputColorSpace=_,this._outputColorSpace=null}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(e){this._inputColorSpace=e,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e,this.setChanged()}set mainScene(e){}set mainCamera(e){}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e){}update(e,t,n){}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof B||t instanceof ee||t instanceof l||t instanceof ts)&&this[e].dispose()}}},Bs=class extends Cs{constructor(){let{blendFunction:e=Rr.SCREEN,luminanceThreshold:t=.9,luminanceSmoothing:n=.025,mipmapBlur:i=!1,intensity:r=1,radius:s=.85,levels:o=8,kernelSize:a=kr.LARGE,resolutionScale:l=.5,width:c=as.AUTO_SIZE,height:h=as.AUTO_SIZE,resolutionX:u=c,resolutionY:d=h}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("BloomEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D map;\n#else\nuniform lowp sampler2D map;\n#endif\nuniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=texture2D(map,uv)*intensity;}",{blendFunction:e,uniforms:new Map([["map",new L(null)],["intensity",new L(r)]])}),this.renderTarget=new B(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new ms({kernelSize:a}),this.luminancePass=new vs({colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothing=n,this.mipmapBlurPass=new bs,this.mipmapBlurPass.enabled=i,this.mipmapBlurPass.radius=s,this.mipmapBlurPass.levels=o,this.uniforms.get("map").value=i?this.mipmapBlurPass.texture:this.renderTarget.texture;const f=this.resolution=new as(this,u,d,l);f.addEventListener("change",(e=>this.setSize(f.baseWidth,f.baseHeight)))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(e){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getIntensity(){return this.intensity}setIntensity(e){this.intensity=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,n){const i=this.renderTarget,r=this.luminancePass;r.enabled?(r.render(e,t),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,r.renderTarget):this.blurPass.render(e,r.renderTarget,i)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,t):this.blurPass.render(e,t,i)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.blurPass.resolution.copy(n),this.luminancePass.setSize(e,t),this.mipmapBlurPass.setSize(e,t)}initialize(e,t,n){this.blurPass.initialize(e,t,n),this.luminancePass.initialize(e,t,n),this.mipmapBlurPass.initialize(e,t,n),void 0!==n&&(this.renderTarget.texture.type=n,e.outputEncoding===T&&(this.renderTarget.texture.encoding=T))}};var Is=class extends K{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:te,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:D;super(function(e,t,n){const i=new Map([[te,1],[ne,1],[ie,2],[o,4]]);let r;if(i.has(t)||console.error("Invalid noise texture format"),n===D){r=new Uint8Array(e*i.get(t));for(let e=0,t=r.length;e<t;++e)r[e]=255*Math.random()+.5}else{r=new Float32Array(e*i.get(t));for(let e=0,t=r.length;e<t;++e)r[e]=Math.random()}return r}(e*t,n,i),e,t,n,i),this.needsUpdate=!0}};new t,new m,new a;var Ms=class extends Cs{constructor(e,t){let{blendFunction:n=Rr.SCREEN,patternTexture:i=null,patternScale:r=1,edgeStrength:s=1,pulseSpeed:o=0,visibleEdgeColor:l=16777215,hiddenEdgeColor:c=2230538,kernelSize:h=kr.VERY_SMALL,blur:u=!1,xRay:d=!0,multisampling:f=0,resolutionScale:p=.5,width:g=as.AUTO_SIZE,height:m=as.AUTO_SIZE,resolutionX:v=g,resolutionY:y=m}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super("OutlineEffect","uniform lowp sampler2D edgeTexture;uniform lowp sampler2D maskTexture;uniform vec3 visibleEdgeColor;uniform vec3 hiddenEdgeColor;uniform float pulse;uniform float edgeStrength;\n#ifdef USE_PATTERN\nuniform lowp sampler2D patternTexture;varying vec2 vUvPattern;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 edge=texture2D(edgeTexture,uv).rg;vec2 mask=texture2D(maskTexture,uv).rg;\n#ifndef X_RAY\nedge.y=0.0;\n#endif\nedge*=(edgeStrength*mask.x*pulse);vec3 color=edge.x*visibleEdgeColor+edge.y*hiddenEdgeColor;float visibilityFactor=0.0;\n#ifdef USE_PATTERN\nvec4 patternColor=texelToLinear(texture2D(patternTexture,vUvPattern));\n#ifdef X_RAY\nfloat hiddenFactor=0.5;\n#else\nfloat hiddenFactor=0.0;\n#endif\nvisibilityFactor=(1.0-mask.y>0.0)?1.0:hiddenFactor;visibilityFactor*=(1.0-mask.x)*patternColor.a;color+=visibilityFactor*patternColor.rgb;\n#endif\nfloat alpha=max(max(edge.x,edge.y),visibilityFactor);\n#ifdef ALPHA\noutputColor=vec4(color,alpha);\n#else\noutputColor=vec4(color,max(alpha,inputColor.a));\n#endif\n}",{uniforms:new Map([["maskTexture",new L(null)],["edgeTexture",new L(null)],["edgeStrength",new L(s)],["visibleEdgeColor",new L(new a(l))],["hiddenEdgeColor",new L(new a(c))],["pulse",new L(1)],["patternScale",new L(r)],["patternTexture",new L(null)]])}),this.blendMode.addEventListener("change",(e=>{this.blendMode.getBlendFunction()===Rr.ALPHA?this.defines.set("ALPHA","1"):this.defines.delete("ALPHA"),this.setChanged()})),this.blendMode.setBlendFunction(n),this.patternTexture=i,this.xRay=d,this.scene=e,this.camera=t,this.renderTargetMask=new B(1,1),this.renderTargetMask.samples=f,this.renderTargetMask.texture.name="Outline.Mask",this.uniforms.get("maskTexture").value=this.renderTargetMask.texture,this.renderTargetOutline=new B(1,1,{depthBuffer:!1}),this.renderTargetOutline.texture.name="Outline.Edges",this.uniforms.get("edgeTexture").value=this.renderTargetOutline.texture,this.clearPass=new ss,this.clearPass.overrideClearColor=new a(0),this.clearPass.overrideClearAlpha=1,this.depthPass=new us(e,t),this.maskPass=new hs(e,t,new Gr(this.depthPass.texture,t));const b=this.maskPass.clearPass;b.overrideClearColor=new a(16777215),b.overrideClearAlpha=1,this.blurPass=new ms({resolutionScale:p,resolutionX:v,resolutionY:y,kernelSize:h}),this.blurPass.enabled=u;const w=this.blurPass.resolution;w.addEventListener("change",(e=>this.setSize(w.baseWidth,w.baseHeight))),this.outlinePass=new As(new Zr);this.outlinePass.fullscreenMaterial.inputBuffer=this.renderTargetMask.texture,this.time=0,this.active=!1,this.selection=new Es,this.selection.layer=10,this.pulseSpeed=o}set mainScene(e){this.scene=e,this.depthPass.mainScene=e,this.maskPass.mainScene=e}set mainCamera(e){this.camera=e,this.depthPass.mainCamera=e,this.maskPass.mainCamera=e,this.maskPass.overrideMaterial.copyCameraSettings(e)}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.getResolution()}get multisampling(){return this.renderTargetMask.samples}set multisampling(e){this.renderTargetMask.samples=e,this.renderTargetMask.dispose()}get patternScale(){return this.uniforms.get("patternScale").value}set patternScale(e){this.uniforms.get("patternScale").value=e}get edgeStrength(){return this.uniforms.get("edgeStrength").value}set edgeStrength(e){this.uniforms.get("edgeStrength").value=e}get visibleEdgeColor(){return this.uniforms.get("visibleEdgeColor").value}set visibleEdgeColor(e){this.uniforms.get("visibleEdgeColor").value=e}get hiddenEdgeColor(){return this.uniforms.get("hiddenEdgeColor").value}set hiddenEdgeColor(e){this.uniforms.get("hiddenEdgeColor").value=e}getBlurPass(){return this.blurPass}getSelection(){return this.selection}getPulseSpeed(){return this.pulseSpeed}setPulseSpeed(e){this.pulseSpeed=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get selectionLayer(){return this.selection.layer}set selectionLayer(e){this.selection.layer=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get blur(){return this.blurPass.enabled}set blur(e){this.blurPass.enabled=e}get xRay(){return this.defines.has("X_RAY")}set xRay(e){this.xRay!==e&&(e?this.defines.set("X_RAY","1"):this.defines.delete("X_RAY"),this.setChanged())}isXRayEnabled(){return this.xRay}setXRayEnabled(e){this.xRay=e}get patternTexture(){return this.uniforms.get("patternTexture").value}set patternTexture(e){if(null!==e?(e.wrapS=e.wrapT=N,this.defines.set("USE_PATTERN","1"),this.setVertexShader("uniform float patternScale;varying vec2 vUvPattern;void mainSupport(const in vec2 uv){vUvPattern=uv*vec2(aspect,1.0)*patternScale;}")):(this.defines.delete("USE_PATTERN"),this.setVertexShader(null)),null!==this.renderer){const t=Mr(e,this.renderer.capabilities.isWebGL2);this.defines.set("texelToLinear(texel)",t)}this.uniforms.get("patternTexture").value=e,this.setChanged()}setPatternTexture(e){this.patternTexture=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}setSelection(e){return this.selection.set(e),this}clearSelection(){return this.selection.clear(),this}selectObject(e){return this.selection.add(e),this}deselectObject(e){return this.selection.delete(e),this}update(e,t,n){const i=this.scene,r=this.camera,s=this.selection,o=this.uniforms.get("pulse"),a=i.background,l=r.layers.mask;s.size>0?(i.background=null,o.value=1,this.pulseSpeed>0&&(o.value=.375*Math.cos(this.time*this.pulseSpeed*10)+.625),this.active=!0,this.time+=n,s.setVisible(!1),this.depthPass.render(e),s.setVisible(!0),r.layers.set(s.layer),this.maskPass.render(e,this.renderTargetMask),r.layers.mask=l,i.background=a,this.outlinePass.render(e,null,this.renderTargetOutline),this.blurPass.enabled&&this.blurPass.render(e,this.renderTargetOutline,this.renderTargetOutline)):this.active&&(this.clearPass.render(e,this.renderTargetOutline),this.active=!1)}setSize(e,t){this.blurPass.setSize(e,t),this.renderTargetMask.setSize(e,t);const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.depthPass.setSize(i,r),this.renderTargetOutline.setSize(i,r),this.outlinePass.fullscreenMaterial.setSize(i,r)}initialize(e,t,n){const i=Mr(this.patternTexture,e.capabilities.isWebGL2);this.defines.set("texelToLinear(texel)",i),this.blurPass.initialize(e,t,D),void 0!==n&&(this.depthPass.initialize(e,t,n),this.maskPass.initialize(e,t,n),this.outlinePass.initialize(e,t,n))}};new t,new t;var Os="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGyg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bv93QHoEhZTnA+nYqSGr3fBoAtaiqBUImdm5hPJwA2er+nKwBHnE+X1gUzSbnR+z11wPj/AeCpPDD3t7rvAAAAAElFTkSuQmCC",Rs=class extends Cs{constructor(){let e,t,{blendFunction:n=Rr.SRC,preset:i=jr.MEDIUM,edgeDetectionMode:r=_r.COLOR,predicationMode:s=Ur.DISABLED}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("SMAAEffect","uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",{vertexShader:"varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",blendFunction:n,attributes:Lr.CONVOLUTION|Lr.DEPTH,uniforms:new Map([["weightMap",new L(null)]])}),arguments.length>1&&(e=arguments[0],t=arguments[1],arguments.length>2&&(i=arguments[2]),arguments.length>3&&(r=arguments[3])),this.renderTargetEdges=new B(1,1,{depthBuffer:!1}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new ss(!0,!1,!1),this.clearPass.overrideClearColor=new a(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new As(new Qr),this.edgeDetectionMaterial.edgeDetectionMode=r,this.edgeDetectionMaterial.predicationMode=s,this.weightsPass=new As(new Kr);const o=new k;o.onLoad=()=>{const n=new l(e);n.name="SMAA.Search",n.magFilter=I,n.minFilter=I,n.generateMipmaps=!1,n.needsUpdate=!0,n.flipY=!0,this.weightsMaterial.searchTexture=n;const i=new l(t);i.name="SMAA.Area",i.magFilter=U,i.minFilter=U,i.generateMipmaps=!1,i.needsUpdate=!0,i.flipY=!1,this.weightsMaterial.areaTexture=i,this.dispatchEvent({type:"load"})},o.itemStart("search"),o.itemStart("area"),void 0!==e&&void 0!==t?(o.itemEnd("search"),o.itemEnd("area")):"undefined"!=typeof Image&&(e=new Image,t=new Image,e.addEventListener("load",(()=>o.itemEnd("search"))),t.addEventListener("load",(()=>o.itemEnd("area"))),e.src=Os,t.src=Ps),this.applyPreset(i)}get edgesTexture(){return this.renderTargetEdges.texture}getEdgesTexture(){return this.edgesTexture}get weightsTexture(){return this.renderTargetWeights.texture}getWeightsTexture(){return this.weightsTexture}get edgeDetectionMaterial(){return this.edgeDetectionPass.fullscreenMaterial}get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(e){this.edgeDetectionMaterial.edgeDetectionThreshold=e}setOrthogonalSearchSteps(e){this.weightsMaterial.orthogonalSearchSteps=e}applyPreset(e){const t=this.edgeDetectionMaterial,n=this.weightsMaterial;switch(e){case jr.LOW:t.edgeDetectionThreshold=.15,n.orthogonalSearchSteps=4,n.diagonalDetection=!1,n.cornerDetection=!1;break;case jr.MEDIUM:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=8,n.diagonalDetection=!1,n.cornerDetection=!1;break;case jr.HIGH:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=16,n.diagonalSearchSteps=8,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0;break;case jr.ULTRA:t.edgeDetectionThreshold=.05,n.orthogonalSearchSteps=32,n.diagonalSearchSteps=16,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0}}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.edgeDetectionMaterial.depthBuffer=e,this.edgeDetectionMaterial.depthPacking=t}update(e,t,n){this.clearPass.render(e,this.renderTargetEdges),this.edgeDetectionPass.render(e,t,this.renderTargetEdges),this.weightsPass.render(e,this.renderTargetEdges,this.renderTargetWeights)}setSize(e,t){this.edgeDetectionMaterial.setSize(e,t),this.weightsMaterial.setSize(e,t),this.renderTargetEdges.setSize(e,t),this.renderTargetWeights.setSize(e,t)}dispose(){const{searchTexture:e,areaTexture:t}=this.weightsMaterial;null!==e&&null!==t&&(e.dispose(),t.dispose()),super.dispose()}static get searchImageDataURL(){return Os}static get areaImageDataURL(){return Ps}},_s=class extends Cs{constructor(e,t){let{blendFunction:n=Rr.MULTIPLY,samples:i=9,rings:r=7,normalDepthBuffer:s=null,depthAwareUpsampling:a=!0,worldDistanceThreshold:l,worldDistanceFalloff:c,worldProximityThreshold:h,worldProximityFalloff:u,distanceThreshold:d=.97,distanceFalloff:f=.03,rangeThreshold:p=5e-4,rangeFalloff:g=.001,minRadiusScale:m=.1,luminanceInfluence:v=.7,radius:y=.1825,intensity:b=1,bias:w=.025,fade:A=.01,color:x=null,resolutionScale:S=1,width:E=as.AUTO_SIZE,height:T=as.AUTO_SIZE,resolutionX:D=E,resolutionY:C=T}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super("SSAOEffect","uniform lowp sampler2D aoBuffer;uniform float luminanceInfluence;uniform float intensity;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH)\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\n#endif\n#ifdef COLORIZE\nuniform vec3 color;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){float aoLinear=texture2D(aoBuffer,uv).r;\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH) && __VERSION__ == 300\nvec4 normalDepth[4];normalDepth[0]=textureOffset(normalDepthBuffer,uv,ivec2(0,0));normalDepth[1]=textureOffset(normalDepthBuffer,uv,ivec2(0,1));normalDepth[2]=textureOffset(normalDepthBuffer,uv,ivec2(1,0));normalDepth[3]=textureOffset(normalDepthBuffer,uv,ivec2(1,1));float dot01=dot(normalDepth[0].rgb,normalDepth[1].rgb);float dot02=dot(normalDepth[0].rgb,normalDepth[2].rgb);float dot03=dot(normalDepth[0].rgb,normalDepth[3].rgb);float minDot=min(dot01,min(dot02,dot03));float s=step(THRESHOLD,minDot);float smallestDistance=1.0;int index;for(int i=0;i<4;++i){float distance=abs(depth-normalDepth[i].a);if(distance<smallestDistance){smallestDistance=distance;index=i;}}ivec2 offsets[4];offsets[0]=ivec2(0,0);offsets[1]=ivec2(0,1);offsets[2]=ivec2(1,0);offsets[3]=ivec2(1,1);ivec2 coord=ivec2(uv*vec2(textureSize(aoBuffer,0)))+offsets[index];float aoNearest=texelFetch(aoBuffer,coord,0).r;float ao=mix(aoNearest,aoLinear,s);\n#else\nfloat ao=aoLinear;\n#endif\nfloat l=luminance(inputColor.rgb);ao=mix(ao,0.0,l*luminanceInfluence);ao=clamp(ao*intensity,0.0,1.0);\n#ifdef COLORIZE\noutputColor=vec4(1.0-ao*(1.0-color),inputColor.a);\n#else\noutputColor=vec4(vec3(1.0-ao),inputColor.a);\n#endif\n}",{blendFunction:n,attributes:Lr.DEPTH,defines:new Map([["THRESHOLD","0.997"]]),uniforms:new Map([["aoBuffer",new L(null)],["normalDepthBuffer",new L(s)],["luminanceInfluence",new L(v)],["color",new L(null)],["intensity",new L(b)],["scale",new L(0)]])}),this.renderTarget=new B(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="AO.Target",this.uniforms.get("aoBuffer").value=this.renderTarget.texture;const I=this.resolution=new as(this,D,C,S);I.addEventListener("change",(e=>this.setSize(I.baseWidth,I.baseHeight))),this.camera=e,this.depthDownsamplingPass=new ds({normalBuffer:t,resolutionScale:S}),this.depthDownsamplingPass.enabled=null===s,this.ssaoPass=new As(new qr(e));const M=new Is(64,64,o);M.wrapS=M.wrapT=N;const O=this.ssaoMaterial;O.normalBuffer=t,O.noiseTexture=M,O.minRadiusScale=m,O.samples=i,O.radius=y,O.rings=r,O.fade=A,O.bias=w,O.distanceThreshold=d,O.distanceFalloff=f,O.proximityThreshold=p,O.proximityFalloff=g,void 0!==l&&(O.worldDistanceThreshold=l),void 0!==c&&(O.worldDistanceFalloff=c),void 0!==h&&(O.worldProximityThreshold=h),void 0!==u&&(O.worldProximityFalloff=u),null!==s&&(this.ssaoMaterial.normalDepthBuffer=s,this.defines.set("NORMAL_DEPTH","1")),this.depthAwareUpsampling=a,this.color=x}set mainCamera(e){this.camera=e,this.ssaoMaterial.copyCameraSettings(e)}getResolution(){return this.resolution}get ssaoMaterial(){return this.ssaoPass.fullscreenMaterial}getSSAOMaterial(){return this.ssaoMaterial}get samples(){return this.ssaoMaterial.samples}set samples(e){this.ssaoMaterial.samples=e}get rings(){return this.ssaoMaterial.rings}set rings(e){this.ssaoMaterial.rings=e}get radius(){return this.ssaoMaterial.radius}set radius(e){this.ssaoMaterial.radius=e}get depthAwareUpsampling(){return this.defines.has("DEPTH_AWARE_UPSAMPLING")}set depthAwareUpsampling(e){this.depthAwareUpsampling!==e&&(e?this.defines.set("DEPTH_AWARE_UPSAMPLING","1"):this.defines.delete("DEPTH_AWARE_UPSAMPLING"),this.setChanged())}isDepthAwareUpsamplingEnabled(){return this.depthAwareUpsampling}setDepthAwareUpsamplingEnabled(e){this.depthAwareUpsampling=e}get distanceScaling(){return!0}set distanceScaling(e){}get color(){return this.uniforms.get("color").value}set color(e){const t=this.uniforms,n=this.defines;null!==e?n.has("COLORIZE")?t.get("color").value.set(e):(n.set("COLORIZE","1"),t.get("color").value=new a(e),this.setChanged()):n.has("COLORIZE")&&(n.delete("COLORIZE"),t.get("color").value=null,this.setChanged())}get luminanceInfluence(){return this.uniforms.get("luminanceInfluence").value}set luminanceInfluence(e){this.uniforms.get("luminanceInfluence").value=e}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getColor(){return this.color}setColor(e){this.color=e}setDistanceCutoff(e,t){this.ssaoMaterial.distanceThreshold=e,this.ssaoMaterial.distanceFalloff=t}setProximityCutoff(e,t){this.ssaoMaterial.proximityThreshold=e,this.ssaoMaterial.proximityFalloff=t}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthDownsamplingPass.setDepthTexture(e,t),this.ssaoMaterial.depthBuffer=e,this.ssaoMaterial.depthPacking=t}update(e,t,n){const i=this.renderTarget;this.depthDownsamplingPass.enabled&&this.depthDownsamplingPass.render(e),this.ssaoPass.render(e,null,i)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.ssaoMaterial.copyCameraSettings(this.camera),this.ssaoMaterial.setSize(i,r),this.renderTarget.setSize(i,r),this.depthDownsamplingPass.resolution.scale=n.scale,this.depthDownsamplingPass.setSize(e,t)}initialize(e,t,n){try{let i=this.uniforms.get("normalDepthBuffer").value;null===i&&(this.depthDownsamplingPass.initialize(e,t,n),i=this.depthDownsamplingPass.texture,this.uniforms.get("normalDepthBuffer").value=i,this.ssaoMaterial.normalDepthBuffer=i,this.defines.set("NORMAL_DEPTH","1"))}catch(e){this.depthDownsamplingPass.enabled=!1}}};function Ls(){return Ls=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Ls.apply(this,arguments)}var Ns="#define GLSLIFY 1\nvec3 getViewPosition(const float depth){float clipW=_projectionMatrix[2][3]*depth+_projectionMatrix[3][3];vec4 clipPosition=vec4((vec3(vUv,depth)-0.5)*2.0,1.0);clipPosition*=clipW;return(_inverseProjectionMatrix*clipPosition).xyz;}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 screenSpaceToWorldSpace(const vec2 uv,const float depth){vec4 ndc=vec4((uv.x-0.5)*2.0,(uv.y-0.5)*2.0,(depth-0.5)*2.0,1.0);vec4 clip=_inverseProjectionMatrix*ndc;vec4 view=cameraMatrixWorld*(clip/clip.w);return view.xyz;}\n#define Scale (vec3(0.8, 0.8, 0.8))\n#define K (19.19)\nvec3 hash(vec3 a){a=fract(a*Scale);a+=dot(a,a.yxz+K);return fract((a.xxy+a.yxx)*a.zyx);}float fresnel_dielectric_cos(float cosi,float eta){float c=abs(cosi);float g=eta*eta-1.0+c*c;float result;if(g>0.0){g=sqrt(g);float A=(g-c)/(g+c);float B=(c*(g+c)-1.0)/(c*(g-c)+1.0);result=0.5*A*A*(1.0+B*B);}else{result=1.0;}return result;}float fresnel_dielectric(vec3 Incoming,vec3 Normal,float eta){float cosine=dot(Incoming,Normal);return min(1.0,5.0*fresnel_dielectric_cos(cosine,eta));}";class ks extends j{constructor(){super({type:"MRTMaterial",defines:{USE_UV:"",TEMPORAL_RESOLVE:""},uniforms:{opacity:new L(1),normalMap:new L(null),normalScale:new L(new w(1,1)),uvTransform:new L(new ue),roughness:new L(1),roughnessMap:new L(null)},vertexShader:"\n #ifdef USE_MRT\n varying vec2 vHighPrecisionZW;\n #endif\n #define NORMAL\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n #endif\n #include <common>\n #include <uv_pars_vertex>\n #include <displacementmap_pars_vertex>\n #include <normal_pars_vertex>\n #include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n void main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n #endif\n #ifdef USE_MRT\n vHighPrecisionZW = gl_Position.zw;\n #endif \n #ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n }\n ",fragmentShader:"\n #define NORMAL\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n #endif\n #include <packing>\n #include <uv_pars_fragment>\n #include <normal_pars_fragment>\n #include <bumpmap_pars_fragment>\n #include <normalmap_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n #include <roughnessmap_pars_fragment>\n \n #ifdef USE_MRT\n layout(location = 0) out vec4 gNormal;\n layout(location = 1) out vec4 gDepth;\n \n varying vec2 vHighPrecisionZW;\n #endif\n uniform float roughness;\n void main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n\n float roughnessFactor = roughness;\n \n if(roughness > 10.0e9){\n roughnessFactor = 1.;\n }else{\n #ifdef useRoughnessMap\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n roughnessFactor *= texelRoughness.g;\n #endif\n }\n\n vec3 normalColor = packNormalToRGB( normal );\n #ifdef USE_MRT\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n vec4 depthColor = packDepthToRGBA( fragCoordZ );\n gNormal = vec4( normalColor, roughnessFactor );\n gDepth = depthColor;\n #else\n gl_FragColor = vec4(normalColor, roughnessFactor);\n #endif\n }\n ",toneMapped:!1}),this.normalMapType=de,this.normalScale=new w(1,1),Object.defineProperty(this,"glslVersion",{get(){return"USE_MRT"in this.defines?fe:null},set(e){}})}}class Us extends j{constructor(){super({type:"ReflectionsMaterial",uniforms:{inputTexture:new L(null),accumulatedTexture:new L(null),normalTexture:new L(null),depthTexture:new L(null),_projectionMatrix:new L(new m),_inverseProjectionMatrix:new L(new m),cameraMatrixWorld:new L(new m),cameraNear:new L(0),cameraFar:new L(0),rayDistance:new L(0),intensity:new L(0),roughnessFade:new L(0),fade:new L(0),thickness:new L(0),ior:new L(0),maxDepthDifference:new L(0),jitter:new L(0),jitterRoughness:new L(0),maxRoughness:new L(0),samples:new L(0),envMap:new L(null),envMapPosition:new L(new t),envMapSize:new L(new t),viewMatrix:new L(new m)},defines:{steps:20,refineSteps:5,CUBEUV_TEXEL_WIDTH:0,CUBEUV_TEXEL_HEIGHT:0,CUBEUV_MAX_MIP:0,vWorldPosition:"worldPos"},fragmentShader:"#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D inputTexture;uniform sampler2D accumulatedTexture;uniform sampler2D normalTexture;uniform sampler2D depthTexture;uniform sampler2D envMap;uniform mat4 _projectionMatrix;uniform mat4 _inverseProjectionMatrix;uniform mat4 cameraMatrixWorld;uniform float cameraNear;uniform float cameraFar;uniform float rayDistance;uniform float intensity;uniform float maxDepthDifference;uniform float roughnessFade;uniform float maxRoughness;uniform float fade;uniform float thickness;uniform float ior;uniform float samples;uniform float jitter;uniform float jitterRoughness;\n#define INVALID_RAY_COORDS vec2(-1.0);\n#define EARLY_OUT_COLOR vec4(0.0, 0.0, 0.0, 1.0)\n#define FLOAT_EPSILON 0.00001\nfloat nearMinusFar;float nearMulFar;float farMinusNear;\n#include <packing>\n#include <helperFunctions>\nvec2 RayMarch(vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference);vec2 BinarySearch(in vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference);float fastGetViewZ(const in float depth);vec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness);void main(){vec4 depthTexel=textureLod(depthTexture,vUv,0.0);if(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON){gl_FragColor=EARLY_OUT_COLOR;return;}float unpackedDepth=unpackRGBAToDepth(depthTexel);vec4 normalTexel=textureLod(normalTexture,vUv,0.0);float roughness=normalTexel.a;float specular=1.0-roughness;nearMinusFar=cameraNear-cameraFar;nearMulFar=cameraNear*cameraFar;farMinusNear=cameraFar-cameraNear;normalTexel.rgb=unpackRGBToNormal(normalTexel.rgb);float depth=fastGetViewZ(unpackedDepth);vec3 viewPos=getViewPosition(depth);vec3 viewDir=normalize(viewPos);vec3 viewNormal=normalTexel.xyz;vec3 worldPos=screenSpaceToWorldSpace(vUv,unpackedDepth);vec3 jitt=vec3(0.0);if(jitterRoughness!=0.0||jitter!=0.0){vec3 randomJitter=hash(50.0*samples*worldPos)-0.5;float spread=((2.0-specular)+roughness*jitterRoughness);float jitterMix=jitter*0.25+jitterRoughness*roughness;if(jitterMix>1.0)jitterMix=1.0;jitt=mix(vec3(0.0),randomJitter*spread,jitterMix);}viewNormal+=jitt;float fresnelFactor=fresnel_dielectric(viewDir,viewNormal,ior);vec3 iblRadiance=getIBLRadiance(-viewDir,viewNormal,0.)*fresnelFactor;float lastFrameAlpha=textureLod(accumulatedTexture,vUv,0.0).a;if(roughness>maxRoughness||(roughness>1.0-FLOAT_EPSILON&&roughnessFade>1.0-FLOAT_EPSILON)){gl_FragColor=vec4(iblRadiance,lastFrameAlpha);return;}vec3 reflected=reflect(viewDir,viewNormal);vec3 rayDir=reflected*-viewPos.z;vec3 hitPos=viewPos;float rayHitDepthDifference;vec2 coords=RayMarch(rayDir,hitPos,rayHitDepthDifference);if(coords.x==-1.0){gl_FragColor=vec4(iblRadiance,lastFrameAlpha);return;}vec4 SSRTexel=textureLod(inputTexture,coords.xy,0.0);vec4 SSRTexelReflected=textureLod(accumulatedTexture,coords.xy,0.0);vec3 SSR=SSRTexel.rgb+SSRTexelReflected.rgb;float roughnessFactor=mix(specular,1.0,max(0.0,1.0-roughnessFade));vec2 coordsNDC=(coords.xy*2.0-1.0);float screenFade=0.1;float maxDimension=min(1.0,max(abs(coordsNDC.x),abs(coordsNDC.y)));float reflectionIntensity=1.0-(max(0.0,maxDimension-screenFade)/(1.0-screenFade));reflectionIntensity=max(0.,reflectionIntensity);vec3 finalSSR=mix(iblRadiance,SSR,reflectionIntensity)*roughnessFactor;if(fade!=0.0){vec3 hitWorldPos=screenSpaceToWorldSpace(coords,rayHitDepthDifference);float reflectionDistance=distance(hitWorldPos,worldPos)+1.0;float opacity=1.0/(reflectionDistance*fade*0.1);if(opacity>1.0)opacity=1.0;finalSSR*=opacity;}finalSSR*=fresnelFactor*intensity;finalSSR=min(vec3(1.0),finalSSR);float alpha=hitPos.z==1.0 ? 1.0 : SSRTexelReflected.a;alpha=min(lastFrameAlpha,alpha);gl_FragColor=vec4(finalSSR,alpha);}vec2 RayMarch(vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference){dir=normalize(dir);dir*=rayDistance/float(steps);float depth;vec4 projectedCoord;vec4 lastProjectedCoord;float unpackedDepth;vec4 depthTexel;for(int i=0;i<steps;i++){hitPos+=dir;projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;\n#ifndef missedRays\nif(projectedCoord.x<0.0||projectedCoord.x>1.0||projectedCoord.y<0.0||projectedCoord.y>1.0){return INVALID_RAY_COORDS;}\n#endif\ndepthTexel=textureLod(depthTexture,projectedCoord.xy,0.0);unpackedDepth=unpackRGBAToDepth(depthTexel);depth=fastGetViewZ(unpackedDepth);rayHitDepthDifference=depth-hitPos.z;if(rayHitDepthDifference>=0.0&&rayHitDepthDifference<thickness){\n#if refineSteps == 0\nif(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON)return INVALID_RAY_COORDS;\n#else\nreturn BinarySearch(dir,hitPos,rayHitDepthDifference);\n#endif\n}\n#ifndef missedRays\nif(hitPos.z>0.0){return INVALID_RAY_COORDS;}\n#endif\nlastProjectedCoord=projectedCoord;}hitPos.z=1.0;\n#ifndef missedRays\nreturn INVALID_RAY_COORDS;\n#endif\nrayHitDepthDifference=unpackedDepth;return projectedCoord.xy;}vec2 BinarySearch(in vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference){float depth;vec4 projectedCoord;vec2 lastMinProjectedCoordXY;float unpackedDepth;vec4 depthTexel;for(int i=0;i<refineSteps;i++){projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;depthTexel=textureLod(depthTexture,projectedCoord.xy,0.0);unpackedDepth=unpackRGBAToDepth(depthTexel);depth=fastGetViewZ(unpackedDepth);rayHitDepthDifference=depth-hitPos.z;dir*=0.5;if(rayHitDepthDifference>0.0){hitPos-=dir;}else{hitPos+=dir;}}if(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON)return INVALID_RAY_COORDS;if(abs(rayHitDepthDifference)>maxDepthDifference)return INVALID_RAY_COORDS;projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;rayHitDepthDifference=unpackedDepth;return projectedCoord.xy;}float fastGetViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn nearMulFar/(farMinusNear*depth-cameraFar);\n#else\nreturn depth*nearMinusFar-cameraNear;\n#endif\n}\n#include <common>\n#include <cube_uv_reflection_fragment>\nvec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness){\n#if defined(ENVMAP_TYPE_CUBE_UV)\nvec3 reflectVec=reflect(-viewDir,normal);reflectVec=normalize(mix(reflectVec,normal,roughness*roughness));reflectVec=inverseTransformDirection(reflectVec,viewMatrix);vec4 envMapColor=textureCubeUV(envMap,reflectVec,roughness);return envMapColor.rgb*intensity;\n#else\nreturn vec3(0.0);\n#endif\n}".replace("#include <helperFunctions>",Ns),vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",toneMapped:!1,depthWrite:!1,depthTest:!1})}}const js=e=>{const t=[e],n=[];for(;0!==t.length;){const e=t.shift();e.material&&n.push(e);for(const n of e.children)n.visible&&t.push(n)}return n},zs=(e,t,n)=>{e.uniforms.envMap.value=t;const i=(e=>{const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}})({envMapCubeUVHeight:n});e.defines.ENVMAP_TYPE_CUBE_UV="",e.defines.CUBEUV_TEXEL_WIDTH=i.texelWidth,e.defines.CUBEUV_TEXEL_HEIGHT=i.texelHeight,e.defines.CUBEUV_MAX_MIP=i.maxMip+".0",e.needsUpdate=!0};class Fs extends ts{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super("ReflectionsPass"),this.ssrEffect=void 0,this.cachedMaterials=new WeakMap,this.USE_MRT=!1,this.webgl1DepthPass=null,this.visibleMeshes=[],this.ssrEffect=e,this._scene=e._scene,this._camera=e._camera,this.fullscreenMaterial=new Us,e._camera.isPerspectiveCamera&&(this.fullscreenMaterial.defines.PERSPECTIVE_CAMERA="");const n=t.width||"undefined"!=typeof window?window.innerWidth:2e3,i=t.height||"undefined"!=typeof window?window.innerHeight:1e3;this.renderTarget=new B(n,i,{minFilter:U,magFilter:U,type:le,depthBuffer:!1}),this.renderPass=new hs(this._scene,this._camera),this.USE_MRT=(()=>{try{const e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}})(),this.USE_MRT?(this.gBuffersRenderTarget=new ce(n,i,2,{minFilter:U,magFilter:U}),this.normalTexture=this.gBuffersRenderTarget.texture[0],this.depthTexture=this.gBuffersRenderTarget.texture[1]):(this.webgl1DepthPass=new us(this._scene,this._camera),this.webgl1DepthPass.renderTarget.minFilter=U,this.webgl1DepthPass.renderTarget.magFilter=U,this.webgl1DepthPass.renderTarget.texture.minFilter=U,this.webgl1DepthPass.renderTarget.texture.magFilter=U,this.webgl1DepthPass.setSize("undefined"!=typeof window?window.innerWidth:2e3,"undefined"!=typeof window?window.innerHeight:1e3),this.gBuffersRenderTarget=new B(n,i,{minFilter:U,magFilter:U}),this.normalTexture=this.gBuffersRenderTarget.texture,this.depthTexture=this.webgl1DepthPass.texture),this.fullscreenMaterial.uniforms.normalTexture.value=this.normalTexture,this.fullscreenMaterial.uniforms.depthTexture.value=this.depthTexture,this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.ssrEffect.temporalResolvePass.accumulatedTexture,this.fullscreenMaterial.uniforms.cameraMatrixWorld.value=this._camera.matrixWorld,this.fullscreenMaterial.uniforms._projectionMatrix.value=this._camera.projectionMatrix,this.fullscreenMaterial.uniforms._inverseProjectionMatrix.value=this._camera.projectionMatrixInverse}setSize(e,t){this.renderTarget.setSize(e*this.ssrEffect.resolutionScale,t*this.ssrEffect.resolutionScale),this.gBuffersRenderTarget.setSize(e*this.ssrEffect.resolutionScale,t*this.ssrEffect.resolutionScale),this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.ssrEffect.temporalResolvePass.accumulatedTexture,this.fullscreenMaterial.needsUpdate=!0}dispose(){this.renderTarget.dispose(),this.gBuffersRenderTarget.dispose(),this.renderPass.dispose(),this.USE_MRT||this.webgl1DepthPass.dispose(),this.fullscreenMaterial.dispose(),this.normalTexture=null,this.depthTexture=null,this.velocityTexture=null}keepMaterialMapUpdated(e,t,n,i){this.ssrEffect[i]?t[n]!==e[n]&&(e[n]=t[n],e.uniforms[n].value=t[n],t[n]?e.defines[i]="":delete e.defines[i],e.needsUpdate=!0):void 0!==e[n]&&(e[n]=void 0,e.uniforms[n].value=void 0,delete e.defines[i],e.needsUpdate=!0)}setMRTMaterialInScene(){this.visibleMeshes=js(this._scene);for(const e of this.visibleMeshes)if(e.material){const t=e.material;let[n,i]=this.cachedMaterials.get(e)||[];if(t!==n){i&&i.dispose(),i=new ks,this.USE_MRT&&(i.defines.USE_MRT=""),i.normalScale=t.normalScale,i.uniforms.normalScale.value=t.normalScale;const n=t.map||t.normalMap||t.roughnessMap||t.metalnessMap;n&&(i.uniforms.uvTransform.value=n.matrix),this.cachedMaterials.set(e,[t,i])}this.keepMaterialMapUpdated(i,t,"normalMap","useNormalMap"),this.keepMaterialMapUpdated(i,t,"roughnessMap","useRoughnessMap"),i.uniforms.roughness.value=0===this.ssrEffect.selection.size||this.ssrEffect.selection.has(e)?t.roughness||0:1e11,e.material=i}}unsetMRTMaterialInScene(){for(const t of this.visibleMeshes){var e;if("MRTMaterial"===(null==(e=t.material)?void 0:e.type)){t.visible=!0;const[e]=this.cachedMaterials.get(t);t.material=e}}}render(e,t){this.setMRTMaterialInScene(),e.setRenderTarget(this.gBuffersRenderTarget),this.renderPass.render(e,this.gBuffersRenderTarget),this.unsetMRTMaterialInScene(),this.USE_MRT||this.webgl1DepthPass.renderPass.render(e,this.webgl1DepthPass.renderTarget),this.fullscreenMaterial.uniforms.inputTexture.value=t.texture,this.fullscreenMaterial.uniforms.samples.value=this.ssrEffect.temporalResolvePass.samples,this.fullscreenMaterial.uniforms.cameraNear.value=this._camera.near,this.fullscreenMaterial.uniforms.cameraFar.value=this._camera.far,this.fullscreenMaterial.uniforms.viewMatrix.value.copy(this._camera.matrixWorldInverse),e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera)}}const Hs={intensity:1,exponent:1,distance:10,fade:0,roughnessFade:1,thickness:10,ior:1.45,maxRoughness:1,maxDepthDifference:10,blend:.9,correction:1,correctionRadius:1,blur:.5,blurKernel:1,blurSharpness:10,jitter:0,jitterRoughness:0,steps:20,refineSteps:5,missedRays:!0,useNormalMap:!0,useRoughnessMap:!0,resolutionScale:1,velocityResolutionScale:1};class Gs extends j{constructor(e){const t="#define GLSLIFY 1\nuniform sampler2D inputTexture;uniform sampler2D accumulatedTexture;uniform sampler2D velocityTexture;uniform sampler2D lastVelocityTexture;uniform float blend;uniform float correction;uniform float exponent;uniform float samples;uniform vec2 invTexSize;uniform mat4 curInverseProjectionMatrix;uniform mat4 curCameraMatrixWorld;uniform mat4 prevInverseProjectionMatrix;uniform mat4 prevCameraMatrixWorld;varying vec2 vUv;\n#define MAX_NEIGHBOR_DEPTH_DIFFERENCE 0.001\n#define FLOAT_EPSILON 0.00001\n#define FLOAT_ONE_MINUS_EPSILON 0.99999\nvec3 transformexponent;vec3 undoColorTransformExponent;vec3 transformColor(vec3 color){if(exponent==1.0)return color;return pow(abs(color),transformexponent);}vec3 undoColorTransform(vec3 color){if(exponent==1.0)return color;return max(pow(abs(color),undoColorTransformExponent),vec3(0.0));}void main(){if(exponent!=1.0){transformexponent=vec3(1.0/exponent);undoColorTransformExponent=vec3(exponent);}vec4 inputTexel=textureLod(inputTexture,vUv,0.0);vec4 accumulatedTexel;vec3 inputColor=transformColor(inputTexel.rgb);vec3 accumulatedColor;float alpha=inputTexel.a;float velocityDisocclusion;bool didReproject=false;\n#ifdef boxBlur\nvec3 boxBlurredColor=inputTexel.rgb;\n#endif\nvec4 velocity=textureLod(velocityTexture,vUv,0.0);bool isMoving=alpha<1.0||dot(velocity.xy,velocity.xy)>0.0;if(isMoving){vec3 minNeighborColor=inputColor;vec3 maxNeighborColor=inputColor;vec3 col;vec2 neighborUv;vec2 reprojectedUv=vUv-velocity.xy;vec4 lastVelocity=textureLod(lastVelocityTexture,reprojectedUv,0.0);float depth=velocity.b;float closestDepth=depth;float lastClosestDepth=lastVelocity.b;float neighborDepth;float lastNeighborDepth;for(int x=-correctionRadius;x<=correctionRadius;x++){for(int y=-correctionRadius;y<=correctionRadius;y++){if(x!=0||y!=0){neighborUv=vUv+vec2(x,y)*invTexSize;vec4 neigborVelocity=textureLod(velocityTexture,neighborUv,0.0);neighborDepth=neigborVelocity.b;col=textureLod(inputTexture,neighborUv,0.0).xyz;int absX=abs(x);int absY=abs(y);\n#ifdef dilation\nif(absX==1&&absY==1){if(neighborDepth>closestDepth){velocity=neigborVelocity;closestDepth=neighborDepth;}vec4 lastNeighborVelocity=textureLod(velocityTexture,vUv+vec2(x,y)*invTexSize,0.0);lastNeighborDepth=lastNeighborVelocity.b;if(neighborDepth>closestDepth){lastVelocity=lastNeighborVelocity;lastClosestDepth=lastNeighborDepth;}}\n#endif\nif(abs(depth-neighborDepth)<MAX_NEIGHBOR_DEPTH_DIFFERENCE){\n#ifdef boxBlur\nif(absX<=2&&absY<=2)boxBlurredColor+=col;\n#endif\ncol=transformColor(col);minNeighborColor=min(col,minNeighborColor);maxNeighborColor=max(col,maxNeighborColor);}}}}float velocityLength=length(lastVelocity.xy-velocity.xy);velocityDisocclusion=(velocityLength-0.000005)*10.0;velocityDisocclusion*=velocityDisocclusion;reprojectedUv=vUv-velocity.xy;\n#ifdef boxBlur\nfloat pxRadius=correctionRadius>5 ? 121.0 : pow(float(correctionRadius*2+1),2.0);boxBlurredColor/=pxRadius;boxBlurredColor=transformColor(boxBlurredColor);\n#endif\nif(reprojectedUv.x>=0.0&&reprojectedUv.x<=1.0&&reprojectedUv.y>=0.0&&reprojectedUv.y<=1.0){accumulatedTexel=textureLod(accumulatedTexture,reprojectedUv,0.0);accumulatedColor=transformColor(accumulatedTexel.rgb);vec3 clampedColor=clamp(accumulatedColor,minNeighborColor,maxNeighborColor);accumulatedColor=mix(accumulatedColor,clampedColor,correction);didReproject=true;}else{\n#ifdef boxBlur\naccumulatedColor=boxBlurredColor;\n#else\naccumulatedColor=inputColor;\n#endif\n}if(velocity.r>FLOAT_ONE_MINUS_EPSILON&&velocity.g>FLOAT_ONE_MINUS_EPSILON){alpha=0.0;velocityDisocclusion=1.0;}}else{accumulatedColor=transformColor(textureLod(accumulatedTexture,vUv,0.0).rgb);}vec3 outputColor=inputColor;\n#include <custom_compose_shader>\ngl_FragColor=vec4(undoColorTransform(outputColor),alpha);}".replace("#include <custom_compose_shader>",e);super({type:"TemporalResolveMaterial",uniforms:{inputTexture:new L(null),accumulatedTexture:new L(null),velocityTexture:new L(null),lastVelocityTexture:new L(null),samples:new L(1),blend:new L(.5),correction:new L(1),exponent:new L(1),invTexSize:new L(new w)},defines:{correctionRadius:1},vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",fragmentShader:t})}}const Vs=`\n\t\tvec3 transformed;\n\n\t\t// Get the normal\n\t\t${re.skinbase_vertex}\n\t\t${re.beginnormal_vertex}\n\t\t${re.skinnormal_vertex}\n\t\t${re.defaultnormal_vertex}\n\n\t\t// Get the current vertex position\n\t\ttransformed = vec3( position );\n\t\t${re.skinning_vertex}\n\t\tnewPosition = velocityMatrix * vec4( transformed, 1.0 );\n\n\t\t// Get the previous vertex position\n\t\ttransformed = vec3( position );\n\t\t${re.skinbase_vertex.replace(/mat4 /g,"").replace(/getBoneMatrix/g,"getPrevBoneMatrix")}\n\t\t${re.skinning_vertex.replace(/vec4 /g,"")}\n\t\tprevPosition = prevVelocityMatrix * vec4( transformed, 1.0 );\n\n\t\tgl_Position = newPosition;\n`;class Ys extends j{constructor(){super({uniforms:{prevVelocityMatrix:{value:new m},velocityMatrix:{value:new m},prevBoneTexture:{value:null},interpolateGeometry:{value:0},intensity:{value:1},boneTexture:{value:null},alphaTest:{value:0},map:{value:null},alphaMap:{value:null},opacity:{value:1}},vertexShader:`\n #define MAX_BONES 1024\n \n ${re.skinning_pars_vertex}\n \n\t\t#ifdef USE_SKINNING\n\t\t#ifdef BONE_TEXTURE\n\t\t\tuniform sampler2D prevBoneTexture;\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tfloat j = i * 4.0;\n\t\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\t\ty = dy * ( y + 0.5 );\n\t\t\t\tvec4 v1 = texture2D( prevBoneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\t\tvec4 v2 = texture2D( prevBoneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\t\tvec4 v3 = texture2D( prevBoneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\t\tvec4 v4 = texture2D( prevBoneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#else\n\t\t\tuniform mat4 prevBoneMatrices[ MAX_BONES ];\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tmat4 bone = prevBoneMatrices[ int(i) ];\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#endif\n\t\t#endif\n\n \n uniform mat4 velocityMatrix;\n uniform mat4 prevVelocityMatrix;\n uniform float interpolateGeometry;\n varying vec4 prevPosition;\n varying vec4 newPosition;\n\t\t\t\t\tvarying vec2 vHighPrecisionZW;\n \n void main() {\n \n ${Vs}\n\n\t\t\t\t\t\tvHighPrecisionZW = gl_Position.zw;\n \n }`,fragmentShader:"\n uniform float intensity;\n varying vec4 prevPosition;\n varying vec4 newPosition;\n\t\t\t\t\tvarying vec2 vHighPrecisionZW;\n \n void main() {\n\t\t\t\t\t\t#ifdef FULL_MOVEMENT\n\t\t\t\t\t\tgl_FragColor = vec4( 1., 1., 1. - gl_FragCoord.z, 0. );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t\t#endif\n\n vec2 pos0 = (prevPosition.xy / prevPosition.w) * 0.5 + 0.5;\n vec2 pos1 = (newPosition.xy / newPosition.w) * 0.5 + 0.5;\n \n vec2 vel = pos1 - pos0;\n\n\t\t\t\t\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n \n gl_FragColor = vec4( vel, 1. - fragCoordZ, 0. );\n \n }"}),this.isVelocityMaterial=!0}}const Qs=new a(0),Ws=["visible","wireframe","side"];class Xs extends ts{constructor(e,n){var i,s;super("VelocityPass"),this.cachedMaterials=new WeakMap,this.lastCameraTransform={position:new t,quaternion:new r},this.visibleMeshes=[],this.renderedMeshesThisFrame=0,this.renderedMeshesLastFrame=0,this._scene=e,this._camera=n,this.renderTarget=new B((null==(i=window)?void 0:i.innerWidth)||1e3,(null==(s=window)?void 0:s.innerHeight)||1e3,{type:le})}setVelocityMaterialInScene(){this.renderedMeshesThisFrame=0,this.visibleMeshes=js(this._scene);for(const n of this.visibleMeshes){var e;const i=n.material;let[r,s]=this.cachedMaterials.get(n)||[];var t;if(i!==r)s=new Ys,s.lastMatrixWorld=new m,n.material=s,null!=(t=n.skeleton)&&t.boneTexture&&this.saveBoneTexture(n),this.cachedMaterials.set(n,[i,s]);if(s.uniforms.velocityMatrix.value.multiplyMatrices(this._camera.projectionMatrix,n.modelViewMatrix),n.userData.needsUpdatedReflections||i.map instanceof pe?("FULL_MOVEMENT"in s.defines||(s.needsUpdate=!0),s.defines.FULL_MOVEMENT=""):"FULL_MOVEMENT"in s.defines&&(delete s.defines.FULL_MOVEMENT,s.needsUpdate=!0),n.visible=this.cameraMovedThisFrame||!n.matrixWorld.equals(s.lastMatrixWorld)||n.skeleton||"FULL_MOVEMENT"in s.defines,n.material=s,n.visible){this.renderedMeshesThisFrame++;for(const e of Ws)s[e]=i[e];null!=(e=n.skeleton)&&e.boneTexture&&(s.defines.USE_SKINNING="",s.defines.BONE_TEXTURE="",s.uniforms.boneTexture.value=n.skeleton.boneTexture)}}}saveBoneTexture(e){let t=e.material.uniforms.prevBoneTexture.value;if(t&&t.image.width===e.skeleton.boneTexture.width)t=e.material.uniforms.prevBoneTexture.value,t.image.data.set(e.skeleton.boneTexture.image.data);else{var n;null==(n=t)||n.dispose();const i=e.skeleton.boneTexture.image.data.slice(),r=e.skeleton.boneTexture.image.width;t=new K(i,r,r,o,X),e.material.uniforms.prevBoneTexture.value=t,t.needsUpdate=!0}}unsetVelocityMaterialInScene(){for(const t of this.visibleMeshes){var e;if(t.material.isVelocityMaterial)t.visible=!0,t.material.lastMatrixWorld.copy(t.matrixWorld),t.material.uniforms.prevVelocityMatrix.value.multiplyMatrices(this._camera.projectionMatrix,t.modelViewMatrix),null!=(e=t.skeleton)&&e.boneTexture&&this.saveBoneTexture(t),t.material=this.cachedMaterials.get(t)[0]}}setSize(e,t){this.renderTarget.setSize(e,t)}renderVelocity(e){if(e.setRenderTarget(this.renderTarget),this.renderedMeshesThisFrame>0){const{background:t}=this._scene;this._scene.background=Qs,e.render(this._scene,this._camera),this._scene.background=t}else e.clearColor()}checkCameraMoved(){const e=this.lastCameraTransform.position.distanceToSquared(this._camera.position),t=8*(1-this.lastCameraTransform.quaternion.dot(this._camera.quaternion));return(e>1e-6||t>1e-6)&&(this.lastCameraTransform.position.copy(this._camera.position),this.lastCameraTransform.quaternion.copy(this._camera.quaternion),!0)}render(e){this.cameraMovedThisFrame=this.checkCameraMoved(),this.setVelocityMaterialInScene(),(this.renderedMeshesThisFrame>0||this.renderedMeshesLastFrame>0)&&this.renderVelocity(e),this.unsetVelocityMaterialInScene(),this.renderedMeshesLastFrame=this.renderedMeshesThisFrame}}const Zs=new w;class Ks extends ts{constructor(e,n,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super("TemporalResolvePass"),this.velocityPass=null,this.velocityResolutionScale=1,this.samples=1,this.lastCameraTransform={position:new t,quaternion:new r},this._scene=e,this._camera=n,this.renderTarget=new B(1,1,{minFilter:U,magFilter:U,type:le,depthBuffer:!1}),this.velocityPass=new Xs(e,n),this.fullscreenMaterial=new Gs(i),this.fullscreenMaterial.defines.correctionRadius=s.correctionRadius||1,s.dilation&&(this.fullscreenMaterial.defines.dilation=""),s.boxBlur&&(this.fullscreenMaterial.defines.boxBlur=""),this.setupFramebuffers(1,1),this.checkCanUseSharedVelocityTexture()}dispose(){this._scene.userData.velocityTexture===this.velocityPass.renderTarget.texture&&(delete this._scene.userData.velocityTexture,delete this._scene.userData.lastVelocityTexture),this.renderTarget.dispose(),this.accumulatedTexture.dispose(),this.fullscreenMaterial.dispose(),this.velocityPass.dispose()}setSize(e,t){this.renderTarget.setSize(e,t),this.velocityPass.setSize(e*this.velocityResolutionScale,t*this.velocityResolutionScale),this.velocityPass.renderTarget.texture.minFilter=1===this.velocityResolutionScale?I:U,this.velocityPass.renderTarget.texture.magFilter=1===this.velocityResolutionScale?I:U,this.velocityPass.renderTarget.texture.needsUpdate=!0,this.fullscreenMaterial.uniforms.invTexSize.value.set(1/e,1/t),this.setupFramebuffers(e,t)}setupFramebuffers(e,t){this.accumulatedTexture&&this.accumulatedTexture.dispose(),this.lastVelocityTexture&&this.lastVelocityTexture.dispose(),this.accumulatedTexture=new he(e,t,o),this.accumulatedTexture.minFilter=U,this.accumulatedTexture.magFilter=U,this.accumulatedTexture.type=le,this.lastVelocityTexture=new he(e*this.velocityResolutionScale,t*this.velocityResolutionScale,o),this.lastVelocityTexture.minFilter=1===this.velocityResolutionScale?I:U,this.lastVelocityTexture.magFilter=1===this.velocityResolutionScale?I:U,this.lastVelocityTexture.type=le,this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.accumulatedTexture,this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this.lastVelocityTexture,this.fullscreenMaterial.needsUpdate=!0}checkCanUseSharedVelocityTexture(){return this._scene.userData.velocityTexture&&this.velocityPass.renderTarget.texture!==this._scene.userData.velocityTexture?this.velocityPass.renderTarget.texture===this.fullscreenMaterial.uniforms.velocityTexture.value&&(this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this._scene.userData.lastVelocityTexture,this.fullscreenMaterial.uniforms.velocityTexture.value=this._scene.userData.velocityTexture,this.fullscreenMaterial.needsUpdate=!0):this.velocityPass.renderTarget.texture!==this.fullscreenMaterial.uniforms.velocityTexture.value&&(this.fullscreenMaterial.uniforms.velocityTexture.value=this.velocityPass.renderTarget.texture,this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this.lastVelocityTexture,this.fullscreenMaterial.needsUpdate=!0,this._scene.userData.velocityTexture||(this._scene.userData.velocityTexture=this.velocityPass.renderTarget.texture,this._scene.userData.lastVelocityTexture=this.lastVelocityTexture)),this.velocityPass.renderTarget.texture!==this.fullscreenMaterial.uniforms.velocityTexture.value}checkNeedsResample(){const e=this.lastCameraTransform.position.distanceToSquared(this._camera.position),t=8*(1-this.lastCameraTransform.quaternion.dot(this._camera.quaternion));(e>1e-6||t>1e-6)&&(this.samples=1,this.lastCameraTransform.position.copy(this._camera.position),this.lastCameraTransform.quaternion.copy(this._camera.quaternion))}render(e){this.samples++,this.checkNeedsResample(),this.fullscreenMaterial.uniforms.samples.value=this.samples,e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera),e.copyFramebufferToTexture(Zs,this.accumulatedTexture),e.setRenderTarget(this.velocityPass.renderTarget),e.copyFramebufferToTexture(Zs,this.lastVelocityTexture)}}const qs=function(e,t){let n=1,i=0;for(;e>0;)n/=t,i+=n*(e%t),e=~~(e/t);return i};function Js(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const $s="\n#if defined( USE_ENVMAP ) || defined( ) || defined ( USE_SHADOWMAP )\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n #ifdef BOX_PROJECTED_ENV_MAP\n vWorldPosition = worldPosition.xyz;\n #endif\n#endif\n",eo="\n#ifdef BOX_PROJECTED_ENV_MAP\n uniform vec3 envMapSize;\n uniform vec3 envMapPosition;\n varying vec3 vWorldPosition;\n \n vec3 parallaxCorrectNormal( vec3 v, vec3 cubeSize, vec3 cubePos ) {\n vec3 nDir = normalize( v );\n\n vec3 rbmax = ( .5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n vec3 rbmin = ( -.5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n\n vec3 rbminmax;\n\n rbminmax.x = ( nDir.x > 0. ) ? rbmax.x : rbmin.x;\n rbminmax.y = ( nDir.y > 0. ) ? rbmax.y : rbmin.y;\n rbminmax.z = ( nDir.z > 0. ) ? rbmax.z : rbmin.z;\n\n float correction = min( min( rbminmax.x, rbminmax.y ), rbminmax.z );\n vec3 boxIntersection = vWorldPosition + nDir * correction;\n \n return boxIntersection - cubePos;\n }\n#endif\n",to="\n#ifdef BOX_PROJECTED_ENV_MAP\n worldNormal = parallaxCorrectNormal( worldNormal, envMapSize, envMapPosition );\n#endif\n",no="\n#ifdef BOX_PROJECTED_ENV_MAP\n reflectVec = parallaxCorrectNormal( reflectVec, envMapSize, envMapPosition );\n#endif\n";const io="#define GLSLIFY 1\n#define MODE_DEFAULT 0\n#define MODE_REFLECTIONS 1\n#define MODE_RAW_REFLECTION 2\n#define MODE_BLURRED_REFLECTIONS 3\n#define MODE_INPUT 4\n#define MODE_BLUR_MIX 5\n#define FLOAT_EPSILON 0.00001\nuniform sampler2D inputTexture;uniform sampler2D reflectionsTexture;uniform float samples;\n#include <boxBlur>\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 reflectionsTexel=texture2D(reflectionsTexture,vUv);ivec2 size=textureSize(reflectionsTexture,0);vec2 invTexSize=1./vec2(size.x,size.y);vec3 reflectionClr=reflectionsTexel.xyz;if(blur>FLOAT_EPSILON){vec3 blurredReflectionsColor=denoise(reflectionsTexel.rgb,reflectionsTexture,vUv,invTexSize,blur,blurSharpness,blurKernel);reflectionClr=mix(reflectionClr,blurredReflectionsColor.rgb,blur);}\n#if RENDER_MODE == MODE_DEFAULT\noutputColor=vec4(inputColor.rgb+reflectionClr,1.0);\n#endif\n#if RENDER_MODE == MODE_REFLECTIONS\noutputColor=vec4(reflectionClr,1.0);\n#endif\n#if RENDER_MODE == MODE_RAW_REFLECTION\noutputColor=vec4(reflectionsTexel.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_BLURRED_REFLECTIONS\noutputColor=vec4(blurredReflectionsTexel.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_INPUT\noutputColor=vec4(inputColor.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_BLUR_MIX\noutputColor=vec4(vec3(blur),1.0);\n#endif\n}".replace("#include <helperFunctions>",Ns).replace("#include <boxBlur>","#define GLSLIFY 1\nuniform float blur;uniform float blurSharpness;uniform int blurKernel;vec3 denoise(vec3 center,sampler2D tex,vec2 uv,vec2 invTexSize,float blur,float blurSharpness,int blurKernel){vec3 color;float total;vec3 col;float weight;for(int x=-blurKernel;x<=blurKernel;x++){for(int y=-blurKernel;y<=blurKernel;y++){col=textureLod(tex,uv+vec2(x,y)*invTexSize,0.).rgb;weight=1.0-abs(dot(col-center,vec3(0.25)));weight=pow(weight,blurSharpness);color+=col*weight;total+=weight;}}return color/total;}"),ro=["blur","blurSharpness","blurKernel"],so=new se(1);let oo;class ao extends Cs{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Hs;super("SSREffect",io,{type:"FinalSSRMaterial",uniforms:new Map([["reflectionsTexture",new L(null)],["blur",new L(0)],["blurSharpness",new L(0)],["blurKernel",new L(0)]]),defines:new Map([["RENDER_MODE","0"]])}),this.haltonSequence=(e=>{const t=[];let n=1;const i=n+e;for(;n<i;n++)t.push([qs(n,2)-.5,qs(n,3)-.5]);return t})(1024),this.haltonIndex=0,this.selection=new Es,this.lastSize=void 0,this.cubeCamera=new oe(.001,1e3,so),this.usingBoxProjectedEnvMap=!1,this._scene=e,this._camera=t;n=Ls({},Hs,n,{boxBlur:!0,dilation:!0}),this.temporalResolvePass=new Ks(e,t,"#define GLSLIFY 1\n#define INV_EULER 0.36787944117144233\nalpha=velocityDisocclusion<FLOAT_EPSILON ?(alpha+0.0075): 0.0;alpha=clamp(alpha,0.0,1.0);bool needsBlur=!didReproject||velocityDisocclusion>0.5;\n#ifdef boxBlur\nif(needsBlur)inputColor=boxBlurredColor;\n#endif\nif(alpha==1.0){outputColor=accumulatedColor;}else{float m=mix(alpha,1.0,blend);if(needsBlur)m=0.0;outputColor=accumulatedColor*m+inputColor*(1.0-m);}",n),this.uniforms.get("reflectionsTexture").value=this.temporalResolvePass.renderTarget.texture,this.reflectionsPass=new Fs(this,n),this.temporalResolvePass.fullscreenMaterial.uniforms.inputTexture.value=this.reflectionsPass.renderTarget.texture,this.lastSize={width:n.width,height:n.height,resolutionScale:n.resolutionScale,velocityResolutionScale:n.velocityResolutionScale},this.setSize(n.width,n.height),this.makeOptionsReactive(n)}makeOptionsReactive(e){let t=!1;const n=this.reflectionsPass.fullscreenMaterial.uniforms,i=Object.keys(n);for(const r of Object.keys(e))Object.defineProperty(this,r,{get:()=>e[r],set(s){if(e[r]!==s||!t)switch(e[r]=s,ro.includes(r)||this.setSize(this.lastSize.width,this.lastSize.height,!0),r){case"resolutionScale":this.setSize(this.lastSize.width,this.lastSize.height);break;case"velocityResolutionScale":this.temporalResolvePass.velocityResolutionScale=s,this.setSize(this.lastSize.width,this.lastSize.height,!0);break;case"blur":this.uniforms.get("blur").value=s;break;case"blurSharpness":this.uniforms.get("blurSharpness").value=s;break;case"blurKernel":this.uniforms.get("blurKernel").value=s;break;case"steps":this.reflectionsPass.fullscreenMaterial.defines.steps=parseInt(s),this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"refineSteps":this.reflectionsPass.fullscreenMaterial.defines.refineSteps=parseInt(s),this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"missedRays":s?this.reflectionsPass.fullscreenMaterial.defines.missedRays="":delete this.reflectionsPass.fullscreenMaterial.defines.missedRays,this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"correctionRadius":this.temporalResolvePass.fullscreenMaterial.defines.correctionRadius=Math.round(s),this.temporalResolvePass.fullscreenMaterial.needsUpdate=t;break;case"blend":this.temporalResolvePass.fullscreenMaterial.uniforms.blend.value=s;break;case"correction":this.temporalResolvePass.fullscreenMaterial.uniforms.correction.value=s;break;case"exponent":this.temporalResolvePass.fullscreenMaterial.uniforms.exponent.value=s;break;case"distance":n.rayDistance.value=s;default:i.includes(r)&&(n[r].value=s)}}}),this[r]=e[r];t=!0}setSize(e,t){(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||e!==this.lastSize.width||t!==this.lastSize.height||this.resolutionScale!==this.lastSize.resolutionScale||this.velocityResolutionScale!==this.lastSize.velocityResolutionScale)&&(this.temporalResolvePass.setSize(e,t),this.reflectionsPass.setSize(e,t),this.lastSize={width:e,height:t,resolutionScale:this.resolutionScale,velocityResolutionScale:this.velocityResolutionScale})}generateBoxProjectedEnvMapFallback(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new t,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:512;this.cubeCamera.renderTarget.dispose(),this.cubeCamera.renderTarget=new se(r),this.cubeCamera.position.copy(n),this.cubeCamera.updateMatrixWorld(),this.cubeCamera.update(e,this._scene),oo||(oo=new ae(e),oo.compileCubemapShader());const s=oo.fromCubemap(this.cubeCamera.renderTarget.texture).texture;s.minFilter=U,s.magFilter=U;const o=this.reflectionsPass.fullscreenMaterial;return function(e,t,n){e.defines.BOX_PROJECTED_ENV_MAP="",e.uniforms.envMapPosition={value:t},e.uniforms.envMapSize={value:n};const i=new RegExp(Js("vec3 worldNormal = inverseTransformDirection ( normal , viewMatrix ) ;").replaceAll(" ","\\s*"),"g"),r=new RegExp(Js("reflectVec = inverseTransformDirection ( reflectVec , viewMatrix ) ;").replaceAll(" ","\\s*"),"g");e.vertexShader="varying vec3 vWorldPosition;\n"+e.vertexShader.replace("#include <worldpos_vertex>",$s),e.fragmentShader=eo+"\n"+e.fragmentShader.replace("#include <envmap_physical_pars_fragment>",re.envmap_physical_pars_fragment).replace(i,`vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n ${to}`).replace(r,`reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n ${no}`)}(o,n,i),o.fragmentShader=o.fragmentShader.replace("vec3 worldPos","worldPos").replace("varying vec3 vWorldPosition;","vec3 worldPos;"),o.uniforms.envMapPosition.value.copy(n),o.uniforms.envMapSize.value.copy(i),zs(o,s,r),this.usingBoxProjectedEnvMap=!0,s}setIBLRadiance(e,t){this._scene.traverse((n=>{if(n.material){var i;const r=null==(i=t.properties.get(n.material))?void 0:i.uniforms;r&&"disableIBLRadiance"in r&&(r.disableIBLRadiance.value=e)}}))}deleteBoxProjectedEnvMapFallback(){const e=this.reflectionsPass.fullscreenMaterial;e.uniforms.envMap.value=null,e.fragmentShader=e.fragmentShader.replace("worldPos = ","vec3 worldPos = "),delete e.defines.BOX_PROJECTED_ENV_MAP,e.needsUpdate=!0,this.usingBoxProjectedEnvMap=!1}dispose(){super.dispose(),this.reflectionsPass.dispose(),this.temporalResolvePass.dispose()}update(e,t){if(!this.usingBoxProjectedEnvMap&&this._scene.environment){const t=this.reflectionsPass.fullscreenMaterial;let n=null;if(this._scene.traverse((t=>{if(!n&&t.material&&!t.material.envMap){const i=e.properties.get(t.material);"envMap"in i&&i.envMap instanceof l&&(n=i.envMap)}})),n){const e=this._scene.environment.image.height;zs(t,n,e)}}this.haltonIndex=(this.haltonIndex+1)%this.haltonSequence.length;const[n,i]=this.haltonSequence[this.haltonIndex],{width:r,height:s}=this.lastSize;this.temporalResolvePass.velocityPass.render(e),this._camera.setViewOffset&&this._camera.setViewOffset(r,s,n,i,r,s),this.reflectionsPass.render(e,t),this.temporalResolvePass.render(e),this._camera.clearViewOffset()}static patchDirectEnvIntensity(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;re.envmap_physical_pars_fragment=0===e?re.envmap_physical_pars_fragment.replace("vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {","vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { return vec3(0.0);"):re.envmap_physical_pars_fragment.replace("vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );","vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ) * "+e.toFixed(5)+";")}}class lo{constructor(e,t,n){this.renderer=e,this.scene=t,this.camera=n,this.passesMap=new Map,this.effectsMap=new Map,this.effectsNeedsUpddate=!0,this.effectComposer=this._initEffectComposer(),this._initPasses(),this._initEffects()}updateEffectPass(){if(!this.effectsNeedsUpddate)return;this.effectsNeedsUpddate=!1;const{effectComposer:e}=this;e.passes.forEach((t=>{t instanceof gs&&(e.removePass(t),t.dispose())}));const t=Array.from(this.effectsMap).filter((e=>{let[,{enabled:t}]=e;return t})).map((e=>{let[,{effect:t}]=e;return t})),n=new gs(this.camera,...t);this.passesMap.set(lo.CONSTANTS.effectPass,n),e.addPass(n)}updateCamera(e){const{passesMap:t,effectsMap:n}=this,{CONSTANTS:i}=lo,r=t.get(i.renderPass),s=t.get(i.normalPass),o=t.get(i.effectPass);r.mainCamera=e,s.mainCamera=e,o.mainCamera=e;n.get(i.outlineEffect).effect.mainCamera=e}_initEffectComposer(){const e=new class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,{depthBuffer:t=!0,stencilBuffer:n=!1,multisampling:i=0,frameBufferType:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.renderer=null,this.inputBuffer=this.createBuffer(t,n,r,i),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new ns,this.depthTexture=null,this.passes=[],this.timer=new class{constructor(){this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(e){"undefined"!=typeof document&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=e)}get delta(){return this._delta*xs}get fixedDelta(){return this._fixedDelta*xs}set fixedDelta(e){this._fixedDelta=1e3*e}get elapsed(){return this._elapsed*xs}update(e){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=void 0!==e?e:performance.now(),this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()}handleEvent(e){document.hidden||(this.currentTime=performance.now())}dispose(){this.autoReset=!1}},this.autoRenderToScreen=!0,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){const t=this.inputBuffer,n=this.multisampling;n>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):n!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){const t=e.getSize(new w),n=e.getContext().getContextAttributes().alpha,i=this.inputBuffer.texture.type;i===D&&e.outputEncoding===T&&(this.inputBuffer.texture.encoding=T,this.outputBuffer.texture.encoding=T,this.inputBuffer.dispose(),this.outputBuffer.dispose()),e.autoClear=!1,this.setSize(t.width,t.height);for(const t of this.passes)t.initialize(e,n,i)}}replaceRenderer(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=this.renderer,i=n.domElement.parentNode;return this.setRenderer(e),t&&null!==i&&(i.removeChild(n.domElement),i.appendChild(e.domElement)),n}createDepthTexture(){const e=this.depthTexture=new M;return this.inputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(e.format=O,e.type=P):e.type=R,e}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const e of this.passes)e.setDepthTexture(null)}}createBuffer(e,t,n,i){const r=this.renderer,s=null===r?new w:r.getDrawingBufferSize(new w),o={minFilter:U,magFilter:U,stencilBuffer:t,depthBuffer:e,type:n};let a;return i>0?(a=new B(s.width,s.height,o),a.ignoreDepthForMultisampleCopy=!1,a.samples=i):a=new B(s.width,s.height,o),n===D&&null!==r&&r.outputEncoding===T&&(a.texture.encoding=T),a.texture.name="EffectComposer.Buffer",a.texture.generateMipmaps=!1,a}setMainScene(e){for(const t of this.passes)t.mainScene=e}setMainCamera(e){for(const t of this.passes)t.mainCamera=e}addPass(e,t){const n=this.passes,i=this.renderer,r=i.getDrawingBufferSize(new w),s=i.getContext().getContextAttributes().alpha,o=this.inputBuffer.texture.type;if(e.setRenderer(i),e.setSize(r.width,r.height),e.initialize(i,s,o),this.autoRenderToScreen&&(n.length>0&&(n[n.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?n.splice(t,0,e):n.push(e),this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){const t=this.createDepthTexture();for(e of n)e.setDepthTexture(t)}else e.setDepthTexture(this.depthTexture)}removePass(e){const t=this.passes,n=t.indexOf(e);if(-1!==n&&t.splice(n,1).length>0){if(null!==this.depthTexture){const n=(e,t)=>e||t.needsDepthTexture;t.reduce(n,!1)||(e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&n===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){const e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){const t=this.renderer,n=this.copyPass;let i,r,s,o=this.inputBuffer,a=this.outputBuffer,l=!1;void 0===e&&(this.timer.update(),e=this.timer.delta);for(const c of this.passes)c.enabled&&(c.render(t,o,a,e,l),c.needsSwap&&(l&&(n.renderToScreen=c.renderToScreen,i=t.getContext(),r=t.state.buffers.stencil,r.setFunc(i.NOTEQUAL,1,4294967295),n.render(t,o,a,e,l),r.setFunc(i.EQUAL,1,4294967295)),s=o,o=a,a=s),c instanceof ys?l=!0:c instanceof is&&(l=!1))}setSize(e,t,n){const i=this.renderer,r=i.getSize(new w);void 0!==e&&void 0!==t||(e=r.width,t=r.height),r.width===e&&r.height===t||i.setSize(e,t,n);const s=i.getDrawingBufferSize(new w);this.inputBuffer.setSize(s.width,s.height),this.outputBuffer.setSize(s.width,s.height);for(const e of this.passes)e.setSize(s.width,s.height)}reset(){const e=this.timer.autoReset;this.dispose(),this.autoRenderToScreen=!0,this.timer.autoReset=e}dispose(){for(const e of this.passes)e.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}}(this.renderer,{multisampling:8,frameBufferType:le});return e}_initPasses(){const{effectComposer:e}=this,{CONSTANTS:t}=lo,n=this._initRenderPass(),i=this._initNormalPass(),r=this._initEffectPass();e.addPass(n),e.addPass(i),e.addPass(r),this.passesMap.set(t.renderPass,n),this.passesMap.set(t.normalPass,i),this.passesMap.set(t.effectPass,r)}_initRenderPass(){return new hs(this.scene,this.camera)}_initNormalPass(){const e=new ws(this.scene,this.camera,{resolutionScale:1});return e.enabled=!1,e}_initEffectPass(){return new gs(this.camera)}_initEffects(){const{CONSTANTS:e}=lo,t=this._initSMAAEffect(),n=this._initOutlineEffect(),i=this._initSSREffect(),r=this._initBloomEffect(),s=this._initSSAOEffect();this.effectsMap.set(e.smaaEffect,{enabled:!0,effect:t}),this.effectsMap.set(e.outlineEffect,{enabled:!1,effect:n}),this.effectsMap.set(e.ssrEffect,{enabled:!1,effect:i}),this.effectsMap.set(e.bloomEffect,{enabled:!1,effect:r}),this.effectsMap.set(e.ssaoEffect,{enabled:!1,effect:s})}_initSMAAEffect(){return new Rs({preset:jr.HIGH,edgeDetectionMode:_r.COLOR})}_initSSREffect(){return new ao(this.scene,this.camera)}_initBloomEffect(){return new Bs({blendFunction:Rr.ADD})}_initOutlineEffect(){return new Ms(this.scene,this.camera,{blendFunction:Rr.SCREEN})}_initSSAOEffect(){const{CONSTANTS:e}=lo,t=this.passesMap.get(e.normalPass);return new _s(this.camera,t.texture,{blendFunction:Rr.MULTIPLY})}}lo.CONSTANTS={renderPass:"renderPass",normalPass:"normalPass",effectPass:"effectPass",smaaEffect:"smaaEffect",ssaoEffect:"ssaoEffect",outlineEffect:"outlineEffect",ssrEffect:"ssrEffect",bloomEffect:"bloomEffect"};const co=new class{constructor(){this.workerPool=new wt(4)}generate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{workerPool:n}=this;return new Promise(((r,s)=>{if(e.attributes.position instanceof ge)throw new Error("GenerateMeshBVHWorker: GLBufferAttribute are not supported for the geometry attributes.");bt(e);const o=e.index?e.index.array:null,a=e.attributes.position.array;n.postMessage({index:o,position:a,options:Object.assign(Object.assign({},t),{onProgress:null,includedProgressCallback:Boolean(t.onProgress),groups:[...e.groups]})}).then((n=>{const{data:o}=n;if(o)if(o.error)s(new Error(o.error));else if(o.serialized){const{serialized:n,position:s}=o,a=ut.deserialize(n,e,{setIndex:!1}),l=Object.assign({setBoundingBox:!0},t);if(e.attributes.position instanceof me?e.attributes.position.data.array=s:e.attributes.position instanceof $&&(e.attributes.position.array=s),e.index)e.index.array=n.index;else{const t=new $(n.index,1,!1);e.setIndex(t)}l.setBoundingBox&&(e.boundingBox=a.getBoundingBox(new i)),r(a)}else t.onProgress&&t.onProgress(o.progress)}))}))}dispose(){this.workerPool.dispose()}};class ho{constructor(e){this.viewport=e,this.cameraChanging=!1,this.timer=null,this.computedGeometriesUuid=new Map,this.generateMeshBVHWorker=co,this.viewport.signals.cameraChange.add((()=>{this.cameraChanging=!0,this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((()=>{this.cameraChanging=!1}),1e3)}))}computeModelsBoundsTree(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:n="slice",force:i=!1,frameSliceCount:r=500,workerCreator:s}=t,{meshOfModelList:o}=this.viewport.scener.intersectsList,a=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:async e=>e.geometry.computeBoundsTree();!i&&e.computedGeometriesUuid.has(t.geometry.uuid)||n(t).then((()=>{e.computedGeometriesUuid.set(t.geometry.uuid,t.geometry.uuid)}))};return new Promise(((e,t)=>{if("block"===n)o.forEach((e=>a(e))),e();else if("slice"===n){let t=0,n=0;const i=()=>{if(t=requestAnimationFrame(i),!this.cameraChanging){for(const e of o.slice(n,n+r))a(e),n+=1;n>=o.length&&(cancelAnimationFrame(t),e())}};i()}else if("worker"===n)if(s){this.generateMeshBVHWorker.workerPool.setWorkerCreator(s);const t=e=>this.generateMeshBVHWorker.generate(e.geometry).then((t=>t&&(e.geometry.boundsTree=t)));Promise.allSettled(o.map((e=>a(e,t)))).then((()=>e()))}else t("请设置 workerCreator")}))}dispose(){this.generateMeshBVHWorker.dispose()}}const uo=navigator.userAgent.toLowerCase().includes("mac");var fo;!function(e){e[e.NONE=-1]="NONE",e[e.ROTATE=0]="ROTATE",e[e.ZOOM=1]="ZOOM",e[e.PAN=2]="PAN"}(fo||(fo={}));const po=new t,go=[new t,new t,new t],mo=[new t,new t,new t];let vo=new DOMRect;class yo{constructor(e){this.viewport=e,this.camera=this.viewport.cameraManager.mainCamera,this.domElement=this.viewport.interactiveContainer,this.interactivePosition=null,this.fallbackInteractivePosition=null,this.enabled=!0,this.enabledMousePointInteractive=!0,this.enableZoom=!0,this.zoomSpeed=1,this.zoomMinDistance=1,this.zoomMaxDistance=1e5,this.zoomMinStepDistance=.1,this.zoomMaxStepDistance=2e4,this.enableRotate=!0,this.enableRotateX=!0,this.enableRotateY=!0,this.rotateSpeed=1,this.rotateTiltRange={max:Math.PI,min:0},this.enableAutoRotate=!1,this.autoRotateSpeed=1,this.autoRotateClockwise=!0,this.enableOutOfScene=!0,this.unOffsetOfScene=0,this.enablePan=!0,this.enablePanX=!0,this.enablePanY=!0,this.enablePanAxisX=!0,this.enablePanAxisY=!0,this.enablePanAxisZ=!0,this.panSpeed=2,this.state=fo.NONE,this.sceneBoxCenter=new t,this.dispose=()=>{},this.domElement=e.interactiveContainer,this.init()}init(){const e=e=>{e.preventDefault(),!1!==this.enabled&&(0===e.button?this.state=fo.ROTATE:1===e.button?this.state=fo.ZOOM:2===e.button&&(this.state=fo.PAN),vo=this.domElement.getBoundingClientRect(),this.state!==fo.ROTATE&&this.state!==fo.PAN||(this.interactivePosition=this.getInteractivePosition(e),this.interactivePosition||(this.sceneBoxCenter=this.getSceneBbox().getCenter(new t)),this.domElement.addEventListener("mousemove",n,!1),window.addEventListener("mouseup",i,!0)))},n=e=>{if(e.preventDefault(),!1===this.enabled)return;const{movementX:n,movementY:i}=e;this.state===fo.ROTATE?this.rotate(new t(.00375*-n,.00375*-i,0)):this.state===fo.PAN&&this.pan(new t(-n,i,0))},i=e=>{e.preventDefault(),this.domElement.removeEventListener("mousemove",n,!1),window.removeEventListener("mouseup",i,!0),this.state=fo.NONE},r=e=>{if(e.preventDefault(),!this.enabled)return;let n=0;n=uo&&e.shiftKey?120*-e.deltaX:120*-e.deltaY,this.zoom_on_point(new t(0,0,n),e)},s=e=>{if(e.preventDefault(),!1===this.enabled)return;vo=this.domElement.getBoundingClientRect();const n=e.touches;switch(n.length){case 1:go[0].set(n[0].clientX,n[0].clientY,0),go[1].set(n[0].clientX,n[0].clientY,0);break;case 2:go[0].set(n[0].clientX,n[0].clientY,0),go[1].set(n[1].clientX,n[1].clientY,0);break;case 3:case 4:case 5:go[0].set(n[0].clientX,n[0].clientY,0),go[1].set(n[2].clientX,n[2].clientY,0)}const i=new t(vo.x,vo.y,0);go[0].sub(i),go[1].sub(i),mo[0].copy(go[0]),mo[1].copy(go[1]),this.interactivePosition=this.getInteractivePosition({offsetX:(go[0].x+go[1].x)/2,offsetY:(go[0].y+go[1].y)/2}),this.interactivePosition||(this.sceneBoxCenter=this.getSceneBbox().getCenter(new t)),this.domElement.addEventListener("touchmove",o,{passive:!1}),this.domElement.addEventListener("touchend",a,!1)},o=e=>{if(e.preventDefault(),!1===this.enabled)return;function n(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"y";const r=new w(e[1].x-e[0].x,e[1].y-e[0].y),s=new w(n[1].x-n[0].x,n[1].y-n[0].y),o=r.angle(),a=s.angle();r.normalize(),s.normalize();const l=n[0].y-e[0].y;return"y"===i?new t(0,.005*l,0):"x"===i?new t(o-a,0,0):new t}switch(e.touches.length){case 1:{go[0].set(e.touches[0].clientX-vo.x,e.touches[0].clientY-vo.y,0),go[1].set(e.touches[0].clientX-vo.x,e.touches[0].clientY-vo.y,0);const t=go[0].clone().sub(((e,t)=>{let n=t[0];for(const i in t)n.distanceTo(e)>t[i].distanceTo(e)&&(n=t[i]);return n})(go[0],mo));t.x=-t.x;const n=t.multiplyScalar(.9);this.pan(n);break}case 2:{go[0].set(e.touches[0].clientX-vo.x,e.touches[0].clientY-vo.y,0),go[1].set(e.touches[1].clientX-vo.x,e.touches[1].clientY-vo.y,0);const i=mo[0].distanceTo(mo[1])-go[0].distanceTo(go[1]);this.zoom_touch(new t(0,0,i*this.zoomSpeed/25)),this.rotate(n(go,mo,"x"));break}case 3:case 4:case 5:go[0].set(e.touches[0].clientX-vo.x,e.touches[0].clientY-vo.y,0),go[1].set(e.touches[2].clientX-vo.x,e.touches[2].clientY-vo.y,0),this.rotate(n(go,mo,"y"))}mo[0].copy(go[0]),mo[1].copy(go[1])},a=e=>{e.preventDefault(),this.state=fo.NONE,this.domElement.removeEventListener("touchmove",o,!1),this.domElement.removeEventListener("touchend",a,!1)};this.domElement.addEventListener("mousedown",e,!1),this.domElement.addEventListener("wheel",r,{passive:!1}),this.domElement.addEventListener("touchstart",s,{passive:!1}),this.dispose=()=>{this.domElement.removeEventListener("mousedown",e),this.domElement.removeEventListener("wheel",r),this.domElement.removeEventListener("touchstart",s)}}getInteractivePosition(e){if(this.enabledMousePointInteractive){const t=this.viewport.getIntersects(e,void 0,{isFilterHideObject:!0});if(t.length){const[{point:e}]=t;return e.clone()}return this.fallbackInteractivePosition}return this.fallbackInteractivePosition}intersectsBox(e){const n=this.getSceneBbox(),i=new t;n.getSize(i);let r=Math.max(i.x,i.y,i.z);0!=this.unOffsetOfScene&&(r=this.unOffsetOfScene);const s=n.clone();s.min.addScalar(r/2),s.max.addScalar(-r/2);const o=(new y).copy(this.camera);o.position.add(e),o.updateMatrixWorld(),o.updateProjectionMatrix();return(new ve).setFromProjectionMatrix((new m).multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse)).intersectsBox(n)}caculateContainPoint(e,n){const i=(new t).copy(e).applyMatrix4(n.matrixWorldInverse).applyMatrix4(n.projectionMatrix);return!(Math.abs(i.x)>1||Math.abs(i.y)>1||Math.abs(i.z)>1)}panLeft(e){const n=new t,i=this.camera.matrix.elements;this.enablePanAxisX&&n.setX(i[0]),this.enablePanAxisY&&n.setY(i[1]),this.enablePanAxisZ&&n.setZ(i[2]),n.multiplyScalar(e);let r=!0;this.enableOutOfScene||(r=this.intersectsBox(n)),r&&this.camera.position.add(n)}panUp(e){const n=new t,i=this.camera.matrix.elements;this.enablePanAxisX&&n.setX(i[4]),this.enablePanAxisY&&n.setY(i[5]),this.enablePanAxisZ&&n.setZ(i[6]),n.multiplyScalar(e);let r=!0;this.enableOutOfScene||(r=this.intersectsBox(n)),r&&this.camera.position.add(n)}pan(e){var t;if(!this.enablePan)return;this.enablePanX||e.setX(0),this.enablePanY||e.setY(0);const n=null!==(t=this.interactivePosition)&&void 0!==t?t:this.sceneBoxCenter;let i=this.camera.position.clone().sub(n).length();i*=Math.tan(this.camera.fov/2*Math.PI/180),this.panLeft(this.panSpeed*e.x*i/vo.height),this.panUp(this.panSpeed*e.y*i/vo.height),this.viewport.signals.cameraChange.dispatch()}zoom_on_point(e,n){if(!this.enableZoom)return;this.interactivePosition=this.getInteractivePosition(n);let i=e.z>0?6:-6;const r=new t(0,0,0);let s;if(this.interactivePosition){s=this.interactivePosition.distanceTo(this.camera.position);const e=this.domElement.getBoundingClientRect();r.set(n.offsetX/e.width*2-1,-n.offsetY/e.height*2+1,.1)}else s=this.camera.position.length(),r.set(0,0,.1);let o=!1;s>this.zoomMaxDistance&&i<0?(o=!0,s=this.zoomMaxDistance,i*=2):s<this.zoomMinDistance&&i>0&&(o=!0,s=this.zoomMinDistance,i*=2),r.unproject(this.camera),r.sub(this.camera.position);let a=s/i*this.zoomSpeed;if(a>0?a>this.zoomMaxStepDistance?a=this.zoomMaxStepDistance:a<this.zoomMinStepDistance&&(a=this.zoomMinStepDistance):a<0&&(a<-this.zoomMaxStepDistance?a=-this.zoomMaxStepDistance:a>-this.zoomMinStepDistance&&(a=-this.zoomMinStepDistance)),o&&!n.shiftKey)return;const l=this.camera.position.clone().addVectors(this.camera.position,r.setLength(a));this.camera.position.copy(l),this.viewport.signals.cameraChange.dispatch()}zoom_touch(e){if(!this.enableZoom)return;let n=e.z;const i=new t(0,0,0);let r;if(this.interactivePosition){const e={offsetX:(mo[0].x+mo[1].x)/2,offsetY:(mo[0].y+mo[1].y)/2};r=this.interactivePosition.distanceTo(this.camera.position),i.set(e.offsetX/vo.width*2-1,-e.offsetY/vo.height*2+1,.1)}else r=this.camera.position.length(),i.set(0,0,.1);if(r>this.zoomMaxDistance&&n>0?(r=this.zoomMaxDistance,n=0):r<this.zoomMinDistance&&n<0&&(r=this.zoomMinDistance),0===n)return;i.unproject(this.camera),i.sub(this.camera.position);let s=r*-n*this.zoomSpeed*.1;s>0?s>this.zoomMaxStepDistance?s=this.zoomMaxStepDistance:s<this.zoomMinStepDistance&&(s=this.zoomMinStepDistance):s<0&&(s<-this.zoomMaxStepDistance?s=-this.zoomMaxStepDistance:s>-this.zoomMinStepDistance&&(s=-this.zoomMinStepDistance));const o=this.camera.position.clone().addVectors(this.camera.position,i.setLength(s));this.camera.position.copy(o),this.viewport.signals.cameraChange.dispatch()}rotate(e){var n;if(!this.enableRotate)return;e.x*=this.rotateSpeed,e.y*=this.rotateSpeed;const i=new t(0,0,-1);i.applyQuaternion(this.camera.quaternion);const r=i.angleTo(new t(0,1,0));(r-e.y>this.rotateTiltRange.max&&e.y<0||r-e.y<this.rotateTiltRange.min&&e.y>0)&&(e.y=0);const s=null!==(n=this.interactivePosition)&&void 0!==n?n:this.sceneBoxCenter;po.copy(this.camera.position).sub(s);const o=new m,a=new t(1,0,0);this.enableRotateX&&o.makeRotationAxis(new t(0,1,0),e.x);const l=new m;this.enableRotateY&&(a.applyEuler(this.camera.rotation),l.makeRotationAxis(a,e.y),o.multiply(l)),po.applyMatrix4(o),i.applyMatrix4(o),this.camera.position.copy(s).add(po),this.camera.lookAt(i.add(this.camera.position)),this.viewport.signals.cameraChange.dispatch()}autoRotate(){const e=this.autoRotateClockwise?.01:-.01;this.rotate(new t(e*this.autoRotateSpeed,0,0))}update(){this.enableAutoRotate&&this.autoRotate()}getSceneBbox(){const e=this.viewport.scene,t=new i;return t.setFromObject(e),t}}const bo={type:"change"},wo={type:"start"},Ao={type:"end"};class xo extends G{constructor(e,n){super(),this.object=e,this.domElement=n,this.enabled=!0,this.target=new t,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.enableAutoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:ye.ROTATE,MIDDLE:ye.DOLLY,RIGHT:ye.PAN},this.touches={ONE:be.ROTATE,TWO:be.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.userData.zoom,this._domElementKeyEvents=null,this.domElement.style.touchAction="none",this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",W),this._domElementKeyEvents=e},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.userData.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.userData.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(bo),i.update(),o=s.NONE},this.update=function(){const n=new t,f=(new r).setFromUnitVectors(e.up,new t(0,1,0)),p=f.clone().invert(),g=new t,m=new r,v=2*Math.PI;return function(){const e=i.object.position;n.copy(e).sub(i.target),n.applyQuaternion(f),l.setFromVector3(n),i.enableAutoRotate&&o===s.NONE&&C(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(l.theta+=c.theta*i.dampingFactor,l.phi+=c.phi*i.dampingFactor):(l.theta+=c.theta,l.phi+=c.phi);let t=i.minAzimuthAngle,r=i.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=v:t>Math.PI&&(t-=v),r<-Math.PI?r+=v:r>Math.PI&&(r-=v),l.theta=t<=r?Math.max(t,Math.min(r,l.theta)):l.theta>(t+r)/2?Math.max(t,l.theta):Math.min(r,l.theta)),l.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=h,l.radius=Math.max(i.minDistance,Math.min(i.maxDistance,l.radius)),!0===i.enableDamping?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),n.setFromSpherical(l),n.applyQuaternion(p),e.copy(i.target).add(n),i.object.lookAt(i.target),!0===i.enableDamping?(c.theta*=1-i.dampingFactor,c.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(c.set(0,0,0),u.set(0,0,0)),h=1,!!(d||g.distanceToSquared(i.object.position)>a||8*(1-m.dot(i.object.quaternion))>a)&&(i.dispatchEvent(bo),g.copy(i.object.position),m.copy(i.object.quaternion),d=!1,!0)}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",X),i.domElement.removeEventListener("pointerdown",H),i.domElement.removeEventListener("pointercancel",Y),i.domElement.removeEventListener("wheel",Q),i.domElement.removeEventListener("pointermove",G),window.removeEventListener("pointerup",V),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",W)};const i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=s.NONE;const a=1e-6,l=new we,c=new we;let h=1;const u=new t;let d=!1;const f=new w,p=new w,g=new w,m=new w,v=new w,b=new w,A=new w,x=new w,S=new w,E=[],T={};function D(){return Math.pow(.95,i.zoomSpeed)}function C(e){c.theta-=e}function B(e){c.phi-=e}const I=function(){const e=new t;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),u.add(e)}}(),M=function(){const e=new t;return function(t,n){!0===i.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(i.object.up,e)),e.multiplyScalar(t),u.add(e)}}(),O=function(){const e=new t;return function(t,n){const r=i.domElement;if(i.object instanceof y){const s=i.object.position;e.copy(s).sub(i.target);let o=e.length();o*=Math.tan(i.object.fov/2*Math.PI/180),I(2*t*o/r.clientHeight,i.object.matrix),M(2*n*o/r.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(I(t*(i.object.right-i.object.left)/i.object.userData.zoom/r.clientWidth,i.object.matrix),M(n*(i.object.top-i.object.bottom)/i.object.userData.zoom/r.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function P(e){i.object instanceof y?h/=e:i.object.isOrthographicCamera?(i.object.userData.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.userData.zoom*e)),i.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function R(e){i.object instanceof y?h*=e:i.object.isOrthographicCamera?(i.object.userData.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.userData.zoom/e)),i.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function _(e){f.set(e.clientX,e.clientY)}function L(e){m.set(e.clientX,e.clientY)}function N(){if(1===E.length)f.set(E[0].pageX,E[0].pageY);else{const e=.5*(E[0].pageX+E[1].pageX),t=.5*(E[0].pageY+E[1].pageY);f.set(e,t)}}function k(){if(1===E.length)m.set(E[0].pageX,E[0].pageY);else{const e=.5*(E[0].pageX+E[1].pageX),t=.5*(E[0].pageY+E[1].pageY);m.set(e,t)}}function U(){const e=E[0].pageX-E[1].pageX,t=E[0].pageY-E[1].pageY,n=Math.sqrt(e*e+t*t);A.set(0,n)}function j(e){if(1==E.length)p.set(e.pageX,e.pageY);else{const t=q(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);p.set(n,i)}g.subVectors(p,f).multiplyScalar(i.rotateSpeed);const t=i.domElement;C(2*Math.PI*g.x/t.clientHeight),B(2*Math.PI*g.y/t.clientHeight),f.copy(p)}function z(e){if(1===E.length)v.set(e.pageX,e.pageY);else{const t=q(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);v.set(n,i)}b.subVectors(v,m).multiplyScalar(i.panSpeed),O(b.x,b.y),m.copy(v)}function F(e){const t=q(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);x.set(0,s),S.set(0,Math.pow(x.y/A.y,i.zoomSpeed)),P(S.y),A.copy(x)}function H(e){!1!==i.enabled&&(0===E.length&&(i.domElement.addEventListener("pointermove",G),window.addEventListener("pointerup",V)),function(e){E.push(e)}(e),"touch"===e.pointerType?function(e){switch(K(e),E.length){case 1:switch(i.touches.ONE){case be.ROTATE:if(!1===i.enableRotate)return;N(),o=s.TOUCH_ROTATE;break;case be.PAN:if(!1===i.enablePan)return;k(),o=s.TOUCH_PAN;break;default:o=s.NONE}break;case 2:switch(i.touches.TWO){case be.DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&U(),i.enablePan&&k(),o=s.TOUCH_DOLLY_PAN;break;case be.DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&U(),i.enableRotate&&N(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent(wo)}(e):function(e){let t;switch(e.button){case 0:t=i.mouseButtons.LEFT;break;case 1:t=i.mouseButtons.MIDDLE;break;case 2:t=i.mouseButtons.RIGHT;break;default:t=-1}switch(t){case ye.DOLLY:if(!1===i.enableZoom)return;!function(e){A.set(e.clientX,e.clientY)}(e),o=s.DOLLY;break;case ye.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enablePan)return;L(e),o=s.PAN}else{if(!1===i.enableRotate)return;_(e),o=s.ROTATE}break;case ye.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enableRotate)return;_(e),o=s.ROTATE}else{if(!1===i.enablePan)return;L(e),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent(wo)}(e))}function G(e){e.preventDefault(),!1!==i.enabled&&("touch"===e.pointerType?function(e){switch(K(e),o){case s.TOUCH_ROTATE:if(!1===i.enableRotate)return;j(e),i.update();break;case s.TOUCH_PAN:if(!1===i.enablePan)return;z(e),i.update();break;case s.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(e){i.enableZoom&&F(e),i.enablePan&&z(e)}(e),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(e){i.enableZoom&&F(e),i.enableRotate&&j(e)}(e),i.update();break;default:o=s.NONE}}(e):function(e){switch(o){case s.ROTATE:if(!1===i.enableRotate)return;!function(e){p.set(e.clientX,e.clientY),g.subVectors(p,f).multiplyScalar(i.rotateSpeed);const t=i.domElement;C(2*Math.PI*g.x/t.clientHeight),B(2*Math.PI*g.y/t.clientHeight),f.copy(p),i.update()}(e);break;case s.DOLLY:if(!1===i.enableZoom)return;!function(e){x.set(e.clientX,e.clientY),S.subVectors(x,A),S.y>0?P(D()):S.y<0&&R(D()),A.copy(x),i.update()}(e);break;case s.PAN:if(!1===i.enablePan)return;!function(e){v.set(e.clientX,e.clientY),b.subVectors(v,m).multiplyScalar(i.panSpeed),O(b.x,b.y),m.copy(v),i.update()}(e)}}(e))}function V(e){Z(e),0===E.length&&(i.domElement.removeEventListener("pointermove",G),window.removeEventListener("pointerup",V)),i.dispatchEvent(Ao),o=s.NONE}function Y(e){Z(e)}function Q(e){!1!==i.enabled&&!1!==i.enableZoom&&o===s.NONE&&(e.preventDefault(),i.dispatchEvent(wo),function(e){e.deltaY<0?R(D()):e.deltaY>0&&P(D()),i.update()}(e),i.dispatchEvent(Ao))}function W(e){!1!==i.enabled&&!1!==i.enablePan&&function(e){let t=!1;switch(e.code){case i.keys.UP:O(0,i.keyPanSpeed),t=!0;break;case i.keys.BOTTOM:O(0,-i.keyPanSpeed),t=!0;break;case i.keys.LEFT:O(i.keyPanSpeed,0),t=!0;break;case i.keys.RIGHT:O(-i.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),i.update())}(e)}function X(e){!1!==i.enabled&&e.preventDefault()}function Z(e){delete T[e.pointerId];for(let t=0;t<E.length;t++)if(E[t].pointerId==e.pointerId)return void E.splice(t,1)}function K(e){let t=T[e.pointerId];void 0===t&&(t=new w,T[e.pointerId]=t),t.set(e.pageX,e.pageY)}function q(e){const t=e.pointerId===E[0].pointerId?E[1]:E[0];return T[t.pointerId]}i.domElement.addEventListener("contextmenu",X),i.domElement.addEventListener("pointerdown",H),i.domElement.addEventListener("pointercancel",Y),i.domElement.addEventListener("wheel",Q,{passive:!1})}}class So{get options(){return this._options}set options(e){this._options=e,e.type||(this._options.type="free"),this._onChangeCallback()}constructor(e){this.viewport=e,this._options={type:"free"},this._disposeList=new Set,this.currentControls=new yo(this.viewport)}handleFreeControls(){const e=Jn(this.options,["type"]),{postRender:t}=this.viewport,n=this.currentControls=new yo(this.viewport);Object.assign(n,e),t.set("FreeControlsUpdate",(()=>{n.update()})),this._disposeList.add((()=>{t.delete("FreeControlsUpdate")}))}handleOrbitControls(){const e=Jn(Object.assign({},this.options),["type"]),{cameraManager:{mainCamera:t},interactiveContainer:n,postRender:i}=this.viewport,r=this.currentControls=new xo(t,n);Object.assign(r,e),r.update();const s=()=>{this.viewport.signals.cameraChange.dispatch()};if(r.addEventListener("change",s),this._disposeList.add((()=>{r.removeEventListener("change",s)})),e.enableDamping||e.enableAutoRotate)i.set("OrbitControlsUpdate",(()=>{this.viewport.render((()=>{r.update()}))})),this._disposeList.add((()=>{i.delete("OrbitControlsUpdate")}));else{const e=e=>{e&&r.update()};this.viewport.signals.cameraChange.add(e),this._disposeList.add((()=>{this.viewport.signals.cameraChange.remove(e)}))}}_onChangeCallback(){switch(this.dispose(),this.options.type){case"free":default:this.handleFreeControls();break;case"orbit":this.handleOrbitControls()}this.viewport.triggerRender()}setOptions(e){this.options=e}dispose(){this.currentControls.dispose(),this._disposeList.forEach((e=>e())),this._disposeList.clear()}}var Eo="0123456789abcdefghijklmnopqrstuvwxyz";function To(e){return Eo.charAt(e)}function Do(e,t){return e&t}function Co(e,t){return e|t}function Bo(e,t){return e^t}function Io(e,t){return e&~t}function Mo(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Oo(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var Po,Ro="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_o="=";function Lo(e){var t,n,i="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),i+=Ro.charAt(n>>6)+Ro.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),i+=Ro.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),i+=Ro.charAt(n>>2)+Ro.charAt((3&n)<<4));(3&i.length)>0;)i+=_o;return i}function No(e){var t,n="",i=0,r=0;for(t=0;t<e.length&&e.charAt(t)!=_o;++t){var s=Ro.indexOf(e.charAt(t));s<0||(0==i?(n+=To(s>>2),r=3&s,i=1):1==i?(n+=To(r<<2|s>>4),r=15&s,i=2):2==i?(n+=To(r),n+=To(s>>2),r=3&s,i=3):(n+=To(r<<2|s>>4),n+=To(15&s),i=0))}return 1==i&&(n+=To(r<<2)),n}var ko,Uo=function(e){var t;if(void 0===Po){var n="0123456789ABCDEF",i=" \f\n\r\t \u2028\u2029";for(Po={},t=0;t<16;++t)Po[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)Po[n.charAt(t)]=t;for(t=0;t<i.length;++t)Po[i.charAt(t)]=-1}var r=[],s=0,o=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=Po[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);s|=a,++o>=2?(r[r.length]=s,s=0,o=0):s<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return r},jo={decode:function(e){var t;if(void 0===ko){var n="= \f\n\r\t \u2028\u2029";for(ko=Object.create(null),t=0;t<64;++t)ko["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(ko["-"]=62,ko._=63,t=0;t<n.length;++t)ko[n.charAt(t)]=-1}var i=[],r=0,s=0;for(t=0;t<e.length;++t){var o=e.charAt(t);if("="==o)break;if(-1!=(o=ko[o])){if(void 0===o)throw new Error("Illegal character at offset "+t);r|=o,++s>=4?(i[i.length]=r>>16,i[i.length]=r>>8&255,i[i.length]=255&r,r=0,s=0):r<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:i[i.length]=r>>10;break;case 3:i[i.length]=r>>16,i[i.length]=r>>8&255}return i},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=jo.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return jo.decode(e)}},zo=1e13,Fo=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,i,r=this.buf,s=r.length;for(n=0;n<s;++n)(i=r[n]*e+t)<zo?t=0:i-=(t=0|i/zo)*zo,r[n]=i;t>0&&(r[n]=t)},e.prototype.sub=function(e){var t,n,i=this.buf,r=i.length;for(t=0;t<r;++t)(n=i[t]-e)<0?(n+=zo,e=1):e=0,i[t]=n;for(;0===i[i.length-1];)i.pop()},e.prototype.toString=function(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,n=t[t.length-1].toString(),i=t.length-2;i>=0;--i)n+=(zo+t[i]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*zo+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),Ho="…",Go=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,Vo=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Yo(e,t){return e.length>t&&(e=e.substring(0,t)+Ho),e}var Qo,Wo=function(){function e(t,n){this.hexDigits="0123456789ABCDEF",t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)},e.prototype.hexDump=function(e,t,n){for(var i="",r=e;r<t;++r)if(i+=this.hexByte(this.get(r)),!0!==n)switch(15&r){case 7:i+=" ";break;case 15:i+="\n";break;default:i+=" "}return i},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var i=this.get(n);if(i<32||i>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n="",i=e;i<t;++i)n+=String.fromCharCode(this.get(i));return n},e.prototype.parseStringUTF=function(e,t){for(var n="",i=e;i<t;){var r=this.get(i++);n+=r<128?String.fromCharCode(r):r>191&&r<224?String.fromCharCode((31&r)<<6|63&this.get(i++)):String.fromCharCode((15&r)<<12|(63&this.get(i++))<<6|63&this.get(i++))}return n},e.prototype.parseStringBMP=function(e,t){for(var n,i,r="",s=e;s<t;)n=this.get(s++),i=this.get(s++),r+=String.fromCharCode(n<<8|i);return r},e.prototype.parseTime=function(e,t,n){var i=this.parseStringISO(e,t),r=(n?Go:Vo).exec(i);return r?(n&&(r[1]=+r[1],r[1]+=+r[1]<70?2e3:1900),i=r[1]+"-"+r[2]+"-"+r[3]+" "+r[4],r[5]&&(i+=":"+r[5],r[6]&&(i+=":"+r[6],r[7]&&(i+="."+r[7]))),r[8]&&(i+=" UTC","Z"!=r[8]&&(i+=r[8],r[9]&&(i+=":"+r[9]))),i):"Unrecognized time: "+i},e.prototype.parseInteger=function(e,t){for(var n,i=this.get(e),r=i>127,s=r?255:0,o="";i==s&&++e<t;)i=this.get(e);if(0===(n=t-e))return r?-1:0;if(n>4){for(o=i,n<<=3;0==(128&(+o^s));)o=+o<<1,--n;o="("+n+" bit)\n"}r&&(i-=256);for(var a=new Fo(i),l=e+1;l<t;++l)a.mulAdd(256,this.get(l));return o+a.toString()},e.prototype.parseBitString=function(e,t,n){for(var i=this.get(e),r="("+((t-e-1<<3)-i)+" bit)\n",s="",o=e+1;o<t;++o){for(var a=this.get(o),l=o==t-1?i:0,c=7;c>=l;--c)s+=a>>c&1?"1":"0";if(s.length>n)return r+Yo(s,n)}return r+s},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return Yo(this.parseStringISO(e,t),n);var i=t-e,r="("+i+" byte)\n";i>(n/=2)&&(t=e+n);for(var s=e;s<t;++s)r+=this.hexByte(this.get(s));return i>n&&(r+=Ho),r},e.prototype.parseOID=function(e,t,n){for(var i="",r=new Fo,s=0,o=e;o<t;++o){var a=this.get(o);if(r.mulAdd(128,127&a),s+=7,!(128&a)){if(""===i)if((r=r.simplify())instanceof Fo)r.sub(80),i="2."+r.toString();else{var l=r<80?r<40?0:1:2;i=l+"."+(r-40*l)}else i+="."+r.toString();if(i.length>n)return Yo(i,n);r=new Fo,s=0}}return s>0&&(i+=".incomplete"),i},e}(),Xo=function(){function e(e,t,n,i,r){if(!(i instanceof Zo))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=n,this.tag=i,this.sub=r}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+n,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return Yo(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return Yo(this.stream.parseStringISO(t,t+n),e);case 30:return Yo(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,23==this.tag.tagNumber)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},e.prototype.toPrettyString=function(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var n=0,i=this.sub.length;n<i;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=127&t;if(n==t)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===n)return null;t=0;for(var i=0;i<n;++i)t=256*t+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=2*this.header,n=2*this.length;return e.substr(t,n)},e.decode=function(t){var n;n=t instanceof Wo?t:new Wo(t,0);var i=new Wo(n),r=new Zo(n),s=e.decodeLength(n),o=n.pos,a=o-i.pos,l=null,c=function(){var t=[];if(null!==s){for(var i=o+s;n.pos<i;)t[t.length]=e.decode(n);if(n.pos!=i)throw new Error("Content size is not correct for container starting at offset "+o)}else try{for(;;){var r=e.decode(n);if(r.tag.isEOC())break;t[t.length]=r}s=o-n.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return t};if(r.tagConstructed)l=c();else if(r.isUniversal()&&(3==r.tagNumber||4==r.tagNumber))try{if(3==r.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");l=c();for(var h=0;h<l.length;++h)if(l[h].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){l=null}if(null===l){if(null===s)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);n.pos=o+Math.abs(s)}return new e(i,a,s,r,l)},e}(),Zo=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=0!=(32&t),this.tagNumber=31&t,31==this.tagNumber){var n=new Fo;do{t=e.get(),n.mulAdd(128,127&t)}while(128&t);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return 0===this.tagClass},e.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},e}(),Ko=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],qo=(1<<26)/Ko[Ko.length-1],Jo=function(){function e(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,i=(1<<t)-1,r=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(n=this[o]>>a)>0&&(r=!0,s=To(n));o>=0;)a<t?(n=(this[o]&(1<<a)-1)<<t-a,n|=this[--o]>>(a+=this.DB-t)):(n=this[o]>>(a-=t)&i,a<=0&&(a+=this.DB,--o)),n>0&&(r=!0),r&&(s+=To(n));return r?s:"0"},e.prototype.negate=function(){var t=ia();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ua(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=ia();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new ea(t):new ta(t),this.exp(e,n)},e.prototype.clone=function(){var e=ia();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n,i=this.DB-e*this.DB%8,r=0;if(e-- >0)for(i<this.DB&&(n=this[e]>>i)!=(this.s&this.DM)>>i&&(t[r++]=n|this.s<<this.DB-i);e>=0;)i<8?(n=(this[e]&(1<<i)-1)<<8-i,n|=this[--e]>>(i+=this.DB-8)):(n=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==r&&(128&this.s)!=(128&n)&&++r,(r>0||n!=this.s)&&(t[r++]=n);return t},e.prototype.equals=function(e){return 0==this.compareTo(e)},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=ia();return this.bitwiseTo(e,Do,t),t},e.prototype.or=function(e){var t=ia();return this.bitwiseTo(e,Co,t),t},e.prototype.xor=function(e){var t=ia();return this.bitwiseTo(e,Bo,t),t},e.prototype.andNot=function(e){var t=ia();return this.bitwiseTo(e,Io,t),t},e.prototype.not=function(){for(var e=ia(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=ia();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=ia();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+Mo(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=Oo(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,Co)},e.prototype.clearBit=function(e){return this.changeBit(e,Io)},e.prototype.flipBit=function(e){return this.changeBit(e,Bo)},e.prototype.add=function(e){var t=ia();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=ia();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=ia();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=ia();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=ia();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=ia(),n=ia();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,i,r=e.bitLength(),s=ha(1);if(r<=0)return s;n=r<18?1:r<48?3:r<144?4:r<768?5:6,i=r<8?new ea(t):t.isEven()?new na(t):new ta(t);var o=[],a=3,l=n-1,c=(1<<n)-1;if(o[1]=i.convert(this),n>1){var h=ia();for(i.sqrTo(o[1],h);a<=c;)o[a]=ia(),i.mulTo(h,o[a-2],o[a]),a+=2}var u,d,f=e.t-1,p=!0,g=ia();for(r=ua(e[f])-1;f>=0;){for(r>=l?u=e[f]>>r-l&c:(u=(e[f]&(1<<r+1)-1)<<l-r,f>0&&(u|=e[f-1]>>this.DB+r-l)),a=n;0==(1&u);)u>>=1,--a;if((r-=a)<0&&(r+=this.DB,--f),p)o[u].copyTo(s),p=!1;else{for(;a>1;)i.sqrTo(s,g),i.sqrTo(g,s),a-=2;a>0?i.sqrTo(s,g):(d=s,s=g,g=d),i.mulTo(g,o[u],s)}for(;f>=0&&0==(e[f]&1<<r);)i.sqrTo(s,g),d=s,s=g,g=d,--r<0&&(r=this.DB-1,--f)}return i.revert(s)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;for(var i=t.clone(),r=this.clone(),s=ha(1),o=ha(0),a=ha(0),l=ha(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),n?(s.isEven()&&o.isEven()||(s.addTo(this,s),o.subTo(t,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),n?(a.isEven()&&l.isEven()||(a.addTo(this,a),l.subTo(t,l)),a.rShiftTo(1,a)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);i.compareTo(r)>=0?(i.subTo(r,i),n&&s.subTo(a,s),o.subTo(l,o)):(r.subTo(i,r),n&&a.subTo(s,a),l.subTo(o,l))}return 0!=r.compareTo(e.ONE)?e.ZERO:l.compareTo(t)>=0?l.subtract(t):l.signum()<0?(l.addTo(t,l),l.signum()<0?l.add(t):l):l},e.prototype.pow=function(e){return this.exp(e,new $o)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var i=t;t=n,n=i}var r=t.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)return t;for(r<s&&(s=r),s>0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));t.signum()>0;)(r=t.getLowestSetBit())>0&&t.rShiftTo(r,t),(r=n.getLowestSetBit())>0&&n.rShiftTo(r,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return s>0&&n.lShiftTo(s,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=Ko[Ko.length-1]){for(t=0;t<Ko.length;++t)if(n[0]==Ko[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<Ko.length;){for(var i=Ko[t],r=t+1;r<Ko.length&&i<qo;)i*=Ko[r++];for(i=n.modInt(i);t<r;)if(i%Ko[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var i;if(16==n)i=4;else if(8==n)i=3;else if(256==n)i=8;else if(2==n)i=1;else if(32==n)i=5;else{if(4!=n)return void this.fromRadix(t,n);i=2}this.t=0,this.s=0;for(var r=t.length,s=!1,o=0;--r>=0;){var a=8==i?255&+t[r]:ca(t,r);a<0?"-"==t.charAt(r)&&(s=!0):(s=!1,0==o?this[this.t++]=a:o+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=i)>=this.DB&&(o-=this.DB))}8==i&&0!=(128&+t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,i=this.DB-n,r=(1<<i)-1,s=Math.floor(e/this.DB),o=this.s<<n&this.DM,a=this.t-1;a>=0;--a)t[a+s+1]=this[a]>>i|o,o=(this[a]&r)<<n;for(a=s-1;a>=0;--a)t[a]=0;t[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var i=e%this.DB,r=this.DB-i,s=(1<<i)-1;t[0]=this[n]>>i;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&s)<<r,t[o-n]=this[o]>>i;i>0&&(t[this.t-n-1]|=(this.s&s)<<r),t.t=this.t-n,t.clamp()}},e.prototype.subTo=function(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);n<r;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var i=this.abs(),r=t.abs(),s=i.t;for(n.t=s+r.t;--s>=0;)n[s]=0;for(s=0;s<r.t;++s)n[s+i.t]=i.am(0,r[s],n,s,0,i.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var i=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,i,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,i){var r=t.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t)return null!=n&&n.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=ia());var o=ia(),a=this.s,l=t.s,c=this.DB-ua(r[r.t-1]);c>0?(r.lShiftTo(c,o),s.lShiftTo(c,i)):(r.copyTo(o),s.copyTo(i));var h=o.t,u=o[h-1];if(0!=u){var d=u*(1<<this.F1)+(h>1?o[h-2]>>this.F2:0),f=this.FV/d,p=(1<<this.F1)/d,g=1<<this.F2,m=i.t,v=m-h,y=null==n?ia():n;for(o.dlShiftTo(v,y),i.compareTo(y)>=0&&(i[i.t++]=1,i.subTo(y,i)),e.ONE.dlShiftTo(h,y),y.subTo(o,o);o.t<h;)o[o.t++]=0;for(;--v>=0;){var b=i[--m]==u?this.DM:Math.floor(i[m]*f+(i[m-1]+g)*p);if((i[m]+=o.am(0,b,i,v,0,h))<b)for(o.dlShiftTo(v,y),i.subTo(y,i);i[m]<--b;)i.subTo(y,i)}null!=n&&(i.drShiftTo(h,n),a!=l&&e.ZERO.subTo(n,n)),i.t=h,i.clamp(),c>0&&i.rShiftTo(c,i),a<0&&e.ZERO.subTo(i,i)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var i=ia(),r=ia(),s=n.convert(this),o=ua(t)-1;for(s.copyTo(i);--o>=0;)if(n.sqrTo(i,r),(t&1<<o)>0)n.mulTo(r,s,i);else{var a=i;i=r,r=a}return n.revert(i)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),i=ha(n),r=ia(),s=ia(),o="";for(this.divRemTo(i,r,s);r.signum()>0;)o=(n+s.intValue()).toString(e).substr(1)+o,r.divRemTo(i,r,s);return s.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var i=this.chunkSize(n),r=Math.pow(n,i),s=!1,o=0,a=0,l=0;l<t.length;++l){var c=ca(t,l);c<0?"-"==t.charAt(l)&&0==this.signum()&&(s=!0):(a=n*a+c,++o>=i&&(this.dMultiply(r),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(n,o)),this.dAddOffset(a,0)),s&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,i){if("number"==typeof n)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),Co,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var r=[],s=7&t;r.length=1+(t>>3),n.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}},e.prototype.bitwiseTo=function(e,t,n){var i,r,s=Math.min(e.t,this.t);for(i=0;i<s;++i)n[i]=t(this[i],e[i]);if(e.t<this.t){for(r=e.s&this.DM,i=s;i<this.t;++i)n[i]=t(this[i],r);n.t=this.t}else{for(r=this.s&this.DM,i=s;i<e.t;++i)n[i]=t(r,e[i]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var i=e.ONE.shiftLeft(t);return this.bitwiseTo(i,n,i),i},e.prototype.addTo=function(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);n<r;)i+=this[n]+e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i+=e[n],t[n++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[n++]=i:i<-1&&(t[n++]=this.DV+i),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var i=Math.min(this.t+e.t,t);for(n.s=0,n.t=i;i>0;)n[--i]=0;for(var r=n.t-this.t;i<r;++i)n[i+this.t]=this.am(0,e[i],n,i,0,this.t);for(r=Math.min(e.t,t);i<r;++i)this.am(0,e[i],n,i,0,t-i);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var i=n.t=this.t+e.t-t;for(n.s=0;--i>=0;)n[i]=0;for(i=Math.max(t-this.t,0);i<e.t;++i)n[this.t+i-t]=this.am(t-i,e[i],n,0,0,this.t+i-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var i=this.t-1;i>=0;--i)n=(t*n+this[i])%e;return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),i=n.getLowestSetBit();if(i<=0)return!1;var r=n.shiftRight(i);(t=t+1>>1)>Ko.length&&(t=Ko.length);for(var s=ia(),o=0;o<t;++o){s.fromInt(Ko[Math.floor(Math.random()*Ko.length)]);var a=s.modPow(r,this);if(0!=a.compareTo(e.ONE)&&0!=a.compareTo(n)){for(var l=1;l++<i&&0!=a.compareTo(n);)if(0==(a=a.modPowInt(2,this)).compareTo(e.ONE))return!1;if(0!=a.compareTo(n))return!1}}return!0},e.prototype.square=function(){var e=ia();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(n.compareTo(i)<0){var r=n;n=i,i=r}var s=n.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)t(n);else{s<o&&(o=s),o>0&&(n.rShiftTo(o,n),i.rShiftTo(o,i));var a=function(){(s=n.getLowestSetBit())>0&&n.rShiftTo(s,n),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),n.compareTo(i)>=0?(n.subTo(i,n),n.rShiftTo(1,n)):(i.subTo(n,i),i.rShiftTo(1,i)),n.signum()>0?setTimeout(a,0):(o>0&&i.lShiftTo(o,i),setTimeout((function(){t(i)}),0))};setTimeout(a,10)}},e.prototype.fromNumberAsync=function(t,n,i,r){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),Co,this),this.isEven()&&this.dAddOffset(1,0);var s=this,o=function(){s.dAddOffset(2,0),s.bitLength()>t&&s.subTo(e.ONE.shiftLeft(t-1),s),s.isProbablePrime(n)?setTimeout((function(){r()}),0):setTimeout(o,0)};setTimeout(o,0)}else{var a=[],l=7&t;a.length=1+(t>>3),n.nextBytes(a),l>0?a[0]&=(1<<l)-1:a[0]=0,this.fromString(a,256)}},e}(),$o=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),ea=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),ta=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=ia();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Jo.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=ia();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],i=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,i,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),na=function(){function e(e){this.m=e,this.r2=ia(),this.q3=ia(),Jo.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=ia();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function ia(){return new Jo(null)}function ra(e,t){return new Jo(e,t)}var sa="undefined"!=typeof navigator;sa&&"Microsoft Internet Explorer"==navigator.appName?(Jo.prototype.am=function(e,t,n,i,r,s){for(var o=32767&t,a=t>>15;--s>=0;){var l=32767&this[e],c=this[e++]>>15,h=a*l+c*o;r=((l=o*l+((32767&h)<<15)+n[i]+(1073741823&r))>>>30)+(h>>>15)+a*c+(r>>>30),n[i++]=1073741823&l}return r},Qo=30):sa&&"Netscape"!=navigator.appName?(Jo.prototype.am=function(e,t,n,i,r,s){for(;--s>=0;){var o=t*this[e++]+n[i]+r;r=Math.floor(o/67108864),n[i++]=67108863&o}return r},Qo=26):(Jo.prototype.am=function(e,t,n,i,r,s){for(var o=16383&t,a=t>>14;--s>=0;){var l=16383&this[e],c=this[e++]>>14,h=a*l+c*o;r=((l=o*l+((16383&h)<<14)+n[i]+r)>>28)+(h>>14)+a*c,n[i++]=268435455&l}return r},Qo=28),Jo.prototype.DB=Qo,Jo.prototype.DM=(1<<Qo)-1,Jo.prototype.DV=1<<Qo;Jo.prototype.FV=Math.pow(2,52),Jo.prototype.F1=52-Qo,Jo.prototype.F2=2*Qo-52;var oa,aa,la=[];for(oa="0".charCodeAt(0),aa=0;aa<=9;++aa)la[oa++]=aa;for(oa="a".charCodeAt(0),aa=10;aa<36;++aa)la[oa++]=aa;for(oa="A".charCodeAt(0),aa=10;aa<36;++aa)la[oa++]=aa;function ca(e,t){var n=la[e.charCodeAt(t)];return null==n?-1:n}function ha(e){var t=ia();return t.fromInt(e),t}function ua(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}Jo.ZERO=ha(0),Jo.ONE=ha(1);var da=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,i;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,i=this.S[t],this.S[t]=this.S[n],this.S[n]=i;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();var fa,pa,ga=256,ma=null;if(null==ma){ma=[],pa=0;var va=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var ya=new Uint32Array(256);for(window.crypto.getRandomValues(ya),va=0;va<ya.length;++va)ma[pa++]=255&ya[va]}var ba=0,wa=function(e){if((ba=ba||0)>=256||pa>=ga)window.removeEventListener?window.removeEventListener("mousemove",wa,!1):window.detachEvent&&window.detachEvent("onmousemove",wa);else try{var t=e.x+e.y;ma[pa++]=255&t,ba+=1}catch(e){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",wa,!1):window.attachEvent&&window.attachEvent("onmousemove",wa))}function Aa(){if(null==fa){for(fa=new da;pa<ga;){var e=Math.floor(65536*Math.random());ma[pa++]=255&e}for(fa.init(ma),pa=0;pa<ma.length;++pa)ma[pa]=0;pa=0}return fa.next()}var xa=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=Aa()},e}();var Sa=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=ra(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=function(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var n=[],i=e.length-1;i>=0&&t>0;){var r=e.charCodeAt(i--);r<128?n[--t]=r:r>127&&r<2048?(n[--t]=63&r|128,n[--t]=r>>6|192):(n[--t]=63&r|128,n[--t]=r>>6&63|128,n[--t]=r>>12|224)}n[--t]=0;for(var s=new xa,o=[];t>2;){for(o[0]=0;0==o[0];)s.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new Jo(n)}(e,t);if(null==n)return null;var i=this.doPublic(n);if(null==i)return null;for(var r=i.toString(16),s=r.length,o=0;o<2*t-s;o++)r="0"+r;return r},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=ra(e,16),this.e=parseInt(t,16),this.d=ra(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,i,r,s,o,a){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=ra(e,16),this.e=parseInt(t,16),this.d=ra(n,16),this.p=ra(i,16),this.q=ra(r,16),this.dmp1=ra(s,16),this.dmq1=ra(o,16),this.coeff=ra(a,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new xa,i=e>>1;this.e=parseInt(t,16);for(var r=new Jo(t,16);;){for(;this.p=new Jo(e-i,1,n),0!=this.p.subtract(Jo.ONE).gcd(r).compareTo(Jo.ONE)||!this.p.isProbablePrime(10););for(;this.q=new Jo(i,1,n),0!=this.q.subtract(Jo.ONE).gcd(r).compareTo(Jo.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(Jo.ONE),a=this.q.subtract(Jo.ONE),l=o.multiply(a);if(0==l.gcd(r).compareTo(Jo.ONE)){this.n=this.p.multiply(this.q),this.d=r.modInverse(l),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=ra(e,16),n=this.doPrivate(t);return null==n?null:function(e,t){var n=e.toByteArray(),i=0;for(;i<n.length&&0==n[i];)++i;if(n.length-i!=t-1||2!=n[i])return null;++i;for(;0!=n[i];)if(++i>=n.length)return null;var r="";for(;++i<n.length;){var s=255&n[i];s<128?r+=String.fromCharCode(s):s>191&&s<224?(r+=String.fromCharCode((31&s)<<6|63&n[i+1]),++i):(r+=String.fromCharCode((15&s)<<12|(63&n[i+1])<<6|63&n[i+2]),i+=2)}return r}(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var i=new xa,r=e>>1;this.e=parseInt(t,16);var s=new Jo(t,16),o=this,a=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(Jo.ONE),i=o.q.subtract(Jo.ONE),r=t.multiply(i);0==r.gcd(s).compareTo(Jo.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(r),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(i),o.coeff=o.q.modInverse(o.p),setTimeout((function(){n()}),0)):setTimeout(a,0)},l=function(){o.q=ia(),o.q.fromNumberAsync(r,1,i,(function(){o.q.subtract(Jo.ONE).gcda(s,(function(e){0==e.compareTo(Jo.ONE)&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(l,0)}))}))},c=function(){o.p=ia(),o.p.fromNumberAsync(e-r,1,i,(function(){o.p.subtract(Jo.ONE).gcda(s,(function(e){0==e.compareTo(Jo.ONE)&&o.p.isProbablePrime(10)?setTimeout(l,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)},e.prototype.sign=function(e,t,n){var i=function(e){return Ea[e]||""}(n),r=function(e,t){if(t<e.length+22)return console.error("Message too long for RSA"),null;for(var n=t-e.length-6,i="",r=0;r<n;r+=2)i+="ff";return ra("0001"+i+"00"+e,16)}(i+t(e).toString(),this.n.bitLength()/4);if(null==r)return null;var s=this.doPrivate(r);if(null==s)return null;var o=s.toString(16);return 0==(1&o.length)?o:"0"+o},e.prototype.verify=function(e,t,n){var i=ra(t,16),r=this.doPublic(i);return null==r?null:function(e){for(var t in Ea)if(Ea.hasOwnProperty(t)){var n=Ea[t],i=n.length;if(e.substr(0,i)==n)return e.substr(i)}return e}
7
+ */var Hr="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";function Gr(e,t){let n="texel";if(null!==e){const i=Number.parseInt(H);if(!(t&&i>=133&&135!==i&&e.format===o&&e.type===D&&e.encoding===T))switch(e.encoding){case T:n="sRGBToLinear(texel)";break;case _:n="texel";break;default:throw new Error(`Unsupported encoding: ${e.encoding}`)}}return n}function Vr(e,t,n){return e*(t-n)-t}function Yr(e,t,n){return Math.min(Math.max((e+t)/(t-n),0),1)}var Qr={SKIP:9,SET:30,ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},Wr={DEPTH:0,LUMA:1,COLOR:2},Xr={NONE:0,DEPTH:1,CONVOLUTION:2},Zr={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},Kr={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},qr={DISABLED:0,DEPTH:1,CUSTOM:2},Jr={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3},$r=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],es=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new q;super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new L(null),texelSize:new L(new q),scale:new L(1),kernel:new L(0)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;\n#include <encodings_fragment>\n}",vertexShader:"uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.setTexelSize(e.x,e.y),this.kernelSize=Kr.MEDIUM}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get kernelSequence(){return $r[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t,.5*e,.5*t)}setSize(e,t){const n=1/e,i=1/t;this.uniforms.texelSize.value.set(n,i,.5*n,.5*i)}},ts=class extends j{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new L(null),opacity:new L(1)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <dithering_pars_fragment>\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include <encodings_fragment>\n#include <dithering_fragment>\n}",vertexShader:Hr}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},ns=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;super({name:"DepthComparisonMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new L(null),cameraNear:new L(.3),cameraFar:new L(1e3)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#include <clipping_planes_pars_fragment>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float cameraNear;uniform float cameraFar;varying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <clipping_planes_fragment>\nvec2 projTexCoord=(vProjTexCoord.xy/vProjTexCoord.w)*0.5+0.5;projTexCoord=clamp(projTexCoord,0.002,0.998);\n#if DEPTH_PACKING == 3201\nfloat fragCoordZ=unpackRGBAToDepth(texture2D(depthBuffer,projTexCoord));\n#else\nfloat fragCoordZ=texture2D(depthBuffer,projTexCoord).r;\n#endif\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#else\nfloat viewZ=orthographicDepthToViewZ(fragCoordZ,cameraNear,cameraFar);\n#endif\nfloat depthTest=(-vViewZ>-viewZ)?1.0:0.0;gl_FragColor.rg=vec2(0.0,depthTest);}",vertexShader:"#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying float vViewZ;varying vec4 vProjTexCoord;void main(){\n#include <skinbase_vertex>\n#include <begin_vertex>\n#include <morphtarget_vertex>\n#include <skinning_vertex>\n#include <project_vertex>\nvViewZ=mvPosition.z;vProjTexCoord=gl_Position;\n#include <clipping_planes_vertex>\n}"}),this.toneMapped=!1,this.depthBuffer=e,this.depthPacking=z,this.copyCameraSettings(t)}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:z;this.depthBuffer=e,this.depthPacking=t}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof y?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},is=class extends j{constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new L(null),normalBuffer:new L(null),texelSize:new L(new b)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"#include <packing>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\n#ifdef DOWNSAMPLE_NORMALS\nuniform lowp sampler2D normalBuffer;\n#endif\nvarying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[]=float[4](abs(c-samples[0]),abs(c-samples[1]),abs(c-samples[2]),abs(c-samples[3]));float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]<maxDistance){remaining[j++]=i;}else{rejected[k++]=i;}}for(;j<3;++j){remaining[j]=rejected[--k];}vec3 s=vec3(samples[remaining[0]],samples[remaining[1]],samples[remaining[2]]);c=(s.x+s.y+s.z)/3.0;distances[0]=abs(c-s.x);distances[1]=abs(c-s.y);distances[2]=abs(c-s.z);float minDistance=min(distances[0],min(distances[1],distances[2]));for(i=0;i<3;++i){if(distances[i]==minDistance){break;}}return remaining[i];}void main(){float d[]=float[4](readDepth(vUv0),readDepth(vUv1),readDepth(vUv2),readDepth(vUv3));int index=findBestDepth(d);\n#ifdef DOWNSAMPLE_NORMALS\nvec3 n[]=vec3[4](texture2D(normalBuffer,vUv0).rgb,texture2D(normalBuffer,vUv1).rgb,texture2D(normalBuffer,vUv2).rgb,texture2D(normalBuffer,vUv3).rgb);\n#else\nvec3 n[]=vec3[4](vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));\n#endif\ngl_FragColor=vec4(n[index],d[index]);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=uv;vUv1=vec2(uv.x,uv.y+texelSize.y);vUv2=vec2(uv.x+texelSize.x,uv.y);vUv3=uv+texelSize;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthBuffer=e,this.depthPacking=t}set normalBuffer(e){this.uniforms.normalBuffer.value=e,null!==e?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(e){this.normalBuffer=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},rs=class extends j{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new L(null),texelSize:new L(new b)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#define WEIGHT_INNER 0.125\n#define WEIGHT_OUTER 0.0555555\nvarying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;\n#include <encodings_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},ss=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new b,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wr.COLOR;super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:H.replace(/\D+/g,""),LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new L(null),depthBuffer:new L(null),predicationBuffer:new L(null),texelSize:new L(e)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\n#if EDGE_DETECTION_MODE == 1\n#include <common>\n#endif\n#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}\n#elif PREDICATION_MODE == 2\nuniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}\n#endif\n#if PREDICATION_MODE != 0\nvec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}\n#endif\n#if EDGE_DETECTION_MODE != 0\nuniform sampler2D inputBuffer;\n#endif\nvoid main(){\n#if EDGE_DETECTION_MODE == 0\nconst vec2 threshold=vec2(DEPTH_THRESHOLD);\n#elif PREDICATION_MODE != 0\nvec2 threshold=calculatePredicatedThreshold();\n#else\nconst vec2 threshold=vec2(EDGE_THRESHOLD);\n#endif\n#if EDGE_DETECTION_MODE == 0\nvec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 1\nfloat l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#elif EDGE_DETECTION_MODE == 2\nvec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);\n#endif\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\nvoid main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);\n#if EDGE_DETECTION_MODE != 0\nvUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.edgeDetectionMode=t}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthBuffer=e,this.depthPacking=t}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(e){this.edgeDetectionMode=e}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(e){this.localContrastAdaptationFactor=e}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*e).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(e){this.edgeDetectionThreshold=e}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(e){this.predicationMode=e}set predicationBuffer(e){this.uniforms.predicationBuffer.value=e}setPredicationBuffer(e){this.uniforms.predicationBuffer.value=e}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(e){this.predicationThreshold=e}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(e){this.predicationScale=e}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(e){this.predicationStrength=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},os=class extends j{constructor(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super({name:"EffectMaterial",defines:{THREE_REVISION:H.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new L(null),depthBuffer:new L(null),resolution:new L(new b),texelSize:new L(new b),cameraNear:new L(.3),cameraFar:new L(1e3),aspect:new L(1),time:new L(0)},blending:F,depthWrite:!1,depthTest:!1,dithering:r}),this.toneMapped=!1,e&&this.setShaderParts(e),t&&this.setDefines(t),n&&this.setUniforms(n),this.copyCameraSettings(i)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthBuffer=e,this.depthPacking=t}setShaderData(e){this.setShaderParts(e.shaderParts),this.setDefines(e.defines),this.setUniforms(e.uniforms),this.setExtensions(e.extensions)}setShaderParts(e){var t,n,i,r,s;return this.fragmentShader="#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if THREE_REVISION >= 137\nvec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include <encodings_fragment>\n#endif\n#include <dithering_fragment>\n}".replace(Zr.FRAGMENT_HEAD,null!=(t=e.get(Zr.FRAGMENT_HEAD))?t:"").replace(Zr.FRAGMENT_MAIN_UV,null!=(n=e.get(Zr.FRAGMENT_MAIN_UV))?n:"").replace(Zr.FRAGMENT_MAIN_IMAGE,null!=(i=e.get(Zr.FRAGMENT_MAIN_IMAGE))?i:""),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEADvoid main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORTgl_Position=vec4(position.xy,1.0,1.0);}".replace(Zr.VERTEX_HEAD,null!=(r=e.get(Zr.VERTEX_HEAD))?r:"").replace(Zr.VERTEX_MAIN_SUPPORT,null!=(s=e.get(Zr.VERTEX_MAIN_SUPPORT))?s:""),this.needsUpdate=!0,this}setDefines(e){for(const t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(const t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){this.extensions={};for(const t of e)this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof y?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const n=this.uniforms;n.resolution.value.set(e,t),n.texelSize.value.set(1/e,1/t),n.aspect.value=e/t}static get Section(){return Zr}},as=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super({name:"LuminanceMaterial",defines:{THREE_REVISION:H.replace(/\D+/g,"")},uniforms:{inputBuffer:new L(null),threshold:new L(0),smoothing:new L(1),range:new L(null)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);l*=low*high;\n#elif defined(THRESHOLD)\nl=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=vec4(texel.rgb*l,l);\n#else\ngl_FragColor=vec4(l);\n#endif\n}",vertexShader:Hr}),this.toneMapped=!1,this.colorOutput=e,this.luminanceRange=t}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}},ls=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new b;super({name:"OutlineMaterial",uniforms:{inputBuffer:new L(null),texelSize:new L(new b)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"uniform lowp sampler2D inputBuffer;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 c0=texture2D(inputBuffer,vUv0).rg;vec2 c1=texture2D(inputBuffer,vUv1).rg;vec2 c2=texture2D(inputBuffer,vUv2).rg;vec2 c3=texture2D(inputBuffer,vUv3).rg;float d0=(c0.x-c1.x)*0.5;float d1=(c2.x-c3.x)*0.5;float d=length(vec2(d0,d1));float a0=min(c0.y,c1.y);float a1=min(c2.y,c3.y);float visibilityFactor=min(a0,a1);gl_FragColor.rg=(1.0-visibilityFactor>0.001)?vec2(d,0.0):vec2(0.0,d);}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=vec2(uv.x+texelSize.x,uv.y);vUv1=vec2(uv.x-texelSize.x,uv.y);vUv2=vec2(uv.x,uv.y+texelSize.y);vUv3=vec2(uv.x,uv.y-texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.uniforms.texelSize.value.set(e.x,e.y),this.uniforms.maskTexture=this.uniforms.inputBuffer}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},cs=class extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new b,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new b;super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new L(null),searchTexture:new L(null),areaTexture:new L(null),resolution:new L(t),texelSize:new L(e)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)\n#if __VERSION__ < 300\n#define round(v) floor(v + 0.5)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x>end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x<end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.y>end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;i++){if(!(texCoord.y<end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);\n#endif\n}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);\n#endif\n}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){\n#if !defined(DISABLE_DIAG_DETECTION)\nweights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){\n#endif\nvec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);\n#if !defined(DISABLE_DIAG_DETECTION)\n}else{e.r=0.0;}\n#endif\n}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}",vertexShader:"uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(e){this.uniforms.searchTexture.value=e}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(e){this.uniforms.areaTexture.value=e}setLookupTextures(e,t){this.searchTexture=e,this.areaTexture=t}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(e){const t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(e){this.orthogonalSearchSteps=e}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(e){const t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(e){this.diagonalSearchSteps=e}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(e){this.diagonalDetection=e}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(e){const t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(e){this.cornerRounding=e}get cornerDetection(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerDetection(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(e){this.cornerDetection=e}setSize(e,t){const n=this.uniforms;n.texelSize.value.set(1/e,1/t),n.resolution.value.set(e,t)}},hs=class extends j{constructor(e){super({name:"SSAOMaterial",defines:{SAMPLES_INT:"0",INV_SAMPLES_FLOAT:"0.0",SPIRAL_TURNS:"0.0",RADIUS:"1.0",RADIUS_SQ:"1.0",DISTANCE_SCALING:"1",DEPTH_PACKING:"0"},uniforms:{depthBuffer:new L(null),normalBuffer:new L(null),normalDepthBuffer:new L(null),noiseTexture:new L(null),inverseProjectionMatrix:new L(new m),projectionMatrix:new L(new m),texelSize:new L(new b),cameraNearFar:new L(new b),distanceCutoff:new L(new b),proximityCutoff:new L(new b),noiseScale:new L(new b),minRadiusScale:new L(.33),intensity:new L(1),fade:new L(.01),bias:new L(0)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <packing>\n#ifdef NORMAL_DEPTH\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){return texture2D(normalDepthBuffer,uv).a;}\n#else\nuniform lowp sampler2D normalBuffer;\n#if DEPTH_PACKING == 3201\nuniform lowp sampler2D depthBuffer;\n#elif defined(GL_FRAGMENT_PRECISION_HIGH)\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}\n#endif\nuniform lowp sampler2D noiseTexture;uniform mat4 inverseProjectionMatrix;uniform mat4 projectionMatrix;uniform vec2 texelSize;uniform vec2 cameraNearFar;uniform float intensity;uniform float minRadiusScale;uniform float fade;uniform float bias;uniform vec2 distanceCutoff;uniform vec2 proximityCutoff;varying vec2 vUv;varying vec2 vUv2;float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNearFar.x,cameraNearFar.y);\n#endif\n}vec3 getViewPosition(const in vec2 screenPosition,const in float depth,const in float viewZ){vec4 clipPosition=vec4(vec3(screenPosition,depth)*2.0-1.0,1.0);float clipW=projectionMatrix[2][3]*viewZ+projectionMatrix[3][3];clipPosition*=clipW;return(inverseProjectionMatrix*clipPosition).xyz;}float getAmbientOcclusion(const in vec3 p,const in vec3 n,const in float depth,const in vec2 uv){float radiusScale=1.0-smoothstep(0.0,distanceCutoff.y,depth);radiusScale=radiusScale*(1.0-minRadiusScale)+minRadiusScale;float radius=RADIUS*radiusScale;float noise=texture2D(noiseTexture,vUv2).r;float baseAngle=noise*PI2;float rings=SPIRAL_TURNS*PI2;float occlusion=0.0;int taps=0;for(int i=0;i<SAMPLES_INT;++i){float alpha=(float(i)+0.5)*INV_SAMPLES_FLOAT;float angle=alpha*rings+baseAngle;vec2 rotation=vec2(cos(angle),sin(angle));vec2 coords=alpha*radius*rotation*texelSize+uv;if(coords.s<0.0||coords.s>1.0||coords.t<0.0||coords.t>1.0){continue;}float sampleDepth=readDepth(coords);float viewZ=getViewZ(sampleDepth);\n#ifdef PERSPECTIVE_CAMERA\nfloat linearSampleDepth=viewZToOrthographicDepth(viewZ,cameraNearFar.x,cameraNearFar.y);\n#else\nfloat linearSampleDepth=sampleDepth;\n#endif\nfloat proximity=abs(depth-linearSampleDepth);if(proximity<proximityCutoff.y){float falloff=1.0-smoothstep(proximityCutoff.x,proximityCutoff.y,proximity);vec3 Q=getViewPosition(coords,sampleDepth,viewZ);vec3 v=Q-p;float vv=dot(v,v);float vn=dot(v,n)-bias;float f=max(RADIUS_SQ-vv,0.0)/RADIUS_SQ;occlusion+=(f*f*f*max(vn/(fade+vv),0.0))*falloff;}++taps;}return occlusion/(4.0*max(float(taps),1.0));}void main(){\n#ifdef NORMAL_DEPTH\nvec4 normalDepth=texture2D(normalDepthBuffer,vUv);\n#else\nvec4 normalDepth=vec4(texture2D(normalBuffer,vUv).xyz,readDepth(vUv));\n#endif\nfloat ao=0.0;float depth=normalDepth.a;float viewZ=getViewZ(depth);\n#ifdef PERSPECTIVE_CAMERA\nfloat linearDepth=viewZToOrthographicDepth(viewZ,cameraNearFar.x,cameraNearFar.y);\n#else\nfloat linearDepth=depth;\n#endif\nif(linearDepth<distanceCutoff.y){vec3 viewPosition=getViewPosition(vUv,depth,viewZ);vec3 viewNormal=unpackRGBToNormal(normalDepth.rgb);ao+=getAmbientOcclusion(viewPosition,viewNormal,linearDepth,vUv);float d=smoothstep(distanceCutoff.x,distanceCutoff.y,linearDepth);ao=mix(ao,0.0,d);\n#ifdef LEGACY_INTENSITY\nao=clamp(1.0-pow(1.0-ao,abs(intensity)),0.0,1.0);\n#endif\n}gl_FragColor.r=ao;}",vertexShader:"uniform vec2 noiseScale;varying vec2 vUv;varying vec2 vUv2;void main(){vUv=position.xy*0.5+0.5;vUv2=vUv*noiseScale;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.copyCameraSettings(e),this.resolution=new b,this.r=1}get near(){return this.uniforms.cameraNearFar.value.x}get far(){return this.uniforms.cameraNearFar.value.y}set normalDepthBuffer(e){this.uniforms.normalDepthBuffer.value=e,null!==e?this.defines.NORMAL_DEPTH="1":delete this.defines.NORMAL_DEPTH,this.needsUpdate=!0}setNormalDepthBuffer(e){this.normalDepthBuffer=e}set normalBuffer(e){this.uniforms.normalBuffer.value=e}setNormalBuffer(e){this.uniforms.normalBuffer.value=e}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthBuffer=e,this.depthPacking=t}set noiseTexture(e){this.uniforms.noiseTexture.value=e}setNoiseTexture(e){this.uniforms.noiseTexture.value=e}get samples(){return Number(this.defines.SAMPLES_INT)}set samples(e){this.defines.SAMPLES_INT=e.toFixed(0),this.defines.INV_SAMPLES_FLOAT=(1/e).toFixed(9),this.needsUpdate=!0}getSamples(){return this.samples}setSamples(e){this.samples=e}get rings(){return Number(this.defines.SPIRAL_TURNS)}set rings(e){this.defines.SPIRAL_TURNS=e.toFixed(1),this.needsUpdate=!0}getRings(){return this.rings}setRings(e){this.rings=e}get intensity(){return this.uniforms.intensity.value}set intensity(e){this.uniforms.intensity.value=e,void 0===this.defines.LEGACY_INTENSITY&&(this.defines.LEGACY_INTENSITY="1",this.needsUpdate=!0)}getIntensity(){return this.uniforms.intensity.value}setIntensity(e){this.uniforms.intensity.value=e}get fade(){return this.uniforms.fade.value}set fade(e){this.uniforms.fade.value=e}getFade(){return this.uniforms.fade.value}setFade(e){this.uniforms.fade.value=e}get bias(){return this.uniforms.bias.value}set bias(e){this.uniforms.bias.value=e}getBias(){return this.uniforms.bias.value}setBias(e){this.uniforms.bias.value=e}get minRadiusScale(){return this.uniforms.minRadiusScale.value}set minRadiusScale(e){this.uniforms.minRadiusScale.value=e}getMinRadiusScale(){return this.uniforms.minRadiusScale.value}setMinRadiusScale(e){this.uniforms.minRadiusScale.value=e}updateRadius(){const e=this.r*this.resolution.height;this.defines.RADIUS=e.toFixed(11),this.defines.RADIUS_SQ=(e*e).toFixed(11),this.needsUpdate=!0}get radius(){return this.r}set radius(e){this.r=Math.min(Math.max(e,1e-6),1),this.updateRadius()}getRadius(){return this.radius}setRadius(e){this.radius=e}get distanceScaling(){return!0}set distanceScaling(e){}isDistanceScalingEnabled(){return this.distanceScaling}setDistanceScalingEnabled(e){this.distanceScaling=e}get distanceThreshold(){return this.uniforms.distanceCutoff.value.x}set distanceThreshold(e){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.distanceFalloff,0),1))}get worldDistanceThreshold(){return-Vr(this.distanceThreshold,this.near,this.far)}set worldDistanceThreshold(e){this.distanceThreshold=Yr(-e,this.near,this.far)}get distanceFalloff(){return this.uniforms.distanceCutoff.value.y-this.distanceThreshold}set distanceFalloff(e){this.uniforms.distanceCutoff.value.y=Math.min(Math.max(this.distanceThreshold+e,0),1)}get worldDistanceFalloff(){return-Vr(this.distanceFalloff,this.near,this.far)}set worldDistanceFalloff(e){this.distanceFalloff=Yr(-e,this.near,this.far)}setDistanceCutoff(e,t){this.uniforms.distanceCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}get proximityThreshold(){return this.uniforms.proximityCutoff.value.x}set proximityThreshold(e){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+this.proximityFalloff,0),1))}get worldProximityThreshold(){return-Vr(this.proximityThreshold,this.near,this.far)}set worldProximityThreshold(e){this.proximityThreshold=Yr(-e,this.near,this.far)}get proximityFalloff(){return this.uniforms.proximityCutoff.value.y-this.proximityThreshold}set proximityFalloff(e){this.uniforms.proximityCutoff.value.y=Math.min(Math.max(this.proximityThreshold+e,0),1)}get worldProximityFalloff(){return-Vr(this.proximityFalloff,this.near,this.far)}set worldProximityFalloff(e){this.proximityFalloff=Yr(-e,this.near,this.far)}setProximityCutoff(e,t){this.uniforms.proximityCutoff.value.set(Math.min(Math.max(e,0),1),Math.min(Math.max(e+t,0),1))}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNearFar.value.set(e.near,e.far),this.uniforms.projectionMatrix.value.copy(e.projectionMatrix),this.uniforms.inverseProjectionMatrix.value.copy(e.projectionMatrix).invert(),e instanceof y?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const n=this.uniforms,i=n.noiseTexture.value;null!==i&&n.noiseScale.value.set(e/i.image.width,t/i.image.height),n.texelSize.value.set(1/e,1/t),this.resolution.set(e,t),this.updateRadius()}},us=class extends j{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new L(null),supportBuffer:new L(null),texelSize:new L(new b),radius:new L(.85)},blending:F,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;\n#else\nuniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;\n#endif\nuniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);\n#include <encodings_fragment>\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}set supportBuffer(e){this.uniforms.supportBuffer.value=e}get radius(){return this.uniforms.radius.value}set radius(e){this.uniforms.radius.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},ds=new E,fs=null;var ps=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Pass",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new c,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ds;this.name=e,this.renderer=null,this.scene=t,this.camera=n,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){const t=this.fullscreenMaterial;null!==t&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;null!==t?t.material=e:(t=new u(function(){if(null===fs){const e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);void 0!==(fs=new J).setAttribute?(fs.setAttribute("position",new $(e,3)),fs.setAttribute("uv",new $(t,2))):(fs.addAttribute("position",new $(e,3)),fs.addAttribute("uv",new $(t,2)))}return fs}(),e),t.frustumCulled=!1,null===this.scene&&(this.scene=new c),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e){}render(e,t,n,i,r){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof I||t instanceof ee||t instanceof l||t instanceof ps)&&this[e].dispose()}}},gs=class extends ps{constructor(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];super("CopyPass"),this.fullscreenMaterial=new ts,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new I(1,1,{minFilter:U,magFilter:U,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTarget.texture.type=n,n!==D?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":e.outputEncoding===T&&(this.renderTarget.texture.encoding=T))}},ms=class extends ps{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(e,t,n,i,r){const s=e.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},vs=new a,ys=class extends ps{constructor(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=n,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,n){this.color=e,this.depth=t,this.stencil=n}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,n,i,r){const s=this.overrideClearColor,o=this.overrideClearAlpha,a=e.getClearAlpha(),l=null!==s,c=o>=0;l?(e.getClearColor(vs),e.setClearColor(s,c?o:a)):c&&e.setClearAlpha(o),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(vs,a):c&&e.setClearAlpha(a)}},ws=-1,bs=class extends G{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ws,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ws,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;super(),this.resizable=e,this.baseSize=new b(1,1),this.preferredSize=new b(t,n),this.target=this.preferredSize,this.s=i,this.effectiveSize=new b,this.addEventListener("change",(()=>this.updateEffectiveSize())),this.updateEffectiveSize()}updateEffectiveSize(){const e=this.baseSize,t=this.preferredSize,n=this.effectiveSize,i=this.scale;t.width!==ws?n.width=t.width:t.height!==ws?n.width=Math.round(t.height*(e.width/Math.max(e.height,1))):n.width=Math.round(e.width*i),t.height!==ws?n.height=t.height:t.width!==ws?n.height=Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):n.height=Math.round(e.height*i)}get width(){return this.effectiveSize.width}set width(e){this.preferredWidth=e}get height(){return this.effectiveSize.height}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferredSize.setScalar(ws),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.baseSize.width}set baseWidth(e){this.baseSize.width!==e&&(this.baseSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(e){this.baseWidth=e}get baseHeight(){return this.baseSize.height}set baseHeight(e){this.baseSize.height!==e&&(this.baseSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){this.baseSize.width===e&&this.baseSize.height===t||(this.baseSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(e){this.preferredSize.width!==e&&(this.preferredSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferredSize.height}set preferredHeight(e){this.preferredSize.height!==e&&(this.preferredSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){this.preferredSize.width===e&&this.preferredSize.height===t||(this.preferredSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(e){this.s=e.scale,this.baseSize.set(e.baseWidth,e.baseHeight),this.preferredSize.set(e.preferredWidth,e.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return ws}},As=!1,xs=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case Y:t=this.materialsFlatShadedDoubleSide;break;case V:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case Y:t=this.materialsDoubleSide;break;case V:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){const t=this.materials=[e.clone(),e.clone(),e.clone()];for(const n of t)n.uniforms=Object.assign({},e.uniforms),n.side=Q;t[2].skinning=!0,this.materialsBackSide=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.side=V,n})),this.materialsDoubleSide=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.side=Y,n})),this.materialsFlatShaded=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n})),this.materialsFlatShadedBackSide=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=V,n})),this.materialsFlatShadedDoubleSide=t.map((t=>{const n=t.clone();return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=Y,n}))}}render(e,t,n){const i=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,As){const i=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,n);for(const e of i)e[0].material=e[1];this.meshCount!==i.size&&i.clear()}else{const i=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,n),t.overrideMaterial=i}e.shadowMap.enabled=i}disposeMaterials(){if(null!==this.material){const e=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const t of e)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return As}static set workaroundEnabled(e){As=e}},Ss=class extends ps{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new ys,this.overrideMaterialManager=null===n?null:new xs(n),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){const e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){const t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new xs(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,n,i,r){const s=this.scene,o=this.camera,a=this.selection,l=o.layers.mask,c=s.background,h=e.shadowMap.autoUpdate,u=this.renderToScreen?null:t;null!==a&&o.layers.set(a.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(u),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,s,o):e.render(s,o),o.layers.mask=l,s.background=c,e.shadowMap.autoUpdate=h}},Es=class extends ps{constructor(e,t){let{renderTarget:n,resolutionScale:i=1,width:r=bs.AUTO_SIZE,height:s=bs.AUTO_SIZE,resolutionX:o=r,resolutionY:l=s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super("DepthPass"),this.needsSwap=!1,this.renderPass=new Ss(e,t,new W({depthPacking:z}));const c=this.renderPass;c.skipShadowMapUpdate=!0,c.ignoreBackground=!0;const h=c.getClearPass();h.overrideClearColor=new a(16777215),h.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new I(1,1,{minFilter:B,magFilter:B}),this.renderTarget.texture.name="DepthPass.Target");const u=this.resolution=new bs(this,o,l,i);u.addEventListener("change",(e=>this.setSize(u.baseWidth,u.baseHeight)))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},Ts=class extends ps{constructor(){let{normalBuffer:e=null,resolutionScale:t=.5,width:n=bs.AUTO_SIZE,height:i=bs.AUTO_SIZE,resolutionX:r=n,resolutionY:s=i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("DepthDownsamplingPass");const o=new is;o.normalBuffer=e,this.fullscreenMaterial=o,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new I(1,1,{minFilter:B,magFilter:B,depthBuffer:!1,type:X}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;const a=this.resolution=new bs(this,r,s,t);a.addEventListener("change",(e=>this.setSize(a.baseWidth,a.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t}render(e,t,n,i,r){e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.fullscreenMaterial.setSize(e,t)}initialize(e,t,n){const i=e.getContext();if(!(i.getExtension("EXT_color_buffer_float")||i.getExtension("EXT_color_buffer_half_float")))throw new Error("Rendering to float texture is not supported.")}};function Ds(e,t,n){for(const i of t){const t="$1"+e+i.charAt(0).toUpperCase()+i.slice(1),r=new RegExp("([^\\.])(\\b"+i+"\\b)","g");for(const e of n.entries())null!==e[1]&&n.set(e[0],e[1].replace(r,t))}}function Cs(e,t,n){var i,r,s,o,a;let l=t.getFragmentShader(),c=t.getVertexShader();const h=void 0!==l&&/mainImage/.test(l),u=void 0!==l&&/mainUv/.test(l);if(n.attributes|=t.getAttributes(),void 0===l)throw new Error(`Missing fragment shader (${t.name})`);if(u&&0!=(n.attributes&Xr.CONVOLUTION))throw new Error(`Effects that transform UVs are incompatible with convolution effects (${t.name})`);if(!h&&!u)throw new Error(`Could not find mainImage or mainUv function (${t.name})`);{const d=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,f=n.shaderParts;let p=null!=(i=f.get(Zr.FRAGMENT_HEAD))?i:"",g=null!=(r=f.get(Zr.FRAGMENT_MAIN_UV))?r:"",m=null!=(s=f.get(Zr.FRAGMENT_MAIN_IMAGE))?s:"",v=null!=(o=f.get(Zr.VERTEX_HEAD))?o:"",y=null!=(a=f.get(Zr.VERTEX_MAIN_SUPPORT))?a:"";const w=new Set,b=new Set;if(u&&(g+=`\t${e}MainUv(UV);\n`,n.uvTransformation=!0),null!==c&&/mainSupport/.test(c)){const t=/mainSupport *\([\w\s]*?uv\s*?\)/.test(c);y+=`\t${e}MainSupport(`,y+=t?"vUv);\n":");\n";for(const e of c.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const t of e[1].split(/\s*,\s*/))n.varyings.add(t),w.add(t),b.add(t);for(const e of c.matchAll(d))b.add(e[1])}for(const e of l.matchAll(d))b.add(e[1]);for(const e of t.defines.keys())b.add(e.replace(/\([\w\s,]*\)/g,""));for(const e of t.uniforms.keys())b.add(e);b.delete("while"),b.delete("for"),b.delete("if"),t.uniforms.forEach(((t,i)=>n.uniforms.set(e+i.charAt(0).toUpperCase()+i.slice(1),t))),t.defines.forEach(((t,i)=>n.defines.set(e+i.charAt(0).toUpperCase()+i.slice(1),t)));const A=new Map([["fragment",l],["vertex",c]]);Ds(e,b,n.defines),Ds(e,b,A),l=A.get("fragment"),c=A.get("vertex");const x=t.blendMode;if(n.blendModes.set(x.blendFunction,x),h){null!==t.inputColorSpace&&t.inputColorSpace!==n.colorSpace&&(m+=t.inputColorSpace===T?"color0 = LinearTosRGB(color0);\n\t":"color0 = sRGBToLinear(color0);\n\t"),null!==t.outputColorSpace?n.colorSpace=t.outputColorSpace:null!==t.inputColorSpace&&(n.colorSpace=t.inputColorSpace);const i=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;m+=`${e}MainImage(color0, UV, `,0!=(n.attributes&Xr.DEPTH)&&i.test(l)&&(m+="depth, ",n.readDepth=!0),m+="color1);\n\t";const r=e+"BlendOpacity";n.uniforms.set(r,x.opacity),m+=`color0 = blend${x.blendFunction}(color0, color1, ${r});\n\n\t`,p+=`uniform float ${r};\n\n`}if(p+=l+"\n",null!==c&&(v+=c+"\n"),f.set(Zr.FRAGMENT_HEAD,p),f.set(Zr.FRAGMENT_MAIN_UV,g),f.set(Zr.FRAGMENT_MAIN_IMAGE,m),f.set(Zr.VERTEX_HEAD,v),f.set(Zr.VERTEX_MAIN_SUPPORT,y),null!==t.extensions)for(const e of t.extensions)n.extensions.add(e)}}var Is=class extends ps{constructor(e){super("EffectPass"),this.fullscreenMaterial=new os(null,null,null,e),this.listener=e=>this.handleEvent(e),this.effects=[];for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.setEffects(n),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(e){for(const t of this.effects)t.mainScene=e}set mainCamera(e){this.fullscreenMaterial.copyCameraSettings(e);for(const t of this.effects)t.mainCamera=e}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){const t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}setEffects(e){for(const e of this.effects)e.removeEventListener("change",this.listener);this.effects=e.sort(((e,t)=>t.attributes-e.attributes));for(const e of this.effects)e.addEventListener("change",this.listener)}updateMaterial(){const e=new Ns;let t=0;for(const n of this.effects)if(n.blendMode.blendFunction===Qr.DST)e.attributes|=n.getAttributes()&Xr.DEPTH;else{if(0!=(e.attributes&n.getAttributes()&Xr.CONVOLUTION))throw new Error(`Convolution effects cannot be merged (${n.name})`);Cs("e"+t++,n,e)}let n=e.shaderParts.get(Zr.FRAGMENT_HEAD),i=e.shaderParts.get(Zr.FRAGMENT_MAIN_IMAGE),r=e.shaderParts.get(Zr.FRAGMENT_MAIN_UV);const s=/\bblend\b/g;for(const t of e.blendModes.values())n+=t.getShaderCode().replace(s,`blend${t.blendFunction}`)+"\n";0!=(e.attributes&Xr.DEPTH)?(e.readDepth&&(i="float depth = readDepth(UV);\n\n\t"+i),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,e.colorSpace===T&&(i+="color0 = sRGBToLinear(color0);\n\t"),e.uvTransformation?(r="vec2 transformedUv = vUv;\n"+r,e.defines.set("UV","transformedUv")):e.defines.set("UV","vUv"),e.shaderParts.set(Zr.FRAGMENT_HEAD,n),e.shaderParts.set(Zr.FRAGMENT_MAIN_IMAGE,i),e.shaderParts.set(Zr.FRAGMENT_MAIN_UV,r),e.shaderParts.forEach(((e,t,n)=>n.set(t,null==e?void 0:e.trim().replace(/^#/,"\n#")))),this.skipRendering=0===t,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(e)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t;for(const n of this.effects)n.setDepthTexture(e,t)}render(e,t,n,i,r){for(const n of this.effects)n.update(e,t,i);if(!this.skipRendering||this.renderToScreen){const r=this.fullscreenMaterial;r.inputBuffer=t.texture,r.time+=i*this.timeScale,e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}}setSize(e,t){this.fullscreenMaterial.setSize(e,t);for(const n of this.effects)n.setSize(e,t)}initialize(e,t,n){this.renderer=e;for(const i of this.effects)i.initialize(e,t,n);this.updateMaterial(),void 0!==n&&n!==D&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const e of this.effects)e.removeEventListener("change",this.listener),e.dispose()}handleEvent(e){if("change"===e.type)this.recompile()}},Bs=class extends ps{constructor(){let{kernelSize:e=Kr.MEDIUM,resolutionScale:t=.5,width:n=bs.AUTO_SIZE,height:i=bs.AUTO_SIZE,resolutionX:r=n,resolutionY:s=i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("KawaseBlurPass"),this.renderTargetA=new I(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const o=this.resolution=new bs(this,r,s,t);o.addEventListener("change",(e=>this.setSize(o.baseWidth,o.baseHeight))),this._blurMaterial=new es,this._blurMaterial.kernelSize=e,this.copyMaterial=new ts}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(e){this._blurMaterial=e}get dithering(){return this.copyMaterial.dithering}set dithering(e){this.copyMaterial.dithering=e}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(e){this.blurMaterial.kernelSize=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB,c=this.blurMaterial,h=c.kernelSequence;let u=t;this.fullscreenMaterial=c;for(let t=0,n=h.length;t<n;++t){const n=0==(1&t)?a:l;c.kernel=h[t],c.inputBuffer=u.texture,e.setRenderTarget(n),e.render(s,o),u=n}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=u.texture,e.setRenderTarget(this.renderToScreen?null:n),e.render(s,o)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.renderTargetA.setSize(i,r),this.renderTargetB.setSize(i,r),this.blurMaterial.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTargetA.texture.type=n,this.renderTargetB.texture.type=n,n!==D?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):e.outputEncoding===T&&(this.renderTargetA.texture.encoding=T,this.renderTargetB.texture.encoding=T))}static get AUTO_SIZE(){return bs.AUTO_SIZE}},Ms=class extends ps{constructor(){let{renderTarget:e,luminanceRange:t,colorOutput:n,resolutionScale:i=1,width:r=bs.AUTO_SIZE,height:s=bs.AUTO_SIZE,resolutionX:o=r,resolutionY:a=s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("LuminancePass"),this.fullscreenMaterial=new as(n,t),this.needsSwap=!1,this.renderTarget=e,void 0===this.renderTarget&&(this.renderTarget=new I(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const l=this.resolution=new bs(this,o,a,i);l.addEventListener("change",(e=>this.setSize(l.baseWidth,l.baseHeight)))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}initialize(e,t,n){void 0!==n&&n!==D&&(this.renderTarget.texture.type=n,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},Os=class extends ps{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new ys(!1,!1,!0),this.inverse=!1}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,n,i,r){const s=e.getContext(),o=e.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,h=this.inverted?0:1,u=1-h;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.stencil.setFunc(s.ALWAYS,h,4294967295),o.stencil.setClear(u),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(e,null):(c.render(e,t),c.render(e,n))),this.renderToScreen?(e.setRenderTarget(null),e.render(a,l)):(e.setRenderTarget(t),e.render(a,l),e.setRenderTarget(n),e.render(a,l)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(s.EQUAL,1,4294967295),o.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.stencil.setLocked(!0)}},Ps=class extends ps{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new I(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new rs,this.upsamplingMaterial=new us,this.resolution=new b}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(e){if(this.levels!==e){const t=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let n=0;n<e;++n){const e=t.clone();e.texture.name="Downsampling.Mipmap"+n,this.downsamplingMipmaps.push(e)}this.upsamplingMipmaps.push(t);for(let n=1,i=e-1;n<i;++n){const e=t.clone();e.texture.name="Upsampling.Mipmap"+n,this.upsamplingMipmaps.push(e)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(e){this.upsamplingMaterial.radius=e}render(e,t,n,i,r){const{scene:s,camera:o}=this,{downsamplingMaterial:a,upsamplingMaterial:l}=this,{downsamplingMipmaps:c,upsamplingMipmaps:h}=this;let u=t;this.fullscreenMaterial=a;for(let t=0,n=c.length;t<n;++t){const n=c[t];a.setSize(u.width,u.height),a.inputBuffer=u.texture,e.setRenderTarget(n),e.render(s,o),u=n}this.fullscreenMaterial=l;for(let t=h.length-1;t>=0;--t){const n=h[t];l.setSize(u.width,u.height),l.inputBuffer=u.texture,l.supportBuffer=c[t].texture,e.setRenderTarget(n),e.render(s,o),u=n}}setSize(e,t){const n=this.resolution;n.set(e,t);let i=n.width,r=n.height;for(let e=0,t=this.downsamplingMipmaps.length;e<t;++e)i=Math.round(.5*i),r=Math.round(.5*r),this.downsamplingMipmaps[e].setSize(i,r),e<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[e].setSize(i,r)}initialize(e,t,n){if(void 0!==n){const t=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(const e of t)e.texture.type=n;if(n!==D)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(e.outputEncoding===T)for(const e of t)e.texture.encoding=T}}dispose(){super.dispose();for(const e of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))e.dispose()}},Rs=class extends ps{constructor(e,t){let{renderTarget:n,resolutionScale:i=1,width:r=bs.AUTO_SIZE,height:s=bs.AUTO_SIZE,resolutionX:o=r,resolutionY:l=s}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super("NormalPass"),this.needsSwap=!1,this.renderPass=new Ss(e,t,new C);const c=this.renderPass;c.ignoreBackground=!0,c.skipShadowMapUpdate=!0;const h=c.getClearPass();h.overrideClearColor=new a(7829503),h.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new I(1,1,{minFilter:B,magFilter:B}),this.renderTarget.texture.name="NormalPass.Target");const u=this.resolution=new bs(this,o,l,i);u.addEventListener("change",(e=>this.setSize(u.baseWidth,u.baseHeight)))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){const s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,s,s)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},_s=class extends ps{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"inputBuffer";super("ShaderPass"),this.fullscreenMaterial=e,this.input=t}setInput(e){this.input=e}render(e,t,n,i,r){const s=this.fullscreenMaterial.uniforms;null!==t&&void 0!==s&&void 0!==s[this.input]&&(s[this.input].value=t.texture),e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}initialize(e,t,n){void 0!==n&&n!==D&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},Ls=.001,Ns=class{constructor(){this.shaderParts=new Map([[Zr.FRAGMENT_HEAD,null],[Zr.FRAGMENT_MAIN_UV,null],[Zr.FRAGMENT_MAIN_IMAGE,null],[Zr.VERTEX_HEAD,null],[Zr.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=Xr.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=_}},ks=class extends Set{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;super(),this.l=t,this.exclusive=!1,void 0!==e&&this.set(e)}get layer(){return this.l}set layer(e){const t=this.l;for(const n of this)n.layers.disable(t),n.layers.enable(e);this.l=e}getLayer(){return this.layer}setLayer(e){this.layer=e}isExclusive(){return this.exclusive}setExclusive(e){this.exclusive=e}clear(){const e=this.layer;for(const t of this)t.layers.disable(e);return super.clear()}set(e){this.clear();for(const t of e)this.add(t);return this}indexOf(e){return this.has(e)?0:-1}add(e){return this.exclusive?e.layers.set(this.layer):e.layers.enable(this.layer),super.add(e)}delete(e){return this.has(e)&&e.layers.disable(this.layer),super.delete(e)}toggle(e){let t;return this.has(e)?(this.delete(e),t=!1):(this.add(e),t=!0),t}setVisible(e){for(const t of this)e?t.layers.enable(0):t.layers.disable(0);return this}},Us=new Map([[Qr.ADD,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}"],[Qr.ALPHA,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}"],[Qr.AVERAGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}"],[Qr.COLOR,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Qr.COLOR_BURN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}"],[Qr.COLOR_DODGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}"],[Qr.DARKEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}"],[Qr.DIFFERENCE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}"],[Qr.DIVIDE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}"],[Qr.DST,null],[Qr.EXCLUSION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}"],[Qr.HARD_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}"],[Qr.HARD_MIX,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}"],[Qr.HUE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Qr.INVERT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}"],[Qr.INVERT_RGB,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}"],[Qr.LIGHTEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}"],[Qr.LINEAR_BURN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}"],[Qr.LINEAR_DODGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}"],[Qr.LINEAR_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}"],[Qr.LUMINOSITY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Qr.MULTIPLY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}"],[Qr.NEGATION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}"],[Qr.NORMAL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}"],[Qr.OVERLAY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}"],[Qr.PIN_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}"],[Qr.REFLECT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}"],[Qr.SATURATION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}"],[Qr.SCREEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}"],[Qr.SOFT_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}"],[Qr.SRC,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}"],[Qr.SUBTRACT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}"],[Qr.VIVID_LIGHT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}"]]),js=class extends G{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;super(),this._blendFunction=e,this.opacity=new L(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this._blendFunction}set blendFunction(e){this._blendFunction=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return Us.get(this.blendFunction)}},Fs=class extends G{constructor(e,t){let{attributes:n=Xr.NONE,blendFunction:i=Qr.NORMAL,defines:r=new Map,uniforms:s=new Map,extensions:o=null,vertexShader:a=null}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(),this.name=e,this.renderer=null,this.attributes=n,this.fragmentShader=t,this.vertexShader=a,this.defines=r,this.uniforms=s,this.extensions=o,this.blendMode=new js(i),this.blendMode.addEventListener("change",(e=>this.setChanged())),this._inputColorSpace=_,this._outputColorSpace=null}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(e){this._inputColorSpace=e,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e,this.setChanged()}set mainScene(e){}set mainCamera(e){}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e){}update(e,t,n){}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof I||t instanceof ee||t instanceof l||t instanceof ps)&&this[e].dispose()}}},zs=class extends Fs{constructor(){let{blendFunction:e=Qr.SCREEN,luminanceThreshold:t=.9,luminanceSmoothing:n=.025,mipmapBlur:i=!1,intensity:r=1,radius:s=.85,levels:o=8,kernelSize:a=Kr.LARGE,resolutionScale:l=.5,width:c=bs.AUTO_SIZE,height:h=bs.AUTO_SIZE,resolutionX:u=c,resolutionY:d=h}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("BloomEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D map;\n#else\nuniform lowp sampler2D map;\n#endif\nuniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=texture2D(map,uv)*intensity;}",{blendFunction:e,uniforms:new Map([["map",new L(null)],["intensity",new L(r)]])}),this.renderTarget=new I(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new Bs({kernelSize:a}),this.luminancePass=new Ms({colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothing=n,this.mipmapBlurPass=new Ps,this.mipmapBlurPass.enabled=i,this.mipmapBlurPass.radius=s,this.mipmapBlurPass.levels=o,this.uniforms.get("map").value=i?this.mipmapBlurPass.texture:this.renderTarget.texture;const f=this.resolution=new bs(this,u,d,l);f.addEventListener("change",(e=>this.setSize(f.baseWidth,f.baseHeight)))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(e){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getIntensity(){return this.intensity}setIntensity(e){this.intensity=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,n){const i=this.renderTarget,r=this.luminancePass;r.enabled?(r.render(e,t),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,r.renderTarget):this.blurPass.render(e,r.renderTarget,i)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,t):this.blurPass.render(e,t,i)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.blurPass.resolution.copy(n),this.luminancePass.setSize(e,t),this.mipmapBlurPass.setSize(e,t)}initialize(e,t,n){this.blurPass.initialize(e,t,n),this.luminancePass.initialize(e,t,n),this.mipmapBlurPass.initialize(e,t,n),void 0!==n&&(this.renderTarget.texture.type=n,e.outputEncoding===T&&(this.renderTarget.texture.encoding=T))}};var Hs=class extends K{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:te,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:D;super(function(e,t,n){const i=new Map([[te,1],[ne,1],[ie,2],[o,4]]);let r;if(i.has(t)||console.error("Invalid noise texture format"),n===D){r=new Uint8Array(e*i.get(t));for(let e=0,t=r.length;e<t;++e)r[e]=255*Math.random()+.5}else{r=new Float32Array(e*i.get(t));for(let e=0,t=r.length;e<t;++e)r[e]=Math.random()}return r}(e*t,n,i),e,t,n,i),this.needsUpdate=!0}};new t,new m,new a;var Gs=class extends Fs{constructor(e,t){let{blendFunction:n=Qr.SCREEN,patternTexture:i=null,patternScale:r=1,edgeStrength:s=1,pulseSpeed:o=0,visibleEdgeColor:l=16777215,hiddenEdgeColor:c=2230538,kernelSize:h=Kr.VERY_SMALL,blur:u=!1,xRay:d=!0,multisampling:f=0,resolutionScale:p=.5,width:g=bs.AUTO_SIZE,height:m=bs.AUTO_SIZE,resolutionX:v=g,resolutionY:y=m}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super("OutlineEffect","uniform lowp sampler2D edgeTexture;uniform lowp sampler2D maskTexture;uniform vec3 visibleEdgeColor;uniform vec3 hiddenEdgeColor;uniform float pulse;uniform float edgeStrength;\n#ifdef USE_PATTERN\nuniform lowp sampler2D patternTexture;varying vec2 vUvPattern;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 edge=texture2D(edgeTexture,uv).rg;vec2 mask=texture2D(maskTexture,uv).rg;\n#ifndef X_RAY\nedge.y=0.0;\n#endif\nedge*=(edgeStrength*mask.x*pulse);vec3 color=edge.x*visibleEdgeColor+edge.y*hiddenEdgeColor;float visibilityFactor=0.0;\n#ifdef USE_PATTERN\nvec4 patternColor=texelToLinear(texture2D(patternTexture,vUvPattern));\n#ifdef X_RAY\nfloat hiddenFactor=0.5;\n#else\nfloat hiddenFactor=0.0;\n#endif\nvisibilityFactor=(1.0-mask.y>0.0)?1.0:hiddenFactor;visibilityFactor*=(1.0-mask.x)*patternColor.a;color+=visibilityFactor*patternColor.rgb;\n#endif\nfloat alpha=max(max(edge.x,edge.y),visibilityFactor);\n#ifdef ALPHA\noutputColor=vec4(color,alpha);\n#else\noutputColor=vec4(color,max(alpha,inputColor.a));\n#endif\n}",{uniforms:new Map([["maskTexture",new L(null)],["edgeTexture",new L(null)],["edgeStrength",new L(s)],["visibleEdgeColor",new L(new a(l))],["hiddenEdgeColor",new L(new a(c))],["pulse",new L(1)],["patternScale",new L(r)],["patternTexture",new L(null)]])}),this.blendMode.addEventListener("change",(e=>{this.blendMode.getBlendFunction()===Qr.ALPHA?this.defines.set("ALPHA","1"):this.defines.delete("ALPHA"),this.setChanged()})),this.blendMode.setBlendFunction(n),this.patternTexture=i,this.xRay=d,this.scene=e,this.camera=t,this.renderTargetMask=new I(1,1),this.renderTargetMask.samples=f,this.renderTargetMask.texture.name="Outline.Mask",this.uniforms.get("maskTexture").value=this.renderTargetMask.texture,this.renderTargetOutline=new I(1,1,{depthBuffer:!1}),this.renderTargetOutline.texture.name="Outline.Edges",this.uniforms.get("edgeTexture").value=this.renderTargetOutline.texture,this.clearPass=new ys,this.clearPass.overrideClearColor=new a(0),this.clearPass.overrideClearAlpha=1,this.depthPass=new Es(e,t),this.maskPass=new Ss(e,t,new ns(this.depthPass.texture,t));const w=this.maskPass.clearPass;w.overrideClearColor=new a(16777215),w.overrideClearAlpha=1,this.blurPass=new Bs({resolutionScale:p,resolutionX:v,resolutionY:y,kernelSize:h}),this.blurPass.enabled=u;const b=this.blurPass.resolution;b.addEventListener("change",(e=>this.setSize(b.baseWidth,b.baseHeight))),this.outlinePass=new _s(new ls);this.outlinePass.fullscreenMaterial.inputBuffer=this.renderTargetMask.texture,this.time=0,this.active=!1,this.selection=new ks,this.selection.layer=10,this.pulseSpeed=o}set mainScene(e){this.scene=e,this.depthPass.mainScene=e,this.maskPass.mainScene=e}set mainCamera(e){this.camera=e,this.depthPass.mainCamera=e,this.maskPass.mainCamera=e,this.maskPass.overrideMaterial.copyCameraSettings(e)}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.getResolution()}get multisampling(){return this.renderTargetMask.samples}set multisampling(e){this.renderTargetMask.samples=e,this.renderTargetMask.dispose()}get patternScale(){return this.uniforms.get("patternScale").value}set patternScale(e){this.uniforms.get("patternScale").value=e}get edgeStrength(){return this.uniforms.get("edgeStrength").value}set edgeStrength(e){this.uniforms.get("edgeStrength").value=e}get visibleEdgeColor(){return this.uniforms.get("visibleEdgeColor").value}set visibleEdgeColor(e){this.uniforms.get("visibleEdgeColor").value=e}get hiddenEdgeColor(){return this.uniforms.get("hiddenEdgeColor").value}set hiddenEdgeColor(e){this.uniforms.get("hiddenEdgeColor").value=e}getBlurPass(){return this.blurPass}getSelection(){return this.selection}getPulseSpeed(){return this.pulseSpeed}setPulseSpeed(e){this.pulseSpeed=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get selectionLayer(){return this.selection.layer}set selectionLayer(e){this.selection.layer=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get blur(){return this.blurPass.enabled}set blur(e){this.blurPass.enabled=e}get xRay(){return this.defines.has("X_RAY")}set xRay(e){this.xRay!==e&&(e?this.defines.set("X_RAY","1"):this.defines.delete("X_RAY"),this.setChanged())}isXRayEnabled(){return this.xRay}setXRayEnabled(e){this.xRay=e}get patternTexture(){return this.uniforms.get("patternTexture").value}set patternTexture(e){if(null!==e?(e.wrapS=e.wrapT=N,this.defines.set("USE_PATTERN","1"),this.setVertexShader("uniform float patternScale;varying vec2 vUvPattern;void mainSupport(const in vec2 uv){vUvPattern=uv*vec2(aspect,1.0)*patternScale;}")):(this.defines.delete("USE_PATTERN"),this.setVertexShader(null)),null!==this.renderer){const t=Gr(e,this.renderer.capabilities.isWebGL2);this.defines.set("texelToLinear(texel)",t)}this.uniforms.get("patternTexture").value=e,this.setChanged()}setPatternTexture(e){this.patternTexture=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}setSelection(e){return this.selection.set(e),this}clearSelection(){return this.selection.clear(),this}selectObject(e){return this.selection.add(e),this}deselectObject(e){return this.selection.delete(e),this}update(e,t,n){const i=this.scene,r=this.camera,s=this.selection,o=this.uniforms.get("pulse"),a=i.background,l=r.layers.mask;s.size>0?(i.background=null,o.value=1,this.pulseSpeed>0&&(o.value=.375*Math.cos(this.time*this.pulseSpeed*10)+.625),this.active=!0,this.time+=n,s.setVisible(!1),this.depthPass.render(e),s.setVisible(!0),r.layers.set(s.layer),this.maskPass.render(e,this.renderTargetMask),r.layers.mask=l,i.background=a,this.outlinePass.render(e,null,this.renderTargetOutline),this.blurPass.enabled&&this.blurPass.render(e,this.renderTargetOutline,this.renderTargetOutline)):this.active&&(this.clearPass.render(e,this.renderTargetOutline),this.active=!1)}setSize(e,t){this.blurPass.setSize(e,t),this.renderTargetMask.setSize(e,t);const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.depthPass.setSize(i,r),this.renderTargetOutline.setSize(i,r),this.outlinePass.fullscreenMaterial.setSize(i,r)}initialize(e,t,n){const i=Gr(this.patternTexture,e.capabilities.isWebGL2);this.defines.set("texelToLinear(texel)",i),this.blurPass.initialize(e,t,D),void 0!==n&&(this.depthPass.initialize(e,t,n),this.maskPass.initialize(e,t,n),this.outlinePass.initialize(e,t,n))}};new t,new t;var Vs="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",Ys="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAYAAAABNmBHAAAgAElEQVR4Xuy9CbhlV1ktOvbpq09DkiIkUBI6kxASIH0DlAQiIK1wRfSJTx+i4JX7vKIigs8HXpXvqVcvrcC9agQ7IDTSSWgqCQQliDRBJKkkhDSkqVPNqVOnP+8b//rH3P+eZ+199tlznVTlvVrft7+1T7OaueZY42/m37QALKNk2wHg1pITlB17mC+Pp11W3X/LHyT32vhg48/5SOv+PnwpsHA70JoGlueB1iKApeqzvOzn44GatTB76Xzhd7suBR7+WWADgDEAwwCG/L54b/poDLrHuvvm70Z2Avhsc+PVcxscBU8F8C8ADg5+ipIjD/PlGwfgju8B924E5seARUfLsiNmqQW0IjL8+7L2NYD/7COBzfcCm+aB8SVgdAkYIRCXKyDax4EdAanL5PuNPllNvXDlAHwFgP8AcC2AhRIoDXbsYb48dl5WkVFTE3LGDcC9m4CZCWBuFFgeAZaGAYJQQCRqDHT+McJrVb8zwATUXH02MHYfMHEIGFsAxgjApQqACYQORjtd/B7Axt/z79sC0+cMPgjjlwPwVwHcA+DfAHzTx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cEQHGbcYAEwtSXSqY0gnCdgeuMI0cvuGx/FUGgFhwEYrR80QckWN+X0fjm1DwAWv8RgJFilJZBznz0pQg+AZAAlVWh1GvGka0XzB0cCQi30aSGVa9AF62fLOB7MhrfnJoPwPER59Px+o3e76mL5Kwp2G57xPl0kxc3er+nLvyKtLmhfUC78RHn081ONnq/pzcAR5xPR9mRRu/31IVgvgUccT4dNaobvd/TGYAjzqejumqj93s6A3DE+XRUg2VSCjdaGr3fUw+I+VPwiPPpqJjO8J1Nw43e7ymHwHoAKMFd7QErAeEE5NNJMb3R+z3lsGcNzgfgiPPpomJ6o/d76oGwPgCOKJ8uKqY3er+nKwBHmE+noqRG7/fUA199U/AI8+kEwEbv93QHoEhZTnA+nYqSGr3fBoAtaiqBUImdm5hPJwA2er+nKwBHnE+X1gUzSbnR+z11wPj/AeCpPDD3t7rvAAAAAElFTkSuQmCC",Qs=class extends Fs{constructor(){let e,t,{blendFunction:n=Qr.SRC,preset:i=Jr.MEDIUM,edgeDetectionMode:r=Wr.COLOR,predicationMode:s=qr.DISABLED}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super("SMAAEffect","uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",{vertexShader:"varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",blendFunction:n,attributes:Xr.CONVOLUTION|Xr.DEPTH,uniforms:new Map([["weightMap",new L(null)]])}),arguments.length>1&&(e=arguments[0],t=arguments[1],arguments.length>2&&(i=arguments[2]),arguments.length>3&&(r=arguments[3])),this.renderTargetEdges=new I(1,1,{depthBuffer:!1}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new ys(!0,!1,!1),this.clearPass.overrideClearColor=new a(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new _s(new ss),this.edgeDetectionMaterial.edgeDetectionMode=r,this.edgeDetectionMaterial.predicationMode=s,this.weightsPass=new _s(new cs);const o=new k;o.onLoad=()=>{const n=new l(e);n.name="SMAA.Search",n.magFilter=B,n.minFilter=B,n.generateMipmaps=!1,n.needsUpdate=!0,n.flipY=!0,this.weightsMaterial.searchTexture=n;const i=new l(t);i.name="SMAA.Area",i.magFilter=U,i.minFilter=U,i.generateMipmaps=!1,i.needsUpdate=!0,i.flipY=!1,this.weightsMaterial.areaTexture=i,this.dispatchEvent({type:"load"})},o.itemStart("search"),o.itemStart("area"),void 0!==e&&void 0!==t?(o.itemEnd("search"),o.itemEnd("area")):"undefined"!=typeof Image&&(e=new Image,t=new Image,e.addEventListener("load",(()=>o.itemEnd("search"))),t.addEventListener("load",(()=>o.itemEnd("area"))),e.src=Vs,t.src=Ys),this.applyPreset(i)}get edgesTexture(){return this.renderTargetEdges.texture}getEdgesTexture(){return this.edgesTexture}get weightsTexture(){return this.renderTargetWeights.texture}getWeightsTexture(){return this.weightsTexture}get edgeDetectionMaterial(){return this.edgeDetectionPass.fullscreenMaterial}get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(e){this.edgeDetectionMaterial.edgeDetectionThreshold=e}setOrthogonalSearchSteps(e){this.weightsMaterial.orthogonalSearchSteps=e}applyPreset(e){const t=this.edgeDetectionMaterial,n=this.weightsMaterial;switch(e){case Jr.LOW:t.edgeDetectionThreshold=.15,n.orthogonalSearchSteps=4,n.diagonalDetection=!1,n.cornerDetection=!1;break;case Jr.MEDIUM:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=8,n.diagonalDetection=!1,n.cornerDetection=!1;break;case Jr.HIGH:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=16,n.diagonalSearchSteps=8,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0;break;case Jr.ULTRA:t.edgeDetectionThreshold=.05,n.orthogonalSearchSteps=32,n.diagonalSearchSteps=16,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0}}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.edgeDetectionMaterial.depthBuffer=e,this.edgeDetectionMaterial.depthPacking=t}update(e,t,n){this.clearPass.render(e,this.renderTargetEdges),this.edgeDetectionPass.render(e,t,this.renderTargetEdges),this.weightsPass.render(e,this.renderTargetEdges,this.renderTargetWeights)}setSize(e,t){this.edgeDetectionMaterial.setSize(e,t),this.weightsMaterial.setSize(e,t),this.renderTargetEdges.setSize(e,t),this.renderTargetWeights.setSize(e,t)}dispose(){const{searchTexture:e,areaTexture:t}=this.weightsMaterial;null!==e&&null!==t&&(e.dispose(),t.dispose()),super.dispose()}static get searchImageDataURL(){return Vs}static get areaImageDataURL(){return Ys}},Ws=class extends Fs{constructor(e,t){let{blendFunction:n=Qr.MULTIPLY,samples:i=9,rings:r=7,normalDepthBuffer:s=null,depthAwareUpsampling:a=!0,worldDistanceThreshold:l,worldDistanceFalloff:c,worldProximityThreshold:h,worldProximityFalloff:u,distanceThreshold:d=.97,distanceFalloff:f=.03,rangeThreshold:p=5e-4,rangeFalloff:g=.001,minRadiusScale:m=.1,luminanceInfluence:v=.7,radius:y=.1825,intensity:w=1,bias:b=.025,fade:A=.01,color:x=null,resolutionScale:S=1,width:E=bs.AUTO_SIZE,height:T=bs.AUTO_SIZE,resolutionX:D=E,resolutionY:C=T}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super("SSAOEffect","uniform lowp sampler2D aoBuffer;uniform float luminanceInfluence;uniform float intensity;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH)\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D normalDepthBuffer;\n#else\nuniform mediump sampler2D normalDepthBuffer;\n#endif\n#endif\n#ifdef COLORIZE\nuniform vec3 color;\n#endif\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){float aoLinear=texture2D(aoBuffer,uv).r;\n#if defined(DEPTH_AWARE_UPSAMPLING) && defined(NORMAL_DEPTH) && __VERSION__ == 300\nvec4 normalDepth[4];normalDepth[0]=textureOffset(normalDepthBuffer,uv,ivec2(0,0));normalDepth[1]=textureOffset(normalDepthBuffer,uv,ivec2(0,1));normalDepth[2]=textureOffset(normalDepthBuffer,uv,ivec2(1,0));normalDepth[3]=textureOffset(normalDepthBuffer,uv,ivec2(1,1));float dot01=dot(normalDepth[0].rgb,normalDepth[1].rgb);float dot02=dot(normalDepth[0].rgb,normalDepth[2].rgb);float dot03=dot(normalDepth[0].rgb,normalDepth[3].rgb);float minDot=min(dot01,min(dot02,dot03));float s=step(THRESHOLD,minDot);float smallestDistance=1.0;int index;for(int i=0;i<4;++i){float distance=abs(depth-normalDepth[i].a);if(distance<smallestDistance){smallestDistance=distance;index=i;}}ivec2 offsets[4];offsets[0]=ivec2(0,0);offsets[1]=ivec2(0,1);offsets[2]=ivec2(1,0);offsets[3]=ivec2(1,1);ivec2 coord=ivec2(uv*vec2(textureSize(aoBuffer,0)))+offsets[index];float aoNearest=texelFetch(aoBuffer,coord,0).r;float ao=mix(aoNearest,aoLinear,s);\n#else\nfloat ao=aoLinear;\n#endif\nfloat l=luminance(inputColor.rgb);ao=mix(ao,0.0,l*luminanceInfluence);ao=clamp(ao*intensity,0.0,1.0);\n#ifdef COLORIZE\noutputColor=vec4(1.0-ao*(1.0-color),inputColor.a);\n#else\noutputColor=vec4(vec3(1.0-ao),inputColor.a);\n#endif\n}",{blendFunction:n,attributes:Xr.DEPTH,defines:new Map([["THRESHOLD","0.997"]]),uniforms:new Map([["aoBuffer",new L(null)],["normalDepthBuffer",new L(s)],["luminanceInfluence",new L(v)],["color",new L(null)],["intensity",new L(w)],["scale",new L(0)]])}),this.renderTarget=new I(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="AO.Target",this.uniforms.get("aoBuffer").value=this.renderTarget.texture;const B=this.resolution=new bs(this,D,C,S);B.addEventListener("change",(e=>this.setSize(B.baseWidth,B.baseHeight))),this.camera=e,this.depthDownsamplingPass=new Ts({normalBuffer:t,resolutionScale:S}),this.depthDownsamplingPass.enabled=null===s,this.ssaoPass=new _s(new hs(e));const M=new Hs(64,64,o);M.wrapS=M.wrapT=N;const O=this.ssaoMaterial;O.normalBuffer=t,O.noiseTexture=M,O.minRadiusScale=m,O.samples=i,O.radius=y,O.rings=r,O.fade=A,O.bias=b,O.distanceThreshold=d,O.distanceFalloff=f,O.proximityThreshold=p,O.proximityFalloff=g,void 0!==l&&(O.worldDistanceThreshold=l),void 0!==c&&(O.worldDistanceFalloff=c),void 0!==h&&(O.worldProximityThreshold=h),void 0!==u&&(O.worldProximityFalloff=u),null!==s&&(this.ssaoMaterial.normalDepthBuffer=s,this.defines.set("NORMAL_DEPTH","1")),this.depthAwareUpsampling=a,this.color=x}set mainCamera(e){this.camera=e,this.ssaoMaterial.copyCameraSettings(e)}getResolution(){return this.resolution}get ssaoMaterial(){return this.ssaoPass.fullscreenMaterial}getSSAOMaterial(){return this.ssaoMaterial}get samples(){return this.ssaoMaterial.samples}set samples(e){this.ssaoMaterial.samples=e}get rings(){return this.ssaoMaterial.rings}set rings(e){this.ssaoMaterial.rings=e}get radius(){return this.ssaoMaterial.radius}set radius(e){this.ssaoMaterial.radius=e}get depthAwareUpsampling(){return this.defines.has("DEPTH_AWARE_UPSAMPLING")}set depthAwareUpsampling(e){this.depthAwareUpsampling!==e&&(e?this.defines.set("DEPTH_AWARE_UPSAMPLING","1"):this.defines.delete("DEPTH_AWARE_UPSAMPLING"),this.setChanged())}isDepthAwareUpsamplingEnabled(){return this.depthAwareUpsampling}setDepthAwareUpsamplingEnabled(e){this.depthAwareUpsampling=e}get distanceScaling(){return!0}set distanceScaling(e){}get color(){return this.uniforms.get("color").value}set color(e){const t=this.uniforms,n=this.defines;null!==e?n.has("COLORIZE")?t.get("color").value.set(e):(n.set("COLORIZE","1"),t.get("color").value=new a(e),this.setChanged()):n.has("COLORIZE")&&(n.delete("COLORIZE"),t.get("color").value=null,this.setChanged())}get luminanceInfluence(){return this.uniforms.get("luminanceInfluence").value}set luminanceInfluence(e){this.uniforms.get("luminanceInfluence").value=e}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getColor(){return this.color}setColor(e){this.color=e}setDistanceCutoff(e,t){this.ssaoMaterial.distanceThreshold=e,this.ssaoMaterial.distanceFalloff=t}setProximityCutoff(e,t){this.ssaoMaterial.proximityThreshold=e,this.ssaoMaterial.proximityFalloff=t}setDepthTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;this.depthDownsamplingPass.setDepthTexture(e,t),this.ssaoMaterial.depthBuffer=e,this.ssaoMaterial.depthPacking=t}update(e,t,n){const i=this.renderTarget;this.depthDownsamplingPass.enabled&&this.depthDownsamplingPass.render(e),this.ssaoPass.render(e,null,i)}setSize(e,t){const n=this.resolution;n.setBaseSize(e,t);const i=n.width,r=n.height;this.ssaoMaterial.copyCameraSettings(this.camera),this.ssaoMaterial.setSize(i,r),this.renderTarget.setSize(i,r),this.depthDownsamplingPass.resolution.scale=n.scale,this.depthDownsamplingPass.setSize(e,t)}initialize(e,t,n){try{let i=this.uniforms.get("normalDepthBuffer").value;null===i&&(this.depthDownsamplingPass.initialize(e,t,n),i=this.depthDownsamplingPass.texture,this.uniforms.get("normalDepthBuffer").value=i,this.ssaoMaterial.normalDepthBuffer=i,this.defines.set("NORMAL_DEPTH","1"))}catch(e){this.depthDownsamplingPass.enabled=!1}}};function Xs(){return Xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Xs.apply(this,arguments)}var Zs="#define GLSLIFY 1\nvec3 getViewPosition(const float depth){float clipW=_projectionMatrix[2][3]*depth+_projectionMatrix[3][3];vec4 clipPosition=vec4((vec3(vUv,depth)-0.5)*2.0,1.0);clipPosition*=clipW;return(_inverseProjectionMatrix*clipPosition).xyz;}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 screenSpaceToWorldSpace(const vec2 uv,const float depth){vec4 ndc=vec4((uv.x-0.5)*2.0,(uv.y-0.5)*2.0,(depth-0.5)*2.0,1.0);vec4 clip=_inverseProjectionMatrix*ndc;vec4 view=cameraMatrixWorld*(clip/clip.w);return view.xyz;}\n#define Scale (vec3(0.8, 0.8, 0.8))\n#define K (19.19)\nvec3 hash(vec3 a){a=fract(a*Scale);a+=dot(a,a.yxz+K);return fract((a.xxy+a.yxx)*a.zyx);}float fresnel_dielectric_cos(float cosi,float eta){float c=abs(cosi);float g=eta*eta-1.0+c*c;float result;if(g>0.0){g=sqrt(g);float A=(g-c)/(g+c);float B=(c*(g+c)-1.0)/(c*(g-c)+1.0);result=0.5*A*A*(1.0+B*B);}else{result=1.0;}return result;}float fresnel_dielectric(vec3 Incoming,vec3 Normal,float eta){float cosine=dot(Incoming,Normal);return min(1.0,5.0*fresnel_dielectric_cos(cosine,eta));}";class Ks extends j{constructor(){super({type:"MRTMaterial",defines:{USE_UV:"",TEMPORAL_RESOLVE:""},uniforms:{opacity:new L(1),normalMap:new L(null),normalScale:new L(new b(1,1)),uvTransform:new L(new ue),roughness:new L(1),roughnessMap:new L(null)},vertexShader:"\n #ifdef USE_MRT\n varying vec2 vHighPrecisionZW;\n #endif\n #define NORMAL\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n #endif\n #include <common>\n #include <uv_pars_vertex>\n #include <displacementmap_pars_vertex>\n #include <normal_pars_vertex>\n #include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n void main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n #endif\n #ifdef USE_MRT\n vHighPrecisionZW = gl_Position.zw;\n #endif \n #ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n }\n ",fragmentShader:"\n #define NORMAL\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n #endif\n #include <packing>\n #include <uv_pars_fragment>\n #include <normal_pars_fragment>\n #include <bumpmap_pars_fragment>\n #include <normalmap_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n #include <roughnessmap_pars_fragment>\n \n #ifdef USE_MRT\n layout(location = 0) out vec4 gNormal;\n layout(location = 1) out vec4 gDepth;\n \n varying vec2 vHighPrecisionZW;\n #endif\n uniform float roughness;\n void main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n\n float roughnessFactor = roughness;\n \n if(roughness > 10.0e9){\n roughnessFactor = 1.;\n }else{\n #ifdef useRoughnessMap\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n roughnessFactor *= texelRoughness.g;\n #endif\n }\n\n vec3 normalColor = packNormalToRGB( normal );\n #ifdef USE_MRT\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n vec4 depthColor = packDepthToRGBA( fragCoordZ );\n gNormal = vec4( normalColor, roughnessFactor );\n gDepth = depthColor;\n #else\n gl_FragColor = vec4(normalColor, roughnessFactor);\n #endif\n }\n ",toneMapped:!1}),this.normalMapType=de,this.normalScale=new b(1,1),Object.defineProperty(this,"glslVersion",{get(){return"USE_MRT"in this.defines?fe:null},set(e){}})}}class qs extends j{constructor(){super({type:"ReflectionsMaterial",uniforms:{inputTexture:new L(null),accumulatedTexture:new L(null),normalTexture:new L(null),depthTexture:new L(null),_projectionMatrix:new L(new m),_inverseProjectionMatrix:new L(new m),cameraMatrixWorld:new L(new m),cameraNear:new L(0),cameraFar:new L(0),rayDistance:new L(0),intensity:new L(0),roughnessFade:new L(0),fade:new L(0),thickness:new L(0),ior:new L(0),maxDepthDifference:new L(0),jitter:new L(0),jitterRoughness:new L(0),maxRoughness:new L(0),samples:new L(0),envMap:new L(null),envMapPosition:new L(new t),envMapSize:new L(new t),viewMatrix:new L(new m)},defines:{steps:20,refineSteps:5,CUBEUV_TEXEL_WIDTH:0,CUBEUV_TEXEL_HEIGHT:0,CUBEUV_MAX_MIP:0,vWorldPosition:"worldPos"},fragmentShader:"#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D inputTexture;uniform sampler2D accumulatedTexture;uniform sampler2D normalTexture;uniform sampler2D depthTexture;uniform sampler2D envMap;uniform mat4 _projectionMatrix;uniform mat4 _inverseProjectionMatrix;uniform mat4 cameraMatrixWorld;uniform float cameraNear;uniform float cameraFar;uniform float rayDistance;uniform float intensity;uniform float maxDepthDifference;uniform float roughnessFade;uniform float maxRoughness;uniform float fade;uniform float thickness;uniform float ior;uniform float samples;uniform float jitter;uniform float jitterRoughness;\n#define INVALID_RAY_COORDS vec2(-1.0);\n#define EARLY_OUT_COLOR vec4(0.0, 0.0, 0.0, 1.0)\n#define FLOAT_EPSILON 0.00001\nfloat nearMinusFar;float nearMulFar;float farMinusNear;\n#include <packing>\n#include <helperFunctions>\nvec2 RayMarch(vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference);vec2 BinarySearch(in vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference);float fastGetViewZ(const in float depth);vec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness);void main(){vec4 depthTexel=textureLod(depthTexture,vUv,0.0);if(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON){gl_FragColor=EARLY_OUT_COLOR;return;}float unpackedDepth=unpackRGBAToDepth(depthTexel);vec4 normalTexel=textureLod(normalTexture,vUv,0.0);float roughness=normalTexel.a;float specular=1.0-roughness;nearMinusFar=cameraNear-cameraFar;nearMulFar=cameraNear*cameraFar;farMinusNear=cameraFar-cameraNear;normalTexel.rgb=unpackRGBToNormal(normalTexel.rgb);float depth=fastGetViewZ(unpackedDepth);vec3 viewPos=getViewPosition(depth);vec3 viewDir=normalize(viewPos);vec3 viewNormal=normalTexel.xyz;vec3 worldPos=screenSpaceToWorldSpace(vUv,unpackedDepth);vec3 jitt=vec3(0.0);if(jitterRoughness!=0.0||jitter!=0.0){vec3 randomJitter=hash(50.0*samples*worldPos)-0.5;float spread=((2.0-specular)+roughness*jitterRoughness);float jitterMix=jitter*0.25+jitterRoughness*roughness;if(jitterMix>1.0)jitterMix=1.0;jitt=mix(vec3(0.0),randomJitter*spread,jitterMix);}viewNormal+=jitt;float fresnelFactor=fresnel_dielectric(viewDir,viewNormal,ior);vec3 iblRadiance=getIBLRadiance(-viewDir,viewNormal,0.)*fresnelFactor;float lastFrameAlpha=textureLod(accumulatedTexture,vUv,0.0).a;if(roughness>maxRoughness||(roughness>1.0-FLOAT_EPSILON&&roughnessFade>1.0-FLOAT_EPSILON)){gl_FragColor=vec4(iblRadiance,lastFrameAlpha);return;}vec3 reflected=reflect(viewDir,viewNormal);vec3 rayDir=reflected*-viewPos.z;vec3 hitPos=viewPos;float rayHitDepthDifference;vec2 coords=RayMarch(rayDir,hitPos,rayHitDepthDifference);if(coords.x==-1.0){gl_FragColor=vec4(iblRadiance,lastFrameAlpha);return;}vec4 SSRTexel=textureLod(inputTexture,coords.xy,0.0);vec4 SSRTexelReflected=textureLod(accumulatedTexture,coords.xy,0.0);vec3 SSR=SSRTexel.rgb+SSRTexelReflected.rgb;float roughnessFactor=mix(specular,1.0,max(0.0,1.0-roughnessFade));vec2 coordsNDC=(coords.xy*2.0-1.0);float screenFade=0.1;float maxDimension=min(1.0,max(abs(coordsNDC.x),abs(coordsNDC.y)));float reflectionIntensity=1.0-(max(0.0,maxDimension-screenFade)/(1.0-screenFade));reflectionIntensity=max(0.,reflectionIntensity);vec3 finalSSR=mix(iblRadiance,SSR,reflectionIntensity)*roughnessFactor;if(fade!=0.0){vec3 hitWorldPos=screenSpaceToWorldSpace(coords,rayHitDepthDifference);float reflectionDistance=distance(hitWorldPos,worldPos)+1.0;float opacity=1.0/(reflectionDistance*fade*0.1);if(opacity>1.0)opacity=1.0;finalSSR*=opacity;}finalSSR*=fresnelFactor*intensity;finalSSR=min(vec3(1.0),finalSSR);float alpha=hitPos.z==1.0 ? 1.0 : SSRTexelReflected.a;alpha=min(lastFrameAlpha,alpha);gl_FragColor=vec4(finalSSR,alpha);}vec2 RayMarch(vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference){dir=normalize(dir);dir*=rayDistance/float(steps);float depth;vec4 projectedCoord;vec4 lastProjectedCoord;float unpackedDepth;vec4 depthTexel;for(int i=0;i<steps;i++){hitPos+=dir;projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;\n#ifndef missedRays\nif(projectedCoord.x<0.0||projectedCoord.x>1.0||projectedCoord.y<0.0||projectedCoord.y>1.0){return INVALID_RAY_COORDS;}\n#endif\ndepthTexel=textureLod(depthTexture,projectedCoord.xy,0.0);unpackedDepth=unpackRGBAToDepth(depthTexel);depth=fastGetViewZ(unpackedDepth);rayHitDepthDifference=depth-hitPos.z;if(rayHitDepthDifference>=0.0&&rayHitDepthDifference<thickness){\n#if refineSteps == 0\nif(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON)return INVALID_RAY_COORDS;\n#else\nreturn BinarySearch(dir,hitPos,rayHitDepthDifference);\n#endif\n}\n#ifndef missedRays\nif(hitPos.z>0.0){return INVALID_RAY_COORDS;}\n#endif\nlastProjectedCoord=projectedCoord;}hitPos.z=1.0;\n#ifndef missedRays\nreturn INVALID_RAY_COORDS;\n#endif\nrayHitDepthDifference=unpackedDepth;return projectedCoord.xy;}vec2 BinarySearch(in vec3 dir,inout vec3 hitPos,inout float rayHitDepthDifference){float depth;vec4 projectedCoord;vec2 lastMinProjectedCoordXY;float unpackedDepth;vec4 depthTexel;for(int i=0;i<refineSteps;i++){projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;depthTexel=textureLod(depthTexture,projectedCoord.xy,0.0);unpackedDepth=unpackRGBAToDepth(depthTexel);depth=fastGetViewZ(unpackedDepth);rayHitDepthDifference=depth-hitPos.z;dir*=0.5;if(rayHitDepthDifference>0.0){hitPos-=dir;}else{hitPos+=dir;}}if(dot(depthTexel.rgb,depthTexel.rgb)<FLOAT_EPSILON)return INVALID_RAY_COORDS;if(abs(rayHitDepthDifference)>maxDepthDifference)return INVALID_RAY_COORDS;projectedCoord=_projectionMatrix*vec4(hitPos,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;rayHitDepthDifference=unpackedDepth;return projectedCoord.xy;}float fastGetViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn nearMulFar/(farMinusNear*depth-cameraFar);\n#else\nreturn depth*nearMinusFar-cameraNear;\n#endif\n}\n#include <common>\n#include <cube_uv_reflection_fragment>\nvec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness){\n#if defined(ENVMAP_TYPE_CUBE_UV)\nvec3 reflectVec=reflect(-viewDir,normal);reflectVec=normalize(mix(reflectVec,normal,roughness*roughness));reflectVec=inverseTransformDirection(reflectVec,viewMatrix);vec4 envMapColor=textureCubeUV(envMap,reflectVec,roughness);return envMapColor.rgb*intensity;\n#else\nreturn vec3(0.0);\n#endif\n}".replace("#include <helperFunctions>",Zs),vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",toneMapped:!1,depthWrite:!1,depthTest:!1})}}const Js=e=>{const t=[e],n=[];for(;0!==t.length;){const e=t.shift();e.material&&n.push(e);for(const n of e.children)n.visible&&t.push(n)}return n},$s=(e,t,n)=>{e.uniforms.envMap.value=t;const i=(e=>{const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}})({envMapCubeUVHeight:n});e.defines.ENVMAP_TYPE_CUBE_UV="",e.defines.CUBEUV_TEXEL_WIDTH=i.texelWidth,e.defines.CUBEUV_TEXEL_HEIGHT=i.texelHeight,e.defines.CUBEUV_MAX_MIP=i.maxMip+".0",e.needsUpdate=!0};class eo extends ps{constructor(e,t={}){super("ReflectionsPass"),this.ssrEffect=void 0,this.cachedMaterials=new WeakMap,this.USE_MRT=!1,this.webgl1DepthPass=null,this.visibleMeshes=[],this.ssrEffect=e,this._scene=e._scene,this._camera=e._camera,this.fullscreenMaterial=new qs,e._camera.isPerspectiveCamera&&(this.fullscreenMaterial.defines.PERSPECTIVE_CAMERA="");const n=t.width||"undefined"!=typeof window?window.innerWidth:2e3,i=t.height||"undefined"!=typeof window?window.innerHeight:1e3;this.renderTarget=new I(n,i,{minFilter:U,magFilter:U,type:le,depthBuffer:!1}),this.renderPass=new Ss(this._scene,this._camera),this.USE_MRT=(()=>{try{const e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}})(),this.USE_MRT?(this.gBuffersRenderTarget=new ce(n,i,2,{minFilter:U,magFilter:U}),this.normalTexture=this.gBuffersRenderTarget.texture[0],this.depthTexture=this.gBuffersRenderTarget.texture[1]):(this.webgl1DepthPass=new Es(this._scene,this._camera),this.webgl1DepthPass.renderTarget.minFilter=U,this.webgl1DepthPass.renderTarget.magFilter=U,this.webgl1DepthPass.renderTarget.texture.minFilter=U,this.webgl1DepthPass.renderTarget.texture.magFilter=U,this.webgl1DepthPass.setSize("undefined"!=typeof window?window.innerWidth:2e3,"undefined"!=typeof window?window.innerHeight:1e3),this.gBuffersRenderTarget=new I(n,i,{minFilter:U,magFilter:U}),this.normalTexture=this.gBuffersRenderTarget.texture,this.depthTexture=this.webgl1DepthPass.texture),this.fullscreenMaterial.uniforms.normalTexture.value=this.normalTexture,this.fullscreenMaterial.uniforms.depthTexture.value=this.depthTexture,this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.ssrEffect.temporalResolvePass.accumulatedTexture,this.fullscreenMaterial.uniforms.cameraMatrixWorld.value=this._camera.matrixWorld,this.fullscreenMaterial.uniforms._projectionMatrix.value=this._camera.projectionMatrix,this.fullscreenMaterial.uniforms._inverseProjectionMatrix.value=this._camera.projectionMatrixInverse}setSize(e,t){this.renderTarget.setSize(e*this.ssrEffect.resolutionScale,t*this.ssrEffect.resolutionScale),this.gBuffersRenderTarget.setSize(e*this.ssrEffect.resolutionScale,t*this.ssrEffect.resolutionScale),this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.ssrEffect.temporalResolvePass.accumulatedTexture,this.fullscreenMaterial.needsUpdate=!0}dispose(){this.renderTarget.dispose(),this.gBuffersRenderTarget.dispose(),this.renderPass.dispose(),this.USE_MRT||this.webgl1DepthPass.dispose(),this.fullscreenMaterial.dispose(),this.normalTexture=null,this.depthTexture=null,this.velocityTexture=null}keepMaterialMapUpdated(e,t,n,i){this.ssrEffect[i]?t[n]!==e[n]&&(e[n]=t[n],e.uniforms[n].value=t[n],t[n]?e.defines[i]="":delete e.defines[i],e.needsUpdate=!0):void 0!==e[n]&&(e[n]=void 0,e.uniforms[n].value=void 0,delete e.defines[i],e.needsUpdate=!0)}setMRTMaterialInScene(){this.visibleMeshes=Js(this._scene);for(const e of this.visibleMeshes)if(e.material){const t=e.material;let[n,i]=this.cachedMaterials.get(e)||[];if(t!==n){i&&i.dispose(),i=new Ks,this.USE_MRT&&(i.defines.USE_MRT=""),i.normalScale=t.normalScale,i.uniforms.normalScale.value=t.normalScale;const n=t.map||t.normalMap||t.roughnessMap||t.metalnessMap;n&&(i.uniforms.uvTransform.value=n.matrix),this.cachedMaterials.set(e,[t,i])}this.keepMaterialMapUpdated(i,t,"normalMap","useNormalMap"),this.keepMaterialMapUpdated(i,t,"roughnessMap","useRoughnessMap"),i.uniforms.roughness.value=0===this.ssrEffect.selection.size||this.ssrEffect.selection.has(e)?t.roughness||0:1e11,e.material=i}}unsetMRTMaterialInScene(){for(const t of this.visibleMeshes){var e;if("MRTMaterial"===(null==(e=t.material)?void 0:e.type)){t.visible=!0;const[e]=this.cachedMaterials.get(t);t.material=e}}}render(e,t){this.setMRTMaterialInScene(),e.setRenderTarget(this.gBuffersRenderTarget),this.renderPass.render(e,this.gBuffersRenderTarget),this.unsetMRTMaterialInScene(),this.USE_MRT||this.webgl1DepthPass.renderPass.render(e,this.webgl1DepthPass.renderTarget),this.fullscreenMaterial.uniforms.inputTexture.value=t.texture,this.fullscreenMaterial.uniforms.samples.value=this.ssrEffect.temporalResolvePass.samples,this.fullscreenMaterial.uniforms.cameraNear.value=this._camera.near,this.fullscreenMaterial.uniforms.cameraFar.value=this._camera.far,this.fullscreenMaterial.uniforms.viewMatrix.value.copy(this._camera.matrixWorldInverse),e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera)}}const to={intensity:1,exponent:1,distance:10,fade:0,roughnessFade:1,thickness:10,ior:1.45,maxRoughness:1,maxDepthDifference:10,blend:.9,correction:1,correctionRadius:1,blur:.5,blurKernel:1,blurSharpness:10,jitter:0,jitterRoughness:0,steps:20,refineSteps:5,missedRays:!0,useNormalMap:!0,useRoughnessMap:!0,resolutionScale:1,velocityResolutionScale:1};class no extends j{constructor(e){const t="#define GLSLIFY 1\nuniform sampler2D inputTexture;uniform sampler2D accumulatedTexture;uniform sampler2D velocityTexture;uniform sampler2D lastVelocityTexture;uniform float blend;uniform float correction;uniform float exponent;uniform float samples;uniform vec2 invTexSize;uniform mat4 curInverseProjectionMatrix;uniform mat4 curCameraMatrixWorld;uniform mat4 prevInverseProjectionMatrix;uniform mat4 prevCameraMatrixWorld;varying vec2 vUv;\n#define MAX_NEIGHBOR_DEPTH_DIFFERENCE 0.001\n#define FLOAT_EPSILON 0.00001\n#define FLOAT_ONE_MINUS_EPSILON 0.99999\nvec3 transformexponent;vec3 undoColorTransformExponent;vec3 transformColor(vec3 color){if(exponent==1.0)return color;return pow(abs(color),transformexponent);}vec3 undoColorTransform(vec3 color){if(exponent==1.0)return color;return max(pow(abs(color),undoColorTransformExponent),vec3(0.0));}void main(){if(exponent!=1.0){transformexponent=vec3(1.0/exponent);undoColorTransformExponent=vec3(exponent);}vec4 inputTexel=textureLod(inputTexture,vUv,0.0);vec4 accumulatedTexel;vec3 inputColor=transformColor(inputTexel.rgb);vec3 accumulatedColor;float alpha=inputTexel.a;float velocityDisocclusion;bool didReproject=false;\n#ifdef boxBlur\nvec3 boxBlurredColor=inputTexel.rgb;\n#endif\nvec4 velocity=textureLod(velocityTexture,vUv,0.0);bool isMoving=alpha<1.0||dot(velocity.xy,velocity.xy)>0.0;if(isMoving){vec3 minNeighborColor=inputColor;vec3 maxNeighborColor=inputColor;vec3 col;vec2 neighborUv;vec2 reprojectedUv=vUv-velocity.xy;vec4 lastVelocity=textureLod(lastVelocityTexture,reprojectedUv,0.0);float depth=velocity.b;float closestDepth=depth;float lastClosestDepth=lastVelocity.b;float neighborDepth;float lastNeighborDepth;for(int x=-correctionRadius;x<=correctionRadius;x++){for(int y=-correctionRadius;y<=correctionRadius;y++){if(x!=0||y!=0){neighborUv=vUv+vec2(x,y)*invTexSize;vec4 neigborVelocity=textureLod(velocityTexture,neighborUv,0.0);neighborDepth=neigborVelocity.b;col=textureLod(inputTexture,neighborUv,0.0).xyz;int absX=abs(x);int absY=abs(y);\n#ifdef dilation\nif(absX==1&&absY==1){if(neighborDepth>closestDepth){velocity=neigborVelocity;closestDepth=neighborDepth;}vec4 lastNeighborVelocity=textureLod(velocityTexture,vUv+vec2(x,y)*invTexSize,0.0);lastNeighborDepth=lastNeighborVelocity.b;if(neighborDepth>closestDepth){lastVelocity=lastNeighborVelocity;lastClosestDepth=lastNeighborDepth;}}\n#endif\nif(abs(depth-neighborDepth)<MAX_NEIGHBOR_DEPTH_DIFFERENCE){\n#ifdef boxBlur\nif(absX<=2&&absY<=2)boxBlurredColor+=col;\n#endif\ncol=transformColor(col);minNeighborColor=min(col,minNeighborColor);maxNeighborColor=max(col,maxNeighborColor);}}}}float velocityLength=length(lastVelocity.xy-velocity.xy);velocityDisocclusion=(velocityLength-0.000005)*10.0;velocityDisocclusion*=velocityDisocclusion;reprojectedUv=vUv-velocity.xy;\n#ifdef boxBlur\nfloat pxRadius=correctionRadius>5 ? 121.0 : pow(float(correctionRadius*2+1),2.0);boxBlurredColor/=pxRadius;boxBlurredColor=transformColor(boxBlurredColor);\n#endif\nif(reprojectedUv.x>=0.0&&reprojectedUv.x<=1.0&&reprojectedUv.y>=0.0&&reprojectedUv.y<=1.0){accumulatedTexel=textureLod(accumulatedTexture,reprojectedUv,0.0);accumulatedColor=transformColor(accumulatedTexel.rgb);vec3 clampedColor=clamp(accumulatedColor,minNeighborColor,maxNeighborColor);accumulatedColor=mix(accumulatedColor,clampedColor,correction);didReproject=true;}else{\n#ifdef boxBlur\naccumulatedColor=boxBlurredColor;\n#else\naccumulatedColor=inputColor;\n#endif\n}if(velocity.r>FLOAT_ONE_MINUS_EPSILON&&velocity.g>FLOAT_ONE_MINUS_EPSILON){alpha=0.0;velocityDisocclusion=1.0;}}else{accumulatedColor=transformColor(textureLod(accumulatedTexture,vUv,0.0).rgb);}vec3 outputColor=inputColor;\n#include <custom_compose_shader>\ngl_FragColor=vec4(undoColorTransform(outputColor),alpha);}".replace("#include <custom_compose_shader>",e);super({type:"TemporalResolveMaterial",uniforms:{inputTexture:new L(null),accumulatedTexture:new L(null),velocityTexture:new L(null),lastVelocityTexture:new L(null),samples:new L(1),blend:new L(.5),correction:new L(1),exponent:new L(1),invTexSize:new L(new b)},defines:{correctionRadius:1},vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",fragmentShader:t})}}const io=`\n\t\tvec3 transformed;\n\n\t\t// Get the normal\n\t\t${re.skinbase_vertex}\n\t\t${re.beginnormal_vertex}\n\t\t${re.skinnormal_vertex}\n\t\t${re.defaultnormal_vertex}\n\n\t\t// Get the current vertex position\n\t\ttransformed = vec3( position );\n\t\t${re.skinning_vertex}\n\t\tnewPosition = velocityMatrix * vec4( transformed, 1.0 );\n\n\t\t// Get the previous vertex position\n\t\ttransformed = vec3( position );\n\t\t${re.skinbase_vertex.replace(/mat4 /g,"").replace(/getBoneMatrix/g,"getPrevBoneMatrix")}\n\t\t${re.skinning_vertex.replace(/vec4 /g,"")}\n\t\tprevPosition = prevVelocityMatrix * vec4( transformed, 1.0 );\n\n\t\tgl_Position = newPosition;\n`;class ro extends j{constructor(){super({uniforms:{prevVelocityMatrix:{value:new m},velocityMatrix:{value:new m},prevBoneTexture:{value:null},interpolateGeometry:{value:0},intensity:{value:1},boneTexture:{value:null},alphaTest:{value:0},map:{value:null},alphaMap:{value:null},opacity:{value:1}},vertexShader:`\n #define MAX_BONES 1024\n \n ${re.skinning_pars_vertex}\n \n\t\t#ifdef USE_SKINNING\n\t\t#ifdef BONE_TEXTURE\n\t\t\tuniform sampler2D prevBoneTexture;\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tfloat j = i * 4.0;\n\t\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\t\ty = dy * ( y + 0.5 );\n\t\t\t\tvec4 v1 = texture2D( prevBoneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\t\tvec4 v2 = texture2D( prevBoneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\t\tvec4 v3 = texture2D( prevBoneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\t\tvec4 v4 = texture2D( prevBoneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#else\n\t\t\tuniform mat4 prevBoneMatrices[ MAX_BONES ];\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tmat4 bone = prevBoneMatrices[ int(i) ];\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#endif\n\t\t#endif\n\n \n uniform mat4 velocityMatrix;\n uniform mat4 prevVelocityMatrix;\n uniform float interpolateGeometry;\n varying vec4 prevPosition;\n varying vec4 newPosition;\n\t\t\t\t\tvarying vec2 vHighPrecisionZW;\n \n void main() {\n \n ${io}\n\n\t\t\t\t\t\tvHighPrecisionZW = gl_Position.zw;\n \n }`,fragmentShader:"\n uniform float intensity;\n varying vec4 prevPosition;\n varying vec4 newPosition;\n\t\t\t\t\tvarying vec2 vHighPrecisionZW;\n \n void main() {\n\t\t\t\t\t\t#ifdef FULL_MOVEMENT\n\t\t\t\t\t\tgl_FragColor = vec4( 1., 1., 1. - gl_FragCoord.z, 0. );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t\t#endif\n\n vec2 pos0 = (prevPosition.xy / prevPosition.w) * 0.5 + 0.5;\n vec2 pos1 = (newPosition.xy / newPosition.w) * 0.5 + 0.5;\n \n vec2 vel = pos1 - pos0;\n\n\t\t\t\t\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n \n gl_FragColor = vec4( vel, 1. - fragCoordZ, 0. );\n \n }"}),this.isVelocityMaterial=!0}}const so=new a(0),oo=["visible","wireframe","side"];class ao extends ps{constructor(e,n){var i,s;super("VelocityPass"),this.cachedMaterials=new WeakMap,this.lastCameraTransform={position:new t,quaternion:new r},this.visibleMeshes=[],this.renderedMeshesThisFrame=0,this.renderedMeshesLastFrame=0,this._scene=e,this._camera=n,this.renderTarget=new I((null==(i=window)?void 0:i.innerWidth)||1e3,(null==(s=window)?void 0:s.innerHeight)||1e3,{type:le})}setVelocityMaterialInScene(){this.renderedMeshesThisFrame=0,this.visibleMeshes=Js(this._scene);for(const n of this.visibleMeshes){var e;const i=n.material;let[r,s]=this.cachedMaterials.get(n)||[];var t;if(i!==r)s=new ro,s.lastMatrixWorld=new m,n.material=s,null!=(t=n.skeleton)&&t.boneTexture&&this.saveBoneTexture(n),this.cachedMaterials.set(n,[i,s]);if(s.uniforms.velocityMatrix.value.multiplyMatrices(this._camera.projectionMatrix,n.modelViewMatrix),n.userData.needsUpdatedReflections||i.map instanceof pe?("FULL_MOVEMENT"in s.defines||(s.needsUpdate=!0),s.defines.FULL_MOVEMENT=""):"FULL_MOVEMENT"in s.defines&&(delete s.defines.FULL_MOVEMENT,s.needsUpdate=!0),n.visible=this.cameraMovedThisFrame||!n.matrixWorld.equals(s.lastMatrixWorld)||n.skeleton||"FULL_MOVEMENT"in s.defines,n.material=s,n.visible){this.renderedMeshesThisFrame++;for(const e of oo)s[e]=i[e];null!=(e=n.skeleton)&&e.boneTexture&&(s.defines.USE_SKINNING="",s.defines.BONE_TEXTURE="",s.uniforms.boneTexture.value=n.skeleton.boneTexture)}}}saveBoneTexture(e){let t=e.material.uniforms.prevBoneTexture.value;if(t&&t.image.width===e.skeleton.boneTexture.width)t=e.material.uniforms.prevBoneTexture.value,t.image.data.set(e.skeleton.boneTexture.image.data);else{var n;null==(n=t)||n.dispose();const i=e.skeleton.boneTexture.image.data.slice(),r=e.skeleton.boneTexture.image.width;t=new K(i,r,r,o,X),e.material.uniforms.prevBoneTexture.value=t,t.needsUpdate=!0}}unsetVelocityMaterialInScene(){for(const t of this.visibleMeshes){var e;if(t.material.isVelocityMaterial)t.visible=!0,t.material.lastMatrixWorld.copy(t.matrixWorld),t.material.uniforms.prevVelocityMatrix.value.multiplyMatrices(this._camera.projectionMatrix,t.modelViewMatrix),null!=(e=t.skeleton)&&e.boneTexture&&this.saveBoneTexture(t),t.material=this.cachedMaterials.get(t)[0]}}setSize(e,t){this.renderTarget.setSize(e,t)}renderVelocity(e){if(e.setRenderTarget(this.renderTarget),this.renderedMeshesThisFrame>0){const{background:t}=this._scene;this._scene.background=so,e.render(this._scene,this._camera),this._scene.background=t}else e.clearColor()}checkCameraMoved(){const e=this.lastCameraTransform.position.distanceToSquared(this._camera.position),t=8*(1-this.lastCameraTransform.quaternion.dot(this._camera.quaternion));return(e>1e-6||t>1e-6)&&(this.lastCameraTransform.position.copy(this._camera.position),this.lastCameraTransform.quaternion.copy(this._camera.quaternion),!0)}render(e){this.cameraMovedThisFrame=this.checkCameraMoved(),this.setVelocityMaterialInScene(),(this.renderedMeshesThisFrame>0||this.renderedMeshesLastFrame>0)&&this.renderVelocity(e),this.unsetVelocityMaterialInScene(),this.renderedMeshesLastFrame=this.renderedMeshesThisFrame}}const lo=new b;class co extends ps{constructor(e,n,i,s={}){super("TemporalResolvePass"),this.velocityPass=null,this.velocityResolutionScale=1,this.samples=1,this.lastCameraTransform={position:new t,quaternion:new r},this._scene=e,this._camera=n,this.renderTarget=new I(1,1,{minFilter:U,magFilter:U,type:le,depthBuffer:!1}),this.velocityPass=new ao(e,n),this.fullscreenMaterial=new no(i),this.fullscreenMaterial.defines.correctionRadius=s.correctionRadius||1,s.dilation&&(this.fullscreenMaterial.defines.dilation=""),s.boxBlur&&(this.fullscreenMaterial.defines.boxBlur=""),this.setupFramebuffers(1,1),this.checkCanUseSharedVelocityTexture()}dispose(){this._scene.userData.velocityTexture===this.velocityPass.renderTarget.texture&&(delete this._scene.userData.velocityTexture,delete this._scene.userData.lastVelocityTexture),this.renderTarget.dispose(),this.accumulatedTexture.dispose(),this.fullscreenMaterial.dispose(),this.velocityPass.dispose()}setSize(e,t){this.renderTarget.setSize(e,t),this.velocityPass.setSize(e*this.velocityResolutionScale,t*this.velocityResolutionScale),this.velocityPass.renderTarget.texture.minFilter=1===this.velocityResolutionScale?B:U,this.velocityPass.renderTarget.texture.magFilter=1===this.velocityResolutionScale?B:U,this.velocityPass.renderTarget.texture.needsUpdate=!0,this.fullscreenMaterial.uniforms.invTexSize.value.set(1/e,1/t),this.setupFramebuffers(e,t)}setupFramebuffers(e,t){this.accumulatedTexture&&this.accumulatedTexture.dispose(),this.lastVelocityTexture&&this.lastVelocityTexture.dispose(),this.accumulatedTexture=new he(e,t,o),this.accumulatedTexture.minFilter=U,this.accumulatedTexture.magFilter=U,this.accumulatedTexture.type=le,this.lastVelocityTexture=new he(e*this.velocityResolutionScale,t*this.velocityResolutionScale,o),this.lastVelocityTexture.minFilter=1===this.velocityResolutionScale?B:U,this.lastVelocityTexture.magFilter=1===this.velocityResolutionScale?B:U,this.lastVelocityTexture.type=le,this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.accumulatedTexture,this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this.lastVelocityTexture,this.fullscreenMaterial.needsUpdate=!0}checkCanUseSharedVelocityTexture(){return this._scene.userData.velocityTexture&&this.velocityPass.renderTarget.texture!==this._scene.userData.velocityTexture?this.velocityPass.renderTarget.texture===this.fullscreenMaterial.uniforms.velocityTexture.value&&(this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this._scene.userData.lastVelocityTexture,this.fullscreenMaterial.uniforms.velocityTexture.value=this._scene.userData.velocityTexture,this.fullscreenMaterial.needsUpdate=!0):this.velocityPass.renderTarget.texture!==this.fullscreenMaterial.uniforms.velocityTexture.value&&(this.fullscreenMaterial.uniforms.velocityTexture.value=this.velocityPass.renderTarget.texture,this.fullscreenMaterial.uniforms.lastVelocityTexture.value=this.lastVelocityTexture,this.fullscreenMaterial.needsUpdate=!0,this._scene.userData.velocityTexture||(this._scene.userData.velocityTexture=this.velocityPass.renderTarget.texture,this._scene.userData.lastVelocityTexture=this.lastVelocityTexture)),this.velocityPass.renderTarget.texture!==this.fullscreenMaterial.uniforms.velocityTexture.value}checkNeedsResample(){const e=this.lastCameraTransform.position.distanceToSquared(this._camera.position),t=8*(1-this.lastCameraTransform.quaternion.dot(this._camera.quaternion));(e>1e-6||t>1e-6)&&(this.samples=1,this.lastCameraTransform.position.copy(this._camera.position),this.lastCameraTransform.quaternion.copy(this._camera.quaternion))}render(e){this.samples++,this.checkNeedsResample(),this.fullscreenMaterial.uniforms.samples.value=this.samples,e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera),e.copyFramebufferToTexture(lo,this.accumulatedTexture),e.setRenderTarget(this.velocityPass.renderTarget),e.copyFramebufferToTexture(lo,this.lastVelocityTexture)}}const ho=function(e,t){let n=1,i=0;for(;e>0;)n/=t,i+=n*(e%t),e=~~(e/t);return i};function uo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const fo="\n#if defined( USE_ENVMAP ) || defined( ) || defined ( USE_SHADOWMAP )\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n #ifdef BOX_PROJECTED_ENV_MAP\n vWorldPosition = worldPosition.xyz;\n #endif\n#endif\n",po="\n#ifdef BOX_PROJECTED_ENV_MAP\n uniform vec3 envMapSize;\n uniform vec3 envMapPosition;\n varying vec3 vWorldPosition;\n \n vec3 parallaxCorrectNormal( vec3 v, vec3 cubeSize, vec3 cubePos ) {\n vec3 nDir = normalize( v );\n\n vec3 rbmax = ( .5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n vec3 rbmin = ( -.5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n\n vec3 rbminmax;\n\n rbminmax.x = ( nDir.x > 0. ) ? rbmax.x : rbmin.x;\n rbminmax.y = ( nDir.y > 0. ) ? rbmax.y : rbmin.y;\n rbminmax.z = ( nDir.z > 0. ) ? rbmax.z : rbmin.z;\n\n float correction = min( min( rbminmax.x, rbminmax.y ), rbminmax.z );\n vec3 boxIntersection = vWorldPosition + nDir * correction;\n \n return boxIntersection - cubePos;\n }\n#endif\n",go="\n#ifdef BOX_PROJECTED_ENV_MAP\n worldNormal = parallaxCorrectNormal( worldNormal, envMapSize, envMapPosition );\n#endif\n",mo="\n#ifdef BOX_PROJECTED_ENV_MAP\n reflectVec = parallaxCorrectNormal( reflectVec, envMapSize, envMapPosition );\n#endif\n";const vo="#define GLSLIFY 1\n#define MODE_DEFAULT 0\n#define MODE_REFLECTIONS 1\n#define MODE_RAW_REFLECTION 2\n#define MODE_BLURRED_REFLECTIONS 3\n#define MODE_INPUT 4\n#define MODE_BLUR_MIX 5\n#define FLOAT_EPSILON 0.00001\nuniform sampler2D inputTexture;uniform sampler2D reflectionsTexture;uniform float samples;\n#include <boxBlur>\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 reflectionsTexel=texture2D(reflectionsTexture,vUv);ivec2 size=textureSize(reflectionsTexture,0);vec2 invTexSize=1./vec2(size.x,size.y);vec3 reflectionClr=reflectionsTexel.xyz;if(blur>FLOAT_EPSILON){vec3 blurredReflectionsColor=denoise(reflectionsTexel.rgb,reflectionsTexture,vUv,invTexSize,blur,blurSharpness,blurKernel);reflectionClr=mix(reflectionClr,blurredReflectionsColor.rgb,blur);}\n#if RENDER_MODE == MODE_DEFAULT\noutputColor=vec4(inputColor.rgb+reflectionClr,1.0);\n#endif\n#if RENDER_MODE == MODE_REFLECTIONS\noutputColor=vec4(reflectionClr,1.0);\n#endif\n#if RENDER_MODE == MODE_RAW_REFLECTION\noutputColor=vec4(reflectionsTexel.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_BLURRED_REFLECTIONS\noutputColor=vec4(blurredReflectionsTexel.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_INPUT\noutputColor=vec4(inputColor.xyz,1.0);\n#endif\n#if RENDER_MODE == MODE_BLUR_MIX\noutputColor=vec4(vec3(blur),1.0);\n#endif\n}".replace("#include <helperFunctions>",Zs).replace("#include <boxBlur>","#define GLSLIFY 1\nuniform float blur;uniform float blurSharpness;uniform int blurKernel;vec3 denoise(vec3 center,sampler2D tex,vec2 uv,vec2 invTexSize,float blur,float blurSharpness,int blurKernel){vec3 color;float total;vec3 col;float weight;for(int x=-blurKernel;x<=blurKernel;x++){for(int y=-blurKernel;y<=blurKernel;y++){col=textureLod(tex,uv+vec2(x,y)*invTexSize,0.).rgb;weight=1.0-abs(dot(col-center,vec3(0.25)));weight=pow(weight,blurSharpness);color+=col*weight;total+=weight;}}return color/total;}"),yo=["blur","blurSharpness","blurKernel"],wo=new se(1);let bo;class Ao extends Fs{constructor(e,t,n=to){super("SSREffect",vo,{type:"FinalSSRMaterial",uniforms:new Map([["reflectionsTexture",new L(null)],["blur",new L(0)],["blurSharpness",new L(0)],["blurKernel",new L(0)]]),defines:new Map([["RENDER_MODE","0"]])}),this.haltonSequence=(e=>{const t=[];let n=1;const i=n+e;for(;n<i;n++)t.push([ho(n,2)-.5,ho(n,3)-.5]);return t})(1024),this.haltonIndex=0,this.selection=new ks,this.lastSize=void 0,this.cubeCamera=new oe(.001,1e3,wo),this.usingBoxProjectedEnvMap=!1,this._scene=e,this._camera=t;n=Xs({},to,n,{boxBlur:!0,dilation:!0}),this.temporalResolvePass=new co(e,t,"#define GLSLIFY 1\n#define INV_EULER 0.36787944117144233\nalpha=velocityDisocclusion<FLOAT_EPSILON ?(alpha+0.0075): 0.0;alpha=clamp(alpha,0.0,1.0);bool needsBlur=!didReproject||velocityDisocclusion>0.5;\n#ifdef boxBlur\nif(needsBlur)inputColor=boxBlurredColor;\n#endif\nif(alpha==1.0){outputColor=accumulatedColor;}else{float m=mix(alpha,1.0,blend);if(needsBlur)m=0.0;outputColor=accumulatedColor*m+inputColor*(1.0-m);}",n),this.uniforms.get("reflectionsTexture").value=this.temporalResolvePass.renderTarget.texture,this.reflectionsPass=new eo(this,n),this.temporalResolvePass.fullscreenMaterial.uniforms.inputTexture.value=this.reflectionsPass.renderTarget.texture,this.lastSize={width:n.width,height:n.height,resolutionScale:n.resolutionScale,velocityResolutionScale:n.velocityResolutionScale},this.setSize(n.width,n.height),this.makeOptionsReactive(n)}makeOptionsReactive(e){let t=!1;const n=this.reflectionsPass.fullscreenMaterial.uniforms,i=Object.keys(n);for(const r of Object.keys(e))Object.defineProperty(this,r,{get:()=>e[r],set(s){if(e[r]!==s||!t)switch(e[r]=s,yo.includes(r)||this.setSize(this.lastSize.width,this.lastSize.height,!0),r){case"resolutionScale":this.setSize(this.lastSize.width,this.lastSize.height);break;case"velocityResolutionScale":this.temporalResolvePass.velocityResolutionScale=s,this.setSize(this.lastSize.width,this.lastSize.height,!0);break;case"blur":this.uniforms.get("blur").value=s;break;case"blurSharpness":this.uniforms.get("blurSharpness").value=s;break;case"blurKernel":this.uniforms.get("blurKernel").value=s;break;case"steps":this.reflectionsPass.fullscreenMaterial.defines.steps=parseInt(s),this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"refineSteps":this.reflectionsPass.fullscreenMaterial.defines.refineSteps=parseInt(s),this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"missedRays":s?this.reflectionsPass.fullscreenMaterial.defines.missedRays="":delete this.reflectionsPass.fullscreenMaterial.defines.missedRays,this.reflectionsPass.fullscreenMaterial.needsUpdate=t;break;case"correctionRadius":this.temporalResolvePass.fullscreenMaterial.defines.correctionRadius=Math.round(s),this.temporalResolvePass.fullscreenMaterial.needsUpdate=t;break;case"blend":this.temporalResolvePass.fullscreenMaterial.uniforms.blend.value=s;break;case"correction":this.temporalResolvePass.fullscreenMaterial.uniforms.correction.value=s;break;case"exponent":this.temporalResolvePass.fullscreenMaterial.uniforms.exponent.value=s;break;case"distance":n.rayDistance.value=s;default:i.includes(r)&&(n[r].value=s)}}}),this[r]=e[r];t=!0}setSize(e,t,n=!1){(n||e!==this.lastSize.width||t!==this.lastSize.height||this.resolutionScale!==this.lastSize.resolutionScale||this.velocityResolutionScale!==this.lastSize.velocityResolutionScale)&&(this.temporalResolvePass.setSize(e,t),this.reflectionsPass.setSize(e,t),this.lastSize={width:e,height:t,resolutionScale:this.resolutionScale,velocityResolutionScale:this.velocityResolutionScale})}generateBoxProjectedEnvMapFallback(e,n=new t,i=new t,r=512){this.cubeCamera.renderTarget.dispose(),this.cubeCamera.renderTarget=new se(r),this.cubeCamera.position.copy(n),this.cubeCamera.updateMatrixWorld(),this.cubeCamera.update(e,this._scene),bo||(bo=new ae(e),bo.compileCubemapShader());const s=bo.fromCubemap(this.cubeCamera.renderTarget.texture).texture;s.minFilter=U,s.magFilter=U;const o=this.reflectionsPass.fullscreenMaterial;return function(e,t,n){e.defines.BOX_PROJECTED_ENV_MAP="",e.uniforms.envMapPosition={value:t},e.uniforms.envMapSize={value:n};const i=new RegExp(uo("vec3 worldNormal = inverseTransformDirection ( normal , viewMatrix ) ;").replaceAll(" ","\\s*"),"g"),r=new RegExp(uo("reflectVec = inverseTransformDirection ( reflectVec , viewMatrix ) ;").replaceAll(" ","\\s*"),"g");e.vertexShader="varying vec3 vWorldPosition;\n"+e.vertexShader.replace("#include <worldpos_vertex>",fo),e.fragmentShader=po+"\n"+e.fragmentShader.replace("#include <envmap_physical_pars_fragment>",re.envmap_physical_pars_fragment).replace(i,`vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n ${go}`).replace(r,`reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n ${mo}`)}(o,n,i),o.fragmentShader=o.fragmentShader.replace("vec3 worldPos","worldPos").replace("varying vec3 vWorldPosition;","vec3 worldPos;"),o.uniforms.envMapPosition.value.copy(n),o.uniforms.envMapSize.value.copy(i),$s(o,s,r),this.usingBoxProjectedEnvMap=!0,s}setIBLRadiance(e,t){this._scene.traverse((n=>{if(n.material){var i;const r=null==(i=t.properties.get(n.material))?void 0:i.uniforms;r&&"disableIBLRadiance"in r&&(r.disableIBLRadiance.value=e)}}))}deleteBoxProjectedEnvMapFallback(){const e=this.reflectionsPass.fullscreenMaterial;e.uniforms.envMap.value=null,e.fragmentShader=e.fragmentShader.replace("worldPos = ","vec3 worldPos = "),delete e.defines.BOX_PROJECTED_ENV_MAP,e.needsUpdate=!0,this.usingBoxProjectedEnvMap=!1}dispose(){super.dispose(),this.reflectionsPass.dispose(),this.temporalResolvePass.dispose()}update(e,t){if(!this.usingBoxProjectedEnvMap&&this._scene.environment){const t=this.reflectionsPass.fullscreenMaterial;let n=null;if(this._scene.traverse((t=>{if(!n&&t.material&&!t.material.envMap){const i=e.properties.get(t.material);"envMap"in i&&i.envMap instanceof l&&(n=i.envMap)}})),n){const e=this._scene.environment.image.height;$s(t,n,e)}}this.haltonIndex=(this.haltonIndex+1)%this.haltonSequence.length;const[n,i]=this.haltonSequence[this.haltonIndex],{width:r,height:s}=this.lastSize;this.temporalResolvePass.velocityPass.render(e),this._camera.setViewOffset&&this._camera.setViewOffset(r,s,n,i,r,s),this.reflectionsPass.render(e,t),this.temporalResolvePass.render(e),this._camera.clearViewOffset()}static patchDirectEnvIntensity(e=0){re.envmap_physical_pars_fragment=0===e?re.envmap_physical_pars_fragment.replace("vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {","vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { return vec3(0.0);"):re.envmap_physical_pars_fragment.replace("vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );","vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ) * "+e.toFixed(5)+";")}}class xo{constructor(e,t,n){this.renderer=e,this.scene=t,this.camera=n,this.passesMap=new Map,this.effectsMap=new Map,this.effectsNeedsUpddate=!0,this.effectComposer=this._initEffectComposer(),this._initPasses(),this._initEffects()}updateEffectPass(){if(!this.effectsNeedsUpddate)return;this.effectsNeedsUpddate=!1;const{effectComposer:e}=this;e.passes.forEach((t=>{t instanceof Is&&(e.removePass(t),t.dispose())}));const t=Array.from(this.effectsMap).filter((e=>{let[,{enabled:t}]=e;return t})).map((e=>{let[,{effect:t}]=e;return t})),n=new Is(this.camera,...t);this.passesMap.set(xo.CONSTANTS.effectPass,n),e.addPass(n)}updateCamera(e){const{passesMap:t,effectsMap:n}=this,{CONSTANTS:i}=xo,r=t.get(i.renderPass),s=t.get(i.normalPass),o=t.get(i.effectPass);r.mainCamera=e,s.mainCamera=e,o.mainCamera=e;n.get(i.outlineEffect).effect.mainCamera=e}_initEffectComposer(){const e=new class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,{depthBuffer:t=!0,stencilBuffer:n=!1,multisampling:i=0,frameBufferType:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.renderer=null,this.inputBuffer=this.createBuffer(t,n,r,i),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new gs,this.depthTexture=null,this.passes=[],this.timer=new class{constructor(){this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(e){"undefined"!=typeof document&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=e)}get delta(){return this._delta*Ls}get fixedDelta(){return this._fixedDelta*Ls}set fixedDelta(e){this._fixedDelta=1e3*e}get elapsed(){return this._elapsed*Ls}update(e){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=void 0!==e?e:performance.now(),this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()}handleEvent(e){document.hidden||(this.currentTime=performance.now())}dispose(){this.autoReset=!1}},this.autoRenderToScreen=!0,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){const t=this.inputBuffer,n=this.multisampling;n>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):n!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){const t=e.getSize(new b),n=e.getContext().getContextAttributes().alpha,i=this.inputBuffer.texture.type;i===D&&e.outputEncoding===T&&(this.inputBuffer.texture.encoding=T,this.outputBuffer.texture.encoding=T,this.inputBuffer.dispose(),this.outputBuffer.dispose()),e.autoClear=!1,this.setSize(t.width,t.height);for(const t of this.passes)t.initialize(e,n,i)}}replaceRenderer(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=this.renderer,i=n.domElement.parentNode;return this.setRenderer(e),t&&null!==i&&(i.removeChild(n.domElement),i.appendChild(e.domElement)),n}createDepthTexture(){const e=this.depthTexture=new M;return this.inputBuffer.depthTexture=e,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(e.format=O,e.type=P):e.type=R,e}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const e of this.passes)e.setDepthTexture(null)}}createBuffer(e,t,n,i){const r=this.renderer,s=null===r?new b:r.getDrawingBufferSize(new b),o={minFilter:U,magFilter:U,stencilBuffer:t,depthBuffer:e,type:n};let a;return i>0?(a=new I(s.width,s.height,o),a.ignoreDepthForMultisampleCopy=!1,a.samples=i):a=new I(s.width,s.height,o),n===D&&null!==r&&r.outputEncoding===T&&(a.texture.encoding=T),a.texture.name="EffectComposer.Buffer",a.texture.generateMipmaps=!1,a}setMainScene(e){for(const t of this.passes)t.mainScene=e}setMainCamera(e){for(const t of this.passes)t.mainCamera=e}addPass(e,t){const n=this.passes,i=this.renderer,r=i.getDrawingBufferSize(new b),s=i.getContext().getContextAttributes().alpha,o=this.inputBuffer.texture.type;if(e.setRenderer(i),e.setSize(r.width,r.height),e.initialize(i,s,o),this.autoRenderToScreen&&(n.length>0&&(n[n.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?n.splice(t,0,e):n.push(e),this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){const t=this.createDepthTexture();for(e of n)e.setDepthTexture(t)}else e.setDepthTexture(this.depthTexture)}removePass(e){const t=this.passes,n=t.indexOf(e);if(-1!==n&&t.splice(n,1).length>0){if(null!==this.depthTexture){const n=(e,t)=>e||t.needsDepthTexture;t.reduce(n,!1)||(e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&n===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){const e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){const t=this.renderer,n=this.copyPass;let i,r,s,o=this.inputBuffer,a=this.outputBuffer,l=!1;void 0===e&&(this.timer.update(),e=this.timer.delta);for(const c of this.passes)c.enabled&&(c.render(t,o,a,e,l),c.needsSwap&&(l&&(n.renderToScreen=c.renderToScreen,i=t.getContext(),r=t.state.buffers.stencil,r.setFunc(i.NOTEQUAL,1,4294967295),n.render(t,o,a,e,l),r.setFunc(i.EQUAL,1,4294967295)),s=o,o=a,a=s),c instanceof Os?l=!0:c instanceof ms&&(l=!1))}setSize(e,t,n){const i=this.renderer,r=i.getSize(new b);void 0!==e&&void 0!==t||(e=r.width,t=r.height),r.width===e&&r.height===t||i.setSize(e,t,n);const s=i.getDrawingBufferSize(new b);this.inputBuffer.setSize(s.width,s.height),this.outputBuffer.setSize(s.width,s.height);for(const e of this.passes)e.setSize(s.width,s.height)}reset(){const e=this.timer.autoReset;this.dispose(),this.autoRenderToScreen=!0,this.timer.autoReset=e}dispose(){for(const e of this.passes)e.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}}(this.renderer,{multisampling:8,frameBufferType:le});return e}_initPasses(){const{effectComposer:e}=this,{CONSTANTS:t}=xo,n=this._initRenderPass(),i=this._initNormalPass(),r=this._initEffectPass();e.addPass(n),e.addPass(i),e.addPass(r),this.passesMap.set(t.renderPass,n),this.passesMap.set(t.normalPass,i),this.passesMap.set(t.effectPass,r)}_initRenderPass(){return new Ss(this.scene,this.camera)}_initNormalPass(){const e=new Rs(this.scene,this.camera,{resolutionScale:1});return e.enabled=!1,e}_initEffectPass(){return new Is(this.camera)}_initEffects(){const{CONSTANTS:e}=xo,t=this._initSMAAEffect(),n=this._initOutlineEffect(),i=this._initSSREffect(),r=this._initBloomEffect(),s=this._initSSAOEffect();this.effectsMap.set(e.smaaEffect,{enabled:!0,effect:t}),this.effectsMap.set(e.outlineEffect,{enabled:!1,effect:n}),this.effectsMap.set(e.ssrEffect,{enabled:!1,effect:i}),this.effectsMap.set(e.bloomEffect,{enabled:!1,effect:r}),this.effectsMap.set(e.ssaoEffect,{enabled:!1,effect:s})}_initSMAAEffect(){return new Qs({preset:Jr.HIGH,edgeDetectionMode:Wr.COLOR})}_initSSREffect(){return new Ao(this.scene,this.camera)}_initBloomEffect(){return new zs({blendFunction:Qr.ADD})}_initOutlineEffect(){return new Gs(this.scene,this.camera,{blendFunction:Qr.SCREEN})}_initSSAOEffect(){const{CONSTANTS:e}=xo,t=this.passesMap.get(e.normalPass);return new Ws(this.camera,t.texture,{blendFunction:Qr.MULTIPLY})}}xo.CONSTANTS={renderPass:"renderPass",normalPass:"normalPass",effectPass:"effectPass",smaaEffect:"smaaEffect",ssaoEffect:"ssaoEffect",outlineEffect:"outlineEffect",ssrEffect:"ssrEffect",bloomEffect:"bloomEffect"};const So=new class{constructor(){this.workerPool=new Pt(4)}generate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{workerPool:n}=this;return new Promise(((r,s)=>{if(e.attributes.position instanceof ge)throw new Error("GenerateMeshBVHWorker: GLBufferAttribute are not supported for the geometry attributes.");Ot(e);const o=e.index?e.index.array:null,a=e.attributes.position.array;n.postMessage({index:o,position:a,options:Object.assign(Object.assign({},t),{onProgress:null,includedProgressCallback:Boolean(t.onProgress),groups:[...e.groups]})}).then((n=>{const{data:o}=n;if(o)if(o.error)s(new Error(o.error));else if(o.serialized){const{serialized:n,position:s}=o,a=St.deserialize(n,e,{setIndex:!1}),l=Object.assign({setBoundingBox:!0},t);if(e.attributes.position instanceof me?e.attributes.position.data.array=s:e.attributes.position instanceof $&&(e.attributes.position.array=s),e.index)e.index.array=n.index;else{const t=new $(n.index,1,!1);e.setIndex(t)}l.setBoundingBox&&(e.boundingBox=a.getBoundingBox(new i)),r(a)}else t.onProgress&&t.onProgress(o.progress)}))}))}dispose(){this.workerPool.dispose()}};class Eo{constructor(e){this.viewport=e,this.cameraChanging=!1,this.timer=null,this.computedGeometriesUuid=new Map,this.generateMeshBVHWorker=So,this.viewport.signals.cameraChange.add((()=>{this.cameraChanging=!0,this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((()=>{this.cameraChanging=!1}),1e3)}))}computeModelsBoundsTree(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{type:n="slice",force:i=!1,frameSliceCount:r=500,workerCreator:s}=t,{meshOfModelList:o}=this.viewport.scener.intersectsList,a=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:async e=>e.geometry.computeBoundsTree();!i&&e.computedGeometriesUuid.has(t.geometry.uuid)||n(t).then((()=>{e.computedGeometriesUuid.set(t.geometry.uuid,t.geometry.uuid)}))};return new Promise(((e,t)=>{if("block"===n)o.forEach((e=>a(e))),e();else if("slice"===n){let t=0,n=0;const i=()=>{if(t=requestAnimationFrame(i),!this.cameraChanging){for(const e of o.slice(n,n+r))a(e),n+=1;n>=o.length&&(cancelAnimationFrame(t),e())}};i()}else if("worker"===n)if(s){this.generateMeshBVHWorker.workerPool.setWorkerCreator(s);const t=e=>this.generateMeshBVHWorker.generate(e.geometry).then((t=>t&&(e.geometry.boundsTree=t)));Promise.allSettled(o.map((e=>a(e,t)))).then((()=>e()))}else t("请设置 workerCreator")}))}dispose(){this.generateMeshBVHWorker.dispose()}}const To=navigator.userAgent.toLowerCase().includes("mac");var Do;!function(e){e[e.NONE=-1]="NONE",e[e.ROTATE=0]="ROTATE",e[e.ZOOM=1]="ZOOM",e[e.PAN=2]="PAN"}(Do||(Do={}));const Co=new t,Io=[new t,new t,new t],Bo=[new t,new t,new t];let Mo=new DOMRect;class Oo{constructor(e){this.viewport=e,this.camera=this.viewport.cameraManager.mainCamera,this.domElement=this.viewport.interactiveContainer,this.interactivePosition=null,this.fallbackInteractivePosition=null,this.enabled=!0,this.enabledMousePointInteractive=!0,this.enableZoom=!0,this.zoomSpeed=1,this.zoomMinDistance=1,this.zoomMaxDistance=1e5,this.zoomMinStepDistance=.1,this.zoomMaxStepDistance=2e4,this.enableRotate=!0,this.enableRotateX=!0,this.enableRotateY=!0,this.rotateSpeed=1,this.rotateTiltRange={max:Math.PI,min:0},this.enableAutoRotate=!1,this.autoRotateSpeed=1,this.autoRotateClockwise=!0,this.enableOutOfScene=!0,this.unOffsetOfScene=0,this.enablePan=!0,this.enablePanX=!0,this.enablePanY=!0,this.enablePanAxisX=!0,this.enablePanAxisY=!0,this.enablePanAxisZ=!0,this.panSpeed=2,this.state=Do.NONE,this.sceneBoxCenter=new t,this.dispose=()=>{},this.domElement=e.interactiveContainer,this.init()}init(){const e=e=>{e.preventDefault(),!1!==this.enabled&&(0===e.button?this.state=Do.ROTATE:1===e.button?this.state=Do.ZOOM:2===e.button&&(this.state=Do.PAN),Mo=this.domElement.getBoundingClientRect(),this.state!==Do.ROTATE&&this.state!==Do.PAN||(this.interactivePosition=this.getInteractivePosition(e),this.interactivePosition||(this.sceneBoxCenter=this.getSceneBbox().getCenter(new t)),this.domElement.addEventListener("mousemove",n,!1),window.addEventListener("mouseup",i,!0)))},n=e=>{if(e.preventDefault(),!1===this.enabled)return;const{movementX:n,movementY:i}=e;this.state===Do.ROTATE?this.rotate(new t(.00375*-n,.00375*-i,0)):this.state===Do.PAN&&this.pan(new t(-n,i,0))},i=e=>{e.preventDefault(),this.domElement.removeEventListener("mousemove",n,!1),window.removeEventListener("mouseup",i,!0),this.state=Do.NONE},r=e=>{if(e.preventDefault(),!this.enabled)return;let n=0;n=To&&e.shiftKey?120*-e.deltaX:120*-e.deltaY,this.zoom_on_point(new t(0,0,n),e)},s=e=>{if(e.preventDefault(),!1===this.enabled)return;Mo=this.domElement.getBoundingClientRect();const n=e.touches;switch(n.length){case 1:Io[0].set(n[0].clientX,n[0].clientY,0),Io[1].set(n[0].clientX,n[0].clientY,0);break;case 2:Io[0].set(n[0].clientX,n[0].clientY,0),Io[1].set(n[1].clientX,n[1].clientY,0);break;case 3:case 4:case 5:Io[0].set(n[0].clientX,n[0].clientY,0),Io[1].set(n[2].clientX,n[2].clientY,0)}const i=new t(Mo.x,Mo.y,0);Io[0].sub(i),Io[1].sub(i),Bo[0].copy(Io[0]),Bo[1].copy(Io[1]),this.interactivePosition=this.getInteractivePosition({offsetX:(Io[0].x+Io[1].x)/2,offsetY:(Io[0].y+Io[1].y)/2}),this.interactivePosition||(this.sceneBoxCenter=this.getSceneBbox().getCenter(new t)),this.domElement.addEventListener("touchmove",o,{passive:!1}),this.domElement.addEventListener("touchend",a,!1)},o=e=>{if(e.preventDefault(),!1===this.enabled)return;function n(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"y";const r=new b(e[1].x-e[0].x,e[1].y-e[0].y),s=new b(n[1].x-n[0].x,n[1].y-n[0].y),o=r.angle(),a=s.angle();r.normalize(),s.normalize();const l=n[0].y-e[0].y;return"y"===i?new t(0,.005*l,0):"x"===i?new t(o-a,0,0):new t}switch(e.touches.length){case 1:{Io[0].set(e.touches[0].clientX-Mo.x,e.touches[0].clientY-Mo.y,0),Io[1].set(e.touches[0].clientX-Mo.x,e.touches[0].clientY-Mo.y,0);const t=Io[0].clone().sub(((e,t)=>{let n=t[0];for(const i in t)n.distanceTo(e)>t[i].distanceTo(e)&&(n=t[i]);return n})(Io[0],Bo));t.x=-t.x;const n=t.multiplyScalar(.9);this.pan(n);break}case 2:{Io[0].set(e.touches[0].clientX-Mo.x,e.touches[0].clientY-Mo.y,0),Io[1].set(e.touches[1].clientX-Mo.x,e.touches[1].clientY-Mo.y,0);const i=Bo[0].distanceTo(Bo[1])-Io[0].distanceTo(Io[1]);this.zoom_touch(new t(0,0,i*this.zoomSpeed/25)),this.rotate(n(Io,Bo,"x"));break}case 3:case 4:case 5:Io[0].set(e.touches[0].clientX-Mo.x,e.touches[0].clientY-Mo.y,0),Io[1].set(e.touches[2].clientX-Mo.x,e.touches[2].clientY-Mo.y,0),this.rotate(n(Io,Bo,"y"))}Bo[0].copy(Io[0]),Bo[1].copy(Io[1])},a=e=>{e.preventDefault(),this.state=Do.NONE,this.domElement.removeEventListener("touchmove",o,!1),this.domElement.removeEventListener("touchend",a,!1)};this.domElement.addEventListener("mousedown",e,!1),this.domElement.addEventListener("wheel",r,{passive:!1}),this.domElement.addEventListener("touchstart",s,{passive:!1}),this.dispose=()=>{this.domElement.removeEventListener("mousedown",e),this.domElement.removeEventListener("wheel",r),this.domElement.removeEventListener("touchstart",s)}}getInteractivePosition(e){if(this.enabledMousePointInteractive){const t=this.viewport.getIntersects(e,void 0,{isFilterHideObject:!0});if(t.length){const[{point:e}]=t;return e.clone()}return this.fallbackInteractivePosition}return this.fallbackInteractivePosition}intersectsBox(e){const n=this.getSceneBbox(),i=new t;n.getSize(i);let r=Math.max(i.x,i.y,i.z);0!=this.unOffsetOfScene&&(r=this.unOffsetOfScene);const s=n.clone();s.min.addScalar(r/2),s.max.addScalar(-r/2);const o=(new y).copy(this.camera);o.position.add(e),o.updateMatrixWorld(),o.updateProjectionMatrix();return(new ve).setFromProjectionMatrix((new m).multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse)).intersectsBox(n)}caculateContainPoint(e,n){const i=(new t).copy(e).applyMatrix4(n.matrixWorldInverse).applyMatrix4(n.projectionMatrix);return!(Math.abs(i.x)>1||Math.abs(i.y)>1||Math.abs(i.z)>1)}panLeft(e){const n=new t,i=this.camera.matrix.elements;this.enablePanAxisX&&n.setX(i[0]),this.enablePanAxisY&&n.setY(i[1]),this.enablePanAxisZ&&n.setZ(i[2]),n.multiplyScalar(e);let r=!0;this.enableOutOfScene||(r=this.intersectsBox(n)),r&&this.camera.position.add(n)}panUp(e){const n=new t,i=this.camera.matrix.elements;this.enablePanAxisX&&n.setX(i[4]),this.enablePanAxisY&&n.setY(i[5]),this.enablePanAxisZ&&n.setZ(i[6]),n.multiplyScalar(e);let r=!0;this.enableOutOfScene||(r=this.intersectsBox(n)),r&&this.camera.position.add(n)}pan(e){var t;if(!this.enablePan)return;this.enablePanX||e.setX(0),this.enablePanY||e.setY(0);const n=null!==(t=this.interactivePosition)&&void 0!==t?t:this.sceneBoxCenter;let i=this.camera.position.clone().sub(n).length();i*=Math.tan(this.camera.fov/2*Math.PI/180),this.panLeft(this.panSpeed*e.x*i/Mo.height),this.panUp(this.panSpeed*e.y*i/Mo.height),this.viewport.signals.cameraChange.dispatch()}zoom_on_point(e,n){if(!this.enableZoom)return;this.interactivePosition=this.getInteractivePosition(n);let i=e.z>0?6:-6;const r=new t(0,0,0);let s;if(this.interactivePosition){s=this.interactivePosition.distanceTo(this.camera.position);const e=this.domElement.getBoundingClientRect();r.set(n.offsetX/e.width*2-1,-n.offsetY/e.height*2+1,.1)}else s=this.camera.position.length(),r.set(0,0,.1);let o=!1;s>this.zoomMaxDistance&&i<0?(o=!0,s=this.zoomMaxDistance,i*=2):s<this.zoomMinDistance&&i>0&&(o=!0,s=this.zoomMinDistance,i*=2),r.unproject(this.camera),r.sub(this.camera.position);let a=s/i*this.zoomSpeed;if(a>0?a>this.zoomMaxStepDistance?a=this.zoomMaxStepDistance:a<this.zoomMinStepDistance&&(a=this.zoomMinStepDistance):a<0&&(a<-this.zoomMaxStepDistance?a=-this.zoomMaxStepDistance:a>-this.zoomMinStepDistance&&(a=-this.zoomMinStepDistance)),o&&!n.shiftKey)return;const l=this.camera.position.clone().addVectors(this.camera.position,r.setLength(a));this.camera.position.copy(l),this.viewport.signals.cameraChange.dispatch()}zoom_touch(e){if(!this.enableZoom)return;let n=e.z;const i=new t(0,0,0);let r;if(this.interactivePosition){const e={offsetX:(Bo[0].x+Bo[1].x)/2,offsetY:(Bo[0].y+Bo[1].y)/2};r=this.interactivePosition.distanceTo(this.camera.position),i.set(e.offsetX/Mo.width*2-1,-e.offsetY/Mo.height*2+1,.1)}else r=this.camera.position.length(),i.set(0,0,.1);if(r>this.zoomMaxDistance&&n>0?(r=this.zoomMaxDistance,n=0):r<this.zoomMinDistance&&n<0&&(r=this.zoomMinDistance),0===n)return;i.unproject(this.camera),i.sub(this.camera.position);let s=r*-n*this.zoomSpeed*.1;s>0?s>this.zoomMaxStepDistance?s=this.zoomMaxStepDistance:s<this.zoomMinStepDistance&&(s=this.zoomMinStepDistance):s<0&&(s<-this.zoomMaxStepDistance?s=-this.zoomMaxStepDistance:s>-this.zoomMinStepDistance&&(s=-this.zoomMinStepDistance));const o=this.camera.position.clone().addVectors(this.camera.position,i.setLength(s));this.camera.position.copy(o),this.viewport.signals.cameraChange.dispatch()}rotate(e){var n;if(!this.enableRotate)return;e.x*=this.rotateSpeed,e.y*=this.rotateSpeed;const i=new t(0,0,-1);i.applyQuaternion(this.camera.quaternion);const r=i.angleTo(new t(0,1,0));(r-e.y>this.rotateTiltRange.max&&e.y<0||r-e.y<this.rotateTiltRange.min&&e.y>0)&&(e.y=0);const s=null!==(n=this.interactivePosition)&&void 0!==n?n:this.sceneBoxCenter;Co.copy(this.camera.position).sub(s);const o=new m,a=new t(1,0,0);this.enableRotateX&&o.makeRotationAxis(new t(0,1,0),e.x);const l=new m;this.enableRotateY&&(a.applyEuler(this.camera.rotation),l.makeRotationAxis(a,e.y),o.multiply(l)),Co.applyMatrix4(o),i.applyMatrix4(o),this.camera.position.copy(s).add(Co),this.camera.lookAt(i.add(this.camera.position)),this.viewport.signals.cameraChange.dispatch()}autoRotate(){const e=this.autoRotateClockwise?.01:-.01;this.rotate(new t(e*this.autoRotateSpeed,0,0))}update(){this.enableAutoRotate&&this.autoRotate()}getSceneBbox(){const e=this.viewport.scene,t=new i;return t.setFromObject(e),t}}const Po={type:"change"},Ro={type:"start"},_o={type:"end"};class Lo extends G{constructor(e,n){super(),this.object=e,this.domElement=n,this.enabled=!0,this.target=new t,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.enableAutoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:ye.ROTATE,MIDDLE:ye.DOLLY,RIGHT:ye.PAN},this.touches={ONE:we.ROTATE,TWO:we.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.userData.zoom,this._domElementKeyEvents=null,this.domElement.style.touchAction="none",this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(e){e.addEventListener("keydown",W),this._domElementKeyEvents=e},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.userData.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.userData.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(Po),i.update(),o=s.NONE},this.update=function(){const n=new t,f=(new r).setFromUnitVectors(e.up,new t(0,1,0)),p=f.clone().invert(),g=new t,m=new r,v=2*Math.PI;return function(){const e=i.object.position;n.copy(e).sub(i.target),n.applyQuaternion(f),l.setFromVector3(n),i.enableAutoRotate&&o===s.NONE&&C(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(l.theta+=c.theta*i.dampingFactor,l.phi+=c.phi*i.dampingFactor):(l.theta+=c.theta,l.phi+=c.phi);let t=i.minAzimuthAngle,r=i.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=v:t>Math.PI&&(t-=v),r<-Math.PI?r+=v:r>Math.PI&&(r-=v),l.theta=t<=r?Math.max(t,Math.min(r,l.theta)):l.theta>(t+r)/2?Math.max(t,l.theta):Math.min(r,l.theta)),l.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=h,l.radius=Math.max(i.minDistance,Math.min(i.maxDistance,l.radius)),!0===i.enableDamping?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),n.setFromSpherical(l),n.applyQuaternion(p),e.copy(i.target).add(n),i.object.lookAt(i.target),!0===i.enableDamping?(c.theta*=1-i.dampingFactor,c.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(c.set(0,0,0),u.set(0,0,0)),h=1,!!(d||g.distanceToSquared(i.object.position)>a||8*(1-m.dot(i.object.quaternion))>a)&&(i.dispatchEvent(Po),g.copy(i.object.position),m.copy(i.object.quaternion),d=!1,!0)}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",X),i.domElement.removeEventListener("pointerdown",H),i.domElement.removeEventListener("pointercancel",Y),i.domElement.removeEventListener("wheel",Q),i.domElement.removeEventListener("pointermove",G),window.removeEventListener("pointerup",V),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",W)};const i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=s.NONE;const a=1e-6,l=new be,c=new be;let h=1;const u=new t;let d=!1;const f=new b,p=new b,g=new b,m=new b,v=new b,w=new b,A=new b,x=new b,S=new b,E=[],T={};function D(){return Math.pow(.95,i.zoomSpeed)}function C(e){c.theta-=e}function I(e){c.phi-=e}const B=function(){const e=new t;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),u.add(e)}}(),M=function(){const e=new t;return function(t,n){!0===i.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(i.object.up,e)),e.multiplyScalar(t),u.add(e)}}(),O=function(){const e=new t;return function(t,n){const r=i.domElement;if(i.object instanceof y){const s=i.object.position;e.copy(s).sub(i.target);let o=e.length();o*=Math.tan(i.object.fov/2*Math.PI/180),B(2*t*o/r.clientHeight,i.object.matrix),M(2*n*o/r.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(B(t*(i.object.right-i.object.left)/i.object.userData.zoom/r.clientWidth,i.object.matrix),M(n*(i.object.top-i.object.bottom)/i.object.userData.zoom/r.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function P(e){i.object instanceof y?h/=e:i.object.isOrthographicCamera?(i.object.userData.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.userData.zoom*e)),i.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function R(e){i.object instanceof y?h*=e:i.object.isOrthographicCamera?(i.object.userData.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.userData.zoom/e)),i.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function _(e){f.set(e.clientX,e.clientY)}function L(e){m.set(e.clientX,e.clientY)}function N(){if(1===E.length)f.set(E[0].pageX,E[0].pageY);else{const e=.5*(E[0].pageX+E[1].pageX),t=.5*(E[0].pageY+E[1].pageY);f.set(e,t)}}function k(){if(1===E.length)m.set(E[0].pageX,E[0].pageY);else{const e=.5*(E[0].pageX+E[1].pageX),t=.5*(E[0].pageY+E[1].pageY);m.set(e,t)}}function U(){const e=E[0].pageX-E[1].pageX,t=E[0].pageY-E[1].pageY,n=Math.sqrt(e*e+t*t);A.set(0,n)}function j(e){if(1==E.length)p.set(e.pageX,e.pageY);else{const t=q(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);p.set(n,i)}g.subVectors(p,f).multiplyScalar(i.rotateSpeed);const t=i.domElement;C(2*Math.PI*g.x/t.clientHeight),I(2*Math.PI*g.y/t.clientHeight),f.copy(p)}function F(e){if(1===E.length)v.set(e.pageX,e.pageY);else{const t=q(e),n=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);v.set(n,i)}w.subVectors(v,m).multiplyScalar(i.panSpeed),O(w.x,w.y),m.copy(v)}function z(e){const t=q(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);x.set(0,s),S.set(0,Math.pow(x.y/A.y,i.zoomSpeed)),P(S.y),A.copy(x)}function H(e){!1!==i.enabled&&(0===E.length&&(i.domElement.addEventListener("pointermove",G),window.addEventListener("pointerup",V)),function(e){E.push(e)}(e),"touch"===e.pointerType?function(e){switch(K(e),E.length){case 1:switch(i.touches.ONE){case we.ROTATE:if(!1===i.enableRotate)return;N(),o=s.TOUCH_ROTATE;break;case we.PAN:if(!1===i.enablePan)return;k(),o=s.TOUCH_PAN;break;default:o=s.NONE}break;case 2:switch(i.touches.TWO){case we.DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&U(),i.enablePan&&k(),o=s.TOUCH_DOLLY_PAN;break;case we.DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&U(),i.enableRotate&&N(),o=s.TOUCH_DOLLY_ROTATE;break;default:o=s.NONE}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent(Ro)}(e):function(e){let t;switch(e.button){case 0:t=i.mouseButtons.LEFT;break;case 1:t=i.mouseButtons.MIDDLE;break;case 2:t=i.mouseButtons.RIGHT;break;default:t=-1}switch(t){case ye.DOLLY:if(!1===i.enableZoom)return;!function(e){A.set(e.clientX,e.clientY)}(e),o=s.DOLLY;break;case ye.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enablePan)return;L(e),o=s.PAN}else{if(!1===i.enableRotate)return;_(e),o=s.ROTATE}break;case ye.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enableRotate)return;_(e),o=s.ROTATE}else{if(!1===i.enablePan)return;L(e),o=s.PAN}break;default:o=s.NONE}o!==s.NONE&&i.dispatchEvent(Ro)}(e))}function G(e){e.preventDefault(),!1!==i.enabled&&("touch"===e.pointerType?function(e){switch(K(e),o){case s.TOUCH_ROTATE:if(!1===i.enableRotate)return;j(e),i.update();break;case s.TOUCH_PAN:if(!1===i.enablePan)return;F(e),i.update();break;case s.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(e){i.enableZoom&&z(e),i.enablePan&&F(e)}(e),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(e){i.enableZoom&&z(e),i.enableRotate&&j(e)}(e),i.update();break;default:o=s.NONE}}(e):function(e){switch(o){case s.ROTATE:if(!1===i.enableRotate)return;!function(e){p.set(e.clientX,e.clientY),g.subVectors(p,f).multiplyScalar(i.rotateSpeed);const t=i.domElement;C(2*Math.PI*g.x/t.clientHeight),I(2*Math.PI*g.y/t.clientHeight),f.copy(p),i.update()}(e);break;case s.DOLLY:if(!1===i.enableZoom)return;!function(e){x.set(e.clientX,e.clientY),S.subVectors(x,A),S.y>0?P(D()):S.y<0&&R(D()),A.copy(x),i.update()}(e);break;case s.PAN:if(!1===i.enablePan)return;!function(e){v.set(e.clientX,e.clientY),w.subVectors(v,m).multiplyScalar(i.panSpeed),O(w.x,w.y),m.copy(v),i.update()}(e)}}(e))}function V(e){Z(e),0===E.length&&(i.domElement.removeEventListener("pointermove",G),window.removeEventListener("pointerup",V)),i.dispatchEvent(_o),o=s.NONE}function Y(e){Z(e)}function Q(e){!1!==i.enabled&&!1!==i.enableZoom&&o===s.NONE&&(e.preventDefault(),i.dispatchEvent(Ro),function(e){e.deltaY<0?R(D()):e.deltaY>0&&P(D()),i.update()}(e),i.dispatchEvent(_o))}function W(e){!1!==i.enabled&&!1!==i.enablePan&&function(e){let t=!1;switch(e.code){case i.keys.UP:O(0,i.keyPanSpeed),t=!0;break;case i.keys.BOTTOM:O(0,-i.keyPanSpeed),t=!0;break;case i.keys.LEFT:O(i.keyPanSpeed,0),t=!0;break;case i.keys.RIGHT:O(-i.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),i.update())}(e)}function X(e){!1!==i.enabled&&e.preventDefault()}function Z(e){delete T[e.pointerId];for(let t=0;t<E.length;t++)if(E[t].pointerId==e.pointerId)return void E.splice(t,1)}function K(e){let t=T[e.pointerId];void 0===t&&(t=new b,T[e.pointerId]=t),t.set(e.pageX,e.pageY)}function q(e){const t=e.pointerId===E[0].pointerId?E[1]:E[0];return T[t.pointerId]}i.domElement.addEventListener("contextmenu",X),i.domElement.addEventListener("pointerdown",H),i.domElement.addEventListener("pointercancel",Y),i.domElement.addEventListener("wheel",Q,{passive:!1})}}class No{get options(){return this._options}set options(e){this._options=e,e.type||(this._options.type="free"),this._onChangeCallback()}constructor(e){this.viewport=e,this._options={type:"free"},this._disposeList=new Set,this.currentControls=new Oo(this.viewport)}handleFreeControls(){const e=ui(this.options,["type"]),{postRender:t}=this.viewport,n=this.currentControls=new Oo(this.viewport);Object.assign(n,e),t.set("FreeControlsUpdate",(()=>{n.update()})),this._disposeList.add((()=>{t.delete("FreeControlsUpdate")}))}handleOrbitControls(){const e=ui(Object.assign({},this.options),["type"]),{cameraManager:{mainCamera:t},interactiveContainer:n,postRender:i}=this.viewport,r=this.currentControls=new Lo(t,n);Object.assign(r,e),r.update();const s=()=>{this.viewport.signals.cameraChange.dispatch()};if(r.addEventListener("change",s),this._disposeList.add((()=>{r.removeEventListener("change",s)})),e.enableDamping||e.enableAutoRotate)i.set("OrbitControlsUpdate",(()=>{this.viewport.render((()=>{r.update()}))})),this._disposeList.add((()=>{i.delete("OrbitControlsUpdate")}));else{const e=e=>{e&&r.update()};this.viewport.signals.cameraChange.add(e),this._disposeList.add((()=>{this.viewport.signals.cameraChange.remove(e)}))}}_onChangeCallback(){switch(this.dispose(),this.options.type){case"free":default:this.handleFreeControls();break;case"orbit":this.handleOrbitControls()}this.viewport.triggerRender()}setOptions(e){this.options=e}dispose(){this.currentControls.dispose(),this._disposeList.forEach((e=>e())),this._disposeList.clear()}}var ko="0123456789abcdefghijklmnopqrstuvwxyz";function Uo(e){return ko.charAt(e)}function jo(e,t){return e&t}function Fo(e,t){return e|t}function zo(e,t){return e^t}function Ho(e,t){return e&~t}function Go(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Vo(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var Yo,Qo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wo="=";function Xo(e){var t,n,i="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),i+=Qo.charAt(n>>6)+Qo.charAt(63&n);for(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),i+=Qo.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),i+=Qo.charAt(n>>2)+Qo.charAt((3&n)<<4));(3&i.length)>0;)i+=Wo;return i}function Zo(e){var t,n="",i=0,r=0;for(t=0;t<e.length&&e.charAt(t)!=Wo;++t){var s=Qo.indexOf(e.charAt(t));s<0||(0==i?(n+=Uo(s>>2),r=3&s,i=1):1==i?(n+=Uo(r<<2|s>>4),r=15&s,i=2):2==i?(n+=Uo(r),n+=Uo(s>>2),r=3&s,i=3):(n+=Uo(r<<2|s>>4),n+=Uo(15&s),i=0))}return 1==i&&(n+=Uo(r<<2)),n}var Ko,qo=function(e){var t;if(void 0===Yo){var n="0123456789ABCDEF",i=" \f\n\r\t \u2028\u2029";for(Yo={},t=0;t<16;++t)Yo[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)Yo[n.charAt(t)]=t;for(t=0;t<i.length;++t)Yo[i.charAt(t)]=-1}var r=[],s=0,o=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=Yo[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);s|=a,++o>=2?(r[r.length]=s,s=0,o=0):s<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return r},Jo={decode:function(e){var t;if(void 0===Ko){var n="= \f\n\r\t \u2028\u2029";for(Ko=Object.create(null),t=0;t<64;++t)Ko["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(Ko["-"]=62,Ko._=63,t=0;t<n.length;++t)Ko[n.charAt(t)]=-1}var i=[],r=0,s=0;for(t=0;t<e.length;++t){var o=e.charAt(t);if("="==o)break;if(-1!=(o=Ko[o])){if(void 0===o)throw new Error("Illegal character at offset "+t);r|=o,++s>=4?(i[i.length]=r>>16,i[i.length]=r>>8&255,i[i.length]=255&r,r=0,s=0):r<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:i[i.length]=r>>10;break;case 3:i[i.length]=r>>16,i[i.length]=r>>8&255}return i},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=Jo.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return Jo.decode(e)}},$o=1e13,ea=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,i,r=this.buf,s=r.length;for(n=0;n<s;++n)(i=r[n]*e+t)<$o?t=0:i-=(t=0|i/$o)*$o,r[n]=i;t>0&&(r[n]=t)},e.prototype.sub=function(e){var t,n,i=this.buf,r=i.length;for(t=0;t<r;++t)(n=i[t]-e)<0?(n+=$o,e=1):e=0,i[t]=n;for(;0===i[i.length-1];)i.pop()},e.prototype.toString=function(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,n=t[t.length-1].toString(),i=t.length-2;i>=0;--i)n+=($o+t[i]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*$o+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),ta="…",na=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,ia=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function ra(e,t){return e.length>t&&(e=e.substring(0,t)+ta),e}var sa,oa=function(){function e(t,n){this.hexDigits="0123456789ABCDEF",t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)},e.prototype.hexDump=function(e,t,n){for(var i="",r=e;r<t;++r)if(i+=this.hexByte(this.get(r)),!0!==n)switch(15&r){case 7:i+=" ";break;case 15:i+="\n";break;default:i+=" "}return i},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var i=this.get(n);if(i<32||i>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n="",i=e;i<t;++i)n+=String.fromCharCode(this.get(i));return n},e.prototype.parseStringUTF=function(e,t){for(var n="",i=e;i<t;){var r=this.get(i++);n+=r<128?String.fromCharCode(r):r>191&&r<224?String.fromCharCode((31&r)<<6|63&this.get(i++)):String.fromCharCode((15&r)<<12|(63&this.get(i++))<<6|63&this.get(i++))}return n},e.prototype.parseStringBMP=function(e,t){for(var n,i,r="",s=e;s<t;)n=this.get(s++),i=this.get(s++),r+=String.fromCharCode(n<<8|i);return r},e.prototype.parseTime=function(e,t,n){var i=this.parseStringISO(e,t),r=(n?na:ia).exec(i);return r?(n&&(r[1]=+r[1],r[1]+=+r[1]<70?2e3:1900),i=r[1]+"-"+r[2]+"-"+r[3]+" "+r[4],r[5]&&(i+=":"+r[5],r[6]&&(i+=":"+r[6],r[7]&&(i+="."+r[7]))),r[8]&&(i+=" UTC","Z"!=r[8]&&(i+=r[8],r[9]&&(i+=":"+r[9]))),i):"Unrecognized time: "+i},e.prototype.parseInteger=function(e,t){for(var n,i=this.get(e),r=i>127,s=r?255:0,o="";i==s&&++e<t;)i=this.get(e);if(0===(n=t-e))return r?-1:0;if(n>4){for(o=i,n<<=3;0==(128&(+o^s));)o=+o<<1,--n;o="("+n+" bit)\n"}r&&(i-=256);for(var a=new ea(i),l=e+1;l<t;++l)a.mulAdd(256,this.get(l));return o+a.toString()},e.prototype.parseBitString=function(e,t,n){for(var i=this.get(e),r="("+((t-e-1<<3)-i)+" bit)\n",s="",o=e+1;o<t;++o){for(var a=this.get(o),l=o==t-1?i:0,c=7;c>=l;--c)s+=a>>c&1?"1":"0";if(s.length>n)return r+ra(s,n)}return r+s},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return ra(this.parseStringISO(e,t),n);var i=t-e,r="("+i+" byte)\n";i>(n/=2)&&(t=e+n);for(var s=e;s<t;++s)r+=this.hexByte(this.get(s));return i>n&&(r+=ta),r},e.prototype.parseOID=function(e,t,n){for(var i="",r=new ea,s=0,o=e;o<t;++o){var a=this.get(o);if(r.mulAdd(128,127&a),s+=7,!(128&a)){if(""===i)if((r=r.simplify())instanceof ea)r.sub(80),i="2."+r.toString();else{var l=r<80?r<40?0:1:2;i=l+"."+(r-40*l)}else i+="."+r.toString();if(i.length>n)return ra(i,n);r=new ea,s=0}}return s>0&&(i+=".incomplete"),i},e}(),aa=function(){function e(e,t,n,i,r){if(!(i instanceof la))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=n,this.tag=i,this.sub=r}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+n,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return ra(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return ra(this.stream.parseStringISO(t,t+n),e);case 30:return ra(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,23==this.tag.tagNumber)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},e.prototype.toPrettyString=function(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var n=0,i=this.sub.length;n<i;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=127&t;if(n==t)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===n)return null;t=0;for(var i=0;i<n;++i)t=256*t+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=2*this.header,n=2*this.length;return e.substr(t,n)},e.decode=function(t){var n;n=t instanceof oa?t:new oa(t,0);var i=new oa(n),r=new la(n),s=e.decodeLength(n),o=n.pos,a=o-i.pos,l=null,c=function(){var t=[];if(null!==s){for(var i=o+s;n.pos<i;)t[t.length]=e.decode(n);if(n.pos!=i)throw new Error("Content size is not correct for container starting at offset "+o)}else try{for(;;){var r=e.decode(n);if(r.tag.isEOC())break;t[t.length]=r}s=o-n.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return t};if(r.tagConstructed)l=c();else if(r.isUniversal()&&(3==r.tagNumber||4==r.tagNumber))try{if(3==r.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");l=c();for(var h=0;h<l.length;++h)if(l[h].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){l=null}if(null===l){if(null===s)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);n.pos=o+Math.abs(s)}return new e(i,a,s,r,l)},e}(),la=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=0!=(32&t),this.tagNumber=31&t,31==this.tagNumber){var n=new ea;do{t=e.get(),n.mulAdd(128,127&t)}while(128&t);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return 0===this.tagClass},e.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},e}(),ca=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ha=(1<<26)/ca[ca.length-1],ua=function(){function e(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,i=(1<<t)-1,r=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(n=this[o]>>a)>0&&(r=!0,s=Uo(n));o>=0;)a<t?(n=(this[o]&(1<<a)-1)<<t-a,n|=this[--o]>>(a+=this.DB-t)):(n=this[o]>>(a-=t)&i,a<=0&&(a+=this.DB,--o)),n>0&&(r=!0),r&&(s+=Uo(n));return r?s:"0"},e.prototype.negate=function(){var t=ma();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+Ea(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=ma();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new fa(t):new pa(t),this.exp(e,n)},e.prototype.clone=function(){var e=ma();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n,i=this.DB-e*this.DB%8,r=0;if(e-- >0)for(i<this.DB&&(n=this[e]>>i)!=(this.s&this.DM)>>i&&(t[r++]=n|this.s<<this.DB-i);e>=0;)i<8?(n=(this[e]&(1<<i)-1)<<8-i,n|=this[--e]>>(i+=this.DB-8)):(n=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==r&&(128&this.s)!=(128&n)&&++r,(r>0||n!=this.s)&&(t[r++]=n);return t},e.prototype.equals=function(e){return 0==this.compareTo(e)},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=ma();return this.bitwiseTo(e,jo,t),t},e.prototype.or=function(e){var t=ma();return this.bitwiseTo(e,Fo,t),t},e.prototype.xor=function(e){var t=ma();return this.bitwiseTo(e,zo,t),t},e.prototype.andNot=function(e){var t=ma();return this.bitwiseTo(e,Ho,t),t},e.prototype.not=function(){for(var e=ma(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=ma();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=ma();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+Go(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=Vo(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,Fo)},e.prototype.clearBit=function(e){return this.changeBit(e,Ho)},e.prototype.flipBit=function(e){return this.changeBit(e,zo)},e.prototype.add=function(e){var t=ma();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=ma();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=ma();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=ma();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=ma();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=ma(),n=ma();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,i,r=e.bitLength(),s=Sa(1);if(r<=0)return s;n=r<18?1:r<48?3:r<144?4:r<768?5:6,i=r<8?new fa(t):t.isEven()?new ga(t):new pa(t);var o=[],a=3,l=n-1,c=(1<<n)-1;if(o[1]=i.convert(this),n>1){var h=ma();for(i.sqrTo(o[1],h);a<=c;)o[a]=ma(),i.mulTo(h,o[a-2],o[a]),a+=2}var u,d,f=e.t-1,p=!0,g=ma();for(r=Ea(e[f])-1;f>=0;){for(r>=l?u=e[f]>>r-l&c:(u=(e[f]&(1<<r+1)-1)<<l-r,f>0&&(u|=e[f-1]>>this.DB+r-l)),a=n;0==(1&u);)u>>=1,--a;if((r-=a)<0&&(r+=this.DB,--f),p)o[u].copyTo(s),p=!1;else{for(;a>1;)i.sqrTo(s,g),i.sqrTo(g,s),a-=2;a>0?i.sqrTo(s,g):(d=s,s=g,g=d),i.mulTo(g,o[u],s)}for(;f>=0&&0==(e[f]&1<<r);)i.sqrTo(s,g),d=s,s=g,g=d,--r<0&&(r=this.DB-1,--f)}return i.revert(s)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;for(var i=t.clone(),r=this.clone(),s=Sa(1),o=Sa(0),a=Sa(0),l=Sa(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),n?(s.isEven()&&o.isEven()||(s.addTo(this,s),o.subTo(t,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;r.isEven();)r.rShiftTo(1,r),n?(a.isEven()&&l.isEven()||(a.addTo(this,a),l.subTo(t,l)),a.rShiftTo(1,a)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);i.compareTo(r)>=0?(i.subTo(r,i),n&&s.subTo(a,s),o.subTo(l,o)):(r.subTo(i,r),n&&a.subTo(s,a),l.subTo(o,l))}return 0!=r.compareTo(e.ONE)?e.ZERO:l.compareTo(t)>=0?l.subtract(t):l.signum()<0?(l.addTo(t,l),l.signum()<0?l.add(t):l):l},e.prototype.pow=function(e){return this.exp(e,new da)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var i=t;t=n,n=i}var r=t.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)return t;for(r<s&&(s=r),s>0&&(t.rShiftTo(s,t),n.rShiftTo(s,n));t.signum()>0;)(r=t.getLowestSetBit())>0&&t.rShiftTo(r,t),(r=n.getLowestSetBit())>0&&n.rShiftTo(r,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return s>0&&n.lShiftTo(s,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=ca[ca.length-1]){for(t=0;t<ca.length;++t)if(n[0]==ca[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<ca.length;){for(var i=ca[t],r=t+1;r<ca.length&&i<ha;)i*=ca[r++];for(i=n.modInt(i);t<r;)if(i%ca[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var i;if(16==n)i=4;else if(8==n)i=3;else if(256==n)i=8;else if(2==n)i=1;else if(32==n)i=5;else{if(4!=n)return void this.fromRadix(t,n);i=2}this.t=0,this.s=0;for(var r=t.length,s=!1,o=0;--r>=0;){var a=8==i?255&+t[r]:xa(t,r);a<0?"-"==t.charAt(r)&&(s=!0):(s=!1,0==o?this[this.t++]=a:o+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=i)>=this.DB&&(o-=this.DB))}8==i&&0!=(128&+t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},e.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,i=this.DB-n,r=(1<<i)-1,s=Math.floor(e/this.DB),o=this.s<<n&this.DM,a=this.t-1;a>=0;--a)t[a+s+1]=this[a]>>i|o,o=(this[a]&r)<<n;for(a=s-1;a>=0;--a)t[a]=0;t[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var i=e%this.DB,r=this.DB-i,s=(1<<i)-1;t[0]=this[n]>>i;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&s)<<r,t[o-n]=this[o]>>i;i>0&&(t[this.t-n-1]|=(this.s&s)<<r),t.t=this.t-n,t.clamp()}},e.prototype.subTo=function(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);n<r;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var i=this.abs(),r=t.abs(),s=i.t;for(n.t=s+r.t;--s>=0;)n[s]=0;for(s=0;s<r.t;++s)n[s+i.t]=i.am(0,r[s],n,s,0,i.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var i=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,i,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,i){var r=t.abs();if(!(r.t<=0)){var s=this.abs();if(s.t<r.t)return null!=n&&n.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=ma());var o=ma(),a=this.s,l=t.s,c=this.DB-Ea(r[r.t-1]);c>0?(r.lShiftTo(c,o),s.lShiftTo(c,i)):(r.copyTo(o),s.copyTo(i));var h=o.t,u=o[h-1];if(0!=u){var d=u*(1<<this.F1)+(h>1?o[h-2]>>this.F2:0),f=this.FV/d,p=(1<<this.F1)/d,g=1<<this.F2,m=i.t,v=m-h,y=null==n?ma():n;for(o.dlShiftTo(v,y),i.compareTo(y)>=0&&(i[i.t++]=1,i.subTo(y,i)),e.ONE.dlShiftTo(h,y),y.subTo(o,o);o.t<h;)o[o.t++]=0;for(;--v>=0;){var w=i[--m]==u?this.DM:Math.floor(i[m]*f+(i[m-1]+g)*p);if((i[m]+=o.am(0,w,i,v,0,h))<w)for(o.dlShiftTo(v,y),i.subTo(y,i);i[m]<--w;)i.subTo(y,i)}null!=n&&(i.drShiftTo(h,n),a!=l&&e.ZERO.subTo(n,n)),i.t=h,i.clamp(),c>0&&i.rShiftTo(c,i),a<0&&e.ZERO.subTo(i,i)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var i=ma(),r=ma(),s=n.convert(this),o=Ea(t)-1;for(s.copyTo(i);--o>=0;)if(n.sqrTo(i,r),(t&1<<o)>0)n.mulTo(r,s,i);else{var a=i;i=r,r=a}return n.revert(i)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),i=Sa(n),r=ma(),s=ma(),o="";for(this.divRemTo(i,r,s);r.signum()>0;)o=(n+s.intValue()).toString(e).substr(1)+o,r.divRemTo(i,r,s);return s.intValue().toString(e)+o},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var i=this.chunkSize(n),r=Math.pow(n,i),s=!1,o=0,a=0,l=0;l<t.length;++l){var c=xa(t,l);c<0?"-"==t.charAt(l)&&0==this.signum()&&(s=!0):(a=n*a+c,++o>=i&&(this.dMultiply(r),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(n,o)),this.dAddOffset(a,0)),s&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,i){if("number"==typeof n)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),Fo,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var r=[],s=7&t;r.length=1+(t>>3),n.nextBytes(r),s>0?r[0]&=(1<<s)-1:r[0]=0,this.fromString(r,256)}},e.prototype.bitwiseTo=function(e,t,n){var i,r,s=Math.min(e.t,this.t);for(i=0;i<s;++i)n[i]=t(this[i],e[i]);if(e.t<this.t){for(r=e.s&this.DM,i=s;i<this.t;++i)n[i]=t(this[i],r);n.t=this.t}else{for(r=this.s&this.DM,i=s;i<e.t;++i)n[i]=t(r,e[i]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var i=e.ONE.shiftLeft(t);return this.bitwiseTo(i,n,i),i},e.prototype.addTo=function(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);n<r;)i+=this[n]+e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i+=e[n],t[n++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[n++]=i:i<-1&&(t[n++]=this.DV+i),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var i=Math.min(this.t+e.t,t);for(n.s=0,n.t=i;i>0;)n[--i]=0;for(var r=n.t-this.t;i<r;++i)n[i+this.t]=this.am(0,e[i],n,i,0,this.t);for(r=Math.min(e.t,t);i<r;++i)this.am(0,e[i],n,i,0,t-i);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var i=n.t=this.t+e.t-t;for(n.s=0;--i>=0;)n[i]=0;for(i=Math.max(t-this.t,0);i<e.t;++i)n[this.t+i-t]=this.am(t-i,e[i],n,0,0,this.t+i-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var i=this.t-1;i>=0;--i)n=(t*n+this[i])%e;return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),i=n.getLowestSetBit();if(i<=0)return!1;var r=n.shiftRight(i);(t=t+1>>1)>ca.length&&(t=ca.length);for(var s=ma(),o=0;o<t;++o){s.fromInt(ca[Math.floor(Math.random()*ca.length)]);var a=s.modPow(r,this);if(0!=a.compareTo(e.ONE)&&0!=a.compareTo(n)){for(var l=1;l++<i&&0!=a.compareTo(n);)if(0==(a=a.modPowInt(2,this)).compareTo(e.ONE))return!1;if(0!=a.compareTo(n))return!1}}return!0},e.prototype.square=function(){var e=ma();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(n.compareTo(i)<0){var r=n;n=i,i=r}var s=n.getLowestSetBit(),o=i.getLowestSetBit();if(o<0)t(n);else{s<o&&(o=s),o>0&&(n.rShiftTo(o,n),i.rShiftTo(o,i));var a=function(){(s=n.getLowestSetBit())>0&&n.rShiftTo(s,n),(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),n.compareTo(i)>=0?(n.subTo(i,n),n.rShiftTo(1,n)):(i.subTo(n,i),i.rShiftTo(1,i)),n.signum()>0?setTimeout(a,0):(o>0&&i.lShiftTo(o,i),setTimeout((function(){t(i)}),0))};setTimeout(a,10)}},e.prototype.fromNumberAsync=function(t,n,i,r){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),Fo,this),this.isEven()&&this.dAddOffset(1,0);var s=this,o=function(){s.dAddOffset(2,0),s.bitLength()>t&&s.subTo(e.ONE.shiftLeft(t-1),s),s.isProbablePrime(n)?setTimeout((function(){r()}),0):setTimeout(o,0)};setTimeout(o,0)}else{var a=[],l=7&t;a.length=1+(t>>3),n.nextBytes(a),l>0?a[0]&=(1<<l)-1:a[0]=0,this.fromString(a,256)}},e}(),da=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),fa=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),pa=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=ma();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(ua.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=ma();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],i=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,i,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),ga=function(){function e(e){this.m=e,this.r2=ma(),this.q3=ma(),ua.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=ma();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function ma(){return new ua(null)}function va(e,t){return new ua(e,t)}var ya="undefined"!=typeof navigator;ya&&"Microsoft Internet Explorer"==navigator.appName?(ua.prototype.am=function(e,t,n,i,r,s){for(var o=32767&t,a=t>>15;--s>=0;){var l=32767&this[e],c=this[e++]>>15,h=a*l+c*o;r=((l=o*l+((32767&h)<<15)+n[i]+(1073741823&r))>>>30)+(h>>>15)+a*c+(r>>>30),n[i++]=1073741823&l}return r},sa=30):ya&&"Netscape"!=navigator.appName?(ua.prototype.am=function(e,t,n,i,r,s){for(;--s>=0;){var o=t*this[e++]+n[i]+r;r=Math.floor(o/67108864),n[i++]=67108863&o}return r},sa=26):(ua.prototype.am=function(e,t,n,i,r,s){for(var o=16383&t,a=t>>14;--s>=0;){var l=16383&this[e],c=this[e++]>>14,h=a*l+c*o;r=((l=o*l+((16383&h)<<14)+n[i]+r)>>28)+(h>>14)+a*c,n[i++]=268435455&l}return r},sa=28),ua.prototype.DB=sa,ua.prototype.DM=(1<<sa)-1,ua.prototype.DV=1<<sa;ua.prototype.FV=Math.pow(2,52),ua.prototype.F1=52-sa,ua.prototype.F2=2*sa-52;var wa,ba,Aa=[];for(wa="0".charCodeAt(0),ba=0;ba<=9;++ba)Aa[wa++]=ba;for(wa="a".charCodeAt(0),ba=10;ba<36;++ba)Aa[wa++]=ba;for(wa="A".charCodeAt(0),ba=10;ba<36;++ba)Aa[wa++]=ba;function xa(e,t){var n=Aa[e.charCodeAt(t)];return null==n?-1:n}function Sa(e){var t=ma();return t.fromInt(e),t}function Ea(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}ua.ZERO=Sa(0),ua.ONE=Sa(1);var Ta=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,i;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,i=this.S[t],this.S[t]=this.S[n],this.S[n]=i;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();var Da,Ca,Ia=256,Ba=null;if(null==Ba){Ba=[],Ca=0;var Ma=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var Oa=new Uint32Array(256);for(window.crypto.getRandomValues(Oa),Ma=0;Ma<Oa.length;++Ma)Ba[Ca++]=255&Oa[Ma]}var Pa=0,Ra=function(e){if((Pa=Pa||0)>=256||Ca>=Ia)window.removeEventListener?window.removeEventListener("mousemove",Ra,!1):window.detachEvent&&window.detachEvent("onmousemove",Ra);else try{var t=e.x+e.y;Ba[Ca++]=255&t,Pa+=1}catch(e){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",Ra,!1):window.attachEvent&&window.attachEvent("onmousemove",Ra))}function _a(){if(null==Da){for(Da=new Ta;Ca<Ia;){var e=Math.floor(65536*Math.random());Ba[Ca++]=255&e}for(Da.init(Ba),Ca=0;Ca<Ba.length;++Ca)Ba[Ca]=0;Ca=0}return Da.next()}var La=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=_a()},e}();var Na=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=va(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=function(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var n=[],i=e.length-1;i>=0&&t>0;){var r=e.charCodeAt(i--);r<128?n[--t]=r:r>127&&r<2048?(n[--t]=63&r|128,n[--t]=r>>6|192):(n[--t]=63&r|128,n[--t]=r>>6&63|128,n[--t]=r>>12|224)}n[--t]=0;for(var s=new La,o=[];t>2;){for(o[0]=0;0==o[0];)s.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new ua(n)}(e,t);if(null==n)return null;var i=this.doPublic(n);if(null==i)return null;for(var r=i.toString(16),s=r.length,o=0;o<2*t-s;o++)r="0"+r;return r},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=va(e,16),this.e=parseInt(t,16),this.d=va(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,i,r,s,o,a){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=va(e,16),this.e=parseInt(t,16),this.d=va(n,16),this.p=va(i,16),this.q=va(r,16),this.dmp1=va(s,16),this.dmq1=va(o,16),this.coeff=va(a,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new La,i=e>>1;this.e=parseInt(t,16);for(var r=new ua(t,16);;){for(;this.p=new ua(e-i,1,n),0!=this.p.subtract(ua.ONE).gcd(r).compareTo(ua.ONE)||!this.p.isProbablePrime(10););for(;this.q=new ua(i,1,n),0!=this.q.subtract(ua.ONE).gcd(r).compareTo(ua.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(ua.ONE),a=this.q.subtract(ua.ONE),l=o.multiply(a);if(0==l.gcd(r).compareTo(ua.ONE)){this.n=this.p.multiply(this.q),this.d=r.modInverse(l),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=va(e,16),n=this.doPrivate(t);return null==n?null:function(e,t){var n=e.toByteArray(),i=0;for(;i<n.length&&0==n[i];)++i;if(n.length-i!=t-1||2!=n[i])return null;++i;for(;0!=n[i];)if(++i>=n.length)return null;var r="";for(;++i<n.length;){var s=255&n[i];s<128?r+=String.fromCharCode(s):s>191&&s<224?(r+=String.fromCharCode((31&s)<<6|63&n[i+1]),++i):(r+=String.fromCharCode((15&s)<<12|(63&n[i+1])<<6|63&n[i+2]),i+=2)}return r}(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var i=new La,r=e>>1;this.e=parseInt(t,16);var s=new ua(t,16),o=this,a=function(){var t=function(){if(o.p.compareTo(o.q)<=0){var e=o.p;o.p=o.q,o.q=e}var t=o.p.subtract(ua.ONE),i=o.q.subtract(ua.ONE),r=t.multiply(i);0==r.gcd(s).compareTo(ua.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(r),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(i),o.coeff=o.q.modInverse(o.p),setTimeout((function(){n()}),0)):setTimeout(a,0)},l=function(){o.q=ma(),o.q.fromNumberAsync(r,1,i,(function(){o.q.subtract(ua.ONE).gcda(s,(function(e){0==e.compareTo(ua.ONE)&&o.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(l,0)}))}))},c=function(){o.p=ma(),o.p.fromNumberAsync(e-r,1,i,(function(){o.p.subtract(ua.ONE).gcda(s,(function(e){0==e.compareTo(ua.ONE)&&o.p.isProbablePrime(10)?setTimeout(l,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)},e.prototype.sign=function(e,t,n){var i=function(e){return ka[e]||""}(n),r=function(e,t){if(t<e.length+22)return console.error("Message too long for RSA"),null;for(var n=t-e.length-6,i="",r=0;r<n;r+=2)i+="ff";return va("0001"+i+"00"+e,16)}(i+t(e).toString(),this.n.bitLength()/4);if(null==r)return null;var s=this.doPrivate(r);if(null==s)return null;var o=s.toString(16);return 0==(1&o.length)?o:"0"+o},e.prototype.verify=function(e,t,n){var i=va(t,16),r=this.doPublic(i);return null==r?null:function(e){for(var t in ka)if(ka.hasOwnProperty(t)){var n=ka[t],i=n.length;if(e.substr(0,i)==n)return e.substr(i)}return e}
8
8
  /*!
9
9
  Copyright (c) 2011, Yahoo! Inc. All rights reserved.
10
10
  Code licensed under the BSD License:
11
11
  http://developer.yahoo.com/yui/license.html
12
12
  version: 2.9.0
13
- */(r.toString(16).replace(/^1f+00/,""))==n(e).toString()},e}();var Ea={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};var Ta={};Ta.lang={extend:function(e,t,n){if(!t||!e)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var i=function(){};if(i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t),n){var r;for(r in n)e.prototype[r]=n[r];var s=function(){},o=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(s=function(e,t){for(r=0;r<o.length;r+=1){var n=o[r],i=t[n];"function"==typeof i&&i!=Object.prototype[n]&&(e[n]=i)}})}catch(e){}s(e.prototype,n)}}};
13
+ */(r.toString(16).replace(/^1f+00/,""))==n(e).toString()},e}();var ka={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};var Ua={};Ua.lang={extend:function(e,t,n){if(!t||!e)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var i=function(){};if(i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t),n){var r;for(r in n)e.prototype[r]=n[r];var s=function(){},o=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(s=function(e,t){for(r=0;r<o.length;r+=1){var n=o[r],i=t[n];"function"==typeof i&&i!=Object.prototype[n]&&(e[n]=i)}})}catch(e){}s(e.prototype,n)}}};
14
14
  /**
15
15
  * @fileOverview
16
16
  * @name asn1-1.0.js
@@ -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/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAA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JpSKOZzP86Nwz28EiQ504g4SrJwffUPur/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};
22
+ var ja={};void 0!==ja.asn1&&ja.asn1||(ja.asn1={}),ja.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 ua(i,16).xor(e).add(ua.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=ja.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,w=t.ASN1Util.newObject,b=Object.keys(e);if(1!=b.length)throw"key of param shall be only one.";var A=b[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=w(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=w(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=w(D[2]);return new y({tag:D[0],explicit:D[1],obj:C})}var I={};if(void 0!==D.explicit&&(I.explicit=D.explicit),void 0!==D.tag&&(I.tag=D.tag),void 0===D.obj)throw"obj shall be specified for 'tag'.";return I.obj=w(D.obj),new y(I)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},ja.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 ua(i,2).toString(10),i=""}return t},ja.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 ua(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},ja.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""}},ja.asn1.DERAbstractString=function(e){ja.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))},Ua.lang.extend(ja.asn1.DERAbstractString,ja.asn1.ASN1Object),ja.asn1.DERAbstractTime=function(e){ja.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}},Ua.lang.extend(ja.asn1.DERAbstractTime,ja.asn1.ASN1Object),ja.asn1.DERAbstractStructured=function(e){ja.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)},Ua.lang.extend(ja.asn1.DERAbstractStructured,ja.asn1.ASN1Object),ja.asn1.DERBoolean=function(){ja.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},Ua.lang.extend(ja.asn1.DERBoolean,ja.asn1.ASN1Object),ja.asn1.DERInteger=function(e){ja.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=ja.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new ua(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))},Ua.lang.extend(ja.asn1.DERInteger,ja.asn1.ASN1Object),ja.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=ja.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}ja.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))},Ua.lang.extend(ja.asn1.DERBitString,ja.asn1.ASN1Object),ja.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=ja.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}ja.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},Ua.lang.extend(ja.asn1.DEROctetString,ja.asn1.DERAbstractString),ja.asn1.DERNull=function(){ja.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Ua.lang.extend(ja.asn1.DERNull,ja.asn1.ASN1Object),ja.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 ua(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};ja.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=ja.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))},Ua.lang.extend(ja.asn1.DERObjectIdentifier,ja.asn1.ASN1Object),ja.asn1.DEREnumerated=function(e){ja.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=ja.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new ua(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))},Ua.lang.extend(ja.asn1.DEREnumerated,ja.asn1.ASN1Object),ja.asn1.DERUTF8String=function(e){ja.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},Ua.lang.extend(ja.asn1.DERUTF8String,ja.asn1.DERAbstractString),ja.asn1.DERNumericString=function(e){ja.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},Ua.lang.extend(ja.asn1.DERNumericString,ja.asn1.DERAbstractString),ja.asn1.DERPrintableString=function(e){ja.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},Ua.lang.extend(ja.asn1.DERPrintableString,ja.asn1.DERAbstractString),ja.asn1.DERTeletexString=function(e){ja.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},Ua.lang.extend(ja.asn1.DERTeletexString,ja.asn1.DERAbstractString),ja.asn1.DERIA5String=function(e){ja.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},Ua.lang.extend(ja.asn1.DERIA5String,ja.asn1.DERAbstractString),ja.asn1.DERUTCTime=function(e){ja.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))},Ua.lang.extend(ja.asn1.DERUTCTime,ja.asn1.DERAbstractTime),ja.asn1.DERGeneralizedTime=function(e){ja.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))},Ua.lang.extend(ja.asn1.DERGeneralizedTime,ja.asn1.DERAbstractTime),ja.asn1.DERSequence=function(e){ja.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}},Ua.lang.extend(ja.asn1.DERSequence,ja.asn1.DERAbstractStructured),ja.asn1.DERSet=function(e){ja.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)},Ua.lang.extend(ja.asn1.DERSet,ja.asn1.DERAbstractStructured),ja.asn1.DERTaggedObject=function(e){ja.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)))},Ua.lang.extend(ja.asn1.DERTaggedObject,ja.asn1.ASN1Object);var Fa,za,Ha,Ga=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)}}(),Va=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 Ga(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)?qo(e):Jo.unarmor(e),r=aa.decode(i);if(3===r.sub.length&&(r=r.sub[2].sub[0]),9===r.sub.length){t=r.sub[1].getHexStringValue(),this.n=va(t,16),n=r.sub[2].getHexStringValue(),this.e=parseInt(n,16);var s=r.sub[3].getHexStringValue();this.d=va(s,16);var o=r.sub[4].getHexStringValue();this.p=va(o,16);var a=r.sub[5].getHexStringValue();this.q=va(a,16);var l=r.sub[6].getHexStringValue();this.dmp1=va(l,16);var c=r.sub[7].getHexStringValue();this.dmq1=va(c,16);var h=r.sub[8].getHexStringValue();this.coeff=va(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=va(t,16),n=u.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else t=r.sub[0].getHexStringValue(),this.n=va(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 ja.asn1.DERInteger({int:0}),new ja.asn1.DERInteger({bigint:this.n}),new ja.asn1.DERInteger({int:this.e}),new ja.asn1.DERInteger({bigint:this.d}),new ja.asn1.DERInteger({bigint:this.p}),new ja.asn1.DERInteger({bigint:this.q}),new ja.asn1.DERInteger({bigint:this.dmp1}),new ja.asn1.DERInteger({bigint:this.dmq1}),new ja.asn1.DERInteger({bigint:this.coeff})]};return new ja.asn1.DERSequence(e).getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return Xo(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new ja.asn1.DERSequence({array:[new ja.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new ja.asn1.DERNull]}),t=new ja.asn1.DERSequence({array:[new ja.asn1.DERInteger({bigint:this.n}),new ja.asn1.DERInteger({int:this.e})]}),n=new ja.asn1.DERBitString({hex:"00"+t.getEncodedHex()});return new ja.asn1.DERSequence({array:[e,n]}).getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return Xo(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}(Na),Ya="undefined"!=typeof process?null===(Fa=process.env)||void 0===Fa?void 0:Fa.npm_package_version:void 0,Qa=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 Va(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(Zo(e))}catch(e){return!1}},e.prototype.encrypt=function(e){try{return Xo(this.getKey().encrypt(e))}catch(e){return!1}},e.prototype.sign=function(e,t,n){try{return Xo(this.getKey().sign(e,t,n))}catch(e){return!1}},e.prototype.verify=function(e,t,n){try{return this.getKey().verify(e,Zo(t),n)}catch(e){return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new Va,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=Ya,e}(),Wa={},Xa={get exports(){return Wa},set exports(e){Wa=e}},Za={};za="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ha={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&Ha.rotl(e,8)|4278255360&Ha.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=Ha.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(za.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((za.indexOf(e.charAt(n-1))&Math.pow(2,-2*i+8)-1)<<2*i|za.indexOf(e.charAt(n))>>>6-2*i);return t}},{get exports(){return Za},set exports(e){Za=e}}.exports=Ha;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("")}}},qa=Ka,Ja=function(e){return null!=e&&($a(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&$a(e.slice(0,0))}(e)||!!e._isBuffer)};function $a(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}!function(){var e=Za,t=qa.utf8,n=Ja,i=qa.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,w=h,b=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+w>>>0,u=u+b>>>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,Xa.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 el,tl,nl={serialNums:[],key:"",verified:!0};class il{constructor(e){this.viewport=e,this.encryptInfo=nl,el.set(this,!0),tl.set(this,setTimeout((()=>{yi(this,el,!1,"f"),this.viewport.triggerRender()}),5e3))}verify(e,t){var n;clearTimeout(vi(this,tl,"f"));const i=new Qa;i.setPublicKey(null===(n=this.encryptInfo)||void 0===n?void 0:n.key);const r=i.verify(e,t,Wa);return yi(this,el,r,"f"),this.viewport.triggerRender(),r}getVerified(){return!!nl.verified||vi(this,el,"f")}}el=new WeakMap,tl=new WeakMap;class rl{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 sl=new e.Vector4;class ol 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(w(i,"X"));u.userData.type="posX";const d=new e.Sprite(w(r,"Y"));d.userData.type="posY";const f=new e.Sprite(w(s,"Z"));f.userData.type="posZ";const p=new e.Sprite(w(i));p.userData.type="negX";const g=new e.Sprite(w(r));g.userData.type="negY";const m=new e.Sprite(w(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 w(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(sl),e.setViewport(i,0,128,128),e.render(this,o),e.setViewport(sl.x,sl.y,sl.z,sl.w)}}}const al="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAApCAYAAADDJIzmAAAABGdBTUEAALGPC/xhBQA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JhmOyWDMBnhwmLXGv+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=",ll=100,cl=41,hl=new q,ul=new Ae;class dl extends v{get size(){var e;return null!==(e=this._size)&&void 0!==e?e:this.size=new b(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 w(-1.6,1.6,.8,-.8,0,4),this.direction=(new b).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 b(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=ul.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]:al,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ll,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:cl;const i=this.imageWidth,r=i*(n/t);this.size=new b(i,r);const s=ul.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(hl);const{width:t,height:n}=e.domElement,i=new b(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 b(o,a);l.normalize().multiplyScalar(i);const c=new b(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(hl.x,hl.y,hl.z,hl.w)}}J.prototype.computeBoundsTree=Et,J.prototype.disposeBoundsTree=Tt,u.prototype.raycast=Dt,Ee.prototype.firstHitOnly=!0;const fl={needsUpdate:!1};let pl=0,gl=0;const ml=e=>{e instanceof l&&e.dispose()};class vl{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 ar,cameraObjectChange:new ar,sceneChanged:new ar,backgroundChanged:new ar,beforeRender:new ar,sceneRendered:new ar,loadRendered:new ar,tweenUpdate:new ar,hover:new ar,click:new ar,dblClick:new ar,rightClick:new ar,mouseDown:new ar,mouseMove:new ar,mouseUp:new ar,mouseWheel:new ar,keyDown:new ar,keyUp:new ar,modelHover:new ar,modelUnHover:new ar,modelClick:new ar,modelDblClick:new ar,modelRightClick:new ar,poiHover:new ar,poiUnHover:new ar,poiClick:new ar,poiDblClick:new ar,poiRightClick:new ar,selectPosition:new ar,sceneClick:new ar,objectAdded:new ar,objectRemoved:new ar,objectChanged:new ar,geometryChanged:new ar,materialAdded:new ar,materialChanged:new ar,materialRemoved:new ar,cameraChange:new ar,outlineChange:new ar,modelAnimation:new ar,getSceneInfo:new ar},this.scener=new ur(this.signals,this.state),this.scene=this.scener.scene,this.cameraManager=new zr(this),this.camera=this.cameraManager.currentCamera,this.rendererManager=new Cr(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 xo(this.renderer,this.scene,this.camera),this.effectComposer=this.effectManager.effectComposer,this.bvh=new Eo(this),this.controls=new No(this),this.info=new rl(this.scene,this.signals),this.stats=Bt(),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 ol(this.camera,this.container),this.license=new il(this),this.waterMark=new dl(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:w=20,refineSteps:b=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(xo.CONSTANTS.ssrEffect);C.enabled=t;const{effect:I}=C;I.usingBoxProjectedEnvMap=!0,I.intensity=n,I.exponent=i,I.distance=r,I.fade=s,I.roughnessFade=o,I.thickness=a,I.ior=l,I.maxRoughness=c,I.maxDepthDifference=h,I.blend=u,I.correction=d,I.correctionRadius=f,I.blur=p,I.blurKernel=g,I.blurSharpness=m,I.jitter=v,I.jitterRoughness=y,I.steps=w,I.refineSteps=b,I.missedRays=A,I.useNormalMap=x,I.useRoughnessMap=S,I.resolutionScale=E,I.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(xo.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 w=y.passesMap.get(xo.CONSTANTS.normalPass),b=y.effectsMap.get(xo.CONSTANTS.ssaoEffect);w.enabled=t,b.enabled=t;const{effect:A}=b,{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:Ie};this.renderer.toneMapping=i[t],this.renderer.toneMappingExposure=n,this.signals.sceneChanged.dispatch()}async setSphereSkyBackground(e){const t=ei(e);if("hdr"===t||"pic"===t){const t=await(new It).loadAsync(e);t.mapping=Ce,ml(this.scene.background),this.scene.background=t}else{const t=await(new Ae).loadAsync(e);t.mapping=Ce,ml(this.scene.background),this.scene.background=t}this.signals.backgroundChanged.dispatch()}async setSkyBackground(e,t){const n=await In(e,t);ml(this.scene.background),this.scene.background=n,this.signals.backgroundChanged.dispatch()}setBackgroundColor(e){ml(this.scene.background),this.scene.background=new a(e),this.signals.backgroundChanged.dispatch()}setBackgroundColorAlpha(e,t){ml(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 Mt,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=Sn(90-a),f=Sn(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=Ie,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 Ct,.04).texture,this.signals.sceneChanged.dispatch(),this.scene.environment}playModelAnimation(e,t){let n;if(t instanceof Be?n=t:Wn(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 Be?i=t:Wn(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&&!fl.needsUpdate)return;if(this.state.useFreq>0&&this.state.useFreq--,fl.needsUpdate&&(fl.needsUpdate=!1),this.state.isPausedRender)return;pl=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))),gl=performance.now(),this.signals.sceneRendered.dispatch(gl-pl)}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()),rn.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 b;o.set(s.offsetX/r.width*2-1,-s.offsetY/r.height*2+1),this.raycaster.setFromCamera(o,this.camera);let a=[];return a=Xn(t)?this.raycaster.intersectObjects(t,!0):this.raycaster.intersectObject(t,!0),i?a.filter((e=>{let{object:t}=e;return Dn(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),Xn(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(),rn.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(xo.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 Cl){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 yl 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,fl.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,fl.needsUpdate=!0}setMove(e,t,n,i){return ii(this.position,yn(e),t,n,i)}setRotate(e,t,n,i){const s=wn(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return ii({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 ii(this.scale,yn(e),t,n,i)}getBoundingBox(){return new i(new t,new t).setFromObject(this)}eventPropagation(){this.isEventPropagation=!0}sClone(e){return new yl(this.geometry,this.material,{id:`clone_${$n()}`}).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 bl||e.children[t]instanceof yl?this.add(e.children[t].sClone()):this.add(e.children[t].clone());return this}}const wl={onLoad:null,onClick:null,onDblClick:null,onRightClick:null};class bl 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({},wl),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,fl.needsUpdate=!0}hide(){this.visible=!1,this.handleHide=!0,this.autoUpdate=!0,fl.needsUpdate=!0}setMove(e,t,n,i){return ii(this.position,yn(e),t,n,i)}setRotate(e,t,n,i){const s=wn(e),o=this.quaternion.clone(),a=(new r).setFromEuler(s);return ii({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 ii(this.scale,yn(e),t,n,i)}sClone(e){return new bl({id:`clone_${$n()}`}).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 bl||n instanceof yl?this.add(n.sClone()):this.add(n.clone())}return this}getBoundingBox(){return new i(new t,new t).setFromObject(this)}getSpaceAttribute(){return En(this,!(arguments.length>0&&void 0!==arguments[0])||arguments[0])}syncSpaceAttribute(e){e instanceof bl?Tn(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1]):vn("In soonspacejs: BaseObject3D 对象原型方法 'syncSpaceAttribute' 第一个参数对象类型错误!")}}class Al extends bl{constructor(e){super(e,"Group")}showAllChild(){this.children.forEach((e=>{e instanceof bl&&e.show()}))}hideAllChild(){this.children.forEach((e=>{e instanceof bl&&e.hide()}))}}class xl extends bl{constructor(e){super(e,"PluginObject")}}class Sl extends bl{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 dr(this.element))}_create2DHalf(){this.add(new Sr(this.element))}_create3D(){this.add(new xr(this.element))}}class El extends bl{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]:{};In(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,fl.needsUpdate=!0}}))}))}sClone(e){return new El({id:`${this.sid}_clone`,url:"",format:this.formatType}).sCopy(this,e)}}const Tl={position:{x:0,y:0,z:0},scale:{x:16,y:16,z:1},stype:"Icon"};class Dl extends _e{constructor(e,t){super(e);const{position:n,scale:i,stype:r}=Object.assign(Object.assign({},Tl),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 Cl extends bl{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 Cl(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 Dl(this._computeMaterialSizeAttenuation(e));return this.add(t),t}_createText(e){const t=this._createTextMaterial(e),n=new Dl(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 Il extends yl{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:Bn(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(yn(r)),s&&(o.map=Bn(s)),o.needsUpdate=!0,fl.needsUpdate=!0}}class Bl extends Il{constructor(e){super(e,"Node"),this.graphs=e.graphs}}class Ml extends yl{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:Bn(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(yn(r)),s&&(o.map=Bn(s)),o.needsUpdate=!0,fl.needsUpdate=!0}}class Ol extends yl{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=yn(n),d=yn(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,Qn(s)&&s?ii(a.offset,{y:-1,x:0},{repeat:!0,duration:500}):Zn(s)&&ii(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 Pl extends bl{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=Xn(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=Xn(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 Bl(Object.assign({},e));return this.add(t),t}createCircle(e){const t=new Ml(Object.assign(Object.assign({},e),{rotation:{x:Math.PI/2,y:0,z:0}}));return this.add(t),t}createLink(e){const t=new Ol(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&&yn(n.position).equals(yn(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&&yn(n.position).equals(yn(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=Xn(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 Rl(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=yn(e[n]),l=yn(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 _l extends yl{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(Rl(n,i),function(e,t,n){return new xe({color:e,side:Y,transparent:t<1,opacity:t,map:Bn(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=Bn(o)),r&&s?this.geometry=Rl(r,s):r?this.geometry=Rl(r,null!==(t=this.params.width)&&void 0!==t?t:20):s&&(this.geometry=Rl(this.points,s)),l.needsUpdate=!0,fl.needsUpdate=!0}}function Ll(e){const t=[];for(let n=0;n<e.length;n++)t.push(new b(e[n].x,e[n].z));return t.length>2?new je(new Fe(t)):new J}class Nl extends yl{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(Ll(i),function(e,t,n){return new xe({color:e,opacity:t,transparent:t<1,side:Y,map:Bn(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=Ll(r)),s&&(o.map=Bn(s)),o.needsUpdate=!0,fl.needsUpdate=!0}}class kl extends bl{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 Il(e);return this.add(t),fl.needsUpdate=!0,t}getPoint(e){return this.getChildForType("Point",e)}removePoint(e){const t=this.getPoint(e);t&&this.remove(t),fl.needsUpdate=!0}createLine(e){const t=new _l(e);return this.add(t),fl.needsUpdate=!0,t}getLine(e){return this.getChildForType("Line",e)}removeLine(e){const t=this.getLine(e);t&&this.remove(t),fl.needsUpdate=!0}createPolygon(e){const t=new Nl(e);return this.add(t),fl.needsUpdate=!0,t}getPolygon(e){return this.getChildForType("Polygon",e)}removePolygon(e){const t=this.getPolygon(e);t&&this.remove(t),fl.needsUpdate=!0}createCircle(e){const t=new Ml(e);return this.add(t),fl.needsUpdate=!0,t}getCircle(e){return this.getChildForType("Circle",e)}removeCircle(e){const t=this.getCircle(e);t&&this.remove(t),fl.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 Ul extends yl{constructor(e,t,n){super(e,t,n,"Ground")}}var jl=Object.freeze({__proto__:null,BaseMesh:yl,BaseObject3D:bl,Canvas3D:kl,Circle:Ml,Ground:Ul,Group:Al,Icon:Dl,Line:_l,Link:Ol,Model:El,Node:Bl,PluginObject:xl,Poi:Cl,PoiNode:Sl,Point:Il,Polygon:Nl,Topology:Pl});class Fl{constructor(e,t,n){this.type=e,this.scene=n,this.viewport=t}createGroup(e,t){const n=new Al(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 bl||t instanceof yl)&&Zn(t)&&t.stype===this.type||Zn(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 zl extends Fl{constructor(e,t){super(an,e,t),Rt.init()}createAmbientLight(e){const{id:t,name:n="",color:i=10132122,intensity:r=1}=e,s=new ze(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=yn(o).distanceTo(yn(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=yn(o).distanceTo(yn(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 Hl(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 Gl={};let Vl,Yl,Ql;({get exports(){return Gl},set exports(e){Gl=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&Hl)return Hl(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=Hl,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!==si?si:"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!==si?si:"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",w="readwrite";function b(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,w),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 I(e){return D(e,!0)}function B(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([b(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,B(e)?I(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),I(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,B(n,t._defaultConfig.version)?I(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 F(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,w,(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 z(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){L(n._dbInfo,w,(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,w,(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:F,removeItem:z,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 we(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 be(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){be(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){be(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){be(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){be(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){be(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){be(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 Ie(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(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 Be(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(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:we,_support:X(),iterate:xe,getItem:Ae,setItem:Ee,removeItem:Te,clear:De,length:Ce,key:Ie,keys:Be,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 Fe(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 ze(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:Fe,getItem:je,setItem:Ye,removeItem:Ve,clear:Ue,length:Ge,key:ze,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);class Wl extends We{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===r.path?Xe.extractUrlBase(e):r.path,o=new Ze(this.manager);o.setPath(r.path),o.setResponseType("arraybuffer"),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,(function(n){try{t(r.parse(n,s))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e,t){if(function(e){const t="Kaydara FBX Binary \0";return e.byteLength>=t.length&&t===hc(e,0,t.length)}(e))Vl=(new Jl).parse(e);else{const t=hc(e);if(!function(e){const t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function i(t){const i=e[t-1];return e=e.slice(n+t),n++,i}for(let e=0;e<t.length;++e){if(i(1)===t[e])return!1}return!0}(t))throw new Error("THREE.FBXLoader: Unknown format.");if(tc(t)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+tc(t));Vl=(new ql).parse(t)}const n=new Ae(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Xl(n,this.manager).parse(Vl)}}class Xl{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Yl=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),i=this.parseDeformers(),r=(new Zl).parse(i);return this.parseScene(i,r,n),Ql}parseConnections(){const e=new Map;if("Connections"in Vl){Vl.Connections.connections.forEach((function(t){const n=t[0],i=t[1],r=t[2];e.has(n)||e.set(n,{parents:[],children:[]});const s={ID:i,relationship:r};e.get(n).parents.push(s),e.has(i)||e.set(i,{parents:[],children:[]});const o={ID:n,relationship:r};e.get(i).children.push(o)}))}return e}parseImages(){const e={},t={};if("Video"in Vl.Objects){const n=Vl.Objects.Video;for(const i in n){const r=n[i];if(e[parseInt(i)]=r.RelativeFilename||r.Filename,"Content"in r){const e=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,s="string"==typeof r.Content&&""!==r.Content;if(e||s){const e=this.parseImage(n[i]);t[r.RelativeFilename||r.Filename]=e}}}}for(const n in e){const i=e[n];void 0!==t[i]?e[n]=t[i]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(i){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof t)return"data:"+r+";base64,"+t;{const e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:r}))}}parseTextures(e){const t=new Map;if("Texture"in Vl.Objects){const n=Vl.Objects.Texture;for(const i in n){const r=this.parseTexture(n[i],e);t.set(parseInt(i),r)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const i=e.WrapModeU,r=e.WrapModeV,s=void 0!==i?i.value:0,o=void 0!==r?r.value:0;if(n.wrapS=0===s?N:Ke,n.wrapT=0===o?N:Ke,"Scaling"in e){const t=e.Scaling.value;n.repeat.x=t[0],n.repeat.y=t[1]}if("Translation"in e){const t=e.Translation.value;n.offset.x=t[0],n.offset.y=t[1]}return n}loadTexture(e,t){let n;const i=this.textureLoader.path,r=Yl.get(e.id).children;let s;void 0!==r&&r.length>0&&void 0!==t[r[0].ID]&&(n=t[r[0].ID],0!==n.indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));const o=e.FileName.slice(-3).toLowerCase();if("tga"===o){const t=this.manager.getHandler(".tga");null===t?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),s=new l):(t.setPath(this.textureLoader.path),s=t.load(n))}else"psd"===o?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),s=new l):s=this.textureLoader.load(n);return this.textureLoader.setPath(i),s}parseMaterials(e){const t=new Map;if("Material"in Vl.Objects){const n=Vl.Objects.Material;for(const i in n){const r=this.parseMaterial(n[i],e);null!==r&&t.set(parseInt(i),r)}}return t}parseMaterial(e,t){const n=e.id,i=e.attrName;let r=e.ShadingModel;if("object"==typeof r&&(r=r.value),!Yl.has(n))return null;const s=this.parseParameters(e,t,n);let o;return r.toLowerCase(),o=new g,o.setValues(s),o.name=i,o}parseParameters(e,t,n){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new a).fromArray(e.Diffuse.value).convertSRGBToLinear():!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new a).fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new a).fromArray(e.Emissive.value).convertSRGBToLinear():!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new a).fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0,i.depthWrite=!1);const r=this;return Yl.get(n).children.forEach((function(e){const n=e.relationship;switch(n){case"Bump":i.bumpMap=r.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=r.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=r.getTexture(t,e.ID),void 0!==i.map&&(i.map.encoding=T);break;case"DisplacementColor":i.displacementMap=r.getTexture(t,e.ID);break;case"EmissiveColor":i.emissiveMap=r.getTexture(t,e.ID),void 0!==i.emissiveMap&&(i.emissiveMap.encoding=T);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=r.getTexture(t,e.ID);break;case"ReflectionColor":i.envMap=r.getTexture(t,e.ID),void 0!==i.envMap&&(i.envMap.mapping=Ce,i.envMap.encoding=T);break;case"SpecularColor":i.specularMap=r.getTexture(t,e.ID),void 0!==i.specularMap&&(i.specularMap.encoding=T);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=r.getTexture(t,e.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),i}getTexture(e,t){return"LayeredTexture"in Vl.Objects&&t in Vl.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Yl.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Vl.Objects){const n=Vl.Objects.Deformer;for(const i in n){const r=n[i],s=Yl.get(parseInt(i));if("Skin"===r.attrType){const t=this.parseSkeleton(s,n);t.ID=i,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),t.geometryID=s.parents[0].ID,e[i]=t}else if("BlendShape"===r.attrType){const e={id:i};e.rawTargets=this.parseMorphTargets(s,n),e.id=i,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=e}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach((function(e){const i=t[e.ID];if("Cluster"!==i.attrType)return;const r={ID:e.ID,indices:[],weights:[],transformLink:(new m).fromArray(i.TransformLink.a)};"Indexes"in i&&(r.indices=i.Indexes.a,r.weights=i.Weights.a),n.push(r)})),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let i=0;i<e.children.length;i++){const r=e.children[i],s=t[r.ID],o={name:s.attrName,initialWeight:s.DeformPercent,id:s.id,fullWeights:s.FullWeights.a};if("BlendShapeChannel"!==s.attrType)return;o.geoID=Yl.get(parseInt(r.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(o)}return n}parseScene(e,t,n){Ql=new qe;const i=this.parseModels(e.skeletons,t,n),r=Vl.Objects.Model,s=this;i.forEach((function(e){const t=r[e.ID];s.setLookAtProperties(e,t);Yl.get(e.ID).parents.forEach((function(t){const n=i.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&Ql.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),Ql.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);const t=ac(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));const o=(new Kl).parse();1===Ql.children.length&&Ql.children[0].isGroup&&(Ql.children[0].animations=o,Ql=Ql.children[0]),Ql.animations=o}parseModels(e,t,n){const i=new Map,r=Vl.Objects.Model;for(const s in r){const o=parseInt(s),a=r[s],l=Yl.get(o);let c=this.buildSkeleton(l,e,o,a.attrName);if(!c){switch(a.attrType){case"Camera":case"Light":break;case"Mesh":c=this.createMesh(l,t,n);break;case"NurbsCurve":c=this.createCurve(l,t);break;case"LimbNode":case"Root":c=new Je;break;default:c=new qe}c.name=a.attrName?$e.sanitizeNodeName(a.attrName):"",c.ID=o}this.getTransformData(c,a),i.set(o,c)}return i}buildSkeleton(e,t,n,i){let r=null;return e.parents.forEach((function(e){for(const s in t){const o=t[s];o.rawBones.forEach((function(t,s){if(t.ID===e.ID){const e=r;r=new Je,r.matrixWorld.copy(t.transformLink),r.name=i?$e.sanitizeNodeName(i):"",r.ID=n,o.bones[s]=r,null!==e&&r.add(e)}}))}})),r}createCamera(e){let t,n;if(e.children.forEach((function(e){const t=Vl.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new v;else{let e=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(e=1);let i=1;void 0!==n.NearPlane&&(i=n.NearPlane.value/1e3);let r=1e3;void 0!==n.FarPlane&&(r=n.FarPlane.value/1e3);let s=window.innerWidth,o=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(s=n.AspectWidth.value,o=n.AspectHeight.value);const a=s/o;let l=45;void 0!==n.FieldOfView&&(l=n.FieldOfView.value);const c=n.FocalLength?n.FocalLength.value:null;switch(e){case 0:t=new y(l,a,i,r),null!==c&&t.setFocalLength(c);break;case 1:t=new w(-s/2,s/2,o/2,-o/2,i,r);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+e+"."),t=new v}}return t}createLight(e){let t,n;if(e.children.forEach((function(e){const t=Vl.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new v;else{let e;e=void 0===n.LightType?0:n.LightType.value;let i=16777215;void 0!==n.Color&&(i=(new a).fromArray(n.Color.value).convertSRGBToLinear());let r=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(r=0);let s=0;void 0!==n.FarAttenuationEnd&&(s=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value);const o=1;switch(e){case 0:t=new Ye(i,r,s,o);break;case 1:t=new He(i,r);break;case 2:let e=Math.PI/3;void 0!==n.InnerAngle&&(e=et.degToRad(n.InnerAngle.value));let a=0;void 0!==n.OuterAngle&&(a=et.degToRad(n.OuterAngle.value),a=Math.max(a,1)),t=new Ve(i,r,s,e,a,o);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new Ye(i,r)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}createMesh(e,t,n){let i,r=null,s=null;const o=[];return e.children.forEach((function(e){t.has(e.ID)&&(r=t.get(e.ID)),n.has(e.ID)&&o.push(n.get(e.ID))})),o.length>1?s=o:o.length>0?s=o[0]:(s=new g({color:13421772}),o.push(s)),"color"in r.attributes&&o.forEach((function(e){e.vertexColors=!0})),r.FBX_Deformer?(i=new tt(r,s),i.normalizeSkinWeights()):i=new u(r,s),i.castShadow=!0,i.receiveShadow=!0,i}createCurve(e,t){const n=e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),i=new p({color:3342591,linewidth:1});return new nt(n,i)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?lc(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,n){if("LookAtProperty"in n){Yl.get(e.ID).children.forEach((function(n){if("LookAtProperty"===n.relationship){const i=Vl.Objects.Model[n.ID];if("Lcl_Translation"in i){const n=i.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(n),Ql.add(e.target)):e.lookAt((new t).fromArray(n))}}}))}}bindSkeleton(e,t,n){const i=this.parsePoseNodes();for(const r in e){const s=e[r];Yl.get(parseInt(s.ID)).parents.forEach((function(e){if(t.has(e.ID)){const t=e.ID;Yl.get(t).parents.forEach((function(e){if(n.has(e.ID)){n.get(e.ID).bind(new it(s.bones),i[e.ID])}}))}}))}}parsePoseNodes(){const e={};if("Pose"in Vl.Objects){const t=Vl.Objects.Pose;for(const n in t)if("BindPose"===t[n].attrType&&t[n].NbPoseNodes>0){const i=t[n].PoseNode;Array.isArray(i)?i.forEach((function(t){e[t.Node]=(new m).fromArray(t.Matrix.a)})):e[i.Node]=(new m).fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in Vl&&"AmbientColor"in Vl.GlobalSettings){const e=Vl.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],i=e[2];if(0!==t||0!==n||0!==i){const e=new a(t,n,i).convertSRGBToLinear();Ql.add(new ze(e,1))}}}}class Zl{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Vl.Objects){const n=Vl.Objects.Geometry;for(const i in n){const r=Yl.get(parseInt(i)),s=this.parseGeometry(r,n[i],e);t.set(parseInt(i),s)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const i=n.skeletons,r=[],s=e.parents.map((function(e){return Vl.Objects.Model[e.ID]}));if(0===s.length)return;const o=e.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null);e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&r.push(n.morphTargets[e.ID])}));const a=s[0],l={};"RotationOrder"in a&&(l.eulerOrder=lc(a.RotationOrder.value)),"InheritType"in a&&(l.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(l.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(l.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(l.scale=a.GeometricScaling.value);const c=ac(l);return this.genGeometry(t,o,r,c)}genGeometry(e,t,n,i){const r=new J;e.attrName&&(r.name=e.attrName);const s=this.parseGeoNode(e,t),o=this.genBuffers(s),a=new Ue(o.vertex,3);if(a.applyMatrix4(i),r.setAttribute("position",a),o.colors.length>0&&r.setAttribute("color",new Ue(o.colors,3)),t&&(r.setAttribute("skinIndex",new rt(o.weightsIndices,4)),r.setAttribute("skinWeight",new Ue(o.vertexWeights,4)),r.FBX_Deformer=t),o.normal.length>0){const e=(new ue).getNormalMatrix(i),t=new Ue(o.normal,3);t.applyNormalMatrix(e),r.setAttribute("normal",t)}if(o.uvs.forEach((function(e,t){let n="uv"+(t+1).toString();0===t&&(n="uv"),r.setAttribute(n,new Ue(o.uvs[t],2))})),s.material&&"AllSame"!==s.material.mappingType){let e=o.materialIndex[0],t=0;if(o.materialIndex.forEach((function(n,i){n!==e&&(r.addGroup(t,i-t,e),e=n,t=i)})),r.groups.length>0){const t=r.groups[r.groups.length-1],n=t.start+t.count;n!==o.materialIndex.length&&r.addGroup(n,o.materialIndex.length-n,e)}0===r.groups.length&&r.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(r,e,n,i),r}parseGeoNode(e,t){const n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(i,r){void 0===n.weightTable[i]&&(n.weightTable[i]=[]),n.weightTable[i].push({id:t,weight:e.weights[r]})}))}))),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,r=!1,s=[],o=[],a=[],l=[],c=[],h=[];const u=this;return e.vertexIndices.forEach((function(d,f){let p,g=!1;d<0&&(d^=-1,g=!0);let m=[],v=[];if(s.push(3*d,3*d+1,3*d+2),e.color){const t=rc(f,n,d,e.color);a.push(t[0],t[1],t[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){v.push(e.weight),m.push(e.id)})),v.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const e=[0,0,0,0],t=[0,0,0,0];v.forEach((function(n,i){let r=n,s=m[i];t.forEach((function(t,n,i){if(r>t){i[n]=r,r=t;const o=e[n];e[n]=s,s=o}}))})),m=e,v=t}for(;v.length<4;)v.push(0),m.push(0);for(let e=0;e<4;++e)c.push(v[e]),h.push(m[e])}if(e.normal){const t=rc(f,n,d,e.normal);o.push(t[0],t[1],t[2])}e.material&&"AllSame"!==e.material.mappingType&&(p=rc(f,n,d,e.material)[0],p<0&&(u.negativeMaterialIndices=!0,p=0)),e.uv&&e.uv.forEach((function(e,t){const i=rc(f,n,d,e);void 0===l[t]&&(l[t]=[]),l[t].push(i[0]),l[t].push(i[1])})),i++,g&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),u.genFace(t,e,s,p,o,a,l,c,h,i),n++,i=0,s=[],o=[],a=[],l=[],c=[],h=[])})),t}genFace(e,t,n,i,r,s,o,a,l,c){for(let h=2;h<c;h++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(h-1)]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(h-1)+2]]),e.vertex.push(t.vertexPositions[n[3*h]]),e.vertex.push(t.vertexPositions[n[3*h+1]]),e.vertex.push(t.vertexPositions[n[3*h+2]]),t.skeleton&&(e.vertexWeights.push(a[0]),e.vertexWeights.push(a[1]),e.vertexWeights.push(a[2]),e.vertexWeights.push(a[3]),e.vertexWeights.push(a[4*(h-1)]),e.vertexWeights.push(a[4*(h-1)+1]),e.vertexWeights.push(a[4*(h-1)+2]),e.vertexWeights.push(a[4*(h-1)+3]),e.vertexWeights.push(a[4*h]),e.vertexWeights.push(a[4*h+1]),e.vertexWeights.push(a[4*h+2]),e.vertexWeights.push(a[4*h+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(h-1)]),e.weightsIndices.push(l[4*(h-1)+1]),e.weightsIndices.push(l[4*(h-1)+2]),e.weightsIndices.push(l[4*(h-1)+3]),e.weightsIndices.push(l[4*h]),e.weightsIndices.push(l[4*h+1]),e.weightsIndices.push(l[4*h+2]),e.weightsIndices.push(l[4*h+3])),t.color&&(e.colors.push(s[0]),e.colors.push(s[1]),e.colors.push(s[2]),e.colors.push(s[3*(h-1)]),e.colors.push(s[3*(h-1)+1]),e.colors.push(s[3*(h-1)+2]),e.colors.push(s[3*h]),e.colors.push(s[3*h+1]),e.colors.push(s[3*h+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(r[0]),e.normal.push(r[1]),e.normal.push(r[2]),e.normal.push(r[3*(h-1)]),e.normal.push(r[3*(h-1)+1]),e.normal.push(r[3*(h-1)+2]),e.normal.push(r[3*h]),e.normal.push(r[3*h+1]),e.normal.push(r[3*h+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(o[n][0]),e.uvs[n].push(o[n][1]),e.uvs[n].push(o[n][2*(h-1)]),e.uvs[n].push(o[n][2*(h-1)+1]),e.uvs[n].push(o[n][2*h]),e.uvs[n].push(o[n][2*h+1])}))}addMorphTargets(e,t,n,i){if(0===n.length)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const r=this;n.forEach((function(n){n.rawTargets.forEach((function(n){const s=Vl.Objects.Geometry[n.geoID];void 0!==s&&r.genMorphGeometry(e,t,s,i,n.name)}))}))}genMorphGeometry(e,t,n,i,r){const s=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],o=void 0!==n.Vertices?n.Vertices.a:[],a=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l);for(let e=0;e<a.length;e++){const t=3*a[e];c[t]=o[3*e],c[t+1]=o[3*e+1],c[t+2]=o[3*e+2]}const h={vertexIndices:s,vertexPositions:c},u=this.genBuffers(h),d=new Ue(u.vertex,3);d.name=r||n.attrName,d.applyMatrix4(i),e.morphAttributes.position.push(d)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Normals.a;let r=[];return"IndexToDirect"===n&&("NormalIndex"in e?r=e.NormalIndex.a:"NormalsIndex"in e&&(r=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:r,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.UV.a;let r=[];return"IndexToDirect"===n&&(r=e.UVIndex.a),{dataSize:2,buffer:i,indices:r,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Colors.a;let r=[];"IndexToDirect"===n&&(r=e.ColorIndex.a);for(let e=0,t=new a;e<i.length;e+=4)t.fromArray(i,e).convertSRGBToLinear().toArray(i,e);return{dataSize:4,buffer:i,indices:r,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const i=e.Materials.a,r=[];for(let e=0;e<i.length;++e)r.push(e);return{dataSize:1,buffer:i,indices:r,mappingType:t,referenceType:n}}parseNurbsGeometry(e){const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new J;const n=t-1,i=e.KnotVector.a,r=[],s=e.Points.a;for(let e=0,t=s.length;e<t;e+=4)r.push((new q).fromArray(s,e));let o,a;if("Closed"===e.Form)r.push(r[0]);else if("Periodic"===e.Form){o=n,a=i.length-1-o;for(let e=0;e<n;++e)r.push(r[e])}const l=new Ut(n,i,r,o,a).getPoints(12*r.length);return(new J).setFromPoints(l)}}class Kl{parse(){const e=[],t=this.parseClips();if(void 0!==t)for(const n in t){const i=t[n],r=this.addClip(i);e.push(r)}return e}parseClips(){if(void 0===Vl.Objects.AnimationCurve)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=Vl.Objects.AnimationCurveNode,t=new Map;for(const n in e){const i=e[n];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){const e={id:i.id,attr:i.attrName,curves:{}};t.set(e.id,e)}}return t}parseAnimationCurves(e){const t=Vl.Objects.AnimationCurve;for(const n in t){const i={id:t[n].id,times:t[n].KeyTime.a.map(nc),values:t[n].KeyValueFloat.a},r=Yl.get(i.id);if(void 0!==r){const t=r.parents[0].ID,n=r.parents[0].relationship;n.match(/X/)?e.get(t).curves.x=i:n.match(/Y/)?e.get(t).curves.y=i:n.match(/Z/)?e.get(t).curves.z=i:n.match(/d|DeformPercent/)&&e.has(t)&&(e.get(t).curves.morph=i)}}}parseAnimationLayers(e){const t=Vl.Objects.AnimationLayer,n=new Map;for(const i in t){const t=[],r=Yl.get(parseInt(i));if(void 0!==r){r.children.forEach((function(n,i){if(e.has(n.ID)){const r=e.get(n.ID);if(void 0!==r.curves.x||void 0!==r.curves.y||void 0!==r.curves.z){if(void 0===t[i]){const e=Yl.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==e){const r=Vl.Objects.Model[e.toString()];if(void 0===r)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",n);const s={modelName:r.attrName?$e.sanitizeNodeName(r.attrName):"",ID:r.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Ql.traverse((function(e){e.ID===r.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))})),s.transform||(s.transform=new m),"PreRotation"in r&&(s.preRotation=r.PreRotation.value),"PostRotation"in r&&(s.postRotation=r.PostRotation.value),t[i]=s}}t[i]&&(t[i][r.attr]=r)}else if(void 0!==r.curves.morph){if(void 0===t[i]){const e=Yl.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,r=Yl.get(e).parents[0].ID,s=Yl.get(r).parents[0].ID,o=Yl.get(s).parents[0].ID,a=Vl.Objects.Model[o],l={modelName:a.attrName?$e.sanitizeNodeName(a.attrName):"",morphName:Vl.Objects.Deformer[e].attrName};t[i]=l}t[i][r.attr]=r}}})),n.set(parseInt(i),t)}}return n}parseAnimStacks(e){const t=Vl.Objects.AnimationStack,n={};for(const i in t){const r=Yl.get(parseInt(i)).children;r.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const s=e.get(r[0].ID);n[i]={name:t[i].attrName,layer:s}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new Be(e.name,-1,t)}generateTracks(e){const i=[];let s=new t,o=new r,a=new t;if(e.transform&&e.transform.decompose(s,o,a),s=s.toArray(),o=(new n).setFromQuaternion(o,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){const t=this.generateVectorTrack(e.modelName,e.T.curves,s,"position");void 0!==t&&i.push(t)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){const t=this.generateRotationTrack(e.modelName,e.R.curves,o,e.preRotation,e.postRotation,e.eulerOrder);void 0!==t&&i.push(t)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){const t=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale");void 0!==t&&i.push(t)}if(void 0!==e.DeformPercent){const t=this.generateMorphTrack(e);void 0!==t&&i.push(t)}return i}generateVectorTrack(e,t,n,i){const r=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(r,t,n);return new st(e+"."+i,r,s)}generateRotationTrack(e,t,i,s,o,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(et.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(et.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(et.degToRad));const l=this.getTimesForAllAxes(t),c=this.getKeyframeTrackValues(l,t,i);void 0!==s&&((s=s.map(et.degToRad)).push(a),s=(new n).fromArray(s),s=(new r).setFromEuler(s)),void 0!==o&&((o=o.map(et.degToRad)).push(a),o=(new n).fromArray(o),o=(new r).setFromEuler(o).invert());const h=new r,u=new n,d=[];for(let e=0;e<c.length;e+=3)u.set(c[e],c[e+1],c[e+2],a),h.setFromEuler(u),void 0!==s&&h.premultiply(s),void 0!==o&&h.multiply(o),h.toArray(d,e/3*4);return new ot(e+".quaternion",l,d)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map((function(e){return e/100})),i=Ql.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new at(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort((function(e,t){return e-t})),t.length>1){let e=1,n=t[0];for(let i=1;i<t.length;i++){const r=t[i];r!==n&&(t[e]=r,n=r,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){const i=n,r=[];let s=-1,o=-1,a=-1;return e.forEach((function(e){if(t.x&&(s=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(a=t.z.times.indexOf(e)),-1!==s){const e=t.x.values[s];r.push(e),i[0]=e}else r.push(i[0]);if(-1!==o){const e=t.y.values[o];r.push(e),i[1]=e}else r.push(i[1]);if(-1!==a){const e=t.z.values[a];r.push(e),i[2]=e}else r.push(i[2])})),r}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const n=e.values[t-1],i=e.values[t]-n,r=Math.abs(i);if(r>=180){const s=r/180,o=i/s;let a=n+o;const l=e.times[t-1],c=(e.times[t]-l)/s;let h=l+c;const u=[],d=[];for(;h<e.times[t];)u.push(h),h+=c,d.push(a),a+=o;e.times=uc(e.times,t,u),e.values=uc(e.values,t,d)}}}}class ql{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new ec,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,i){const r=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);if(r||s)return;const o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):a?t.parseNodeProperty(e,a,n[++i]):l?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)})),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),r={name:n},s=this.parseNodeAttr(i),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,r):n in o?("PoseNode"===n?o.PoseNode.push(r):void 0!==o[n].id&&(o[n]={},o[n][o[n].id]=o[n]),""!==s.id&&(o[n][s.id]=r)):"number"==typeof s.id?(o[n]={},o[n][s.id]=r):"Properties70"!==n&&(o[n]="PoseNode"===n?[r]:r),"number"==typeof s.id&&(r.id=s.id),""!==s.name&&(r.attrName=s.name),""!==s.type&&(r.attrType=s.type),this.pushStack(r)}parseNodeAttr(e){let t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}}parseNodeProperty(e,t,n){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===i&&","===r&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const s=this.getCurrentNode();if("Properties70"!==s.name){if("C"===i){const e=r.split(",").slice(1),t=parseInt(e[0]),n=parseInt(e[1]);let o=r.split(",").slice(3);o=o.map((function(e){return e.trim().replace(/^"/,"")})),i="connections",r=[t,n],function(e,t){for(let n=0,i=e.length,r=t.length;n<r;n++,i++)e[i]=t[n]}(r,o),void 0===s[i]&&(s[i]=[])}"Node"===i&&(s.id=r),i in s&&Array.isArray(s[i])?s[i].push(r):"a"!==i?s[i]=r:s.a=r,this.setCurrentProp(s,i),"a"===i&&","!==r.slice(-1)&&(s.a=cc(r))}else this.parseNodeSpecialProperty(e,i,r)}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=cc(t.a))}parseNodeSpecialProperty(e,t,n){const i=n.split('",').map((function(e){return e.trim().replace(/^"/,"").replace(/\s/,"_")})),r=i[0],s=i[1],o=i[2],a=i[3];let l=i[4];switch(s){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=cc(l)}this.getPrevNode()[r]={type:s,type2:o,flag:a,value:l},this.setCurrentProp(this.getPrevNode(),r)}}class Jl{parse(e){const t=new $l(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const i=new ec;for(;!this.endOfContent(t);){const e=this.parseNode(t,n);null!==e&&i.add(e.name,e)}return i}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},i=t>=7500?e.getUint64():e.getUint32(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const s=e.getUint8(),o=e.getString(s);if(0===i)return null;const a=[];for(let t=0;t<r;t++)a.push(this.parseProperty(e));const l=a.length>0?a[0]:"",c=a.length>1?a[1]:"",h=a.length>2?a[2]:"";for(n.singleProperty=1===r&&e.getOffset()===i;i>e.getOffset();){const i=this.parseNode(e,t);null!==i&&this.parseSubNode(o,n,i)}return n.propertyList=a,"number"==typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==h&&(n.attrType=h),""!==o&&(n.name=o),n}parseSubNode(e,t,n){if(!0===n.singleProperty){const e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if("Connections"===e&&"C"===n.name){const e=[];n.propertyList.forEach((function(t,n){0!==n&&e.push(t)})),void 0===t.connections&&(t.connections=[]),t.connections.push(e)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){let e=n.propertyList[0],i=n.propertyList[1];const r=n.propertyList[2],s=n.propertyList[3];let o;0===e.indexOf("Lcl ")&&(e=e.replace("Lcl ","Lcl_")),0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),o="Color"===i||"ColorRGB"===i||"Vector"===i||"Vector3D"===i||0===i.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:i,type2:r,flag:s,value:o}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),r=e.getUint32(),s=e.getUint32();if(0===r)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const o=kt.unzlibSync(new Uint8Array(e.getArrayBuffer(s))),a=new $l(o.buffer);switch(t){case"b":case"c":return a.getBooleanArray(i);case"d":return a.getFloat64Array(i);case"f":return a.getFloat32Array(i);case"i":return a.getInt32Array(i);case"l":return a.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class $l{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return 1==(1&this.getUint8())}getBooleanArray(e){const t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,e=4294967295&~e,4294967295===e&&(t=t+1&4294967295),e=e+1&4294967295,-(4294967296*t+e)):4294967296*t+e}getInt64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const i=n.indexOf(0);return i>=0&&(n=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(n)}}class ec{add(e,t){this[e]=t}}function tc(e){const t=e.match(/FBXVersion: (\d+)/);if(t){return parseInt(t[1])}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function nc(e){return e/46186158e3}const ic=[];function rc(e,t,n,i){let r;switch(i.mappingType){case"ByPolygonVertex":r=e;break;case"ByPolygon":r=t;break;case"ByVertice":r=n;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}"IndexToDirect"===i.referenceType&&(r=i.indices[r]);const s=r*i.dataSize,o=s+i.dataSize;return function(e,t,n,i){for(let r=n,s=0;r<i;r++,s++)e[s]=t[r];return e}(ic,i.buffer,s,o)}const sc=new n,oc=new t;function ac(e){const i=new m,r=new m,s=new m,o=new m,a=new m,l=new m,c=new m,h=new m,u=new m,d=new m,f=new m,p=new m,g=e.inheritType?e.inheritType:0;if(e.translation&&i.setPosition(oc.fromArray(e.translation)),e.preRotation){const t=e.preRotation.map(et.degToRad);t.push(e.eulerOrder||n.DEFAULT_ORDER),r.makeRotationFromEuler(sc.fromArray(t))}if(e.rotation){const t=e.rotation.map(et.degToRad);t.push(e.eulerOrder||n.DEFAULT_ORDER),s.makeRotationFromEuler(sc.fromArray(t))}if(e.postRotation){const t=e.postRotation.map(et.degToRad);t.push(e.eulerOrder||n.DEFAULT_ORDER),o.makeRotationFromEuler(sc.fromArray(t)),o.invert()}e.scale&&a.scale(oc.fromArray(e.scale)),e.scalingOffset&&c.setPosition(oc.fromArray(e.scalingOffset)),e.scalingPivot&&l.setPosition(oc.fromArray(e.scalingPivot)),e.rotationOffset&&h.setPosition(oc.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(oc.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(f.copy(e.parentMatrix),d.copy(e.parentMatrixWorld));const v=r.clone().multiply(s).multiply(o),y=new m;y.extractRotation(d);const w=new m;w.copyPosition(d);const b=w.clone().invert().multiply(d),A=y.clone().invert().multiply(b),x=a,S=new m;if(0===g)S.copy(y).multiply(v).multiply(A).multiply(x);else if(1===g)S.copy(y).multiply(A).multiply(v).multiply(x);else{const e=(new m).scale((new t).setFromMatrixScale(f)).clone().invert(),n=A.clone().multiply(e);S.copy(y).multiply(v).multiply(n).multiply(x)}const E=u.clone().invert(),T=l.clone().invert();let D=i.clone().multiply(h).multiply(u).multiply(r).multiply(s).multiply(o).multiply(E).multiply(c).multiply(l).multiply(a).multiply(T);const C=(new m).copyPosition(D),I=d.clone().multiply(C);return p.copyPosition(I),D=p.clone().multiply(S),D.premultiply(d.invert()),D}function lc(e){const t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function cc(e){return e.split(",").map((function(e){return parseFloat(e)}))}function hc(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,n))}function uc(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}const dc=()=>{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}}},fc=()=>{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}}}},pc=()=>{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 ]")}},gc="\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",mc="textureIndex.json";class vc 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 Pt(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=Mn(t),i=this._createMesh(n.value,e),r=new qe;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 Wn(e)&&e/1024/1024<=500&&zn((()=>{this.store.setItem(`${t}_object`,n)})),n}}}_initWorkerCreator(){if(!this.workerSourceURL){const e=dc.toString(),t=fc.toString(),n=pc.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 */",gc].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),vn(`sbmx material: not found uuid: ${n} in file: ${t+mc}`)}const p=new u(f,this.loadedMaterials);return p.castShadow=!0,p.receiveShadow=!0,p}async _createMaterial(e){const t=Mn(e),n=t+mc,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=Ln(n).then((e=>e.json()));this.loadedTextures.set(n,i),s=await i,zn((()=>{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=lt,e.magFilter=U,e.needsUpdate=!0,y.map=e,y.needsUpdate=!0,fl.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,fl.needsUpdate=!0}))}const w=this.loadedMaterials.push(y)-1;this.loadedMaterialsMap.set(n,{material:y,materialIndex:w})}))}dispose(){this.workerPool.dispose(),URL.revokeObjectURL(this.workerSourceURL)}}const yc=new Map,wc=e=>{var t;return null!==(t=null==e?void 0:e.toLowerCase().endsWith(".png"))&&void 0!==t&&t},bc=e=>{if(yc.has(e))return yc.get(e);const t=new l;return yc.set(e,t),(new ct).load(e,(e=>{t.image=e,t.needsUpdate=!0,fl.needsUpdate=!0})),t.encoding=T,t.wrapS=N,t.wrapT=N,t.flipY=!1,t.anisotropy=16,t.mipmaps=[],t.generateMipmaps=!0,t},Ac=(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 xc 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 Sc=new TextDecoder;new TextDecoder;class Ec{constructor(){this.materials=new Map}parseObject(e,t){const n=new El(Object.assign(Object.assign({},t),{format:"sbm"})),i=new Al({id:$n()});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=bc(n));const s=Ac(e,i,r,wc(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 yl(t,a,{id:`${e}_${$n()}`,name:n||e});i.add(c)}}return n}}var Tc=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 xc(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 El(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new Al({id:$n()});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=bc(a)}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=Ac(t,e,c,wc(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 b;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=[],w=[];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 b,o=new b,a=new b;const l=f[e];void 0!==l&&(s=l[0],o=l[1],a=l[2]),w.push(...s.toArray(),...o.toArray(),...a.toArray())}const A=new Float32Array(y),x=new Float32Array(w);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 yl(S,E,{id:`${o}_${$n()}`,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 El(Object.assign(Object.assign({},this.sbmInfo),{format:"sbm"})),a=new Al({id:$n()});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=bc(a)}if(!this.materials.has(t)){const e=[n,r,s,o,a],i=Ac(t,e,c,wc(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=Sc.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 b;t.setX(e.getSoonFloat32(i)),i+=4,t.setY(e.getSoonFloat32(i)),i+=4,f.push(t)}const w=e.getSoonUint32(i);if(i+=4,w>0)for(let t=0;t<w;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 b,o=new b,a=new b;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 yl(T,this.materials.get(h),{id:`${o}_${$n()}`,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 Dc extends Fl{constructor(e,t){super(ln,e,t),this.viewport=e,this.isDisposed=!1,this.modelsPromiseMap=new Map,this.modelsMap=new Map,this.store=Gl.createInstance({name:"soonspace",storeName:"modelData"}),this.cacheStore=Gl.createInstance({name:"soonspace",storeName:"modelCache"}),this.loadingManager=new k,this.datLoader=new vc(this.cacheStore),this.gltfLoader=new Lt(this.loadingManager),this.fbxLoader=new Wl(this.loadingManager),this.dracoDecoderPath=null,this._initLoadingManager(this.loadingManager)}setDracoDecoderPath(e){this.dracoDecoderPath=e;const t=new Nt;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 vn(`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 vn(`模型资源( 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 w=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 tt){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);w.animations=w.animations.map((e=>e.clone())),o&&(w.sid=o),a&&(w.name=a),l&&(w.level=l),!1===c&&w.hide(),h&&w.position.set(h.x,h.y,h.z),u&&w.rotation.set(u.x,u.y,u.z),d&&w.scale.set(d.x,d.y,d.z),w.onClick=f?f.bind(w):null,w.onDblClick=p?p.bind(w):null,w.onRightClick=g?g.bind(w):null,w.onLoad=m?m.bind(w):null,null===(s=w.onLoad)||void 0===s||s.call(w,w),v&&(w.userData=v),null!==n&&this.viewport.scener.addObject(w,n||this.scene||e.parent),i(w)}))}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 _t)}_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 Tc).parseBuffer(t,e),{model:r,caches:s}=i;return s&&zn((()=>{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 Ec).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 El(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=Mn(n),r=t||await this._getBuffer(n),s=new El(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=Mn(t),i=await this._getBuffer(t),r=new El(Object.assign(Object.assign({},e),{format:"gltf"})),s=this.fbxLoader.parse(i,n),{animations:o}=s;return o&&o.length>0&&(r.animations=o),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 Ln(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 Cc extends Fl{constructor(e,t){super(cn,e,t),this.materials=new Map}create(e){const t=this._createMaterial(e.url),n=new Cl(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),Qn(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 Cl(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 Cl(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)&&(Xn(e.material)?e.material=e.material.map((e=>e.clone())):e.material instanceof ee&&(e.material=e.material.clone()))}))}}class Ic extends Fl{constructor(e,t){super(hn,e,t)}create(e){this._openEnableRenderCss(e);const t=new Sl(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 Sl(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 Sl(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 Bc extends Fl{constructor(e,t){super(un,e,t)}create(e){const t=new kl(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 kl(e);n.add(t)})),this.viewport.scener.addObject(n,this.scene),n}addForGroup(e,t){return e&&(t.forEach((t=>{const n=new kl(t);e.add(n)})),this.viewport.scener.addObject(e,this.scene)),e}}class Mc{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 Cn;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 Oc extends Fl{constructor(e,t){super(dn,e,t),this.dijkstra=new Mc}async createFromGml(e){const{url:t,linkWidth:n=20,linkColor:i=65280,renderNode:r=!0,nodeColor:s=255}=e;return Gn(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;Xn(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:Yn(n)?n:"",name:Yn(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 Pl(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 Pl(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 Pl(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 Pl(n);this.setDijkstraGraph(i.nodes),e.add(i)})),e}getShortestPath(e,n){const i=On(e.info.nodes),r=yn(n.start),s=yn(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+=$n(),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 Pl(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=yn(e),n=yn(i.end);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=yn(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?yn(o.position).distanceTo(t):yn(o.position).distanceTo(yn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(yn(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 Pl(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=yn(i.start),n=yn(e);let r=null,a=1/0,l=null,c=1/0;if(s.forEach((e=>{if(e.graphs.length>0){const i=yn(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?yn(o.position).distanceTo(t):yn(o.position).distanceTo(yn(r[r.length-1].position)),r.push(o))})),r.push({id:"endPoint",position:n,graphs:[]}),e+=n.distanceTo(yn(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 Pl(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 Pc extends Fl{constructor(e,t){super(fn,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 ht(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 ut(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 dt(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 yl(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 Ul(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 ft(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 pt(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 gt(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 mt(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 jt(n,i);return r.userData.sid=t,r.userData.stype="Helper",this.viewport.scener.addObject(r,this.scene),r}}class Rc extends Fl{constructor(e,t){super(pn,e,t)}createObject(e,t){const n=new xl(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 _c extends Fl{constructor(e,t){super(on,e,t)}}class Lc{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 _c(e,this.scene),lightManager:new zl(e,this.scene),modelManager:new Dc(e,this.scene),poiManager:new Cc(e,this.scene),poiNodeManager:new Ic(e,this.scene),canvas3DManager:new Bc(e,this.scene),topologyManager:new Oc(e,this.scene),helperManager:new Pc(e,this.scene),pluginObjectManager:new Rc(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&&(Wn(s)||Wn(o))){const n=this.viewport.camera.position.distanceTo(t.position);Wn(s)&&n>s||Wn(o)&&n<o?e(t,!1):e(t,!0)}};this.scene.traverse((e=>{(e instanceof bl||e instanceof yl)&&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)&&Zn(i)&&(i instanceof bl||i instanceof yl||i.userData.stype)&&(Kn(e)&&e(i.userData)||Yn(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 bl||i instanceof yl)&&Zn(i)&&i[e]===t||Zn(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&&vn(`object id ${t} already exists in scene`)};null==e||e.traverse((n=>{if(n instanceof bl||n instanceof yl){if("string"==typeof n.sid&&n.sid.startsWith(sn))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 bl||t instanceof yl){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 Nc(e){const t=kc(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 b(t.x,t.y)})),a=new Fe(o),l=new je(a),c=new vt;c.setFromPoints(o);const h=Uc(c);return l.getAttribute("uv").applyMatrix3(h),l.applyMatrix4(n),{geometry:l,polygonBox:c,modelMatrix:n,planeMatrix:r,projectionMatrix:s,position:i}}function kc(e){const[n,i,r]=e,s=new yt;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 Uc(e){const t=e.min,n=e.getSize(new b),i=new ue;return i.elements=[n.x,0,0,0,n.y,0,t.x,t.y,1],i.invert()}function jc(e,t){const n=Fc(t);return e.intersectsBox(n)}function Fc(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 zc(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 wt(e):new pe(e)}function Hc(e,t,n,i){const r=e.map,s=zc(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 Gc(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=>jc(d,e)))}}function Vc(e,n){const i=new S(new t,e);return function(e){return i.center.copy(e),n.filter((e=>jc(i,e)))}}function Yc(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 bt(n,i);r.push(s)}const s=new S(new t,n);return function(e){return e.filter((e=>{const n=Fc(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 Qc(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=ui(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:zc(n,null==p||p,t)}):g,y=l?new At(v):new xe(v),w=new yl(m,y,{id:c,name:h,userData:u,level:d,visible:f});return o&&w.position.set(o.x,o.y,o.z),a&&w.rotation.set(a.x,a.y,a.z),w}function Wc(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=ui(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:zc(r,null==d||d,n)}):f,m=o?new At(g):new xe(g),{geometry:v,position:y}=Nc(p),w=new yl(v,m,{id:a,name:l,userData:c,level:h,visible:u});return w.position.copy(y),w}e.ColorManagement.enabled=!0,e.ColorManagement.legacyMode=!1;class Xc{constructor(t){this.THREE=e,this.TWEEN=rn,this.utils=ti,this.version=Ht,this.animation=ii,this.library=jl,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 vl(this.options),this.signals=this.viewport.signals,this.manager=new Lc(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){mn(" ____ ____ _ \n / ___| ___ ___ _ __ / ___| _ __ __ _ ___ ___ (_)___ \n \\___ \\ / _ \\ / _ \\| '_ \\\\___ \\| '_ \\ / _` |/ __/ _ \\ | / __| \n ___) | (_) | (_) | | | |___) | |_) | (_| | (_| __/_ | \\__ \\ \n |____/ \\___/ \\___/|_| |_|____/| .__/ \\__,_|\\___\\___(_)/ |___/ \n |_| |__/ \n",{color:"#3eaf7c"}),mn(zt,{color:"#3eaf7c","font-size":"24px"}),mn(`当前版本: ${this.version}`,{color:"#3eaf7c","font-size":"12px"}),mn("文档: http://www.xwbuilders.com:8800",{color:"#3eaf7c","font-size":"12px"}),mn("样例: http://www.xwbuilders.com:8800/examples",{color:"#3eaf7c","font-size":"12px"}),mn("GitHub: https://github.com/soonspacejs",{color:"#3eaf7c","font-size":"12px"})}e&&this.addGridHelper(!0===e?{id:"defaultGridHelper"}:e),(null==t?void 0:t.skyBox)?Yn(null==t?void 0:t.skyBox)?this.setSphereSkyBackground(null==t?void 0:t.skyBox):Zn(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 vn("getPluginObjectById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPluginObjectByName(e){return vn("getPluginObjectByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}removePluginObjectById(e){return vn("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 vn("getLightById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeLightById(e){return vn("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 vn("getGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getGroupByName(e){return vn("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 vn("removeGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}loadSbm(e){return vn("loadSbm is deprecated, use loadModel instead"),this.loadModel(e)}parseSbm(){vn("parseSbm is deprecated!")}cloneSbm(e,t,n){return vn("cloneSbm is deprecated, use cloneModel instead"),this.cloneModel(e,t,n)}getSbmById(e){return vn("getSbmById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmByName(e){return vn("getSbmByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getSbmByUserDataProperty(e,t){return vn("getSbmByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeSbmById(e){return vn("removeSbmById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForSbm(e){return vn("createGroupForSbm is deprecated, use createGroup instead"),this.createGroup(e)}loadSbmToGroup(e,t){return vn("loadSbmToGroup is deprecated, use loadModelToGroup instead"),this.loadModelToGroup(e,t)}addSbmForGroup(e,t){return vn("addSbmForGroup is deprecated, use addModelForGroup instead"),this.addModelForGroup(e,t)}createSbmGroupFromXml(){vn("createGroupForSbm is deprecated!")}getSbmGroupById(e){return vn("getSbmGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getSbmGroupByName(e){return vn("getSbmGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllSbmGroup(){return vn("getAllSbmGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeSbmGroupById(e){return vn("removeSbmGroupById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}clearSbm(){return vn("clearSbm is deprecated, use clearModel instead"),this.clearModel()}getAllSbm(){return vn("getAllSbm is deprecated, use getAllModel instead"),this.getAllModel()}showAllSbm(){return vn("showAllSbm is deprecated, use showAllModel instead"),this.showAllModel()}hideAllSbm(){return vn("hideAllSbm is deprecated, use hideAllModel instead"),this.hideAllModel()}getSbmModelMaps(){return vn("getSbmModelMaps is deprecated, use getModelsMap instead"),this.getModelsMap()}setSbmModelMaps(e){return vn("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 vn("getModelById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelByName(e){return vn("getModelByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getModelByUserDataProperty(e,t){return vn("getModelByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeModelById(e){return vn("removeModelById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForModel(e){return vn("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 vn("getModelGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getModelGroupByName(e){return vn("getModelGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllModelGroup(){return vn("getAllModelGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeModelGroupById(e){return vn("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 vn("getPoiById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiByName(e){return vn("getPoiByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiByUserDataProperty(e,t){return vn("getPoiByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiById(e){return vn("removePoiById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoi(e){return vn("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 vn("getPoiGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiGroupByName(e){return vn("getPoiGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiGroup(){return vn("getAllPoiGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiGroupById(e){return vn("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 vn("getPoiNodeById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeByName(e){return vn("getPoiNodeByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getPoiNodeByUserDataProperty(e,t){return vn("getPoiNodeByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removePoiNodeById(e){return vn("removePoiNodeById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForPoiNode(e){return vn("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 vn("getPoiNodeGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getPoiNodeGroupByName(e){return vn("getPoiNodeGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllPoiNodeGroup(){return vn("getAllPoiNodeGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removePoiNodeGroupById(e){return vn("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=Qc(e,this.textureCache);return this.addObject(t),t}createPolygonPoiMesh(e){const t=Wc(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=Hc(s,t,i,this.textureCache);return this.render(),o}createCanvas3D(e){return this.manager.store.canvas3DManager.create(e)}getCanvas3DById(e){return vn("getCanvas3DById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DByName(e){return vn("getCanvas3DByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getCanvas3DByUserDataProperty(e,t){return vn("getCanvas3DByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeCanvas3DById(e){return vn("removeCanvas3DById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForCanvas3D(e){return vn("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 vn("getCanvas3DGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getCanvas3DGroupByName(e){return vn("getCanvas3DGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllCanvas3DGroup(){return vn("getAllCanvas3DGroup is deprecated, use getAllGroup instead"),this.getAllGroup()}removeCanvas3DGroupById(e){return vn("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 vn("getTopologyById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyByName(e){return vn("getTopologyByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getTopologyByUserDataProperty(e,t){return vn("getTopologyByUserDataProperty is deprecated, use getObjectByUserDataProperty instead"),this.getObjectByUserDataProperty(e,t)}removeTopologyById(e){return vn("removeTopologyById is deprecated, use removeObjectById instead"),this.removeObjectById(e)}createGroupForTopology(e){return vn("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 vn("getTopologyGroupById is deprecated, use getObjectById instead"),this.getObjectById(e)}getTopologyGroupByName(e){return vn("getTopologyGroupByName is deprecated, use getObjectByName instead"),this.getObjectByName(e)}getAllTopologyGroup(){return vn("getAllTopologyGroup is deprecated, use getAllGroups instead"),this.getAllGroup()}removeTopologyGroupById(e){return vn("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 vn("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 vn("getHelperById is deprecated, use getObjectById instead"),this.getObjectById(e)}removeHelperById(e){return vn("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 Gc(e,t)}createFindObjectsInSphereNearPosition(e,t){return Vc(e,t)}createFindObjectsNearPath(e,t){return Yc(e,t)}createPathAnimation(e,t,n){return new ri(e,t,n)}createTopologyAnimation(e,n,i){const r=n.nodes.map((e=>e.getWorldPosition(new t)));return new ri(e,r,i)}}Xc.THREE=e,Xc.TWEEN=rn,Xc.utils=ti;export{Xc as SoonSpace,jc as boundingIsIntersected,Gc as createFindObjectsInBoxNearPosition,Vc as createFindObjectsInSphereNearPosition,Yc as createFindObjectsNearPath,kc as createPlaneMatrix,Qc as createPoiMesh,Wc as createPolygonPoiMesh,zc as createTexture,Uc as createUVMatrix,Xc as default,Fc as getBoundingBox,Nc as getPolygonGeometryInfo,Hc as setTexture};