soonspacejs 2.8.3 → 2.8.5
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 +1 -1
- package/package.json +4 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as e from"three";import{Vector3 as t,Vector4 as n,Vector2 as i,Euler as r,Box3 as s,Scene as o,Quaternion as a,CubeTextureLoader as l,HalfFloatType as c,EquirectangularReflectionMapping as u,TextureLoader as d,Color as h,Texture as f,FileLoader as p,Matrix4 as m,BufferAttribute as g,BufferGeometry as v,Float32BufferAttribute as y,LineBasicMaterial as w,Line as b,Line3 as x,MathUtils as A,CurvePath as S,LineCurve as E,LineCurve3 as T,Bone as D,Uint16BufferAttribute as C,SkinnedMesh as I,Skeleton as M,AnimationClip as B,VectorKeyframeTrack as P,QuaternionKeyframeTrack as O,Object3D as R,InterpolateLinear as L,InterpolateDiscrete as k,EventDispatcher as N,LoopPingPong as F,Fog as z,Mesh as U,LineSegments as j,EdgesGeometry as G,MeshStandardMaterial as H,PerspectiveCamera as V,OrthographicCamera as Q,WebGLRenderer as _,PCFSoftShadowMap as Y,Sphere as W,REVISION as X,Camera as Z,BasicDepthPacking as K,UnsignedByteType as q,DepthTexture as J,DepthStencilFormat as $,UnsignedInt248Type as ee,UnsignedIntType as te,WebGLRenderTarget as ne,Uniform as ie,RepeatWrapping as re,LoadingManager as se,NearestFilter as oe,LinearFilter as ae,ShaderMaterial as le,NoBlending as ce,RGBADepthPacking as ue,BackSide as de,DoubleSide as he,FrontSide as fe,MeshDepthMaterial as pe,LinearEncoding as me,sRGBEncoding as ge,Material as ve,DataTexture as ye,NoColorSpace as we,WebGLMultipleRenderTargets as be,RedFormat as xe,FloatType as Ae,RGBAFormat as Se,ShaderChunk as Ee,WebGLCubeRenderTarget as Te,CubeCamera as De,PMREMGenerator as Ce,FramebufferTexture as Ie,Matrix3 as Me,TangentSpaceNormalMap as Be,GLSL3 as Pe,VideoTexture as Oe,GLBufferAttribute as Re,InterleavedBufferAttribute as Le,Frustum as ke,MOUSE as Ne,TOUCH as Fe,Spherical as ze,Raycaster as Ue,Clock as je,AnimationMixer as Ge,SRGBColorSpace as He,LinearSRGBColorSpace as Ve,UVMapping as Qe,ACESFilmicToneMapping as _e,CubeTexture as Ye,NoToneMapping as We,LinearToneMapping as Xe,ReinhardToneMapping as Ze,CineonToneMapping as Ke,Sprite as qe,SpriteMaterial as Je,SphereGeometry as $e,CircleGeometry as et,ShapeGeometry as tt,Shape as nt,AmbientLight as it,DirectionalLight as rt,HemisphereLight as st,SpotLight as ot,PointLight as at,RectAreaLight as lt,Loader as ct,LoaderUtils as ut,ClampToEdgeWrapping as dt,Group as ht,PropertyBinding as ft,NumberKeyframeTrack as pt,LinearMipMapLinearFilter as mt,ImageLoader as gt,InstancedMesh as vt,GridHelper as yt,AxesHelper as wt,Box3Helper as bt,PlaneGeometry as xt,MeshBasicMaterial as At,DirectionalLightHelper as St,HemisphereLightHelper as Et,SpotLightHelper as Tt,PointLightHelper as Dt,Box2 as Ct,Plane as It,CanvasTexture as Mt,MeshPhongMaterial as Bt}from"three";export*from"three";import{RGBELoader as Pt}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as Ot}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Rt}from"three/examples/jsm/environments/RoomEnvironment.js";import Lt from"three/examples/jsm/libs/stats.module.js";import{Sky as kt}from"three/examples/jsm/objects/Sky.js";import{mergeGeometries as Nt,deinterleaveGeometry as Ft}from"three/examples/jsm/utils/BufferGeometryUtils.js";import"three/examples/jsm/postprocessing/Pass.js";import{WorkerPool as zt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Ut,computeBoundsTree as jt,disposeBoundsTree as Gt,acceleratedRaycast as Ht}from"three-mesh-bvh";import{RectAreaLightUniformsLib as Vt}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as Qt}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as _t}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Yt}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Wt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Xt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Zt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Kt="soonspacejs",qt="2.8.3",Jt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function $t(){throw new Error("setTimeout has not been defined")}function en(){throw new Error("clearTimeout has not been defined")}var tn=$t,nn=en;function rn(e){if(tn===setTimeout)return setTimeout(e,0);if((tn===$t||!tn)&&setTimeout)return tn=setTimeout,setTimeout(e,0);try{return tn(e,0)}catch(t){try{return tn.call(null,e,0)}catch(t){return tn.call(this,e,0)}}}"function"==typeof Jt.setTimeout&&(tn=setTimeout),"function"==typeof Jt.clearTimeout&&(nn=clearTimeout);var sn,on=[],an=!1,ln=-1;function cn(){an&&sn&&(an=!1,sn.length?on=sn.concat(on):ln=-1,on.length&&un())}function un(){if(!an){var e=rn(cn);an=!0;for(var t=on.length;t;){for(sn=on,on=[];++ln<t;)sn&&sn[ln].run();ln=-1,t=on.length}sn=null,an=!1,function(e){if(nn===clearTimeout)return clearTimeout(e);if((nn===en||!nn)&&clearTimeout)return nn=clearTimeout,clearTimeout(e);try{return nn(e)}catch(t){try{return nn.call(null,e)}catch(t){return nn.call(this,e)}}}(e)}}function dn(e,t){this.fun=e,this.array=t}dn.prototype.run=function(){this.fun.apply(null,this.array)};function hn(){}var fn=hn,pn=hn,mn=hn,gn=hn,vn=hn,yn=hn,wn=hn;var bn=Jt.performance||{},xn=bn.now||bn.mozNow||bn.msNow||bn.oNow||bn.webkitNow||function(){return(new Date).getTime()};var An=new Date;var Sn,En={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];on.push(new dn(e,t)),1!==on.length||an||rn(un)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:fn,addListener:pn,once:mn,off:gn,removeListener:vn,removeAllListeners:yn,emit:wn,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*xn.call(bn),n=Math.floor(t),i=Math.floor(t%1*1e9);return e&&(n-=e[0],(i-=e[1])<0&&(n--,i+=1e9)),[n,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-An)/1e3}},Tn={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-Tn.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*Tn.Bounce.In(2*e):.5*Tn.Bounce.Out(2*e-1)+.5}}},Dn="undefined"==typeof self&&void 0!==En&&En.hrtime?function(){var e=En.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()},Cn=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=Dn()),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}(),In={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=In.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=In.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=In.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=In.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(Sn=[1],function(e){var t=1;if(Sn[e])return Sn[e];for(var n=e;n>1;n--)t*=n;return Sn[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}}},Mn=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Bn=new Cn,Pn=function(){function e(e,t){void 0===t&&(t=Bn),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=Tn.Linear.None,this._interpolationFunction=In.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Mn.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?Dn()+parseFloat(e):e:Dn(),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 u in t[r]=o?[]:{},s)t[r][u]=s[u];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=Dn()),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=Dn()),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=Dn()),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}(),On=Mn.nextId,Rn=Bn,Ln=Rn.getAll.bind(Rn),kn=Rn.removeAll.bind(Rn),Nn=Rn.add.bind(Rn),Fn=Rn.remove.bind(Rn),zn=Rn.update.bind(Rn),Un={Easing:Tn,Group:Cn,Interpolation:In,now:Dn,Sequence:Mn,nextId:On,Tween:Pn,VERSION:"18.6.4",getAll:Ln,removeAll:kn,add:Nn,remove:Fn,update:zn};var jn,Gn=(e=>(e[e.x=0]="x",e[e.y=1]="y",e[e.z=2]="z",e))(Gn||{});(jn=Gn||(Gn={})).toKey=function(e){return jn[e]},jn.toIndex=function(e){return jn[e]},jn.getCrossAxiss=function(e){return[(e+1)%3,(e+2)%3]};var Hn=(e=>(e[e.x=0]="x",e[e.y=1]="y",e[e.z=2]="z",e[e.w=3]="w",e))(Hn||{});(e=>{e.toKey=function(t){return e[t]},e.toIndex=function(t){return e[t]},e.getCrossAxiss=function(e){return[(e+1)%4,(e+2)%4]}})(Hn||(Hn={}));var Vn=Object.defineProperty,Qn=(e,t,n)=>(((e,t,n)=>{t in e?Vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function _n(e,r,s){const o=(s=s??0)+1;if(function(e){var t=typeof e;return null==e||"object"!==t&&"function"!==t}(e))return e;if(null!=e.x&&null!=e.y)return function(e){return null!=e.w?(new n).copy(e):null!=e.z?(new t).copy(e):(new i).copy(e)}(e);if(Array.isArray(e))return e.map((e=>_n(e,r,o)));if(e instanceof Map){const t=new Map;for(const n of e.keys()){const i=_n(e.get(n),r,o);t.set(n,i)}return t}if(function(e){return e&&"function"==typeof e[Symbol.iterator]}(e)){const t=[];for(const n of e){const e=_n(n,r,o);t.push(e)}return t}if((r||0===s)&&"object"==typeof e){const t={};for(const n of Object.keys(e))t[n]=_n(e[n],r,o);return t}return e}function Yn(e,t,n){let i=function(e,t){const n=Math.sqrt(e.lengthSq()*t.lengthSq());if(0===n)return 0;let i=e.dot(t)/n;return i=Math.max(-1,Math.min(1,i)),Math.acos(i)}(e,t);return 0===i?i:e.clone().cross(t).dot(n)<0?-i:i}const Wn=180/Math.PI,Xn={yaw:[{name:"前",range:[-15,15]},{name:"左",range:[15,165]},{name:"右",range:[-165,-15]},{name:"后",range:[-180.1,-165]},{name:"后",range:[165,180.1]}],pitch:[{name:"前",range:[-15,15]},{name:"上",range:[15,165]},{name:"下",range:[-165,-15]},{name:"后",range:[-180.1,-165]},{name:"后",range:[165,180.1]}],roll:[{name:"上",range:[-15,15]},{name:"左",range:[15,165]},{name:"右",range:[-165,-15]},{name:"下",range:[-180.1,-165]},{name:"下",range:[165,180.1]}]};const Zn={degrees:!0,map:Xn,front:{x:0,y:0,z:1},up:{x:0,y:1,z:0}};class Kn{constructor(e){Qn(this,"_options"),Qn(this,"_listMap"),Qn(this,"_front"),Qn(this,"_up"),e&&(this.options=e)}static get options(){return this._options??(this.options=Zn)}static set options(e){this._options=Object.assign({},structuredClone(Xn),e)}get defaultOptions(){return this.constructor.options}get options(){return this._options??(this.options=this.defaultOptions)}set options(e){this._options=Object.assign({},structuredClone(this.defaultOptions),e),this._listMap=null,this._front=null,this._up=null}get degrees(){return this.options.degrees??(this.options.degrees=this.defaultOptions.degrees??!0)}set degrees(e){this.options.degrees=e}get map(){return this.options.map||(this.map=this.defaultOptions.map),this.options.map}set map(e){const t=structuredClone(this.defaultOptions.map),n=structuredClone(Xn);e=e?{yaw:e.yaw??t.yaw??n.yaw,pitch:e.pitch??t.pitch??n.pitch,roll:e.roll??t.roll??n.roll}:t,this.options.map=e,this._listMap=null}get listMap(){return this._listMap??(this._listMap=function(e){const t={};for(const[n,i]of Object.entries(e))t[n]=Array.isArray(i)?i:Object.entries(i).map((([e,t])=>({name:e,range:t})));return t}(this.map??{}))}get front(){return this._front||(this.front=this.options.front??this.defaultOptions.front??Zn.front),this._front}set front(e){this._front=(new t).copy(e)}get up(){return this._up||(this.up=this.options.up??this.defaultOptions.up??Zn.up),this._up}set up(e){this._up=(new t).copy(e)}computeAzimuth(e,n,i){const r=(new t).copy(e),s=(new t).copy(n??this.front),o=(new t).copy(i??this.up);let{yaw:a,pitch:l,roll:c}=function(e,t,n){const i=t.clone().negate(),r=n.clone().projectOnPlane(t),s=Yn(t,e.clone().projectOnPlane(r),r),o=t.clone().cross(r);return{yaw:s,pitch:Yn(t,e.clone().projectOnPlane(o),o),roll:Yn(r,e.clone().projectOnPlane(i),i)}}(r,s,o);return this.degrees&&(a*=Wn,l*=Wn,c*=Wn),{yaw:{angle:a,name:this.findAzimuthNames("yaw",a)},pitch:{angle:l,name:this.findAzimuthNames("pitch",l)},roll:{angle:c,name:this.findAzimuthNames("roll",c)}}}findAzimuthNames(e,t){const n=[],i=this.listMap[e];if(!i)return n;for(const{name:e,range:[r,s]}of i)(t>=r&&t<s||t<=r&&t>s)&&n.push(e);return n}}Qn(Kn,"_options"),new Kn;const qn="[soonspacejs]: ";var Jn;!function(e){e.GROUP_MANAGE_TYPE="Group",e.LIGHT_MANAGE_TYPE="Light",e.MODEL_MANAGE_TYPE="Model",e.POI_MANAGE_TYPE="Poi",e.POI_NODE_MANAGE_TYPE="PoiNode",e.CANVAS3D_MANAGE_TYPE="Canvas3D",e.TOPOLOGY_MANAGE_TYPE="Topology",e.HELPER_MANAGE_TYPE="Helper",e.PLUGIN_OBJECT_MANAGE_TYPE="PluginObject"}(Jn||(Jn={}));const $n="In soonspacejs: ",ei=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},ti=e=>{console.warn($n+e)},ni=e=>{console.error($n+e)};function ii(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function ri(e){return e instanceof r?e:new r(e.x,e.y,e.z)}function si(e){const t=new s;return e instanceof o?e.children.filter((e=>!("isTransformControls"in e))).reduce(((e,t)=>e.union((new s).setFromObject(t))),t):t.setFromObject(e),t.isEmpty()&&(e.getWorldPosition(t.min),t.max.copy(t.min)),t}function oi(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 ai(e,t){const n=oi("x",e,t),i=oi("y",e,t),s=oi("z",e,t);return new r(n.x,i.y,s.z,t.order)}function li(e){return Math.PI/180*e}function ci(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new r).setFromQuaternion(e.getWorldQuaternion(new a)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function ui(e,t){const n=ci(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 di(e){return!!e.visible&&(!e.parent||di(e.parent))}class hi{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}}async function fi(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new l).setPath(t).loadAsync(n);{const e=Gi(n);if("hdr"===e||"pic"===e){const e=await(new Pt).setPath(t).setDataType(c).loadAsync(n);return e.mapping=u,e}{const e=await(new d).setPath(t).loadAsync(n);return e.mapping=u,e}}}function pi(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),a=new h,l=t.map((e=>a.set(e).getStyle()));for(let e=0,t=l.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,l[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const c=new f(r);return c.needsUpdate=!0,c}const mi=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function gi(e){return ki(e)?function(e){return e.map((e=>gi(e)))}(e):Ni(e)?function(e){if(Ni(e)){const t={};for(const n in e)t[n]=gi(e[n]);return t}return e}(e):e}const vi=(e,t)=>ki(e)?e.map(t):t(e),yi=e=>vi(e,(e=>e.clone())),wi=e=>vi(e,(e=>e.dispose())),bi=new p,xi=async(e,t)=>(bi.setResponseType(t),bi.loadAsync(e)),Ai=new t,Si=new t,Ei=new t;function Ti(e,t){const n=Ai.setFromMatrixPosition(e.matrixWorld),i=Si.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(Ei);return r.angleTo(s)>Math.PI/2}function Di(e,t,n,r){const s=Ai.setFromMatrixPosition(e.matrixWorld),o=s.clone();o.project(t),n.setFromCamera(new i(o.x,o.y),t);const a=n.intersectObjects(r,!0);if(a.length){const e=a[0].distance;return s.distanceTo(n.ray.origin)<e}return!0}const Ci=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var Ii=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 Mi(e){return xi(e,"text").then((e=>Promise.resolve(function(e){return(new Ii).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class Bi{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,r=new m,s=new Float32Array(3*i),o=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new a,d=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,r),r.decompose(c,u,d),s[3*t]=c.x,s[3*t+1]=c.y,s[3*t+2]=c.z,o[4*t]=u.x,o[4*t+1]=u.y,o[4*t+2]=u.z,o[4*t+3]=u.w,l[3*t]=d.x,l[3*t+1]=d.y,l[3*t+2]=d.z;const h=this.writer,f={};f.attributes={TRANSLATION:h.processAccessor(new g(s,3)),ROTATION:h.processAccessor(new g(o,4)),SCALE:h.processAccessor(new g(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=f,h.extensionsUsed[this.name]=!0}}const Pi=Object.prototype.hasOwnProperty,Oi=e=>"String"===zi(e),Ri=e=>"Boolean"===zi(e),Li=e=>"Number"===zi(e),ki=Array.isArray,Ni=e=>"Object"===zi(e),Fi=e=>"Function"===zi(e),zi=e=>Object.prototype.toString.call(e).slice(8,-1),Ui=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),ji=()=>qn+Math.random().toString(36).substring(7).split("").join("_"),Gi=e=>{var t;const{href:n}=new URL(e,location.origin);if(n.includes(".")){const e=n.split(".").pop();if(!e)return;return e.includes("?")?null===(t=e.split("?").shift())||void 0===t?void 0:t.toLowerCase():e}};var Hi=Object.freeze({__proto__:null,IVector3ToEuler:ri,IVector3ToVector3:ii,MinHeap:hi,cloneDeep:gi,cloneMaterials:yi,deg2Euler:li,disposeMaterials:wi,error:ni,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)=>{const r=new Ot;r.register((e=>new Bi(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:xi,getAsciiString:Ui,getBoundingBox:si,getExtension:Gi,getSpaceAttributeFromObject:ci,getTexture:fi,getValueType:zi,gradientTexture:pi,hasOwn:(e,t)=>Pi.call(e,t),idleTask:Ci,isArray:ki,isBoolean:Ri,isDate:e=>"Date"===zi(e),isFunction:Fi,isNull:e=>"Null"===zi(e),isNumber:Li,isObject:Ni,isObjectBehindCamera:Ti,isObjectOccludeVisible:Di,isObjectVisible:di,isPromise:e=>"Promise"===zi(e),isString:Oi,isSymbol:e=>"Symbol"===zi(e),isUndefined:e=>"Undefined"===zi(e),log:ei,materialHandle:vi,parseFilePath:mi,randomString:ji,rotationAFix:ai,rotationAxisFix:oi,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:ui,warn:ti,xmlToJson:Mi});const Vi={"Linear.None":Tn.Linear.None,"Quadratic.In":Tn.Quadratic.In,"Quadratic.Out":Tn.Quadratic.Out,"Quadratic.InOut":Tn.Quadratic.InOut,"Cubic.In":Tn.Cubic.In,"Cubic.Out":Tn.Cubic.Out,"Cubic.InOut":Tn.Cubic.InOut,"Quartic.In":Tn.Quartic.In,"Quartic.Out":Tn.Quartic.Out,"Quartic.InOut":Tn.Quartic.InOut,"Quintic.In":Tn.Quintic.In,"Quintic.Out":Tn.Quintic.Out,"Quintic.InOut":Tn.Quintic.InOut,"Sinusoidal.In":Tn.Sinusoidal.In,"Sinusoidal.Out":Tn.Sinusoidal.Out,"Sinusoidal.InOut":Tn.Sinusoidal.InOut,"Exponential.In":Tn.Exponential.In,"Exponential.Out":Tn.Exponential.Out,"Exponential.InOut":Tn.Exponential.InOut,"Circular.In":Tn.Circular.In,"Circular.Out":Tn.Circular.Out,"Circular.InOut":Tn.Circular.InOut,"Elastic.In":Tn.Elastic.In,"Elastic.Out":Tn.Elastic.Out,"Elastic.InOut":Tn.Elastic.InOut,"Back.In":Tn.Back.In,"Back.Out":Tn.Back.Out,"Back.InOut":Tn.Back.InOut,"Bounce.In":Tn.Bounce.In,"Bounce.Out":Tn.Bounce.Out,"Bounce.InOut":Tn.Bounce.InOut};function Qi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=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:u=!1,mode:d="Linear.None",yoyo:h=!1}=n,f=Vi[d],p=new Pn(e).to(t,l).easing(f).delay(c).onUpdate((n=>{e instanceof r&&t instanceof r&&n instanceof r&&(n.order=t.order),null==i||i(n,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));Li(u)?p.repeat(u):Ri(u)&&u&&p.repeat(1/0),p.yoyo(h),p.start()}))}class _i{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=ii(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=ii(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 Qi(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 Yi=Object.defineProperty,Wi=(e,t,n)=>(((e,t,n)=>{t in e?Yi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Xi(e,t){if(t=t??e.arcLengthDivisions,e.cacheArcULengths&&e.cacheArcULengths.length===t+1&&!e.needsUpdate){const n=e.cacheArcULengths;return{lengths:n,length:n[t]}}e.needsUpdate=!1;const n=[0];let i=e.getPoint(0),r=0;for(let s=1;s<=t;s++){const o=e.getPointAt(s/t);r+=o.distanceTo(i),n.push(r),i=o}return e.cacheArcULengths=n,{lengths:n,length:r}}function Zi(e,t,n){const i=n?t=>e.getPointAt(t):t=>e.getPoint(t);let r=i(0),s=0;const o=[],a=t.length;for(let e=0;e<a;e++){const n=i(t[e]);s+=n.distanceTo(r),o.push(s),r=n}return{lengths:o,length:o[a-1]}}function Ki(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function qi(e){const{curve:t}=e;let n=t.getLength();const i=Ki(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function Ji(e,t){const n=Ki(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return $i(i,{...t,lengths:r})}function $i(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new h(r):null,a=n?new h(n):o??new h(0,1,0),l=i?new h(i):o??new h(0,0,1),c=[],u=[];e[0].toArray(c,0);const d=c.length,f=s??tr(e).lengths,p=f[f.length-1],m=new h;e.forEach(((e,t)=>{e.toArray(c,t*d);const n=f[t]/p;m.lerpColors(a,l,n),m.toArray(u,3*t)}));const g=new v;return g.setAttribute("position",new y(c,d)),g.setAttribute("color",new y(u,3)),g}function er(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new w({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?$i(e,t):Ji(e,t);return new b(r,n)}function tr(e){const t=nr(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function nr(e){const t=[];return e.reduce(((e,n)=>{const i=new x(e,n);return t.push(i),n})),t}function ir(e,t){const n=[];return{lines:t.filter(((t,i)=>{const r=t.closestPointToPointParameter(e),s=0<=r||r>=1;return s&&n.push(i),s})),indexs:n}}function rr(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=sr(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function sr(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=A.clamp(s,0,1),a=n.at(o,new t),l=e.distanceTo(a);i.clampDists.push(l),i.clampPoints.push(a),i.distSortIndexs.push(r),i.ts.push(s),i.clampTs.push(o)})),i.distSortIndexs.sort(((e,t)=>i.clampDists[e]-i.clampDists[t])),i}function or(e){const t=new S,n=null==e[0].z?E:T;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var ar=(e=>(e.back="back",e.front="front",e))(ar||{});function lr(e){const{curve:t,distance:n,fromU:i=0,side:r,tolerance:s=.1*n}=e,o=e.length??t.getLength(),a=t.getPointAt(i);let l=n/o;const c="front"===r?-1:1;let u=!0,d=i,h=a,f=0,p=!0;do{d=c*l+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),h=t.getPointAt(d),f=h.distanceTo(a),u=Math.abs(n-f)>s;const r=n/f;if(e&&u&&r>1){p=!1;break}l*=r}while(u);return{succeed:p,u:d,point:h,distance:f}}function cr(e){const{curve:t,distance:n,fromU:i=0,tolerance:r=.1*n,origin:s}=e,o=e.length??t.getLength(),a=t.getPointAt(i),l=a.distanceTo(s),c=n-l;let u=c/o,d=!0,h=i,f=a;do{h=u+i;let e=!1;h>1?(h=1,e=!0):h<0&&(h=0,e=!0),f=t.getPointAt(h);const o=f.distanceTo(s);d=Math.abs(n-o)>r;const a=c/(o-l);if(e&&d&&a>1)return null;u*=a}while(d);return{u:h,point:f}}const ur=new t,dr=new t(1,1,1);new a;const hr=new m;function fr(e){const{joints:t,axials:n}=e;if(t)var i=mr(t);else i=n?pr(e):gr(e);return i}function pr(e){const{axials:t,start:n}=e,i=new D;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new D;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function mr(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),pr({axials:t,start:e[0]})}function gr(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),pr({axials:r,start:t})}function vr(e){const{geometry:n,flexible:i=1,axial:r,number:s}=e,o=e.start??new t,l=r.clone().normalize(),c=r.length(),u=s-1,d=(new a).setFromUnitVectors(new t(1,0,0),l),h=(new m).compose(o,d,new t(1,1,1)).invert(),f=n.getAttribute("position").clone(),p=f.count;f.applyMatrix4(h);const g=[],v=[];for(let e=0;e<p;e++){const t=f.getX(e);if(t<0){g.push(0,0,0,0),v.push(1,0,0,0);continue}const n=Math.trunc(t/c);if(n<u){const e=t%c/c*i;g.push(n,n+1,0,0),v.push(1-e,e,0,0)}else g.push(u,0,0,0),v.push(1,0,0,0)}return n.setAttribute("skinIndex",new C(g,4)),n.setAttribute("skinWeight",new y(v,4)),n}function yr(e){const{skeleton:n,geometryFrame:i}=e,r=n.boneInverses[0].clone().invert(),s=n.boneInverses[1].clone().invert();if(i){const e=i.clone().invert();r.premultiply(e),s.premultiply(e)}const o=(new t).setFromMatrixPosition(r),a=(new t).setFromMatrixPosition(s);return a.sub(o),vr({...e,start:o,axial:a,number:n.bones.length})}function wr(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??hr.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=nr(a),c=i.getAttribute("position"),u=c.count,d=[],h=[],f=new t;for(let e=0;e<u;e++){f.fromBufferAttribute(c,e);const{index:t,clampT:n}=rr(f,l),i=n*r;d.push(t,t+1,0,0),h.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new C(d,4)),i.setAttribute("skinWeight",new y(h,4)),i}function br(e){const{geometry:t}=e,n=e.material??void 0,i=new I(t,n),r=fr(e);i.add(r[0]);const s=new M(r);return i.bind(s),wr({...e,skeleton:s}),i}function xr(e){const{skeleton:t}=e,n=Ar(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function Ar(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new I;return t.copy.call(r,t,!1),wr({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function Sr(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=fr(e);n=new M(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=Er({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function Er(e){const{target:t,skeleton:n,parent:i,posOnBone:r}=e,s=t.isMesh,o=s?Ar({...e,skeleton:n}):t.clone(!1);i&&i.add(o),o.updateMatrixWorld(!0),s&&(o.bind(n,t.matrixWorld),r&&(o.frustumCulled=!1));const a=t.children;for(const t of a)Er({...e,target:t,parent:o});return o}function Tr(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Dr(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Cr(e){return Dr(e)??e[0]}function Ir(e){return e.curve?Mr(e):kr(e)}function Mr(e){const{keyframeTracks:t,duration:n,...i}=Br(e);return{...i,clip:new B(e.name,n,t)}}function Br(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=qi(e).division,s=Pr(e,t.getLength()),o=L,a=[],l=Rr(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=Lr(c),{points:d,rotates:h,...f}=Or(c);if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new P(`${i}.position`,u,e,o);a.push(t)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const t=new O(`${i}.quaternion`,u,e,o);a.push(t)}return{...f,keyframeTracks:a,duration:s}}function Pr(e,t){let n=e.duration;if(!n){const i=e.speed;if(null==i)throw"缺少选项 duration 或者 speed";if(!t)throw"缺少参数 length";n=t/i}return n}function Or(e){var n,i;const{curve:r,target:s,lookPoint:o,enableUp:l,fixUp:c}=e,u=e.position??!0,d=e.rotate??!0,h=[],f=[],p=[];if(!u&&!d)return{rotates:h,points:f,curveLength:void 0,lengths:void 0};const g=(e.anchor??ur).clone(),v=e.ts??e.us,y=!e.ts;if(!v)throw"缺少参数:至少传递 ts 和 us 任意之一";let w=hr.clone(),b=hr.clone(),x=dr.clone(),A=R.DEFAULT_UP;s&&(s.updateWorldMatrix(!0,!1),w=s.matrix,b=s.matrixWorld,x=s.scale,A=s.up);const S=w.clone().invert(),E=b.clone().multiply(S).clone().invert(),T=r.getTangent(0);T.transformDirection(E);const D=(null==(n=e.front)?void 0:n.clone().normalize())??T,C=(null==(i=e.up)?void 0:i.clone().normalize())??A.clone().transformDirection(E);let I=w.clone().setPosition(0,0,0),M=e=>r.getPoint(e),B=e=>r.getTangent(e);y&&(M=e=>r.getPointAt(e),B=e=>r.getTangentAt(e));const P=v.length,O=P-1;let{distance:L,curveLength:k,lengths:N}=o??{};L=L??0;let F=B;0!==L&&(N||(N=Zi(r,v,y).lengths),null==k&&(k=N[O]),F=(e,t)=>{const n=M(e);let i=(N[t]+L)/k;return i>1&&(i=1),r.getPointAt(i).sub(n).normalize()});let z=e=>{const t=v[e],n=F(t,e);n.transformDirection(E),p.push(n);const i=e-1,r=i<0,s=r?D:p[i],o=(new a).setFromUnitVectors(s,n);if(!r){const e=h[i];o.multiply(e)}return o.normalize()};if(l){const e=new t(0,1,0);z=c?function(t){const n=v[t],i=F(n,t);i.transformDirection(E),p.push(i);const r=t-1;let s;if(r<0)s=(new a).setFromUnitVectors(D,i);else{const e=h[r],t=D.clone().applyQuaternion(e).normalize();s=(new a).setFromUnitVectors(t,i),s.multiply(e)}const o=C.clone().applyQuaternion(s).normalize(),l=(new a).setFromUnitVectors(o,e);return s.premultiply(l),s.normalize()}:function(t){const n=v[t],i=F(n,t);i.transformDirection(E),p.push(i);const r=t-1,s=r<0,o=s?D:p[r],l=(new a).setFromUnitVectors(o,i);if(s){const t=C.clone().applyQuaternion(l);t.projectOnPlane(i).normalize();const n=e.clone().projectOnPlane(i).normalize(),r=(new a).setFromUnitVectors(t,n);l.premultiply(r)}else{const e=h[r];l.multiply(e)}return l.normalize()}}for(let e=0;e<P;e++){const t=v[e];if(d){const t=z(e);h.push(t),I=(new m).compose(ur,t,x)}if(u){const e=M(t);e.applyMatrix4(E);const n=g.clone().applyMatrix4(I);e.sub(n),f.push(e)}}return{rotates:h,points:f,curveLength:k??void 0,lengths:N??void 0}}function Rr(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function Lr(e){const{curve:t,division:n,duration:i}=e,r=t.getLengths(n),s=r[r.length-1];return r.map((e=>e/s*i))}function kr(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r,...s}=Nr(e);else{const t=or(n);var{keyframeTracks:i,duration:r,...s}=Br({...e,curve:t})}return{...s,clip:new B(e.name,r,i)}}function Nr(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=tr(n),o=Pr(e,r),a=[],l=s.map((e=>e/r*o)),{points:c,pointTimes:u,rotates:d,rotateTimes:h}=Fr({...e,times:l},i);if(c.length){const e=[];c.forEach(((t,n)=>{t.toArray(e,3*n)}));const n=new P(`${t}.position`,u,e,L);a.push(n)}if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new O(`${t}.quaternion`,h,e,k);a.push(n)}return{keyframeTracks:a,duration:o,lengths:s,curveLength:r}}function Fr(e,n){var i,r;const{points:s,target:o,times:l,enableUp:c,fixUp:u}=e,d=e.position??!0,h=e.rotate??!0,f=s.length,p=f-1;n=n??nr(s);const g=[],v=[],y=[],w=[],b={rotates:g,points:v,rotateTimes:l,pointTimes:y};if(!d&&!h)return b;const x=(e.anchor??ur).clone();let A=hr.clone(),S=hr.clone(),E=dr.clone(),T=R.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),A=o.matrix,S=o.matrixWorld,E=o.scale,T=o.up);const D=A.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const M=(null==(i=e.front)?void 0:i.clone().normalize())??I,B=(null==(r=e.up)?void 0:r.clone().normalize())??T.clone().transformDirection(C);let P=A.clone().setPosition(0,0,0),O=P,L=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const r=e-1,s=r<0,o=s?M:w[r],l=(new a).setFromUnitVectors(o,i);if(!s){const e=g[r];l.multiply(e)}return l.normalize()};if(c){const e=new t(0,1,0);L=u?function(i){const r=n[i].delta(new t).normalize();r.transformDirection(C),w.push(r);const s=i-1;let o;if(s<0)o=(new a).setFromUnitVectors(M,r);else{const e=g[s],t=M.clone().applyQuaternion(e).normalize();o=(new a).setFromUnitVectors(t,r),o.multiply(e)}const l=B.clone().applyQuaternion(o).normalize(),c=(new a).setFromUnitVectors(l,e);return o.premultiply(c),o.normalize()}:function(i){const r=n[i].delta(new t).normalize();r.transformDirection(C),w.push(r);const s=i-1,o=s<0,l=o?M:w[s],c=(new a).setFromUnitVectors(l,r);if(o){const t=B.clone().applyQuaternion(c);t.projectOnPlane(r).normalize();const n=e.clone().projectOnPlane(r).normalize(),i=(new a).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=g[s];c.multiply(e)}return c.normalize()}}for(let e=0;e<f;e++){if(h)if(e<p){const t=L(e);g.push(t),P=(new m).compose(ur,t,E)}else g.push(g[e-1].clone());if(d){const t=l[e],n=s[e].clone();if(n.applyMatrix4(C),e>0){const e=x.clone().applyMatrix4(O),i=n.clone().sub(e);v.push(i),y.push(t)}const i=x.clone().applyMatrix4(P);n.sub(i),v.push(n),y.push(t)}O=P}return b}function zr(e){const t=e.mixer,n=Sr(e),{model:i,skeleton:r}=n,s={...e,target:i,skeleton:r},{clip:o,...a}=e.posOnBone?Ur(s):Hr(s);i.animations.push(o);const l=null==t?void 0:t.clipAction(o,i);return{...a,...n,clip:o,action:l}}function Ur(e){const{boneTracks:t,duration:n,...i}=jr(e),r=t.flat();return{...i,clip:new B(e.name,n,r)}}function jr(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o,...a}=Gr(e),l=r.length,c=L,u=s.map(((e,t)=>{const{points:s,rotates:o}=e,a=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${a.name||a.uuid}`,d=[],h=[];for(let e=0;e<l;e++)s&&s[e].toArray(d,3*e),o[e].toArray(h,4*e);const f=[];if(s){const e=new P(`${u}.position`,r,d,c);f.push(e)}const p=new O(`${u}.quaternion`,r,h,c);return f.push(p),f}));return{...a,boneTracks:u,duration:o}}function Gr(e){var n;const{curve:i,skeleton:r,stretch:s}=e,{bones:o,boneInverses:l}=r,c=o[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const d=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:h,length:f}=qi(e),{matrixWorld:p}=u,g=p.clone().invert(),v=[],y=[];l.reduce(((e,t)=>{const n=t.clone().invert();v.push(n);const i=e.clone().multiply(n);return y.push(i),t}),g);const w=y[0],b=new t,x=new a,A=new t;w.decompose(b,x,A);const S=Pr(e,f),E=Rr(h),T=Lr({curve:i,division:h,duration:S}),D=E.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),M=l[0],B=null==(n=e.up)?void 0:n.clone().applyMatrix4(p).transformDirection(M),{points:P,rotates:O,...R}=Or({...e,curve:i,ts:E,target:c,rotate:!0,front:I,up:B,anchor:null});for(let e=0;e<D;e++)C.push(p.clone());const L=P.map(((e,t)=>{const n=O[t];n.premultiply(x).normalize();const i=(new m).compose(e,n,A);return i.premultiply(p),i})),k=i.getLengths(h).map((e=>e/f)),N=[{points:P,rotates:O,us:k,matrixs:L}],F=s?function(e,t,n){const r=N[e].us[t]-n/f;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=N[e].us[t],{u:s,point:o,succeed:a}=lr({curve:i,distance:n,fromU:r,length:f,side:ar.front,tolerance:d*n});return{u:s,point:a?o:null}},z=l.length,U=z-1;for(let e=1;e<z;e++){const n=[],r=[],s=[],o=[];N.push({points:n,rotates:r,us:s,matrixs:o});const l=y[e],c=v[e],u=e-1,d=N[u],h=y[u],f=v[u],{matrixs:p,points:g,rotates:w}=d,b=(new t).setFromMatrixScale(h),x=u-1,A=x<0?C:N[x].matrixs,S=new t,E=new a,T=new t;l.decompose(S,E,T);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(f)).length(),M=S.length();for(let t=0;t<D;t++){const{point:c,u:d}=F(u,t,I);s.push(d),r.push(E.clone());const h=p[t];if(d<0||!c){n.push(S);const e=h.clone().multiply(l);o.push(e);continue}const f=A[t];let v=f.clone().invert();const y=c.clone().applyMatrix4(v),x=g[t];y.sub(x).normalize();const D=w[t],C=(new m).compose(x,D,b),B=S.clone().transformDirection(C),P=(new a).setFromUnitVectors(B,y);D.premultiply(P).normalize(),h.compose(x,D,b),h.premultiply(f);const O=h.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/M),n.push(c);const L=(new m).compose(c,E,T);if(e===U){const e=i.getTangentAt(d);e.negate().transformDirection(O);const n=(new a).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(E).normalize(),r[t]=n,L.compose(c,n,T)}L.premultiply(h),o.push(L)}}return{...R,times:T,boneSampleDatas:N,duration:S}}function Hr(e){const{boneTracks:t,targetTracks:n,duration:i,...r}=Vr(e),s=n.concat(t.flat());return{...r,clip:new B(e.name,i,s)}}function Vr(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o,...a}=Qr(e),l=i.length,c=t.bones,u=L,d=[],h=[],{points:f,rotates:p}=o;for(let e=0;e<l;e++)f[e].toArray(d,3*e),p[e].toArray(h,4*e);const m=n??"",g=[new P(`${m}.position`,i,d,u),new O(`${m}.quaternion`,i,h,u)],v=r.map(((e,t)=>{const{points:r,rotates:s}=e,o=c[t],a=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,d=[],h=[];for(let e=0;e<l;e++)r&&r[e].toArray(d,3*e),s[e].toArray(h,4*e);const f=[];if(r){const e=new P(`${a}.position`,i,d,u);f.push(e)}const p=new O(`${a}.quaternion`,i,h,u);return f.push(p),f}));return{...a,boneTracks:v,targetTracks:g,duration:s}}function Qr(e){const{curve:n,skeleton:i,stretch:r}=e,{bones:s,boneInverses:o}=i,l=s[0],c=e.target??l.parent;if(!c)throw"target 或 根骨骼的 parent 不存在";const u=e.tolerance??.1;l.updateWorldMatrix(!0,!0);const{division:d,length:h}=qi(e),{matrix:f,matrixWorld:p,scale:g}=c,v=p.clone().multiply(f.clone().invert()),y=p.clone().invert(),w=[],b=[];o.reduce(((e,t)=>{const n=t.clone().invert();w.push(n);const i=e.clone().multiply(n);return b.push(i),t}),y);const x=b[0],A=new t,S=new a,E=new t;x.decompose(A,S,E);const T=Pr(e,h),D=Rr(d),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:M,points:B,...P}=Or({...e,curve:n,target:c,position:!0,rotate:!0,anchor:A,front:I,ts:D}),O=Lr({curve:n,division:d,duration:T}),R=B.map(((e,t)=>{const n=M[t],i=(new m).compose(e,n,g);return i.premultiply(v),i})),L={points:B,rotates:M,matrixs:R},k=[],N=R.map((e=>(k.push(S.clone()),e.clone().multiply(x)))),F=D.length,z=n.getLengths(d).map((e=>e/h)),U=[{rotates:k,us:z,matrixs:N}],j=r?function(e,t,i){const r=U[e].us[t]-i/h;return{u:r,point:r<0?null:n.getPointAt(r)}}:function(e,t,i){const r=U[e].us[t],{u:s,point:o,succeed:a}=lr({curve:n,distance:i,fromU:r,length:h,side:ar.front,tolerance:u*i});return{u:s,point:a?o:null}},G=o.length,H=G-1;for(let e=1;e<G;e++){const i=[],r=[],s=[],o=[];U.push({points:i,rotates:r,us:s,matrixs:o});const l=b[e],c=w[e],u=e-1,d=U[u],h=b[u],f=w[u],{matrixs:p,points:g,rotates:v}=d,y=new t,x=new a,A=new t;h.decompose(y,x,A);const S=u-1,E=S<0?R:U[S].matrixs,T=new t,D=new a,C=new t;l.decompose(T,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(f)).length(),M=T.length();for(let t=0;t<F;t++){const{point:c,u:d}=j(u,t,I);s.push(d),r.push(D.clone());const h=p[t];if(d<0||!c){i.push(T);const e=h.clone().multiply(l);o.push(e);continue}const f=E[t];let w=f.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==g?void 0:g[t])??y;b.sub(S).normalize();const B=v[t],P=(new m).compose(S,B,A),O=T.clone().transformDirection(P);B.setFromUnitVectors(O,b),B.premultiply(x).normalize(),h.compose(S,B,A),h.premultiply(f);const R=h.clone().invert();c.applyMatrix4(R);const L=c.length();c.copy(T).multiplyScalar(L/M),i.push(c);const k=(new m).compose(c,D,C);if(e===H){const e=n.getTangentAt(d);e.negate().transformDirection(R);const i=(new a).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D).normalize(),r[t]=i,k.compose(c,i,C)}k.premultiply(h),o.push(k)}}return{...P,times:O,boneSampleDatas:U,targetSampleDatas:L,duration:T}}class _r{constructor(e){Wi(this,"isAnimationClipKeyframe",!0),Wi(this,"_tracksTimes",null),Wi(this,"lastGetTime",0),Wi(this,"lastGetKeyframeIndexs",[]),this.clip=e}get tracksTimes(){return this._tracksTimes??(this._tracksTimes=this.clip.tracks.map((e=>e.times)))}getTracksKeyframeIndexs(e){const{lastGetTime:t,tracksTimes:n}=this;e<t&&(this.lastGetKeyframeIndexs=[]),this.lastGetTime=e;const i=this.lastGetKeyframeIndexs;return this.lastGetKeyframeIndexs=n.map(((t,n)=>{const r=i[n]??0,s=t.length;for(let n=r;n<s;n++)if(e<t[n])return n-1;return s-1}))}getTracksKeyframes(e){const t=this.getTracksKeyframeIndexs(e),n=this.clip.tracks;return t.map(((e,t)=>{let i=null;if(-1!==e){const r=n[t],s=r.getValueSize(),o=e*s,a=o+s;i=Array.from(r.values.slice(o,a))}return{index:e,value:i}}))}}var Yr=(e=>(e.keyframe="keyframe",e.position=".position",e.quaternion=".quaternion",e.rotation=".rotation",e.scale=".scale",e.loop="loop",e.finished="finished",e.point="point",e))(Yr||{});const Wr=["loop","finished"];class Xr extends _r{constructor(e){super(e.getClip()),Wi(this,"isAnimationActionKeyframe",!0),Wi(this,"_trackNames"),Wi(this,"_positionTrackName"),Wi(this,"_quaternionTrackName"),Wi(this,"_rotationTrackName"),Wi(this,"_scaleTrackName"),Wi(this,"event",new N),Wi(this,"_frameEventNames",null),Wi(this,"mixerListener",(e=>{(e.action.isAnimationActionKeyframe?e.action.action:e.action)===this.action&&this.event.dispatchEvent(e)})),Wi(this,"_points",[]),Wi(this,"_polyline"),Wi(this,"_polylineLengths",[]),Wi(this,"_pointsProgress",[]),Wi(this,"lastGetProgress",0),Wi(this,"lastGetPointIndex",0),Wi(this,"_enablePointEvent",!0),Wi(this,"_enableKeyframeEvent",!0),Wi(this,"lastKeyframes",null),Wi(this,"lastPolylineKeyframe",null),Wi(this,"frameFun",(()=>{var e;if(this.enableKeyframeEvent){const{keyframes:e,lastKeyframes:t}=this;let n=!1;for(const[i,r]of Object.entries(e)){const e=null==t?void 0:t[i];r.index!==(null==e?void 0:e.index)&&(n=!0,this.event.dispatchEvent({type:i,preFrame:e,frame:r}))}n&&(this.event.dispatchEvent({type:"keyframe",preFrame:t,frame:e}),this.lastKeyframes=e)}if(this.pointEventEnabled){const{pointIndex:t,lastPolylineKeyframe:n}=this;if(t!==(null==n?void 0:n.index)){const i={index:t,value:this.points[t]??(null==(e=this.polyline)?void 0:e.getPoint(this.progress)),length:this.polylineLengths[t]};this.event.dispatchEvent({type:"point",preFrame:n,frame:i}),this.lastPolylineKeyframe=i}}})),Wi(this,"_stopListenFun"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progressTime(){const{isReverseLoop:e,duration:t,time:n}=this;return e?t-n:n}set progressTime(e){const{action:t,isReverseLoop:n,duration:i}=this;n&&(e=i-e),t.time=e}get progress(){return this.progressTime/this.duration}set progress(e){this.progressTime=e*this.duration}get loopCount(){const e=this.action._loopCount;return-1===e?0:e}get isReverseLoop(){return this.action.loop===F&&this.loopCount%2==1}get loopDirFactor(){return this.isReverseLoop?-1:1}get isReverse(){const e=this.action.timeScale<0;return this.isReverseLoop?!e:e}get dirFactor(){return this.isReverse?-1:1}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.progressTime);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.progressTime);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get positionTrackName(){return void 0===this._positionTrackName&&(this._positionTrackName=this.trackNames.find((e=>e.endsWith(".position")))??null),this._positionTrackName}get positionkeyframeIndex(){const e=this.positionTrackName;return e?this.keyframeIndexs[e]:null}get positionKeyframe(){const e=this.positionTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get quaternionTrackName(){return void 0===this._quaternionTrackName&&(this._quaternionTrackName=this.trackNames.find((e=>e.endsWith(".quaternion")))??null),this._quaternionTrackName}get quaternionKeyframeIndex(){const e=this.quaternionTrackName;return e?this.keyframeIndexs[e]:null}get quaternionKeyframe(){const e=this.quaternionTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new a(...n):null}}return null}get rotationTrackName(){return void 0===this._rotationTrackName&&(this._rotationTrackName=this.trackNames.find((e=>e.endsWith(".rotation")))??null),this._rotationTrackName}get rotationkeyframeIndex(){const e=this.rotationTrackName;return e?this.keyframeIndexs[e]:null}get rotationKeyframe(){const e=this.rotationTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new r(...n):null}}return null}get scaleTrackName(){return void 0===this._scaleTrackName&&(this._scaleTrackName=this.trackNames.find((e=>e.endsWith(".scale")))??null),this._scaleTrackName}get scaleKeyframeIndex(){const e=this.scaleTrackName;return e?this.keyframeIndexs[e]:null}get scaleKeyframe(){const e=this.scaleTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get frameEventNames(){return this._frameEventNames??(this._frameEventNames=[...this.trackNames,"keyframe","point"])}get mixer(){return this.action._mixer}addEventListener(e,t){const n=this.mixerListener;return Wr.includes(e)&&!this.mixer.hasEventListener(e,n)?(this.mixer.addEventListener(e,n),this.event.addEventListener(e,t),!0):!!this.frameEventNames.includes(e)&&(this.event.addEventListener(e,t),!this._stopListenFun&&this.enableFrameEvent&&(this._stopListenFun=Zr(this.frameFun)),!0)}removeEventListener(e,t){if(Wr.includes(e)&&1===this.getListeners(e).length){const t=this.mixerListener;this.mixer.removeEventListener(e,t)}this.event.removeEventListener(e,t),this.stopListenFun&&!this.hasListeners&&(this.stopListenFun=null)}get points(){return this._points}set points(e){e.length>1?(this._points=e,this.polyline=or(e)):(this._points=[],this.polyline=null)}get polyline(){return this._polyline}set polyline(e){this._polyline=e;const t=(null==e?void 0:e.getCurveLengths())??[];this.polylineLengths=[0,...t]}get polylineLengths(){return this._polylineLengths}set polylineLengths(e){this._polylineLengths=e;const t=1/e[e.length-1];this.pointsProgress=e.map((e=>e*t))}get polylineLength(){return this.polylineLengths[this.polylineLengths.length-1]}get polylineProgressLength(){return this.polylineLength*this.progress}get pointsProgress(){return this._pointsProgress}set pointsProgress(e){this._pointsProgress=e}get pointIndex(){return this.getPointIndex(this.progress)}getPointIndex(e){const{lastGetProgress:t,pointsProgress:n}=this;e<t&&(this.lastGetPointIndex=0),this.lastGetProgress=e;const i=Math.max(this.lastGetPointIndex,0),r=n.length;for(let t=i;t<r;t++)if(e<n[t])return this.lastGetPointIndex=t-1;return this.lastGetPointIndex=r-1}get enablePointEvent(){return this._enablePointEvent}set enablePointEvent(e){this._enablePointEvent=e,e&&this.autoStartListen()}get pointEventEnabled(){return this.enablePointEvent&&this.pointsProgress.length>0&&this.getListeners("point").length>0}get enableKeyframeEvent(){return this._enableKeyframeEvent}set enableKeyframeEvent(e){this._enableKeyframeEvent=e,e&&this.autoStartListen()}get enableFrameEvent(){return this.enableKeyframeEvent||this.enablePointEvent}get stopListenFun(){return this._stopListenFun}set stopListenFun(e){const t=this._stopListenFun;t&&t(),this._stopListenFun=e}startListen(){this.stopListenFun||(this.stopListenFun=Zr(this.frameFun))}stopListen(){this.stopListenFun=null}autoStartListen(){!this.stopListenFun&&this.enableFrameEvent&&this.hasListeners&&(this.stopListenFun=Zr(this.frameFun))}get listeners(){return this.event._listeners}get hasListeners(){const e=this.listeners;return!!e&&Object.values(e).some((e=>e&&e.length>0))}getListeners(e){var t;return(null==(t=this.listeners)?void 0:t[e])??[]}destroy(e){const{action:t,mixer:n,mixerListener:i}=this;this.stopListen(),n.removeEventListener("loop",i),n.removeEventListener("finished",i),this.event._listeners=null,!e&&(t.stop(),t.reset(),n._deactivateAction(t),n._removeInactiveAction(t))}}function Zr(e){let t;const n=i=>{e(i),t=requestAnimationFrame(n)};return t=requestAnimationFrame(n),()=>{cancelAnimationFrame(t)}}class Kr extends Xr{constructor(){super(...arguments),Wi(this,"isAnimationActionOperate",!0)}forward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=e}backward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=-e}}function qr(e){const t=new Kr(e);return new Proxy(t,{get:function(e,t,n){return t in e.action?e.action[t]:e[t]},set:function(e,t,n,i){return t in e.action?e.action[t]=n:e[t]=n,!0},deleteProperty:function(e,t){return t in e.action?Reflect.deleteProperty(e.action,t):Reflect.deleteProperty(e,t)},has:function(e,t){return t in e.action||t in e},ownKeys:function(e){return Reflect.ownKeys(e.action).concat(Reflect.ownKeys(e))}})}class Jr{constructor(e){Wi(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&qr(e)}get play(){const e=this.action;return!(!e||!e._mixer._isActiveAction(e)||e.paused)}set play(e){const t=this.action;t&&(t.paused=!e,e&&0===t.time&&t.play())}stop(){var e;null==(e=this.action)||e.stop()}}function $r(e){var t;null==(t=e.reset)||t.call(e,!0)}class es extends Jr{constructor(e,t=[]){super(e),Wi(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??$r}set updateGUI(e){this._updateGUI=e}get action(){return this._action}set action(e){this.setAction(e),this.updateAllGUI()}updateAllGUI(){for(const e of this.guis)this.updateGUI(e)}}function ts(e){const t=new es(e);return new Proxy(t,{get:function(e,t,n){var i;return t in e?e[t]:null==(i=e.action)?void 0:i[t]},set:function(e,t,n,i){if(t in e)e[t]=n;else{if(!e.action)return!1;e.action[t]=n}return!0},deleteProperty:function(e,t){return t in e?Reflect.deleteProperty(e,t):!!e.action&&Reflect.deleteProperty(e.action,t)},has:function(e,t){return t in e||!!e.action&&t in e.action},ownKeys:function(e){return e.action?Reflect.ownKeys(e).concat(Reflect.ownKeys(e.action)):Reflect.ownKeys(e)}})}function ns(e,t=1){const n=e.slice().sort(((e,t)=>e-t)),i=[[]];return n.reduce((function(e,n){const r=e[e.length-1];return null==r||n-r<=t?e.push(n):(e=[n],i.push(e)),e}),i[0]),i}function is(e,t){let{count:n=4,min:i=-1/0,max:r=1/0}=t??{};const s=e[0];i=Math.max(s-n+1,i),r=Math.min(s+n-1,r),n=Math.min(n,r-i+1);const o=[];for(const t of e)i<=t&&t<=r&&o.push(t);const a=ns(o);a.sort(((e,t)=>t.length-e.length));let l=a.find((e=>e.includes(s)));if(l.length>=n)return l.sort(((t,n)=>e.indexOf(t)-e.indexOf(n))),l=l.slice(0,n),l.sort(((e,t)=>e-t)),l;for(const e of o){i=l[0],r=l[l.length-1];let t=i-e,s=n-l.length;if(t>0&&t<=s)for(let t=e;t<i;t++)l.unshift(t);else if(t=e-r,t>0&&t<=s)for(let t=r+1;t<=e;t++)l.push(t);else;}return l}Wi(es,"updateGUI",$r);var rs="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ss(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 os={},as={},ls=function(e,t){return ls=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])},ls(e,t)};function cs(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}ls(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var us=function(){return us=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},us.apply(this,arguments)};function ds(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}function hs(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}function fs(e,t){return function(n,i){t(n,i,e)}}function ps(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function ms(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())}))}function gs(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])}}}var vs=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 ys(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||vs(t,e,n)}function ws(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 bs(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 xs(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(bs(arguments[t]));return e}function As(){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}function Ss(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))}function Es(e){return this instanceof Es?(this.v=e,this):new Es(e)}function Ts(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 Es?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Ds(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:Es(e[i](t)),done:!1}:r?r(t):t}:r}}function Cs(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ws(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)}))}}}function Is(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var Ms=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function Bs(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)&&vs(t,e,n);return Ms(t,e),t}function Ps(e){return e&&e.__esModule?e:{default:e}}function Os(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 Rs(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}function Ls(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)}function ks(e,t,n){if(null!=t){if("object"!=typeof t)throw new TypeError("Object expected.");var i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose]}if("function"!=typeof i)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t}var Ns="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i};function Fs(e){function t(t){e.error=e.hasError?new Ns(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var i=e.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}var zs={__extends:cs,__assign:us,__rest:ds,__decorate:hs,__param:fs,__metadata:ps,__awaiter:ms,__generator:gs,__createBinding:vs,__exportStar:ys,__values:ws,__read:bs,__spread:xs,__spreadArrays:As,__spreadArray:Ss,__await:Es,__asyncGenerator:Ts,__asyncDelegator:Ds,__asyncValues:Cs,__makeTemplateObject:Is,__importStar:Bs,__importDefault:Ps,__classPrivateFieldGet:Os,__classPrivateFieldSet:Rs,__classPrivateFieldIn:Ls,__addDisposableResource:ks,__disposeResources:Fs},Us=Object.freeze({__proto__:null,__addDisposableResource:ks,get __assign(){return us},__asyncDelegator:Ds,__asyncGenerator:Ts,__asyncValues:Cs,__await:Es,__awaiter:ms,__classPrivateFieldGet:Os,__classPrivateFieldIn:Ls,__classPrivateFieldSet:Rs,__createBinding:vs,__decorate:hs,__disposeResources:Fs,__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",u=!t&&e?i.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),h=!1,f=n.length-1;f>=0;f--){var p={};for(var m in i)p[m]="access"===m?{}:i[m];for(var m in i.access)p.access[m]=i.access[m];p.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var g=(0,n[f])("accessor"===l?{get:d.get,set:d.set}:d[c],p);if("accessor"===l){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=o(g.get))&&(d.get=a),(a=o(g.set))&&(d.set=a),(a=o(g.init))&&r.unshift(a)}else(a=o(g))&&("field"===l?r.unshift(a):d[c]=a)}u&&Object.defineProperty(u,i.name,d),h=!0},__exportStar:ys,__extends:cs,__generator:gs,__importDefault:Ps,__importStar:Bs,__makeTemplateObject:Is,__metadata:ps,__param:fs,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:bs,__rest:ds,__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:xs,__spreadArray:Ss,__spreadArrays:As,__values:ws,default:zs}),js=ss(Us),Gs={},Hs={},Vs={},Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});var _s=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}();Qs.SlotList=_s;var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0});var Ws=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}();Ys.Slot=Ws,Object.defineProperty(Vs,"__esModule",{value:!0});var Xs=Qs,Zs=Ys,Ks=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=Xs.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=Xs.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 Zs.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}();Vs.OnceSignal=Ks,Object.defineProperty(Hs,"__esModule",{value:!0});var qs=js,Js=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qs.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(Vs.OnceSignal);Hs.Signal=Js,Object.defineProperty(Gs,"__esModule",{value:!0});var $s=js,eo=Ys,to=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return $s.__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 eo.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(Hs.Signal);Gs.PrioritySignal=to,Object.defineProperty(as,"__esModule",{value:!0});var no=js,io=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 no.__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}(Gs.PrioritySignal);as.DeluxeSignal=io;var ro={};Object.defineProperty(ro,"__esModule",{value:!0});var so=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}();ro.GenericEvent=so;var oo={};Object.defineProperty(oo,"__esModule",{value:!0}),oo.IOnceSignal=Symbol("IOnceSignal");var ao={};Object.defineProperty(ao,"__esModule",{value:!0}),ao.IPrioritySignal=Symbol("IPrioritySignal");var lo={};Object.defineProperty(lo,"__esModule",{value:!0}),lo.ISignal=Symbol("ISignal");var co={};Object.defineProperty(co,"__esModule",{value:!0}),co.ISlot=Symbol("ISlot");var uo={};Object.defineProperty(uo,"__esModule",{value:!0});var ho=Ys,fo=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 ho.Slot(e,this,t)},e}();uo.MonoSignal=fo;var po={};Object.defineProperty(po,"__esModule",{value:!0});var mo=js,go=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return mo.__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}(Vs.OnceSignal);po.Promise=go,Object.defineProperty(os,"__esModule",{value:!0});var vo=as;os.DeluxeSignal=vo.DeluxeSignal;var yo=ro;os.GenericEvent=yo.GenericEvent;var wo=oo;os.IOnceSignal=wo.IOnceSignal;var bo=ao;os.IPrioritySignal=bo.IPrioritySignal;var xo=lo;os.ISignal=xo.ISignal;var Ao=co;os.ISlot=Ao.ISlot;var So=uo;os.MonoSignal=So.MonoSignal;var Eo=Vs;os.OnceSignal=Eo.OnceSignal;var To=Gs;os.PrioritySignal=To.PrioritySignal;var Do=po;os.Promise=Do.Promise;var Co=Hs,Io=os.Signal=Co.Signal,Mo=Ys;os.Slot=Mo.Slot;var Bo=Qs;os.SlotList=Bo.SlotList;function Po(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 Oo={};({get exports(){return Oo},set exports(e){Oo=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&Po)return Po(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=Po,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(u),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(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var l=new e.MessageChannel;l.port1.onmessage=u,n=function(){l.port2.postMessage(0)}}var c=[];function u(){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 d(e){1!==c.push(e)||i||n()}t.exports=d}).call(this,void 0!==rs?rs:"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 u(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 d(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 h(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 m(e){return e instanceof this?e:s.resolve(new this(r),e)}function g(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;)u(e[l],l);return c;function u(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?d(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){s.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=p(h,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=m,c.reject=g,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!==rs?rs:"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 u(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function d(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function h(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",m=void 0,g={},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 x(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 A(e){return"boolean"==typeof m?c.resolve(m):x(e).then((function(e){return m=e}))}function S(e){var t=g[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=g[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function T(e,t){var n=g[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(g[e.name]=g[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 M(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 B(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 P(e){return l([b(atob(e.data))],{type:e.type})}function O(e){return e&&e.__local_forage_encoded_blob}function R(e){var t=this,n=t._initReady().then((function(){var e=g[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return d(n,e,e),n}function L(e){S(e);for(var t=g[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,M(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 k(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 L(e).then((function(){k(e,t,n,i-1)}))})).catch(n);n(r)}}function N(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function F(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=g[n.name];r||(r=N(),g[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 u=r.forages.slice(0);return c.all(s).then((function(){return n.db=r.db,C(n)})).then((function(e){return n.db=e,M(n,t._defaultConfig.version)?I(n):e})).then((function(e){n.db=r.db=e,t._dbInfo=n;for(var i=0;i<u.length;i++){var s=u[i];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}}))}function z(e,t){var n=this;e=h(e);var i=new c((function(t,i){n.ready().then((function(){k(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),O(e)&&(e=P(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function U(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){k(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;O(i)&&(i=P(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 u(i,t),i}function j(e,t,n){var i=this;e=h(e);var r=new c((function(n,r){var s;i.ready().then((function(){return s=i._dbInfo,"[object Blob]"===v.call(t)?A(s.db).then((function(e){return e?t:B(t)})):t})).then((function(t){k(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 u(r,n),r}function G(e,t){var n=this;e=h(e);var i=new c((function(t,i){n.ready().then((function(){k(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 u(i,t),i}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(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 u(n,e),n}function V(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(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 u(n,e),n}function Q(e,t){var n=this,i=new c((function(t,i){e<0?t(null):n.ready().then((function(){k(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 u(i,t),i}function _(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(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 u(n,e),n}function Y(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=g[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=g[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=g[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 u(i,t),i}var W={_driver:"asyncStorage",_initStorage:F,_support:a(),iterate:U,getItem:z,setItem:j,removeItem:G,clear:H,length:V,key:Q,keys:_,dropInstance:Y};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",ue="fl64",de=$+ee.length,he=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),u=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]),u[l++]=n<<2|i>>4,u[l++]=(15&i)<<4|r>>2,u[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 me(e,t){var n="";if(e&&(n=he.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===he.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+=ue: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 ge(e){if(e.substring(0,$)!==J)return JSON.parse(e);var t,n=e.substring(de),i=e.substring($,de);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 ue:return new Float64Array(s);default:throw new Error("Unkown type: "+i)}}var ve={serialize:me,deserialize:ge,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 xe(e,t){var n=this;e=h(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 u(i,t),i}function Ae(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 u(i,t),i}function Se(e,t,n,i){var r=this;e=h(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 u(s,n),s}function Ee(e,t,n){return Se.apply(this,[e,t,n,1])}function Te(e,t){var n=this;e=h(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 u(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 u(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 u(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 u(i,t),i}function Me(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 u(n,e),n}function Be(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 Pe(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(Be(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"),u(i,t),i}var Oe={_driver:"webSQLStorage",_initStorage:we,_support:X(),iterate:Ae,getItem:xe,setItem:Ee,removeItem:Te,clear:De,length:Ce,key:Ie,keys:Me,dropInstance:Pe};function Re(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function Le(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ke(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Ne(){return!ke()||localStorage.length>0}function Fe(e){var t=this,n={};if(e)for(var i in e)n[i]=e[i];return n.keyPrefix=Le(e,t._defaultConfig),Ne()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function ze(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 u(n,e),n}function Ue(e,t){var n=this;e=h(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 u(i,t),i}function je(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 u(i,t),i}function Ge(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 u(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 u(n,e),n}function Ve(e){var t=this.keys().then((function(e){return e.length}));return u(t,e),t}function Qe(e,t){var n=this;e=h(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return u(i,t),i}function _e(e,t,n){var i=this;e=h(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 u(r,n),r}function Ye(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(Le(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"),u(i,t),i}var We={_driver:"localStorageWrapper",_initStorage:Fe,_support:Re(),iterate:je,getItem:Ue,setItem:_e,removeItem:Qe,clear:ze,length:Ve,key:Ge,keys:He,dropInstance:Ye},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:Oe,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 d=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 u(n,arguments[arguments.length-1]),n}},n=0,i=tt.length;n<i;n++){var r=tt[n];e[r]||(e[r]=t(r))}};d();var h=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(h,n):h(!!e._support):h(!0)}catch(e){n(e)}}));return d(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 d(i,t,n),i},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return d(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 d(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})),d(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 Ro=new o;Ro.name="Scene";class Lo{constructor(e,t){this.signals=e,this.viewportState=t,this.strokeStore=Oo.createInstance({name:"soonspace",storeName:"modelStrokeCache"}),this.scene=Ro.clone(),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 ti("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(e.geometry&&e.material){const n=e;n.geometry.dispose(),vi(n.material,t)}e instanceof lu&&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 z(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 ki(e)?e.forEach((e=>i(e))):Ni(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 ki(e)?Promise.all(e.map((e=>t(e)))):Ni(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,modelCache:a=!0,firstChild:l=!1}=t,c=async e=>{var c;if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const u=new ou({id:`${null!==(c=e.sid)&&void 0!==c?c:e.id}_stroke`,name:`${e.name}_stroke`}),d=new j,h=new w({color:s,transparent:!0,opacity:o});d.material=h,u.add(d);let f=null;const p=()=>{const t=[];if((l?e.children[0]:e).traverse((n=>{if("Mesh"===n.type&&n instanceof U){const i=new G(n.geometry,89);n.updateWorldMatrix(!0,!1);const r=n.matrixWorld.clone().premultiply(e.matrixWorld.clone().invert());i.applyMatrix4(r),t.push(i)}})),0!==t.length)return Nt(t)};if(a&&e instanceof uu){const{url:t}=e;await this.strokeStore.ready();const n=await this.strokeStore.getItem(t);if(n)f=new v,f.setAttribute("position",new y(n,3));else{const e=p();if(e){f=e;const n=e.getAttribute("position");n.array instanceof Float32Array&&this.strokeStore.setItem(t,n.array.buffer)}}}else{const e=p();e&&(f=e)}return null!==f?(d.geometry=f,e.userData.strokeGroup=u,e.userData.strokeOptions=t,this.addObject(u,e),this.selectedObjects.stroke.push(e),n&&this.opacityShow(l?e.children[0]:e,{color:i,opacity:r}),Promise.resolve()):void 0};return ki(e)?Promise.all(e.map((e=>c(e)))):Ni(e)?c(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));if(-1===t)return Promise.resolve();this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch();const{firstChild:n}=e.userData.strokeOptions;return this.unOpacityShow(n?e.children[0]:e),Reflect.deleteProperty(e.userData,"strokeOptions"),Promise.resolve()};return ki(e)?Promise.all(e.map((e=>t(e)))):Ni(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=yi(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=vi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return ki(e)?Promise.all(e.map((e=>s(e)))):Ni(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;wi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return ki(e)?Promise.all(e.map((e=>t(e)))):Ni(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 H&&(e.color=new h(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=yi(e.material),vi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return ki(e)?Promise.all(e.map((e=>s(e)))):Ni(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;wi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return ki(e)?Promise.all(e.map((e=>t(e)))):Ni(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",maxOpacity:i=1,minOpacity:r=0,duration:s=1e3}=t;function o(e){e instanceof H&&(e.emissive.set(n),e.emissiveIntensity=i,0!==s&&Qi({emissiveIntensity:i},{emissiveIntensity:r},{duration:s,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const a=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=yi(e.material),vi(e.material,o)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return ki(e)?Promise.all(e.map((e=>a(e)))):Ni(e)?a(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&Un.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;vi(e.material,t),wi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return ki(e)?Promise.all(e.map((e=>n(e)))):Ni(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof su)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 ko extends R{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof ko&&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 No=new t,Fo=new m,zo=new m,Uo=new t,jo=new t;class Go{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(),Fo.copy(t.matrixWorldInverse),zo.multiplyMatrices(t.projectionMatrix,Fo),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof ko&&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 ko){const t=e.parent;if(t.occlude){const t=!Ti(e,this.viewport.camera)&&Di(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}No.setFromMatrixPosition(e.matrixWorld),No.applyMatrix4(zo);const o=di(e)&&No.z>=-1&&No.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("+(No.x*i+i)+"px,"+(-No.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 Uo.setFromMatrixPosition(e.matrixWorld),jo.setFromMatrixPosition(t.matrixWorld),Uo.distanceToSquared(jo)}}}const Ho=new t,Vo=new a,Qo=new t;class _o extends R{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof _o&&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 Yo extends _o{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const Wo=new m,Xo=new m;class Zo{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 u(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,u)=>{const h=u.projectionMatrix.elements[5]*r;s.camera.fov!==h&&(o.style.perspective=u instanceof V?h+"px":"",s.camera.fov=h),u.view&&u.view.enabled?(o.style.transform=`translate( ${-u.view.offsetX*(t/u.view.width)}px, ${-u.view.offsetY*(n/u.view.height)}px )`,o.style.transform+=`scale( ${u.view.fullWidth/u.view.width}, ${u.view.fullHeight/u.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===u.parent&&!0===u.matrixWorldAutoUpdate&&u.updateMatrixWorld();let f=0,p=0;u instanceof Q&&(f=-(u.right+u.left)/2,p=(u.top+u.bottom)/2);const m=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,g=(u instanceof Q?`scale( ${m} )scale(`+h+")translate("+l(f)+"px,"+l(p)+"px)"+c(u.matrixWorldInverse):`scale( ${m} )translateZ(`+h+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==g&&(a.style.transform=g,s.camera.style=g),d(e,e,u)},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 d=(e,t,n,i)=>{var r;if(e instanceof _o){const t=e.parent;if(t.occlude){const t=!Ti(e,this.viewport.camera)&&Di(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=di(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 Yo?(Wo.copy(n.matrixWorldInverse),Wo.transpose(),0!==e.rotation2D&&Wo.multiply(Xo.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(Ho,Vo,Qo),Wo.setPosition(Ho),Wo.scale(Qo),Wo.elements[3]=0,Wo.elements[7]=0,Wo.elements[11]=0,Wo.elements[15]=1,t=u(Wo)):t=u(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++)d(e.children[i],t,n)}}}class Ko{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 i(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,{alpha:n}=e,{offsetWidth:i,offsetHeight:r}=this.container,s=new _({powerPreference:"high-performance",premultipliedAlpha:!0,stencil:!1,antialias:!1,alpha:!1,preserveDrawingBuffer:!0,logarithmicDepthBuffer:t});return s.autoClear=!1,s.setSize(i,r),s.setPixelRatio(self.devicePixelRatio),s.setClearAlpha(n?0:1),s.localClippingEnabled=!0,s.sortObjects=!0,s.shadowMap.enabled=!0,s.shadowMap.type=Y,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new Go(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 Zo(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 qo=new m,Jo=(e,t)=>{const n=qo.clone(),i=qo.clone(),s=qo.clone();n.makeRotationY(e),i.makeRotationX(t);const o=new r;return s.multiplyMatrices(n,i),o.setFromRotationMatrix(s),o},$o=Jo(-Math.PI/2,-Math.PI/4),ea=Jo(Math.PI/2,-Math.PI/4),ta=Jo(-Math.PI/4,-Math.PI/4),na=Jo(Math.PI/4,-Math.PI/4),ia=Jo(1.25*Math.PI,-Math.PI/4),ra=Jo(.75*Math.PI,-Math.PI/4),sa={LEFT:new r(0,-Math.PI/2,0),RIGHT:new r(0,Math.PI/2,0),FRONT:new r(0,0,0),BACK:new r(0,Math.PI,0),TOP:new r(-Math.PI/2,0,0),BOTTOM:new r(Math.PI/2,0,0),FRONTTOP:new r(-Math.PI/4,0,0),BACKTOP:new r(Math.PI/4,Math.PI,0),LEFTTOP:new r($o.x,$o.y,$o.z),RIGHTTOP:new r(ea.x,ea.y,ea.z),LEFTFRONTTOP:new r(ta.x,ta.y,ta.z),RIGHTFRONTTOP:new r(na.x,na.y,na.z),LEFTBACKTOP:new r(ia.x,ia.y,ia.z),RIGHTBACKTOP:new r(ra.x,ra.y,ra.z)},oa=e=>Li(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),aa=new t,la=new r,ca=new V(50,1,.01,5e4);ca.position.set(500,1e3,500),ca.lookAt(aa.set(0,0,0)),ca.name="Camera";class ua{constructor(e){this.viewport=e,this.mainCamera=ca.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=ca.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&&Ni(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(Ni(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 Qi(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new a).setFromEuler(e);return Qi({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",n=arguments.length>2?arguments[2]:void 0;if(Oi(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?la.copy(this.currentCamera.rotation):sa[e]&&la.copy(sa[e])}else t instanceof r?la.copy(t):Ni(t)&&la.set(t.x,t.y,t.z);la.copy(ai(this.currentCamera.rotation,la.clone())),await Promise.all([this.moveTo(e,n),this.rotateTo(la,n)])}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 ti("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Oi(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=sa[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&ti("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=ri(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(aa),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new m;r.lookAt(s,t,i.object.up),n=la.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 fu||e instanceof lu){const{padding:t=50}=i,r=oa(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=si(e),o=s.getSize(aa);let a=0;if(Oi(r)){const e=Math.max(o.x,o.y,o.z);a=oa(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(aa.set(l/2,c/2,l/2)),s.min.sub(aa.set(l/2,c/2,l/2))),s.isEmpty()&&(aa.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(aa,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=ii(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return Qi({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 s).setFromObject(e).getCenter(aa);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(aa);(new t).subVectors(i,n).normalize();let r=new W;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",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof su&&(e=(new s).setFromObject(e)),e.isEmpty())return ti("target box is empty"),new t;const{extendScale:r=1.6,mode:o="scene"}=i;if("scene"===o){const t=e.getCenter(aa),i=e.max.clone().sub(e.min),s=Math.max(i.x,i.y,i.z),o=t.clone(),a=e=>{const t=(r-.5)*Math.abs(s),n=Math.max(t,this.viewport.camera.near);o.add(e.multiplyScalar(n))};let l;return l=Oi(n)?sa[n.toLocaleUpperCase()]:ri(n),a(aa.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(aa).clone():new t}}
|
|
1
|
+
import*as e from"three";import{Vector3 as t,Vector4 as n,Vector2 as i,Euler as r,Box3 as s,Scene as o,Quaternion as a,CubeTextureLoader as l,HalfFloatType as c,EquirectangularReflectionMapping as u,TextureLoader as d,Color as h,Texture as f,FileLoader as p,Matrix4 as m,BufferAttribute as g,BufferGeometry as v,Float32BufferAttribute as y,LineBasicMaterial as w,Line as b,Line3 as x,MathUtils as A,CurvePath as S,LineCurve as E,LineCurve3 as T,Bone as D,Uint16BufferAttribute as C,SkinnedMesh as I,Skeleton as M,AnimationClip as B,VectorKeyframeTrack as P,QuaternionKeyframeTrack as O,Object3D as R,InterpolateLinear as L,InterpolateDiscrete as k,EventDispatcher as N,LoopPingPong as F,Fog as z,Mesh as U,LineSegments as j,EdgesGeometry as G,MeshStandardMaterial as H,PerspectiveCamera as V,OrthographicCamera as Q,WebGLRenderer as _,PCFSoftShadowMap as Y,Sphere as W,REVISION as X,Camera as Z,BasicDepthPacking as K,UnsignedByteType as q,DepthTexture as J,DepthStencilFormat as $,UnsignedInt248Type as ee,UnsignedIntType as te,WebGLRenderTarget as ne,Uniform as ie,RepeatWrapping as re,LoadingManager as se,NearestFilter as oe,LinearFilter as ae,ShaderMaterial as le,NoBlending as ce,RGBADepthPacking as ue,BackSide as de,DoubleSide as he,FrontSide as fe,MeshDepthMaterial as pe,LinearEncoding as me,sRGBEncoding as ge,Material as ve,DataTexture as ye,NoColorSpace as we,WebGLMultipleRenderTargets as be,RedFormat as xe,FloatType as Ae,RGBAFormat as Se,ShaderChunk as Ee,WebGLCubeRenderTarget as Te,CubeCamera as De,PMREMGenerator as Ce,FramebufferTexture as Ie,Matrix3 as Me,TangentSpaceNormalMap as Be,GLSL3 as Pe,VideoTexture as Oe,GLBufferAttribute as Re,InterleavedBufferAttribute as Le,Frustum as ke,MOUSE as Ne,TOUCH as Fe,Spherical as ze,Raycaster as Ue,Clock as je,AnimationMixer as Ge,SRGBColorSpace as He,LinearSRGBColorSpace as Ve,UVMapping as Qe,ACESFilmicToneMapping as _e,CubeTexture as Ye,NoToneMapping as We,LinearToneMapping as Xe,ReinhardToneMapping as Ze,CineonToneMapping as Ke,Sprite as qe,SpriteMaterial as Je,SphereGeometry as $e,CircleGeometry as et,ShapeGeometry as tt,Shape as nt,AmbientLight as it,DirectionalLight as rt,HemisphereLight as st,SpotLight as ot,PointLight as at,RectAreaLight as lt,Loader as ct,LoaderUtils as ut,ClampToEdgeWrapping as dt,Group as ht,PropertyBinding as ft,NumberKeyframeTrack as pt,LinearMipMapLinearFilter as mt,ImageLoader as gt,InstancedMesh as vt,GridHelper as yt,AxesHelper as wt,Box3Helper as bt,PlaneGeometry as xt,MeshBasicMaterial as At,DirectionalLightHelper as St,HemisphereLightHelper as Et,SpotLightHelper as Tt,PointLightHelper as Dt,Box2 as Ct,Plane as It,CanvasTexture as Mt,MeshPhongMaterial as Bt}from"three";export*from"three";import{RGBELoader as Pt}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as Ot}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Rt}from"three/examples/jsm/environments/RoomEnvironment.js";import Lt from"three/examples/jsm/libs/stats.module.js";import{Sky as kt}from"three/examples/jsm/objects/Sky.js";import{mergeGeometries as Nt,deinterleaveGeometry as Ft}from"three/examples/jsm/utils/BufferGeometryUtils.js";import"three/examples/jsm/postprocessing/Pass.js";import{WorkerPool as zt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Ut,computeBoundsTree as jt,disposeBoundsTree as Gt,acceleratedRaycast as Ht}from"three-mesh-bvh";import{RectAreaLightUniformsLib as Vt}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as Qt}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as _t}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Yt}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Wt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Xt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Zt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Kt="soonspacejs",qt="2.8.5",Jt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function $t(){throw new Error("setTimeout has not been defined")}function en(){throw new Error("clearTimeout has not been defined")}var tn=$t,nn=en;function rn(e){if(tn===setTimeout)return setTimeout(e,0);if((tn===$t||!tn)&&setTimeout)return tn=setTimeout,setTimeout(e,0);try{return tn(e,0)}catch(t){try{return tn.call(null,e,0)}catch(t){return tn.call(this,e,0)}}}"function"==typeof Jt.setTimeout&&(tn=setTimeout),"function"==typeof Jt.clearTimeout&&(nn=clearTimeout);var sn,on=[],an=!1,ln=-1;function cn(){an&&sn&&(an=!1,sn.length?on=sn.concat(on):ln=-1,on.length&&un())}function un(){if(!an){var e=rn(cn);an=!0;for(var t=on.length;t;){for(sn=on,on=[];++ln<t;)sn&&sn[ln].run();ln=-1,t=on.length}sn=null,an=!1,function(e){if(nn===clearTimeout)return clearTimeout(e);if((nn===en||!nn)&&clearTimeout)return nn=clearTimeout,clearTimeout(e);try{return nn(e)}catch(t){try{return nn.call(null,e)}catch(t){return nn.call(this,e)}}}(e)}}function dn(e,t){this.fun=e,this.array=t}dn.prototype.run=function(){this.fun.apply(null,this.array)};function hn(){}var fn=hn,pn=hn,mn=hn,gn=hn,vn=hn,yn=hn,wn=hn;var bn=Jt.performance||{},xn=bn.now||bn.mozNow||bn.msNow||bn.oNow||bn.webkitNow||function(){return(new Date).getTime()};var An=new Date;var Sn,En={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];on.push(new dn(e,t)),1!==on.length||an||rn(un)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:fn,addListener:pn,once:mn,off:gn,removeListener:vn,removeAllListeners:yn,emit:wn,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*xn.call(bn),n=Math.floor(t),i=Math.floor(t%1*1e9);return e&&(n-=e[0],(i-=e[1])<0&&(n--,i+=1e9)),[n,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-An)/1e3}},Tn={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-Tn.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*Tn.Bounce.In(2*e):.5*Tn.Bounce.Out(2*e-1)+.5}}},Dn="undefined"==typeof self&&void 0!==En&&En.hrtime?function(){var e=En.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()},Cn=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=Dn()),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}(),In={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=In.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=In.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=In.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=In.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(Sn=[1],function(e){var t=1;if(Sn[e])return Sn[e];for(var n=e;n>1;n--)t*=n;return Sn[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}}},Mn=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Bn=new Cn,Pn=function(){function e(e,t){void 0===t&&(t=Bn),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=Tn.Linear.None,this._interpolationFunction=In.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Mn.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?Dn()+parseFloat(e):e:Dn(),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 u in t[r]=o?[]:{},s)t[r][u]=s[u];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=Dn()),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=Dn()),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=Dn()),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}(),On=Mn.nextId,Rn=Bn,Ln=Rn.getAll.bind(Rn),kn=Rn.removeAll.bind(Rn),Nn=Rn.add.bind(Rn),Fn=Rn.remove.bind(Rn),zn=Rn.update.bind(Rn),Un={Easing:Tn,Group:Cn,Interpolation:In,now:Dn,Sequence:Mn,nextId:On,Tween:Pn,VERSION:"18.6.4",getAll:Ln,removeAll:kn,add:Nn,remove:Fn,update:zn};var jn,Gn=(e=>(e[e.x=0]="x",e[e.y=1]="y",e[e.z=2]="z",e))(Gn||{});(jn=Gn||(Gn={})).toKey=function(e){return jn[e]},jn.toIndex=function(e){return jn[e]},jn.getCrossAxiss=function(e){return[(e+1)%3,(e+2)%3]};var Hn=(e=>(e[e.x=0]="x",e[e.y=1]="y",e[e.z=2]="z",e[e.w=3]="w",e))(Hn||{});(e=>{e.toKey=function(t){return e[t]},e.toIndex=function(t){return e[t]},e.getCrossAxiss=function(e){return[(e+1)%4,(e+2)%4]}})(Hn||(Hn={}));var Vn=Object.defineProperty,Qn=(e,t,n)=>(((e,t,n)=>{t in e?Vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function _n(e,r,s){const o=(s=s??0)+1;if(function(e){var t=typeof e;return null==e||"object"!==t&&"function"!==t}(e))return e;if(null!=e.x&&null!=e.y)return function(e){return null!=e.w?(new n).copy(e):null!=e.z?(new t).copy(e):(new i).copy(e)}(e);if(Array.isArray(e))return e.map((e=>_n(e,r,o)));if(e instanceof Map){const t=new Map;for(const n of e.keys()){const i=_n(e.get(n),r,o);t.set(n,i)}return t}if(function(e){return e&&"function"==typeof e[Symbol.iterator]}(e)){const t=[];for(const n of e){const e=_n(n,r,o);t.push(e)}return t}if((r||0===s)&&"object"==typeof e){const t={};for(const n of Object.keys(e))t[n]=_n(e[n],r,o);return t}return e}function Yn(e,t,n){let i=function(e,t){const n=Math.sqrt(e.lengthSq()*t.lengthSq());if(0===n)return 0;let i=e.dot(t)/n;return i=Math.max(-1,Math.min(1,i)),Math.acos(i)}(e,t);return 0===i?i:e.clone().cross(t).dot(n)<0?-i:i}const Wn=180/Math.PI,Xn={yaw:[{name:"前",range:[-15,15]},{name:"左",range:[15,165]},{name:"右",range:[-165,-15]},{name:"后",range:[-180.1,-165]},{name:"后",range:[165,180.1]}],pitch:[{name:"前",range:[-15,15]},{name:"上",range:[15,165]},{name:"下",range:[-165,-15]},{name:"后",range:[-180.1,-165]},{name:"后",range:[165,180.1]}],roll:[{name:"上",range:[-15,15]},{name:"左",range:[15,165]},{name:"右",range:[-165,-15]},{name:"下",range:[-180.1,-165]},{name:"下",range:[165,180.1]}]};const Zn={degrees:!0,map:Xn,front:{x:0,y:0,z:1},up:{x:0,y:1,z:0}};class Kn{constructor(e){Qn(this,"_options"),Qn(this,"_listMap"),Qn(this,"_front"),Qn(this,"_up"),e&&(this.options=e)}static get options(){return this._options??(this.options=Zn)}static set options(e){this._options=Object.assign({},structuredClone(Xn),e)}get defaultOptions(){return this.constructor.options}get options(){return this._options??(this.options=this.defaultOptions)}set options(e){this._options=Object.assign({},structuredClone(this.defaultOptions),e),this._listMap=null,this._front=null,this._up=null}get degrees(){return this.options.degrees??(this.options.degrees=this.defaultOptions.degrees??!0)}set degrees(e){this.options.degrees=e}get map(){return this.options.map||(this.map=this.defaultOptions.map),this.options.map}set map(e){const t=structuredClone(this.defaultOptions.map),n=structuredClone(Xn);e=e?{yaw:e.yaw??t.yaw??n.yaw,pitch:e.pitch??t.pitch??n.pitch,roll:e.roll??t.roll??n.roll}:t,this.options.map=e,this._listMap=null}get listMap(){return this._listMap??(this._listMap=function(e){const t={};for(const[n,i]of Object.entries(e))t[n]=Array.isArray(i)?i:Object.entries(i).map((([e,t])=>({name:e,range:t})));return t}(this.map??{}))}get front(){return this._front||(this.front=this.options.front??this.defaultOptions.front??Zn.front),this._front}set front(e){this._front=(new t).copy(e)}get up(){return this._up||(this.up=this.options.up??this.defaultOptions.up??Zn.up),this._up}set up(e){this._up=(new t).copy(e)}computeAzimuth(e,n,i){const r=(new t).copy(e),s=(new t).copy(n??this.front),o=(new t).copy(i??this.up);let{yaw:a,pitch:l,roll:c}=function(e,t,n){const i=t.clone().negate(),r=n.clone().projectOnPlane(t),s=Yn(t,e.clone().projectOnPlane(r),r),o=t.clone().cross(r);return{yaw:s,pitch:Yn(t,e.clone().projectOnPlane(o),o),roll:Yn(r,e.clone().projectOnPlane(i),i)}}(r,s,o);return this.degrees&&(a*=Wn,l*=Wn,c*=Wn),{yaw:{angle:a,name:this.findAzimuthNames("yaw",a)},pitch:{angle:l,name:this.findAzimuthNames("pitch",l)},roll:{angle:c,name:this.findAzimuthNames("roll",c)}}}findAzimuthNames(e,t){const n=[],i=this.listMap[e];if(!i)return n;for(const{name:e,range:[r,s]}of i)(t>=r&&t<s||t<=r&&t>s)&&n.push(e);return n}}Qn(Kn,"_options"),new Kn;const qn="[soonspacejs]: ";var Jn;!function(e){e.GROUP_MANAGE_TYPE="Group",e.LIGHT_MANAGE_TYPE="Light",e.MODEL_MANAGE_TYPE="Model",e.POI_MANAGE_TYPE="Poi",e.POI_NODE_MANAGE_TYPE="PoiNode",e.CANVAS3D_MANAGE_TYPE="Canvas3D",e.TOPOLOGY_MANAGE_TYPE="Topology",e.HELPER_MANAGE_TYPE="Helper",e.PLUGIN_OBJECT_MANAGE_TYPE="PluginObject"}(Jn||(Jn={}));const $n="In soonspacejs: ",ei=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},ti=e=>{console.warn($n+e)},ni=e=>{console.error($n+e)};function ii(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function ri(e){return e instanceof r?e:new r(e.x,e.y,e.z)}function si(e){const t=new s;return e instanceof o?e.children.filter((e=>!("isTransformControls"in e))).reduce(((e,t)=>e.union((new s).setFromObject(t))),t):t.setFromObject(e),t.isEmpty()&&(e.getWorldPosition(t.min),t.max.copy(t.min)),t}function oi(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 ai(e,t){const n=oi("x",e,t),i=oi("y",e,t),s=oi("z",e,t);return new r(n.x,i.y,s.z,t.order)}function li(e){return Math.PI/180*e}function ci(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new r).setFromQuaternion(e.getWorldQuaternion(new a)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function ui(e,t){const n=ci(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 di(e){return!!e.visible&&(!e.parent||di(e.parent))}class hi{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}}async function fi(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new l).setPath(t).loadAsync(n);{const e=Gi(n);if("hdr"===e||"pic"===e){const e=await(new Pt).setPath(t).setDataType(c).loadAsync(n);return e.mapping=u,e}{const e=await(new d).setPath(t).loadAsync(n);return e.mapping=u,e}}}function pi(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),a=new h,l=t.map((e=>a.set(e).getStyle()));for(let e=0,t=l.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,l[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const c=new f(r);return c.needsUpdate=!0,c}const mi=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function gi(e){return ki(e)?function(e){return e.map((e=>gi(e)))}(e):Ni(e)?function(e){if(Ni(e)){const t={};for(const n in e)t[n]=gi(e[n]);return t}return e}(e):e}const vi=(e,t)=>ki(e)?e.map(t):t(e),yi=e=>vi(e,(e=>e.clone())),wi=e=>vi(e,(e=>e.dispose())),bi=new p,xi=async(e,t)=>(bi.setResponseType(t),bi.loadAsync(e)),Ai=new t,Si=new t,Ei=new t;function Ti(e,t){const n=Ai.setFromMatrixPosition(e.matrixWorld),i=Si.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(Ei);return r.angleTo(s)>Math.PI/2}function Di(e,t,n,r){const s=Ai.setFromMatrixPosition(e.matrixWorld),o=s.clone();o.project(t),n.setFromCamera(new i(o.x,o.y),t);const a=n.intersectObjects(r,!0);if(a.length){const e=a[0].distance;return s.distanceTo(n.ray.origin)<e}return!0}const Ci=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var Ii=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 Mi(e){return xi(e,"text").then((e=>Promise.resolve(function(e){return(new Ii).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class Bi{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,r=new m,s=new Float32Array(3*i),o=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new a,d=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,r),r.decompose(c,u,d),s[3*t]=c.x,s[3*t+1]=c.y,s[3*t+2]=c.z,o[4*t]=u.x,o[4*t+1]=u.y,o[4*t+2]=u.z,o[4*t+3]=u.w,l[3*t]=d.x,l[3*t+1]=d.y,l[3*t+2]=d.z;const h=this.writer,f={};f.attributes={TRANSLATION:h.processAccessor(new g(s,3)),ROTATION:h.processAccessor(new g(o,4)),SCALE:h.processAccessor(new g(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=f,h.extensionsUsed[this.name]=!0}}const Pi=Object.prototype.hasOwnProperty,Oi=e=>"String"===zi(e),Ri=e=>"Boolean"===zi(e),Li=e=>"Number"===zi(e),ki=Array.isArray,Ni=e=>"Object"===zi(e),Fi=e=>"Function"===zi(e),zi=e=>Object.prototype.toString.call(e).slice(8,-1),Ui=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),ji=()=>qn+Math.random().toString(36).substring(7).split("").join("_"),Gi=e=>{var t;const{href:n}=new URL(e,location.origin);if(n.includes(".")){const e=n.split(".").pop();if(!e)return;return e.includes("?")?null===(t=e.split("?").shift())||void 0===t?void 0:t.toLowerCase():e}};var Hi=Object.freeze({__proto__:null,IVector3ToEuler:ri,IVector3ToVector3:ii,MinHeap:hi,cloneDeep:gi,cloneMaterials:yi,deg2Euler:li,disposeMaterials:wi,error:ni,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)=>{const r=new Ot;r.register((e=>new Bi(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:xi,getAsciiString:Ui,getBoundingBox:si,getExtension:Gi,getSpaceAttributeFromObject:ci,getTexture:fi,getValueType:zi,gradientTexture:pi,hasOwn:(e,t)=>Pi.call(e,t),idleTask:Ci,isArray:ki,isBoolean:Ri,isDate:e=>"Date"===zi(e),isFunction:Fi,isNull:e=>"Null"===zi(e),isNumber:Li,isObject:Ni,isObjectBehindCamera:Ti,isObjectOccludeVisible:Di,isObjectVisible:di,isPromise:e=>"Promise"===zi(e),isString:Oi,isSymbol:e=>"Symbol"===zi(e),isUndefined:e=>"Undefined"===zi(e),log:ei,materialHandle:vi,parseFilePath:mi,randomString:ji,rotationAFix:ai,rotationAxisFix:oi,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:ui,warn:ti,xmlToJson:Mi});const Vi={"Linear.None":Tn.Linear.None,"Quadratic.In":Tn.Quadratic.In,"Quadratic.Out":Tn.Quadratic.Out,"Quadratic.InOut":Tn.Quadratic.InOut,"Cubic.In":Tn.Cubic.In,"Cubic.Out":Tn.Cubic.Out,"Cubic.InOut":Tn.Cubic.InOut,"Quartic.In":Tn.Quartic.In,"Quartic.Out":Tn.Quartic.Out,"Quartic.InOut":Tn.Quartic.InOut,"Quintic.In":Tn.Quintic.In,"Quintic.Out":Tn.Quintic.Out,"Quintic.InOut":Tn.Quintic.InOut,"Sinusoidal.In":Tn.Sinusoidal.In,"Sinusoidal.Out":Tn.Sinusoidal.Out,"Sinusoidal.InOut":Tn.Sinusoidal.InOut,"Exponential.In":Tn.Exponential.In,"Exponential.Out":Tn.Exponential.Out,"Exponential.InOut":Tn.Exponential.InOut,"Circular.In":Tn.Circular.In,"Circular.Out":Tn.Circular.Out,"Circular.InOut":Tn.Circular.InOut,"Elastic.In":Tn.Elastic.In,"Elastic.Out":Tn.Elastic.Out,"Elastic.InOut":Tn.Elastic.InOut,"Back.In":Tn.Back.In,"Back.Out":Tn.Back.Out,"Back.InOut":Tn.Back.InOut,"Bounce.In":Tn.Bounce.In,"Bounce.Out":Tn.Bounce.Out,"Bounce.InOut":Tn.Bounce.InOut};function Qi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=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:u=!1,mode:d="Linear.None",yoyo:h=!1}=n,f=Vi[d],p=new Pn(e).to(t,l).easing(f).delay(c).onUpdate((n=>{e instanceof r&&t instanceof r&&n instanceof r&&(n.order=t.order),null==i||i(n,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));Li(u)?p.repeat(u):Ri(u)&&u&&p.repeat(1/0),p.yoyo(h),p.start()}))}class _i{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=ii(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=ii(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 Qi(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 Yi=Object.defineProperty,Wi=(e,t,n)=>(((e,t,n)=>{t in e?Yi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Xi(e,t){if(t=t??e.arcLengthDivisions,e.cacheArcULengths&&e.cacheArcULengths.length===t+1&&!e.needsUpdate){const n=e.cacheArcULengths;return{lengths:n,length:n[t]}}e.needsUpdate=!1;const n=[0];let i=e.getPoint(0),r=0;for(let s=1;s<=t;s++){const o=e.getPointAt(s/t);r+=o.distanceTo(i),n.push(r),i=o}return e.cacheArcULengths=n,{lengths:n,length:r}}function Zi(e,t,n){const i=n?t=>e.getPointAt(t):t=>e.getPoint(t);let r=i(0),s=0;const o=[],a=t.length;for(let e=0;e<a;e++){const n=i(t[e]);s+=n.distanceTo(r),o.push(s),r=n}return{lengths:o,length:o[a-1]}}function Ki(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function qi(e){const{curve:t}=e;let n=t.getLength();const i=Ki(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function Ji(e,t){const n=Ki(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return $i(i,{...t,lengths:r})}function $i(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new h(r):null,a=n?new h(n):o??new h(0,1,0),l=i?new h(i):o??new h(0,0,1),c=[],u=[];e[0].toArray(c,0);const d=c.length,f=s??tr(e).lengths,p=f[f.length-1],m=new h;e.forEach(((e,t)=>{e.toArray(c,t*d);const n=f[t]/p;m.lerpColors(a,l,n),m.toArray(u,3*t)}));const g=new v;return g.setAttribute("position",new y(c,d)),g.setAttribute("color",new y(u,3)),g}function er(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new w({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?$i(e,t):Ji(e,t);return new b(r,n)}function tr(e){const t=nr(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function nr(e){const t=[];return e.reduce(((e,n)=>{const i=new x(e,n);return t.push(i),n})),t}function ir(e,t){const n=[];return{lines:t.filter(((t,i)=>{const r=t.closestPointToPointParameter(e),s=0<=r||r>=1;return s&&n.push(i),s})),indexs:n}}function rr(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=sr(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function sr(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=A.clamp(s,0,1),a=n.at(o,new t),l=e.distanceTo(a);i.clampDists.push(l),i.clampPoints.push(a),i.distSortIndexs.push(r),i.ts.push(s),i.clampTs.push(o)})),i.distSortIndexs.sort(((e,t)=>i.clampDists[e]-i.clampDists[t])),i}function or(e){const t=new S,n=null==e[0].z?E:T;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var ar=(e=>(e.back="back",e.front="front",e))(ar||{});function lr(e){const{curve:t,distance:n,fromU:i=0,side:r,tolerance:s=.1*n}=e,o=e.length??t.getLength(),a=t.getPointAt(i);let l=n/o;const c="front"===r?-1:1;let u=!0,d=i,h=a,f=0,p=!0;do{d=c*l+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),h=t.getPointAt(d),f=h.distanceTo(a),u=Math.abs(n-f)>s;const r=n/f;if(e&&u&&r>1){p=!1;break}l*=r}while(u);return{succeed:p,u:d,point:h,distance:f}}function cr(e){const{curve:t,distance:n,fromU:i=0,tolerance:r=.1*n,origin:s}=e,o=e.length??t.getLength(),a=t.getPointAt(i),l=a.distanceTo(s),c=n-l;let u=c/o,d=!0,h=i,f=a;do{h=u+i;let e=!1;h>1?(h=1,e=!0):h<0&&(h=0,e=!0),f=t.getPointAt(h);const o=f.distanceTo(s);d=Math.abs(n-o)>r;const a=c/(o-l);if(e&&d&&a>1)return null;u*=a}while(d);return{u:h,point:f}}const ur=new t,dr=new t(1,1,1);new a;const hr=new m;function fr(e){const{joints:t,axials:n}=e;if(t)var i=mr(t);else i=n?pr(e):gr(e);return i}function pr(e){const{axials:t,start:n}=e,i=new D;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new D;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function mr(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),pr({axials:t,start:e[0]})}function gr(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),pr({axials:r,start:t})}function vr(e){const{geometry:n,flexible:i=1,axial:r,number:s}=e,o=e.start??new t,l=r.clone().normalize(),c=r.length(),u=s-1,d=(new a).setFromUnitVectors(new t(1,0,0),l),h=(new m).compose(o,d,new t(1,1,1)).invert(),f=n.getAttribute("position").clone(),p=f.count;f.applyMatrix4(h);const g=[],v=[];for(let e=0;e<p;e++){const t=f.getX(e);if(t<0){g.push(0,0,0,0),v.push(1,0,0,0);continue}const n=Math.trunc(t/c);if(n<u){const e=t%c/c*i;g.push(n,n+1,0,0),v.push(1-e,e,0,0)}else g.push(u,0,0,0),v.push(1,0,0,0)}return n.setAttribute("skinIndex",new C(g,4)),n.setAttribute("skinWeight",new y(v,4)),n}function yr(e){const{skeleton:n,geometryFrame:i}=e,r=n.boneInverses[0].clone().invert(),s=n.boneInverses[1].clone().invert();if(i){const e=i.clone().invert();r.premultiply(e),s.premultiply(e)}const o=(new t).setFromMatrixPosition(r),a=(new t).setFromMatrixPosition(s);return a.sub(o),vr({...e,start:o,axial:a,number:n.bones.length})}function wr(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??hr.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=nr(a),c=i.getAttribute("position"),u=c.count,d=[],h=[],f=new t;for(let e=0;e<u;e++){f.fromBufferAttribute(c,e);const{index:t,clampT:n}=rr(f,l),i=n*r;d.push(t,t+1,0,0),h.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new C(d,4)),i.setAttribute("skinWeight",new y(h,4)),i}function br(e){const{geometry:t}=e,n=e.material??void 0,i=new I(t,n),r=fr(e);i.add(r[0]);const s=new M(r);return i.bind(s),wr({...e,skeleton:s}),i}function xr(e){const{skeleton:t}=e,n=Ar(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function Ar(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new I;return t.copy.call(r,t,!1),wr({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function Sr(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=fr(e);n=new M(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=Er({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function Er(e){const{target:t,skeleton:n,parent:i,posOnBone:r}=e,s=t.isMesh,o=s?Ar({...e,skeleton:n}):t.clone(!1);i&&i.add(o),o.updateMatrixWorld(!0),s&&(o.bind(n,t.matrixWorld),r&&(o.frustumCulled=!1));const a=t.children;for(const t of a)Er({...e,target:t,parent:o});return o}function Tr(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Dr(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Cr(e){return Dr(e)??e[0]}function Ir(e){return e.curve?Mr(e):kr(e)}function Mr(e){const{keyframeTracks:t,duration:n,...i}=Br(e);return{...i,clip:new B(e.name,n,t)}}function Br(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=qi(e).division,s=Pr(e,t.getLength()),o=L,a=[],l=Rr(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=Lr(c),{points:d,rotates:h,...f}=Or(c);if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new P(`${i}.position`,u,e,o);a.push(t)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const t=new O(`${i}.quaternion`,u,e,o);a.push(t)}return{...f,keyframeTracks:a,duration:s}}function Pr(e,t){let n=e.duration;if(!n){const i=e.speed;if(null==i)throw"缺少选项 duration 或者 speed";if(!t)throw"缺少参数 length";n=t/i}return n}function Or(e){var n,i;const{curve:r,target:s,lookPoint:o,enableUp:l,fixUp:c}=e,u=e.position??!0,d=e.rotate??!0,h=[],f=[],p=[];if(!u&&!d)return{rotates:h,points:f,curveLength:void 0,lengths:void 0};const g=(e.anchor??ur).clone(),v=e.ts??e.us,y=!e.ts;if(!v)throw"缺少参数:至少传递 ts 和 us 任意之一";let w=hr.clone(),b=hr.clone(),x=dr.clone(),A=R.DEFAULT_UP;s&&(s.updateWorldMatrix(!0,!1),w=s.matrix,b=s.matrixWorld,x=s.scale,A=s.up);const S=w.clone().invert(),E=b.clone().multiply(S).clone().invert(),T=r.getTangent(0);T.transformDirection(E);const D=(null==(n=e.front)?void 0:n.clone().normalize())??T,C=(null==(i=e.up)?void 0:i.clone().normalize())??A.clone().transformDirection(E);let I=w.clone().setPosition(0,0,0),M=e=>r.getPoint(e),B=e=>r.getTangent(e);y&&(M=e=>r.getPointAt(e),B=e=>r.getTangentAt(e));const P=v.length,O=P-1;let{distance:L,curveLength:k,lengths:N}=o??{};L=L??0;let F=B;0!==L&&(N||(N=Zi(r,v,y).lengths),null==k&&(k=N[O]),F=(e,t)=>{const n=M(e);let i=(N[t]+L)/k;return i>1&&(i=1),r.getPointAt(i).sub(n).normalize()});let z=e=>{const t=v[e],n=F(t,e);n.transformDirection(E),p.push(n);const i=e-1,r=i<0,s=r?D:p[i],o=(new a).setFromUnitVectors(s,n);if(!r){const e=h[i];o.multiply(e)}return o.normalize()};if(l){const e=new t(0,1,0);z=c?function(t){const n=v[t],i=F(n,t);i.transformDirection(E),p.push(i);const r=t-1;let s;if(r<0)s=(new a).setFromUnitVectors(D,i);else{const e=h[r],t=D.clone().applyQuaternion(e).normalize();s=(new a).setFromUnitVectors(t,i),s.multiply(e)}const o=C.clone().applyQuaternion(s).normalize(),l=(new a).setFromUnitVectors(o,e);return s.premultiply(l),s.normalize()}:function(t){const n=v[t],i=F(n,t);i.transformDirection(E),p.push(i);const r=t-1,s=r<0,o=s?D:p[r],l=(new a).setFromUnitVectors(o,i);if(s){const t=C.clone().applyQuaternion(l);t.projectOnPlane(i).normalize();const n=e.clone().projectOnPlane(i).normalize(),r=(new a).setFromUnitVectors(t,n);l.premultiply(r)}else{const e=h[r];l.multiply(e)}return l.normalize()}}for(let e=0;e<P;e++){const t=v[e];if(d){const t=z(e);h.push(t),I=(new m).compose(ur,t,x)}if(u){const e=M(t);e.applyMatrix4(E);const n=g.clone().applyMatrix4(I);e.sub(n),f.push(e)}}return{rotates:h,points:f,curveLength:k??void 0,lengths:N??void 0}}function Rr(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function Lr(e){const{curve:t,division:n,duration:i}=e,r=t.getLengths(n),s=r[r.length-1];return r.map((e=>e/s*i))}function kr(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r,...s}=Nr(e);else{const t=or(n);var{keyframeTracks:i,duration:r,...s}=Br({...e,curve:t})}return{...s,clip:new B(e.name,r,i)}}function Nr(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=tr(n),o=Pr(e,r),a=[],l=s.map((e=>e/r*o)),{points:c,pointTimes:u,rotates:d,rotateTimes:h}=Fr({...e,times:l},i);if(c.length){const e=[];c.forEach(((t,n)=>{t.toArray(e,3*n)}));const n=new P(`${t}.position`,u,e,L);a.push(n)}if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new O(`${t}.quaternion`,h,e,k);a.push(n)}return{keyframeTracks:a,duration:o,lengths:s,curveLength:r}}function Fr(e,n){var i,r;const{points:s,target:o,times:l,enableUp:c,fixUp:u}=e,d=e.position??!0,h=e.rotate??!0,f=s.length,p=f-1;n=n??nr(s);const g=[],v=[],y=[],w=[],b={rotates:g,points:v,rotateTimes:l,pointTimes:y};if(!d&&!h)return b;const x=(e.anchor??ur).clone();let A=hr.clone(),S=hr.clone(),E=dr.clone(),T=R.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),A=o.matrix,S=o.matrixWorld,E=o.scale,T=o.up);const D=A.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const M=(null==(i=e.front)?void 0:i.clone().normalize())??I,B=(null==(r=e.up)?void 0:r.clone().normalize())??T.clone().transformDirection(C);let P=A.clone().setPosition(0,0,0),O=P,L=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const r=e-1,s=r<0,o=s?M:w[r],l=(new a).setFromUnitVectors(o,i);if(!s){const e=g[r];l.multiply(e)}return l.normalize()};if(c){const e=new t(0,1,0);L=u?function(i){const r=n[i].delta(new t).normalize();r.transformDirection(C),w.push(r);const s=i-1;let o;if(s<0)o=(new a).setFromUnitVectors(M,r);else{const e=g[s],t=M.clone().applyQuaternion(e).normalize();o=(new a).setFromUnitVectors(t,r),o.multiply(e)}const l=B.clone().applyQuaternion(o).normalize(),c=(new a).setFromUnitVectors(l,e);return o.premultiply(c),o.normalize()}:function(i){const r=n[i].delta(new t).normalize();r.transformDirection(C),w.push(r);const s=i-1,o=s<0,l=o?M:w[s],c=(new a).setFromUnitVectors(l,r);if(o){const t=B.clone().applyQuaternion(c);t.projectOnPlane(r).normalize();const n=e.clone().projectOnPlane(r).normalize(),i=(new a).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=g[s];c.multiply(e)}return c.normalize()}}for(let e=0;e<f;e++){if(h)if(e<p){const t=L(e);g.push(t),P=(new m).compose(ur,t,E)}else g.push(g[e-1].clone());if(d){const t=l[e],n=s[e].clone();if(n.applyMatrix4(C),e>0){const e=x.clone().applyMatrix4(O),i=n.clone().sub(e);v.push(i),y.push(t)}const i=x.clone().applyMatrix4(P);n.sub(i),v.push(n),y.push(t)}O=P}return b}function zr(e){const t=e.mixer,n=Sr(e),{model:i,skeleton:r}=n,s={...e,target:i,skeleton:r},{clip:o,...a}=e.posOnBone?Ur(s):Hr(s);i.animations.push(o);const l=null==t?void 0:t.clipAction(o,i);return{...a,...n,clip:o,action:l}}function Ur(e){const{boneTracks:t,duration:n,...i}=jr(e),r=t.flat();return{...i,clip:new B(e.name,n,r)}}function jr(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o,...a}=Gr(e),l=r.length,c=L,u=s.map(((e,t)=>{const{points:s,rotates:o}=e,a=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${a.name||a.uuid}`,d=[],h=[];for(let e=0;e<l;e++)s&&s[e].toArray(d,3*e),o[e].toArray(h,4*e);const f=[];if(s){const e=new P(`${u}.position`,r,d,c);f.push(e)}const p=new O(`${u}.quaternion`,r,h,c);return f.push(p),f}));return{...a,boneTracks:u,duration:o}}function Gr(e){var n;const{curve:i,skeleton:r,stretch:s}=e,{bones:o,boneInverses:l}=r,c=o[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const d=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:h,length:f}=qi(e),{matrixWorld:p}=u,g=p.clone().invert(),v=[],y=[];l.reduce(((e,t)=>{const n=t.clone().invert();v.push(n);const i=e.clone().multiply(n);return y.push(i),t}),g);const w=y[0],b=new t,x=new a,A=new t;w.decompose(b,x,A);const S=Pr(e,f),E=Rr(h),T=Lr({curve:i,division:h,duration:S}),D=E.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),M=l[0],B=null==(n=e.up)?void 0:n.clone().applyMatrix4(p).transformDirection(M),{points:P,rotates:O,...R}=Or({...e,curve:i,ts:E,target:c,rotate:!0,front:I,up:B,anchor:null});for(let e=0;e<D;e++)C.push(p.clone());const L=P.map(((e,t)=>{const n=O[t];n.premultiply(x).normalize();const i=(new m).compose(e,n,A);return i.premultiply(p),i})),k=i.getLengths(h).map((e=>e/f)),N=[{points:P,rotates:O,us:k,matrixs:L}],F=s?function(e,t,n){const r=N[e].us[t]-n/f;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=N[e].us[t],{u:s,point:o,succeed:a}=lr({curve:i,distance:n,fromU:r,length:f,side:ar.front,tolerance:d*n});return{u:s,point:a?o:null}},z=l.length,U=z-1;for(let e=1;e<z;e++){const n=[],r=[],s=[],o=[];N.push({points:n,rotates:r,us:s,matrixs:o});const l=y[e],c=v[e],u=e-1,d=N[u],h=y[u],f=v[u],{matrixs:p,points:g,rotates:w}=d,b=(new t).setFromMatrixScale(h),x=u-1,A=x<0?C:N[x].matrixs,S=new t,E=new a,T=new t;l.decompose(S,E,T);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(f)).length(),M=S.length();for(let t=0;t<D;t++){const{point:c,u:d}=F(u,t,I);s.push(d),r.push(E.clone());const h=p[t];if(d<0||!c){n.push(S);const e=h.clone().multiply(l);o.push(e);continue}const f=A[t];let v=f.clone().invert();const y=c.clone().applyMatrix4(v),x=g[t];y.sub(x).normalize();const D=w[t],C=(new m).compose(x,D,b),B=S.clone().transformDirection(C),P=(new a).setFromUnitVectors(B,y);D.premultiply(P).normalize(),h.compose(x,D,b),h.premultiply(f);const O=h.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/M),n.push(c);const L=(new m).compose(c,E,T);if(e===U){const e=i.getTangentAt(d);e.negate().transformDirection(O);const n=(new a).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(E).normalize(),r[t]=n,L.compose(c,n,T)}L.premultiply(h),o.push(L)}}return{...R,times:T,boneSampleDatas:N,duration:S}}function Hr(e){const{boneTracks:t,targetTracks:n,duration:i,...r}=Vr(e),s=n.concat(t.flat());return{...r,clip:new B(e.name,i,s)}}function Vr(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o,...a}=Qr(e),l=i.length,c=t.bones,u=L,d=[],h=[],{points:f,rotates:p}=o;for(let e=0;e<l;e++)f[e].toArray(d,3*e),p[e].toArray(h,4*e);const m=n??"",g=[new P(`${m}.position`,i,d,u),new O(`${m}.quaternion`,i,h,u)],v=r.map(((e,t)=>{const{points:r,rotates:s}=e,o=c[t],a=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,d=[],h=[];for(let e=0;e<l;e++)r&&r[e].toArray(d,3*e),s[e].toArray(h,4*e);const f=[];if(r){const e=new P(`${a}.position`,i,d,u);f.push(e)}const p=new O(`${a}.quaternion`,i,h,u);return f.push(p),f}));return{...a,boneTracks:v,targetTracks:g,duration:s}}function Qr(e){const{curve:n,skeleton:i,stretch:r}=e,{bones:s,boneInverses:o}=i,l=s[0],c=e.target??l.parent;if(!c)throw"target 或 根骨骼的 parent 不存在";const u=e.tolerance??.1;l.updateWorldMatrix(!0,!0);const{division:d,length:h}=qi(e),{matrix:f,matrixWorld:p,scale:g}=c,v=p.clone().multiply(f.clone().invert()),y=p.clone().invert(),w=[],b=[];o.reduce(((e,t)=>{const n=t.clone().invert();w.push(n);const i=e.clone().multiply(n);return b.push(i),t}),y);const x=b[0],A=new t,S=new a,E=new t;x.decompose(A,S,E);const T=Pr(e,h),D=Rr(d),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:M,points:B,...P}=Or({...e,curve:n,target:c,position:!0,rotate:!0,anchor:A,front:I,ts:D}),O=Lr({curve:n,division:d,duration:T}),R=B.map(((e,t)=>{const n=M[t],i=(new m).compose(e,n,g);return i.premultiply(v),i})),L={points:B,rotates:M,matrixs:R},k=[],N=R.map((e=>(k.push(S.clone()),e.clone().multiply(x)))),F=D.length,z=n.getLengths(d).map((e=>e/h)),U=[{rotates:k,us:z,matrixs:N}],j=r?function(e,t,i){const r=U[e].us[t]-i/h;return{u:r,point:r<0?null:n.getPointAt(r)}}:function(e,t,i){const r=U[e].us[t],{u:s,point:o,succeed:a}=lr({curve:n,distance:i,fromU:r,length:h,side:ar.front,tolerance:u*i});return{u:s,point:a?o:null}},G=o.length,H=G-1;for(let e=1;e<G;e++){const i=[],r=[],s=[],o=[];U.push({points:i,rotates:r,us:s,matrixs:o});const l=b[e],c=w[e],u=e-1,d=U[u],h=b[u],f=w[u],{matrixs:p,points:g,rotates:v}=d,y=new t,x=new a,A=new t;h.decompose(y,x,A);const S=u-1,E=S<0?R:U[S].matrixs,T=new t,D=new a,C=new t;l.decompose(T,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(f)).length(),M=T.length();for(let t=0;t<F;t++){const{point:c,u:d}=j(u,t,I);s.push(d),r.push(D.clone());const h=p[t];if(d<0||!c){i.push(T);const e=h.clone().multiply(l);o.push(e);continue}const f=E[t];let w=f.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==g?void 0:g[t])??y;b.sub(S).normalize();const B=v[t],P=(new m).compose(S,B,A),O=T.clone().transformDirection(P);B.setFromUnitVectors(O,b),B.premultiply(x).normalize(),h.compose(S,B,A),h.premultiply(f);const R=h.clone().invert();c.applyMatrix4(R);const L=c.length();c.copy(T).multiplyScalar(L/M),i.push(c);const k=(new m).compose(c,D,C);if(e===H){const e=n.getTangentAt(d);e.negate().transformDirection(R);const i=(new a).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D).normalize(),r[t]=i,k.compose(c,i,C)}k.premultiply(h),o.push(k)}}return{...P,times:O,boneSampleDatas:U,targetSampleDatas:L,duration:T}}class _r{constructor(e){Wi(this,"isAnimationClipKeyframe",!0),Wi(this,"_tracksTimes",null),Wi(this,"lastGetTime",0),Wi(this,"lastGetKeyframeIndexs",[]),this.clip=e}get tracksTimes(){return this._tracksTimes??(this._tracksTimes=this.clip.tracks.map((e=>e.times)))}getTracksKeyframeIndexs(e){const{lastGetTime:t,tracksTimes:n}=this;e<t&&(this.lastGetKeyframeIndexs=[]),this.lastGetTime=e;const i=this.lastGetKeyframeIndexs;return this.lastGetKeyframeIndexs=n.map(((t,n)=>{const r=i[n]??0,s=t.length;for(let n=r;n<s;n++)if(e<t[n])return n-1;return s-1}))}getTracksKeyframes(e){const t=this.getTracksKeyframeIndexs(e),n=this.clip.tracks;return t.map(((e,t)=>{let i=null;if(-1!==e){const r=n[t],s=r.getValueSize(),o=e*s,a=o+s;i=Array.from(r.values.slice(o,a))}return{index:e,value:i}}))}}var Yr=(e=>(e.keyframe="keyframe",e.position=".position",e.quaternion=".quaternion",e.rotation=".rotation",e.scale=".scale",e.loop="loop",e.finished="finished",e.point="point",e))(Yr||{});const Wr=["loop","finished"];class Xr extends _r{constructor(e){super(e.getClip()),Wi(this,"isAnimationActionKeyframe",!0),Wi(this,"_trackNames"),Wi(this,"_positionTrackName"),Wi(this,"_quaternionTrackName"),Wi(this,"_rotationTrackName"),Wi(this,"_scaleTrackName"),Wi(this,"event",new N),Wi(this,"_frameEventNames",null),Wi(this,"mixerListener",(e=>{(e.action.isAnimationActionKeyframe?e.action.action:e.action)===this.action&&this.event.dispatchEvent(e)})),Wi(this,"_points",[]),Wi(this,"_polyline"),Wi(this,"_polylineLengths",[]),Wi(this,"_pointsProgress",[]),Wi(this,"lastGetProgress",0),Wi(this,"lastGetPointIndex",0),Wi(this,"_enablePointEvent",!0),Wi(this,"_enableKeyframeEvent",!0),Wi(this,"lastKeyframes",null),Wi(this,"lastPolylineKeyframe",null),Wi(this,"frameFun",(()=>{var e;if(this.enableKeyframeEvent){const{keyframes:e,lastKeyframes:t}=this;let n=!1;for(const[i,r]of Object.entries(e)){const e=null==t?void 0:t[i];r.index!==(null==e?void 0:e.index)&&(n=!0,this.event.dispatchEvent({type:i,preFrame:e,frame:r}))}n&&(this.event.dispatchEvent({type:"keyframe",preFrame:t,frame:e}),this.lastKeyframes=e)}if(this.pointEventEnabled){const{pointIndex:t,lastPolylineKeyframe:n}=this;if(t!==(null==n?void 0:n.index)){const i={index:t,value:this.points[t]??(null==(e=this.polyline)?void 0:e.getPoint(this.progress)),length:this.polylineLengths[t]};this.event.dispatchEvent({type:"point",preFrame:n,frame:i}),this.lastPolylineKeyframe=i}}})),Wi(this,"_stopListenFun"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progressTime(){const{isReverseLoop:e,duration:t,time:n}=this;return e?t-n:n}set progressTime(e){const{action:t,isReverseLoop:n,duration:i}=this;n&&(e=i-e),t.time=e}get progress(){return this.progressTime/this.duration}set progress(e){this.progressTime=e*this.duration}get loopCount(){const e=this.action._loopCount;return-1===e?0:e}get isReverseLoop(){return this.action.loop===F&&this.loopCount%2==1}get loopDirFactor(){return this.isReverseLoop?-1:1}get isReverse(){const e=this.action.timeScale<0;return this.isReverseLoop?!e:e}get dirFactor(){return this.isReverse?-1:1}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.progressTime);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.progressTime);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get positionTrackName(){return void 0===this._positionTrackName&&(this._positionTrackName=this.trackNames.find((e=>e.endsWith(".position")))??null),this._positionTrackName}get positionkeyframeIndex(){const e=this.positionTrackName;return e?this.keyframeIndexs[e]:null}get positionKeyframe(){const e=this.positionTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get quaternionTrackName(){return void 0===this._quaternionTrackName&&(this._quaternionTrackName=this.trackNames.find((e=>e.endsWith(".quaternion")))??null),this._quaternionTrackName}get quaternionKeyframeIndex(){const e=this.quaternionTrackName;return e?this.keyframeIndexs[e]:null}get quaternionKeyframe(){const e=this.quaternionTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new a(...n):null}}return null}get rotationTrackName(){return void 0===this._rotationTrackName&&(this._rotationTrackName=this.trackNames.find((e=>e.endsWith(".rotation")))??null),this._rotationTrackName}get rotationkeyframeIndex(){const e=this.rotationTrackName;return e?this.keyframeIndexs[e]:null}get rotationKeyframe(){const e=this.rotationTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new r(...n):null}}return null}get scaleTrackName(){return void 0===this._scaleTrackName&&(this._scaleTrackName=this.trackNames.find((e=>e.endsWith(".scale")))??null),this._scaleTrackName}get scaleKeyframeIndex(){const e=this.scaleTrackName;return e?this.keyframeIndexs[e]:null}get scaleKeyframe(){const e=this.scaleTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get frameEventNames(){return this._frameEventNames??(this._frameEventNames=[...this.trackNames,"keyframe","point"])}get mixer(){return this.action._mixer}addEventListener(e,t){const n=this.mixerListener;return Wr.includes(e)&&!this.mixer.hasEventListener(e,n)?(this.mixer.addEventListener(e,n),this.event.addEventListener(e,t),!0):!!this.frameEventNames.includes(e)&&(this.event.addEventListener(e,t),!this._stopListenFun&&this.enableFrameEvent&&(this._stopListenFun=Zr(this.frameFun)),!0)}removeEventListener(e,t){if(Wr.includes(e)&&1===this.getListeners(e).length){const t=this.mixerListener;this.mixer.removeEventListener(e,t)}this.event.removeEventListener(e,t),this.stopListenFun&&!this.hasListeners&&(this.stopListenFun=null)}get points(){return this._points}set points(e){e.length>1?(this._points=e,this.polyline=or(e)):(this._points=[],this.polyline=null)}get polyline(){return this._polyline}set polyline(e){this._polyline=e;const t=(null==e?void 0:e.getCurveLengths())??[];this.polylineLengths=[0,...t]}get polylineLengths(){return this._polylineLengths}set polylineLengths(e){this._polylineLengths=e;const t=1/e[e.length-1];this.pointsProgress=e.map((e=>e*t))}get polylineLength(){return this.polylineLengths[this.polylineLengths.length-1]}get polylineProgressLength(){return this.polylineLength*this.progress}get pointsProgress(){return this._pointsProgress}set pointsProgress(e){this._pointsProgress=e}get pointIndex(){return this.getPointIndex(this.progress)}getPointIndex(e){const{lastGetProgress:t,pointsProgress:n}=this;e<t&&(this.lastGetPointIndex=0),this.lastGetProgress=e;const i=Math.max(this.lastGetPointIndex,0),r=n.length;for(let t=i;t<r;t++)if(e<n[t])return this.lastGetPointIndex=t-1;return this.lastGetPointIndex=r-1}get enablePointEvent(){return this._enablePointEvent}set enablePointEvent(e){this._enablePointEvent=e,e&&this.autoStartListen()}get pointEventEnabled(){return this.enablePointEvent&&this.pointsProgress.length>0&&this.getListeners("point").length>0}get enableKeyframeEvent(){return this._enableKeyframeEvent}set enableKeyframeEvent(e){this._enableKeyframeEvent=e,e&&this.autoStartListen()}get enableFrameEvent(){return this.enableKeyframeEvent||this.enablePointEvent}get stopListenFun(){return this._stopListenFun}set stopListenFun(e){const t=this._stopListenFun;t&&t(),this._stopListenFun=e}startListen(){this.stopListenFun||(this.stopListenFun=Zr(this.frameFun))}stopListen(){this.stopListenFun=null}autoStartListen(){!this.stopListenFun&&this.enableFrameEvent&&this.hasListeners&&(this.stopListenFun=Zr(this.frameFun))}get listeners(){return this.event._listeners}get hasListeners(){const e=this.listeners;return!!e&&Object.values(e).some((e=>e&&e.length>0))}getListeners(e){var t;return(null==(t=this.listeners)?void 0:t[e])??[]}destroy(e){const{action:t,mixer:n,mixerListener:i}=this;this.stopListen(),n.removeEventListener("loop",i),n.removeEventListener("finished",i),this.event._listeners=null,!e&&(t.stop(),t.reset(),n._deactivateAction(t),n._removeInactiveAction(t))}}function Zr(e){let t;const n=i=>{e(i),t=requestAnimationFrame(n)};return t=requestAnimationFrame(n),()=>{cancelAnimationFrame(t)}}class Kr extends Xr{constructor(){super(...arguments),Wi(this,"isAnimationActionOperate",!0)}forward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=e}backward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=-e}}function qr(e){const t=new Kr(e);return new Proxy(t,{get:function(e,t,n){return t in e.action?e.action[t]:e[t]},set:function(e,t,n,i){return t in e.action?e.action[t]=n:e[t]=n,!0},deleteProperty:function(e,t){return t in e.action?Reflect.deleteProperty(e.action,t):Reflect.deleteProperty(e,t)},has:function(e,t){return t in e.action||t in e},ownKeys:function(e){return Reflect.ownKeys(e.action).concat(Reflect.ownKeys(e))}})}class Jr{constructor(e){Wi(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&qr(e)}get play(){const e=this.action;return!(!e||!e._mixer._isActiveAction(e)||e.paused)}set play(e){const t=this.action;t&&(t.paused=!e,e&&0===t.time&&t.play())}stop(){var e;null==(e=this.action)||e.stop()}}function $r(e){var t;null==(t=e.reset)||t.call(e,!0)}class es extends Jr{constructor(e,t=[]){super(e),Wi(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??$r}set updateGUI(e){this._updateGUI=e}get action(){return this._action}set action(e){this.setAction(e),this.updateAllGUI()}updateAllGUI(){for(const e of this.guis)this.updateGUI(e)}}function ts(e){const t=new es(e);return new Proxy(t,{get:function(e,t,n){var i;return t in e?e[t]:null==(i=e.action)?void 0:i[t]},set:function(e,t,n,i){if(t in e)e[t]=n;else{if(!e.action)return!1;e.action[t]=n}return!0},deleteProperty:function(e,t){return t in e?Reflect.deleteProperty(e,t):!!e.action&&Reflect.deleteProperty(e.action,t)},has:function(e,t){return t in e||!!e.action&&t in e.action},ownKeys:function(e){return e.action?Reflect.ownKeys(e).concat(Reflect.ownKeys(e.action)):Reflect.ownKeys(e)}})}function ns(e,t=1){const n=e.slice().sort(((e,t)=>e-t)),i=[[]];return n.reduce((function(e,n){const r=e[e.length-1];return null==r||n-r<=t?e.push(n):(e=[n],i.push(e)),e}),i[0]),i}function is(e,t){let{count:n=4,min:i=-1/0,max:r=1/0}=t??{};const s=e[0];i=Math.max(s-n+1,i),r=Math.min(s+n-1,r),n=Math.min(n,r-i+1);const o=[];for(const t of e)i<=t&&t<=r&&o.push(t);const a=ns(o);a.sort(((e,t)=>t.length-e.length));let l=a.find((e=>e.includes(s)));if(l.length>=n)return l.sort(((t,n)=>e.indexOf(t)-e.indexOf(n))),l=l.slice(0,n),l.sort(((e,t)=>e-t)),l;for(const e of o){i=l[0],r=l[l.length-1];let t=i-e,s=n-l.length;if(t>0&&t<=s)for(let t=e;t<i;t++)l.unshift(t);else if(t=e-r,t>0&&t<=s)for(let t=r+1;t<=e;t++)l.push(t);else;}return l}Wi(es,"updateGUI",$r);var rs="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ss(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 os={},as={},ls=function(e,t){return ls=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])},ls(e,t)};function cs(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}ls(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var us=function(){return us=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},us.apply(this,arguments)};function ds(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}function hs(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}function fs(e,t){return function(n,i){t(n,i,e)}}function ps(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function ms(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())}))}function gs(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])}}}var vs=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 ys(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||vs(t,e,n)}function ws(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 bs(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 xs(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(bs(arguments[t]));return e}function As(){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}function Ss(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))}function Es(e){return this instanceof Es?(this.v=e,this):new Es(e)}function Ts(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 Es?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Ds(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:Es(e[i](t)),done:!1}:r?r(t):t}:r}}function Cs(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ws(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)}))}}}function Is(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var Ms=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function Bs(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)&&vs(t,e,n);return Ms(t,e),t}function Ps(e){return e&&e.__esModule?e:{default:e}}function Os(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 Rs(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}function Ls(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)}function ks(e,t,n){if(null!=t){if("object"!=typeof t)throw new TypeError("Object expected.");var i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose]}if("function"!=typeof i)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t}var Ns="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i};function Fs(e){function t(t){e.error=e.hasError?new Ns(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var i=e.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}var zs={__extends:cs,__assign:us,__rest:ds,__decorate:hs,__param:fs,__metadata:ps,__awaiter:ms,__generator:gs,__createBinding:vs,__exportStar:ys,__values:ws,__read:bs,__spread:xs,__spreadArrays:As,__spreadArray:Ss,__await:Es,__asyncGenerator:Ts,__asyncDelegator:Ds,__asyncValues:Cs,__makeTemplateObject:Is,__importStar:Bs,__importDefault:Ps,__classPrivateFieldGet:Os,__classPrivateFieldSet:Rs,__classPrivateFieldIn:Ls,__addDisposableResource:ks,__disposeResources:Fs},Us=Object.freeze({__proto__:null,__addDisposableResource:ks,get __assign(){return us},__asyncDelegator:Ds,__asyncGenerator:Ts,__asyncValues:Cs,__await:Es,__awaiter:ms,__classPrivateFieldGet:Os,__classPrivateFieldIn:Ls,__classPrivateFieldSet:Rs,__createBinding:vs,__decorate:hs,__disposeResources:Fs,__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",u=!t&&e?i.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),h=!1,f=n.length-1;f>=0;f--){var p={};for(var m in i)p[m]="access"===m?{}:i[m];for(var m in i.access)p.access[m]=i.access[m];p.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var g=(0,n[f])("accessor"===l?{get:d.get,set:d.set}:d[c],p);if("accessor"===l){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=o(g.get))&&(d.get=a),(a=o(g.set))&&(d.set=a),(a=o(g.init))&&r.unshift(a)}else(a=o(g))&&("field"===l?r.unshift(a):d[c]=a)}u&&Object.defineProperty(u,i.name,d),h=!0},__exportStar:ys,__extends:cs,__generator:gs,__importDefault:Ps,__importStar:Bs,__makeTemplateObject:Is,__metadata:ps,__param:fs,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:bs,__rest:ds,__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:xs,__spreadArray:Ss,__spreadArrays:As,__values:ws,default:zs}),js=ss(Us),Gs={},Hs={},Vs={},Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});var _s=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}();Qs.SlotList=_s;var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0});var Ws=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}();Ys.Slot=Ws,Object.defineProperty(Vs,"__esModule",{value:!0});var Xs=Qs,Zs=Ys,Ks=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=Xs.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=Xs.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 Zs.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}();Vs.OnceSignal=Ks,Object.defineProperty(Hs,"__esModule",{value:!0});var qs=js,Js=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qs.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(Vs.OnceSignal);Hs.Signal=Js,Object.defineProperty(Gs,"__esModule",{value:!0});var $s=js,eo=Ys,to=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return $s.__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 eo.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(Hs.Signal);Gs.PrioritySignal=to,Object.defineProperty(as,"__esModule",{value:!0});var no=js,io=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 no.__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}(Gs.PrioritySignal);as.DeluxeSignal=io;var ro={};Object.defineProperty(ro,"__esModule",{value:!0});var so=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}();ro.GenericEvent=so;var oo={};Object.defineProperty(oo,"__esModule",{value:!0}),oo.IOnceSignal=Symbol("IOnceSignal");var ao={};Object.defineProperty(ao,"__esModule",{value:!0}),ao.IPrioritySignal=Symbol("IPrioritySignal");var lo={};Object.defineProperty(lo,"__esModule",{value:!0}),lo.ISignal=Symbol("ISignal");var co={};Object.defineProperty(co,"__esModule",{value:!0}),co.ISlot=Symbol("ISlot");var uo={};Object.defineProperty(uo,"__esModule",{value:!0});var ho=Ys,fo=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 ho.Slot(e,this,t)},e}();uo.MonoSignal=fo;var po={};Object.defineProperty(po,"__esModule",{value:!0});var mo=js,go=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return mo.__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}(Vs.OnceSignal);po.Promise=go,Object.defineProperty(os,"__esModule",{value:!0});var vo=as;os.DeluxeSignal=vo.DeluxeSignal;var yo=ro;os.GenericEvent=yo.GenericEvent;var wo=oo;os.IOnceSignal=wo.IOnceSignal;var bo=ao;os.IPrioritySignal=bo.IPrioritySignal;var xo=lo;os.ISignal=xo.ISignal;var Ao=co;os.ISlot=Ao.ISlot;var So=uo;os.MonoSignal=So.MonoSignal;var Eo=Vs;os.OnceSignal=Eo.OnceSignal;var To=Gs;os.PrioritySignal=To.PrioritySignal;var Do=po;os.Promise=Do.Promise;var Co=Hs,Io=os.Signal=Co.Signal,Mo=Ys;os.Slot=Mo.Slot;var Bo=Qs;os.SlotList=Bo.SlotList;function Po(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 Oo={};({get exports(){return Oo},set exports(e){Oo=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&Po)return Po(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=Po,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(u),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(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var l=new e.MessageChannel;l.port1.onmessage=u,n=function(){l.port2.postMessage(0)}}var c=[];function u(){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 d(e){1!==c.push(e)||i||n()}t.exports=d}).call(this,void 0!==rs?rs:"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 u(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 d(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 h(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 m(e){return e instanceof this?e:s.resolve(new this(r),e)}function g(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;)u(e[l],l);return c;function u(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?d(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){s.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=p(h,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=m,c.reject=g,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!==rs?rs:"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 u(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function d(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function h(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",m=void 0,g={},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 x(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 A(e){return"boolean"==typeof m?c.resolve(m):x(e).then((function(e){return m=e}))}function S(e){var t=g[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=g[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function T(e,t){var n=g[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(g[e.name]=g[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 M(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 B(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 P(e){return l([b(atob(e.data))],{type:e.type})}function O(e){return e&&e.__local_forage_encoded_blob}function R(e){var t=this,n=t._initReady().then((function(){var e=g[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return d(n,e,e),n}function L(e){S(e);for(var t=g[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,M(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 k(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 L(e).then((function(){k(e,t,n,i-1)}))})).catch(n);n(r)}}function N(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function F(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=g[n.name];r||(r=N(),g[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 u=r.forages.slice(0);return c.all(s).then((function(){return n.db=r.db,C(n)})).then((function(e){return n.db=e,M(n,t._defaultConfig.version)?I(n):e})).then((function(e){n.db=r.db=e,t._dbInfo=n;for(var i=0;i<u.length;i++){var s=u[i];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}}))}function z(e,t){var n=this;e=h(e);var i=new c((function(t,i){n.ready().then((function(){k(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),O(e)&&(e=P(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function U(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){k(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;O(i)&&(i=P(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 u(i,t),i}function j(e,t,n){var i=this;e=h(e);var r=new c((function(n,r){var s;i.ready().then((function(){return s=i._dbInfo,"[object Blob]"===v.call(t)?A(s.db).then((function(e){return e?t:B(t)})):t})).then((function(t){k(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 u(r,n),r}function G(e,t){var n=this;e=h(e);var i=new c((function(t,i){n.ready().then((function(){k(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 u(i,t),i}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(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 u(n,e),n}function V(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(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 u(n,e),n}function Q(e,t){var n=this,i=new c((function(t,i){e<0?t(null):n.ready().then((function(){k(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 u(i,t),i}function _(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(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 u(n,e),n}function Y(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=g[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=g[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=g[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 u(i,t),i}var W={_driver:"asyncStorage",_initStorage:F,_support:a(),iterate:U,getItem:z,setItem:j,removeItem:G,clear:H,length:V,key:Q,keys:_,dropInstance:Y};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",ue="fl64",de=$+ee.length,he=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),u=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]),u[l++]=n<<2|i>>4,u[l++]=(15&i)<<4|r>>2,u[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 me(e,t){var n="";if(e&&(n=he.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===he.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+=ue: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 ge(e){if(e.substring(0,$)!==J)return JSON.parse(e);var t,n=e.substring(de),i=e.substring($,de);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 ue:return new Float64Array(s);default:throw new Error("Unkown type: "+i)}}var ve={serialize:me,deserialize:ge,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 xe(e,t){var n=this;e=h(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 u(i,t),i}function Ae(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 u(i,t),i}function Se(e,t,n,i){var r=this;e=h(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 u(s,n),s}function Ee(e,t,n){return Se.apply(this,[e,t,n,1])}function Te(e,t){var n=this;e=h(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 u(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 u(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 u(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 u(i,t),i}function Me(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 u(n,e),n}function Be(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 Pe(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(Be(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"),u(i,t),i}var Oe={_driver:"webSQLStorage",_initStorage:we,_support:X(),iterate:Ae,getItem:xe,setItem:Ee,removeItem:Te,clear:De,length:Ce,key:Ie,keys:Me,dropInstance:Pe};function Re(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function Le(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ke(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Ne(){return!ke()||localStorage.length>0}function Fe(e){var t=this,n={};if(e)for(var i in e)n[i]=e[i];return n.keyPrefix=Le(e,t._defaultConfig),Ne()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function ze(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 u(n,e),n}function Ue(e,t){var n=this;e=h(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 u(i,t),i}function je(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 u(i,t),i}function Ge(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 u(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 u(n,e),n}function Ve(e){var t=this.keys().then((function(e){return e.length}));return u(t,e),t}function Qe(e,t){var n=this;e=h(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return u(i,t),i}function _e(e,t,n){var i=this;e=h(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 u(r,n),r}function Ye(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(Le(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"),u(i,t),i}var We={_driver:"localStorageWrapper",_initStorage:Fe,_support:Re(),iterate:je,getItem:Ue,setItem:_e,removeItem:Qe,clear:ze,length:Ve,key:Ge,keys:He,dropInstance:Ye},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:Oe,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 d=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 u(n,arguments[arguments.length-1]),n}},n=0,i=tt.length;n<i;n++){var r=tt[n];e[r]||(e[r]=t(r))}};d();var h=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(h,n):h(!!e._support):h(!0)}catch(e){n(e)}}));return d(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 d(i,t,n),i},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return d(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 d(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})),d(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 Ro=new o;Ro.name="Scene";class Lo{constructor(e,t){this.signals=e,this.viewportState=t,this.strokeStore=Oo.createInstance({name:"soonspace",storeName:"modelStrokeCache"}),this.scene=Ro.clone(),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 ti("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(e.geometry&&e.material){const n=e;n.geometry.dispose(),vi(n.material,t)}e instanceof lu&&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 z(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 ki(e)?e.forEach((e=>i(e))):Ni(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 ki(e)?Promise.all(e.map((e=>t(e)))):Ni(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,modelCache:a=!0,firstChild:l=!1}=t,c=async e=>{var c;if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const u=new ou({id:`${null!==(c=e.sid)&&void 0!==c?c:e.id}_stroke`,name:`${e.name}_stroke`}),d=new j,h=new w({color:s,transparent:!0,opacity:o});d.material=h,u.add(d);let f=null;const p=()=>{const t=[];if((l?e.children[0]:e).traverse((n=>{if("Mesh"===n.type&&n instanceof U){const i=new G(n.geometry,89);n.updateWorldMatrix(!0,!1);const r=n.matrixWorld.clone().premultiply(e.matrixWorld.clone().invert());i.applyMatrix4(r),t.push(i)}})),0!==t.length)return Nt(t)};if(a&&e instanceof uu){const{url:t}=e;await this.strokeStore.ready();const n=await this.strokeStore.getItem(t);if(n)f=new v,f.setAttribute("position",new y(n,3));else{const e=p();if(e){f=e;const n=e.getAttribute("position");n.array instanceof Float32Array&&this.strokeStore.setItem(t,n.array.buffer)}}}else{const e=p();e&&(f=e)}return null!==f?(d.geometry=f,e.userData.strokeGroup=u,e.userData.strokeOptions=t,this.addObject(u,e),this.selectedObjects.stroke.push(e),n&&this.opacityShow(l?e.children[0]:e,{color:i,opacity:r}),Promise.resolve()):void 0};return ki(e)?Promise.all(e.map((e=>c(e)))):Ni(e)?c(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));if(-1===t)return Promise.resolve();this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch();const{firstChild:n}=e.userData.strokeOptions;return this.unOpacityShow(n?e.children[0]:e),Reflect.deleteProperty(e.userData,"strokeOptions"),Promise.resolve()};return ki(e)?Promise.all(e.map((e=>t(e)))):Ni(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=yi(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=vi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return ki(e)?Promise.all(e.map((e=>s(e)))):Ni(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;wi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return ki(e)?Promise.all(e.map((e=>t(e)))):Ni(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 H&&(e.color=new h(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=yi(e.material),vi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return ki(e)?Promise.all(e.map((e=>s(e)))):Ni(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;wi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return ki(e)?Promise.all(e.map((e=>t(e)))):Ni(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",maxOpacity:i=1,minOpacity:r=0,duration:s=1e3}=t;function o(e){e instanceof H&&(e.emissive.set(n),e.emissiveIntensity=i,0!==s&&Qi({emissiveIntensity:i},{emissiveIntensity:r},{duration:s,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const a=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=yi(e.material),vi(e.material,o)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return ki(e)?Promise.all(e.map((e=>a(e)))):Ni(e)?a(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&Un.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;vi(e.material,t),wi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return ki(e)?Promise.all(e.map((e=>n(e)))):Ni(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof su)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 ko extends R{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof ko&&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 No=new t,Fo=new m,zo=new m,Uo=new t,jo=new t;class Go{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(),Fo.copy(t.matrixWorldInverse),zo.multiplyMatrices(t.projectionMatrix,Fo),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof ko&&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 ko){const t=e.parent;if(t.occlude){const t=!Ti(e,this.viewport.camera)&&Di(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}No.setFromMatrixPosition(e.matrixWorld),No.applyMatrix4(zo);const o=di(e)&&No.z>=-1&&No.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("+(No.x*i+i)+"px,"+(-No.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 Uo.setFromMatrixPosition(e.matrixWorld),jo.setFromMatrixPosition(t.matrixWorld),Uo.distanceToSquared(jo)}}}const Ho=new t,Vo=new a,Qo=new t;class _o extends R{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof _o&&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 Yo extends _o{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const Wo=new m,Xo=new m;class Zo{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 u(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,u)=>{const h=u.projectionMatrix.elements[5]*r;s.camera.fov!==h&&(o.style.perspective=u instanceof V?h+"px":"",s.camera.fov=h),u.view&&u.view.enabled?(o.style.transform=`translate( ${-u.view.offsetX*(t/u.view.width)}px, ${-u.view.offsetY*(n/u.view.height)}px )`,o.style.transform+=`scale( ${u.view.fullWidth/u.view.width}, ${u.view.fullHeight/u.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===u.parent&&!0===u.matrixWorldAutoUpdate&&u.updateMatrixWorld();let f=0,p=0;u instanceof Q&&(f=-(u.right+u.left)/2,p=(u.top+u.bottom)/2);const m=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,g=(u instanceof Q?`scale( ${m} )scale(`+h+")translate("+l(f)+"px,"+l(p)+"px)"+c(u.matrixWorldInverse):`scale( ${m} )translateZ(`+h+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==g&&(a.style.transform=g,s.camera.style=g),d(e,e,u)},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 d=(e,t,n,i)=>{var r;if(e instanceof _o){const t=e.parent;if(t.occlude){const t=!Ti(e,this.viewport.camera)&&Di(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=di(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 Yo?(Wo.copy(n.matrixWorldInverse),Wo.transpose(),0!==e.rotation2D&&Wo.multiply(Xo.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(Ho,Vo,Qo),Wo.setPosition(Ho),Wo.scale(Qo),Wo.elements[3]=0,Wo.elements[7]=0,Wo.elements[11]=0,Wo.elements[15]=1,t=u(Wo)):t=u(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++)d(e.children[i],t,n)}}}class Ko{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 i(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,{alpha:n}=e,{offsetWidth:i,offsetHeight:r}=this.container,s=new _({powerPreference:"high-performance",premultipliedAlpha:!0,stencil:!1,antialias:!1,alpha:!1,preserveDrawingBuffer:!0,logarithmicDepthBuffer:t});return s.autoClear=!1,s.setSize(i,r),s.setPixelRatio(self.devicePixelRatio),s.setClearAlpha(n?0:1),s.localClippingEnabled=!0,s.sortObjects=!0,s.shadowMap.enabled=!0,s.shadowMap.type=Y,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new Go(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 Zo(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 qo=new m,Jo=(e,t)=>{const n=qo.clone(),i=qo.clone(),s=qo.clone();n.makeRotationY(e),i.makeRotationX(t);const o=new r;return s.multiplyMatrices(n,i),o.setFromRotationMatrix(s),o},$o=Jo(-Math.PI/2,-Math.PI/4),ea=Jo(Math.PI/2,-Math.PI/4),ta=Jo(-Math.PI/4,-Math.PI/4),na=Jo(Math.PI/4,-Math.PI/4),ia=Jo(1.25*Math.PI,-Math.PI/4),ra=Jo(.75*Math.PI,-Math.PI/4),sa={LEFT:new r(0,-Math.PI/2,0),RIGHT:new r(0,Math.PI/2,0),FRONT:new r(0,0,0),BACK:new r(0,Math.PI,0),TOP:new r(-Math.PI/2,0,0),BOTTOM:new r(Math.PI/2,0,0),FRONTTOP:new r(-Math.PI/4,0,0),BACKTOP:new r(Math.PI/4,Math.PI,0),LEFTTOP:new r($o.x,$o.y,$o.z),RIGHTTOP:new r(ea.x,ea.y,ea.z),LEFTFRONTTOP:new r(ta.x,ta.y,ta.z),RIGHTFRONTTOP:new r(na.x,na.y,na.z),LEFTBACKTOP:new r(ia.x,ia.y,ia.z),RIGHTBACKTOP:new r(ra.x,ra.y,ra.z)},oa=e=>Li(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),aa=new t,la=new r,ca=new V(50,1,.01,5e4);ca.position.set(500,1e3,500),ca.lookAt(aa.set(0,0,0)),ca.name="Camera";class ua{constructor(e){this.viewport=e,this.mainCamera=ca.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=ca.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&&Ni(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(Ni(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 Qi(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new a).setFromEuler(e);return Qi({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",n=arguments.length>2?arguments[2]:void 0;if(Oi(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?la.copy(this.currentCamera.rotation):sa[e]&&la.copy(sa[e])}else t instanceof r?la.copy(t):Ni(t)&&la.set(t.x,t.y,t.z);la.copy(ai(this.currentCamera.rotation,la.clone())),await Promise.all([this.moveTo(e,n),this.rotateTo(la,n)])}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 ti("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Oi(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=sa[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&ti("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=ri(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(aa),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new m;r.lookAt(s,t,i.object.up),n=la.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 fu||e instanceof lu){const{padding:t=50}=i,r=oa(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=si(e),o=s.getSize(aa);let a=0;if(Oi(r)){const e=Math.max(o.x,o.y,o.z);a=oa(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(aa.set(l/2,c/2,l/2)),s.min.sub(aa.set(l/2,c/2,l/2))),s.isEmpty()&&(aa.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(aa,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=ii(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return Qi({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 s).setFromObject(e).getCenter(aa);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(aa);(new t).subVectors(i,n).normalize();let r=new W;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",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof su&&(e=(new s).setFromObject(e)),e.isEmpty())return ti("target box is empty"),new t;const{extendScale:r=1.6,mode:o="scene"}=i;if("scene"===o){const t=e.getCenter(aa),i=e.max.clone().sub(e.min),s=Math.max(i.x,i.y,i.z),o=t.clone(),a=e=>{const t=(r-.5)*Math.abs(s),n=Math.max(t,this.viewport.camera.near);o.add(e.multiplyScalar(n))};let l;return l=Oi(n)?sa[n.toLocaleUpperCase()]:ri(n),a(aa.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(aa).clone():new t}}
|
|
2
2
|
/**
|
|
3
3
|
* postprocessing v6.31.0 build Sun May 07 2023
|
|
4
4
|
* https://github.com/pmndrs/postprocessing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soonspacejs",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.5",
|
|
4
4
|
"homepage": "http://www.xwbuilders.com:8800/",
|
|
5
5
|
"description": "soonspacejs 2.x",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -21,10 +21,12 @@
|
|
|
21
21
|
"author": "xuek",
|
|
22
22
|
"license": "UNLICENSED",
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@three3d/animation": "^2.1.2",
|
|
25
|
+
"@three3d/tools": "^1.5.0",
|
|
24
26
|
"three-mesh-bvh": "0.6.0"
|
|
25
27
|
},
|
|
26
28
|
"peerDependencies": {
|
|
27
29
|
"three": ">=0.152.2"
|
|
28
30
|
},
|
|
29
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "2da2c74128661d2217887684b5ef6cff1d6db34d"
|
|
30
32
|
}
|