@realsee/dnalogel 3.49.6 → 3.49.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var oE=Object.defineProperty,aE=Object.defineProperties;var lE=Object.getOwnPropertyDescriptors;var nh=Object.getOwnPropertySymbols;var lv=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable;var uf=(e,n,t)=>n in e?oE(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,R=(e,n)=>{for(var t in n||(n={}))lv.call(n,t)&&uf(e,t,n[t]);if(nh)for(var t of nh(n))cv.call(n,t)&&uf(e,t,n[t]);return e},Ee=(e,n)=>aE(e,lE(n));var po=(e,n)=>{var t={};for(var i in e)lv.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&nh)for(var i of nh(e))n.indexOf(i)<0&&cv.call(e,i)&&(t[i]=e[i]);return t};var v=(e,n,t)=>(uf(e,typeof n!="symbol"?n+"":n,t),t);var ee=(e,n,t)=>new Promise((i,r)=>{var s=l=>{try{a(t.next(l))}catch(c){r(c)}},o=l=>{try{a(t.throw(l))}catch(c){r(c)}},a=l=>l.done?i(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(e,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const qt=require("@realsee/five"),ne=require("three"),du=require("three/examples/jsm/renderers/CSS3DRenderer"),yd=require("hammerjs"),Qm=require("@realsee/five/line"),fu=require("animejs"),j1=require("three/examples/jsm/loaders/FBXLoader"),cE=require("earcut"),hE=require("@realsee/five/gltf-loader");function uE(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const C=uE(ne);function dE(){console.debug("%c %c@realsee/dnalogel %cv3.49.6",["background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')","background-repeat: no-repeat","background-position: 0 center","padding-left: 8px"].join(";"),"","background-color: #12ce9b;color:black;padding:0 6px;border-radius: 3px")}function fE(){const e=typeof OffscreenCanvas!="undefined",n=e&&new OffscreenCanvas(1,1).getContext("webgl")!==null;e&&!n&&Object.assign(window,{OffscreenCanvas:function(t,i){const r=document.createElement("canvas");return r.width=t,r.height=i,r}})}function H1(){}const hv=()=>Promise.resolve(),uv={__queue:Promise.resolve()};function pE(e=hv){uv.__queue=uv.__queue.then(e).catch(hv)}function ih(e,n,t){const i=e.x,r=e.y,s=Math.floor(i/n*1e4)/1e4,o=Math.floor(r/t*1e4)/1e4;return{x:s,y:o}}function df(e,n,t){const{x:i,y:r}=e,s=i*n,o=r*t;return{x:s,y:o}}function rh(e){if(e.length<2)return{};const n=e.slice(-2),t=n[0],i={x:(n[0].x+n[1].x)/2,y:(n[0].y+n[1].y)/2};return{control:t,end:i}}function mE(e,n,t=H1){new Promise(i=>{setTimeout(()=>{t(),i(!0)},n*e)})}const gE=window,dv=window.requestAnimationFrame||gE.webkitRequestAnimationFrame||(e=>setTimeout(e,16));function su(e,n=0){n<=0?dv(e):dv(()=>su(e,n-1))}var Ki=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return this.None(e)},Out:function(e){return this.None(e)},InOut:function(e){return this.None(e)}}),Quadratic:Object.freeze({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:Object.freeze({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:Object.freeze({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:Object.freeze({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:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({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:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Ki.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?Ki.Bounce.In(e*2)*.5:Ki.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),Go=function(){return performance.now()},U1=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(t){return n._tweens[t]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(n){this._tweens[n.getId()]=n,this._tweensAddedDuringUpdate[n.getId()]=n},e.prototype.remove=function(n){delete this._tweens[n.getId()],delete this._tweensAddedDuringUpdate[n.getId()]},e.prototype.update=function(n,t){n===void 0&&(n=Go()),t===void 0&&(t=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<i.length;r++){var s=this._tweens[i[r]],o=!t;s&&s.update(n,o)===!1&&!t&&delete this._tweens[i[r]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),zs={Linear:function(e,n){var t=e.length-1,i=t*n,r=Math.floor(i),s=zs.Utils.Linear;return n<0?s(e[0],e[1],i):n>1?s(e[t],e[t-1],t-i):s(e[r],e[r+1>t?t:r+1],i-r)},Bezier:function(e,n){for(var t=0,i=e.length-1,r=Math.pow,s=zs.Utils.Bernstein,o=0;o<=i;o++)t+=r(1-n,i-o)*r(n,o)*e[o]*s(i,o);return t},CatmullRom:function(e,n){var t=e.length-1,i=t*n,r=Math.floor(i),s=zs.Utils.CatmullRom;return e[0]===e[t]?(n<0&&(r=Math.floor(i=t*(1+n))),s(e[(r-1+t)%t],e[r],e[(r+1)%t],e[(r+2)%t],i-r)):n<0?e[0]-(s(e[0],e[0],e[1],e[1],-i)-e[0]):n>1?e[t]-(s(e[t],e[t],e[t-1],e[t-1],i-t)-e[t]):s(e[r?r-1:0],e[r],e[t<r+1?t:r+1],e[t<r+2?t:r+2],i-r)},Utils:{Linear:function(e,n,t){return(n-e)*t+e},Bernstein:function(e,n){var t=zs.Utils.Factorial;return t(e)/t(n)/t(e-n)},Factorial:function(){var e=[1];return function(n){var t=1;if(e[n])return e[n];for(var i=n;i>1;i--)t*=i;return e[n]=t,t}}(),CatmullRom:function(e,n,t,i,r){var s=(t-e)*.5,o=(i-n)*.5,a=r*r,l=r*a;return(2*n-2*t+s+o)*l+(-3*n+3*t-2*s-o)*a+s*r+n}}},Ym=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Ep=new U1,bd=function(){function e(n,t){t===void 0&&(t=Ep),this._object=n,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ki.Linear.None,this._interpolationFunction=zs.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Ym.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!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.getDuration=function(){return this._duration},e.prototype.to=function(n,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,t){if(n===void 0&&(n=Go()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,t,i,r,s){for(var o in i){var a=n[o],l=Array.isArray(a),c=l?"array":typeof a,h=!l&&Array.isArray(i[o]);if(!(c==="undefined"||c==="function")){if(h){var u=i[o];if(u.length===0)continue;for(var d=[a],f=0,m=u.length;f<m;f+=1){var p=this._handleRelativeValue(a,u[f]);if(isNaN(p)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(p)}h&&(i[o]=d)}if((c==="object"||l)&&a&&!h){t[o]=l?[]:{};var g=a;for(var y in g)t[o][y]=g[y];r[o]=l?[]:{};var u=i[o];if(!this._isDynamic){var b={};for(var y in u)b[y]=u[y];i[o]=u=b}this._setupProperties(g,t[o],u,r[o],s)}else(typeof t[o]=="undefined"||s)&&(t[o]=a),l||(t[o]*=1),h?r[o]=i[o].slice().reverse():r[o]=t[o]||0}}},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(n){return n===void 0&&(n=Go()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this._group&&this._group.remove(this),this)},e.prototype.resume=function(n){return n===void 0&&(n=Go()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var n=0,t=this._chainedTweens.length;n<t;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n===void 0&&(n=Ep),this._group=n,this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=Ki.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=zs.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,t){var i=this,r;if(n===void 0&&(n=Go()),t===void 0&&(t=!0),this._isPaused)return!0;var s,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(n>o)return!1;t&&this.start(n,!0)}if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=n-this._startTime,l=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),c=this._duration+this._repeat*l,h=function(){if(i._duration===0||a>c)return 1;var g=Math.trunc(a/l),y=a-g*l,b=Math.min(y/i._duration,1);return b===0&&a===i._duration?1:b},u=h(),d=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var m=0,p=this._chainedTweens.length;m<p;m++)this._chainedTweens[m].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,t,i,r){for(var s in i)if(t[s]!==void 0){var o=t[s]||0,a=i[s],l=Array.isArray(n[s]),c=Array.isArray(a),h=!l&&c;h?n[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(n[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(n[s]=o+(a-o)*r))}},e.prototype._handleRelativeValue=function(n,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?n+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(n){var t=this._valuesStartRepeat[n],i=this._valuesEnd[n];typeof i=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(i):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=t},e}(),vE="23.1.1",yE=Ym.nextId,er=Ep,bE=er.getAll.bind(er),AE=er.removeAll.bind(er),wE=er.add.bind(er),W1=er.remove.bind(er),xE=er.update.bind(er),fv={Easing:Ki,Group:U1,Interpolation:zs,now:Go,Sequence:Ym,nextId:yE,Tween:bd,VERSION:vE,getAll:bE,removeAll:AE,add:wE,remove:W1,update:xE};function ME(e,n,t,i=Ki.Linear.None){const r=new bd(e).to(n,t).easing(i).start();function s(o){r.update(o)&&requestAnimationFrame(s)}return requestAnimationFrame(s),r}var wr=(e=>(e.Drawline="Drawline",e.Undo="Undo",e.Exit="Exit",e))(wr||{});const Pl=Symbol("$$PAINT_BRUSH_EVENT$$");function sh(e){return e[Pl]||(e[Pl]={}),e[Pl]}function EE(e){e[Pl]||delete e[Pl]}let CE=class{hasListener(n){const t=sh(this);return t&&t[n]&&t[n].length>0}on(n,t,i){const r=sh(this);return r[n]||(r[n]=[]),r[n].push([t,i||!1]),()=>this.off(n,t)}once(n,t){return this.on(n,t,!0)}off(n,t){if(n===void 0){EE(this);return}const i=sh(this);if(i[n]||(i[n]=[]),t===void 0){i[n].length=0;return}let r=0;for(;r<i[n].length&&i[n][r][0]!==t;r++);r<i[n].length&&i[n].splice(r,1)}emit(n,...t){let i=!1;const s=sh(this)[n]||[];for(let o of s.slice()){const[a,l=!1]=o,c=a(...t);l&&this.off(n,a),c===!1&&(i=!0)}return i}};function Vr(){return((1+Math.random())*65536|0).toString(16).substring(1)}function xn(){return(Vr()+Vr()+"-"+Vr()+"-4"+Vr().substr(0,3)+"-"+Vr()+"-"+Vr()+Vr()+Vr()).toLowerCase()}const PE=`
1
+ "use strict";var oE=Object.defineProperty,aE=Object.defineProperties;var lE=Object.getOwnPropertyDescriptors;var nh=Object.getOwnPropertySymbols;var lv=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable;var uf=(e,n,t)=>n in e?oE(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,R=(e,n)=>{for(var t in n||(n={}))lv.call(n,t)&&uf(e,t,n[t]);if(nh)for(var t of nh(n))cv.call(n,t)&&uf(e,t,n[t]);return e},Ee=(e,n)=>aE(e,lE(n));var po=(e,n)=>{var t={};for(var i in e)lv.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&nh)for(var i of nh(e))n.indexOf(i)<0&&cv.call(e,i)&&(t[i]=e[i]);return t};var v=(e,n,t)=>(uf(e,typeof n!="symbol"?n+"":n,t),t);var ee=(e,n,t)=>new Promise((i,r)=>{var s=l=>{try{a(t.next(l))}catch(c){r(c)}},o=l=>{try{a(t.throw(l))}catch(c){r(c)}},a=l=>l.done?i(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(e,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const qt=require("@realsee/five"),ne=require("three"),du=require("three/examples/jsm/renderers/CSS3DRenderer"),yd=require("hammerjs"),Qm=require("@realsee/five/line"),fu=require("animejs"),j1=require("three/examples/jsm/loaders/FBXLoader"),cE=require("earcut"),hE=require("@realsee/five/gltf-loader");function uE(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const C=uE(ne);function dE(){console.debug("%c %c@realsee/dnalogel %cv3.49.7",["background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')","background-repeat: no-repeat","background-position: 0 center","padding-left: 8px"].join(";"),"","background-color: #12ce9b;color:black;padding:0 6px;border-radius: 3px")}function fE(){const e=typeof OffscreenCanvas!="undefined",n=e&&new OffscreenCanvas(1,1).getContext("webgl")!==null;e&&!n&&Object.assign(window,{OffscreenCanvas:function(t,i){const r=document.createElement("canvas");return r.width=t,r.height=i,r}})}function H1(){}const hv=()=>Promise.resolve(),uv={__queue:Promise.resolve()};function pE(e=hv){uv.__queue=uv.__queue.then(e).catch(hv)}function ih(e,n,t){const i=e.x,r=e.y,s=Math.floor(i/n*1e4)/1e4,o=Math.floor(r/t*1e4)/1e4;return{x:s,y:o}}function df(e,n,t){const{x:i,y:r}=e,s=i*n,o=r*t;return{x:s,y:o}}function rh(e){if(e.length<2)return{};const n=e.slice(-2),t=n[0],i={x:(n[0].x+n[1].x)/2,y:(n[0].y+n[1].y)/2};return{control:t,end:i}}function mE(e,n,t=H1){new Promise(i=>{setTimeout(()=>{t(),i(!0)},n*e)})}const gE=window,dv=window.requestAnimationFrame||gE.webkitRequestAnimationFrame||(e=>setTimeout(e,16));function su(e,n=0){n<=0?dv(e):dv(()=>su(e,n-1))}var Ki=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return this.None(e)},Out:function(e){return this.None(e)},InOut:function(e){return this.None(e)}}),Quadratic:Object.freeze({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:Object.freeze({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:Object.freeze({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:Object.freeze({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:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({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:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Ki.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?Ki.Bounce.In(e*2)*.5:Ki.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),Go=function(){return performance.now()},U1=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(t){return n._tweens[t]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(n){this._tweens[n.getId()]=n,this._tweensAddedDuringUpdate[n.getId()]=n},e.prototype.remove=function(n){delete this._tweens[n.getId()],delete this._tweensAddedDuringUpdate[n.getId()]},e.prototype.update=function(n,t){n===void 0&&(n=Go()),t===void 0&&(t=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<i.length;r++){var s=this._tweens[i[r]],o=!t;s&&s.update(n,o)===!1&&!t&&delete this._tweens[i[r]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),zs={Linear:function(e,n){var t=e.length-1,i=t*n,r=Math.floor(i),s=zs.Utils.Linear;return n<0?s(e[0],e[1],i):n>1?s(e[t],e[t-1],t-i):s(e[r],e[r+1>t?t:r+1],i-r)},Bezier:function(e,n){for(var t=0,i=e.length-1,r=Math.pow,s=zs.Utils.Bernstein,o=0;o<=i;o++)t+=r(1-n,i-o)*r(n,o)*e[o]*s(i,o);return t},CatmullRom:function(e,n){var t=e.length-1,i=t*n,r=Math.floor(i),s=zs.Utils.CatmullRom;return e[0]===e[t]?(n<0&&(r=Math.floor(i=t*(1+n))),s(e[(r-1+t)%t],e[r],e[(r+1)%t],e[(r+2)%t],i-r)):n<0?e[0]-(s(e[0],e[0],e[1],e[1],-i)-e[0]):n>1?e[t]-(s(e[t],e[t],e[t-1],e[t-1],i-t)-e[t]):s(e[r?r-1:0],e[r],e[t<r+1?t:r+1],e[t<r+2?t:r+2],i-r)},Utils:{Linear:function(e,n,t){return(n-e)*t+e},Bernstein:function(e,n){var t=zs.Utils.Factorial;return t(e)/t(n)/t(e-n)},Factorial:function(){var e=[1];return function(n){var t=1;if(e[n])return e[n];for(var i=n;i>1;i--)t*=i;return e[n]=t,t}}(),CatmullRom:function(e,n,t,i,r){var s=(t-e)*.5,o=(i-n)*.5,a=r*r,l=r*a;return(2*n-2*t+s+o)*l+(-3*n+3*t-2*s-o)*a+s*r+n}}},Ym=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Ep=new U1,bd=function(){function e(n,t){t===void 0&&(t=Ep),this._object=n,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ki.Linear.None,this._interpolationFunction=zs.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Ym.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!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.getDuration=function(){return this._duration},e.prototype.to=function(n,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,t){if(n===void 0&&(n=Go()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,t,i,r,s){for(var o in i){var a=n[o],l=Array.isArray(a),c=l?"array":typeof a,h=!l&&Array.isArray(i[o]);if(!(c==="undefined"||c==="function")){if(h){var u=i[o];if(u.length===0)continue;for(var d=[a],f=0,m=u.length;f<m;f+=1){var p=this._handleRelativeValue(a,u[f]);if(isNaN(p)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(p)}h&&(i[o]=d)}if((c==="object"||l)&&a&&!h){t[o]=l?[]:{};var g=a;for(var y in g)t[o][y]=g[y];r[o]=l?[]:{};var u=i[o];if(!this._isDynamic){var b={};for(var y in u)b[y]=u[y];i[o]=u=b}this._setupProperties(g,t[o],u,r[o],s)}else(typeof t[o]=="undefined"||s)&&(t[o]=a),l||(t[o]*=1),h?r[o]=i[o].slice().reverse():r[o]=t[o]||0}}},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(n){return n===void 0&&(n=Go()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this._group&&this._group.remove(this),this)},e.prototype.resume=function(n){return n===void 0&&(n=Go()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var n=0,t=this._chainedTweens.length;n<t;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n===void 0&&(n=Ep),this._group=n,this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=Ki.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=zs.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,t){var i=this,r;if(n===void 0&&(n=Go()),t===void 0&&(t=!0),this._isPaused)return!0;var s,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(n>o)return!1;t&&this.start(n,!0)}if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=n-this._startTime,l=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),c=this._duration+this._repeat*l,h=function(){if(i._duration===0||a>c)return 1;var g=Math.trunc(a/l),y=a-g*l,b=Math.min(y/i._duration,1);return b===0&&a===i._duration?1:b},u=h(),d=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var m=0,p=this._chainedTweens.length;m<p;m++)this._chainedTweens[m].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,t,i,r){for(var s in i)if(t[s]!==void 0){var o=t[s]||0,a=i[s],l=Array.isArray(n[s]),c=Array.isArray(a),h=!l&&c;h?n[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(n[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(n[s]=o+(a-o)*r))}},e.prototype._handleRelativeValue=function(n,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?n+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(n){var t=this._valuesStartRepeat[n],i=this._valuesEnd[n];typeof i=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(i):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=t},e}(),vE="23.1.1",yE=Ym.nextId,er=Ep,bE=er.getAll.bind(er),AE=er.removeAll.bind(er),wE=er.add.bind(er),W1=er.remove.bind(er),xE=er.update.bind(er),fv={Easing:Ki,Group:U1,Interpolation:zs,now:Go,Sequence:Ym,nextId:yE,Tween:bd,VERSION:vE,getAll:bE,removeAll:AE,add:wE,remove:W1,update:xE};function ME(e,n,t,i=Ki.Linear.None){const r=new bd(e).to(n,t).easing(i).start();function s(o){r.update(o)&&requestAnimationFrame(s)}return requestAnimationFrame(s),r}var wr=(e=>(e.Drawline="Drawline",e.Undo="Undo",e.Exit="Exit",e))(wr||{});const Pl=Symbol("$$PAINT_BRUSH_EVENT$$");function sh(e){return e[Pl]||(e[Pl]={}),e[Pl]}function EE(e){e[Pl]||delete e[Pl]}let CE=class{hasListener(n){const t=sh(this);return t&&t[n]&&t[n].length>0}on(n,t,i){const r=sh(this);return r[n]||(r[n]=[]),r[n].push([t,i||!1]),()=>this.off(n,t)}once(n,t){return this.on(n,t,!0)}off(n,t){if(n===void 0){EE(this);return}const i=sh(this);if(i[n]||(i[n]=[]),t===void 0){i[n].length=0;return}let r=0;for(;r<i[n].length&&i[n][r][0]!==t;r++);r<i[n].length&&i[n].splice(r,1)}emit(n,...t){let i=!1;const s=sh(this)[n]||[];for(let o of s.slice()){const[a,l=!1]=o,c=a(...t);l&&this.off(n,a),c===!1&&(i=!0)}return i}};function Vr(){return((1+Math.random())*65536|0).toString(16).substring(1)}function xn(){return(Vr()+Vr()+"-"+Vr()+"-4"+Vr().substr(0,3)+"-"+Vr()+"-"+Vr()+Vr()+Vr()).toLowerCase()}const PE=`
2
2
  <style type="text/css">
3
3
 
4
4
  #_gl_paintBrush {
@@ -3095,7 +3095,7 @@ vec4 linearToOutputTexel(vec4 value){
3095
3095
  vec4 envMapTexelToLinear(vec4 color) {
3096
3096
  return inputTexelToLinear(color);
3097
3097
  }
3098
- `}at.create=function(e,n){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(at.prototype),e.prototype.constructor=e,e.prototype.getPoint=n,e};Object.assign($r.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var n=this.getPoints(e);return this.createGeometry(n)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var n=this.getSpacedPoints(e);return this.createGeometry(n)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var n=new pt,t=0,i=e.length;t<i;t++){var r=e[t];n.vertices.push(new B(r.x,r.y,r.z||0))}return n}});Object.assign(Xi.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}});Object.create(ai.prototype);Object.create(ai.prototype);function Ww(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),ai.call(this,e),this.type="catmullrom"}Ww.prototype=Object.create(ai.prototype);Object.assign(Ww.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}});Am.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Ca.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Object.assign(Vt.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Tw.extractUrlBase(e)}});Vt.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Object.assign(gm.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}});Object.assign(Vw.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}});Object.assign(pi.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}});Object.assign(cr.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}});Rc.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)};Gw.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)};Object.assign(wt,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),wt.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),wt.ceilPowerOfTwo(e)}});Object.assign(Wn.prototype,{flattenToArrayOffset:function(e,n){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,n)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}});Object.assign(Mt.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,n){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,n)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new B().setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,n,t,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,n,i,t,r,s)}});Qi.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)};En.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)};Object.assign(Fa.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}});Object.assign(Ln.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,n)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}});Object.assign(Ln,{barycoordFromPoint:function(e,n,t,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ln.getBarycoord(e,n,t,i,r)},normal:function(e,n,t,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ln.getNormal(e,n,t,i)}});Object.assign(Gs.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ua(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new fa(this,e)}});Object.assign(me.prototype,{fromAttribute:function(e,n,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,n,t)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(B.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,n){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(n,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,n,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,n,t)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(Nt.prototype,{fromAttribute:function(e,n,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,n,t)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(pt.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}});Object.assign(je.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,n){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(n,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}});Object.defineProperties(je.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Object.assign(tn.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}});Object.defineProperties(tn.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),_P},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});Object.defineProperties(Eu.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}});Object.defineProperty(jp.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}});Gp.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Object.defineProperty(at.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}});wn.prototype.setLens=function(e,n){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),n!==void 0&&(this.filmGauge=n),this.setFocalLength(e)};Object.defineProperties(Jt.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}});Object.defineProperties(ut.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Gl},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Gl)}}});Object.assign(ut.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(e===!0?Gl:Cd),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(Xe.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,n){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(n&&n.isBufferAttribute)&&!(n&&n.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new ut(arguments[1],arguments[2]))):e==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(n),this):this.setAttribute(e,n)},addDrawCall:function(e,n,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,n)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}});Object.defineProperties(Xe.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});Object.defineProperties(Ea.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}});Object.defineProperties(Fw.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}});Object.defineProperties(ls.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Gl},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}});Object.assign(ls.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(e===!0?Gl:Cd),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(Sr.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}});Object.defineProperties(ym.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}});Object.defineProperties(dt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Qe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===q1}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}});Object.defineProperties(qs.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties($n.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}});Object.assign(xw.prototype,{clearTarget:function(e,n,t,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(n,t,i)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}});Object.defineProperties(xw.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=e===!0?Ed:Kn}}});Object.defineProperties(Aw.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(di.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}});Object.defineProperties(gc.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var n=this,t=new vm;return t.load(e,function(i){n.setBuffer(i)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}});Ow.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Wl.prototype.updateCubeMap=function(e,n){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,n)};Qs.crossOrigin=void 0;Qs.loadTexture=function(e,n,t,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new nm;r.setCrossOrigin(this.crossOrigin);var s=r.load(e,t,void 0,i);return n&&(s.mapping=n),s};Qs.loadTextureCube=function(e,n,t,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new tm;r.setCrossOrigin(this.crossOrigin);var s=r.load(e,t,void 0,i);return n&&(s.mapping=n),s};Qs.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Qs.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:iC}}));var $o=function(){Ea.call(this),this.type="LineSegmentsGeometry";var e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],t=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(t),this.setAttribute("position",new ze(e,3)),this.setAttribute("uv",new ze(n,2))};$o.prototype=Object.assign(Object.create(Ea.prototype),{constructor:$o,isLineSegmentsGeometry:!0,applyMatrix4:function(e){var n=this.attributes.instanceStart,t=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),t.applyMatrix4(e),n.data.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},setPositions:function(e){var n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));var t=new Qu(n,6,1);return this.setAttribute("instanceStart",new Kr(t,3,0)),this.setAttribute("instanceEnd",new Kr(t,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},setColors:function(e){var n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));var t=new Qu(n,6,1);return this.setAttribute("instanceColorStart",new Kr(t,3,0)),this.setAttribute("instanceColorEnd",new Kr(t,3,3)),this},fromWireframeGeometry:function(e){return this.setPositions(e.attributes.position.array),this},fromEdgesGeometry:function(e){return this.setPositions(e.attributes.position.array),this},fromMesh:function(e){return this.fromWireframeGeometry(new ql(e.geometry)),this},fromLineSegments:function(e){var n=e.geometry;return n.isGeometry?this.setPositions(n.vertices):n.isBufferGeometry&&this.setPositions(n.attributes.position.array),this},computeBoundingBox:function(){var e=new pi;return function(){this.boundingBox===null&&(this.boundingBox=new pi);var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;t!==void 0&&i!==void 0&&(this.boundingBox.setFromBufferAttribute(t),e.setFromBufferAttribute(i),this.boundingBox.union(e))}}(),computeBoundingSphere:function(){var e=new B;return function(){this.boundingSphere===null&&(this.boundingSphere=new cr),this.boundingBox===null&&this.computeBoundingBox();var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(t!==void 0&&i!==void 0){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var s=0,o=0,a=t.count;o<a;o++)e.fromBufferAttribute(t,o),s=Math.max(s,r.distanceToSquared(e)),e.fromBufferAttribute(i,o),s=Math.max(s,r.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}}(),toJSON:function(){},applyMatrix:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}});var Rl=function(){$o.call(this),this.type="LineGeometry"};Rl.prototype=Object.assign(Object.create($o.prototype),{constructor:Rl,isLineGeometry:!0,setPositions:function(e){for(var n=e.length-3,t=new Float32Array(2*n),i=0;i<n;i+=3)t[2*i]=e[i],t[2*i+1]=e[i+1],t[2*i+2]=e[i+2],t[2*i+3]=e[i+3],t[2*i+4]=e[i+4],t[2*i+5]=e[i+5];return $o.prototype.setPositions.call(this,t),this},setColors:function(e){for(var n=e.length-3,t=new Float32Array(2*n),i=0;i<n;i+=3)t[2*i]=e[i],t[2*i+1]=e[i+1],t[2*i+2]=e[i+2],t[2*i+3]=e[i+3],t[2*i+4]=e[i+4],t[2*i+5]=e[i+5];return $o.prototype.setColors.call(this,t),this},fromLine:function(e){var n=e.geometry;return n.isGeometry?this.setPositions(n.vertices):n.isBufferGeometry&&this.setPositions(n.attributes.position.array),this},copy:function(){return this}});class ei extends ne.Object3D{constructor(){super();v(this,"name","IObject3D");v(this,"needsRender")}removeChildren(){for(;this.children.length>0;)this.remove(this.children[0]);return this}add(...t){const i=t.filter(Boolean);return i.length===0?this:super.add(...i)}addIfNotExists(...t){return t.forEach(i=>{this.children.includes(i)||this.add(i)}),this}remove(...t){if(t.length===0)return this;const i=t.filter(Boolean);return super.remove(...i)}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}}function Yf(e,n,t){const{x:i,y:r,z:s}=n.clone().project(e);return s>1?void 0:{leftPx:(i+1)/2*t.x,topPx:(-r+1)/2*t.y}}function ki(e){var t;return((t=e.models)==null?void 0:t.filter(i=>i.name===e.state.workCode)[0])||e.model}class Qw extends Cn{constructor(t){super();v(this,"five");this.five=t}}const wc=(e,n)=>{if(!n)return e;const t=new C.Vector3,i=new C.Quaternion,r=new C.Vector3;return n.decompose(t,i,r),e.clone().multiply(r).applyQuaternion(i).add(t)},Xf=new Map;class V3 extends Qw{constructor(t){super(t);v(this,"_workCode")}get fromType(){var r,s;const t=this.workCode;if(Xf.has(t))return Xf.get(t);const i=(s=(r=JSON.parse(this.work.raw.works[0]))==null?void 0:r.from_type)!=null?s:"vr";return Xf.set(t,i),i}set workCode(t){this._workCode=t}get workCode(){var t;return(t=this._workCode)!=null?t:this.five.state.workCode}get work(){var t,i;return(i=(t=this.five.works)==null?void 0:t.find(r=>r.workCode===this.workCode))!=null?i:this.five.work}get observers(){var t;return(t=this.work)==null?void 0:t.observers}get transform(){var i,r,s,o;const t=(o=(i=this.work)==null?void 0:i.transform)!=null?o:(s=(r=this.work)==null?void 0:r.options)==null?void 0:s.transform;return t?t.clone():new C.Matrix4}getObserverPosition(t){var r;const i=(r=this.getObserver(t))==null?void 0:r.position;if(i)return wc(i,this.transform)}getObserverStandingPosition(t){var r;const i=(r=this.getObserver(t))==null?void 0:r.standingPosition;if(i)return wc(i,this.transform)}getObserver(t){var i;return(i=this.observers)==null?void 0:i[t]}}class Sd extends Qw{constructor(t){super(t);v(this,"workUtil",new V3(this.five))}get version(){return this.five.constructor.version}get majorVersion(){return Number(this.version.split(".")[0])}get model(){return ki(this.five)}moveToPano(t,i){const r=this.majorVersion===5?t:{workCode:this.workUtil.workCode,panoIndex:t};return this.five.moveToPano(r,i)}}const rs=new C.Raycaster;rs.params.Points.threshold=.02;const J0="LightTagContainer_shgjakdhwakjdhsja",G3=new C.Vector2;class xc{constructor(n,t,i){v(this,"container");v(this,"visible",!1);v(this,"enabled",!1);v(this,"wrapper");v(this,"positionsForRotate");v(this,"intersectCheck",!0);v(this,"tagWrapper");v(this,"five");v(this,"originPosition");v(this,"transformedPosition");v(this,"disposer");v(this,"config");v(this,"fiveUtil");v(this,"onCameraUpdate",()=>{this.visible!==!1&&this.updateScreenPosition()});v(this,"onFiveEveryReady",()=>{var n;if(this.intersectCheck&&this.visible&&this.five.state.mode!=="Panorama"){let t=.01;this.fiveUtil.workUtil.fromType==="poincare"&&(t=.05),rs.set(this.five.camera.position,this.transformedPosition.clone().sub(this.five.camera.position));const i=(n=ki(this.five).intersectRaycaster(rs))==null?void 0:n[0];(i==null?void 0:i.distance)+t>this.transformedPosition.distanceTo(this.five.camera.position)?(this.container.style.opacity="1",this.container.style.pointerEvents="auto"):(this.container.style.opacity="0",this.container.style.pointerEvents="none")}});var r,s,o;this.five=n,this.fiveUtil=(r=n.__fiveUtil__)!=null?r:n.__fiveUtil__=new Sd(n),this.originPosition=t?Ft(t).clone():void 0,this.transformedPosition=(s=this.originPosition)==null?void 0:s.clone(),this.positionsForRotate=(o=i==null?void 0:i.positionsForRotate)==null?void 0:o.map(a=>Ft(a).clone()),this.container=(()=>{const a=document.createElement("div");return a.style.width="0",a.style.height="0",a.style.position="absolute",a.style.transition="opacity 0.2s linear",a})(),this.config=i!=null?i:{},this.enable(),this.show()}show(){this.visible=!0,this.container.style.opacity="1",this.container.style.pointerEvents="auto",this.onCameraUpdate()}hide(){this.visible=!1,this.container.style.opacity="0",this.container.style.pointerEvents="none"}enable(){var i,r,s,o;if(this.enabled)return;this.enabled=!0,this.wrapper=(s=(r=this.config.wrapper)!=null?r:(i=this.five.getElement())==null?void 0:i.parentElement)!=null?s:document.body,this.tagWrapper||(this.tagWrapper=(o=document.getElementById(J0))!=null?o:(()=>{const a=document.createElement("div");return a.id=J0,a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.pointerEvents="none",a.style.zIndex="1",a})(),this.wrapper.contains(this.tagWrapper)||this.wrapper.appendChild(this.tagWrapper)),this.tagWrapper.appendChild(this.container);let n=!1;const t=()=>{n||(n=!0,this.five.ready().then(()=>{this.onFiveEveryReady(),n=!1}))};this.five.on("cameraUpdate",t),this.five.on("cameraUpdate",this.onCameraUpdate),this.disposer=()=>{this.five.off("cameraUpdate",t),this.five.off("cameraUpdate",this.onCameraUpdate)}}disable(){var n;this.enabled&&(this.enabled=!1,this.tagWrapper.removeChild(this.container),(n=this.disposer)==null||n.call(this))}destroy(){this.disable(),this.container.remove()}setTransformMatrix(n){var t;this.transformedPosition=(t=this.originPosition)==null?void 0:t.clone().applyMatrix4(n),this.onCameraUpdate()}setPosition(n,t){this.transformedPosition=n,this.positionsForRotate=t,this.onCameraUpdate(),setTimeout(()=>this.onCameraUpdate(),0)}updateScreenPosition(){if(!this.transformedPosition){this.container.style.left="-100%",this.container.style.top="-100%";return}const n=this.five.renderer.getSize(G3),t=Yf(this.five.camera,this.transformedPosition,n);if(!t){this.container.style.left="-100%",this.container.style.top="-100%";return}const i=(()=>{const s=2*Math.tan(.5*this.five.camera.fov/180*Math.PI),o=this.transformedPosition.distanceTo(this.five.camera.position);return Math.max(Math.min(1-s*o/40,1),.5)})(),r=(()=>{if(this.positionsForRotate===void 0||this.positionsForRotate.length!==2)return 0;const[s,o]=this.positionsForRotate,a=Yf(this.five.camera,s,n),l=Yf(this.five.camera,o,n);if(!a||!l)return 0;const c=a.leftPx>l.leftPx?l:a,h=a.leftPx>l.leftPx?a:l,u=h.leftPx-c.leftPx,d=h.topPx-c.topPx;return Math.atan2(d,u)*(180/Math.PI)})();this.container.style.left=t.leftPx+"px",this.container.style.top=t.topPx+"px",this.container.style.transformOrigin="center",this.container.style.transform=`scale(${i})`,r&&(this.container.style.transform+=` rotate(${r}deg)`)}}function j3(e,n,t){return new xc(e,n,t)}function hg(e){q0(e),e.traverse(n=>q0(n))}function q0(e){Array.isArray(e.lengthDoms)&&e.lengthDoms[0]instanceof xc&&e.lengthDoms.forEach(t=>t.destroy()),e.areaDom instanceof xc&&e.areaDom.destroy()}function Yw(e){if(!document.getElementById("LineLengthTagStyle")){const t=document.createElement("style");t.id="LineLengthTagStyle",document.head.appendChild(t),t.innerHTML=`
3098
+ `}at.create=function(e,n){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(at.prototype),e.prototype.constructor=e,e.prototype.getPoint=n,e};Object.assign($r.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var n=this.getPoints(e);return this.createGeometry(n)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var n=this.getSpacedPoints(e);return this.createGeometry(n)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var n=new pt,t=0,i=e.length;t<i;t++){var r=e[t];n.vertices.push(new B(r.x,r.y,r.z||0))}return n}});Object.assign(Xi.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}});Object.create(ai.prototype);Object.create(ai.prototype);function Ww(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),ai.call(this,e),this.type="catmullrom"}Ww.prototype=Object.create(ai.prototype);Object.assign(Ww.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}});Am.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Ca.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Object.assign(Vt.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Tw.extractUrlBase(e)}});Vt.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Object.assign(gm.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}});Object.assign(Vw.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}});Object.assign(pi.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}});Object.assign(cr.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}});Rc.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)};Gw.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)};Object.assign(wt,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),wt.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),wt.ceilPowerOfTwo(e)}});Object.assign(Wn.prototype,{flattenToArrayOffset:function(e,n){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,n)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}});Object.assign(Mt.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,n){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,n)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new B().setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,n,t,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,n,i,t,r,s)}});Qi.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)};En.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)};Object.assign(Fa.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}});Object.assign(Ln.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,n)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}});Object.assign(Ln,{barycoordFromPoint:function(e,n,t,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ln.getBarycoord(e,n,t,i,r)},normal:function(e,n,t,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ln.getNormal(e,n,t,i)}});Object.assign(Gs.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ua(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new fa(this,e)}});Object.assign(me.prototype,{fromAttribute:function(e,n,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,n,t)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(B.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,n){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(n,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,n,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,n,t)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(Nt.prototype,{fromAttribute:function(e,n,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,n,t)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(pt.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}});Object.assign(je.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,n){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(n,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}});Object.defineProperties(je.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Object.assign(tn.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}});Object.defineProperties(tn.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),_P},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});Object.defineProperties(Eu.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}});Object.defineProperty(jp.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}});Gp.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Object.defineProperty(at.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}});wn.prototype.setLens=function(e,n){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),n!==void 0&&(this.filmGauge=n),this.setFocalLength(e)};Object.defineProperties(Jt.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}});Object.defineProperties(ut.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Gl},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Gl)}}});Object.assign(ut.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(e===!0?Gl:Cd),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(Xe.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,n){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(n&&n.isBufferAttribute)&&!(n&&n.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new ut(arguments[1],arguments[2]))):e==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(n),this):this.setAttribute(e,n)},addDrawCall:function(e,n,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,n)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}});Object.defineProperties(Xe.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});Object.defineProperties(Ea.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}});Object.defineProperties(Fw.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}});Object.defineProperties(ls.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Gl},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}});Object.assign(ls.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(e===!0?Gl:Cd),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(Sr.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}});Object.defineProperties(ym.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}});Object.defineProperties(dt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Qe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===q1}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}});Object.defineProperties(qs.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties($n.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}});Object.assign(xw.prototype,{clearTarget:function(e,n,t,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(n,t,i)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}});Object.defineProperties(xw.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=e===!0?Ed:Kn}}});Object.defineProperties(Aw.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(di.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}});Object.defineProperties(gc.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var n=this,t=new vm;return t.load(e,function(i){n.setBuffer(i)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}});Ow.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Wl.prototype.updateCubeMap=function(e,n){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,n)};Qs.crossOrigin=void 0;Qs.loadTexture=function(e,n,t,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new nm;r.setCrossOrigin(this.crossOrigin);var s=r.load(e,t,void 0,i);return n&&(s.mapping=n),s};Qs.loadTextureCube=function(e,n,t,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new tm;r.setCrossOrigin(this.crossOrigin);var s=r.load(e,t,void 0,i);return n&&(s.mapping=n),s};Qs.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Qs.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:iC}}));var $o=function(){Ea.call(this),this.type="LineSegmentsGeometry";var e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],t=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(t),this.setAttribute("position",new ze(e,3)),this.setAttribute("uv",new ze(n,2))};$o.prototype=Object.assign(Object.create(Ea.prototype),{constructor:$o,isLineSegmentsGeometry:!0,applyMatrix4:function(e){var n=this.attributes.instanceStart,t=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),t.applyMatrix4(e),n.data.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},setPositions:function(e){var n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));var t=new Qu(n,6,1);return this.setAttribute("instanceStart",new Kr(t,3,0)),this.setAttribute("instanceEnd",new Kr(t,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this},setColors:function(e){var n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));var t=new Qu(n,6,1);return this.setAttribute("instanceColorStart",new Kr(t,3,0)),this.setAttribute("instanceColorEnd",new Kr(t,3,3)),this},fromWireframeGeometry:function(e){return this.setPositions(e.attributes.position.array),this},fromEdgesGeometry:function(e){return this.setPositions(e.attributes.position.array),this},fromMesh:function(e){return this.fromWireframeGeometry(new ql(e.geometry)),this},fromLineSegments:function(e){var n=e.geometry;return n.isGeometry?this.setPositions(n.vertices):n.isBufferGeometry&&this.setPositions(n.attributes.position.array),this},computeBoundingBox:function(){var e=new pi;return function(){this.boundingBox===null&&(this.boundingBox=new pi);var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;t!==void 0&&i!==void 0&&(this.boundingBox.setFromBufferAttribute(t),e.setFromBufferAttribute(i),this.boundingBox.union(e))}}(),computeBoundingSphere:function(){var e=new B;return function(){this.boundingSphere===null&&(this.boundingSphere=new cr),this.boundingBox===null&&this.computeBoundingBox();var t=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(t!==void 0&&i!==void 0){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var s=0,o=0,a=t.count;o<a;o++)e.fromBufferAttribute(t,o),s=Math.max(s,r.distanceToSquared(e)),e.fromBufferAttribute(i,o),s=Math.max(s,r.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}}(),toJSON:function(){},applyMatrix:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}});var Rl=function(){$o.call(this),this.type="LineGeometry"};Rl.prototype=Object.assign(Object.create($o.prototype),{constructor:Rl,isLineGeometry:!0,setPositions:function(e){for(var n=e.length-3,t=new Float32Array(2*n),i=0;i<n;i+=3)t[2*i]=e[i],t[2*i+1]=e[i+1],t[2*i+2]=e[i+2],t[2*i+3]=e[i+3],t[2*i+4]=e[i+4],t[2*i+5]=e[i+5];return $o.prototype.setPositions.call(this,t),this},setColors:function(e){for(var n=e.length-3,t=new Float32Array(2*n),i=0;i<n;i+=3)t[2*i]=e[i],t[2*i+1]=e[i+1],t[2*i+2]=e[i+2],t[2*i+3]=e[i+3],t[2*i+4]=e[i+4],t[2*i+5]=e[i+5];return $o.prototype.setColors.call(this,t),this},fromLine:function(e){var n=e.geometry;return n.isGeometry?this.setPositions(n.vertices):n.isBufferGeometry&&this.setPositions(n.attributes.position.array),this},copy:function(){return this}});class ei extends ne.Object3D{constructor(){super();v(this,"name","IObject3D");v(this,"needsRender")}removeChildren(){for(;this.children.length>0;)this.remove(this.children[0]);return this}add(...t){const i=t.filter(Boolean);return i.length===0?this:super.add(...i)}addIfNotExists(...t){return t.forEach(i=>{this.children.includes(i)||this.add(i)}),this}remove(...t){if(t.length===0)return this;const i=t.filter(Boolean);return super.remove(...i)}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}}function Yf(e,n,t){const{x:i,y:r,z:s}=n.clone().project(e);return s>1?void 0:{leftPx:(i+1)/2*t.x,topPx:(-r+1)/2*t.y}}function ki(e){var t;return((t=e.models)==null?void 0:t.filter(i=>i.name===e.state.workCode)[0])||e.model}class Qw extends Cn{constructor(t){super();v(this,"five");this.five=t}}const wc=(e,n)=>{if(!n)return e;const t=new C.Vector3,i=new C.Quaternion,r=new C.Vector3;return n.decompose(t,i,r),e.clone().multiply(r).applyQuaternion(i).add(t)},Xf=new Map;class V3 extends Qw{constructor(t){super(t);v(this,"_workCode")}get fromType(){var r,s;const t=this.workCode;if(Xf.has(t))return Xf.get(t);const i=(s=(r=JSON.parse(this.work.raw.works[0]))==null?void 0:r.from_type)!=null?s:"vr";return Xf.set(t,i),i}set workCode(t){this._workCode=t}get workCode(){var t;return(t=this._workCode)!=null?t:this.five.state.workCode}get work(){var t,i;return(i=(t=this.five.works)==null?void 0:t.find(r=>r.workCode===this.workCode))!=null?i:this.five.work}get observers(){var t;return(t=this.work)==null?void 0:t.observers}get transform(){var i,r,s,o;const t=(o=(i=this.work)==null?void 0:i.transform)!=null?o:(s=(r=this.work)==null?void 0:r.options)==null?void 0:s.transform;return t?t.clone():new C.Matrix4}getObserverPosition(t){var r;const i=(r=this.getObserver(t))==null?void 0:r.position;if(i)return wc(i,this.transform)}getObserverStandingPosition(t){var r;const i=(r=this.getObserver(t))==null?void 0:r.standingPosition;if(i)return wc(i,this.transform)}getObserver(t){var i;return(i=this.observers)==null?void 0:i[t]}}class Sd extends Qw{constructor(t){super(t);v(this,"workUtil",new V3(this.five))}get version(){return this.five.constructor.version}get majorVersion(){return Number(this.version.split(".")[0])}get model(){return ki(this.five)}moveToPano(t,i){const r=this.majorVersion===5?t:{workCode:this.workUtil.workCode,panoIndex:t};return this.five.moveToPano(r,i)}}const rs=new C.Raycaster;rs.params.Points.threshold=.02;const J0="LightTagContainer_shgjakdhwakjdhsja",G3=new C.Vector2;class xc{constructor(n,t,i){v(this,"container");v(this,"visible",!1);v(this,"enabled",!1);v(this,"wrapper");v(this,"positionsForRotate");v(this,"intersectCheck",!0);v(this,"simulate3D",!1);v(this,"tagWrapper");v(this,"five");v(this,"originPosition");v(this,"transformedPosition");v(this,"disposer");v(this,"config");v(this,"fiveUtil");v(this,"onCameraUpdate",()=>{this.visible!==!1&&this.updateScreenPosition()});v(this,"onFiveEveryReady",()=>{var n;if(this.intersectCheck&&this.visible&&this.five.state.mode!=="Panorama"){let t=.01;this.fiveUtil.workUtil.fromType==="poincare"&&(t=.05),rs.set(this.five.camera.position,this.transformedPosition.clone().sub(this.five.camera.position));const i=(n=ki(this.five).intersectRaycaster(rs))==null?void 0:n[0];(i==null?void 0:i.distance)+t>this.transformedPosition.distanceTo(this.five.camera.position)?(this.container.style.opacity="1",this.container.style.pointerEvents="auto"):(this.container.style.opacity="0",this.container.style.pointerEvents="none")}});var r,s,o;this.five=n,this.fiveUtil=(r=n.__fiveUtil__)!=null?r:n.__fiveUtil__=new Sd(n),this.originPosition=t?Ft(t).clone():void 0,this.transformedPosition=(s=this.originPosition)==null?void 0:s.clone(),this.positionsForRotate=(o=i==null?void 0:i.positionsForRotate)==null?void 0:o.map(a=>Ft(a).clone()),this.container=(()=>{const a=document.createElement("div");return a.style.width="0",a.style.height="0",a.style.position="absolute",a.style.transition="opacity 0.2s linear",a})(),this.config=i!=null?i:{},this.enable(),this.show()}show(){this.visible=!0,this.container.style.opacity="1",this.container.style.pointerEvents="auto",this.onCameraUpdate()}hide(){this.visible=!1,this.container.style.opacity="0",this.container.style.pointerEvents="none"}enable(){var i,r,s,o;if(this.enabled)return;this.enabled=!0,this.wrapper=(s=(r=this.config.wrapper)!=null?r:(i=this.five.getElement())==null?void 0:i.parentElement)!=null?s:document.body,this.tagWrapper||(this.tagWrapper=(o=document.getElementById(J0))!=null?o:(()=>{const a=document.createElement("div");return a.id=J0,a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.pointerEvents="none",a.style.zIndex="1",a})(),this.wrapper.contains(this.tagWrapper)||this.wrapper.appendChild(this.tagWrapper)),this.tagWrapper.appendChild(this.container);let n=!1;const t=()=>{n||(n=!0,this.five.ready().then(()=>{this.onFiveEveryReady(),n=!1}))};this.five.on("cameraUpdate",t),this.five.on("cameraUpdate",this.onCameraUpdate),this.disposer=()=>{this.five.off("cameraUpdate",t),this.five.off("cameraUpdate",this.onCameraUpdate)}}disable(){var n;this.enabled&&(this.enabled=!1,this.tagWrapper.removeChild(this.container),(n=this.disposer)==null||n.call(this))}destroy(){this.disable(),this.container.remove()}setTransformMatrix(n){var t;this.transformedPosition=(t=this.originPosition)==null?void 0:t.clone().applyMatrix4(n),this.onCameraUpdate()}setPosition(n,t){this.transformedPosition=n,this.positionsForRotate=t,this.onCameraUpdate(),setTimeout(()=>this.onCameraUpdate(),0)}updateScreenPosition(){if(!this.transformedPosition){this.container.style.left="-100%",this.container.style.top="-100%";return}const n=this.five.renderer.getSize(G3),t=Yf(this.five.camera,this.transformedPosition,n);if(!t){this.container.style.left="-100%",this.container.style.top="-100%";return}const i=(()=>{if(!this.simulate3D)return 1;const s=2*Math.tan(.5*this.five.camera.fov/180*Math.PI),o=this.transformedPosition.distanceTo(this.five.camera.position);return Math.max(Math.min(1-s*o/40,1),.5)})(),r=(()=>{if(this.positionsForRotate===void 0||this.positionsForRotate.length!==2)return 0;const[s,o]=this.positionsForRotate,a=Yf(this.five.camera,s,n),l=Yf(this.five.camera,o,n);if(!a||!l)return 0;const c=a.leftPx>l.leftPx?l:a,h=a.leftPx>l.leftPx?a:l,u=h.leftPx-c.leftPx,d=h.topPx-c.topPx;return Math.atan2(d,u)*(180/Math.PI)})();this.container.style.left=t.leftPx+"px",this.container.style.top=t.topPx+"px",this.container.style.transformOrigin="center",this.container.style.transform=`scale(${i})`,r&&(this.container.style.transform+=` rotate(${r}deg)`)}}function j3(e,n,t){return new xc(e,n,t)}function hg(e){q0(e),e.traverse(n=>q0(n))}function q0(e){Array.isArray(e.lengthDoms)&&e.lengthDoms[0]instanceof xc&&e.lengthDoms.forEach(t=>t.destroy()),e.areaDom instanceof xc&&e.areaDom.destroy()}function Yw(e){if(!document.getElementById("LineLengthTagStyle")){const t=document.createElement("style");t.id="LineLengthTagStyle",document.head.appendChild(t),t.innerHTML=`
3099
3099
  .LineLengthTag {
3100
3100
  position: absolute;
3101
3101
  pointer-events: none;
@@ -3119,7 +3119,7 @@ vec4 envMapTexelToLinear(vec4 color) {
3119
3119
  <div>${e}</div>
3120
3120
  <div>${e}</div>
3121
3121
  </div>
3122
- `}function zr(e){return arguments.length===0?[]:Array.isArray(e)?e:[e]}function qu(e,n){const i=zr(n).map(r=>e.localToWorld(r.clone()));return Array.isArray(n)?i:i[0]}class K0 extends nC{constructor(t){var i,r;super(t);v(this,"_three_color");At(t==null?void 0:t.color)&&(this.three_color=(i=t==null?void 0:t.color)!=null?i:16777215),Object.keys(t).forEach(s=>{["color","dashed","dashScale","dashSize","gapSize","resolution"].includes(s)||s in this&&(this[s]=t[s])}),this.setDashed((r=t==null?void 0:t.dashed)!=null?r:!1)}get three_color(){return this._three_color}set three_color(t){this._three_color=t,this.color=t}setDashed(t){this.dashed=t,t?this.defines.USE_DASH="":delete this.defines.USE_DASH,this.needsUpdate=!0}}class $0 extends tC{constructor(t,i){super(t,i);v(this,"name","Line3")}}class Ri extends ei{constructor(t){var o,a,l,c,h;super();v(this,"name","LineMesh");v(this,"points");v(this,"lengthDoms",[]);v(this,"highlighted",!1);v(this,"line");v(this,"backLine");v(this,"opacityBeforeHighlight");v(this,"paramsStyle",{});v(this,"lastRenderLengthItem");this.paramsStyle=t!=null?t:{};const i=new Rl,r=new K0({color:new C.Color((o=t==null?void 0:t.lineColor)!=null?o:gv),linewidth:(a=t==null?void 0:t.lineWidth)!=null?a:eC,dashScale:40,opacity:(l=t==null?void 0:t.opacity)!=null?l:1,transparent:!0,dashed:(c=t==null?void 0:t.dashed)!=null?c:!1}),s=new K0({color:new C.Color((h=t==null?void 0:t.lineColor)!=null?h:gv),linewidth:r.linewidth*.9,dashScale:r.dashScale,opacity:r.opacity*.7,depthTest:!1,depthWrite:!1,transparent:!0,resolution:r.resolution});this.line=new $0(i,r),this.backLine=new $0(i,s),this.line.renderOrder=1,this.backLine.renderOrder=0,this.line.name="lineFrontMaterial",this.backLine.name="lineBackMaterial",t&&this.setStyle(t),t!=null&&t.points&&this.setPoints(t.points),this.addEventListener("removed",()=>{hg(this)})}get style(){return{lineColor:this.color,lineWidth:this.lineWidth,opacity:this.opacity,dashed:this.dashed,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode,lengthEnable:this.paramsStyle.lengthEnable}}get opacity(){var t;return(t=this.line.material.opacity)!=null?t:this.paramsStyle.opacity}get lineWidth(){var t;return(t=this.line.material.linewidth)!=null?t:this.paramsStyle.lineWidth}get color(){var t;return new C.Color((t=this.line.material.three_color)!=null?t:this.paramsStyle.lineColor)}get dashed(){var t;return(t=this.line.material.dashed)!=null?t:this.paramsStyle.dashed}get occlusionVisibility(){return this.paramsStyle.occlusionVisibility}get occlusionMode(){return this.paramsStyle.occlusionMode}get five(){var t,i;return(i=(t=window.globalModules)==null?void 0:t.five)!=null?i:window.$five}updateMatrixWorld(t){var i;if(super.updateMatrixWorld(t),this.points){const r=(i=qu(this,this.points))==null?void 0:i.map(s=>s.toArray().join(",")).join(",");r!==this.lastRenderLengthItem&&(this.updateLengthItems(),this.lastRenderLengthItem=r)}}setPoints(t){const i=t.map(Ft).filter(At);if(this.points=i,i.length<2){this.line.geometry=new Rl,this.backLine.geometry=this.line.geometry,this.updateLengthItems();return}this.addIfNotExists(this.line,this.backLine);const r=i.flatMap(s=>[s.x,s.y,s.z]);r.length>2&&(this.line.geometry.dispose(),this.line.geometry=new Rl,this.backLine.geometry=this.line.geometry),this.line.geometry.setPositions(r),this.line.computeLineDistances(),this.updateLengthItems(),this.needsRender=!0}setResolution(t,i){const r=this.line.material.resolution;(r.x!==t||r.y!==i)&&(r.set(t,i),this.needsRender=!0);const s=this.backLine.material.resolution;(s.x!==t||s.y!==i)&&(s.set(t,i),this.needsRender=!0)}setStyle(t){var s,o,a;this.paramsStyle=R(R({},this.paramsStyle),t),At(t.lineColor)&&(this.line.material.three_color=new C.Color(t.lineColor),this.backLine.material.three_color=new C.Color(t.lineColor)),At(t.lineWidth)&&(this.line.material.linewidth=t.lineWidth),At(t.dashed)&&this.line.material.setDashed(t.dashed),At(t.opacity)&&(this.line.material.opacity=t.opacity,this.backLine.material.opacity=this.line.material.opacity*.7),this.updateLengthItems();const i=(s=t.occlusionVisibility)!=null?s:this.paramsStyle.occlusionVisibility,r=(a=(o=t.occlusionMode)!=null?o:this.paramsStyle.occlusionMode)!=null?a:"translucence";i?r==="depthTest"?(this.line.material.depthTest=!1,this.backLine.visible=!1):r==="translucence"&&(this.line.material.depthTest=!0,this.backLine.visible=!0,this.line.material.opacity===1?this.backLine.material.setDashed(!0):this.backLine.material.setDashed(this.line.material.dashed)):(this.line.material.depthTest=!0,this.backLine.visible=!1),this.needsRender=!0}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.line.material.opacity,this.line.material.opacity=this.opacityBeforeHighlight*ra,this.backLine.material.opacity=this.backLine.material.opacity*ra,this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.line.material.opacity=this.opacityBeforeHighlight,this.backLine.material.opacity=.2,this.needsRender=!0)}updateLengthItems(){const t=()=>{this.lengthDoms.forEach(r=>r.destroy()),this.lengthDoms=[]};if(!this.points||this.points.length<2||!this.paramsStyle.lengthEnable)return t();if(!this.five)return console.error("Five not found");const i=this.points.map((r,s)=>{if(s!==0)return[this.points[s-1],r]}).filter(At).map(r=>qu(this,r));i.forEach(([r,s],o)=>{var c;const a=lr(r,s);this.lengthDoms[o]=(c=this.lengthDoms[o])!=null?c:(()=>{const h=new xc(this.five);return h.intersectCheck=!1,h})(),this.lengthDoms[o].setPosition(a,[r,s]);const l=r.distanceTo(s).toFixed(2);this.lengthDoms[o].lengthDom!==l&&(this.lengthDoms[o].lengthDom=l,l==="0.00"?this.lengthDoms[o].container.innerHTML="":this.lengthDoms[o].container.innerHTML=Yw(l+"m"))}),this.lengthDoms.length>i.length&&(this.lengthDoms.slice(i.length).forEach(r=>r.destroy()),this.lengthDoms.length=i.length)}}class H3 extends du.CSS3DSprite{constructor(){super(...arguments);v(this,"isCSS3DSprite",!0)}}const U3=`
3122
+ `}function zr(e){return arguments.length===0?[]:Array.isArray(e)?e:[e]}function qu(e,n){const i=zr(n).map(r=>e.localToWorld(r.clone()));return Array.isArray(n)?i:i[0]}class K0 extends nC{constructor(t){var i,r;super(t);v(this,"_three_color");At(t==null?void 0:t.color)&&(this.three_color=(i=t==null?void 0:t.color)!=null?i:16777215),Object.keys(t).forEach(s=>{["color","dashed","dashScale","dashSize","gapSize","resolution"].includes(s)||s in this&&(this[s]=t[s])}),this.setDashed((r=t==null?void 0:t.dashed)!=null?r:!1)}get three_color(){return this._three_color}set three_color(t){this._three_color=t,this.color=t}setDashed(t){this.dashed=t,t?this.defines.USE_DASH="":delete this.defines.USE_DASH,this.needsUpdate=!0}}class $0 extends tC{constructor(t,i){super(t,i);v(this,"name","Line3")}}class Ri extends ei{constructor(t){var o,a,l,c,h;super();v(this,"name","LineMesh");v(this,"points");v(this,"lengthDoms",[]);v(this,"highlighted",!1);v(this,"line");v(this,"backLine");v(this,"opacityBeforeHighlight");v(this,"paramsStyle",{});v(this,"lastRenderLengthItem");this.paramsStyle=t!=null?t:{};const i=new Rl,r=new K0({color:new C.Color((o=t==null?void 0:t.lineColor)!=null?o:gv),linewidth:(a=t==null?void 0:t.lineWidth)!=null?a:eC,dashScale:40,opacity:(l=t==null?void 0:t.opacity)!=null?l:1,transparent:!0,dashed:(c=t==null?void 0:t.dashed)!=null?c:!1}),s=new K0({color:new C.Color((h=t==null?void 0:t.lineColor)!=null?h:gv),linewidth:r.linewidth*.9,dashScale:r.dashScale,opacity:r.opacity*.7,depthTest:!1,depthWrite:!1,transparent:!0,resolution:r.resolution});this.line=new $0(i,r),this.backLine=new $0(i,s),this.line.renderOrder=1,this.backLine.renderOrder=0,this.line.name="lineFrontMaterial",this.backLine.name="lineBackMaterial",t&&this.setStyle(t),t!=null&&t.points&&this.setPoints(t.points),this.addEventListener("removed",()=>{hg(this)})}get style(){return{lineColor:this.color,lineWidth:this.lineWidth,opacity:this.opacity,dashed:this.dashed,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode,lengthEnable:this.paramsStyle.lengthEnable}}get opacity(){var t;return(t=this.line.material.opacity)!=null?t:this.paramsStyle.opacity}get lineWidth(){var t;return(t=this.line.material.linewidth)!=null?t:this.paramsStyle.lineWidth}get color(){var t;return new C.Color((t=this.line.material.three_color)!=null?t:this.paramsStyle.lineColor)}get dashed(){var t;return(t=this.line.material.dashed)!=null?t:this.paramsStyle.dashed}get occlusionVisibility(){return this.paramsStyle.occlusionVisibility}get occlusionMode(){return this.paramsStyle.occlusionMode}get five(){var t,i;return(i=(t=window.globalModules)==null?void 0:t.five)!=null?i:window.$five}updateMatrixWorld(t){var i;if(super.updateMatrixWorld(t),this.points){const r=(i=qu(this,this.points))==null?void 0:i.map(s=>s.toArray().join(",")).join(",");r!==this.lastRenderLengthItem&&(this.updateLengthItems(),this.lastRenderLengthItem=r)}}setPoints(t){const i=t.map(Ft).filter(At);if(this.points=i,i.length<2){this.line.geometry=new Rl,this.backLine.geometry=this.line.geometry,this.updateLengthItems();return}this.addIfNotExists(this.line,this.backLine);const r=i.flatMap(s=>[s.x,s.y,s.z]);r.length>2&&(this.line.geometry.dispose(),this.line.geometry=new Rl,this.backLine.geometry=this.line.geometry),this.line.geometry.setPositions(r),this.line.computeLineDistances(),this.updateLengthItems(),this.needsRender=!0}setResolution(t,i){const r=this.line.material.resolution;(r.x!==t||r.y!==i)&&(r.set(t,i),this.needsRender=!0);const s=this.backLine.material.resolution;(s.x!==t||s.y!==i)&&(s.set(t,i),this.needsRender=!0)}setStyle(t){var s,o,a;this.paramsStyle=R(R({},this.paramsStyle),t),At(t.lineColor)&&(this.line.material.three_color=new C.Color(t.lineColor),this.backLine.material.three_color=new C.Color(t.lineColor)),At(t.lineWidth)&&(this.line.material.linewidth=t.lineWidth),At(t.dashed)&&this.line.material.setDashed(t.dashed),At(t.opacity)&&(this.line.material.opacity=t.opacity,this.backLine.material.opacity=this.line.material.opacity*.7),this.updateLengthItems();const i=(s=t.occlusionVisibility)!=null?s:this.paramsStyle.occlusionVisibility,r=(a=(o=t.occlusionMode)!=null?o:this.paramsStyle.occlusionMode)!=null?a:"translucence";i?r==="depthTest"?(this.line.material.depthTest=!1,this.backLine.visible=!1):r==="translucence"&&(this.line.material.depthTest=!0,this.backLine.visible=!0,this.line.material.opacity===1?this.backLine.material.setDashed(!0):this.backLine.material.setDashed(this.line.material.dashed)):(this.line.material.depthTest=!0,this.backLine.visible=!1),this.needsRender=!0}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.line.material.opacity,this.line.material.opacity=this.opacityBeforeHighlight*ra,this.backLine.material.opacity=this.backLine.material.opacity*ra,this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.line.material.opacity=this.opacityBeforeHighlight,this.backLine.material.opacity=.2,this.needsRender=!0)}updateLengthItems(){const t=()=>{this.lengthDoms.forEach(r=>r.destroy()),this.lengthDoms=[]};if(!this.points||this.points.length<2||!this.paramsStyle.lengthEnable)return t();if(!this.five)return console.error("Five not found");const i=this.points.map((r,s)=>{if(s!==0)return[this.points[s-1],r]}).filter(At).map(r=>qu(this,r));i.forEach(([r,s],o)=>{var c;const a=lr(r,s);this.lengthDoms[o]=(c=this.lengthDoms[o])!=null?c:(()=>{const h=new xc(this.five);return h.intersectCheck=!1,h.simulate3D=!0,h})(),this.lengthDoms[o].setPosition(a,[r,s]);const l=r.distanceTo(s).toFixed(2);this.lengthDoms[o].lengthDom!==l&&(this.lengthDoms[o].lengthDom=l,l==="0.00"?this.lengthDoms[o].container.innerHTML="":this.lengthDoms[o].container.innerHTML=Yw(l+"m"))}),this.lengthDoms.length>i.length&&(this.lengthDoms.slice(i.length).forEach(r=>r.destroy()),this.lengthDoms.length=i.length)}}class H3 extends du.CSS3DSprite{constructor(){super(...arguments);v(this,"isCSS3DSprite",!0)}}const U3=`
3123
3123
  varying vec2 vUv;
3124
3124
  varying float vRadius;
3125
3125
  varying float vDistanceToCamera;
@@ -3170,7 +3170,7 @@ void main() {
3170
3170
  svg [type='lineItemGroup'] g g g g {
3171
3171
  stroke: #ffffff;
3172
3172
  }</style>
3173
- `;return e.$$set=s=>{"content"in s&&t(0,i=s.content)},[i,r]}class PD extends ke{constructor(n){super(),Le(this,n,CD,ED,De,{content:0},MD)}}function _D(e){Ue(e,"svelte-ozpg4a",".floorplan-plugin__base-image.svelte-ozpg4a{position:absolute;z-index:10;width:100%;height:100%;pointer-events:none}")}function SD(e){let n,t;return n=new xD({props:{url:e[1].url}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&2&&(s.url=i[1].url),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function ID(e){let n,t;return n=new PD({props:{content:e[0]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.content=i[0]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function TD(e){let n,t,i,r;const s=[ID,SD],o=[];function a(l,c){return l[0]?0:l[1]?1:-1}return~(t=a(e))&&(i=o[t]=s[t](e)),{c(){n=H("div"),i&&i.c(),_(n,"class","floorplan-plugin__base-image svelte-ozpg4a")},m(l,c){Z(l,n,c),~t&&o[t].m(n,null),r=!0},p(l,[c]){let h=t;t=a(l),t===h?~t&&o[t].p(l,c):(i&&(Ve(),X(o[h],1,1,()=>{o[h]=null}),Ge()),~t?(i=o[t],i?i.p(l,c):(i=o[t]=s[t](l),i.c()),F(i,1),i.m(n,null)):i=null)},i(l){r||(F(i),r=!0)},o(l){X(i),r=!1},d(l){l&&Y(n),~t&&o[t].d()}}}function DD(e,n,t){let i,r,{floorIndex:s}=n,{floorplanData:o}=n;return e.$$set=a=>{"floorIndex"in a&&t(2,s=a.floorIndex),"floorplanData"in a&&t(3,o=a.floorplanData)},e.$$.update=()=>{var a,l;e.$$.dirty&12&&t(1,i=o.outlines[s]),e.$$.dirty&12&&t(0,r=(l=(a=o.outlines)==null?void 0:a[s])==null?void 0:l.svgContent)},[r,i,s,o]}class Cx extends ke{constructor(n){super(),Le(this,n,DD,TD,De,{floorIndex:2,floorplanData:3},_D)}}function LD(e){Ue(e,"svelte-9vzn2f",".floorplan-plugin__room-label-item.svelte-9vzn2f{position:absolute;display:flex;flex-flow:column;align-items:center;line-height:1;color:#fff;transform:translate(-50%, -50%);white-space:nowrap;will-change:opacity;transition:opacity 300ms}.floorplan-plugin__room-part1.svelte-9vzn2f{display:flex;flex-flow:column;align-items:center;color:#fff;white-space:nowrap}.floorplan-plugin__room-area.svelte-9vzn2f{opacity:0.6;line-height:1.25;margin-top:0.125rem}")}function kD(e){let n,t=e[15].outerHTML+"",i;return{c(){n=new $u(!1),i=ft(),n.a=i},m(r,s){n.m(t,r,s),Z(r,i,s)},p(r,s){s[0]&32768&&t!==(t=r[15].outerHTML+"")&&n.p(t)},d(r){r&&Y(i),r&&n.d()}}}function RD(e){let n,t,i,r,s,o,a=e[1]&&uy(e),l=e[0]&&dy(e),c=e[2]&&fy(e);return{c(){n=H("div"),a&&a.c(),t=ve(),l&&l.c(),i=ve(),c&&c.c(),r=ft(),_(n,"class","floorplan-plugin__room-part1 svelte-9vzn2f"),W(n,"opacity",e[11]?"1":"0")},m(h,u){Z(h,n,u),a&&a.m(n,null),Q(n,t),l&&l.m(n,null),Z(h,i,u),c&&c.m(h,u),Z(h,r,u),s||(o=[Di(As.call(null,n)),ot(n,"clientWidth",e[32]),ot(n,"clientHeight",e[33])],s=!0)},p(h,u){h[1]?a?a.p(h,u):(a=uy(h),a.c(),a.m(n,t)):a&&(a.d(1),a=null),h[0]?l?l.p(h,u):(l=dy(h),l.c(),l.m(n,null)):l&&(l.d(1),l=null),u[0]&2048&&W(n,"opacity",h[11]?"1":"0"),h[2]?c?c.p(h,u):(c=fy(h),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(h){h&&Y(n),a&&a.d(),l&&l.d(),h&&Y(i),c&&c.d(h),h&&Y(r),s=!1,yn(o)}}}function uy(e){let n,t=e[3].name+"",i;return{c(){n=H("span"),i=xt(t),_(n,"class","floorplan-plugin__room-name")},m(r,s){Z(r,n,s),Q(n,i)},p(r,s){s[0]&8&&t!==(t=r[3].name+"")&&Ct(i,t)},d(r){r&&Y(n)}}}function dy(e){let n,t;return{c(){n=H("span"),t=xt(e[14]),_(n,"class","floorplan-plugin__room-area svelte-9vzn2f"),W(n,"font-size",e[19])},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r[0]&16384&&Ct(t,i[14])},d(i){i&&Y(n)}}}function fy(e){let n,t;return{c(){n=H("span"),t=xt(e[13]),_(n,"class","floorplan-plugin__room-size"),W(n,"font-size",e[19]),W(n,"opacity",e[10]?"0.6":"0")},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r[0]&8192&&Ct(t,i[13]),r[0]&1024&&W(n,"opacity",i[10]?"0.6":"0")},d(i){i&&Y(n)}}}function OD(e){let n,t,i;function r(a,l){if(a[4]===void 0)return RD;if(a[15])return kD}let s=r(e),o=s&&s(e);return{c(){n=H("div"),o&&o.c(),_(n,"class","floorplan-plugin__room-label-item svelte-9vzn2f"),W(n,"left",e[16]),W(n,"top",e[17]),W(n,"font-size",e[18]),W(n,"opacity",e[12]?"1":"0"),W(n,"transform",e[9]?"translate(-50%, calc(-50% + 6px))":"translate(-50%, -50%)")},m(a,l){Z(a,n,l),o&&o.m(n,null),t||(i=[Di(As.call(null,n)),ot(n,"clientWidth",e[34]),ot(n,"clientHeight",e[35])],t=!0)},p(a,l){s===(s=r(a))&&o?o.p(a,l):(o&&o.d(1),o=s&&s(a),o&&(o.c(),o.m(n,null))),l[0]&4096&&W(n,"opacity",a[12]?"1":"0"),l[0]&512&&W(n,"transform",a[9]?"translate(-50%, calc(-50% + 6px))":"translate(-50%, -50%)")},i:de,o:de,d(a){a&&Y(n),o&&o.d(),t=!1,yn(i)}}}function zD(e,n){const t=e[0],i=e[1];let r=!1;for(let s=0,o=n.length-1;s<n.length;o=s++){const a=n[s][0],l=n[s][1],c=n[o][0],h=n[o][1];l>i!=h>i&&t<(c-a)*(i-l)/(h-l)+a&&(r=!r)}return r}function BD(e,n,t){let i,r,s,o,a,l,c,h,u,d,f,m,p,{pxmm:g}=n,{roomAreaEnable:y}=n,{roomNameEnable:b}=n,{roomDimensionEnable:A}=n,{room:w}=n,{hoveredRoom:x}=n,{getRoomAreaText:M}=n,{getRoomDimensionText:P}=n,{getLabelElement:S}=n,{adaptiveRoomLabelVisibleEnable:T}=n;function z(se,xe){if(xe.width===0||xe.height===0)return()=>!1;const Be=se.path.map(({x:N,y:j})=>[N,j]),ae=se.roomLabel.position,{x:pe,y:Te}=ae,{width:He,height:mt}=xe,Me=He/2,Ne=mt/2;return function(j){const Pe=pe*j,ge=Te*j,qe=Be.map(([ue,st])=>[ue*j,st*j]);return[[Pe+Me,ge-Ne],[Pe-Me,ge-Ne],[Pe-Me,ge+Ne],[Pe+Me,ge+Ne]].every(ue=>zD(ue,qe))}}const D=document.body.clientWidth,k=document.body.clientHeight,O=w.roomLabel,G=O.positionInImage.x*100+"%",I=O.positionInImage.y*100+"%",U=(D<500||k<500?10:14)+"px",q=(D<500||k<500?8:12)+"px";let K=0,te=0,ie=0,fe=0,ye=!1;x.subscribe(function(xe){t(25,ye=!!xe&&xe.id===w.id)});const be=se=>{t(7,ie=se.detail)},Je=se=>{t(8,fe=se.detail)},Ae=se=>{t(5,K=se.detail)},le=se=>{t(6,te=se.detail)};return e.$$set=se=>{"pxmm"in se&&t(20,g=se.pxmm),"roomAreaEnable"in se&&t(0,y=se.roomAreaEnable),"roomNameEnable"in se&&t(1,b=se.roomNameEnable),"roomDimensionEnable"in se&&t(2,A=se.roomDimensionEnable),"room"in se&&t(3,w=se.room),"hoveredRoom"in se&&t(21,x=se.hoveredRoom),"getRoomAreaText"in se&&t(22,M=se.getRoomAreaText),"getRoomDimensionText"in se&&t(23,P=se.getRoomDimensionText),"getLabelElement"in se&&t(4,S=se.getLabelElement),"adaptiveRoomLabelVisibleEnable"in se&&t(24,T=se.adaptiveRoomLabelVisibleEnable)},e.$$.update=()=>{var se,xe;e.$$.dirty[0]&24&&t(15,i=S==null?void 0:S(w)),e.$$.dirty[0]&4194312&&t(14,r=w.size?M(w.size):""),e.$$.dirty[0]&8388616&&t(13,s=w!=null&&w.dimension?P((se=w.dimension)==null?void 0:se.width,(xe=w.dimension)==null?void 0:xe.height):""),e.$$.dirty[0]&384&&t(31,o={width:ie,height:fe}),e.$$.dirty[0]&8|e.$$.dirty[1]&1&&t(30,a=o?z(w,o):void 0),e.$$.dirty[0]&1091567616&&t(27,l=T?!!(a!=null&&a(g)):!0),e.$$.dirty[0]&96&&t(29,c={width:K,height:te}),e.$$.dirty[0]&536870920&&t(28,h=c?z(w,c):void 0),e.$$.dirty[0]&286261248&&t(26,u=T?!!(h!=null&&h(g)):!0),e.$$.dirty[0]&234881024&&t(12,d=u||l||ye),e.$$.dirty[0]&167772160&&t(11,f=l||ye),e.$$.dirty[0]&100663296&&t(10,m=u||ye),e.$$.dirty[0]&201326592&&t(9,p=l&&!u)},[y,b,A,w,S,K,te,ie,fe,p,m,f,d,s,r,i,G,I,U,q,g,x,M,P,T,ye,u,l,h,c,a,o,be,Je,Ae,le]}class ND extends ke{constructor(n){super(),Le(this,n,BD,OD,De,{pxmm:20,roomAreaEnable:0,roomNameEnable:1,roomDimensionEnable:2,room:3,hoveredRoom:21,getRoomAreaText:22,getRoomDimensionText:23,getLabelElement:4,adaptiveRoomLabelVisibleEnable:24},LD,[-1,-1])}}function FD(e){Ue(e,"svelte-13xux0b",".floorplan-plugin__room-labels.svelte-13xux0b{width:100%;height:100%;position:absolute;left:0;top:0;z-index:20;pointer-events:none}")}function py(e,n,t){const i=e.slice();return i[14]=n[t],i}function my(e){let n,t=[],i=new Map,r,s,o,a=e[10];const l=c=>c[14].id;for(let c=0;c<a.length;c+=1){let h=py(e,a,c),u=l(h);i.set(u,t[c]=gy(u,h))}return{c(){n=H("div");for(let c=0;c<t.length;c+=1)t[c].c();_(n,"class","floorplan-plugin__room-labels svelte-13xux0b")},m(c,h){Z(c,n,h);for(let u=0;u<t.length;u+=1)t[u]&&t[u].m(n,null);r=!0,s||(o=[Di(As.call(null,n)),ot(n,"clientWidth",e[13])],s=!0)},p(c,h){h&1791&&(a=c[10],Ve(),t=zi(t,h,l,1,c,a,i,n,bs,gy,null,py),Ge())},i(c){if(!r){for(let h=0;h<a.length;h+=1)F(t[h]);r=!0}},o(c){for(let h=0;h<t.length;h+=1)X(t[h]);r=!1},d(c){c&&Y(n);for(let h=0;h<t.length;h+=1)t[h].d();s=!1,yn(o)}}}function gy(e,n){let t,i,r;const s=[{pxmm:n[9],room:n[14],hoveredRoom:n[3],roomAreaEnable:n[0],roomNameEnable:n[1],roomDimensionEnable:n[2],getLabelElement:n[6],getRoomAreaText:n[4],getRoomDimensionText:n[5],adaptiveRoomLabelVisibleEnable:n[7]}];let o={};for(let a=0;a<s.length;a+=1)o=kn(o,s[a]);return i=new ND({props:o}),{key:e,first:null,c(){t=ft(),Ie(i.$$.fragment),this.first=t},m(a,l){Z(a,t,l),_e(i,a,l),r=!0},p(a,l){n=a;const c=l&1791?Vn(s,[{pxmm:n[9],room:n[14],hoveredRoom:n[3],roomAreaEnable:n[0],roomNameEnable:n[1],roomDimensionEnable:n[2],getLabelElement:n[6],getRoomAreaText:n[4],getRoomDimensionText:n[5],adaptiveRoomLabelVisibleEnable:n[7]}]):{};i.$set(c)},i(a){r||(F(i.$$.fragment,a),r=!0)},o(a){X(i.$$.fragment,a),r=!1},d(a){a&&Y(t),Se(i,a)}}}function VD(e){let n,t,i=e[10]&&my(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[10]?i?(i.p(r,s),s&1024&&F(i,1)):(i=my(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function GD(e,n,t){let i,{floorIndex:r}=n,{roomAreaEnable:s}=n,{roomNameEnable:o}=n,{roomDimensionEnable:a}=n,{floorplanData:l}=n,{hoveredRoom:c}=n,{getRoomAreaText:h}=n,{getRoomDimensionText:u}=n,{getLabelElement:d}=n,{adaptiveRoomLabelVisibleEnable:f}=n,m=0,p=0;const g=y=>{t(8,m=y.detail)};return e.$$set=y=>{"floorIndex"in y&&t(11,r=y.floorIndex),"roomAreaEnable"in y&&t(0,s=y.roomAreaEnable),"roomNameEnable"in y&&t(1,o=y.roomNameEnable),"roomDimensionEnable"in y&&t(2,a=y.roomDimensionEnable),"floorplanData"in y&&t(12,l=y.floorplanData),"hoveredRoom"in y&&t(3,c=y.hoveredRoom),"getRoomAreaText"in y&&t(4,h=y.getRoomAreaText),"getRoomDimensionText"in y&&t(5,u=y.getRoomDimensionText),"getLabelElement"in y&&t(6,d=y.getLabelElement),"adaptiveRoomLabelVisibleEnable"in y&&t(7,f=y.adaptiveRoomLabelVisibleEnable)},e.$$.update=()=>{if(e.$$.dirty&6144&&t(10,i=l.floorDatas[r].rooms),e.$$.dirty&4352){const{max:y,min:b}=l.bounding,A=y.x-b.x;t(9,p=m/A)}},[s,o,a,c,h,u,d,f,m,p,i,r,l,g]}class jD extends ke{constructor(n){super(),Le(this,n,GD,VD,De,{floorIndex:11,roomAreaEnable:0,roomNameEnable:1,roomDimensionEnable:2,floorplanData:12,hoveredRoom:3,getRoomAreaText:4,getRoomDimensionText:5,getLabelElement:6,adaptiveRoomLabelVisibleEnable:7},FD)}}function HD(e){Ue(e,"svelte-djlmk4",".floorplan-plugin__rule-labels.svelte-djlmk4.svelte-djlmk4{position:absolute;display:flex}.floorplan-plugin__rule-labels--top.svelte-djlmk4.svelte-djlmk4{left:0;top:-1.25rem}.floorplan-plugin__rule-labels--bottom.svelte-djlmk4.svelte-djlmk4{left:0;bottom:-1.25rem}.floorplan-plugin__rule-labels--left.svelte-djlmk4.svelte-djlmk4{top:0;left:-1.25rem}.floorplan-plugin__rule-labels--right.svelte-djlmk4.svelte-djlmk4{top:0;right:-1.25rem}.floorplan-plugin__rule-line.svelte-djlmk4.svelte-djlmk4{background:#fff;opacity:0.05;width:100%;height:100%}.floorplan-plugin__rule-scale-wrapper.svelte-djlmk4.svelte-djlmk4{position:absolute;width:0.3125rem;height:100%;left:50%;top:0;transform:translateX(-50%)}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-scale-wrapper.svelte-djlmk4{width:100%;height:0.3125rem;top:50%;left:0;transform:translateY(-50%)}.floorplan-plugin__rule-scale.svelte-djlmk4.svelte-djlmk4{position:absolute;background:#fff;opacity:0.05;width:100%;height:0.0625rem}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-scale.svelte-djlmk4{width:0.0625rem;height:100%}.floorplan-plugin__rule-text-wrapper.svelte-djlmk4.svelte-djlmk4{position:absolute}.floorplan-plugin__rule-labels--top.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:100%;height:0;top:0.625rem}.floorplan-plugin__rule-labels--bottom.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:100%;height:0;bottom:0.625rem}.floorplan-plugin__rule-labels--left.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:0;height:100%;left:0.625rem}.floorplan-plugin__rule-labels--right.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:0;height:100%;right:0.625rem}.floorplan-plugin__rule-text-item.svelte-djlmk4.svelte-djlmk4{width:0;height:0;position:absolute;transform:rotate(90deg)}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-text-item.svelte-djlmk4{transform:rotate(0)}.floorplan-plugin__rule-text.svelte-djlmk4.svelte-djlmk4{width:-moz-max-content;width:max-content;transform:translate(-50%, -50%);font-size:0.625rem;color:#fff;opacity:0.2}")}function vy(e,n,t){const i=e.slice();return i[11]=n[t],i[13]=t,i}function yy(e,n,t){const i=e.slice();return i[14]=n[t],i}function by(e){let n;return{c(){n=H("div"),_(n,"class","floorplan-plugin__rule-scale svelte-djlmk4"),W(n,"left",e[14].left*100+"%"),W(n,"bottom",e[14].bottom*100+"%")},m(t,i){Z(t,n,i)},p:de,d(t){t&&Y(n)}}}function Ay(e,n){let t,i,r=n[1](n[11].distance)+"",s,o;return{key:e,first:null,c(){t=H("div"),i=H("div"),s=xt(r),o=ve(),_(i,"class","floorplan-plugin__rule-text svelte-djlmk4"),Ce(i,"is-row",n[2]),_(t,"class","floorplan-plugin__rule-text-item svelte-djlmk4"),W(t,"left",n[11].left*100+"%"),W(t,"bottom",n[11].bottom*100+"%"),this.first=t},m(a,l){Z(a,t,l),Q(t,i),Q(i,s),Q(t,o)},p(a,l){n=a,l&2&&r!==(r=n[1](n[11].distance)+"")&&Ct(s,r)},d(a){a&&Y(t)}}}function UD(e){let n,t,i,r,s,o,a=[],l=new Map,c,h=e[3],u=[];for(let m=0;m<h.length;m+=1)u[m]=by(yy(e,h,m));let d=e[4];const f=m=>m[13];for(let m=0;m<d.length;m+=1){let p=vy(e,d,m),g=f(p);l.set(g,a[m]=Ay(g,p))}return{c(){n=H("div"),t=H("div"),i=ve(),r=H("div");for(let m=0;m<u.length;m+=1)u[m].c();s=ve(),o=H("div");for(let m=0;m<a.length;m+=1)a[m].c();_(t,"class","floorplan-plugin__rule-line svelte-djlmk4"),_(r,"class","floorplan-plugin__rule-scale-wrapper svelte-djlmk4"),Ce(r,"is-row",e[2]),_(o,"class","floorplan-plugin__rule-text-wrapper svelte-djlmk4"),_(n,"class",c="floorplan-plugin__rule-labels floorplan-plugin__rule-labels--"+e[0]+" svelte-djlmk4"),Ce(n,"is-row",e[2]),W(n,"width",e[2]?"100%":1/16+"rem"),W(n,"height",e[2]?1/16+"rem":"100%")},m(m,p){Z(m,n,p),Q(n,t),Q(n,i),Q(n,r);for(let g=0;g<u.length;g+=1)u[g]&&u[g].m(r,null);Q(n,s),Q(n,o);for(let g=0;g<a.length;g+=1)a[g]&&a[g].m(o,null)},p(m,[p]){if(p&8){h=m[3];let g;for(g=0;g<h.length;g+=1){const y=yy(m,h,g);u[g]?u[g].p(y,p):(u[g]=by(y),u[g].c(),u[g].m(r,null))}for(;g<u.length;g+=1)u[g].d(1);u.length=h.length}p&22&&(d=m[4],a=zi(a,p,f,1,m,d,l,o,Mg,Ay,null,vy)),p&1&&c!==(c="floorplan-plugin__rule-labels floorplan-plugin__rule-labels--"+m[0]+" svelte-djlmk4")&&_(n,"class",c),p&5&&Ce(n,"is-row",m[2])},i:de,o:de,d(m){m&&Y(n),Oi(u,m);for(let p=0;p<a.length;p+=1)a[p].d()}}}const Oo=1e3,zo=180;function WD(e,n,t){let{type:i}=n,{data:r}=n,{bounding:s}=n,{getRuleDistanceText:o}=n;const a=i==="top"||i==="bottom",l=s.max.x-s.min.x-(Oo-zo)*2,c=s.max.y-s.min.y-(Oo-zo)*2,h=r.map(([m,p])=>a?[m.x,p.x]:[m.y,p.y]).flat().sort().filter((m,p,g)=>p===0?!0:m!==g[p-1]),u=h.map(m=>{const p=a?(m-s.min.x-Oo+zo)/l:0,g=a?0:(m-s.min.y-Oo+zo)/c;return{left:p,bottom:g}});u.unshift({left:0,bottom:0}),u.push(a?{left:1,bottom:0}:{left:0,bottom:1});const d=h[h.length-1]-h[0],f=h.map((m,p,g)=>{const y=p===0?0:m-g[p-1],b=p===0?0:(m+g[p-1])/2,A=a?(b-s.min.x-Oo+zo)/l:0,w=a?0:(b-s.min.y-Oo+zo)/c;return{left:A,bottom:w,distance:y}}).filter(({distance:m})=>m/d>.1);return e.$$set=m=>{"type"in m&&t(0,i=m.type),"data"in m&&t(5,r=m.data),"bounding"in m&&t(6,s=m.bounding),"getRuleDistanceText"in m&&t(1,o=m.getRuleDistanceText)},[i,o,a,u,f,r,s]}class QD extends ke{constructor(n){super(),Le(this,n,WD,UD,De,{type:0,data:5,bounding:6,getRuleDistanceText:1},HD)}}function YD(e){Ue(e,"svelte-1mzj9p3",".floorplan-plugin__rule-labels-wrapper.svelte-1mzj9p3{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none}")}function wy(e,n,t){const i=e.slice();return i[13]=n[t][0],i[14]=n[t][1],i}function xy(e,n){let t,i,r;const s=[{type:n[13],data:n[14],bounding:n[1],getRuleDistanceText:n[0]}];let o={};for(let a=0;a<s.length;a+=1)o=kn(o,s[a]);return i=new QD({props:o}),{key:e,first:null,c(){t=ft(),Ie(i.$$.fragment),this.first=t},m(a,l){Z(a,t,l),_e(i,a,l),r=!0},p(a,l){n=a;const c=l&19?Vn(s,[{type:n[13],data:n[14],bounding:n[1],getRuleDistanceText:n[0]}]):{};i.$set(c)},i(a){r||(F(i.$$.fragment,a),r=!0)},o(a){X(i.$$.fragment,a),r=!1},d(a){a&&Y(t),Se(i,a)}}}function XD(e){let n,t=[],i=new Map,r,s=e[4];const o=a=>a[13];for(let a=0;a<s.length;a+=1){let l=wy(e,s,a),c=o(l);i.set(c,t[a]=xy(c,l))}return{c(){n=H("div");for(let a=0;a<t.length;a+=1)t[a].c();_(n,"class","floorplan-plugin__rule-labels-wrapper svelte-1mzj9p3"),W(n,"width",e[3]),W(n,"height",e[2])},m(a,l){Z(a,n,l);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(n,null);r=!0},p(a,[l]){l&19&&(s=a[4],Ve(),t=zi(t,l,o,1,a,s,i,n,bs,xy,null,wy),Ge()),l&8&&W(n,"width",a[3]),l&4&&W(n,"height",a[2])},i(a){if(!r){for(let l=0;l<s.length;l+=1)F(t[l]);r=!0}},o(a){for(let l=0;l<t.length;l+=1)X(t[l]);r=!1},d(a){a&&Y(n);for(let l=0;l<t.length;l+=1)t[l].d()}}}const My=1e3,Ey=180;function ZD(e,n,t){let i,r,s,o,a,l,c,h,u,d,{floorIndex:f}=n,{floorplanData:m}=n,{getRuleDistanceText:p}=n;return e.$$set=g=>{"floorIndex"in g&&t(5,f=g.floorIndex),"floorplanData"in g&&t(6,m=g.floorplanData),"getRuleDistanceText"in g&&t(0,p=g.getRuleDistanceText)},e.$$.update=()=>{e.$$.dirty&64&&t(1,i=m.bounding),e.$$.dirty&96&&t(11,r=m.floorDatas[f].rules),e.$$.dirty&2048&&t(12,s=Object.keys(r)),e.$$.dirty&6144&&t(4,o=s.map(g=>[g,r[g]])),e.$$.dirty&2&&t(9,a=i.max.x-i.min.x),e.$$.dirty&2&&t(7,l=i.max.y-i.min.y),e.$$.dirty&2&&t(10,c=i.max.x-i.min.x-(My-Ey)*2),e.$$.dirty&2&&t(8,h=i.max.y-i.min.y-(My-Ey)*2),e.$$.dirty&1536&&t(3,u=c/a*100+"%"),e.$$.dirty&384&&t(2,d=h/l*100+"%")},[p,i,d,u,o,f,m,l,h,a,c,r,s]}class JD extends ke{constructor(n){super(),Le(this,n,ZD,XD,De,{floorIndex:5,floorplanData:6,getRuleDistanceText:0},YD)}}function Rd(e,n={}){let t="";const{needZ:i,needA:r}=n;return(i?e.slice().concat(e[0]):e.slice()).forEach((o,a)=>{const{x:l,y:c}=n.format?n.format(o):o,h=l+","+c;return a===0?(t+="M"+h,t):r!=null&&r[a]?(t+="A"+r[a]+","+h,t):(t+="L"+h,t)}),t+(i?"Z":"")}function Px({x:e,y:n},t){const{max:i,min:r}=t;return{x:e-r.x,y:i.y-n}}function qD(e,n){const t=e.x*1e3+n.bounding.origin.x,i=-e.z*1e3+n.bounding.origin.y;return{x:t,y:i}}function KD(e,n){const t=n.bounding,i=t.max.x-t.min.x,r=t.max.y-t.min.y;return{x:(e.x-t.min.x)/i,y:(t.max.y-e.y)/r}}function $D(e,n){return Math.max(...n.work.observers.map(i=>e.z>=i.standingPosition.z?i.floorIndex:0))}function eL(e){let n;return{c(){n=Bt("path"),_(n,"d",e[0]),_(n,"fill","#2F313A")},m(t,i){Z(t,n,i)},p(t,[i]){i&1&&_(n,"d",t[0])},i:de,o:de,d(t){t&&Y(n)}}}function tL(e,n,t){let i,{path:r}=n;return e.$$set=s=>{"path"in s&&t(1,r=s.path)},e.$$.update=()=>{e.$$.dirty&2&&t(0,i=Rd(r,{needZ:!0}))},[i,r]}class nL extends ke{constructor(n){super(),Le(this,n,tL,eL,De,{path:1})}}function iL(e){let n,t,i,r,s,o;return{c(){n=Bt("defs"),t=Bt("pattern"),i=Bt("rect"),r=Bt("path"),s=ve(),o=Bt("path"),_(i,"x","0"),_(i,"y","0"),_(i,"width",e[1]),_(i,"height",e[1]),_(i,"fill","#323747"),_(r,"d",e[2]),_(r,"stroke","#ffffff"),_(r,"stroke-opacity","0.06"),_(r,"stroke-width","0.5"),_(r,"fill","none"),_(t,"id","fpm-room-pattern-0"),_(t,"x","0"),_(t,"y","0"),_(t,"width",e[1]),_(t,"height",e[1]),_(t,"patternUnits","userSpaceOnUse"),_(t,"patternTransform","scale(50 50)"),_(o,"d",e[0]),_(o,"fill","url(#fpm-room-pattern-0)")},m(a,l){Z(a,n,l),Q(n,t),Q(t,i),Q(t,r),Z(a,s,l),Z(a,o,l)},p(a,[l]){l&1&&_(o,"d",a[0])},i:de,o:de,d(a){a&&Y(n),a&&Y(s),a&&Y(o)}}}const ep=6;function rL(e,n,t){let i,{path:r}=n;const s=ep*2,o=`M0 ${ep} h ${s} M${ep} 0 v ${s}`;return e.$$set=a=>{"path"in a&&t(3,r=a.path)},e.$$.update=()=>{e.$$.dirty&8&&t(0,i=Rd(r,{needZ:!0}))},[i,s,o,r]}class sL extends ke{constructor(n){super(),Le(this,n,rL,iL,De,{path:3})}}function oL(e){let n,t,i,r,s,o,a,l,c,h,u;return{c(){n=Bt("defs"),t=Bt("pattern"),i=Bt("rect"),r=Bt("pattern"),s=Bt("rect"),o=ve(),a=Bt("path"),l=ve(),c=Bt("path"),h=ve(),u=Bt("path"),_(i,"x","0"),_(i,"y","0"),_(i,"width","6"),_(i,"height","50"),_(i,"fill","none"),_(i,"stroke","#4B4B57"),_(i,"stroke-width","0.5"),_(t,"id","room-material-pattern-1"),_(t,"x","0"),_(t,"y","0"),_(t,"width","12"),_(t,"height","50"),_(t,"patternUnits","userSpaceOnUse"),_(t,"patternTransform","scale(50 50)"),_(s,"x","0"),_(s,"y","0"),_(s,"width","6"),_(s,"height","50"),_(s,"fill","none"),_(s,"stroke","#4B4B57"),_(s,"stroke-width","0.5"),_(r,"id","room-material-pattern-2"),_(r,"x","6"),_(r,"y","25"),_(r,"width","12"),_(r,"height","50"),_(r,"patternUnits","userSpaceOnUse"),_(r,"patternTransform","scale(50 50)"),_(a,"d",e[0]),_(a,"fill","#43434D"),_(c,"d",e[0]),_(c,"fill","url(#room-material-pattern-1)"),_(u,"d",e[0]),_(u,"fill","url(#room-material-pattern-2)")},m(d,f){Z(d,n,f),Q(n,t),Q(t,i),Q(n,r),Q(r,s),Z(d,o,f),Z(d,a,f),Z(d,l,f),Z(d,c,f),Z(d,h,f),Z(d,u,f)},p(d,[f]){f&1&&_(a,"d",d[0]),f&1&&_(c,"d",d[0]),f&1&&_(u,"d",d[0])},i:de,o:de,d(d){d&&Y(n),d&&Y(o),d&&Y(a),d&&Y(l),d&&Y(c),d&&Y(h),d&&Y(u)}}}function aL(e,n,t){let i,{path:r}=n;return e.$$set=s=>{"path"in s&&t(1,r=s.path)},e.$$.update=()=>{e.$$.dirty&2&&t(0,i=Rd(r,{needZ:!0}))},[i,r]}class lL extends ke{constructor(n){super(),Le(this,n,aL,oL,De,{path:1})}}function cL(e){Ue(e,"svelte-1dykexu",".floorplan-plugin__room-material.svelte-1dykexu{position:absolute;left:0;top:0;width:100%;height:100%}svg.svelte-1dykexu{position:absolute;left:0;top:0;width:100%;height:100%;overflow:visible}")}function Cy(e,n,t){const i=e.slice();return i[5]=n[t],i}function hL(e){let n,t;return n=new sL({props:{path:e[5].path}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.path=i[5].path),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function uL(e){let n,t;return n=new lL({props:{path:e[5].path}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.path=i[5].path),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function dL(e){let n,t;return n=new nL({props:{path:e[5].path}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.path=i[5].path),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function Py(e){let n,t,i,r;const s=[dL,uL,hL],o=[];function a(l,c){return l[5].floorType===1?0:l[5].floorType===0?1:2}return t=a(e),i=o[t]=s[t](e),{c(){n=Bt("svg"),i.c(),_(n,"width","100%"),_(n,"height","100%"),_(n,"viewBox",`0 0 ${e[1]} ${e[2]}`),_(n,"class","svelte-1dykexu")},m(l,c){Z(l,n,c),o[t].m(n,null),r=!0},p(l,c){let h=t;t=a(l),t===h?o[t].p(l,c):(Ve(),X(o[h],1,1,()=>{o[h]=null}),Ge(),i=o[t],i?i.p(l,c):(i=o[t]=s[t](l),i.c()),F(i,1),i.m(n,null))},i(l){r||(F(i),r=!0)},o(l){X(i),r=!1},d(l){l&&Y(n),o[t].d()}}}function fL(e){let n,t,i=e[0],r=[];for(let o=0;o<i.length;o+=1)r[o]=Py(Cy(e,i,o));const s=o=>X(r[o],1,1,()=>{r[o]=null});return{c(){n=H("div");for(let o=0;o<r.length;o+=1)r[o].c();_(n,"class","floorplan-plugin__room-material svelte-1dykexu")},m(o,a){Z(o,n,a);for(let l=0;l<r.length;l+=1)r[l]&&r[l].m(n,null);t=!0},p(o,[a]){if(a&7){i=o[0];let l;for(l=0;l<i.length;l+=1){const c=Cy(o,i,l);r[l]?(r[l].p(c,a),F(r[l],1)):(r[l]=Py(c),r[l].c(),F(r[l],1),r[l].m(n,null))}for(Ve(),l=i.length;l<r.length;l+=1)s(l);Ge()}},i(o){if(!t){for(let a=0;a<i.length;a+=1)F(r[a]);t=!0}},o(o){r=r.filter(Boolean);for(let a=0;a<r.length;a+=1)X(r[a]);t=!1},d(o){o&&Y(n),Oi(r,o)}}}function pL(e,n,t){let i,{floorIndex:r}=n,{floorplanData:s}=n;const o=s.bounding.max.x-s.bounding.min.x,a=s.bounding.max.y-s.bounding.min.y;return e.$$set=l=>{"floorIndex"in l&&t(3,r=l.floorIndex),"floorplanData"in l&&t(4,s=l.floorplanData)},e.$$.update=()=>{e.$$.dirty&24&&t(0,i=s.floorDatas[r].rooms.map(l=>Ee(R({},l),{path:l.path.map(c=>Px(c,s.bounding))})))},[i,o,a,r,s]}class mL extends ke{constructor(n){super(),Le(this,n,pL,fL,De,{floorIndex:3,floorplanData:4},cL)}}function gL(e){Ue(e,"svelte-qq2273","path.svelte-qq2273{--opacity:0;opacity:var(--opacity)}path.svelte-qq2273:hover{opacity:calc(var(--opacity) + 0.1)}")}function vL(e){let n,t,i,r;return{c(){n=Bt("path"),_(n,"d",e[5]),_(n,"fill","#fff"),_(n,"style",e[2]),_(n,"id",t=`${e[1]}_${e[0].id}`),_(n,"class","svelte-qq2273")},m(s,o){Z(s,n,o),i||(r=[ot(n,"mouseenter",e[3]),ot(n,"mouseleave",e[4])],i=!0)},p(s,[o]){o&4&&_(n,"style",s[2]),o&3&&t!==(t=`${s[1]}_${s[0].id}`)&&_(n,"id",t)},i:de,o:de,d(s){s&&Y(n),i=!1,yn(r)}}}function yL(e,n,t){let i,r,{room:s}=n,{floorIndex:o}=n,{floorplanData:a}=n,{highlightData:l}=n,{hoveredRoom:c}=n;function h(){c==null||c.set(s)}function u(){c==null||c.set(void 0)}const{bounding:d}=a,f=Rd(s.path,{needZ:!0,format:m=>Px(m,d)});return e.$$set=m=>{"room"in m&&t(0,s=m.room),"floorIndex"in m&&t(1,o=m.floorIndex),"floorplanData"in m&&t(6,a=m.floorplanData),"highlightData"in m&&t(7,l=m.highlightData),"hoveredRoom"in m&&t(8,c=m.hoveredRoom)},e.$$.update=()=>{e.$$.dirty&131&&t(9,i=l[`${o}_${s.id}`]),e.$$.dirty&512&&t(2,r=i?`fill: ${i.color}; --opacity: ${i.opacity}; pointer-events: ${i.disabled?"none":"auto"}`:null)},[s,o,r,h,u,f,a,l,c,i]}class bL extends ke{constructor(n){super(),Le(this,n,yL,vL,De,{room:0,floorIndex:1,floorplanData:6,highlightData:7,hoveredRoom:8},gL)}}function AL(e){Ue(e,"svelte-1kqo6e4",".floorplan-plugin__room-highlight.svelte-1kqo6e4{position:absolute;width:100%;height:100%}svg.svelte-1kqo6e4{width:100%;height:100%;overflow:visible}")}function _y(e,n,t){const i=e.slice();return i[6]=n[t],i}function Sy(e,n){let t,i,r;const s=[{room:n[6],floorplanData:n[1],hoveredRoom:n[3],floorIndex:n[0],highlightData:n[2]}];let o={};for(let a=0;a<s.length;a+=1)o=kn(o,s[a]);return i=new bL({props:o}),{key:e,first:null,c(){t=ft(),Ie(i.$$.fragment),this.first=t},m(a,l){Z(a,t,l),_e(i,a,l),r=!0},p(a,l){n=a;const c=l&15?Vn(s,[{room:n[6],floorplanData:n[1],hoveredRoom:n[3],floorIndex:n[0],highlightData:n[2]}]):{};i.$set(c)},i(a){r||(F(i.$$.fragment,a),r=!0)},o(a){X(i.$$.fragment,a),r=!1},d(a){a&&Y(t),Se(i,a)}}}function wL(e){let n,t,i=[],r=new Map,s,o=e[1].floorDatas[e[0]].rooms;const a=l=>l[6].id;for(let l=0;l<o.length;l+=1){let c=_y(e,o,l),h=a(c);r.set(h,i[l]=Sy(h,c))}return{c(){n=H("div"),t=Bt("svg");for(let l=0;l<i.length;l+=1)i[l].c();_(t,"width","100%"),_(t,"height","100%"),_(t,"viewBox",`0 0 ${e[4]} ${e[5]}`),_(t,"class","svelte-1kqo6e4"),_(n,"class","floorplan-plugin__room-highlight svelte-1kqo6e4")},m(l,c){Z(l,n,c),Q(n,t);for(let h=0;h<i.length;h+=1)i[h]&&i[h].m(t,null);s=!0},p(l,[c]){c&15&&(o=l[1].floorDatas[l[0]].rooms,Ve(),i=zi(i,c,a,1,l,o,r,t,bs,Sy,null,_y),Ge())},i(l){if(!s){for(let c=0;c<o.length;c+=1)F(i[c]);s=!0}},o(l){for(let c=0;c<i.length;c+=1)X(i[c]);s=!1},d(l){l&&Y(n);for(let c=0;c<i.length;c+=1)i[c].d()}}}function xL(e,n,t){let{floorIndex:i}=n,{floorplanData:r}=n,{highlightData:s}=n,{hoveredRoom:o}=n;const a=r.bounding.max.x-r.bounding.min.x,l=r.bounding.max.y-r.bounding.min.y;return e.$$set=c=>{"floorIndex"in c&&t(0,i=c.floorIndex),"floorplanData"in c&&t(1,r=c.floorplanData),"highlightData"in c&&t(2,s=c.highlightData),"hoveredRoom"in c&&t(3,o=c.hoveredRoom)},[i,r,s,o,a,l]}class _x extends ke{constructor(n){super(),Le(this,n,xL,wL,De,{floorIndex:0,floorplanData:1,highlightData:2,hoveredRoom:3},AL)}}function ML(e){Ue(e,"svelte-1lm20n5",".missing-floor.svelte-1lm20n5{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);display:flex;flex-direction:column;align-items:center}.text.svelte-1lm20n5{margin-top:0.75rem;color:#fff;opacity:0.3}")}function Iy(e){let n,t=e[0].text+"",i;return{c(){n=H("span"),i=xt(t),_(n,"class","text svelte-1lm20n5"),W(n,"font-size",e[0].textFontSize+"px")},m(r,s){Z(r,n,s),Q(n,i)},p(r,s){s&1&&t!==(t=r[0].text+"")&&Ct(i,t),s&1&&W(n,"font-size",r[0].textFontSize+"px")},d(r){r&&Y(n)}}}function EL(e){let n,t,i,r,s=e[0].text&&Iy(e);return{c(){n=H("div"),t=H("img"),r=ve(),s&&s.c(),_(t,"class","image"),_(t,"alt","缺省楼层展位图"),Pn(t.src,i=e[0].imageURL)||_(t,"src",i),W(t,"width",e[0].imageWidth+"px"),W(t,"height",e[0].imageHeight+"px"),_(n,"class","missing-floor svelte-1lm20n5")},m(o,a){Z(o,n,a),Q(n,t),Q(n,r),s&&s.m(n,null)},p(o,[a]){a&1&&!Pn(t.src,i=o[0].imageURL)&&_(t,"src",i),a&1&&W(t,"width",o[0].imageWidth+"px"),a&1&&W(t,"height",o[0].imageHeight+"px"),o[0].text?s?s.p(o,a):(s=Iy(o),s.c(),s.m(n,null)):s&&(s.d(1),s=null)},i:de,o:de,d(o){o&&Y(n),s&&s.d()}}}function CL(e,n,t){let{missingFloorConfig:i}=n;return e.$$set=r=>{"missingFloorConfig"in r&&t(0,i=r.missingFloorConfig)},[i]}class PL extends ke{constructor(n){super(),Le(this,n,CL,EL,De,{missingFloorConfig:0},ML)}}const ps="data:image/png;base64,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";function Pg(e){return e*180/Math.PI}function _L(e){Ue(e,"svelte-17cl35n",".floorplan__camera-position.svelte-17cl35n{position:absolute;width:0;height:0}.floorplan__camera-rotate.svelte-17cl35n{position:absolute;background-repeat:no-repeat;background-size:100%}")}function SL(e){let n,t;return{c(){n=H("div"),t=H("div"),_(t,"class","floorplan__camera-rotate svelte-17cl35n"),W(t,"background-image",`url(${e[0]||ps})`),W(t,"width",e[4]),W(t,"height",e[4]),W(t,"left","-"+e[4]),W(t,"top","-"+e[4]),W(t,"transform",`rotate(${e[3]}deg)`),W(t,"transform-origin",`${e[4]} ${e[4]}`),_(n,"class","floorplan__camera-position svelte-17cl35n"),W(n,"left",e[1]),W(n,"top",e[2])},m(i,r){Z(i,n,r),Q(n,t)},p(i,[r]){r&1&&W(t,"background-image",`url(${i[0]||ps})`);const s=r&1;s&&W(t,"width",i[4]),s&&W(t,"height",i[4]),s&&W(t,"left","-"+i[4]),s&&W(t,"top","-"+i[4]),s&&W(t,"transform",`rotate(${i[3]}deg)`),s&&W(t,"transform-origin",`${i[4]} ${i[4]}`)},i:de,o:de,d(i){i&&Y(n)}}}function IL(e,n,t){let{panoIndex:i}=n,{floorplanData:r}=n,{lastPanoramaLongitude:s}=n,{cameraImageUrl:o}=n;const{observers:a}=r,l=a[i],c=l.positionInImage.x,h=l.positionInImage.y,u=c*100+"%",d=h*100+"%",f=-Pg(s)+45,m=document.body.clientWidth,p=document.body.clientHeight,y=`${(m<500||p<500?17:37)/16}rem`;return e.$$set=b=>{"panoIndex"in b&&t(5,i=b.panoIndex),"floorplanData"in b&&t(6,r=b.floorplanData),"lastPanoramaLongitude"in b&&t(7,s=b.lastPanoramaLongitude),"cameraImageUrl"in b&&t(0,o=b.cameraImageUrl)},[o,u,d,f,y,i,r,s]}let TL=class extends ke{constructor(n){super(),Le(this,n,IL,SL,De,{panoIndex:5,floorplanData:6,lastPanoramaLongitude:7,cameraImageUrl:0},_L)}};const DL="data:image/png;base64,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";function LL(e){Ue(e,"svelte-rpkaro",".floorplan-plugin__compass.svelte-rpkaro{position:absolute;left:50%;top:-2.875rem;width:14.4375rem;height:2.5625rem;will-change:opacity;transform-origin:center 11.5rem}.floorplan-plugin__compass-image.svelte-rpkaro{width:100%;height:100%;position:absolute;left:0;top:0;opacity:0.1;background-repeat:no-repeat;background-size:100% 100%}.floorplan-plugin__compass-text.svelte-rpkaro{position:absolute;left:50%;top:0.9375rem;transform:translateX(-50%);opacity:0.2;font-weight:bold;font-size:0.625rem;color:#fff}")}function kL(e){let n,t,i,r,s;return{c(){n=H("div"),t=H("div"),i=ve(),r=H("span"),s=xt(e[0]),_(t,"class","floorplan-plugin__compass-image svelte-rpkaro"),W(t,"background-image",`url(${DL})`),_(r,"class","floorplan-plugin__compass-text svelte-rpkaro"),_(n,"class","floorplan-plugin__compass svelte-rpkaro"),W(n,"transform",e[2])},m(o,a){Z(o,n,a),Q(n,t),Q(n,i),Q(n,r),Q(r,s)},p(o,a){a&1&&Ct(s,o[0])},d(o){o&&Y(n)}}}function RL(e){let n,t=e[1]&&kL(e);return{c(){t&&t.c(),n=ft()},m(i,r){t&&t.m(i,r),Z(i,n,r)},p(i,[r]){i[1]&&t.p(i,r)},i:de,o:de,d(i){t&&t.d(i),i&&Y(n)}}}function OL(e,n,t){var c;let{floorplanData:i}=n,{northDesc:r}=n;const s=(c=i.entrance)==null?void 0:c.northRad,o=typeof s=="number",l=`translateX(-50%) translateZ(10px) rotate(${-(s?Pg(s):0)+90}deg)`;return e.$$set=h=>{"floorplanData"in h&&t(3,i=h.floorplanData),"northDesc"in h&&t(0,r=h.northDesc)},[r,o,l,i]}class zL extends ke{constructor(n){super(),Le(this,n,OL,RL,De,{floorplanData:3,northDesc:0},LL)}}function BL(e){Ue(e,"svelte-bl8zrz",".floorplan-plugin__floor.svelte-bl8zrz{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0;pointer-events:none}.floorplan-plugin__floor--is-current.svelte-bl8zrz{opacity:1;pointer-events:auto}")}function NL(e){let n,t,i,r,s,o,a,l,c,h;const u=[{floorIndex:e[2],floorplanData:e[11]}];let d={};for(let w=0;w<u.length;w+=1)d=kn(d,u[w]);n=new mL({props:d});let f=(e[3]||e[5])&&Ty(e);const m=[{floorplanData:e[11],floorIndex:e[2]}];let p={};for(let w=0;w<m.length;w+=1)p=kn(p,m[w]);r=new Cx({props:p});let g=e[6]&&Dy(e),y=e[10]&&Ly(e),b=e[4]&&ky(e),A=e[22]&&Ry(e);return{c(){Ie(n.$$.fragment),t=ve(),f&&f.c(),i=ve(),Ie(r.$$.fragment),s=ve(),g&&g.c(),o=ve(),y&&y.c(),a=ve(),b&&b.c(),l=ve(),A&&A.c(),c=ft()},m(w,x){_e(n,w,x),Z(w,t,x),f&&f.m(w,x),Z(w,i,x),_e(r,w,x),Z(w,s,x),g&&g.m(w,x),Z(w,o,x),y&&y.m(w,x),Z(w,a,x),b&&b.m(w,x),Z(w,l,x),A&&A.m(w,x),Z(w,c,x),h=!0},p(w,x){const M=x&2052?Vn(u,[{floorIndex:w[2],floorplanData:w[11]}]):{};n.$set(M),w[3]||w[5]?f?(f.p(w,x),x&40&&F(f,1)):(f=Ty(w),f.c(),F(f,1),f.m(i.parentNode,i)):f&&(Ve(),X(f,1,1,()=>{f=null}),Ge());const P=x&2052?Vn(m,[{floorplanData:w[11],floorIndex:w[2]}]):{};r.$set(P),w[6]?g?(g.p(w,x),x&64&&F(g,1)):(g=Dy(w),g.c(),F(g,1),g.m(o.parentNode,o)):g&&(Ve(),X(g,1,1,()=>{g=null}),Ge()),w[10]?y?(y.p(w,x),x&1024&&F(y,1)):(y=Ly(w),y.c(),F(y,1),y.m(a.parentNode,a)):y&&(Ve(),X(y,1,1,()=>{y=null}),Ge()),w[4]?b?(b.p(w,x),x&16&&F(b,1)):(b=ky(w),b.c(),F(b,1),b.m(l.parentNode,l)):b&&(Ve(),X(b,1,1,()=>{b=null}),Ge()),w[22]?A?(A.p(w,x),x&4194304&&F(A,1)):(A=Ry(w),A.c(),F(A,1),A.m(c.parentNode,c)):A&&(Ve(),X(A,1,1,()=>{A=null}),Ge())},i(w){h||(F(n.$$.fragment,w),F(f),F(r.$$.fragment,w),F(g),F(y),F(b),F(A),h=!0)},o(w){X(n.$$.fragment,w),X(f),X(r.$$.fragment,w),X(g),X(y),X(b),X(A),h=!1},d(w){Se(n,w),w&&Y(t),f&&f.d(w),w&&Y(i),Se(r,w),w&&Y(s),g&&g.d(w),w&&Y(o),y&&y.d(w),w&&Y(a),b&&b.d(w),w&&Y(l),A&&A.d(w),w&&Y(c)}}}function FL(e){let n,t;return n=new PL({props:{missingFloorConfig:e[18]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&262144&&(s.missingFloorConfig=i[18]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function Ty(e){let n,t;const i=[{floorIndex:e[2],floorplanData:e[11],hoveredRoom:e[24],highlightData:e[17]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new _x({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&16910340?Vn(i,[{floorIndex:s[2],floorplanData:s[11],hoveredRoom:s[24],highlightData:s[17]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function Dy(e){let n,t;const i=[{floorplanData:e[11],roomAreaEnable:e[7],roomNameEnable:e[8],roomDimensionEnable:e[9],floorIndex:e[2],getRoomAreaText:e[12],getRoomDimensionText:e[13],getLabelElement:e[14],hoveredRoom:e[24],adaptiveRoomLabelVisibleEnable:e[16]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new jD({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&16874372?Vn(i,[{floorplanData:s[11],roomAreaEnable:s[7],roomNameEnable:s[8],roomDimensionEnable:s[9],floorIndex:s[2],getRoomAreaText:s[12],getRoomDimensionText:s[13],getLabelElement:s[14],hoveredRoom:s[24],adaptiveRoomLabelVisibleEnable:s[16]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function Ly(e){let n,t;const i=[{floorplanData:e[11],floorIndex:e[2],getRuleDistanceText:e[15]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new JD({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&34820?Vn(i,[{floorplanData:s[11],floorIndex:s[2],getRuleDistanceText:s[15]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function ky(e){let n,t;const i=[{panoIndex:e[0],floorplanData:e[11],lastPanoramaLongitude:e[19],cameraImageUrl:e[20]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new TL({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&1574913?Vn(i,[{panoIndex:s[0],floorplanData:s[11],lastPanoramaLongitude:s[19],cameraImageUrl:s[20]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function Ry(e){let n,t;return n=new zL({props:{floorplanData:e[11],northDesc:e[21]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&2048&&(s.floorplanData=i[11]),r&2097152&&(s.northDesc=i[21]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function VL(e){let n,t,i,r,s;const o=[FL,NL],a=[];function l(c,h){return c[23]?1:0}return t=l(e),i=a[t]=o[t](e),{c(){n=H("div"),i.c(),_(n,"class",r=on(`floorplan-plugin__floor${e[1]?" floorplan-plugin__floor--is-current":""}`)+" svelte-bl8zrz")},m(c,h){Z(c,n,h),a[t].m(n,null),s=!0},p(c,[h]){let u=t;t=l(c),t===u?a[t].p(c,h):(Ve(),X(a[u],1,1,()=>{a[u]=null}),Ge(),i=a[t],i?i.p(c,h):(i=a[t]=o[t](c),i.c()),F(i,1),i.m(n,null)),(!s||h&2&&r!==(r=on(`floorplan-plugin__floor${c[1]?" floorplan-plugin__floor--is-current":""}`)+" svelte-bl8zrz"))&&_(n,"class",r)},i(c){s||(F(i),s=!0)},o(c){X(i),s=!1},d(c){c&&Y(n),a[t].d()}}}function GL(e,n,t){let i,r,{panoIndex:s}=n,{isCurrent:o}=n,{floorIndex:a}=n,{highlightEnable:l}=n,{cameraEnable:c}=n,{hoverEnable:h}=n,{roomLabelsEnable:u}=n,{roomAreaEnable:d}=n,{roomNameEnable:f}=n,{roomDimensionEnable:m}=n,{ruleLabelsEnable:p}=n,{floorplanData:g}=n,{getRoomAreaText:y}=n,{getRoomDimensionText:b}=n,{getLabelElement:A}=n,{getRuleDistanceText:w}=n,{adaptiveRoomLabelVisibleEnable:x}=n,{highlightData:M}=n,{missingFloorConfig:P}=n,{lastPanoramaLongitude:S}=n,{cameraImageUrl:T}=n,{northDesc:z}=n,{compassEnable:D}=n;const k=Cg(void 0);return e.$$set=O=>{"panoIndex"in O&&t(0,s=O.panoIndex),"isCurrent"in O&&t(1,o=O.isCurrent),"floorIndex"in O&&t(2,a=O.floorIndex),"highlightEnable"in O&&t(3,l=O.highlightEnable),"cameraEnable"in O&&t(4,c=O.cameraEnable),"hoverEnable"in O&&t(5,h=O.hoverEnable),"roomLabelsEnable"in O&&t(6,u=O.roomLabelsEnable),"roomAreaEnable"in O&&t(7,d=O.roomAreaEnable),"roomNameEnable"in O&&t(8,f=O.roomNameEnable),"roomDimensionEnable"in O&&t(9,m=O.roomDimensionEnable),"ruleLabelsEnable"in O&&t(10,p=O.ruleLabelsEnable),"floorplanData"in O&&t(11,g=O.floorplanData),"getRoomAreaText"in O&&t(12,y=O.getRoomAreaText),"getRoomDimensionText"in O&&t(13,b=O.getRoomDimensionText),"getLabelElement"in O&&t(14,A=O.getLabelElement),"getRuleDistanceText"in O&&t(15,w=O.getRuleDistanceText),"adaptiveRoomLabelVisibleEnable"in O&&t(16,x=O.adaptiveRoomLabelVisibleEnable),"highlightData"in O&&t(17,M=O.highlightData),"missingFloorConfig"in O&&t(18,P=O.missingFloorConfig),"lastPanoramaLongitude"in O&&t(19,S=O.lastPanoramaLongitude),"cameraImageUrl"in O&&t(20,T=O.cameraImageUrl),"northDesc"in O&&t(21,z=O.northDesc),"compassEnable"in O&&t(22,D=O.compassEnable)},e.$$.update=()=>{e.$$.dirty&2052&&t(25,i=g.floorDatas[a]),e.$$.dirty&33554432&&t(23,r=i.rooms.length>0)},[s,o,a,l,c,h,u,d,f,m,p,g,y,b,A,w,x,M,P,S,T,z,D,r,k,i]}let jL=class extends ke{constructor(n){super(),Le(this,n,GL,VL,De,{panoIndex:0,isCurrent:1,floorIndex:2,highlightEnable:3,cameraEnable:4,hoverEnable:5,roomLabelsEnable:6,roomAreaEnable:7,roomNameEnable:8,roomDimensionEnable:9,ruleLabelsEnable:10,floorplanData:11,getRoomAreaText:12,getRoomDimensionText:13,getLabelElement:14,getRuleDistanceText:15,adaptiveRoomLabelVisibleEnable:16,highlightData:17,missingFloorConfig:18,lastPanoramaLongitude:19,cameraImageUrl:20,northDesc:21,compassEnable:22},BL)}};function HL(e){Ue(e,"svelte-86bqav",".floorplan-main.svelte-86bqav{width:100%;height:100%;pointer-events:none}")}function Oy(e,n,t){const i=e.slice();return i[24]=n[t],i}function zy(e){let n,t,i,r=e[14].floorDatas,s=[];for(let a=0;a<r.length;a+=1)s[a]=By(Oy(e,r,a));const o=a=>X(s[a],1,1,()=>{s[a]=null});return{c(){n=H("div");for(let a=0;a<s.length;a+=1)s[a].c();_(n,"class","floorplan-main svelte-86bqav")},m(a,l){Z(a,n,l);for(let c=0;c<s.length;c+=1)s[c]&&s[c].m(n,null);i=!0},p(a,l){if(e=a,l&16777212){r=e[14].floorDatas;let c;for(c=0;c<r.length;c+=1){const h=Oy(e,r,c);s[c]?(s[c].p(h,l),F(s[c],1)):(s[c]=By(h),s[c].c(),F(s[c],1),s[c].m(n,null))}for(Ve(),c=r.length;c<s.length;c+=1)o(c);Ge()}},i(a){if(!i){for(let l=0;l<r.length;l+=1)F(s[l]);t||an(()=>{t=ys(n,_n,{duration:e[0],easing:Rr}),t.start()}),i=!0}},o(a){s=s.filter(Boolean);for(let l=0;l<s.length;l+=1)X(s[l]);i=!1},d(a){a&&Y(n),Oi(s,a)}}}function By(e){let n,t;const i=[{hoverEnable:e[6],highlightEnable:e[7],floorplanData:e[14],getRoomAreaText:e[17],getRoomDimensionText:e[18],getLabelElement:e[19],getRuleDistanceText:e[20],roomLabelsEnable:e[9],roomAreaEnable:e[10],roomNameEnable:e[11],roomDimensionEnable:e[12],ruleLabelsEnable:e[13],adaptiveRoomLabelVisibleEnable:e[21],highlightData:e[22],missingFloorConfig:e[23],panoIndex:e[3],cameraEnable:e[5],cameraImageUrl:e[16],lastPanoramaLongitude:e[15],compassEnable:e[8],northDesc:e[2]},{floorIndex:e[24].floorIndex},{isCurrent:e[24].floorIndex===e[4]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new jL({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&16777212?Vn(i,[o&16777196&&{hoverEnable:s[6],highlightEnable:s[7],floorplanData:s[14],getRoomAreaText:s[17],getRoomDimensionText:s[18],getLabelElement:s[19],getRuleDistanceText:s[20],roomLabelsEnable:s[9],roomAreaEnable:s[10],roomNameEnable:s[11],roomDimensionEnable:s[12],ruleLabelsEnable:s[13],adaptiveRoomLabelVisibleEnable:s[21],highlightData:s[22],missingFloorConfig:s[23],panoIndex:s[3],cameraEnable:s[5],cameraImageUrl:s[16],lastPanoramaLongitude:s[15],compassEnable:s[8],northDesc:s[2]},o&16384&&{floorIndex:s[24].floorIndex},o&16400&&{isCurrent:s[24].floorIndex===s[4]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function UL(e){let n,t,i=e[1]&&zy(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[1]?i?(i.p(r,s),s&2&&F(i,1)):(i=zy(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function WL(e,n,t){let{duration:i=0}=n,{visible:r}=n,{northDesc:s}=n,{panoIndex:o}=n,{floorIndex:a}=n,{cameraEnable:l}=n,{hoverEnable:c}=n,{highlightEnable:h}=n,{compassEnable:u}=n,{roomLabelsEnable:d}=n,{roomAreaEnable:f}=n,{roomNameEnable:m}=n,{roomDimensionEnable:p}=n,{ruleLabelsEnable:g}=n,{floorplanData:y}=n,{lastPanoramaLongitude:b}=n,{cameraImageUrl:A}=n,{getRoomAreaText:w}=n,{getRoomDimensionText:x}=n,{getLabelElement:M}=n,{getRuleDistanceText:P}=n,{adaptiveRoomLabelVisibleEnable:S}=n,{highlightData:T}=n,{missingFloorConfig:z}=n;return e.$$set=D=>{"duration"in D&&t(0,i=D.duration),"visible"in D&&t(1,r=D.visible),"northDesc"in D&&t(2,s=D.northDesc),"panoIndex"in D&&t(3,o=D.panoIndex),"floorIndex"in D&&t(4,a=D.floorIndex),"cameraEnable"in D&&t(5,l=D.cameraEnable),"hoverEnable"in D&&t(6,c=D.hoverEnable),"highlightEnable"in D&&t(7,h=D.highlightEnable),"compassEnable"in D&&t(8,u=D.compassEnable),"roomLabelsEnable"in D&&t(9,d=D.roomLabelsEnable),"roomAreaEnable"in D&&t(10,f=D.roomAreaEnable),"roomNameEnable"in D&&t(11,m=D.roomNameEnable),"roomDimensionEnable"in D&&t(12,p=D.roomDimensionEnable),"ruleLabelsEnable"in D&&t(13,g=D.ruleLabelsEnable),"floorplanData"in D&&t(14,y=D.floorplanData),"lastPanoramaLongitude"in D&&t(15,b=D.lastPanoramaLongitude),"cameraImageUrl"in D&&t(16,A=D.cameraImageUrl),"getRoomAreaText"in D&&t(17,w=D.getRoomAreaText),"getRoomDimensionText"in D&&t(18,x=D.getRoomDimensionText),"getLabelElement"in D&&t(19,M=D.getLabelElement),"getRuleDistanceText"in D&&t(20,P=D.getRuleDistanceText),"adaptiveRoomLabelVisibleEnable"in D&&t(21,S=D.adaptiveRoomLabelVisibleEnable),"highlightData"in D&&t(22,T=D.highlightData),"missingFloorConfig"in D&&t(23,z=D.missingFloorConfig)},[i,r,s,o,a,l,c,h,u,d,f,m,p,g,y,b,A,w,x,M,P,S,T,z]}let _g=class extends ke{constructor(n){super(),Le(this,n,WL,UL,De,{duration:0,visible:1,northDesc:2,panoIndex:3,floorIndex:4,cameraEnable:5,hoverEnable:6,highlightEnable:7,compassEnable:8,roomLabelsEnable:9,roomAreaEnable:10,roomNameEnable:11,roomDimensionEnable:12,ruleLabelsEnable:13,floorplanData:14,lastPanoramaLongitude:15,cameraImageUrl:16,getRoomAreaText:17,getRoomDimensionText:18,getLabelElement:19,getRuleDistanceText:20,adaptiveRoomLabelVisibleEnable:21,highlightData:22,missingFloorConfig:23},HL)}};const QL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC";function YL(e){return ee(this,null,function*(){const n=new Headers({"Content-Type":"text/plain"}),t=function(r){return ee(this,null,function*(){const s={index:r.index,url:r.url,svgUrl:r.svg_url};if(r.svg_url){const o=yield fetch(r.svg_url,{headers:n}).then(a=>a.text());s.svgContent=o}return s})};return yield Promise.all(e.map(t))})}function XL(e){const n={id:e.id,size:e.size,name:e.name,path:e.path,roomType:e.room_type,floorType:e.floor_type,roomLabel:{position:e.room_label.position,positionInImage:e.room_label.position_in_image},observerIndexs:e.observer_indexs};return e.dimension&&Object.assign(n,{dimension:e.dimension}),n}function ZL(e){return{floorName:e.floor_name,floorIndex:e.floor_index,rooms:e.rooms.map(XL),rules:e.rules}}function JL(e){return{index:e.index,floorIndex:e.floor_index,position:e.position,positionInImage:e.position_in_image}}function qL(e){return{rad:e.rad,position:e.position,positionInImage:e.position_in_image,northRad:e.north_rad,roomId:e.room_id,floorIndex:e.floor_index}}function ms(e){return ee(this,null,function*(){const n=yield YL(e.outlines),t=e.computed_data.bounding,i=e.computed_data.floor_datas.map(ZL),r=e.computed_data.entrance?qL(e.computed_data.entrance):null;return{outlines:n,entrance:r,bounding:t,floorDatas:i,observers:e.computed_data.observers.map(JL)}})}function KL(e,n,t){return e.map(r=>{const s=r.position,o=r.icon?r.icon:{url:QL,width:45,height:48},a=$D(s,n),l=qD(s,t),c=KD(l,t);return{floorIndex:a,icon:o,id:r.id,position:l,positionInImage:c}})}function $L(e,n){return n(e),e}function La(e,n){return $L({},t=>{for(const i in e)n.indexOf(i)===-1&&(t[i]=e[i])})}function Ny(e,n){const t=Math.max(...e.work.observers.map(i=>i.floorIndex));return n>t?e.model.bounding.max.y:Math.max(...e.work.observers.filter(i=>i.floorIndex===n).map(i=>i.standingPosition.y))}function Sg(e,n,t=ss.BOUNDING_CENTER){const i=Ny(e,n),r=Ny(e,n+1);return t===ss.BOUNDING_CENTER?(e.model.bounding.max.y+e.model.bounding.min.y)/2:t===ss.CEILING?r:i}function Ig(e,n,t,i){const r=Sg(e,t,i==null?void 0:i.attachedTo),s=new C.Vector3(0,r,0),o=new C.Vector3(1,r,0),a=s.clone().project(e.camera),l=o.clone().project(e.camera);return Math.abs((l.x-a.x)/1e3)*(n.getBoundingClientRect().width/2)}let ws=class{constructor(n,t){v(this,"VERSION","3.49.6");v(this,"NAME");v(this,"five");v(this,"workUtil");v(this,"fiveUtil");v(this,"hooks",new Cn);v(this,"staticPrefix","//vr-image-4.realsee-cdn.cn");this.updateFive(n),t!=null&&t.staticPrefix&&(this.staticPrefix=t.staticPrefix)}set workCode(n){this.workUtil.workCode=n,this.onWorkCodeChange()}get workCode(){return this.workUtil.workCode}updateFive(n){this.five=n,this.fiveUtil=new Sd(n),this.workUtil=this.fiveUtil.workUtil}getCurrentState(){return this.state}absoluteUrl(n){return dg(this.staticPrefix,n)}onWorkCodeChange(){}},Br=class extends ws{};var Zn=(e=>(e.UnknownError="UnknownError",e.DataNotLoaded="DataNotLoaded",e.UpdateSizeError="UpdateSizeError",e.BreakOffByHide="BreakOffByHide",e.BreakOffByDisable="BreakOffByDisable",e.ModelNotLoaded="ModelNotLoaded",e.ChangeModeError="ChangeModeError",e.UpdateCameraError="UpdateCameraError",e))(Zn||{});const Sx=500,ek=80;function Hs(e,n,t=4){return Math.abs(e-n)<Math.pow(10,-t)}function Ix(e,n,t=4){const i=Math.PI*2,r=e%i,s=n%i,o=Math.min(r,s),a=Math.max(r,s);return Hs(o,a,t)||Hs(o+i,a,t)}Object.assign(window,{nearlyEqual:Hs,nearlyEqualRad:Ix});function tk(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fy(e){return tk(e)&&!!e.isVector3}function Tg(e,n){return ee(this,null,function*(){const[t]=yield $s(e.changeMode(...n));if(t)throw new Error("change mode canceled");yield new Promise(o=>{e.once("initAnimationWillStart",()=>{e.once("initAnimationEnded",()=>o())})});const i=n[1];if(!i)return!0;const r=e.getCurrentState();if(!nk(i,r))throw new Error("pose 与预期不符")})}function nk(e,n){return Object.keys(e).every(t=>{const i=n[t],r=e[t];return i===void 0||r===void 0?!0:t==="longitude"||t==="latitude"?Ix(i,r,2):typeof i=="number"&&typeof r=="number"?Hs(i,r,2):Fy(r)&&Fy(i)?r.distanceTo(i)<.01:i===r})}function ik(e,n){if(e.currentMode!==n.mode)return!1;const{latitude:t,longitude:i,fov:r,offset:s}=n,{latitude:o,longitude:a,offset:l}=e.getCurrentState(),c=e.camera.fov;return!(!Hs(t,o,2)||!Hs(i,a,2)||s!==void 0&&s.distanceTo(l)>.01||!Hs(r,c,2))}function Tx(e,n,t=!0){return ee(this,null,function*(){if(ik(e,n)===!0)return;const r=e.getCurrentState();if(r.mode!==n.mode){const[h]=yield $s(Tg(e,[n.mode,n,void 0,t]));if(h)throw h;return}const{latitude:s,longitude:o,fov:a}=r,l=Math.min(1e3,Math.max(200,Math.abs(s-Math.PI/2)*1e3,(o>Math.PI?2*Math.PI-o:o)*500,typeof n.fov=="number"?Math.abs(a-n.fov)*10:1/0)),[c]=yield $s(e.updateCamera(La(n,["mode"]),l,t));if(c)throw new Error(Zn.UpdateCameraError)})}function ka(e,n,t=300){const i=e.getElement();i&&(i.style.opacity=n+"",i.style.transition=t===0?"none":`opacity ${t}ms linear`,t!==0&&Promise.race([new Promise(r=>i.addEventListener("transitionend",r,{once:!0})),new Promise(r=>setTimeout(r,t))]).then(()=>{i.style.transition="none"}))}function rk(e){const{latitude:n,longitude:t}=e,i=Math.abs(n-Math.PI/2)>5*Math.PI/180,r=t>5*(Math.PI/180)&&t<355*(Math.PI/180);return i||r}function sk(e){const{latitude:n,longitude:t}=e,i=Math.abs(n-Math.PI/2)<10*Math.PI/180,r=t<30*(Math.PI/180)||t>330*(Math.PI/180);return i&&r}let ok=class extends Br{constructor(t,i){var l,c,h;super(t);v(this,"name","modelFloorplanPlugin");v(this,"state");v(this,"data");v(this,"showState");v(this,"showPromise");v(this,"app");v(this,"panoIndex",0);v(this,"floorIndex",0);v(this,"selector");v(this,"showRejection");v(this,"wrapper");v(this,"container",document.createElement("div"));v(this,"lastPanoramaLongitude",0);v(this,"size",{width:0,height:0});v(this,"defaultMissingFloorConfig");v(this,"hasAddedEventListener",!1);v(this,"isHiddenByHideFunc",!1);v(this,"highlightData",{});v(this,"dispose",()=>{var t,i;this.removeEventListener(),(t=this.app)==null||t.$destroy(),this.app=void 0,(i=this.container)==null||i.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});v(this,"show",(...i)=>ee(this,[...i],function*(t={}){if(!this.state.enabled||!this.showPromise&&this.state.visible)return;const r=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!0},r),this._show(t)}));v(this,"hide",(...i)=>ee(this,[...i],function*(t={}){this.state.enabled&&(this.isHiddenByHideFunc=!0,this.state.visible!==!1&&(this.updateState({visible:!1},t.userAction||!0),this._hide(t)))}));v(this,"updateSize",()=>{if(!this.data||!this.container||!this.wrapper)return!1;const{min:t,max:i}=this.data.bounding,r=i.x-t.x,s=i.y-t.y,o=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=Ig(this.five,this.wrapper,this.floorIndex,o),l=Math.ceil(r*a),c=Math.ceil(s*a);return this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c}),!0});v(this,"highlight",t=>{this.state.config.highlightEnable&&(this.highlightData=t,this.render())});v(this,"unhighlight",()=>{this.highlightData={},this.render()});v(this,"_disable",t=>{var r,s,o;const{userAction:i}=t;this.hooks.emit("disable",{userAction:i}),(r=this.showRejection)==null||r.call(this,Zn.BreakOffByDisable),this.showPromise=void 0,(s=this.app)==null||s.$destroy(),this.app=void 0,(o=this.container)==null||o.remove(),this.removeEventListener()});v(this,"_enable",t=>{const{userAction:i}=t;this.addEventListener(),this.wrapper&&(this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:i}),this.state.visible&&this._show({userAction:i}))});v(this,"_show",t=>ee(this,null,function*(){var o;if(!this.state.enabled)return;if(!((o=this.five.model)!=null&&o.loaded))throw new Error(Zn.ModelNotLoaded);if(!this.data)throw new Error(Zn.DataNotLoaded);if(this.showPromise)return this.showPromise;const i={floorIndex:this.floorIndex,modelOpacity:this.state.config.modelOpacity,immediately:!1,isAutoShow:!1,userAction:!0},r=R(R({},i),t),s=()=>ee(this,null,function*(){this.hooks.emit("show",{userAction:r.userAction,auto:r.isAutoShow});let a=!1,l;this.showRejection=u=>{a=!0,l=u};const[c]=yield $s(Tx(this.five,this.showState,r.userAction));if(c)throw c;if(a)throw l?new Error(l):new Error(Zn.UnknownError);if(!this.updateSize())throw new Error(Zn.UpdateSizeError);this.floorIndex=r.floorIndex,this.five.model.show(this.floorIndex)});return this.isHiddenByHideFunc=!1,this.showPromise=s().then(()=>{this.showPromise=void 0,this.showRejection=void 0;const a=r.modelOpacity,l=r.immediately?0:Sx;ka(this.five,a,l),this.render(l),this.hooks.emit("showAnimationEnded",{auto:r.isAutoShow,userAction:r.userAction})}).catch(a=>{if(this.showPromise=void 0,this.showRejection=void 0,this.updateState({visible:!1},r.userAction),!r.isAutoShow&&a instanceof Error)throw a}),this.showPromise}));v(this,"_hide",t=>{var s;(s=this.showRejection)==null||s.call(this,Zn.BreakOffByHide),this.showPromise=void 0;const r=R(R({},{userAction:!0,isAutoHide:!1}),t);ka(this.five,1,0),this.hooks.emit("hide",{auto:r.isAutoHide,userAction:r.userAction}),this.render()});v(this,"handleClick",()=>{if(!this.state.visible)return;if(this.hooks.emit("click"))return!1});v(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const t=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!t)throw new Error("不正确的父容器选择器");this.wrapper=t,t.append(this.container)});v(this,"onFiveModeChange",t=>{t!==this.showState.mode&&(this.updateState({visible:!1},!1),this._hide({userAction:!1}))});v(this,"onFiveInteriaPan",(t,i)=>{if(!i||this.state.config.autoShowEnable===!1||this.isHiddenByHideFunc)return;const r=this.five.getCurrentState();r.mode==="Floorplan"&&(this.state.visible||sk(r)&&(this.updateState({visible:!0},!0),this._show({isAutoShow:!0})))});v(this,"onFivePanoArrived",t=>{var i;(i=this.five)!=null&&i.work&&(this.panoIndex=t,this.floorIndex=this.workUtil.observers[t].floorIndex)});v(this,"onFiveCameraUpdate",(t,i)=>{if(!this.state.visible||this.showPromise)return;const r=this.five.getCurrentState();rk(r)&&(this.updateState({visible:!1},i),this._hide({userAction:i,isAutoHide:!0}))});v(this,"onFiveWantsGesture",(t,i)=>{if(this.state.visible&&(i.length>1||t==="mouseWheel"))return!1});v(this,"onFiveWantsPanGesture",(t,i)=>{if(this.five.getCurrentState().mode==="Floorplan"&&this.state.config.autoShowEnable!==!1&&i&&this.state.visible)return this.five.updateCamera(this.showState,0),!1});v(this,"onFiveWantsTapGesture",()=>this.handleClick());v(this,"onFiveWantsChangeMode",(t,i)=>{i==="Panorama"&&t==="Floorplan"&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude)});v(this,"onModelShownFloorChange",t=>{if(this.floorIndex!==t){if(t===null){const i=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[i].floorIndex;return}this.floorIndex=t,this.updateSize(),this.render()}});i!=null&&i.selector&&(this.selector=i.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.showState={mode:"Floorplan",longitude:0,latitude:Math.PI/2,fov:ek/((l=i==null?void 0:i.scale)!=null?l:1)},this.defaultMissingFloorConfig={imageURL:this.staticPrefix+"/release/web/saas/missing-floorplan.e274c596.png",imageWidth:200,imageHeight:120,text:(h=(c=i.i18n)==null?void 0:c.call(i,"暂无平面图"))!=null?h:"暂无平面图",textFontSize:14};const r={northDesc:"北",modelOpacity:1,cameraEnable:!0,highlightEnable:!1,hoverEnable:!0,compassEnable:!0,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,roomDimensionEnable:!0,adaptiveRoomLabelVisibleEnable:!0,cameraImageUrl:ps,attachedTo:ss.BOUNDING_CENTER,getLabelElement:void 0,missingFloorConfig:R(R({},this.defaultMissingFloorConfig),i.missingFloorConfig),i18n:u=>u,getRoomAreaText:u=>(u/1e6).toFixed(1)+"㎡",getRoomDimensionText:(u,d)=>(u/1e3).toFixed(1)+"m × "+(d/1e3).toFixed(1)+"m",getRuleDistanceText:u=>u.toString()},s=i?La(i,["selector","scale"]):{},o=R(R({},r.missingFloorConfig),s.missingFloorConfig),a=Ee(R(R({},r),s),{missingFloorConfig:o});this.state={enabled:!0,visible:!1,config:a},this.initContainer(),t.once("dispose",this.dispose),this.addEventListener()}load(t,i,r=!0){return ee(this,null,function*(){function s(h){return Object.prototype.hasOwnProperty.apply(h,["version"])}const o=t;o&&kr(o.version)&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(t)),l=s(a)?a.data:a,c=this.data;this.data=yield ms(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),i&&this.updateState(i,r),this.render()})}appendTo(t){if(this.wrapper=t,!!this.state.enabled)return t.appendChild(this.container),this.render(),this}enable(t={}){if(this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!0},t.userAction||i),this._enable({userAction:i})}disable(t={}){if(!this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!1},t.userAction||i),this._disable({userAction:i})}setState(t,i={}){const r=this.state,s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s};t.visible?this._show(o):this._hide(o)}this.render()}changeConfigs(t,i=!0){this.updateState({config:t},i),this.render()}formatData(t){return ee(this,null,function*(){return yield ms(t.data)})}updateState(t,i){var a;const r=this.state,s=(a=t.config)!=null&&a.missingFloorConfig?R(R({},r.config.missingFloorConfig),t.config.missingFloorConfig):r.config.missingFloorConfig,o=t.config?Ee(R(R({},r.config),t.config),{missingFloorConfig:s}):r.config;this.state=Ee(R(R({},this.state),t),{config:o}),!Nn(this.state,r,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:10,pointerEvents:"none"}),this.five.addExtraElement(this.container)}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const t=this.five;t.model.loaded?this.onFiveModelLoaded():t.once("modelLoaded",this.onFiveModelLoaded),t.on("modeChange",this.onFiveModeChange),t.on("interiaPan",this.onFiveInteriaPan),t.on("panoArrived",this.onFivePanoArrived),t.on("cameraUpdate",this.onFiveCameraUpdate),t.on("wantsGesture",this.onFiveWantsGesture),t.on("wantsPanGesture",this.onFiveWantsPanGesture),t.on("wantsTapGesture",this.onFiveWantsTapGesture),t.on("wantsChangeMode",this.onFiveWantsChangeMode),t.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const t=this.five;this.hasAddedEventListener=!1,t.off("modelLoaded",this.onFiveModelLoaded),t.off("modeChange",this.onFiveModeChange),t.off("interiaPan",this.onFiveInteriaPan),t.off("panoArrived",this.onFivePanoArrived),t.off("cameraUpdate",this.onFiveCameraUpdate),t.off("wantsGesture",this.onFiveWantsGesture),t.off("wantsPanGesture",this.onFiveWantsPanGesture),t.off("wantsTapGesture",this.onFiveWantsTapGesture),t.off("wantsChangeMode",this.onFiveWantsChangeMode),t.off("modelShownFloorChange",this.onModelShownFloorChange)}render(t){if(!this.state.enabled||!this.container||!this.data||this.size.width===0||this.showPromise)return;const i=Ee(R({},this.state.config),{visible:this.state.visible,duration:t!=null?t:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(i);this.app=new _g({target:this.container,intro:!0,props:i})}};const ak=(e,n)=>new ok(e,n);function lk(e){const{latitude:n,longitude:t}=e,i=Math.abs(n-Math.PI/2)>5*Math.PI/180,r=t>5*(Math.PI/180)&&t<355*(Math.PI/180);return i||r}function ck(e){const{latitude:n,longitude:t}=e,i=Math.abs(n-Math.PI/2)<10*Math.PI/180,r=t<30*(Math.PI/180)||t>330*(Math.PI/180);return i&&r}let hk=class extends Br{constructor(t,i){var l,c;super(t);v(this,"name","modelFloorplanPlugin");v(this,"state");v(this,"data");v(this,"showState");v(this,"showPromise");v(this,"app");v(this,"panoIndex",0);v(this,"floorIndex",0);v(this,"selector");v(this,"showRejection");v(this,"wrapper");v(this,"container",document.createElement("div"));v(this,"lastPanoramaLongitude",0);v(this,"size",{width:0,height:0});v(this,"defaultMissingFloorConfig");v(this,"hasAddedEventListener",!1);v(this,"isHiddenByHideFunc",!1);v(this,"highlightData",{});v(this,"dispose",()=>{var t,i;this.removeEventListener(),(t=this.app)==null||t.$destroy(),this.app=void 0,(i=this.container)==null||i.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});v(this,"show",(...i)=>ee(this,[...i],function*(t={}){if(!this.state.enabled||!this.showPromise&&this.state.visible)return;const r=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!0},r),this._show(t)}));v(this,"hide",(...i)=>ee(this,[...i],function*(t={}){this.state.enabled&&(this.isHiddenByHideFunc=!0,this.state.visible!==!1&&(this.updateState({visible:!1},t.userAction||!0),this._hide(t)))}));v(this,"updateSize",()=>{if(!this.data||!this.container||!this.wrapper)return!1;const{min:t,max:i}=this.data.bounding,r=i.x-t.x,s=i.y-t.y,o=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=Ig(this.five,this.wrapper,this.floorIndex,o),l=Math.ceil(r*a),c=Math.ceil(s*a);return this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c}),!0});v(this,"highlight",t=>{this.state.config.highlightEnable&&(this.highlightData=t,this.render())});v(this,"unhighlight",()=>{this.highlightData={},this.render()});v(this,"_disable",t=>{var r,s,o;const{userAction:i}=t;this.hooks.emit("disable",{userAction:i}),(r=this.showRejection)==null||r.call(this,Zn.BreakOffByDisable),this.showPromise=void 0,(s=this.app)==null||s.$destroy(),this.app=void 0,(o=this.container)==null||o.remove(),this.removeEventListener()});v(this,"_enable",t=>{const{userAction:i}=t;this.addEventListener(),this.wrapper&&(this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:i}),this.state.visible&&this._show({userAction:i}))});v(this,"_show",t=>ee(this,null,function*(){var o;if(!this.state.enabled)return;if(!((o=this.fiveUtil.model)!=null&&o.loaded))throw new Error(Zn.ModelNotLoaded);if(!this.data)throw new Error(Zn.DataNotLoaded);if(this.showPromise)return this.showPromise;const i={floorIndex:this.floorIndex,modelOpacity:this.state.config.modelOpacity,immediately:!1,isAutoShow:!1,userAction:!0},r=R(R({},i),t),s=()=>ee(this,null,function*(){this.hooks.emit("show",{userAction:r.userAction,auto:r.isAutoShow});let a=!1,l;this.showRejection=u=>{a=!0,l=u};const[c]=yield $s(Tx(this.five,this.showState,r.userAction));if(c)throw c;if(a)throw l?new Error(l):new Error(Zn.UnknownError);if(!this.updateSize())throw new Error(Zn.UpdateSizeError);this.updatePosition(),this.floorIndex=r.floorIndex,this.fiveUtil.model.show(this.floorIndex)});return this.isHiddenByHideFunc=!1,this.showPromise=s().then(()=>{this.showPromise=void 0,this.showRejection=void 0;const a=r.modelOpacity,l=r.immediately?0:Sx;ka(this.five,a,l),this.render(l),this.hooks.emit("showAnimationEnded",{auto:r.isAutoShow,userAction:r.userAction})}).catch(a=>{if(this.showPromise=void 0,this.showRejection=void 0,this.updateState({visible:!1},r.userAction),!r.isAutoShow&&a instanceof Error)throw a}),this.showPromise}));v(this,"_hide",t=>{var s;(s=this.showRejection)==null||s.call(this,Zn.BreakOffByHide),this.showPromise=void 0;const r=R(R({},{userAction:!0,isAutoHide:!1}),t);ka(this.five,1,0),this.hooks.emit("hide",{auto:r.isAutoHide,userAction:r.userAction}),this.render()});v(this,"handleClick",()=>{if(!this.state.visible)return;if(this.hooks.emit("click"))return!1});v(this,"onFiveModelLoaded",()=>{const i=this.five.model.bounding.getCenter(new C.Vector3);if(this.showState.offset=i,this.state.enabled===!1||this.wrapper||!this.selector)return;const r=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!r)throw new Error("不正确的父容器选择器");this.wrapper=r,r.append(this.container)});v(this,"onFiveModeChange",t=>{t!==this.showState.mode&&(this.updateState({visible:!1},!1),this._hide({userAction:!1}))});v(this,"onFiveInteriaPan",(t,i)=>{if(!i||this.state.visible||this.state.config.autoShowEnable===!1||this.isHiddenByHideFunc)return;const r=this.five.getCurrentState();r.mode===this.showState.mode&&ck(r)&&(this.updateState({visible:!0},!0),this._show({isAutoShow:!0}))});v(this,"onFivePanoArrived",t=>{var i;(i=this.five)!=null&&i.work&&(this.panoIndex=t,this.floorIndex=this.workUtil.observers[t].floorIndex)});v(this,"onFiveCameraUpdate",(t,i)=>{if(!this.state.visible||this.showPromise)return;const r=this.five.getCurrentState();this.updatePosition(),this.updateSize(),lk(r)&&(this.updateState({visible:!1},i),this._hide({userAction:i}))});v(this,"onFiveWantsPanGesture",(t,i)=>{if(this.five.getCurrentState().mode===this.showState.mode&&this.state.config.autoShowEnable!==!1&&i&&this.state.visible)return this.five.updateCamera(La(this.showState,["offset"]),0),!1});v(this,"onFiveWantsTapGesture",()=>this.handleClick());v(this,"onFiveWantsChangeMode",(t,i)=>{i==="Panorama"&&t===this.showState.mode&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude)});v(this,"onModelShownFloorChange",t=>{var i;if(this.floorIndex!==t){if(t===null){const r=this.five.getCurrentState().panoIndex;this.floorIndex=(i=this.five.work)==null?void 0:i.observers[r].floorIndex;return}this.floorIndex=t,this.updateSize(),this.render()}});i!=null&&i.selector&&(this.selector=i.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.showState={mode:"Mapview",longitude:0,latitude:Math.PI/2},this.defaultMissingFloorConfig={imageURL:this.staticPrefix+"/release/web/saas/missing-floorplan.e274c596.png",imageWidth:200,imageHeight:120,text:(c=(l=i.i18n)==null?void 0:l.call(i,"暂无平面图"))!=null?c:"暂无平面图",textFontSize:14};const r={northDesc:"北",modelOpacity:1,cameraEnable:!0,highlightEnable:!1,hoverEnable:!0,compassEnable:!0,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,roomDimensionEnable:!0,cameraImageUrl:ps,attachedTo:ss.BOUNDING_CENTER,getLabelElement:void 0,adaptiveRoomLabelVisibleEnable:!0,missingFloorConfig:R(R({},this.defaultMissingFloorConfig),i.missingFloorConfig),i18n:h=>h,getRoomAreaText:h=>(h/1e6).toFixed(1)+"㎡",getRoomDimensionText:(h,u)=>(h/1e3).toFixed(1)+"m × "+(u/1e3).toFixed(1)+"m",getRuleDistanceText:h=>h.toString()},s=i?La(i,["selector","scale"]):{},o=R(R({},r.missingFloorConfig),s.missingFloorConfig),a=Ee(R(R({},r),s),{missingFloorConfig:o});this.state={enabled:!0,visible:!1,config:a},this.initContainer(),Ha(t).then(this.onFiveModelLoaded),t.once("dispose",this.dispose),this.addEventListener()}load(t,i,r=!0){return ee(this,null,function*(){function s(h){return Object.prototype.hasOwnProperty.apply(h,["version"])}const o=t;o&&kr(o.version)&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(t)),l=s(a)?a.data:a,c=this.data;this.data=yield ms(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),i&&this.updateState(i,r),this.render()})}appendTo(t){if(this.wrapper=t,!!this.state.enabled)return t.appendChild(this.container),this.render(),this}enable(t={}){if(this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!0},t.userAction||i),this._enable({userAction:i})}disable(t={}){if(!this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!1},t.userAction||i),this._disable({userAction:i})}setState(t,i={}){const r=this.state,s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s};t.visible?this._show(o):this._hide(o)}}changeConfigs(t,i=!0){this.updateState({config:t},i),this.render()}updatePosition(){var a;const t=Sg(this.five,this.floorIndex,this.state.config.attachedTo),i=(a=this.fiveUtil.model)==null?void 0:a.bounding.getCenter(new C.Vector3).setY(t);if(!i)return;const r=i.clone().project(this.five.camera),s=(r.x+1)/2,o=-(r.y-1)/2;this.container.style.left=s*100+"%",this.container.style.top=o*100+"%"}formatData(t){return ee(this,null,function*(){return yield ms(t.data)})}updateState(t,i){var a;const r=this.state,s=(a=t.config)!=null&&a.missingFloorConfig?R(R({},r.config.missingFloorConfig),t.config.missingFloorConfig):r.config.missingFloorConfig,o=t.config?Ee(R(R({},r.config),t.config),{missingFloorConfig:s}):r.config;this.state=Ee(R(R({},this.state),t),{config:o}),!Nn(this.state,r,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:10,pointerEvents:"none"}),this.five.addExtraElement(this.container)}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const t=this.five;t.on("modeChange",this.onFiveModeChange),t.on("interiaPan",this.onFiveInteriaPan),t.on("panoArrived",this.onFivePanoArrived),t.on("cameraUpdate",this.onFiveCameraUpdate),t.on("wantsPanGesture",this.onFiveWantsPanGesture),t.on("wantsTapGesture",this.onFiveWantsTapGesture),t.on("wantsChangeMode",this.onFiveWantsChangeMode),t.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const t=this.five;this.hasAddedEventListener=!1,t.off("modelLoaded",this.onFiveModelLoaded),t.off("modeChange",this.onFiveModeChange),t.off("panoArrived",this.onFivePanoArrived),t.off("cameraUpdate",this.onFiveCameraUpdate),t.off("wantsPanGesture",this.onFiveWantsPanGesture),t.off("wantsTapGesture",this.onFiveWantsTapGesture),t.off("wantsChangeMode",this.onFiveWantsChangeMode),t.off("modelShownFloorChange",this.onModelShownFloorChange)}render(t){if(!this.state.enabled||!this.container||!this.data||this.size.width===0||this.showPromise)return;const i=Ee(R({},this.state.config),{visible:this.state.visible,duration:t!=null?t:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(i);this.app=new _g({target:this.container,intro:!0,props:i})}};const uk=(e,n)=>new hk(e,n);let dk=class extends Br{constructor(t,i){var l,c;super(t);v(this,"name","topviewFloorplanPlugin");v(this,"state");v(this,"data");v(this,"app");v(this,"selector");v(this,"panoIndex",0);v(this,"floorIndex",0);v(this,"wrapper");v(this,"container",document.createElement("div"));v(this,"lastPanoramaLongitude",0);v(this,"size",{width:0,height:0});v(this,"defaultMissingFloorConfig");v(this,"hasAddedEventListener",!1);v(this,"isHiddenByHideFunc",!1);v(this,"highlightData",{});v(this,"updateSize",()=>{if(!this.data||!this.container||!this.wrapper||this.five.getCurrentState().mode!=="Topview")return!1;const{min:t,max:i}=this.data.bounding,r=i.x-t.x,s=i.y-t.y,o=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=Ig(this.five,this.wrapper,this.floorIndex,o),l=Math.ceil(r*a),c=Math.ceil(s*a);return this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c}),!0});v(this,"dispose",()=>{var t,i;this.removeEventListener(),(t=this.app)==null||t.$destroy(),this.app=void 0,(i=this.container)==null||i.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});v(this,"highlight",t=>{this.state.config.highlightEnable&&(this.highlightData=t,this.render())});v(this,"unhighlight",()=>{this.highlightData={},this.render()});v(this,"_disable",t=>{var r,s;const{userAction:i}=t;(r=this.app)==null||r.$destroy(),this.app=void 0,(s=this.container)==null||s.remove(),this.removeEventListener(),this.hooks.emit("disable",{userAction:i})});v(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const t=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!t)throw new Error("不正确的父容器选择器");this.wrapper=t,t.append(this.container)});v(this,"onFiveModeChange",(...[t,,,,i])=>{t!=="Topview"&&this.state.visible&&(this.updateState({visible:!1},i),this._hide({userAction:i}))});v(this,"onFivePanoArrived",t=>{var i;(i=this.five)!=null&&i.work&&(this.panoIndex=t,this.floorIndex=this.five.work.observers[t].floorIndex)});v(this,"onFiveCameraUpdate",(t,i)=>{this.state.visible&&(this.updatePosition(),this.updateSize())});v(this,"onFiveWantsGesture",t=>{if(!(t!=="pan"&&t!=="pinch"&&t!=="mouseWheel")&&this.state.visible&&!this.state.config.gestureEnable)return!1});v(this,"onFiveWantsMoveToPano",()=>{if(this.state.visible&&this.state.config.preventRoomClick)return!1});v(this,"onFiveInitAnimationEnded",(...[,,t])=>{const{mode:i}=this.five.getCurrentState();i==="Topview"&&!this.isHiddenByHideFunc&&!this.state.visible&&this.state.config.autoShowEnable&&(this.updateState({visible:!0},t),this._show({userAction:t}))});v(this,"onModelShownFloorChange",t=>{if(this.floorIndex!==t){if(t===null){const i=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[i].floorIndex;return}this.floorIndex=t,this.updateSize(),this.render()}});i!=null&&i.selector&&(this.selector=i.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.defaultMissingFloorConfig={imageURL:this.staticPrefix+"/release/web/saas/missing-floorplan.e274c596.png",imageWidth:200,imageHeight:120,text:(c=(l=i.i18n)==null?void 0:l.call(i,"暂无平面图"))!=null?c:"暂无平面图",textFontSize:14};const r={northDesc:"北",modelOpacity:1,cameraEnable:!0,hoverEnable:!0,highlightEnable:!1,compassEnable:!0,gestureEnable:!1,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,roomDimensionEnable:!0,cameraImageUrl:ps,attachedTo:ss.BOUNDING_CENTER,getLabelElement:void 0,missingFloorConfig:R(R({},this.defaultMissingFloorConfig),i.missingFloorConfig),i18n:h=>h,adaptiveRoomLabelVisibleEnable:!0,getRoomAreaText:h=>(h/1e6).toFixed(1)+"㎡",getRoomDimensionText:(h,u)=>(h/1e3).toFixed(1)+"m × "+(u/1e3).toFixed(1)+"m",getRuleDistanceText:h=>h.toString()},s=i?La(i,["selector","scale"]):{},o=R(R({},r.missingFloorConfig),s.missingFloorConfig),a=Ee(R(R({},r),s),{missingFloorConfig:o});this.state={enabled:!0,visible:!1,config:a},this.initContainer(),t.model.loaded?this.onFiveModelLoaded():t.once("modelLoaded",this.onFiveModelLoaded),t.once("dispose",this.dispose),this.addEventListener()}load(t,i,r=!0){return ee(this,null,function*(){function s(h){return Object.prototype.hasOwnProperty.apply(h,["version"])}const o=t;o&&kr(o.version)&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(t)),l=s(a)?a.data:a,c=this.data;this.data=yield ms(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),i&&this.updateState(i,r),this.render()})}updatePosition(){var a;const t=Sg(this.five,this.floorIndex,this.state.config.attachedTo),i=(a=this.five.model)==null?void 0:a.bounding.getCenter(new C.Vector3).setY(t);if(!i)return;const r=i.clone().project(this.five.camera),s=(r.x+1)/2,o=-(r.y-1)/2;this.container.style.left=s*100+"%",this.container.style.top=o*100+"%"}appendTo(t){if(this.wrapper=t,!!this.state.enabled)return t.appendChild(this.container),this.render(),this}show(){return ee(this,arguments,function*(t={}){if(this.state.visible)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!0},i),this._show({userAction:i})})}hide(){return ee(this,arguments,function*(t={}){if(this.isHiddenByHideFunc=!0,!this.state.visible)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!1},i),this._hide({userAction:i})})}enable(t={}){if(this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!0},t.userAction||i),this._enable({userAction:i})}disable(t={}){if(!this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!1},t.userAction||i),this._disable({userAction:i})}setState(t,i={}){const r=this.state,s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled){const o={userAction:s};t.enabled?this._enable(o):this._disable(o)}if(t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s};t.visible?this._show(o):this._hide(o)}}changeConfigs(t,i=!0){this.updateState({config:t},i),this.render()}formatData(t){return ee(this,null,function*(){return yield ms(t.data)})}_show(t){return ee(this,null,function*(){if(!this.state.enabled)return;this.isHiddenByHideFunc=!1;const{userAction:i}=t;this.hooks.emit("show",{userAction:i,auto:!1}),this.five.getCurrentState().mode!=="Topview"&&(yield Tg(this.five,["Topview",void 0,void 0,i])),this.five.model.show(this.floorIndex),this.updatePosition(),this.updateSize();const r=500,s=this.state.config.modelOpacity;ka(this.five,s,r),this.hooks.emit("showAnimationEnded",{userAction:i,auto:!1}),this.render()})}_hide(t){return ee(this,null,function*(){if(!this.state.enabled)return;const{userAction:i}=t;this.hooks.emit("hide",{userAction:i,auto:!1});const r=1,s=0;ka(this.five,r,s),this.render()})}_enable(t){const{userAction:i}=t;this.addEventListener(),this.wrapper&&this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:i}),this.state.visible&&this._show({userAction:i})}updateState(t,i){var a;const r=this.state,s=(a=t.config)!=null&&a.missingFloorConfig?R(R({},r.config.missingFloorConfig),t.config.missingFloorConfig):r.config.missingFloorConfig,o=t.config?Ee(R(R({},r.config),t.config),{missingFloorConfig:s}):r.config;this.state=Ee(R(R({},this.state),t),{config:o}),!Nn(this.state,r,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const t=this.five;t.on("modeChange",this.onFiveModeChange),t.on("panoArrived",this.onFivePanoArrived),t.on("cameraUpdate",this.onFiveCameraUpdate),t.on("wantsGesture",this.onFiveWantsGesture),t.on("wantsMoveToPano",this.onFiveWantsMoveToPano),t.on("initAnimationEnded",this.onFiveInitAnimationEnded),t.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const t=this.five;this.hasAddedEventListener=!1,t.off("modeChange",this.onFiveModeChange),t.off("panoArrived",this.onFivePanoArrived),t.off("cameraUpdate",this.onFiveCameraUpdate),t.off("wantsGesture",this.onFiveWantsGesture),t.off("wantsMoveToPano",this.onFiveWantsMoveToPano),t.off("initAnimationEnded",this.onFiveInitAnimationEnded),t.off("modelShownFloorChange",this.onModelShownFloorChange)}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate3d(-50%, -50%, 10px)",zIndex:10,pointerEvents:"none","will-change":"width, height"}),this.five.addExtraElement(this.container)}render(t){if(!this.state.enabled||!this.container||!this.data||this.size.width===0)return;const i=Ee(R({},this.state.config),{visible:this.state.visible,duration:t!=null?t:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(i);this.app=new _g({target:this.container,intro:!0,props:i})}};const fk=(e,n)=>new dk(e,n);function Dg(e,n=200){let t;return function(...i){t||(e(...i),t=setTimeout(function(){t=null},n))}}function pk(e){Ue(e,"svelte-1nqrlxd",".plugin-radar__camera-wrapper.svelte-1nqrlxd{width:100%;height:100%;position:absolute;pointer-events:none}.plugin-radar__camera-position.svelte-1nqrlxd{position:absolute;left:0;top:0;width:0;height:0;transform:none;pointer-events:none;transition:transform 1s linear}.plugin-radar__camera-rotate.svelte-1nqrlxd{position:absolute;left:-0.9375rem;top:-0.9375rem;width:1.0625rem;height:1.0625rem;transform-origin:0.9375rem 0.9375rem;transform:rotate(45deg);background-repeat:no-repeat;background-size:100%}")}function mk(e){let n,t,i;return{c(){n=H("div"),t=H("div"),i=H("div"),_(i,"class","plugin-radar__camera-rotate svelte-1nqrlxd"),W(i,"background-image","url("+(e[0]||ps)+")"),W(i,"transform",e[1]),_(t,"class","plugin-radar__camera-position svelte-1nqrlxd"),W(t,"transform",e[2]),_(n,"class","plugin-radar__camera-wrapper svelte-1nqrlxd"),W(n,"opacity",e[3]?1:0)},m(r,s){Z(r,n,s),Q(n,t),Q(t,i)},p(r,[s]){s&1&&W(i,"background-image","url("+(r[0]||ps)+")"),(s&1||s&3)&&W(i,"transform",r[1]),s&4&&W(t,"transform",r[2]),s&8&&W(n,"opacity",r[3]?1:0)},i:de,o:de,d(r){r&&Y(n)}}}function gk(e){return`rotate(${Math.floor(e/Math.PI*180)*-1+45}deg)`}function vk(e,n,t){var b,A;let i,r,s,o,{five:a}=n,{pxmm:l}=n,{floorplanData:c}=n,{cameraImageUrl:h}=n,u=a.getCurrentState().panoIndex,d=a.getCurrentState().longitude,f=(A=(b=a.work.observers[a.getCurrentState().panoIndex])==null?void 0:b.floorIndex)!=null?A:0;function m(w,x){const M=w.bounding,P=w.observers[x];if(!P)return"";const S=(M.max.x-M.min.x)*l,T=(M.max.y-M.min.y)*l,z=Math.floor(P.positionInImage.x*S),D=Math.floor(P.positionInImage.y*T);return`translate(${z}px, ${D}px)`}function p(w){t(7,u=w)}function g(w){t(9,f=a.work.observers[w].floorIndex)}const y=Dg(w=>{t(8,d=w.longitude)},1e3/60);return Yn(()=>(a.on("panoWillArrive",p),a.on("panoArrived",g),a.on("cameraDirectionUpdate",y),function(){a.off("panoWillArrive",p),a.off("panoArrived",g),a.off("cameraDirectionUpdate",y)})),e.$$set=w=>{"five"in w&&t(4,a=w.five),"pxmm"in w&&t(5,l=w.pxmm),"floorplanData"in w&&t(6,c=w.floorplanData),"cameraImageUrl"in w&&t(0,h=w.cameraImageUrl)},e.$$.update=()=>{e.$$.dirty&576&&t(10,i=c.floorDatas[f]),e.$$.dirty&1024&&t(3,r=i.rooms.length>0),e.$$.dirty&192&&t(2,s=m(c,u)),e.$$.dirty&256&&t(1,o=gk(d))},[h,o,s,r,a,l,c,u,d,f,i]}class yk extends ke{constructor(n){super(),Le(this,n,vk,mk,De,{five:4,pxmm:5,floorplanData:6,cameraImageUrl:0},pk)}}function bk(e){Ue(e,"svelte-1i87fz7",".plugin-pano-floorplan__extra-objects.svelte-1i87fz7{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.plugin-pano-floorplan__extra-object-item--position.svelte-1i87fz7{position:absolute;width:0;height:0}.plugin-pano-floorplan__extra-object-item.svelte-1i87fz7{transform:translate(-50%, -50%)}")}function Vy(e,n,t){const i=e.slice();return i[1]=n[t],i}function Gy(e,n){let t,i,r=`${n[1].icon.width/16}rem`,s=`${n[1].icon.height/16}rem`,o,a=`${n[1].positionInImage.y*100}%`,l=`${n[1].positionInImage.x*100}%`;return{key:e,first:null,c(){t=H("div"),i=H("div"),o=ve(),_(i,"class","plugin-pano-floorplan__extra-object-item svelte-1i87fz7"),W(i,"background-image",`url(${n[1].icon.url})`),W(i,"width",r),W(i,"height",s),_(t,"class","plugin-pano-floorplan__extra-object-item--position svelte-1i87fz7"),W(t,"top",a),W(t,"left",l),this.first=t},m(c,h){Z(c,t,h),Q(t,i),Q(t,o)},p(c,h){n=c,h&1&&W(i,"background-image",`url(${n[1].icon.url})`);const u=h&1;u&&W(i,"width",r),u&&W(i,"height",s),h&1&&a!==(a=`${n[1].positionInImage.y*100}%`)&&W(t,"top",a),h&1&&l!==(l=`${n[1].positionInImage.x*100}%`)&&W(t,"left",l)},d(c){c&&Y(t)}}}function Ak(e){let n,t=[],i=new Map,r=e[0];const s=o=>o[1].id;for(let o=0;o<r.length;o+=1){let a=Vy(e,r,o),l=s(a);i.set(l,t[o]=Gy(l,a))}return{c(){n=H("div");for(let o=0;o<t.length;o+=1)t[o].c();_(n,"class","plugin-pano-floorplan__extra-objects svelte-1i87fz7")},m(o,a){Z(o,n,a);for(let l=0;l<t.length;l+=1)t[l]&&t[l].m(n,null)},p(o,[a]){a&1&&(r=o[0],t=zi(t,a,s,1,o,r,i,n,Mg,Gy,null,Vy))},i:de,o:de,d(o){o&&Y(n);for(let a=0;a<t.length;a+=1)t[a].d()}}}function wk(e,n,t){let{extraObjects:i=[]}=n;return e.$$set=r=>{"extraObjects"in r&&t(0,i=r.extraObjects)},[i]}class xk extends ke{constructor(n){super(),Le(this,n,wk,Ak,De,{extraObjects:0},bk)}}function Mk(e){Ue(e,"svelte-18287ai",".missing-floor-wrapper.svelte-18287ai{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;display:flex;justify-content:center;align-items:center}.missing-floor-image.svelte-18287ai{max-width:100%;max-height:100%}")}function Ek(e){let n,t,i,r,s,o;const a=[{floorIndex:e[2],floorplanData:e[4]}];let l={};for(let h=0;h<a.length;h+=1)l=kn(l,a[h]);n=new Cx({props:l}),i=new xk({props:{extraObjects:e[7]}});let c=e[3]&&jy(e);return{c(){Ie(n.$$.fragment),t=ve(),Ie(i.$$.fragment),r=ve(),c&&c.c(),s=ft()},m(h,u){_e(n,h,u),Z(h,t,u),_e(i,h,u),Z(h,r,u),c&&c.m(h,u),Z(h,s,u),o=!0},p(h,u){const d=u&20?Vn(a,[{floorIndex:h[2],floorplanData:h[4]}]):{};n.$set(d);const f={};u&128&&(f.extraObjects=h[7]),i.$set(f),h[3]?c?(c.p(h,u),u&8&&F(c,1)):(c=jy(h),c.c(),F(c,1),c.m(s.parentNode,s)):c&&(Ve(),X(c,1,1,()=>{c=null}),Ge())},i(h){o||(F(n.$$.fragment,h),F(i.$$.fragment,h),F(c),o=!0)},o(h){X(n.$$.fragment,h),X(i.$$.fragment,h),X(c),o=!1},d(h){Se(n,h),h&&Y(t),Se(i,h),h&&Y(r),c&&c.d(h),h&&Y(s)}}}function Ck(e){let n,t,i;return{c(){n=H("div"),t=H("img"),_(t,"class","missing-floor-image svelte-18287ai"),Pn(t.src,i=e[6])||_(t,"src",i),_(t,"alt","缺省楼层"),_(n,"class","missing-floor-wrapper svelte-18287ai")},m(r,s){Z(r,n,s),Q(n,t)},p(r,s){s&64&&!Pn(t.src,i=r[6])&&_(t,"src",i)},i:de,o:de,d(r){r&&Y(n)}}}function jy(e){let n,t;const i=[{five:e[0],pxmm:e[1],floorIndex:e[2],floorplanData:e[4],onRoomHeightClick:e[9],highlightData:e[5],hoveredRoom:void 0}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new _x({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&567?Vn(i,[{five:s[0],pxmm:s[1],floorIndex:s[2],floorplanData:s[4],onRoomHeightClick:s[9],highlightData:s[5],hoveredRoom:void 0}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function Pk(e){let n,t,i,r;const s=[Ck,Ek],o=[];function a(l,c){return l[8]?1:0}return n=a(e),t=o[n]=s[n](e),{c(){t.c(),i=ft()},m(l,c){o[n].m(l,c),Z(l,i,c),r=!0},p(l,[c]){let h=n;n=a(l),n===h?o[n].p(l,c):(Ve(),X(o[h],1,1,()=>{o[h]=null}),Ge(),t=o[n],t?t.p(l,c):(t=o[n]=s[n](l),t.c()),F(t,1),t.m(i.parentNode,i))},i(l){r||(F(t),r=!0)},o(l){X(t),r=!1},d(l){o[n].d(l),l&&Y(i)}}}function _k(e,n,t){let i,r,s,{five:o}=n,{pxmm:a}=n,{floorIndex:l}=n,{hoverEnable:c}=n,{floorplanData:h}=n,{extraObjects:u=[]}=n,{highlightData:d}=n,{missingFloorImageUrl:f}=n;const m=void 0;return e.$$set=p=>{"five"in p&&t(0,o=p.five),"pxmm"in p&&t(1,a=p.pxmm),"floorIndex"in p&&t(2,l=p.floorIndex),"hoverEnable"in p&&t(3,c=p.hoverEnable),"floorplanData"in p&&t(4,h=p.floorplanData),"extraObjects"in p&&t(10,u=p.extraObjects),"highlightData"in p&&t(5,d=p.highlightData),"missingFloorImageUrl"in p&&t(6,f=p.missingFloorImageUrl)},e.$$.update=()=>{e.$$.dirty&20&&t(11,i=h.floorDatas[l]),e.$$.dirty&2048&&t(8,r=i.rooms.length>0),e.$$.dirty&1028&&t(7,s=u==null?void 0:u.filter(p=>p.floorIndex===l))},[o,a,l,c,h,d,f,s,r,m,u,i]}class Sk extends ke{constructor(n){super(),Le(this,n,_k,Pk,De,{five:0,pxmm:1,floorIndex:2,hoverEnable:3,floorplanData:4,extraObjects:10,highlightData:5,missingFloorImageUrl:6},Mk)}}function Ik(e){Ue(e,"svelte-1mvqyqq",".plugin-floorplan-radar.svelte-1mvqyqq{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.plugin-floorplan-radar-container.svelte-1mvqyqq{position:relative}")}function Hy(e){let n,t,i,r,s=e[8]!==0&&Uy(e);return{c(){n=H("div"),s&&s.c(),_(n,"class","plugin-floorplan-radar svelte-1mvqyqq")},m(o,a){Z(o,n,a),s&&s.m(n,null),t=!0,i||(r=[Di(As.call(null,n)),ot(n,"clientWidth",e[14]),ot(n,"clientHeight",e[15])],i=!0)},p(o,a){o[8]!==0?s?(s.p(o,a),a&256&&F(s,1)):(s=Uy(o),s.c(),F(s,1),s.m(n,null)):s&&(Ve(),X(s,1,1,()=>{s=null}),Ge())},i(o){t||(F(s),t=!0)},o(o){X(s),t=!1},d(o){o&&Y(n),s&&s.d(),i=!1,yn(r)}}}function Uy(e){let n,t,i,r,s=`${e[10]}px`,o=`${e[13]}px`,a;const l=[{five:e[0],pxmm:e[11],floorIndex:e[12],floorplanData:e[3],hoverEnable:e[2],extraObjects:e[5],highlightData:e[6],missingFloorImageUrl:e[7]}];let c={};for(let d=0;d<l.length;d+=1)c=kn(c,l[d]);t=new Sk({props:c});const h=[{pxmm:e[11],five:e[0],floorplanData:e[3],cameraImageUrl:e[4]}];let u={};for(let d=0;d<h.length;d+=1)u=kn(u,h[d]);return r=new yk({props:u}),{c(){n=H("div"),Ie(t.$$.fragment),i=ve(),Ie(r.$$.fragment),_(n,"class","plugin-floorplan-radar-container svelte-1mvqyqq"),W(n,"width",s),W(n,"height",o)},m(d,f){Z(d,n,f),_e(t,n,null),Q(n,i),_e(r,n,null),a=!0},p(d,f){const m=f&6381?Vn(l,[{five:d[0],pxmm:d[11],floorIndex:d[12],floorplanData:d[3],hoverEnable:d[2],extraObjects:d[5],highlightData:d[6],missingFloorImageUrl:d[7]}]):{};t.$set(m);const p=f&2073?Vn(h,[{pxmm:d[11],five:d[0],floorplanData:d[3],cameraImageUrl:d[4]}]):{};r.$set(p),f&1024&&s!==(s=`${d[10]}px`)&&W(n,"width",s),f&8192&&o!==(o=`${d[13]}px`)&&W(n,"height",o)},i(d){a||(F(t.$$.fragment,d),F(r.$$.fragment,d),a=!0)},o(d){X(t.$$.fragment,d),X(r.$$.fragment,d),a=!1},d(d){d&&Y(n),Se(t),Se(r)}}}function Tk(e){let n,t,i=e[1]&&Hy(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[1]?i?(i.p(r,s),s&2&&F(i,1)):(i=Hy(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function Dk(e,n,t){var w,x;let{five:i}=n,{visible:r}=n,{hoverEnable:s}=n,{floorplanData:o}=n,{cameraImageUrl:a}=n,{extraObjects:l=[]}=n,{highlightData:c}=n,{missingFloorImageUrl:h}=n,u=0,d=(x=(w=i.work.observers[i.getCurrentState().panoIndex])==null?void 0:w.floorIndex)!=null?x:0,f=0,m=0,p=0,g=0;function y(M){t(12,d=i.work.observers[M].floorIndex)}Yn(()=>(i.on("panoArrived",y),()=>{i.off("panoArrived",y)}));const b=M=>{t(8,f=M.detail)},A=M=>{t(9,m=M.detail)};return e.$$set=M=>{"five"in M&&t(0,i=M.five),"visible"in M&&t(1,r=M.visible),"hoverEnable"in M&&t(2,s=M.hoverEnable),"floorplanData"in M&&t(3,o=M.floorplanData),"cameraImageUrl"in M&&t(4,a=M.cameraImageUrl),"extraObjects"in M&&t(5,l=M.extraObjects),"highlightData"in M&&t(6,c=M.highlightData),"missingFloorImageUrl"in M&&t(7,h=M.missingFloorImageUrl)},e.$$.update=()=>{if(e.$$.dirty&1800){const M=Math.min(f,m),{max:P,min:S}=o.bounding,T=P.x-S.x,z=P.y-S.y,D=function(){return T>z?[M,M/T*z]:[M/z*T,M]}();t(10,p=D[0]),t(13,g=D[1]),t(11,u=p/T)}},[i,r,s,o,a,l,c,h,f,m,p,u,d,g,b,A]}class Lk extends ke{constructor(n){super(),Le(this,n,Dk,Tk,De,{five:0,visible:1,hoverEnable:2,floorplanData:3,cameraImageUrl:4,extraObjects:5,highlightData:6,missingFloorImageUrl:7},Ik)}}let kk=class extends Br{constructor(t,i){super(t);v(this,"name","panoFloorplanRadarPlugin");v(this,"state");v(this,"data");v(this,"app");v(this,"wrapperSelector","");v(this,"wrapper",null);v(this,"disposed",!1);v(this,"extraObjects",[]);v(this,"highlightData",{});v(this,"dispose",()=>{var t;this.disposed=!0,(t=this.app)==null||t.$destroy(),this.wrapper=null,this.wrapperSelector="",this.hooks.emit("dispose")});v(this,"highlight",t=>{this.state.config.highlightEnable&&(this.highlightData=t,this.render())});v(this,"unhighlight",()=>{this.highlightData={},this.render()});v(this,"_disable",t=>{var r;const{userAction:i}=t;(r=this.app)==null||r.$destroy(),this.app=void 0,this.hooks.emit("disable",{userAction:i})});this.five=t;const r={hoverEnable:!0,highlightEnable:!0,cameraImageUrl:ps,missingFloorImageUrl:this.staticPrefix+"/release/web/saas/missing-floor.d687a5ed.png"},s=R(R({},r),i==null?void 0:i.configs);this.state={enabled:!0,visible:!0,config:s},i!=null&&i.wrapper&&console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法"),typeof(i==null?void 0:i.wrapper)=="string"?this.wrapperSelector=i.wrapper:(i==null?void 0:i.wrapper)instanceof Element&&(this.wrapper=i.wrapper),t.once("dispose",this.dispose)}load(t,i,r=!0){return ee(this,null,function*(){function s(c){return Object.prototype.hasOwnProperty.apply(c,["version"])}const o=JSON.parse(JSON.stringify(t)),a=s(o)?o.data:o,l=this.data;this.data=yield ms(a),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,l),i&&this.updateState(i,r),this.render()})}show(){return ee(this,arguments,function*(t={}){if(this.state.visible)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!0},i),this._show({userAction:i})})}hide(){return ee(this,arguments,function*(t={}){if(!this.state.visible)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!1},i),this._hide({userAction:i})})}enable(t={}){if(this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!0},t.userAction||i),this._enable({userAction:i})}disable(t={}){if(!this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!1},t.userAction||i),this._disable({userAction:i})}setState(t,i={}){const r=this.state,s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled){const o={userAction:s};t.enabled?this._enable(o):this._disable(o)}if(t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s};t.visible?this._show(o):this._hide(o)}}appendTo(t){this.wrapper!==t&&this.app&&(this.app.$destroy(),this.app=void 0),this.wrapper=t,this.render()}changeConfigs(t,i=!0){this.setState({config:t},{userAction:i}),this.render()}setExtraObjectsWith3DPositions(t){this.data&&(this.extraObjects=KL(t,this.five,this.data),this.render())}formatData(t){return ee(this,null,function*(){return yield ms(t.data)})}_enable(t){const{userAction:i}=t;this.hooks.emit("enable",{userAction:i}),this.state.visible&&this._show({userAction:i})}_show(t){if(this.disposed||!this.state.enabled)return;const{userAction:i}=t;this.hooks.emit("show",{userAction:i}),this.render()}_hide(t){if(this.disposed||!this.state.enabled)return;const{userAction:i}=t;this.hooks.emit("hide",{userAction:i}),this.render()}updateState(t,i){const r=this.state,s=t.config?R(R({},r.config),t.config):r.config;this.state=Ee(R(R({},this.state),t),{config:s}),!Nn(this.state,r,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}render(){if(this.disposed||!this.state.enabled)return;if(!this.wrapper&&this.wrapperSelector){const i=document.querySelector(this.wrapperSelector);this.wrapper=i}if(!this.data||!this.wrapper)return;const t=Ee(R({},this.state.config),{five:this.five,floorplanData:this.data,visible:this.state.visible,extraObjects:this.extraObjects,highlightData:this.highlightData});this.app?this.app.$set(t):this.app=new Lk({target:this.wrapper,props:t})}};const Rk=(e,n)=>new kk(e,n),Ok=[{type:0,floorType:1,roomType:"100900000012",name:"其他"},{type:1,floorType:1,roomType:"100900000002",name:"客厅"},{type:2,floorType:1,roomType:"100900000002",name:"餐厅"},{type:3,floorType:0,roomType:"100900000001",name:"卧室"},{type:4,floorType:0,roomType:"100900000001",name:"书房"},{type:5,floorType:3,roomType:"100900000004",name:"卫生间"},{type:6,floorType:3,roomType:"100900000004",name:"淋浴间"},{type:7,floorType:3,roomType:"100900000004",name:"洗手间"},{type:8,floorType:3,roomType:"100900000003",name:"厨房"},{type:9,floorType:1,roomType:"100900000003",name:"开放厨房",onlySubArea:!0},{type:10,floorType:0,roomType:"100900000001",name:"多功能间"},{type:11,floorType:0,roomType:"100900000009",name:"保姆间"},{type:12,floorType:4,roomType:"100900000005",name:"阳台"},{type:13,floorType:4,roomType:"100900000006",name:"露台"},{type:14,floorType:0,roomType:"100900000008",name:"储物间"},{type:15,floorType:0,roomType:"100900000013",name:"衣帽间"},{type:16,floorType:0,roomType:"100900000011",name:"阁楼"},{type:17,floorType:2,roomType:"100900000007",name:"花园"},{type:18,floorType:5,roomType:"100900000010",name:"车库"},{type:19,floorType:1,roomType:"100900000012",name:"电梯"},{type:20,floorType:1,roomType:"100900000012",name:"地下室"},{type:21,floorType:1,roomType:"100900000012",name:"天井"},{type:22,floorType:1,roomType:"100900000012",name:"阳光房"},{type:23,floorType:1,roomType:"100900000012",name:"过道"},{type:24,floorType:1,roomType:"100900000012",name:"楼梯间"},{type:25,floorType:1,roomType:"100900000012",name:"门厅"},{type:26,floorType:2,roomType:"100900000012",name:"入户花园"},{type:27,floorType:1,roomType:"100900000012",name:"玄关"},{type:28,floorType:1,roomType:"100900000012",name:"挑空"},{type:29,floorType:4,roomType:"100900000012",name:"晾晒区"},{type:30,floorType:4,roomType:"100900000012",name:"洗衣房"},{type:31,floorType:0,roomType:"100900000012",name:"娱乐区"},{type:32,floorType:0,roomType:"100900000012",name:"健身区"},{type:33,floorType:0,roomType:"100900000012",name:"接待区"},{type:34,floorType:0,roomType:"100900000012",name:"影音区"},{type:35,floorType:1,roomType:"100900000012",name:"餐饮区"},{type:36,floorType:1,roomType:"100900000012",name:"其他",onlySubArea:!0},{type:37,floorType:1,roomType:"100900000002",name:"起居室"},{type:38,floorType:0,roomType:"100900000001",name:"主卧"},{type:39,floorType:0,roomType:"100900000001",name:"次卧"},{type:40,floorType:0,roomType:"100900000001",name:"优化间"},{type:41,floorType:0,roomType:"100900000001",name:"办公室"},{type:42,floorType:0,roomType:"100900000001",name:"会议室"},{type:43,floorType:0,roomType:"100900000001",name:"洽谈间"},{type:44,floorType:1,roomType:"100900000002",name:"共享大厅"},{type:45,floorType:1,roomType:"100900000012",name:"水吧"},{type:46,floorType:0,roomType:"100900000015",name:"出入口"},{type:47,floorType:0,roomType:"100900000015",name:"大厅"},{type:48,floorType:0,roomType:"100900000015",name:"包厢"},{type:49,floorType:0,roomType:"100900000015",name:"其他"},{type:50,floorType:0,roomType:"100900000016",name:"出入口"},{type:51,floorType:0,roomType:"100900000016",name:"办公区"},{type:52,floorType:0,roomType:"100900000016",name:"老板间"},{type:53,floorType:0,roomType:"100900000016",name:"会议室"},{type:54,floorType:0,roomType:"100900000016",name:"休息区/水吧"},{type:55,floorType:0,roomType:"100900000016",name:"其他"},{type:56,floorType:2,roomType:"100900000012",name:"空中花园"},{type:57,floorType:0,roomType:"100900000001",name:"洋室"},{type:58,floorType:0,roomType:"100900000001",name:"和室"}],zk=[{type:0,description:"木质地板"},{type:1,description:"瓷砖地面"},{type:2,description:"户外地面"},{type:3,description:"卫生间地面"},{type:4,description:"阳台地面"},{type:5,description:"车库地面"}],Bk=[{roomType:"100900000001",description:"室"},{roomType:"100900000002",description:"厅"},{roomType:"100900000003",description:"厨"},{roomType:"100900000004",description:"卫"},{roomType:"100900000005",description:"阳台"},{roomType:"100900000006",description:"露台"},{roomType:"100900000007",description:"花园"},{roomType:"100900000008",description:"储"},{roomType:"100900000009",description:"保姆间"},{roomType:"100900000010",description:"车库"},{roomType:"100900000011",description:"阁楼"},{roomType:"100900000012",description:"其他"},{roomType:"100900000013",description:"衣"},{roomType:"100900000015",description:"商铺"},{roomType:"100900000016",description:"写字楼"}],tp=(e,n,t)=>{const i=new C.Matrix4,r=new C.Euler(e,n,t,"YXZ");return i.makeRotationFromEuler(r),i},Nk=(e,{scale:n,rotation:t,position:i})=>{if(n&&e.scale.set(n,n,n),t){const[r,s,o]=t;r&&e.applyMatrix4(tp(r,0,0)),s&&e.applyMatrix4(tp(0,s,0)),o&&e.applyMatrix4(tp(0,0,o))}return i&&e.position.set(i.x,i.y,i.z),e};function Dx(e,n){e.traverse(t=>{var i;if(t.type==="Mesh"){const r=t,s=R({map:r.material.map||{}},n);r.material=new ne.MeshBasicMaterial(s),r.renderOrder=1,((i=t.parent)==null?void 0:i.type)==="Mesh"&&(t.renderOrder=t.parent.renderOrder+1)}})}const Fk=(e,n)=>{var p;const t=n.fbx_url||"//vrlab-image4.ljcdn.com/release/web/dipan2.f38a21cc.FBX",i=(p=n.north_rad)!=null?p:void 0,r={};let s={x:0,y:0,z:0},o=[0,0,0],a=1,l=i;e.on("modelLoaded",m);const c=g=>ee(exports,null,function*(){var w;const y=(g==null?void 0:g.fbx_url)||t;if(l=(w=g==null?void 0:g.north_rad)!=null?w:i,typeof l!="number")throw new Error('"northRad"配置参数缺失:未配置指南针指向!');const A=yield new j1.FBXLoader().loadAsync(y);return Dx(A,{transparent:!0,side:C.DoubleSide,blending:C.AdditiveBlending}),r.object=A,m(),!0}),h=({latitude:g})=>{if(!r.object)return;const y=u(g);y&&(r.object.position.y=y)},u=g=>{if(r.yBase===void 0)return;const y=.6;if(g>=Math.PI/4)return r.yBase-(y+1.6);const b=g*(4/Math.PI);return r.yBase-(y*b+1.6)},d=()=>{if(!r.object)return;const g=u(e.getPose().latitude);g&&(r.object.position.y=g),e.scene.add(r.object),e.needsRender=!0,e.on("cameraDirectionUpdate",h)},f=()=>{r.object&&(e.scene.remove(r.object),e.needsRender=!0,e.off("cameraDirectionUpdate",h))};function m(){const g=r.object;if(!g)return;const y=e.model.bounding,b=y.max.x-y.min.x,A=y.max.z-y.min.z,w=Math.max(b,A),{max:{x,z:M},min:{x:P,y:S,z:T}}=y;r.yBase=S,s={x:(x+P)/2,y:S-1.6,z:(M+T)/2},o=[0,l-Math.PI/2,0],a=.0045*w,Nk(g,{position:s,rotation:o,scale:a})}return{load:c,disable:f,enable:d}};function Vk(e,n){var c,h,u,d,f;const t=(c=n==null?void 0:n.size)!=null?c:512,i=(h=n==null?void 0:n.fontSize)!=null?h:t*(35/256)*1.2,r=(u=n==null?void 0:n.backgroundColor)!=null?u:"rgba(0,0,0,0)",s=(d=n==null?void 0:n.fontColor)!=null?d:"#fff",o=(f=n==null?void 0:n.textAlign)!=null?f:"center",a=document.createElement("canvas");a.setAttribute("width",t+""),a.setAttribute("height",t+"");const l=a.getContext("2d");return l.fillStyle=r,l.fillRect(0,0,t,t),l.font=`${i}px "微软雅黑"`,l.textAlign=o,l.fillStyle=s,l.fillText(e,t/2,t*.7),new ne.CanvasTexture(a)}const Gk=({x:e,y:n,z:t})=>new ne.Vector3(e,n,t),jk=(e,n)=>{var p,g,y;const t={},i=(p=n.animationEnabled)!=null?p:!0,r=(g=n.position)!=null?g:void 0,s=(y=n.rad)!=null?y:void 0,o=n.fbx_url||"//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx",a=[],l=b=>ee(exports,null,function*(){var z,D,k,O,G,I,U,q;const A=(z=b==null?void 0:b.position)!=null?z:r;if(!A)return Promise.reject(new Error("ModelEntryDoorGuidePlugin.load(): position is undefined"));const w=Gk(A),x=(D=b==null?void 0:b.rad)!=null?D:s,M=(k=b==null?void 0:b.fbx_url)!=null?k:o;if(t.rad=x,x===void 0)return Promise.reject(new Error(`ModelEntryDoorGuidePlugin.load(): rad is ${x}`));const P=yield new j1.FBXLoader().loadAsync(M);P.position.copy(w),P.rotation.z=x,P.scale.set(.8,.8,.8),Dx(P,{transparent:!0,side:C.DoubleSide});const S=(U=(I=(G=(O=P.children)==null?void 0:O[0])==null?void 0:G.children)==null?void 0:I[3])==null?void 0:U.clone();if(!S)return Promise.reject(new Error(`ModelEntryDoorGuidePlugin.load(): textMesh is ${S}`));const T=(q=n.name)!=null?q:"入户门";return S.material=new ne.MeshBasicMaterial({transparent:!0,map:Vk(T)}),S.renderOrder=3,P.children[0].add(S),t.object=P,!0}),c=()=>{if(t.animation)return;if(!t.object)return console.error("ModelEntryDoorGuidePlugin.initAnimation(): state.object is ",t.object);const b=1,A=new ne.AnimationMixer(t.object);a.push(A);const w=A.clipAction(t.object.animations[0]);w.timeScale=b;let x;const M=()=>{let z=0,D=0;const k=1e3/30,O=G=>{z=requestAnimationFrame(O);const I=G-D;I<k||(D=G,a.forEach(U=>U.update(I/1e3)),e.needsRender=!0)};return z=requestAnimationFrame(O),()=>{cancelAnimationFrame(z)}},T={play:()=>{x||(w.play(),x=M(),requestAnimationFrame(()=>{t.object&&t.object.rotation.z!==t.rad&&(t.object.rotation.z=t.rad)}))},stop:()=>{w.stop(),x==null||x(),x=void 0}};t.animation=T},h=b=>{var w;if(!t.object)return console.error("ModelEntryDoorGuidePlugin.enable(): object is ",t.object);((w=b==null?void 0:b.animationEnable)!=null?w:i)&&(t.animation||c(),t.animation.play()),e.scene.add(t.object),e.needsRender=!0},u=()=>{t.object&&(t.animation&&t.animation.stop(),e.scene.remove(t.object),e.needsRender=!0)},d=b=>b==="Floorplan"?h():u();return{load:l,enable:b=>(t.enabled||(t.enabled=!0,d(e.currentMode),e.on("modeChange",d),h(b)),!0),disable:()=>(t.enabled&&(t.enabled=!1,u(),e.off("modeChange",d)),!0)}},Hk=Ki;function Uk(e,n,t,i=Hk.Linear.None){const r=new bd(e).to(n,t).easing(i);zc(()=>r.start(0));const s=ja(a=>{r.update(a)===!1&&s()}),o=[];return r.onDestroy=a=>(o.push(a),r),r.destroy=function(){this.stop(),Object.assign(r,{_onStartCallback:null,_onUpdateCallback:null,_onCompleteCallback:null,_onStopCallbackL:null});let a;for(;a=o.shift();)a();s()},r}function Wk(e,n){return Uk({progress:0},{progress:1},e,n)}var Lx=(e=>(e.Move="Move",e.Rotate="Rotate",e))(Lx||{}),Yi=(e=>(e.Clockwise="Clockwise",e.Anticlockwise="Anticlockwise",e.Loop="Loop",e))(Yi||{});const cu=Math.PI*2;function Wy(e){return(e%cu+cu)%cu}function Qy(e){return e%cu}function np(e,n,t){return e+(n-e)*t}const Sm=(e,n,t)=>{const i=Math.PI,r=i*2;let s=Wy(e),o=Wy(n);return t===Yi.Anticlockwise&&s<o&&(s+=r),t===Yi.Clockwise&&o<s&&(o+=r),t===Yi.Loop&&o-s>i?Sm(s,o,Yi.Anticlockwise):t===Yi.Loop&&s-o>i?Sm(s,o,Yi.Clockwise):{from:s,to:o}},Qk=e=>{const n={},t=(l,c,...h)=>ee(exports,[l,c,...h],function*(s,o,a={preload:!0}){return n.interruptCallback&&n.interruptCallback(!1),a.asyncStartCallback&&(yield a.asyncStartCallback()),s.mode&&s.mode!==e.currentMode&&(yield e.changeMode(s.mode)),a.preload&&s.panoIndex!==void 0&&s.panoIndex!==e.panoIndex&&(yield e.preloadPano(s.panoIndex)),a.asyncEndCallback&&(yield a.asyncEndCallback()),s.panoIndex===void 0&&s.fov===void 0&&s.latitude===void 0&&s.longitude===void 0?!0:yield new Promise((u,d)=>{const f=s.panoIndex!==void 0?s.panoIndex:e.panoIndex;f!==void 0?e.moveToPano(f,R({duration:o,moveEndCallback:()=>u(!0),moveCancelCallback:()=>d(new Error("move canceled"))},s)):d(new Error("unexpected error"))})}),i=s=>{const o=e.state,a=Qy(o.latitude),l=Qy(s.latitude),{from:c,to:h}=Sm(o.longitude,s.longitude,s.rotation||Yi.Loop),u=o.fov,d=s.fov;return{from:{latitude:a,longitude:c,fov:u},to:{latitude:l,longitude:h,fov:d}}};return{move:t,rotate:(l,c,...h)=>ee(exports,[l,c,...h],function*(s,o,a={}){n.interruptCallback&&n.interruptCallback(!1),a.asyncStartCallback&&(yield a.asyncStartCallback()),e.currentMode!==qt.Five.Mode.Panorama&&(yield e.changeMode(qt.Five.Mode.Panorama)),s.panoIndex!==void 0&&s.panoIndex!==e.panoIndex&&(a.preload&&(yield e.preloadPano(s.panoIndex)),yield new Promise((f,m)=>{if(!s.panoIndex){f(!0);return}e.moveToPano(s.panoIndex,{moveEndCallback:()=>f(!0),moveCancelCallback:()=>m(new Error("move canceled"))})})),a.asyncEndCallback&&(yield a.asyncEndCallback());const{from:u,to:d}=i(s);return yield new Promise(f=>{const m=({progress:A})=>{const w={};w.longitude=np(u.longitude,d.longitude,A),w.latitude=np(u.latitude,d.latitude,A),w.fov=np(u.fov,d.fov,A),e.setState(w,!0)},p=()=>{f(!0)},g=()=>{f(!1)},y=s.rotateSpeed?Math.ceil(Math.abs(d.longitude-u.longitude)/s.rotateSpeed*1e3):o,b=Wk(y,Ki.Linear.None).onUpdate(m).onComplete(p).onDestroy(g);s.rotation===Yi.Loop&&b.repeat(1/0).yoyo(!0),n.interruptCallback=(A=!0)=>{b.destroy(),n.interruptCallback=void 0,n.timeoutId&&(clearTimeout(n.timeoutId),n.timeoutId=void 0),f(A)},n.timeoutId=setTimeout(()=>{n.interruptCallback&&n.interruptCallback(!0)},o)})})}};function Yy(e,n){return e.x===n.x&&e.y===n.y}function kx(e,n){return Math.abs(e)===1/0&&Math.abs(n)===1/0?!0:Math.abs(e-n)<.001}function ld(e,n){return(n.y-e.y)/(n.x-e.x)}function Rx(e,n,t){const i=ld(e[1],e[0]),r=ld(n[1],n[0]);if(isNaN(i)||isNaN(r)||kx(i,r))return!1;if(Qh(e[0],n))return e[0];if(Qh(e[1],n))return e[1];if(Qh(n[0],e))return n[0];if(Qh(n[1],e))return n[1];if(t&&!Xk(e,n))return!1;const s=e[0],o=n[0];if(Math.abs(i)===1/0)return{x:s.x,y:n[1].y-(n[1].x-s.x)*r};if(Math.abs(r)===1/0)return{x:o.x,y:e[1].y-(e[1].x-o.x)*i};const a=(o.y-s.y+i*s.x-r*o.x)/(i-r),l=i*a-i*s.x+s.y;return{x:a,y:l}}function Qh(e,n){return Yy(e,n[0])||Yy(e,n[1])?!0:(n[0].x-e.x)*(e.x-n[1].x)>=0&&(n[0].y-e.y)*(e.y-n[1].y)>=0&&kx(ld(n[0],e),ld(e,n[1]))}function Yk(e){let n=1/0,t=-1/0,i=1/0,r=-1/0;return e.forEach(s=>{n=Math.min(n,s.x),t=Math.max(t,s.x),i=Math.min(i,s.y),r=Math.max(r,s.y)}),{x:(n+t)/2,y:(i+r)/2}}function Yh(e,n,t){return(e.x-t.x)*(n.y-t.y)-(n.x-t.x)*(e.y-t.y)}function Xk(e,n){return Math.max(e[0].x,e[1].x)>=Math.min(n[0].x,n[1].x)&&Math.max(n[0].x,n[1].x)>=Math.min(e[0].x,e[1].x)&&Math.max(e[0].y,e[1].y)>=Math.min(n[0].y,n[1].y)&&Yh(n[0],e[1],e[0])*Yh(e[1],n[1],e[0])>0&&Yh(e[0],n[1],n[0])*Yh(n[1],e[1],n[0])>0?1:0}function Ox(e,n=0){n<=0?requestAnimationFrame(e):requestAnimationFrame(()=>Ox(e,n-1))}const Zk=`<style type="text/css">
3173
+ `;return e.$$set=s=>{"content"in s&&t(0,i=s.content)},[i,r]}class PD extends ke{constructor(n){super(),Le(this,n,CD,ED,De,{content:0},MD)}}function _D(e){Ue(e,"svelte-ozpg4a",".floorplan-plugin__base-image.svelte-ozpg4a{position:absolute;z-index:10;width:100%;height:100%;pointer-events:none}")}function SD(e){let n,t;return n=new xD({props:{url:e[1].url}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&2&&(s.url=i[1].url),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function ID(e){let n,t;return n=new PD({props:{content:e[0]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.content=i[0]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function TD(e){let n,t,i,r;const s=[ID,SD],o=[];function a(l,c){return l[0]?0:l[1]?1:-1}return~(t=a(e))&&(i=o[t]=s[t](e)),{c(){n=H("div"),i&&i.c(),_(n,"class","floorplan-plugin__base-image svelte-ozpg4a")},m(l,c){Z(l,n,c),~t&&o[t].m(n,null),r=!0},p(l,[c]){let h=t;t=a(l),t===h?~t&&o[t].p(l,c):(i&&(Ve(),X(o[h],1,1,()=>{o[h]=null}),Ge()),~t?(i=o[t],i?i.p(l,c):(i=o[t]=s[t](l),i.c()),F(i,1),i.m(n,null)):i=null)},i(l){r||(F(i),r=!0)},o(l){X(i),r=!1},d(l){l&&Y(n),~t&&o[t].d()}}}function DD(e,n,t){let i,r,{floorIndex:s}=n,{floorplanData:o}=n;return e.$$set=a=>{"floorIndex"in a&&t(2,s=a.floorIndex),"floorplanData"in a&&t(3,o=a.floorplanData)},e.$$.update=()=>{var a,l;e.$$.dirty&12&&t(1,i=o.outlines[s]),e.$$.dirty&12&&t(0,r=(l=(a=o.outlines)==null?void 0:a[s])==null?void 0:l.svgContent)},[r,i,s,o]}class Cx extends ke{constructor(n){super(),Le(this,n,DD,TD,De,{floorIndex:2,floorplanData:3},_D)}}function LD(e){Ue(e,"svelte-9vzn2f",".floorplan-plugin__room-label-item.svelte-9vzn2f{position:absolute;display:flex;flex-flow:column;align-items:center;line-height:1;color:#fff;transform:translate(-50%, -50%);white-space:nowrap;will-change:opacity;transition:opacity 300ms}.floorplan-plugin__room-part1.svelte-9vzn2f{display:flex;flex-flow:column;align-items:center;color:#fff;white-space:nowrap}.floorplan-plugin__room-area.svelte-9vzn2f{opacity:0.6;line-height:1.25;margin-top:0.125rem}")}function kD(e){let n,t=e[15].outerHTML+"",i;return{c(){n=new $u(!1),i=ft(),n.a=i},m(r,s){n.m(t,r,s),Z(r,i,s)},p(r,s){s[0]&32768&&t!==(t=r[15].outerHTML+"")&&n.p(t)},d(r){r&&Y(i),r&&n.d()}}}function RD(e){let n,t,i,r,s,o,a=e[1]&&uy(e),l=e[0]&&dy(e),c=e[2]&&fy(e);return{c(){n=H("div"),a&&a.c(),t=ve(),l&&l.c(),i=ve(),c&&c.c(),r=ft(),_(n,"class","floorplan-plugin__room-part1 svelte-9vzn2f"),W(n,"opacity",e[11]?"1":"0")},m(h,u){Z(h,n,u),a&&a.m(n,null),Q(n,t),l&&l.m(n,null),Z(h,i,u),c&&c.m(h,u),Z(h,r,u),s||(o=[Di(As.call(null,n)),ot(n,"clientWidth",e[32]),ot(n,"clientHeight",e[33])],s=!0)},p(h,u){h[1]?a?a.p(h,u):(a=uy(h),a.c(),a.m(n,t)):a&&(a.d(1),a=null),h[0]?l?l.p(h,u):(l=dy(h),l.c(),l.m(n,null)):l&&(l.d(1),l=null),u[0]&2048&&W(n,"opacity",h[11]?"1":"0"),h[2]?c?c.p(h,u):(c=fy(h),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(h){h&&Y(n),a&&a.d(),l&&l.d(),h&&Y(i),c&&c.d(h),h&&Y(r),s=!1,yn(o)}}}function uy(e){let n,t=e[3].name+"",i;return{c(){n=H("span"),i=xt(t),_(n,"class","floorplan-plugin__room-name")},m(r,s){Z(r,n,s),Q(n,i)},p(r,s){s[0]&8&&t!==(t=r[3].name+"")&&Ct(i,t)},d(r){r&&Y(n)}}}function dy(e){let n,t;return{c(){n=H("span"),t=xt(e[14]),_(n,"class","floorplan-plugin__room-area svelte-9vzn2f"),W(n,"font-size",e[19])},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r[0]&16384&&Ct(t,i[14])},d(i){i&&Y(n)}}}function fy(e){let n,t;return{c(){n=H("span"),t=xt(e[13]),_(n,"class","floorplan-plugin__room-size"),W(n,"font-size",e[19]),W(n,"opacity",e[10]?"0.6":"0")},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r[0]&8192&&Ct(t,i[13]),r[0]&1024&&W(n,"opacity",i[10]?"0.6":"0")},d(i){i&&Y(n)}}}function OD(e){let n,t,i;function r(a,l){if(a[4]===void 0)return RD;if(a[15])return kD}let s=r(e),o=s&&s(e);return{c(){n=H("div"),o&&o.c(),_(n,"class","floorplan-plugin__room-label-item svelte-9vzn2f"),W(n,"left",e[16]),W(n,"top",e[17]),W(n,"font-size",e[18]),W(n,"opacity",e[12]?"1":"0"),W(n,"transform",e[9]?"translate(-50%, calc(-50% + 6px))":"translate(-50%, -50%)")},m(a,l){Z(a,n,l),o&&o.m(n,null),t||(i=[Di(As.call(null,n)),ot(n,"clientWidth",e[34]),ot(n,"clientHeight",e[35])],t=!0)},p(a,l){s===(s=r(a))&&o?o.p(a,l):(o&&o.d(1),o=s&&s(a),o&&(o.c(),o.m(n,null))),l[0]&4096&&W(n,"opacity",a[12]?"1":"0"),l[0]&512&&W(n,"transform",a[9]?"translate(-50%, calc(-50% + 6px))":"translate(-50%, -50%)")},i:de,o:de,d(a){a&&Y(n),o&&o.d(),t=!1,yn(i)}}}function zD(e,n){const t=e[0],i=e[1];let r=!1;for(let s=0,o=n.length-1;s<n.length;o=s++){const a=n[s][0],l=n[s][1],c=n[o][0],h=n[o][1];l>i!=h>i&&t<(c-a)*(i-l)/(h-l)+a&&(r=!r)}return r}function BD(e,n,t){let i,r,s,o,a,l,c,h,u,d,f,m,p,{pxmm:g}=n,{roomAreaEnable:y}=n,{roomNameEnable:b}=n,{roomDimensionEnable:A}=n,{room:w}=n,{hoveredRoom:x}=n,{getRoomAreaText:M}=n,{getRoomDimensionText:P}=n,{getLabelElement:S}=n,{adaptiveRoomLabelVisibleEnable:T}=n;function z(se,xe){if(xe.width===0||xe.height===0)return()=>!1;const Be=se.path.map(({x:N,y:j})=>[N,j]),ae=se.roomLabel.position,{x:pe,y:Te}=ae,{width:He,height:mt}=xe,Me=He/2,Ne=mt/2;return function(j){const Pe=pe*j,ge=Te*j,qe=Be.map(([ue,st])=>[ue*j,st*j]);return[[Pe+Me,ge-Ne],[Pe-Me,ge-Ne],[Pe-Me,ge+Ne],[Pe+Me,ge+Ne]].every(ue=>zD(ue,qe))}}const D=document.body.clientWidth,k=document.body.clientHeight,O=w.roomLabel,G=O.positionInImage.x*100+"%",I=O.positionInImage.y*100+"%",U=(D<500||k<500?10:14)+"px",q=(D<500||k<500?8:12)+"px";let K=0,te=0,ie=0,fe=0,ye=!1;x.subscribe(function(xe){t(25,ye=!!xe&&xe.id===w.id)});const be=se=>{t(7,ie=se.detail)},Je=se=>{t(8,fe=se.detail)},Ae=se=>{t(5,K=se.detail)},le=se=>{t(6,te=se.detail)};return e.$$set=se=>{"pxmm"in se&&t(20,g=se.pxmm),"roomAreaEnable"in se&&t(0,y=se.roomAreaEnable),"roomNameEnable"in se&&t(1,b=se.roomNameEnable),"roomDimensionEnable"in se&&t(2,A=se.roomDimensionEnable),"room"in se&&t(3,w=se.room),"hoveredRoom"in se&&t(21,x=se.hoveredRoom),"getRoomAreaText"in se&&t(22,M=se.getRoomAreaText),"getRoomDimensionText"in se&&t(23,P=se.getRoomDimensionText),"getLabelElement"in se&&t(4,S=se.getLabelElement),"adaptiveRoomLabelVisibleEnable"in se&&t(24,T=se.adaptiveRoomLabelVisibleEnable)},e.$$.update=()=>{var se,xe;e.$$.dirty[0]&24&&t(15,i=S==null?void 0:S(w)),e.$$.dirty[0]&4194312&&t(14,r=w.size?M(w.size):""),e.$$.dirty[0]&8388616&&t(13,s=w!=null&&w.dimension?P((se=w.dimension)==null?void 0:se.width,(xe=w.dimension)==null?void 0:xe.height):""),e.$$.dirty[0]&384&&t(31,o={width:ie,height:fe}),e.$$.dirty[0]&8|e.$$.dirty[1]&1&&t(30,a=o?z(w,o):void 0),e.$$.dirty[0]&1091567616&&t(27,l=T?!!(a!=null&&a(g)):!0),e.$$.dirty[0]&96&&t(29,c={width:K,height:te}),e.$$.dirty[0]&536870920&&t(28,h=c?z(w,c):void 0),e.$$.dirty[0]&286261248&&t(26,u=T?!!(h!=null&&h(g)):!0),e.$$.dirty[0]&234881024&&t(12,d=u||l||ye),e.$$.dirty[0]&167772160&&t(11,f=l||ye),e.$$.dirty[0]&100663296&&t(10,m=u||ye),e.$$.dirty[0]&201326592&&t(9,p=l&&!u)},[y,b,A,w,S,K,te,ie,fe,p,m,f,d,s,r,i,G,I,U,q,g,x,M,P,T,ye,u,l,h,c,a,o,be,Je,Ae,le]}class ND extends ke{constructor(n){super(),Le(this,n,BD,OD,De,{pxmm:20,roomAreaEnable:0,roomNameEnable:1,roomDimensionEnable:2,room:3,hoveredRoom:21,getRoomAreaText:22,getRoomDimensionText:23,getLabelElement:4,adaptiveRoomLabelVisibleEnable:24},LD,[-1,-1])}}function FD(e){Ue(e,"svelte-13xux0b",".floorplan-plugin__room-labels.svelte-13xux0b{width:100%;height:100%;position:absolute;left:0;top:0;z-index:20;pointer-events:none}")}function py(e,n,t){const i=e.slice();return i[14]=n[t],i}function my(e){let n,t=[],i=new Map,r,s,o,a=e[10];const l=c=>c[14].id;for(let c=0;c<a.length;c+=1){let h=py(e,a,c),u=l(h);i.set(u,t[c]=gy(u,h))}return{c(){n=H("div");for(let c=0;c<t.length;c+=1)t[c].c();_(n,"class","floorplan-plugin__room-labels svelte-13xux0b")},m(c,h){Z(c,n,h);for(let u=0;u<t.length;u+=1)t[u]&&t[u].m(n,null);r=!0,s||(o=[Di(As.call(null,n)),ot(n,"clientWidth",e[13])],s=!0)},p(c,h){h&1791&&(a=c[10],Ve(),t=zi(t,h,l,1,c,a,i,n,bs,gy,null,py),Ge())},i(c){if(!r){for(let h=0;h<a.length;h+=1)F(t[h]);r=!0}},o(c){for(let h=0;h<t.length;h+=1)X(t[h]);r=!1},d(c){c&&Y(n);for(let h=0;h<t.length;h+=1)t[h].d();s=!1,yn(o)}}}function gy(e,n){let t,i,r;const s=[{pxmm:n[9],room:n[14],hoveredRoom:n[3],roomAreaEnable:n[0],roomNameEnable:n[1],roomDimensionEnable:n[2],getLabelElement:n[6],getRoomAreaText:n[4],getRoomDimensionText:n[5],adaptiveRoomLabelVisibleEnable:n[7]}];let o={};for(let a=0;a<s.length;a+=1)o=kn(o,s[a]);return i=new ND({props:o}),{key:e,first:null,c(){t=ft(),Ie(i.$$.fragment),this.first=t},m(a,l){Z(a,t,l),_e(i,a,l),r=!0},p(a,l){n=a;const c=l&1791?Vn(s,[{pxmm:n[9],room:n[14],hoveredRoom:n[3],roomAreaEnable:n[0],roomNameEnable:n[1],roomDimensionEnable:n[2],getLabelElement:n[6],getRoomAreaText:n[4],getRoomDimensionText:n[5],adaptiveRoomLabelVisibleEnable:n[7]}]):{};i.$set(c)},i(a){r||(F(i.$$.fragment,a),r=!0)},o(a){X(i.$$.fragment,a),r=!1},d(a){a&&Y(t),Se(i,a)}}}function VD(e){let n,t,i=e[10]&&my(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[10]?i?(i.p(r,s),s&1024&&F(i,1)):(i=my(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function GD(e,n,t){let i,{floorIndex:r}=n,{roomAreaEnable:s}=n,{roomNameEnable:o}=n,{roomDimensionEnable:a}=n,{floorplanData:l}=n,{hoveredRoom:c}=n,{getRoomAreaText:h}=n,{getRoomDimensionText:u}=n,{getLabelElement:d}=n,{adaptiveRoomLabelVisibleEnable:f}=n,m=0,p=0;const g=y=>{t(8,m=y.detail)};return e.$$set=y=>{"floorIndex"in y&&t(11,r=y.floorIndex),"roomAreaEnable"in y&&t(0,s=y.roomAreaEnable),"roomNameEnable"in y&&t(1,o=y.roomNameEnable),"roomDimensionEnable"in y&&t(2,a=y.roomDimensionEnable),"floorplanData"in y&&t(12,l=y.floorplanData),"hoveredRoom"in y&&t(3,c=y.hoveredRoom),"getRoomAreaText"in y&&t(4,h=y.getRoomAreaText),"getRoomDimensionText"in y&&t(5,u=y.getRoomDimensionText),"getLabelElement"in y&&t(6,d=y.getLabelElement),"adaptiveRoomLabelVisibleEnable"in y&&t(7,f=y.adaptiveRoomLabelVisibleEnable)},e.$$.update=()=>{if(e.$$.dirty&6144&&t(10,i=l.floorDatas[r].rooms),e.$$.dirty&4352){const{max:y,min:b}=l.bounding,A=y.x-b.x;t(9,p=m/A)}},[s,o,a,c,h,u,d,f,m,p,i,r,l,g]}class jD extends ke{constructor(n){super(),Le(this,n,GD,VD,De,{floorIndex:11,roomAreaEnable:0,roomNameEnable:1,roomDimensionEnable:2,floorplanData:12,hoveredRoom:3,getRoomAreaText:4,getRoomDimensionText:5,getLabelElement:6,adaptiveRoomLabelVisibleEnable:7},FD)}}function HD(e){Ue(e,"svelte-djlmk4",".floorplan-plugin__rule-labels.svelte-djlmk4.svelte-djlmk4{position:absolute;display:flex}.floorplan-plugin__rule-labels--top.svelte-djlmk4.svelte-djlmk4{left:0;top:-1.25rem}.floorplan-plugin__rule-labels--bottom.svelte-djlmk4.svelte-djlmk4{left:0;bottom:-1.25rem}.floorplan-plugin__rule-labels--left.svelte-djlmk4.svelte-djlmk4{top:0;left:-1.25rem}.floorplan-plugin__rule-labels--right.svelte-djlmk4.svelte-djlmk4{top:0;right:-1.25rem}.floorplan-plugin__rule-line.svelte-djlmk4.svelte-djlmk4{background:#fff;opacity:0.05;width:100%;height:100%}.floorplan-plugin__rule-scale-wrapper.svelte-djlmk4.svelte-djlmk4{position:absolute;width:0.3125rem;height:100%;left:50%;top:0;transform:translateX(-50%)}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-scale-wrapper.svelte-djlmk4{width:100%;height:0.3125rem;top:50%;left:0;transform:translateY(-50%)}.floorplan-plugin__rule-scale.svelte-djlmk4.svelte-djlmk4{position:absolute;background:#fff;opacity:0.05;width:100%;height:0.0625rem}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-scale.svelte-djlmk4{width:0.0625rem;height:100%}.floorplan-plugin__rule-text-wrapper.svelte-djlmk4.svelte-djlmk4{position:absolute}.floorplan-plugin__rule-labels--top.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:100%;height:0;top:0.625rem}.floorplan-plugin__rule-labels--bottom.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:100%;height:0;bottom:0.625rem}.floorplan-plugin__rule-labels--left.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:0;height:100%;left:0.625rem}.floorplan-plugin__rule-labels--right.svelte-djlmk4 .floorplan-plugin__rule-text-wrapper.svelte-djlmk4{width:0;height:100%;right:0.625rem}.floorplan-plugin__rule-text-item.svelte-djlmk4.svelte-djlmk4{width:0;height:0;position:absolute;transform:rotate(90deg)}.floorplan-plugin__rule-labels.is-row.svelte-djlmk4 .floorplan-plugin__rule-text-item.svelte-djlmk4{transform:rotate(0)}.floorplan-plugin__rule-text.svelte-djlmk4.svelte-djlmk4{width:-moz-max-content;width:max-content;transform:translate(-50%, -50%);font-size:0.625rem;color:#fff;opacity:0.2}")}function vy(e,n,t){const i=e.slice();return i[11]=n[t],i[13]=t,i}function yy(e,n,t){const i=e.slice();return i[14]=n[t],i}function by(e){let n;return{c(){n=H("div"),_(n,"class","floorplan-plugin__rule-scale svelte-djlmk4"),W(n,"left",e[14].left*100+"%"),W(n,"bottom",e[14].bottom*100+"%")},m(t,i){Z(t,n,i)},p:de,d(t){t&&Y(n)}}}function Ay(e,n){let t,i,r=n[1](n[11].distance)+"",s,o;return{key:e,first:null,c(){t=H("div"),i=H("div"),s=xt(r),o=ve(),_(i,"class","floorplan-plugin__rule-text svelte-djlmk4"),Ce(i,"is-row",n[2]),_(t,"class","floorplan-plugin__rule-text-item svelte-djlmk4"),W(t,"left",n[11].left*100+"%"),W(t,"bottom",n[11].bottom*100+"%"),this.first=t},m(a,l){Z(a,t,l),Q(t,i),Q(i,s),Q(t,o)},p(a,l){n=a,l&2&&r!==(r=n[1](n[11].distance)+"")&&Ct(s,r)},d(a){a&&Y(t)}}}function UD(e){let n,t,i,r,s,o,a=[],l=new Map,c,h=e[3],u=[];for(let m=0;m<h.length;m+=1)u[m]=by(yy(e,h,m));let d=e[4];const f=m=>m[13];for(let m=0;m<d.length;m+=1){let p=vy(e,d,m),g=f(p);l.set(g,a[m]=Ay(g,p))}return{c(){n=H("div"),t=H("div"),i=ve(),r=H("div");for(let m=0;m<u.length;m+=1)u[m].c();s=ve(),o=H("div");for(let m=0;m<a.length;m+=1)a[m].c();_(t,"class","floorplan-plugin__rule-line svelte-djlmk4"),_(r,"class","floorplan-plugin__rule-scale-wrapper svelte-djlmk4"),Ce(r,"is-row",e[2]),_(o,"class","floorplan-plugin__rule-text-wrapper svelte-djlmk4"),_(n,"class",c="floorplan-plugin__rule-labels floorplan-plugin__rule-labels--"+e[0]+" svelte-djlmk4"),Ce(n,"is-row",e[2]),W(n,"width",e[2]?"100%":1/16+"rem"),W(n,"height",e[2]?1/16+"rem":"100%")},m(m,p){Z(m,n,p),Q(n,t),Q(n,i),Q(n,r);for(let g=0;g<u.length;g+=1)u[g]&&u[g].m(r,null);Q(n,s),Q(n,o);for(let g=0;g<a.length;g+=1)a[g]&&a[g].m(o,null)},p(m,[p]){if(p&8){h=m[3];let g;for(g=0;g<h.length;g+=1){const y=yy(m,h,g);u[g]?u[g].p(y,p):(u[g]=by(y),u[g].c(),u[g].m(r,null))}for(;g<u.length;g+=1)u[g].d(1);u.length=h.length}p&22&&(d=m[4],a=zi(a,p,f,1,m,d,l,o,Mg,Ay,null,vy)),p&1&&c!==(c="floorplan-plugin__rule-labels floorplan-plugin__rule-labels--"+m[0]+" svelte-djlmk4")&&_(n,"class",c),p&5&&Ce(n,"is-row",m[2])},i:de,o:de,d(m){m&&Y(n),Oi(u,m);for(let p=0;p<a.length;p+=1)a[p].d()}}}const Oo=1e3,zo=180;function WD(e,n,t){let{type:i}=n,{data:r}=n,{bounding:s}=n,{getRuleDistanceText:o}=n;const a=i==="top"||i==="bottom",l=s.max.x-s.min.x-(Oo-zo)*2,c=s.max.y-s.min.y-(Oo-zo)*2,h=r.map(([m,p])=>a?[m.x,p.x]:[m.y,p.y]).flat().sort().filter((m,p,g)=>p===0?!0:m!==g[p-1]),u=h.map(m=>{const p=a?(m-s.min.x-Oo+zo)/l:0,g=a?0:(m-s.min.y-Oo+zo)/c;return{left:p,bottom:g}});u.unshift({left:0,bottom:0}),u.push(a?{left:1,bottom:0}:{left:0,bottom:1});const d=h[h.length-1]-h[0],f=h.map((m,p,g)=>{const y=p===0?0:m-g[p-1],b=p===0?0:(m+g[p-1])/2,A=a?(b-s.min.x-Oo+zo)/l:0,w=a?0:(b-s.min.y-Oo+zo)/c;return{left:A,bottom:w,distance:y}}).filter(({distance:m})=>m/d>.1);return e.$$set=m=>{"type"in m&&t(0,i=m.type),"data"in m&&t(5,r=m.data),"bounding"in m&&t(6,s=m.bounding),"getRuleDistanceText"in m&&t(1,o=m.getRuleDistanceText)},[i,o,a,u,f,r,s]}class QD extends ke{constructor(n){super(),Le(this,n,WD,UD,De,{type:0,data:5,bounding:6,getRuleDistanceText:1},HD)}}function YD(e){Ue(e,"svelte-1mzj9p3",".floorplan-plugin__rule-labels-wrapper.svelte-1mzj9p3{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none}")}function wy(e,n,t){const i=e.slice();return i[13]=n[t][0],i[14]=n[t][1],i}function xy(e,n){let t,i,r;const s=[{type:n[13],data:n[14],bounding:n[1],getRuleDistanceText:n[0]}];let o={};for(let a=0;a<s.length;a+=1)o=kn(o,s[a]);return i=new QD({props:o}),{key:e,first:null,c(){t=ft(),Ie(i.$$.fragment),this.first=t},m(a,l){Z(a,t,l),_e(i,a,l),r=!0},p(a,l){n=a;const c=l&19?Vn(s,[{type:n[13],data:n[14],bounding:n[1],getRuleDistanceText:n[0]}]):{};i.$set(c)},i(a){r||(F(i.$$.fragment,a),r=!0)},o(a){X(i.$$.fragment,a),r=!1},d(a){a&&Y(t),Se(i,a)}}}function XD(e){let n,t=[],i=new Map,r,s=e[4];const o=a=>a[13];for(let a=0;a<s.length;a+=1){let l=wy(e,s,a),c=o(l);i.set(c,t[a]=xy(c,l))}return{c(){n=H("div");for(let a=0;a<t.length;a+=1)t[a].c();_(n,"class","floorplan-plugin__rule-labels-wrapper svelte-1mzj9p3"),W(n,"width",e[3]),W(n,"height",e[2])},m(a,l){Z(a,n,l);for(let c=0;c<t.length;c+=1)t[c]&&t[c].m(n,null);r=!0},p(a,[l]){l&19&&(s=a[4],Ve(),t=zi(t,l,o,1,a,s,i,n,bs,xy,null,wy),Ge()),l&8&&W(n,"width",a[3]),l&4&&W(n,"height",a[2])},i(a){if(!r){for(let l=0;l<s.length;l+=1)F(t[l]);r=!0}},o(a){for(let l=0;l<t.length;l+=1)X(t[l]);r=!1},d(a){a&&Y(n);for(let l=0;l<t.length;l+=1)t[l].d()}}}const My=1e3,Ey=180;function ZD(e,n,t){let i,r,s,o,a,l,c,h,u,d,{floorIndex:f}=n,{floorplanData:m}=n,{getRuleDistanceText:p}=n;return e.$$set=g=>{"floorIndex"in g&&t(5,f=g.floorIndex),"floorplanData"in g&&t(6,m=g.floorplanData),"getRuleDistanceText"in g&&t(0,p=g.getRuleDistanceText)},e.$$.update=()=>{e.$$.dirty&64&&t(1,i=m.bounding),e.$$.dirty&96&&t(11,r=m.floorDatas[f].rules),e.$$.dirty&2048&&t(12,s=Object.keys(r)),e.$$.dirty&6144&&t(4,o=s.map(g=>[g,r[g]])),e.$$.dirty&2&&t(9,a=i.max.x-i.min.x),e.$$.dirty&2&&t(7,l=i.max.y-i.min.y),e.$$.dirty&2&&t(10,c=i.max.x-i.min.x-(My-Ey)*2),e.$$.dirty&2&&t(8,h=i.max.y-i.min.y-(My-Ey)*2),e.$$.dirty&1536&&t(3,u=c/a*100+"%"),e.$$.dirty&384&&t(2,d=h/l*100+"%")},[p,i,d,u,o,f,m,l,h,a,c,r,s]}class JD extends ke{constructor(n){super(),Le(this,n,ZD,XD,De,{floorIndex:5,floorplanData:6,getRuleDistanceText:0},YD)}}function Rd(e,n={}){let t="";const{needZ:i,needA:r}=n;return(i?e.slice().concat(e[0]):e.slice()).forEach((o,a)=>{const{x:l,y:c}=n.format?n.format(o):o,h=l+","+c;return a===0?(t+="M"+h,t):r!=null&&r[a]?(t+="A"+r[a]+","+h,t):(t+="L"+h,t)}),t+(i?"Z":"")}function Px({x:e,y:n},t){const{max:i,min:r}=t;return{x:e-r.x,y:i.y-n}}function qD(e,n){const t=e.x*1e3+n.bounding.origin.x,i=-e.z*1e3+n.bounding.origin.y;return{x:t,y:i}}function KD(e,n){const t=n.bounding,i=t.max.x-t.min.x,r=t.max.y-t.min.y;return{x:(e.x-t.min.x)/i,y:(t.max.y-e.y)/r}}function $D(e,n){return Math.max(...n.work.observers.map(i=>e.z>=i.standingPosition.z?i.floorIndex:0))}function eL(e){let n;return{c(){n=Bt("path"),_(n,"d",e[0]),_(n,"fill","#2F313A")},m(t,i){Z(t,n,i)},p(t,[i]){i&1&&_(n,"d",t[0])},i:de,o:de,d(t){t&&Y(n)}}}function tL(e,n,t){let i,{path:r}=n;return e.$$set=s=>{"path"in s&&t(1,r=s.path)},e.$$.update=()=>{e.$$.dirty&2&&t(0,i=Rd(r,{needZ:!0}))},[i,r]}class nL extends ke{constructor(n){super(),Le(this,n,tL,eL,De,{path:1})}}function iL(e){let n,t,i,r,s,o;return{c(){n=Bt("defs"),t=Bt("pattern"),i=Bt("rect"),r=Bt("path"),s=ve(),o=Bt("path"),_(i,"x","0"),_(i,"y","0"),_(i,"width",e[1]),_(i,"height",e[1]),_(i,"fill","#323747"),_(r,"d",e[2]),_(r,"stroke","#ffffff"),_(r,"stroke-opacity","0.06"),_(r,"stroke-width","0.5"),_(r,"fill","none"),_(t,"id","fpm-room-pattern-0"),_(t,"x","0"),_(t,"y","0"),_(t,"width",e[1]),_(t,"height",e[1]),_(t,"patternUnits","userSpaceOnUse"),_(t,"patternTransform","scale(50 50)"),_(o,"d",e[0]),_(o,"fill","url(#fpm-room-pattern-0)")},m(a,l){Z(a,n,l),Q(n,t),Q(t,i),Q(t,r),Z(a,s,l),Z(a,o,l)},p(a,[l]){l&1&&_(o,"d",a[0])},i:de,o:de,d(a){a&&Y(n),a&&Y(s),a&&Y(o)}}}const ep=6;function rL(e,n,t){let i,{path:r}=n;const s=ep*2,o=`M0 ${ep} h ${s} M${ep} 0 v ${s}`;return e.$$set=a=>{"path"in a&&t(3,r=a.path)},e.$$.update=()=>{e.$$.dirty&8&&t(0,i=Rd(r,{needZ:!0}))},[i,s,o,r]}class sL extends ke{constructor(n){super(),Le(this,n,rL,iL,De,{path:3})}}function oL(e){let n,t,i,r,s,o,a,l,c,h,u;return{c(){n=Bt("defs"),t=Bt("pattern"),i=Bt("rect"),r=Bt("pattern"),s=Bt("rect"),o=ve(),a=Bt("path"),l=ve(),c=Bt("path"),h=ve(),u=Bt("path"),_(i,"x","0"),_(i,"y","0"),_(i,"width","6"),_(i,"height","50"),_(i,"fill","none"),_(i,"stroke","#4B4B57"),_(i,"stroke-width","0.5"),_(t,"id","room-material-pattern-1"),_(t,"x","0"),_(t,"y","0"),_(t,"width","12"),_(t,"height","50"),_(t,"patternUnits","userSpaceOnUse"),_(t,"patternTransform","scale(50 50)"),_(s,"x","0"),_(s,"y","0"),_(s,"width","6"),_(s,"height","50"),_(s,"fill","none"),_(s,"stroke","#4B4B57"),_(s,"stroke-width","0.5"),_(r,"id","room-material-pattern-2"),_(r,"x","6"),_(r,"y","25"),_(r,"width","12"),_(r,"height","50"),_(r,"patternUnits","userSpaceOnUse"),_(r,"patternTransform","scale(50 50)"),_(a,"d",e[0]),_(a,"fill","#43434D"),_(c,"d",e[0]),_(c,"fill","url(#room-material-pattern-1)"),_(u,"d",e[0]),_(u,"fill","url(#room-material-pattern-2)")},m(d,f){Z(d,n,f),Q(n,t),Q(t,i),Q(n,r),Q(r,s),Z(d,o,f),Z(d,a,f),Z(d,l,f),Z(d,c,f),Z(d,h,f),Z(d,u,f)},p(d,[f]){f&1&&_(a,"d",d[0]),f&1&&_(c,"d",d[0]),f&1&&_(u,"d",d[0])},i:de,o:de,d(d){d&&Y(n),d&&Y(o),d&&Y(a),d&&Y(l),d&&Y(c),d&&Y(h),d&&Y(u)}}}function aL(e,n,t){let i,{path:r}=n;return e.$$set=s=>{"path"in s&&t(1,r=s.path)},e.$$.update=()=>{e.$$.dirty&2&&t(0,i=Rd(r,{needZ:!0}))},[i,r]}class lL extends ke{constructor(n){super(),Le(this,n,aL,oL,De,{path:1})}}function cL(e){Ue(e,"svelte-1dykexu",".floorplan-plugin__room-material.svelte-1dykexu{position:absolute;left:0;top:0;width:100%;height:100%}svg.svelte-1dykexu{position:absolute;left:0;top:0;width:100%;height:100%;overflow:visible}")}function Cy(e,n,t){const i=e.slice();return i[5]=n[t],i}function hL(e){let n,t;return n=new sL({props:{path:e[5].path}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.path=i[5].path),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function uL(e){let n,t;return n=new lL({props:{path:e[5].path}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.path=i[5].path),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function dL(e){let n,t;return n=new nL({props:{path:e[5].path}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.path=i[5].path),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function Py(e){let n,t,i,r;const s=[dL,uL,hL],o=[];function a(l,c){return l[5].floorType===1?0:l[5].floorType===0?1:2}return t=a(e),i=o[t]=s[t](e),{c(){n=Bt("svg"),i.c(),_(n,"width","100%"),_(n,"height","100%"),_(n,"viewBox",`0 0 ${e[1]} ${e[2]}`),_(n,"class","svelte-1dykexu")},m(l,c){Z(l,n,c),o[t].m(n,null),r=!0},p(l,c){let h=t;t=a(l),t===h?o[t].p(l,c):(Ve(),X(o[h],1,1,()=>{o[h]=null}),Ge(),i=o[t],i?i.p(l,c):(i=o[t]=s[t](l),i.c()),F(i,1),i.m(n,null))},i(l){r||(F(i),r=!0)},o(l){X(i),r=!1},d(l){l&&Y(n),o[t].d()}}}function fL(e){let n,t,i=e[0],r=[];for(let o=0;o<i.length;o+=1)r[o]=Py(Cy(e,i,o));const s=o=>X(r[o],1,1,()=>{r[o]=null});return{c(){n=H("div");for(let o=0;o<r.length;o+=1)r[o].c();_(n,"class","floorplan-plugin__room-material svelte-1dykexu")},m(o,a){Z(o,n,a);for(let l=0;l<r.length;l+=1)r[l]&&r[l].m(n,null);t=!0},p(o,[a]){if(a&7){i=o[0];let l;for(l=0;l<i.length;l+=1){const c=Cy(o,i,l);r[l]?(r[l].p(c,a),F(r[l],1)):(r[l]=Py(c),r[l].c(),F(r[l],1),r[l].m(n,null))}for(Ve(),l=i.length;l<r.length;l+=1)s(l);Ge()}},i(o){if(!t){for(let a=0;a<i.length;a+=1)F(r[a]);t=!0}},o(o){r=r.filter(Boolean);for(let a=0;a<r.length;a+=1)X(r[a]);t=!1},d(o){o&&Y(n),Oi(r,o)}}}function pL(e,n,t){let i,{floorIndex:r}=n,{floorplanData:s}=n;const o=s.bounding.max.x-s.bounding.min.x,a=s.bounding.max.y-s.bounding.min.y;return e.$$set=l=>{"floorIndex"in l&&t(3,r=l.floorIndex),"floorplanData"in l&&t(4,s=l.floorplanData)},e.$$.update=()=>{e.$$.dirty&24&&t(0,i=s.floorDatas[r].rooms.map(l=>Ee(R({},l),{path:l.path.map(c=>Px(c,s.bounding))})))},[i,o,a,r,s]}class mL extends ke{constructor(n){super(),Le(this,n,pL,fL,De,{floorIndex:3,floorplanData:4},cL)}}function gL(e){Ue(e,"svelte-qq2273","path.svelte-qq2273{--opacity:0;opacity:var(--opacity)}path.svelte-qq2273:hover{opacity:calc(var(--opacity) + 0.1)}")}function vL(e){let n,t,i,r;return{c(){n=Bt("path"),_(n,"d",e[5]),_(n,"fill","#fff"),_(n,"style",e[2]),_(n,"id",t=`${e[1]}_${e[0].id}`),_(n,"class","svelte-qq2273")},m(s,o){Z(s,n,o),i||(r=[ot(n,"mouseenter",e[3]),ot(n,"mouseleave",e[4])],i=!0)},p(s,[o]){o&4&&_(n,"style",s[2]),o&3&&t!==(t=`${s[1]}_${s[0].id}`)&&_(n,"id",t)},i:de,o:de,d(s){s&&Y(n),i=!1,yn(r)}}}function yL(e,n,t){let i,r,{room:s}=n,{floorIndex:o}=n,{floorplanData:a}=n,{highlightData:l}=n,{hoveredRoom:c}=n;function h(){c==null||c.set(s)}function u(){c==null||c.set(void 0)}const{bounding:d}=a,f=Rd(s.path,{needZ:!0,format:m=>Px(m,d)});return e.$$set=m=>{"room"in m&&t(0,s=m.room),"floorIndex"in m&&t(1,o=m.floorIndex),"floorplanData"in m&&t(6,a=m.floorplanData),"highlightData"in m&&t(7,l=m.highlightData),"hoveredRoom"in m&&t(8,c=m.hoveredRoom)},e.$$.update=()=>{e.$$.dirty&131&&t(9,i=l[`${o}_${s.id}`]),e.$$.dirty&512&&t(2,r=i?`fill: ${i.color}; --opacity: ${i.opacity}; pointer-events: ${i.disabled?"none":"auto"}`:null)},[s,o,r,h,u,f,a,l,c,i]}class bL extends ke{constructor(n){super(),Le(this,n,yL,vL,De,{room:0,floorIndex:1,floorplanData:6,highlightData:7,hoveredRoom:8},gL)}}function AL(e){Ue(e,"svelte-1kqo6e4",".floorplan-plugin__room-highlight.svelte-1kqo6e4{position:absolute;width:100%;height:100%}svg.svelte-1kqo6e4{width:100%;height:100%;overflow:visible}")}function _y(e,n,t){const i=e.slice();return i[6]=n[t],i}function Sy(e,n){let t,i,r;const s=[{room:n[6],floorplanData:n[1],hoveredRoom:n[3],floorIndex:n[0],highlightData:n[2]}];let o={};for(let a=0;a<s.length;a+=1)o=kn(o,s[a]);return i=new bL({props:o}),{key:e,first:null,c(){t=ft(),Ie(i.$$.fragment),this.first=t},m(a,l){Z(a,t,l),_e(i,a,l),r=!0},p(a,l){n=a;const c=l&15?Vn(s,[{room:n[6],floorplanData:n[1],hoveredRoom:n[3],floorIndex:n[0],highlightData:n[2]}]):{};i.$set(c)},i(a){r||(F(i.$$.fragment,a),r=!0)},o(a){X(i.$$.fragment,a),r=!1},d(a){a&&Y(t),Se(i,a)}}}function wL(e){let n,t,i=[],r=new Map,s,o=e[1].floorDatas[e[0]].rooms;const a=l=>l[6].id;for(let l=0;l<o.length;l+=1){let c=_y(e,o,l),h=a(c);r.set(h,i[l]=Sy(h,c))}return{c(){n=H("div"),t=Bt("svg");for(let l=0;l<i.length;l+=1)i[l].c();_(t,"width","100%"),_(t,"height","100%"),_(t,"viewBox",`0 0 ${e[4]} ${e[5]}`),_(t,"class","svelte-1kqo6e4"),_(n,"class","floorplan-plugin__room-highlight svelte-1kqo6e4")},m(l,c){Z(l,n,c),Q(n,t);for(let h=0;h<i.length;h+=1)i[h]&&i[h].m(t,null);s=!0},p(l,[c]){c&15&&(o=l[1].floorDatas[l[0]].rooms,Ve(),i=zi(i,c,a,1,l,o,r,t,bs,Sy,null,_y),Ge())},i(l){if(!s){for(let c=0;c<o.length;c+=1)F(i[c]);s=!0}},o(l){for(let c=0;c<i.length;c+=1)X(i[c]);s=!1},d(l){l&&Y(n);for(let c=0;c<i.length;c+=1)i[c].d()}}}function xL(e,n,t){let{floorIndex:i}=n,{floorplanData:r}=n,{highlightData:s}=n,{hoveredRoom:o}=n;const a=r.bounding.max.x-r.bounding.min.x,l=r.bounding.max.y-r.bounding.min.y;return e.$$set=c=>{"floorIndex"in c&&t(0,i=c.floorIndex),"floorplanData"in c&&t(1,r=c.floorplanData),"highlightData"in c&&t(2,s=c.highlightData),"hoveredRoom"in c&&t(3,o=c.hoveredRoom)},[i,r,s,o,a,l]}class _x extends ke{constructor(n){super(),Le(this,n,xL,wL,De,{floorIndex:0,floorplanData:1,highlightData:2,hoveredRoom:3},AL)}}function ML(e){Ue(e,"svelte-1lm20n5",".missing-floor.svelte-1lm20n5{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);display:flex;flex-direction:column;align-items:center}.text.svelte-1lm20n5{margin-top:0.75rem;color:#fff;opacity:0.3}")}function Iy(e){let n,t=e[0].text+"",i;return{c(){n=H("span"),i=xt(t),_(n,"class","text svelte-1lm20n5"),W(n,"font-size",e[0].textFontSize+"px")},m(r,s){Z(r,n,s),Q(n,i)},p(r,s){s&1&&t!==(t=r[0].text+"")&&Ct(i,t),s&1&&W(n,"font-size",r[0].textFontSize+"px")},d(r){r&&Y(n)}}}function EL(e){let n,t,i,r,s=e[0].text&&Iy(e);return{c(){n=H("div"),t=H("img"),r=ve(),s&&s.c(),_(t,"class","image"),_(t,"alt","缺省楼层展位图"),Pn(t.src,i=e[0].imageURL)||_(t,"src",i),W(t,"width",e[0].imageWidth+"px"),W(t,"height",e[0].imageHeight+"px"),_(n,"class","missing-floor svelte-1lm20n5")},m(o,a){Z(o,n,a),Q(n,t),Q(n,r),s&&s.m(n,null)},p(o,[a]){a&1&&!Pn(t.src,i=o[0].imageURL)&&_(t,"src",i),a&1&&W(t,"width",o[0].imageWidth+"px"),a&1&&W(t,"height",o[0].imageHeight+"px"),o[0].text?s?s.p(o,a):(s=Iy(o),s.c(),s.m(n,null)):s&&(s.d(1),s=null)},i:de,o:de,d(o){o&&Y(n),s&&s.d()}}}function CL(e,n,t){let{missingFloorConfig:i}=n;return e.$$set=r=>{"missingFloorConfig"in r&&t(0,i=r.missingFloorConfig)},[i]}class PL extends ke{constructor(n){super(),Le(this,n,CL,EL,De,{missingFloorConfig:0},ML)}}const ps="data:image/png;base64,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";function Pg(e){return e*180/Math.PI}function _L(e){Ue(e,"svelte-17cl35n",".floorplan__camera-position.svelte-17cl35n{position:absolute;width:0;height:0}.floorplan__camera-rotate.svelte-17cl35n{position:absolute;background-repeat:no-repeat;background-size:100%}")}function SL(e){let n,t;return{c(){n=H("div"),t=H("div"),_(t,"class","floorplan__camera-rotate svelte-17cl35n"),W(t,"background-image",`url(${e[0]||ps})`),W(t,"width",e[4]),W(t,"height",e[4]),W(t,"left","-"+e[4]),W(t,"top","-"+e[4]),W(t,"transform",`rotate(${e[3]}deg)`),W(t,"transform-origin",`${e[4]} ${e[4]}`),_(n,"class","floorplan__camera-position svelte-17cl35n"),W(n,"left",e[1]),W(n,"top",e[2])},m(i,r){Z(i,n,r),Q(n,t)},p(i,[r]){r&1&&W(t,"background-image",`url(${i[0]||ps})`);const s=r&1;s&&W(t,"width",i[4]),s&&W(t,"height",i[4]),s&&W(t,"left","-"+i[4]),s&&W(t,"top","-"+i[4]),s&&W(t,"transform",`rotate(${i[3]}deg)`),s&&W(t,"transform-origin",`${i[4]} ${i[4]}`)},i:de,o:de,d(i){i&&Y(n)}}}function IL(e,n,t){let{panoIndex:i}=n,{floorplanData:r}=n,{lastPanoramaLongitude:s}=n,{cameraImageUrl:o}=n;const{observers:a}=r,l=a[i],c=l.positionInImage.x,h=l.positionInImage.y,u=c*100+"%",d=h*100+"%",f=-Pg(s)+45,m=document.body.clientWidth,p=document.body.clientHeight,y=`${(m<500||p<500?17:37)/16}rem`;return e.$$set=b=>{"panoIndex"in b&&t(5,i=b.panoIndex),"floorplanData"in b&&t(6,r=b.floorplanData),"lastPanoramaLongitude"in b&&t(7,s=b.lastPanoramaLongitude),"cameraImageUrl"in b&&t(0,o=b.cameraImageUrl)},[o,u,d,f,y,i,r,s]}let TL=class extends ke{constructor(n){super(),Le(this,n,IL,SL,De,{panoIndex:5,floorplanData:6,lastPanoramaLongitude:7,cameraImageUrl:0},_L)}};const DL="data:image/png;base64,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";function LL(e){Ue(e,"svelte-rpkaro",".floorplan-plugin__compass.svelte-rpkaro{position:absolute;left:50%;top:-2.875rem;width:14.4375rem;height:2.5625rem;will-change:opacity;transform-origin:center 11.5rem}.floorplan-plugin__compass-image.svelte-rpkaro{width:100%;height:100%;position:absolute;left:0;top:0;opacity:0.1;background-repeat:no-repeat;background-size:100% 100%}.floorplan-plugin__compass-text.svelte-rpkaro{position:absolute;left:50%;top:0.9375rem;transform:translateX(-50%);opacity:0.2;font-weight:bold;font-size:0.625rem;color:#fff}")}function kL(e){let n,t,i,r,s;return{c(){n=H("div"),t=H("div"),i=ve(),r=H("span"),s=xt(e[0]),_(t,"class","floorplan-plugin__compass-image svelte-rpkaro"),W(t,"background-image",`url(${DL})`),_(r,"class","floorplan-plugin__compass-text svelte-rpkaro"),_(n,"class","floorplan-plugin__compass svelte-rpkaro"),W(n,"transform",e[2])},m(o,a){Z(o,n,a),Q(n,t),Q(n,i),Q(n,r),Q(r,s)},p(o,a){a&1&&Ct(s,o[0])},d(o){o&&Y(n)}}}function RL(e){let n,t=e[1]&&kL(e);return{c(){t&&t.c(),n=ft()},m(i,r){t&&t.m(i,r),Z(i,n,r)},p(i,[r]){i[1]&&t.p(i,r)},i:de,o:de,d(i){t&&t.d(i),i&&Y(n)}}}function OL(e,n,t){var c;let{floorplanData:i}=n,{northDesc:r}=n;const s=(c=i.entrance)==null?void 0:c.northRad,o=typeof s=="number",l=`translateX(-50%) translateZ(10px) rotate(${-(s?Pg(s):0)+90}deg)`;return e.$$set=h=>{"floorplanData"in h&&t(3,i=h.floorplanData),"northDesc"in h&&t(0,r=h.northDesc)},[r,o,l,i]}class zL extends ke{constructor(n){super(),Le(this,n,OL,RL,De,{floorplanData:3,northDesc:0},LL)}}function BL(e){Ue(e,"svelte-bl8zrz",".floorplan-plugin__floor.svelte-bl8zrz{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0;pointer-events:none}.floorplan-plugin__floor--is-current.svelte-bl8zrz{opacity:1;pointer-events:auto}")}function NL(e){let n,t,i,r,s,o,a,l,c,h;const u=[{floorIndex:e[2],floorplanData:e[11]}];let d={};for(let w=0;w<u.length;w+=1)d=kn(d,u[w]);n=new mL({props:d});let f=(e[3]||e[5])&&Ty(e);const m=[{floorplanData:e[11],floorIndex:e[2]}];let p={};for(let w=0;w<m.length;w+=1)p=kn(p,m[w]);r=new Cx({props:p});let g=e[6]&&Dy(e),y=e[10]&&Ly(e),b=e[4]&&ky(e),A=e[22]&&Ry(e);return{c(){Ie(n.$$.fragment),t=ve(),f&&f.c(),i=ve(),Ie(r.$$.fragment),s=ve(),g&&g.c(),o=ve(),y&&y.c(),a=ve(),b&&b.c(),l=ve(),A&&A.c(),c=ft()},m(w,x){_e(n,w,x),Z(w,t,x),f&&f.m(w,x),Z(w,i,x),_e(r,w,x),Z(w,s,x),g&&g.m(w,x),Z(w,o,x),y&&y.m(w,x),Z(w,a,x),b&&b.m(w,x),Z(w,l,x),A&&A.m(w,x),Z(w,c,x),h=!0},p(w,x){const M=x&2052?Vn(u,[{floorIndex:w[2],floorplanData:w[11]}]):{};n.$set(M),w[3]||w[5]?f?(f.p(w,x),x&40&&F(f,1)):(f=Ty(w),f.c(),F(f,1),f.m(i.parentNode,i)):f&&(Ve(),X(f,1,1,()=>{f=null}),Ge());const P=x&2052?Vn(m,[{floorplanData:w[11],floorIndex:w[2]}]):{};r.$set(P),w[6]?g?(g.p(w,x),x&64&&F(g,1)):(g=Dy(w),g.c(),F(g,1),g.m(o.parentNode,o)):g&&(Ve(),X(g,1,1,()=>{g=null}),Ge()),w[10]?y?(y.p(w,x),x&1024&&F(y,1)):(y=Ly(w),y.c(),F(y,1),y.m(a.parentNode,a)):y&&(Ve(),X(y,1,1,()=>{y=null}),Ge()),w[4]?b?(b.p(w,x),x&16&&F(b,1)):(b=ky(w),b.c(),F(b,1),b.m(l.parentNode,l)):b&&(Ve(),X(b,1,1,()=>{b=null}),Ge()),w[22]?A?(A.p(w,x),x&4194304&&F(A,1)):(A=Ry(w),A.c(),F(A,1),A.m(c.parentNode,c)):A&&(Ve(),X(A,1,1,()=>{A=null}),Ge())},i(w){h||(F(n.$$.fragment,w),F(f),F(r.$$.fragment,w),F(g),F(y),F(b),F(A),h=!0)},o(w){X(n.$$.fragment,w),X(f),X(r.$$.fragment,w),X(g),X(y),X(b),X(A),h=!1},d(w){Se(n,w),w&&Y(t),f&&f.d(w),w&&Y(i),Se(r,w),w&&Y(s),g&&g.d(w),w&&Y(o),y&&y.d(w),w&&Y(a),b&&b.d(w),w&&Y(l),A&&A.d(w),w&&Y(c)}}}function FL(e){let n,t;return n=new PL({props:{missingFloorConfig:e[18]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&262144&&(s.missingFloorConfig=i[18]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function Ty(e){let n,t;const i=[{floorIndex:e[2],floorplanData:e[11],hoveredRoom:e[24],highlightData:e[17]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new _x({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&16910340?Vn(i,[{floorIndex:s[2],floorplanData:s[11],hoveredRoom:s[24],highlightData:s[17]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function Dy(e){let n,t;const i=[{floorplanData:e[11],roomAreaEnable:e[7],roomNameEnable:e[8],roomDimensionEnable:e[9],floorIndex:e[2],getRoomAreaText:e[12],getRoomDimensionText:e[13],getLabelElement:e[14],hoveredRoom:e[24],adaptiveRoomLabelVisibleEnable:e[16]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new jD({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&16874372?Vn(i,[{floorplanData:s[11],roomAreaEnable:s[7],roomNameEnable:s[8],roomDimensionEnable:s[9],floorIndex:s[2],getRoomAreaText:s[12],getRoomDimensionText:s[13],getLabelElement:s[14],hoveredRoom:s[24],adaptiveRoomLabelVisibleEnable:s[16]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function Ly(e){let n,t;const i=[{floorplanData:e[11],floorIndex:e[2],getRuleDistanceText:e[15]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new JD({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&34820?Vn(i,[{floorplanData:s[11],floorIndex:s[2],getRuleDistanceText:s[15]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function ky(e){let n,t;const i=[{panoIndex:e[0],floorplanData:e[11],lastPanoramaLongitude:e[19],cameraImageUrl:e[20]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new TL({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&1574913?Vn(i,[{panoIndex:s[0],floorplanData:s[11],lastPanoramaLongitude:s[19],cameraImageUrl:s[20]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function Ry(e){let n,t;return n=new zL({props:{floorplanData:e[11],northDesc:e[21]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&2048&&(s.floorplanData=i[11]),r&2097152&&(s.northDesc=i[21]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function VL(e){let n,t,i,r,s;const o=[FL,NL],a=[];function l(c,h){return c[23]?1:0}return t=l(e),i=a[t]=o[t](e),{c(){n=H("div"),i.c(),_(n,"class",r=on(`floorplan-plugin__floor${e[1]?" floorplan-plugin__floor--is-current":""}`)+" svelte-bl8zrz")},m(c,h){Z(c,n,h),a[t].m(n,null),s=!0},p(c,[h]){let u=t;t=l(c),t===u?a[t].p(c,h):(Ve(),X(a[u],1,1,()=>{a[u]=null}),Ge(),i=a[t],i?i.p(c,h):(i=a[t]=o[t](c),i.c()),F(i,1),i.m(n,null)),(!s||h&2&&r!==(r=on(`floorplan-plugin__floor${c[1]?" floorplan-plugin__floor--is-current":""}`)+" svelte-bl8zrz"))&&_(n,"class",r)},i(c){s||(F(i),s=!0)},o(c){X(i),s=!1},d(c){c&&Y(n),a[t].d()}}}function GL(e,n,t){let i,r,{panoIndex:s}=n,{isCurrent:o}=n,{floorIndex:a}=n,{highlightEnable:l}=n,{cameraEnable:c}=n,{hoverEnable:h}=n,{roomLabelsEnable:u}=n,{roomAreaEnable:d}=n,{roomNameEnable:f}=n,{roomDimensionEnable:m}=n,{ruleLabelsEnable:p}=n,{floorplanData:g}=n,{getRoomAreaText:y}=n,{getRoomDimensionText:b}=n,{getLabelElement:A}=n,{getRuleDistanceText:w}=n,{adaptiveRoomLabelVisibleEnable:x}=n,{highlightData:M}=n,{missingFloorConfig:P}=n,{lastPanoramaLongitude:S}=n,{cameraImageUrl:T}=n,{northDesc:z}=n,{compassEnable:D}=n;const k=Cg(void 0);return e.$$set=O=>{"panoIndex"in O&&t(0,s=O.panoIndex),"isCurrent"in O&&t(1,o=O.isCurrent),"floorIndex"in O&&t(2,a=O.floorIndex),"highlightEnable"in O&&t(3,l=O.highlightEnable),"cameraEnable"in O&&t(4,c=O.cameraEnable),"hoverEnable"in O&&t(5,h=O.hoverEnable),"roomLabelsEnable"in O&&t(6,u=O.roomLabelsEnable),"roomAreaEnable"in O&&t(7,d=O.roomAreaEnable),"roomNameEnable"in O&&t(8,f=O.roomNameEnable),"roomDimensionEnable"in O&&t(9,m=O.roomDimensionEnable),"ruleLabelsEnable"in O&&t(10,p=O.ruleLabelsEnable),"floorplanData"in O&&t(11,g=O.floorplanData),"getRoomAreaText"in O&&t(12,y=O.getRoomAreaText),"getRoomDimensionText"in O&&t(13,b=O.getRoomDimensionText),"getLabelElement"in O&&t(14,A=O.getLabelElement),"getRuleDistanceText"in O&&t(15,w=O.getRuleDistanceText),"adaptiveRoomLabelVisibleEnable"in O&&t(16,x=O.adaptiveRoomLabelVisibleEnable),"highlightData"in O&&t(17,M=O.highlightData),"missingFloorConfig"in O&&t(18,P=O.missingFloorConfig),"lastPanoramaLongitude"in O&&t(19,S=O.lastPanoramaLongitude),"cameraImageUrl"in O&&t(20,T=O.cameraImageUrl),"northDesc"in O&&t(21,z=O.northDesc),"compassEnable"in O&&t(22,D=O.compassEnable)},e.$$.update=()=>{e.$$.dirty&2052&&t(25,i=g.floorDatas[a]),e.$$.dirty&33554432&&t(23,r=i.rooms.length>0)},[s,o,a,l,c,h,u,d,f,m,p,g,y,b,A,w,x,M,P,S,T,z,D,r,k,i]}let jL=class extends ke{constructor(n){super(),Le(this,n,GL,VL,De,{panoIndex:0,isCurrent:1,floorIndex:2,highlightEnable:3,cameraEnable:4,hoverEnable:5,roomLabelsEnable:6,roomAreaEnable:7,roomNameEnable:8,roomDimensionEnable:9,ruleLabelsEnable:10,floorplanData:11,getRoomAreaText:12,getRoomDimensionText:13,getLabelElement:14,getRuleDistanceText:15,adaptiveRoomLabelVisibleEnable:16,highlightData:17,missingFloorConfig:18,lastPanoramaLongitude:19,cameraImageUrl:20,northDesc:21,compassEnable:22},BL)}};function HL(e){Ue(e,"svelte-86bqav",".floorplan-main.svelte-86bqav{width:100%;height:100%;pointer-events:none}")}function Oy(e,n,t){const i=e.slice();return i[24]=n[t],i}function zy(e){let n,t,i,r=e[14].floorDatas,s=[];for(let a=0;a<r.length;a+=1)s[a]=By(Oy(e,r,a));const o=a=>X(s[a],1,1,()=>{s[a]=null});return{c(){n=H("div");for(let a=0;a<s.length;a+=1)s[a].c();_(n,"class","floorplan-main svelte-86bqav")},m(a,l){Z(a,n,l);for(let c=0;c<s.length;c+=1)s[c]&&s[c].m(n,null);i=!0},p(a,l){if(e=a,l&16777212){r=e[14].floorDatas;let c;for(c=0;c<r.length;c+=1){const h=Oy(e,r,c);s[c]?(s[c].p(h,l),F(s[c],1)):(s[c]=By(h),s[c].c(),F(s[c],1),s[c].m(n,null))}for(Ve(),c=r.length;c<s.length;c+=1)o(c);Ge()}},i(a){if(!i){for(let l=0;l<r.length;l+=1)F(s[l]);t||an(()=>{t=ys(n,_n,{duration:e[0],easing:Rr}),t.start()}),i=!0}},o(a){s=s.filter(Boolean);for(let l=0;l<s.length;l+=1)X(s[l]);i=!1},d(a){a&&Y(n),Oi(s,a)}}}function By(e){let n,t;const i=[{hoverEnable:e[6],highlightEnable:e[7],floorplanData:e[14],getRoomAreaText:e[17],getRoomDimensionText:e[18],getLabelElement:e[19],getRuleDistanceText:e[20],roomLabelsEnable:e[9],roomAreaEnable:e[10],roomNameEnable:e[11],roomDimensionEnable:e[12],ruleLabelsEnable:e[13],adaptiveRoomLabelVisibleEnable:e[21],highlightData:e[22],missingFloorConfig:e[23],panoIndex:e[3],cameraEnable:e[5],cameraImageUrl:e[16],lastPanoramaLongitude:e[15],compassEnable:e[8],northDesc:e[2]},{floorIndex:e[24].floorIndex},{isCurrent:e[24].floorIndex===e[4]}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new jL({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&16777212?Vn(i,[o&16777196&&{hoverEnable:s[6],highlightEnable:s[7],floorplanData:s[14],getRoomAreaText:s[17],getRoomDimensionText:s[18],getLabelElement:s[19],getRuleDistanceText:s[20],roomLabelsEnable:s[9],roomAreaEnable:s[10],roomNameEnable:s[11],roomDimensionEnable:s[12],ruleLabelsEnable:s[13],adaptiveRoomLabelVisibleEnable:s[21],highlightData:s[22],missingFloorConfig:s[23],panoIndex:s[3],cameraEnable:s[5],cameraImageUrl:s[16],lastPanoramaLongitude:s[15],compassEnable:s[8],northDesc:s[2]},o&16384&&{floorIndex:s[24].floorIndex},o&16400&&{isCurrent:s[24].floorIndex===s[4]}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function UL(e){let n,t,i=e[1]&&zy(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[1]?i?(i.p(r,s),s&2&&F(i,1)):(i=zy(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function WL(e,n,t){let{duration:i=0}=n,{visible:r}=n,{northDesc:s}=n,{panoIndex:o}=n,{floorIndex:a}=n,{cameraEnable:l}=n,{hoverEnable:c}=n,{highlightEnable:h}=n,{compassEnable:u}=n,{roomLabelsEnable:d}=n,{roomAreaEnable:f}=n,{roomNameEnable:m}=n,{roomDimensionEnable:p}=n,{ruleLabelsEnable:g}=n,{floorplanData:y}=n,{lastPanoramaLongitude:b}=n,{cameraImageUrl:A}=n,{getRoomAreaText:w}=n,{getRoomDimensionText:x}=n,{getLabelElement:M}=n,{getRuleDistanceText:P}=n,{adaptiveRoomLabelVisibleEnable:S}=n,{highlightData:T}=n,{missingFloorConfig:z}=n;return e.$$set=D=>{"duration"in D&&t(0,i=D.duration),"visible"in D&&t(1,r=D.visible),"northDesc"in D&&t(2,s=D.northDesc),"panoIndex"in D&&t(3,o=D.panoIndex),"floorIndex"in D&&t(4,a=D.floorIndex),"cameraEnable"in D&&t(5,l=D.cameraEnable),"hoverEnable"in D&&t(6,c=D.hoverEnable),"highlightEnable"in D&&t(7,h=D.highlightEnable),"compassEnable"in D&&t(8,u=D.compassEnable),"roomLabelsEnable"in D&&t(9,d=D.roomLabelsEnable),"roomAreaEnable"in D&&t(10,f=D.roomAreaEnable),"roomNameEnable"in D&&t(11,m=D.roomNameEnable),"roomDimensionEnable"in D&&t(12,p=D.roomDimensionEnable),"ruleLabelsEnable"in D&&t(13,g=D.ruleLabelsEnable),"floorplanData"in D&&t(14,y=D.floorplanData),"lastPanoramaLongitude"in D&&t(15,b=D.lastPanoramaLongitude),"cameraImageUrl"in D&&t(16,A=D.cameraImageUrl),"getRoomAreaText"in D&&t(17,w=D.getRoomAreaText),"getRoomDimensionText"in D&&t(18,x=D.getRoomDimensionText),"getLabelElement"in D&&t(19,M=D.getLabelElement),"getRuleDistanceText"in D&&t(20,P=D.getRuleDistanceText),"adaptiveRoomLabelVisibleEnable"in D&&t(21,S=D.adaptiveRoomLabelVisibleEnable),"highlightData"in D&&t(22,T=D.highlightData),"missingFloorConfig"in D&&t(23,z=D.missingFloorConfig)},[i,r,s,o,a,l,c,h,u,d,f,m,p,g,y,b,A,w,x,M,P,S,T,z]}let _g=class extends ke{constructor(n){super(),Le(this,n,WL,UL,De,{duration:0,visible:1,northDesc:2,panoIndex:3,floorIndex:4,cameraEnable:5,hoverEnable:6,highlightEnable:7,compassEnable:8,roomLabelsEnable:9,roomAreaEnable:10,roomNameEnable:11,roomDimensionEnable:12,ruleLabelsEnable:13,floorplanData:14,lastPanoramaLongitude:15,cameraImageUrl:16,getRoomAreaText:17,getRoomDimensionText:18,getLabelElement:19,getRuleDistanceText:20,adaptiveRoomLabelVisibleEnable:21,highlightData:22,missingFloorConfig:23},HL)}};const QL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAALaADAAQAAAABAAAAMAAAAADe2FZjAAAEF0lEQVRoBe2WzWskRRiHf13V092TxI2oEzYeVDwITtyDuCiihwiCePGgxIM3vYgHL4J4UIhBRA8i/gPqyUvWg7AiIuIeloDiYUHJLOK6BPwIk9nNODM9Xf1RVe1b3elJRjCZmQ6euqGmuqer33rq4e23GqiOykBloDJQGagMVAYqA5WBykBlYFYD1qwP/tdzaZqOx9zYOLxeX0+L5yzLGp0X/03a25MOnGRcBtx+6Rlo9SL08G4EooFnxa8Yiivox5/h5Ys/4cl7NVorNDRnngX+0MIkVMeMSf23zyKML8J7/Dy8hwF2Buh9CnS+AEQIdLspBuGb+M7/qLW4qJrNpsLapjYhpwVnx3BMfCtNNx3Etc9xywvnMf80wG8HmQainw0RxSGrnmeBp+8k5/j9S0HbvXb5io0Lz880/0wPHV1NlhLd316He+4xOCv5ragF7L9PrH1qBJyB0626x/lC+qrSvH5r/W+n1WpxUM5nMY4GPeH8lHJaPgfeAFQHCL+ntkXT+vnUc3W6pvTIwC0wy3rA4dwLmK2avZ7Eo9uKBuYJfgJscbs8dLCxDMt+EOEPBEZNEWyBYHqTz6bPXrzUnNrSShxHIsYiOL69zrCGLLcLqJP68tB+9w5wj+YhWDafQ2s61wNqxjZhmrQ2pvMFCEvXuCUZ7wqH794ZWs28LJqlTXSUyuksF2M/yOwqgkx2c1ADa4wLAQRk2sAGQQakhN6yFC2hltfz5kSY44NKQeeh+vtI/SSzWhg2CzCgmWISmKUGmaYFBDfCSymnfxJ6/+ospVcWOLLp5DGP/y0P/Rp66O99DQNq7Po3Ds0a0wY+My2QSv2N2mO/OyxR2o6UQk+Lv7yJ06JYSnnolZVU9cUn2O9SmaMWGFBqYXRwbqAJWIi94TX5biotpcGl1DXZ6LnqIbNDTnmUgi52Mv5l5ysMxIcZcGjy2DTK4ZHlcBC14zeSge4qphICjj3bS0A7o9nSp2TOkm7aZ8bGZy/jxhO87V91G0+dfY/Z7BWIIK9KYUi5qy/Hf8YfBG3sqJTHiQWhmTVkbip+wX3x6volVSx+LPAxF+VLXhZ8VQ+iP2Rta/iWe5v42Fngj0BbdnRTXh12ZIcKhTaGbcYjybRwXBU1lu9KlndXp04NM52poKWO0RZsviNaP9a6grkO972+st05pXhE5c1hTEluJy7XUejGUQNLMbAmTdWY1rKBLW3aTJqBZ7nZkb36DhYCreeYHbMUXHvaYi5XDK70EcgulmRjm77wNtenzuXCbmnTRaAx493rbGf3Jr/njMzj920CnKdUaFCjlDioy7NYNvOdGrQJNgI32/L2tkXfFPlxgToqjWVhD6KdLnQRdARf/HHQz2r2X2Gqy8pAZaAyUBmoDFQGKgP/q4F/AJYg9/s0ZoABAAAAAElFTkSuQmCC";function YL(e){return ee(this,null,function*(){const n=new Headers({"Content-Type":"text/plain"}),t=function(r){return ee(this,null,function*(){const s={index:r.index,url:r.url,svgUrl:r.svg_url};if(r.svg_url){const o=yield fetch(r.svg_url,{headers:n}).then(a=>a.text());s.svgContent=o}return s})};return yield Promise.all(e.map(t))})}function XL(e){const n={id:e.id,size:e.size,name:e.name,path:e.path,roomType:e.room_type,floorType:e.floor_type,roomLabel:{position:e.room_label.position,positionInImage:e.room_label.position_in_image},observerIndexs:e.observer_indexs};return e.dimension&&Object.assign(n,{dimension:e.dimension}),n}function ZL(e){return{floorName:e.floor_name,floorIndex:e.floor_index,rooms:e.rooms.map(XL),rules:e.rules}}function JL(e){return{index:e.index,floorIndex:e.floor_index,position:e.position,positionInImage:e.position_in_image}}function qL(e){return{rad:e.rad,position:e.position,positionInImage:e.position_in_image,northRad:e.north_rad,roomId:e.room_id,floorIndex:e.floor_index}}function ms(e){return ee(this,null,function*(){const n=yield YL(e.outlines),t=e.computed_data.bounding,i=e.computed_data.floor_datas.map(ZL),r=e.computed_data.entrance?qL(e.computed_data.entrance):null;return{outlines:n,entrance:r,bounding:t,floorDatas:i,observers:e.computed_data.observers.map(JL)}})}function KL(e,n,t){return e.map(r=>{const s=r.position,o=r.icon?r.icon:{url:QL,width:45,height:48},a=$D(s,n),l=qD(s,t),c=KD(l,t);return{floorIndex:a,icon:o,id:r.id,position:l,positionInImage:c}})}function $L(e,n){return n(e),e}function La(e,n){return $L({},t=>{for(const i in e)n.indexOf(i)===-1&&(t[i]=e[i])})}function Ny(e,n){const t=Math.max(...e.work.observers.map(i=>i.floorIndex));return n>t?e.model.bounding.max.y:Math.max(...e.work.observers.filter(i=>i.floorIndex===n).map(i=>i.standingPosition.y))}function Sg(e,n,t=ss.BOUNDING_CENTER){const i=Ny(e,n),r=Ny(e,n+1);return t===ss.BOUNDING_CENTER?(e.model.bounding.max.y+e.model.bounding.min.y)/2:t===ss.CEILING?r:i}function Ig(e,n,t,i){const r=Sg(e,t,i==null?void 0:i.attachedTo),s=new C.Vector3(0,r,0),o=new C.Vector3(1,r,0),a=s.clone().project(e.camera),l=o.clone().project(e.camera);return Math.abs((l.x-a.x)/1e3)*(n.getBoundingClientRect().width/2)}let ws=class{constructor(n,t){v(this,"VERSION","3.49.7");v(this,"NAME");v(this,"five");v(this,"workUtil");v(this,"fiveUtil");v(this,"hooks",new Cn);v(this,"staticPrefix","//vr-image-4.realsee-cdn.cn");this.updateFive(n),t!=null&&t.staticPrefix&&(this.staticPrefix=t.staticPrefix)}set workCode(n){this.workUtil.workCode=n,this.onWorkCodeChange()}get workCode(){return this.workUtil.workCode}updateFive(n){this.five=n,this.fiveUtil=new Sd(n),this.workUtil=this.fiveUtil.workUtil}getCurrentState(){return this.state}absoluteUrl(n){return dg(this.staticPrefix,n)}onWorkCodeChange(){}},Br=class extends ws{};var Zn=(e=>(e.UnknownError="UnknownError",e.DataNotLoaded="DataNotLoaded",e.UpdateSizeError="UpdateSizeError",e.BreakOffByHide="BreakOffByHide",e.BreakOffByDisable="BreakOffByDisable",e.ModelNotLoaded="ModelNotLoaded",e.ChangeModeError="ChangeModeError",e.UpdateCameraError="UpdateCameraError",e))(Zn||{});const Sx=500,ek=80;function Hs(e,n,t=4){return Math.abs(e-n)<Math.pow(10,-t)}function Ix(e,n,t=4){const i=Math.PI*2,r=e%i,s=n%i,o=Math.min(r,s),a=Math.max(r,s);return Hs(o,a,t)||Hs(o+i,a,t)}Object.assign(window,{nearlyEqual:Hs,nearlyEqualRad:Ix});function tk(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fy(e){return tk(e)&&!!e.isVector3}function Tg(e,n){return ee(this,null,function*(){const[t]=yield $s(e.changeMode(...n));if(t)throw new Error("change mode canceled");yield new Promise(o=>{e.once("initAnimationWillStart",()=>{e.once("initAnimationEnded",()=>o())})});const i=n[1];if(!i)return!0;const r=e.getCurrentState();if(!nk(i,r))throw new Error("pose 与预期不符")})}function nk(e,n){return Object.keys(e).every(t=>{const i=n[t],r=e[t];return i===void 0||r===void 0?!0:t==="longitude"||t==="latitude"?Ix(i,r,2):typeof i=="number"&&typeof r=="number"?Hs(i,r,2):Fy(r)&&Fy(i)?r.distanceTo(i)<.01:i===r})}function ik(e,n){if(e.currentMode!==n.mode)return!1;const{latitude:t,longitude:i,fov:r,offset:s}=n,{latitude:o,longitude:a,offset:l}=e.getCurrentState(),c=e.camera.fov;return!(!Hs(t,o,2)||!Hs(i,a,2)||s!==void 0&&s.distanceTo(l)>.01||!Hs(r,c,2))}function Tx(e,n,t=!0){return ee(this,null,function*(){if(ik(e,n)===!0)return;const r=e.getCurrentState();if(r.mode!==n.mode){const[h]=yield $s(Tg(e,[n.mode,n,void 0,t]));if(h)throw h;return}const{latitude:s,longitude:o,fov:a}=r,l=Math.min(1e3,Math.max(200,Math.abs(s-Math.PI/2)*1e3,(o>Math.PI?2*Math.PI-o:o)*500,typeof n.fov=="number"?Math.abs(a-n.fov)*10:1/0)),[c]=yield $s(e.updateCamera(La(n,["mode"]),l,t));if(c)throw new Error(Zn.UpdateCameraError)})}function ka(e,n,t=300){const i=e.getElement();i&&(i.style.opacity=n+"",i.style.transition=t===0?"none":`opacity ${t}ms linear`,t!==0&&Promise.race([new Promise(r=>i.addEventListener("transitionend",r,{once:!0})),new Promise(r=>setTimeout(r,t))]).then(()=>{i.style.transition="none"}))}function rk(e){const{latitude:n,longitude:t}=e,i=Math.abs(n-Math.PI/2)>5*Math.PI/180,r=t>5*(Math.PI/180)&&t<355*(Math.PI/180);return i||r}function sk(e){const{latitude:n,longitude:t}=e,i=Math.abs(n-Math.PI/2)<10*Math.PI/180,r=t<30*(Math.PI/180)||t>330*(Math.PI/180);return i&&r}let ok=class extends Br{constructor(t,i){var l,c,h;super(t);v(this,"name","modelFloorplanPlugin");v(this,"state");v(this,"data");v(this,"showState");v(this,"showPromise");v(this,"app");v(this,"panoIndex",0);v(this,"floorIndex",0);v(this,"selector");v(this,"showRejection");v(this,"wrapper");v(this,"container",document.createElement("div"));v(this,"lastPanoramaLongitude",0);v(this,"size",{width:0,height:0});v(this,"defaultMissingFloorConfig");v(this,"hasAddedEventListener",!1);v(this,"isHiddenByHideFunc",!1);v(this,"highlightData",{});v(this,"dispose",()=>{var t,i;this.removeEventListener(),(t=this.app)==null||t.$destroy(),this.app=void 0,(i=this.container)==null||i.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});v(this,"show",(...i)=>ee(this,[...i],function*(t={}){if(!this.state.enabled||!this.showPromise&&this.state.visible)return;const r=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!0},r),this._show(t)}));v(this,"hide",(...i)=>ee(this,[...i],function*(t={}){this.state.enabled&&(this.isHiddenByHideFunc=!0,this.state.visible!==!1&&(this.updateState({visible:!1},t.userAction||!0),this._hide(t)))}));v(this,"updateSize",()=>{if(!this.data||!this.container||!this.wrapper)return!1;const{min:t,max:i}=this.data.bounding,r=i.x-t.x,s=i.y-t.y,o=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=Ig(this.five,this.wrapper,this.floorIndex,o),l=Math.ceil(r*a),c=Math.ceil(s*a);return this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c}),!0});v(this,"highlight",t=>{this.state.config.highlightEnable&&(this.highlightData=t,this.render())});v(this,"unhighlight",()=>{this.highlightData={},this.render()});v(this,"_disable",t=>{var r,s,o;const{userAction:i}=t;this.hooks.emit("disable",{userAction:i}),(r=this.showRejection)==null||r.call(this,Zn.BreakOffByDisable),this.showPromise=void 0,(s=this.app)==null||s.$destroy(),this.app=void 0,(o=this.container)==null||o.remove(),this.removeEventListener()});v(this,"_enable",t=>{const{userAction:i}=t;this.addEventListener(),this.wrapper&&(this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:i}),this.state.visible&&this._show({userAction:i}))});v(this,"_show",t=>ee(this,null,function*(){var o;if(!this.state.enabled)return;if(!((o=this.five.model)!=null&&o.loaded))throw new Error(Zn.ModelNotLoaded);if(!this.data)throw new Error(Zn.DataNotLoaded);if(this.showPromise)return this.showPromise;const i={floorIndex:this.floorIndex,modelOpacity:this.state.config.modelOpacity,immediately:!1,isAutoShow:!1,userAction:!0},r=R(R({},i),t),s=()=>ee(this,null,function*(){this.hooks.emit("show",{userAction:r.userAction,auto:r.isAutoShow});let a=!1,l;this.showRejection=u=>{a=!0,l=u};const[c]=yield $s(Tx(this.five,this.showState,r.userAction));if(c)throw c;if(a)throw l?new Error(l):new Error(Zn.UnknownError);if(!this.updateSize())throw new Error(Zn.UpdateSizeError);this.floorIndex=r.floorIndex,this.five.model.show(this.floorIndex)});return this.isHiddenByHideFunc=!1,this.showPromise=s().then(()=>{this.showPromise=void 0,this.showRejection=void 0;const a=r.modelOpacity,l=r.immediately?0:Sx;ka(this.five,a,l),this.render(l),this.hooks.emit("showAnimationEnded",{auto:r.isAutoShow,userAction:r.userAction})}).catch(a=>{if(this.showPromise=void 0,this.showRejection=void 0,this.updateState({visible:!1},r.userAction),!r.isAutoShow&&a instanceof Error)throw a}),this.showPromise}));v(this,"_hide",t=>{var s;(s=this.showRejection)==null||s.call(this,Zn.BreakOffByHide),this.showPromise=void 0;const r=R(R({},{userAction:!0,isAutoHide:!1}),t);ka(this.five,1,0),this.hooks.emit("hide",{auto:r.isAutoHide,userAction:r.userAction}),this.render()});v(this,"handleClick",()=>{if(!this.state.visible)return;if(this.hooks.emit("click"))return!1});v(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const t=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!t)throw new Error("不正确的父容器选择器");this.wrapper=t,t.append(this.container)});v(this,"onFiveModeChange",t=>{t!==this.showState.mode&&(this.updateState({visible:!1},!1),this._hide({userAction:!1}))});v(this,"onFiveInteriaPan",(t,i)=>{if(!i||this.state.config.autoShowEnable===!1||this.isHiddenByHideFunc)return;const r=this.five.getCurrentState();r.mode==="Floorplan"&&(this.state.visible||sk(r)&&(this.updateState({visible:!0},!0),this._show({isAutoShow:!0})))});v(this,"onFivePanoArrived",t=>{var i;(i=this.five)!=null&&i.work&&(this.panoIndex=t,this.floorIndex=this.workUtil.observers[t].floorIndex)});v(this,"onFiveCameraUpdate",(t,i)=>{if(!this.state.visible||this.showPromise)return;const r=this.five.getCurrentState();rk(r)&&(this.updateState({visible:!1},i),this._hide({userAction:i,isAutoHide:!0}))});v(this,"onFiveWantsGesture",(t,i)=>{if(this.state.visible&&(i.length>1||t==="mouseWheel"))return!1});v(this,"onFiveWantsPanGesture",(t,i)=>{if(this.five.getCurrentState().mode==="Floorplan"&&this.state.config.autoShowEnable!==!1&&i&&this.state.visible)return this.five.updateCamera(this.showState,0),!1});v(this,"onFiveWantsTapGesture",()=>this.handleClick());v(this,"onFiveWantsChangeMode",(t,i)=>{i==="Panorama"&&t==="Floorplan"&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude)});v(this,"onModelShownFloorChange",t=>{if(this.floorIndex!==t){if(t===null){const i=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[i].floorIndex;return}this.floorIndex=t,this.updateSize(),this.render()}});i!=null&&i.selector&&(this.selector=i.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.showState={mode:"Floorplan",longitude:0,latitude:Math.PI/2,fov:ek/((l=i==null?void 0:i.scale)!=null?l:1)},this.defaultMissingFloorConfig={imageURL:this.staticPrefix+"/release/web/saas/missing-floorplan.e274c596.png",imageWidth:200,imageHeight:120,text:(h=(c=i.i18n)==null?void 0:c.call(i,"暂无平面图"))!=null?h:"暂无平面图",textFontSize:14};const r={northDesc:"北",modelOpacity:1,cameraEnable:!0,highlightEnable:!1,hoverEnable:!0,compassEnable:!0,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,roomDimensionEnable:!0,adaptiveRoomLabelVisibleEnable:!0,cameraImageUrl:ps,attachedTo:ss.BOUNDING_CENTER,getLabelElement:void 0,missingFloorConfig:R(R({},this.defaultMissingFloorConfig),i.missingFloorConfig),i18n:u=>u,getRoomAreaText:u=>(u/1e6).toFixed(1)+"㎡",getRoomDimensionText:(u,d)=>(u/1e3).toFixed(1)+"m × "+(d/1e3).toFixed(1)+"m",getRuleDistanceText:u=>u.toString()},s=i?La(i,["selector","scale"]):{},o=R(R({},r.missingFloorConfig),s.missingFloorConfig),a=Ee(R(R({},r),s),{missingFloorConfig:o});this.state={enabled:!0,visible:!1,config:a},this.initContainer(),t.once("dispose",this.dispose),this.addEventListener()}load(t,i,r=!0){return ee(this,null,function*(){function s(h){return Object.prototype.hasOwnProperty.apply(h,["version"])}const o=t;o&&kr(o.version)&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(t)),l=s(a)?a.data:a,c=this.data;this.data=yield ms(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),i&&this.updateState(i,r),this.render()})}appendTo(t){if(this.wrapper=t,!!this.state.enabled)return t.appendChild(this.container),this.render(),this}enable(t={}){if(this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!0},t.userAction||i),this._enable({userAction:i})}disable(t={}){if(!this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!1},t.userAction||i),this._disable({userAction:i})}setState(t,i={}){const r=this.state,s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s};t.visible?this._show(o):this._hide(o)}this.render()}changeConfigs(t,i=!0){this.updateState({config:t},i),this.render()}formatData(t){return ee(this,null,function*(){return yield ms(t.data)})}updateState(t,i){var a;const r=this.state,s=(a=t.config)!=null&&a.missingFloorConfig?R(R({},r.config.missingFloorConfig),t.config.missingFloorConfig):r.config.missingFloorConfig,o=t.config?Ee(R(R({},r.config),t.config),{missingFloorConfig:s}):r.config;this.state=Ee(R(R({},this.state),t),{config:o}),!Nn(this.state,r,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:10,pointerEvents:"none"}),this.five.addExtraElement(this.container)}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const t=this.five;t.model.loaded?this.onFiveModelLoaded():t.once("modelLoaded",this.onFiveModelLoaded),t.on("modeChange",this.onFiveModeChange),t.on("interiaPan",this.onFiveInteriaPan),t.on("panoArrived",this.onFivePanoArrived),t.on("cameraUpdate",this.onFiveCameraUpdate),t.on("wantsGesture",this.onFiveWantsGesture),t.on("wantsPanGesture",this.onFiveWantsPanGesture),t.on("wantsTapGesture",this.onFiveWantsTapGesture),t.on("wantsChangeMode",this.onFiveWantsChangeMode),t.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const t=this.five;this.hasAddedEventListener=!1,t.off("modelLoaded",this.onFiveModelLoaded),t.off("modeChange",this.onFiveModeChange),t.off("interiaPan",this.onFiveInteriaPan),t.off("panoArrived",this.onFivePanoArrived),t.off("cameraUpdate",this.onFiveCameraUpdate),t.off("wantsGesture",this.onFiveWantsGesture),t.off("wantsPanGesture",this.onFiveWantsPanGesture),t.off("wantsTapGesture",this.onFiveWantsTapGesture),t.off("wantsChangeMode",this.onFiveWantsChangeMode),t.off("modelShownFloorChange",this.onModelShownFloorChange)}render(t){if(!this.state.enabled||!this.container||!this.data||this.size.width===0||this.showPromise)return;const i=Ee(R({},this.state.config),{visible:this.state.visible,duration:t!=null?t:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(i);this.app=new _g({target:this.container,intro:!0,props:i})}};const ak=(e,n)=>new ok(e,n);function lk(e){const{latitude:n,longitude:t}=e,i=Math.abs(n-Math.PI/2)>5*Math.PI/180,r=t>5*(Math.PI/180)&&t<355*(Math.PI/180);return i||r}function ck(e){const{latitude:n,longitude:t}=e,i=Math.abs(n-Math.PI/2)<10*Math.PI/180,r=t<30*(Math.PI/180)||t>330*(Math.PI/180);return i&&r}let hk=class extends Br{constructor(t,i){var l,c;super(t);v(this,"name","modelFloorplanPlugin");v(this,"state");v(this,"data");v(this,"showState");v(this,"showPromise");v(this,"app");v(this,"panoIndex",0);v(this,"floorIndex",0);v(this,"selector");v(this,"showRejection");v(this,"wrapper");v(this,"container",document.createElement("div"));v(this,"lastPanoramaLongitude",0);v(this,"size",{width:0,height:0});v(this,"defaultMissingFloorConfig");v(this,"hasAddedEventListener",!1);v(this,"isHiddenByHideFunc",!1);v(this,"highlightData",{});v(this,"dispose",()=>{var t,i;this.removeEventListener(),(t=this.app)==null||t.$destroy(),this.app=void 0,(i=this.container)==null||i.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});v(this,"show",(...i)=>ee(this,[...i],function*(t={}){if(!this.state.enabled||!this.showPromise&&this.state.visible)return;const r=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!0},r),this._show(t)}));v(this,"hide",(...i)=>ee(this,[...i],function*(t={}){this.state.enabled&&(this.isHiddenByHideFunc=!0,this.state.visible!==!1&&(this.updateState({visible:!1},t.userAction||!0),this._hide(t)))}));v(this,"updateSize",()=>{if(!this.data||!this.container||!this.wrapper)return!1;const{min:t,max:i}=this.data.bounding,r=i.x-t.x,s=i.y-t.y,o=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=Ig(this.five,this.wrapper,this.floorIndex,o),l=Math.ceil(r*a),c=Math.ceil(s*a);return this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c}),!0});v(this,"highlight",t=>{this.state.config.highlightEnable&&(this.highlightData=t,this.render())});v(this,"unhighlight",()=>{this.highlightData={},this.render()});v(this,"_disable",t=>{var r,s,o;const{userAction:i}=t;this.hooks.emit("disable",{userAction:i}),(r=this.showRejection)==null||r.call(this,Zn.BreakOffByDisable),this.showPromise=void 0,(s=this.app)==null||s.$destroy(),this.app=void 0,(o=this.container)==null||o.remove(),this.removeEventListener()});v(this,"_enable",t=>{const{userAction:i}=t;this.addEventListener(),this.wrapper&&(this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:i}),this.state.visible&&this._show({userAction:i}))});v(this,"_show",t=>ee(this,null,function*(){var o;if(!this.state.enabled)return;if(!((o=this.fiveUtil.model)!=null&&o.loaded))throw new Error(Zn.ModelNotLoaded);if(!this.data)throw new Error(Zn.DataNotLoaded);if(this.showPromise)return this.showPromise;const i={floorIndex:this.floorIndex,modelOpacity:this.state.config.modelOpacity,immediately:!1,isAutoShow:!1,userAction:!0},r=R(R({},i),t),s=()=>ee(this,null,function*(){this.hooks.emit("show",{userAction:r.userAction,auto:r.isAutoShow});let a=!1,l;this.showRejection=u=>{a=!0,l=u};const[c]=yield $s(Tx(this.five,this.showState,r.userAction));if(c)throw c;if(a)throw l?new Error(l):new Error(Zn.UnknownError);if(!this.updateSize())throw new Error(Zn.UpdateSizeError);this.updatePosition(),this.floorIndex=r.floorIndex,this.fiveUtil.model.show(this.floorIndex)});return this.isHiddenByHideFunc=!1,this.showPromise=s().then(()=>{this.showPromise=void 0,this.showRejection=void 0;const a=r.modelOpacity,l=r.immediately?0:Sx;ka(this.five,a,l),this.render(l),this.hooks.emit("showAnimationEnded",{auto:r.isAutoShow,userAction:r.userAction})}).catch(a=>{if(this.showPromise=void 0,this.showRejection=void 0,this.updateState({visible:!1},r.userAction),!r.isAutoShow&&a instanceof Error)throw a}),this.showPromise}));v(this,"_hide",t=>{var s;(s=this.showRejection)==null||s.call(this,Zn.BreakOffByHide),this.showPromise=void 0;const r=R(R({},{userAction:!0,isAutoHide:!1}),t);ka(this.five,1,0),this.hooks.emit("hide",{auto:r.isAutoHide,userAction:r.userAction}),this.render()});v(this,"handleClick",()=>{if(!this.state.visible)return;if(this.hooks.emit("click"))return!1});v(this,"onFiveModelLoaded",()=>{const i=this.five.model.bounding.getCenter(new C.Vector3);if(this.showState.offset=i,this.state.enabled===!1||this.wrapper||!this.selector)return;const r=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!r)throw new Error("不正确的父容器选择器");this.wrapper=r,r.append(this.container)});v(this,"onFiveModeChange",t=>{t!==this.showState.mode&&(this.updateState({visible:!1},!1),this._hide({userAction:!1}))});v(this,"onFiveInteriaPan",(t,i)=>{if(!i||this.state.visible||this.state.config.autoShowEnable===!1||this.isHiddenByHideFunc)return;const r=this.five.getCurrentState();r.mode===this.showState.mode&&ck(r)&&(this.updateState({visible:!0},!0),this._show({isAutoShow:!0}))});v(this,"onFivePanoArrived",t=>{var i;(i=this.five)!=null&&i.work&&(this.panoIndex=t,this.floorIndex=this.workUtil.observers[t].floorIndex)});v(this,"onFiveCameraUpdate",(t,i)=>{if(!this.state.visible||this.showPromise)return;const r=this.five.getCurrentState();this.updatePosition(),this.updateSize(),lk(r)&&(this.updateState({visible:!1},i),this._hide({userAction:i}))});v(this,"onFiveWantsPanGesture",(t,i)=>{if(this.five.getCurrentState().mode===this.showState.mode&&this.state.config.autoShowEnable!==!1&&i&&this.state.visible)return this.five.updateCamera(La(this.showState,["offset"]),0),!1});v(this,"onFiveWantsTapGesture",()=>this.handleClick());v(this,"onFiveWantsChangeMode",(t,i)=>{i==="Panorama"&&t===this.showState.mode&&(this.lastPanoramaLongitude=this.five.getCurrentState().longitude)});v(this,"onModelShownFloorChange",t=>{var i;if(this.floorIndex!==t){if(t===null){const r=this.five.getCurrentState().panoIndex;this.floorIndex=(i=this.five.work)==null?void 0:i.observers[r].floorIndex;return}this.floorIndex=t,this.updateSize(),this.render()}});i!=null&&i.selector&&(this.selector=i.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.showState={mode:"Mapview",longitude:0,latitude:Math.PI/2},this.defaultMissingFloorConfig={imageURL:this.staticPrefix+"/release/web/saas/missing-floorplan.e274c596.png",imageWidth:200,imageHeight:120,text:(c=(l=i.i18n)==null?void 0:l.call(i,"暂无平面图"))!=null?c:"暂无平面图",textFontSize:14};const r={northDesc:"北",modelOpacity:1,cameraEnable:!0,highlightEnable:!1,hoverEnable:!0,compassEnable:!0,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,roomDimensionEnable:!0,cameraImageUrl:ps,attachedTo:ss.BOUNDING_CENTER,getLabelElement:void 0,adaptiveRoomLabelVisibleEnable:!0,missingFloorConfig:R(R({},this.defaultMissingFloorConfig),i.missingFloorConfig),i18n:h=>h,getRoomAreaText:h=>(h/1e6).toFixed(1)+"㎡",getRoomDimensionText:(h,u)=>(h/1e3).toFixed(1)+"m × "+(u/1e3).toFixed(1)+"m",getRuleDistanceText:h=>h.toString()},s=i?La(i,["selector","scale"]):{},o=R(R({},r.missingFloorConfig),s.missingFloorConfig),a=Ee(R(R({},r),s),{missingFloorConfig:o});this.state={enabled:!0,visible:!1,config:a},this.initContainer(),Ha(t).then(this.onFiveModelLoaded),t.once("dispose",this.dispose),this.addEventListener()}load(t,i,r=!0){return ee(this,null,function*(){function s(h){return Object.prototype.hasOwnProperty.apply(h,["version"])}const o=t;o&&kr(o.version)&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(t)),l=s(a)?a.data:a,c=this.data;this.data=yield ms(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),i&&this.updateState(i,r),this.render()})}appendTo(t){if(this.wrapper=t,!!this.state.enabled)return t.appendChild(this.container),this.render(),this}enable(t={}){if(this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!0},t.userAction||i),this._enable({userAction:i})}disable(t={}){if(!this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!1},t.userAction||i),this._disable({userAction:i})}setState(t,i={}){const r=this.state,s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s};t.visible?this._show(o):this._hide(o)}}changeConfigs(t,i=!0){this.updateState({config:t},i),this.render()}updatePosition(){var a;const t=Sg(this.five,this.floorIndex,this.state.config.attachedTo),i=(a=this.fiveUtil.model)==null?void 0:a.bounding.getCenter(new C.Vector3).setY(t);if(!i)return;const r=i.clone().project(this.five.camera),s=(r.x+1)/2,o=-(r.y-1)/2;this.container.style.left=s*100+"%",this.container.style.top=o*100+"%"}formatData(t){return ee(this,null,function*(){return yield ms(t.data)})}updateState(t,i){var a;const r=this.state,s=(a=t.config)!=null&&a.missingFloorConfig?R(R({},r.config.missingFloorConfig),t.config.missingFloorConfig):r.config.missingFloorConfig,o=t.config?Ee(R(R({},r.config),t.config),{missingFloorConfig:s}):r.config;this.state=Ee(R(R({},this.state),t),{config:o}),!Nn(this.state,r,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:10,pointerEvents:"none"}),this.five.addExtraElement(this.container)}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const t=this.five;t.on("modeChange",this.onFiveModeChange),t.on("interiaPan",this.onFiveInteriaPan),t.on("panoArrived",this.onFivePanoArrived),t.on("cameraUpdate",this.onFiveCameraUpdate),t.on("wantsPanGesture",this.onFiveWantsPanGesture),t.on("wantsTapGesture",this.onFiveWantsTapGesture),t.on("wantsChangeMode",this.onFiveWantsChangeMode),t.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const t=this.five;this.hasAddedEventListener=!1,t.off("modelLoaded",this.onFiveModelLoaded),t.off("modeChange",this.onFiveModeChange),t.off("panoArrived",this.onFivePanoArrived),t.off("cameraUpdate",this.onFiveCameraUpdate),t.off("wantsPanGesture",this.onFiveWantsPanGesture),t.off("wantsTapGesture",this.onFiveWantsTapGesture),t.off("wantsChangeMode",this.onFiveWantsChangeMode),t.off("modelShownFloorChange",this.onModelShownFloorChange)}render(t){if(!this.state.enabled||!this.container||!this.data||this.size.width===0||this.showPromise)return;const i=Ee(R({},this.state.config),{visible:this.state.visible,duration:t!=null?t:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(i);this.app=new _g({target:this.container,intro:!0,props:i})}};const uk=(e,n)=>new hk(e,n);let dk=class extends Br{constructor(t,i){var l,c;super(t);v(this,"name","topviewFloorplanPlugin");v(this,"state");v(this,"data");v(this,"app");v(this,"selector");v(this,"panoIndex",0);v(this,"floorIndex",0);v(this,"wrapper");v(this,"container",document.createElement("div"));v(this,"lastPanoramaLongitude",0);v(this,"size",{width:0,height:0});v(this,"defaultMissingFloorConfig");v(this,"hasAddedEventListener",!1);v(this,"isHiddenByHideFunc",!1);v(this,"highlightData",{});v(this,"updateSize",()=>{if(!this.data||!this.container||!this.wrapper||this.five.getCurrentState().mode!=="Topview")return!1;const{min:t,max:i}=this.data.bounding,r=i.x-t.x,s=i.y-t.y,o=this.state.config.attachedTo?{attachedTo:this.state.config.attachedTo}:void 0,a=Ig(this.five,this.wrapper,this.floorIndex,o),l=Math.ceil(r*a),c=Math.ceil(s*a);return this.size.width===l&&this.size.height===c||(this.container.style.width=l+"px",this.container.style.height=c+"px",this.size={width:l,height:c}),!0});v(this,"dispose",()=>{var t,i;this.removeEventListener(),(t=this.app)==null||t.$destroy(),this.app=void 0,(i=this.container)==null||i.remove(),this.data=void 0,this.wrapper=void 0,this.selector=void 0,this.hooks.emit("dispose")});v(this,"highlight",t=>{this.state.config.highlightEnable&&(this.highlightData=t,this.render())});v(this,"unhighlight",()=>{this.highlightData={},this.render()});v(this,"_disable",t=>{var r,s;const{userAction:i}=t;(r=this.app)==null||r.$destroy(),this.app=void 0,(s=this.container)==null||s.remove(),this.removeEventListener(),this.hooks.emit("disable",{userAction:i})});v(this,"onFiveModelLoaded",()=>{if(this.state.enabled===!1||this.wrapper||!this.selector)return;const t=this.selector instanceof Element?this.selector:document.querySelector(this.selector);if(!t)throw new Error("不正确的父容器选择器");this.wrapper=t,t.append(this.container)});v(this,"onFiveModeChange",(...[t,,,,i])=>{t!=="Topview"&&this.state.visible&&(this.updateState({visible:!1},i),this._hide({userAction:i}))});v(this,"onFivePanoArrived",t=>{var i;(i=this.five)!=null&&i.work&&(this.panoIndex=t,this.floorIndex=this.five.work.observers[t].floorIndex)});v(this,"onFiveCameraUpdate",(t,i)=>{this.state.visible&&(this.updatePosition(),this.updateSize())});v(this,"onFiveWantsGesture",t=>{if(!(t!=="pan"&&t!=="pinch"&&t!=="mouseWheel")&&this.state.visible&&!this.state.config.gestureEnable)return!1});v(this,"onFiveWantsMoveToPano",()=>{if(this.state.visible&&this.state.config.preventRoomClick)return!1});v(this,"onFiveInitAnimationEnded",(...[,,t])=>{const{mode:i}=this.five.getCurrentState();i==="Topview"&&!this.isHiddenByHideFunc&&!this.state.visible&&this.state.config.autoShowEnable&&(this.updateState({visible:!0},t),this._show({userAction:t}))});v(this,"onModelShownFloorChange",t=>{if(this.floorIndex!==t){if(t===null){const i=this.five.getCurrentState().panoIndex;this.floorIndex=this.five.work.observers[i].floorIndex;return}this.floorIndex=t,this.updateSize(),this.render()}});i!=null&&i.selector&&(this.selector=i.selector,console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法")),this.defaultMissingFloorConfig={imageURL:this.staticPrefix+"/release/web/saas/missing-floorplan.e274c596.png",imageWidth:200,imageHeight:120,text:(c=(l=i.i18n)==null?void 0:l.call(i,"暂无平面图"))!=null?c:"暂无平面图",textFontSize:14};const r={northDesc:"北",modelOpacity:1,cameraEnable:!0,hoverEnable:!0,highlightEnable:!1,compassEnable:!0,gestureEnable:!1,autoShowEnable:!0,ruleLabelsEnable:!0,roomLabelsEnable:!0,roomAreaEnable:!0,roomNameEnable:!0,roomDimensionEnable:!0,cameraImageUrl:ps,attachedTo:ss.BOUNDING_CENTER,getLabelElement:void 0,missingFloorConfig:R(R({},this.defaultMissingFloorConfig),i.missingFloorConfig),i18n:h=>h,adaptiveRoomLabelVisibleEnable:!0,getRoomAreaText:h=>(h/1e6).toFixed(1)+"㎡",getRoomDimensionText:(h,u)=>(h/1e3).toFixed(1)+"m × "+(u/1e3).toFixed(1)+"m",getRuleDistanceText:h=>h.toString()},s=i?La(i,["selector","scale"]):{},o=R(R({},r.missingFloorConfig),s.missingFloorConfig),a=Ee(R(R({},r),s),{missingFloorConfig:o});this.state={enabled:!0,visible:!1,config:a},this.initContainer(),t.model.loaded?this.onFiveModelLoaded():t.once("modelLoaded",this.onFiveModelLoaded),t.once("dispose",this.dispose),this.addEventListener()}load(t,i,r=!0){return ee(this,null,function*(){function s(h){return Object.prototype.hasOwnProperty.apply(h,["version"])}const o=t;o&&kr(o.version)&&console.warn("传入 serverData.data 的方式后续可能不再支持,请把 serverData 整体传入 load 函数");const a=JSON.parse(JSON.stringify(t)),l=s(a)?a.data:a,c=this.data;this.data=yield ms(l),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,c),i&&this.updateState(i,r),this.render()})}updatePosition(){var a;const t=Sg(this.five,this.floorIndex,this.state.config.attachedTo),i=(a=this.five.model)==null?void 0:a.bounding.getCenter(new C.Vector3).setY(t);if(!i)return;const r=i.clone().project(this.five.camera),s=(r.x+1)/2,o=-(r.y-1)/2;this.container.style.left=s*100+"%",this.container.style.top=o*100+"%"}appendTo(t){if(this.wrapper=t,!!this.state.enabled)return t.appendChild(this.container),this.render(),this}show(){return ee(this,arguments,function*(t={}){if(this.state.visible)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!0},i),this._show({userAction:i})})}hide(){return ee(this,arguments,function*(t={}){if(this.isHiddenByHideFunc=!0,!this.state.visible)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!1},i),this._hide({userAction:i})})}enable(t={}){if(this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!0},t.userAction||i),this._enable({userAction:i})}disable(t={}){if(!this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!1},t.userAction||i),this._disable({userAction:i})}setState(t,i={}){const r=this.state,s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled){const o={userAction:s};t.enabled?this._enable(o):this._disable(o)}if(t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s};t.visible?this._show(o):this._hide(o)}}changeConfigs(t,i=!0){this.updateState({config:t},i),this.render()}formatData(t){return ee(this,null,function*(){return yield ms(t.data)})}_show(t){return ee(this,null,function*(){if(!this.state.enabled)return;this.isHiddenByHideFunc=!1;const{userAction:i}=t;this.hooks.emit("show",{userAction:i,auto:!1}),this.five.getCurrentState().mode!=="Topview"&&(yield Tg(this.five,["Topview",void 0,void 0,i])),this.five.model.show(this.floorIndex),this.updatePosition(),this.updateSize();const r=500,s=this.state.config.modelOpacity;ka(this.five,s,r),this.hooks.emit("showAnimationEnded",{userAction:i,auto:!1}),this.render()})}_hide(t){return ee(this,null,function*(){if(!this.state.enabled)return;const{userAction:i}=t;this.hooks.emit("hide",{userAction:i,auto:!1});const r=1,s=0;ka(this.five,r,s),this.render()})}_enable(t){const{userAction:i}=t;this.addEventListener(),this.wrapper&&this.wrapper.append(this.container),this.hooks.emit("enable",{userAction:i}),this.state.visible&&this._show({userAction:i})}updateState(t,i){var a;const r=this.state,s=(a=t.config)!=null&&a.missingFloorConfig?R(R({},r.config.missingFloorConfig),t.config.missingFloorConfig):r.config.missingFloorConfig,o=t.config?Ee(R(R({},r.config),t.config),{missingFloorConfig:s}):r.config;this.state=Ee(R(R({},this.state),t),{config:o}),!Nn(this.state,r,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}addEventListener(){if(!this.state.enabled||this.hasAddedEventListener)return;const t=this.five;t.on("modeChange",this.onFiveModeChange),t.on("panoArrived",this.onFivePanoArrived),t.on("cameraUpdate",this.onFiveCameraUpdate),t.on("wantsGesture",this.onFiveWantsGesture),t.on("wantsMoveToPano",this.onFiveWantsMoveToPano),t.on("initAnimationEnded",this.onFiveInitAnimationEnded),t.on("modelShownFloorChange",this.onModelShownFloorChange)}removeEventListener(){const t=this.five;this.hasAddedEventListener=!1,t.off("modeChange",this.onFiveModeChange),t.off("panoArrived",this.onFivePanoArrived),t.off("cameraUpdate",this.onFiveCameraUpdate),t.off("wantsGesture",this.onFiveWantsGesture),t.off("wantsMoveToPano",this.onFiveWantsMoveToPano),t.off("initAnimationEnded",this.onFiveInitAnimationEnded),t.off("modelShownFloorChange",this.onModelShownFloorChange)}initContainer(){this.container.classList.add("floorplan-plugin"),Object.assign(this.container.style,{position:"absolute",left:"50%",top:"50%",transform:"translate3d(-50%, -50%, 10px)",zIndex:10,pointerEvents:"none","will-change":"width, height"}),this.five.addExtraElement(this.container)}render(t){if(!this.state.enabled||!this.container||!this.data||this.size.width===0)return;const i=Ee(R({},this.state.config),{visible:this.state.visible,duration:t!=null?t:0,panoIndex:this.panoIndex,floorIndex:this.floorIndex,floorplanData:this.data,lastPanoramaLongitude:this.lastPanoramaLongitude,highlightData:this.highlightData});if(this.app)return this.app.$set(i);this.app=new _g({target:this.container,intro:!0,props:i})}};const fk=(e,n)=>new dk(e,n);function Dg(e,n=200){let t;return function(...i){t||(e(...i),t=setTimeout(function(){t=null},n))}}function pk(e){Ue(e,"svelte-1nqrlxd",".plugin-radar__camera-wrapper.svelte-1nqrlxd{width:100%;height:100%;position:absolute;pointer-events:none}.plugin-radar__camera-position.svelte-1nqrlxd{position:absolute;left:0;top:0;width:0;height:0;transform:none;pointer-events:none;transition:transform 1s linear}.plugin-radar__camera-rotate.svelte-1nqrlxd{position:absolute;left:-0.9375rem;top:-0.9375rem;width:1.0625rem;height:1.0625rem;transform-origin:0.9375rem 0.9375rem;transform:rotate(45deg);background-repeat:no-repeat;background-size:100%}")}function mk(e){let n,t,i;return{c(){n=H("div"),t=H("div"),i=H("div"),_(i,"class","plugin-radar__camera-rotate svelte-1nqrlxd"),W(i,"background-image","url("+(e[0]||ps)+")"),W(i,"transform",e[1]),_(t,"class","plugin-radar__camera-position svelte-1nqrlxd"),W(t,"transform",e[2]),_(n,"class","plugin-radar__camera-wrapper svelte-1nqrlxd"),W(n,"opacity",e[3]?1:0)},m(r,s){Z(r,n,s),Q(n,t),Q(t,i)},p(r,[s]){s&1&&W(i,"background-image","url("+(r[0]||ps)+")"),(s&1||s&3)&&W(i,"transform",r[1]),s&4&&W(t,"transform",r[2]),s&8&&W(n,"opacity",r[3]?1:0)},i:de,o:de,d(r){r&&Y(n)}}}function gk(e){return`rotate(${Math.floor(e/Math.PI*180)*-1+45}deg)`}function vk(e,n,t){var b,A;let i,r,s,o,{five:a}=n,{pxmm:l}=n,{floorplanData:c}=n,{cameraImageUrl:h}=n,u=a.getCurrentState().panoIndex,d=a.getCurrentState().longitude,f=(A=(b=a.work.observers[a.getCurrentState().panoIndex])==null?void 0:b.floorIndex)!=null?A:0;function m(w,x){const M=w.bounding,P=w.observers[x];if(!P)return"";const S=(M.max.x-M.min.x)*l,T=(M.max.y-M.min.y)*l,z=Math.floor(P.positionInImage.x*S),D=Math.floor(P.positionInImage.y*T);return`translate(${z}px, ${D}px)`}function p(w){t(7,u=w)}function g(w){t(9,f=a.work.observers[w].floorIndex)}const y=Dg(w=>{t(8,d=w.longitude)},1e3/60);return Yn(()=>(a.on("panoWillArrive",p),a.on("panoArrived",g),a.on("cameraDirectionUpdate",y),function(){a.off("panoWillArrive",p),a.off("panoArrived",g),a.off("cameraDirectionUpdate",y)})),e.$$set=w=>{"five"in w&&t(4,a=w.five),"pxmm"in w&&t(5,l=w.pxmm),"floorplanData"in w&&t(6,c=w.floorplanData),"cameraImageUrl"in w&&t(0,h=w.cameraImageUrl)},e.$$.update=()=>{e.$$.dirty&576&&t(10,i=c.floorDatas[f]),e.$$.dirty&1024&&t(3,r=i.rooms.length>0),e.$$.dirty&192&&t(2,s=m(c,u)),e.$$.dirty&256&&t(1,o=gk(d))},[h,o,s,r,a,l,c,u,d,f,i]}class yk extends ke{constructor(n){super(),Le(this,n,vk,mk,De,{five:4,pxmm:5,floorplanData:6,cameraImageUrl:0},pk)}}function bk(e){Ue(e,"svelte-1i87fz7",".plugin-pano-floorplan__extra-objects.svelte-1i87fz7{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.plugin-pano-floorplan__extra-object-item--position.svelte-1i87fz7{position:absolute;width:0;height:0}.plugin-pano-floorplan__extra-object-item.svelte-1i87fz7{transform:translate(-50%, -50%)}")}function Vy(e,n,t){const i=e.slice();return i[1]=n[t],i}function Gy(e,n){let t,i,r=`${n[1].icon.width/16}rem`,s=`${n[1].icon.height/16}rem`,o,a=`${n[1].positionInImage.y*100}%`,l=`${n[1].positionInImage.x*100}%`;return{key:e,first:null,c(){t=H("div"),i=H("div"),o=ve(),_(i,"class","plugin-pano-floorplan__extra-object-item svelte-1i87fz7"),W(i,"background-image",`url(${n[1].icon.url})`),W(i,"width",r),W(i,"height",s),_(t,"class","plugin-pano-floorplan__extra-object-item--position svelte-1i87fz7"),W(t,"top",a),W(t,"left",l),this.first=t},m(c,h){Z(c,t,h),Q(t,i),Q(t,o)},p(c,h){n=c,h&1&&W(i,"background-image",`url(${n[1].icon.url})`);const u=h&1;u&&W(i,"width",r),u&&W(i,"height",s),h&1&&a!==(a=`${n[1].positionInImage.y*100}%`)&&W(t,"top",a),h&1&&l!==(l=`${n[1].positionInImage.x*100}%`)&&W(t,"left",l)},d(c){c&&Y(t)}}}function Ak(e){let n,t=[],i=new Map,r=e[0];const s=o=>o[1].id;for(let o=0;o<r.length;o+=1){let a=Vy(e,r,o),l=s(a);i.set(l,t[o]=Gy(l,a))}return{c(){n=H("div");for(let o=0;o<t.length;o+=1)t[o].c();_(n,"class","plugin-pano-floorplan__extra-objects svelte-1i87fz7")},m(o,a){Z(o,n,a);for(let l=0;l<t.length;l+=1)t[l]&&t[l].m(n,null)},p(o,[a]){a&1&&(r=o[0],t=zi(t,a,s,1,o,r,i,n,Mg,Gy,null,Vy))},i:de,o:de,d(o){o&&Y(n);for(let a=0;a<t.length;a+=1)t[a].d()}}}function wk(e,n,t){let{extraObjects:i=[]}=n;return e.$$set=r=>{"extraObjects"in r&&t(0,i=r.extraObjects)},[i]}class xk extends ke{constructor(n){super(),Le(this,n,wk,Ak,De,{extraObjects:0},bk)}}function Mk(e){Ue(e,"svelte-18287ai",".missing-floor-wrapper.svelte-18287ai{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;display:flex;justify-content:center;align-items:center}.missing-floor-image.svelte-18287ai{max-width:100%;max-height:100%}")}function Ek(e){let n,t,i,r,s,o;const a=[{floorIndex:e[2],floorplanData:e[4]}];let l={};for(let h=0;h<a.length;h+=1)l=kn(l,a[h]);n=new Cx({props:l}),i=new xk({props:{extraObjects:e[7]}});let c=e[3]&&jy(e);return{c(){Ie(n.$$.fragment),t=ve(),Ie(i.$$.fragment),r=ve(),c&&c.c(),s=ft()},m(h,u){_e(n,h,u),Z(h,t,u),_e(i,h,u),Z(h,r,u),c&&c.m(h,u),Z(h,s,u),o=!0},p(h,u){const d=u&20?Vn(a,[{floorIndex:h[2],floorplanData:h[4]}]):{};n.$set(d);const f={};u&128&&(f.extraObjects=h[7]),i.$set(f),h[3]?c?(c.p(h,u),u&8&&F(c,1)):(c=jy(h),c.c(),F(c,1),c.m(s.parentNode,s)):c&&(Ve(),X(c,1,1,()=>{c=null}),Ge())},i(h){o||(F(n.$$.fragment,h),F(i.$$.fragment,h),F(c),o=!0)},o(h){X(n.$$.fragment,h),X(i.$$.fragment,h),X(c),o=!1},d(h){Se(n,h),h&&Y(t),Se(i,h),h&&Y(r),c&&c.d(h),h&&Y(s)}}}function Ck(e){let n,t,i;return{c(){n=H("div"),t=H("img"),_(t,"class","missing-floor-image svelte-18287ai"),Pn(t.src,i=e[6])||_(t,"src",i),_(t,"alt","缺省楼层"),_(n,"class","missing-floor-wrapper svelte-18287ai")},m(r,s){Z(r,n,s),Q(n,t)},p(r,s){s&64&&!Pn(t.src,i=r[6])&&_(t,"src",i)},i:de,o:de,d(r){r&&Y(n)}}}function jy(e){let n,t;const i=[{five:e[0],pxmm:e[1],floorIndex:e[2],floorplanData:e[4],onRoomHeightClick:e[9],highlightData:e[5],hoveredRoom:void 0}];let r={};for(let s=0;s<i.length;s+=1)r=kn(r,i[s]);return n=new _x({props:r}),{c(){Ie(n.$$.fragment)},m(s,o){_e(n,s,o),t=!0},p(s,o){const a=o&567?Vn(i,[{five:s[0],pxmm:s[1],floorIndex:s[2],floorplanData:s[4],onRoomHeightClick:s[9],highlightData:s[5],hoveredRoom:void 0}]):{};n.$set(a)},i(s){t||(F(n.$$.fragment,s),t=!0)},o(s){X(n.$$.fragment,s),t=!1},d(s){Se(n,s)}}}function Pk(e){let n,t,i,r;const s=[Ck,Ek],o=[];function a(l,c){return l[8]?1:0}return n=a(e),t=o[n]=s[n](e),{c(){t.c(),i=ft()},m(l,c){o[n].m(l,c),Z(l,i,c),r=!0},p(l,[c]){let h=n;n=a(l),n===h?o[n].p(l,c):(Ve(),X(o[h],1,1,()=>{o[h]=null}),Ge(),t=o[n],t?t.p(l,c):(t=o[n]=s[n](l),t.c()),F(t,1),t.m(i.parentNode,i))},i(l){r||(F(t),r=!0)},o(l){X(t),r=!1},d(l){o[n].d(l),l&&Y(i)}}}function _k(e,n,t){let i,r,s,{five:o}=n,{pxmm:a}=n,{floorIndex:l}=n,{hoverEnable:c}=n,{floorplanData:h}=n,{extraObjects:u=[]}=n,{highlightData:d}=n,{missingFloorImageUrl:f}=n;const m=void 0;return e.$$set=p=>{"five"in p&&t(0,o=p.five),"pxmm"in p&&t(1,a=p.pxmm),"floorIndex"in p&&t(2,l=p.floorIndex),"hoverEnable"in p&&t(3,c=p.hoverEnable),"floorplanData"in p&&t(4,h=p.floorplanData),"extraObjects"in p&&t(10,u=p.extraObjects),"highlightData"in p&&t(5,d=p.highlightData),"missingFloorImageUrl"in p&&t(6,f=p.missingFloorImageUrl)},e.$$.update=()=>{e.$$.dirty&20&&t(11,i=h.floorDatas[l]),e.$$.dirty&2048&&t(8,r=i.rooms.length>0),e.$$.dirty&1028&&t(7,s=u==null?void 0:u.filter(p=>p.floorIndex===l))},[o,a,l,c,h,d,f,s,r,m,u,i]}class Sk extends ke{constructor(n){super(),Le(this,n,_k,Pk,De,{five:0,pxmm:1,floorIndex:2,hoverEnable:3,floorplanData:4,extraObjects:10,highlightData:5,missingFloorImageUrl:6},Mk)}}function Ik(e){Ue(e,"svelte-1mvqyqq",".plugin-floorplan-radar.svelte-1mvqyqq{width:100%;height:100%;display:flex;justify-content:center;align-items:center}.plugin-floorplan-radar-container.svelte-1mvqyqq{position:relative}")}function Hy(e){let n,t,i,r,s=e[8]!==0&&Uy(e);return{c(){n=H("div"),s&&s.c(),_(n,"class","plugin-floorplan-radar svelte-1mvqyqq")},m(o,a){Z(o,n,a),s&&s.m(n,null),t=!0,i||(r=[Di(As.call(null,n)),ot(n,"clientWidth",e[14]),ot(n,"clientHeight",e[15])],i=!0)},p(o,a){o[8]!==0?s?(s.p(o,a),a&256&&F(s,1)):(s=Uy(o),s.c(),F(s,1),s.m(n,null)):s&&(Ve(),X(s,1,1,()=>{s=null}),Ge())},i(o){t||(F(s),t=!0)},o(o){X(s),t=!1},d(o){o&&Y(n),s&&s.d(),i=!1,yn(r)}}}function Uy(e){let n,t,i,r,s=`${e[10]}px`,o=`${e[13]}px`,a;const l=[{five:e[0],pxmm:e[11],floorIndex:e[12],floorplanData:e[3],hoverEnable:e[2],extraObjects:e[5],highlightData:e[6],missingFloorImageUrl:e[7]}];let c={};for(let d=0;d<l.length;d+=1)c=kn(c,l[d]);t=new Sk({props:c});const h=[{pxmm:e[11],five:e[0],floorplanData:e[3],cameraImageUrl:e[4]}];let u={};for(let d=0;d<h.length;d+=1)u=kn(u,h[d]);return r=new yk({props:u}),{c(){n=H("div"),Ie(t.$$.fragment),i=ve(),Ie(r.$$.fragment),_(n,"class","plugin-floorplan-radar-container svelte-1mvqyqq"),W(n,"width",s),W(n,"height",o)},m(d,f){Z(d,n,f),_e(t,n,null),Q(n,i),_e(r,n,null),a=!0},p(d,f){const m=f&6381?Vn(l,[{five:d[0],pxmm:d[11],floorIndex:d[12],floorplanData:d[3],hoverEnable:d[2],extraObjects:d[5],highlightData:d[6],missingFloorImageUrl:d[7]}]):{};t.$set(m);const p=f&2073?Vn(h,[{pxmm:d[11],five:d[0],floorplanData:d[3],cameraImageUrl:d[4]}]):{};r.$set(p),f&1024&&s!==(s=`${d[10]}px`)&&W(n,"width",s),f&8192&&o!==(o=`${d[13]}px`)&&W(n,"height",o)},i(d){a||(F(t.$$.fragment,d),F(r.$$.fragment,d),a=!0)},o(d){X(t.$$.fragment,d),X(r.$$.fragment,d),a=!1},d(d){d&&Y(n),Se(t),Se(r)}}}function Tk(e){let n,t,i=e[1]&&Hy(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[1]?i?(i.p(r,s),s&2&&F(i,1)):(i=Hy(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function Dk(e,n,t){var w,x;let{five:i}=n,{visible:r}=n,{hoverEnable:s}=n,{floorplanData:o}=n,{cameraImageUrl:a}=n,{extraObjects:l=[]}=n,{highlightData:c}=n,{missingFloorImageUrl:h}=n,u=0,d=(x=(w=i.work.observers[i.getCurrentState().panoIndex])==null?void 0:w.floorIndex)!=null?x:0,f=0,m=0,p=0,g=0;function y(M){t(12,d=i.work.observers[M].floorIndex)}Yn(()=>(i.on("panoArrived",y),()=>{i.off("panoArrived",y)}));const b=M=>{t(8,f=M.detail)},A=M=>{t(9,m=M.detail)};return e.$$set=M=>{"five"in M&&t(0,i=M.five),"visible"in M&&t(1,r=M.visible),"hoverEnable"in M&&t(2,s=M.hoverEnable),"floorplanData"in M&&t(3,o=M.floorplanData),"cameraImageUrl"in M&&t(4,a=M.cameraImageUrl),"extraObjects"in M&&t(5,l=M.extraObjects),"highlightData"in M&&t(6,c=M.highlightData),"missingFloorImageUrl"in M&&t(7,h=M.missingFloorImageUrl)},e.$$.update=()=>{if(e.$$.dirty&1800){const M=Math.min(f,m),{max:P,min:S}=o.bounding,T=P.x-S.x,z=P.y-S.y,D=function(){return T>z?[M,M/T*z]:[M/z*T,M]}();t(10,p=D[0]),t(13,g=D[1]),t(11,u=p/T)}},[i,r,s,o,a,l,c,h,f,m,p,u,d,g,b,A]}class Lk extends ke{constructor(n){super(),Le(this,n,Dk,Tk,De,{five:0,visible:1,hoverEnable:2,floorplanData:3,cameraImageUrl:4,extraObjects:5,highlightData:6,missingFloorImageUrl:7},Ik)}}let kk=class extends Br{constructor(t,i){super(t);v(this,"name","panoFloorplanRadarPlugin");v(this,"state");v(this,"data");v(this,"app");v(this,"wrapperSelector","");v(this,"wrapper",null);v(this,"disposed",!1);v(this,"extraObjects",[]);v(this,"highlightData",{});v(this,"dispose",()=>{var t;this.disposed=!0,(t=this.app)==null||t.$destroy(),this.wrapper=null,this.wrapperSelector="",this.hooks.emit("dispose")});v(this,"highlight",t=>{this.state.config.highlightEnable&&(this.highlightData=t,this.render())});v(this,"unhighlight",()=>{this.highlightData={},this.render()});v(this,"_disable",t=>{var r;const{userAction:i}=t;(r=this.app)==null||r.$destroy(),this.app=void 0,this.hooks.emit("disable",{userAction:i})});this.five=t;const r={hoverEnable:!0,highlightEnable:!0,cameraImageUrl:ps,missingFloorImageUrl:this.staticPrefix+"/release/web/saas/missing-floor.d687a5ed.png"},s=R(R({},r),i==null?void 0:i.configs);this.state={enabled:!0,visible:!0,config:s},i!=null&&i.wrapper&&console.warn("不推荐继续使用 params.selector 配置父容器,请使用 appendTo 方法"),typeof(i==null?void 0:i.wrapper)=="string"?this.wrapperSelector=i.wrapper:(i==null?void 0:i.wrapper)instanceof Element&&(this.wrapper=i.wrapper),t.once("dispose",this.dispose)}load(t,i,r=!0){return ee(this,null,function*(){function s(c){return Object.prototype.hasOwnProperty.apply(c,["version"])}const o=JSON.parse(JSON.stringify(t)),a=s(o)?o.data:o,l=this.data;this.data=yield ms(a),this.hooks.emit("dataLoaded",this.data),this.hooks.emit("dataChange",this.data,l),i&&this.updateState(i,r),this.render()})}show(){return ee(this,arguments,function*(t={}){if(this.state.visible)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!0},i),this._show({userAction:i})})}hide(){return ee(this,arguments,function*(t={}){if(!this.state.visible)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({visible:!1},i),this._hide({userAction:i})})}enable(t={}){if(this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!0},t.userAction||i),this._enable({userAction:i})}disable(t={}){if(!this.state.enabled)return;const i=t.userAction!==void 0?t.userAction:!0;this.updateState({enabled:!1},t.userAction||i),this._disable({userAction:i})}setState(t,i={}){const r=this.state,s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled){const o={userAction:s};t.enabled?this._enable(o):this._disable(o)}if(t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s};t.visible?this._show(o):this._hide(o)}}appendTo(t){this.wrapper!==t&&this.app&&(this.app.$destroy(),this.app=void 0),this.wrapper=t,this.render()}changeConfigs(t,i=!0){this.setState({config:t},{userAction:i}),this.render()}setExtraObjectsWith3DPositions(t){this.data&&(this.extraObjects=KL(t,this.five,this.data),this.render())}formatData(t){return ee(this,null,function*(){return yield ms(t.data)})}_enable(t){const{userAction:i}=t;this.hooks.emit("enable",{userAction:i}),this.state.visible&&this._show({userAction:i})}_show(t){if(this.disposed||!this.state.enabled)return;const{userAction:i}=t;this.hooks.emit("show",{userAction:i}),this.render()}_hide(t){if(this.disposed||!this.state.enabled)return;const{userAction:i}=t;this.hooks.emit("hide",{userAction:i}),this.render()}updateState(t,i){const r=this.state,s=t.config?R(R({},r.config),t.config):r.config;this.state=Ee(R(R({},this.state),t),{config:s}),!Nn(this.state,r,{deep:!0})&&this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}render(){if(this.disposed||!this.state.enabled)return;if(!this.wrapper&&this.wrapperSelector){const i=document.querySelector(this.wrapperSelector);this.wrapper=i}if(!this.data||!this.wrapper)return;const t=Ee(R({},this.state.config),{five:this.five,floorplanData:this.data,visible:this.state.visible,extraObjects:this.extraObjects,highlightData:this.highlightData});this.app?this.app.$set(t):this.app=new Lk({target:this.wrapper,props:t})}};const Rk=(e,n)=>new kk(e,n),Ok=[{type:0,floorType:1,roomType:"100900000012",name:"其他"},{type:1,floorType:1,roomType:"100900000002",name:"客厅"},{type:2,floorType:1,roomType:"100900000002",name:"餐厅"},{type:3,floorType:0,roomType:"100900000001",name:"卧室"},{type:4,floorType:0,roomType:"100900000001",name:"书房"},{type:5,floorType:3,roomType:"100900000004",name:"卫生间"},{type:6,floorType:3,roomType:"100900000004",name:"淋浴间"},{type:7,floorType:3,roomType:"100900000004",name:"洗手间"},{type:8,floorType:3,roomType:"100900000003",name:"厨房"},{type:9,floorType:1,roomType:"100900000003",name:"开放厨房",onlySubArea:!0},{type:10,floorType:0,roomType:"100900000001",name:"多功能间"},{type:11,floorType:0,roomType:"100900000009",name:"保姆间"},{type:12,floorType:4,roomType:"100900000005",name:"阳台"},{type:13,floorType:4,roomType:"100900000006",name:"露台"},{type:14,floorType:0,roomType:"100900000008",name:"储物间"},{type:15,floorType:0,roomType:"100900000013",name:"衣帽间"},{type:16,floorType:0,roomType:"100900000011",name:"阁楼"},{type:17,floorType:2,roomType:"100900000007",name:"花园"},{type:18,floorType:5,roomType:"100900000010",name:"车库"},{type:19,floorType:1,roomType:"100900000012",name:"电梯"},{type:20,floorType:1,roomType:"100900000012",name:"地下室"},{type:21,floorType:1,roomType:"100900000012",name:"天井"},{type:22,floorType:1,roomType:"100900000012",name:"阳光房"},{type:23,floorType:1,roomType:"100900000012",name:"过道"},{type:24,floorType:1,roomType:"100900000012",name:"楼梯间"},{type:25,floorType:1,roomType:"100900000012",name:"门厅"},{type:26,floorType:2,roomType:"100900000012",name:"入户花园"},{type:27,floorType:1,roomType:"100900000012",name:"玄关"},{type:28,floorType:1,roomType:"100900000012",name:"挑空"},{type:29,floorType:4,roomType:"100900000012",name:"晾晒区"},{type:30,floorType:4,roomType:"100900000012",name:"洗衣房"},{type:31,floorType:0,roomType:"100900000012",name:"娱乐区"},{type:32,floorType:0,roomType:"100900000012",name:"健身区"},{type:33,floorType:0,roomType:"100900000012",name:"接待区"},{type:34,floorType:0,roomType:"100900000012",name:"影音区"},{type:35,floorType:1,roomType:"100900000012",name:"餐饮区"},{type:36,floorType:1,roomType:"100900000012",name:"其他",onlySubArea:!0},{type:37,floorType:1,roomType:"100900000002",name:"起居室"},{type:38,floorType:0,roomType:"100900000001",name:"主卧"},{type:39,floorType:0,roomType:"100900000001",name:"次卧"},{type:40,floorType:0,roomType:"100900000001",name:"优化间"},{type:41,floorType:0,roomType:"100900000001",name:"办公室"},{type:42,floorType:0,roomType:"100900000001",name:"会议室"},{type:43,floorType:0,roomType:"100900000001",name:"洽谈间"},{type:44,floorType:1,roomType:"100900000002",name:"共享大厅"},{type:45,floorType:1,roomType:"100900000012",name:"水吧"},{type:46,floorType:0,roomType:"100900000015",name:"出入口"},{type:47,floorType:0,roomType:"100900000015",name:"大厅"},{type:48,floorType:0,roomType:"100900000015",name:"包厢"},{type:49,floorType:0,roomType:"100900000015",name:"其他"},{type:50,floorType:0,roomType:"100900000016",name:"出入口"},{type:51,floorType:0,roomType:"100900000016",name:"办公区"},{type:52,floorType:0,roomType:"100900000016",name:"老板间"},{type:53,floorType:0,roomType:"100900000016",name:"会议室"},{type:54,floorType:0,roomType:"100900000016",name:"休息区/水吧"},{type:55,floorType:0,roomType:"100900000016",name:"其他"},{type:56,floorType:2,roomType:"100900000012",name:"空中花园"},{type:57,floorType:0,roomType:"100900000001",name:"洋室"},{type:58,floorType:0,roomType:"100900000001",name:"和室"}],zk=[{type:0,description:"木质地板"},{type:1,description:"瓷砖地面"},{type:2,description:"户外地面"},{type:3,description:"卫生间地面"},{type:4,description:"阳台地面"},{type:5,description:"车库地面"}],Bk=[{roomType:"100900000001",description:"室"},{roomType:"100900000002",description:"厅"},{roomType:"100900000003",description:"厨"},{roomType:"100900000004",description:"卫"},{roomType:"100900000005",description:"阳台"},{roomType:"100900000006",description:"露台"},{roomType:"100900000007",description:"花园"},{roomType:"100900000008",description:"储"},{roomType:"100900000009",description:"保姆间"},{roomType:"100900000010",description:"车库"},{roomType:"100900000011",description:"阁楼"},{roomType:"100900000012",description:"其他"},{roomType:"100900000013",description:"衣"},{roomType:"100900000015",description:"商铺"},{roomType:"100900000016",description:"写字楼"}],tp=(e,n,t)=>{const i=new C.Matrix4,r=new C.Euler(e,n,t,"YXZ");return i.makeRotationFromEuler(r),i},Nk=(e,{scale:n,rotation:t,position:i})=>{if(n&&e.scale.set(n,n,n),t){const[r,s,o]=t;r&&e.applyMatrix4(tp(r,0,0)),s&&e.applyMatrix4(tp(0,s,0)),o&&e.applyMatrix4(tp(0,0,o))}return i&&e.position.set(i.x,i.y,i.z),e};function Dx(e,n){e.traverse(t=>{var i;if(t.type==="Mesh"){const r=t,s=R({map:r.material.map||{}},n);r.material=new ne.MeshBasicMaterial(s),r.renderOrder=1,((i=t.parent)==null?void 0:i.type)==="Mesh"&&(t.renderOrder=t.parent.renderOrder+1)}})}const Fk=(e,n)=>{var p;const t=n.fbx_url||"//vrlab-image4.ljcdn.com/release/web/dipan2.f38a21cc.FBX",i=(p=n.north_rad)!=null?p:void 0,r={};let s={x:0,y:0,z:0},o=[0,0,0],a=1,l=i;e.on("modelLoaded",m);const c=g=>ee(exports,null,function*(){var w;const y=(g==null?void 0:g.fbx_url)||t;if(l=(w=g==null?void 0:g.north_rad)!=null?w:i,typeof l!="number")throw new Error('"northRad"配置参数缺失:未配置指南针指向!');const A=yield new j1.FBXLoader().loadAsync(y);return Dx(A,{transparent:!0,side:C.DoubleSide,blending:C.AdditiveBlending}),r.object=A,m(),!0}),h=({latitude:g})=>{if(!r.object)return;const y=u(g);y&&(r.object.position.y=y)},u=g=>{if(r.yBase===void 0)return;const y=.6;if(g>=Math.PI/4)return r.yBase-(y+1.6);const b=g*(4/Math.PI);return r.yBase-(y*b+1.6)},d=()=>{if(!r.object)return;const g=u(e.getPose().latitude);g&&(r.object.position.y=g),e.scene.add(r.object),e.needsRender=!0,e.on("cameraDirectionUpdate",h)},f=()=>{r.object&&(e.scene.remove(r.object),e.needsRender=!0,e.off("cameraDirectionUpdate",h))};function m(){const g=r.object;if(!g)return;const y=e.model.bounding,b=y.max.x-y.min.x,A=y.max.z-y.min.z,w=Math.max(b,A),{max:{x,z:M},min:{x:P,y:S,z:T}}=y;r.yBase=S,s={x:(x+P)/2,y:S-1.6,z:(M+T)/2},o=[0,l-Math.PI/2,0],a=.0045*w,Nk(g,{position:s,rotation:o,scale:a})}return{load:c,disable:f,enable:d}};function Vk(e,n){var c,h,u,d,f;const t=(c=n==null?void 0:n.size)!=null?c:512,i=(h=n==null?void 0:n.fontSize)!=null?h:t*(35/256)*1.2,r=(u=n==null?void 0:n.backgroundColor)!=null?u:"rgba(0,0,0,0)",s=(d=n==null?void 0:n.fontColor)!=null?d:"#fff",o=(f=n==null?void 0:n.textAlign)!=null?f:"center",a=document.createElement("canvas");a.setAttribute("width",t+""),a.setAttribute("height",t+"");const l=a.getContext("2d");return l.fillStyle=r,l.fillRect(0,0,t,t),l.font=`${i}px "微软雅黑"`,l.textAlign=o,l.fillStyle=s,l.fillText(e,t/2,t*.7),new ne.CanvasTexture(a)}const Gk=({x:e,y:n,z:t})=>new ne.Vector3(e,n,t),jk=(e,n)=>{var p,g,y;const t={},i=(p=n.animationEnabled)!=null?p:!0,r=(g=n.position)!=null?g:void 0,s=(y=n.rad)!=null?y:void 0,o=n.fbx_url||"//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx",a=[],l=b=>ee(exports,null,function*(){var z,D,k,O,G,I,U,q;const A=(z=b==null?void 0:b.position)!=null?z:r;if(!A)return Promise.reject(new Error("ModelEntryDoorGuidePlugin.load(): position is undefined"));const w=Gk(A),x=(D=b==null?void 0:b.rad)!=null?D:s,M=(k=b==null?void 0:b.fbx_url)!=null?k:o;if(t.rad=x,x===void 0)return Promise.reject(new Error(`ModelEntryDoorGuidePlugin.load(): rad is ${x}`));const P=yield new j1.FBXLoader().loadAsync(M);P.position.copy(w),P.rotation.z=x,P.scale.set(.8,.8,.8),Dx(P,{transparent:!0,side:C.DoubleSide});const S=(U=(I=(G=(O=P.children)==null?void 0:O[0])==null?void 0:G.children)==null?void 0:I[3])==null?void 0:U.clone();if(!S)return Promise.reject(new Error(`ModelEntryDoorGuidePlugin.load(): textMesh is ${S}`));const T=(q=n.name)!=null?q:"入户门";return S.material=new ne.MeshBasicMaterial({transparent:!0,map:Vk(T)}),S.renderOrder=3,P.children[0].add(S),t.object=P,!0}),c=()=>{if(t.animation)return;if(!t.object)return console.error("ModelEntryDoorGuidePlugin.initAnimation(): state.object is ",t.object);const b=1,A=new ne.AnimationMixer(t.object);a.push(A);const w=A.clipAction(t.object.animations[0]);w.timeScale=b;let x;const M=()=>{let z=0,D=0;const k=1e3/30,O=G=>{z=requestAnimationFrame(O);const I=G-D;I<k||(D=G,a.forEach(U=>U.update(I/1e3)),e.needsRender=!0)};return z=requestAnimationFrame(O),()=>{cancelAnimationFrame(z)}},T={play:()=>{x||(w.play(),x=M(),requestAnimationFrame(()=>{t.object&&t.object.rotation.z!==t.rad&&(t.object.rotation.z=t.rad)}))},stop:()=>{w.stop(),x==null||x(),x=void 0}};t.animation=T},h=b=>{var w;if(!t.object)return console.error("ModelEntryDoorGuidePlugin.enable(): object is ",t.object);((w=b==null?void 0:b.animationEnable)!=null?w:i)&&(t.animation||c(),t.animation.play()),e.scene.add(t.object),e.needsRender=!0},u=()=>{t.object&&(t.animation&&t.animation.stop(),e.scene.remove(t.object),e.needsRender=!0)},d=b=>b==="Floorplan"?h():u();return{load:l,enable:b=>(t.enabled||(t.enabled=!0,d(e.currentMode),e.on("modeChange",d),h(b)),!0),disable:()=>(t.enabled&&(t.enabled=!1,u(),e.off("modeChange",d)),!0)}},Hk=Ki;function Uk(e,n,t,i=Hk.Linear.None){const r=new bd(e).to(n,t).easing(i);zc(()=>r.start(0));const s=ja(a=>{r.update(a)===!1&&s()}),o=[];return r.onDestroy=a=>(o.push(a),r),r.destroy=function(){this.stop(),Object.assign(r,{_onStartCallback:null,_onUpdateCallback:null,_onCompleteCallback:null,_onStopCallbackL:null});let a;for(;a=o.shift();)a();s()},r}function Wk(e,n){return Uk({progress:0},{progress:1},e,n)}var Lx=(e=>(e.Move="Move",e.Rotate="Rotate",e))(Lx||{}),Yi=(e=>(e.Clockwise="Clockwise",e.Anticlockwise="Anticlockwise",e.Loop="Loop",e))(Yi||{});const cu=Math.PI*2;function Wy(e){return(e%cu+cu)%cu}function Qy(e){return e%cu}function np(e,n,t){return e+(n-e)*t}const Sm=(e,n,t)=>{const i=Math.PI,r=i*2;let s=Wy(e),o=Wy(n);return t===Yi.Anticlockwise&&s<o&&(s+=r),t===Yi.Clockwise&&o<s&&(o+=r),t===Yi.Loop&&o-s>i?Sm(s,o,Yi.Anticlockwise):t===Yi.Loop&&s-o>i?Sm(s,o,Yi.Clockwise):{from:s,to:o}},Qk=e=>{const n={},t=(l,c,...h)=>ee(exports,[l,c,...h],function*(s,o,a={preload:!0}){return n.interruptCallback&&n.interruptCallback(!1),a.asyncStartCallback&&(yield a.asyncStartCallback()),s.mode&&s.mode!==e.currentMode&&(yield e.changeMode(s.mode)),a.preload&&s.panoIndex!==void 0&&s.panoIndex!==e.panoIndex&&(yield e.preloadPano(s.panoIndex)),a.asyncEndCallback&&(yield a.asyncEndCallback()),s.panoIndex===void 0&&s.fov===void 0&&s.latitude===void 0&&s.longitude===void 0?!0:yield new Promise((u,d)=>{const f=s.panoIndex!==void 0?s.panoIndex:e.panoIndex;f!==void 0?e.moveToPano(f,R({duration:o,moveEndCallback:()=>u(!0),moveCancelCallback:()=>d(new Error("move canceled"))},s)):d(new Error("unexpected error"))})}),i=s=>{const o=e.state,a=Qy(o.latitude),l=Qy(s.latitude),{from:c,to:h}=Sm(o.longitude,s.longitude,s.rotation||Yi.Loop),u=o.fov,d=s.fov;return{from:{latitude:a,longitude:c,fov:u},to:{latitude:l,longitude:h,fov:d}}};return{move:t,rotate:(l,c,...h)=>ee(exports,[l,c,...h],function*(s,o,a={}){n.interruptCallback&&n.interruptCallback(!1),a.asyncStartCallback&&(yield a.asyncStartCallback()),e.currentMode!==qt.Five.Mode.Panorama&&(yield e.changeMode(qt.Five.Mode.Panorama)),s.panoIndex!==void 0&&s.panoIndex!==e.panoIndex&&(a.preload&&(yield e.preloadPano(s.panoIndex)),yield new Promise((f,m)=>{if(!s.panoIndex){f(!0);return}e.moveToPano(s.panoIndex,{moveEndCallback:()=>f(!0),moveCancelCallback:()=>m(new Error("move canceled"))})})),a.asyncEndCallback&&(yield a.asyncEndCallback());const{from:u,to:d}=i(s);return yield new Promise(f=>{const m=({progress:A})=>{const w={};w.longitude=np(u.longitude,d.longitude,A),w.latitude=np(u.latitude,d.latitude,A),w.fov=np(u.fov,d.fov,A),e.setState(w,!0)},p=()=>{f(!0)},g=()=>{f(!1)},y=s.rotateSpeed?Math.ceil(Math.abs(d.longitude-u.longitude)/s.rotateSpeed*1e3):o,b=Wk(y,Ki.Linear.None).onUpdate(m).onComplete(p).onDestroy(g);s.rotation===Yi.Loop&&b.repeat(1/0).yoyo(!0),n.interruptCallback=(A=!0)=>{b.destroy(),n.interruptCallback=void 0,n.timeoutId&&(clearTimeout(n.timeoutId),n.timeoutId=void 0),f(A)},n.timeoutId=setTimeout(()=>{n.interruptCallback&&n.interruptCallback(!0)},o)})})}};function Yy(e,n){return e.x===n.x&&e.y===n.y}function kx(e,n){return Math.abs(e)===1/0&&Math.abs(n)===1/0?!0:Math.abs(e-n)<.001}function ld(e,n){return(n.y-e.y)/(n.x-e.x)}function Rx(e,n,t){const i=ld(e[1],e[0]),r=ld(n[1],n[0]);if(isNaN(i)||isNaN(r)||kx(i,r))return!1;if(Qh(e[0],n))return e[0];if(Qh(e[1],n))return e[1];if(Qh(n[0],e))return n[0];if(Qh(n[1],e))return n[1];if(t&&!Xk(e,n))return!1;const s=e[0],o=n[0];if(Math.abs(i)===1/0)return{x:s.x,y:n[1].y-(n[1].x-s.x)*r};if(Math.abs(r)===1/0)return{x:o.x,y:e[1].y-(e[1].x-o.x)*i};const a=(o.y-s.y+i*s.x-r*o.x)/(i-r),l=i*a-i*s.x+s.y;return{x:a,y:l}}function Qh(e,n){return Yy(e,n[0])||Yy(e,n[1])?!0:(n[0].x-e.x)*(e.x-n[1].x)>=0&&(n[0].y-e.y)*(e.y-n[1].y)>=0&&kx(ld(n[0],e),ld(e,n[1]))}function Yk(e){let n=1/0,t=-1/0,i=1/0,r=-1/0;return e.forEach(s=>{n=Math.min(n,s.x),t=Math.max(t,s.x),i=Math.min(i,s.y),r=Math.max(r,s.y)}),{x:(n+t)/2,y:(i+r)/2}}function Yh(e,n,t){return(e.x-t.x)*(n.y-t.y)-(n.x-t.x)*(e.y-t.y)}function Xk(e,n){return Math.max(e[0].x,e[1].x)>=Math.min(n[0].x,n[1].x)&&Math.max(n[0].x,n[1].x)>=Math.min(e[0].x,e[1].x)&&Math.max(e[0].y,e[1].y)>=Math.min(n[0].y,n[1].y)&&Yh(n[0],e[1],e[0])*Yh(e[1],n[1],e[0])>0&&Yh(e[0],n[1],n[0])*Yh(n[1],e[1],n[0])>0?1:0}function Ox(e,n=0){n<=0?requestAnimationFrame(e):requestAnimationFrame(()=>Ox(e,n-1))}const Zk=`<style type="text/css">
3174
3174
  .PanoRulerPlugin-rule-line {
3175
3175
  position: absolute;
3176
3176
  transform-origin: left center;
@@ -3520,7 +3520,7 @@ void main() {
3520
3520
  z-index: 5;
3521
3521
  `,t.container.style.pointerEvents="none";const i=m=>(t.wrapper=m,m.appendChild(t.container),l(),!0),r=m=>{t.itemLabels=A4(m),l()},s=()=>(t.enabled||(t.enabled=!0,l()),!0),o=()=>(t.enabled&&(t.enabled=!1,l()),!0),a=()=>{h(),t.container.remove()},l=()=>{var m;if(t.wrapper){if(!t.enabled||!t.fiveModeEnabled){(m=t.app)==null||m.$destroy(),t.app=void 0;return}t.app?t.app.$set({five:e,itemLabels:t.itemLabels}):t.app=new b4({target:t.container,props:{five:e,modelOcclusionEnable:t.modelOcclusionEnable,itemLabels:t.itemLabels,hooks:t.hooks,displayStrategyType:t.displayStrategyType}})}},c=()=>{e.on("modeChange",u),e.once("dispose",a)},h=()=>{e.off("modeChange",u)},u=m=>{if(t.enabled){if(m!==qt.Five.Mode.Floorplan){t.fiveModeEnabled=!1,l();return}e.once("initAnimationEnded",()=>{t.fiveModeEnabled=e.currentMode===qt.Five.Mode.Floorplan,l()})}};return c(),{appendTo:i,load:r,enable:s,disable:o,dispose:a,hooks:t.hooks}},x4={name:"ModelItemLabelPlugin",version:0};var Yo=(e=>(e.TOP_LEFT="topLeft",e.TOP_RIGHT="topRight",e.BOTTOM_LEFT="bottomLeft",e.BOTTOM_RIGHT="bottomRight",e))(Yo||{});function M4(e){if(e.length===0)return[];if(Array.isArray(e[0]))return e;let n=[];return e.forEach(t=>{const i=[t[Yo.TOP_LEFT],t[Yo.BOTTOM_LEFT],t[Yo.BOTTOM_RIGHT],t[Yo.TOP_RIGHT]];n.push(i)}),n}const E4="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAYAAADFw8lbAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAKqADAAQAAAABAAAAKgAAAADUGqULAAAB0ElEQVRYCe2WSUoEQRBFLVHEiVZU1I03cKW38SSewRt4A5fiTty5cQIFR9pZQWkcUNSe2/Z9yISiSGxRkUAy4BGZSVX168gistraYsQKxArECsQKxApYqkDyU5lmsznMM+ZgAGpQhaUkSRbINgLJCXiCBtSgAkVYtGGIBTKj8AgKSVahDNvQa0IUkUG4Bx91BpLdBTOS/cgUIB3a+gMwI9mFzE3a0I3z5B4r292JzGVA8tSSZILMcUDyzIykthOZvYDk+V9Ktmz4yGzhOhV4/+5YU4N/hzqo0StX3Fg5TcnNlYvgs8bPsM4hkScHoyO46haRnGEYktQVI+4ypUYKyXtxyUu27JCceAMJvjo0HoM5CEZ7cPX7i013q3IWVV5r2aw/2TK+svWbPGU68KQCa6pYeus1V0X99quSfvtVSc39lmfz2mdbz32tg1dAJ0421AVs9E7/FxBSezrMmjI/gm5/nYmMkBq+TqBs7LNgTlZH6EnWlPmORdk+pHQipUNfTxtg7p3NIXWRMvXfoqusmXsNhpC6crIS1Zf9C6yAOdlxpK5BW18CiT7A/G93gE+P0FY/RoO+RWqS62YhB2r4YhlixArECsQKxArECvzjCnwAOr0wF44ggHAAAAAASUVORK5CYII=",zg="data:image/png;base64,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",Rm="data:image/png;base64,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",C4="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAABcVBMVEUAAAAAAAD////////+/v45OTn////////39/fp6enPz8/7+/vw8PD+/v7x8fHc3NzHx8f////////+/v77+/vr6+v////7+/v5+fn////z8/P////////q6uqgoKD+/v79/f3m5ub+/v7////////////////39/f39/f////z8/P////t7e3s7Oz29vb////5+fn////h4eH////g4ODV1dX////////BwcH///////////+Ojo5zc3MlJSX////////////////////////7+/v////////////v7+/u7u7n5+f////39/f////09PT6+vr09PT+/v76+vr////5+fnv7+/09PTk5OT////////////////Jycn///++vr7///////+0tLT///9TU1P///8SEhL////////+/v76+vr////8/Pz39/ft7e3t7e36+vr////////X19fV1dX///+xsbF9fX1iYmL///////+K8mOEAAAAenRSTlMaAIDy8CD41cWRX9uk7Kl1VVEw6dWT/M/NvKyVkY475eWIgx0Z39rHv7axnZyZmIuKhn56emZjX1FEPTU0Kx4PCAX69fTgxcKkopWL7crJuri2sa6rnIyHhX54bVtZVU9NSUcsJSIcFROno6Hcwp+ekHVxbWhnRC8nDLc9s8oAAAOGSURBVEjHpdd3X9pAGAfwkBBDAoQmBJmWvUWWiIDIHoJb66x7a4d78Op7pBQ1J5DY33987vnyXEIu3CGy/0hvnDthM+l0hj3JScSudDKOdhNPpl1i8Ut624Gi6+trI3zW1tcdqGM7/SIC5/ZRR2SNJEm7JkHt7FAJjR18WIs40P3cAFxIOaIRna6ZOHxGunk+TDR1ukjUkSr0w86bcKShiz1OI4JMP8YAD9+4emM2Gm407IfIhzm0NxrhKNsLH4SvQ+RktyvUfZIMXYcPPsSFCcvY6EYW6ZPsxuiYZaLwAW5bDY70Da5paxjvm8d+UcjAUL/GzPtCnDF/mwFWhJ75Zs68x05gxxFRGQfa+RYXokHVCC4O4yOqYLTwBjNB+ncWEZnsbzrIvOLz4CW9g4jODn0ZPO/iZN0UmhaPp0Omq+Q/nLu6NO0hErJnurjKdTBzEdAhkqILXDAdbFkJ7EnDe4EVy198srpiwhE4X1RKDFOqviBwcNPK6gmPmeWlGDz+VdHqRPEVHo0tLTM8RpcX4G+flLe6kU/Cs1pYRnm8uriQhfoC+0ZDvbMLi6ttfO5fDCDCKFrvooAKAov+c4BZvy8EzaolCHRdIZ+fBThl9G0Ih1RCrBJWbPiMKYAZ409oMSqFWAktzJ9GBuDvRoVGOIQJMSas0CiM39u45v0M9tbaeLc6F5M+7dhcbRfgg+pcU/oNa85VDwDOzBtmpP9UKsN8BuCzeb1P+kPi08+fASyr6fVPUh/PJ72+xj/bZk5PSV0YlJ4z83iC4EipS5LkiAkeHxGcQerLwMARRzyW+QklhUgKpST8nXfYg+fHkjS89MPz0MFnhKdCSWpc8RBnPAZB3RUvLt7i3oob7f5juDzuikY81tjcHlcHg9xabdyUWDvF2ay3slecr1ptimNx9lhhs1bzXQxy5NZa6VMx9pS2Wt1H77cVjFartYvBdlDICDc0cbVa3Twd2NcOyuLwVqo+K1ebjgdcr0k+O1uXwThfl8vlhqm+99kASup5GINsYhhmG8d7UXzcBgo2e21cd9WlUll5/7G958ql8uxu7y0zS5SGSkOGBA51TRiGQAi232Y9v4kVQZGavpt6c6l3tLpNsc38gGOC01IeLg4Xi8NaLz1KkqO0VzvcTrFscYo4oLjiRAsKEXeJPRqxW0bsFWLGLVbiocyZSm5vbW0nU9BsIfyp/AGqAvfOkBaFawAAAABJRU5ErkJggg==",P4=(e,{videoElement:n})=>{const t={videoMeshes:[],videoTextureEnabled:!1,videoSource:"",rectPoints:[],enabled:!1,videoElement:n},i=Bc(e),r=new Map,s=y=>{t.videoTexture&&(t.videoTexture.image.muted=y)},o=()=>t.videoTexture?t.videoTexture.image.muted:!0,a=()=>{if(t.enabled||!t.videoTexture)return;t.enabled=!0,t.videoMeshes=c(),t.videoMeshes.forEach(b=>e.scene.add(b));const y=()=>{if(!t.videoTexture)return;const b=()=>{var A;t.videoTexture&&((A=t.videoTexture)==null||A.image.removeEventListener("timeupdate",b),t.videoTextureEnabled=!0,t.videoMeshes.forEach(w=>{w.material.map!==t.videoTexture&&(w.material.map=t.videoTexture)}),e.needsRender=!0)};t.videoTexture.image.addEventListener("timeupdate",b),t.videoTexture&&t.videoMeshes.length&&(t.videoTexture.image.play(),t.videoTexture.image.onplay=()=>{i.hide()},t.videoTexture.image.onpause=()=>{i.show()},t.videoTexture.image.onclick=()=>{t.videoTexture.image.muted=!1,t.videoTexture.image.play()})};if(e.model.loaded)y();else return e.once("modelLoaded",()=>y())},l=()=>{t.enabled&&(t.enabled=!1,t.videoMeshes.forEach(y=>{y.geometry.dispose(),y.material.dispose(),e.scene.remove(y),t.videoTexture&&t.videoTexture.image.pause()}),t.videoMeshes=[],e.needsRender=!0)},c=()=>t.rectPoints.map((y,b)=>{const A=new C.BufferGeometry,w=128,x=[];x.push(...y[0].toArray());for(let k=1;k<w;k++)x.push(y[0].x+(y[1].x-y[0].x)*k/w,y[0].y+(y[1].y-y[0].y)*k/w,y[0].z+(y[1].z-y[0].z)*k/w);x.push(...y[1].toArray()),x.push(...y[2].toArray());for(let k=1;k<w;k++)x.push(y[2].x+(y[3].x-y[2].x)*k/w,y[2].y+(y[3].y-y[2].y)*k/w,y[2].z+(y[3].z-y[2].z)*k/w);x.push(...y[3].toArray());const M=[];M.push(0,1);for(let k=1;k<w;k++)M.push(0,1-k/w);M.push(0,0),M.push(1,0);for(let k=1;k<w;k++)M.push(1,k/w);M.push(1,1);const P=[];for(let k=0;k<w;k++)P.push(k,k+1,w*2-k,k,w*2-k,w*2+1-k);A.setAttribute("position",new C.BufferAttribute(new Float32Array(x),3)),A.setAttribute("uv",new C.BufferAttribute(new Float32Array(M),2)),A.setIndex(new C.BufferAttribute(new Uint32Array(P),1));const S=new C.MeshBasicMaterial({map:t.videoTextureEnabled?t.videoTexture:t.imageTexture,side:C.DoubleSide}),T=new C.Mesh(A,S);T.renderOrder=1,T.name=`ModelTVVideoPlugin-${b}-${performance.now()}`;const z=[y[1],y[2],y[3],y[0]],D=i.create3DDomContainer(z);if(D!=null&&D.container){const k=document.createElement("div");k.classList.add("play-icon"),k.style.width="100%",k.style.height="100%",k.style.display="flex",k.style.justifyContent="center",k.style.alignItems="center",k.style.pointerEvents="none",D.container.appendChild(k);const O=document.createElement("img");O.src=zg,O.style.width="200px",O.style.pointerEvents="auto",O.onclick=()=>{t.videoTexture.image.muted=!1,t.videoTexture.image.play()},k.appendChild(O),r.set(T,D)}return T}),h=y=>{const b=new C.TextureLoader().load(y);return b.minFilter=C.LinearFilter,b.magFilter=C.LinearFilter,b.format=C.RGBFormat,b},u=(y,b)=>{let A=b;return new Promise((w,x)=>{const M=new XMLHttpRequest;M.onreadystatechange=()=>{if(M.readyState===4)if(M.status===200){const P=window.URL||window.webkitURL;A=A||document.createElement("video"),A.crossOrigin="anonymous",A.muted=!0,A.loop=!0,A.playsInline=!0,A.src=P.createObjectURL(M.response);const S=new C.VideoTexture(A);S.minFilter=C.LinearFilter,S.magFilter=C.LinearFilter,S.format=C.RGBFormat,w(Object.assign(S,{videoSource:y}))}else x(new Error("Video download Error: "+M.status))},M.onerror=P=>x(P),M.open("GET",y),M.responseType="blob",M.send()})},d=(y,b)=>ee(exports,null,function*(){const{video_src:A,video_poster_src:w,points:x}=y;t.videoSource=A,t.rectPoints=M4(x).map(M=>M.map(({x:P,y:S,z:T})=>new C.Vector3(P,S,T))),t.imageTexture=h(w),b&&(t.videoElement=b),t.videoTexture=yield u(t.videoSource,t.videoElement),t.enabled=!!y.enable,t.enabled&&a()}),f=y=>{if(!t.enabled)return;const b=t.videoMeshes;if(!(!b||y.intersectObjects(b).length===0))return t.videoTexture&&(t.videoTexture.image.paused||t.videoTexture.image.pause()),!1},m=y=>{y==="Floorplan"?i.hide():i.show()},p=()=>{if(!t.enabled)return;const y=e.camera.position;if(r.forEach((b,A)=>{const w=b.css3DObject.position.clone(),x=w.clone().sub(y).normalize(),M=new C.Raycaster(y,x),P=e.model.intersectRaycaster(M)[0],S=w.distanceTo(y),T=.01;P&&P.distance+T<S?b.hide():b.show()}),!o()){const b=t.rectPoints.find(A=>{const w=A[0].clone().add(A[1]).add(A[2]).add(A[3]).divideScalar(4);return A.map(x=>x.clone().add(w).divideScalar(2)).filter(x=>{const M=x.distanceTo(y),P=new C.Raycaster(y,x.clone().sub(y).normalize()),S=e.model.intersectRaycaster(P)[0],T=.01;return!(S&&S.distance+T<M)}).length>=2});(!b||b.length===0)&&s(!0)}},g=()=>{l(),t.videoTexture=void 0,e.off("modeChange",m),e.off("wantsTapGesture",f),e.off("panoArrived",p),e.off("renderFrame",()=>{t.videoMeshes.forEach(y=>{y&&(y.needsRender=!0)})})};return e.on("modeChange",m),e.on("wantsTapGesture",f),e.on("panoArrived",p),e.on("renderFrame",()=>{t.videoMeshes.forEach(y=>{y&&(y.needsRender=!0)})}),{enable:a,disable:l,load:d,dispose:g,state:t,css3DRenderPlugin:i}};var Ns=(e=>(e.SMALL="small",e.MIDLLE="middle",e.LARGE="large",e.EXTRA_LARGE="x-large",e))(Ns||{});function _4(e){Ue(e,"svelte-1jhufeh",`.item-label-item.svelte-1jhufeh.svelte-1jhufeh{position:absolute;z-index:0;transform:none;cursor:pointer;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;animation:svelte-1jhufeh-fadeIn .3s ease-in}.item-label-item.fold.svelte-1jhufeh>.item-label-item__text-wrap.svelte-1jhufeh{visibility:hidden}.item-label-item.fold.svelte-1jhufeh>.item-label-item__bar.anchor.svelte-1jhufeh{visibility:hidden}.item-label-item.fold.svelte-1jhufeh>.item-label-item__bar.anchor.svelte-1jhufeh:after{visibility:visible}.item-label-item__text-wrap.svelte-1jhufeh.svelte-1jhufeh{height:-moz-fit-content;height:fit-content;padding:0.75rem 1.25rem 0.75rem 0.75rem;position:absolute;width:-moz-max-content;width:max-content;max-width:29.5625rem;min-height:5.75rem;background-image:linear-gradient(269deg, rgba(0, 0, 0, 0.50) 0%, rgba(0, 0, 0, 0.60) 49%, rgba(31, 38, 46, 0.70) 100%);border:0.09375rem solid rgba(255, 255, 255, .65);border-radius:0.1875rem;color:white;transform:translate(-50%, 0);display:flex;justify-content:flex-start;align-items:center;box-sizing:border-box;overflow:hidden;pointer-events:all}.item-label-item__custom.svelte-1jhufeh.svelte-1jhufeh{padding:0;max-width:unset;min-height:unset;background-image:unset;border:0;border-radius:0}.icon-wrap.svelte-1jhufeh.svelte-1jhufeh{width:4.25rem;height:100%;display:flex;justify-content:center;align-content:center}.icon.svelte-1jhufeh.svelte-1jhufeh{width:4.25rem;height:4.25rem;background-repeat:no-repeat;background-size:contain;background-position:center}.item-label-text.svelte-1jhufeh.svelte-1jhufeh{margin-left:0.75rem;padding-left:0.75rem;min-height:4.25rem;height:auto;display:flex;flex-flow:column;justify-content:space-around;align-content:flex-start;border-left:solid rgba(255, 255, 255, .2) 0.0625rem;border-top:solid rgba(255, 255, 255, .2) 0;border-right:solid rgba(255, 255, 255, .2) 0;border-bottom:solid rgba(255, 255, 255, .2) 0;pointer-events:auto}.item-model.svelte-1jhufeh.svelte-1jhufeh{white-space:nowrap;font-size:1.375rem;font-weight:bold;line-height:1.875rem}.item-name.svelte-1jhufeh.svelte-1jhufeh{height:auto;word-wrap:break-word;word-break:break-all;font-size:1.25rem;line-height:1.75rem}.item-label-item__bar.svelte-1jhufeh.svelte-1jhufeh{position:absolute;bottom:0;width:0.1875rem;background-image:linear-gradient(to bottom, white, rgba(255, 255, 255, 0));box-shadow:0 0.125rem 0.5rem 0 rgba(0, 0, 0, 0.20);pointer-events:none}.item-label-item__bar.anchor.svelte-1jhufeh.svelte-1jhufeh:after{content:'';position:absolute;bottom:0;width:1.5rem;height:1.5rem;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAABcVBMVEUAAAAAAAD////////+/v45OTn////////39/fp6enPz8/7+/vw8PD+/v7x8fHc3NzHx8f////////+/v77+/vr6+v////7+/v5+fn////z8/P////////q6uqgoKD+/v79/f3m5ub+/v7////////////////39/f39/f////z8/P////t7e3s7Oz29vb////5+fn////h4eH////g4ODV1dX////////BwcH///////////+Ojo5zc3MlJSX////////////////////////7+/v////////////v7+/u7u7n5+f////39/f////09PT6+vr09PT+/v76+vr////5+fnv7+/09PTk5OT////////////////Jycn///++vr7///////+0tLT///9TU1P///8SEhL////////+/v76+vr////8/Pz39/ft7e3t7e36+vr////////X19fV1dX///+xsbF9fX1iYmL///////+K8mOEAAAAenRSTlMaAIDy8CD41cWRX9uk7Kl1VVEw6dWT/M/NvKyVkY475eWIgx0Z39rHv7axnZyZmIuKhn56emZjX1FEPTU0Kx4PCAX69fTgxcKkopWL7crJuri2sa6rnIyHhX54bVtZVU9NSUcsJSIcFROno6Hcwp+ekHVxbWhnRC8nDLc9s8oAAAOGSURBVEjHpdd3X9pAGAfwkBBDAoQmBJmWvUWWiIDIHoJb66x7a4d78Op7pBQ1J5DY33987vnyXEIu3CGy/0hvnDthM+l0hj3JScSudDKOdhNPpl1i8Ut624Gi6+trI3zW1tcdqGM7/SIC5/ZRR2SNJEm7JkHt7FAJjR18WIs40P3cAFxIOaIRna6ZOHxGunk+TDR1ukjUkSr0w86bcKShiz1OI4JMP8YAD9+4emM2Gm407IfIhzm0NxrhKNsLH4SvQ+RktyvUfZIMXYcPPsSFCcvY6EYW6ZPsxuiYZaLwAW5bDY70Da5paxjvm8d+UcjAUL/GzPtCnDF/mwFWhJ75Zs68x05gxxFRGQfa+RYXokHVCC4O4yOqYLTwBjNB+ncWEZnsbzrIvOLz4CW9g4jODn0ZPO/iZN0UmhaPp0Omq+Q/nLu6NO0hErJnurjKdTBzEdAhkqILXDAdbFkJ7EnDe4EVy198srpiwhE4X1RKDFOqviBwcNPK6gmPmeWlGDz+VdHqRPEVHo0tLTM8RpcX4G+flLe6kU/Cs1pYRnm8uriQhfoC+0ZDvbMLi6ttfO5fDCDCKFrvooAKAov+c4BZvy8EzaolCHRdIZ+fBThl9G0Ih1RCrBJWbPiMKYAZ409oMSqFWAktzJ9GBuDvRoVGOIQJMSas0CiM39u45v0M9tbaeLc6F5M+7dhcbRfgg+pcU/oNa85VDwDOzBtmpP9UKsN8BuCzeb1P+kPi08+fASyr6fVPUh/PJ72+xj/bZk5PSV0YlJ4z83iC4EipS5LkiAkeHxGcQerLwMARRzyW+QklhUgKpST8nXfYg+fHkjS89MPz0MFnhKdCSWpc8RBnPAZB3RUvLt7i3oob7f5juDzuikY81tjcHlcHg9xabdyUWDvF2ay3slecr1ptimNx9lhhs1bzXQxy5NZa6VMx9pS2Wt1H77cVjFartYvBdlDICDc0cbVa3Twd2NcOyuLwVqo+K1ebjgdcr0k+O1uXwThfl8vlhqm+99kASup5GINsYhhmG8d7UXzcBgo2e21cd9WlUll5/7G958ql8uxu7y0zS5SGSkOGBA51TRiGQAi232Y9v4kVQZGavpt6c6l3tLpNsc38gGOC01IeLg4Xi8NaLz1KkqO0VzvcTrFscYo4oLjiRAsKEXeJPRqxW0bsFWLGLVbiocyZSm5vbW0nU9BsIfyp/AGqAvfOkBaFawAAAABJRU5ErkJggg==');background-position:center;background-size:contain;transform:translate(-0.65625rem, 50%)}@keyframes svelte-1jhufeh-fadeIn{from{opacity:0
3522
3522
  }to{opacity:1
3523
- }}`)}function S4(e){let n,t,i,r=(e[0].code||e[0].id)+"",s,o,a,l=e[0].name+"",c,h=e[0].icon&&Ob(e);return{c(){h&&h.c(),n=ve(),t=H("div"),i=H("span"),s=xt(r),o=ve(),a=H("span"),c=xt(l),_(i,"class","item-model svelte-1jhufeh"),_(a,"class","item-name svelte-1jhufeh"),_(t,"class","item-label-text svelte-1jhufeh")},m(u,d){h&&h.m(u,d),Z(u,n,d),Z(u,t,d),Q(t,i),Q(i,s),Q(t,o),Q(t,a),Q(a,c)},p(u,d){u[0].icon?h?h.p(u,d):(h=Ob(u),h.c(),h.m(n.parentNode,n)):h&&(h.d(1),h=null),d&1&&r!==(r=(u[0].code||u[0].id)+"")&&Ct(s,r),d&1&&l!==(l=u[0].name+"")&&Ct(c,l)},d(u){h&&h.d(u),u&&Y(n),u&&Y(t)}}}function I4(e){let n;return{c(){n=H("div")},m(t,i){Z(t,n,i),e[6](n)},p:de,d(t){t&&Y(n),e[6](null)}}}function Ob(e){let n,t,i,r,s;return{c(){n=H("div"),t=H("div"),_(t,"class","icon svelte-1jhufeh"),_(t,"style",i=`background-image: url(${e[0].icon})`),_(n,"class","icon-wrap svelte-1jhufeh")},m(o,a){Z(o,n,a),Q(n,t),r||(s=ot(n,"click",e[7]),r=!0)},p(o,a){a&1&&i!==(i=`background-image: url(${o[0].icon})`)&&_(t,"style",i)},d(o){o&&Y(n),r=!1,s()}}}function T4(e){let n,t,i,r,s,o,a,l,c,h;function u(m,p){return p&1&&(i=null),i==null&&(i=typeof m[0].render=="function"),i?I4:S4}let d=u(e,-1),f=d(e);return{c(){n=H("div"),t=H("div"),f.c(),s=ve(),o=H("div"),_(t,"class",r=on(Jn("item-label-item__text-wrap",{"item-label-item__custom":typeof e[0].render=="function"}))+" svelte-1jhufeh"),W(t,"bottom",`${e[0].strokeLength}px`),_(o,"class",a=on(Jn("item-label-item__bar",{anchor:e[1]}))+" svelte-1jhufeh"),W(o,"height",`${e[0].strokeLength}px`),_(n,"class",l=on(Jn("item-label-item",{fold:e[0].isFold}))+" svelte-1jhufeh"),W(n,"z-index",e[0].zIndex),W(n,"transform",e[0].transform)},m(m,p){Z(m,n,p),Q(n,t),f.m(t,null),Q(n,s),Q(n,o),c||(h=ot(t,"click",e[4]),c=!0)},p(m,[p]){d===(d=u(m,p))&&f?f.p(m,p):(f.d(1),f=d(m),f&&(f.c(),f.m(t,null))),p&1&&r!==(r=on(Jn("item-label-item__text-wrap",{"item-label-item__custom":typeof m[0].render=="function"}))+" svelte-1jhufeh")&&_(t,"class",r),p&1&&W(t,"bottom",`${m[0].strokeLength}px`),p&2&&a!==(a=on(Jn("item-label-item__bar",{anchor:m[1]}))+" svelte-1jhufeh")&&_(o,"class",a),p&1&&W(o,"height",`${m[0].strokeLength}px`),p&1&&l!==(l=on(Jn("item-label-item",{fold:m[0].isFold}))+" svelte-1jhufeh")&&_(n,"class",l),p&1&&W(n,"z-index",m[0].zIndex),p&1&&W(n,"transform",m[0].transform)},i:de,o:de,d(m){m&&Y(n),f.d(),c=!1,h()}}}function D4(e,n,t){let{itemLabel:i}=n,{hooks:r}=n,{anchorEnabled:s}=n,{onIconClick:o}=n;function a(){r.emit("onLabelClick",i)}let l;function c(u){Qt[u?"unshift":"push"](()=>{l=u,t(3,l)})}const h=u=>o(i);return e.$$set=u=>{"itemLabel"in u&&t(0,i=u.itemLabel),"hooks"in u&&t(5,r=u.hooks),"anchorEnabled"in u&&t(1,s=u.anchorEnabled),"onIconClick"in u&&t(2,o=u.onIconClick)},e.$$.update=()=>{if(e.$$.dirty&9&&typeof i.render=="function"&&l&&l.children.length===0){const u=i.render(i);u&&l.appendChild(u)}},[i,s,o,l,a,r,c,h]}class L4 extends ke{constructor(n){super(),Le(this,n,D4,T4,De,{itemLabel:0,hooks:5,anchorEnabled:1,onIconClick:2},_4)}}const{Raycaster:k4,Vector3:tG}=C,zb=(e,n,t,i)=>{const r=n.clone().sub(t).normalize(),s=new k4;s.set(t,r);const[o]=e.model.intersectRaycaster(s);return o&&o.distance+.01<i},R4=(e,n)=>{switch(n){case Ns.SMALL:return Math.ceil(-27.78*e+85);case Ns.MIDLLE:return Math.ceil(-38.9*e+130);case Ns.LARGE:return Math.ceil(-44.44*e+140);case Ns.EXTRA_LARGE:return Math.ceil(-92.59*e+300)}},O4=e=>`translate(${e[0]}px, ${e[1]}px)`;function Bb(e){return e.map(n=>R({observerIndex:void 0,visible:!1,isFold:!1},n))}function z4(e){Ue(e,"svelte-f82itz",".item-labels-container.svelte-f82itz{width:100%;height:100%;position:relative}")}function Nb(e,n,t){const i=e.slice();return i[29]=n[t],i}function Fb(e){let n,t;return n=new L4({props:{itemLabel:e[29],hooks:e[0],anchorEnabled:e[2],onIconClick:e[6]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r[0]&2&&(s.itemLabel=i[29]),r[0]&1&&(s.hooks=i[0]),r[0]&4&&(s.anchorEnabled=i[2]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function Vb(e,n){let t,i,r,s=n[29].visible&&Fb(n);return{key:e,first:null,c(){t=ft(),s&&s.c(),i=ft(),this.first=t},m(o,a){Z(o,t,a),s&&s.m(o,a),Z(o,i,a),r=!0},p(o,a){n=o,n[29].visible?s?(s.p(n,a),a[0]&2&&F(s,1)):(s=Fb(n),s.c(),F(s,1),s.m(i.parentNode,i)):s&&(Ve(),X(s,1,1,()=>{s=null}),Ge())},i(o){r||(F(s),r=!0)},o(o){X(s),r=!1},d(o){o&&Y(t),s&&s.d(o),o&&Y(i)}}}function B4(e){let n,t=[],i=new Map,r,s,o=e[1];const a=l=>l[29].id;for(let l=0;l<o.length;l+=1){let c=Nb(e,o,l),h=a(c);i.set(h,t[l]=Vb(h,c))}return{c(){n=H("div");for(let l=0;l<t.length;l+=1)t[l].c();_(n,"class","item-labels-container svelte-f82itz"),an(()=>e[12].call(n)),W(n,"opacity",e[5]?1:0)},m(l,c){Z(l,n,c);for(let h=0;h<t.length;h+=1)t[h]&&t[h].m(n,null);r=yg(n,e[12].bind(n)),s=!0},p(l,c){c[0]&71&&(o=l[1],Ve(),t=zi(t,c,a,1,l,o,i,n,bs,Vb,null,Nb),Ge()),c[0]&32&&W(n,"opacity",l[5]?1:0)},i(l){if(!s){for(let c=0;c<o.length;c+=1)F(t[c]);s=!0}},o(l){for(let c=0;c<t.length;c+=1)X(t[c]);s=!1},d(l){l&&Y(n);for(let c=0;c<t.length;c+=1)t[c].d();r()}}}let N4=11;function F4(e,n,t){const{Vector3:i}=C;let{five:r}=n,{modelOcclusionEnable:s}=n,{itemLabels:o}=n,{hooks:a}=n,{displayStrategyType:l}=n,{maxVisibleDistance:c}=n,h=null,u=null,d=(r==null?void 0:r.currentMode)===qt.Five.Mode.Panorama,f,m,p=[],g=!0;const y=(G,I)=>{const U=G.camera.position.clone(),q=new i(I.modelPosition[0],I.modelPosition[1],I.modelPosition[2]),K=q.distanceTo(U);return c!==void 0&&G.state.mode===qt.Five.Mode.Panorama&&K>c?!1:zb(G,q.clone().sub(U).normalize(),U,K)},b=G=>{const{camera:I,model:U}=r,{x:q,y:K,z:te}=G.clone().project(I),ie=(q+1)/2,fe=(2-(K+1))/2;return!!(Math.abs(te)<1&&[ie,fe].every(Ae=>Ae<1&&Ae>=0))},A=(G,I)=>{const U=new i(I.modelPosition[0],I.modelPosition[1],I.modelPosition[2]),q=G.project2d(U),K=q==null?void 0:q.x,te=q==null?void 0:q.y;return[K,te]},w=(G,I)=>{const U=I.map(K=>{if(G.state.panoIndex!==K.panoIndex)return Ee(R({},K),{visible:!1});const te=A(G,K);K.name.length*N4;const ie=R4(K.modelPosition[1],l),fe=G.currentMode===qt.Five.Mode.Panorama?b(new i(K.position[0],K.position[1],K.position[2])):!0,ye=s?y(G,K):!1,be=fe&&!ye;if(!be)return Ee(R({},K),{visible:be});p.push(te);const Je=O4(te);return Ee(R({},K),{visible:be,transform:Je,strokeLength:ie})}),q=U.filter(({visible:K})=>K).map(K=>({itemLabelItem:K,distance:new i(K.modelPosition[0],K.modelPosition[1],K.modelPosition[2]).clone().distanceTo(G.camera.position)})).sort((K,te)=>K.distance-te.distance);return U.map(K=>{const te=q.findIndex(ie=>ie.itemLabelItem.id===K.id);return te!==void 0?Ee(R({},K),{zIndex:te*10}):K})},x=()=>{p=[],t(1,u=w(r,u))},M=()=>{t(5,g=!1),P()},P=nM(()=>{t(5,g=!0),x()},300),S=()=>{r.once("renderFrame",x)},T=()=>{window.addEventListener("resize",S,!1)},z=()=>{h!==o&&(t(1,u=Bb(o)),h=o,x())},D=(G,I)=>{let U=[];for(const{position:K,panoIndex:te}of I){const ie=G.distanceTo(K);(c===void 0||ie<=c||r.state.mode!==qt.Five.Mode.Panorama)&&U.push({panoIndex:te,obVector:K,distance:ie})}U=U.sort((K,te)=>K.distance-te.distance);let q;for(const K of U){const{obVector:te,distance:ie,panoIndex:fe}=K;if(!zb(r,G,te,ie)){q=fe;break}}return typeof q=="number"?I[q]:void 0},k=G=>{if(r.state.mode===qt.Five.Mode.Panorama)return;const I=r.work.observers,U=new i().fromArray(G.position),q=D(U,I);if(q&&(G.observerIndex=q.panoIndex),typeof G.observerIndex=="number"){const K=I[G.observerIndex],te=U.clone().sub(K.position).normalize(),ie={longitude:Math.PI+Math.atan2(te.x,te.z),latitude:Math.acos(te.y/te.length())-Math.PI/2};r.setState(Ee(R({},ie),{mode:qt.Five.Mode.Panorama,panoIndex:G.observerIndex})),r.once("initAnimationEnded",()=>{t(1,u=u.map(fe=>Ee(R({},fe),{isFold:fe.id!==G.id}))),r.once("cameraUpdate",()=>{t(1,u=u.map(fe=>Ee(R({},fe),{isFold:!1})))})})}};fx(()=>{z()}),Yn(()=>{t(1,u=Bb(o)),h=o,x(),T(),r.on("cameraUpdate",M)}),bi(()=>{r.off("cameraUpdate",M),window.removeEventListener("resize",S,!1)});function O(){f=this.clientWidth,m=this.clientHeight,t(3,f),t(4,m)}return e.$$set=G=>{"five"in G&&t(7,r=G.five),"modelOcclusionEnable"in G&&t(8,s=G.modelOcclusionEnable),"itemLabels"in G&&t(9,o=G.itemLabels),"hooks"in G&&t(0,a=G.hooks),"displayStrategyType"in G&&t(10,l=G.displayStrategyType),"maxVisibleDistance"in G&&t(11,c=G.maxVisibleDistance)},[a,u,d,f,m,g,k,r,s,o,l,c,O]}class V4 extends ke{constructor(n){super(),Le(this,n,F4,B4,De,{five:7,modelOcclusionEnable:8,itemLabels:9,hooks:0,displayStrategyType:10,maxVisibleDistance:11},z4,[-1,-1])}}function G4(e){return e.item_labels.map(n=>Ee(R({},n),{modelPosition:[n.position[0],n.position[1],n.position[2]],observerIndex:void 0}))}const j4=void 0,H4=(e,n)=>{var d,f,m,p;const t={container:document.createElement("div"),data:null,enabled:!0,fiveModeEnabled:!0,itemLabels:[],wrapper:null,app:void 0,hooks:new qt.Subscribe,modelOcclusionEnable:(d=n==null?void 0:n.modelOcclusionEnable)!=null?d:!0,onlyVisibleInPanorama:(f=n==null?void 0:n.onlyVisibleInPanorama)!=null?f:!0,displayStrategyType:(m=n==null?void 0:n.displayStrategyType)!=null?m:Ns.SMALL,maxVisibleDistance:(p=n==null?void 0:n.maxVisibleDistance)!=null?p:j4};t.container.setAttribute("class","item-label-plugin-container"),t.container.style.cssText=`
3523
+ }}`)}function S4(e){let n,t,i,r=(e[0].code||e[0].id)+"",s,o,a,l=e[0].name+"",c,h=e[0].icon&&Ob(e);return{c(){h&&h.c(),n=ve(),t=H("div"),i=H("span"),s=xt(r),o=ve(),a=H("span"),c=xt(l),_(i,"class","item-model svelte-1jhufeh"),_(a,"class","item-name svelte-1jhufeh"),_(t,"class","item-label-text svelte-1jhufeh")},m(u,d){h&&h.m(u,d),Z(u,n,d),Z(u,t,d),Q(t,i),Q(i,s),Q(t,o),Q(t,a),Q(a,c)},p(u,d){u[0].icon?h?h.p(u,d):(h=Ob(u),h.c(),h.m(n.parentNode,n)):h&&(h.d(1),h=null),d&1&&r!==(r=(u[0].code||u[0].id)+"")&&Ct(s,r),d&1&&l!==(l=u[0].name+"")&&Ct(c,l)},d(u){h&&h.d(u),u&&Y(n),u&&Y(t)}}}function I4(e){let n;return{c(){n=H("div")},m(t,i){Z(t,n,i),e[6](n)},p:de,d(t){t&&Y(n),e[6](null)}}}function Ob(e){let n,t,i,r,s;return{c(){n=H("div"),t=H("div"),_(t,"class","icon svelte-1jhufeh"),_(t,"style",i=`background-image: url(${e[0].icon})`),_(n,"class","icon-wrap svelte-1jhufeh")},m(o,a){Z(o,n,a),Q(n,t),r||(s=ot(n,"click",e[7]),r=!0)},p(o,a){a&1&&i!==(i=`background-image: url(${o[0].icon})`)&&_(t,"style",i)},d(o){o&&Y(n),r=!1,s()}}}function T4(e){let n,t,i,r,s,o,a,l,c,h;function u(m,p){return p&1&&(i=null),i==null&&(i=typeof m[0].render=="function"),i?I4:S4}let d=u(e,-1),f=d(e);return{c(){n=H("div"),t=H("div"),f.c(),s=ve(),o=H("div"),_(t,"class",r=on(Jn("item-label-item__text-wrap",{"item-label-item__custom":typeof e[0].render=="function"}))+" svelte-1jhufeh"),W(t,"bottom",`${e[0].strokeLength}px`),_(o,"class",a=on(Jn("item-label-item__bar",{anchor:e[1]}))+" svelte-1jhufeh"),W(o,"height",`${e[0].strokeLength}px`),_(n,"class",l=on(Jn("item-label-item",{fold:e[0].isFold}))+" svelte-1jhufeh"),W(n,"z-index",e[0].zIndex),W(n,"transform",e[0].transform)},m(m,p){Z(m,n,p),Q(n,t),f.m(t,null),Q(n,s),Q(n,o),c||(h=ot(t,"click",e[4]),c=!0)},p(m,[p]){d===(d=u(m,p))&&f?f.p(m,p):(f.d(1),f=d(m),f&&(f.c(),f.m(t,null))),p&1&&r!==(r=on(Jn("item-label-item__text-wrap",{"item-label-item__custom":typeof m[0].render=="function"}))+" svelte-1jhufeh")&&_(t,"class",r),p&1&&W(t,"bottom",`${m[0].strokeLength}px`),p&2&&a!==(a=on(Jn("item-label-item__bar",{anchor:m[1]}))+" svelte-1jhufeh")&&_(o,"class",a),p&1&&W(o,"height",`${m[0].strokeLength}px`),p&1&&l!==(l=on(Jn("item-label-item",{fold:m[0].isFold}))+" svelte-1jhufeh")&&_(n,"class",l),p&1&&W(n,"z-index",m[0].zIndex),p&1&&W(n,"transform",m[0].transform)},i:de,o:de,d(m){m&&Y(n),f.d(),c=!1,h()}}}function D4(e,n,t){let{itemLabel:i}=n,{hooks:r}=n,{anchorEnabled:s}=n,{onIconClick:o}=n;function a(){r.emit("onLabelClick",i)}let l;function c(u){Qt[u?"unshift":"push"](()=>{l=u,t(3,l)})}const h=u=>o(i);return e.$$set=u=>{"itemLabel"in u&&t(0,i=u.itemLabel),"hooks"in u&&t(5,r=u.hooks),"anchorEnabled"in u&&t(1,s=u.anchorEnabled),"onIconClick"in u&&t(2,o=u.onIconClick)},e.$$.update=()=>{if(e.$$.dirty&9&&typeof i.render=="function"&&l&&l.children.length===0){const u=i.render(i);u&&l.appendChild(u)}},[i,s,o,l,a,r,c,h]}class L4 extends ke{constructor(n){super(),Le(this,n,D4,T4,De,{itemLabel:0,hooks:5,anchorEnabled:1,onIconClick:2},_4)}}const{Raycaster:k4,Vector3:$6}=C,zb=(e,n,t,i)=>{const r=n.clone().sub(t).normalize(),s=new k4;s.set(t,r);const[o]=e.model.intersectRaycaster(s);return o&&o.distance+.01<i},R4=(e,n)=>{switch(n){case Ns.SMALL:return Math.ceil(-27.78*e+85);case Ns.MIDLLE:return Math.ceil(-38.9*e+130);case Ns.LARGE:return Math.ceil(-44.44*e+140);case Ns.EXTRA_LARGE:return Math.ceil(-92.59*e+300)}},O4=e=>`translate(${e[0]}px, ${e[1]}px)`;function Bb(e){return e.map(n=>R({observerIndex:void 0,visible:!1,isFold:!1},n))}function z4(e){Ue(e,"svelte-f82itz",".item-labels-container.svelte-f82itz{width:100%;height:100%;position:relative}")}function Nb(e,n,t){const i=e.slice();return i[29]=n[t],i}function Fb(e){let n,t;return n=new L4({props:{itemLabel:e[29],hooks:e[0],anchorEnabled:e[2],onIconClick:e[6]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r[0]&2&&(s.itemLabel=i[29]),r[0]&1&&(s.hooks=i[0]),r[0]&4&&(s.anchorEnabled=i[2]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function Vb(e,n){let t,i,r,s=n[29].visible&&Fb(n);return{key:e,first:null,c(){t=ft(),s&&s.c(),i=ft(),this.first=t},m(o,a){Z(o,t,a),s&&s.m(o,a),Z(o,i,a),r=!0},p(o,a){n=o,n[29].visible?s?(s.p(n,a),a[0]&2&&F(s,1)):(s=Fb(n),s.c(),F(s,1),s.m(i.parentNode,i)):s&&(Ve(),X(s,1,1,()=>{s=null}),Ge())},i(o){r||(F(s),r=!0)},o(o){X(s),r=!1},d(o){o&&Y(t),s&&s.d(o),o&&Y(i)}}}function B4(e){let n,t=[],i=new Map,r,s,o=e[1];const a=l=>l[29].id;for(let l=0;l<o.length;l+=1){let c=Nb(e,o,l),h=a(c);i.set(h,t[l]=Vb(h,c))}return{c(){n=H("div");for(let l=0;l<t.length;l+=1)t[l].c();_(n,"class","item-labels-container svelte-f82itz"),an(()=>e[12].call(n)),W(n,"opacity",e[5]?1:0)},m(l,c){Z(l,n,c);for(let h=0;h<t.length;h+=1)t[h]&&t[h].m(n,null);r=yg(n,e[12].bind(n)),s=!0},p(l,c){c[0]&71&&(o=l[1],Ve(),t=zi(t,c,a,1,l,o,i,n,bs,Vb,null,Nb),Ge()),c[0]&32&&W(n,"opacity",l[5]?1:0)},i(l){if(!s){for(let c=0;c<o.length;c+=1)F(t[c]);s=!0}},o(l){for(let c=0;c<t.length;c+=1)X(t[c]);s=!1},d(l){l&&Y(n);for(let c=0;c<t.length;c+=1)t[c].d();r()}}}let N4=11;function F4(e,n,t){const{Vector3:i}=C;let{five:r}=n,{modelOcclusionEnable:s}=n,{itemLabels:o}=n,{hooks:a}=n,{displayStrategyType:l}=n,{maxVisibleDistance:c}=n,h=null,u=null,d=(r==null?void 0:r.currentMode)===qt.Five.Mode.Panorama,f,m,p=[],g=!0;const y=(G,I)=>{const U=G.camera.position.clone(),q=new i(I.modelPosition[0],I.modelPosition[1],I.modelPosition[2]),K=q.distanceTo(U);return c!==void 0&&G.state.mode===qt.Five.Mode.Panorama&&K>c?!1:zb(G,q.clone().sub(U).normalize(),U,K)},b=G=>{const{camera:I,model:U}=r,{x:q,y:K,z:te}=G.clone().project(I),ie=(q+1)/2,fe=(2-(K+1))/2;return!!(Math.abs(te)<1&&[ie,fe].every(Ae=>Ae<1&&Ae>=0))},A=(G,I)=>{const U=new i(I.modelPosition[0],I.modelPosition[1],I.modelPosition[2]),q=G.project2d(U),K=q==null?void 0:q.x,te=q==null?void 0:q.y;return[K,te]},w=(G,I)=>{const U=I.map(K=>{if(G.state.panoIndex!==K.panoIndex)return Ee(R({},K),{visible:!1});const te=A(G,K);K.name.length*N4;const ie=R4(K.modelPosition[1],l),fe=G.currentMode===qt.Five.Mode.Panorama?b(new i(K.position[0],K.position[1],K.position[2])):!0,ye=s?y(G,K):!1,be=fe&&!ye;if(!be)return Ee(R({},K),{visible:be});p.push(te);const Je=O4(te);return Ee(R({},K),{visible:be,transform:Je,strokeLength:ie})}),q=U.filter(({visible:K})=>K).map(K=>({itemLabelItem:K,distance:new i(K.modelPosition[0],K.modelPosition[1],K.modelPosition[2]).clone().distanceTo(G.camera.position)})).sort((K,te)=>K.distance-te.distance);return U.map(K=>{const te=q.findIndex(ie=>ie.itemLabelItem.id===K.id);return te!==void 0?Ee(R({},K),{zIndex:te*10}):K})},x=()=>{p=[],t(1,u=w(r,u))},M=()=>{t(5,g=!1),P()},P=nM(()=>{t(5,g=!0),x()},300),S=()=>{r.once("renderFrame",x)},T=()=>{window.addEventListener("resize",S,!1)},z=()=>{h!==o&&(t(1,u=Bb(o)),h=o,x())},D=(G,I)=>{let U=[];for(const{position:K,panoIndex:te}of I){const ie=G.distanceTo(K);(c===void 0||ie<=c||r.state.mode!==qt.Five.Mode.Panorama)&&U.push({panoIndex:te,obVector:K,distance:ie})}U=U.sort((K,te)=>K.distance-te.distance);let q;for(const K of U){const{obVector:te,distance:ie,panoIndex:fe}=K;if(!zb(r,G,te,ie)){q=fe;break}}return typeof q=="number"?I[q]:void 0},k=G=>{if(r.state.mode===qt.Five.Mode.Panorama)return;const I=r.work.observers,U=new i().fromArray(G.position),q=D(U,I);if(q&&(G.observerIndex=q.panoIndex),typeof G.observerIndex=="number"){const K=I[G.observerIndex],te=U.clone().sub(K.position).normalize(),ie={longitude:Math.PI+Math.atan2(te.x,te.z),latitude:Math.acos(te.y/te.length())-Math.PI/2};r.setState(Ee(R({},ie),{mode:qt.Five.Mode.Panorama,panoIndex:G.observerIndex})),r.once("initAnimationEnded",()=>{t(1,u=u.map(fe=>Ee(R({},fe),{isFold:fe.id!==G.id}))),r.once("cameraUpdate",()=>{t(1,u=u.map(fe=>Ee(R({},fe),{isFold:!1})))})})}};fx(()=>{z()}),Yn(()=>{t(1,u=Bb(o)),h=o,x(),T(),r.on("cameraUpdate",M)}),bi(()=>{r.off("cameraUpdate",M),window.removeEventListener("resize",S,!1)});function O(){f=this.clientWidth,m=this.clientHeight,t(3,f),t(4,m)}return e.$$set=G=>{"five"in G&&t(7,r=G.five),"modelOcclusionEnable"in G&&t(8,s=G.modelOcclusionEnable),"itemLabels"in G&&t(9,o=G.itemLabels),"hooks"in G&&t(0,a=G.hooks),"displayStrategyType"in G&&t(10,l=G.displayStrategyType),"maxVisibleDistance"in G&&t(11,c=G.maxVisibleDistance)},[a,u,d,f,m,g,k,r,s,o,l,c,O]}class V4 extends ke{constructor(n){super(),Le(this,n,F4,B4,De,{five:7,modelOcclusionEnable:8,itemLabels:9,hooks:0,displayStrategyType:10,maxVisibleDistance:11},z4,[-1,-1])}}function G4(e){return e.item_labels.map(n=>Ee(R({},n),{modelPosition:[n.position[0],n.position[1],n.position[2]],observerIndex:void 0}))}const j4=void 0,H4=(e,n)=>{var d,f,m,p;const t={container:document.createElement("div"),data:null,enabled:!0,fiveModeEnabled:!0,itemLabels:[],wrapper:null,app:void 0,hooks:new qt.Subscribe,modelOcclusionEnable:(d=n==null?void 0:n.modelOcclusionEnable)!=null?d:!0,onlyVisibleInPanorama:(f=n==null?void 0:n.onlyVisibleInPanorama)!=null?f:!0,displayStrategyType:(m=n==null?void 0:n.displayStrategyType)!=null?m:Ns.SMALL,maxVisibleDistance:(p=n==null?void 0:n.maxVisibleDistance)!=null?p:j4};t.container.setAttribute("class","item-label-plugin-container"),t.container.style.cssText=`
3524
3524
  position: absolute;
3525
3525
  left: 0;
3526
3526
  top: 0;
@@ -3560,7 +3560,7 @@ void main() {
3560
3560
  void main() {
3561
3561
  gl_FragColor = texture2D(map, vUv);
3562
3562
  }
3563
- `);this.uniforms={map:{value:t}}}}class SM extends C.Mesh{constructor(){super(...arguments);v(this,"name","MediaPlane");v(this,"src")}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}dispose(){this.traverse(t=>{if(t.isMesh){const i=t;i.geometry.dispose(),(i.material instanceof Array?i.material:[i.material]).forEach(s=>{s.dispose()})}})}}class IM extends SM{constructor(t,i,r){var a;super();v(this,"name","PanoTagPluginImagePlane");this.src=t;const s=(a=r==null?void 0:r.resolveZFighting)!=null?a:!0;let o=i;if(s){const l=Nc(i,5e-4);o=i.map(c=>c.clone().add(l))}zx(t).then(({texture:l,transparent:c})=>{var p;const h=new C.MeshBasicMaterial({map:l,transparent:c}),u=Cl((p=r==null?void 0:r.objectFit)!=null?p:"contain",o,l.image.width/l.image.height),d=lr(...u),f=u.map(g=>g.clone().sub(d)),m=new _M(f);this.position.copy(d),this.geometry=m,this.material=h}).catch(l=>{console.error(`Imageplane error ${l==null?void 0:l.message}`)})}}class TM extends SM{constructor(t,i,r){const{videoCoverSrc:s,objectFit:o="contain",playButton:a="withText",paused:l=!0,videoTextureMap:c,ImageTextureMap:h,domEvents:u}=r!=null?r:{};super();v(this,"isVideoPlane",!0);v(this,"name","PanoTagPluginImagePlane");v(this,"videoInstance");v(this,"onVideoReady");v(this,"objectFit");v(this,"buttonSrc");v(this,"videoCoverSrc");v(this,"domEvents");v(this,"disposers",[]);v(this,"cornerPoints");v(this,"videoMesh");v(this,"coverMesh");v(this,"buttonMesh");v(this,"videoTextureMap");v(this,"ImageTextureMap");this.cornerPoints=i,this.src=t,this.buttonSrc=(()=>a==="withText"?zg:a==="withoutText"?Rm:typeof a=="string"?a:Rm)(),this.videoCoverSrc=s,this.objectFit=o,this.videoTextureMap=c,this.ImageTextureMap=h,this.domEvents=u,this.position.copy(lr(...i)),this.videoCoverSrc&&l?this.addCoverMesh().then(()=>this.addButtonMesh()):this.addVideoMesh().then(()=>{l?this.addButtonMesh():this.play(!0)}),this.addEventListener("removed",()=>{this.remove(...this.children)}),this.addEventListener("dispose",()=>{var d;(d=this.disposers)==null||d.forEach(f=>f==null?void 0:f())})}play(t=!1){return ee(this,null,function*(){this.videoMesh||(yield this.addVideoMesh()),this.showPlayUI(),this.videoInstance.paused&&this.videoInstance.play().then(()=>this.showPlayUI()).catch(i=>{this.pause(),console.error("play error",i)}),this.videoInstance.muted=t,this.render()})}pause(){this.videoInstance&&(this.videoInstance.pause(),this.showPauseUI().then(()=>this.render()))}initialRenderHooks(t){const r=t(()=>{var s;this.videoMesh&&((s=this.videoInstance)==null?void 0:s.paused)===!1&&(this.videoMesh.needsRender=!0)});this.disposers.push(()=>r)}showPlayUI(){this.coverMesh&&(this.coverMesh.visible=!1),this.remove(this.buttonMesh),this.videoMesh.visible=!0}showPauseUI(){return ee(this,null,function*(){this.coverMesh?(this.coverMesh.visible=!0,this.videoMesh&&(this.videoMesh.visible=!1)):(yield this.addCoverMesh(),this.coverMesh&&(this.videoMesh.visible=!1)),this.addButtonMesh().then(()=>this.render())})}render(){var t;this.videoMesh&&(this.videoMesh.needsRender=!0),this.coverMesh&&(this.coverMesh.needsRender=!0),this.buttonMesh&&(this.buttonMesh.needsRender=!0),this.videoMesh&&((t=this.videoInstance)==null?void 0:t.paused)===!1&&(this.videoMesh.needsRender=!0)}addCoverMesh(){return ee(this,null,function*(){if(this.children.includes(this.coverMesh))return;const t=yield(()=>ee(this,null,function*(){if(this.coverMesh)return this.coverMesh;if(!this.videoCoverSrc)return;const{texture:i,transparent:r}=yield this.getImageTexture(this.videoCoverSrc),s=new C.MeshBasicMaterial({transparent:!1,map:i}),o=Cl(this.objectFit,this.cornerPoints,i.image.width/i.image.height),a=new cp(o,s);return a.position.copy(new ne.Vector3(0,0,0)),a.name="videoCoverMesh",a}))();return t&&(this.children.includes(this.coverMesh)||(this.add(t),this.coverMesh=t)),t})}addVideoMesh(){return ee(this,null,function*(){if(this.children.includes(this.videoMesh))return;const t=yield(()=>ee(this,null,function*(){if(this.videoMesh)return this.videoMesh;if(!this.src)return;const r=this.getVideoTexture(this.src),s=new C.MeshBasicMaterial({transparent:!1,map:r}),o=yield new Promise(l=>{r.metadataLoaded?l(Cl(this.objectFit,this.cornerPoints,r.image.videoWidth/r.image.videoHeight)):r.addEventListener("videoLoaded",()=>l(Cl(this.objectFit,this.cornerPoints,r.image.videoWidth/r.image.videoHeight)))}),a=new cp(o,s);return a.name="videoMesh",a.position.copy(new ne.Vector3(0,0,0)),a}))();if(!t)return;this.domEvents.addAutoBindEventListener(t,"click",()=>{!this.videoInstance.paused&&this.videoInstance.muted?this.videoInstance.muted=!1:this.pause()},{noEmitWhenHide:!0});const i=t.material.map.image;return i.addEventListener("playing",()=>{this.coverMesh||this.remove(this.buttonMesh),this.render()}),i.addEventListener("pause",()=>{this.videoInstance.paused&&(this.showPauseUI(),this.render())}),this.children.includes(this.videoMesh)||(this.add(t),this.videoMesh=t,this.videoInstance=i),t})}addButtonMesh(){return ee(this,null,function*(){if(this.children.includes(this.buttonMesh))return;const t=yield(()=>ee(this,null,function*(){var f,m,p,g;if(this.buttonMesh)return this.buttonMesh;const i=(m=(f=this.videoMesh)==null?void 0:f.geometry.points[0].distanceTo(this.videoMesh.geometry.points[3]))!=null?m:1/0,r=(g=(p=this.coverMesh)==null?void 0:p.geometry.points[0].distanceTo(this.coverMesh.geometry.points[3]))!=null?g:1/0,s=this.cornerPoints[0].distanceTo(this.cornerPoints[3]),a=Math.min(i,r,s)/s*.3,{texture:l,transparent:c}=yield this.getImageTexture(this.buttonSrc),h=Cl("contain",this.cornerPoints,l.image.width/l.image.height),u=new cp(h,new fF(l));u.position.copy(new ne.Vector3(0,0,0)),u.name="buttonMesh",u.scale.set(a,a,a),this.domEvents.addAutoBindEventListener(u,"click",()=>{this.play()},{noEmitWhenHide:!0});const d=Nc(h,5e-4);return u.position.add(d),u}))();return this.children.includes(this.buttonMesh)||(this.add(t),this.buttonMesh=t),t})}getImageTexture(t){return ee(this,null,function*(){var r,s;if((r=this.ImageTextureMap)!=null&&r.has(t))return this.ImageTextureMap.get(t);const i=yield zx(t);return(s=this.ImageTextureMap)==null||s.set(t,i),i})}getVideoTexture(t){var r,s;if((r=this.videoTextureMap)!=null&&r.has(t))return this.videoTextureMap.get(t);const i=dF(t);return(s=this.videoTextureMap)==null||s.set(t,i),i}}function n1(e){return Object.entries(e)}function i1(e){var t,i;typeof e.visibleConfig=="object"&&e.visibleConfig.keep&&(e.visibleConfig.keep==="visible"?e.visibleConfig={keep:e.visibleConfig.keep,visibleFiveMode:(t=e.visibleConfig)==null?void 0:t.visibleFiveMode}:e.visibleConfig.keep==="hidden"&&(e.visibleConfig={keep:e.visibleConfig.keep})),typeof e.unfoldedConfig=="object"&&(e.unfoldedConfig.disableFold&&(e.unfoldedConfig={keep:"unfolded"}),e.unfoldedConfig.disableUnfold&&(e.unfoldedConfig={keep:"folded"}),e.unfoldedConfig.keep&&(e.unfoldedConfig={keep:e.unfoldedConfig.keep}));const n=(i=e.initialState)!=null?i:{};return typeof e.unfoldedConfig=="object"&&(e.unfoldedConfig.keep==="unfolded"?n.unfolded=!0:e.unfoldedConfig.keep==="folded"&&(n.unfolded=!1)),typeof e.visibleConfig=="object"&&(e.visibleConfig.keep==="visible"?n.visible=!0:e.visibleConfig.keep==="hidden"&&(n.visible=!1)),e.initialState=n,e}const DM={visibleConfig:{intersectRaycaster:{enabled:!0,distanceAccuracy:.01,checkPoints:"corner",needPassed:1}},clickable:!0,simulate3D:!1,renderType:"Dom"};var LM=(e=>(e.PointTag="PointTag",e.PlaneTag="PlaneTag",e))(LM||{}),kM=(e=>(e.Audio="Audio",e.Text="Text",e.ImageText="ImageText",e.Image="Image",e.Video="Video",e.Link="Link",e.Sticker="Sticker",e.VRLink="VRLink",e.PanoLink="PanoLink",e.Marketing="Marketing",e.MediaPlane="MediaPlane",e.MediaModel="MediaModel",e.Model="Model",e.Panorama="Panorama",e.Custom="Custom",e.Unknown="Unknown",e))(kM||{}),RM=(e=>(e.Two="2D",e.Three="3D",e))(RM||{});function hp(e,n,t){var f,m,p,g,y;const i=(f=t==null?void 0:t.useCache)!=null?f:!0;if(!e)return(m=n.globalConfig)!=null?m:{};if(i){if((p=e==null?void 0:e.computedConfig)!=null&&p._isMerged)return e.computedConfig;if((g=e==null?void 0:e.config)!=null&&g._isMerged)return e.config}const r={},s={},o={};n.contentTypeConfig&&Object.entries(n.contentTypeConfig).forEach(([b,A])=>{var z,D;const w=b,x=w.split("-"),M=b.startsWith("["),P=M?x[0].slice(1,-1):void 0,S=M?x.slice(1):x,T=P?["PanoramaLike","ModelLike"].includes(P)?(z=s[P])!=null?z:s[P]={}:(D=o[P])!=null?D:o[P]={}:r;if(!T[w]){if(S.length===0&&(T[w]=A),S.length===1){const[k]=S;(e.contentType===k||k==="Any")&&(T[w]=A)}if(S.length===2){const[k="Any",O="Any"]=S;k==="Mixin"&&e.contentType===O&&(T[w]=A),(e.stickType===k||k==="Any")&&(e.contentType===O||O==="Any")&&(T[w]=A)}if(S.length===3){const[k="Any",O,G]=S;if(O==="Audio"&&e.contentType==="Audio"){const I=e;(I.stickType===k||k==="Any")&&I.data.appearance===G&&(T[w]=A)}}}});const a=(y=e.initialConfig)!=null?y:{},l=jt({},DM,n.globalConfig,...Object.values(r)),c=jt({},l,a),h={},u=Object.values(qt.Five.Mode);n1(s).forEach(([b,A])=>{u.forEach(w=>{(b==="PanoramaLike"&&Fs(w)||b==="ModelLike"&&_i(w))&&(h[w]=jt({},l,...Object.values(A),a,{_isMerged:!0}))})}),n1(o).forEach(([b,A])=>{const w=h[b];h[b]=jt({},l,w,...Object.values(A),a,{_isMerged:!0})});const d=Ee(R({},c),{configWithFiveMode:h});return i1(d),Object.values(h).forEach(b=>i1(b)),d._isMerged=!0,d}function r1(e){const n=e.split("?")[0].split(".").pop();return n?n.toLowerCase():""}function pF(e,n){if(!e)return 0;const t=e.observers;if(!n||!t)return console.error("getFloorIndex: invalid arguments: ",{point:n,observer:t}),0;const i=[];t.forEach(s=>{var a,l,c;const o=(l=(a=s.floorIndex)!=null?a:s.floor_index)!=null?l:0;i[o]||(i[o]=[]),i[o].push(wc(s.position,(c=e.options)==null?void 0:c.transform).y)});const r=i.map(s=>s.reduce((o,a)=>o+a,0)/s.length);for(let s=r.length-1;s>0;s--)if(n.y>=r[s])return s;return 0}class _c{constructor(){v(this,"cache_raycasterDistance",new Map);v(this,"cache_visible",new Map)}clear(){this.cache_visible.clear(),this.cache_raycasterDistance.clear()}static generateCameraTagKey(n,t,i=3){const r=R(R({},t.five.getCurrentState()),n),s=r.mode==="Panorama"?t.workUtil.getObserverPosition(r.panoIndex):t.five.camera.position;return s?[s.x.toFixed(i),s.y.toFixed(i),s.z.toFixed(i),t.id].join(","):void 0}getVisible(n,t,i=1){const r=_c.generateCameraTagKey(t,n,i);if(r)return this.cache_visible.get(r)}setVisible(n,t,i,r=1){const s=_c.generateCameraTagKey(t,n,r);s&&this.cache_visible.set(s,i)}}class Yg{constructor(n,t){v(this,"plugin");v(this,"id");v(this,"contentType");v(this,"stickType");v(this,"enabled");v(this,"config");v(this,"data");v(this,"state");v(this,"temporaryState",{visible:!0});v(this,"originPosition");v(this,"position");v(this,"fiveState");v(this,"model");v(this,"matrix");v(this,"screenPosition");v(this,"normal");v(this,"mediaPlane");v(this,"hooks");v(this,"zIndex");v(this,"play");v(this,"pause");v(this,"tag3DContentSvelte");v(this,"dom");v(this,"contentDom");v(this,"initialConfig");v(this,"computedConfig");v(this,"cache");v(this,"entryFromModel");var l,c,h,u;this.plugin=n;const i=Bg(t);t.stickType=i;const r=JSON.parse(JSON.stringify(t.data)),s=(l=t.initialConfig)!=null?l:t.config?JSON.parse(JSON.stringify(t.config)):{};t.initialConfig=s;const o=hp(t,n.config),a=this.getConfig(t);t.config=a,this.id=(c=t.id)!=null?c:xn(),this.enabled=(h=t.enabled)!=null?h:!0,this.contentType=t.contentType,this.data=(u=a.initialData)!=null&&u.important?jt(t.data,r,a.initialData):jt(t.data,a.initialData,r),this.state=R({visible:void 0,unfolded:!this.can("fold")},a.initialState),this.originPosition=t.position,t.originPosition=this.originPosition,this.position=(()=>{const d=t.originPosition;if(!d)return;const f=n.workUtil.transform;return Array.isArray(d)&&d.length===4?d.map(Ft).map(m=>wc(m,f).toArray()):wc(Ft(d),f).toArray()})(),this.matrix=t.matrix?(()=>{const d=new C.Matrix4().fromArray(t.matrix);return d.premultiply(n.workUtil.transform),d.elements})():t.matrix,this.initialConfig=s,this.computedConfig=o,this.stickType=i,this.config=t.config,this.fiveState=t.fiveState,this.normal=t.normal,this.cache=new _c,this.hooks=new Cn,Object.keys(t).forEach(d=>{this[d]===void 0&&t[d]!==void 0&&(this[d]=t[d])})}get five(){return this.plugin.five}get fiveUtil(){return this.plugin.fiveUtil}get workUtil(){return this.plugin.workUtil}get centerPosition(){const n=zm(this);return lr(...Array.isArray(n)?n:[n])}get currentConfig(){var r,s;const n=hp(this,this.plugin.config,{useCache:!0}),t=this.five.getCurrentState().mode,i=(r=n.configWithFiveMode)==null?void 0:r[t];return(s=i!=null?i:n)!=null?s:{}}get currentVisible(){return!(!this.plugin.state.enabled||!this.plugin.state.visible||!this.enabled||!this.state.visible)}get sharedCache(){return this.plugin.cache}applyVisible(){throw new Error("Method not implemented.")}find(n){return ee(this,null,function*(){var r;const t=this.fiveState;if(!this.fiveState)return;const i=(r=n==null?void 0:n.targetMode)!=null?r:this.five.state.mode;if(i==="Panorama"){const s=t==null?void 0:t.panoIndex;if(kr(s))return;const o=this.workUtil.getObserverPosition(s),a=this.centerPosition.clone().sub(o).normalize();this.five.setState(R({mode:"Panorama",workCode:this.workUtil.workCode,panoIndex:s},Oc(a))),yield this.five.ready()}else i==="Mapview"&&(yield ex(this.five,this.centerPosition,n==null?void 0:n.pointConfig))})}blink(n){return ee(this,null,function*(){var a,l,c,h;const t=(a=this.enabled)!=null?a:!0,i=(l=this.state)==null?void 0:l.visible,r=t&&i;r===!1&&(this.state.visible=!0,this.enabled=!0,this.applyVisible(),this.plugin.render(),this.computeRenderType()!=="Mesh"?yield new Promise(u=>ee(this,null,function*(){if(this.dom||this.contentDom){u();return}const d=setInterval(()=>{(this.dom||this.contentDom)&&(u(),clearInterval(d))},16.7)})):this.stickType==="Model"&&!((c=this.model)!=null&&c.object)?yield(h=this.model)==null?void 0:h.promise:this.stickType==="Plane"&&(yield new Promise(u=>ee(this,null,function*(){if(this.mediaPlane){u();return}const d=setInterval(()=>{this.mediaPlane&&(u(),clearInterval(d))},16.7)}))),this.dom&&(this.dom.style.visibility="hidden"),this.contentDom&&(this.contentDom.style.visibility="hidden"));const s=(()=>{var d;const u=[];return u.push(this.dom),this.stickType!=="2DPoint"&&u.push(this.contentDom),u.push((d=this.model)==null?void 0:d.object),u.push(this.mediaPlane),u.filter(Boolean)})();if(!s.length){console.warn("tagDom is empty");return}yield(r?Td:$w)(s,R({begin:()=>{r===!1&&(this.dom&&(this.dom.style.visibility=""),this.contentDom&&(this.contentDom.style.visibility=""))},updateRender:()=>{this.five.needsRender=!0}},n)).finished,t===!1&&(this.enabled=!1,this.updateVisible()),i===!1&&this.updateVisible(),r===!1&&(this.dom&&(this.dom.style.visibility=""),this.contentDom&&(this.contentDom.style.visibility=""))})}unfold(){}unfoldAndFoldOthers(){}fold(){}enable(){this.enabled=!0,this.hooks.emit("enable"),this.applyVisible()}disable(){this.enabled=!1,this.hooks.emit("disable"),this.applyVisible()}changeData(n,t=!0){return this.setData(n,t)}changePosition(n){return this.setPosition(n)}setData(n,t=!0){t?this.data=jt(this.data,n):this.data=R(R({},this.data),n),this.hooks.emit("dataChanged",this.data)}setPosition(n){throw new Error("Method not implemented.")}set(n,t=!0){this.plugin.tagsLengthWillUpdate=!0,t?jt(this,n):Object.assign(this,n),this.cache.clear()}updateConfig(){var i;const n=this.getConfig(void 0,{useCache:!1});this.computedConfig=n;const t=this.getConfig();if(this.config=t,this.config.initialData){const r=JSON.parse(JSON.stringify(this.data));this.data=(i=t.initialData)!=null&&i.important?jt(this.data,r,t.initialData):jt(this.data,t.initialData,r)}this.cache.clear()}updateVisible(){this.state.visible=this.getVisible(),this.applyVisible()}updateZIndex(){const n=this.getDistance();this.zIndex=Math.round((1e4-(n!=null?n:0))*100)}getConfig(n,t){var o,a,l;const i=hp(n!=null?n:this,this.plugin.config,{useCache:t==null?void 0:t.useCache}),r=(o=t==null?void 0:t.fiveMode)!=null?o:this.five.getCurrentState().mode,s=(a=i.configWithFiveMode)==null?void 0:a[r];return(l=s!=null?s:i)!=null?l:{}}getDistance(n,t=3){const i=R(R({},this.five.getCurrentState()),n),{panoIndex:r,mode:s}=i,o=s==="Panorama"?this.workUtil.getObserverPosition(r):this.five.camera.position,a=this.centerPosition;return!o||!a?-1:o.distanceTo(a)}getVisible(n){if(!this.enabled||!this.plugin.state.enabled||!this.fiveUtil.model)return!1;const t=R(R({},this.five.getCurrentState()),n);let i=this.cache.getVisible(this,t);return kr(i)&&(i=this.computeVisible(t).value,this.cache.setVisible(this,t,i)),i}getUnfoldedByPanoIndex(n){if(!this.currentVisible)return;const i=this.computeUnfoldedByPanoIndex(n);return i&&this.getUnfoldedByCamera()}getUnfoldedByCamera(){return this.currentVisible?this.computeUnfoldedByCamera():void 0}can(n){const t=this.currentConfig;if(!t||typeof t!="object")return!0;if(n==="show"||n==="hide"){if(!t.visibleConfig||typeof t.visibleConfig!="object")return!0;if(n==="show"&&t.visibleConfig.keep==="hidden"||n==="hide"&&(t.visibleConfig.keep==="visible"||t.visibleConfig.alwaysShowWhenMovePano))return!1}if(n==="fold"||n==="unfold"){if(!t.unfoldedConfig||typeof t.unfoldedConfig!="object")return!0;if(n==="fold"&&t.unfoldedConfig.keep==="unfolded"||n==="unfold"&&t.unfoldedConfig.keep==="folded")return!1}return!0}onClick(n){}computeRenderType(){const n=(()=>{if(this.stickType==="3DPoint")return"Dom";const t=this.getConfig();if(!t||typeof t!="object"||!t.renderType)return;const i=this.data.mediaData;if(!(!i||i.length===0)&&t.renderType==="Mesh"){if(IO(this)){if(i.length===1){if(i[0].type==="Video")return navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&navigator.userAgent.toLowerCase().indexOf("mobile")>-1?"Dom":"Mesh";if(i[0].type==="Image")return r1(i[0].url)==="gif"?"Dom":"Mesh"}}else if($i(this))return i.length===1&&i[0].type==="Image"?r1(i[0].url)==="gif"?"Dom":"Mesh":"BehindDom"}})();return n!=null?n:"Dom"}computeVisible(n){const t=R(R({},this.five.getCurrentState()),n),{panoIndex:i,mode:r}=t,s=[];return(()=>{var c,u,d;const l=(c=this.getConfig().visibleConfig)!=null?c:{};if(typeof l=="function")return{value:l(this.five,{tag:this,distance:this.getDistance(t,void 0)}),checkedList:s,reason:"config function result"};{if(l.keep==="hidden")return{value:!1,checkedList:s,reason:"config.keep is hidden"};if(l.keep==="visible")return{value:!0,checkedList:s,reason:"config.keep is visible"};const f=this.computeVisibleByFiveMode(l,r);if((f==null?void 0:f.value)===!1)return f;if(l.followModelVisibility===!0&&["poincare","aerophoto","sand"].includes(this.workUtil.fromType)&&(r==="Floorplan"||r==="Mapview")){const h=this.computeVisibleByFloorIndex(),{value:m}=h,p=po(h,["value"]);if(m===!1)return R({value:!1,checkedList:s,reason:"followModelVisibility check failed"},p)}if(Fs(r)&&l.visiblePanoIndex!==void 0&&l.visiblePanoIndex!=="all"&&i!==void 0){if(s.push("visiblePanoIndex"),Array.isArray(l.visiblePanoIndex)&&!l.visiblePanoIndex.includes(i))return{value:!1,checkedList:s,reason:`current panoIndex is not included in visiblePano. currentPanoIndex: ${i}, visiblePanoIndex: ${l.visiblePanoIndex}`};if(l.visiblePanoIndex==="current"&&i!==((u=this.fiveState)==null?void 0:u.panoIndex))return{value:!1,checkedList:s,reason:`current panoIndex is not equal to tag.panoIndex. currentPanoIndex: ${i}, tag.panoIndex: ${(d=this.fiveState)==null?void 0:d.panoIndex}`}}if(l.visibleDistance!==void 0&&(s.push("visibleDistance"),l.visibleDistance!=="unLimited")){const m=this.getDistance(t,1);if(qh(m,l.visibleDistance)===!1)return{value:!1,checkedList:s,panoIndex:i,visibleDistance:l.visibleDistance,reason:`distance is not in visibleDistance. distance: ${m}, visibleDistance: ${l.visibleDistance.min} - ${l.visibleDistance.max}`}}if(l.intersectRaycaster!==!1&&(typeof l.intersectRaycaster!="object"||l.intersectRaycaster.enabled!==!1)){if(s.push("intersectRaycaster"),i===void 0)return{value:!1,checkedList:s,reason:`intersectRaycaster check failed: panoIndex is ${i}`};const m=this.computeVisibleByIntersect(i);if(m.value===!1)return Object.assign(m,{checkedList:s})}return{value:!0,checkedList:s,reason:"all check passed"}}})()}computeVisibleByFiveMode(n,t){const i=()=>{var o,a;let s=typeof n.visibleFiveMode=="function"?n.visibleFiveMode(this):n.visibleFiveMode;if(s||(s=(a=(o=this.fiveState)==null?void 0:o.mode)!=null?a:this.workUtil.observers.length?"Panorama":"ModelLike"),Array.isArray(s))return s.includes(t);if(s==="ModelLike")return _i(t);if(s==="PanoramaLike")return!Fs(t);if(s==="all")return!0;if(typeof s=="string")return s===t};if((()=>{var o;const s=i();if(At((o=this.fiveState)==null?void 0:o.panoIndex)&&n.entryFromModel){if(_i(t)&&s?this.entryFromModel=!1:this.entryFromModel=!0,_i(t))return!0}else this.entryFromModel=!1;return s})()===!1)return{value:!1,reason:"current mode is not included in visibleFiveMode",visibleFiveMode:n.visibleFiveMode,mode:t}}computeVisibleByIntersect(n){var l,c,h,u;const t=io(io((l=this.getConfig().visibleConfig)!=null?l:{}).intersectRaycaster),i=n!=null?n:this.five.getCurrentState().panoIndex,r=Fs(this.five.getCurrentState().mode)?this.workUtil.getObserverPosition(i):this.five.camera.position;if(r===void 0)return{value:!1,reason:{type:"startPosition is undefined",fivePanoIndex:i}};const s=zr((()=>{var f;const d=(f=t.checkPoints)!=null?f:"center";return d==="center"?Hb(this):d==="corner"?zm(this):Array.isArray(d)?d:[]})());let o=0,a=0;for(const d of s){const f=new C.Vector3().subVectors(d,r).normalize();let m;rs.set(r,f);const[p]=this.fiveUtil.model.intersectRaycaster(rs);m=p==null?void 0:p.distance;const g=(()=>{if(!$i(this))return;const x=this.plugin.tags.filter($i).map(P=>{var S;return(S=P.model)==null?void 0:S.object}).filter(At),[M]=rs.intersectObjects(x,!0);return M})(),y=r.distanceTo(d),b=(c=t.distanceAccuracy)!=null?c:.01;m=Math.min(m!=null?m:1/0,(h=g==null?void 0:g.distance)!=null?h:1/0),m+b>=y?o++:a++;const w=(u=t.needPassed)!=null?u:1;if(o>=w)return{value:!0}}return a===0?{value:!0}:{value:!1,reason:{type:"intersectRaycaster check failed",passedCount:o,needPassed:t.needPassed,model:this.fiveUtil.model.name}}}computeVisibleByFloorIndex(){var r,s,o,a,l,c,h;let n=0;const t=(r=this.fiveState)==null?void 0:r.panoIndex;t!==void 0?n=(s=this.workUtil.getObserver(t))==null?void 0:s.floorIndex:n=pF(this.workUtil.work,(h=(c=(a=(o=this.model)==null?void 0:o.object)==null?void 0:a.position)!=null?c:(l=this.mediaPlane)==null?void 0:l.position)!=null?h:Hb(this));const i=this.fiveUtil.model.shownFloor;return{value:i===null||i===n,currentFiveFloorIndex:i,tagFloorIndex:n}}computeUnfoldedByPanoIndex(n){const t=this.getConfig().unfoldedConfig;if(t){if(typeof t=="function")return t(this.five,{tag:this,distance:this.getDistance({panoIndex:n})});if(t.keep==="folded")return!1;if(t.keep==="unfolded")return!0;if(t.unfoldDistance&&qh(this.getDistance({panoIndex:n}),t.unfoldDistance)===!1)return!1}}computeUnfoldedByCamera(){var t;if(this.entryFromModel&&_i(this.five.state.mode))return!1;const n=this.getConfig().unfoldedConfig;if(n){if(typeof n=="function")return n(this.five,{tag:this,distance:this.getDistance()});if(n.keep==="folded")return!1;if(n.keep==="unfolded")return!0;if(n.autoUnfold===void 0||n.autoUnfold===!1||n.autoUnfold.enable===!1||!n.autoUnfold.strategy)return;if(n.autoUnfold.strategy==="ScreenPostion"){const i=this.computeTagProject();if(i&&qh(i.x,n.autoUnfold.autoUnfoldProjectX)===!1)return!1}if(n.autoUnfold.strategy==="MinimumDistance"){const s=this.plugin.filterPointTag.filter(a=>a.currentVisible).filter(a=>{const l=this.computeTagProject();if(!l)return!1;const{x:c,y:h,z:u}=l;return!(Math.abs(u)>1||Math.abs(c)>1||Math.abs(h)>1)}).map(a=>({tag:a,id:a.id,tagConfig:a.getConfig().unfoldedConfig})).filter(({tagConfig:a})=>{var l,c;return!(typeof a=="function"||a.keep||a.autoUnfold===!1||((l=a.autoUnfold)==null?void 0:l.enable)===!1||((c=a.autoUnfold)==null?void 0:c.strategy)!=="MinimumDistance")}).map(a=>Ee(R({},a),{distance:a.tag.getDistance()})).filter(({distance:a,tagConfig:l})=>{const c=l.autoUnfold.distance;return!(c&&qh(a,c)===!1)}).sort((a,l)=>a.distance-l.distance).findIndex(a=>a.id===this.id);if(s===-1||s<=((t=n.autoUnfold.maxNumber)!=null?t:1)-1===!1)return!1}return n.autoUnfold.strategy!=="FoldWhenMove"}}computeTagProject(){const n=this.centerPosition;if(!n)return;const{x:t,y:i,z:r}=n.project(this.five.camera);if(!(r>1))return{x:t,y:i,z:r}}addObjectClickHandler(n,t,i){if(!t||!this.plugin.domEvents)return()=>{};const r=()=>!(!n.currentVisible||n.loading),s=o=>{if(!r())return!1;i(o.origDomEvent)};return this.plugin.domEvents.addEventListener(t,"click",s),()=>{var o;(o=this.plugin.domEvents)==null||o.removeEventListener(t,"click",s)}}whyHide(){var t;if(!this.plugin.state.enabled)return{reason:`plugin.state.enabled is ${this.plugin.state.enabled}`};if(!this.plugin.state.visible)return{reason:`plugin.state.visible is ${this.plugin.state.visible}`};if(!this.enabled)return{reason:`tag ${this.id} enabled is: ${this.enabled}`};const n=Ee(R({},this.computeVisible()),{tagInstance:this});return n.value!==this.state.visible?{reason:"插件故障,请联系维护人员, err: 0",info:n}:this.state.visible?{reason:"应该是能看见才对",info:n}:n.value===!0?{reason:"插件故障,请联系维护人员, err: 1",info:n}:{reason:(t=n.reason.type)!=null?t:n.reason,info:n}}destroy(){const n=this.plugin.tags.findIndex(t=>t.id===this.id);if(n===-1){console.warn(`Destroy failed: tag ${this.id} not found`);return}this.disable(),this.hooks.off(),this.cache.clear(),this.plugin.tags.splice(n,1),this.plugin.tagsLengthWillUpdate=!0,this.plugin.hooks.emit("tagsLengthChange")}}class OM extends Yg{constructor(t,i){super(t,i);v(this,"loading",!1);v(this,"loadModel",()=>ee(this,null,function*(){var o;const t=this.data.modelUrl;if(!t)return;this.loading=!0;const i=lF(t).then(a=>ee(this,null,function*(){var h;const l=Object.assign(a.scene,{customID:this.id,isTagModel:!0,removeEventListener:this.getConfig().clickable===!1?()=>{}:this.addObjectClickHandler(this,a.scene,u=>{this.plugin.hooks.emit("click",{target:"TagModel",tag:this,event:u})})});return l.visible=this.currentVisible,new C.Matrix4().fromArray(this.matrix).decompose(l.position,l.quaternion,l.scale),l.updateWorldMatrix(!0,!0),l.visible=yield this.getVisible(),(h=this.getConfig().modelConfig)!=null&&h.autoLookAtEnabled&&l.lookAt(this.five.camera.position.clone().setY(l.position.y)),l}));this.model={promise:i};const r=yield i;if(this.loading=!1,((o=this.model)==null?void 0:o.promise)!==i||!this.plugin.tags.includes(this))return;this.model.object=r;const s=this.plugin.gltfObjectGroup.children.find(a=>a.customID===this.id);if(s&&(this.plugin.gltfObjectGroup.remove(s),s.removeEventListener()),this.plugin.updateRender3DDomTag(),$i(this)){if(this.computeRenderType()==="Mesh"&&!this.mediaPlane){const a=this.data.mediaPosition.map(os);this.mediaPlane=new IM(this.data.mediaData[0].url,this.data.mediaPosition.map(os),{objectFit:this.data.objectFit});const l=new C.Vector3().addVectors(a[0],a[2]).divideScalar(2);this.mediaPlane.position.copy(l),r.add(this.mediaPlane)}this.computeRenderType()!=="Mesh"&&(r.updateTagCss3DObjectMatrix=()=>this.plugin.updateTagCss3DObjectMatrix(this,r),r.updateTagCss3DObjectMatrix())}return this.plugin.gltfObjectGroup.add(r),r}));this.state.unfolded=!0}applyVisible(){var t,i,r;(t=this.model)!=null&&t.object&&(this.model.object.visible=this.currentVisible),(i=this.tag3DContentSvelte)==null||i.svelteApp.$set({tag:this,state:this.plugin.state}),(r=this.tag3DContentSvelte)==null||r.css3DInstance.setVisible(this.currentVisible)}computeNormal(){return oM(this.data.mediaPosition)}}function mF(e){Ue(e,"svelte-elzzn6",'@font-face{font-family:"TG-TYPE";font-style:normal;font-weight:400;src:local("TG-TYPE-Bold"), url(data:application/font-woff2;charset=utf-8;base64,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) format("woff2")}*{-webkit-tap-highlight-color:transparent}.content__container.svelte-elzzn6{position:relative;left:50%;top:50%;transform:translate(-50%, -50%);font-family:PingFangSC, Segoe UI, Rototo, sans-serif;transition:opacity 0.2s linear}.content__container.unClickable.svelte-elzzn6{pointer-events:none !important}.content__container.unClickable.svelte-elzzn6 *{pointer-events:none !important}.content__wrapper.svelte-elzzn6{pointer-events:none;width:100%;height:100%}.content__container.hide.svelte-elzzn6{opacity:0;pointer-events:none}.content__container.hide.svelte-elzzn6 *{pointer-events:none !important}.content__container.disable.svelte-elzzn6{display:none}.content.svelte-elzzn6{position:relative;width:100%;height:100%;font-size:0.75rem;color:#fff}.content.svelte-elzzn6:not(.unfolded){pointer-events:none}.content.svelte-elzzn6:not(.unfolded) *{pointer-events:none !important}.content.unfolded.svelte-elzzn6{pointer-events:auto}')}function gF(e){let n,t;return{c(){n=H("div"),_(n,"data-info","tag content is keep folded"),_(n,"data-id",t=e[0].id)},m(i,r){Z(i,n,r)},p(i,r){r&1&&t!==(t=i[0].id)&&_(n,"data-id",t)},i:de,o:de,d(i){i&&Y(n)}}}function vF(e){let n,t,i,r,s,o,a,l,c,h,u,d,f,m,p,g,y;const b=[CF,EF,MF,xF,wF,AF,bF],A=[];function w(x,M){return M&9&&(r=null),M&9&&(s=null),M&9&&(o=null),M&9&&(a=null),M&9&&(l=null),M&9&&(c=null),M&9&&(h=null),r==null&&(r=!!(["Text"].includes(x[0].contentType)||["Text"].includes(x[3].get(x[0].contentType)))),r?0:(s==null&&(s=!!(["ImageText","Image","Video"].includes(x[0].contentType)||["ImageText","Image","Video"].includes(x[3].get(x[0].contentType)))),s?1:(o==null&&(o=!!(["Audio"].includes(x[0].contentType)||["Audio"].includes(x[3].get(x[0].contentType)))),o?2:(a==null&&(a=!!(["Marketing"].includes(x[0].contentType)||["Marketing"].includes(x[3].get(x[0].contentType)))),a?3:(l==null&&(l=!!(["Link","VRLink","PanoLink","Sticker"].includes(x[0].contentType)||["Link","VRLink","PanoLink","Sticker"].includes(x[3].get(x[0].contentType)))),l?4:(c==null&&(c=!!(["MediaPlane","MediaModel"].includes(x[0].contentType)||["MediaPlane","MediaModel"].includes(x[3].get(x[0].contentType)))),c?5:(h==null&&(h=!!(["Panorama"].includes(x[0].contentType)||["Panorama"].includes(x[3].get(x[0].contentType)))),h?6:-1))))))}return~(u=w(e,-1))&&(d=A[u]=b[u](e)),{c(){var x;n=H("div"),t=H("div"),i=H("div"),d&&d.c(),_(i,"class","content svelte-elzzn6"),Ce(i,"unfolded",(x=e[0].state)==null?void 0:x.unfolded),_(t,"class","content__wrapper svelte-elzzn6"),_(n,"class",f=on(Jn("content__container",e[0].className))+" svelte-elzzn6"),_(n,"data-id",m=e[0].id),Ce(n,"disable",e[0].enabled===!1),Ce(n,"hide",e[5]),Ce(n,"unClickable",e[0].config.clickable===!1),W(n,"width",e[0].stickType==="Plane"||e[0].contentType==="MediaModel"?"100%":0),W(n,"height",e[0].stickType==="Plane"||e[0].contentType==="MediaModel"?"100%":0)},m(x,M){Z(x,n,M),Q(n,t),Q(t,i),~u&&A[u].m(i,null),e[16](n),p=!0,g||(y=ot(n,"click",e[17],!0),g=!0)},p(x,M){var S;let P=u;u=w(x,M),u===P?~u&&A[u].p(x,M):(d&&(Ve(),X(A[P],1,1,()=>{A[P]=null}),Ge()),~u?(d=A[u],d?d.p(x,M):(d=A[u]=b[u](x),d.c()),F(d,1),d.m(i,null)):d=null),(!p||M&1)&&Ce(i,"unfolded",(S=x[0].state)==null?void 0:S.unfolded),(!p||M&1&&f!==(f=on(Jn("content__container",x[0].className))+" svelte-elzzn6"))&&_(n,"class",f),(!p||M&1&&m!==(m=x[0].id))&&_(n,"data-id",m),(!p||M&1)&&Ce(n,"disable",x[0].enabled===!1),(!p||M&33)&&Ce(n,"hide",x[5]),(!p||M&1)&&Ce(n,"unClickable",x[0].config.clickable===!1),M&1&&W(n,"width",x[0].stickType==="Plane"||x[0].contentType==="MediaModel"?"100%":0),M&1&&W(n,"height",x[0].stickType==="Plane"||x[0].contentType==="MediaModel"?"100%":0)},i(x){p||(F(d),p=!0)},o(x){X(d),p=!1},d(x){x&&Y(n),~u&&A[u].d(),e[16](null),g=!1,y()}}}function yF(e){let n,t,i,r,s,o,a;return t=new oF({props:{tag:nn(e[0]),rendererMap:e[2]}}),{c(){n=H("div"),Ie(t.$$.fragment),_(n,"class",i=on(Jn("content__container",e[0].className))+" svelte-elzzn6"),_(n,"data-id",r=e[0].id),Ce(n,"custom-tag-disable",e[0].enabled===!1),Ce(n,"custom-tag-hide",e[5])},m(l,c){Z(l,n,c),_e(t,n,null),e[14](n),s=!0,o||(a=ot(n,"click",e[15]),o=!0)},p(l,c){const h={};c&1&&(h.tag=nn(l[0])),c&4&&(h.rendererMap=l[2]),t.$set(h),(!s||c&1&&i!==(i=on(Jn("content__container",l[0].className))+" svelte-elzzn6"))&&_(n,"class",i),(!s||c&1&&r!==(r=l[0].id))&&_(n,"data-id",r),(!s||c&1)&&Ce(n,"custom-tag-disable",l[0].enabled===!1),(!s||c&33)&&Ce(n,"custom-tag-hide",l[5])},i(l){s||(F(t.$$.fragment,l),s=!0)},o(l){X(t.$$.fragment,l),s=!1},d(l){l&&Y(n),Se(t),e[14](null),o=!1,a()}}}function bF(e){let n,t;return n=new tF({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function AF(e){let n,t;return n=new RN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function wF(e){let n,t;return n=new qN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function xF(e){let n,t;return n=new aN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function MF(e){let n,t;return n=new TN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function EF(e){let n,t;return n=new iN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function CF(e){let n,t;return n=new xz({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function PF(e){let n,t,i,r,s;const o=[yF,vF,gF],a=[];function l(c,h){return h&5&&(n=null),n==null&&(n=!!(c[0].element||c[2].has(c[0].contentType))),n?0:c[4]?1:2}return t=l(e,-1),i=a[t]=o[t](e),{c(){i.c(),r=ft()},m(c,h){a[t].m(c,h),Z(c,r,h),s=!0},p(c,[h]){let u=t;t=l(c,h),t===u?a[t].p(c,h):(Ve(),X(a[u],1,1,()=>{a[u]=null}),Ge(),i=a[t],i?i.p(c,h):(i=a[t]=o[t](c),i.c()),F(i,1),i.m(r.parentNode,r))},i(c){s||(F(i),s=!0)},o(c){X(i),s=!1},d(c){a[t].d(c),c&&Y(r)}}}function _F(e,n,t){let i,r,s,o,a,l,{tag:c}=n,{hooks:h}=n,{rendererMap:u=new Map}=n,{contentTypeMap:d=new Map}=n,{state:f}=n,{mediaStore:m}=n,{temporaryState:p}=n;Em("hooks",h),Em("mediaStore",m);let g,y;function b(S){S?h.emit("exposure",{id:o,type:"start"}):h.emit("exposure",{id:o,type:"end"})}function A(S,T,z){var D,k;return!(!T.visible||!T.enabled||!z.visible||!((D=S.state)!=null&&D.visible)||((k=S.temporaryState)==null?void 0:k.visible)===!1||S instanceof OM&&S.loading)}function w(S){Qt[S?"unshift":"push"](()=>{c.contentDom=S,t(0,c)})}const x=S=>h.emit("click",{event:S,target:"TagContent",tag:c});function M(S){Qt[S?"unshift":"push"](()=>{c.contentDom=S,t(0,c)})}const P=S=>{c.entryFromModel&&_i(c.five.state.mode)?(S.stopPropagation(),c.find({targetMode:"Panorama"})):h.emit("click",{event:S,target:"TagContent",tag:c})};return e.$$set=S=>{"tag"in S&&t(0,c=S.tag),"hooks"in S&&t(1,h=S.hooks),"rendererMap"in S&&t(2,u=S.rendererMap),"contentTypeMap"in S&&t(3,d=S.contentTypeMap),"state"in S&&t(6,f=S.state),"mediaStore"in S&&t(7,m=S.mediaStore),"temporaryState"in S&&t(8,p=S.temporaryState)},e.$$.update=()=>{var S,T,z,D,k,O,G,I,U,q,K;e.$$.dirty&1&&t(12,i=(S=c.state)==null?void 0:S.unfolded),e.$$.dirty&1&&t(11,r=(T=c.state)==null?void 0:T.visible),e.$$.dirty&321&&t(13,s=f.visible&&p.visible&&((z=c.state)==null?void 0:z.visible)),e.$$.dirty&1&&(o=c.id),e.$$.dirty&321&&t(5,a=!A(c,f,p)),e.$$.dirty&8192&&b(s),e.$$.dirty&7681&&c.hooks&&(i!==void 0&&i!==y&&(t(10,y=i),i?(k=(D=c.hooks).emit)==null||k.call(D,"unfolded"):(G=c==null?void 0:(O=c.hooks).emit)==null||G.call(O,"folded")),r!==void 0&&r!==g&&(t(9,g=r),r?(U=(I=c.hooks).emit)==null||U.call(I,"show"):(K=(q=c.hooks).emit)==null||K.call(q,"hide"))),e.$$.dirty&1&&t(4,l=(()=>!(typeof c.config.unfoldedConfig=="object"&&c.config.unfoldedConfig.keep==="folded"))())},[c,h,u,d,l,a,f,m,p,g,y,r,i,s,w,x,M,P]}let zM=class extends ke{constructor(n){super(),Le(this,n,_F,PF,De,{tag:0,hooks:1,rendererMap:2,contentTypeMap:3,state:6,mediaStore:7,temporaryState:8},mF)}};const SF={globalConfig:{visibleConfig:{followModelVisibility:!0},unfoldedConfig:{autoUnfold:{enable:!0,strategy:"MinimumDistance",distance:{max:5}}},tag3DConfig:{ratio:.0035}},contentTypeConfig:{"[Mapview]":{unfoldedConfig:{autoUnfold:{enable:!1,distance:{max:9999}}}},"[Floorplan]":{unfoldedConfig:{autoUnfold:{enable:!1,distance:{max:9999}}}},"Any-Audio-plane":{unfoldedConfig:{keep:"unfolded"}},Link:{unfoldedConfig:{keep:"unfolded"}},Panorama:{unfoldedConfig:{keep:"unfolded"}},VRLink:{unfoldedConfig:{keep:"unfolded"}},PanoLink:{unfoldedConfig:{keep:"unfolded"}},MediaPlane:{unfoldedConfig:{keep:"unfolded"},visibleConfig:{alwaysShowWhenMovePano:!0},initialData:{autoplayConfig:{autoplayCarousel:!0,autoplayVideo:!1,autoplayVideoInCarousel:!1}}},"Model-Any":{unfoldedConfig:{keep:"unfolded"},visibleConfig:{visibleFiveMode:"all",alwaysShowWhenMovePano:!0}}}};class s1 extends C.Raycaster{intersectObject(n,t=!0,i=[]){return Fm(n,this,i,t),i.sort(o1),i}intersectObjects(n,t=!0,i=[]){for(let r=0,s=n.length;r<s;r++)Fm(n[r],this,i,t);return i.sort(o1),i}}function o1(e,n){return e.distance-n.distance}function Fm(e,n,t,i){let r=!0;if(e.layers.test(n.layers)&&e.raycast(n,t)===!1&&(r=!1),r===!0&&i===!0){const s=e.children;for(let o=0,a=s.length;o<a;o++)Fm(s[o],n,t,!0)}}function Xg(e,n,t,i){let r=!0;if(e.type!=="Line2"&&(e.layers.test(n.layers)&&e.raycast(n,t)===!1&&(r=!1),r===!0&&i===!0)){const s=e.children;for(let o=0,a=s.length;o<a;o++)s[o].type!=="Line2"&&Xg(s[o],n,t,!0)}}class Zg{constructor(n,t){v(this,"five");v(this,"dragging",!1);v(this,"boundObject",{});v(this,"config");v(this,"lastMouseDownEvent");v(this,"lastTouchEvent");v(this,"handleWantsGesture",(n,t)=>{if(t.length!==1)return;const i=t[0];if(i.raycaster){const r=new s1;r.ray=i.raycaster.ray,r.near=i.raycaster.near,r.far=i.raycaster.far,r.camera=i.raycaster.camera,r.layers=i.raycaster.layers,r.params=i.raycaster.params,i.raycaster=r}if(i){if(n==="mouseMove"&&this.onDomEvent("hover",i),n==="tap"){let r;!r&&!Cc&&(r=this.lastMouseDownEvent),!r&&Cc&&(r=this.lastTouchEvent),r||(r=new MouseEvent("click",{clientX:i.x,clientY:i.y}));const s=this.onDomEvent("click",i,r),o=this.onDomEvent("wantDblclick",i,r,this.boundObject.dblclick);if(s===!1||o===!1)return!1}if(this.dragging)return!1}});v(this,"handleDomEvent",(n,t,i)=>{const r={x:t.clientX,y:t.clientY};this.onDomEvent(n,r,t,i)});v(this,"handleMouseEvent",n=>{this.handleDomEvent(n.type,n)});v(this,"handleMousedown",n=>{this.lastMouseDownEvent=n,this.handleDomEvent("mousedown",n),this.handleDomEvent("dragstart",n,this.haveDragEventObject)});v(this,"handleTouchStart",n=>{this.lastTouchEvent=n});v(this,"handleMouseup",n=>{var t;this.dragging=!1,(t=this.haveDragEventObject)==null||t.forEach(i=>{i._dragging&&(i._dragging=!1,this.notify({eventName:"dragend",object:i,originEvent:n,raycaster:this.getRaycaster({x:n.clientX,y:n.clientY})}))}),this.handleDomEvent("mouseup",n)});v(this,"handleMousemove",n=>{var t;this.dragging&&((t=this.boundObject.drag)==null||t.forEach(i=>{i._dragging&&this.notify({eventName:"drag",object:i,originEvent:n,raycaster:this.getRaycaster({x:n.clientX,y:n.clientY})})}))});v(this,"onDomEvent",(n,t,i,r=this.boundObject[n])=>{var d,f,m,p,g;if(!t||!r||(r==null?void 0:r.length)===0)return;const s=[];((d=this.config)==null?void 0:d.fiveModels)!==null&&((f=this.config)!=null&&f.fiveModels?s.push(...this.config.fiveModels):s.push(this.model));const o=s.filter(y=>y.loaded),a=(m=t.raycaster)!=null?m:this.getRaycaster(t);a.params.Points.threshold=.02;const l=a.intersectObjects(r,!0),c=[];o.forEach(y=>{const b=y.intersectRaycaster(a);c.push(...b)});const h=.01;if(c.length>0&&l.length>0&&c[0].distance+h<l[0].distance)return;const u=(p=l==null?void 0:l[0])==null?void 0:p.object;if(n==="wantDblclick")return!1;if((!u||!this.objectIsBound(u))&&n==="hover")for(const y of(g=this.boundObject.hover)!=null?g:[])y._hovered&&this.notify({eventName:"unHover",object:y});if(u&&u&&this.notify({eventName:n,object:u,originEvent:i,raycaster:a,intersects:l}))return!1});v(this,"objectIsBound",n=>{let t=n._domEvent,i=n.parent;for(;typeof t=="undefined"&&i;)t=i._domEvent,i=i.parent;return!!t});v(this,"notify",n=>{var d,f,m;const{eventName:t,object:i,originEvent:r,raycaster:s,intersects:o}=n;let a=!1,l=[];const c=[];let h=i;for(c.push(h);h.parent;)h=h.parent,c.push(h);const u=c.at(-1);if(!((d=this.config)!=null&&d.noEmitWhenNotInScene&&u.type!=="Scene")){for(const p of c){if(a)break;p.draggable&&(t==="dragstart"&&(p._dragging=!0,this.dragging=!0),t==="dragend"&&(p._dragging=!1,this.dragging=!1));const g=p._domEvent;if(!g)continue;const y=g[`${t}Handler`];if(y)for(const[b,A]of y){if(A!=null&&A.noEmitWhenNotInScene&&u.type!=="Scene"||((f=this.config)!=null&&f.noEmitWhenHide||A!=null&&A.noEmitWhenHide)&&!Xm(p))continue;if(t==="hover"){if(p._hovered)continue;p._hovered=!0;for(const x of(m=this.boundObject.hover)!=null?m:[])x!==p&&x._hovered&&this.notify({eventName:"unHover",object:x})}if(t==="unHover"){if(!p._hovered)continue;p._hovered=!1}const w=b({type:t,target:p,origDomEvent:r,raycaster:s,intersects:o,stopPropagation:()=>{a=!0}});l.push(w!=null?w:!0)}}if(t==="click"||t==="wantDblclick")return l.some(p=>p===!0)}});this.five=n,this.config=t,n.on("wantsGesture",this.handleWantsGesture),document.addEventListener("mousedown",this.handleMousedown),document.addEventListener("touchstart",this.handleTouchStart),document.addEventListener("dblclick",this.handleMouseEvent),document.addEventListener("mouseup",this.handleMouseup),document.addEventListener("mousemove",this.handleMousemove)}get haveDragEventObject(){return[...new Set([this.boundObject.dragend,this.boundObject.drag,this.boundObject.dragstart].flat())].filter(Boolean)}get model(){return ki(this.five)}addAutoBindEventListener(n,t,i,r){const s=()=>this.addEventListener(n,t,i,r),o=()=>this.removeEventListener(n,t,i,r);return n.addEventListener("added",s),n.addEventListener("removed",o),n.addEventListener("dispose",o),()=>{n.removeEventListener("added",s),n.removeEventListener("removed",o),n.removeEventListener("dispose",o)}}addEventListener(n,t,i,r){n._domEvent||(n._domEvent={}),n._domEvent[`${t}Handler`]||(n._domEvent[`${t}Handler`]=[]),this.boundObject[t]||(this.boundObject[t]=[]),this.boundObject[t].includes(n)||this.boundObject[t].push(n),n._domEvent[`${t}Handler`].push([i,R({noEmitWhenHide:!1,noEmitWhenNotInScene:!1},r)])}removeEventListener(n,t,i,...r){var o,a;if(!n._domEvent||(t===void 0&&(Object.keys(this.boundObject).forEach(l=>{var h,u;const c=(h=this.boundObject[l])==null?void 0:h.findIndex(d=>d===n);c!==-1&&((u=this.boundObject[l])==null||u.splice(c,1))}),n._domEvent={}),!n._domEvent[`${t}Handler`]))return;if(i===void 0){delete n._domEvent[`${t}Handler`];return}const s=n._domEvent[`${t}Handler`].findIndex(l=>l[0]===i);if(s!==-1&&(n._domEvent[`${t}Handler`].splice(s,1),n._domEvent[`${t}Handler`].length===0&&delete n._domEvent[`${t}Handler`],n._domEvent&&Object.keys(n._domEvent).length===0&&delete n._domEvent,!n._domEvent)){const l=(o=this.boundObject[t])==null?void 0:o.findIndex(c=>c===n);l!==-1&&((a=this.boundObject[t])==null||a.splice(l,1))}}clear(){this.boundObject={}}dispose(){var n;(n=this.five)==null||n.off("wantsGesture",this.handleWantsGesture),document.removeEventListener("mousedown",this.handleMousedown),document.removeEventListener("touchstart",this.handleTouchStart),document.removeEventListener("mouseup",this.handleMouseup),document.removeEventListener("mousemove",this.handleMousemove),this.boundObject={}}toJSON(){return{boundObject:this.boundObject}}getRaycaster(n){const t=this.five.getElement();if(!t)return;const i=Xx(n,t),r=new s1;return r.setFromCamera(i,this.five.camera),r}}class IF extends ws{constructor(t){super(t);v(this,"tags",[]);v(this,"cache",new _c);v(this,"config",SF);v(this,"renderQueue",new Map);v(this,"params");v(this,"mediaStore",Cg({currentMediaElement:null}));v(this,"store",{disposers:[],disposed:!1,resizeObserverDisposerAdding:!1,css3DRenderDisposer:new Map});v(this,"domEvents",new Zg(this.five));v(this,"_cache_pointTag");v(this,"_cache_2DPointTag");v(this,"_cache_css3DTag");v(this,"_container",null);v(this,"_css3DRenderPlugin");v(this,"whyHide",t=>{const i=this.getTagById(t);return i?i.whyHide():{reason:`tag ${t} not found`}});v(this,"loadVideoFirstFrame",()=>{uF&&this.hooks.emit("loadVideoFirstFrame")});this.mediaStore.subscribe(({currentMediaElement:i})=>{this.tags.forEach(r=>{var s;if(r.mediaPlane instanceof TM&&i!==r.mediaPlane.videoInstance){if(!((s=r.mediaPlane.videoInstance)!=null&&s.src)||i===r.mediaPlane.videoInstance)return;r.mediaPlane.pause()}})})}get container(){var t;return this._container||((t=this.five.getElement())==null?void 0:t.parentElement)}set container(t){this._container=t}set tagsLengthWillUpdate(t){t&&(this._cache_pointTag=this.tags.filter(i=>i.stickType==="2DPoint"||i.stickType==="3DPoint").filter(i=>i.position),this._cache_2DPointTag=this.tags.filter(i=>i.stickType==="2DPoint").filter(i=>i.position),this._cache_css3DTag=this.tags.filter(i=>i.stickType==="3DPoint"||i.stickType==="Plane"||i.stickType==="Model"&&i.contentType==="MediaModel").filter(i=>{const r=i.computeRenderType();return r==="BehindDom"||r==="Dom"}))}get css3DRenderPlugin(){var t,i,r;if(!this._css3DRenderPlugin){const s=Bc(this.five);this._css3DRenderPlugin=s,(t=s.frontModeCSS3DRenderer)!=null&&t.domElementWrapper&&(s.frontModeCSS3DRenderer.domElementWrapper.style.zIndex=(r=(i=this.params.containerZIndex)==null?void 0:i.toString())!=null?r:"")}return this._css3DRenderPlugin}get filterPointTag(){var t;return(t=this._cache_pointTag)!=null?t:[]}get filter2DPointTag(){var t;return(t=this._cache_2DPointTag)!=null?t:[]}get filterCSS3DTag(){var t;return(t=this._cache_css3DTag)!=null?t:[]}addRenderQueue(t){var o,a;const{type:i,keys:r=[],tags:s=[]}=t;this.renderQueue.has(i)?this.renderQueue.set(i,{keys:Array.from(new Set([...(o=this.renderQueue.get(i).keys)!=null?o:[],...r])),tags:Array.from(new Set([...(a=this.renderQueue.get(i).tags)!=null?a:[],...s]))}):this.renderQueue.set(i,{keys:r,tags:s})}getTagById(t){const i=this.tags.find(r=>r.id===t);if(!i){console.warn(`getTagById Error: can't find tag id: ${t}`);return}return i}pauseCurrentMedia(){this.mediaStore.set({currentMediaElement:null})}getPositions(t){if(PO(t))return t.position;if($i(t))return t.data.mediaPosition;if(_O(t))return TO(this.five.camera.position,Ft(t.position),Ft(t.normal))}addObjectClickHandler(t,i,r){if(!i||!this.domEvents)return()=>{};const s=()=>!(!t.currentVisible||t.loading),o=a=>{if(!s())return!1;r(a.origDomEvent)};return this.domEvents.addEventListener(i,"click",o),()=>{var a;(a=this.domEvents)==null||a.removeEventListener(i,"click",o)}}checkDisposed(){return this.store.disposed?(console.error("PanoTagPluginController has been disposed"),!0):!1}}class TF extends IF{constructor(t){super(t);v(this,"rendererMap",new Map);v(this,"contentTypeMap",new Map);v(this,"group",new ne.Group);v(this,"imagePlaneGroup",new ne.Group);v(this,"gltfObjectGroup",new ne.Group);v(this,"enabledModelTagSet",new Set);v(this,"temporaryState",{visible:!0});v(this,"TagContainerSvelte");this.group.name="PanoTagPluginModelGroup",this.gltfObjectGroup.name="PanoTagPluginGLTFObjectGroup",this.imagePlaneGroup.name="ImagePlaneGroup",this.group.add(this.gltfObjectGroup),this.group.add(this.imagePlaneGroup)}registerRenderer(t,i,r){var s;this.rendererMap.set(t,{renderer:i,usePoint:(s=r==null?void 0:r.usePoint)!=null?s:!1})}bindRenderer(t,i){this.contentTypeMap.set(t,i)}clearTags(){var t;this.tags.length&&(this.tags.forEach(i=>{var r,s,o,a,l;(s=(r=i.mediaPlane)==null?void 0:r.parent)==null||s.remove(i.mediaPlane),(l=(a=(o=i.model)==null?void 0:o.object)==null?void 0:a.parent)==null||l.remove(i.model.object)}),this.tags=[],this.tagsLengthWillUpdate=!0,this.hooks.emit("tagsLengthChange"),(t=this.TagContainerSvelte)==null||t.$destroy(),this.TagContainerSvelte=void 0,this.disposeAllCSS3DContainer()),this.enabledModelTagSet.clear(),this.cache.clear()}updateRender3DDomTag(t){(t?zr(t):this.filterCSS3DTag).forEach(r=>{var s,o,a,l,c,h;if(r.tag3DContentSvelte){const{svelteApp:u,css3DInstance:d,initialNormal:f,currentNormal:m}=r.tag3DContentSvelte;if((o=d==null?void 0:d.css3DObject)==null||o.setVisible((this.state.visible&&((s=r.state)==null?void 0:s.visible))!==!1),u.$set({tag:r,hooks:this.hooks,state:this.state,temporaryState:this.temporaryState}),!f.equals(m)){const p=new ne.Quaternion().setFromUnitVectors(f,m);d.css3DObject.setRotationFromQuaternion(p)}return}else{if($i(r)&&!((a=r.model)!=null&&a.object)||((l=r.state)==null?void 0:l.visible)===!1||!this.state.visible||!this.state.enabled||!this.css3DRenderPlugin)return;if(r.stickType==="3DPoint"&&!r.normal)return console.error("updateRenderPlaneTag: 三维点标签缺少法向量!");const u=this.getPositions(r);if(!u)return;const d=r.computeNormal();if(!d)return;const f=r.getConfig(),m=R({wrapperStyle:{zIndex:`${Math.round((1e4-((c=r.getDistance())!=null?c:0))*100)}`}},f.tag3DConfig);if(r.computeRenderType()==="BehindDom"||m.mode==="behind"){m.mode="behind",m.container=document.createElement("div");const y="black";m.container.style.backgroundColor=y,m.container.style.border=`3px solid ${y}`,this.css3DRenderPlugin.hooks.on("render",()=>{var b;if(p.css3DObject.opacityMesh&&f.clickable!==!1){const A=this.addObjectClickHandler(r,p.css3DObject.opacityMesh,w=>{this.hooks.emit("click",{event:w,target:"TagContent",tag:r})});(b=this.store.css3DRenderDisposer.get(r.id))==null||b.push(A)}})}const p=this.css3DRenderPlugin.create3DDomContainer(u,m);if(!p)return;this.store.css3DRenderDisposer.set(r.id,[p.dispose]);const g=new zM({target:p.container,props:{tag:r,hooks:this.hooks,state:this.state,mediaStore:this.mediaStore,temporaryState:this.temporaryState}});r.tag3DContentSvelte={svelteApp:g,domContainer:p,css3DInstance:p,initialNormal:d,currentNormal:d,dispose:()=>{g.$destroy(),p.dispose()}},$i(r)&&((h=r.model)!=null&&h.object)&&this.updateTagCss3DObjectMatrix(r,r.model.object)}}),this.clearUnusedPanelTag()}updateTagCss3DObjectMatrix(t,i){var p,g,y;const r=(g=(p=t.getConfig().tag3DConfig)==null?void 0:p.ratio)!=null?g:.00216,s=(y=t.tag3DContentSvelte)==null?void 0:y.css3DInstance.css3DObject;if(!s)return;const o=$i(t)?t.data.mediaPosition:t.position;if(!o||o.length!==4||!Array.isArray(o[0])||!Array.isArray(o[2]))return;i.updateWorldMatrix(!1,!1);const a=i.matrixWorld,l=new ne.Vector3().fromArray(o[0]),c=new ne.Vector3().fromArray(o[2]),h=lr(l,c).add(new ne.Vector3(0,0,5e-4)),u=new ne.Matrix4().setPosition(h),d=new ne.Matrix4().makeScale(r,r,r),f=new ne.Matrix4().multiply(a).multiply(u).multiply(d);f.decompose(s.position,s.quaternion,s.scale);const m=s.opacityMesh;m&&f.decompose(m.position,m.quaternion,m.scale)}addMediaModelTag(t){return ee(this,null,function*(){const i=t.filter(r=>r.stickType==="Model").map(r=>r.loadModel());yield Promise.all(i),t.forEach(r=>r.updateVisible())})}disposeAllCSS3DContainer(){for(const[,t]of this.store.css3DRenderDisposer)t==null||t.forEach(i=>i==null?void 0:i());this.store.css3DRenderDisposer=new Map}clearUnusedPanelTag(){this.filter2DPointTag.forEach(t=>{var i;(i=t.tag3DContentSvelte)==null||i.css3DInstance.dispose(),t.tag3DContentSvelte=void 0});for(const[t,i]of this.store.css3DRenderDisposer){const r=this.getTagById(t);(!r||r.stickType==="2DPoint")&&(i==null||i.forEach(s=>s==null?void 0:s()),this.store.css3DRenderDisposer.delete(t))}}}class DF{constructor(n){v(this,"plugin");v(this,"logBinded",!1);this.plugin=n}get debug(){return this.plugin.debug}addDebugPoints(){try{CO(this.plugin.five,this.plugin.tags)}catch(n){console.error(n)}}bindLog(){if(this.logBinded)return;this.logBinded=!0;const n=t=>{Object.getOwnPropertyNames(t).forEach(i=>{typeof t[i]=="function"&&(t[i]=new Proxy(t[i],{apply:(r,s,o)=>(["render"].includes(i)||this.addLog(i,...o),r.apply(s,o))}))})};n(this.plugin),n(this.plugin.constructor.prototype)}addLog(n,...t){if(this.debug){let i=new Error().stack;console.debug(`%cPanoTagPlugin%c${n}`,"background-color: #35e0ed; color: black; padding:0 6px; border-radius: 3px","padding: 0 3px; color: #f3f47c",...t,{stack:i})}}closeIntersectRaycaster(){this.plugin.tags.forEach(n=>{var t;io((t=n==null?void 0:n.initialConfig)==null?void 0:t.visibleConfig).intersectRaycaster&&(n.initialConfig.visibleConfig.intersectRaycaster.enabled=!1)}),this.plugin.changeGlobalConfig({visibleConfig:{intersectRaycaster:{enabled:!1}}})}}function LF(e){return typeof window.requestIdleCallback!="undefined"?window.requestIdleCallback(e):setTimeout(function(){e()},1)}function kF(e){if(typeof window.cancelIdleCallback!="undefined")return window.cancelIdleCallback(e);clearTimeout(e)}const RF=new C.Vector2;class OF extends Yg{constructor(t,i){super(t,i);v(this,"__Object__");v(this,"requestIdleCallbackId")}unfoldAndFoldOthers(){const t=this.can("fold"),i=this.can("unfold");t&&i&&(this.state.unfolded=!this.state.unfolded,this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.state.unfolded&&this.plugin.tags.forEach(r=>{r.id!==this.id&&r.fold()}))}onClick(t){t.target==="TagPoint"&&this.unfoldAndFoldOthers()}updateVisible(){this.requestIdleCallbackId&&kF(this.requestIdleCallbackId),this.requestIdleCallbackId=LF(()=>{super.updateVisible()})}applyVisible(){var t,i,r,s;this.currentVisible&&this.updateScreenPosition(),(r=(i=(t=this.tag3DContentSvelte)==null?void 0:t.css3DInstance)==null?void 0:i.css3DObject)==null||r.setVisible(this.currentVisible),(s=this.tag3DContentSvelte)==null||s.svelteApp.$set({state:this.plugin.state,temporaryState:this.temporaryState}),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}unfold(){this.setUnfold(!0)}fold(){this.setUnfold(!1)}setUnfold(t){const i=this.can("fold"),r=this.can("unfold");i&&r&&(this.state.unfolded=t,this.hooks.emit(t?"unfolded":"folded"),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}))}setPosition(t){this.originPosition=t,this.position=t,this.cache.clear(),this.updateVisible(),this.updateScreenPosition(),this.updateZIndex(),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}updateScreenPosition(t){var a;if(this.stickType!=="2DPoint"&&this.stickType!=="3DPoint")return;const{force:i=!1}=t!=null?t:{},r=i?this.state.visible:this.currentVisible,s=(a=this.__Object__)!=null?a:{timeoutId:void 0,inAnimation:!1};if(this.__Object__=s,!r&&this.screenPosition?(s.inAnimation=!0,s.timeoutId=setTimeout(()=>{requestAnimationFrame(()=>{this.currentVisible||(s.inAnimation=!1,this.screenPosition=null,this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}))})},1e3)):s.timeoutId&&(clearTimeout(s.timeoutId),s.inAnimation=!1,s.timeoutId=void 0),!r&&!s.inAnimation)return;const o=this.computeTagProject();if(o){const l=(()=>{if(!this.currentConfig.simulate3D)return 1;const h=2*Math.tan(.5*this.five.camera.fov/180*Math.PI),u=this.getDistance(void 0,1);return Math.max(Math.min(1-h*u/40,1),.5)})(),c=this.five.renderer.getSize(RF);this.screenPosition={leftPx:(o.x+1)/2*c.x,topPx:(-o.y+1)/2*c.y,scale:l}}else this.screenPosition=null;this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}updateUnfoldedByPanoIndex(){const t=this.getUnfoldedByPanoIndex();if(this.state&&(t!==void 0&&(this.state.unfolded=t),t&&!this.state.visible)){const i=this.getConfig();typeof i.unfoldedConfig=="object"&&i.unfoldedConfig.autoFoldWhenHide!==!1&&(this.state.unfolded=!1)}}computeNormal(){return new C.Vector3().fromArray(this.normal)}}const zF=new Map,BF=new Map;class NF extends Yg{constructor(n,t){super(n,t),this.state.unfolded=!0}applyVisible(){var t,i,r,s,o,a;this.computeRenderType()==="Mesh"?((i=(t=this.data.mediaData)==null?void 0:t[0])==null?void 0:i.type)==="Video"?this.renderVideoPlane():((s=(r=this.data.mediaData)==null?void 0:r[0])==null?void 0:s.type)==="Image"&&this.renderImagePlane():(this.tag3DContentSvelte||this.plugin.updateRender3DDomTag(),(o=this.tag3DContentSvelte)==null||o.svelteApp.$set({tag:this,state:this.plugin.state}),(a=this.tag3DContentSvelte)==null||a.css3DInstance.setVisible(this.currentVisible))}renderVideoPlane(){var a;const n=this.data.mediaData[0];if(!n)return;const{url:t}=n;if(!t)return;const i=this.currentVisible,r=(()=>!!(this.mediaPlane&&!i))(),s=(()=>!!(!this.mediaPlane&&i))(),o=(()=>!!(this.mediaPlane&&this.mediaPlane.src!==t))();if((r||o)&&this.mediaPlane&&(this.plugin.imagePlaneGroup.remove(this.mediaPlane),this.mediaPlane.dispose(),this.mediaPlane.removeFromParent(),this.mediaPlane=void 0),s||o){const l=this.position.map(os),c=new TM(t,l,{videoCoverSrc:n.videoCoverUrl,playButton:this.data.playIcon,paused:!((a=this.data.autoplayConfig)!=null&&a.autoplayVideo),objectFit:this.data.objectFit,videoTextureMap:zF,ImageTextureMap:BF,domEvents:this.plugin.domEvents});c.onVideoReady=u=>{u.addEventListener("play",()=>this.plugin.mediaStore.set({currentMediaElement:c.videoInstance}))};const h=u=>(this.five.on("renderFrame",u),()=>this.five.off("renderFrame",u));c.initialRenderHooks(h),this.mediaPlane=c,this.play=()=>c.play(),this.pause=()=>c.pause(),this.plugin.imagePlaneGroup.add(this.mediaPlane)}this.five.needsRender=!0}renderImagePlane(){const n=this.data.mediaData[0];if(!n)return;const{url:t}=n;if(!t)return;const i=this.position.map(os),r=this.currentVisible,s=(()=>!!(this.mediaPlane&&!r))(),o=(()=>!!(!this.mediaPlane&&r))(),a=(()=>!!(this.mediaPlane&&this.mediaPlane.src!==t))();(s||a)&&this.mediaPlane&&(this.plugin.imagePlaneGroup.remove(this.mediaPlane),this.mediaPlane.dispose(),this.mediaPlane.removeFromParent(),this.mediaPlane=void 0),(o||a)&&(this.mediaPlane=new IM(t,i,{objectFit:this.data.objectFit}),this.getConfig().clickable!==!1&&this.plugin.domEvents.addAutoBindEventListener(this.mediaPlane,"click",l=>{this.plugin.hooks.emit("click",{tag:this,target:"TagContent",event:l.origDomEvent})},{noEmitWhenHide:!0}),this.plugin.imagePlaneGroup.add(this.mediaPlane)),this.five.needsRender=!0}computeNormal(){return oM(this.position)}}function FF(e){Ue(e,"svelte-7aiuwz",'@charset "UTF-8";.tag-point-click-helper.svelte-7aiuwz.svelte-7aiuwz{position:absolute;pointer-events:auto;cursor:pointer;width:calc(100% + 0.75rem);height:calc(100% + 0.75rem);left:50%;top:50%;transform:translate(-50%, -50%)}.tag-point-wrapper.svelte-7aiuwz.svelte-7aiuwz{pointer-events:none;position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.tag-folded-point.svelte-7aiuwz.svelte-7aiuwz,.tag-unfolded-point.svelte-7aiuwz.svelte-7aiuwz{transition:all 0.5s}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{display:flex;justify-content:center;align-items:center;position:absolute;width:100%;height:100%;border-radius:50%}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:0.3125rem;height:0.3125rem;border-radius:50%;background-color:white}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz:before{content:"";position:absolute;width:0.875rem;height:0.875rem;border-radius:50%;background-color:rgba(0, 0, 0, 0.2)}.tag-point-wrapper.folded.svelte-7aiuwz .tag-folded-point.svelte-7aiuwz{opacity:1;scale:1}.tag-point-wrapper.folded.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{opacity:0;scale:1}.tag-point-wrapper.unfolded.svelte-7aiuwz .tag-folded-point.svelte-7aiuwz{opacity:0;scale:0.2}.tag-point-wrapper.unfolded.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{opacity:1;scale:1}')}function VF(e){let n,t,i,r,s,o,a,l,c,h,u,d;return r=new Bi({props:{center:!0,blurRadius:15,spreadRadius:5,opacity:.3}}),c=new PM({props:{icon:e[2],width:e[1]}}),c.$on("iconLoaded",e[7]),{c(){n=H("div"),t=H("div"),i=ve(),Ie(r.$$.fragment),s=ve(),o=H("div"),a=ve(),l=H("div"),Ie(c.$$.fragment),_(t,"class","tag-point-click-helper svelte-7aiuwz"),_(o,"class","tag-unfolded-point svelte-7aiuwz"),W(o,"transition-delay",(e[3]?e[5]:0)+"ms"),_(l,"class","tag-folded-point svelte-7aiuwz"),W(l,"transition-delay",(e[3]?e[5]:0)+"ms"),_(n,"class","tag-point-wrapper svelte-7aiuwz"),Ce(n,"unfolded",e[0]),Ce(n,"folded",e[3])},m(f,m){Z(f,n,m),Q(n,t),Q(n,i),_e(r,n,null),Q(n,s),Q(n,o),Q(n,a),Q(n,l),_e(c,l,null),h=!0,u||(d=ot(t,"click",e[4]),u=!0)},p(f,[m]){m&8&&W(o,"transition-delay",(f[3]?f[5]:0)+"ms");const p={};m&4&&(p.icon=f[2]),m&2&&(p.width=f[1]),c.$set(p),m&8&&W(l,"transition-delay",(f[3]?f[5]:0)+"ms"),(!h||m&1)&&Ce(n,"unfolded",f[0]),(!h||m&8)&&Ce(n,"folded",f[3])},i(f){h||(F(r.$$.fragment,f),F(c.$$.fragment,f),h=!0)},o(f){X(r.$$.fragment,f),X(c.$$.fragment,f),h=!1},d(f){f&&Y(n),Se(r),Se(c),u=!1,d()}}}function GF(e,n,t){let i,r,s,o;const a=fs("hooks");let{tag:l}=n,c,h=!1;const u=()=>{c!==void 0&&clearTimeout(c),h=!0,c=setTimeout(()=>{h=!1},800)},d=p=>{h||(l.entryFromModel&&_i(l.five.state.mode)?l.find({targetMode:"Panorama"}).then(()=>l.unfoldAndFoldOthers()):a.emit("click",{event:p,target:"TagPoint",tag:l}))},f=(()=>l.contentType==="Text"&&l.data.appearance==="plane"?500:800)();function m(p){Xa.call(this,e,p)}return e.$$set=p=>{"tag"in p&&t(6,l=p.tag)},e.$$.update=()=>{var p,g,y,b;e.$$.dirty&64&&t(0,i=(p=l.state)==null?void 0:p.unfolded),e.$$.dirty&1&&t(3,r=!i),e.$$.dirty&64&&t(2,s=(y=(g=l.style)==null?void 0:g.point)!=null&&y.url?(b=l.style)==null?void 0:b.point:{url:C4}),e.$$.dirty&64&&t(1,o=(()=>{var x,M,P,S;const A=(M=(x=l.style)==null?void 0:x.point)==null?void 0:M.width;if(typeof A=="number")return A;const w=(S=(P=l.style)==null?void 0:P.point)==null?void 0:S.size;if(typeof w=="number")return w;if(w==="S")return 18;if(w==="M")return 20;if(w==="L")return 24;if(w==="XL")return 28})())},u(),[i,o,s,r,d,f,l,m]}class jF extends ke{constructor(n){super(),Le(this,n,GF,VF,De,{tag:6},FF)}}function HF(e){Ue(e,"svelte-2g2g8a",".tag.svelte-2g2g8a{position:absolute;width:0rem;height:0rem;overflow:visible;pointer-events:auto;will-change:opacity;transition:opacity 0.2s linear}.tag.enableZIndex.svelte-2g2g8a{position:absolute}.tag.hide.svelte-2g2g8a{opacity:0;pointer-events:none}.tag.hide.svelte-2g2g8a *{pointer-events:none !important}.tag.unClickable.svelte-2g2g8a{pointer-events:none !important}.tag.unClickable.svelte-2g2g8a *{pointer-events:none !important}")}function a1(e){let n,t,i,r,s,o,a,l,c;const h=[WF,UF],u=[];function d(g,y){return g[8]?0:1}t=d(e),i=u[t]=h[t](e);const f=[YF,QF],m=[];function p(g,y){return g[15]?0:1}return s=p(e),o=m[s]=f[s](e),{c(){n=H("div"),i.c(),r=ve(),o.c(),_(n,"class","tag svelte-2g2g8a"),_(n,"data-tag-id",e[14]),_(n,"data-tag-unfolded",e[6]),_(n,"data-content-type",a=e[0].contentType),_(n,"id",l=`tag-${e[14]}`),Ce(n,"unClickable",e[0].config.clickable===!1),Ce(n,"hide",e[12]),Ce(n,"enableZIndex",e[9]),W(n,"z-index",e[9]),W(n,"transform",`translate3d(${e[11]}, ${e[10]}, 0) scale(${e[7].scale})`)},m(g,y){Z(g,n,y),u[t].m(n,null),Q(n,r),m[s].m(n,null),e[17](n),c=!0},p(g,y){let b=t;t=d(g),t===b?u[t].p(g,y):(Ve(),X(u[b],1,1,()=>{u[b]=null}),Ge(),i=u[t],i?i.p(g,y):(i=u[t]=h[t](g),i.c()),F(i,1),i.m(n,r));let A=s;s=p(g),s===A?m[s].p(g,y):(Ve(),X(m[A],1,1,()=>{m[A]=null}),Ge(),o=m[s],o?o.p(g,y):(o=m[s]=f[s](g),o.c()),F(o,1),o.m(n,null)),(!c||y&16384)&&_(n,"data-tag-id",g[14]),(!c||y&64)&&_(n,"data-tag-unfolded",g[6]),(!c||y&1&&a!==(a=g[0].contentType))&&_(n,"data-content-type",a),(!c||y&16384&&l!==(l=`tag-${g[14]}`))&&_(n,"id",l),(!c||y&1)&&Ce(n,"unClickable",g[0].config.clickable===!1),(!c||y&4096)&&Ce(n,"hide",g[12]),(!c||y&512)&&Ce(n,"enableZIndex",g[9]),y&512&&W(n,"z-index",g[9]),y&3200&&W(n,"transform",`translate3d(${g[11]}, ${g[10]}, 0) scale(${g[7].scale})`)},i(g){c||(F(i),F(o),c=!0)},o(g){X(i),X(o),c=!1},d(g){g&&Y(n),u[t].d(),m[s].d(),e[17](null)}}}function UF(e){let n;return{c(){n=H("div"),_(n,"data-info","tag point is disable")},m(t,i){Z(t,n,i)},p:de,i:de,o:de,d(t){t&&Y(n)}}}function WF(e){let n,t;return n=new jF({props:{tag:e[0]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=i[0]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function QF(e){let n;return{c(){n=H("div"),_(n,"data-info","tag content is disable")},m(t,i){Z(t,n,i)},p:de,i:de,o:de,d(t){t&&Y(n)}}}function YF(e){let n,t;return n=new zM({props:{mediaStore:e[1],tag:nn(e[0]),hooks:e[16],state:e[4],temporaryState:e[5],rendererMap:e[2],contentTypeMap:e[3]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&2&&(s.mediaStore=i[1]),r&1&&(s.tag=nn(i[0])),r&16&&(s.state=i[4]),r&32&&(s.temporaryState=i[5]),r&4&&(s.rendererMap=i[2]),r&8&&(s.contentTypeMap=i[3]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function XF(e){let n,t,i=e[7]&&!e[13]&&a1(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[7]&&!r[13]?i?(i.p(r,s),s&8320&&F(i,1)):(i=a1(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function ZF(e,n,t){let i,r,s,o,a,l,c,h,u,d,{tag:f}=n,{mediaStore:m}=n,{rendererMap:p=new Map}=n,{contentTypeMap:g=new Map}=n,{state:y}=n,{temporaryState:b}=n;const A=fs("hooks");function w(x){Qt[x?"unshift":"push"](()=>{f.dom=x,t(0,f)})}return e.$$set=x=>{"tag"in x&&t(0,f=x.tag),"mediaStore"in x&&t(1,m=x.mediaStore),"rendererMap"in x&&t(2,p=x.rendererMap),"contentTypeMap"in x&&t(3,g=x.contentTypeMap),"state"in x&&t(4,y=x.state),"temporaryState"in x&&t(5,b=x.temporaryState)},e.$$.update=()=>{var x,M,P,S;e.$$.dirty&5&&t(8,i=(()=>{var T,z,D;return!(((z=(T=f.style)==null?void 0:T.point)==null?void 0:z.enabled)===!1||((D=p.get(f.contentType))==null?void 0:D.usePoint)===!1||f.contentType==="Sticker"||f.contentType==="Link"||f.contentType==="VRLink"||f.contentType==="PanoLink"||f.contentType==="Panorama"||f.contentType==="Audio"&&f.data.appearance==="plane")})()),e.$$.dirty&257&&t(15,r=(()=>!(f.stickType!=="2DPoint"||f.entryFromModel&&_i(f.five.state.mode)&&i))()),e.$$.dirty&1&&t(14,s=f.id),e.$$.dirty&1&&t(7,o=f.screenPosition),e.$$.dirty&1&&t(13,a=f.enabled===!1||!f.state),e.$$.dirty&129&&t(12,l=!((x=f.state)!=null&&x.visible)||((M=f.temporaryState)==null?void 0:M.visible)===!1||!o),e.$$.dirty&1&&t(6,c=(P=f.state)==null?void 0:P.unfolded),e.$$.dirty&128&&t(11,h=(o==null?void 0:o.leftPx)+"px"),e.$$.dirty&128&&t(10,u=(o==null?void 0:o.topPx)+"px"),e.$$.dirty&65&&t(9,d=c?((S=f.zIndex)!=null?S:0)+(c?1e6:0):void 0)},[f,m,p,g,y,b,c,o,i,d,u,h,l,a,s,r,A,w]}class JF extends ke{constructor(n){super(),Le(this,n,ZF,XF,De,{tag:0,mediaStore:1,rendererMap:2,contentTypeMap:3,state:4,temporaryState:5},HF)}}function qF(e){Ue(e,"svelte-1owzhnq",".tag--container.svelte-1owzhnq{box-sizing:border-box;position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;opacity:1;-webkit-user-select:none;-moz-user-select:none;user-select:none;transform:translate3d(0, 0, 0);transition:opacity 0.2s linear}.tag--container.hide.svelte-1owzhnq{opacity:0;pointer-events:none}.tag--container.hide.svelte-1owzhnq *{pointer-events:none !important}")}function l1(e,n,t){const i=e.slice();return i[8]=n[t],i}function c1(e){let n,t=[],i=new Map,r,s,o=e[0];const a=l=>l[8].id;for(let l=0;l<o.length;l+=1){let c=l1(e,o,l),h=a(c);i.set(h,t[l]=h1(h,c))}return{c(){var l;n=H("div");for(let c=0;c<t.length;c+=1)t[c].c();_(n,"class","tag--container svelte-1owzhnq"),Ce(n,"hide",!e[4].visible||!e[5].visible),W(n,"z-index",(l=e[6])!=null?l:"")},m(l,c){Z(l,n,c);for(let h=0;h<t.length;h+=1)t[h]&&t[h].m(n,null);s=!0},p(l,c){var h;c&63&&(o=l[0],Ve(),t=zi(t,c,a,1,l,o,i,n,bs,h1,null,l1),Ge()),(!s||c&48)&&Ce(n,"hide",!l[4].visible||!l[5].visible),c&64&&W(n,"z-index",(h=l[6])!=null?h:"")},i(l){if(!s){for(let c=0;c<o.length;c+=1)F(t[c]);r||an(()=>{r=ys(n,_n,{}),r.start()}),s=!0}},o(l){for(let c=0;c<t.length;c+=1)X(t[c]);s=!1},d(l){l&&Y(n);for(let c=0;c<t.length;c+=1)t[c].d()}}}function h1(e,n){let t,i,r;return i=new JF({props:{state:n[4],temporaryState:n[5],tag:n[8],mediaStore:n[1],rendererMap:n[2],contentTypeMap:n[3]}}),{key:e,first:null,c(){t=ft(),Ie(i.$$.fragment),this.first=t},m(s,o){Z(s,t,o),_e(i,s,o),r=!0},p(s,o){n=s;const a={};o&16&&(a.state=n[4]),o&32&&(a.temporaryState=n[5]),o&1&&(a.tag=n[8]),o&2&&(a.mediaStore=n[1]),o&4&&(a.rendererMap=n[2]),o&8&&(a.contentTypeMap=n[3]),i.$set(a)},i(s){r||(F(i.$$.fragment,s),r=!0)},o(s){X(i.$$.fragment,s),r=!1},d(s){s&&Y(t),Se(i,s)}}}function KF(e){let n,t,i=e[4].enabled&&c1(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[4].enabled?i?(i.p(r,s),s&16&&F(i,1)):(i=c1(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function $F(e,n,t){let{tags:i=[]}=n,{hooks:r}=n,{mediaStore:s}=n,{rendererMap:o}=n,{contentTypeMap:a}=n,{state:l}=n,{temporaryState:c}=n,{zIndex:h=void 0}=n;return Em("hooks",r),e.$$set=u=>{"tags"in u&&t(0,i=u.tags),"hooks"in u&&t(7,r=u.hooks),"mediaStore"in u&&t(1,s=u.mediaStore),"rendererMap"in u&&t(2,o=u.rendererMap),"contentTypeMap"in u&&t(3,a=u.contentTypeMap),"state"in u&&t(4,l=u.state),"temporaryState"in u&&t(5,c=u.temporaryState),"zIndex"in u&&t(6,h=u.zIndex)},[i,s,o,a,l,c,h,r]}class eV extends ke{constructor(n){super(),Le(this,n,$F,KF,De,{tags:0,hooks:7,mediaStore:1,rendererMap:2,contentTypeMap:3,state:4,temporaryState:5,zIndex:6},qF)}}const BM="Dnalogel-PanoTagPlugin",tV=e=>`${BM}--${e}`;class fd extends TF{constructor(t,i){super(t);v(this,"state",{enabled:!0,visible:!0});v(this,"debug");v(this,"debugUtil",new DF(this));v(this,"changeTagModel",(t,i)=>ee(this,null,function*(){var r;t.data=jt({},t.data,i),yield(r=t.loadModel)==null?void 0:r.call(t)}));v(this,"handleFiveModeChange",t=>{const i=()=>{this.tags.forEach(r=>{r.state.visible=!1,r.applyVisible(),this.five.ready().then(()=>{r.updateVisible(),$i(r)&&t!=="Panorama"&&this.changeTagMode(r,"behind")})})};this.tags.length<500?i():this.five.ready().then(()=>i())});v(this,"handleFiveWantsMoveToPano",t=>{if(this.tags.length>500){this.temporaryState.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]});return}else this.tags.forEach(i=>{i.getVisible({panoIndex:t})&&(i.state.visible=!0);const s=i.getConfig();typeof s.visibleConfig=="object"&&i.temporaryState&&(s.visibleConfig.keep?i.temporaryState.visible=s.visibleConfig.keep==="visible":i.temporaryState.visible=!!s.visibleConfig.alwaysShowWhenMovePano)}),this.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.tags.forEach(i=>i.applyVisible())});v(this,"clickhandler",t=>{t.tag.onClick(t)});v(this,"handleFiveCameraUpdate",()=>{this.filterPointTag.forEach(t=>t.updateScreenPosition())});v(this,"handleFiveCameraFovUpdate",()=>{this.handleFiveCameraUpdate(),this.five.off("render.prepare",this.handleFiveCameraUpdate),this.five.on("render.prepare",this.handleFiveCameraUpdate),setTimeout(()=>{this.five.off("render.prepare",this.handleFiveCameraUpdate)},1e3)});v(this,"handleFivePanoArrived",()=>ee(this,null,function*(){this.tags.forEach(t=>{t.state.visible=!1,t.temporaryState=Ee(R({},t.temporaryState),{visible:!0}),t.applyVisible(),t.updateVisible()}),this.temporaryState.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]}),yield this.setUnfolded(),this.updateRender3DDomTag(),this.tags.filter(SO).filter(t=>{var i;return(i=t.getConfig().modelConfig)==null?void 0:i.autoLookAtEnabled}).forEach(t=>{var c;const i=new C.Mesh(new C.BoxGeometry,new C.MeshBasicMaterial),r=(c=t.model)==null?void 0:c.object;if(!r)return;i.position.copy(r.position),i.quaternion.copy(r.quaternion);const s=this.five.camera.position;i.lookAt(s.clone().setY(i.position.y));const o=r.quaternion.clone(),a=i.quaternion.clone(),l=Mc();l.onUpdate(({progress:h})=>{r.quaternion.copy(o.clone().slerp(a,h))}),l.play()})}));v(this,"handleFiveModelShownFloorChange",()=>{this.tags.forEach(t=>t.updateVisible())});v(this,"onFiveEveryReady",()=>{this.setUnfoldedByCamera(),_i(this.five.getCurrentState().mode)&&this.tags.forEach(t=>t.updateVisible())});v(this,"render",()=>{this.renderQueue.forEach((t,i)=>{const{keys:r}=t;if(i==="TagContainerSvelte"){const o=this.filterPointTag.filter(l=>l.screenPosition),a={hooks:this.hooks,tags:o,state:this.state,temporaryState:this.temporaryState,mediaStore:this.mediaStore,rendererMap:this.rendererMap,contentTypeMap:this.contentTypeMap,zIndex:this.params.containerZIndex};if(this.TagContainerSvelte){let l={};if(r.length===0)l=a;else for(const c of r)l[c]=a[c];this.TagContainerSvelte.$set(l)}else{if(!this.container)return console.error("updateRenderPlaneTag: tag2DContainer not found");this.TagContainerSvelte=new eV({target:this.container,props:Ee(R({},a),{state:Ee(R({},this.state),{enabled:!1})})}),zc(()=>{var l;(l=this.TagContainerSvelte)==null||l.$set({state:this.state})})}}}),this.renderQueue.clear()});this.params=jt({},{debug:!1,config:this.config},R({},i)),this.debug=this.params.debug,this.config=this.params.config,this.debug&&this.debugUtil.bindLog(),OO(1,{namespace:Ng.PlayAudio});try{Array.isArray(window.__PANOTAGPLUGIN_DEBUG_LIST__)||(window.__PANOTAGPLUGIN_DEBUG_LIST__=[]),window.__PANOTAGPLUGIN_DEBUG_LIST__.push(this),window.__PANOTAGPLUGIN_DEBUG__||Object.defineProperty(window,"__PANOTAGPLUGIN_DEBUG__",{get:function(){return window.__PANOTAGPLUGIN_DEBUG_LIST__.sort((r,s)=>s.tags.length-r.tags.length)[0]}})}catch(r){}}appendTo(t){var r,s,o,a;this.debugUtil.addLog("appendTo"),this.container=t,(r=this.css3DRenderPlugin)==null||r.appendToFrontFiveContainer(this.container);const i=(o=(s=this.TagContainerSvelte)==null?void 0:s.$$)==null?void 0:o.root;i&&i!==this.container&&((a=this.TagContainerSvelte)==null||a.$destroy(),this.TagContainerSvelte=void 0)}load(t){return ee(this,null,function*(){var r,s;this.clearTags();try{console.debug(BM," load:",{data:JSON.parse(JSON.stringify(t))})}catch(o){}this.config=jt({},this.config,{globalConfig:(r=t.globalConfig)!=null?r:{},contentTypeConfig:(s=t.contentTypeConfig)!=null?s:{}});const i=yield this.addTag(t.tagList);return this.hooks.emit("loaded"),i})}addTag(t){return ee(this,null,function*(){const r=(Array.isArray(t)?t:[t]).filter(s=>s.position).map(s=>{const o=Bg(s);if(o==="2DPoint"||o==="3DPoint")return new OF(this,s);if(o==="Model")return new OM(this,s);if(o==="Plane")return new NF(this,s)});return r.forEach(kO),this.tags.push(...r),this.tagsLengthWillUpdate=!0,Ha(this.five).then(()=>ee(this,null,function*(){var s,o;this.store.eventListenerDisposer&&((o=(s=this.store).eventListenerDisposer)==null||o.call(s)),this.state.enabled&&this.handleEnable(),this.addResizeListener(),this.clearUnusedPanelTag(),this.addMediaModelTag(r),r.forEach(a=>{a.updateVisible(),a.updateZIndex()}),this.setUnfolded(),this.addRenderQueue({type:"TagContainerSvelte"}),this.hooks.emit("tagsLengthChange")}))})}changeConfig(t,i=!0){i?this.config=jt({},this.config,t):this.config=t,this.tags.forEach(r=>{r.updateConfig(),r.updateVisible()})}changeGlobalConfig(t,i=!0){i?this.config.globalConfig=jt({},this.config.globalConfig,t):this.config.globalConfig=t,this.tags.forEach(r=>{r.updateConfig(),r.updateVisible()})}changeContentTypeConfig(t,i,r=!0){this.config.contentTypeConfig||(this.config.contentTypeConfig={}),r?this.config.contentTypeConfig[t]=jt({},this.config.contentTypeConfig[t],i):this.config.contentTypeConfig[t]=i,this.tags.forEach(s=>{s.updateConfig(),s.updateVisible()})}show(t){return ee(this,null,function*(){if(this.checkDisposed())return;const{userAction:i=!0}=t!=null?t:{};this.setState({visible:!0},{userAction:i}),this.hooks.emit("show",{userAction:i})})}hide(t){return ee(this,null,function*(){if(this.checkDisposed())return;const{userAction:i=!0}=t!=null?t:{};this.setState({visible:!1},{userAction:i}),this.hooks.emit("hide",{userAction:i})})}enable(t){if(this.checkDisposed())return;const{userAction:i=!0}=t!=null?t:{};this.setState({enabled:!0},{userAction:i}),this.hooks.emit("enable",{userAction:i})}disable(t){if(this.checkDisposed())return;const{userAction:i=!0}=t!=null?t:{};this.setState({enabled:!1},{userAction:i}),this.hooks.emit("disable",{userAction:i})}setState(t,i){if(this.checkDisposed())return;const{userAction:r=!0}=i!=null?i:{},s=R({},this.state);this.state=Object.assign(this.state,t),s.visible!==this.state.visible&&(t.visible?this.handleShow():this.handleHide()),s.enabled!==this.state.enabled&&(t.enabled?this.handleEnable():this.handleDisable()),this.hooks.emit("stateChange",{state:this.state,prevState:s,userAction:r})}dispose(){var t,i,r,s,o,a;this.pauseCurrentMedia(),this.disposeAllCSS3DContainer(),(t=this.TagContainerSvelte)==null||t.$destroy(),this.filterCSS3DTag.forEach(l=>{var c;return(c=l.tag3DContentSvelte)==null?void 0:c.svelteApp.$destroy()}),this.tags.forEach(l=>l.cache.clear()),this.tags=[],this.tagsLengthWillUpdate=!0,this.hooks.emit("tagsLengthChange"),(i=this.store.disposers)==null||i.forEach(l=>l==null?void 0:l()),this.store.disposers=[],(s=(r=this.store).eventListenerDisposer)==null||s.call(r),this.store.eventListenerDisposer=void 0,(a=(o=this.store).resizeObserverDisposer)==null||a.call(o),this.store.resizeObserverDisposer=void 0,this.store.resizeObserverDisposerAdding=!1,this.five.scene.remove(this.group),this.group.remove(...this.group.children),this.gltfObjectGroup.remove(...this.gltfObjectGroup.children),this.imagePlaneGroup.remove(...this.imagePlaneGroup.children),this.five.needsRender=!0,this.store.disposed=!0,this.hooks.emit("dispose")}blinkTagById(t,i){return ee(this,null,function*(){var r;return(r=this.getTagById(t))==null?void 0:r.blink(i)})}changeUnfoldedById(t,i){const r=this.getTagById(t);i?r==null||r.unfold():r==null||r.fold()}changeEnabledById(t,i){var s;const r=this.getTagById(t);r&&(r.enabled=i,(s=r.hooks)==null||s.emit(i?"enable":"disable"))}changeTagNormalById(t,i){const r=this.getTagById(t);r&&r.tag3DContentSvelte&&(r.tag3DContentSvelte.currentNormal=os(i))}changePositionById(t,i){const r=this.getTagById(t);r&&r.setPosition(i)}changeDataById(t,i,r=!0){const s=this.getTagById(t);s&&(s.setData(i,r),this.clearUnusedPanelTag(),s.hooks.emit("dataChanged",s.data))}changeStickTypeById(t,i,r=!0){this.changeTagById(t,i,r)}changeTagById(t,i,r=!0){const s=this.getTagById(t);s&&(s.set(i),s.updateVisible(),this.clearUnusedPanelTag(),s.hooks.emit("dataChanged",s.data))}destroyTagById(t){(Array.isArray(t)?t:[t]).forEach(r=>{var s;return(s=this.getTagById(r))==null?void 0:s.destroy()})}updateRenderAllTags(){this.tags.forEach(t=>t.updateVisible()),this.five.needsRender=!0}setUnfolded(){return ee(this,null,function*(){return new Promise(t=>{setTimeout(()=>{this.setUnfoldedByCamera(),t()},100)})})}handleShow(){this.state.visible=!0,this.group.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["state"]}),this.five.needsRender=!0}handleHide(){this.pauseCurrentMedia(),this.state.visible=!1,this.group.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["state"]}),this.five.needsRender=!0}handleEnable(){this.state.enabled=!0,this.store.eventListenerDisposer=this.addEventListener(),this.five.scene.children.includes(this.group)||this.five.scene.add(this.group),this.group.traverse(t=>{var i;(i=t==null?void 0:t.updateTagCss3DObjectMatrix)==null||i.call(t)}),this.updateRender3DDomTag(),this.five.needsRender=!0}handleDisable(){var t,i,r;this.pauseCurrentMedia(),this.state.enabled=!1,(i=(t=this.store).eventListenerDisposer)==null||i.call(t),this.five.scene.remove(this.group),(r=this.TagContainerSvelte)==null||r.$set({tags:[]}),this.filterCSS3DTag.forEach(s=>{var o;(o=s.tag3DContentSvelte)==null||o.dispose(),s.tag3DContentSvelte=void 0}),this.five.needsRender=!0}addResizeListener(){if(!this.store.resizeObserverDisposer&&!this.store.resizeObserverDisposerAdding){const t=this.addResizeObserver();this.store.resizeObserverDisposerAdding=!0,setTimeout(()=>{this.store.resizeObserverDisposer=t,this.store.resizeObserverDisposerAdding=!1},200)}}addResizeObserver(){if(this.store.disposed)return;const t=this.five.getElement(),i=()=>{this.state.enabled&&(this.filterPointTag.forEach(c=>c.updateScreenPosition({force:!0})),this.temporaryState.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]}))},r=()=>{this.state.enabled&&(this.temporaryState.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]}))},{observe:s,unobserve:o}=Bm(Ub(()=>{this.store.resizeObserverDisposer&&r()},500),t),{observe:a,unobserve:l}=Bm(DO(()=>i(),400),t);return s(),a(),()=>{o(),l()}}setUnfoldedByCamera(){let t=!1;this.filterPointTag.forEach(i=>{const r=i.getUnfoldedByCamera();if(i.state&&r!==void 0){if(r===!0&&i.screenPosition){const s=i.getConfig().unfoldedConfig;io(s).keep!=="unfolded"&&(t=!0)}i.state.unfolded=r}}),t&&this.filterPointTag.forEach(i=>{const r=i.getConfig().unfoldedConfig;typeof r=="object"&&(r.autoUnfold||r.autoUnfold===!1||io(r.autoUnfold).enable===!1||r.keep)||i.state&&(i.state.unfolded=!1)})}changeTagMode(t,i){var r,s,o,a,l,c;((r=t.config)==null?void 0:r.renderType)!=="Mesh"&&((a=(o=(s=t.tag3DContentSvelte)==null?void 0:s.css3DInstance)==null?void 0:o.css3DObject)==null?void 0:a.mode)!==i&&((l=t.config)!=null&&l.tag3DConfig?t.config.tag3DConfig.mode=i:t.config?t.config.tag3DConfig={mode:i}:t.config={tag3DConfig:{mode:i}},(c=this.store.css3DRenderDisposer.get(t.id))==null||c.forEach(h=>h==null?void 0:h()),t.tag3DContentSvelte=void 0)}addEventListener(){const{five:t,hooks:i}=this;let r=!1;const s=Ub(()=>{r||(r=!0,t.ready().then(()=>{this.onFiveEveryReady(),r=!1}))},150);return t.on("cameraUpdate",s),this.handleFivePanoArrived(),t.on("wantsMoveToPano",this.handleFiveWantsMoveToPano),t.on("models.refined",this.onFiveEveryReady),t.on("modeChange",this.handleFiveModeChange),t.on("modelShownFloorChange",this.handleFiveModelShownFloorChange),t.on("cameraUpdate",this.handleFiveCameraUpdate),t.on("cameraFovUpdate",this.handleFiveCameraFovUpdate),t.on("panoArrived",this.handleFivePanoArrived),t.on("panoArrived",this.loadVideoFirstFrame),t.on("render.prepare",this.render),i.on("click",this.clickhandler),()=>{t.off("wantsMoveToPano",this.handleFiveWantsMoveToPano),t.off("models.refined",this.onFiveEveryReady),t.off("modeChange",this.handleFiveModeChange),t.off("modelShownFloorChange",this.handleFiveModelShownFloorChange),t.off("cameraUpdate",this.handleFiveCameraUpdate),t.off("cameraFovUpdate",this.handleFiveCameraFovUpdate),t.off("cameraUpdate",s),t.off("panoArrived",this.handleFivePanoArrived),t.off("panoArrived",this.loadVideoFirstFrame),t.off("render.prepare",this.render),i.off("click",this.clickhandler),this.store.eventListenerDisposer=void 0}}}const nV=(e,n)=>new fd(e,n);function iV(e){Ue(e,"svelte-4qjwer",".guide-line__tag.svelte-4qjwer.svelte-4qjwer{position:relative}.text-with-distance.svelte-4qjwer.svelte-4qjwer{display:flex;flex-direction:column;position:relative;padding:0.125rem 0.25rem;border-radius:0.125rem;background:linear-gradient(to top, rgba(147, 147, 147, 0.3), rgba(74, 74, 74, 0.3));box-shadow:0 0.125rem 0.5rem 0 rgba(0, 0, 0, 0.2)}.text-with-distance.svelte-4qjwer .border.svelte-4qjwer{position:absolute;top:-50%;right:-50%;bottom:-50%;left:-50%;padding:0.0625rem;border-radius:0.25rem;background:linear-gradient(to right, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.2));-webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);mask-composite:exclude;-webkit-mask-composite:xor;transform:scale(0.5)}.distance-and-name.svelte-4qjwer.svelte-4qjwer{display:flex;gap:0.1875rem}.distance.svelte-4qjwer.svelte-4qjwer{white-space:nowrap;font-size:0.625rem;line-height:0.875rem;color:#66afff}.name.svelte-4qjwer.svelte-4qjwer{opacity:0.6;font-size:0.625rem;line-height:0.875rem;white-space:nowrap;color:#ffffff}.line-name.svelte-4qjwer.svelte-4qjwer{color:#fff;white-space:nowrap;font-size:0.625rem;line-height:0.875rem}.guide-line__tag-point.svelte-4qjwer.svelte-4qjwer{position:absolute;left:50%;bottom:0.0625rem;width:0.4375rem;height:0.125rem;transform:translateX(-50%);background:#fff;border-radius:50%;opacity:0.5}.guide-line__tag-line.svelte-4qjwer.svelte-4qjwer{position:absolute;left:50%;bottom:0.0625rem;width:0.0625rem;height:1.875rem;transform:translateX(-50%);background:linear-gradient(to top, #fff, rgba(255, 255, 255, 0))}.guide-line__tag-content.svelte-4qjwer.svelte-4qjwer{position:absolute;left:-0.9375rem;bottom:1.9375rem;display:flex}.guide-line__tag-icon.svelte-4qjwer.svelte-4qjwer{width:1.875rem;height:1.875rem;background-size:100%}.guide-line__tag-text.svelte-4qjwer.svelte-4qjwer{box-sizing:content-box;height:0.875rem;width:-moz-max-content;width:max-content;margin-top:0.3125rem;transform:translateX(-0.1875rem);white-space:nowrap;font-size:0.625rem;line-height:0.875rem;border:solid transparent;border-width:0.125rem 0.5rem 0.125rem 0.375rem;border-image-slice:6 25 6 18 fill;color:#fff}")}function u1(e){let n,t;return{c(){n=H("div"),t=xt(e[0]),_(n,"class","guide-line__tag-text svelte-4qjwer"),W(n,"border-image-source",`url(${e[6]})`)},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r&1&&Ct(t,i[0])},d(i){i&&Y(n)}}}function d1(e){let n,t,i,r,s=e[5]("全程")+"",o,a,l=e[5]("米")+"",c,h,u,d,f,m,p=e[4]&&f1(e);return{c(){n=H("div"),p&&p.c(),t=ve(),i=H("div"),r=H("span"),o=xt(s),a=xt(e[2]),c=xt(l),h=ve(),u=H("span"),d=xt(e[0]),f=ve(),m=H("div"),_(r,"class","distance svelte-4qjwer"),_(u,"class","name svelte-4qjwer"),_(i,"class","distance-and-name svelte-4qjwer"),_(m,"class","border svelte-4qjwer"),_(n,"class","text-with-distance svelte-4qjwer")},m(g,y){Z(g,n,y),p&&p.m(n,null),Q(n,t),Q(n,i),Q(i,r),Q(r,o),Q(r,a),Q(r,c),Q(i,h),Q(i,u),Q(u,d),Q(n,f),Q(n,m)},p(g,y){g[4]?p?p.p(g,y):(p=f1(g),p.c(),p.m(n,t)):p&&(p.d(1),p=null),y&32&&s!==(s=g[5]("全程")+"")&&Ct(o,s),y&4&&Ct(a,g[2]),y&32&&l!==(l=g[5]("米")+"")&&Ct(c,l),y&1&&Ct(d,g[0])},d(g){g&&Y(n),p&&p.d()}}}function f1(e){let n,t;return{c(){n=H("span"),t=xt(e[4]),_(n,"class","line-name svelte-4qjwer")},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r&16&&Ct(t,i[4])},d(i){i&&Y(n)}}}function rV(e){let n,t,i,r,s,o,a,l,c,h=e[0]&&!e[2]&&u1(e),u=e[2]&&d1(e);return{c(){n=H("div"),t=H("div"),i=ve(),r=H("div"),s=ve(),o=H("div"),a=H("div"),l=ve(),h&&h.c(),c=ve(),u&&u.c(),_(t,"class","guide-line__tag-point svelte-4qjwer"),_(r,"class","guide-line__tag-line svelte-4qjwer"),_(a,"class","guide-line__tag-icon svelte-4qjwer"),W(a,"background-image",`url(${e[1]})`),_(o,"class","guide-line__tag-content svelte-4qjwer"),_(n,"class","guide-line__tag svelte-4qjwer"),W(n,"opacity",e[3])},m(d,f){Z(d,n,f),Q(n,t),Q(n,i),Q(n,r),Q(n,s),Q(n,o),Q(o,a),Q(o,l),h&&h.m(o,null),Q(o,c),u&&u.m(o,null)},p(d,[f]){f&2&&W(a,"background-image",`url(${d[1]})`),d[0]&&!d[2]?h?h.p(d,f):(h=u1(d),h.c(),h.m(o,c)):h&&(h.d(1),h=null),d[2]?u?u.p(d,f):(u=d1(d),u.c(),u.m(o,null)):u&&(u.d(1),u=null),f&8&&W(n,"opacity",d[3])},i:de,o:de,d(d){d&&Y(n),h&&h.d(),u&&u.d()}}}function sV(e,n,t){let{text:i=""}=n,{icon_url:r=""}=n,{distance:s=0}=n,{opacity:o=1}=n,{name:a=""}=n,{i18n:l=h=>h}=n;const c="data:image/png;base64,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";return e.$$set=h=>{"text"in h&&t(0,i=h.text),"icon_url"in h&&t(1,r=h.icon_url),"distance"in h&&t(2,s=h.distance),"opacity"in h&&t(3,o=h.opacity),"name"in h&&t(4,a=h.name),"i18n"in h&&t(5,l=h.i18n)},[i,r,s,o,a,l,c]}class oV extends ke{constructor(n){super(),Le(this,n,sV,rV,De,{text:0,icon_url:1,distance:2,opacity:3,name:4,i18n:5},iV)}}function aV(e){return e.length===0?[]:e.filter((n,t)=>n!==e[t-1])}const lV=`
3563
+ `);this.uniforms={map:{value:t}}}}class SM extends C.Mesh{constructor(){super(...arguments);v(this,"name","MediaPlane");v(this,"src")}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}dispose(){this.traverse(t=>{if(t.isMesh){const i=t;i.geometry.dispose(),(i.material instanceof Array?i.material:[i.material]).forEach(s=>{s.dispose()})}})}}class IM extends SM{constructor(t,i,r){var a;super();v(this,"name","PanoTagPluginImagePlane");this.src=t;const s=(a=r==null?void 0:r.resolveZFighting)!=null?a:!0;let o=i;if(s){const l=Nc(i,5e-4);o=i.map(c=>c.clone().add(l))}zx(t).then(({texture:l,transparent:c})=>{var p;const h=new C.MeshBasicMaterial({map:l,transparent:c}),u=Cl((p=r==null?void 0:r.objectFit)!=null?p:"contain",o,l.image.width/l.image.height),d=lr(...u),f=u.map(g=>g.clone().sub(d)),m=new _M(f);this.position.copy(d),this.geometry=m,this.material=h}).catch(l=>{console.error(`Imageplane error ${l==null?void 0:l.message}`)})}}class TM extends SM{constructor(t,i,r){const{videoCoverSrc:s,objectFit:o="contain",playButton:a="withText",paused:l=!0,videoTextureMap:c,ImageTextureMap:h,domEvents:u}=r!=null?r:{};super();v(this,"isVideoPlane",!0);v(this,"name","PanoTagPluginImagePlane");v(this,"videoInstance");v(this,"onVideoReady");v(this,"objectFit");v(this,"buttonSrc");v(this,"videoCoverSrc");v(this,"domEvents");v(this,"disposers",[]);v(this,"cornerPoints");v(this,"videoMesh");v(this,"coverMesh");v(this,"buttonMesh");v(this,"videoTextureMap");v(this,"ImageTextureMap");this.cornerPoints=i,this.src=t,this.buttonSrc=(()=>a==="withText"?zg:a==="withoutText"?Rm:typeof a=="string"?a:Rm)(),this.videoCoverSrc=s,this.objectFit=o,this.videoTextureMap=c,this.ImageTextureMap=h,this.domEvents=u,this.position.copy(lr(...i)),this.videoCoverSrc&&l?this.addCoverMesh().then(()=>this.addButtonMesh()):this.addVideoMesh().then(()=>{l?this.addButtonMesh():this.play(!0)}),this.addEventListener("removed",()=>{this.remove(...this.children)}),this.addEventListener("dispose",()=>{var d;(d=this.disposers)==null||d.forEach(f=>f==null?void 0:f())})}play(t=!1){return ee(this,null,function*(){this.videoMesh||(yield this.addVideoMesh()),this.showPlayUI(),this.videoInstance.paused&&this.videoInstance.play().then(()=>this.showPlayUI()).catch(i=>{this.pause(),console.error("play error",i)}),this.videoInstance.muted=t,this.render()})}pause(){this.videoInstance&&(this.videoInstance.pause(),this.showPauseUI().then(()=>this.render()))}initialRenderHooks(t){const r=t(()=>{var s;this.videoMesh&&((s=this.videoInstance)==null?void 0:s.paused)===!1&&(this.videoMesh.needsRender=!0)});this.disposers.push(()=>r)}showPlayUI(){this.coverMesh&&(this.coverMesh.visible=!1),this.remove(this.buttonMesh),this.videoMesh.visible=!0}showPauseUI(){return ee(this,null,function*(){this.coverMesh?(this.coverMesh.visible=!0,this.videoMesh&&(this.videoMesh.visible=!1)):(yield this.addCoverMesh(),this.coverMesh&&(this.videoMesh.visible=!1)),this.addButtonMesh().then(()=>this.render())})}render(){var t;this.videoMesh&&(this.videoMesh.needsRender=!0),this.coverMesh&&(this.coverMesh.needsRender=!0),this.buttonMesh&&(this.buttonMesh.needsRender=!0),this.videoMesh&&((t=this.videoInstance)==null?void 0:t.paused)===!1&&(this.videoMesh.needsRender=!0)}addCoverMesh(){return ee(this,null,function*(){if(this.children.includes(this.coverMesh))return;const t=yield(()=>ee(this,null,function*(){if(this.coverMesh)return this.coverMesh;if(!this.videoCoverSrc)return;const{texture:i,transparent:r}=yield this.getImageTexture(this.videoCoverSrc),s=new C.MeshBasicMaterial({transparent:!1,map:i}),o=Cl(this.objectFit,this.cornerPoints,i.image.width/i.image.height),a=new cp(o,s);return a.position.copy(new ne.Vector3(0,0,0)),a.name="videoCoverMesh",a}))();return t&&(this.children.includes(this.coverMesh)||(this.add(t),this.coverMesh=t)),t})}addVideoMesh(){return ee(this,null,function*(){if(this.children.includes(this.videoMesh))return;const t=yield(()=>ee(this,null,function*(){if(this.videoMesh)return this.videoMesh;if(!this.src)return;const r=this.getVideoTexture(this.src),s=new C.MeshBasicMaterial({transparent:!1,map:r}),o=yield new Promise(l=>{r.metadataLoaded?l(Cl(this.objectFit,this.cornerPoints,r.image.videoWidth/r.image.videoHeight)):r.addEventListener("videoLoaded",()=>l(Cl(this.objectFit,this.cornerPoints,r.image.videoWidth/r.image.videoHeight)))}),a=new cp(o,s);return a.name="videoMesh",a.position.copy(new ne.Vector3(0,0,0)),a}))();if(!t)return;this.domEvents.addAutoBindEventListener(t,"click",()=>{!this.videoInstance.paused&&this.videoInstance.muted?this.videoInstance.muted=!1:this.pause()},{noEmitWhenHide:!0});const i=t.material.map.image;return i.addEventListener("playing",()=>{this.coverMesh||this.remove(this.buttonMesh),this.render()}),i.addEventListener("pause",()=>{this.videoInstance.paused&&(this.showPauseUI(),this.render())}),this.children.includes(this.videoMesh)||(this.add(t),this.videoMesh=t,this.videoInstance=i),t})}addButtonMesh(){return ee(this,null,function*(){if(this.children.includes(this.buttonMesh))return;const t=yield(()=>ee(this,null,function*(){var f,m,p,g;if(this.buttonMesh)return this.buttonMesh;const i=(m=(f=this.videoMesh)==null?void 0:f.geometry.points[0].distanceTo(this.videoMesh.geometry.points[3]))!=null?m:1/0,r=(g=(p=this.coverMesh)==null?void 0:p.geometry.points[0].distanceTo(this.coverMesh.geometry.points[3]))!=null?g:1/0,s=this.cornerPoints[0].distanceTo(this.cornerPoints[3]),a=Math.min(i,r,s)/s*.3,{texture:l,transparent:c}=yield this.getImageTexture(this.buttonSrc),h=Cl("contain",this.cornerPoints,l.image.width/l.image.height),u=new cp(h,new fF(l));u.position.copy(new ne.Vector3(0,0,0)),u.name="buttonMesh",u.scale.set(a,a,a),this.domEvents.addAutoBindEventListener(u,"click",()=>{this.play()},{noEmitWhenHide:!0});const d=Nc(h,5e-4);return u.position.add(d),u}))();return this.children.includes(this.buttonMesh)||(this.add(t),this.buttonMesh=t),t})}getImageTexture(t){return ee(this,null,function*(){var r,s;if((r=this.ImageTextureMap)!=null&&r.has(t))return this.ImageTextureMap.get(t);const i=yield zx(t);return(s=this.ImageTextureMap)==null||s.set(t,i),i})}getVideoTexture(t){var r,s;if((r=this.videoTextureMap)!=null&&r.has(t))return this.videoTextureMap.get(t);const i=dF(t);return(s=this.videoTextureMap)==null||s.set(t,i),i}}function n1(e){return Object.entries(e)}function i1(e){var t,i;typeof e.visibleConfig=="object"&&e.visibleConfig.keep&&(e.visibleConfig.keep==="visible"?e.visibleConfig={keep:e.visibleConfig.keep,visibleFiveMode:(t=e.visibleConfig)==null?void 0:t.visibleFiveMode}:e.visibleConfig.keep==="hidden"&&(e.visibleConfig={keep:e.visibleConfig.keep})),typeof e.unfoldedConfig=="object"&&(e.unfoldedConfig.disableFold&&(e.unfoldedConfig={keep:"unfolded"}),e.unfoldedConfig.disableUnfold&&(e.unfoldedConfig={keep:"folded"}),e.unfoldedConfig.keep&&(e.unfoldedConfig={keep:e.unfoldedConfig.keep}));const n=(i=e.initialState)!=null?i:{};return typeof e.unfoldedConfig=="object"&&(e.unfoldedConfig.keep==="unfolded"?n.unfolded=!0:e.unfoldedConfig.keep==="folded"&&(n.unfolded=!1)),typeof e.visibleConfig=="object"&&(e.visibleConfig.keep==="visible"?n.visible=!0:e.visibleConfig.keep==="hidden"&&(n.visible=!1)),e.initialState=n,e}const DM={visibleConfig:{intersectRaycaster:{enabled:!0,distanceAccuracy:.01,checkPoints:"corner",needPassed:1}},clickable:!0,simulate3D:!1,renderType:"Dom"};var LM=(e=>(e.PointTag="PointTag",e.PlaneTag="PlaneTag",e))(LM||{}),kM=(e=>(e.Audio="Audio",e.Text="Text",e.ImageText="ImageText",e.Image="Image",e.Video="Video",e.Link="Link",e.Sticker="Sticker",e.VRLink="VRLink",e.PanoLink="PanoLink",e.Marketing="Marketing",e.MediaPlane="MediaPlane",e.MediaModel="MediaModel",e.Model="Model",e.Panorama="Panorama",e.Custom="Custom",e.Unknown="Unknown",e))(kM||{}),RM=(e=>(e.Two="2D",e.Three="3D",e))(RM||{});function hp(e,n,t){var f,m,p,g,y;const i=(f=t==null?void 0:t.useCache)!=null?f:!0;if(!e)return(m=n.globalConfig)!=null?m:{};if(i){if((p=e==null?void 0:e.computedConfig)!=null&&p._isMerged)return e.computedConfig;if((g=e==null?void 0:e.config)!=null&&g._isMerged)return e.config}const r={},s={},o={};n.contentTypeConfig&&Object.entries(n.contentTypeConfig).forEach(([b,A])=>{var z,D;const w=b,x=w.split("-"),M=b.startsWith("["),P=M?x[0].slice(1,-1):void 0,S=M?x.slice(1):x,T=P?["PanoramaLike","ModelLike"].includes(P)?(z=s[P])!=null?z:s[P]={}:(D=o[P])!=null?D:o[P]={}:r;if(!T[w]){if(S.length===0&&(T[w]=A),S.length===1){const[k]=S;(e.contentType===k||k==="Any")&&(T[w]=A)}if(S.length===2){const[k="Any",O="Any"]=S;k==="Mixin"&&e.contentType===O&&(T[w]=A),(e.stickType===k||k==="Any")&&(e.contentType===O||O==="Any")&&(T[w]=A)}if(S.length===3){const[k="Any",O,G]=S;if(O==="Audio"&&e.contentType==="Audio"){const I=e;(I.stickType===k||k==="Any")&&I.data.appearance===G&&(T[w]=A)}}}});const a=(y=e.initialConfig)!=null?y:{},l=jt({},DM,n.globalConfig,...Object.values(r)),c=jt({},l,a),h={},u=Object.values(qt.Five.Mode);n1(s).forEach(([b,A])=>{u.forEach(w=>{(b==="PanoramaLike"&&Fs(w)||b==="ModelLike"&&_i(w))&&(h[w]=jt({},l,...Object.values(A),a,{_isMerged:!0}))})}),n1(o).forEach(([b,A])=>{const w=h[b];h[b]=jt({},l,w,...Object.values(A),a,{_isMerged:!0})});const d=Ee(R({},c),{configWithFiveMode:h});return i1(d),Object.values(h).forEach(b=>i1(b)),d._isMerged=!0,d}function r1(e){const n=e.split("?")[0].split(".").pop();return n?n.toLowerCase():""}function pF(e,n){if(!e)return 0;const t=e.observers;if(!n||!t)return console.error("getFloorIndex: invalid arguments: ",{point:n,observer:t}),0;const i=[];t.forEach(s=>{var a,l,c;const o=(l=(a=s.floorIndex)!=null?a:s.floor_index)!=null?l:0;i[o]||(i[o]=[]),i[o].push(wc(s.position,(c=e.options)==null?void 0:c.transform).y)});const r=i.map(s=>s.reduce((o,a)=>o+a,0)/s.length);for(let s=r.length-1;s>0;s--)if(n.y>=r[s])return s;return 0}class _c{constructor(){v(this,"cache_raycasterDistance",new Map);v(this,"cache_visible",new Map)}clear(){this.cache_visible.clear(),this.cache_raycasterDistance.clear()}static generateCameraTagKey(n,t,i=3){const r=R(R({},t.five.getCurrentState()),n),s=r.mode==="Panorama"?t.workUtil.getObserverPosition(r.panoIndex):t.five.camera.position;return s?[s.x.toFixed(i),s.y.toFixed(i),s.z.toFixed(i),t.id].join(","):void 0}getVisible(n,t,i=1){const r=_c.generateCameraTagKey(t,n,i);if(r)return this.cache_visible.get(r)}setVisible(n,t,i,r=1){const s=_c.generateCameraTagKey(t,n,r);s&&this.cache_visible.set(s,i)}}class Yg{constructor(n,t){v(this,"plugin");v(this,"id");v(this,"contentType");v(this,"stickType");v(this,"enabled");v(this,"config");v(this,"data");v(this,"state");v(this,"temporaryState",{visible:!0});v(this,"originPosition");v(this,"position");v(this,"fiveState");v(this,"model");v(this,"matrix");v(this,"screenPosition");v(this,"normal");v(this,"mediaPlane");v(this,"hooks");v(this,"zIndex");v(this,"play");v(this,"pause");v(this,"tag3DContentSvelte");v(this,"dom");v(this,"contentDom");v(this,"initialConfig");v(this,"computedConfig");v(this,"cache");v(this,"entryFromModel");var l,c,h,u;this.plugin=n;const i=Bg(t);t.stickType=i;const r=JSON.parse(JSON.stringify(t.data)),s=(l=t.initialConfig)!=null?l:t.config?JSON.parse(JSON.stringify(t.config)):{};t.initialConfig=s;const o=hp(t,n.config),a=this.getConfig(t);t.config=a,this.id=(c=t.id)!=null?c:xn(),this.enabled=(h=t.enabled)!=null?h:!0,this.contentType=t.contentType,this.data=(u=a.initialData)!=null&&u.important?jt(t.data,r,a.initialData):jt(t.data,a.initialData,r),this.state=R({visible:void 0,unfolded:!this.can("fold")},a.initialState),this.originPosition=t.position,t.originPosition=this.originPosition,this.position=(()=>{const d=t.originPosition;if(!d)return;const f=n.workUtil.transform;return Array.isArray(d)&&d.length===4?d.map(Ft).map(m=>wc(m,f).toArray()):wc(Ft(d),f).toArray()})(),this.matrix=t.matrix?(()=>{const d=new C.Matrix4().fromArray(t.matrix);return d.premultiply(n.workUtil.transform),d.elements})():t.matrix,this.initialConfig=s,this.computedConfig=o,this.stickType=i,this.config=t.config,this.fiveState=t.fiveState,this.normal=t.normal,this.cache=new _c,this.hooks=new Cn,Object.keys(t).forEach(d=>{this[d]===void 0&&t[d]!==void 0&&(this[d]=t[d])})}get five(){return this.plugin.five}get fiveUtil(){return this.plugin.fiveUtil}get workUtil(){return this.plugin.workUtil}get centerPosition(){const n=zm(this);return lr(...Array.isArray(n)?n:[n])}get currentConfig(){var r,s;const n=hp(this,this.plugin.config,{useCache:!0}),t=this.five.getCurrentState().mode,i=(r=n.configWithFiveMode)==null?void 0:r[t];return(s=i!=null?i:n)!=null?s:{}}get currentVisible(){return!(!this.plugin.state.enabled||!this.plugin.state.visible||!this.enabled||!this.state.visible)}get sharedCache(){return this.plugin.cache}applyVisible(){throw new Error("Method not implemented.")}find(n){return ee(this,null,function*(){var r;const t=this.fiveState;if(!this.fiveState)return;const i=(r=n==null?void 0:n.targetMode)!=null?r:this.five.state.mode;if(i==="Panorama"){const s=t==null?void 0:t.panoIndex;if(kr(s))return;const o=this.workUtil.getObserverPosition(s),a=this.centerPosition.clone().sub(o).normalize();this.five.setState(R({mode:"Panorama",workCode:this.workUtil.workCode,panoIndex:s},Oc(a))),yield this.five.ready()}else i==="Mapview"&&(yield ex(this.five,this.centerPosition,n==null?void 0:n.pointConfig))})}blink(n){return ee(this,null,function*(){var a,l,c,h;const t=(a=this.enabled)!=null?a:!0,i=(l=this.state)==null?void 0:l.visible,r=t&&i;r===!1&&(this.state.visible=!0,this.enabled=!0,this.applyVisible(),this.plugin.render(),this.computeRenderType()!=="Mesh"?yield new Promise(u=>ee(this,null,function*(){if(this.dom||this.contentDom){u();return}const d=setInterval(()=>{(this.dom||this.contentDom)&&(u(),clearInterval(d))},16.7)})):this.stickType==="Model"&&!((c=this.model)!=null&&c.object)?yield(h=this.model)==null?void 0:h.promise:this.stickType==="Plane"&&(yield new Promise(u=>ee(this,null,function*(){if(this.mediaPlane){u();return}const d=setInterval(()=>{this.mediaPlane&&(u(),clearInterval(d))},16.7)}))),this.dom&&(this.dom.style.visibility="hidden"),this.contentDom&&(this.contentDom.style.visibility="hidden"));const s=(()=>{var d;const u=[];return u.push(this.dom),this.stickType!=="2DPoint"&&u.push(this.contentDom),u.push((d=this.model)==null?void 0:d.object),u.push(this.mediaPlane),u.filter(Boolean)})();if(!s.length){console.warn("tagDom is empty");return}yield(r?Td:$w)(s,R({begin:()=>{r===!1&&(this.dom&&(this.dom.style.visibility=""),this.contentDom&&(this.contentDom.style.visibility=""))},updateRender:()=>{this.five.needsRender=!0}},n)).finished,t===!1&&(this.enabled=!1,this.updateVisible()),i===!1&&this.updateVisible(),r===!1&&(this.dom&&(this.dom.style.visibility=""),this.contentDom&&(this.contentDom.style.visibility=""))})}unfold(){}unfoldAndFoldOthers(){}fold(){}enable(){this.enabled=!0,this.hooks.emit("enable"),this.applyVisible()}disable(){this.enabled=!1,this.hooks.emit("disable"),this.applyVisible()}changeData(n,t=!0){return this.setData(n,t)}changePosition(n){return this.setPosition(n)}setData(n,t=!0){t?this.data=jt(this.data,n):this.data=R(R({},this.data),n),this.hooks.emit("dataChanged",this.data)}setPosition(n){throw new Error("Method not implemented.")}set(n,t=!0){this.plugin.tagsLengthWillUpdate=!0,t?jt(this,n):Object.assign(this,n),this.cache.clear()}updateConfig(){var i;const n=this.getConfig(void 0,{useCache:!1});this.computedConfig=n;const t=this.getConfig();if(this.config=t,this.config.initialData){const r=JSON.parse(JSON.stringify(this.data));this.data=(i=t.initialData)!=null&&i.important?jt(this.data,r,t.initialData):jt(this.data,t.initialData,r)}this.cache.clear()}updateVisible(){this.state.visible=this.getVisible(),this.applyVisible()}updateZIndex(){const n=this.getDistance();this.zIndex=Math.round((1e4-(n!=null?n:0))*100)}getConfig(n,t){var o,a,l;const i=hp(n!=null?n:this,this.plugin.config,{useCache:t==null?void 0:t.useCache}),r=(o=t==null?void 0:t.fiveMode)!=null?o:this.five.getCurrentState().mode,s=(a=i.configWithFiveMode)==null?void 0:a[r];return(l=s!=null?s:i)!=null?l:{}}getDistance(n,t=3){const i=R(R({},this.five.getCurrentState()),n),{panoIndex:r,mode:s}=i,o=s==="Panorama"?this.workUtil.getObserverPosition(r):this.five.camera.position,a=this.centerPosition;return!o||!a?-1:o.distanceTo(a)}getVisible(n){if(!this.enabled||!this.plugin.state.enabled||!this.fiveUtil.model)return!1;const t=R(R({},this.five.getCurrentState()),n);let i=this.cache.getVisible(this,t);return kr(i)&&(i=this.computeVisible(t).value,this.cache.setVisible(this,t,i)),i}getUnfoldedByPanoIndex(n){if(!this.currentVisible)return;const i=this.computeUnfoldedByPanoIndex(n);return i&&this.getUnfoldedByCamera()}getUnfoldedByCamera(){return this.currentVisible?this.computeUnfoldedByCamera():void 0}can(n){const t=this.currentConfig;if(!t||typeof t!="object")return!0;if(n==="show"||n==="hide"){if(!t.visibleConfig||typeof t.visibleConfig!="object")return!0;if(n==="show"&&t.visibleConfig.keep==="hidden"||n==="hide"&&(t.visibleConfig.keep==="visible"||t.visibleConfig.alwaysShowWhenMovePano))return!1}if(n==="fold"||n==="unfold"){if(!t.unfoldedConfig||typeof t.unfoldedConfig!="object")return!0;if(n==="fold"&&t.unfoldedConfig.keep==="unfolded"||n==="unfold"&&t.unfoldedConfig.keep==="folded")return!1}return!0}onClick(n){}computeRenderType(){const n=(()=>{if(this.stickType==="3DPoint")return"Dom";const t=this.getConfig();if(!t||typeof t!="object"||!t.renderType)return;const i=this.data.mediaData;if(!(!i||i.length===0)&&t.renderType==="Mesh"){if(IO(this)){if(i.length===1){if(i[0].type==="Video")return navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&navigator.userAgent.toLowerCase().indexOf("mobile")>-1?"Dom":"Mesh";if(i[0].type==="Image")return r1(i[0].url)==="gif"?"Dom":"Mesh"}}else if($i(this))return i.length===1&&i[0].type==="Image"?r1(i[0].url)==="gif"?"Dom":"Mesh":"BehindDom"}})();return n!=null?n:"Dom"}computeVisible(n){const t=R(R({},this.five.getCurrentState()),n),{panoIndex:i,mode:r}=t,s=[];return(()=>{var c,u,d;const l=(c=this.getConfig().visibleConfig)!=null?c:{};if(typeof l=="function")return{value:l(this.five,{tag:this,distance:this.getDistance(t,void 0)}),checkedList:s,reason:"config function result"};{if(l.keep==="hidden")return{value:!1,checkedList:s,reason:"config.keep is hidden"};if(l.keep==="visible")return{value:!0,checkedList:s,reason:"config.keep is visible"};const f=this.computeVisibleByFiveMode(l,r);if((f==null?void 0:f.value)===!1)return f;if(l.followModelVisibility===!0&&["poincare","aerophoto","sand"].includes(this.workUtil.fromType)&&(r==="Floorplan"||r==="Mapview")){const h=this.computeVisibleByFloorIndex(),{value:m}=h,p=po(h,["value"]);if(m===!1)return R({value:!1,checkedList:s,reason:"followModelVisibility check failed"},p)}if(Fs(r)&&l.visiblePanoIndex!==void 0&&l.visiblePanoIndex!=="all"&&i!==void 0){if(s.push("visiblePanoIndex"),Array.isArray(l.visiblePanoIndex)&&!l.visiblePanoIndex.includes(i))return{value:!1,checkedList:s,reason:`current panoIndex is not included in visiblePano. currentPanoIndex: ${i}, visiblePanoIndex: ${l.visiblePanoIndex}`};if(l.visiblePanoIndex==="current"&&i!==((u=this.fiveState)==null?void 0:u.panoIndex))return{value:!1,checkedList:s,reason:`current panoIndex is not equal to tag.panoIndex. currentPanoIndex: ${i}, tag.panoIndex: ${(d=this.fiveState)==null?void 0:d.panoIndex}`}}if(l.visibleDistance!==void 0&&(s.push("visibleDistance"),l.visibleDistance!=="unLimited")){const m=this.getDistance(t,1);if(qh(m,l.visibleDistance)===!1)return{value:!1,checkedList:s,panoIndex:i,visibleDistance:l.visibleDistance,reason:`distance is not in visibleDistance. distance: ${m}, visibleDistance: ${l.visibleDistance.min} - ${l.visibleDistance.max}`}}if(l.intersectRaycaster!==!1&&(typeof l.intersectRaycaster!="object"||l.intersectRaycaster.enabled!==!1)){if(s.push("intersectRaycaster"),i===void 0)return{value:!1,checkedList:s,reason:`intersectRaycaster check failed: panoIndex is ${i}`};const m=this.computeVisibleByIntersect(i);if(m.value===!1)return Object.assign(m,{checkedList:s})}return{value:!0,checkedList:s,reason:"all check passed"}}})()}computeVisibleByFiveMode(n,t){const i=()=>{var o,a;let s=typeof n.visibleFiveMode=="function"?n.visibleFiveMode(this):n.visibleFiveMode;if(s||(s=(a=(o=this.fiveState)==null?void 0:o.mode)!=null?a:this.workUtil.observers.length?"Panorama":"ModelLike"),Array.isArray(s))return s.includes(t);if(s==="ModelLike")return _i(t);if(s==="PanoramaLike")return!Fs(t);if(s==="all")return!0;if(typeof s=="string")return s===t};if((()=>{var o;const s=i();if(At((o=this.fiveState)==null?void 0:o.panoIndex)&&n.entryFromModel){if(_i(t)&&s?this.entryFromModel=!1:this.entryFromModel=!0,_i(t))return!0}else this.entryFromModel=!1;return s})()===!1)return{value:!1,reason:"current mode is not included in visibleFiveMode",visibleFiveMode:n.visibleFiveMode,mode:t}}computeVisibleByIntersect(n){var l,c,h,u;const t=io(io((l=this.getConfig().visibleConfig)!=null?l:{}).intersectRaycaster),i=n!=null?n:this.five.getCurrentState().panoIndex,r=Fs(this.five.getCurrentState().mode)?this.workUtil.getObserverPosition(i):this.five.camera.position;if(r===void 0)return{value:!1,reason:{type:"startPosition is undefined",fivePanoIndex:i}};const s=zr((()=>{var f;const d=(f=t.checkPoints)!=null?f:"center";return d==="center"?Hb(this):d==="corner"?zm(this):Array.isArray(d)?d:[]})());let o=0,a=0;for(const d of s){const f=new C.Vector3().subVectors(d,r).normalize();let m;rs.set(r,f);const[p]=this.fiveUtil.model.intersectRaycaster(rs);m=p==null?void 0:p.distance;const g=(()=>{if(!$i(this))return;const x=this.plugin.tags.filter($i).map(P=>{var S;return(S=P.model)==null?void 0:S.object}).filter(At),[M]=rs.intersectObjects(x,!0);return M})(),y=r.distanceTo(d),b=(c=t.distanceAccuracy)!=null?c:.01;m=Math.min(m!=null?m:1/0,(h=g==null?void 0:g.distance)!=null?h:1/0),m+b>=y?o++:a++;const w=(u=t.needPassed)!=null?u:1;if(o>=w)return{value:!0}}return a===0?{value:!0}:{value:!1,reason:{type:"intersectRaycaster check failed",passedCount:o,needPassed:t.needPassed,model:this.fiveUtil.model.name}}}computeVisibleByFloorIndex(){var r,s,o,a,l,c,h;let n=0;const t=(r=this.fiveState)==null?void 0:r.panoIndex;t!==void 0?n=(s=this.workUtil.getObserver(t))==null?void 0:s.floorIndex:n=pF(this.workUtil.work,(h=(c=(a=(o=this.model)==null?void 0:o.object)==null?void 0:a.position)!=null?c:(l=this.mediaPlane)==null?void 0:l.position)!=null?h:Hb(this));const i=this.fiveUtil.model.shownFloor;return{value:i===null||i===n,currentFiveFloorIndex:i,tagFloorIndex:n}}computeUnfoldedByPanoIndex(n){const t=this.getConfig().unfoldedConfig;if(t){if(typeof t=="function")return t(this.five,{tag:this,distance:this.getDistance({panoIndex:n})});if(t.keep==="folded")return!1;if(t.keep==="unfolded")return!0;if(t.unfoldDistance&&qh(this.getDistance({panoIndex:n}),t.unfoldDistance)===!1)return!1}}computeUnfoldedByCamera(){var t;if(this.entryFromModel&&_i(this.five.state.mode))return!1;const n=this.getConfig().unfoldedConfig;if(n){if(typeof n=="function")return n(this.five,{tag:this,distance:this.getDistance()});if(n.keep==="folded")return!1;if(n.keep==="unfolded")return!0;if(n.autoUnfold===void 0||n.autoUnfold===!1||n.autoUnfold.enable===!1||!n.autoUnfold.strategy)return;if(n.autoUnfold.strategy==="ScreenPostion"){const i=this.computeTagProject();if(i&&qh(i.x,n.autoUnfold.autoUnfoldProjectX)===!1)return!1}if(n.autoUnfold.strategy==="MinimumDistance"){const s=this.plugin.filterPointTag.filter(a=>a.currentVisible).filter(a=>{const l=this.computeTagProject();if(!l)return!1;const{x:c,y:h,z:u}=l;return!(Math.abs(u)>1||Math.abs(c)>1||Math.abs(h)>1)}).map(a=>({tag:a,id:a.id,tagConfig:a.getConfig().unfoldedConfig})).filter(({tagConfig:a})=>{var l,c;return!(typeof a=="function"||a.keep||a.autoUnfold===!1||((l=a.autoUnfold)==null?void 0:l.enable)===!1||((c=a.autoUnfold)==null?void 0:c.strategy)!=="MinimumDistance")}).map(a=>Ee(R({},a),{distance:a.tag.getDistance()})).filter(({distance:a,tagConfig:l})=>{const c=l.autoUnfold.distance;return!(c&&qh(a,c)===!1)}).sort((a,l)=>a.distance-l.distance).findIndex(a=>a.id===this.id);if(s===-1||s<=((t=n.autoUnfold.maxNumber)!=null?t:1)-1===!1)return!1}return n.autoUnfold.strategy!=="FoldWhenMove"}}computeTagProject(){const n=this.centerPosition;if(!n)return;const{x:t,y:i,z:r}=n.project(this.five.camera);if(!(r>1))return{x:t,y:i,z:r}}addObjectClickHandler(n,t,i){if(!t||!this.plugin.domEvents)return()=>{};const r=()=>!(!n.currentVisible||n.loading),s=o=>{if(!r())return!1;i(o.origDomEvent)};return this.plugin.domEvents.addEventListener(t,"click",s),()=>{var o;(o=this.plugin.domEvents)==null||o.removeEventListener(t,"click",s)}}whyHide(){var t;if(!this.plugin.state.enabled)return{reason:`plugin.state.enabled is ${this.plugin.state.enabled}`};if(!this.plugin.state.visible)return{reason:`plugin.state.visible is ${this.plugin.state.visible}`};if(!this.enabled)return{reason:`tag ${this.id} enabled is: ${this.enabled}`};const n=Ee(R({},this.computeVisible()),{tagInstance:this});return n.value!==this.state.visible?{reason:"插件故障,请联系维护人员, err: 0",info:n}:this.state.visible?{reason:"应该是能看见才对",info:n}:n.value===!0?{reason:"插件故障,请联系维护人员, err: 1",info:n}:{reason:(t=n.reason.type)!=null?t:n.reason,info:n}}destroy(){const n=this.plugin.tags.findIndex(t=>t.id===this.id);if(n===-1){console.warn(`Destroy failed: tag ${this.id} not found`);return}this.disable(),this.hooks.off(),this.cache.clear(),this.plugin.tags.splice(n,1),this.plugin.tagsLengthWillUpdate=!0,this.plugin.hooks.emit("tagsLengthChange")}}class OM extends Yg{constructor(t,i){super(t,i);v(this,"loading",!1);v(this,"loadModel",()=>ee(this,null,function*(){var o;const t=this.data.modelUrl;if(!t)return;this.loading=!0;const i=lF(t).then(a=>ee(this,null,function*(){var h;const l=Object.assign(a.scene,{customID:this.id,isTagModel:!0,removeEventListener:this.getConfig().clickable===!1?()=>{}:this.addObjectClickHandler(this,a.scene,u=>{this.plugin.hooks.emit("click",{target:"TagModel",tag:this,event:u})})});return l.visible=this.currentVisible,new C.Matrix4().fromArray(this.matrix).decompose(l.position,l.quaternion,l.scale),l.updateWorldMatrix(!0,!0),l.visible=yield this.getVisible(),(h=this.getConfig().modelConfig)!=null&&h.autoLookAtEnabled&&l.lookAt(this.five.camera.position.clone().setY(l.position.y)),l}));this.model={promise:i};const r=yield i;if(this.loading=!1,((o=this.model)==null?void 0:o.promise)!==i||!this.plugin.tags.includes(this))return;this.model.object=r;const s=this.plugin.gltfObjectGroup.children.find(a=>a.customID===this.id);if(s&&(this.plugin.gltfObjectGroup.remove(s),s.removeEventListener()),this.plugin.updateRender3DDomTag(),$i(this)){if(this.computeRenderType()==="Mesh"&&!this.mediaPlane){const a=this.data.mediaPosition.map(os);this.mediaPlane=new IM(this.data.mediaData[0].url,this.data.mediaPosition.map(os),{objectFit:this.data.objectFit});const l=new C.Vector3().addVectors(a[0],a[2]).divideScalar(2);this.mediaPlane.position.copy(l),r.add(this.mediaPlane)}this.computeRenderType()!=="Mesh"&&(r.updateTagCss3DObjectMatrix=()=>this.plugin.updateTagCss3DObjectMatrix(this,r),r.updateTagCss3DObjectMatrix())}return this.plugin.gltfObjectGroup.add(r),r}));this.state.unfolded=!0}applyVisible(){var t,i,r;(t=this.model)!=null&&t.object&&(this.model.object.visible=this.currentVisible),(i=this.tag3DContentSvelte)==null||i.svelteApp.$set({tag:this,state:this.plugin.state}),(r=this.tag3DContentSvelte)==null||r.css3DInstance.setVisible(this.currentVisible)}computeNormal(){return oM(this.data.mediaPosition)}}function mF(e){Ue(e,"svelte-elzzn6",'@font-face{font-family:"TG-TYPE";font-style:normal;font-weight:400;src:local("TG-TYPE-Bold"), url(data:application/font-woff2;charset=utf-8;base64,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) format("woff2")}*{-webkit-tap-highlight-color:transparent}.content__container.svelte-elzzn6{position:relative;left:50%;top:50%;transform:translate(-50%, -50%);font-family:PingFangSC, Segoe UI, Rototo, sans-serif;transition:opacity 0.2s linear}.content__container.unClickable.svelte-elzzn6{pointer-events:none !important}.content__container.unClickable.svelte-elzzn6 *{pointer-events:none !important}.content__wrapper.svelte-elzzn6{pointer-events:none;width:100%;height:100%}.content__container.hide.svelte-elzzn6{opacity:0;pointer-events:none}.content__container.hide.svelte-elzzn6 *{pointer-events:none !important}.content__container.disable.svelte-elzzn6{display:none}.content.svelte-elzzn6{position:relative;width:100%;height:100%;font-size:0.75rem;color:#fff}.content.svelte-elzzn6:not(.unfolded){pointer-events:none}.content.svelte-elzzn6:not(.unfolded) *{pointer-events:none !important}.content.unfolded.svelte-elzzn6{pointer-events:auto}')}function gF(e){let n,t;return{c(){n=H("div"),_(n,"data-info","tag content is keep folded"),_(n,"data-id",t=e[0].id)},m(i,r){Z(i,n,r)},p(i,r){r&1&&t!==(t=i[0].id)&&_(n,"data-id",t)},i:de,o:de,d(i){i&&Y(n)}}}function vF(e){let n,t,i,r,s,o,a,l,c,h,u,d,f,m,p,g,y;const b=[CF,EF,MF,xF,wF,AF,bF],A=[];function w(x,M){return M&9&&(r=null),M&9&&(s=null),M&9&&(o=null),M&9&&(a=null),M&9&&(l=null),M&9&&(c=null),M&9&&(h=null),r==null&&(r=!!(["Text"].includes(x[0].contentType)||["Text"].includes(x[3].get(x[0].contentType)))),r?0:(s==null&&(s=!!(["ImageText","Image","Video"].includes(x[0].contentType)||["ImageText","Image","Video"].includes(x[3].get(x[0].contentType)))),s?1:(o==null&&(o=!!(["Audio"].includes(x[0].contentType)||["Audio"].includes(x[3].get(x[0].contentType)))),o?2:(a==null&&(a=!!(["Marketing"].includes(x[0].contentType)||["Marketing"].includes(x[3].get(x[0].contentType)))),a?3:(l==null&&(l=!!(["Link","VRLink","PanoLink","Sticker"].includes(x[0].contentType)||["Link","VRLink","PanoLink","Sticker"].includes(x[3].get(x[0].contentType)))),l?4:(c==null&&(c=!!(["MediaPlane","MediaModel"].includes(x[0].contentType)||["MediaPlane","MediaModel"].includes(x[3].get(x[0].contentType)))),c?5:(h==null&&(h=!!(["Panorama"].includes(x[0].contentType)||["Panorama"].includes(x[3].get(x[0].contentType)))),h?6:-1))))))}return~(u=w(e,-1))&&(d=A[u]=b[u](e)),{c(){var x;n=H("div"),t=H("div"),i=H("div"),d&&d.c(),_(i,"class","content svelte-elzzn6"),Ce(i,"unfolded",(x=e[0].state)==null?void 0:x.unfolded),_(t,"class","content__wrapper svelte-elzzn6"),_(n,"class",f=on(Jn("content__container",e[0].className))+" svelte-elzzn6"),_(n,"data-id",m=e[0].id),Ce(n,"disable",e[0].enabled===!1),Ce(n,"hide",e[5]),Ce(n,"unClickable",e[0].config.clickable===!1),W(n,"width",e[0].stickType==="Plane"||e[0].contentType==="MediaModel"?"100%":0),W(n,"height",e[0].stickType==="Plane"||e[0].contentType==="MediaModel"?"100%":0)},m(x,M){Z(x,n,M),Q(n,t),Q(t,i),~u&&A[u].m(i,null),e[16](n),p=!0,g||(y=ot(n,"click",e[17],!0),g=!0)},p(x,M){var S;let P=u;u=w(x,M),u===P?~u&&A[u].p(x,M):(d&&(Ve(),X(A[P],1,1,()=>{A[P]=null}),Ge()),~u?(d=A[u],d?d.p(x,M):(d=A[u]=b[u](x),d.c()),F(d,1),d.m(i,null)):d=null),(!p||M&1)&&Ce(i,"unfolded",(S=x[0].state)==null?void 0:S.unfolded),(!p||M&1&&f!==(f=on(Jn("content__container",x[0].className))+" svelte-elzzn6"))&&_(n,"class",f),(!p||M&1&&m!==(m=x[0].id))&&_(n,"data-id",m),(!p||M&1)&&Ce(n,"disable",x[0].enabled===!1),(!p||M&33)&&Ce(n,"hide",x[5]),(!p||M&1)&&Ce(n,"unClickable",x[0].config.clickable===!1),M&1&&W(n,"width",x[0].stickType==="Plane"||x[0].contentType==="MediaModel"?"100%":0),M&1&&W(n,"height",x[0].stickType==="Plane"||x[0].contentType==="MediaModel"?"100%":0)},i(x){p||(F(d),p=!0)},o(x){X(d),p=!1},d(x){x&&Y(n),~u&&A[u].d(),e[16](null),g=!1,y()}}}function yF(e){let n,t,i,r,s,o,a;return t=new oF({props:{tag:nn(e[0]),rendererMap:e[2]}}),{c(){n=H("div"),Ie(t.$$.fragment),_(n,"class",i=on(Jn("content__container",e[0].className))+" svelte-elzzn6"),_(n,"data-id",r=e[0].id),Ce(n,"custom-tag-disable",e[0].enabled===!1),Ce(n,"custom-tag-hide",e[5])},m(l,c){Z(l,n,c),_e(t,n,null),e[14](n),s=!0,o||(a=ot(n,"click",e[15]),o=!0)},p(l,c){const h={};c&1&&(h.tag=nn(l[0])),c&4&&(h.rendererMap=l[2]),t.$set(h),(!s||c&1&&i!==(i=on(Jn("content__container",l[0].className))+" svelte-elzzn6"))&&_(n,"class",i),(!s||c&1&&r!==(r=l[0].id))&&_(n,"data-id",r),(!s||c&1)&&Ce(n,"custom-tag-disable",l[0].enabled===!1),(!s||c&33)&&Ce(n,"custom-tag-hide",l[5])},i(l){s||(F(t.$$.fragment,l),s=!0)},o(l){X(t.$$.fragment,l),s=!1},d(l){l&&Y(n),Se(t),e[14](null),o=!1,a()}}}function bF(e){let n,t;return n=new tF({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function AF(e){let n,t;return n=new RN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function wF(e){let n,t;return n=new qN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function xF(e){let n,t;return n=new aN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function MF(e){let n,t;return n=new TN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function EF(e){let n,t;return n=new iN({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function CF(e){let n,t;return n=new xz({props:{tag:nn(e[0])}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=nn(i[0])),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function PF(e){let n,t,i,r,s;const o=[yF,vF,gF],a=[];function l(c,h){return h&5&&(n=null),n==null&&(n=!!(c[0].element||c[2].has(c[0].contentType))),n?0:c[4]?1:2}return t=l(e,-1),i=a[t]=o[t](e),{c(){i.c(),r=ft()},m(c,h){a[t].m(c,h),Z(c,r,h),s=!0},p(c,[h]){let u=t;t=l(c,h),t===u?a[t].p(c,h):(Ve(),X(a[u],1,1,()=>{a[u]=null}),Ge(),i=a[t],i?i.p(c,h):(i=a[t]=o[t](c),i.c()),F(i,1),i.m(r.parentNode,r))},i(c){s||(F(i),s=!0)},o(c){X(i),s=!1},d(c){a[t].d(c),c&&Y(r)}}}function _F(e,n,t){let i,r,s,o,a,l,{tag:c}=n,{hooks:h}=n,{rendererMap:u=new Map}=n,{contentTypeMap:d=new Map}=n,{state:f}=n,{mediaStore:m}=n,{temporaryState:p}=n;Em("hooks",h),Em("mediaStore",m);let g,y;function b(S){S?h.emit("exposure",{id:o,type:"start"}):h.emit("exposure",{id:o,type:"end"})}function A(S,T,z){var D,k;return!(!T.visible||!T.enabled||!z.visible||!((D=S.state)!=null&&D.visible)||((k=S.temporaryState)==null?void 0:k.visible)===!1||S instanceof OM&&S.loading)}function w(S){Qt[S?"unshift":"push"](()=>{c.contentDom=S,t(0,c)})}const x=S=>h.emit("click",{event:S,target:"TagContent",tag:c});function M(S){Qt[S?"unshift":"push"](()=>{c.contentDom=S,t(0,c)})}const P=S=>{c.entryFromModel&&_i(c.five.state.mode)?(S.stopPropagation(),c.find({targetMode:"Panorama"})):h.emit("click",{event:S,target:"TagContent",tag:c})};return e.$$set=S=>{"tag"in S&&t(0,c=S.tag),"hooks"in S&&t(1,h=S.hooks),"rendererMap"in S&&t(2,u=S.rendererMap),"contentTypeMap"in S&&t(3,d=S.contentTypeMap),"state"in S&&t(6,f=S.state),"mediaStore"in S&&t(7,m=S.mediaStore),"temporaryState"in S&&t(8,p=S.temporaryState)},e.$$.update=()=>{var S,T,z,D,k,O,G,I,U,q,K;e.$$.dirty&1&&t(12,i=(S=c.state)==null?void 0:S.unfolded),e.$$.dirty&1&&t(11,r=(T=c.state)==null?void 0:T.visible),e.$$.dirty&321&&t(13,s=f.visible&&p.visible&&((z=c.state)==null?void 0:z.visible)),e.$$.dirty&1&&(o=c.id),e.$$.dirty&321&&t(5,a=!A(c,f,p)),e.$$.dirty&8192&&b(s),e.$$.dirty&7681&&c.hooks&&(i!==void 0&&i!==y&&(t(10,y=i),i?(k=(D=c.hooks).emit)==null||k.call(D,"unfolded"):(G=c==null?void 0:(O=c.hooks).emit)==null||G.call(O,"folded")),r!==void 0&&r!==g&&(t(9,g=r),r?(U=(I=c.hooks).emit)==null||U.call(I,"show"):(K=(q=c.hooks).emit)==null||K.call(q,"hide"))),e.$$.dirty&1&&t(4,l=(()=>!(typeof c.config.unfoldedConfig=="object"&&c.config.unfoldedConfig.keep==="folded"))())},[c,h,u,d,l,a,f,m,p,g,y,r,i,s,w,x,M,P]}let zM=class extends ke{constructor(n){super(),Le(this,n,_F,PF,De,{tag:0,hooks:1,rendererMap:2,contentTypeMap:3,state:6,mediaStore:7,temporaryState:8},mF)}};const SF={globalConfig:{visibleConfig:{followModelVisibility:!0},unfoldedConfig:{autoUnfold:{enable:!0,strategy:"MinimumDistance",distance:{max:5}}},tag3DConfig:{ratio:.0035}},contentTypeConfig:{"[Mapview]":{unfoldedConfig:{autoUnfold:{enable:!1,distance:{max:9999}}}},"[Floorplan]":{unfoldedConfig:{autoUnfold:{enable:!1,distance:{max:9999}}}},"Any-Audio-plane":{unfoldedConfig:{keep:"unfolded"}},Link:{unfoldedConfig:{keep:"unfolded"}},Panorama:{unfoldedConfig:{keep:"unfolded"}},VRLink:{unfoldedConfig:{keep:"unfolded"}},PanoLink:{unfoldedConfig:{keep:"unfolded"}},MediaPlane:{unfoldedConfig:{keep:"unfolded"},visibleConfig:{alwaysShowWhenMovePano:!0},initialData:{autoplayConfig:{autoplayCarousel:!0,autoplayVideo:!1,autoplayVideoInCarousel:!1}}},"Model-Any":{unfoldedConfig:{keep:"unfolded"},visibleConfig:{visibleFiveMode:"all",alwaysShowWhenMovePano:!0}}}};class s1 extends C.Raycaster{intersectObject(n,t=!0,i=[]){return Fm(n,this,i,t),i.sort(o1),i}intersectObjects(n,t=!0,i=[]){for(let r=0,s=n.length;r<s;r++)Fm(n[r],this,i,t);return i.sort(o1),i}}function o1(e,n){return e.distance-n.distance}function Fm(e,n,t,i){let r=!0;if(e.layers.test(n.layers)&&e.raycast(n,t)===!1&&(r=!1),r===!0&&i===!0){const s=e.children;for(let o=0,a=s.length;o<a;o++)Fm(s[o],n,t,!0)}}function Xg(e,n,t,i){let r=!0;if(e.type!=="Line2"&&(e.layers.test(n.layers)&&e.raycast(n,t)===!1&&(r=!1),r===!0&&i===!0)){const s=e.children;for(let o=0,a=s.length;o<a;o++)s[o].type!=="Line2"&&Xg(s[o],n,t,!0)}}class Zg{constructor(n,t){v(this,"five");v(this,"dragging",!1);v(this,"boundObject",{});v(this,"config");v(this,"lastMouseDownEvent");v(this,"lastTouchEvent");v(this,"handleWantsGesture",(n,t)=>{if(t.length!==1)return;const i=t[0];if(i.raycaster){const r=new s1;r.ray=i.raycaster.ray,r.near=i.raycaster.near,r.far=i.raycaster.far,r.camera=i.raycaster.camera,r.layers=i.raycaster.layers,r.params=i.raycaster.params,i.raycaster=r}if(i){if(n==="mouseMove"&&this.onDomEvent("hover",i),n==="tap"){let r;!r&&!Cc&&(r=this.lastMouseDownEvent),!r&&Cc&&(r=this.lastTouchEvent),r||(r=new MouseEvent("click",{clientX:i.x,clientY:i.y}));const s=this.onDomEvent("click",i,r),o=this.onDomEvent("wantDblclick",i,r,this.boundObject.dblclick);if(s===!1||o===!1)return!1}if(this.dragging)return!1}});v(this,"handleDomEvent",(n,t,i)=>{const r={x:t.clientX,y:t.clientY};this.onDomEvent(n,r,t,i)});v(this,"handleMouseEvent",n=>{this.handleDomEvent(n.type,n)});v(this,"handleMousedown",n=>{this.lastMouseDownEvent=n,this.handleDomEvent("mousedown",n),this.handleDomEvent("dragstart",n,this.haveDragEventObject)});v(this,"handleTouchStart",n=>{this.lastTouchEvent=n});v(this,"handleMouseup",n=>{var t;this.dragging=!1,(t=this.haveDragEventObject)==null||t.forEach(i=>{i._dragging&&(i._dragging=!1,this.notify({eventName:"dragend",object:i,originEvent:n,raycaster:this.getRaycaster({x:n.clientX,y:n.clientY})}))}),this.handleDomEvent("mouseup",n)});v(this,"handleMousemove",n=>{var t;this.dragging&&((t=this.boundObject.drag)==null||t.forEach(i=>{i._dragging&&this.notify({eventName:"drag",object:i,originEvent:n,raycaster:this.getRaycaster({x:n.clientX,y:n.clientY})})}))});v(this,"onDomEvent",(n,t,i,r=this.boundObject[n])=>{var d,f,m,p,g;if(!t||!r||(r==null?void 0:r.length)===0)return;const s=[];((d=this.config)==null?void 0:d.fiveModels)!==null&&((f=this.config)!=null&&f.fiveModels?s.push(...this.config.fiveModels):s.push(this.model));const o=s.filter(y=>y.loaded),a=(m=t.raycaster)!=null?m:this.getRaycaster(t);a.params.Points.threshold=.02;const l=a.intersectObjects(r,!0),c=[];o.forEach(y=>{const b=y.intersectRaycaster(a);c.push(...b)});const h=.01;if(c.length>0&&l.length>0&&c[0].distance+h<l[0].distance)return;const u=(p=l==null?void 0:l[0])==null?void 0:p.object;if(n==="wantDblclick")return!1;if((!u||!this.objectIsBound(u))&&n==="hover")for(const y of(g=this.boundObject.hover)!=null?g:[])y._hovered&&this.notify({eventName:"unHover",object:y});if(u&&u&&this.notify({eventName:n,object:u,originEvent:i,raycaster:a,intersects:l}))return!1});v(this,"objectIsBound",n=>{let t=n._domEvent,i=n.parent;for(;typeof t=="undefined"&&i;)t=i._domEvent,i=i.parent;return!!t});v(this,"notify",n=>{var d,f,m;const{eventName:t,object:i,originEvent:r,raycaster:s,intersects:o}=n;let a=!1,l=[];const c=[];let h=i;for(c.push(h);h.parent;)h=h.parent,c.push(h);const u=c.at(-1);if(!((d=this.config)!=null&&d.noEmitWhenNotInScene&&u.type!=="Scene")){for(const p of c){if(a)break;p.draggable&&(t==="dragstart"&&(p._dragging=!0,this.dragging=!0),t==="dragend"&&(p._dragging=!1,this.dragging=!1));const g=p._domEvent;if(!g)continue;const y=g[`${t}Handler`];if(y)for(const[b,A]of y){if(A!=null&&A.noEmitWhenNotInScene&&u.type!=="Scene"||((f=this.config)!=null&&f.noEmitWhenHide||A!=null&&A.noEmitWhenHide)&&!Xm(p))continue;if(t==="hover"){if(p._hovered)continue;p._hovered=!0;for(const x of(m=this.boundObject.hover)!=null?m:[])x!==p&&x._hovered&&this.notify({eventName:"unHover",object:x})}if(t==="unHover"){if(!p._hovered)continue;p._hovered=!1}const w=b({type:t,target:p,origDomEvent:r,raycaster:s,intersects:o,stopPropagation:()=>{a=!0}});l.push(w!=null?w:!0)}}if(t==="click"||t==="wantDblclick")return l.some(p=>p===!0)}});this.five=n,this.config=t,n.on("wantsGesture",this.handleWantsGesture),document.addEventListener("mousedown",this.handleMousedown),document.addEventListener("touchstart",this.handleTouchStart),document.addEventListener("dblclick",this.handleMouseEvent),document.addEventListener("mouseup",this.handleMouseup),document.addEventListener("mousemove",this.handleMousemove)}get haveDragEventObject(){return[...new Set([this.boundObject.dragend,this.boundObject.drag,this.boundObject.dragstart].flat())].filter(Boolean)}get model(){return ki(this.five)}addAutoBindEventListener(n,t,i,r){const s=()=>this.addEventListener(n,t,i,r),o=()=>this.removeEventListener(n,t,i,r);return n.addEventListener("added",s),n.addEventListener("removed",o),n.addEventListener("dispose",o),()=>{n.removeEventListener("added",s),n.removeEventListener("removed",o),n.removeEventListener("dispose",o)}}addEventListener(n,t,i,r){n._domEvent||(n._domEvent={}),n._domEvent[`${t}Handler`]||(n._domEvent[`${t}Handler`]=[]),this.boundObject[t]||(this.boundObject[t]=[]),this.boundObject[t].includes(n)||this.boundObject[t].push(n),n._domEvent[`${t}Handler`].push([i,R({noEmitWhenHide:!1,noEmitWhenNotInScene:!1},r)])}removeEventListener(n,t,i,...r){var o,a;if(!n._domEvent||(t===void 0&&(Object.keys(this.boundObject).forEach(l=>{var h,u;const c=(h=this.boundObject[l])==null?void 0:h.findIndex(d=>d===n);c!==-1&&((u=this.boundObject[l])==null||u.splice(c,1))}),n._domEvent={}),!n._domEvent[`${t}Handler`]))return;if(i===void 0){delete n._domEvent[`${t}Handler`];return}const s=n._domEvent[`${t}Handler`].findIndex(l=>l[0]===i);if(s!==-1&&(n._domEvent[`${t}Handler`].splice(s,1),n._domEvent[`${t}Handler`].length===0&&delete n._domEvent[`${t}Handler`],n._domEvent&&Object.keys(n._domEvent).length===0&&delete n._domEvent,!n._domEvent)){const l=(o=this.boundObject[t])==null?void 0:o.findIndex(c=>c===n);l!==-1&&((a=this.boundObject[t])==null||a.splice(l,1))}}clear(){this.boundObject={}}dispose(){var n;(n=this.five)==null||n.off("wantsGesture",this.handleWantsGesture),document.removeEventListener("mousedown",this.handleMousedown),document.removeEventListener("touchstart",this.handleTouchStart),document.removeEventListener("mouseup",this.handleMouseup),document.removeEventListener("mousemove",this.handleMousemove),this.boundObject={}}toJSON(){return{boundObject:this.boundObject}}getRaycaster(n){const t=this.five.getElement();if(!t)return;const i=Xx(n,t),r=new s1;return r.setFromCamera(i,this.five.camera),r}}class IF extends ws{constructor(t){super(t);v(this,"tags",[]);v(this,"cache",new _c);v(this,"config",SF);v(this,"renderQueue",new Map);v(this,"params");v(this,"mediaStore",Cg({currentMediaElement:null}));v(this,"store",{disposers:[],disposed:!1,resizeObserverDisposerAdding:!1,css3DRenderDisposer:new Map});v(this,"domEvents",new Zg(this.five));v(this,"_cache_pointTag");v(this,"_cache_2DPointTag");v(this,"_cache_css3DTag");v(this,"_container",null);v(this,"_css3DRenderPlugin");v(this,"whyHide",t=>{const i=this.getTagById(t);return i?i.whyHide():{reason:`tag ${t} not found`}});v(this,"loadVideoFirstFrame",()=>{uF&&this.hooks.emit("loadVideoFirstFrame")});this.mediaStore.subscribe(({currentMediaElement:i})=>{this.tags.forEach(r=>{var s;if(r.mediaPlane instanceof TM&&i!==r.mediaPlane.videoInstance){if(!((s=r.mediaPlane.videoInstance)!=null&&s.src)||i===r.mediaPlane.videoInstance)return;r.mediaPlane.pause()}})})}get container(){var t;return this._container||((t=this.five.getElement())==null?void 0:t.parentElement)}set container(t){this._container=t}set tagsLengthWillUpdate(t){t&&(this._cache_pointTag=this.tags.filter(i=>i.stickType==="2DPoint"||i.stickType==="3DPoint").filter(i=>i.position),this._cache_2DPointTag=this.tags.filter(i=>i.stickType==="2DPoint").filter(i=>i.position),this._cache_css3DTag=this.tags.filter(i=>i.stickType==="3DPoint"||i.stickType==="Plane"||i.stickType==="Model"&&i.contentType==="MediaModel").filter(i=>{const r=i.computeRenderType();return r==="BehindDom"||r==="Dom"}))}get css3DRenderPlugin(){var t,i,r;if(!this._css3DRenderPlugin){const s=Bc(this.five);this._css3DRenderPlugin=s,(t=s.frontModeCSS3DRenderer)!=null&&t.domElementWrapper&&(s.frontModeCSS3DRenderer.domElementWrapper.style.zIndex=(r=(i=this.params.containerZIndex)==null?void 0:i.toString())!=null?r:"")}return this._css3DRenderPlugin}get filterPointTag(){var t;return(t=this._cache_pointTag)!=null?t:[]}get filter2DPointTag(){var t;return(t=this._cache_2DPointTag)!=null?t:[]}get filterCSS3DTag(){var t;return(t=this._cache_css3DTag)!=null?t:[]}addRenderQueue(t){var o,a;const{type:i,keys:r=[],tags:s=[]}=t;this.renderQueue.has(i)?this.renderQueue.set(i,{keys:Array.from(new Set([...(o=this.renderQueue.get(i).keys)!=null?o:[],...r])),tags:Array.from(new Set([...(a=this.renderQueue.get(i).tags)!=null?a:[],...s]))}):this.renderQueue.set(i,{keys:r,tags:s})}getTagById(t){const i=this.tags.find(r=>r.id===t);if(!i){console.warn(`getTagById Error: can't find tag id: ${t}`);return}return i}pauseCurrentMedia(){this.mediaStore.set({currentMediaElement:null})}getPositions(t){if(PO(t))return t.position;if($i(t))return t.data.mediaPosition;if(_O(t))return TO(this.five.camera.position,Ft(t.position),Ft(t.normal))}addObjectClickHandler(t,i,r){if(!i||!this.domEvents)return()=>{};const s=()=>!(!t.currentVisible||t.loading),o=a=>{if(!s())return!1;r(a.origDomEvent)};return this.domEvents.addEventListener(i,"click",o),()=>{var a;(a=this.domEvents)==null||a.removeEventListener(i,"click",o)}}checkDisposed(){return this.store.disposed?(console.error("PanoTagPluginController has been disposed"),!0):!1}}class TF extends IF{constructor(t){super(t);v(this,"rendererMap",new Map);v(this,"contentTypeMap",new Map);v(this,"group",new ne.Group);v(this,"imagePlaneGroup",new ne.Group);v(this,"gltfObjectGroup",new ne.Group);v(this,"enabledModelTagSet",new Set);v(this,"temporaryState",{visible:!0});v(this,"TagContainerSvelte");this.group.name="PanoTagPluginModelGroup",this.gltfObjectGroup.name="PanoTagPluginGLTFObjectGroup",this.imagePlaneGroup.name="ImagePlaneGroup",this.group.add(this.gltfObjectGroup),this.group.add(this.imagePlaneGroup)}registerRenderer(t,i,r){var s;this.rendererMap.set(t,{renderer:i,usePoint:(s=r==null?void 0:r.usePoint)!=null?s:!1})}bindRenderer(t,i){this.contentTypeMap.set(t,i)}clearTags(){var t;this.tags.length&&(this.tags.forEach(i=>{var r,s,o,a,l;(s=(r=i.mediaPlane)==null?void 0:r.parent)==null||s.remove(i.mediaPlane),(l=(a=(o=i.model)==null?void 0:o.object)==null?void 0:a.parent)==null||l.remove(i.model.object)}),this.tags=[],this.tagsLengthWillUpdate=!0,this.hooks.emit("tagsLengthChange"),(t=this.TagContainerSvelte)==null||t.$destroy(),this.TagContainerSvelte=void 0,this.disposeAllCSS3DContainer()),this.enabledModelTagSet.clear(),this.cache.clear()}updateRender3DDomTag(t){(t?zr(t):this.filterCSS3DTag).forEach(r=>{var s,o,a,l,c,h;if(r.tag3DContentSvelte){const{svelteApp:u,css3DInstance:d,initialNormal:f,currentNormal:m}=r.tag3DContentSvelte;if((o=d==null?void 0:d.css3DObject)==null||o.setVisible((this.state.visible&&((s=r.state)==null?void 0:s.visible))!==!1),u.$set({tag:r,hooks:this.hooks,state:this.state,temporaryState:this.temporaryState}),!f.equals(m)){const p=new ne.Quaternion().setFromUnitVectors(f,m);d.css3DObject.setRotationFromQuaternion(p)}return}else{if($i(r)&&!((a=r.model)!=null&&a.object)||((l=r.state)==null?void 0:l.visible)===!1||!this.state.visible||!this.state.enabled||!this.css3DRenderPlugin)return;if(r.stickType==="3DPoint"&&!r.normal)return console.error("updateRenderPlaneTag: 三维点标签缺少法向量!");const u=this.getPositions(r);if(!u)return;const d=r.computeNormal();if(!d)return;const f=r.getConfig(),m=R({wrapperStyle:{zIndex:`${Math.round((1e4-((c=r.getDistance())!=null?c:0))*100)}`}},f.tag3DConfig);if(r.computeRenderType()==="BehindDom"||m.mode==="behind"){m.mode="behind",m.container=document.createElement("div");const y="black";m.container.style.backgroundColor=y,m.container.style.border=`3px solid ${y}`,this.css3DRenderPlugin.hooks.on("render",()=>{var b;if(p.css3DObject.opacityMesh&&f.clickable!==!1){const A=this.addObjectClickHandler(r,p.css3DObject.opacityMesh,w=>{this.hooks.emit("click",{event:w,target:"TagContent",tag:r})});(b=this.store.css3DRenderDisposer.get(r.id))==null||b.push(A)}})}const p=this.css3DRenderPlugin.create3DDomContainer(u,m);if(!p)return;this.store.css3DRenderDisposer.set(r.id,[p.dispose]);const g=new zM({target:p.container,props:{tag:r,hooks:this.hooks,state:this.state,mediaStore:this.mediaStore,temporaryState:this.temporaryState}});r.tag3DContentSvelte={svelteApp:g,domContainer:p,css3DInstance:p,initialNormal:d,currentNormal:d,dispose:()=>{g.$destroy(),p.dispose()}},$i(r)&&((h=r.model)!=null&&h.object)&&this.updateTagCss3DObjectMatrix(r,r.model.object)}}),this.clearUnusedPanelTag()}updateTagCss3DObjectMatrix(t,i){var p,g,y;const r=(g=(p=t.getConfig().tag3DConfig)==null?void 0:p.ratio)!=null?g:.00216,s=(y=t.tag3DContentSvelte)==null?void 0:y.css3DInstance.css3DObject;if(!s)return;const o=$i(t)?t.data.mediaPosition:t.position;if(!o||o.length!==4||!Array.isArray(o[0])||!Array.isArray(o[2]))return;i.updateWorldMatrix(!1,!1);const a=i.matrixWorld,l=new ne.Vector3().fromArray(o[0]),c=new ne.Vector3().fromArray(o[2]),h=lr(l,c).add(new ne.Vector3(0,0,5e-4)),u=new ne.Matrix4().setPosition(h),d=new ne.Matrix4().makeScale(r,r,r),f=new ne.Matrix4().multiply(a).multiply(u).multiply(d);f.decompose(s.position,s.quaternion,s.scale);const m=s.opacityMesh;m&&f.decompose(m.position,m.quaternion,m.scale)}addMediaModelTag(t){return ee(this,null,function*(){const i=t.filter(r=>r.stickType==="Model").map(r=>r.loadModel());yield Promise.all(i),t.forEach(r=>r.updateVisible())})}disposeAllCSS3DContainer(){for(const[,t]of this.store.css3DRenderDisposer)t==null||t.forEach(i=>i==null?void 0:i());this.store.css3DRenderDisposer=new Map}clearUnusedPanelTag(){this.filter2DPointTag.forEach(t=>{var i;(i=t.tag3DContentSvelte)==null||i.css3DInstance.dispose(),t.tag3DContentSvelte=void 0});for(const[t,i]of this.store.css3DRenderDisposer){const r=this.getTagById(t);(!r||r.stickType==="2DPoint")&&(i==null||i.forEach(s=>s==null?void 0:s()),this.store.css3DRenderDisposer.delete(t))}}}class DF{constructor(n){v(this,"plugin");v(this,"logBinded",!1);this.plugin=n}get debug(){return this.plugin.debug}addDebugPoints(){try{CO(this.plugin.five,this.plugin.tags)}catch(n){console.error(n)}}bindLog(){if(this.logBinded)return;this.logBinded=!0;const n=t=>{Object.getOwnPropertyNames(t).forEach(i=>{typeof t[i]=="function"&&(t[i]=new Proxy(t[i],{apply:(r,s,o)=>(["render"].includes(i)||this.addLog(i,...o),r.apply(s,o))}))})};n(this.plugin),n(this.plugin.constructor.prototype)}addLog(n,...t){if(this.debug){let i=new Error().stack;console.debug(`%cPanoTagPlugin%c${n}`,"background-color: #35e0ed; color: black; padding:0 6px; border-radius: 3px","padding: 0 3px; color: #f3f47c",...t,{stack:i})}}closeIntersectRaycaster(){this.plugin.tags.forEach(n=>{var t;io((t=n==null?void 0:n.initialConfig)==null?void 0:t.visibleConfig).intersectRaycaster&&(n.initialConfig.visibleConfig.intersectRaycaster.enabled=!1)}),this.plugin.changeGlobalConfig({visibleConfig:{intersectRaycaster:{enabled:!1}}})}}const LF=new C.Vector2;class kF extends Yg{constructor(t,i){super(t,i);v(this,"__Object__");v(this,"requestIdleCallbackId")}unfoldAndFoldOthers(){const t=this.can("fold"),i=this.can("unfold");t&&i&&(this.state.unfolded=!this.state.unfolded,this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.state.unfolded&&this.plugin.tags.forEach(r=>{r.id!==this.id&&r.fold()}))}onClick(t){t.target==="TagPoint"&&this.unfoldAndFoldOthers()}updateVisible(){if(typeof window.requestIdleCallback=="undefined"){super.updateVisible();return}const t=()=>{this.requestIdleCallbackId&&cancelIdleCallback(this.requestIdleCallbackId),this.requestIdleCallbackId=requestIdleCallback(()=>{super.updateVisible()})};let i=!1;requestIdleCallback(()=>{i=!0}),t(),setTimeout(()=>{i||(this.requestIdleCallbackId&&cancelIdleCallback(this.requestIdleCallbackId),super.updateVisible())},200)}applyVisible(){var t,i,r,s;this.currentVisible&&this.updateScreenPosition(),(r=(i=(t=this.tag3DContentSvelte)==null?void 0:t.css3DInstance)==null?void 0:i.css3DObject)==null||r.setVisible(this.currentVisible),(s=this.tag3DContentSvelte)==null||s.svelteApp.$set({state:this.plugin.state,temporaryState:this.temporaryState}),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}unfold(){this.setUnfold(!0)}fold(){this.setUnfold(!1)}setUnfold(t){const i=this.can("fold"),r=this.can("unfold");i&&r&&(this.state.unfolded=t,this.hooks.emit(t?"unfolded":"folded"),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}))}setPosition(t){this.originPosition=t,this.position=t,this.cache.clear(),this.updateVisible(),this.updateScreenPosition(),this.updateZIndex(),this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}updateScreenPosition(t){var a;if(this.stickType!=="2DPoint"&&this.stickType!=="3DPoint")return;const{force:i=!1}=t!=null?t:{},r=i?this.state.visible:this.currentVisible,s=(a=this.__Object__)!=null?a:{timeoutId:void 0,inAnimation:!1};if(this.__Object__=s,!r&&this.screenPosition?(s.inAnimation=!0,s.timeoutId=setTimeout(()=>{requestAnimationFrame(()=>{this.currentVisible||(s.inAnimation=!1,this.screenPosition=null,this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}))})},1e3)):s.timeoutId&&(clearTimeout(s.timeoutId),s.inAnimation=!1,s.timeoutId=void 0),!r&&!s.inAnimation)return;const o=this.computeTagProject();if(o){const l=(()=>{if(!this.currentConfig.simulate3D)return 1;const h=2*Math.tan(.5*this.five.camera.fov/180*Math.PI),u=this.getDistance(void 0,1);return Math.max(Math.min(1-h*u/40,1),.5)})(),c=this.five.renderer.getSize(LF);this.screenPosition={leftPx:(o.x+1)/2*c.x,topPx:(-o.y+1)/2*c.y,scale:l}}else this.screenPosition=null;this.plugin.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]})}updateUnfoldedByPanoIndex(){const t=this.getUnfoldedByPanoIndex();if(this.state&&(t!==void 0&&(this.state.unfolded=t),t&&!this.state.visible)){const i=this.getConfig();typeof i.unfoldedConfig=="object"&&i.unfoldedConfig.autoFoldWhenHide!==!1&&(this.state.unfolded=!1)}}computeNormal(){return new C.Vector3().fromArray(this.normal)}}const RF=new Map,OF=new Map;class zF extends Yg{constructor(n,t){super(n,t),this.state.unfolded=!0}applyVisible(){var t,i,r,s,o,a;this.computeRenderType()==="Mesh"?((i=(t=this.data.mediaData)==null?void 0:t[0])==null?void 0:i.type)==="Video"?this.renderVideoPlane():((s=(r=this.data.mediaData)==null?void 0:r[0])==null?void 0:s.type)==="Image"&&this.renderImagePlane():(this.tag3DContentSvelte||this.plugin.updateRender3DDomTag(),(o=this.tag3DContentSvelte)==null||o.svelteApp.$set({tag:this,state:this.plugin.state}),(a=this.tag3DContentSvelte)==null||a.css3DInstance.setVisible(this.currentVisible))}renderVideoPlane(){var a;const n=this.data.mediaData[0];if(!n)return;const{url:t}=n;if(!t)return;const i=this.currentVisible,r=(()=>!!(this.mediaPlane&&!i))(),s=(()=>!!(!this.mediaPlane&&i))(),o=(()=>!!(this.mediaPlane&&this.mediaPlane.src!==t))();if((r||o)&&this.mediaPlane&&(this.plugin.imagePlaneGroup.remove(this.mediaPlane),this.mediaPlane.dispose(),this.mediaPlane.removeFromParent(),this.mediaPlane=void 0),s||o){const l=this.position.map(os),c=new TM(t,l,{videoCoverSrc:n.videoCoverUrl,playButton:this.data.playIcon,paused:!((a=this.data.autoplayConfig)!=null&&a.autoplayVideo),objectFit:this.data.objectFit,videoTextureMap:RF,ImageTextureMap:OF,domEvents:this.plugin.domEvents});c.onVideoReady=u=>{u.addEventListener("play",()=>this.plugin.mediaStore.set({currentMediaElement:c.videoInstance}))};const h=u=>(this.five.on("renderFrame",u),()=>this.five.off("renderFrame",u));c.initialRenderHooks(h),this.mediaPlane=c,this.play=()=>c.play(),this.pause=()=>c.pause(),this.plugin.imagePlaneGroup.add(this.mediaPlane)}this.five.needsRender=!0}renderImagePlane(){const n=this.data.mediaData[0];if(!n)return;const{url:t}=n;if(!t)return;const i=this.position.map(os),r=this.currentVisible,s=(()=>!!(this.mediaPlane&&!r))(),o=(()=>!!(!this.mediaPlane&&r))(),a=(()=>!!(this.mediaPlane&&this.mediaPlane.src!==t))();(s||a)&&this.mediaPlane&&(this.plugin.imagePlaneGroup.remove(this.mediaPlane),this.mediaPlane.dispose(),this.mediaPlane.removeFromParent(),this.mediaPlane=void 0),(o||a)&&(this.mediaPlane=new IM(t,i,{objectFit:this.data.objectFit}),this.getConfig().clickable!==!1&&this.plugin.domEvents.addAutoBindEventListener(this.mediaPlane,"click",l=>{this.plugin.hooks.emit("click",{tag:this,target:"TagContent",event:l.origDomEvent})},{noEmitWhenHide:!0}),this.plugin.imagePlaneGroup.add(this.mediaPlane)),this.five.needsRender=!0}computeNormal(){return oM(this.position)}}function BF(e){Ue(e,"svelte-7aiuwz",'@charset "UTF-8";.tag-point-click-helper.svelte-7aiuwz.svelte-7aiuwz{position:absolute;pointer-events:auto;cursor:pointer;width:calc(100% + 0.75rem);height:calc(100% + 0.75rem);left:50%;top:50%;transform:translate(-50%, -50%)}.tag-point-wrapper.svelte-7aiuwz.svelte-7aiuwz{pointer-events:none;position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.tag-folded-point.svelte-7aiuwz.svelte-7aiuwz,.tag-unfolded-point.svelte-7aiuwz.svelte-7aiuwz{transition:all 0.5s}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{display:flex;justify-content:center;align-items:center;position:absolute;width:100%;height:100%;border-radius:50%}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:0.3125rem;height:0.3125rem;border-radius:50%;background-color:white}.tag-point-wrapper.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz:before{content:"";position:absolute;width:0.875rem;height:0.875rem;border-radius:50%;background-color:rgba(0, 0, 0, 0.2)}.tag-point-wrapper.folded.svelte-7aiuwz .tag-folded-point.svelte-7aiuwz{opacity:1;scale:1}.tag-point-wrapper.folded.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{opacity:0;scale:1}.tag-point-wrapper.unfolded.svelte-7aiuwz .tag-folded-point.svelte-7aiuwz{opacity:0;scale:0.2}.tag-point-wrapper.unfolded.svelte-7aiuwz .tag-unfolded-point.svelte-7aiuwz{opacity:1;scale:1}')}function NF(e){let n,t,i,r,s,o,a,l,c,h,u,d;return r=new Bi({props:{center:!0,blurRadius:15,spreadRadius:5,opacity:.3}}),c=new PM({props:{icon:e[2],width:e[1]}}),c.$on("iconLoaded",e[7]),{c(){n=H("div"),t=H("div"),i=ve(),Ie(r.$$.fragment),s=ve(),o=H("div"),a=ve(),l=H("div"),Ie(c.$$.fragment),_(t,"class","tag-point-click-helper svelte-7aiuwz"),_(o,"class","tag-unfolded-point svelte-7aiuwz"),W(o,"transition-delay",(e[3]?e[5]:0)+"ms"),_(l,"class","tag-folded-point svelte-7aiuwz"),W(l,"transition-delay",(e[3]?e[5]:0)+"ms"),_(n,"class","tag-point-wrapper svelte-7aiuwz"),Ce(n,"unfolded",e[0]),Ce(n,"folded",e[3])},m(f,m){Z(f,n,m),Q(n,t),Q(n,i),_e(r,n,null),Q(n,s),Q(n,o),Q(n,a),Q(n,l),_e(c,l,null),h=!0,u||(d=ot(t,"click",e[4]),u=!0)},p(f,[m]){m&8&&W(o,"transition-delay",(f[3]?f[5]:0)+"ms");const p={};m&4&&(p.icon=f[2]),m&2&&(p.width=f[1]),c.$set(p),m&8&&W(l,"transition-delay",(f[3]?f[5]:0)+"ms"),(!h||m&1)&&Ce(n,"unfolded",f[0]),(!h||m&8)&&Ce(n,"folded",f[3])},i(f){h||(F(r.$$.fragment,f),F(c.$$.fragment,f),h=!0)},o(f){X(r.$$.fragment,f),X(c.$$.fragment,f),h=!1},d(f){f&&Y(n),Se(r),Se(c),u=!1,d()}}}function FF(e,n,t){let i,r,s,o;const a=fs("hooks");let{tag:l}=n,c,h=!1;const u=()=>{c!==void 0&&clearTimeout(c),h=!0,c=setTimeout(()=>{h=!1},800)},d=p=>{h||(l.entryFromModel&&_i(l.five.state.mode)?l.find({targetMode:"Panorama"}).then(()=>l.unfoldAndFoldOthers()):a.emit("click",{event:p,target:"TagPoint",tag:l}))},f=(()=>l.contentType==="Text"&&l.data.appearance==="plane"?500:800)();function m(p){Xa.call(this,e,p)}return e.$$set=p=>{"tag"in p&&t(6,l=p.tag)},e.$$.update=()=>{var p,g,y,b;e.$$.dirty&64&&t(0,i=(p=l.state)==null?void 0:p.unfolded),e.$$.dirty&1&&t(3,r=!i),e.$$.dirty&64&&t(2,s=(y=(g=l.style)==null?void 0:g.point)!=null&&y.url?(b=l.style)==null?void 0:b.point:{url:C4}),e.$$.dirty&64&&t(1,o=(()=>{var x,M,P,S;const A=(M=(x=l.style)==null?void 0:x.point)==null?void 0:M.width;if(typeof A=="number")return A;const w=(S=(P=l.style)==null?void 0:P.point)==null?void 0:S.size;if(typeof w=="number")return w;if(w==="S")return 18;if(w==="M")return 20;if(w==="L")return 24;if(w==="XL")return 28})())},u(),[i,o,s,r,d,f,l,m]}class VF extends ke{constructor(n){super(),Le(this,n,FF,NF,De,{tag:6},BF)}}function GF(e){Ue(e,"svelte-2g2g8a",".tag.svelte-2g2g8a{position:absolute;width:0rem;height:0rem;overflow:visible;pointer-events:auto;will-change:opacity;transition:opacity 0.2s linear}.tag.enableZIndex.svelte-2g2g8a{position:absolute}.tag.hide.svelte-2g2g8a{opacity:0;pointer-events:none}.tag.hide.svelte-2g2g8a *{pointer-events:none !important}.tag.unClickable.svelte-2g2g8a{pointer-events:none !important}.tag.unClickable.svelte-2g2g8a *{pointer-events:none !important}")}function a1(e){let n,t,i,r,s,o,a,l,c;const h=[HF,jF],u=[];function d(g,y){return g[8]?0:1}t=d(e),i=u[t]=h[t](e);const f=[WF,UF],m=[];function p(g,y){return g[15]?0:1}return s=p(e),o=m[s]=f[s](e),{c(){n=H("div"),i.c(),r=ve(),o.c(),_(n,"class","tag svelte-2g2g8a"),_(n,"data-tag-id",e[14]),_(n,"data-tag-unfolded",e[6]),_(n,"data-content-type",a=e[0].contentType),_(n,"id",l=`tag-${e[14]}`),Ce(n,"unClickable",e[0].config.clickable===!1),Ce(n,"hide",e[12]),Ce(n,"enableZIndex",e[9]),W(n,"z-index",e[9]),W(n,"transform",`translate3d(${e[11]}, ${e[10]}, 0) scale(${e[7].scale})`)},m(g,y){Z(g,n,y),u[t].m(n,null),Q(n,r),m[s].m(n,null),e[17](n),c=!0},p(g,y){let b=t;t=d(g),t===b?u[t].p(g,y):(Ve(),X(u[b],1,1,()=>{u[b]=null}),Ge(),i=u[t],i?i.p(g,y):(i=u[t]=h[t](g),i.c()),F(i,1),i.m(n,r));let A=s;s=p(g),s===A?m[s].p(g,y):(Ve(),X(m[A],1,1,()=>{m[A]=null}),Ge(),o=m[s],o?o.p(g,y):(o=m[s]=f[s](g),o.c()),F(o,1),o.m(n,null)),(!c||y&16384)&&_(n,"data-tag-id",g[14]),(!c||y&64)&&_(n,"data-tag-unfolded",g[6]),(!c||y&1&&a!==(a=g[0].contentType))&&_(n,"data-content-type",a),(!c||y&16384&&l!==(l=`tag-${g[14]}`))&&_(n,"id",l),(!c||y&1)&&Ce(n,"unClickable",g[0].config.clickable===!1),(!c||y&4096)&&Ce(n,"hide",g[12]),(!c||y&512)&&Ce(n,"enableZIndex",g[9]),y&512&&W(n,"z-index",g[9]),y&3200&&W(n,"transform",`translate3d(${g[11]}, ${g[10]}, 0) scale(${g[7].scale})`)},i(g){c||(F(i),F(o),c=!0)},o(g){X(i),X(o),c=!1},d(g){g&&Y(n),u[t].d(),m[s].d(),e[17](null)}}}function jF(e){let n;return{c(){n=H("div"),_(n,"data-info","tag point is disable")},m(t,i){Z(t,n,i)},p:de,i:de,o:de,d(t){t&&Y(n)}}}function HF(e){let n,t;return n=new VF({props:{tag:e[0]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&1&&(s.tag=i[0]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function UF(e){let n;return{c(){n=H("div"),_(n,"data-info","tag content is disable")},m(t,i){Z(t,n,i)},p:de,i:de,o:de,d(t){t&&Y(n)}}}function WF(e){let n,t;return n=new zM({props:{mediaStore:e[1],tag:nn(e[0]),hooks:e[16],state:e[4],temporaryState:e[5],rendererMap:e[2],contentTypeMap:e[3]}}),{c(){Ie(n.$$.fragment)},m(i,r){_e(n,i,r),t=!0},p(i,r){const s={};r&2&&(s.mediaStore=i[1]),r&1&&(s.tag=nn(i[0])),r&16&&(s.state=i[4]),r&32&&(s.temporaryState=i[5]),r&4&&(s.rendererMap=i[2]),r&8&&(s.contentTypeMap=i[3]),n.$set(s)},i(i){t||(F(n.$$.fragment,i),t=!0)},o(i){X(n.$$.fragment,i),t=!1},d(i){Se(n,i)}}}function QF(e){let n,t,i=e[7]&&!e[13]&&a1(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[7]&&!r[13]?i?(i.p(r,s),s&8320&&F(i,1)):(i=a1(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function YF(e,n,t){let i,r,s,o,a,l,c,h,u,d,{tag:f}=n,{mediaStore:m}=n,{rendererMap:p=new Map}=n,{contentTypeMap:g=new Map}=n,{state:y}=n,{temporaryState:b}=n;const A=fs("hooks");function w(x){Qt[x?"unshift":"push"](()=>{f.dom=x,t(0,f)})}return e.$$set=x=>{"tag"in x&&t(0,f=x.tag),"mediaStore"in x&&t(1,m=x.mediaStore),"rendererMap"in x&&t(2,p=x.rendererMap),"contentTypeMap"in x&&t(3,g=x.contentTypeMap),"state"in x&&t(4,y=x.state),"temporaryState"in x&&t(5,b=x.temporaryState)},e.$$.update=()=>{var x,M,P,S;e.$$.dirty&5&&t(8,i=(()=>{var T,z,D;return!(((z=(T=f.style)==null?void 0:T.point)==null?void 0:z.enabled)===!1||((D=p.get(f.contentType))==null?void 0:D.usePoint)===!1||f.contentType==="Sticker"||f.contentType==="Link"||f.contentType==="VRLink"||f.contentType==="PanoLink"||f.contentType==="Panorama"||f.contentType==="Audio"&&f.data.appearance==="plane")})()),e.$$.dirty&257&&t(15,r=(()=>!(f.stickType!=="2DPoint"||f.entryFromModel&&_i(f.five.state.mode)&&i))()),e.$$.dirty&1&&t(14,s=f.id),e.$$.dirty&1&&t(7,o=f.screenPosition),e.$$.dirty&1&&t(13,a=f.enabled===!1||!f.state),e.$$.dirty&129&&t(12,l=!((x=f.state)!=null&&x.visible)||((M=f.temporaryState)==null?void 0:M.visible)===!1||!o),e.$$.dirty&1&&t(6,c=(P=f.state)==null?void 0:P.unfolded),e.$$.dirty&128&&t(11,h=(o==null?void 0:o.leftPx)+"px"),e.$$.dirty&128&&t(10,u=(o==null?void 0:o.topPx)+"px"),e.$$.dirty&65&&t(9,d=c?((S=f.zIndex)!=null?S:0)+(c?1e6:0):void 0)},[f,m,p,g,y,b,c,o,i,d,u,h,l,a,s,r,A,w]}class XF extends ke{constructor(n){super(),Le(this,n,YF,QF,De,{tag:0,mediaStore:1,rendererMap:2,contentTypeMap:3,state:4,temporaryState:5},GF)}}function ZF(e){Ue(e,"svelte-1owzhnq",".tag--container.svelte-1owzhnq{box-sizing:border-box;position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;opacity:1;-webkit-user-select:none;-moz-user-select:none;user-select:none;transform:translate3d(0, 0, 0);transition:opacity 0.2s linear}.tag--container.hide.svelte-1owzhnq{opacity:0;pointer-events:none}.tag--container.hide.svelte-1owzhnq *{pointer-events:none !important}")}function l1(e,n,t){const i=e.slice();return i[8]=n[t],i}function c1(e){let n,t=[],i=new Map,r,s,o=e[0];const a=l=>l[8].id;for(let l=0;l<o.length;l+=1){let c=l1(e,o,l),h=a(c);i.set(h,t[l]=h1(h,c))}return{c(){var l;n=H("div");for(let c=0;c<t.length;c+=1)t[c].c();_(n,"class","tag--container svelte-1owzhnq"),Ce(n,"hide",!e[4].visible||!e[5].visible),W(n,"z-index",(l=e[6])!=null?l:"")},m(l,c){Z(l,n,c);for(let h=0;h<t.length;h+=1)t[h]&&t[h].m(n,null);s=!0},p(l,c){var h;c&63&&(o=l[0],Ve(),t=zi(t,c,a,1,l,o,i,n,bs,h1,null,l1),Ge()),(!s||c&48)&&Ce(n,"hide",!l[4].visible||!l[5].visible),c&64&&W(n,"z-index",(h=l[6])!=null?h:"")},i(l){if(!s){for(let c=0;c<o.length;c+=1)F(t[c]);r||an(()=>{r=ys(n,_n,{}),r.start()}),s=!0}},o(l){for(let c=0;c<t.length;c+=1)X(t[c]);s=!1},d(l){l&&Y(n);for(let c=0;c<t.length;c+=1)t[c].d()}}}function h1(e,n){let t,i,r;return i=new XF({props:{state:n[4],temporaryState:n[5],tag:n[8],mediaStore:n[1],rendererMap:n[2],contentTypeMap:n[3]}}),{key:e,first:null,c(){t=ft(),Ie(i.$$.fragment),this.first=t},m(s,o){Z(s,t,o),_e(i,s,o),r=!0},p(s,o){n=s;const a={};o&16&&(a.state=n[4]),o&32&&(a.temporaryState=n[5]),o&1&&(a.tag=n[8]),o&2&&(a.mediaStore=n[1]),o&4&&(a.rendererMap=n[2]),o&8&&(a.contentTypeMap=n[3]),i.$set(a)},i(s){r||(F(i.$$.fragment,s),r=!0)},o(s){X(i.$$.fragment,s),r=!1},d(s){s&&Y(t),Se(i,s)}}}function JF(e){let n,t,i=e[4].enabled&&c1(e);return{c(){i&&i.c(),n=ft()},m(r,s){i&&i.m(r,s),Z(r,n,s),t=!0},p(r,[s]){r[4].enabled?i?(i.p(r,s),s&16&&F(i,1)):(i=c1(r),i.c(),F(i,1),i.m(n.parentNode,n)):i&&(Ve(),X(i,1,1,()=>{i=null}),Ge())},i(r){t||(F(i),t=!0)},o(r){X(i),t=!1},d(r){i&&i.d(r),r&&Y(n)}}}function qF(e,n,t){let{tags:i=[]}=n,{hooks:r}=n,{mediaStore:s}=n,{rendererMap:o}=n,{contentTypeMap:a}=n,{state:l}=n,{temporaryState:c}=n,{zIndex:h=void 0}=n;return Em("hooks",r),e.$$set=u=>{"tags"in u&&t(0,i=u.tags),"hooks"in u&&t(7,r=u.hooks),"mediaStore"in u&&t(1,s=u.mediaStore),"rendererMap"in u&&t(2,o=u.rendererMap),"contentTypeMap"in u&&t(3,a=u.contentTypeMap),"state"in u&&t(4,l=u.state),"temporaryState"in u&&t(5,c=u.temporaryState),"zIndex"in u&&t(6,h=u.zIndex)},[i,s,o,a,l,c,h,r]}class KF extends ke{constructor(n){super(),Le(this,n,qF,JF,De,{tags:0,hooks:7,mediaStore:1,rendererMap:2,contentTypeMap:3,state:4,temporaryState:5,zIndex:6},ZF)}}const BM="Dnalogel-PanoTagPlugin",$F=e=>`${BM}--${e}`;class fd extends TF{constructor(t,i){super(t);v(this,"state",{enabled:!0,visible:!0});v(this,"debug");v(this,"debugUtil",new DF(this));v(this,"changeTagModel",(t,i)=>ee(this,null,function*(){var r;t.data=jt({},t.data,i),yield(r=t.loadModel)==null?void 0:r.call(t)}));v(this,"handleFiveModeChange",t=>{const i=()=>{this.tags.forEach(r=>{r.state.visible=!1,r.applyVisible(),this.five.ready().then(()=>{r.updateVisible(),$i(r)&&t!=="Panorama"&&this.changeTagMode(r,"behind")})})};this.tags.length<500?i():this.five.ready().then(()=>i())});v(this,"handleFiveWantsMoveToPano",t=>{if(this.tags.length>500){this.temporaryState.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]});return}else this.tags.forEach(i=>{i.getVisible({panoIndex:t})&&(i.state.visible=!0);const s=i.getConfig();typeof s.visibleConfig=="object"&&i.temporaryState&&(s.visibleConfig.keep?i.temporaryState.visible=s.visibleConfig.keep==="visible":i.temporaryState.visible=!!s.visibleConfig.alwaysShowWhenMovePano)}),this.addRenderQueue({type:"TagContainerSvelte",keys:["tags"]}),this.tags.forEach(i=>i.applyVisible())});v(this,"clickhandler",t=>{t.tag.onClick(t)});v(this,"handleFiveCameraUpdate",()=>{this.filterPointTag.forEach(t=>t.updateScreenPosition())});v(this,"handleFiveCameraFovUpdate",()=>{this.handleFiveCameraUpdate(),this.five.off("render.prepare",this.handleFiveCameraUpdate),this.five.on("render.prepare",this.handleFiveCameraUpdate),setTimeout(()=>{this.five.off("render.prepare",this.handleFiveCameraUpdate)},1e3)});v(this,"handleFivePanoArrived",()=>ee(this,null,function*(){this.tags.forEach(t=>{t.state.visible=!1,t.temporaryState=Ee(R({},t.temporaryState),{visible:!0}),t.applyVisible(),t.updateVisible()}),this.temporaryState.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]}),yield this.setUnfolded(),this.updateRender3DDomTag(),this.tags.filter(SO).filter(t=>{var i;return(i=t.getConfig().modelConfig)==null?void 0:i.autoLookAtEnabled}).forEach(t=>{var c;const i=new C.Mesh(new C.BoxGeometry,new C.MeshBasicMaterial),r=(c=t.model)==null?void 0:c.object;if(!r)return;i.position.copy(r.position),i.quaternion.copy(r.quaternion);const s=this.five.camera.position;i.lookAt(s.clone().setY(i.position.y));const o=r.quaternion.clone(),a=i.quaternion.clone(),l=Mc();l.onUpdate(({progress:h})=>{r.quaternion.copy(o.clone().slerp(a,h))}),l.play()})}));v(this,"handleFiveModelShownFloorChange",()=>{this.tags.forEach(t=>t.updateVisible())});v(this,"onFiveEveryReady",()=>{this.setUnfoldedByCamera(),_i(this.five.getCurrentState().mode)&&this.tags.forEach(t=>t.updateVisible())});v(this,"render",()=>{this.renderQueue.forEach((t,i)=>{const{keys:r}=t;if(i==="TagContainerSvelte"){const o=this.filterPointTag.filter(l=>l.screenPosition),a={hooks:this.hooks,tags:o,state:this.state,temporaryState:this.temporaryState,mediaStore:this.mediaStore,rendererMap:this.rendererMap,contentTypeMap:this.contentTypeMap,zIndex:this.params.containerZIndex};if(this.TagContainerSvelte){let l={};if(r.length===0)l=a;else for(const c of r)l[c]=a[c];this.TagContainerSvelte.$set(l)}else{if(!this.container)return console.error("updateRenderPlaneTag: tag2DContainer not found");this.TagContainerSvelte=new KF({target:this.container,props:Ee(R({},a),{state:Ee(R({},this.state),{enabled:!1})})}),zc(()=>{var l;(l=this.TagContainerSvelte)==null||l.$set({state:this.state})})}}}),this.renderQueue.clear()});this.params=jt({},{debug:!1,config:this.config},R({},i)),this.debug=this.params.debug,this.config=this.params.config,this.debug&&this.debugUtil.bindLog(),OO(1,{namespace:Ng.PlayAudio});try{Array.isArray(window.__PANOTAGPLUGIN_DEBUG_LIST__)||(window.__PANOTAGPLUGIN_DEBUG_LIST__=[]),window.__PANOTAGPLUGIN_DEBUG_LIST__.push(this),window.__PANOTAGPLUGIN_DEBUG__||Object.defineProperty(window,"__PANOTAGPLUGIN_DEBUG__",{get:function(){return window.__PANOTAGPLUGIN_DEBUG_LIST__.sort((r,s)=>s.tags.length-r.tags.length)[0]}})}catch(r){}}appendTo(t){var r,s,o,a;this.debugUtil.addLog("appendTo"),this.container=t,(r=this.css3DRenderPlugin)==null||r.appendToFrontFiveContainer(this.container);const i=(o=(s=this.TagContainerSvelte)==null?void 0:s.$$)==null?void 0:o.root;i&&i!==this.container&&((a=this.TagContainerSvelte)==null||a.$destroy(),this.TagContainerSvelte=void 0)}load(t){return ee(this,null,function*(){var r,s;this.clearTags();try{console.debug(BM," load:",{data:JSON.parse(JSON.stringify(t))})}catch(o){}this.config=jt({},this.config,{globalConfig:(r=t.globalConfig)!=null?r:{},contentTypeConfig:(s=t.contentTypeConfig)!=null?s:{}});const i=yield this.addTag(t.tagList);return this.hooks.emit("loaded"),i})}addTag(t){return ee(this,null,function*(){const r=(Array.isArray(t)?t:[t]).filter(s=>s.position).map(s=>{const o=Bg(s);if(o==="2DPoint"||o==="3DPoint")return new kF(this,s);if(o==="Model")return new OM(this,s);if(o==="Plane")return new zF(this,s)});return r.forEach(kO),this.tags.push(...r),this.tagsLengthWillUpdate=!0,Ha(this.five).then(()=>ee(this,null,function*(){var s,o;this.store.eventListenerDisposer&&((o=(s=this.store).eventListenerDisposer)==null||o.call(s)),this.state.enabled&&this.handleEnable(),this.addResizeListener(),this.clearUnusedPanelTag(),this.addMediaModelTag(r),r.forEach(a=>{a.updateVisible(),a.updateZIndex()}),this.setUnfolded(),this.addRenderQueue({type:"TagContainerSvelte"}),this.hooks.emit("tagsLengthChange")}))})}changeConfig(t,i=!0){i?this.config=jt({},this.config,t):this.config=t,this.tags.forEach(r=>{r.updateConfig(),r.updateVisible()})}changeGlobalConfig(t,i=!0){i?this.config.globalConfig=jt({},this.config.globalConfig,t):this.config.globalConfig=t,this.tags.forEach(r=>{r.updateConfig(),r.updateVisible()})}changeContentTypeConfig(t,i,r=!0){this.config.contentTypeConfig||(this.config.contentTypeConfig={}),r?this.config.contentTypeConfig[t]=jt({},this.config.contentTypeConfig[t],i):this.config.contentTypeConfig[t]=i,this.tags.forEach(s=>{s.updateConfig(),s.updateVisible()})}show(t){return ee(this,null,function*(){if(this.checkDisposed())return;const{userAction:i=!0}=t!=null?t:{};this.setState({visible:!0},{userAction:i}),this.hooks.emit("show",{userAction:i})})}hide(t){return ee(this,null,function*(){if(this.checkDisposed())return;const{userAction:i=!0}=t!=null?t:{};this.setState({visible:!1},{userAction:i}),this.hooks.emit("hide",{userAction:i})})}enable(t){if(this.checkDisposed())return;const{userAction:i=!0}=t!=null?t:{};this.setState({enabled:!0},{userAction:i}),this.hooks.emit("enable",{userAction:i})}disable(t){if(this.checkDisposed())return;const{userAction:i=!0}=t!=null?t:{};this.setState({enabled:!1},{userAction:i}),this.hooks.emit("disable",{userAction:i})}setState(t,i){if(this.checkDisposed())return;const{userAction:r=!0}=i!=null?i:{},s=R({},this.state);this.state=Object.assign(this.state,t),s.visible!==this.state.visible&&(t.visible?this.handleShow():this.handleHide()),s.enabled!==this.state.enabled&&(t.enabled?this.handleEnable():this.handleDisable()),this.hooks.emit("stateChange",{state:this.state,prevState:s,userAction:r})}dispose(){var t,i,r,s,o,a;this.pauseCurrentMedia(),this.disposeAllCSS3DContainer(),(t=this.TagContainerSvelte)==null||t.$destroy(),this.filterCSS3DTag.forEach(l=>{var c;return(c=l.tag3DContentSvelte)==null?void 0:c.svelteApp.$destroy()}),this.tags.forEach(l=>l.cache.clear()),this.tags=[],this.tagsLengthWillUpdate=!0,this.hooks.emit("tagsLengthChange"),(i=this.store.disposers)==null||i.forEach(l=>l==null?void 0:l()),this.store.disposers=[],(s=(r=this.store).eventListenerDisposer)==null||s.call(r),this.store.eventListenerDisposer=void 0,(a=(o=this.store).resizeObserverDisposer)==null||a.call(o),this.store.resizeObserverDisposer=void 0,this.store.resizeObserverDisposerAdding=!1,this.five.scene.remove(this.group),this.group.remove(...this.group.children),this.gltfObjectGroup.remove(...this.gltfObjectGroup.children),this.imagePlaneGroup.remove(...this.imagePlaneGroup.children),this.five.needsRender=!0,this.store.disposed=!0,this.hooks.emit("dispose")}blinkTagById(t,i){return ee(this,null,function*(){var r;return(r=this.getTagById(t))==null?void 0:r.blink(i)})}changeUnfoldedById(t,i){const r=this.getTagById(t);i?r==null||r.unfold():r==null||r.fold()}changeEnabledById(t,i){var s;const r=this.getTagById(t);r&&(r.enabled=i,(s=r.hooks)==null||s.emit(i?"enable":"disable"))}changeTagNormalById(t,i){const r=this.getTagById(t);r&&r.tag3DContentSvelte&&(r.tag3DContentSvelte.currentNormal=os(i))}changePositionById(t,i){const r=this.getTagById(t);r&&r.setPosition(i)}changeDataById(t,i,r=!0){const s=this.getTagById(t);s&&(s.setData(i,r),this.clearUnusedPanelTag(),s.hooks.emit("dataChanged",s.data))}changeStickTypeById(t,i,r=!0){this.changeTagById(t,i,r)}changeTagById(t,i,r=!0){const s=this.getTagById(t);s&&(s.set(i),s.updateVisible(),this.clearUnusedPanelTag(),s.hooks.emit("dataChanged",s.data))}destroyTagById(t){(Array.isArray(t)?t:[t]).forEach(r=>{var s;return(s=this.getTagById(r))==null?void 0:s.destroy()})}updateRenderAllTags(){this.tags.forEach(t=>t.updateVisible()),this.five.needsRender=!0}setUnfolded(){return ee(this,null,function*(){return new Promise(t=>{setTimeout(()=>{this.setUnfoldedByCamera(),t()},100)})})}handleShow(){this.state.visible=!0,this.group.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["state"]}),this.five.needsRender=!0}handleHide(){this.pauseCurrentMedia(),this.state.visible=!1,this.group.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["state"]}),this.five.needsRender=!0}handleEnable(){this.state.enabled=!0,this.store.eventListenerDisposer=this.addEventListener(),this.five.scene.children.includes(this.group)||this.five.scene.add(this.group),this.group.traverse(t=>{var i;(i=t==null?void 0:t.updateTagCss3DObjectMatrix)==null||i.call(t)}),this.updateRender3DDomTag(),this.five.needsRender=!0}handleDisable(){var t,i,r;this.pauseCurrentMedia(),this.state.enabled=!1,(i=(t=this.store).eventListenerDisposer)==null||i.call(t),this.five.scene.remove(this.group),(r=this.TagContainerSvelte)==null||r.$set({tags:[]}),this.filterCSS3DTag.forEach(s=>{var o;(o=s.tag3DContentSvelte)==null||o.dispose(),s.tag3DContentSvelte=void 0}),this.five.needsRender=!0}addResizeListener(){if(!this.store.resizeObserverDisposer&&!this.store.resizeObserverDisposerAdding){const t=this.addResizeObserver();this.store.resizeObserverDisposerAdding=!0,setTimeout(()=>{this.store.resizeObserverDisposer=t,this.store.resizeObserverDisposerAdding=!1},200)}}addResizeObserver(){if(this.store.disposed)return;const t=this.five.getElement(),i=()=>{this.state.enabled&&(this.filterPointTag.forEach(c=>c.updateScreenPosition({force:!0})),this.temporaryState.visible=!0,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]}))},r=()=>{this.state.enabled&&(this.temporaryState.visible=!1,this.addRenderQueue({type:"TagContainerSvelte",keys:["temporaryState"]}))},{observe:s,unobserve:o}=Bm(Ub(()=>{this.store.resizeObserverDisposer&&r()},500),t),{observe:a,unobserve:l}=Bm(DO(()=>i(),400),t);return s(),a(),()=>{o(),l()}}setUnfoldedByCamera(){let t=!1;this.filterPointTag.forEach(i=>{const r=i.getUnfoldedByCamera();if(i.state&&r!==void 0){if(r===!0&&i.screenPosition){const s=i.getConfig().unfoldedConfig;io(s).keep!=="unfolded"&&(t=!0)}i.state.unfolded=r}}),t&&this.filterPointTag.forEach(i=>{const r=i.getConfig().unfoldedConfig;typeof r=="object"&&(r.autoUnfold||r.autoUnfold===!1||io(r.autoUnfold).enable===!1||r.keep)||i.state&&(i.state.unfolded=!1)})}changeTagMode(t,i){var r,s,o,a,l,c;((r=t.config)==null?void 0:r.renderType)!=="Mesh"&&((a=(o=(s=t.tag3DContentSvelte)==null?void 0:s.css3DInstance)==null?void 0:o.css3DObject)==null?void 0:a.mode)!==i&&((l=t.config)!=null&&l.tag3DConfig?t.config.tag3DConfig.mode=i:t.config?t.config.tag3DConfig={mode:i}:t.config={tag3DConfig:{mode:i}},(c=this.store.css3DRenderDisposer.get(t.id))==null||c.forEach(h=>h==null?void 0:h()),t.tag3DContentSvelte=void 0)}addEventListener(){const{five:t,hooks:i}=this;let r=!1;const s=Ub(()=>{r||(r=!0,t.ready().then(()=>{this.onFiveEveryReady(),r=!1}))},150);return t.on("cameraUpdate",s),this.handleFivePanoArrived(),t.on("wantsMoveToPano",this.handleFiveWantsMoveToPano),t.on("models.refined",this.onFiveEveryReady),t.on("modeChange",this.handleFiveModeChange),t.on("modelShownFloorChange",this.handleFiveModelShownFloorChange),t.on("cameraUpdate",this.handleFiveCameraUpdate),t.on("cameraFovUpdate",this.handleFiveCameraFovUpdate),t.on("panoArrived",this.handleFivePanoArrived),t.on("panoArrived",this.loadVideoFirstFrame),t.on("render.prepare",this.render),i.on("click",this.clickhandler),()=>{t.off("wantsMoveToPano",this.handleFiveWantsMoveToPano),t.off("models.refined",this.onFiveEveryReady),t.off("modeChange",this.handleFiveModeChange),t.off("modelShownFloorChange",this.handleFiveModelShownFloorChange),t.off("cameraUpdate",this.handleFiveCameraUpdate),t.off("cameraFovUpdate",this.handleFiveCameraFovUpdate),t.off("cameraUpdate",s),t.off("panoArrived",this.handleFivePanoArrived),t.off("panoArrived",this.loadVideoFirstFrame),t.off("render.prepare",this.render),i.off("click",this.clickhandler),this.store.eventListenerDisposer=void 0}}}const eV=(e,n)=>new fd(e,n);function tV(e){Ue(e,"svelte-4qjwer",".guide-line__tag.svelte-4qjwer.svelte-4qjwer{position:relative}.text-with-distance.svelte-4qjwer.svelte-4qjwer{display:flex;flex-direction:column;position:relative;padding:0.125rem 0.25rem;border-radius:0.125rem;background:linear-gradient(to top, rgba(147, 147, 147, 0.3), rgba(74, 74, 74, 0.3));box-shadow:0 0.125rem 0.5rem 0 rgba(0, 0, 0, 0.2)}.text-with-distance.svelte-4qjwer .border.svelte-4qjwer{position:absolute;top:-50%;right:-50%;bottom:-50%;left:-50%;padding:0.0625rem;border-radius:0.25rem;background:linear-gradient(to right, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.2));-webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);mask-composite:exclude;-webkit-mask-composite:xor;transform:scale(0.5)}.distance-and-name.svelte-4qjwer.svelte-4qjwer{display:flex;gap:0.1875rem}.distance.svelte-4qjwer.svelte-4qjwer{white-space:nowrap;font-size:0.625rem;line-height:0.875rem;color:#66afff}.name.svelte-4qjwer.svelte-4qjwer{opacity:0.6;font-size:0.625rem;line-height:0.875rem;white-space:nowrap;color:#ffffff}.line-name.svelte-4qjwer.svelte-4qjwer{color:#fff;white-space:nowrap;font-size:0.625rem;line-height:0.875rem}.guide-line__tag-point.svelte-4qjwer.svelte-4qjwer{position:absolute;left:50%;bottom:0.0625rem;width:0.4375rem;height:0.125rem;transform:translateX(-50%);background:#fff;border-radius:50%;opacity:0.5}.guide-line__tag-line.svelte-4qjwer.svelte-4qjwer{position:absolute;left:50%;bottom:0.0625rem;width:0.0625rem;height:1.875rem;transform:translateX(-50%);background:linear-gradient(to top, #fff, rgba(255, 255, 255, 0))}.guide-line__tag-content.svelte-4qjwer.svelte-4qjwer{position:absolute;left:-0.9375rem;bottom:1.9375rem;display:flex}.guide-line__tag-icon.svelte-4qjwer.svelte-4qjwer{width:1.875rem;height:1.875rem;background-size:100%}.guide-line__tag-text.svelte-4qjwer.svelte-4qjwer{box-sizing:content-box;height:0.875rem;width:-moz-max-content;width:max-content;margin-top:0.3125rem;transform:translateX(-0.1875rem);white-space:nowrap;font-size:0.625rem;line-height:0.875rem;border:solid transparent;border-width:0.125rem 0.5rem 0.125rem 0.375rem;border-image-slice:6 25 6 18 fill;color:#fff}")}function u1(e){let n,t;return{c(){n=H("div"),t=xt(e[0]),_(n,"class","guide-line__tag-text svelte-4qjwer"),W(n,"border-image-source",`url(${e[6]})`)},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r&1&&Ct(t,i[0])},d(i){i&&Y(n)}}}function d1(e){let n,t,i,r,s=e[5]("全程")+"",o,a,l=e[5]("米")+"",c,h,u,d,f,m,p=e[4]&&f1(e);return{c(){n=H("div"),p&&p.c(),t=ve(),i=H("div"),r=H("span"),o=xt(s),a=xt(e[2]),c=xt(l),h=ve(),u=H("span"),d=xt(e[0]),f=ve(),m=H("div"),_(r,"class","distance svelte-4qjwer"),_(u,"class","name svelte-4qjwer"),_(i,"class","distance-and-name svelte-4qjwer"),_(m,"class","border svelte-4qjwer"),_(n,"class","text-with-distance svelte-4qjwer")},m(g,y){Z(g,n,y),p&&p.m(n,null),Q(n,t),Q(n,i),Q(i,r),Q(r,o),Q(r,a),Q(r,c),Q(i,h),Q(i,u),Q(u,d),Q(n,f),Q(n,m)},p(g,y){g[4]?p?p.p(g,y):(p=f1(g),p.c(),p.m(n,t)):p&&(p.d(1),p=null),y&32&&s!==(s=g[5]("全程")+"")&&Ct(o,s),y&4&&Ct(a,g[2]),y&32&&l!==(l=g[5]("米")+"")&&Ct(c,l),y&1&&Ct(d,g[0])},d(g){g&&Y(n),p&&p.d()}}}function f1(e){let n,t;return{c(){n=H("span"),t=xt(e[4]),_(n,"class","line-name svelte-4qjwer")},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r&16&&Ct(t,i[4])},d(i){i&&Y(n)}}}function nV(e){let n,t,i,r,s,o,a,l,c,h=e[0]&&!e[2]&&u1(e),u=e[2]&&d1(e);return{c(){n=H("div"),t=H("div"),i=ve(),r=H("div"),s=ve(),o=H("div"),a=H("div"),l=ve(),h&&h.c(),c=ve(),u&&u.c(),_(t,"class","guide-line__tag-point svelte-4qjwer"),_(r,"class","guide-line__tag-line svelte-4qjwer"),_(a,"class","guide-line__tag-icon svelte-4qjwer"),W(a,"background-image",`url(${e[1]})`),_(o,"class","guide-line__tag-content svelte-4qjwer"),_(n,"class","guide-line__tag svelte-4qjwer"),W(n,"opacity",e[3])},m(d,f){Z(d,n,f),Q(n,t),Q(n,i),Q(n,r),Q(n,s),Q(n,o),Q(o,a),Q(o,l),h&&h.m(o,null),Q(o,c),u&&u.m(o,null)},p(d,[f]){f&2&&W(a,"background-image",`url(${d[1]})`),d[0]&&!d[2]?h?h.p(d,f):(h=u1(d),h.c(),h.m(o,c)):h&&(h.d(1),h=null),d[2]?u?u.p(d,f):(u=d1(d),u.c(),u.m(o,null)):u&&(u.d(1),u=null),f&8&&W(n,"opacity",d[3])},i:de,o:de,d(d){d&&Y(n),h&&h.d(),u&&u.d()}}}function iV(e,n,t){let{text:i=""}=n,{icon_url:r=""}=n,{distance:s=0}=n,{opacity:o=1}=n,{name:a=""}=n,{i18n:l=h=>h}=n;const c="data:image/png;base64,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";return e.$$set=h=>{"text"in h&&t(0,i=h.text),"icon_url"in h&&t(1,r=h.icon_url),"distance"in h&&t(2,s=h.distance),"opacity"in h&&t(3,o=h.opacity),"name"in h&&t(4,a=h.name),"i18n"in h&&t(5,l=h.i18n)},[i,r,s,o,a,l,c]}class rV extends ke{constructor(n){super(),Le(this,n,iV,nV,De,{text:0,icon_url:1,distance:2,opacity:3,name:4,i18n:5},tV)}}function sV(e){return e.length===0?[]:e.filter((n,t)=>n!==e[t-1])}const oV=`
3564
3564
  varying vec2 vUv;
3565
3565
  varying float ignoreAnimationMap;
3566
3566
  attribute float animationWillError;
@@ -3570,7 +3570,7 @@ void main() {
3570
3570
  ignoreAnimationMap = animationWillError;
3571
3571
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
3572
3572
  }
3573
- `,cV=`
3573
+ `,aV=`
3574
3574
  // 是否使用颜色
3575
3575
  uniform int useMapColor;
3576
3576
  // 贴图
@@ -3701,14 +3701,14 @@ void main() {
3701
3701
  gl_FragColor.a = gl_FragColor.a * distanceOpacity();
3702
3702
  gl_FragColor.a = gl_FragColor.a * flicker;
3703
3703
  }
3704
- `;class Vm{constructor(n,t){v(this,"name","");v(this,"startTagContainer");v(this,"endTagContainer");v(this,"path",[]);v(this,"geometryStyle",{});v(this,"materialStyle",{});v(this,"meshStyle",{});v(this,"group",new C.Group);v(this,"meshWithDepthTest");v(this,"meshWithoutDepthTest");v(this,"five");v(this,"mode");v(this,"_curvePath",null);v(this,"_curvePoints",null);v(this,"_panoGroup",[]);v(this,"skippedPositions",null);v(this,"textureUrl","");v(this,"scale",1);v(this,"width",.5);v(this,"unitLength",.5);v(this,"_visibleFloorIndexes",null);v(this,"visible",null);v(this,"modeVisible",!1);v(this,"floorVisible",!0);v(this,"defaultVisible",!1);v(this,"inWalkAnimation",!1);v(this,"customVisible",null);v(this,"parent");v(this,"plugin");v(this,"textureHasLoaded",!1);v(this,"disposed",!1);v(this,"flowAnime",new Pa({progress:0}).to({progress:1}).duration(1500).repeat(1/0));v(this,"cacheLengths",[]);v(this,"heightOffset",0);v(this,"panoMap",{});v(this,"autoDepthTestEffectDistance");v(this,"dispose",()=>{var n,t;this.disposed||(this.disposed=!0,this.parent.hooks.off("show",this.updateVisible),this.parent.hooks.off("hide",this.updateVisible),this.plugin.hooks.off("show",this.updateVisible),this.plugin.hooks.off("hide",this.updateVisible),this.plugin.hooks.off("enable",this.updateVisible),this.plugin.hooks.off("disable",this.updateVisible),this.five.off("modeChange",this.onFiveModeChange),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("modelShownFloorChange",this.onFiveModelShownFloorChange),this.doHide(),(n=this.startTagContainer)==null||n.plugin.dispose(),(t=this.endTagContainer)==null||t.plugin.dispose())});v(this,"onWalkAnimationStart",()=>{this.inWalkAnimation=!0,this.updateVisible()});v(this,"onWalkAnimationEnd",()=>{this.inWalkAnimation=!1,this.updateVisible()});v(this,"onFiveModeChange",n=>{this.modeVisible=this.mode==="panorama"?Fs(n):_i(n),this.updateVisible()});v(this,"onFivePanoArrived",n=>{var r,s,o,a,l,c;const t=(o=(s=(r=this.path)==null?void 0:r[0])==null?void 0:s.panoIndexMap)==null?void 0:o[n],i=this.panoMap[t!=null?t:n];if(i===void 0)this.group.children.includes(this.meshWithoutDepthTest)&&this.group.remove(this.meshWithoutDepthTest),this.meshWithDepthTest.material.uniforms.excludeMinV.value=-1,this.meshWithDepthTest.material.uniforms.excludeMaxV.value=-1;else{this.group.children.includes(this.meshWithoutDepthTest)||this.group.add(this.meshWithoutDepthTest),this.meshWithoutDepthTest.visible=!0;const h=this.meshWithDepthTest.geometry.getAttribute("uv"),u=100*((a=this.autoDepthTestEffectDistance)!=null?a:2),d=(l=h.getY((i-u)*2))!=null?l:0,f=(c=h.getY((i+u)*2))!=null?c:h.getY(h.count-1);this.meshWithDepthTest.material.uniforms.excludeMinV.value=d,this.meshWithDepthTest.material.uniforms.excludeMaxV.value=f,this.meshWithoutDepthTest.material.uniforms.includeMinV.value=d,this.meshWithoutDepthTest.material.uniforms.includeMaxV.value=f}this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0});v(this,"onFiveModelShownFloorChange",n=>{this.floorVisible=n===null||this.visibleFloorIndexes===null||this.visibleFloorIndexes.includes(n),this.updateVisible()});v(this,"updateVisible",()=>{const n=(()=>!this.parent.visible||!this.plugin.state.enabled||!this.plugin.state.visible?!1:this.customVisible!==null?this.customVisible:this.inWalkAnimation?!0:this.modeVisible&&this.textureHasLoaded&&this.defaultVisible&&this.floorVisible)();this.visible!==n&&(this.visible=n,n?this.doShow():this.doHide())});v(this,"onFlowAnimeUpdate",n=>{const{progress:t}=n;this.meshWithDepthTest.material.uniforms.vOffset.value=t,this.meshWithoutDepthTest.material.uniforms.vOffset.value=t,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0});v(this,"logError",n=>iM("GuideLineModeItem: ",n));var s,o;this.five=n,this.mode=t.mode,this.plugin=t.plugin,this.parent=t.parent,this.group.name="GuideLineModeItem";const i=new C.BufferGeometry,r=new C.ShaderMaterial({vertexShader:lV,fragmentShader:cV,transparent:!0,uniforms:{map:{value:null},useMapColor:{value:0},mapColor:{value:new C.Color},mapOpacity:{value:1},backgroundColor:{value:new C.Color},backgroundOpacity:{value:0},borderColor:{value:new C.Color},borderOpacity:{value:0},backgroundClip:{value:0},borderWidth:{value:.05},opacity:{value:1},flicker:{value:1},maxV:{value:0},vOffset:{value:0},includeMinV:{value:-1},includeMaxV:{value:-1},excludeMinV:{value:-1},excludeMaxV:{value:-1}}});this.meshWithDepthTest=new C.Mesh(i,r),this.meshWithoutDepthTest=new C.Mesh(i,r.clone()),this.meshWithoutDepthTest.material.depthTest=!1,this.meshWithDepthTest.name="GuideLineModeItemWithDepthTest",this.meshWithoutDepthTest.name="GuideLineModeItemWithoutDepthTest",this.group.add(this.meshWithDepthTest),this.mode==="panorama"&&(this.parent.hooks.on("walkStart",this.onWalkAnimationStart),this.parent.hooks.on("walkEnded",this.onWalkAnimationEnd),this.onFivePanoArrived(this.five.getCurrentState().panoIndex)),this.updateVisible(),this.onFiveModeChange(this.five.getCurrentState().mode),this.onFiveModelShownFloorChange((o=(s=this.five.model)==null?void 0:s.shownFloor)!=null?o:null),this.flowAnime.onUpdate(this.onFlowAnimeUpdate),this.parent.hooks.on("show",this.updateVisible),this.parent.hooks.on("hide",this.updateVisible),this.plugin.hooks.on("show",this.updateVisible),this.plugin.hooks.on("hide",this.updateVisible),this.plugin.hooks.on("enable",this.updateVisible),this.plugin.hooks.on("disable",this.updateVisible),this.plugin.hooks.on("dispose",this.dispose),this.five.on("modeChange",this.onFiveModeChange),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("modelShownFloorChange",this.onFiveModelShownFloorChange),this.five.needsRender=!0}get panoGroup(){return this._panoGroup}get visibleFloorIndexes(){return this._visibleFloorIndexes}get curvePath(){return this._curvePath}get curvePoints(){return this._curvePoints}setCustomVisible(n){if(this.disposed)return this.logError("disposed");this.customVisible!==n&&(this.customVisible=n,this.updateVisible())}setDefaultVisible(n){if(this.disposed)return this.logError("disposed");this.defaultVisible!==n&&(this.defaultVisible=n,this.updateVisible())}setUnitSize(n,t){if(this.disposed)return this.logError("disposed");this.width=n,this.unitLength=t,this.setGeometryByPath(this.path,{width:n,unit_length:t})}setScale(n){if(this.disposed)return this.logError("disposed");this.scale=n,this.setGeometryByPath(this.path,{scale:n})}setGeometryByPanoGroup(n,t){if(this.disposed)return this.logError("disposed");if(!this.five.work)return this.logError("setPathByPanoGroup: work is not ready");const i=aV(n);if(this._panoGroup=i,(t==null?void 0:t.skipPanoGroup)!==void 0){const s=t.skipPanoGroup?i.map(o=>this.plugin.workUtil.getObserverStandingPosition(o)).filter(At):null;this.skippedPositions=s}const r=this.getPathFromPanoGroup(i,this.five.work,t);this.path=r,this.setGeometryByPath(r,t)}setGeometryByPath(n,t){var d,f,m,p;if(this.disposed)return this.logError("disposed");const i=(d=t==null?void 0:t.scale)!=null?d:this.scale,r=(f=t==null?void 0:t.width)!=null?f:this.width,s=(m=t==null?void 0:t.unit_length)!=null?m:this.unitLength;this.scale=i,this.width=r,this.unitLength=s;const{geometry:o,maxV:a,curvePath:l,curvePoints:c,panoMap:h,totalLength:u}=xO({path:n,width:r*i,unitLength:s*i,skipPositions:this.skippedPositions,useAutoDepthTest:t.useAutoDepthTest});this.autoDepthTestEffectDistance=(p=t.autoDepthTestEffectDistance)!=null?p:(()=>{const g=u/10;return g>3?3:g<1?1:g})(),this.panoMap=h,this._curvePath=l,this._curvePoints=c,this.meshWithDepthTest.geometry.copy(o),this.onFivePanoArrived(this.five.getCurrentState().panoIndex),this.meshWithDepthTest.material.needsUpdate=!0,this.meshWithDepthTest.material.uniforms.maxV.value=a,this.meshWithoutDepthTest.material.needsUpdate=!0,this.meshWithoutDepthTest.material.uniforms.maxV.value=a,this.five.needsRender=!0,this.path=n,this.geometryStyle=R(R({},this.geometryStyle),t)}setMartial(n){var i,r,s,o,a;if(this.disposed)return this.logError("disposed");this.setDefaultVisible((i=n==null?void 0:n.visible)!=null?i:!1),this.setColor((r=n==null?void 0:n.color)!=null?r:"#ffffff"),this.setOpacity((s=n==null?void 0:n.opacity)!=null?s:.5),this.setTextureUrl((a=(o=n==null?void 0:n.texture)==null?void 0:o.url)!=null?a:"https://vr-image-4.realsee-cdn.cn/release/web/arrow1.ebe7d0ff.png"),(n==null?void 0:n.background_color)!==void 0&&this.setBackgroundColor(n.background_color),(n==null?void 0:n.background_opacity)!==void 0&&this.setBackgroundOpacity(n.background_opacity),(n==null?void 0:n.border_color)!==void 0&&this.setBorderColor(n.border_color),(n==null?void 0:n.border_opacity)!==void 0&&this.setBorderOpacity(n.border_opacity),(n==null?void 0:n.border_width)!==void 0&&this.setBorderWidth(n.border_width),(n==null?void 0:n.background_clip)!==void 0&&this.setBackgroundClip(n.background_clip);const t=R(R({},this.materialStyle),n);this.materialStyle=t}setMeshStyle(n){if(n!=null&&n.translate){const r=new C.Vector3,s=new C.Vector3().fromArray(n.translate);s.y+=this.heightOffset,r.add(s),this.group.position.copy(r),i(this.startTagContainer,s),i(this.endTagContainer,s)}const t=R(R({},this.meshStyle),n);this.meshStyle=t;function i(r,s){if(!(r!=null&&r.tag))return;const o=new C.Vector3().fromArray(r.tag.position);o.add(s);const a=o.toArray();r.plugin.changeTagById(r.tag.id,{position:a})}}setHeightOffset(n){const t=new C.Vector3;this.meshStyle.translate&&t.add(new C.Vector3().fromArray(this.meshStyle.translate)),t.setY(t.y+n),this.group.position.copy(t),this.heightOffset=n,this.five.needsRender=!0}setColor(n){if(this.disposed)return this.logError("disposed");n&&(this.meshWithDepthTest.material.uniforms.mapColor.value=new C.Color().set(n),this.meshWithoutDepthTest.material.uniforms.mapColor.value=new C.Color().set(n)),this.meshWithDepthTest.material.uniforms.useMapColor.value=n?1:0,this.meshWithoutDepthTest.material.uniforms.useMapColor.value=n?1:0,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderColor(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.borderColor.value=new C.Color().set(n),this.meshWithoutDepthTest.material.uniforms.borderColor.value=new C.Color().set(n),this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderOpacity(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.borderOpacity.value=n,this.meshWithoutDepthTest.material.uniforms.borderOpacity.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundClip(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.backgroundClip.value=n==="border-box"?0:1,this.meshWithoutDepthTest.material.uniforms.backgroundClip.value=n==="border-box"?0:1,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderWidth(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.borderWidth.value=n,this.meshWithoutDepthTest.material.uniforms.borderWidth.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundColor(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.backgroundColor.value=new C.Color().set(n),this.meshWithoutDepthTest.material.uniforms.backgroundColor.value=new C.Color().set(n),this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundOpacity(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.backgroundOpacity.value=n,this.meshWithoutDepthTest.material.uniforms.backgroundOpacity.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setOpacity(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.opacity.value=n,this.meshWithoutDepthTest.material.uniforms.opacity.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setMapOpacity(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.mapOpacity.value=n,this.meshWithoutDepthTest.material.uniforms.mapOpacity.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setTextureUrl(n){if(this.disposed)return this.logError("disposed");this.textureUrl=n,Us(n).then(t=>{this.disposed||this.textureUrl===n&&(t.wrapT=C.RepeatWrapping,this.textureHasLoaded=!0,this.meshWithDepthTest.material.uniforms.map.value=t,this.meshWithoutDepthTest.material.uniforms.map.value=t,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.meshWithDepthTest.material.needsUpdate=!0,this.meshWithoutDepthTest.material.needsUpdate=!0,this.five.needsRender=!0,this.updateVisible())})}setVisibleFloorIndexes(n){var t,i;if(this.disposed)return this.logError("disposed");this._visibleFloorIndexes=n,this.onFiveModelShownFloorChange((i=(t=this.five.model)==null?void 0:t.shownFloor)!=null?i:null)}setStartTag(n){this.setTag("start",n)}setEndTag(n){this.setTag("end",n)}flicker(){var n,t,i,r,s,o;if(this.disposed)return this.logError("disposed");Td([this.group,(i=(t=(n=this.startTagContainer)==null?void 0:n.plugin)==null?void 0:t.tags[0])==null?void 0:i.dom,(o=(s=(r=this.endTagContainer)==null?void 0:r.plugin)==null?void 0:s.tags[0])==null?void 0:o.dom],{loop:6,updateRender:()=>{this.five.needsRender=!0}})}getLengthByPanoGroupIndex(n){return this.disposed?this.logError("disposed"):this.cacheLengths.length!==0?this.cacheLengths[n]:(this.cacheLengths=this.getPanoGroupLengths(),this.cacheLengths[n])}getPanoGroupLengths(){var l;if(!this.curvePoints||!this.curvePath)return[];const n=this.curvePoints.length,t=this.curvePath.getLength(),i=n-1,r=t/i,s=(l=this.curvePath.getLengths(i))!=null?l:[],o=[];let a=0;for(let c=0;c<n;c++){const h=this.curvePoints[c],u=this.plugin.workUtil.getObserverStandingPosition(a);if(!u)break;u.clone().setY(0).distanceTo(h.clone().setY(0))<r&&(o.push(s[c]),a+=1)}return o}setTag(n,t){var l,c;const i=this.curvePath;if(!(t!=null&&t.data))return;const r=n==="start"?(l=this.startTagContainer)!=null?l:(()=>(this.startTagContainer={tag:null,plugin:new fd(this.five,{containerZIndex:1})},this.startTagContainer))():(c=this.endTagContainer)!=null?c:(()=>(this.endTagContainer={tag:null,plugin:new fd(this.five,{containerZIndex:1})},this.endTagContainer))(),o=jt({},{contentType:"Custom",stickType:"2DPoint",config:{visibleConfig:{visibleFiveMode:["Floorplan","Mapview"],followModelVisibility:!1}},style:{point:{enabled:!1}},data:{}},t);r.tag=o,hV(o)&&(r.tag.element=h=>{var f,m;(f=r.app)==null||f.$destroy();const u=n==="start"?Ee(R({},o.data),{name:this.name,distance:Math.round((m=i.getLength())!=null?m:0),i18n:this.plugin.config.i18n}):o.data,d=new oV({target:h,intro:!0,props:u});return r.app=d,()=>d.$destroy()}),r.plugin.load({tagList:[r.tag]});const a=this.meshStyle.translate;if(a&&o.position){const h=new C.Vector3().fromArray(o.position),u=new C.Vector3().fromArray(a);h.add(u),h.y+=this.heightOffset;const d=h.toArray();r.plugin.changeTagById(r.tag.id,{position:d})}}doShow(){var n,t;this.mode==="model"&&this.flowAnime.play(),this.five.scene.add(this.group),(n=this.startTagContainer)==null||n.plugin.show(),(t=this.endTagContainer)==null||t.plugin.show(),this.five.needsRender=!0}doHide(){var n,t;this.mode==="model"&&this.flowAnime.stop(),this.five.scene.remove(this.group),(n=this.startTagContainer)==null||n.plugin.hide(),(t=this.endTagContainer)==null||t.plugin.hide(),this.five.needsRender=!0}getPathFromPanoGroup(n,t,i){if(n.length<2)return[];const r={},s=n.map((l,c)=>{const h=this.plugin.workUtil.getObserverStandingPosition(l);if(!h)return;const u=n[c-1];if((c===0?999:h.distanceTo(this.plugin.workUtil.getObserverStandingPosition(u)))<.05){let f=u;for(;r[f]!==void 0;)f=r[f];r[l]=f;return}return{position:h,panoIndex:l}}).filter(At),o=s.map(l=>l.position.toArray()),a=s.map(l=>l.panoIndex);return[Ee(R({type:"CatmullRomCurve3",points:o},i),{panoIndexList:a,panoIndexMap:r})]}}function hV(e){return e.contentType==="Custom"}const uV=Object.freeze(Object.defineProperty({__proto__:null,GuideLineModeItem:Vm},Symbol.toStringTag,{value:"Module"})),NM="CruisePlugin",up=`${NM}`;class FM extends ws{constructor(t,i){super(t,i);v(this,"state",{visible:!0,enabled:!0,disposed:!1,playing:!1,speed:1});v(this,"data");v(this,"config");v(this,"pauseDataMap",new Map);v(this,"privateState",{playing:!1,broke:!1,modeChanging:!1});v(this,"GuideLine");v(this,"disposedErrorLog",()=>{console.error(`${up} is disposed`)});v(this,"disableWarnLog",()=>{console.warn(`${up} is disabled`)});v(this,"disableErrorLog",()=>{console.error(`${up} is disabled`)});this.config=i,Object.assign(window,{[`__${NM}_DEBUG__`]:this})}play(t){this.setState({playing:!0},t)}pause(t){this.setState({playing:!1},t)}show(t){return ee(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return ee(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.setState({disposed:!0})}setState(t,i){var s;if(this.state.disposed)return this.disposedErrorLog();if(!this.state.enabled&&t.enabled!==!0&&t.disposed!==!0)return this.disableErrorLog();const r=R({},this.state);this.state=jt({},this.state,t),t.disposed!==void 0&&t.disposed!==r.disposed&&t.disposed&&this.handleDispose(),t.visible!==void 0&&t.visible!==r.visible&&this.handleVisible(t.visible,i==null?void 0:i.userAction),t.enabled!==void 0&&t.enabled!==r.enabled&&this.handleEnable(t.enabled,i==null?void 0:i.userAction),t.playing!==void 0&&t.playing!==r.playing&&this.changePlayState(t.playing,i),t.speed!==void 0&&t.speed!==r.speed&&this.changeSpeed(t.speed),Nn(r,this.state,{deep:!0})||this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:(s=i==null?void 0:i.userAction)!=null?s:!0})}clearPauseData(){var t,i;if((t=this.data)!=null&&t.id)return this.pauseDataMap.delete((i=this.data)==null?void 0:i.id)}changePlayState(t,i){this.actionIfStateIsEnabled(()=>{var r;return this.hooks.emit("playStateChange",t?"playing":"pause",{userAction:(r=i==null?void 0:i.userAction)!=null?r:!0})}),t?this.handlePlay(i):this.handlePause(i),this.state.playing=t}handleEnable(t,i=!0){var r,s;t?((r=this.GuideLine)==null||r.enable(),this.hooks.emit("enable",{userAction:i})):((s=this.GuideLine)==null||s.disable(),this.changePlayState(!1,{userAction:i}),this.hooks.emit("disable",{userAction:i})),this.state.enabled=t}handleVisible(t,i=!0){var r,s;t?((r=this.GuideLine)==null||r.show(),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:i}))):((s=this.GuideLine)==null||s.hide(),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:i}))),this.state.visible=t}addInterruptListener(t){const i=()=>{this.privateState.modeChanging||t()},r=s=>{s!=="mouseMove"&&(t(),this.five.off("gesture",r))};return this.five.on("gesture",r),this.five.once("wantsChangeMode",i),()=>{this.five.off("gesture",r),this.five.off("wantsChangeMode",i)}}getSpeededDuration(t){return t/this.state.speed}forceInteruptUpdateCamera(){this.five.updateCamera({},0)}getPauseData(){var t;if((t=this.data)!=null&&t.id)return this.pauseDataMap.get(this.data.id)}setPauseData(){var i;const t=(i=this.data)==null?void 0:i.id;if(t)return this.pauseDataMap.set(t,{fiveState:this.five.getCurrentState(),playedProgress:this.getProgress()})}clear(){this.clearPauseData()}handleDispose(){var t;this.setState({playing:!1}),this.clearPauseData(),this.clear(),(t=this.GuideLine)==null||t.dispose(),this.GuideLine=void 0}actionIfStateIsEnabled(t,i){if(this.state.enabled)return t();i!=null&&i.warnLog&&this.disableWarnLog()}}function dp(e,n,t){var l,c,h;const i=new C.Vector3().fromArray([(l=t.x)!=null?l:0,(c=t.y)!=null?c:0,(h=t.z)!=null?h:0]),r=e.getPointAt(n).clone().add(i),s=e.getTangentAt(n),{longitude:o,latitude:a}=Oc(s);return{offset:r.clone(),longitude:o,latitude:a,distance:0}}let Jg=class extends FM{constructor(t,i){var o;super(t,i);v(this,"curve");v(this,"baseCurveOffset");v(this,"curveOffset");v(this,"playStartedTime",performance.now());v(this,"duration");v(this,"changeSpeed",(t,i=!0)=>{this.state.speed=t,this.hooks.emit("speedChange",t,{userAction:i})});v(this,"moveToStart",()=>{this.five.setState(Ee(R({},dp(this.curve,0,this.curveOffset)),{mode:"Model"}))});v(this,"playFromStart",()=>{this.clearPauseData(),this.setState({playing:!0})});v(this,"getDuration",()=>this.getSpeededDuration(this.duration));v(this,"getProgress",()=>{var l;const t=this.getPauseData();let i=(l=t==null?void 0:t.playedProgress)!=null?l:0;(i<0||i>=1)&&(i=0);const r=1-i,s=this.getDuration(),a=(performance.now()-this.playStartedTime)/s;return 1-r+a});const r={config:{speedConfig:{moveSpeed:2,moveSpeedUnit:"m/s"}}},s={allowBroke:!0};this.state=jt({},r,this.state),this.config=jt({},s,this.config),this.baseCurveOffset=jt({x:0,y:0,z:0},{y:2},(o=this.config)==null?void 0:o.offset)}load(t,i){var a,l,c,h,u,d,f,m,p;this.handlePause(),this.clear(),this.data=R({id:xn()},t);const r=(()=>{if(this.data.path instanceof C.Curve)return this.data.path.curves[0];{if(this.data.path.length<2)return null;const g=this.data.path.map(Ft);return new C.CatmullRomCurve3(g,void 0,"catmullrom",.5)}})();if(!r)return;if(this.curve=r,this.curveOffset={x:this.baseCurveOffset.x+((l=(a=this.data.offset)==null?void 0:a.x)!=null?l:0),y:this.baseCurveOffset.y+((h=(c=this.data.offset)==null?void 0:c.y)!=null?h:0),z:this.baseCurveOffset.z+((d=(u=this.data.offset)==null?void 0:u.z)!=null?d:0)},!this.curve)throw new Error("curve is not defined");const s=this.curve.getLength(),o=this.state.config.speedConfig.moveSpeedUnit==="m/ms"?1:1e3;if(this.duration=s/(this.state.config.speedConfig.moveSpeed/o),Array.isArray(this.data.path)){const g=this.data.path.map(Ft).map(y=>y.toArray());!this.GuideLine&&(((f=this.config)==null?void 0:f.useGuideLine)!==!1&&t.useGuildLine||(m=this.config)!=null&&m.useGuideLine&&t.useGuildLine!==!1)&&(this.GuideLine=AV(this.five,this.config)),(p=this.GuideLine)==null||p.load({lines:[{id:xn(),path:[{type:"CatmullRomCurve3",points:g}],model_style:{visible:!0}}]})}return i?this.setState(i):(this.setState({playing:!1}),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),this.changePlayState(this.state.playing),this.changeSpeed(this.state.speed)),Promise.resolve()}handlePlay(){return new Promise((t,i)=>ee(this,null,function*(){var l;this.hooks.emit("play",{userAction:!0});const r=this.getPauseData();let s=(l=r==null?void 0:r.playedProgress)!=null?l:0;(s<0||s>=1)&&(s=0);const o=dp(this.curve,s,this.curveOffset);if(this.hooks.emit("progressChange",s),this.five.setState(Ee(R({},o),{mode:"Model"})),yield this.five.ready(),this.playStartedTime=performance.now(),this.config.allowBroke){const c=this.addInterruptListener(()=>{this.state.playing&&(this.hooks.emit("broke"),this.handlePause(),c(),i(new Error("broke")))})}const a=()=>{const c=this.getProgress();if(c>=1)this.five.off("renderFrame",a),this.setState({playing:!1},{userAction:!1}),this.hooks.emit("end"),this.hooks.emit("progressChange",1),t("end");else if(this.state.playing===!1)this.five.off("renderFrame",a);else if(c>=0){const h=dp(this.curve,c,this.curveOffset);this.hooks.emit("progressChange",c),this.five.setState(h,!0)}};this.five.on("renderFrame",a)}))}handlePause(t){var i;this.state.playing=!1,this.hooks.emit("pause",{userAction:(i=t==null?void 0:t.userAction)!=null?i:!0}),this.setPauseData()}};function p1(e){const n=Math.abs(Math.cos(e.latitude));return new C.Vector3(-Math.sin(e.longitude)*n,-Math.sin(e.latitude),-Math.cos(e.longitude)*n)}function dV(e,n){const t=p1(e),i=p1(n);return t.angleTo(i)}const fV=e=>ee(exports,null,function*(){try{e().then(()=>{},()=>{}).catch(()=>{})}catch(n){}});function pV(e){return new Promise(n=>{setTimeout(()=>{n()},e)})}function mV(e){return ee(this,null,function*(){return new Promise(n=>{if(e.work){n();return}e.once("loaded",()=>n())})})}class Vc extends FM{constructor(t,i){super(t,i);v(this,"state",{visible:!0,enabled:!0,disposed:!1,playing:!1,speed:1,config:{speedConfig:{rotateSpeed:.001,rotateSpeedUnit:"rad/ms",moveSpeed:.002,moveSpeedUnit:"m/ms"}}});v(this,"privateState",{playing:!1,currentPlayQueue:[],currentPlayKeyframe:null,broke:!1,modeChanging:!1});this.config=i,Object.assign(window,{__WalkPlugin_DEBUG__:this})}load(t,i,r){return ee(this,null,function*(){var h,u;this.clear();const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,o=yield this.formatData(t);this.data=R({id:o.keyframesId},o),this.hooks.emit("dataChange",o,s);let a=[],l;const c=this.data.keyframes.filter(d=>d.data.panoIndex!==void 0);c.filter((d,f)=>{var m;return d.data.panoIndex!==((m=c[f-1])==null?void 0:m.data.panoIndex)}).map(d=>d.data.panoIndex).forEach(d=>{var m,p;const f=(m=this.workUtil.getObserver(d))==null?void 0:m.floorIndex;if(f!==void 0)if(l===f){const g=a.length-1;a[g]=[...(p=a[g])!=null?p:[],d]}else{l=f;const g=a.length;a[g]=[d]}}),!this.GuideLine&&((h=this.config)==null?void 0:h.useGuideLine)!==!1&&o.useGuildLine!==!1&&(this.GuideLine=qg(this.five,this.config)),(u=this.GuideLine)==null||u.load({routes:a.map(d=>({panoIndexList:d})),config:o.guildPluginOptions}),i?this.setState(i,{userAction:r}):(this.setState({playing:!1},{userAction:!1}),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),this.changePlayState(this.state.playing,{userAction:!1}),this.changeSpeed(this.state.speed)),this.clearPauseData(),console.debug("WORKPLUGIN loaded",o),this.hooks.emit("dataLoaded",o)})}playFrom(t){const{index:i,id:r,userAction:s}=t;this.state.playing&&this.setState({playing:!1},{userAction:s}),this.setState({playing:!0},{userAction:s,playFromIndex:i,playFromId:r})}playFromStart(t){return this.playFrom(Ee(R({},t),{index:0}))}formatData(t){return ee(this,null,function*(){this.five.work||(yield mV(this.five));const i=(()=>{const r=t;return typeof r=="object"&&r!==null&&At(r.version)&&r.data?r.data:r})();if(i.keyframes)return{keyframesId:xn(),keyframes:i.keyframes.map((r,s)=>{var l;const o=i.keyframes[s+1],a=(()=>!o||o.start===void 0||r.end===void 0?0:o.start-r.end)();return Ee(R({id:(l=r.uuid)!=null?l:xn(),moveIndex:s,stay:a,index:s},r),{guildPluginOptions:i.guildPluginOptions})})};if(i.panoIndexList){let r=[];const{moveEffect:s,moveToFirstPanoEffect:o,moveToFirstPanoDuration:a}=i;return this.privateState.moveToFirstPanoEffect=o,this.privateState.moveToFirstPanoDuration=a,i.panoIndexList.forEach((l,c)=>{const h=(()=>{var p,g;const u=i.panoIndexList.slice(c).find(y=>y!==l);if(u===void 0)return;const d=this.workUtil.getObserverPosition(l),f=this.workUtil.getObserverPosition(u);if(!f||!d||((p=this.workUtil.getObserver(l))==null?void 0:p.floorIndex)!==((g=this.workUtil.getObserver(u))==null?void 0:g.floorIndex))return;const m=new C.Vector3().subVectors(f,d);return Oc(m.normalize())})();i.moveType===void 0||i.moveType==="justMove"?r.push({moveIndex:c,stay:i.stay,data:R({effect:"Move",panoIndex:l,moveEffect:s},h!=null?h:{})}):i.moveType==="moveAndRotate"&&(r.push({moveIndex:c,stay:i.stay,data:{effect:"Move",panoIndex:l,moveEffect:s}}),h&&r.push({moveIndex:c,stay:i.stay,data:R({effect:"Rotate",panoIndex:l},h)}))}),{keyframesId:xn(),keyframes:r.map((l,c)=>R({id:xn(),index:c},l)),guildPluginOptions:i.guildPluginOptions,useGuildLine:i.useGuildLine}}else throw new Error("format error: data no keyframes or no panoIndexList")})}handlePlay(t){return ee(this,null,function*(){var f;const{data:i,state:r,privateState:s,hooks:o}=this;if(s.playing||!(i!=null&&i.keyframes)||(i==null?void 0:i.keyframes.length)===0)return;const a=xn();s.playId=a,s.playing=!0,s.broke=!1;const l=i.keyframes,c=this.getPauseData();(t==null?void 0:t.notEmitEvent)!==!0&&o.emit("play",{userAction:(f=t==null?void 0:t.userAction)!=null?f:!0});let h=!1;const d=yield(()=>ee(this,null,function*(){var m,p;if((t==null?void 0:t.playFromIndex)!==void 0)return t.playFromIndex;if((t==null?void 0:t.playFromId)!==void 0)return(m=this.data)==null?void 0:m.keyframes.findIndex(g=>g.id===t.playFromId);if(c!=null&&c.id){const g=(p=this.data)==null?void 0:p.keyframes.find(y=>y.id===c.id);if(c!=null&&c.fiveState&&(yield this.move(c.fiveState,{moveEffect:s.moveToFirstPanoEffect,duration:s.moveToFirstPanoDuration})),g){if(g.data.effect==="Move")return g.index;if(g.data.effect==="Rotate"){const y=c.duration!==void 0?c.duration*(1-c.playedProgress):void 0;return yield this.playKeyframe(g,{duration:y}),h=!0,g.index+1}}}}))();this.clearPauseData();for(const m of l){if(s.broke||!r.playing||!s.playing||a!==s.playId)return;if(!(d!==void 0&&m.index<d))try{o.emit("playIndexChange",m.index,m),yield this.playKeyframe(m,{moveEffect:h===!1?s.moveToFirstPanoEffect:void 0,duration:h===!1&&typeof s.moveToFirstPanoDuration=="number"?s.moveToFirstPanoDuration:void 0}),m.stay&&(yield pV(m.stay)),h===!1&&(h=!0)}catch(p){return console.error(p),Promise.resolve("broke")}}r.playing&&a===s.playId&&(this.setState({playing:!1},{userAction:!1}),o.emit("end"),this.clearPauseData())})}handlePause(t){var o;const{state:i,privateState:r,hooks:s}=this;i.playing=!1,r.playing!==!1&&(r.playing=!1,(t==null?void 0:t.userAction)!==!1&&this.setPauseData(),r.broke||this.forceInteruptUpdateCamera(),(t==null?void 0:t.notEmitEvent)!==!0&&s.emit("pause",{userAction:(o=t==null?void 0:t.userAction)!=null?o:!0}))}changeSpeed(t,i=!0){const{state:r,privateState:s,hooks:o}=this,{currentPlayKeyframe:a}=s;if(o.emit("speedChange",t,{userAction:i}),r.playing&&a)try{const l=a.originDuration!==void 0?a.originDuration*(1-this.getProgress()):void 0,c=this.playKeyframe(a.keyframe,{duration:l});s.currentPlayQueue.push(c)}catch(l){}}getProgress(){return this.five.controller.cameraMotion.progress}setPauseData(){var t,i,r;if((t=this.data)!=null&&t.id)return this.pauseDataMap.set(this.data.id,{id:(i=this.privateState.currentPlayKeyframe)==null?void 0:i.keyframe.id,fiveState:this.five.getCurrentState(),duration:(r=this.privateState.currentPlayKeyframe)==null?void 0:r.originDuration,playedProgress:this.getProgress()})}clear(){this.clearPauseData(),this.privateState.currentPlayKeyframe=null}playKeyframe(t,i){return ee(this,null,function*(){var s;const{privateState:r}=this;return((s=this.privateState.currentPlayKeyframe)==null?void 0:s.keyframe.id)!==t.id&&(this.privateState.currentPlayKeyframe={keyframe:t}),r.currentPlayQueue.push(this.getPlayPromise(t,i)),this.actionPromiseQueue()})}getPlayPromise(r){return ee(this,arguments,function*(t,i={}){var o;const s=t.data;if(i.duration=(o=i.duration)!=null?o:t.start!==void 0&&t.end!==void 0?t.end-t.start:void 0,!!s)return new Promise((a,l)=>{let c=!1;this.addInterruptListener(()=>{if(!c)return this.hooks.emit("broke"),this.privateState.broke=!0,this.setState({playing:!1}),c=!0,l(new Error("play is interupted"))});try{if(c)return;const h=()=>{a(),c=!0};switch(s.effect){case"Move":this.move(s,i).then(h);break;case"Rotate":this.rotate(s,i).then(h);break;default:this.rotate(s,i).then(h)}}catch(h){}})})}actionPromiseQueue(){return ee(this,null,function*(){const{privateState:t}=this;return new Promise((i,r)=>{if(t.currentPlayQueue.length===0){i();return}const s=t.currentPlayQueue.shift();if(!s){i();return}s.then(i,r)}).then(()=>t.currentPlayQueue.length===0?Promise.resolve():this.actionPromiseQueue())})}move(t,i){return ee(this,null,function*(){if(t.mode&&t.mode!==this.five.currentMode)yield this.changeMode(t);else if(t.panoIndex!==this.five.panoIndex)yield this.changePano(t,i);else return Promise.resolve()})}rotate(t,i){return ee(this,null,function*(){if(t.mode&&t.mode!==this.five.currentMode)yield this.changeMode({mode:t.mode,panoIndex:t.panoIndex});else if(t.panoIndex&&t.panoIndex!==this.five.panoIndex)return yield this.changePano(t,i);yield this.updateCamera(t,i)})}updateCamera(r){return ee(this,arguments,function*(t,i={}){const{five:s,privateState:o,state:a}=this,l=(()=>{var f,m;const u=(f=a.config)==null?void 0:f.speedConfig,d=(m=t.rotateSpeed)!=null?m:u==null?void 0:u.rotateSpeed;if((u==null?void 0:u.rotateSpeedUnit)===void 0)return d;if(d!==void 0)return u.rotateSpeedUnit==="rad/ms"?d:d/1e3})(),c=(()=>{if(i.duration)return i.duration;if(l){const u=this.five.getCurrentState();return dV(u,t)/l}return 800})();o.currentPlayKeyframe&&(o.currentPlayKeyframe.originDuration=c);const h=this.getSpeededDuration(c);return new Promise(u=>{fV(()=>s.updateCamera(t,h)),setTimeout(()=>u(),h)})})}changePano(t,i){return ee(this,null,function*(){const{five:r,privateState:s,state:o}=this;if(typeof t.panoIndex!="number"||t.panoIndex===r.panoIndex)return;const a=r.getCurrentState().mode!=="Panorama";a&&(this.privateState.modeChanging=!0);const l=(()=>{var d,f;const h=(d=o.config)==null?void 0:d.speedConfig,u=(f=t.moveSpeed)!=null?f:h==null?void 0:h.moveSpeed;if((h==null?void 0:h.moveSpeedUnit)===void 0)return u;if(u!==void 0)return h.moveSpeedUnit==="m/ms"?u:u/1e3})(),c=(()=>{if(i!=null&&i.duration)return i.duration;if(l&&typeof r.panoIndex=="number"&&typeof t.panoIndex=="number"){const h=this.workUtil.getObserverPosition(r.panoIndex),u=this.workUtil.getObserverPosition(t.panoIndex);return h&&u?h.distanceTo(u)/l:800}return 800})();s.currentPlayKeyframe&&(s.currentPlayKeyframe.originDuration=c),yield new Promise(h=>{var u,d,f;this.fiveUtil.moveToPano(t.panoIndex,{latitude:t.latitude,longitude:t.longitude,fov:t.fov,duration:this.getSpeededDuration(c),effect:(f=(d=i==null?void 0:i.moveEffect)!=null?d:(u=this.state.config)==null?void 0:u.moveEffect)!=null?f:t.moveEffect,moveCancelCallback:()=>h(),moveEndCallback:()=>h()}),a&&r.once("panoArrived",()=>h())}),a&&(this.privateState.modeChanging=!1)})}changeMode(t,i){return ee(this,null,function*(){t.mode&&t.mode!==this.five.currentMode&&(this.privateState.modeChanging=!0,yield this.five.changeMode(t.mode,t,i),this.privateState.modeChanging=!1)})}}class VM{constructor(n){v(this,"id");v(this,"renderID");v(this,"isGuideLine",!0);v(this,"panoramaItem");v(this,"modelItem");v(this,"hooks",new Cn);v(this,"_visible",!0);v(this,"plugin");v(this,"five");v(this,"logError",n=>iM("GuideLineItem: ",n));this.id=n.id,this.five=n.five,this.plugin=n.plugin,this.panoramaItem=new Vm(this.five,{mode:"panorama",plugin:this.plugin,parent:this}),this.modelItem=new Vm(this.five,{mode:"model",plugin:this.plugin,parent:this})}get visible(){return this._visible}setData(n){this.setDataByMode("panorama",n),this.setDataByMode("model",n)}setDataByMode(n,t){var u;const i=n==="panorama"?this.panoramaItem:this.modelItem,r=n==="panorama"?t.panorama_style:t.model_style,s=n==="panorama"&&t.panorama_style.use_auto_depthtest,o=t.panorama_style.auto_depth_test_effect_distance,a=t.path,l=r,c=r,h=r;if(t.pano_group){const d=n==="panorama"&&t.panorama_style.skip_group===!0;i.setGeometryByPanoGroup(t.pano_group,Ee(R({skipPanoGroup:d},l),{useAutoDepthTest:s,autoDepthTestEffectDistance:o}))}else t.path&&i.setGeometryByPath(a,Ee(R({},l),{useAutoDepthTest:s,autoDepthTestEffectDistance:o}));i.name=t.name,i.setMeshStyle(h),i.setMartial(c),i.setVisibleFloorIndexes((u=t.visible_floor_indexes)!=null?u:null),i.setStartTag(r==null?void 0:r.start_tag),i.setEndTag(r==null?void 0:r.end_tag)}show(){this._visible=!0,this.hooks.emit("show",{userAction:!0})}hide(){this._visible=!1,this.hooks.emit("hide",{userAction:!0})}dispose(){this.panoramaItem.dispose(),this.modelItem.dispose()}walk(n){return ee(this,null,function*(){if(this.hooks.emit("walkStart",{userAction:!0}),this.panoramaItem.panoGroup.length){const t=R({panoIndexList:this.panoramaItem.panoGroup},n),[i]=yield $s(vV(this.five,t));if(i)return this.logError(i.message)}else{const t={path:this.panoramaItem.curvePath},[i]=yield $s(gV(this.five,t));if(i)return this.logError(i.message)}this.hooks.emit("walkEnded",{userAction:!0})})}}function gV(e,n){return ee(this,null,function*(){const t=new Jg(e);yield t.load(n),t.playFromStart()})}function vV(e,n){return ee(this,null,function*(){if(n.panoIndexList.length===0)return;const t=e.getCurrentState();t.mode!=="Panorama"&&(yield Tg(e,["Panorama",{longitude:t.longitude,latitude:0,panoIndex:n.panoIndexList[0]}]));const i=new Vc(e);yield i.load(n),yield new Promise((r,s)=>{const o=e.getCurrentState();let a=n.panoIndexList.slice();o.panoIndex===a[0]&&c(o.panoIndex),i.playFromStart();function l(f){if(f!=="Panorama")return u(new Error("mode not match"))}function c(f){const m=a[0];if(a=a.slice(1),f!==m)return u(new Error("panoIndex not match, wanted: "+m+", got: "+f));if(a.length===0)return d()}function h(){e.off("modeChange",l),e.off("panoArrived",c)}function u(f){h(),s(f)}function d(){h(),r()}e.on("modeChange",l),e.on("panoArrived",c)})})}const yV=Object.freeze(Object.defineProperty({__proto__:null,GuideLineItem:VM},Symbol.toStringTag,{value:"Module"})),Gm="GuideLinePlugin",m1=`${Gm}`;let bV=class extends Br{constructor(t,i){super(t,i);v(this,"name",Gm);v(this,"cruisePlugin");v(this,"itemMap",new Map);v(this,"state",{visible:!1,enabled:!0});v(this,"data");v(this,"heightOffset",0);v(this,"_config");v(this,"_disposed",!1);v(this,"disposedErrorLog",()=>{console.error(`${m1} is disposed`)});this._config=i!=null?i:{},this.cruisePlugin=new Vc(t),Object.assign(window,{[`__${Gm}_DEBUG__`]:this})}get config(){return this._config}get disposed(){return this._disposed}load(t,i,r=!0){return ee(this,null,function*(){var f,m,p,g,y,b,A,w;const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,o=yield this.formatData(t);this.hooks.emit("dataChange",o,s),this.data=o;const a=o.config,c={panorama_style:{visible:!!(!o.lines&&o.routes),unit_length:(f=a==null?void 0:a.unitHeight)!=null?f:.4,width:(m=a==null?void 0:a.unitWidth)!=null?m:.6,texture:{url:(p=a==null?void 0:a.arrowTextureUrl)!=null?p:this.staticPrefix+"/release/web/arrow-white.5c2c79a5.png"},use_auto_depthtest:(g=this.config.useAutoDepthTest)!=null?g:!1,auto_depth_test_effect_distance:this.config.autoDepthTestEffectDistance}},h=(b=(y=o.routes)==null?void 0:y.map(x=>{var M;return jt({},c,{id:(M=x.id)!=null?M:xn(),pano_group:x.panoIndexList})}))!=null?b:[],u=(w=(A=o.lines)==null?void 0:A.map(x=>jt({},c,x)))!=null?w:[],d=[...h,...u];yield Ha(this.five),this.clear(),d.forEach(x=>{this.addGuideLineItem(x)}),this.updateTagsEnable(),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),i&&this.setState(i,{userAction:r}),this.hooks.emit("dataLoaded",o),console.debug(`${m1} loaded`,o)})}formatData(t){return ee(this,null,function*(){return this.getDataWithoutVersion(t)})}show(t){return ee(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return ee(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.disposed||(this.clear(),this.hooks.emit("dispose"))}setState(t,i){var s;if(this.disposed)return this.disposedErrorLog();const r=R({},this.state);this.state=R(R({},this.state),t),t.visible!==void 0&&t.visible!==r.visible&&this.handleVisible(t.visible,i==null?void 0:i.userAction),t.enabled!==void 0&&t.enabled!==r.enabled&&this.handleEnable(t.enabled,i==null?void 0:i.userAction),Nn(r,this.state,{deep:!0})||(this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:(s=i==null?void 0:i.userAction)!=null?s:!0}),this.five.needsRender=!0)}addGuideLineItem(t){const i=t.render_id||t.id,r=this.itemMap.get(i);r&&this.removeGuideLineItem(r);const s=new VM({five:this.five,id:i,plugin:this});return this.itemMap.set(i,s),t&&s.setData(t),this.heightOffset+=1e-4,s.modelItem.setHeightOffset(this.heightOffset),s.panoramaItem.setHeightOffset(this.heightOffset),s}getGuideLineItemByID(t){return this.itemMap.get(t)}removeGuideLineItem(t){this.itemMap.delete(t.id),t.panoramaItem.dispose(),t.modelItem.dispose()}updateTagsEnable(){const t=[];function i(o){return Array.isArray(o)&&o.every(a=>typeof a=="number")}function r(o,a){return new C.Vector3().fromArray(o).distanceTo(new C.Vector3().fromArray(a))<.01}function s(o){var l;const a=(l=o==null?void 0:o.tag)==null?void 0:l.position;return i(a)?t.every(c=>{var h;return i((h=c.tag)==null?void 0:h.position)?!r(a,c.tag.position):!0}):!1}this.itemMap.forEach(o=>{const a=o.modelItem.startTagContainer,l=o.modelItem.endTagContainer,c=s(a);c&&t.push(a),a==null||a.plugin.setState({enabled:c},{});const h=s(l);h&&t.push(l),l==null||l.plugin.setState({enabled:h},{})})}clear(){this.heightOffset=0,this.itemMap.forEach(t=>{this.removeGuideLineItem(t)})}handleEnable(t,i=!0){this.hooks.emit(t?"enable":"disable",{userAction:i})}handleVisible(t,i=!0){this.state.enabled&&this.hooks.emit(t?"show":"hide",{userAction:i})}getDataWithoutVersion(t){return typeof t=="object"&&t!==null&&t.data?t.data:t}};const qg=(e,n)=>new bV(e,n),AV=qg,wV=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),xV=(e,n)=>new Vc(e,n),MV=(e,n)=>new Jg(e,n);function GM(e,n,t){if(t){const r=new C.Vector3().subVectors(e.position,t).applyQuaternion(e.quaternion.clone().inverse()).applyQuaternion(n).add(t);e.position.copy(r)}e.quaternion.copy(n)}class Gc extends ei{constructor(t,i){var r,s;super();v(this,"originObject3D");v(this,"onRender");v(this,"positionFrom");this.originObject3D=t,this.onRender=(r=i==null?void 0:i.onRender)!=null?r:()=>{},this.positionFrom=(s=i==null?void 0:i.positionFrom)!=null?s:"objectPosition"}get helperObject(){return this}render(){this.onRender()}enable(){this.parent.children.includes(this)||this.parent.add(this)}disable(){this.removeFromParent()}show(){this.visible=!0,this.render()}hide(){this.visible=!1,this.render()}raycasterIntersectObject(t,i=[]){return t.intersectObject(this,!0,i)}initialPosition(t){var i,r;this.positionFrom==="objectPosition"?this.position.copy(this.originObject3D.position):this.positionFrom==="boundingBox"?this.position.copy((i=Ga(this.originObject3D))==null?void 0:i.getCenter(new C.Vector3)):this.positionFrom==="boundingSphere"?this.position.copy((r=qw(this.originObject3D))==null?void 0:r.center):this.positionFrom instanceof ne.Vector3?this.position.copy(this.positionFrom):this.positionFrom instanceof Function&&this.position.copy(this.positionFrom(this.originObject3D)),t&&this.position.add(t)}setScaleByCamera(t){}initQuaternion(){this.quaternion.copy(this.originObject3D.quaternion)}applyHelperScaleMatrix4(t,i){this.scale.applyMatrix4(t)}setHelperQuaternion(t,i){GM(this,t,i)}applyHelperQuaternion(t,i){if(i){const r=new ne.Vector3().subVectors(this.position,i).applyQuaternion(t).add(i);this.position.copy(r)}this.applyQuaternion(t)}dispose(){this.removeFromParent()}}class EV extends Gc{}class CV extends Gc{}class PV extends Gc{}class _V extends Gc{}class SV extends Gc{}class IV extends C.Group{constructor(t){super();v(this,"direction");this.direction=t||"x"}}class g1 extends C.Mesh{constructor(t,i,r){super(t,i);v(this,"direction");this.direction=r||"x"}}function TV(e,n){const{offsetWidth:t,offsetHeight:i}=n,{top:r,left:s}=n.getBoundingClientRect();return Object.assign(new C.Vector2,{x:(e.x-s)/t*2-1,y:-(e.y-r)/i*2+1})}function Vd(e,n,t){if(!n||!t||!e)return;const i=TV(n,t);if(Math.abs(i.x)===1||Math.abs(i.y)===1)return;const r=new C.Raycaster;return r.setFromCamera(i,e),r.params.Points.threshold=.1,r}function DV(e,n){return!(Math.abs(e.x-n.x)>1e-5||Math.abs(e.y-n.y)>1e-5||Math.abs(e.z-n.z)>1e-5)}class fp extends IV{constructor(t){var h;super(t.direction);v(this,"line");v(this,"arrow");v(this,"lineHeight",.4);v(this,"arrowHeight",.1);this.name="ArrowGroup";const i=new C.Color((h=t.color)!=null?h:16214315),r=new C.MeshBasicMaterial({color:i,depthTest:!1,depthWrite:!1,opacity:1,transparent:!0,side:C.DoubleSide});this.renderOrder=50;const s=new C.ConeGeometry(.04,.1,32),o=new g1(s,r.clone(),t.direction);o.name=`arrow-${t.direction}`,this.arrow=o;const a=.004,l=new C.CylinderGeometry(a,a,.4,32),c=new g1(l,r.clone(),t.direction);c.name=`line-${t.direction}`,this.line=c,this.formatArrow(),this.formatLine(),this.add(this.arrow,this.line)}formatArrow(){this.arrow.geometry.translate(0,this.lineHeight+this.arrowHeight/2,0),this.direction==="x"?(this.arrow.geometry.rotateX(Math.PI/2),this.arrow.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.arrow.geometry.rotateX(Math.PI/2)}formatLine(){this.line.geometry.translate(0,this.lineHeight/2,0),this.direction==="x"?(this.line.geometry.rotateX(Math.PI/2),this.line.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.line.geometry.rotateX(Math.PI/2)}}const pp={X:15618642,Y:4765519,Z:4227839};class ia{static get X(){return new C.Color(pp.X).convertSRGBToLinear().clone()}static get Y(){return new C.Color(pp.Y).convertSRGBToLinear().clone()}static get Z(){return new C.Color(pp.Z).convertSRGBToLinear().clone()}}function Kg(e,n){const r=e.position.distanceTo(n),s=e.fov,o=r/3,a=s/90;return o*a}class LV extends EV{constructor(t,i){super(t,i);v(this,"xArrow");v(this,"yArrow");v(this,"zArrow");i.xArrowEnable!==!1&&(this.xArrow=new fp({direction:"x",color:ia.X})),i.yArrowEnable!==!1&&(this.yArrow=new fp({direction:"y",color:ia.Y})),i.zArrowEnable!==!1&&(this.zArrow=new fp({direction:"z",color:ia.Z})),this.add(...[this.xArrow,this.yArrow,this.zArrow].filter(Boolean))}show(){super.show(),this.xArrow&&(this.xArrow.visible=!0),this.yArrow&&(this.yArrow.visible=!0),this.zArrow&&(this.zArrow.visible=!0)}setScaleByCamera(t){this.scale.setScalar(Kg(t,this.position))}showDraggingHelper(t){this.xArrow&&(this.xArrow.visible=t.includes("x")),this.yArrow&&(this.yArrow.visible=t.includes("y")),this.zArrow&&(this.zArrow.visible=t.includes("z"))}dispose(){this.remove(...[this.xArrow,this.yArrow,this.zArrow].filter(Boolean)),super.dispose()}}function Ws(e,n){return kV(document.createElement(n!=null?n:"div"),e)}function kV(e,n){if(!n)return e;for(const t in n)t&&n[t]&&(e.style[t]=n[t]);return e}function RV(e){const n=Ws(R({position:"absolute",display:"block",borderRadius:"4px",paddingTop:"1px",paddingBottom:"1px",paddingLeft:"4px",paddingRight:"4px",pointerEvents:"none",userSelect:"none",zIndex:"99999",backgroundColor:"rgba(0,0,0,0.7)",fontSize:"12px",color:"#fff",letterSpacing:"0",lineHeight:"18px"},e)),t=()=>{n.style.display!=="block"&&n.style.top&&n.style.left&&(n.style.display="block")};return{element:n,show:t,hide:()=>{n.style.display="none",n.style.top="",n.style.left=""},setLeftTop:(s,o)=>{n.style.left=s,n.style.top=o,t()}}}class OV extends PV{constructor(t,i){super(t,i);v(this,"xCircle");v(this,"yCircle");v(this,"zCircle");v(this,"children",[]);v(this,"angleTips");v(this,"container");(i==null?void 0:i.yzCircleEnable)!==!1&&(this.xCircle=new mp({direction:"x",color:ia.X})),(i==null?void 0:i.xzCircleEnable)!==!1&&(this.yCircle=new mp({direction:"y",color:ia.Y})),(i==null?void 0:i.xyCircleEnable)!==!1&&(this.zCircle=new mp({direction:"z",color:ia.Z})),i!=null&&i.container&&(i==null?void 0:i.angleTipsEnable)!==!1&&(this.container=i==null?void 0:i.container,this.angleTips=RV({display:"none"}),this.container.appendChild(this.angleTips.element)),this.add(...[this.xCircle,this.yCircle,this.zCircle].filter(Boolean)),this.show()}hide(){this.children.forEach(t=>t.hide())}show(){var t;this.children.forEach(i=>i.showCircle()),(t=this.angleTips)==null||t.hide()}setScaleByCamera(t){this.scale.setScalar(Kg(t,this.position))}showDraggingHelper(t){var i;this.hide(),this.children.filter(r=>t.includes(r.direction)).forEach(r=>r.showRing()),(i=this.angleTips)==null||i.show()}dispose(){var t,i;this.removeFromParent(),(i=(t=this.angleTips)==null?void 0:t.element)==null||i.remove()}}class mp extends C.Group{constructor(t){super();v(this,"direction");v(this,"circle");v(this,"ring");v(this,"angleSector");this.direction=t.direction,this.circle=new zV(t),this.ring=new BV(t),this.angleSector=new NV(t),this.add(this.circle,this.ring,this.angleSector),this.direction==="y"?this.rotateX(Math.PI/2):this.direction==="x"&&this.rotateY(-Math.PI/2)}showCircle(){this.add(this.circle),this.remove(this.ring,this.angleSector)}showRing(){this.add(this.ring,this.angleSector),this.remove(this.circle)}hide(){this.remove(this.ring,this.angleSector,this.circle)}}let zV=class extends C.Mesh{constructor(t){var i;super();v(this,"direction");v(this,"gapAngle",.02);v(this,"geometry",new C.RingGeometry(.25,.3,20,8,this.gapAngle,Math.PI/2-this.gapAngle*2));this.material=new C.MeshBasicMaterial({opacity:.6,color:(i=t.color)!=null?i:16777215,transparent:!0,side:C.DoubleSide,depthTest:!1,depthWrite:!1}),this.renderOrder=50,this.direction=t.direction,this.geometry.name=`RotateHelperCircleGeometry-${this.direction}`}};class BV extends C.Group{constructor(t){super();v(this,"direction");this.direction=t.direction;const i=.015,r=new Array(8).fill(null).map((s,o)=>{const a=new C.RingGeometry(.25,.3,20,8,Math.PI/4*o+i,Math.PI/4-i*2),l=new C.MeshBasicMaterial({opacity:1,color:16777215,depthTest:!1,depthWrite:!1,transparent:!0,side:C.DoubleSide});this.renderOrder=50;const c=new C.Mesh(a,l);return c.name=`AxesDashedRing-${this.direction}-${o}`,c});this.add(...r)}}class NV extends C.Mesh{constructor(t){var r;super();v(this,"direction");v(this,"baseAxes");v(this,"angleDirection");switch(t.direction){case"x":this.baseAxes=new C.Vector3(0,0,1);break;case"y":this.baseAxes=new C.Vector3(1,0,0);break;case"z":this.baseAxes=new C.Vector3(1,0,0);break}const i=.3+5e-4;this.geometry=new C.CircleGeometry(i,48,0,1e-4),this.material=new C.MeshBasicMaterial({opacity:.4,color:(r=t.color)!=null?r:16777215,depthTest:!1,depthWrite:!1,transparent:!0,side:C.DoubleSide}),this.renderOrder=50,this.direction=t.direction,this.angleDirection=this.direction==="z"?1:-1}}function FV(){const e=Ws({width:"100%",height:"100%",left:"0",top:"0",position:"absolute",pointerEvents:"none"}),n=Ws({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}),t=Ws({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"absolute",border:"1px solid rgba(255,255,255,0.4)"});e.appendChild(n),n.appendChild(t);const i="-4px",r={direction:"nesw",element:Zr({cursor:"nesw-resize",left:i,bottom:i})},s={direction:"ns",element:Zr({cursor:"ns-resize",bottom:i})},o={direction:"nwse",element:Zr({cursor:"nwse-resize",right:i,bottom:i})},a={direction:"ew",element:Zr({cursor:"ew-resize",right:i})},l={direction:"nesw",element:Zr({cursor:"nesw-resize",right:i,top:i})},c={direction:"ns",element:Zr({cursor:"ns-resize",top:i})},h={direction:"nwse",element:Zr({cursor:"nwse-resize",left:i,top:i})},u={direction:"ew",element:Zr({cursor:"ew-resize",left:i})};return new Array(s,a,c,u,r,o,l,h).forEach(f=>n.appendChild(f.element)),{container:e,squares:[r,s,o,a,l,c,h,u]}}function Zr(e){const n=Ws(R({background:"#FFFFFF",width:"9px",height:"9px",position:"absolute",pointerEvents:"none"},e)),t=Ws({width:"15px",height:"15px",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"}),i=Ws({width:"15px",height:"15px",cursor:e==null?void 0:e.cursor,pointerEvents:"auto",background:"transparent"});return i.draggable=!0,t.appendChild(i),n.appendChild(t),n}class VV extends SV{constructor(t,i,r,s){super(t);v(this,"points",[]);v(this,"cornerPositions",[]);v(this,"css3DInstance");v(this,"plane");v(this,"css3DRenderer",new Ia);v(this,"camera");v(this,"scene");v(this,"container");v(this,"enabled",!1);this.camera=r,this.scene=s,this.container=i,this.initRectangleScaleHelper()}get helperObject(){var t;if(!((t=this.css3DInstance)!=null&&t.css3DObject))throw new Error("css3DInstance is not initialized");return this.css3DInstance.css3DObject}applyMatrix4(t){var i;super.applyMatrix4(t),this.helperObject.applyMatrix4(t),(i=this.plane)==null||i.applyMatrix4(t),this.cornerPositions.forEach(r=>r.applyMatrix4(t))}showDraggingHelper(){}applyHelperScaleMatrix4(t,i){var r;(r=this.plane)==null||r.scale.applyMatrix4(t),this.helperObject.applyScaleMatrix4(t)}updatePoints(){const t=this.calculatePointPosition(this.cornerPositions);this.points.forEach((i,r)=>{i.position.copy(t[r])})}applyHelperQuaternion(t,i){var s;const r=(s=this.css3DInstance)==null?void 0:s.css3DObject;if(r){const o=new C.Vector3().subVectors(r.position,i).applyQuaternion(t).add(i);r.position.copy(o),r.applyQuaternion(t)}if(this.plane){const o=new C.Vector3().subVectors(this.plane.position,i).applyQuaternion(t).add(i);this.plane.position.copy(o),this.plane.applyQuaternion(t)}this.cornerPositions.forEach(o=>{const a=new C.Vector3().subVectors(o,i).applyQuaternion(t).add(i);o.copy(a)})}enable(){var t;this.enabled||(this.enabled=!0,(t=this.css3DInstance)==null||t.enable(),this.plane&&this.scene.add(this.plane))}disable(){var t;this.enabled&&(this.enabled=!1,(t=this.css3DInstance)==null||t.disable(),this.plane&&this.scene.remove(this.plane))}show(){var t;(t=this.css3DInstance)==null||t.show(),this.plane&&(this.plane.visible=!0)}hide(){var t;(t=this.css3DInstance)==null||t.hide(),this.plane&&(this.plane.visible=!1)}dispose(){this.disable(),this.css3DRenderer.dispose()}initRectangleScaleHelper(){var a,l;const t=this.getCornerPositions();if(!t)return;this.cornerPositions=t;const i=this.css3DRenderer.create3DElement(this.camera,t,{ratio:.003});if(!i)return;this.css3DInstance=i,i.appendToElement(this.container);const r=i.css3DObject.container,{container:s,squares:o}=FV();this.points=o.map((c,h)=>({direction:c.direction,point:c.element,position:this.calculatePointPosition(t)[h]})),r.insertBefore(s,(a=r.children[0])!=null?a:null),this.helperObject.position.copy(this.originObject3D.position),(l=this.plane)==null||l.position.copy(this.originObject3D.position)}getCornerPositions(){const{originObject3D:t}=this;if(t.isCSS3DObjectPlus)return t.cornerPoints;console.error("当前物体暂时不支持 ScaleHelper")}calculatePointPosition(t){return[t[0].clone(),t[0].clone().add(t[1]).divideScalar(2),t[1].clone(),t[1].clone().add(t[2]).divideScalar(2),t[2].clone(),t[2].clone().add(t[3]).divideScalar(2),t[3].clone(),t[3].clone().add(t[0]).divideScalar(2)]}}class GV extends CV{constructor(t){super(t);v(this,"box");v(this,"outline");v(this,"originObject");v(this,"positionAttribute");this.originObject=t,this.positionAttribute=new C.BufferAttribute(new Float32Array(8*3),3),this.box=this.createBox(),this.outline=this.createOutline(),this.add(this.box,this.outline),this.update()}raycasterIntersectObject(t,i){return t.intersectObject(this,!1,i)}raycast(t,i){this.box.raycast(t,i)}update(){const t=Ga(this.originObject);if(!t)return;const{min:i,max:r}=t;this.positionAttribute.setXYZ(0,r.x,r.y,r.z),this.positionAttribute.setXYZ(1,i.x,r.y,r.z),this.positionAttribute.setXYZ(2,i.x,i.y,r.z),this.positionAttribute.setXYZ(3,r.x,i.y,r.z),this.positionAttribute.setXYZ(4,r.x,r.y,i.z),this.positionAttribute.setXYZ(5,i.x,r.y,i.z),this.positionAttribute.setXYZ(6,i.x,i.y,i.z),this.positionAttribute.setXYZ(7,r.x,i.y,i.z),this.positionAttribute.needsUpdate=!0}createOutline(){const t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new C.BufferGeometry;i.setIndex(new C.BufferAttribute(t,1)),i.setAttribute("position",this.positionAttribute);const r=new C.LineBasicMaterial({color:64767,linewidth:1,opacity:1,toneMapped:!1}),s=new C.LineSegments(i,r);return s.matrixAutoUpdate=!1,s}createBox(){const t=new Uint16Array([0,1,2,0,2,3,0,3,7,0,7,4,0,4,5,0,5,1,6,1,5,6,2,1,6,5,4,6,4,7,6,3,2,6,7,3]),i=new C.BufferGeometry;i.setIndex(new C.BufferAttribute(t,1)),i.setAttribute("position",this.positionAttribute);const r=new C.MeshBasicMaterial({color:64767,opacity:.1,depthTest:!1,transparent:!0});return new C.Mesh(i,r)}}function Rt(e,n){this._camera=e||null,this._domElement=n||document,this._raycaster=new C.Raycaster,this._selected=null,this._boundObjs={};var t=this;this._$onClick=function(){t._onClick.apply(t,arguments)},this._$onDblClick=function(){t._onDblClick.apply(t,arguments)},this._$onMouseMove=function(){t._onMouseMove.apply(t,arguments)},this._$onMouseDown=function(){t._onMouseDown.apply(t,arguments)},this._$onMouseUp=function(){t._onMouseUp.apply(t,arguments)},this._$onTouchMove=function(){t._onTouchMove.apply(t,arguments)},this._$onTouchStart=function(){t._onTouchStart.apply(t,arguments)},this._$onTouchEnd=function(){t._onTouchEnd.apply(t,arguments)},this._$onContextmenu=function(){t._onContextmenu.apply(t,arguments)},this._domElement.addEventListener("click",this._$onClick,!1),this._domElement.addEventListener("dblclick",this._$onDblClick,!1),this._domElement.addEventListener("mousemove",this._$onMouseMove,!1),this._domElement.addEventListener("mousedown",this._$onMouseDown,!1),this._domElement.addEventListener("mouseup",this._$onMouseUp,!1),this._domElement.addEventListener("touchmove",this._$onTouchMove,!1),this._domElement.addEventListener("touchstart",this._$onTouchStart,!1),this._domElement.addEventListener("touchend",this._$onTouchEnd,!1),this._domElement.addEventListener("contextmenu",this._$onContextmenu,!1)}Rt.prototype.destroy=function(){this._domElement.removeEventListener("click",this._$onClick,!1),this._domElement.removeEventListener("dblclick",this._$onDblClick,!1),this._domElement.removeEventListener("mousemove",this._$onMouseMove,!1),this._domElement.removeEventListener("mousedown",this._$onMouseDown,!1),this._domElement.removeEventListener("mouseup",this._$onMouseUp,!1),this._domElement.removeEventListener("touchmove",this._$onTouchMove,!1),this._domElement.removeEventListener("touchstart",this._$onTouchStart,!1),this._domElement.removeEventListener("touchend",this._$onTouchEnd,!1),this._domElement.removeEventListener("contextmenu",this._$onContextmenu,!1)};Rt.eventNames=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","contextmenu","touchstart","touchend"];Rt.prototype._getRelativeMouseXY=function(e){var n=e.target||e.srcElement;n.nodeType===3&&(n=n.parentNode);var t={x:0,y:0},i=n,r=getComputedStyle(i,null);t.y+=parseInt(r.getPropertyValue("padding-top"),10),t.x+=parseInt(r.getPropertyValue("padding-left"),10);do t.x+=i.offsetLeft,t.y+=i.offsetTop,r=getComputedStyle(i,null),t.x+=parseInt(r.getPropertyValue("border-left-width"),10),t.y+=parseInt(r.getPropertyValue("border-top-width"),10);while(i=i.offsetParent);var s={width:n===window?window.innerWidth:n.offsetWidth,height:n===window?window.innerHeight:n.offsetHeight};return{x:Number((e.pageX-t.x)/s.width)*2-1,y:-((e.pageY-t.y)/s.height)*2+1}};Rt.prototype._objectCtxInit=function(e){e._3xDomEvent={}};Rt.prototype._objectCtxDeinit=function(e){delete e._3xDomEvent};Rt.prototype._objectCtxIsInit=function(e){return!!e._3xDomEvent};Rt.prototype._objectCtxGet=function(e){return e._3xDomEvent};Rt.prototype.camera=function(e){return e&&(this._camera=e),this._camera};Rt.prototype.bind=function(e,n,t,i){console.assert(Rt.eventNames.indexOf(n)!==-1,"not available events:"+n),this._objectCtxIsInit(e)||this._objectCtxInit(e);var r=this._objectCtxGet(e);r[n+"Handlers"]||(r[n+"Handlers"]=[]),r[n+"Handlers"].push({callback:t,useCapture:i}),this._boundObjs[n]===void 0&&(this._boundObjs[n]=[]),this._boundObjs[n].push(e)};Rt.prototype.addEventListener=Rt.prototype.bind;Rt.prototype.unbind=function(e,n,t,i){console.assert(Rt.eventNames.indexOf(n)!==-1,"not available events:"+n),this._objectCtxIsInit(e)||this._objectCtxInit(e);var r=this._objectCtxGet(e);r[n+"Handlers"]||(r[n+"Handlers"]=[]);for(var s=r[n+"Handlers"],o=0;o<s.length;o++){var a=s[o];if(t==a.callback&&i==a.useCapture){s.splice(o,1);break}}var l=this._boundObjs[n].indexOf(e);this._boundObjs[n].splice(l,1)};Rt.prototype.removeEventListener=Rt.prototype.unbind;Rt.prototype._bound=function(e,n){var t=this._objectCtxGet(n);return t?!!t[e+"Handlers"]:!1};Rt.prototype._onMove=function(e,n,t,i){var r=this._boundObjs[e];if(!(r===void 0||r.length===0)){var s=new C.Vector2;s.set(n,t),this._raycaster.setFromCamera(s,this._camera);var o=this._raycaster.intersectObjects(r),a=this._selected;if(o.length>0){var l,c,h,u=o[0],d=u.object;this._selected=d,h=this._bound("mousemove",d),a!=d&&(l=this._bound("mouseover",d),c=a&&this._bound("mouseout",a))}else c=a&&this._bound("mouseout",a),this._selected=null;h&&this._notify("mousemove",d,i,u),l&&this._notify("mouseover",d,i,u),c&&this._notify("mouseout",a,i,u)}};Rt.prototype._onEvent=function(e,n,t,i){var r=this._boundObjs[e];if(!(r===void 0||r.length===0)){var s=new C.Vector2;s.set(n,t),this._raycaster.setFromCamera(s,this._camera);var o=this._raycaster.intersectObjects(r,!0);if(o.length!==0){for(var a=o[0],l=a.object,c=this._objectCtxGet(l),h=l.parent;typeof c=="undefined"&&h;)c=this._objectCtxGet(h),h=h.parent;c&&this._notify(e,l,i,a)}}};Rt.prototype._notify=function(e,n,t,i){var r=this._objectCtxGet(n),s=r?r[e+"Handlers"]:null;if(!r||!s||s.length===0){n.parent&&this._notify(e,n.parent,t,i);return}for(var s=r[e+"Handlers"],o=0;o<s.length;o++){var a=s[o],l=!0;a.callback({type:e,target:n,origDomEvent:t,intersect:i,stopPropagation:function(){l=!1}}),l&&a.useCapture===!1&&n.parent&&this._notify(e,n.parent,t,i)}};Rt.prototype._onMouseDown=function(e){return this._onMouseEvent("mousedown",e)};Rt.prototype._onMouseUp=function(e){return this._onMouseEvent("mouseup",e)};Rt.prototype._onMouseEvent=function(e,n){var t=this._getRelativeMouseXY(n);this._onEvent(e,t.x,t.y,n)};Rt.prototype._onMouseMove=function(e){var n=this._getRelativeMouseXY(e);this._onMove("mousemove",n.x,n.y,e),this._onMove("mouseover",n.x,n.y,e),this._onMove("mouseout",n.x,n.y,e)};Rt.prototype._onClick=function(e){this._onMouseEvent("click",e)};Rt.prototype._onDblClick=function(e){this._onMouseEvent("dblclick",e)};Rt.prototype._onContextmenu=function(e){this._onMouseEvent("contextmenu",e)};Rt.prototype._onTouchStart=function(e){return this._onTouchEvent("touchstart",e)};Rt.prototype._onTouchEnd=function(e){return this._onTouchEvent("touchend",e)};Rt.prototype._onTouchMove=function(e){if(e.touches.length==1){var n=Number(e.touches[0].pageX/window.innerWidth)*2-1,t=-(e.touches[0].pageY/window.innerHeight)*2+1;this._onMove("mousemove",n,t,e),this._onMove("mouseover",n,t,e),this._onMove("mouseout",n,t,e)}};Rt.prototype._onTouchEvent=function(e,n){var t=n.touches;if(t.length==0&&(t=n.changedTouches),t.length==1){var i=Number(t[0].pageX/window.innerWidth)*2-1,r=-(t[0].pageY/window.innerHeight)*2+1;this._onEvent(e,i,r,n)}};class jc{constructor(n,t){v(this,"originObject3D");v(this,"hooks");v(this,"preventTapDefaultEvent",!1);v(this,"internalHooks");v(this,"disposers",[]);v(this,"helperObject3D");v(this,"camera");v(this,"model");v(this,"scene");v(this,"container");v(this,"domEvents");v(this,"isDragging",!1);v(this,"enabled",!1);v(this,"name","BaseController");v(this,"boundingBox");v(this,"config");v(this,"onRender");v(this,"onWantsTapGesture",n=>{if(this.getIntersectObject(n))return!1});v(this,"onWantsUpdateCameraDistance",()=>{if(this.camera.isPerspectiveCamera){const n=this.camera;this.helperObject3D.setScaleByCamera(n)}});v(this,"getBox",()=>this.boundingBox?this.boundingBox:(this.boundingBox=Ga(this.originObject3D),this.boundingBox));var h,u,d;this.hooks=(h=n.sharedHooks)!=null?h:new Cn,this.internalHooks=(u=n.sharedInternalHooks)!=null?u:new Cn,this.camera=n.camera,this.model=n.model,this.originObject3D=n.originObject3D,this.helperObject3D=n.helperObject3D,this.container=n.container,this.scene=n.scene,this.domEvents=new Rt(n.camera,n.container),this.onRender=(d=n.onRender)!=null?d:()=>{},this.config=t!=null?t:{},this.initialHelperPosition(),this.initialHelperQuaternion(),this.onWantsUpdateCameraDistance(),this.enable();const i=this.onSetOriginObjectScale.bind(this),r=this.onSetOriginObjectRotate.bind(this),s=this.onSetOriginObjectPosition.bind(this),o=this.onApplyOriginObjectScale.bind(this),a=this.onApplyOriginObjectRotate.bind(this),l=this.onApplyOriginObjectPosition.bind(this),c=this.initialHelperPosition.bind(this);this.internalHooks.on("setObjectPosition",this.onWantsUpdateCameraDistance),this.internalHooks.on("initialHelperPosition",this.onWantsUpdateCameraDistance),this.internalHooks.on("initialHelperPosition",c),this.internalHooks.on("setObjectScale",i),this.internalHooks.on("setObjectRotate",r),this.internalHooks.on("setObjectPosition",s),this.internalHooks.on("applyObjectPosition",l),this.internalHooks.on("applyObjectRotate",a),this.internalHooks.on("applyObjectScale",o),this.disposers.push(()=>{this.internalHooks.off("setObjectPosition",this.onWantsUpdateCameraDistance),this.internalHooks.off("initialHelperPosition",this.onWantsUpdateCameraDistance),this.internalHooks.off("initialHelperPosition",c),this.internalHooks.off("setObjectScale",i),this.internalHooks.off("setObjectRotate",r),this.internalHooks.off("setObjectPosition",s),this.internalHooks.off("applyObjectPosition",l),this.internalHooks.off("applyObjectRotate",a),this.internalHooks.off("applyObjectScale",o)})}initialHelperPosition(){this.helperObject3D.initialPosition(this.calculateOffset(this.config.offset))}initialHelperQuaternion(){var a,l,c;this.helperObject3D.initQuaternion();const n=(a=this.config.xAxis)!=null?a:new C.Vector3(1,0,0),t=(l=this.config.yAxis)!=null?l:new C.Vector3(0,1,0),i=(c=this.config.zAxis)!=null?c:new C.Vector3(0,0,1),r=new C.Quaternion;r.setFromUnitVectors(new C.Vector3(1,0,0),n.normalize());const s=new C.Quaternion;s.setFromUnitVectors(new C.Vector3(0,1,0),t.normalize());const o=new C.Quaternion;o.setFromUnitVectors(new C.Vector3(0,0,1),i.normalize()),this.helperObject3D.quaternion.premultiply(r),this.helperObject3D.quaternion.premultiply(s),this.helperObject3D.quaternion.premultiply(o)}enable(){this.enabled||(this.enabled=!0,this.scene.add(this.helperObject3D),this.helperObject3D.enable(),this.render())}disable(){this.enabled&&(this.enabled=!1,this.helperObject3D.disable(),this.render())}show(){this.helperObject3D.show(),this.render()}hide(){this.helperObject3D.hide(),this.render()}dispose(){var n;(n=this.disposers)==null||n.forEach(t=>t==null?void 0:t()),this.helperObject3D.dispose(),this.render()}applyHelperMatrix4(n){this.helperObject3D.applyMatrix4(n)}applyHelperQuaternion(n,t){this.helperObject3D.applyHelperQuaternion(n,t)}applyHelperScaleMatrix4(n,t){this.helperObject3D.applyHelperScaleMatrix4(n,t)}onWantsGesture(n,t,i){if(this.isDragging)return!1}onIntersectionOnModelUpdate(n){}onApplyOriginObjectScale(n){this.applyHelperScaleMatrix4(n.matrix,n.origin)}onApplyOriginObjectRotate(n){this.applyHelperQuaternion(n.quaternion,n.origin)}onApplyOriginObjectPosition(n){this.applyHelperMatrix4(n.matrix)}onSetOriginObjectScale(n){this.helperObject3D.scale.copy(n),this.updateOffsetByScale(n)}onSetOriginObjectRotate(n,t){this.helperObject3D.setHelperQuaternion(n,t)}onSetOriginObjectPosition(n){this.helperObject3D.position.copy(n.clone().add(this.calculateOffset(this.config.offset)))}render(){this.onRender()}updateOffsetByScale(n){if(this.boundingBox&&this.config.offset){const t=this.originObject3D.position,i=new C.Vector3().subVectors(this.boundingBox.max,t).multiply(n).add(t),r=new C.Vector3().subVectors(this.boundingBox.min,t).multiply(n).add(t),s=this.calculateOffset(this.config.offset,{min:r,max:i});this.helperObject3D.initialPosition(s)}}hoverListener(n,t=16777215,i=1){const r=zr(n).filter(At),s=[];for(const o of r)if(o.material||o instanceof C.Group){const a=o instanceof C.Group?o.children.filter(d=>d instanceof C.Mesh):[o];a.forEach(d=>{d.__originalColor__=d.material.color.clone(),d.__originalOpacity__=d.material.opacity});const l=()=>{a.forEach(d=>{d.material.color.set(t),d.material.opacity=i}),this.render()},c=()=>{a.forEach(d=>{d.material.color.copy(d.__originalColor__),d.material.opacity=d.__originalOpacity__}),this.render()},h=()=>{this.isDragging||l()},u=()=>{this.isDragging||c()};for(const d of a)this.domEvents.addEventListener(d,"mouseover",h),this.domEvents.addEventListener(d,"mouseout",u),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",c),this.hooks.on("rotateEnd",c),s.push(()=>{this.domEvents.removeEventListener(d,"mouseover",h),this.domEvents.removeEventListener(d,"mouseout",u),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",c),this.hooks.off("rotateEnd",c)})}return()=>s.forEach(o=>o==null?void 0:o())}getIntersectObject(n){const t=this.camera.position,i=this.helperObject3D;if(!i)return;const r=this.helperObject3D.raycasterIntersectObject(n)[0];if(!r)return;const s=r;if(s.object=i,this.model.intersectRaycaster){const o=this.model.intersectRaycaster(n)[0];if(o&&o.point.distanceTo(t)<s.point.distanceTo(t))return}return s.object}calculateOffset(n,t){const i=new C.Vector3(0,0,0);if(!n)return i;const r=()=>t||this.getBox();if(typeof n.x=="number")i.setX(n.x);else if(typeof n.x=="object"){const s=r();i.setX((s.max.x-s.min.x)*n.x.percents)}if(typeof n.y=="number")i.setY(n.y);else if(typeof n.y=="object"){const s=r();i.setY((s.max.y-s.min.y)*n.y.percents)}if(typeof n.z=="number")i.setZ(n.z);else if(typeof n.z=="object"){const s=r();i.setZ((s.max.z-s.min.z)*n.z.percents)}return i}}const jV=new C.Vector3;function so(e){var d;const{raycaster:n,line:t,clampToLine:i=!0}=e;if(((d=n.camera)==null?void 0:d.type)==="OrthographicCamera"){const f=n.ray.origin.clone();return t.closestPointToPoint(f,!1,new C.Vector3)}const r=new C.Plane().setFromNormalAndCoplanarPoint(n.ray.direction.clone().normalize(),n.ray.origin),s=r.projectPoint(t.start,new C.Vector3),o=r.projectPoint(t.end,new C.Vector3),a=new C.Line3(s,o),l=a.closestPointToPoint(n.ray.origin,i,jV),c=l.distanceTo(o),h=l.distanceTo(s),u=a.distance();if(c>h&&c>u){const f=-l.distanceTo(s)/u,m=t.start.clone().sub(t.end).normalize();return t.start.sub(m.clone().multiplyScalar(f*t.distance()))}else{const f=l.distanceTo(s)/u;return new C.Vector3().lerpVectors(t.start,t.end,f)}}class HV extends jc{constructor(...t){super(...t);v(this,"name","MoveController");v(this,"startInfo");v(this,"_moveByMouse",{enabled:!1});v(this,"mouseInfo");v(this,"mousedownEventListenerDisposer");v(this,"dragStart",t=>{if(this.moveByMouseEnable||this.isDragging)return;const i=t==null?void 0:t.intersect;if(!i)return this.dragEnd();const r=(i==null?void 0:i.object).direction;if(!r)return this.dragEnd();const s=new C.Vector3(1,0,0).applyQuaternion(this.helperObject3D.quaternion),o=new C.Vector3(0,1,0).applyQuaternion(this.helperObject3D.quaternion),a=new C.Vector3(0,0,1).applyQuaternion(this.helperObject3D.quaternion),l=(()=>{switch(r){case"x":return s;case"y":return o;case"z":return a}})(),c=i.point.clone(),h=new C.Line3(c.clone().sub(l.normalize()),c.clone().add(l.normalize()));this.startInfo={startVectorProject:c,line:h},this.helperObject3D.showDraggingHelper([r]),this.hooks.emit("moveStart"),this.isDragging=!0});v(this,"dragging",t=>{if(!this.isDragging||!this.startInfo)return;const i="touches"in t?t.touches[0].clientX:t.x,r="touches"in t?t.touches[0].clientY:t.y,s=Vd(this.camera,{x:i,y:r},this.container);return s?(this.move(s),!1):this.dragEnd()});v(this,"dragEnd",()=>{this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("moveEnd"))});const i=this.helperObject3D;this.hoverListener([i.xArrow,i.yArrow,i.zArrow]);const r=this.show.bind(this),s=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",this.dragStart),document.addEventListener("mousemove",this.dragging),document.addEventListener("mouseup",this.dragEnd),this.domEvents.addEventListener(this.helperObject3D,"touchstart",this.dragStart),document.addEventListener("touchmove",this.dragging),document.addEventListener("touchend",this.dragEnd),this.hooks.on("rotateStart",s),this.hooks.on("rotateEnd",r),this.hooks.on("scaleStart",s),this.hooks.on("scaleEnd",r),this.hooks.on("moveByMouseEnable",s),this.hooks.on("moveByMouseDisable",r),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",this.dragStart),document.removeEventListener("mousemove",this.dragging),document.removeEventListener("mouseup",this.dragEnd),this.domEvents.removeEventListener(this.helperObject3D,"touchstart",this.dragStart),document.removeEventListener("touchmove",this.dragging),document.removeEventListener("touchend",this.dragEnd),this.hooks.off("rotateStart",s),this.hooks.off("rotateEnd",r),this.hooks.off("scaleStart",s),this.hooks.off("scaleEnd",r),this.hooks.off("moveByMouseEnable",s),this.hooks.off("moveByMouseDisable",r)}),this.moveByMouseEnable&&this.moveByMouse()}get moveByMouseEnable(){return this._moveByMouse.enabled}dispose(){var t;super.dispose(),(t=this.disposers)==null||t.forEach(i=>i==null?void 0:i())}moveByMouse(t){this._moveByMouse={enabled:!0,useFaceNormal:t==null?void 0:t.useFaceNormal},this.preventTapDefaultEvent=!0;const i=this.handleMouseDown.bind(this),r=this.handleMouseUp.bind(this);this.hooks.emit("moveByMouseEnable"),setTimeout(()=>{this.container.addEventListener("mousedown",i),this.container.addEventListener("mouseup",r)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener("mousedown",i),this.container.removeEventListener("mouseup",r)}}disableMoveByMouse(){var t;this._moveByMouse={enabled:!1},this.preventTapDefaultEvent=!1,this.hooks.emit("moveByMouseDisable"),(t=this.mousedownEventListenerDisposer)==null||t.call(this)}onIntersectionOnModelUpdate(t){var o,a,l;if(!this.moveByMouseEnable)return;const{point:i,face:r}=t;if(!this.hooks.emit("wantToMove",i)){if(this.originObject3D.position.copy(i),(this._moveByMouse.useFaceNormal===!0||typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.enable!==!1)&&r!=null&&r.normal){const c=(()=>typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.alignmentVector?this._moveByMouse.useFaceNormal.alignmentVector:{x:0,y:1,z:0})(),h=new C.Vector3((o=c.x)!=null?o:0,(a=c.y)!=null?a:0,(l=c.z)!=null?l:0),u=(()=>typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.fixedFaceNormal?this._moveByMouse.useFaceNormal.fixedFaceNormal(r.normal):r.normal)();this.originObject3D.quaternion.setFromUnitVectors(h,u),this.internalHooks.emit("setObjectRotate",this.originObject3D.quaternion.clone())}this.internalHooks.emit("setObjectPosition",i),this.hooks.emit("move",i)}}handleMouseDown(t){const{x:i,y:r}=t;this.mouseInfo={x:i,y:r,mouseDownTimestamp:Date.now()}}handleMouseUp(t){if(!this.mouseInfo)return;const{x:i,y:r}=t;this.mouseInfo.x===i&&this.mouseInfo.y===r&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}move(t){if(!this.startInfo)return this.dragEnd();const{line:i,startVectorProject:r}=this.startInfo,s=this.originObject3D,o=so({raycaster:t,line:i,clampToLine:!1}),a=o.clone().sub(r),l=new C.Matrix4;l.setPosition(a);const c=s.position.clone().applyMatrix4(l);this.hooks.emit("wantToMove",c)||(s.applyMatrix4(l),r.copy(o),this.internalHooks.emit("applyObjectPosition",{matrix:l}),this.hooks.emit("move",c))}}class bl{constructor(n,t,i,r,s,o,a){v(this,"helperController");v(this,"five");v(this,"onFiveWantsUpdateCameraDistance",()=>{var n,t;this.helperController&&((t=(n=this.helperController).onWantsUpdateCameraDistance)==null||t.call(n))});v(this,"onFiveWantsTapGesture",n=>{if(!this.helperController)return;if(this.helperController.preventTapDefaultEvent)return!1;const t=this.helperController.onWantsTapGesture(n);return this.five.needsRender=!0,t});v(this,"onFiveWantsGesture",(...n)=>{if(!this.helperController)return;const t=this.helperController.onWantsGesture(...n);return this.five.needsRender=!0,t});v(this,"onFiveIntersectionOnModelUpdate",(...n)=>{this.helperController&&this.helperController.onIntersectionOnModelUpdate(...n)});const{camera:l,model:c,scene:h}=n,u=n.getElement();if(this.five=n,!l||!c||!u||!h)return;const d=()=>{n.needsRender=!0};this.helperController=new t({camera:l,model:c,originObject3D:i,helperObject3D:r,container:u,scene:h,onRender:d,sharedHooks:o,sharedInternalHooks:a},s),n.on("wantsTapGesture",this.onFiveWantsTapGesture),n.on("wantsGesture",this.onFiveWantsGesture),n.on("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),n.on("cameraFovUpdate",this.onFiveWantsUpdateCameraDistance),n.on("cameraPositionUpdate",this.onFiveWantsUpdateCameraDistance)}dispose(){var n;this.five.off("wantsTapGesture",this.onFiveWantsTapGesture),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),this.five.off("cameraFovUpdate",this.onFiveWantsUpdateCameraDistance),this.five.off("cameraPositionUpdate",this.onFiveWantsUpdateCameraDistance),(n=this.helperController)==null||n.dispose()}}const UV="v1.0.1",WV="Object3DHelper",$g=`${WV}@${UV}`,QV=()=>{console.error(`${$g} is disposed`)},YV=()=>{console.warn(`${$g} is disabled`)},XV=()=>{console.error(`${$g} is disabled`)};class ZV{constructor(n){v(this,"controllers",{});v(this,"state",{visible:!0,enabled:!0,disposed:!1});v(this,"hooks",new Cn);v(this,"eventListener",{});n&&this.addControllers(n),this.setState(this.state)}show(n){return ee(this,null,function*(){this.setState({visible:!0},n)})}hide(n){return ee(this,null,function*(){this.setState({visible:!1},n)})}enable(n){this.setState({enabled:!0},n)}disable(n){this.setState({enabled:!1},n)}dispose(){this.setState({disposed:!0})}setState(n,t){if(this.state.disposed)return QV();if(!this.state.enabled&&n.enabled!==!0&&n.disposed!==!0)return XV();const i=R({},this.state);this.state=R(R({},this.state),n),n.disposed!==void 0&&n.disposed!==i.disposed&&n.disposed&&this.handleDispose(),n.visible!==void 0&&this.handleVisible(n.visible),n.enabled!==void 0&&this.handleEnable(n.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:i})}addControllers(n){this.controllers=R(R({},this.controllers),n),this.setState(this.state)}getCurrentState(){return this.state}handleEnable(n,t=!0){n?(this.everyControllerDo(i=>{i.enable()}),this.hooks.emit("enable",{userAction:t})):(this.everyControllerDo(i=>{i.disable()}),this.hooks.emit("disable",{userAction:t})),this.state.enabled=n}handleVisible(n,t=!0){n?(this.everyControllerDo(i=>{i.show()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:t}))):(this.everyControllerDo(i=>{i.hide()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:t}))),this.state.visible=n}everyControllerDo(n){Object.values(this.controllers).forEach(t=>{t&&n(t)})}handleDispose(){var n,t;Object.values(this.controllers).forEach(i=>{i==null||i.dispose()});for(const i in this.controllers){if(!i)continue;const r=i;(t=(n=this.eventListener)[r])==null||t.call(n)}}actionIfStateIsEnabled(n,t){if(this.state.enabled)return n();t!=null&&t.warnLog&&YV()}}function gp(e){return e*Math.PI/180}const vp=new C.Quaternion;class JV extends jc{constructor(...t){var c,h,u;super(...t);v(this,"name","RotateController");v(this,"startInfo");v(this,"removeListener");const i=this.helperObject3D;this.hoverListener([(c=i.xCircle)==null?void 0:c.circle,(h=i.yCircle)==null?void 0:h.circle,(u=i.zCircle)==null?void 0:u.circle].filter(Boolean));const r=this.dragStart.bind(this),s=this.dragging.bind(this),o=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",r),document.addEventListener("mousemove",s),document.addEventListener("mouseup",o),this.domEvents.addEventListener(this.helperObject3D,"touchstart",r),document.addEventListener("touchmove",s),document.addEventListener("touchend",o),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",a),this.hooks.on("scaleStart",l),this.hooks.on("scaleEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",r),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",o),this.domEvents.removeEventListener(this.helperObject3D,"touchstart",r),document.removeEventListener("touchmove",s),document.removeEventListener("touchend",o),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",a),this.hooks.off("scaleStart",l),this.hooks.off("scaleEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)})}get rotateCenter(){return this.helperObject3D.position.clone()}setRotateAngle(t){const{x:i=0,y:r=0,z:s=0}=t,o=new C.Euler(gp(i),gp(r),gp(s)),a=new C.Quaternion().setFromEuler(o);if(this.hooks.emit("wantToRotate",a))return;const{originObject3D:c,rotateCenter:h}=this;GM(c,a,h),this.internalHooks.emit("setObjectRotate",a,h),this.hooks.emit("rotate",a),this.render()}onApplyOriginObjectRotate(t){this.isDragging||super.onApplyOriginObjectRotate(t)}onApplyOriginObjectScale(t){}dragStart(t){if(this.isDragging)return;const i=t==null?void 0:t.intersect;if(!i)return this.dragEnd();const r=(i==null?void 0:i.object).direction;if(!r)return this.dragEnd();const s=i.point,o=this.getAngleHelper(r);this.setTipsAngle(0);const a=s.clone();a.y+=.2,this.setTipsPosition(a);const l=this.helperObject3D.quaternion.clone(),c=(()=>{if(r==="x")return new C.Vector3(1,0,0).applyQuaternion(l);if(r==="y")return new C.Vector3(0,1,0).applyQuaternion(l);if(r==="z")return new C.Vector3(0,0,1).applyQuaternion(l)})(),h=new C.Plane().setFromNormalAndCoplanarPoint(c,s),d=h.projectPoint(s.clone(),new C.Vector3).clone().sub(this.rotateCenter),f=d.angleTo(o.baseAxes.clone().applyQuaternion(l));this.setAngleHelperStart(r,f),this.setAngleHelperLength(r,0),this.startInfo={direction:r,startVector:d,plane:h,angleHelper:o,angle:0,helperQuaternion:l.clone()},vp.copy(l),this.helperObject3D.showDraggingHelper([r]),this.hooks.emit("rotateStart"),this.isDragging=!0}dragging(t){if(!this.isDragging)return;const i="touches"in t?t.touches[0].clientX:t.x,r="touches"in t?t.touches[0].clientY:t.y,s=Vd(this.camera,{x:i,y:r},this.container);return s?(this.rotate(s),!1):this.dragEnd()}rotate(t){if(!this.startInfo)return this.dragEnd();const{startVector:i,plane:r,angleHelper:s,direction:o,helperQuaternion:a}=this.startInfo,{originObject3D:l}=this,c=t.ray.intersectPlane(r,new C.Vector3);if(!c)return;const h=this.rotateCenter.clone(),d=r.projectPoint(c.clone(),new C.Vector3).clone().sub(h);if(i.angleTo(d)===0)return;const f=new C.Quaternion().setFromUnitVectors(i.clone().normalize(),d.clone().normalize()),m=l.quaternion.clone().premultiply(f);if(this.hooks.emit("wantToRotate",m))return;const y=new C.Euler().setFromQuaternion(new C.Quaternion().setFromUnitVectors(i.clone().normalize().applyQuaternion(a.clone().inverse()),d.clone().normalize().applyQuaternion(a.clone().inverse())),`${o.toUpperCase()}${"XZY".replace(o.toUpperCase(),"")}`)[o]*s.angleDirection;if(this.startInfo.angle+=y,this.setAngleHelperLength(o,this.startInfo.angle),this.setTipsAngle(Pg(this.startInfo.angle)),h){const b=new C.Vector3().subVectors(l.position,h).applyQuaternion(f).add(h);l.position.copy(b)}l.applyQuaternion(f),vp.premultiply(f),this.internalHooks.emit("applyObjectRotate",{quaternion:f,origin:h}),this.hooks.emit("rotate",l.quaternion),this.startInfo.startVector=d}dragEnd(){this.isDragging&&(this.internalHooks.emit("setObjectRotate",vp,this.rotateCenter),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("rotateEnd"))}getAngleHelper(t){var i,r,s;switch(t){case"x":return(i=this.helperObject3D.xCircle)==null?void 0:i.angleSector;case"y":return(r=this.helperObject3D.yCircle)==null?void 0:r.angleSector;case"z":return(s=this.helperObject3D.zCircle)==null?void 0:s.angleSector}}setAngleHelperStart(t,i){const r=this.getAngleHelper(t);if(!r){console.warn("angleHelper is undefined");return}if(r instanceof C.Mesh&&r.geometry instanceof C.CircleGeometry){const{radius:s,segments:o,thetaLength:a}=r.geometry.parameters;r.geometry=new C.CircleGeometry(s,o,i,a)}else console.warn("only support THREE.CircleGeometry")}setAngleHelperLength(t,i){const s=i>=0?Math.max(i,.001):Math.min(i,-.001),o=this.getAngleHelper(t);if(o instanceof C.Mesh&&o.geometry instanceof C.CircleGeometry){const{radius:a,thetaStart:l}=o.geometry.parameters,c=Math.ceil(Math.abs(s)*(40/(2*Math.PI)));o.geometry=new C.CircleGeometry(a,c,l,s)}else console.warn("only support THREE.CircleGeometry")}setTipsAngle(t){var r;const i=(r=this.helperObject3D.angleTips)==null?void 0:r.element;i&&(i.innerText=`${t.toFixed(0)}°`)}setTipsPosition(t){const i=this.helperObject3D.angleTips;if(!i)return;const r=t.project(this.camera),{x:s,y:o,z:a}=r;if(a>1)return;const l=(s+1)/2*100+"%",c=(-o+1)/2*100+"%";i.setLeftTop(l,c)}}class qV extends jc{constructor(...t){super(...t);v(this,"startInfo");v(this,"name","RectangleScaleController")}enable(){this.helperObject3D.enable(),super.enable()}disable(){this.helperObject3D.disable(),super.disable()}show(){this.helperObject3D.show(),super.show()}hide(){this.helperObject3D.hide(),super.hide()}onApplyOriginObjectPosition(t){this.isDragging||super.onApplyOriginObjectPosition(t)}onApplyOriginObjectScale(t){this.helperObject3D.applyHelperScaleMatrix4(t.matrix,t.origin)}getDragPlane(){const t=new C.Plane,i=this.helperObject3D.cornerPositions;if(i.length!==0)return i.length<3?t.setFromNormalAndCoplanarPoint(this.originObject3D.getWorldDirection(new ne.Vector3),i[0]):t.setFromCoplanarPoints(i[0],i[1],i[2]),t}dragStart(t,i){var s,o;(o=(s=this.helperObject3D).updatePoints)==null||o.call(s);const r=this.getDragPlane();if(!r)return this.dragEnd();this.startInfo={startPoint:{position:i.position.clone(),direction:i.direction},plane:r},this.hooks.emit("scaleStart"),this.render(),this.isDragging=!0}dragging(t){if(!this.isDragging)return;const i=Vd(this.camera,t,this.container);if(!i)return this.dragEnd();this.scale(i)}scale(t){var T,z;if(!this.startInfo)return;const i=this.originObject3D,{startPoint:r,plane:s}=this.startInfo,o=this.helperObject3D.cornerPositions;if(o.length<4)return this.dragEnd();const a=t.ray.intersectPlane(s,new ne.Vector3);if(!a||DV(a,this.camera.position))return;const l=new ne.Vector3().addVectors(o[0],o[2]).divideScalar(2),{position:c,direction:h}=r,u=new ne.Vector3().subVectors(o[1],o[0]),d=new ne.Vector3().subVectors(o[3],o[0]),f=D=>{const k=new ne.Vector3(0,0,0);if(!this.startInfo)return k;const O=(D==="ew"?u:d).clone(),G=c.clone().projectOnVector(O),I=a.clone().projectOnVector(O),U=l.clone().projectOnVector(O);if(I.equals(G))return k;if(D==="ns"&&typeof this.startInfo.dragPointInCenterBottom!="boolean"){const te=new ne.Vector3().subVectors(I,U),ie=te.x<0&&O.x>=0,fe=te.y<0&&O.y>=0,ye=te.z<0&&O.z>=0;this.startInfo.dragPointInCenterBottom=ie||fe||ye}if(D==="ew"&&typeof this.startInfo.dragPointInCenterLeft!="boolean"){const te=new ne.Vector3().subVectors(I,U),ie=te.x<0&&O.x>=0,fe=te.y<0&&O.y>=0,ye=te.z<0&&O.z>=0;this.startInfo.dragPointInCenterLeft=ie||fe||ye}const q=new ne.Vector3().subVectors(I,G),K=q.length();return K>.3?(console.warn("offset.length() > 0.3, skipped",K),k):q},m=f("ew"),p=f("ns"),g=()=>{const D=m;this.helperObject3D.cornerPositions.forEach((k,O)=>{var G;(G=this.startInfo)!=null&&G.dragPointInCenterLeft?(O===0||O===3)&&k.add(D):(O===1||O===2)&&k.add(D)})},y=()=>{const D=p;this.helperObject3D.cornerPositions.forEach((k,O)=>{var G;(G=this.startInfo)!=null&&G.dragPointInCenterBottom?(O===0||O===1)&&k.add(D):(O===2||O===3)&&k.add(D)})};switch(h){case"ew":g();break;case"ns":y();break;case"nesw":case"nwse":g(),y()}const b=new ne.Vector3().subVectors(o[1],o[0]).length()/u.length(),A=new ne.Vector3().subVectors(o[3],o[0]).length()/d.length(),w=new ne.Vector3(b,A,1),x=new C.Matrix4().scale(w);i.isCSS3DObjectPlus?i.applyScaleMatrix4(x):i.scale.applyMatrix4(x),r.position.copy(a);const M=new ne.Vector3().addVectors(o[0],o[2]).divideScalar(2),P=new ne.Vector3().subVectors(M,l),S=new C.Matrix4().setPosition(P);i.applyMatrix4(S),(T=this.helperObject3D.css3DInstance)==null||T.css3DObject.applyMatrix4(S),(z=this.helperObject3D.plane)==null||z.applyMatrix4(S),this.internalHooks.emit("applyObjectScale",{matrix:x}),this.internalHooks.emit("applyObjectPosition",{matrix:S}),this.render()}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.hooks.emit("scaleEnd"),this.render())}}class KV extends qV{constructor(...t){super(...t);v(this,"name","CSS3DScaleController");this.addHTMLEventListener()}addHTMLEventListener(){this.helperObject3D.points.forEach(t=>{if(!t)return;const i=t.point,r=a=>this.dragStart(a,t),s=this.dragging.bind(this),o=this.dragEnd.bind(this);i.addEventListener("dragstart",r),i.addEventListener("drag",s),i.addEventListener("dragend",o)})}}class $V extends jc{constructor(...t){super(...t);v(this,"name","BoundingBoxController")}}class e8 extends _V{constructor(t,i){super(t,i);v(this,"scaleMeshes",[]);v(this,"positions",[]);i&&(this.positions=i.positions)}initialPosition(t){this.position.copy(this.originObject3D.position),this.scaleMeshes.length&&this.remove(...this.scaleMeshes);const i=typeof this.positions=="function"?this.positions():this.positions;i&&(this.scaleMeshes=i.map(r=>{const s=t8();return s.position.copy(r.handlePosition),s.scalePosition=r,s}),this.add(...this.scaleMeshes))}setScaleByCamera(t){this.scaleMeshes.forEach(i=>{i.scale.setScalar(Kg(t,i.scalePosition.handlePosition.clone().applyMatrix4(this.matrixWorld)))})}}function t8(){const n=new C.BoxGeometry(.05,.05,.05),t=new C.MeshBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1,transparent:!0,side:C.DoubleSide}),i=new C.Mesh(n,t);return i.renderOrder=10,i}class n8 extends jc{constructor(...t){super(...t);v(this,"name","ScaleController");v(this,"startInfo");v(this,"dragStart",t=>{if(this.isDragging)return;this.isDragging=!0;const{intersect:i}=t,r=this.camera.position,s=i.object,o=s.scalePosition.basePosition.clone(),l=s.scalePosition.handlePosition.clone().clone().sub(o).clone(),c=new C.Line3(o,o.clone().add(l.normalize().multiplyScalar(5)));c.applyMatrix4(this.helperObject3D.matrixWorld);const h=new C.Raycaster(r,i.point.clone().sub(r)),u=so({raycaster:h,line:c});this.startInfo={line:c,scaleStartPoint:u,draggingObject:s},this.hooks.emit("scaleStart")});v(this,"dragging",t=>{if(!this.isDragging||!this.startInfo)return;const i="touches"in t?t.touches[0].clientX:t.x,r="touches"in t?t.touches[0].clientY:t.y,s=Vd(this.camera,{x:i,y:r},this.container);return s?(this.scale(s),!1):this.dragEnd()});v(this,"scale",t=>{var c,h;if(!this.startInfo)return;const{line:i,scaleStartPoint:r,draggingObject:s}=this.startInfo,{scalePosition:o}=s,{basePosition:a}=o,l=so({raycaster:t,line:i});l.applyMatrix4(new C.Matrix4().getInverse(this.helperObject3D.matrixWorld.clone())),(h=(c=this.config)==null?void 0:c.scaleCallback)==null||h.call(c,{ratio:l.distanceTo(a)/r.distanceTo(a),intersectPoint:l,scalePosition:o}),s.position.copy(l.clone())});v(this,"dragEnd",()=>{this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.internalHooks.emit("initialHelperPosition"),this.hooks.emit("scaleEnd"))});const i=this.show.bind(this),r=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",this.dragStart),document.addEventListener("mousemove",this.dragging),document.addEventListener("mouseup",this.dragEnd),this.domEvents.addEventListener(this.helperObject3D,"touchstart",this.dragStart),document.addEventListener("touchmove",this.dragging),document.addEventListener("touchend",this.dragEnd),this.hooks.on("rotateStart",r),this.hooks.on("rotateEnd",i),this.hooks.on("moveStart",r),this.hooks.on("moveEnd",i),this.hooks.on("moveByMouseEnable",r),this.hooks.on("moveByMouseDisable",i),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",this.dragStart),document.removeEventListener("mousemove",this.dragging),document.removeEventListener("mouseup",this.dragEnd),this.domEvents.removeEventListener(this.helperObject3D,"touchstart",this.dragStart),document.removeEventListener("touchmove",this.dragging),document.removeEventListener("touchend",this.dragEnd),this.hooks.off("rotateStart",r),this.hooks.off("rotateEnd",i),this.hooks.off("moveStart",r),this.hooks.off("moveEnd",i),this.hooks.off("moveByMouseEnable",r),this.hooks.off("moveByMouseDisable",i)})}initialHelperQuaternion(){this.helperObject3D.initQuaternion()}initialHelperPosition(){this.helperObject3D.initialPosition();const t=this;t.offHoverListener&&t.offHoverListener(),t.offHoverListener=this.hoverListener(this.helperObject3D.scaleMeshes)}setScale(t){var l,c,h;let i=1,r=1,s=1;typeof t=="number"?(i=t,r=t,s=t):typeof t=="object"&&(i=(l=t.x)!=null?l:1,r=(c=t.y)!=null?c:1,s=(h=t.z)!=null?h:1);const o=new C.Vector3(i,r,s);this.hooks.emit("wantToScale",o)||(this.originObject3D.scale.copy(o),this.internalHooks.emit("setObjectScale",o),this.hooks.emit("scale",o),this.render())}}const jm="Object3DHelperPlugin",Gd=jm,i8=()=>{console.error(`${Gd} is disposed`)},r8=()=>{console.warn(`${Gd} is disabled`)},s8=()=>{console.error(`${Gd} is disabled`)};class ev extends ws{constructor(t){super(t);v(this,"name",jm);v(this,"state",{visible:!0,enabled:!0,disposed:!1});v(this,"objectHelperMap",new Map);v(this,"css3DObjectParentMap",new Map);v(this,"css3DRender");this.five=t,this.css3DRender=new Ia(this.five.scene),console.warn("Object3DHelper: 使用此插件,需要在初始化five时,设置five参数: { backgroundAlpha: 0, backgroundColor: 0x000000 }"),Object.assign(window,{[`__${jm.toUpperCase()}_DEBUG__`]:this})}show(t){return ee(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return ee(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.setState({disposed:!0})}setState(t,i){if(this.state.disposed)return i8();if(!this.state.enabled&&t.enabled!==!0&&t.disposed!==!0)return s8();const r=R({},this.state);this.state=R(R({},this.state),t),t.disposed!==void 0&&t.disposed!==r.disposed&&t.disposed&&this.handleDispose(),t.visible!==void 0&&t.visible!==r.visible&&this.handleVisible(t.visible),t.enabled!==void 0&&t.enabled!==r.enabled&&this.handleEnable(t.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:r})}getObject3DHelper(t){return this.objectHelperMap.get(t)}addObject3DHelper(t,i={}){var y;if(!t){console.error("Object3D is undefined");return}if(this.objectHelperMap.has(t)){console.warn(`Object3DHelperPlugin: object3D ${t.name} is already has helper`);return}const r=new ZV,s=[],o=(y=this.five.getElement())==null?void 0:y.parentElement,a=this.five.camera,c=R(R({},{moveHelper:!0,rotateHelper:!0,scaleHelper:!0,boundingBoxHelper:!1,positionFrom:"objectPosition"}),i),{moveHelper:h,rotateHelper:u,scaleHelper:d,boundingBoxHelper:f}=c,m=new Cn,p=new Cn,g=b=>{if(b)return typeof b=="boolean"?b:b.enable};if(g(h)){const b=R(R({},this.getConfig(c.moveHelper)),c),A=new LV(t,R({},b)),w=new bl(this.five,HV,t,A,b,m,p);r.addControllers({moveController:w.helperController}),s.push(()=>w.dispose())}if(g(u)){const b=R(R({},this.getConfig(c.rotateHelper)),c),A=new OV(t,R({container:o},b)),w=new bl(this.five,JV,t,A,b,m,p);r.addControllers({rotateController:w.helperController}),s.push(()=>w.dispose())}if(g(f)){const b=new GV(t),A=new bl(this.five,$V,t,b,void 0,m,p);r.addControllers({boundingBoxController:A.helperController})}if(g(d))if(t.isCSS3DObjectPlus&&o){const b=new VV(t,o,a,this.five.scene),A=new bl(this.five,KV,t,b,void 0,m,p);r.addControllers({scaleController:A.helperController}),s.push(()=>A.dispose()),Ha(this.five).then(()=>{var w,x;if(t.isCSS3DObjectPlus){const M=t;if(!M||M.mode!=="front")return;const P=(w=this.css3DRender.behindModeCSS3DRenderer.wrapper)!=null?w:sx(this.five);P&&(this.css3DObjectParentMap.set(M,M.parent),M.removeFromParent(),this.css3DRender.behindModeCSS3DRenderer.setWrapper(P),(x=this.css3DRender.getBehindCSS3DObjectGroup())==null||x.add(M),this.css3DRender.render(this.five.camera))}})}else{const b=R(R({},this.getConfig(c.scaleHelper)),c),A=new e8(t,b),w=new bl(this.five,n8,t,A,b,m,p);r.addControllers({scaleController:w.helperController}),s.push(()=>w.dispose())}return this.objectHelperMap.set(t,{helper:r,disposers:s}),r.controllers}removeObject3DHelper(t){if(!this.objectHelperMap.has(t))return;const{helper:i,disposers:r}=this.objectHelperMap.get(t);if(i){if(t.isCSS3DObjectPlus){const s=t,o=this.css3DObjectParentMap.get(s);o&&o.add(s),this.css3DRender.render(this.five.camera)}this.objectHelperMap.delete(t),i.dispose(),r==null||r.forEach(s=>s==null?void 0:s())}}handleEnable(t,i=!0){t?(this.everyHelperDo(r=>r.enable()),this.hooks.emit("enable",{userAction:i})):(this.everyHelperDo(r=>r.disable()),this.hooks.emit("disable",{userAction:i})),this.state.enabled=t}handleVisible(t,i=!0){t?(this.everyHelperDo(r=>r.show()),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:i}))):(this.everyHelperDo(r=>r.hide()),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:i}))),this.state.visible=t}handleDispose(){this.everyHelperDo((t,i)=>{t.dispose(),i==null||i.forEach(r=>r==null?void 0:r())})}everyHelperDo(t){this.objectHelperMap.forEach(({helper:i,disposers:r})=>{i&&t(i,r)})}actionIfStateIsEnabled(t,i){if(this.state.enabled)return t();i!=null&&i.warnLog&&r8()}getConfig(t){if(t&&typeof t!="boolean"&&t.enable)return t}}const o8=e=>new ev(e),a8=`
3704
+ `;class Vm{constructor(n,t){v(this,"name","");v(this,"startTagContainer");v(this,"endTagContainer");v(this,"path",[]);v(this,"geometryStyle",{});v(this,"materialStyle",{});v(this,"meshStyle",{});v(this,"group",new C.Group);v(this,"meshWithDepthTest");v(this,"meshWithoutDepthTest");v(this,"five");v(this,"mode");v(this,"_curvePath",null);v(this,"_curvePoints",null);v(this,"_panoGroup",[]);v(this,"skippedPositions",null);v(this,"textureUrl","");v(this,"scale",1);v(this,"width",.5);v(this,"unitLength",.5);v(this,"_visibleFloorIndexes",null);v(this,"visible",null);v(this,"modeVisible",!1);v(this,"floorVisible",!0);v(this,"defaultVisible",!1);v(this,"inWalkAnimation",!1);v(this,"customVisible",null);v(this,"parent");v(this,"plugin");v(this,"textureHasLoaded",!1);v(this,"disposed",!1);v(this,"flowAnime",new Pa({progress:0}).to({progress:1}).duration(1500).repeat(1/0));v(this,"cacheLengths",[]);v(this,"heightOffset",0);v(this,"panoMap",{});v(this,"autoDepthTestEffectDistance");v(this,"dispose",()=>{var n,t;this.disposed||(this.disposed=!0,this.parent.hooks.off("show",this.updateVisible),this.parent.hooks.off("hide",this.updateVisible),this.plugin.hooks.off("show",this.updateVisible),this.plugin.hooks.off("hide",this.updateVisible),this.plugin.hooks.off("enable",this.updateVisible),this.plugin.hooks.off("disable",this.updateVisible),this.five.off("modeChange",this.onFiveModeChange),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("modelShownFloorChange",this.onFiveModelShownFloorChange),this.doHide(),(n=this.startTagContainer)==null||n.plugin.dispose(),(t=this.endTagContainer)==null||t.plugin.dispose())});v(this,"onWalkAnimationStart",()=>{this.inWalkAnimation=!0,this.updateVisible()});v(this,"onWalkAnimationEnd",()=>{this.inWalkAnimation=!1,this.updateVisible()});v(this,"onFiveModeChange",n=>{this.modeVisible=this.mode==="panorama"?Fs(n):_i(n),this.updateVisible()});v(this,"onFivePanoArrived",n=>{var r,s,o,a,l,c;const t=(o=(s=(r=this.path)==null?void 0:r[0])==null?void 0:s.panoIndexMap)==null?void 0:o[n],i=this.panoMap[t!=null?t:n];if(i===void 0)this.group.children.includes(this.meshWithoutDepthTest)&&this.group.remove(this.meshWithoutDepthTest),this.meshWithDepthTest.material.uniforms.excludeMinV.value=-1,this.meshWithDepthTest.material.uniforms.excludeMaxV.value=-1;else{this.group.children.includes(this.meshWithoutDepthTest)||this.group.add(this.meshWithoutDepthTest),this.meshWithoutDepthTest.visible=!0;const h=this.meshWithDepthTest.geometry.getAttribute("uv"),u=100*((a=this.autoDepthTestEffectDistance)!=null?a:2),d=(l=h.getY((i-u)*2))!=null?l:0,f=(c=h.getY((i+u)*2))!=null?c:h.getY(h.count-1);this.meshWithDepthTest.material.uniforms.excludeMinV.value=d,this.meshWithDepthTest.material.uniforms.excludeMaxV.value=f,this.meshWithoutDepthTest.material.uniforms.includeMinV.value=d,this.meshWithoutDepthTest.material.uniforms.includeMaxV.value=f}this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0});v(this,"onFiveModelShownFloorChange",n=>{this.floorVisible=n===null||this.visibleFloorIndexes===null||this.visibleFloorIndexes.includes(n),this.updateVisible()});v(this,"updateVisible",()=>{const n=(()=>!this.parent.visible||!this.plugin.state.enabled||!this.plugin.state.visible?!1:this.customVisible!==null?this.customVisible:this.inWalkAnimation?!0:this.modeVisible&&this.textureHasLoaded&&this.defaultVisible&&this.floorVisible)();this.visible!==n&&(this.visible=n,n?this.doShow():this.doHide())});v(this,"onFlowAnimeUpdate",n=>{const{progress:t}=n;this.meshWithDepthTest.material.uniforms.vOffset.value=t,this.meshWithoutDepthTest.material.uniforms.vOffset.value=t,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0});v(this,"logError",n=>iM("GuideLineModeItem: ",n));var s,o;this.five=n,this.mode=t.mode,this.plugin=t.plugin,this.parent=t.parent,this.group.name="GuideLineModeItem";const i=new C.BufferGeometry,r=new C.ShaderMaterial({vertexShader:oV,fragmentShader:aV,transparent:!0,uniforms:{map:{value:null},useMapColor:{value:0},mapColor:{value:new C.Color},mapOpacity:{value:1},backgroundColor:{value:new C.Color},backgroundOpacity:{value:0},borderColor:{value:new C.Color},borderOpacity:{value:0},backgroundClip:{value:0},borderWidth:{value:.05},opacity:{value:1},flicker:{value:1},maxV:{value:0},vOffset:{value:0},includeMinV:{value:-1},includeMaxV:{value:-1},excludeMinV:{value:-1},excludeMaxV:{value:-1}}});this.meshWithDepthTest=new C.Mesh(i,r),this.meshWithoutDepthTest=new C.Mesh(i,r.clone()),this.meshWithoutDepthTest.material.depthTest=!1,this.meshWithDepthTest.name="GuideLineModeItemWithDepthTest",this.meshWithoutDepthTest.name="GuideLineModeItemWithoutDepthTest",this.group.add(this.meshWithDepthTest),this.mode==="panorama"&&(this.parent.hooks.on("walkStart",this.onWalkAnimationStart),this.parent.hooks.on("walkEnded",this.onWalkAnimationEnd),this.onFivePanoArrived(this.five.getCurrentState().panoIndex)),this.updateVisible(),this.onFiveModeChange(this.five.getCurrentState().mode),this.onFiveModelShownFloorChange((o=(s=this.five.model)==null?void 0:s.shownFloor)!=null?o:null),this.flowAnime.onUpdate(this.onFlowAnimeUpdate),this.parent.hooks.on("show",this.updateVisible),this.parent.hooks.on("hide",this.updateVisible),this.plugin.hooks.on("show",this.updateVisible),this.plugin.hooks.on("hide",this.updateVisible),this.plugin.hooks.on("enable",this.updateVisible),this.plugin.hooks.on("disable",this.updateVisible),this.plugin.hooks.on("dispose",this.dispose),this.five.on("modeChange",this.onFiveModeChange),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("modelShownFloorChange",this.onFiveModelShownFloorChange),this.five.needsRender=!0}get panoGroup(){return this._panoGroup}get visibleFloorIndexes(){return this._visibleFloorIndexes}get curvePath(){return this._curvePath}get curvePoints(){return this._curvePoints}setCustomVisible(n){if(this.disposed)return this.logError("disposed");this.customVisible!==n&&(this.customVisible=n,this.updateVisible())}setDefaultVisible(n){if(this.disposed)return this.logError("disposed");this.defaultVisible!==n&&(this.defaultVisible=n,this.updateVisible())}setUnitSize(n,t){if(this.disposed)return this.logError("disposed");this.width=n,this.unitLength=t,this.setGeometryByPath(this.path,{width:n,unit_length:t})}setScale(n){if(this.disposed)return this.logError("disposed");this.scale=n,this.setGeometryByPath(this.path,{scale:n})}setGeometryByPanoGroup(n,t){if(this.disposed)return this.logError("disposed");if(!this.five.work)return this.logError("setPathByPanoGroup: work is not ready");const i=sV(n);if(this._panoGroup=i,(t==null?void 0:t.skipPanoGroup)!==void 0){const s=t.skipPanoGroup?i.map(o=>this.plugin.workUtil.getObserverStandingPosition(o)).filter(At):null;this.skippedPositions=s}const r=this.getPathFromPanoGroup(i,this.five.work,t);this.path=r,this.setGeometryByPath(r,t)}setGeometryByPath(n,t){var d,f,m,p;if(this.disposed)return this.logError("disposed");const i=(d=t==null?void 0:t.scale)!=null?d:this.scale,r=(f=t==null?void 0:t.width)!=null?f:this.width,s=(m=t==null?void 0:t.unit_length)!=null?m:this.unitLength;this.scale=i,this.width=r,this.unitLength=s;const{geometry:o,maxV:a,curvePath:l,curvePoints:c,panoMap:h,totalLength:u}=xO({path:n,width:r*i,unitLength:s*i,skipPositions:this.skippedPositions,useAutoDepthTest:t.useAutoDepthTest});this.autoDepthTestEffectDistance=(p=t.autoDepthTestEffectDistance)!=null?p:(()=>{const g=u/10;return g>3?3:g<1?1:g})(),this.panoMap=h,this._curvePath=l,this._curvePoints=c,this.meshWithDepthTest.geometry.copy(o),this.onFivePanoArrived(this.five.getCurrentState().panoIndex),this.meshWithDepthTest.material.needsUpdate=!0,this.meshWithDepthTest.material.uniforms.maxV.value=a,this.meshWithoutDepthTest.material.needsUpdate=!0,this.meshWithoutDepthTest.material.uniforms.maxV.value=a,this.five.needsRender=!0,this.path=n,this.geometryStyle=R(R({},this.geometryStyle),t)}setMartial(n){var i,r,s,o,a;if(this.disposed)return this.logError("disposed");this.setDefaultVisible((i=n==null?void 0:n.visible)!=null?i:!1),this.setColor((r=n==null?void 0:n.color)!=null?r:"#ffffff"),this.setOpacity((s=n==null?void 0:n.opacity)!=null?s:.5),this.setTextureUrl((a=(o=n==null?void 0:n.texture)==null?void 0:o.url)!=null?a:"https://vr-image-4.realsee-cdn.cn/release/web/arrow1.ebe7d0ff.png"),(n==null?void 0:n.background_color)!==void 0&&this.setBackgroundColor(n.background_color),(n==null?void 0:n.background_opacity)!==void 0&&this.setBackgroundOpacity(n.background_opacity),(n==null?void 0:n.border_color)!==void 0&&this.setBorderColor(n.border_color),(n==null?void 0:n.border_opacity)!==void 0&&this.setBorderOpacity(n.border_opacity),(n==null?void 0:n.border_width)!==void 0&&this.setBorderWidth(n.border_width),(n==null?void 0:n.background_clip)!==void 0&&this.setBackgroundClip(n.background_clip);const t=R(R({},this.materialStyle),n);this.materialStyle=t}setMeshStyle(n){if(n!=null&&n.translate){const r=new C.Vector3,s=new C.Vector3().fromArray(n.translate);s.y+=this.heightOffset,r.add(s),this.group.position.copy(r),i(this.startTagContainer,s),i(this.endTagContainer,s)}const t=R(R({},this.meshStyle),n);this.meshStyle=t;function i(r,s){if(!(r!=null&&r.tag))return;const o=new C.Vector3().fromArray(r.tag.position);o.add(s);const a=o.toArray();r.plugin.changeTagById(r.tag.id,{position:a})}}setHeightOffset(n){const t=new C.Vector3;this.meshStyle.translate&&t.add(new C.Vector3().fromArray(this.meshStyle.translate)),t.setY(t.y+n),this.group.position.copy(t),this.heightOffset=n,this.five.needsRender=!0}setColor(n){if(this.disposed)return this.logError("disposed");n&&(this.meshWithDepthTest.material.uniforms.mapColor.value=new C.Color().set(n),this.meshWithoutDepthTest.material.uniforms.mapColor.value=new C.Color().set(n)),this.meshWithDepthTest.material.uniforms.useMapColor.value=n?1:0,this.meshWithoutDepthTest.material.uniforms.useMapColor.value=n?1:0,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderColor(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.borderColor.value=new C.Color().set(n),this.meshWithoutDepthTest.material.uniforms.borderColor.value=new C.Color().set(n),this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderOpacity(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.borderOpacity.value=n,this.meshWithoutDepthTest.material.uniforms.borderOpacity.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundClip(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.backgroundClip.value=n==="border-box"?0:1,this.meshWithoutDepthTest.material.uniforms.backgroundClip.value=n==="border-box"?0:1,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBorderWidth(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.borderWidth.value=n,this.meshWithoutDepthTest.material.uniforms.borderWidth.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundColor(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.backgroundColor.value=new C.Color().set(n),this.meshWithoutDepthTest.material.uniforms.backgroundColor.value=new C.Color().set(n),this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setBackgroundOpacity(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.backgroundOpacity.value=n,this.meshWithoutDepthTest.material.uniforms.backgroundOpacity.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setOpacity(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.opacity.value=n,this.meshWithoutDepthTest.material.uniforms.opacity.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setMapOpacity(n){if(this.disposed)return this.logError("disposed");this.meshWithDepthTest.material.uniforms.mapOpacity.value=n,this.meshWithoutDepthTest.material.uniforms.mapOpacity.value=n,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.five.needsRender=!0}setTextureUrl(n){if(this.disposed)return this.logError("disposed");this.textureUrl=n,Us(n).then(t=>{this.disposed||this.textureUrl===n&&(t.wrapT=C.RepeatWrapping,this.textureHasLoaded=!0,this.meshWithDepthTest.material.uniforms.map.value=t,this.meshWithoutDepthTest.material.uniforms.map.value=t,this.meshWithDepthTest.material.uniformsNeedUpdate=!0,this.meshWithoutDepthTest.material.uniformsNeedUpdate=!0,this.meshWithDepthTest.material.needsUpdate=!0,this.meshWithoutDepthTest.material.needsUpdate=!0,this.five.needsRender=!0,this.updateVisible())})}setVisibleFloorIndexes(n){var t,i;if(this.disposed)return this.logError("disposed");this._visibleFloorIndexes=n,this.onFiveModelShownFloorChange((i=(t=this.five.model)==null?void 0:t.shownFloor)!=null?i:null)}setStartTag(n){this.setTag("start",n)}setEndTag(n){this.setTag("end",n)}flicker(){var n,t,i,r,s,o;if(this.disposed)return this.logError("disposed");Td([this.group,(i=(t=(n=this.startTagContainer)==null?void 0:n.plugin)==null?void 0:t.tags[0])==null?void 0:i.dom,(o=(s=(r=this.endTagContainer)==null?void 0:r.plugin)==null?void 0:s.tags[0])==null?void 0:o.dom],{loop:6,updateRender:()=>{this.five.needsRender=!0}})}getLengthByPanoGroupIndex(n){return this.disposed?this.logError("disposed"):this.cacheLengths.length!==0?this.cacheLengths[n]:(this.cacheLengths=this.getPanoGroupLengths(),this.cacheLengths[n])}getPanoGroupLengths(){var l;if(!this.curvePoints||!this.curvePath)return[];const n=this.curvePoints.length,t=this.curvePath.getLength(),i=n-1,r=t/i,s=(l=this.curvePath.getLengths(i))!=null?l:[],o=[];let a=0;for(let c=0;c<n;c++){const h=this.curvePoints[c],u=this.plugin.workUtil.getObserverStandingPosition(a);if(!u)break;u.clone().setY(0).distanceTo(h.clone().setY(0))<r&&(o.push(s[c]),a+=1)}return o}setTag(n,t){var l,c;const i=this.curvePath;if(!(t!=null&&t.data))return;const r=n==="start"?(l=this.startTagContainer)!=null?l:(()=>(this.startTagContainer={tag:null,plugin:new fd(this.five,{containerZIndex:1})},this.startTagContainer))():(c=this.endTagContainer)!=null?c:(()=>(this.endTagContainer={tag:null,plugin:new fd(this.five,{containerZIndex:1})},this.endTagContainer))(),o=jt({},{contentType:"Custom",stickType:"2DPoint",config:{visibleConfig:{visibleFiveMode:["Floorplan","Mapview"],followModelVisibility:!1}},style:{point:{enabled:!1}},data:{}},t);r.tag=o,lV(o)&&(r.tag.element=h=>{var f,m;(f=r.app)==null||f.$destroy();const u=n==="start"?Ee(R({},o.data),{name:this.name,distance:Math.round((m=i.getLength())!=null?m:0),i18n:this.plugin.config.i18n}):o.data,d=new rV({target:h,intro:!0,props:u});return r.app=d,()=>d.$destroy()}),r.plugin.load({tagList:[r.tag]});const a=this.meshStyle.translate;if(a&&o.position){const h=new C.Vector3().fromArray(o.position),u=new C.Vector3().fromArray(a);h.add(u),h.y+=this.heightOffset;const d=h.toArray();r.plugin.changeTagById(r.tag.id,{position:d})}}doShow(){var n,t;this.mode==="model"&&this.flowAnime.play(),this.five.scene.add(this.group),(n=this.startTagContainer)==null||n.plugin.show(),(t=this.endTagContainer)==null||t.plugin.show(),this.five.needsRender=!0}doHide(){var n,t;this.mode==="model"&&this.flowAnime.stop(),this.five.scene.remove(this.group),(n=this.startTagContainer)==null||n.plugin.hide(),(t=this.endTagContainer)==null||t.plugin.hide(),this.five.needsRender=!0}getPathFromPanoGroup(n,t,i){if(n.length<2)return[];const r={},s=n.map((l,c)=>{const h=this.plugin.workUtil.getObserverStandingPosition(l);if(!h)return;const u=n[c-1];if((c===0?999:h.distanceTo(this.plugin.workUtil.getObserverStandingPosition(u)))<.05){let f=u;for(;r[f]!==void 0;)f=r[f];r[l]=f;return}return{position:h,panoIndex:l}}).filter(At),o=s.map(l=>l.position.toArray()),a=s.map(l=>l.panoIndex);return[Ee(R({type:"CatmullRomCurve3",points:o},i),{panoIndexList:a,panoIndexMap:r})]}}function lV(e){return e.contentType==="Custom"}const cV=Object.freeze(Object.defineProperty({__proto__:null,GuideLineModeItem:Vm},Symbol.toStringTag,{value:"Module"})),NM="CruisePlugin",up=`${NM}`;class FM extends ws{constructor(t,i){super(t,i);v(this,"state",{visible:!0,enabled:!0,disposed:!1,playing:!1,speed:1});v(this,"data");v(this,"config");v(this,"pauseDataMap",new Map);v(this,"privateState",{playing:!1,broke:!1,modeChanging:!1});v(this,"GuideLine");v(this,"disposedErrorLog",()=>{console.error(`${up} is disposed`)});v(this,"disableWarnLog",()=>{console.warn(`${up} is disabled`)});v(this,"disableErrorLog",()=>{console.error(`${up} is disabled`)});this.config=i,Object.assign(window,{[`__${NM}_DEBUG__`]:this})}play(t){this.setState({playing:!0},t)}pause(t){this.setState({playing:!1},t)}show(t){return ee(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return ee(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.setState({disposed:!0})}setState(t,i){var s;if(this.state.disposed)return this.disposedErrorLog();if(!this.state.enabled&&t.enabled!==!0&&t.disposed!==!0)return this.disableErrorLog();const r=R({},this.state);this.state=jt({},this.state,t),t.disposed!==void 0&&t.disposed!==r.disposed&&t.disposed&&this.handleDispose(),t.visible!==void 0&&t.visible!==r.visible&&this.handleVisible(t.visible,i==null?void 0:i.userAction),t.enabled!==void 0&&t.enabled!==r.enabled&&this.handleEnable(t.enabled,i==null?void 0:i.userAction),t.playing!==void 0&&t.playing!==r.playing&&this.changePlayState(t.playing,i),t.speed!==void 0&&t.speed!==r.speed&&this.changeSpeed(t.speed),Nn(r,this.state,{deep:!0})||this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:(s=i==null?void 0:i.userAction)!=null?s:!0})}clearPauseData(){var t,i;if((t=this.data)!=null&&t.id)return this.pauseDataMap.delete((i=this.data)==null?void 0:i.id)}changePlayState(t,i){this.actionIfStateIsEnabled(()=>{var r;return this.hooks.emit("playStateChange",t?"playing":"pause",{userAction:(r=i==null?void 0:i.userAction)!=null?r:!0})}),t?this.handlePlay(i):this.handlePause(i),this.state.playing=t}handleEnable(t,i=!0){var r,s;t?((r=this.GuideLine)==null||r.enable(),this.hooks.emit("enable",{userAction:i})):((s=this.GuideLine)==null||s.disable(),this.changePlayState(!1,{userAction:i}),this.hooks.emit("disable",{userAction:i})),this.state.enabled=t}handleVisible(t,i=!0){var r,s;t?((r=this.GuideLine)==null||r.show(),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:i}))):((s=this.GuideLine)==null||s.hide(),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:i}))),this.state.visible=t}addInterruptListener(t){const i=()=>{this.privateState.modeChanging||t()},r=s=>{s!=="mouseMove"&&(t(),this.five.off("gesture",r))};return this.five.on("gesture",r),this.five.once("wantsChangeMode",i),()=>{this.five.off("gesture",r),this.five.off("wantsChangeMode",i)}}getSpeededDuration(t){return t/this.state.speed}forceInteruptUpdateCamera(){this.five.updateCamera({},0)}getPauseData(){var t;if((t=this.data)!=null&&t.id)return this.pauseDataMap.get(this.data.id)}setPauseData(){var i;const t=(i=this.data)==null?void 0:i.id;if(t)return this.pauseDataMap.set(t,{fiveState:this.five.getCurrentState(),playedProgress:this.getProgress()})}clear(){this.clearPauseData()}handleDispose(){var t;this.setState({playing:!1}),this.clearPauseData(),this.clear(),(t=this.GuideLine)==null||t.dispose(),this.GuideLine=void 0}actionIfStateIsEnabled(t,i){if(this.state.enabled)return t();i!=null&&i.warnLog&&this.disableWarnLog()}}function dp(e,n,t){var l,c,h;const i=new C.Vector3().fromArray([(l=t.x)!=null?l:0,(c=t.y)!=null?c:0,(h=t.z)!=null?h:0]),r=e.getPointAt(n).clone().add(i),s=e.getTangentAt(n),{longitude:o,latitude:a}=Oc(s);return{offset:r.clone(),longitude:o,latitude:a,distance:0}}let Jg=class extends FM{constructor(t,i){var o;super(t,i);v(this,"curve");v(this,"baseCurveOffset");v(this,"curveOffset");v(this,"playStartedTime",performance.now());v(this,"duration");v(this,"changeSpeed",(t,i=!0)=>{this.state.speed=t,this.hooks.emit("speedChange",t,{userAction:i})});v(this,"moveToStart",()=>{this.five.setState(Ee(R({},dp(this.curve,0,this.curveOffset)),{mode:"Model"}))});v(this,"playFromStart",()=>{this.clearPauseData(),this.setState({playing:!0})});v(this,"getDuration",()=>this.getSpeededDuration(this.duration));v(this,"getProgress",()=>{var l;const t=this.getPauseData();let i=(l=t==null?void 0:t.playedProgress)!=null?l:0;(i<0||i>=1)&&(i=0);const r=1-i,s=this.getDuration(),a=(performance.now()-this.playStartedTime)/s;return 1-r+a});const r={config:{speedConfig:{moveSpeed:2,moveSpeedUnit:"m/s"}}},s={allowBroke:!0};this.state=jt({},r,this.state),this.config=jt({},s,this.config),this.baseCurveOffset=jt({x:0,y:0,z:0},{y:2},(o=this.config)==null?void 0:o.offset)}load(t,i){var a,l,c,h,u,d,f,m,p;this.handlePause(),this.clear(),this.data=R({id:xn()},t);const r=(()=>{if(this.data.path instanceof C.Curve)return this.data.path.curves[0];{if(this.data.path.length<2)return null;const g=this.data.path.map(Ft);return new C.CatmullRomCurve3(g,void 0,"catmullrom",.5)}})();if(!r)return;if(this.curve=r,this.curveOffset={x:this.baseCurveOffset.x+((l=(a=this.data.offset)==null?void 0:a.x)!=null?l:0),y:this.baseCurveOffset.y+((h=(c=this.data.offset)==null?void 0:c.y)!=null?h:0),z:this.baseCurveOffset.z+((d=(u=this.data.offset)==null?void 0:u.z)!=null?d:0)},!this.curve)throw new Error("curve is not defined");const s=this.curve.getLength(),o=this.state.config.speedConfig.moveSpeedUnit==="m/ms"?1:1e3;if(this.duration=s/(this.state.config.speedConfig.moveSpeed/o),Array.isArray(this.data.path)){const g=this.data.path.map(Ft).map(y=>y.toArray());!this.GuideLine&&(((f=this.config)==null?void 0:f.useGuideLine)!==!1&&t.useGuildLine||(m=this.config)!=null&&m.useGuideLine&&t.useGuildLine!==!1)&&(this.GuideLine=yV(this.five,this.config)),(p=this.GuideLine)==null||p.load({lines:[{id:xn(),path:[{type:"CatmullRomCurve3",points:g}],model_style:{visible:!0}}]})}return i?this.setState(i):(this.setState({playing:!1}),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),this.changePlayState(this.state.playing),this.changeSpeed(this.state.speed)),Promise.resolve()}handlePlay(){return new Promise((t,i)=>ee(this,null,function*(){var l;this.hooks.emit("play",{userAction:!0});const r=this.getPauseData();let s=(l=r==null?void 0:r.playedProgress)!=null?l:0;(s<0||s>=1)&&(s=0);const o=dp(this.curve,s,this.curveOffset);if(this.hooks.emit("progressChange",s),this.five.setState(Ee(R({},o),{mode:"Model"})),yield this.five.ready(),this.playStartedTime=performance.now(),this.config.allowBroke){const c=this.addInterruptListener(()=>{this.state.playing&&(this.hooks.emit("broke"),this.handlePause(),c(),i(new Error("broke")))})}const a=()=>{const c=this.getProgress();if(c>=1)this.five.off("renderFrame",a),this.setState({playing:!1},{userAction:!1}),this.hooks.emit("end"),this.hooks.emit("progressChange",1),t("end");else if(this.state.playing===!1)this.five.off("renderFrame",a);else if(c>=0){const h=dp(this.curve,c,this.curveOffset);this.hooks.emit("progressChange",c),this.five.setState(h,!0)}};this.five.on("renderFrame",a)}))}handlePause(t){var i;this.state.playing=!1,this.hooks.emit("pause",{userAction:(i=t==null?void 0:t.userAction)!=null?i:!0}),this.setPauseData()}};function p1(e){const n=Math.abs(Math.cos(e.latitude));return new C.Vector3(-Math.sin(e.longitude)*n,-Math.sin(e.latitude),-Math.cos(e.longitude)*n)}function hV(e,n){const t=p1(e),i=p1(n);return t.angleTo(i)}const uV=e=>ee(exports,null,function*(){try{e().then(()=>{},()=>{}).catch(()=>{})}catch(n){}});function dV(e){return new Promise(n=>{setTimeout(()=>{n()},e)})}function fV(e){return ee(this,null,function*(){return new Promise(n=>{if(e.work){n();return}e.once("loaded",()=>n())})})}class Vc extends FM{constructor(t,i){super(t,i);v(this,"state",{visible:!0,enabled:!0,disposed:!1,playing:!1,speed:1,config:{speedConfig:{rotateSpeed:.001,rotateSpeedUnit:"rad/ms",moveSpeed:.002,moveSpeedUnit:"m/ms"}}});v(this,"privateState",{playing:!1,currentPlayQueue:[],currentPlayKeyframe:null,broke:!1,modeChanging:!1});this.config=i,Object.assign(window,{__WalkPlugin_DEBUG__:this})}load(t,i,r){return ee(this,null,function*(){var h,u;this.clear();const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,o=yield this.formatData(t);this.data=R({id:o.keyframesId},o),this.hooks.emit("dataChange",o,s);let a=[],l;const c=this.data.keyframes.filter(d=>d.data.panoIndex!==void 0);c.filter((d,f)=>{var m;return d.data.panoIndex!==((m=c[f-1])==null?void 0:m.data.panoIndex)}).map(d=>d.data.panoIndex).forEach(d=>{var m,p;const f=(m=this.workUtil.getObserver(d))==null?void 0:m.floorIndex;if(f!==void 0)if(l===f){const g=a.length-1;a[g]=[...(p=a[g])!=null?p:[],d]}else{l=f;const g=a.length;a[g]=[d]}}),!this.GuideLine&&((h=this.config)==null?void 0:h.useGuideLine)!==!1&&o.useGuildLine!==!1&&(this.GuideLine=qg(this.five,this.config)),(u=this.GuideLine)==null||u.load({routes:a.map(d=>({panoIndexList:d})),config:o.guildPluginOptions}),i?this.setState(i,{userAction:r}):(this.setState({playing:!1},{userAction:!1}),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),this.changePlayState(this.state.playing,{userAction:!1}),this.changeSpeed(this.state.speed)),this.clearPauseData(),console.debug("WORKPLUGIN loaded",o),this.hooks.emit("dataLoaded",o)})}playFrom(t){const{index:i,id:r,userAction:s}=t;this.state.playing&&this.setState({playing:!1},{userAction:s}),this.setState({playing:!0},{userAction:s,playFromIndex:i,playFromId:r})}playFromStart(t){return this.playFrom(Ee(R({},t),{index:0}))}formatData(t){return ee(this,null,function*(){this.five.work||(yield fV(this.five));const i=(()=>{const r=t;return typeof r=="object"&&r!==null&&At(r.version)&&r.data?r.data:r})();if(i.keyframes)return{keyframesId:xn(),keyframes:i.keyframes.map((r,s)=>{var l;const o=i.keyframes[s+1],a=(()=>!o||o.start===void 0||r.end===void 0?0:o.start-r.end)();return Ee(R({id:(l=r.uuid)!=null?l:xn(),moveIndex:s,stay:a,index:s},r),{guildPluginOptions:i.guildPluginOptions})})};if(i.panoIndexList){let r=[];const{moveEffect:s,moveToFirstPanoEffect:o,moveToFirstPanoDuration:a}=i;return this.privateState.moveToFirstPanoEffect=o,this.privateState.moveToFirstPanoDuration=a,i.panoIndexList.forEach((l,c)=>{const h=(()=>{var p,g;const u=i.panoIndexList.slice(c).find(y=>y!==l);if(u===void 0)return;const d=this.workUtil.getObserverPosition(l),f=this.workUtil.getObserverPosition(u);if(!f||!d||((p=this.workUtil.getObserver(l))==null?void 0:p.floorIndex)!==((g=this.workUtil.getObserver(u))==null?void 0:g.floorIndex))return;const m=new C.Vector3().subVectors(f,d);return Oc(m.normalize())})();i.moveType===void 0||i.moveType==="justMove"?r.push({moveIndex:c,stay:i.stay,data:R({effect:"Move",panoIndex:l,moveEffect:s},h!=null?h:{})}):i.moveType==="moveAndRotate"&&(r.push({moveIndex:c,stay:i.stay,data:{effect:"Move",panoIndex:l,moveEffect:s}}),h&&r.push({moveIndex:c,stay:i.stay,data:R({effect:"Rotate",panoIndex:l},h)}))}),{keyframesId:xn(),keyframes:r.map((l,c)=>R({id:xn(),index:c},l)),guildPluginOptions:i.guildPluginOptions,useGuildLine:i.useGuildLine}}else throw new Error("format error: data no keyframes or no panoIndexList")})}handlePlay(t){return ee(this,null,function*(){var f;const{data:i,state:r,privateState:s,hooks:o}=this;if(s.playing||!(i!=null&&i.keyframes)||(i==null?void 0:i.keyframes.length)===0)return;const a=xn();s.playId=a,s.playing=!0,s.broke=!1;const l=i.keyframes,c=this.getPauseData();(t==null?void 0:t.notEmitEvent)!==!0&&o.emit("play",{userAction:(f=t==null?void 0:t.userAction)!=null?f:!0});let h=!1;const d=yield(()=>ee(this,null,function*(){var m,p;if((t==null?void 0:t.playFromIndex)!==void 0)return t.playFromIndex;if((t==null?void 0:t.playFromId)!==void 0)return(m=this.data)==null?void 0:m.keyframes.findIndex(g=>g.id===t.playFromId);if(c!=null&&c.id){const g=(p=this.data)==null?void 0:p.keyframes.find(y=>y.id===c.id);if(c!=null&&c.fiveState&&(yield this.move(c.fiveState,{moveEffect:s.moveToFirstPanoEffect,duration:s.moveToFirstPanoDuration})),g){if(g.data.effect==="Move")return g.index;if(g.data.effect==="Rotate"){const y=c.duration!==void 0?c.duration*(1-c.playedProgress):void 0;return yield this.playKeyframe(g,{duration:y}),h=!0,g.index+1}}}}))();this.clearPauseData();for(const m of l){if(s.broke||!r.playing||!s.playing||a!==s.playId)return;if(!(d!==void 0&&m.index<d))try{o.emit("playIndexChange",m.index,m),yield this.playKeyframe(m,{moveEffect:h===!1?s.moveToFirstPanoEffect:void 0,duration:h===!1&&typeof s.moveToFirstPanoDuration=="number"?s.moveToFirstPanoDuration:void 0}),m.stay&&(yield dV(m.stay)),h===!1&&(h=!0)}catch(p){return console.error(p),Promise.resolve("broke")}}r.playing&&a===s.playId&&(this.setState({playing:!1},{userAction:!1}),o.emit("end"),this.clearPauseData())})}handlePause(t){var o;const{state:i,privateState:r,hooks:s}=this;i.playing=!1,r.playing!==!1&&(r.playing=!1,(t==null?void 0:t.userAction)!==!1&&this.setPauseData(),r.broke||this.forceInteruptUpdateCamera(),(t==null?void 0:t.notEmitEvent)!==!0&&s.emit("pause",{userAction:(o=t==null?void 0:t.userAction)!=null?o:!0}))}changeSpeed(t,i=!0){const{state:r,privateState:s,hooks:o}=this,{currentPlayKeyframe:a}=s;if(o.emit("speedChange",t,{userAction:i}),r.playing&&a)try{const l=a.originDuration!==void 0?a.originDuration*(1-this.getProgress()):void 0,c=this.playKeyframe(a.keyframe,{duration:l});s.currentPlayQueue.push(c)}catch(l){}}getProgress(){return this.five.controller.cameraMotion.progress}setPauseData(){var t,i,r;if((t=this.data)!=null&&t.id)return this.pauseDataMap.set(this.data.id,{id:(i=this.privateState.currentPlayKeyframe)==null?void 0:i.keyframe.id,fiveState:this.five.getCurrentState(),duration:(r=this.privateState.currentPlayKeyframe)==null?void 0:r.originDuration,playedProgress:this.getProgress()})}clear(){this.clearPauseData(),this.privateState.currentPlayKeyframe=null}playKeyframe(t,i){return ee(this,null,function*(){var s;const{privateState:r}=this;return((s=this.privateState.currentPlayKeyframe)==null?void 0:s.keyframe.id)!==t.id&&(this.privateState.currentPlayKeyframe={keyframe:t}),r.currentPlayQueue.push(this.getPlayPromise(t,i)),this.actionPromiseQueue()})}getPlayPromise(r){return ee(this,arguments,function*(t,i={}){var o;const s=t.data;if(i.duration=(o=i.duration)!=null?o:t.start!==void 0&&t.end!==void 0?t.end-t.start:void 0,!!s)return new Promise((a,l)=>{let c=!1;this.addInterruptListener(()=>{if(!c)return this.hooks.emit("broke"),this.privateState.broke=!0,this.setState({playing:!1}),c=!0,l(new Error("play is interupted"))});try{if(c)return;const h=()=>{a(),c=!0};switch(s.effect){case"Move":this.move(s,i).then(h);break;case"Rotate":this.rotate(s,i).then(h);break;default:this.rotate(s,i).then(h)}}catch(h){}})})}actionPromiseQueue(){return ee(this,null,function*(){const{privateState:t}=this;return new Promise((i,r)=>{if(t.currentPlayQueue.length===0){i();return}const s=t.currentPlayQueue.shift();if(!s){i();return}s.then(i,r)}).then(()=>t.currentPlayQueue.length===0?Promise.resolve():this.actionPromiseQueue())})}move(t,i){return ee(this,null,function*(){if(t.mode&&t.mode!==this.five.currentMode)yield this.changeMode(t);else if(t.panoIndex!==this.five.panoIndex)yield this.changePano(t,i);else return Promise.resolve()})}rotate(t,i){return ee(this,null,function*(){if(t.mode&&t.mode!==this.five.currentMode)yield this.changeMode({mode:t.mode,panoIndex:t.panoIndex});else if(t.panoIndex&&t.panoIndex!==this.five.panoIndex)return yield this.changePano(t,i);yield this.updateCamera(t,i)})}updateCamera(r){return ee(this,arguments,function*(t,i={}){const{five:s,privateState:o,state:a}=this,l=(()=>{var f,m;const u=(f=a.config)==null?void 0:f.speedConfig,d=(m=t.rotateSpeed)!=null?m:u==null?void 0:u.rotateSpeed;if((u==null?void 0:u.rotateSpeedUnit)===void 0)return d;if(d!==void 0)return u.rotateSpeedUnit==="rad/ms"?d:d/1e3})(),c=(()=>{if(i.duration)return i.duration;if(l){const u=this.five.getCurrentState();return hV(u,t)/l}return 800})();o.currentPlayKeyframe&&(o.currentPlayKeyframe.originDuration=c);const h=this.getSpeededDuration(c);return new Promise(u=>{uV(()=>s.updateCamera(t,h)),setTimeout(()=>u(),h)})})}changePano(t,i){return ee(this,null,function*(){const{five:r,privateState:s,state:o}=this;if(typeof t.panoIndex!="number"||t.panoIndex===r.panoIndex)return;const a=r.getCurrentState().mode!=="Panorama";a&&(this.privateState.modeChanging=!0);const l=(()=>{var d,f;const h=(d=o.config)==null?void 0:d.speedConfig,u=(f=t.moveSpeed)!=null?f:h==null?void 0:h.moveSpeed;if((h==null?void 0:h.moveSpeedUnit)===void 0)return u;if(u!==void 0)return h.moveSpeedUnit==="m/ms"?u:u/1e3})(),c=(()=>{if(i!=null&&i.duration)return i.duration;if(l&&typeof r.panoIndex=="number"&&typeof t.panoIndex=="number"){const h=this.workUtil.getObserverPosition(r.panoIndex),u=this.workUtil.getObserverPosition(t.panoIndex);return h&&u?h.distanceTo(u)/l:800}return 800})();s.currentPlayKeyframe&&(s.currentPlayKeyframe.originDuration=c),yield new Promise(h=>{var u,d,f;this.fiveUtil.moveToPano(t.panoIndex,{latitude:t.latitude,longitude:t.longitude,fov:t.fov,duration:this.getSpeededDuration(c),effect:(f=(d=i==null?void 0:i.moveEffect)!=null?d:(u=this.state.config)==null?void 0:u.moveEffect)!=null?f:t.moveEffect,moveCancelCallback:()=>h(),moveEndCallback:()=>h()}),a&&r.once("panoArrived",()=>h())}),a&&(this.privateState.modeChanging=!1)})}changeMode(t,i){return ee(this,null,function*(){t.mode&&t.mode!==this.five.currentMode&&(this.privateState.modeChanging=!0,yield this.five.changeMode(t.mode,t,i),this.privateState.modeChanging=!1)})}}class VM{constructor(n){v(this,"id");v(this,"renderID");v(this,"isGuideLine",!0);v(this,"panoramaItem");v(this,"modelItem");v(this,"hooks",new Cn);v(this,"_visible",!0);v(this,"plugin");v(this,"five");v(this,"logError",n=>iM("GuideLineItem: ",n));this.id=n.id,this.five=n.five,this.plugin=n.plugin,this.panoramaItem=new Vm(this.five,{mode:"panorama",plugin:this.plugin,parent:this}),this.modelItem=new Vm(this.five,{mode:"model",plugin:this.plugin,parent:this})}get visible(){return this._visible}setData(n){this.setDataByMode("panorama",n),this.setDataByMode("model",n)}setDataByMode(n,t){var u;const i=n==="panorama"?this.panoramaItem:this.modelItem,r=n==="panorama"?t.panorama_style:t.model_style,s=n==="panorama"&&t.panorama_style.use_auto_depthtest,o=t.panorama_style.auto_depth_test_effect_distance,a=t.path,l=r,c=r,h=r;if(t.pano_group){const d=n==="panorama"&&t.panorama_style.skip_group===!0;i.setGeometryByPanoGroup(t.pano_group,Ee(R({skipPanoGroup:d},l),{useAutoDepthTest:s,autoDepthTestEffectDistance:o}))}else t.path&&i.setGeometryByPath(a,Ee(R({},l),{useAutoDepthTest:s,autoDepthTestEffectDistance:o}));i.name=t.name,i.setMeshStyle(h),i.setMartial(c),i.setVisibleFloorIndexes((u=t.visible_floor_indexes)!=null?u:null),i.setStartTag(r==null?void 0:r.start_tag),i.setEndTag(r==null?void 0:r.end_tag)}show(){this._visible=!0,this.hooks.emit("show",{userAction:!0})}hide(){this._visible=!1,this.hooks.emit("hide",{userAction:!0})}dispose(){this.panoramaItem.dispose(),this.modelItem.dispose()}walk(n){return ee(this,null,function*(){if(this.hooks.emit("walkStart",{userAction:!0}),this.panoramaItem.panoGroup.length){const t=R({panoIndexList:this.panoramaItem.panoGroup},n),[i]=yield $s(mV(this.five,t));if(i)return this.logError(i.message)}else{const t={path:this.panoramaItem.curvePath},[i]=yield $s(pV(this.five,t));if(i)return this.logError(i.message)}this.hooks.emit("walkEnded",{userAction:!0})})}}function pV(e,n){return ee(this,null,function*(){const t=new Jg(e);yield t.load(n),t.playFromStart()})}function mV(e,n){return ee(this,null,function*(){if(n.panoIndexList.length===0)return;const t=e.getCurrentState();t.mode!=="Panorama"&&(yield Tg(e,["Panorama",{longitude:t.longitude,latitude:0,panoIndex:n.panoIndexList[0]}]));const i=new Vc(e);yield i.load(n),yield new Promise((r,s)=>{const o=e.getCurrentState();let a=n.panoIndexList.slice();o.panoIndex===a[0]&&c(o.panoIndex),i.playFromStart();function l(f){if(f!=="Panorama")return u(new Error("mode not match"))}function c(f){const m=a[0];if(a=a.slice(1),f!==m)return u(new Error("panoIndex not match, wanted: "+m+", got: "+f));if(a.length===0)return d()}function h(){e.off("modeChange",l),e.off("panoArrived",c)}function u(f){h(),s(f)}function d(){h(),r()}e.on("modeChange",l),e.on("panoArrived",c)})})}const gV=Object.freeze(Object.defineProperty({__proto__:null,GuideLineItem:VM},Symbol.toStringTag,{value:"Module"})),Gm="GuideLinePlugin",m1=`${Gm}`;let vV=class extends Br{constructor(t,i){super(t,i);v(this,"name",Gm);v(this,"cruisePlugin");v(this,"itemMap",new Map);v(this,"state",{visible:!1,enabled:!0});v(this,"data");v(this,"heightOffset",0);v(this,"_config");v(this,"_disposed",!1);v(this,"disposedErrorLog",()=>{console.error(`${m1} is disposed`)});this._config=i!=null?i:{},this.cruisePlugin=new Vc(t),Object.assign(window,{[`__${Gm}_DEBUG__`]:this})}get config(){return this._config}get disposed(){return this._disposed}load(t,i,r=!0){return ee(this,null,function*(){var f,m,p,g,y,b,A,w;const s=this.data?JSON.parse(JSON.stringify(this.data)):void 0,o=yield this.formatData(t);this.hooks.emit("dataChange",o,s),this.data=o;const a=o.config,c={panorama_style:{visible:!!(!o.lines&&o.routes),unit_length:(f=a==null?void 0:a.unitHeight)!=null?f:.4,width:(m=a==null?void 0:a.unitWidth)!=null?m:.6,texture:{url:(p=a==null?void 0:a.arrowTextureUrl)!=null?p:this.staticPrefix+"/release/web/arrow-white.5c2c79a5.png"},use_auto_depthtest:(g=this.config.useAutoDepthTest)!=null?g:!1,auto_depth_test_effect_distance:this.config.autoDepthTestEffectDistance}},h=(b=(y=o.routes)==null?void 0:y.map(x=>{var M;return jt({},c,{id:(M=x.id)!=null?M:xn(),pano_group:x.panoIndexList})}))!=null?b:[],u=(w=(A=o.lines)==null?void 0:A.map(x=>jt({},c,x)))!=null?w:[],d=[...h,...u];yield Ha(this.five),this.clear(),d.forEach(x=>{this.addGuideLineItem(x)}),this.updateTagsEnable(),this.handleVisible(this.state.visible),this.handleEnable(this.state.enabled),i&&this.setState(i,{userAction:r}),this.hooks.emit("dataLoaded",o),console.debug(`${m1} loaded`,o)})}formatData(t){return ee(this,null,function*(){return this.getDataWithoutVersion(t)})}show(t){return ee(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return ee(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.disposed||(this.clear(),this.hooks.emit("dispose"))}setState(t,i){var s;if(this.disposed)return this.disposedErrorLog();const r=R({},this.state);this.state=R(R({},this.state),t),t.visible!==void 0&&t.visible!==r.visible&&this.handleVisible(t.visible,i==null?void 0:i.userAction),t.enabled!==void 0&&t.enabled!==r.enabled&&this.handleEnable(t.enabled,i==null?void 0:i.userAction),Nn(r,this.state,{deep:!0})||(this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:(s=i==null?void 0:i.userAction)!=null?s:!0}),this.five.needsRender=!0)}addGuideLineItem(t){const i=t.render_id||t.id,r=this.itemMap.get(i);r&&this.removeGuideLineItem(r);const s=new VM({five:this.five,id:i,plugin:this});return this.itemMap.set(i,s),t&&s.setData(t),this.heightOffset+=1e-4,s.modelItem.setHeightOffset(this.heightOffset),s.panoramaItem.setHeightOffset(this.heightOffset),s}getGuideLineItemByID(t){return this.itemMap.get(t)}removeGuideLineItem(t){this.itemMap.delete(t.id),t.panoramaItem.dispose(),t.modelItem.dispose()}updateTagsEnable(){const t=[];function i(o){return Array.isArray(o)&&o.every(a=>typeof a=="number")}function r(o,a){return new C.Vector3().fromArray(o).distanceTo(new C.Vector3().fromArray(a))<.01}function s(o){var l;const a=(l=o==null?void 0:o.tag)==null?void 0:l.position;return i(a)?t.every(c=>{var h;return i((h=c.tag)==null?void 0:h.position)?!r(a,c.tag.position):!0}):!1}this.itemMap.forEach(o=>{const a=o.modelItem.startTagContainer,l=o.modelItem.endTagContainer,c=s(a);c&&t.push(a),a==null||a.plugin.setState({enabled:c},{});const h=s(l);h&&t.push(l),l==null||l.plugin.setState({enabled:h},{})})}clear(){this.heightOffset=0,this.itemMap.forEach(t=>{this.removeGuideLineItem(t)})}handleEnable(t,i=!0){this.hooks.emit(t?"enable":"disable",{userAction:i})}handleVisible(t,i=!0){this.state.enabled&&this.hooks.emit(t?"show":"hide",{userAction:i})}getDataWithoutVersion(t){return typeof t=="object"&&t!==null&&t.data?t.data:t}};const qg=(e,n)=>new vV(e,n),yV=qg,bV=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),AV=(e,n)=>new Vc(e,n),wV=(e,n)=>new Jg(e,n);function GM(e,n,t){if(t){const r=new C.Vector3().subVectors(e.position,t).applyQuaternion(e.quaternion.clone().inverse()).applyQuaternion(n).add(t);e.position.copy(r)}e.quaternion.copy(n)}class Gc extends ei{constructor(t,i){var r,s;super();v(this,"originObject3D");v(this,"onRender");v(this,"positionFrom");this.originObject3D=t,this.onRender=(r=i==null?void 0:i.onRender)!=null?r:()=>{},this.positionFrom=(s=i==null?void 0:i.positionFrom)!=null?s:"objectPosition"}get helperObject(){return this}render(){this.onRender()}enable(){this.parent.children.includes(this)||this.parent.add(this)}disable(){this.removeFromParent()}show(){this.visible=!0,this.render()}hide(){this.visible=!1,this.render()}raycasterIntersectObject(t,i=[]){return t.intersectObject(this,!0,i)}initialPosition(t){var i,r;this.positionFrom==="objectPosition"?this.position.copy(this.originObject3D.position):this.positionFrom==="boundingBox"?this.position.copy((i=Ga(this.originObject3D))==null?void 0:i.getCenter(new C.Vector3)):this.positionFrom==="boundingSphere"?this.position.copy((r=qw(this.originObject3D))==null?void 0:r.center):this.positionFrom instanceof ne.Vector3?this.position.copy(this.positionFrom):this.positionFrom instanceof Function&&this.position.copy(this.positionFrom(this.originObject3D)),t&&this.position.add(t)}setScaleByCamera(t){}initQuaternion(){this.quaternion.copy(this.originObject3D.quaternion)}applyHelperScaleMatrix4(t,i){this.scale.applyMatrix4(t)}setHelperQuaternion(t,i){GM(this,t,i)}applyHelperQuaternion(t,i){if(i){const r=new ne.Vector3().subVectors(this.position,i).applyQuaternion(t).add(i);this.position.copy(r)}this.applyQuaternion(t)}dispose(){this.removeFromParent()}}class xV extends Gc{}class MV extends Gc{}class EV extends Gc{}class CV extends Gc{}class PV extends Gc{}class _V extends C.Group{constructor(t){super();v(this,"direction");this.direction=t||"x"}}class g1 extends C.Mesh{constructor(t,i,r){super(t,i);v(this,"direction");this.direction=r||"x"}}function SV(e,n){const{offsetWidth:t,offsetHeight:i}=n,{top:r,left:s}=n.getBoundingClientRect();return Object.assign(new C.Vector2,{x:(e.x-s)/t*2-1,y:-(e.y-r)/i*2+1})}function Vd(e,n,t){if(!n||!t||!e)return;const i=SV(n,t);if(Math.abs(i.x)===1||Math.abs(i.y)===1)return;const r=new C.Raycaster;return r.setFromCamera(i,e),r.params.Points.threshold=.1,r}function IV(e,n){return!(Math.abs(e.x-n.x)>1e-5||Math.abs(e.y-n.y)>1e-5||Math.abs(e.z-n.z)>1e-5)}class fp extends _V{constructor(t){var h;super(t.direction);v(this,"line");v(this,"arrow");v(this,"lineHeight",.4);v(this,"arrowHeight",.1);this.name="ArrowGroup";const i=new C.Color((h=t.color)!=null?h:16214315),r=new C.MeshBasicMaterial({color:i,depthTest:!1,depthWrite:!1,opacity:1,transparent:!0,side:C.DoubleSide});this.renderOrder=50;const s=new C.ConeGeometry(.04,.1,32),o=new g1(s,r.clone(),t.direction);o.name=`arrow-${t.direction}`,this.arrow=o;const a=.004,l=new C.CylinderGeometry(a,a,.4,32),c=new g1(l,r.clone(),t.direction);c.name=`line-${t.direction}`,this.line=c,this.formatArrow(),this.formatLine(),this.add(this.arrow,this.line)}formatArrow(){this.arrow.geometry.translate(0,this.lineHeight+this.arrowHeight/2,0),this.direction==="x"?(this.arrow.geometry.rotateX(Math.PI/2),this.arrow.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.arrow.geometry.rotateX(Math.PI/2)}formatLine(){this.line.geometry.translate(0,this.lineHeight/2,0),this.direction==="x"?(this.line.geometry.rotateX(Math.PI/2),this.line.geometry.rotateY(Math.PI/2)):this.direction==="z"&&this.line.geometry.rotateX(Math.PI/2)}}const pp={X:15618642,Y:4765519,Z:4227839};class ia{static get X(){return new C.Color(pp.X).convertSRGBToLinear().clone()}static get Y(){return new C.Color(pp.Y).convertSRGBToLinear().clone()}static get Z(){return new C.Color(pp.Z).convertSRGBToLinear().clone()}}function Kg(e,n){const r=e.position.distanceTo(n),s=e.fov,o=r/3,a=s/90;return o*a}class TV extends xV{constructor(t,i){super(t,i);v(this,"xArrow");v(this,"yArrow");v(this,"zArrow");i.xArrowEnable!==!1&&(this.xArrow=new fp({direction:"x",color:ia.X})),i.yArrowEnable!==!1&&(this.yArrow=new fp({direction:"y",color:ia.Y})),i.zArrowEnable!==!1&&(this.zArrow=new fp({direction:"z",color:ia.Z})),this.add(...[this.xArrow,this.yArrow,this.zArrow].filter(Boolean))}show(){super.show(),this.xArrow&&(this.xArrow.visible=!0),this.yArrow&&(this.yArrow.visible=!0),this.zArrow&&(this.zArrow.visible=!0)}setScaleByCamera(t){this.scale.setScalar(Kg(t,this.position))}showDraggingHelper(t){this.xArrow&&(this.xArrow.visible=t.includes("x")),this.yArrow&&(this.yArrow.visible=t.includes("y")),this.zArrow&&(this.zArrow.visible=t.includes("z"))}dispose(){this.remove(...[this.xArrow,this.yArrow,this.zArrow].filter(Boolean)),super.dispose()}}function Ws(e,n){return DV(document.createElement(n!=null?n:"div"),e)}function DV(e,n){if(!n)return e;for(const t in n)t&&n[t]&&(e.style[t]=n[t]);return e}function LV(e){const n=Ws(R({position:"absolute",display:"block",borderRadius:"4px",paddingTop:"1px",paddingBottom:"1px",paddingLeft:"4px",paddingRight:"4px",pointerEvents:"none",userSelect:"none",zIndex:"99999",backgroundColor:"rgba(0,0,0,0.7)",fontSize:"12px",color:"#fff",letterSpacing:"0",lineHeight:"18px"},e)),t=()=>{n.style.display!=="block"&&n.style.top&&n.style.left&&(n.style.display="block")};return{element:n,show:t,hide:()=>{n.style.display="none",n.style.top="",n.style.left=""},setLeftTop:(s,o)=>{n.style.left=s,n.style.top=o,t()}}}class kV extends EV{constructor(t,i){super(t,i);v(this,"xCircle");v(this,"yCircle");v(this,"zCircle");v(this,"children",[]);v(this,"angleTips");v(this,"container");(i==null?void 0:i.yzCircleEnable)!==!1&&(this.xCircle=new mp({direction:"x",color:ia.X})),(i==null?void 0:i.xzCircleEnable)!==!1&&(this.yCircle=new mp({direction:"y",color:ia.Y})),(i==null?void 0:i.xyCircleEnable)!==!1&&(this.zCircle=new mp({direction:"z",color:ia.Z})),i!=null&&i.container&&(i==null?void 0:i.angleTipsEnable)!==!1&&(this.container=i==null?void 0:i.container,this.angleTips=LV({display:"none"}),this.container.appendChild(this.angleTips.element)),this.add(...[this.xCircle,this.yCircle,this.zCircle].filter(Boolean)),this.show()}hide(){this.children.forEach(t=>t.hide())}show(){var t;this.children.forEach(i=>i.showCircle()),(t=this.angleTips)==null||t.hide()}setScaleByCamera(t){this.scale.setScalar(Kg(t,this.position))}showDraggingHelper(t){var i;this.hide(),this.children.filter(r=>t.includes(r.direction)).forEach(r=>r.showRing()),(i=this.angleTips)==null||i.show()}dispose(){var t,i;this.removeFromParent(),(i=(t=this.angleTips)==null?void 0:t.element)==null||i.remove()}}class mp extends C.Group{constructor(t){super();v(this,"direction");v(this,"circle");v(this,"ring");v(this,"angleSector");this.direction=t.direction,this.circle=new RV(t),this.ring=new OV(t),this.angleSector=new zV(t),this.add(this.circle,this.ring,this.angleSector),this.direction==="y"?this.rotateX(Math.PI/2):this.direction==="x"&&this.rotateY(-Math.PI/2)}showCircle(){this.add(this.circle),this.remove(this.ring,this.angleSector)}showRing(){this.add(this.ring,this.angleSector),this.remove(this.circle)}hide(){this.remove(this.ring,this.angleSector,this.circle)}}let RV=class extends C.Mesh{constructor(t){var i;super();v(this,"direction");v(this,"gapAngle",.02);v(this,"geometry",new C.RingGeometry(.25,.3,20,8,this.gapAngle,Math.PI/2-this.gapAngle*2));this.material=new C.MeshBasicMaterial({opacity:.6,color:(i=t.color)!=null?i:16777215,transparent:!0,side:C.DoubleSide,depthTest:!1,depthWrite:!1}),this.renderOrder=50,this.direction=t.direction,this.geometry.name=`RotateHelperCircleGeometry-${this.direction}`}};class OV extends C.Group{constructor(t){super();v(this,"direction");this.direction=t.direction;const i=.015,r=new Array(8).fill(null).map((s,o)=>{const a=new C.RingGeometry(.25,.3,20,8,Math.PI/4*o+i,Math.PI/4-i*2),l=new C.MeshBasicMaterial({opacity:1,color:16777215,depthTest:!1,depthWrite:!1,transparent:!0,side:C.DoubleSide});this.renderOrder=50;const c=new C.Mesh(a,l);return c.name=`AxesDashedRing-${this.direction}-${o}`,c});this.add(...r)}}class zV extends C.Mesh{constructor(t){var r;super();v(this,"direction");v(this,"baseAxes");v(this,"angleDirection");switch(t.direction){case"x":this.baseAxes=new C.Vector3(0,0,1);break;case"y":this.baseAxes=new C.Vector3(1,0,0);break;case"z":this.baseAxes=new C.Vector3(1,0,0);break}const i=.3+5e-4;this.geometry=new C.CircleGeometry(i,48,0,1e-4),this.material=new C.MeshBasicMaterial({opacity:.4,color:(r=t.color)!=null?r:16777215,depthTest:!1,depthWrite:!1,transparent:!0,side:C.DoubleSide}),this.renderOrder=50,this.direction=t.direction,this.angleDirection=this.direction==="z"?1:-1}}function BV(){const e=Ws({width:"100%",height:"100%",left:"0",top:"0",position:"absolute",pointerEvents:"none"}),n=Ws({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}),t=Ws({boxSizing:"border-box",width:"100%",height:"100%",left:"0",top:"0",position:"absolute",border:"1px solid rgba(255,255,255,0.4)"});e.appendChild(n),n.appendChild(t);const i="-4px",r={direction:"nesw",element:Zr({cursor:"nesw-resize",left:i,bottom:i})},s={direction:"ns",element:Zr({cursor:"ns-resize",bottom:i})},o={direction:"nwse",element:Zr({cursor:"nwse-resize",right:i,bottom:i})},a={direction:"ew",element:Zr({cursor:"ew-resize",right:i})},l={direction:"nesw",element:Zr({cursor:"nesw-resize",right:i,top:i})},c={direction:"ns",element:Zr({cursor:"ns-resize",top:i})},h={direction:"nwse",element:Zr({cursor:"nwse-resize",left:i,top:i})},u={direction:"ew",element:Zr({cursor:"ew-resize",left:i})};return new Array(s,a,c,u,r,o,l,h).forEach(f=>n.appendChild(f.element)),{container:e,squares:[r,s,o,a,l,c,h,u]}}function Zr(e){const n=Ws(R({background:"#FFFFFF",width:"9px",height:"9px",position:"absolute",pointerEvents:"none"},e)),t=Ws({width:"15px",height:"15px",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"}),i=Ws({width:"15px",height:"15px",cursor:e==null?void 0:e.cursor,pointerEvents:"auto",background:"transparent"});return i.draggable=!0,t.appendChild(i),n.appendChild(t),n}class NV extends PV{constructor(t,i,r,s){super(t);v(this,"points",[]);v(this,"cornerPositions",[]);v(this,"css3DInstance");v(this,"plane");v(this,"css3DRenderer",new Ia);v(this,"camera");v(this,"scene");v(this,"container");v(this,"enabled",!1);this.camera=r,this.scene=s,this.container=i,this.initRectangleScaleHelper()}get helperObject(){var t;if(!((t=this.css3DInstance)!=null&&t.css3DObject))throw new Error("css3DInstance is not initialized");return this.css3DInstance.css3DObject}applyMatrix4(t){var i;super.applyMatrix4(t),this.helperObject.applyMatrix4(t),(i=this.plane)==null||i.applyMatrix4(t),this.cornerPositions.forEach(r=>r.applyMatrix4(t))}showDraggingHelper(){}applyHelperScaleMatrix4(t,i){var r;(r=this.plane)==null||r.scale.applyMatrix4(t),this.helperObject.applyScaleMatrix4(t)}updatePoints(){const t=this.calculatePointPosition(this.cornerPositions);this.points.forEach((i,r)=>{i.position.copy(t[r])})}applyHelperQuaternion(t,i){var s;const r=(s=this.css3DInstance)==null?void 0:s.css3DObject;if(r){const o=new C.Vector3().subVectors(r.position,i).applyQuaternion(t).add(i);r.position.copy(o),r.applyQuaternion(t)}if(this.plane){const o=new C.Vector3().subVectors(this.plane.position,i).applyQuaternion(t).add(i);this.plane.position.copy(o),this.plane.applyQuaternion(t)}this.cornerPositions.forEach(o=>{const a=new C.Vector3().subVectors(o,i).applyQuaternion(t).add(i);o.copy(a)})}enable(){var t;this.enabled||(this.enabled=!0,(t=this.css3DInstance)==null||t.enable(),this.plane&&this.scene.add(this.plane))}disable(){var t;this.enabled&&(this.enabled=!1,(t=this.css3DInstance)==null||t.disable(),this.plane&&this.scene.remove(this.plane))}show(){var t;(t=this.css3DInstance)==null||t.show(),this.plane&&(this.plane.visible=!0)}hide(){var t;(t=this.css3DInstance)==null||t.hide(),this.plane&&(this.plane.visible=!1)}dispose(){this.disable(),this.css3DRenderer.dispose()}initRectangleScaleHelper(){var a,l;const t=this.getCornerPositions();if(!t)return;this.cornerPositions=t;const i=this.css3DRenderer.create3DElement(this.camera,t,{ratio:.003});if(!i)return;this.css3DInstance=i,i.appendToElement(this.container);const r=i.css3DObject.container,{container:s,squares:o}=BV();this.points=o.map((c,h)=>({direction:c.direction,point:c.element,position:this.calculatePointPosition(t)[h]})),r.insertBefore(s,(a=r.children[0])!=null?a:null),this.helperObject.position.copy(this.originObject3D.position),(l=this.plane)==null||l.position.copy(this.originObject3D.position)}getCornerPositions(){const{originObject3D:t}=this;if(t.isCSS3DObjectPlus)return t.cornerPoints;console.error("当前物体暂时不支持 ScaleHelper")}calculatePointPosition(t){return[t[0].clone(),t[0].clone().add(t[1]).divideScalar(2),t[1].clone(),t[1].clone().add(t[2]).divideScalar(2),t[2].clone(),t[2].clone().add(t[3]).divideScalar(2),t[3].clone(),t[3].clone().add(t[0]).divideScalar(2)]}}class FV extends MV{constructor(t){super(t);v(this,"box");v(this,"outline");v(this,"originObject");v(this,"positionAttribute");this.originObject=t,this.positionAttribute=new C.BufferAttribute(new Float32Array(8*3),3),this.box=this.createBox(),this.outline=this.createOutline(),this.add(this.box,this.outline),this.update()}raycasterIntersectObject(t,i){return t.intersectObject(this,!1,i)}raycast(t,i){this.box.raycast(t,i)}update(){const t=Ga(this.originObject);if(!t)return;const{min:i,max:r}=t;this.positionAttribute.setXYZ(0,r.x,r.y,r.z),this.positionAttribute.setXYZ(1,i.x,r.y,r.z),this.positionAttribute.setXYZ(2,i.x,i.y,r.z),this.positionAttribute.setXYZ(3,r.x,i.y,r.z),this.positionAttribute.setXYZ(4,r.x,r.y,i.z),this.positionAttribute.setXYZ(5,i.x,r.y,i.z),this.positionAttribute.setXYZ(6,i.x,i.y,i.z),this.positionAttribute.setXYZ(7,r.x,i.y,i.z),this.positionAttribute.needsUpdate=!0}createOutline(){const t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new C.BufferGeometry;i.setIndex(new C.BufferAttribute(t,1)),i.setAttribute("position",this.positionAttribute);const r=new C.LineBasicMaterial({color:64767,linewidth:1,opacity:1,toneMapped:!1}),s=new C.LineSegments(i,r);return s.matrixAutoUpdate=!1,s}createBox(){const t=new Uint16Array([0,1,2,0,2,3,0,3,7,0,7,4,0,4,5,0,5,1,6,1,5,6,2,1,6,5,4,6,4,7,6,3,2,6,7,3]),i=new C.BufferGeometry;i.setIndex(new C.BufferAttribute(t,1)),i.setAttribute("position",this.positionAttribute);const r=new C.MeshBasicMaterial({color:64767,opacity:.1,depthTest:!1,transparent:!0});return new C.Mesh(i,r)}}function Rt(e,n){this._camera=e||null,this._domElement=n||document,this._raycaster=new C.Raycaster,this._selected=null,this._boundObjs={};var t=this;this._$onClick=function(){t._onClick.apply(t,arguments)},this._$onDblClick=function(){t._onDblClick.apply(t,arguments)},this._$onMouseMove=function(){t._onMouseMove.apply(t,arguments)},this._$onMouseDown=function(){t._onMouseDown.apply(t,arguments)},this._$onMouseUp=function(){t._onMouseUp.apply(t,arguments)},this._$onTouchMove=function(){t._onTouchMove.apply(t,arguments)},this._$onTouchStart=function(){t._onTouchStart.apply(t,arguments)},this._$onTouchEnd=function(){t._onTouchEnd.apply(t,arguments)},this._$onContextmenu=function(){t._onContextmenu.apply(t,arguments)},this._domElement.addEventListener("click",this._$onClick,!1),this._domElement.addEventListener("dblclick",this._$onDblClick,!1),this._domElement.addEventListener("mousemove",this._$onMouseMove,!1),this._domElement.addEventListener("mousedown",this._$onMouseDown,!1),this._domElement.addEventListener("mouseup",this._$onMouseUp,!1),this._domElement.addEventListener("touchmove",this._$onTouchMove,!1),this._domElement.addEventListener("touchstart",this._$onTouchStart,!1),this._domElement.addEventListener("touchend",this._$onTouchEnd,!1),this._domElement.addEventListener("contextmenu",this._$onContextmenu,!1)}Rt.prototype.destroy=function(){this._domElement.removeEventListener("click",this._$onClick,!1),this._domElement.removeEventListener("dblclick",this._$onDblClick,!1),this._domElement.removeEventListener("mousemove",this._$onMouseMove,!1),this._domElement.removeEventListener("mousedown",this._$onMouseDown,!1),this._domElement.removeEventListener("mouseup",this._$onMouseUp,!1),this._domElement.removeEventListener("touchmove",this._$onTouchMove,!1),this._domElement.removeEventListener("touchstart",this._$onTouchStart,!1),this._domElement.removeEventListener("touchend",this._$onTouchEnd,!1),this._domElement.removeEventListener("contextmenu",this._$onContextmenu,!1)};Rt.eventNames=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","contextmenu","touchstart","touchend"];Rt.prototype._getRelativeMouseXY=function(e){var n=e.target||e.srcElement;n.nodeType===3&&(n=n.parentNode);var t={x:0,y:0},i=n,r=getComputedStyle(i,null);t.y+=parseInt(r.getPropertyValue("padding-top"),10),t.x+=parseInt(r.getPropertyValue("padding-left"),10);do t.x+=i.offsetLeft,t.y+=i.offsetTop,r=getComputedStyle(i,null),t.x+=parseInt(r.getPropertyValue("border-left-width"),10),t.y+=parseInt(r.getPropertyValue("border-top-width"),10);while(i=i.offsetParent);var s={width:n===window?window.innerWidth:n.offsetWidth,height:n===window?window.innerHeight:n.offsetHeight};return{x:Number((e.pageX-t.x)/s.width)*2-1,y:-((e.pageY-t.y)/s.height)*2+1}};Rt.prototype._objectCtxInit=function(e){e._3xDomEvent={}};Rt.prototype._objectCtxDeinit=function(e){delete e._3xDomEvent};Rt.prototype._objectCtxIsInit=function(e){return!!e._3xDomEvent};Rt.prototype._objectCtxGet=function(e){return e._3xDomEvent};Rt.prototype.camera=function(e){return e&&(this._camera=e),this._camera};Rt.prototype.bind=function(e,n,t,i){console.assert(Rt.eventNames.indexOf(n)!==-1,"not available events:"+n),this._objectCtxIsInit(e)||this._objectCtxInit(e);var r=this._objectCtxGet(e);r[n+"Handlers"]||(r[n+"Handlers"]=[]),r[n+"Handlers"].push({callback:t,useCapture:i}),this._boundObjs[n]===void 0&&(this._boundObjs[n]=[]),this._boundObjs[n].push(e)};Rt.prototype.addEventListener=Rt.prototype.bind;Rt.prototype.unbind=function(e,n,t,i){console.assert(Rt.eventNames.indexOf(n)!==-1,"not available events:"+n),this._objectCtxIsInit(e)||this._objectCtxInit(e);var r=this._objectCtxGet(e);r[n+"Handlers"]||(r[n+"Handlers"]=[]);for(var s=r[n+"Handlers"],o=0;o<s.length;o++){var a=s[o];if(t==a.callback&&i==a.useCapture){s.splice(o,1);break}}var l=this._boundObjs[n].indexOf(e);this._boundObjs[n].splice(l,1)};Rt.prototype.removeEventListener=Rt.prototype.unbind;Rt.prototype._bound=function(e,n){var t=this._objectCtxGet(n);return t?!!t[e+"Handlers"]:!1};Rt.prototype._onMove=function(e,n,t,i){var r=this._boundObjs[e];if(!(r===void 0||r.length===0)){var s=new C.Vector2;s.set(n,t),this._raycaster.setFromCamera(s,this._camera);var o=this._raycaster.intersectObjects(r),a=this._selected;if(o.length>0){var l,c,h,u=o[0],d=u.object;this._selected=d,h=this._bound("mousemove",d),a!=d&&(l=this._bound("mouseover",d),c=a&&this._bound("mouseout",a))}else c=a&&this._bound("mouseout",a),this._selected=null;h&&this._notify("mousemove",d,i,u),l&&this._notify("mouseover",d,i,u),c&&this._notify("mouseout",a,i,u)}};Rt.prototype._onEvent=function(e,n,t,i){var r=this._boundObjs[e];if(!(r===void 0||r.length===0)){var s=new C.Vector2;s.set(n,t),this._raycaster.setFromCamera(s,this._camera);var o=this._raycaster.intersectObjects(r,!0);if(o.length!==0){for(var a=o[0],l=a.object,c=this._objectCtxGet(l),h=l.parent;typeof c=="undefined"&&h;)c=this._objectCtxGet(h),h=h.parent;c&&this._notify(e,l,i,a)}}};Rt.prototype._notify=function(e,n,t,i){var r=this._objectCtxGet(n),s=r?r[e+"Handlers"]:null;if(!r||!s||s.length===0){n.parent&&this._notify(e,n.parent,t,i);return}for(var s=r[e+"Handlers"],o=0;o<s.length;o++){var a=s[o],l=!0;a.callback({type:e,target:n,origDomEvent:t,intersect:i,stopPropagation:function(){l=!1}}),l&&a.useCapture===!1&&n.parent&&this._notify(e,n.parent,t,i)}};Rt.prototype._onMouseDown=function(e){return this._onMouseEvent("mousedown",e)};Rt.prototype._onMouseUp=function(e){return this._onMouseEvent("mouseup",e)};Rt.prototype._onMouseEvent=function(e,n){var t=this._getRelativeMouseXY(n);this._onEvent(e,t.x,t.y,n)};Rt.prototype._onMouseMove=function(e){var n=this._getRelativeMouseXY(e);this._onMove("mousemove",n.x,n.y,e),this._onMove("mouseover",n.x,n.y,e),this._onMove("mouseout",n.x,n.y,e)};Rt.prototype._onClick=function(e){this._onMouseEvent("click",e)};Rt.prototype._onDblClick=function(e){this._onMouseEvent("dblclick",e)};Rt.prototype._onContextmenu=function(e){this._onMouseEvent("contextmenu",e)};Rt.prototype._onTouchStart=function(e){return this._onTouchEvent("touchstart",e)};Rt.prototype._onTouchEnd=function(e){return this._onTouchEvent("touchend",e)};Rt.prototype._onTouchMove=function(e){if(e.touches.length==1){var n=Number(e.touches[0].pageX/window.innerWidth)*2-1,t=-(e.touches[0].pageY/window.innerHeight)*2+1;this._onMove("mousemove",n,t,e),this._onMove("mouseover",n,t,e),this._onMove("mouseout",n,t,e)}};Rt.prototype._onTouchEvent=function(e,n){var t=n.touches;if(t.length==0&&(t=n.changedTouches),t.length==1){var i=Number(t[0].pageX/window.innerWidth)*2-1,r=-(t[0].pageY/window.innerHeight)*2+1;this._onEvent(e,i,r,n)}};class jc{constructor(n,t){v(this,"originObject3D");v(this,"hooks");v(this,"preventTapDefaultEvent",!1);v(this,"internalHooks");v(this,"disposers",[]);v(this,"helperObject3D");v(this,"camera");v(this,"model");v(this,"scene");v(this,"container");v(this,"domEvents");v(this,"isDragging",!1);v(this,"enabled",!1);v(this,"name","BaseController");v(this,"boundingBox");v(this,"config");v(this,"onRender");v(this,"onWantsTapGesture",n=>{if(this.getIntersectObject(n))return!1});v(this,"onWantsUpdateCameraDistance",()=>{if(this.camera.isPerspectiveCamera){const n=this.camera;this.helperObject3D.setScaleByCamera(n)}});v(this,"getBox",()=>this.boundingBox?this.boundingBox:(this.boundingBox=Ga(this.originObject3D),this.boundingBox));var h,u,d;this.hooks=(h=n.sharedHooks)!=null?h:new Cn,this.internalHooks=(u=n.sharedInternalHooks)!=null?u:new Cn,this.camera=n.camera,this.model=n.model,this.originObject3D=n.originObject3D,this.helperObject3D=n.helperObject3D,this.container=n.container,this.scene=n.scene,this.domEvents=new Rt(n.camera,n.container),this.onRender=(d=n.onRender)!=null?d:()=>{},this.config=t!=null?t:{},this.initialHelperPosition(),this.initialHelperQuaternion(),this.onWantsUpdateCameraDistance(),this.enable();const i=this.onSetOriginObjectScale.bind(this),r=this.onSetOriginObjectRotate.bind(this),s=this.onSetOriginObjectPosition.bind(this),o=this.onApplyOriginObjectScale.bind(this),a=this.onApplyOriginObjectRotate.bind(this),l=this.onApplyOriginObjectPosition.bind(this),c=this.initialHelperPosition.bind(this);this.internalHooks.on("setObjectPosition",this.onWantsUpdateCameraDistance),this.internalHooks.on("initialHelperPosition",this.onWantsUpdateCameraDistance),this.internalHooks.on("initialHelperPosition",c),this.internalHooks.on("setObjectScale",i),this.internalHooks.on("setObjectRotate",r),this.internalHooks.on("setObjectPosition",s),this.internalHooks.on("applyObjectPosition",l),this.internalHooks.on("applyObjectRotate",a),this.internalHooks.on("applyObjectScale",o),this.disposers.push(()=>{this.internalHooks.off("setObjectPosition",this.onWantsUpdateCameraDistance),this.internalHooks.off("initialHelperPosition",this.onWantsUpdateCameraDistance),this.internalHooks.off("initialHelperPosition",c),this.internalHooks.off("setObjectScale",i),this.internalHooks.off("setObjectRotate",r),this.internalHooks.off("setObjectPosition",s),this.internalHooks.off("applyObjectPosition",l),this.internalHooks.off("applyObjectRotate",a),this.internalHooks.off("applyObjectScale",o)})}initialHelperPosition(){this.helperObject3D.initialPosition(this.calculateOffset(this.config.offset))}initialHelperQuaternion(){var a,l,c;this.helperObject3D.initQuaternion();const n=(a=this.config.xAxis)!=null?a:new C.Vector3(1,0,0),t=(l=this.config.yAxis)!=null?l:new C.Vector3(0,1,0),i=(c=this.config.zAxis)!=null?c:new C.Vector3(0,0,1),r=new C.Quaternion;r.setFromUnitVectors(new C.Vector3(1,0,0),n.normalize());const s=new C.Quaternion;s.setFromUnitVectors(new C.Vector3(0,1,0),t.normalize());const o=new C.Quaternion;o.setFromUnitVectors(new C.Vector3(0,0,1),i.normalize()),this.helperObject3D.quaternion.premultiply(r),this.helperObject3D.quaternion.premultiply(s),this.helperObject3D.quaternion.premultiply(o)}enable(){this.enabled||(this.enabled=!0,this.scene.add(this.helperObject3D),this.helperObject3D.enable(),this.render())}disable(){this.enabled&&(this.enabled=!1,this.helperObject3D.disable(),this.render())}show(){this.helperObject3D.show(),this.render()}hide(){this.helperObject3D.hide(),this.render()}dispose(){var n;(n=this.disposers)==null||n.forEach(t=>t==null?void 0:t()),this.helperObject3D.dispose(),this.render()}applyHelperMatrix4(n){this.helperObject3D.applyMatrix4(n)}applyHelperQuaternion(n,t){this.helperObject3D.applyHelperQuaternion(n,t)}applyHelperScaleMatrix4(n,t){this.helperObject3D.applyHelperScaleMatrix4(n,t)}onWantsGesture(n,t,i){if(this.isDragging)return!1}onIntersectionOnModelUpdate(n){}onApplyOriginObjectScale(n){this.applyHelperScaleMatrix4(n.matrix,n.origin)}onApplyOriginObjectRotate(n){this.applyHelperQuaternion(n.quaternion,n.origin)}onApplyOriginObjectPosition(n){this.applyHelperMatrix4(n.matrix)}onSetOriginObjectScale(n){this.helperObject3D.scale.copy(n),this.updateOffsetByScale(n)}onSetOriginObjectRotate(n,t){this.helperObject3D.setHelperQuaternion(n,t)}onSetOriginObjectPosition(n){this.helperObject3D.position.copy(n.clone().add(this.calculateOffset(this.config.offset)))}render(){this.onRender()}updateOffsetByScale(n){if(this.boundingBox&&this.config.offset){const t=this.originObject3D.position,i=new C.Vector3().subVectors(this.boundingBox.max,t).multiply(n).add(t),r=new C.Vector3().subVectors(this.boundingBox.min,t).multiply(n).add(t),s=this.calculateOffset(this.config.offset,{min:r,max:i});this.helperObject3D.initialPosition(s)}}hoverListener(n,t=16777215,i=1){const r=zr(n).filter(At),s=[];for(const o of r)if(o.material||o instanceof C.Group){const a=o instanceof C.Group?o.children.filter(d=>d instanceof C.Mesh):[o];a.forEach(d=>{d.__originalColor__=d.material.color.clone(),d.__originalOpacity__=d.material.opacity});const l=()=>{a.forEach(d=>{d.material.color.set(t),d.material.opacity=i}),this.render()},c=()=>{a.forEach(d=>{d.material.color.copy(d.__originalColor__),d.material.opacity=d.__originalOpacity__}),this.render()},h=()=>{this.isDragging||l()},u=()=>{this.isDragging||c()};for(const d of a)this.domEvents.addEventListener(d,"mouseover",h),this.domEvents.addEventListener(d,"mouseout",u),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",c),this.hooks.on("rotateEnd",c),s.push(()=>{this.domEvents.removeEventListener(d,"mouseover",h),this.domEvents.removeEventListener(d,"mouseout",u),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",c),this.hooks.off("rotateEnd",c)})}return()=>s.forEach(o=>o==null?void 0:o())}getIntersectObject(n){const t=this.camera.position,i=this.helperObject3D;if(!i)return;const r=this.helperObject3D.raycasterIntersectObject(n)[0];if(!r)return;const s=r;if(s.object=i,this.model.intersectRaycaster){const o=this.model.intersectRaycaster(n)[0];if(o&&o.point.distanceTo(t)<s.point.distanceTo(t))return}return s.object}calculateOffset(n,t){const i=new C.Vector3(0,0,0);if(!n)return i;const r=()=>t||this.getBox();if(typeof n.x=="number")i.setX(n.x);else if(typeof n.x=="object"){const s=r();i.setX((s.max.x-s.min.x)*n.x.percents)}if(typeof n.y=="number")i.setY(n.y);else if(typeof n.y=="object"){const s=r();i.setY((s.max.y-s.min.y)*n.y.percents)}if(typeof n.z=="number")i.setZ(n.z);else if(typeof n.z=="object"){const s=r();i.setZ((s.max.z-s.min.z)*n.z.percents)}return i}}const VV=new C.Vector3;function so(e){var d;const{raycaster:n,line:t,clampToLine:i=!0}=e;if(((d=n.camera)==null?void 0:d.type)==="OrthographicCamera"){const f=n.ray.origin.clone();return t.closestPointToPoint(f,!1,new C.Vector3)}const r=new C.Plane().setFromNormalAndCoplanarPoint(n.ray.direction.clone().normalize(),n.ray.origin),s=r.projectPoint(t.start,new C.Vector3),o=r.projectPoint(t.end,new C.Vector3),a=new C.Line3(s,o),l=a.closestPointToPoint(n.ray.origin,i,VV),c=l.distanceTo(o),h=l.distanceTo(s),u=a.distance();if(c>h&&c>u){const f=-l.distanceTo(s)/u,m=t.start.clone().sub(t.end).normalize();return t.start.sub(m.clone().multiplyScalar(f*t.distance()))}else{const f=l.distanceTo(s)/u;return new C.Vector3().lerpVectors(t.start,t.end,f)}}class GV extends jc{constructor(...t){super(...t);v(this,"name","MoveController");v(this,"startInfo");v(this,"_moveByMouse",{enabled:!1});v(this,"mouseInfo");v(this,"mousedownEventListenerDisposer");v(this,"dragStart",t=>{if(this.moveByMouseEnable||this.isDragging)return;const i=t==null?void 0:t.intersect;if(!i)return this.dragEnd();const r=(i==null?void 0:i.object).direction;if(!r)return this.dragEnd();const s=new C.Vector3(1,0,0).applyQuaternion(this.helperObject3D.quaternion),o=new C.Vector3(0,1,0).applyQuaternion(this.helperObject3D.quaternion),a=new C.Vector3(0,0,1).applyQuaternion(this.helperObject3D.quaternion),l=(()=>{switch(r){case"x":return s;case"y":return o;case"z":return a}})(),c=i.point.clone(),h=new C.Line3(c.clone().sub(l.normalize()),c.clone().add(l.normalize()));this.startInfo={startVectorProject:c,line:h},this.helperObject3D.showDraggingHelper([r]),this.hooks.emit("moveStart"),this.isDragging=!0});v(this,"dragging",t=>{if(!this.isDragging||!this.startInfo)return;const i="touches"in t?t.touches[0].clientX:t.x,r="touches"in t?t.touches[0].clientY:t.y,s=Vd(this.camera,{x:i,y:r},this.container);return s?(this.move(s),!1):this.dragEnd()});v(this,"dragEnd",()=>{this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("moveEnd"))});const i=this.helperObject3D;this.hoverListener([i.xArrow,i.yArrow,i.zArrow]);const r=this.show.bind(this),s=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",this.dragStart),document.addEventListener("mousemove",this.dragging),document.addEventListener("mouseup",this.dragEnd),this.domEvents.addEventListener(this.helperObject3D,"touchstart",this.dragStart),document.addEventListener("touchmove",this.dragging),document.addEventListener("touchend",this.dragEnd),this.hooks.on("rotateStart",s),this.hooks.on("rotateEnd",r),this.hooks.on("scaleStart",s),this.hooks.on("scaleEnd",r),this.hooks.on("moveByMouseEnable",s),this.hooks.on("moveByMouseDisable",r),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",this.dragStart),document.removeEventListener("mousemove",this.dragging),document.removeEventListener("mouseup",this.dragEnd),this.domEvents.removeEventListener(this.helperObject3D,"touchstart",this.dragStart),document.removeEventListener("touchmove",this.dragging),document.removeEventListener("touchend",this.dragEnd),this.hooks.off("rotateStart",s),this.hooks.off("rotateEnd",r),this.hooks.off("scaleStart",s),this.hooks.off("scaleEnd",r),this.hooks.off("moveByMouseEnable",s),this.hooks.off("moveByMouseDisable",r)}),this.moveByMouseEnable&&this.moveByMouse()}get moveByMouseEnable(){return this._moveByMouse.enabled}dispose(){var t;super.dispose(),(t=this.disposers)==null||t.forEach(i=>i==null?void 0:i())}moveByMouse(t){this._moveByMouse={enabled:!0,useFaceNormal:t==null?void 0:t.useFaceNormal},this.preventTapDefaultEvent=!0;const i=this.handleMouseDown.bind(this),r=this.handleMouseUp.bind(this);this.hooks.emit("moveByMouseEnable"),setTimeout(()=>{this.container.addEventListener("mousedown",i),this.container.addEventListener("mouseup",r)}),this.mousedownEventListenerDisposer=()=>{this.container.removeEventListener("mousedown",i),this.container.removeEventListener("mouseup",r)}}disableMoveByMouse(){var t;this._moveByMouse={enabled:!1},this.preventTapDefaultEvent=!1,this.hooks.emit("moveByMouseDisable"),(t=this.mousedownEventListenerDisposer)==null||t.call(this)}onIntersectionOnModelUpdate(t){var o,a,l;if(!this.moveByMouseEnable)return;const{point:i,face:r}=t;if(!this.hooks.emit("wantToMove",i)){if(this.originObject3D.position.copy(i),(this._moveByMouse.useFaceNormal===!0||typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.enable!==!1)&&r!=null&&r.normal){const c=(()=>typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.alignmentVector?this._moveByMouse.useFaceNormal.alignmentVector:{x:0,y:1,z:0})(),h=new C.Vector3((o=c.x)!=null?o:0,(a=c.y)!=null?a:0,(l=c.z)!=null?l:0),u=(()=>typeof this._moveByMouse.useFaceNormal=="object"&&this._moveByMouse.useFaceNormal.fixedFaceNormal?this._moveByMouse.useFaceNormal.fixedFaceNormal(r.normal):r.normal)();this.originObject3D.quaternion.setFromUnitVectors(h,u),this.internalHooks.emit("setObjectRotate",this.originObject3D.quaternion.clone())}this.internalHooks.emit("setObjectPosition",i),this.hooks.emit("move",i)}}handleMouseDown(t){const{x:i,y:r}=t;this.mouseInfo={x:i,y:r,mouseDownTimestamp:Date.now()}}handleMouseUp(t){if(!this.mouseInfo)return;const{x:i,y:r}=t;this.mouseInfo.x===i&&this.mouseInfo.y===r&&Date.now()-this.mouseInfo.mouseDownTimestamp<500&&(this.disableMoveByMouse(),this.mouseInfo=void 0)}move(t){if(!this.startInfo)return this.dragEnd();const{line:i,startVectorProject:r}=this.startInfo,s=this.originObject3D,o=so({raycaster:t,line:i,clampToLine:!1}),a=o.clone().sub(r),l=new C.Matrix4;l.setPosition(a);const c=s.position.clone().applyMatrix4(l);this.hooks.emit("wantToMove",c)||(s.applyMatrix4(l),r.copy(o),this.internalHooks.emit("applyObjectPosition",{matrix:l}),this.hooks.emit("move",c))}}class bl{constructor(n,t,i,r,s,o,a){v(this,"helperController");v(this,"five");v(this,"onFiveWantsUpdateCameraDistance",()=>{var n,t;this.helperController&&((t=(n=this.helperController).onWantsUpdateCameraDistance)==null||t.call(n))});v(this,"onFiveWantsTapGesture",n=>{if(!this.helperController)return;if(this.helperController.preventTapDefaultEvent)return!1;const t=this.helperController.onWantsTapGesture(n);return this.five.needsRender=!0,t});v(this,"onFiveWantsGesture",(...n)=>{if(!this.helperController)return;const t=this.helperController.onWantsGesture(...n);return this.five.needsRender=!0,t});v(this,"onFiveIntersectionOnModelUpdate",(...n)=>{this.helperController&&this.helperController.onIntersectionOnModelUpdate(...n)});const{camera:l,model:c,scene:h}=n,u=n.getElement();if(this.five=n,!l||!c||!u||!h)return;const d=()=>{n.needsRender=!0};this.helperController=new t({camera:l,model:c,originObject3D:i,helperObject3D:r,container:u,scene:h,onRender:d,sharedHooks:o,sharedInternalHooks:a},s),n.on("wantsTapGesture",this.onFiveWantsTapGesture),n.on("wantsGesture",this.onFiveWantsGesture),n.on("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),n.on("cameraFovUpdate",this.onFiveWantsUpdateCameraDistance),n.on("cameraPositionUpdate",this.onFiveWantsUpdateCameraDistance)}dispose(){var n;this.five.off("wantsTapGesture",this.onFiveWantsTapGesture),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("intersectionOnModelUpdate",this.onFiveIntersectionOnModelUpdate),this.five.off("cameraFovUpdate",this.onFiveWantsUpdateCameraDistance),this.five.off("cameraPositionUpdate",this.onFiveWantsUpdateCameraDistance),(n=this.helperController)==null||n.dispose()}}const jV="v1.0.1",HV="Object3DHelper",$g=`${HV}@${jV}`,UV=()=>{console.error(`${$g} is disposed`)},WV=()=>{console.warn(`${$g} is disabled`)},QV=()=>{console.error(`${$g} is disabled`)};class YV{constructor(n){v(this,"controllers",{});v(this,"state",{visible:!0,enabled:!0,disposed:!1});v(this,"hooks",new Cn);v(this,"eventListener",{});n&&this.addControllers(n),this.setState(this.state)}show(n){return ee(this,null,function*(){this.setState({visible:!0},n)})}hide(n){return ee(this,null,function*(){this.setState({visible:!1},n)})}enable(n){this.setState({enabled:!0},n)}disable(n){this.setState({enabled:!1},n)}dispose(){this.setState({disposed:!0})}setState(n,t){if(this.state.disposed)return UV();if(!this.state.enabled&&n.enabled!==!0&&n.disposed!==!0)return QV();const i=R({},this.state);this.state=R(R({},this.state),n),n.disposed!==void 0&&n.disposed!==i.disposed&&n.disposed&&this.handleDispose(),n.visible!==void 0&&this.handleVisible(n.visible),n.enabled!==void 0&&this.handleEnable(n.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:i})}addControllers(n){this.controllers=R(R({},this.controllers),n),this.setState(this.state)}getCurrentState(){return this.state}handleEnable(n,t=!0){n?(this.everyControllerDo(i=>{i.enable()}),this.hooks.emit("enable",{userAction:t})):(this.everyControllerDo(i=>{i.disable()}),this.hooks.emit("disable",{userAction:t})),this.state.enabled=n}handleVisible(n,t=!0){n?(this.everyControllerDo(i=>{i.show()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:t}))):(this.everyControllerDo(i=>{i.hide()}),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:t}))),this.state.visible=n}everyControllerDo(n){Object.values(this.controllers).forEach(t=>{t&&n(t)})}handleDispose(){var n,t;Object.values(this.controllers).forEach(i=>{i==null||i.dispose()});for(const i in this.controllers){if(!i)continue;const r=i;(t=(n=this.eventListener)[r])==null||t.call(n)}}actionIfStateIsEnabled(n,t){if(this.state.enabled)return n();t!=null&&t.warnLog&&WV()}}function gp(e){return e*Math.PI/180}const vp=new C.Quaternion;class XV extends jc{constructor(...t){var c,h,u;super(...t);v(this,"name","RotateController");v(this,"startInfo");v(this,"removeListener");const i=this.helperObject3D;this.hoverListener([(c=i.xCircle)==null?void 0:c.circle,(h=i.yCircle)==null?void 0:h.circle,(u=i.zCircle)==null?void 0:u.circle].filter(Boolean));const r=this.dragStart.bind(this),s=this.dragging.bind(this),o=this.dragEnd.bind(this),a=this.show.bind(this),l=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",r),document.addEventListener("mousemove",s),document.addEventListener("mouseup",o),this.domEvents.addEventListener(this.helperObject3D,"touchstart",r),document.addEventListener("touchmove",s),document.addEventListener("touchend",o),this.hooks.on("moveStart",l),this.hooks.on("moveEnd",a),this.hooks.on("scaleStart",l),this.hooks.on("scaleEnd",a),this.hooks.on("moveByMouseEnable",l),this.hooks.on("moveByMouseDisable",a),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",r),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",o),this.domEvents.removeEventListener(this.helperObject3D,"touchstart",r),document.removeEventListener("touchmove",s),document.removeEventListener("touchend",o),this.hooks.off("moveStart",l),this.hooks.off("moveEnd",a),this.hooks.off("scaleStart",l),this.hooks.off("scaleEnd",a),this.hooks.off("moveByMouseEnable",l),this.hooks.off("moveByMouseDisable",a)})}get rotateCenter(){return this.helperObject3D.position.clone()}setRotateAngle(t){const{x:i=0,y:r=0,z:s=0}=t,o=new C.Euler(gp(i),gp(r),gp(s)),a=new C.Quaternion().setFromEuler(o);if(this.hooks.emit("wantToRotate",a))return;const{originObject3D:c,rotateCenter:h}=this;GM(c,a,h),this.internalHooks.emit("setObjectRotate",a,h),this.hooks.emit("rotate",a),this.render()}onApplyOriginObjectRotate(t){this.isDragging||super.onApplyOriginObjectRotate(t)}onApplyOriginObjectScale(t){}dragStart(t){if(this.isDragging)return;const i=t==null?void 0:t.intersect;if(!i)return this.dragEnd();const r=(i==null?void 0:i.object).direction;if(!r)return this.dragEnd();const s=i.point,o=this.getAngleHelper(r);this.setTipsAngle(0);const a=s.clone();a.y+=.2,this.setTipsPosition(a);const l=this.helperObject3D.quaternion.clone(),c=(()=>{if(r==="x")return new C.Vector3(1,0,0).applyQuaternion(l);if(r==="y")return new C.Vector3(0,1,0).applyQuaternion(l);if(r==="z")return new C.Vector3(0,0,1).applyQuaternion(l)})(),h=new C.Plane().setFromNormalAndCoplanarPoint(c,s),d=h.projectPoint(s.clone(),new C.Vector3).clone().sub(this.rotateCenter),f=d.angleTo(o.baseAxes.clone().applyQuaternion(l));this.setAngleHelperStart(r,f),this.setAngleHelperLength(r,0),this.startInfo={direction:r,startVector:d,plane:h,angleHelper:o,angle:0,helperQuaternion:l.clone()},vp.copy(l),this.helperObject3D.showDraggingHelper([r]),this.hooks.emit("rotateStart"),this.isDragging=!0}dragging(t){if(!this.isDragging)return;const i="touches"in t?t.touches[0].clientX:t.x,r="touches"in t?t.touches[0].clientY:t.y,s=Vd(this.camera,{x:i,y:r},this.container);return s?(this.rotate(s),!1):this.dragEnd()}rotate(t){if(!this.startInfo)return this.dragEnd();const{startVector:i,plane:r,angleHelper:s,direction:o,helperQuaternion:a}=this.startInfo,{originObject3D:l}=this,c=t.ray.intersectPlane(r,new C.Vector3);if(!c)return;const h=this.rotateCenter.clone(),d=r.projectPoint(c.clone(),new C.Vector3).clone().sub(h);if(i.angleTo(d)===0)return;const f=new C.Quaternion().setFromUnitVectors(i.clone().normalize(),d.clone().normalize()),m=l.quaternion.clone().premultiply(f);if(this.hooks.emit("wantToRotate",m))return;const y=new C.Euler().setFromQuaternion(new C.Quaternion().setFromUnitVectors(i.clone().normalize().applyQuaternion(a.clone().inverse()),d.clone().normalize().applyQuaternion(a.clone().inverse())),`${o.toUpperCase()}${"XZY".replace(o.toUpperCase(),"")}`)[o]*s.angleDirection;if(this.startInfo.angle+=y,this.setAngleHelperLength(o,this.startInfo.angle),this.setTipsAngle(Pg(this.startInfo.angle)),h){const b=new C.Vector3().subVectors(l.position,h).applyQuaternion(f).add(h);l.position.copy(b)}l.applyQuaternion(f),vp.premultiply(f),this.internalHooks.emit("applyObjectRotate",{quaternion:f,origin:h}),this.hooks.emit("rotate",l.quaternion),this.startInfo.startVector=d}dragEnd(){this.isDragging&&(this.internalHooks.emit("setObjectRotate",vp,this.rotateCenter),this.startInfo=void 0,this.isDragging=!1,this.helperObject3D.show(),this.hooks.emit("rotateEnd"))}getAngleHelper(t){var i,r,s;switch(t){case"x":return(i=this.helperObject3D.xCircle)==null?void 0:i.angleSector;case"y":return(r=this.helperObject3D.yCircle)==null?void 0:r.angleSector;case"z":return(s=this.helperObject3D.zCircle)==null?void 0:s.angleSector}}setAngleHelperStart(t,i){const r=this.getAngleHelper(t);if(!r){console.warn("angleHelper is undefined");return}if(r instanceof C.Mesh&&r.geometry instanceof C.CircleGeometry){const{radius:s,segments:o,thetaLength:a}=r.geometry.parameters;r.geometry=new C.CircleGeometry(s,o,i,a)}else console.warn("only support THREE.CircleGeometry")}setAngleHelperLength(t,i){const s=i>=0?Math.max(i,.001):Math.min(i,-.001),o=this.getAngleHelper(t);if(o instanceof C.Mesh&&o.geometry instanceof C.CircleGeometry){const{radius:a,thetaStart:l}=o.geometry.parameters,c=Math.ceil(Math.abs(s)*(40/(2*Math.PI)));o.geometry=new C.CircleGeometry(a,c,l,s)}else console.warn("only support THREE.CircleGeometry")}setTipsAngle(t){var r;const i=(r=this.helperObject3D.angleTips)==null?void 0:r.element;i&&(i.innerText=`${t.toFixed(0)}°`)}setTipsPosition(t){const i=this.helperObject3D.angleTips;if(!i)return;const r=t.project(this.camera),{x:s,y:o,z:a}=r;if(a>1)return;const l=(s+1)/2*100+"%",c=(-o+1)/2*100+"%";i.setLeftTop(l,c)}}class ZV extends jc{constructor(...t){super(...t);v(this,"startInfo");v(this,"name","RectangleScaleController")}enable(){this.helperObject3D.enable(),super.enable()}disable(){this.helperObject3D.disable(),super.disable()}show(){this.helperObject3D.show(),super.show()}hide(){this.helperObject3D.hide(),super.hide()}onApplyOriginObjectPosition(t){this.isDragging||super.onApplyOriginObjectPosition(t)}onApplyOriginObjectScale(t){this.helperObject3D.applyHelperScaleMatrix4(t.matrix,t.origin)}getDragPlane(){const t=new C.Plane,i=this.helperObject3D.cornerPositions;if(i.length!==0)return i.length<3?t.setFromNormalAndCoplanarPoint(this.originObject3D.getWorldDirection(new ne.Vector3),i[0]):t.setFromCoplanarPoints(i[0],i[1],i[2]),t}dragStart(t,i){var s,o;(o=(s=this.helperObject3D).updatePoints)==null||o.call(s);const r=this.getDragPlane();if(!r)return this.dragEnd();this.startInfo={startPoint:{position:i.position.clone(),direction:i.direction},plane:r},this.hooks.emit("scaleStart"),this.render(),this.isDragging=!0}dragging(t){if(!this.isDragging)return;const i=Vd(this.camera,t,this.container);if(!i)return this.dragEnd();this.scale(i)}scale(t){var T,z;if(!this.startInfo)return;const i=this.originObject3D,{startPoint:r,plane:s}=this.startInfo,o=this.helperObject3D.cornerPositions;if(o.length<4)return this.dragEnd();const a=t.ray.intersectPlane(s,new ne.Vector3);if(!a||IV(a,this.camera.position))return;const l=new ne.Vector3().addVectors(o[0],o[2]).divideScalar(2),{position:c,direction:h}=r,u=new ne.Vector3().subVectors(o[1],o[0]),d=new ne.Vector3().subVectors(o[3],o[0]),f=D=>{const k=new ne.Vector3(0,0,0);if(!this.startInfo)return k;const O=(D==="ew"?u:d).clone(),G=c.clone().projectOnVector(O),I=a.clone().projectOnVector(O),U=l.clone().projectOnVector(O);if(I.equals(G))return k;if(D==="ns"&&typeof this.startInfo.dragPointInCenterBottom!="boolean"){const te=new ne.Vector3().subVectors(I,U),ie=te.x<0&&O.x>=0,fe=te.y<0&&O.y>=0,ye=te.z<0&&O.z>=0;this.startInfo.dragPointInCenterBottom=ie||fe||ye}if(D==="ew"&&typeof this.startInfo.dragPointInCenterLeft!="boolean"){const te=new ne.Vector3().subVectors(I,U),ie=te.x<0&&O.x>=0,fe=te.y<0&&O.y>=0,ye=te.z<0&&O.z>=0;this.startInfo.dragPointInCenterLeft=ie||fe||ye}const q=new ne.Vector3().subVectors(I,G),K=q.length();return K>.3?(console.warn("offset.length() > 0.3, skipped",K),k):q},m=f("ew"),p=f("ns"),g=()=>{const D=m;this.helperObject3D.cornerPositions.forEach((k,O)=>{var G;(G=this.startInfo)!=null&&G.dragPointInCenterLeft?(O===0||O===3)&&k.add(D):(O===1||O===2)&&k.add(D)})},y=()=>{const D=p;this.helperObject3D.cornerPositions.forEach((k,O)=>{var G;(G=this.startInfo)!=null&&G.dragPointInCenterBottom?(O===0||O===1)&&k.add(D):(O===2||O===3)&&k.add(D)})};switch(h){case"ew":g();break;case"ns":y();break;case"nesw":case"nwse":g(),y()}const b=new ne.Vector3().subVectors(o[1],o[0]).length()/u.length(),A=new ne.Vector3().subVectors(o[3],o[0]).length()/d.length(),w=new ne.Vector3(b,A,1),x=new C.Matrix4().scale(w);i.isCSS3DObjectPlus?i.applyScaleMatrix4(x):i.scale.applyMatrix4(x),r.position.copy(a);const M=new ne.Vector3().addVectors(o[0],o[2]).divideScalar(2),P=new ne.Vector3().subVectors(M,l),S=new C.Matrix4().setPosition(P);i.applyMatrix4(S),(T=this.helperObject3D.css3DInstance)==null||T.css3DObject.applyMatrix4(S),(z=this.helperObject3D.plane)==null||z.applyMatrix4(S),this.internalHooks.emit("applyObjectScale",{matrix:x}),this.internalHooks.emit("applyObjectPosition",{matrix:S}),this.render()}dragEnd(){this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.hooks.emit("scaleEnd"),this.render())}}class JV extends ZV{constructor(...t){super(...t);v(this,"name","CSS3DScaleController");this.addHTMLEventListener()}addHTMLEventListener(){this.helperObject3D.points.forEach(t=>{if(!t)return;const i=t.point,r=a=>this.dragStart(a,t),s=this.dragging.bind(this),o=this.dragEnd.bind(this);i.addEventListener("dragstart",r),i.addEventListener("drag",s),i.addEventListener("dragend",o)})}}class qV extends jc{constructor(...t){super(...t);v(this,"name","BoundingBoxController")}}class KV extends CV{constructor(t,i){super(t,i);v(this,"scaleMeshes",[]);v(this,"positions",[]);i&&(this.positions=i.positions)}initialPosition(t){this.position.copy(this.originObject3D.position),this.scaleMeshes.length&&this.remove(...this.scaleMeshes);const i=typeof this.positions=="function"?this.positions():this.positions;i&&(this.scaleMeshes=i.map(r=>{const s=$V();return s.position.copy(r.handlePosition),s.scalePosition=r,s}),this.add(...this.scaleMeshes))}setScaleByCamera(t){this.scaleMeshes.forEach(i=>{i.scale.setScalar(Kg(t,i.scalePosition.handlePosition.clone().applyMatrix4(this.matrixWorld)))})}}function $V(){const n=new C.BoxGeometry(.05,.05,.05),t=new C.MeshBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1,transparent:!0,side:C.DoubleSide}),i=new C.Mesh(n,t);return i.renderOrder=10,i}class e8 extends jc{constructor(...t){super(...t);v(this,"name","ScaleController");v(this,"startInfo");v(this,"dragStart",t=>{if(this.isDragging)return;this.isDragging=!0;const{intersect:i}=t,r=this.camera.position,s=i.object,o=s.scalePosition.basePosition.clone(),l=s.scalePosition.handlePosition.clone().clone().sub(o).clone(),c=new C.Line3(o,o.clone().add(l.normalize().multiplyScalar(5)));c.applyMatrix4(this.helperObject3D.matrixWorld);const h=new C.Raycaster(r,i.point.clone().sub(r)),u=so({raycaster:h,line:c});this.startInfo={line:c,scaleStartPoint:u,draggingObject:s},this.hooks.emit("scaleStart")});v(this,"dragging",t=>{if(!this.isDragging||!this.startInfo)return;const i="touches"in t?t.touches[0].clientX:t.x,r="touches"in t?t.touches[0].clientY:t.y,s=Vd(this.camera,{x:i,y:r},this.container);return s?(this.scale(s),!1):this.dragEnd()});v(this,"scale",t=>{var c,h;if(!this.startInfo)return;const{line:i,scaleStartPoint:r,draggingObject:s}=this.startInfo,{scalePosition:o}=s,{basePosition:a}=o,l=so({raycaster:t,line:i});l.applyMatrix4(new C.Matrix4().getInverse(this.helperObject3D.matrixWorld.clone())),(h=(c=this.config)==null?void 0:c.scaleCallback)==null||h.call(c,{ratio:l.distanceTo(a)/r.distanceTo(a),intersectPoint:l,scalePosition:o}),s.position.copy(l.clone())});v(this,"dragEnd",()=>{this.isDragging&&(this.startInfo=void 0,this.isDragging=!1,this.internalHooks.emit("initialHelperPosition"),this.hooks.emit("scaleEnd"))});const i=this.show.bind(this),r=this.hide.bind(this);this.domEvents.addEventListener(this.helperObject3D,"mousedown",this.dragStart),document.addEventListener("mousemove",this.dragging),document.addEventListener("mouseup",this.dragEnd),this.domEvents.addEventListener(this.helperObject3D,"touchstart",this.dragStart),document.addEventListener("touchmove",this.dragging),document.addEventListener("touchend",this.dragEnd),this.hooks.on("rotateStart",r),this.hooks.on("rotateEnd",i),this.hooks.on("moveStart",r),this.hooks.on("moveEnd",i),this.hooks.on("moveByMouseEnable",r),this.hooks.on("moveByMouseDisable",i),this.disposers.push(()=>{this.domEvents.removeEventListener(this.helperObject3D,"mousedown",this.dragStart),document.removeEventListener("mousemove",this.dragging),document.removeEventListener("mouseup",this.dragEnd),this.domEvents.removeEventListener(this.helperObject3D,"touchstart",this.dragStart),document.removeEventListener("touchmove",this.dragging),document.removeEventListener("touchend",this.dragEnd),this.hooks.off("rotateStart",r),this.hooks.off("rotateEnd",i),this.hooks.off("moveStart",r),this.hooks.off("moveEnd",i),this.hooks.off("moveByMouseEnable",r),this.hooks.off("moveByMouseDisable",i)})}initialHelperQuaternion(){this.helperObject3D.initQuaternion()}initialHelperPosition(){this.helperObject3D.initialPosition();const t=this;t.offHoverListener&&t.offHoverListener(),t.offHoverListener=this.hoverListener(this.helperObject3D.scaleMeshes)}setScale(t){var l,c,h;let i=1,r=1,s=1;typeof t=="number"?(i=t,r=t,s=t):typeof t=="object"&&(i=(l=t.x)!=null?l:1,r=(c=t.y)!=null?c:1,s=(h=t.z)!=null?h:1);const o=new C.Vector3(i,r,s);this.hooks.emit("wantToScale",o)||(this.originObject3D.scale.copy(o),this.internalHooks.emit("setObjectScale",o),this.hooks.emit("scale",o),this.render())}}const jm="Object3DHelperPlugin",Gd=jm,t8=()=>{console.error(`${Gd} is disposed`)},n8=()=>{console.warn(`${Gd} is disabled`)},i8=()=>{console.error(`${Gd} is disabled`)};class ev extends ws{constructor(t){super(t);v(this,"name",jm);v(this,"state",{visible:!0,enabled:!0,disposed:!1});v(this,"objectHelperMap",new Map);v(this,"css3DObjectParentMap",new Map);v(this,"css3DRender");this.five=t,this.css3DRender=new Ia(this.five.scene),console.warn("Object3DHelper: 使用此插件,需要在初始化five时,设置five参数: { backgroundAlpha: 0, backgroundColor: 0x000000 }"),Object.assign(window,{[`__${jm.toUpperCase()}_DEBUG__`]:this})}show(t){return ee(this,null,function*(){this.setState({visible:!0},t)})}hide(t){return ee(this,null,function*(){this.setState({visible:!1},t)})}enable(t){this.setState({enabled:!0},t)}disable(t){this.setState({enabled:!1},t)}dispose(){this.setState({disposed:!0})}setState(t,i){if(this.state.disposed)return t8();if(!this.state.enabled&&t.enabled!==!0&&t.disposed!==!0)return i8();const r=R({},this.state);this.state=R(R({},this.state),t),t.disposed!==void 0&&t.disposed!==r.disposed&&t.disposed&&this.handleDispose(),t.visible!==void 0&&t.visible!==r.visible&&this.handleVisible(t.visible),t.enabled!==void 0&&t.enabled!==r.enabled&&this.handleEnable(t.enabled),this.hooks.emit("stateChange",{state:this.state,prevState:r})}getObject3DHelper(t){return this.objectHelperMap.get(t)}addObject3DHelper(t,i={}){var y;if(!t){console.error("Object3D is undefined");return}if(this.objectHelperMap.has(t)){console.warn(`Object3DHelperPlugin: object3D ${t.name} is already has helper`);return}const r=new YV,s=[],o=(y=this.five.getElement())==null?void 0:y.parentElement,a=this.five.camera,c=R(R({},{moveHelper:!0,rotateHelper:!0,scaleHelper:!0,boundingBoxHelper:!1,positionFrom:"objectPosition"}),i),{moveHelper:h,rotateHelper:u,scaleHelper:d,boundingBoxHelper:f}=c,m=new Cn,p=new Cn,g=b=>{if(b)return typeof b=="boolean"?b:b.enable};if(g(h)){const b=R(R({},this.getConfig(c.moveHelper)),c),A=new TV(t,R({},b)),w=new bl(this.five,GV,t,A,b,m,p);r.addControllers({moveController:w.helperController}),s.push(()=>w.dispose())}if(g(u)){const b=R(R({},this.getConfig(c.rotateHelper)),c),A=new kV(t,R({container:o},b)),w=new bl(this.five,XV,t,A,b,m,p);r.addControllers({rotateController:w.helperController}),s.push(()=>w.dispose())}if(g(f)){const b=new FV(t),A=new bl(this.five,qV,t,b,void 0,m,p);r.addControllers({boundingBoxController:A.helperController})}if(g(d))if(t.isCSS3DObjectPlus&&o){const b=new NV(t,o,a,this.five.scene),A=new bl(this.five,JV,t,b,void 0,m,p);r.addControllers({scaleController:A.helperController}),s.push(()=>A.dispose()),Ha(this.five).then(()=>{var w,x;if(t.isCSS3DObjectPlus){const M=t;if(!M||M.mode!=="front")return;const P=(w=this.css3DRender.behindModeCSS3DRenderer.wrapper)!=null?w:sx(this.five);P&&(this.css3DObjectParentMap.set(M,M.parent),M.removeFromParent(),this.css3DRender.behindModeCSS3DRenderer.setWrapper(P),(x=this.css3DRender.getBehindCSS3DObjectGroup())==null||x.add(M),this.css3DRender.render(this.five.camera))}})}else{const b=R(R({},this.getConfig(c.scaleHelper)),c),A=new KV(t,b),w=new bl(this.five,e8,t,A,b,m,p);r.addControllers({scaleController:w.helperController}),s.push(()=>w.dispose())}return this.objectHelperMap.set(t,{helper:r,disposers:s}),r.controllers}removeObject3DHelper(t){if(!this.objectHelperMap.has(t))return;const{helper:i,disposers:r}=this.objectHelperMap.get(t);if(i){if(t.isCSS3DObjectPlus){const s=t,o=this.css3DObjectParentMap.get(s);o&&o.add(s),this.css3DRender.render(this.five.camera)}this.objectHelperMap.delete(t),i.dispose(),r==null||r.forEach(s=>s==null?void 0:s())}}handleEnable(t,i=!0){t?(this.everyHelperDo(r=>r.enable()),this.hooks.emit("enable",{userAction:i})):(this.everyHelperDo(r=>r.disable()),this.hooks.emit("disable",{userAction:i})),this.state.enabled=t}handleVisible(t,i=!0){t?(this.everyHelperDo(r=>r.show()),this.actionIfStateIsEnabled(()=>this.hooks.emit("show",{userAction:i}))):(this.everyHelperDo(r=>r.hide()),this.actionIfStateIsEnabled(()=>this.hooks.emit("hide",{userAction:i}))),this.state.visible=t}handleDispose(){this.everyHelperDo((t,i)=>{t.dispose(),i==null||i.forEach(r=>r==null?void 0:r())})}everyHelperDo(t){this.objectHelperMap.forEach(({helper:i,disposers:r})=>{i&&t(i,r)})}actionIfStateIsEnabled(t,i){if(this.state.enabled)return t();i!=null&&i.warnLog&&n8()}getConfig(t){if(t&&typeof t!="boolean"&&t.enable)return t}}const r8=e=>new ev(e),s8=`
3705
3705
  varying vec2 vUv;
3706
3706
  void main() {
3707
3707
  vUv = uv;
3708
3708
  vec4 mvPosition = modelViewMatrix * vec4(position, 1);
3709
3709
  gl_Position = projectionMatrix * mvPosition;
3710
3710
  }
3711
- `,l8=`
3711
+ `,o8=`
3712
3712
  uniform sampler2D map;
3713
3713
  uniform vec4 size;
3714
3714
  varying vec2 vUv;
@@ -3723,13 +3723,13 @@ void main() {
3723
3723
  float match = (1.0 - step(0.5, abs(uv.x - 0.5))) * (1.0 - step(0.5, abs(uv.y - 0.5))) * (transX < transY ? transX : transY);
3724
3724
  gl_FragColor = vec4(texture2D(map, uv).xyz, match * opacity);
3725
3725
  }
3726
- `;function c8(e){const n=Math.PI*2;let t=-Math.atan2(e.x,-e.z);t=(t%n+n)%n;const i=-Math.asin(e.y/1);return{longitude:t,latitude:i}}class v1{constructor(n,t){v(this,"video");v(this,"_id");v(this,"url");v(this,"five");v(this,"panoIndex");v(this,"observer");v(this,"origin");v(this,"videoMesh");v(this,"_enabled",!0);v(this,"_disposed",!1);v(this,"videoDataLoaded",!1);v(this,"hasVideoEverPlayed",!1);v(this,"renderFiveDisposer");v(this,"hooks");v(this,"unmute",()=>{this.video.muted=!1});v(this,"uv2Position",(n,t)=>{var f;const r=Math.PI,s=Math.PI*2,o=n,a=1-t,l=new ne.Vector3(-1*Math.cos(s*o)*Math.sin(r*a),1*Math.cos(r*a),1*Math.sin(s*o)*Math.sin(r*a));l.setX(-l.x);const c=(f=this.five.work)==null?void 0:f.observers[this.panoIndex];if(!c)return this.logWarning(`点位 ${this.panoIndex} 不存在,请检查 Five 数据是否正常。`);const h=c.position.clone(),u=c.quaternion.clone(),d=l.clone();return d.applyAxisAngle(new ne.Vector3(0,1,0),Math.PI/2),d.applyQuaternion(u),d.add(h),d});v(this,"onFiveDataLoaded",()=>{var l;const n=(l=this.five.work)==null?void 0:l.observers[this.panoIndex];if(!n)return this.logWarning(`点位 ${this.panoIndex} 不存在,请检查 Five 数据是否正常。`);this.observer=n;const{x:t,y:i,z:r,w:s}=n.quaternion,o=new ne.Quaternion(t,i,r,s),a=n.position;this.videoMesh.position.fromArray([a.x,a.y,a.z]),this.videoMesh.quaternion.set(0,0,0,1),this.videoMesh.rotateOnAxis(new ne.Vector3(0,1,0),Math.PI/2),this.videoMesh.applyQuaternion(o)});v(this,"onFiveWantsMoveToPano",n=>{n===this.panoIndex&&(this.hasVideoEverPlayed||this.video.play().catch(()=>{}))});v(this,"onFivePanoArrived",n=>{if(this.disposed)return this.logWarning("实例已被销毁");this.enabled&&this.panoIndex===n&&this.mount()});v(this,"onFivePanoWillArrive",n=>{if(n!==this.panoIndex)return this.unmount();this.panoIndex!==n&&this.unmount()});v(this,"onFiveModeChange",n=>{n!=="Panorama"&&this.hide()});v(this,"onFiveInitAnimationEnded",()=>{const n=this.five.getCurrentState();n.mode==="Panorama"&&n.panoIndex===this.panoIndex&&this.mount()});v(this,"onFiveWantsTapGesture",n=>{if(!this.five.scene.children.includes(this.videoMesh))return;if(this.disposed)return this.logWarning("实例已被销毁");if(!this.enabled)return this.logWarning("实例已被禁用");const[t]=n.intersectObject(this.videoMesh);if(!t)return;if(this.checkIntersectionInBounding(this.origin,t)){const r={target:this,_preventDefaultReturn:!1,preventDefault:()=>{r._preventDefaultReturn=!0}};return this.hooks.emit("click",r),r._preventDefaultReturn===!1&&(this.video.muted=!this.video.muted),!1}});v(this,"onVideoDataLoaded",()=>{this.videoDataLoaded=!0,this.video.paused===!1&&this.video.src!==""&&this.onVideoPlayingAndLoaded()});v(this,"onVideoPlaying",()=>{this.hasVideoEverPlayed=!0,this.enabled&&this.videoDataLoaded&&this.onVideoPlayingAndLoaded()});v(this,"onVideoPlayingAndLoaded",()=>{if(!this.videoDataLoaded)return this.logWarning("视频数据未加载");if(this.video.paused===!0)return this.logWarning("视频已暂停");this.video.addEventListener("timeupdate",()=>{if(this.enabled&&this.panoIndex===this.five.getCurrentState().panoIndex&&this.five.getCurrentState().mode==="Panorama"&&(this.renderFiveDisposer||(this.renderFiveDisposer=ja(()=>{this.five.needsRender=!0},30)),this.five.scene.add(this.videoMesh),this.videoMesh.material.uniforms.opacity.value===0)){const n={value:0};fu({targets:n,value:1,duration:300,easing:"linear",update:()=>{this.videoMesh.material.uniforms.opacity.value=n.value},complete:()=>{this.videoMesh.material.uniforms.opacity.value=1}})}},{once:!0})});v(this,"onVideoPaused",()=>{var n;(n=this.renderFiveDisposer)==null||n.call(this),this.renderFiveDisposer=void 0});var l,c;this.five=n,this.panoIndex=t.panoIndex,this._id=t.renderID,this.url=t.url,this.origin=t.origin.slice(),this.hooks=t.hooks,this._enabled=(c=(l=t.initialState)==null?void 0:l.enabled)!=null?c:!0;const i=document.createElement("video");i.crossOrigin="anonymous",i.autoplay=!1,i.muted=!0,i.loop=!0,i.playsInline=!0,this.video=i;const r=new ne.VideoTexture(this.video);r.minFilter=ne.LinearFilter,r.magFilter=ne.LinearFilter;const s=new ne.ShaderMaterial({vertexShader:a8,fragmentShader:l8,uniforms:{map:{value:r},size:{value:new ne.Vector4(this.origin[0],1-this.origin[1]-this.origin[3],this.origin[2],this.origin[3])},opacity:{value:0}},depthTest:!0,transparent:!0}),o=new ne.SphereBufferGeometry(1,64,64);o.scale(-1,1,1);const a=new ne.Mesh(o,s);a.name="pano-video-plugin",this.videoMesh=a,this.five.work&&this.onFiveDataLoaded(),this.enabled&&this.addEventListeners(),this.mountIfNeeded(),window[`__PANOVIDEO_${this.renderID}_DEBUG__`]=this}get renderID(){return this._id}get disposed(){return this._disposed}get enabled(){return this._enabled}dispose(){this.disposed||(this.disable(),this._disposed=!0)}enable(){this.disposed||this.enabled||(this._enabled=!0,!this.observer&&this.five.work&&this.onFiveDataLoaded(),this.addEventListeners(),this.mountIfNeeded())}disable(){this.disposed||this.enabled&&(this._enabled=!1,this.removeEventListeners(),this.unmount())}lookAtVideo(){if(!this.observer)return;const n=this.getUVCenter();if(!n)return;const t=this.uv2Position(n[0],n[1]);if(!t)return;const i=new ne.Vector3().subVectors(t,this.observer.position).normalize(),{longitude:r,latitude:s}=c8(i);this.five.setState({panoIndex:this.panoIndex,longitude:r,latitude:s}),this.onFiveWantsMoveToPano(this.panoIndex)}getUVCenter(){if(!this.origin)return;const n=this.origin[0]+this.origin[2]/2,t=this.origin[1]+this.origin[3]/2;return[n,t]}addEventListeners(){this.five.on("loaded",this.onFiveDataLoaded),this.five.on("modeChange",this.onFiveModeChange),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive),this.five.on("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.on("wantsTapGesture",this.onFiveWantsTapGesture),this.five.on("initAnimationEnded",this.onFiveInitAnimationEnded),this.video.addEventListener("canplaythrough",this.onVideoDataLoaded),this.video.addEventListener("playing",this.onVideoPlaying),this.video.addEventListener("pause",this.onVideoPaused)}removeEventListeners(){this.five.off("loaded",this.onFiveDataLoaded),this.five.off("modeChange",this.onFiveModeChange),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.off("wantsTapGesture",this.onFiveWantsTapGesture),this.five.off("initAnimationEnded",this.onFiveInitAnimationEnded),this.video.removeEventListener("canplaythrough",this.onVideoDataLoaded),this.video.removeEventListener("playing",this.onVideoPlaying),this.video.removeEventListener("pause",this.onVideoPaused)}mountIfNeeded(){const n=this.five.getCurrentState();n.mode==="Panorama"&&n.panoIndex===this.panoIndex&&this.enabled&&this.mount()}mount(){if(this.disposed)return this.logWarning("插件已经销毁,无法挂载。");if(this.url==="")return this.logWarning("视频资源不存在。");this.video.src!==this.url&&(this.video.src=this.url),this.video.paused&&this.video.play().catch(n=>{this.logWarning(n instanceof Error?n.message:"视频播放失败。"),this.five.once("gesture",()=>{this.video.play().catch(t=>{this.logWarning(t instanceof Error?t.message:"自动播放视频失败。")})})})}unmount(){this.video.pause(),this.videoMesh.material.uniforms.opacity.value=0,this.video.src!==""&&(this.video.src=""),this.five.scene.remove(this.videoMesh)}hide(){this.video.pause(),this.videoMesh.material.uniforms.opacity.value=0,this.five.scene.remove(this.videoMesh)}logWarning(n){console.warn("⛔ ==> [VideoMeshController]:",n)}checkIntersectionInBounding(n,t){if(!t.uv)return!1;const[i,r]=t.uv.toArray(),[s,o,a,l]=n,c=1-o-l,h=s+a,u=c+l;return i>=s&&i<=h&&r>=c&&r<=u}}class h8 extends ws{constructor(t){super(t);v(this,"controllerMap",new Map);v(this,"data");v(this,"enabled",!0);v(this,"_disposed",!1)}get state(){return{enabled:this.enabled}}get disposed(){return this._disposed}load(t,i){var r;if(this.disposed)return this.logWarning("插件已被销毁");typeof((r=i==null?void 0:i.initialState)==null?void 0:r.enabled)!="undefined"&&i.initialState.enabled!==this.enabled&&(i.initialState.enabled?this.enable():this.disable()),t.list.forEach(s=>{const o=s.pano_index,a=s.render_id;s.video_list.forEach(l=>{this.controllerMap.set(l.render_id,new v1(this.five,Ee(R({},l),{panoIndex:o,renderID:a,hooks:this.hooks,initialState:{enabled:this.enabled}})))})}),this.data=t,this.hooks.emit("dataLoaded",t)}enable(t){var r;if(this.disposed)return this.logWarning("插件已被销毁");if(this.enabled)return;this.enabled=!0,Array.from(this.controllerMap.values()).forEach(s=>s.enable());const i=(r=t==null?void 0:t.userAction)!=null?r:!0;this.hooks.emit("enable",{userAction:i})}disable(t){var r;if(this.disposed)return this.logWarning("插件已被销毁");if(!this.enabled)return;this.enabled=!1,Array.from(this.controllerMap.values()).forEach(s=>s.disable());const i=(r=t==null?void 0:t.userAction)!=null?r:!0;this.hooks.emit("disable",{userAction:i})}lookAtVideoItemByRenderID(t){if(this.disposed)return this.logWarning("插件已被销毁");const i=this.controllerMap.get(t);if(!i)return this.logWarning(`ID 为 ${t} 的点位视频不存在`);i.lookAtVideo()}unmuteByRenderID(t){if(this.disposed)return this.logWarning("插件已被销毁");const i=this.controllerMap.get(t);if(!i)return this.logWarning(`ID 为 ${t} 的点位视频不存在`);i.unmute()}add(t,i){if(this.disposed)return this.logWarning("插件已被销毁");i.forEach(r=>{if(this.controllerMap.get(r.render_id))return this.logWarning(`ID 为 ${r.render_id} 的点位视频已存在`);const s=r.render_id;this.controllerMap.set(r.render_id,new v1(this.five,Ee(R({},r),{panoIndex:t,renderID:s,hooks:this.hooks,initialState:{enabled:this.enabled}})))})}removeByRenderID(t){if(this.disposed)return this.logWarning("插件已被销毁");const i=this.controllerMap.get(t);if(!i)return this.logWarning(`ID 为 ${t} 的点位视频不存在`);i.dispose(),this.controllerMap.delete(t)}clear(){if(this.disposed)return this.logWarning("插件已被销毁");Array.from(this.controllerMap.values()).forEach(t=>t.dispose()),this.controllerMap.clear()}dispose(){if(this.disposed)return this.logWarning("插件已被销毁");this._disposed=!0,Array.from(this.controllerMap.values()).forEach(t=>t.dispose()),this.controllerMap.clear()}logWarning(t){console.warn("⛔ ==> [PanoVideoPluginController]:",t)}}const u8=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),d8=e=>new h8(e);function jM(e){const n=new Map;return e.forEach(t=>t.pipes.forEach(i=>n.set(i.id,i))),Array.from(n.values())}function f8(e){const n=e.target.map(({startLibraryID:t,endLibraryID:i})=>{const r=e.data.pipelines.find(s=>s.startLibraryID===t&&s.endLibraryID===i);return r||console.warn(`Cannot find pipeline with startLibraryID ${t} and endLibraryID ${i}`),r}).filter(At);return jM(n)}function p8(e){if(e.quality===0)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/1.png";if(e.quality===1)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/2.png";if(e.quality===2)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/3.png";if(e.quality===3)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/4.png";if(e.quality===4)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/5.png";if(e.isHot)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/6.png"}function m8(e,n){const t=e.ConnectsDataset.map(r=>{const s=r.data,o=r.start,a=r.end,l={isHot:r.waterType===5,quality:r.waterType},c=s.map(h=>{const u=e.LinesDataset.find(p=>p.id===h);if(!u)return null;const d=u.data,f=n!=null&&n.getPipeRadius?n.getPipeRadius(u):1.6/100,m=n!=null&&n.getPipeUrl?n.getPipeUrl(l):p8(l);return{id:u.id,radius:f,water:l,path:d,texture:m}}).filter(At);return{startLibraryID:o,endLibraryID:a,pipes:c}});return{pipes:jM(t),pipelines:t}}function g8(e,n){const t=1-e;return t*t*n}function v8(e,n){return 2*(1-e)*e*n}function y8(e,n){return e*e*n}function yp(e,n,t,i){return g8(e,n)+v8(e,t)+y8(e,i)}function b8(e,n){const t=1-e;return t*t*t*n}function A8(e,n){const t=1-e;return 3*t*t*e*n}function w8(e,n){return 3*(1-e)*e*e*n}function x8(e,n){return e*e*e*n}function bp(e,n,t,i,r){return b8(e,n)+A8(e,t)+w8(e,i)+x8(e,r)}function Hm(e,n){const t=n.length-1;if(t<1)throw new Error("length of points must greater than 2");if(t===2)return new C.Vector3(yp(e,n[0].x,n[1].x,n[2].x),yp(e,n[0].y,n[1].y,n[2].y),yp(e,n[0].z,n[1].z,n[2].z));if(t===3)return new C.Vector3(bp(e,n[0].x,n[1].x,n[2].x,n[3].x),bp(e,n[0].y,n[1].y,n[2].y,n[3].y),bp(e,n[0].z,n[1].z,n[2].z,n[3].z));if(t===1){const[r,s]=n;return r.clone().add(s.clone().sub(r).multiplyScalar(e))}const i=[];return n.reduce((r,s)=>(i.push(Hm(e,[r,s])),s)),Hm(e,i)}class M8 extends C.Curve{constructor(t=[]){super();v(this,"type");v(this,"controlPoints");this.type="CustomBezierCurve3",this.controlPoints=t}getPoint(t,i=new C.Vector3){const r=i,s=Hm(t,this.controlPoints);return r.copy(s),r}copy(t){return super.copy(t),this.controlPoints=t.controlPoints.map(i=>i.clone()),this}toJSON(){const t=super.toJSON(),i=this.controlPoints.map(s=>s.toArray());return Object.assign(t,{controlPoints:i})}fromJSON(t){return super.fromJSON(t),this.controlPoints=t.controlPoints.map(i=>new C.Vector3().fromArray(i)),this}}const E8=`
3726
+ `;function a8(e){const n=Math.PI*2;let t=-Math.atan2(e.x,-e.z);t=(t%n+n)%n;const i=-Math.asin(e.y/1);return{longitude:t,latitude:i}}class v1{constructor(n,t){v(this,"video");v(this,"_id");v(this,"url");v(this,"five");v(this,"panoIndex");v(this,"observer");v(this,"origin");v(this,"videoMesh");v(this,"_enabled",!0);v(this,"_disposed",!1);v(this,"videoDataLoaded",!1);v(this,"hasVideoEverPlayed",!1);v(this,"renderFiveDisposer");v(this,"hooks");v(this,"unmute",()=>{this.video.muted=!1});v(this,"uv2Position",(n,t)=>{var f;const r=Math.PI,s=Math.PI*2,o=n,a=1-t,l=new ne.Vector3(-1*Math.cos(s*o)*Math.sin(r*a),1*Math.cos(r*a),1*Math.sin(s*o)*Math.sin(r*a));l.setX(-l.x);const c=(f=this.five.work)==null?void 0:f.observers[this.panoIndex];if(!c)return this.logWarning(`点位 ${this.panoIndex} 不存在,请检查 Five 数据是否正常。`);const h=c.position.clone(),u=c.quaternion.clone(),d=l.clone();return d.applyAxisAngle(new ne.Vector3(0,1,0),Math.PI/2),d.applyQuaternion(u),d.add(h),d});v(this,"onFiveDataLoaded",()=>{var l;const n=(l=this.five.work)==null?void 0:l.observers[this.panoIndex];if(!n)return this.logWarning(`点位 ${this.panoIndex} 不存在,请检查 Five 数据是否正常。`);this.observer=n;const{x:t,y:i,z:r,w:s}=n.quaternion,o=new ne.Quaternion(t,i,r,s),a=n.position;this.videoMesh.position.fromArray([a.x,a.y,a.z]),this.videoMesh.quaternion.set(0,0,0,1),this.videoMesh.rotateOnAxis(new ne.Vector3(0,1,0),Math.PI/2),this.videoMesh.applyQuaternion(o)});v(this,"onFiveWantsMoveToPano",n=>{n===this.panoIndex&&(this.hasVideoEverPlayed||this.video.play().catch(()=>{}))});v(this,"onFivePanoArrived",n=>{if(this.disposed)return this.logWarning("实例已被销毁");this.enabled&&this.panoIndex===n&&this.mount()});v(this,"onFivePanoWillArrive",n=>{if(n!==this.panoIndex)return this.unmount();this.panoIndex!==n&&this.unmount()});v(this,"onFiveModeChange",n=>{n!=="Panorama"&&this.hide()});v(this,"onFiveInitAnimationEnded",()=>{const n=this.five.getCurrentState();n.mode==="Panorama"&&n.panoIndex===this.panoIndex&&this.mount()});v(this,"onFiveWantsTapGesture",n=>{if(!this.five.scene.children.includes(this.videoMesh))return;if(this.disposed)return this.logWarning("实例已被销毁");if(!this.enabled)return this.logWarning("实例已被禁用");const[t]=n.intersectObject(this.videoMesh);if(!t)return;if(this.checkIntersectionInBounding(this.origin,t)){const r={target:this,_preventDefaultReturn:!1,preventDefault:()=>{r._preventDefaultReturn=!0}};return this.hooks.emit("click",r),r._preventDefaultReturn===!1&&(this.video.muted=!this.video.muted),!1}});v(this,"onVideoDataLoaded",()=>{this.videoDataLoaded=!0,this.video.paused===!1&&this.video.src!==""&&this.onVideoPlayingAndLoaded()});v(this,"onVideoPlaying",()=>{this.hasVideoEverPlayed=!0,this.enabled&&this.videoDataLoaded&&this.onVideoPlayingAndLoaded()});v(this,"onVideoPlayingAndLoaded",()=>{if(!this.videoDataLoaded)return this.logWarning("视频数据未加载");if(this.video.paused===!0)return this.logWarning("视频已暂停");this.video.addEventListener("timeupdate",()=>{if(this.enabled&&this.panoIndex===this.five.getCurrentState().panoIndex&&this.five.getCurrentState().mode==="Panorama"&&(this.renderFiveDisposer||(this.renderFiveDisposer=ja(()=>{this.five.needsRender=!0},30)),this.five.scene.add(this.videoMesh),this.videoMesh.material.uniforms.opacity.value===0)){const n={value:0};fu({targets:n,value:1,duration:300,easing:"linear",update:()=>{this.videoMesh.material.uniforms.opacity.value=n.value},complete:()=>{this.videoMesh.material.uniforms.opacity.value=1}})}},{once:!0})});v(this,"onVideoPaused",()=>{var n;(n=this.renderFiveDisposer)==null||n.call(this),this.renderFiveDisposer=void 0});var l,c;this.five=n,this.panoIndex=t.panoIndex,this._id=t.renderID,this.url=t.url,this.origin=t.origin.slice(),this.hooks=t.hooks,this._enabled=(c=(l=t.initialState)==null?void 0:l.enabled)!=null?c:!0;const i=document.createElement("video");i.crossOrigin="anonymous",i.autoplay=!1,i.muted=!0,i.loop=!0,i.playsInline=!0,this.video=i;const r=new ne.VideoTexture(this.video);r.minFilter=ne.LinearFilter,r.magFilter=ne.LinearFilter;const s=new ne.ShaderMaterial({vertexShader:s8,fragmentShader:o8,uniforms:{map:{value:r},size:{value:new ne.Vector4(this.origin[0],1-this.origin[1]-this.origin[3],this.origin[2],this.origin[3])},opacity:{value:0}},depthTest:!0,transparent:!0}),o=new ne.SphereBufferGeometry(1,64,64);o.scale(-1,1,1);const a=new ne.Mesh(o,s);a.name="pano-video-plugin",this.videoMesh=a,this.five.work&&this.onFiveDataLoaded(),this.enabled&&this.addEventListeners(),this.mountIfNeeded(),window[`__PANOVIDEO_${this.renderID}_DEBUG__`]=this}get renderID(){return this._id}get disposed(){return this._disposed}get enabled(){return this._enabled}dispose(){this.disposed||(this.disable(),this._disposed=!0)}enable(){this.disposed||this.enabled||(this._enabled=!0,!this.observer&&this.five.work&&this.onFiveDataLoaded(),this.addEventListeners(),this.mountIfNeeded())}disable(){this.disposed||this.enabled&&(this._enabled=!1,this.removeEventListeners(),this.unmount())}lookAtVideo(){if(!this.observer)return;const n=this.getUVCenter();if(!n)return;const t=this.uv2Position(n[0],n[1]);if(!t)return;const i=new ne.Vector3().subVectors(t,this.observer.position).normalize(),{longitude:r,latitude:s}=a8(i);this.five.setState({panoIndex:this.panoIndex,longitude:r,latitude:s}),this.onFiveWantsMoveToPano(this.panoIndex)}getUVCenter(){if(!this.origin)return;const n=this.origin[0]+this.origin[2]/2,t=this.origin[1]+this.origin[3]/2;return[n,t]}addEventListeners(){this.five.on("loaded",this.onFiveDataLoaded),this.five.on("modeChange",this.onFiveModeChange),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive),this.five.on("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.on("wantsTapGesture",this.onFiveWantsTapGesture),this.five.on("initAnimationEnded",this.onFiveInitAnimationEnded),this.video.addEventListener("canplaythrough",this.onVideoDataLoaded),this.video.addEventListener("playing",this.onVideoPlaying),this.video.addEventListener("pause",this.onVideoPaused)}removeEventListeners(){this.five.off("loaded",this.onFiveDataLoaded),this.five.off("modeChange",this.onFiveModeChange),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.off("wantsTapGesture",this.onFiveWantsTapGesture),this.five.off("initAnimationEnded",this.onFiveInitAnimationEnded),this.video.removeEventListener("canplaythrough",this.onVideoDataLoaded),this.video.removeEventListener("playing",this.onVideoPlaying),this.video.removeEventListener("pause",this.onVideoPaused)}mountIfNeeded(){const n=this.five.getCurrentState();n.mode==="Panorama"&&n.panoIndex===this.panoIndex&&this.enabled&&this.mount()}mount(){if(this.disposed)return this.logWarning("插件已经销毁,无法挂载。");if(this.url==="")return this.logWarning("视频资源不存在。");this.video.src!==this.url&&(this.video.src=this.url),this.video.paused&&this.video.play().catch(n=>{this.logWarning(n instanceof Error?n.message:"视频播放失败。"),this.five.once("gesture",()=>{this.video.play().catch(t=>{this.logWarning(t instanceof Error?t.message:"自动播放视频失败。")})})})}unmount(){this.video.pause(),this.videoMesh.material.uniforms.opacity.value=0,this.video.src!==""&&(this.video.src=""),this.five.scene.remove(this.videoMesh)}hide(){this.video.pause(),this.videoMesh.material.uniforms.opacity.value=0,this.five.scene.remove(this.videoMesh)}logWarning(n){console.warn("⛔ ==> [VideoMeshController]:",n)}checkIntersectionInBounding(n,t){if(!t.uv)return!1;const[i,r]=t.uv.toArray(),[s,o,a,l]=n,c=1-o-l,h=s+a,u=c+l;return i>=s&&i<=h&&r>=c&&r<=u}}class l8 extends ws{constructor(t){super(t);v(this,"controllerMap",new Map);v(this,"data");v(this,"enabled",!0);v(this,"_disposed",!1)}get state(){return{enabled:this.enabled}}get disposed(){return this._disposed}load(t,i){var r;if(this.disposed)return this.logWarning("插件已被销毁");typeof((r=i==null?void 0:i.initialState)==null?void 0:r.enabled)!="undefined"&&i.initialState.enabled!==this.enabled&&(i.initialState.enabled?this.enable():this.disable()),t.list.forEach(s=>{const o=s.pano_index,a=s.render_id;s.video_list.forEach(l=>{this.controllerMap.set(l.render_id,new v1(this.five,Ee(R({},l),{panoIndex:o,renderID:a,hooks:this.hooks,initialState:{enabled:this.enabled}})))})}),this.data=t,this.hooks.emit("dataLoaded",t)}enable(t){var r;if(this.disposed)return this.logWarning("插件已被销毁");if(this.enabled)return;this.enabled=!0,Array.from(this.controllerMap.values()).forEach(s=>s.enable());const i=(r=t==null?void 0:t.userAction)!=null?r:!0;this.hooks.emit("enable",{userAction:i})}disable(t){var r;if(this.disposed)return this.logWarning("插件已被销毁");if(!this.enabled)return;this.enabled=!1,Array.from(this.controllerMap.values()).forEach(s=>s.disable());const i=(r=t==null?void 0:t.userAction)!=null?r:!0;this.hooks.emit("disable",{userAction:i})}lookAtVideoItemByRenderID(t){if(this.disposed)return this.logWarning("插件已被销毁");const i=this.controllerMap.get(t);if(!i)return this.logWarning(`ID 为 ${t} 的点位视频不存在`);i.lookAtVideo()}unmuteByRenderID(t){if(this.disposed)return this.logWarning("插件已被销毁");const i=this.controllerMap.get(t);if(!i)return this.logWarning(`ID 为 ${t} 的点位视频不存在`);i.unmute()}add(t,i){if(this.disposed)return this.logWarning("插件已被销毁");i.forEach(r=>{if(this.controllerMap.get(r.render_id))return this.logWarning(`ID 为 ${r.render_id} 的点位视频已存在`);const s=r.render_id;this.controllerMap.set(r.render_id,new v1(this.five,Ee(R({},r),{panoIndex:t,renderID:s,hooks:this.hooks,initialState:{enabled:this.enabled}})))})}removeByRenderID(t){if(this.disposed)return this.logWarning("插件已被销毁");const i=this.controllerMap.get(t);if(!i)return this.logWarning(`ID 为 ${t} 的点位视频不存在`);i.dispose(),this.controllerMap.delete(t)}clear(){if(this.disposed)return this.logWarning("插件已被销毁");Array.from(this.controllerMap.values()).forEach(t=>t.dispose()),this.controllerMap.clear()}dispose(){if(this.disposed)return this.logWarning("插件已被销毁");this._disposed=!0,Array.from(this.controllerMap.values()).forEach(t=>t.dispose()),this.controllerMap.clear()}logWarning(t){console.warn("⛔ ==> [PanoVideoPluginController]:",t)}}const c8=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),h8=e=>new l8(e);function jM(e){const n=new Map;return e.forEach(t=>t.pipes.forEach(i=>n.set(i.id,i))),Array.from(n.values())}function u8(e){const n=e.target.map(({startLibraryID:t,endLibraryID:i})=>{const r=e.data.pipelines.find(s=>s.startLibraryID===t&&s.endLibraryID===i);return r||console.warn(`Cannot find pipeline with startLibraryID ${t} and endLibraryID ${i}`),r}).filter(At);return jM(n)}function d8(e){if(e.quality===0)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/1.png";if(e.quality===1)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/2.png";if(e.quality===2)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/3.png";if(e.quality===3)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/4.png";if(e.quality===4)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/5.png";if(e.isHot)return"//vr-static.realsee-cdn.cn/release/web/aqueous-system-demo/19/6.png"}function f8(e,n){const t=e.ConnectsDataset.map(r=>{const s=r.data,o=r.start,a=r.end,l={isHot:r.waterType===5,quality:r.waterType},c=s.map(h=>{const u=e.LinesDataset.find(p=>p.id===h);if(!u)return null;const d=u.data,f=n!=null&&n.getPipeRadius?n.getPipeRadius(u):1.6/100,m=n!=null&&n.getPipeUrl?n.getPipeUrl(l):d8(l);return{id:u.id,radius:f,water:l,path:d,texture:m}}).filter(At);return{startLibraryID:o,endLibraryID:a,pipes:c}});return{pipes:jM(t),pipelines:t}}function p8(e,n){const t=1-e;return t*t*n}function m8(e,n){return 2*(1-e)*e*n}function g8(e,n){return e*e*n}function yp(e,n,t,i){return p8(e,n)+m8(e,t)+g8(e,i)}function v8(e,n){const t=1-e;return t*t*t*n}function y8(e,n){const t=1-e;return 3*t*t*e*n}function b8(e,n){return 3*(1-e)*e*e*n}function A8(e,n){return e*e*e*n}function bp(e,n,t,i,r){return v8(e,n)+y8(e,t)+b8(e,i)+A8(e,r)}function Hm(e,n){const t=n.length-1;if(t<1)throw new Error("length of points must greater than 2");if(t===2)return new C.Vector3(yp(e,n[0].x,n[1].x,n[2].x),yp(e,n[0].y,n[1].y,n[2].y),yp(e,n[0].z,n[1].z,n[2].z));if(t===3)return new C.Vector3(bp(e,n[0].x,n[1].x,n[2].x,n[3].x),bp(e,n[0].y,n[1].y,n[2].y,n[3].y),bp(e,n[0].z,n[1].z,n[2].z,n[3].z));if(t===1){const[r,s]=n;return r.clone().add(s.clone().sub(r).multiplyScalar(e))}const i=[];return n.reduce((r,s)=>(i.push(Hm(e,[r,s])),s)),Hm(e,i)}class w8 extends C.Curve{constructor(t=[]){super();v(this,"type");v(this,"controlPoints");this.type="CustomBezierCurve3",this.controlPoints=t}getPoint(t,i=new C.Vector3){const r=i,s=Hm(t,this.controlPoints);return r.copy(s),r}copy(t){return super.copy(t),this.controlPoints=t.controlPoints.map(i=>i.clone()),this}toJSON(){const t=super.toJSON(),i=this.controlPoints.map(s=>s.toArray());return Object.assign(t,{controlPoints:i})}fromJSON(t){return super.fromJSON(t),this.controlPoints=t.controlPoints.map(i=>new C.Vector3().fromArray(i)),this}}const x8=`
3727
3727
  varying vec2 vUv;
3728
3728
  void main() {
3729
3729
  vUv = uv;
3730
3730
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
3731
3731
  }
3732
- `,C8=`
3732
+ `,M8=`
3733
3733
  varying vec2 vUv;
3734
3734
  uniform float uOffset;
3735
3735
  uniform float vOffset;
@@ -3743,7 +3743,7 @@ void main() {
3743
3743
  gl_FragColor = texture2D(envMap, uv);
3744
3744
  gl_FragColor.a = gl_FragColor.a * opacity;
3745
3745
  }
3746
- `;class Zo extends C.Mesh{constructor(t,i=C8){super();v(this,"geometryConfig",{radius:1.5/100,tubularSegments:20,radialSegments:8});v(this,"customID");v(this,"path");v(this,"pathLength",0);v(this,"pathPoints");v(this,"texture");v(this,"opacityAnime");v(this,"uPreMeter",1);t.geometryConfig&&(this.geometryConfig=R(R({},this.geometryConfig),t.geometryConfig)),this.customID=t.id||this.uuid,this.pathPoints=t.path,this.path=Zo.calculatePath(t.path.map(l=>new C.Vector3().fromArray(l))),this.pathLength=this.path.getLength(),this.texture=Zo.formatTexture(t.texture);const{radius:r,tubularSegments:s,radialSegments:o}=this.geometryConfig,a=Zo.formatTexture(t.texture);this.geometry=Zo.formatGeometryUV(new C.TubeBufferGeometry(this.path,s,r,o),this.pathLength,this.uPreMeter),this.material=new C.ShaderMaterial({uniforms:{opacity:{value:1},uOffset:{value:0},vOffset:{value:0},envMap:{value:a}},transparent:!0,vertexShader:E8,fragmentShader:i})}static calculatePath(t){return t.length===2?new C.LineCurve3(t[0],t[1]):new M8(t)}static formatGeometryUV(t,i,r){const s=t.getAttribute("uv");for(let o=0;o<s.count;o++){const a=s.getX(o)*i*r;s.setX(o,a)}return t}static formatTexture(t){return t.wrapS=C.RepeatWrapping,t.wrapT=C.RepeatWrapping,t}hide(t){return ee(this,null,function*(){var s;(s=this.opacityAnime)==null||s.dispose();const i=0;if(typeof(t==null?void 0:t.duration)!="number")return this.setOpacity(i);const r=this.material.uniforms.opacity.value;return r===i?!0:new Promise(o=>{this.opacityAnime=new Pa({progress:r}).to({progress:i}).onUpdate(({progress:a})=>this.setOpacity(a)).onComplete(()=>o(!0)).onDispose(()=>{this.setOpacity(i),o(!1)}).play()})})}show(t){return ee(this,null,function*(){var s;(s=this.opacityAnime)==null||s.dispose();const i=1;if(typeof(t==null?void 0:t.duration)!="number")return this.setOpacity(i);const r=this.material.uniforms.opacity.value;return new Promise(o=>{this.opacityAnime=new Pa({progress:r}).to({progress:i}).onUpdate(({progress:a})=>this.setOpacity(a)).onComplete(()=>o(!0)).onDispose(()=>{this.setOpacity(i),o(!1)}).play()})})}setOpacity(t){return this.material.uniforms.opacity.value=t,this.material.needsUpdate=!0,this.needsRender=!0,!0}disposeAnime(){var t;(t=this.opacityAnime)==null||t.dispose(),this.opacityAnime=void 0}dispose(){this.disposeAnime(),this.geometry.dispose(),this.material.dispose()}}const P8=`
3746
+ `;class Zo extends C.Mesh{constructor(t,i=M8){super();v(this,"geometryConfig",{radius:1.5/100,tubularSegments:20,radialSegments:8});v(this,"customID");v(this,"path");v(this,"pathLength",0);v(this,"pathPoints");v(this,"texture");v(this,"opacityAnime");v(this,"uPreMeter",1);t.geometryConfig&&(this.geometryConfig=R(R({},this.geometryConfig),t.geometryConfig)),this.customID=t.id||this.uuid,this.pathPoints=t.path,this.path=Zo.calculatePath(t.path.map(l=>new C.Vector3().fromArray(l))),this.pathLength=this.path.getLength(),this.texture=Zo.formatTexture(t.texture);const{radius:r,tubularSegments:s,radialSegments:o}=this.geometryConfig,a=Zo.formatTexture(t.texture);this.geometry=Zo.formatGeometryUV(new C.TubeBufferGeometry(this.path,s,r,o),this.pathLength,this.uPreMeter),this.material=new C.ShaderMaterial({uniforms:{opacity:{value:1},uOffset:{value:0},vOffset:{value:0},envMap:{value:a}},transparent:!0,vertexShader:x8,fragmentShader:i})}static calculatePath(t){return t.length===2?new C.LineCurve3(t[0],t[1]):new w8(t)}static formatGeometryUV(t,i,r){const s=t.getAttribute("uv");for(let o=0;o<s.count;o++){const a=s.getX(o)*i*r;s.setX(o,a)}return t}static formatTexture(t){return t.wrapS=C.RepeatWrapping,t.wrapT=C.RepeatWrapping,t}hide(t){return ee(this,null,function*(){var s;(s=this.opacityAnime)==null||s.dispose();const i=0;if(typeof(t==null?void 0:t.duration)!="number")return this.setOpacity(i);const r=this.material.uniforms.opacity.value;return r===i?!0:new Promise(o=>{this.opacityAnime=new Pa({progress:r}).to({progress:i}).onUpdate(({progress:a})=>this.setOpacity(a)).onComplete(()=>o(!0)).onDispose(()=>{this.setOpacity(i),o(!1)}).play()})})}show(t){return ee(this,null,function*(){var s;(s=this.opacityAnime)==null||s.dispose();const i=1;if(typeof(t==null?void 0:t.duration)!="number")return this.setOpacity(i);const r=this.material.uniforms.opacity.value;return new Promise(o=>{this.opacityAnime=new Pa({progress:r}).to({progress:i}).onUpdate(({progress:a})=>this.setOpacity(a)).onComplete(()=>o(!0)).onDispose(()=>{this.setOpacity(i),o(!1)}).play()})})}setOpacity(t){return this.material.uniforms.opacity.value=t,this.material.needsUpdate=!0,this.needsRender=!0,!0}disposeAnime(){var t;(t=this.opacityAnime)==null||t.dispose(),this.opacityAnime=void 0}dispose(){this.disposeAnime(),this.geometry.dispose(),this.material.dispose()}}const E8=`
3747
3747
  varying vec2 vUv;
3748
3748
  uniform float uOffset;
3749
3749
  uniform float vOffset;
@@ -3758,4 +3758,4 @@ void main() {
3758
3758
  gl_FragColor = texture2D(envMap, uv);
3759
3759
  gl_FragColor.a = gl_FragColor.a * opacity;
3760
3760
  }
3761
- `;class _8 extends Zo{constructor(t){super(t,P8);v(this,"initialDisplacement",0);v(this,"oldTime",new Date().getTime());v(this,"flowSpeed",.6);v(this,"rotateSpeed",0);v(this,"flowAnimationDisposer",()=>{})}setInitialDisplacement(t,i="backward"){this.initialDisplacement=Math.abs(t)*(i==="forward"?-1:1),this.moveFromOrigin(this.initialDisplacement)}moveFromOrigin(t){const i=t*this.uPreMeter;return this.material.uniforms.uOffset.value=i,this.material.needsUpdate=!0,this.needsRender=!0,!0}moveForwardFromInitialOffset(t){const i=t*-1,r=this.initialDisplacement+i;this.moveFromOrigin(r)}flow(){this.flowAnimationDisposer(),this.oldTime=new Date().getTime();let t=0,i=0;const r=ja(()=>{const s=new Date().getTime(),o=s-this.oldTime,a=this.flowSpeed*(o/1e3),l=this.rotateSpeed*(o/1e3);t=t+a,i=i+l;const c=1/360,h=i*c;this.material.uniforms.vOffset.value=h,this.moveForwardFromInitialOffset(t),this.oldTime=s});this.flowAnimationDisposer=function(){r(),this.moveForwardFromInitialOffset(0)}}stopFlow(){this.flowAnimationDisposer()}setSpeed(t){typeof(t==null?void 0:t.flowSpeed)=="number"&&(this.flowSpeed=t.flowSpeed),typeof(t==null?void 0:t.rotateSpeed)=="number"&&(this.rotateSpeed=t.rotateSpeed)}disposeAnime(){super.disposeAnime(),this.flowAnimationDisposer()}}const y1={flowSpeed:.6,rotateSpeed:0};let S8=class extends Br{constructor(t){super(t);v(this,"data");v(this,"state");v(this,"group");v(this,"pipeObjects",[]);v(this,"texturePromiseCache",new Map);v(this,"dispose",()=>{this.disable(),this.five.scene.remove(this.group),this.texturePromiseCache.forEach(t=>t.then(i=>i.dispose())),this.texturePromiseCache.clear()});v(this,"onWantsFiveTapGesture",(...t)=>{const[i]=t,r=i.intersectObjects(this.pipeObjects,!1);if(r.length===0||!this.data)return;const a=r[0].object.customID,l=this.data.pipes.find(({id:h})=>h===a),c=this.data.pipelines.find(h=>l&&h.pipes.includes(l));if(!(!l||!c))return this.hooks.emit("tap",{intersectObjects:r,pipe:l,pipeline:c,wantsFiveTapGestureParams:t}),!1});this.state={target:null,visible:!0,enabled:!0,isFlowing:!1,speed:y1},this.five=t,this.group=new C.Group,this.group.name="water-pipe-group",this.five.scene.add(this.group),this.five.once("dispose",this.dispose),this.five.on("wantsTapGesture",this.onWantsFiveTapGesture)}load(t,i,r,s){return ee(this,null,function*(){const o=this.data;this.data=yield this.formatData(t,s),this.removeAllPipes(),this.hooks.emit("dataChange",this.data,o),this.pipeObjects=yield Promise.all(this.data.pipes.filter(a=>!!(a!=null&&a.texture)).map(u=>ee(this,[u],function*({id:a,texture:l,path:c,radius:h}){const d=yield this.loadPipeTexture(l),f={id:a,path:c,textureURL:l,texture:d,geometryConfig:{radius:h}};return new _8(f)}))),this.data.pipelines.forEach(a=>{a.pipes.reduce((l,c)=>{const h=this.findPipeObjectWithID(c.id);return h==null||h.setInitialDisplacement(l),l+((h==null?void 0:h.pathLength)||0)},0)}),this.hooks.emit("dataLoaded",this.data),this.state.visible===!1&&this.pipeObjects.forEach(a=>a.setOpacity(0)),this.state.enabled&&(this.group.add(...this.pipeObjects),this.five.needsRender=!0),i&&this.setState(i,{userAction:r})})}setState(t,i={}){const r=this.state;if(Nn(t,r,{deep:!0}))return;const s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s,anime:{duration:500}};t.visible?this._show(o):this._hide(o)}if(t.isFlowing!==void 0&&r.isFlowing!==t.isFlowing&&(t.isFlowing?this._flow():this._stopFlow()),t.speed!==void 0&&!Nn(r.speed,this.state.speed,{deep:!0})&&this._setSpeed(t.speed),t.target!==void 0&&!Nn(r.target,this.state.target,{deep:!0})){const o={target:t.target,showAnime:{duration:500},hideAnime:{duration:500}};this._switchPipelines(o)}}enable(t={}){var r;if(this.state.enabled)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!0},i),this._enable({userAction:i})}disable(t={}){var r;if(this.state.enabled===!1)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!1,isFlowing:!1},i),this._disable({userAction:i})}show(){return ee(this,arguments,function*(t={}){if(this.state.visible)return;const i=R({userAction:!0,anime:{duration:500}},t);this.updateState({visible:!0},i.userAction),yield this._show(i)})}hide(){return ee(this,arguments,function*(t={}){if(this.state.visible===!1)return;const i=R({userAction:!0,anime:{duration:500}},t);this.updateState({visible:!1},i.userAction),yield this._hide(i)})}switchPipelines(t){return ee(this,null,function*(){var c,h,u,d,f,m;if(!this.data)return;const i=(c=t==null?void 0:t.target)!=null?c:null,r=(h=t==null?void 0:t.userAction)!=null?h:!0;this.updateState({target:i},r);const s={duration:500},o=(d=(u=t==null?void 0:t.hideAnime)!=null?u:t==null?void 0:t.anime)!=null?d:s,a=(m=(f=t==null?void 0:t.showAnime)!=null?f:t==null?void 0:t.anime)!=null?m:s,l={target:i,showAnime:a,hideAnime:o};this._switchPipelines(l)})}flow(t={}){var r;if(this.state.isFlowing)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({isFlowing:!0},i),this._flow()}stopFlow(t={}){var r;if(this.state.isFlowing===!1)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({isFlowing:!1},i),this._stopFlow()}setSpeed(t){var s,o;const i=(s=t==null?void 0:t.speed)!=null?s:y1,r=(o=t.userAction)!=null?o:!0;this.updateState({speed:i},r),this._setSpeed(i)}formatData(t,i){return ee(this,null,function*(){return m8(t,i)})}_enable(t){this.hooks.emit("enable",{userAction:t.userAction}),this.five.scene.add(this.group),this.five.needsRender=!0,this.five.on("wantsTapGesture",this.onWantsFiveTapGesture)}_disable(t){this.hooks.emit("disable",{userAction:t.userAction}),this.disposeAnime(),this.five.scene.remove(this.group),this.five.needsRender=!0,this.five.off("wantsTapGesture",this.onWantsFiveTapGesture)}_show(t){return ee(this,null,function*(){var s;this.hooks.emit("show",{userAction:t.userAction});const i=(s=t==null?void 0:t.anime)!=null?s:{duration:500},r=this.findPipeObjectWithTarget(this.state.target);yield Promise.all(r.map(o=>o==null?void 0:o.show(i))),this.five.needsRender=!0})}_hide(t){return ee(this,null,function*(){var r;this.hooks.emit("hide",{userAction:t.userAction});const i=(r=t==null?void 0:t.anime)!=null?r:{duration:500};yield Promise.all(this.pipeObjects.map(s=>s.hide(i))),this.five.needsRender=!0})}_switchPipelines(t){return ee(this,null,function*(){if(!this.data)return;const i=this.findPipeObjectWithTarget(t.target),r=t.hideAnime;yield Promise.all(this.pipeObjects.map(o=>o.hide(r)));const s=t.showAnime;yield Promise.all(i.map(o=>o.show(s)))})}_flow(){this.pipeObjects.forEach(t=>t.flow())}_stopFlow(){this.pipeObjects.forEach(t=>t.stopFlow())}_setSpeed(t){this.pipeObjects.forEach(i=>i.setSpeed(t))}updateState(t,i){const r=this.state;this.state=R(R({},this.state),t),this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}loadPipeTexture(t){return ee(this,null,function*(){const i=this.texturePromiseCache.get(t);if(i)return i;const r=Us(t);return this.texturePromiseCache.set(t,r),r})}disposeAnime(){this.pipeObjects.forEach(t=>t.disposeAnime()),this.five.needsRender=!0}removeAllPipes(){this.disposeAnime(),this.group.remove(...this.pipeObjects),this.pipeObjects.forEach(t=>t.dispose()),this.pipeObjects=[],this.five.needsRender=!0}findPipeObjectWithID(t){return this.pipeObjects.find(({customID:i})=>i===t)}findPipeObjectWithTarget(t){return t?f8({data:this.data,target:t}).map(({id:r})=>this.findPipeObjectWithID(r)).filter(At):this.pipeObjects}};const I8=e=>new S8(e),T8="data:image/png;base64,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";function D8(e){Ue(e,"svelte-1s88cj8",".room-label-item.svelte-1s88cj8{position:absolute;font-size:0.5rem;transform:none;cursor:pointer;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;color:#fff}.room-label-item__text.svelte-1s88cj8{position:absolute;left:0;top:-4rem;transform:translate(-50%, 0);display:flex;justify-content:center;align-items:center;height:1.25rem;min-width:2rem;padding:0 0.375rem;pointer-events:all;background-size:100% 100%;background-repeat:no-repeat;white-space:nowrap}.room-label-item__bar.svelte-1s88cj8{position:absolute;top:-2.75rem;height:3rem;width:0.0625rem;background-image:linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0))}.wide.svelte-1s88cj8{font-size:0.625rem}")}function b1(e){let n,t,i,r,s,o;return{c(){n=H("span"),t=xt(e[0]),i=ve(),r=H("div"),_(n,"class","room-label-item__text svelte-1s88cj8"),W(n,"background-image","url("+T8+")"),Ce(n,"wide",e[0].length>3),_(r,"class","room-label-item__bar svelte-1s88cj8")},m(a,l){Z(a,n,l),Q(n,t),Z(a,i,l),Z(a,r,l),s||(o=ot(n,"click",function(){hr(e[4])&&e[4].apply(this,arguments)}),s=!0)},p(a,l){e=a,l&1&&Ct(t,e[0]),l&1&&Ce(n,"wide",e[0].length>3)},d(a){a&&Y(n),a&&Y(i),a&&Y(r),s=!1,o()}}}function L8(e){let n,t=!e[5]&&b1(e);return{c(){n=H("div"),t&&t.c(),_(n,"class","room-label-item svelte-1s88cj8"),W(n,"z-index",e[2]),W(n,"transform",e[3]),W(n,"opacity",e[1]),W(n,"visibility",e[7])},m(i,r){Z(i,n,r),t&&t.m(n,null),e[10](n)},p(i,[r]){i[5]?t&&(t.d(1),t=null):t?t.p(i,r):(t=b1(i),t.c(),t.m(n,null)),r&4&&W(n,"z-index",i[2]),r&8&&W(n,"transform",i[3]),r&2&&W(n,"opacity",i[1]),r&128&&W(n,"visibility",i[7])},i:de,o:de,d(i){i&&Y(n),t&&t.d(),e[10](null)}}}function k8(e,n,t){let i,{content:r}=n,{visible:s=!0}=n,{opacity:o=1}=n,{zIndex:a=0}=n,{transform:l=void 0}=n,{onClick:c=()=>{}}=n,{rendererIfNeed:h=void 0}=n,{rendererData:u=void 0}=n,d,f;Yn(()=>{d&&typeof h=="function"&&(f=h(d,u))}),bi(()=>{f==null||f()});function m(p){Qt[p?"unshift":"push"](()=>{d=p,t(6,d)})}return e.$$set=p=>{"content"in p&&t(0,r=p.content),"visible"in p&&t(8,s=p.visible),"opacity"in p&&t(1,o=p.opacity),"zIndex"in p&&t(2,a=p.zIndex),"transform"in p&&t(3,l=p.transform),"onClick"in p&&t(4,c=p.onClick),"rendererIfNeed"in p&&t(5,h=p.rendererIfNeed),"rendererData"in p&&t(9,u=p.rendererData)},e.$$.update=()=>{e.$$.dirty&256&&t(7,i=s?"visible":"hidden")},[r,o,a,l,c,h,d,i,s,u,m]}class HM extends ke{constructor(n){super(),Le(this,n,k8,L8,De,{content:0,visible:8,opacity:1,zIndex:2,transform:3,onClick:4,rendererIfNeed:5,rendererData:9},D8)}}class R8 extends Zw{constructor(t){super();v(this,"areaMakerItem");this.areaMakerItem=t}raycast(t,i){this.areaMakerItem.makerObject.raycast(t,i)}}class O8{constructor(n,t){v(this,"id");v(this,"name","");v(this,"makerObject");v(this,"outline");v(this,"bottomY");v(this,"opacity");v(this,"height");v(this,"floorIndex");v(this,"shape");v(this,"mounted",!1);v(this,"checkMsg",{checkVisibleMsg:"",checkTagVisibleMsg:""});v(this,"modelGroup");v(this,"visible",!0);v(this,"tagApp");v(this,"tagVisible",null);v(this,"tagPosition",new C.Vector3);v(this,"tagNDCPosition",new C.Vector3);v(this,"tagTransform",{left:0,top:0});v(this,"tagZIndex",0);v(this,"hooks",new Cn);v(this,"itemRenderer");v(this,"data");v(this,"plugin");v(this,"opacityAnime");v(this,"isInContainerResizeAnimation",!1);v(this,"containerResizeTimeoutID",null);v(this,"resizeObserver");v(this,"doOpacityAnime",n=>{var a;(a=this.opacityAnime)==null||a.dispose();const t=n.duration,[i,r]=n.makerObjectOpacity,[s,o]=n.outlineOpacity;if(t===0){this.makerObject.material.opacity=r,this.outline.material.opacity=o;return}return new Promise(l=>{this.opacityAnime=new Pa({makerObjectOpacity:i,outlineOpacity:s}).to({makerObjectOpacity:r,outlineOpacity:o}).onUpdate(({makerObjectOpacity:c,outlineOpacity:h})=>{this.makerObject.material.opacity=c,this.outline.material.opacity=h,this.plugin.five.needsRender=!0}).onComplete(()=>l(!0)).onDispose(()=>{this.makerObject.material.opacity=r,this.outline.material.opacity=o,this.plugin.five.needsRender=!0,l(!1)}).play()})});v(this,"onPluginConfigChange",n=>{this.makerObject.material.depthTest=n.config.modelDepthTest,this.outline.material.depthTest=n.config.modelDepthTest,this.plugin.five.needsRender=!0});v(this,"onPluginStateChange",()=>{this.updateVisible(),this.updateTagVisible()});v(this,"updateVisible",()=>{var r;const{result:n,msg:t}=this.checkVisible();if(this.checkMsg.checkVisibleMsg=t,this.visible===n)return;this.visible=n;const i=(r=this.data.object_data.visible)!=null?r:!0;this.modelGroup.visible=n&&i,this.plugin.five.needsRender=!0});v(this,"checkVisible",()=>{if(!this.plugin.state.visible)return{result:!1,msg:"插件不可见"};const t=this.plugin.fiveUtil.model.shownFloor;return t===null||t===this.floorIndex?{result:!0,msg:""}:{result:!1,msg:`模型高亮楼层不符合展示条件, 当前高亮楼层为:${t}`}});v(this,"updateTag",()=>{this.tagApp&&(this.updateTagNDCPosition(),this.updateTagDomTransform(),this.updateTagVisible())});v(this,"updateTagNDCPosition",()=>{const t=this.tagPosition.clone().project(this.plugin.five.camera);this.tagNDCPosition.copy(t)});v(this,"updateTagDomTransform",()=>{var r;const n=this.tagNDCPosition,t=Math.round((n.x+1)/2*this.plugin.tagDomContainer.clientWidth),i=Math.round((-n.y+1)/2*this.plugin.tagDomContainer.clientHeight);this.tagTransform.left===t&&this.tagTransform.top===i||(this.tagTransform={left:t,top:i},(r=this.tagApp)==null||r.$set({transform:`translate(${t}px, ${i}px)`}))});v(this,"updateTagVisible",()=>{var i;const{result:n,msg:t}=this.checkTagVisible();this.checkMsg.checkTagVisibleMsg=t,this.tagVisible!==n&&(this.tagVisible=n,this.tagApp&&(this.tagVisible?this.hooks.emit("tagShow"):this.hooks.emit("tagHide"),(i=this.tagApp)==null||i.$set({visible:n})))});v(this,"checkTagVisible",()=>{if(!this.visible)return{result:!1,msg:"标注整体不可见"};if(this.isInContainerResizeAnimation)return{result:!1,msg:"处于容器 resize 动画中"};const t=this.plugin.five,i=t.camera.position.clone();rs.set(i.clone(),this.tagPosition.clone().sub(i).normalize());const[r]=this.plugin.fiveUtil.model.intersectRaycaster(rs),s=this.tagPosition.distanceTo(t.camera.position);if(r&&r.distance+.1<s)return{result:!1,msg:"标注标签被 Five 模型遮挡"};const o=this.tagNDCPosition;return Math.abs(o.x)>1.2||Math.abs(o.y)>1.2||Math.abs(o.z)>1?{result:!1,msg:"标注标签不在屏幕内"}:{result:!0,msg:""}});v(this,"onFiveCameraUpdate",()=>{this.tagApp&&this.visible&&(this.updateTagNDCPosition(),this.updateTagDomTransform(),this.updateTagVisible())});v(this,"onContainerResize",()=>{this.isInContainerResizeAnimation===!1&&(this.isInContainerResizeAnimation=!0,this.updateTag());const t=()=>{this.isInContainerResizeAnimation=!1,this.containerResizeTimeoutID=null,this.updateTag()};this.containerResizeTimeoutID&&clearTimeout(this.containerResizeTimeoutID),this.containerResizeTimeoutID=setTimeout(t,100)});var l,c,h,u;const i=t.object_data,r=i.bottom_y,s=i.height,o=new C.Color((l=i.color)!=null?l:"#FFFFFF"),a=(c=i.opacity)!=null?c:.4;this.data=t,this.id=t.id,this.name=(h=t.name)!=null?h:"",this.plugin=n,this.height=s,this.bottomY=r,this.opacity=a,this.shape=new C.Shape().fromJSON(i.shape),this.floorIndex=t.floor_index,this.makerObject=new C.Mesh(A1(this.shape,s),z8(o,a)),Ap(this.makerObject,r),this.makerObject.material.depthTest=this.plugin.config.modelDepthTest,this.outline=new Jw(new C.EdgesGeometry(this.makerObject.geometry),new C.LineBasicMaterial({color:o,transparent:!0})),Ap(this.outline,r),this.outline.material.depthTest=this.plugin.config.modelDepthTest,this.setHeight(s),this.modelGroup=new R8(this),this.modelGroup.visible=(u=i.visible)!=null?u:!0}mount(){if(this.mounted)return;this.mounted=!0,this.updateVisible(),this.makerObject.material.depthTest=this.plugin.config.modelDepthTest,this.outline.material.depthTest=this.plugin.config.modelDepthTest,this.modelGroup.add(this.makerObject,this.outline);const n=!!this.name,t=this.plugin.tagDomContainer;n&&(this.tagApp=new HM({target:t,props:{rendererData:this.data,content:this.name,visible:this.tagVisible,rendererIfNeed:this.itemRenderer,transform:`translate(${this.tagTransform.left}px, ${this.tagTransform.top}px)`,onClick:i=>this.hooks.emit("tagClick",{target:this,nativeEvent:i})}}),this.updateTag()),this.plugin.five.needsRender=!0,this.plugin.hooks.on("stateChange",this.onPluginStateChange),this.plugin.hooks.on("configChange",this.onPluginConfigChange),this.plugin.five.on("modeChange",this.updateVisible),this.plugin.five.on("modelShownFloorChange",this.updateVisible),this.plugin.five.on("cameraUpdate",this.onFiveCameraUpdate),this.resizeObserver=Bm(this.onContainerResize,t),this.resizeObserver.observe()}unmount(){var n,t;this.mounted&&(this.mounted=!1,this.modelGroup.remove(...this.modelGroup.children),(n=this.tagApp)==null||n.$destroy(),this.tagApp=null,this.plugin.hooks.off("stateChange",this.onPluginStateChange),this.plugin.hooks.off("configChange",this.onPluginConfigChange),this.plugin.five.off("modeChange",this.updateVisible),this.plugin.five.off("modelShownFloorChange",this.updateVisible),this.plugin.five.off("cameraUpdate",this.onFiveCameraUpdate),(t=this.resizeObserver)==null||t.unobserve())}setOpacity(n){var t;this.opacity=n,(t=this.opacityAnime)==null||t.dispose(),this.makerObject.material.opacity=n,this.plugin.five.needsRender=!0}setColor(n){const t=new C.Color(n);this.makerObject.material.color=t,this.outline.material.color=t,this.plugin.five.needsRender=!0}setHeight(n){if(n<=0)throw new Error("高度必须大于 0");this.height=n,this.makerObject.geometry=A1(this.shape,n),this.outline.geometry=new C.EdgesGeometry(this.makerObject.geometry);const t=this.shape.extractPoints(10).shape.slice(0,-1),i=Yk(t),r=new C.Vector3(i.x,i.y,n);Ap(r,this.bottomY),this.tagPosition.copy(r),this.updateTag(),this.plugin.five.needsRender=!0}setTagZIndex(n){var t;this.tagZIndex!==n&&((t=this.tagApp)==null||t.$set({zIndex:n}))}}function A1(e,n){return new C.ExtrudeBufferGeometry(e,{depth:n,bevelEnabled:!1})}function z8(e,n){return new C.MeshBasicMaterial({color:e,opacity:n,transparent:!0})}function Ap(e,n){const t=new C.Matrix4,i=new C.Matrix4().makeRotationX(Math.PI/2),r=new C.Matrix4().makeTranslation(0,0,-n),s=new C.Matrix4().makeScale(1,1,-1);t.multiply(i),t.multiply(r),t.multiply(s),e.applyMatrix4(t)}let B8=class extends Br{constructor(t,i){super(t);v(this,"state");v(this,"itemMap");v(this,"itemRenderer");v(this,"modelGroup");v(this,"data");v(this,"tagDomContainer");v(this,"checkMsg",{childrenMountedState:""});v(this,"isInFiveChangeModeAnime",!1);v(this,"childrenMountedState",!1);v(this,"_config");v(this,"_disposed",!1);v(this,"dispose",()=>{this.five.scene.remove(this.modelGroup)});v(this,"onFiveInitAnimationWillStart",()=>{this.isInFiveChangeModeAnime=!0,this.updateChildrenMountedState()});v(this,"onFiveInitAnimationEnded",()=>{this.isInFiveChangeModeAnime=!1,this.updateChildrenMountedState()});v(this,"onFiveCameraUpdate",()=>{const t=this.five.camera;[...this.itemMap.values()].sort((r,s)=>{const o=r.tagPosition.distanceTo(t.position);return s.tagPosition.distanceTo(t.position)-o}).forEach((r,s)=>{var o;(o=this.getMaskItemByID(r.id))==null||o.setTagZIndex(s*10)})});v(this,"onFiveModeChange",()=>{this.updateChildrenMountedState()});v(this,"onMakerTagClick",t=>{this.hooks.emit("wantsTap",{target:t.target,intersectObjects:[]})});v(this,"onWantsFiveTapGesture",t=>{const i=Array.from(this.itemMap.values()).filter(l=>l.mounted&&l.visible).map(l=>({makerItem:l,intersects:l.modelGroup.getRaycastIntersects(t)})).filter(({intersects:l})=>l.length>0);if(i.length===0)return;const r=i.reduce((l,c)=>{const h=l.intersects[0].distance,u=c.intersects[0].distance;return h<u?l:c}),s=this.fiveUtil.model.intersectRaycaster(t)[0];if(this.config.modelDepthTest&&s&&s.distance<r.intersects[0].distance)return;if(this.hooks.emit("wantsTap",{target:r.makerItem,intersectObjects:r.intersects}))return!1});this.five=t,this.tagDomContainer=document.createElement("div"),this.tagDomContainer.style.position="absolute",this.tagDomContainer.style.top="0",this.tagDomContainer.style.left="0",this.tagDomContainer.style.width="100%",this.tagDomContainer.style.height="100%",this.tagDomContainer.style.pointerEvents="none";const r={enabled:!0,visible:!0};this.state=Object.assign(r,i==null?void 0:i.initialState);const s=R({modelDepthTest:!0},i==null?void 0:i.config);this._config=s,this.modelGroup=new C.Group,this.modelGroup.name="ModelMakerPluginGroup",this.itemMap=new Map,this.state.enabled&&this._enable({userAction:!1})}get config(){return R({},this._config)}get disposed(){return this._disposed}load(t){return ee(this,null,function*(){const i=this.data;this.data=this.formatData(t),this.hooks.emit("dataChange",this.data,i),this.modelGroup.remove(...this.modelGroup.children),this.itemMap.forEach(r=>r.unmount()),this.itemMap.clear(),this.childrenMountedState=!1,this.checkMsg.childrenMountedState="",this.data.list.forEach(r=>{const s=new O8(this,r);s.itemRenderer=this.itemRenderer,this.modelGroup.add(s.modelGroup),this.itemMap.set(r.id,s),s.hooks.on("tagClick",this.onMakerTagClick)}),this.updateChildrenMountedState()})}appendTo(t){t.appendChild(this.tagDomContainer)}enable(t={}){var r;if(this.state.enabled)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!0},i),this._enable({userAction:i})}disable(t={}){var r;if(this.state.enabled===!1)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!1},i),this._disable({userAction:i})}show(t){return ee(this,null,function*(){if(this.state.visible)return Promise.resolve();if(this.disposed)return Promise.reject(new Error("不能在已销毁的插件上调用 show"));const i=R({userAction:!0},t);this.updateState({visible:!0},i.userAction),yield this._show(i)})}hide(t){return ee(this,null,function*(){if(this.state.visible===!1)return;const i=R({userAction:!0},t);this.updateState({visible:!1},i.userAction),yield this._hide(i)})}setState(t,i={}){const r=this.state;if(Nn(t,r,{deep:!0}))return;const s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s,anime:{duration:500}};t.visible?this._show(o):this._hide(o)}}updateConfig(t,i={}){var o;const r=this.config,s=R(R({},r),t);this._config=s,this.hooks.emit("configChange",{prevConfig:r,config:s,userAction:(o=i.userAction)!=null?o:!0})}getMaskItemByID(t){return this.itemMap.get(t)}formatData(t){function i(r){return r.list.length===0?!0:!("shape"in r.list[0].object_data)}return i(t)?{list:t.list.filter(r=>r.object_data.points.length>=3).map(r=>{const s=new C.Shape,o=r.object_data.points[0];return s.moveTo(o[0],o[2]),r.object_data.points.slice(1).forEach(l=>s.lineTo(l[0],l[2])),s.lineTo(o[0],o[2]),Ee(R({},r),{floor_index:r.object_data.floorIndex,object_data:Ee(R({},r.object_data),{bottom_y:o[1]+r.object_data.fixedY,shape:s.toJSON(),height:r.object_data.height+r.object_data.fixedHeight})})})}:t}checkChildrenMountedState(){const t=this.state,i=this.five;if(!t.enabled)return{result:!1,msg:"插件不可用"};const r=i.getCurrentState().mode;return r==="Panorama"?{result:!1,msg:`Five 模态不符合条件, 当前模态为:${r}`}:this.isInFiveChangeModeAnime?{result:!1,msg:"切换模态动画中不展示"}:{result:!0,msg:""}}updateChildrenMountedState(){const{result:t,msg:i}=this.checkChildrenMountedState();this.checkMsg.childrenMountedState=i,t!==this.childrenMountedState&&(this.childrenMountedState=t,this.itemMap.forEach(r=>{this.childrenMountedState?r.mount():r.unmount()}))}updateState(t,i){const r=this.state;this.state=R(R({},this.state),t),this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}_enable(t){this.hooks.emit("enable",{userAction:t.userAction}),this.five.scene.add(this.modelGroup),this.updateChildrenMountedState(),this.five.needsRender=!0,this.five.on("wantsTapGesture",this.onWantsFiveTapGesture),this.five.on("initAnimationWillStart",this.onFiveInitAnimationWillStart),this.five.on("initAnimationEnded",this.onFiveInitAnimationEnded),this.five.on("modeChange",this.onFiveModeChange),this.five.on("cameraUpdate",this.onFiveCameraUpdate)}_disable(t){this.hooks.emit("disable",{userAction:t.userAction}),this.five.scene.remove(this.modelGroup),this.updateChildrenMountedState(),this.five.needsRender=!0,this.five.off("wantsTapGesture",this.onWantsFiveTapGesture),this.five.off("initAnimationWillStart",this.onFiveInitAnimationWillStart),this.five.off("initAnimationEnded",this.onFiveInitAnimationEnded),this.five.off("modeChange",this.onFiveModeChange),this.five.off("cameraUpdate",this.onFiveCameraUpdate)}_show(t){return ee(this,null,function*(){this.hooks.emit("show",t),this.five.needsRender=!0})}_hide(t){return ee(this,null,function*(){this.hooks.emit("hide",t),this.five.needsRender=!0})}};const N8=(e,n)=>new B8(e,n);class F8 extends ws{constructor(t,i){super(t);v(this,"state");v(this,"checkMsg",{meshHidden:"",pluginDisabled:"",pluginHidden:""});v(this,"group",new C.Group);v(this,"mesh");v(this,"textureLoadingPromise");v(this,"opacityAnimeTween");v(this,"isInPanoMoveAnime",!1);v(this,"lastArrivedPanoIndex",-1);v(this,"_config");v(this,"_disposed",!1);v(this,"dispose",()=>{this.five.scene.remove(this.group),this.group.remove(...this.group.children),this.five.off("dispose",this.dispose),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive)});v(this,"checkMeshVisible",()=>this.state.visible?this.config.imageURL===""?{result:!1,msg:"图片不存在"}:this.mesh.material.map?this.five.work?this.five.getCurrentState().mode!=="Panorama"?{result:!1,msg:"非全景模式"}:this.isInPanoMoveAnime?{result:!1,msg:"处于走点动画中"}:{result:!0,msg:""}:{result:!1,msg:"Five 数据未加载"}:{result:!1,msg:"指南针贴图未加载"}:{result:!1,msg:"插件隐藏"});v(this,"onTextureLoaded",t=>{this.mesh.material.map=t,this.mesh.material.needsUpdate=!0,this.updateMeshVisible()});v(this,"onFiveWillLoad",()=>{this.lastArrivedPanoIndex=-1,this.updateMeshVisible()});v(this,"onFivePanoWillArrive",t=>{var i;t!==this.five.getCurrentState().panoIndex&&(this.isInPanoMoveAnime=!0,(i=this.opacityAnimeTween)==null||i.dispose(),this.updateMeshVisible())});v(this,"onFivePanoArrived",t=>{t!==this.lastArrivedPanoIndex&&(this.lastArrivedPanoIndex=t,this.isInPanoMoveAnime=!1,this.updateMeshPosition(t),this.updateMeshVisible(),this.five.needsRender=!0)});v(this,"onMeshVisibleChange",t=>{var i;if((i=this.opacityAnimeTween)==null||i.dispose(),!t){this.mesh.visible=!1;return}this.mesh.material.setValues({opacity:0}),this.mesh.visible=!0,this.opacityAnimeTween=Mc(1e3).onUpdate(({progress:r})=>{var s;(s=this.mesh)==null||s.material.setValues({opacity:r}),this.five.needsRender=!0}).play()});v(this,"onFiveModeChange",()=>{this.updateMeshVisible()});this.five=t;const r={enabled:!0,visible:!0};this.state=Object.assign(r,i==null?void 0:i.initialState);const s=R({width:1.4,yOffset:.01,yRotate:0,imageURL:this.absoluteUrl("/release/web/logo.7febb17f.png")},i==null?void 0:i.config);this._config=s,this.group.name="current-pano-image-plugin-group",this.mesh=new C.Mesh(new C.PlaneBufferGeometry(this.config.width,this.config.width),new C.MeshBasicMaterial({transparent:!0,opacity:0,depthTest:!1})),this.mesh.visible=!1,this.group.add(this.mesh),this.updateMeshQuaternion(this.config.yRotate),this.state.visible||(this.checkMsg.pluginHidden="初始值设置为隐藏"),this.state.enabled||(this.checkMsg.pluginDisabled="初始值设置为禁用"),this.state.enabled&&this._enable({userAction:!1}),this.five.once("dispose",this.dispose)}get config(){return R({},this._config)}get disposed(){return this._disposed}enable(t={}){var r;if(this.state.enabled)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!0},i),this.checkMsg.pluginDisabled="",this._enable({userAction:i})}disable(t={}){var r;if(this.state.enabled===!1)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!1},i),this.checkMsg.pluginDisabled="调用 disable 禁用",this._disable({userAction:i})}show(t){return ee(this,null,function*(){if(this.state.visible)return Promise.resolve();if(this.disposed)return Promise.reject(new Error("不能在已销毁的插件上调用 show"));const i=R({userAction:!0},t);this.updateState({visible:!0},i.userAction),this.checkMsg.pluginHidden="",this._show(i)})}hide(t){return ee(this,null,function*(){if(this.state.visible===!1)return;const i=R({userAction:!0},t);this.updateState({visible:!1},i.userAction),this.checkMsg.pluginDisabled="调用 hide 隐藏",this._hide(i)})}setState(t,i={}){const r=this.state;if(Nn(t,r,{deep:!0}))return;const s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this.checkMsg.pluginDisabled="":this.checkMsg.pluginDisabled="调用 setState 禁用",t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s,anime:{duration:500}};t.visible?this.checkMsg.pluginHidden="":this.checkMsg.pluginHidden="调用 setState 隐藏",t.visible?this._show(o):this._hide(o)}}updateConfig(t,i={}){var o;const r=this.config,s=R(R({},r),t);this._config=s,r.imageURL!==s.imageURL&&this.reloadTexture(s.imageURL),r.yOffset!==s.yOffset&&this.updateMeshPosition(this.five.getCurrentState().panoIndex),r.yRotate!==s.yRotate&&this.updateMeshQuaternion(s.yRotate),r.width!==s.width&&(this.mesh.geometry=new C.PlaneBufferGeometry(s.width,s.width)),this.hooks.emit("configChange",{prevConfig:r,config:s,userAction:(o=i.userAction)!=null?o:!0})}__whyCantSeeMesh(){if(this.disposed)return"插件已销毁";if(this.checkMsg.pluginDisabled)return this.checkMsg.pluginDisabled;if(this.checkMsg.pluginHidden)return this.checkMsg.pluginHidden;if(this.checkMsg.meshHidden)return this.checkMsg.meshHidden}updateState(t,i){const r=this.state;this.state=R(R({},this.state),t),this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}updateMeshVisible(){const{result:t,msg:i}=this.checkMeshVisible();this.checkMsg.meshHidden=i,t!==this.mesh.visible&&this.onMeshVisibleChange(t)}updateMeshPosition(t){const i=this.workUtil.getObserverStandingPosition(t);if(!i){console.warn("CurrentPanoImagePlugin: 无法获取到当前点位的 standingPosition");return}const r=i.clone().setY(i.y+this.config.yOffset);r&&this.mesh.position.copy(r)}reloadTexture(t){return ee(this,null,function*(){if(this.mesh.material.map=null,t!==""){const i=Us(t);this.textureLoadingPromise=i;const r=yield i;r.minFilter=C.LinearFilter,this.textureLoadingPromise===i&&(this.onTextureLoaded(r),this.textureLoadingPromise=null)}this.updateMeshVisible()})}updateMeshQuaternion(t){const i=new C.Quaternion;i.multiplyQuaternions(new C.Quaternion().setFromAxisAngle(new C.Vector3(1,0,0),-Math.PI/2),new C.Quaternion().setFromAxisAngle(new C.Vector3(0,0,1),t)),this.mesh.quaternion.copy(i)}_enable(t){this.hooks.emit("enable",{userAction:t.userAction}),this.config.imageURL&&!this.mesh.material.map&&!this.textureLoadingPromise&&this.reloadTexture(this.config.imageURL),this.five.scene.add(this.group),this.five.needsRender=!0,this.five.work&&this.onFiveWillLoad(),this.five.getCurrentState().mode==="Panorama"&&(this.onFiveModeChange(),this.onFivePanoArrived(this.five.getCurrentState().panoIndex)),this.five.on("willLoad",this.onFiveWillLoad),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive),this.five.on("modeChange",this.onFiveModeChange)}_disable(t){this.hooks.emit("disable",{userAction:t.userAction}),this.five.scene.remove(this.group),this.five.needsRender=!0,this.five.off("willLoad",this.onFiveWillLoad),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("modeChange",this.onFiveModeChange)}_show(t){this.hooks.emit("show",t),this.updateMeshVisible(),this.five.needsRender=!0}_hide(t){this.hooks.emit("hide",t),this.updateMeshVisible(),this.five.needsRender=!0}}const V8=(e,n)=>new F8(e,n),G8={auto:"",pen:"","pen-forbidden":"","pen-crosshair":"","pne-polygon":"","pen-circle":"","crosshair-rectangle":"","crosshair-circle":""};class j8{constructor(n){v(this,"container");v(this,"deleteButton");this.container=n}setType(n){const t=G8[n];t?this.container.style.cursor=`url(${t}), auto`:this.container.style.cursor=n}showDeleteButton(n){const{clientX:t,clientY:i,container:r,onClick:s}=n;let o=this.deleteButton;return o||(o=document.createElement("div"),o.style.position="absolute",o.style.width="20px",o.style.height="20px",o.style.transform="translate(-50%, -40px)",o.style.borderRadius="50%",o.style.cursor="pointer",o.style.zIndex="9999",o.style.cursor="pointer",o.style.userSelect="none",o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center",o.style.backgroundImage="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTciIGhlaWdodD0iMjUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSIxMC43MDYlIiB5MT0iNDIuNzQ0JSIgeDI9Ijg5LjA2NCUiIHkyPSI1Ny4yMDglIiBpZD0icHJlZml4X19hIj48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9Ii4zMDgiIG9mZnNldD0iNDkuNTY5JSIvPjxzdG9wIHN0b3AtY29sb3I9IiNGRkYiIHN0b3Atb3BhY2l0eT0iMCIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iLS4yNSIgeT0iLS4yNSIgd2lkdGg9IjU3LjUiIGhlaWdodD0iMjMuNSIgcng9IjExLjI1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDEpIiBmaWxsPSIjMkMyQzJDIiBzdHJva2U9InVybCgjcHJlZml4X19hKSIgc3Ryb2tlLXdpZHRoPSIuNSIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsLW9wYWNpdHk9Ii4zMDMiLz48L3N2Zz4=)",o.innerHTML='<svg width="16px" height="17px" viewBox="0 0 16 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><linearGradient x1="22.185491%" y1="100%" x2="66.8316686%" y2="6.67239121%" id="1"><stop stop-color="#FFFCFC" stop-opacity="0.6"></stop><stop stop-color="#FFFFFF" offset="100%"></stop></linearGradient></defs> <path fill="url(#1)" fill-rule="nonzero" transform="translate(2.16 2.16)" d="M11.2979686,2.71818182 C11.611378,2.71818182 11.8654465,2.97561809 11.8654465,3.29318182 C11.8654465,3.58428191 11.6519584,3.82485822 11.374972,3.86293275 L11.2979686,3.86818182 L10.464,3.868 L9.7236795,10.6246222 C9.64153248,11.3737453 9.04854423,11.9512142 8.32013277,12.0165596 L8.18206028,12.0227273 L3.68338622,12.0227273 C2.89302127,12.0227273 2.22904821,11.4205655 2.141767,10.6246222 L2.141767,10.6246222 L1.4,3.868 L0.567477876,3.86818182 C0.254068499,3.86818182 0,3.61074555 0,3.29318182 C0,3.00208173 0.213488114,2.76150541 0.49047449,2.72343089 L0.567477876,2.71818182 L11.2979686,2.71818182 Z M9.322,3.868 L2.542,3.868 L3.26978106,10.4976259 C3.28762252,10.6603274 3.39528004,10.7928487 3.53932022,10.8467307 L3.61412483,10.866894 L3.68338622,10.8727273 L8.18206028,10.8727273 C8.39410941,10.8727273 8.57224853,10.7111717 8.59566544,10.4976259 L8.59566544,10.4976259 L9.322,3.868 Z M8.16824216,0 C8.48165153,0 8.73572003,0.257436269 8.73572003,0.575 C8.73572003,0.866100087 8.52223192,1.1066764 8.24524554,1.14475093 L8.16824216,1.15 L3.69720434,1.15 C3.38379497,1.15 3.12972647,0.892563731 3.12972647,0.575 C3.12972647,0.283899913 3.34321458,0.0433235966 3.62020096,0.00524907226 L3.69720434,0 L8.16824216,0 Z"></path></svg>'),this.deleteButton=o,r.appendChild(o),o.style.left=`${t}px`,o.style.top=`${i}px`,o.onclick=()=>{r.removeChild(o),s()},o}removeDeleteButton(){this.deleteButton&&this.deleteButton.remove()}tip(n){return()=>this.closeTip()}closeTip(){}reset(){this.container.style.cursor="auto"}}class H8{constructor(){v(this,"five");v(this,"_cursor");v(this,"_pointSelector");v(this,"_fiveDomEvents");v(this,"_object3DHelper");v(this,"inited",!1);v(this,"init",n=>{this.inited=!0,this.five=n,this._cursor=void 0,this._pointSelector=void 0,this._fiveDomEvents=void 0,this._object3DHelper=void 0})}get cursor(){if(!this.inited)throw new Error("Global not inited");return this._cursor?this._cursor:(this._cursor=new j8(this.five.getElement()),this._cursor)}get pointSelector(){if(!this.inited)throw new Error("Global not inited");return this._pointSelector?this._pointSelector:(this._pointSelector=new Qx(this.five,{mode:"cursor"}),this._pointSelector)}get fiveDomEvents(){if(!this.inited)throw new Error("Global not inited");return this._fiveDomEvents?this._fiveDomEvents:(this._fiveDomEvents=new Zg(this.five,{noEmitWhenNotInScene:!0}),this._fiveDomEvents)}get object3DHelper(){if(!this.inited)throw new Error("Global not inited");return this._object3DHelper?this._object3DHelper:(this._object3DHelper=new ev(this.five),this._object3DHelper)}}const UM=new H8;window.globalModules=UM;function WM(e,n){return e?n(e)?e:e.parent?WM(e.parent,n):null:null}const U8="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==";let w1=null;class Sc extends ei{constructor(t){var c,h;super();v(this,"name","PointMesh");v(this,"opacityBeforeHighlight");v(this,"highlighted",!1);v(this,"fontMesh");v(this,"backgroundMesh");const i=new C.BufferGeometry;i.setAttribute("position",new C.Float32BufferAttribute([0,0,0],3));const r={transparent:!0,side:C.DoubleSide,size:(c=t==null?void 0:t.size)!=null?c:8,map:w1||(w1=new C.TextureLoader().load(U8)),sizeAttenuation:!1},s=new C.PointsMaterial(Ee(R({},r),{color:(h=t==null?void 0:t.color)!=null?h:16777215,depthTest:!0,opacity:1})),o=new C.PointsMaterial(Ee(R({},r),{size:s.size,color:s.color,depthWrite:!1,depthTest:!1,opacity:.5})),a=new C.Points(i,s),l=new C.Points(i,o);this.fontMesh=a,this.backgroundMesh=l,a.name="FontMesh",l.name="BackgroundMesh",a.renderOrder=10,l.renderOrder=0,this.add(a,l),t!=null&&t.point&&this.position.copy(Ft(t.point)),t&&this.setStyle(t)}get color(){return this.fontMesh.material.color}get size(){return this.fontMesh.material.size}setStyle(t){At(t.color)&&(this.fontMesh.material.setValues({color:t.color}),this.backgroundMesh.material.setValues({color:t.color})),At(t.size)&&(this.fontMesh.material.setValues({side:t.size}),this.backgroundMesh.material.setValues({side:t.size})),At(t.occlusionVisibility)&&(t.occlusionVisibility?t.occlusionMode==="depthTest"?(this.fontMesh.material.depthTest=!1,this.backgroundMesh.visible=!1):(this.fontMesh.material.depthTest=!0,this.backgroundMesh.visible=!0):(this.fontMesh.material.depthTest=!0,this.backgroundMesh.visible=!1))}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.fontMesh.material.opacity,this.fontMesh.material.setValues({opacity:this.opacityBeforeHighlight*ra}))}unhighlight(){this.highlighted&&(this.highlighted=!1,this.fontMesh.material.setValues({opacity:this.opacityBeforeHighlight}))}}class Um extends Ri{constructor(t){super();v(this,"name","LineWithDotsMesh");v(this,"pointGroup",new ei);v(this,"_paramsStyle");v(this,"setStyle",t=>{super.setStyle(t),this._paramsStyle=R(R({},this._paramsStyle),t),this.pointMeshes.forEach(i=>i.setStyle(Ee(R({},this._paramsStyle),{color:t.lineColor}))),this.updateEdgePointsVisibility(),this.needsRender=!0});v(this,"highlight",()=>{super.highlight(),this.pointMeshes.forEach(t=>t.highlight())});v(this,"unhighlight",()=>{super.unhighlight(),this.pointMeshes.forEach(t=>t.unhighlight())});v(this,"updateEdgePointsVisibility",()=>{var t;At((t=this._paramsStyle)==null?void 0:t.pointVisibility)&&(this.startPoint&&(this.startPoint.visible=typeof this._paramsStyle.pointVisibility=="object"?this._paramsStyle.pointVisibility.startPoint:this._paramsStyle.pointVisibility),this.endPoint&&(this.endPoint.visible=typeof this._paramsStyle.pointVisibility=="object"?this._paramsStyle.pointVisibility.endPoint:this._paramsStyle.pointVisibility))});this.add(this.pointGroup),t&&this.setStyle(t),t!=null&&t.points&&this.setPoints(t.points)}get startPoint(){return this.pointMeshes[0]}get endPoint(){return this.pointMeshes.length<2?null:this.pointMeshes.at(-1)}get visiblePointMeshes(){return this.pointMeshes.filter(t=>t.visible)}get pointMeshes(){return this.pointGroup.children}setPoints(t){super.setPoints(t);const i=t.map(Ft).filter(At);this.pointGroup.removeChildren(),this.addIfNotExists(this.pointGroup),i.forEach(r=>{var o;const s=new Sc(Ee(R({},this.style),{color:(o=this._paramsStyle)==null?void 0:o.lineColor}));s.position.copy(r),this.pointGroup.add(s)}),this.updateEdgePointsVisibility(),this.needsRender=!0}}function W8(e){const n=[...e];if(e.length<3)return e;const t=e.at(-1),i=e[0];return t.equals(i)||n.push(i),n}class QM extends ei{constructor(t){super();v(this,"name","PolylineBaseMesh");v(this,"lines",[]);v(this,"withDots");v(this,"paramsStyle");const o=t,{withDots:i,points:r}=o,s=po(o,["withDots","points"]);this.withDots=i!=null?i:!0,r&&this.setPoints(r),s&&this.setStyle(s),this.addEventListener("removed",()=>{hg(this)})}get style(){var t;return{lineColor:this.lineColor,lineWidth:this.lineWidth,opacity:this.opacity,dashed:this.dashed,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode,lengthEnable:(t=this.paramsStyle)==null?void 0:t.lengthEnable}}get opacity(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.opacity)!=null?r:(i=this.paramsStyle)==null?void 0:i.opacity}get lineColor(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.color)!=null?r:(i=this.paramsStyle)!=null&&i.lineColor?new C.Color(this.paramsStyle.lineColor):void 0}get lineWidth(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.lineWidth)!=null?r:(i=this.paramsStyle)==null?void 0:i.lineWidth}get dashed(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.dashed)!=null?r:(i=this.paramsStyle)==null?void 0:i.dashed}get occlusionVisibility(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.occlusionVisibility)!=null?r:(i=this.paramsStyle)==null?void 0:i.occlusionVisibility}get occlusionMode(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.occlusionMode)!=null?r:(i=this.paramsStyle)==null?void 0:i.occlusionMode}get points(){var t;return this.lines.map(i=>i.points[0]).concat((t=this.lines.at(-1))==null?void 0:t.points[1]).filter(Boolean)}setPoints(t,i={closed:!1}){let r=t.map(Ft);i.closed&&(r=W8(r)),r.forEach((s,o)=>{var c;const a=r[o+1];if(o!==0&&a===void 0)return;const l=(c=this.lines[o])!=null?c:(()=>{const h=new Um(Ee(R({},this.style),{pointVisibility:this.withDots?{startPoint:o===0,endPoint:!0}:!1}));return this.lines[o]=h,this.add(h),h})();l.setStyle(this.style),l.setPoints([s,a])}),r.length===0?(this.lines.forEach(s=>s.removeFromParent()),this.lines=[]):r.length===1||this.lines.length>r.length-1&&this.lines.splice(r.length-1).forEach(s=>s.removeFromParent())}setStyle(t){this.paramsStyle=R(R({},this.paramsStyle),t),this.lines.forEach(i=>i.setStyle(this.paramsStyle))}highlight(){this.lines.forEach(t=>t.highlight())}unhighlight(){this.lines.forEach(t=>t.unhighlight())}}class oo extends QM{constructor(...t){super(Ee(R({},t[0]),{withDots:!1}));v(this,"name","PolylineMesh")}}class Bl extends QM{constructor(...t){super(Ee(R({},t[0]),{withDots:!0}));v(this,"name","PolylineWithDotsMesh")}}const wp=typeof navigator!="undefined"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function xp(e,n,t,i){e.addEventListener?e.addEventListener(n,t,i):e.attachEvent&&e.attachEvent("on".concat(n),t)}function Al(e,n,t,i){e.removeEventListener?e.removeEventListener(n,t,i):e.detachEvent&&e.detachEvent("on".concat(n),t)}function YM(e,n){const t=n.slice(0,n.length-1);for(let i=0;i<t.length;i++)t[i]=e[t[i].toLowerCase()];return t}function XM(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");const n=e.split(",");let t=n.lastIndexOf("");for(;t>=0;)n[t-1]+=",",n.splice(t,1),t=n.lastIndexOf("");return n}function Q8(e,n){const t=e.length>=n.length?e:n,i=e.length>=n.length?n:e;let r=!0;for(let s=0;s<t.length;s++)i.indexOf(t[s])===-1&&(r=!1);return r}const Ic={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":wp?173:189,"=":wp?61:187,";":wp?59:186,"'":222,"[":219,"]":221,"\\":220},ar={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},Wm={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Dn={16:!1,18:!1,17:!1,91:!1},en={};for(let e=1;e<20;e++)Ic["f".concat(e)]=111+e;let Yt=[],Nl=null,ZM="all";const Mr=new Map,Hc=e=>Ic[e.toLowerCase()]||ar[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),Y8=e=>Object.keys(Ic).find(n=>Ic[n]===e),X8=e=>Object.keys(ar).find(n=>ar[n]===e);function JM(e){ZM=e||"all"}function Tc(){return ZM||"all"}function Z8(){return Yt.slice(0)}function J8(){return Yt.map(e=>Y8(e)||X8(e)||String.fromCharCode(e))}function q8(){const e=[];return Object.keys(en).forEach(n=>{en[n].forEach(t=>{let{key:i,scope:r,mods:s,shortcut:o}=t;e.push({scope:r,shortcut:o,mods:s,keys:i.split("+").map(a=>Hc(a))})})}),e}function K8(e){const n=e.target||e.srcElement,{tagName:t}=n;let i=!0;const r=t==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(n.type);return(n.isContentEditable||(r||t==="TEXTAREA"||t==="SELECT")&&!n.readOnly)&&(i=!1),i}function $8(e){return typeof e=="string"&&(e=Hc(e)),Yt.indexOf(e)!==-1}function e6(e,n){let t,i;e||(e=Tc());for(const r in en)if(Object.prototype.hasOwnProperty.call(en,r))for(t=en[r],i=0;i<t.length;)t[i].scope===e?t.splice(i,1).forEach(o=>{let{element:a}=o;return tv(a)}):i++;Tc()===e&&JM(n||"all")}function t6(e){let n=e.keyCode||e.which||e.charCode;const t=Yt.indexOf(n);if(t>=0&&Yt.splice(t,1),e.key&&e.key.toLowerCase()==="meta"&&Yt.splice(0,Yt.length),(n===93||n===224)&&(n=91),n in Dn){Dn[n]=!1;for(const i in ar)ar[i]===n&&(ri[i]=!1)}}function qM(e){if(typeof e=="undefined")Object.keys(en).forEach(r=>{Array.isArray(en[r])&&en[r].forEach(s=>nu(s)),delete en[r]}),tv(null);else if(Array.isArray(e))e.forEach(r=>{r.key&&nu(r)});else if(typeof e=="object")e.key&&nu(e);else if(typeof e=="string"){for(var n=arguments.length,t=new Array(n>1?n-1:0),i=1;i<n;i++)t[i-1]=arguments[i];let[r,s]=t;typeof r=="function"&&(s=r,r=""),nu({key:e,scope:r,method:s,splitKey:"+"})}}const nu=e=>{let{key:n,scope:t,method:i,splitKey:r="+"}=e;XM(n).forEach(o=>{const a=o.split(r),l=a.length,c=a[l-1],h=c==="*"?"*":Hc(c);if(!en[h])return;t||(t=Tc());const u=l>1?YM(ar,a):[],d=[];en[h]=en[h].filter(f=>{const p=(i?f.method===i:!0)&&f.scope===t&&Q8(f.mods,u);return p&&d.push(f.element),!p}),d.forEach(f=>tv(f))})};function x1(e,n,t,i){if(n.element!==i)return;let r;if(n.scope===t||n.scope==="all"){r=n.mods.length>0;for(const s in Dn)Object.prototype.hasOwnProperty.call(Dn,s)&&(!Dn[s]&&n.mods.indexOf(+s)>-1||Dn[s]&&n.mods.indexOf(+s)===-1)&&(r=!1);(n.mods.length===0&&!Dn[16]&&!Dn[18]&&!Dn[17]&&!Dn[91]||r||n.shortcut==="*")&&(n.keys=[],n.keys=n.keys.concat(Yt),n.method(e,n)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function M1(e,n){const t=en["*"];let i=e.keyCode||e.which||e.charCode;if(!ri.filter.call(this,e))return;if((i===93||i===224)&&(i=91),Yt.indexOf(i)===-1&&i!==229&&Yt.push(i),["ctrlKey","altKey","shiftKey","metaKey"].forEach(a=>{const l=Wm[a];e[a]&&Yt.indexOf(l)===-1?Yt.push(l):!e[a]&&Yt.indexOf(l)>-1?Yt.splice(Yt.indexOf(l),1):a==="metaKey"&&e[a]&&Yt.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(Yt=Yt.slice(Yt.indexOf(l))))}),i in Dn){Dn[i]=!0;for(const a in ar)ar[a]===i&&(ri[a]=!0);if(!t)return}for(const a in Dn)Object.prototype.hasOwnProperty.call(Dn,a)&&(Dn[a]=e[Wm[a]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(Yt.indexOf(17)===-1&&Yt.push(17),Yt.indexOf(18)===-1&&Yt.push(18),Dn[17]=!0,Dn[18]=!0);const r=Tc();if(t)for(let a=0;a<t.length;a++)t[a].scope===r&&(e.type==="keydown"&&t[a].keydown||e.type==="keyup"&&t[a].keyup)&&x1(e,t[a],r,n);if(!(i in en))return;const s=en[i],o=s.length;for(let a=0;a<o;a++)if((e.type==="keydown"&&s[a].keydown||e.type==="keyup"&&s[a].keyup)&&s[a].key){const l=s[a],{splitKey:c}=l,h=l.key.split(c),u=[];for(let d=0;d<h.length;d++)u.push(Hc(h[d]));u.sort().join("")===Yt.sort().join("")&&x1(e,l,r,n)}}function ri(e,n,t){Yt=[];const i=XM(e);let r=[],s="all",o=document,a=0,l=!1,c=!0,h="+",u=!1,d=!1;for(t===void 0&&typeof n=="function"&&(t=n),Object.prototype.toString.call(n)==="[object Object]"&&(n.scope&&(s=n.scope),n.element&&(o=n.element),n.keyup&&(l=n.keyup),n.keydown!==void 0&&(c=n.keydown),n.capture!==void 0&&(u=n.capture),typeof n.splitKey=="string"&&(h=n.splitKey),n.single===!0&&(d=!0)),typeof n=="string"&&(s=n),d&&qM(e,s);a<i.length;a++)e=i[a].split(h),r=[],e.length>1&&(r=YM(ar,e)),e=e[e.length-1],e=e==="*"?"*":Hc(e),e in en||(en[e]=[]),en[e].push({keyup:l,keydown:c,scope:s,mods:r,shortcut:i[a],method:t,key:i[a],splitKey:h,element:o});if(typeof o!="undefined"&&window){if(!Mr.has(o)){const f=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return M1(p,o)},m=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;M1(p,o),t6(p)};Mr.set(o,{keydownListener:f,keyupListenr:m,capture:u}),xp(o,"keydown",f,u),xp(o,"keyup",m,u)}if(!Nl){const f=()=>{Yt=[]};Nl={listener:f,capture:u},xp(window,"focus",f,u)}}}function n6(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(en).forEach(t=>{en[t].filter(r=>r.scope===n&&r.shortcut===e).forEach(r=>{r&&r.method&&r.method()})})}function tv(e){const n=Object.values(en).flat();if(n.findIndex(i=>{let{element:r}=i;return r===e})<0){const{keydownListener:i,keyupListenr:r,capture:s}=Mr.get(e)||{};i&&r&&(Al(e,"keyup",r,s),Al(e,"keydown",i,s),Mr.delete(e))}if((n.length<=0||Mr.size<=0)&&(Object.keys(Mr).forEach(r=>{const{keydownListener:s,keyupListenr:o,capture:a}=Mr.get(r)||{};s&&o&&(Al(r,"keyup",o,a),Al(r,"keydown",s,a),Mr.delete(r))}),Mr.clear(),Object.keys(en).forEach(r=>delete en[r]),Nl)){const{listener:r,capture:s}=Nl;Al(window,"focus",r,s),Nl=null}}const Mp={getPressedKeyString:J8,setScope:JM,getScope:Tc,deleteScope:e6,getPressedKeyCodes:Z8,getAllKeyCodes:q8,isPressed:$8,filter:K8,trigger:n6,unbind:qM,keyMap:Ic,modifier:ar,modifierMap:Wm};for(const e in Mp)Object.prototype.hasOwnProperty.call(Mp,e)&&(ri[e]=Mp[e]);if(typeof window!="undefined"){const e=window.hotkeys;ri.noConflict=n=>(n&&window.hotkeys===ri&&(window.hotkeys=e),ri),window.hotkeys=ri}const E1=new Map;class Nr extends ei{constructor(t,i){super();v(this,"name","Sculpt");v(this,"isSculptObject",!0);v(this,"draggable");v(this,"selected");v(this,"config");v(this,"editor");v(this,"on",(t,i,r)=>sn.modules.fiveDomEvents.addEventListener(this,t,i,r));v(this,"off",(...t)=>sn.modules.fiveDomEvents.removeEventListener(this,...t));t!=null&&t.id&&(this.uuid=t.id),this.config=R({canEdit:!0,occlusionVisibility:!0,occlusionMode:"translucence"},i),t!=null&&t.style&&(t.style.occlusionVisibility=this.config.occlusionVisibility,t.style.occlusionMode=this.config.occlusionMode),this.addEventListener("removed",()=>{hg(this)}),ri("esc",()=>{this.stopCreating()}),this.config.canEdit&&(ri("backspace, delete",()=>{this.selected&&this.delete()}),this.on("click",()=>{var s;if(this.pointSelector.enabled)return;let r=E1.get(this.parent.uuid);r&&(r.selected=!1,r.unhighlight(),(s=r.editor)==null||s.disable()),E1.set(this.parent.uuid,this),this.selected=!0,this.highlight()}),ri("esc",()=>{var r;this.selected=!1,this.unhighlight(),!this.pointSelector.enabled&&((r=this.editor)==null||r.disable())}))}get baseData(){return{id:this.uuid,type:this.type}}get pointSelector(){return sn.modules.pointSelector}undo(){throw new Error("Method not implemented.")}redo(){throw new Error("Method not implemented.")}canUndo(){throw new Error("Method not implemented.")}canRedo(){throw new Error("Method not implemented.")}stopCreating(){sn.modules.pointSelector.disable()}delete(){var t;this.removeFromParent(),this.off(),(t=this.editor)==null||t.disable()}highlight(){}unhighlight(){}showDeleteButton(t,i){sn.modules.cursor.showDeleteButton({clientX:t,clientY:i,container:document.body,onClick:()=>this.delete()}),sn.modules.five.once("cameraUpdate",()=>{sn.modules.cursor.removeDeleteButton()})}applyObjectMatrixWorld(t){return this.updateMatrixWorld(),qu(this,t)}applyObjectQuaternion(t){const i=this.quaternion.clone();return Array.isArray(t)?t.map(r=>r.clone().applyQuaternion(i)):t.clone().applyQuaternion(i)}}class nv extends ei{constructor(t){super();v(this,"originObject");this.originObject=t}enable(){this.originObject.add(this)}disable(){this.originObject.remove(this)}}class Uc extends nv{constructor(t,i){super(t);v(this,"objectHelperConfig");this.objectHelperConfig=i}enable(){super.enable();const t=typeof this.objectHelperConfig=="function"?this.objectHelperConfig():this.objectHelperConfig;sn.modules.object3DHelper.addObject3DHelper(this.originObject,R({positionFrom:"boundingBox"},t))}disable(){super.disable(),sn.modules.object3DHelper.removeObject3DHelper(this.originObject)}}class iv extends nv{constructor(t){super(t);v(this,"draggingPoints",[]);v(this,"onDragstart",t=>{const i=t.target;this.draggingPoints=this.pointMeshes.filter(r=>r.position.equals(i.position))});v(this,"onDragend",t=>{this.draggingPoints=[]})}get pointMeshes(){return this.children.filter(t=>t instanceof Sc)}get pointHandles(){return this.children}enable(){super.enable(),this.points.filter(At).forEach(t=>{const i=new Sc;i.visible=!1,i.position.copy(t),i.draggable=!0,sn.modules.fiveDomEvents.addEventListener(i,"drag",this.onDrag),sn.modules.fiveDomEvents.addEventListener(i,"dragstart",this.onDragstart),sn.modules.fiveDomEvents.addEventListener(i,"dragend",this.onDragend),this.add(i)})}disable(){super.disable(),this.removeChildren()}}class i6 extends iv{constructor(t){super(t);v(this,"onDrag",t=>{if(!this.draggingPoints||this.draggingPoints.length===0)return;const i=Fc(sn.modules.five,t.raycaster);this.draggingPoints.forEach(r=>r.position.copy(i.point)),this.originObject.lineMesh.setPoints(this.pointMeshes.map(r=>r.position))})}get points(){return this.originObject.lineMesh.points}}class r6 extends iv{constructor(t){super(t);v(this,"onDrag",t=>{if(!this.draggingPoints||this.draggingPoints.length===0)return;const i=Fc(sn.modules.five,t.raycaster);this.draggingPoints.forEach(r=>r.position.copy(i.point)),this.originObject.polyLineMesh.setPoints(this.pointMeshes.map(r=>r.position))})}get points(){return this.originObject.polyLineMesh.points}}function yi(e){return Array.isArray(e)?e.map(n=>[n.x,n.y,n.z]):[e.x,e.y,e.z]}function rv(){let e,n;return{promise:new Promise((i,r)=>{e=i,n=r}),resolve:e,reject:n}}const C1=new C.Vector3;class P1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Polyline");v(this,"polyLineMesh");v(this,"creatingObject");t&&(this.polyLineMesh=new Bl(R(R({},t.style),t)),this.add(this.polyLineMesh)),this.editor=new r6(this)}get data(){return Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.polyLineMesh.points)),style:{lineColor:new C.Color(this.polyLineMesh.lineColor).getHex(),lineWidth:this.polyLineMesh.lineWidth,dashed:this.polyLineMesh.dashed}})}highlight(){var t;(t=this.polyLineMesh)==null||t.highlight()}unhighlight(){var t;(t=this.polyLineMesh)==null||t.unhighlight()}canUndo(){var t;(t=this.creatingObject)==null||t.canUndo()}canRedo(){var t;(t=this.creatingObject)==null||t.canRedo()}undo(){var t;(t=this.creatingObject)==null||t.undo()}redo(){var t;(t=this.creatingObject)==null||t.redo()}create(t){return ee(this,null,function*(){this.removeChildren();const i=new Bl(t);this.polyLineMesh=i,this.add(this.polyLineMesh),this.creatingObject=s6(i,this.pointSelector,t),yield this.creatingObject.finished,this.editor.enable()})}}function s6(e,n,t){var x;const i=e.parent;if(!i)return;const{promise:r,resolve:s,reject:o}=rv(),a=(x=t==null?void 0:t.limit)!=null?x:"none",l=new oo(e.style);i.add(l);const c=new oo(Ee(R({},e.style),{dashed:!0,lengthEnable:!1}));i.add(c),n.enable();const h=[];let u,d,f;const m=[],p=()=>h.length>0,g=()=>m.length>0,y=()=>{p()&&(m.push(h.pop()),e.setPoints(h),w(f),n.pointSelectorHelper.magnifier.render())},b=()=>{g()&&(h.push(m.pop()),e.setPoints(h),w(f),n.pointSelectorHelper.magnifier.render())},A=M=>{m.length=0;const P=h.length===0?M.point:u.clone();h.push(P),e.setPoints(h)},w=M=>{const P=()=>{l.setPoints([]),c.setPoints([]),u=null};if(!M||(f=M,!(h!=null&&h.length)))return P();const S=h.at(-1).clone();a==="none"?(u=M.point,l.setPoints([S,u])):a==="xoz"?(d=d!=null?d:new C.Plane().setFromNormalAndCoplanarPoint(new C.Vector3(0,1,0),h[0]),n.plane=d,u=d.projectPoint(M.point,C1),l.setPoints([S,u]),c.setPoints([u,M.point])):a==="y"&&(h.length===1?(u=M.point,l.setPoints([S,u])):(d=d!=null?d:new C.Plane().setFromCoplanarPoints(h[0],h[1],new C.Vector3(0,1,0).add(h[0])),n.plane=d,u=d.projectPoint(M.point,C1),l.setPoints([S,u]),c.setPoints([u,M.point])))};return n.on("select",A),n.on("intersectionUpdate",w),n.on("disable",()=>{if(n.off("select",A),n.off("intersectionUpdate",w),n.plane=null,i.remove(l),i.remove(c),h.length<2)return i.remove(e),o(new Error("Cancelled"));s()}),{finished:r,canUndo:p,canRedo:g,undo:y,redo:b}}class o6 extends nv{constructor(t){super(t);v(this,"onDrag",t=>{var r;const i=Fc(sn.modules.five,t.raycaster);(r=this.originObject.pointMesh)==null||r.position.copy(i.point)})}enable(){super.enable(),this.originObject.config.canEdit&&(this.originObject.draggable=!0,this.originObject.on("drag",this.onDrag))}disable(){super.disable(),this.originObject.config.canEdit&&(this.originObject.draggable=!1,this.originObject.off("drag",this.onDrag))}}class _1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Point");v(this,"pointMesh");this.editor=new o6(this),t&&(this.pointMesh=new Sc(R(R({},t.style),t)),this.add(this.pointMesh))}get data(){return Ee(R({},this.baseData),{point:yi(this.applyObjectMatrixWorld(this.pointMesh.position)),style:{color:this.pointMesh.color.getHex(),size:this.pointMesh.size}})}highlight(){var t;(t=this.pointMesh)==null||t.highlight()}unhighlight(){var t;(t=this.pointMesh)==null||t.unhighlight()}setStyle(t){this.pointMesh.setStyle(t)}create(t){return ee(this,null,function*(){this.pointMesh&&this.remove(this.pointMesh),this.add(this.pointMesh=new Sc(t)),yield a6(this.pointMesh,this.pointSelector),this.editor.enable()})}}function a6(e,n){return new Promise((t,i)=>{n.enable();const r=s=>{const{point:o}=s;e.position.copy(o),t(),n.disable()};n.on("disable",()=>{n.off("select",r),i(new Error("Cancelled"))}),n.once("select",r)})}class sv extends ei{constructor(t){var a,l;super();v(this,"name","ColoredMesh");v(this,"meshFont");v(this,"meshBackground");v(this,"paramsStyle",{});v(this,"_geometry",new C.BufferGeometry);this.paramsStyle=t!=null?t:{};const i=new C.MeshBasicMaterial({color:(a=t==null?void 0:t.color)!=null?a:$E,transparent:!0,side:C.DoubleSide,depthTest:!0,opacity:(l=t==null?void 0:t.opacity)!=null?l:.5}),r=new C.MeshBasicMaterial({color:16777215,transparent:!0,side:C.DoubleSide,depthTest:!1,depthWrite:!1,opacity:.3/.5*i.opacity}),s=new C.Mesh(this.geometry,i),o=new C.Mesh(this.geometry,r);s.name="MeshFront",o.name="MeshBackground",s.renderOrder=1,o.renderOrder=0,this.meshFont=s,this.meshBackground=o,this.add(s),this.setOcclusionVisibility({occlusionVisibility:t==null?void 0:t.occlusionVisibility,occlusionMode:t==null?void 0:t.occlusionMode})}get style(){return{color:this.color,opacity:this.opacity,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode}}get color(){return this.meshFont.material.color}get opacity(){return this.meshFont.material.opacity}get occlusionVisibility(){return!!this.meshBackground.parent||this.meshFont.material.depthTest===!1}get occlusionMode(){return this.meshFont.material.depthTest===!1?"depthTest":"translucence"}set geometry(t){this._geometry=t,this.meshFont.geometry=t,this.meshBackground.geometry=t}get geometry(){return this._geometry}setStyle(t){this.paramsStyle=R(R({},this.paramsStyle),t),At(t.color)&&(this.meshFont.material.color.set(t.color),this.needsRender=!0),At(t.opacity)&&(this.meshFont.material.opacity=t.opacity,this.meshBackground.material.opacity=.3/.5*t.opacity,this.needsRender=!0),this.setOcclusionVisibility(t)}setOcclusionVisibility(t){var s,o,a;const i=(o=(s=t.occlusionMode)!=null?s:this.paramsStyle.occlusionMode)!=null?o:"translucence",r=(a=t.occlusionVisibility)!=null?a:this.paramsStyle.occlusionVisibility;At(r)&&(r?i==="depthTest"?(this.meshFont.material.depthTest=!1,this.remove(this.meshBackground)):i==="translucence"&&(this.meshFont.material.depthTest=!0,this.addIfNotExists(this.meshBackground)):(this.meshFont.material.depthTest=!0,this.remove(this.meshBackground)))}}const ov=new C.BufferGeometry;ov.name="blankGeometry";ov.isBlank=!0;class pd extends sv{constructor(t){super(t);v(this,"name","PolygonMesh");v(this,"points",[]);v(this,"planeHelperNeedUpdate",!0);v(this,"geometryInfoNeedUpdate",!0);v(this,"_paramsStyle");v(this,"planeHelper",null);v(this,"_geometryInfo",null);v(this,"opacityBeforeHighlight");v(this,"highlighted",!1);v(this,"lastRenderAreaItem");v(this,"areaDom");t!=null&&t.points&&this.setPoints(t.points),this._paramsStyle=t!=null?t:{},this.updateAreaItems()}get style(){return Ee(R({},super.style),{lengthEnable:this._paramsStyle.lengthEnable})}get isBlank(){return!!this.geometry.isBlank}get center(){var t;return(t=this.geometryInfo)==null?void 0:t.center}get geometryInfo(){return this.geometryInfoNeedUpdate&&(this.isBlank?this._geometryInfo=null:this._geometryInfo=Hx(this.geometry),this.geometryInfoNeedUpdate=!1),this._geometryInfo}get five(){var t,i;return(i=(t=window.globalModules)==null?void 0:t.five)!=null?i:window.$five}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.center){const i=qu(this,this.center).toArray().join(",");i!==this.lastRenderAreaItem&&(this.updateAreaItems(),this.lastRenderAreaItem=i)}}setStyle(t){this._paramsStyle=R(R({},this._paramsStyle),t),super.setStyle(this._paramsStyle),this.updateAreaItems()}setPoints(t){var r;const i=t.map(Ft);this.points=i,this.geometry=(r=Gx(this.points,{checkLinesIntersect:!0}))!=null?r:ov,this.planeHelperNeedUpdate=!0,this.geometryInfoNeedUpdate=!0,this.updateAreaItems()}projectPoint(t){return t&&(this.planeHelperNeedUpdate&&this.updatePlaneHelper(),this.planeHelper?this.planeHelper.projectPoint(t,new C.Vector3):t)}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.opacity,this.setStyle({opacity:this.opacity*ra}),this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.setStyle({opacity:this.opacityBeforeHighlight}),this.needsRender=!0)}updatePlaneHelper(){this.points.length>=3?this.planeHelper=new C.Plane().setFromCoplanarPoints(this.points[0],this.points[1],this.points[2]):this.planeHelper=null,this.planeHelperNeedUpdate=!1}updateAreaItems(){var r;const t=()=>{var s;(s=this.areaDom)==null||s.destroy(),this.areaDom=void 0};if(!this._paramsStyle.lengthEnable||!this.geometryInfo)return t();if(!this.five)return console.error("Five not found");this.areaDom=(r=this.areaDom)!=null?r:(()=>{const s=new xc(this.five);return s.intersectCheck=!1,s})(),this.areaDom.setPosition(this.center);const i=this.geometryInfo.area.toFixed(2);i==="0.00"?this.areaDom.container.innerHTML="":this.areaDom.container.innerHTML=Yw(i+"m²")}}class md extends pd{constructor(t){const s=t!=null?t:{},{points:i}=s,r=po(s,["points"]);super();v(this,"name","PolygonWithEdgeMesh");v(this,"line",new oo);i&&this.setPoints(i),r&&this.setStyle(r)}get style(){return Ee(R({},super.style),{lineWidth:this.lineWidth,lineColor:this.lineColor})}get lineWidth(){return this.line.lineWidth}get lineColor(){return this.line.lineColor}raycast(t,i){return this.children.forEach(r=>{Xg(r,t,i,!0)}),!1}setPoints(t,i={closed:!0}){super.setPoints(t),this.points&&(this.line.setPoints(this.points,i),this.addIfNotExists(this.line))}setStyle(t){super.setStyle(t),this.line.setStyle(t)}highlight(){super.highlight(),this.line.highlight()}unhighlight(){super.unhighlight(),this.line.unhighlight()}}class S1 extends md{constructor(){super(...arguments);v(this,"name","AreaMesh")}}class l6 extends iv{constructor(t){super(t);v(this,"onDrag",t=>{if(!this.draggingPoints||this.draggingPoints.length===0)return;const i=Fc(sn.modules.five,t.raycaster),r=this.originObject.areaMesh.projectPoint(i.point);this.draggingPoints.forEach(s=>s.position.copy(r)),this.originObject.areaMesh.setPoints(this.pointMeshes.map(s=>s.position))})}get points(){return this.originObject.areaMesh.points}}const I1=new C.Vector3;class T1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Polygon");v(this,"areaMesh");v(this,"creatingObject");this.editor=new l6(this),t&&(this.areaMesh=new S1(R(R({},t.style),t)),this.add(this.areaMesh))}get data(){return this.updateMatrixWorld(),Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.areaMesh.points)),style:{color:this.areaMesh.color.getHex(),lineColor:this.areaMesh.lineColor.getHex(),lineWidth:this.areaMesh.lineWidth}})}highlight(){var t;(t=this.areaMesh)==null||t.highlight()}unhighlight(){var t;(t=this.areaMesh)==null||t.unhighlight()}canUndo(){var t;(t=this.creatingObject)==null||t.canUndo()}canRedo(){var t;(t=this.creatingObject)==null||t.canRedo()}undo(){var t;(t=this.creatingObject)==null||t.undo()}redo(){var t;(t=this.creatingObject)==null||t.redo()}create(t){return ee(this,null,function*(){this.children.forEach(r=>{r.parent===this&&this.remove(r)}),this.children.length=0;const i=new S1(t);this.areaMesh=i,this.add(this.areaMesh),this.creatingObject=KM(this.areaMesh,this.pointSelector,t),yield this.creatingObject.finished,this.editor.enable()})}}function KM(e,n,t){var S;const{promise:i,resolve:r,reject:s}=rv(),o=e.parent;if(!o){s(new Error("No container"));return}const a=(S=t==null?void 0:t.limit)!=null?S:"none",l=new oo(Ee(R({},e.style),{opacity:1}));o==null||o.add(l);const c=new oo(Ee(R({},e.style),{dashed:!0,lengthEnable:!1}));o==null||o.add(c),n.enable();const h=[];let u,d,f=!1,m;const p=[],g=()=>h.length>0,y=()=>p.length>0,b=()=>{g()&&(p.push(h.pop()),x(m),n.pointSelectorHelper.magnifier.render())},A=()=>{y()&&(h.push(p.pop()),x(m),n.pointSelectorHelper.magnifier.render())},w=T=>{p.length=0;const z=h.length===0?T.point:u.clone();h.push(z),e.setPoints(h,{closed:!1}),f&&(M(),r())},x=T=>{const z=()=>{l.setPoints([]),c.setPoints([]),e.setPoints(h),n.pointSelectorHelper.magnifier.render()};if(!T||(m=T,!(h!=null&&h.length)))return z();const D=h.at(-1).clone();if(h.length<3&&(a==="none"?(u=T.point,l.setPoints([D,u]),c.setPoints([])):a==="xoz"?(d=d!=null?d:new C.Plane().setFromNormalAndCoplanarPoint(new C.Vector3(0,1,0),h[0]),n.plane=d,u=d.projectPoint(T.point,I1),l.setPoints([D,u]),c.setPoints([u,T.point])):a==="y"&&(h.length===1?(u=T.point,l.setPoints([D,u]),c.setPoints([])):(d=d!=null?d:new C.Plane().setFromCoplanarPoints(h[0],h[1],new C.Vector3(0,1,0).add(h[0])),n.plane=d,u=d.projectPoint(T.point,I1),l.setPoints([D,u]),c.setPoints([u,T.point])))),h.length>=3){u=e.projectPoint(T.point);const k=h[0],O=.2;k.distanceTo(u)<O||k.distanceTo(T.point)<O?(u=k,T.point.copy(k),n.pointSelectorHelper.updateWithIntersect(T,{emitEvent:!1}),f=!0):f=!1,l.setPoints([D,u]),c.setPoints([u,T.point])}h.length>=2?(e.setPoints([...h,u],{closed:!1}),e.line.setPoints(e.points.slice(0,-1)),e.isBlank?(n.cursorError=!0,l.setStyle({lineColor:16734553}),c.setStyle({lineColor:16734553})):(n.cursorError=!1,l.setStyle({lineColor:e.lineColor}),c.setStyle({lineColor:e.lineColor}))):e.setPoints([])},M=()=>{n.off("select",w),n.off("intersectionUpdate",x),n.off("disable",P),n.plane=null,n.disable(),o==null||o.remove(l,c)},P=()=>{M(),o==null||o.remove(e,c,l),s(new Error("Cancelled"))};return n.on("select",w),n.on("intersectionUpdate",x),n.on("disable",P),{finished:i,canUndo:g,canRedo:y,undo:b,redo:A}}class gd extends ei{constructor(t){super();v(this,"name","PrismMesh");v(this,"heightPoint");v(this,"bottomPolygon",new md);v(this,"topPolygon",new md);v(this,"paramStyle");v(this,"edgePlanes",new ei);this.topPolygon.name="TopPolygon",this.bottomPolygon.name="BottomPolygon",this.edgePlanes.name="EdgePlanes",this.addIfNotExists(this.bottomPolygon),t&&this.setPoints(t),t&&this.setStyle(t)}get center(){return this.localCenter}get localCenter(){var r,s;const t=(r=this.topPolygon)==null?void 0:r.center,i=(s=this.bottomPolygon)==null?void 0:s.center;if(t&&i)return new C.Vector3().lerpVectors(t,i,.5)}get worldCenter(){return this.updateMatrixWorld(),this.localToWorld(this.localCenter)}get color(){return this.bottomPolygon.color}get lineWidth(){return this.bottomPolygon.lineWidth}get lineColor(){return this.bottomPolygon.lineColor}setStyle(t){this.paramStyle=R(R({},this.paramStyle),t),this.bottomPolygon.setStyle(this.paramStyle),this.topPolygon.setStyle(this.paramStyle),this.edgePlanes.children.forEach(i=>{(i instanceof Ri||i instanceof pd)&&i.setStyle(this.paramStyle)})}setPoints(t){At(t.points)&&this.setBottomPoints(t.points),At(t.heightPoint)&&this.setTopHeightPoint(Ft(t.heightPoint))}highlight(){this.bottomPolygon.highlight(),this.topPolygon.highlight(),this.edgePlanes.children.forEach(t=>{typeof t.highlight=="function"&&t.highlight()})}unhighlight(){this.bottomPolygon.unhighlight(),this.topPolygon.unhighlight(),this.edgePlanes.children.forEach(t=>{typeof t.unhighlight=="function"&&t.unhighlight()})}setBottomPoints(t){this.bottomPolygon.setPoints(t.map(Ft)),this.heightPoint&&this.setTopHeightPoint(this.heightPoint)}setTopHeightPoint(t){this.heightPoint=t,this.addIfNotExists(this.topPolygon);const i=this.bottomPolygon.projectPoint(t),r=new C.Vector3().subVectors(t,i);this.up.copy(r.clone().normalize());const o=this.bottomPolygon.points.map(a=>a.clone().add(r));this.topPolygon.setPoints(o),this.setEdgePlanes()}raycast(t,i){return this.children.forEach(r=>{Xg(r,t,i,!0)}),!1}setEdgePlanes(){const t=this.bottomPolygon.points,i=this.topPolygon.points;this.addIfNotExists(this.edgePlanes),this.edgePlanes.removeChildren(),t.forEach((r,s)=>{if(s===0)return;const o=new pd({color:this.color});o.setPoints([t[s-1],t[s],i[s],i[s-1]]);const a=new Ri({lineColor:this.lineColor,lineWidth:this.lineWidth});a.name="EdgeLine",a.setPoints([t[s-1],i[s-1]]),this.edgePlanes.add(o,a)})}}class c6 extends Uc{constructor(n){super(n,()=>{const t=()=>{var o,a;const i=(o=n.prismMesh.topPolygon)==null?void 0:o.center,r=(a=n.prismMesh.bottomPolygon)==null?void 0:a.center,s=new C.Vector3().lerpVectors(i,r,.5);return{topCenter:i,bottomCenter:r,boxCenter:s}};return{positionFrom:()=>t().boxCenter.clone().applyMatrix4(n.matrixWorld),yAxis:n.prismMesh.up,scaleHelper:{enable:!0,positions:()=>{const i=t();return[{id:"top",handlePosition:i.topCenter,basePosition:i.bottomCenter},{id:"bottom",handlePosition:i.bottomCenter,basePosition:i.topCenter}]},scaleCallback:i=>{const{intersectPoint:r,scalePosition:s}=i,{id:o}=s,{prismMesh:a}=n;o==="top"?a.setPoints({heightPoint:r}):o==="bottom"&&a.setPoints({points:a.topPolygon.points.map(l=>l.clone().add(r.clone().sub(s.basePosition)))})}}}})}}class D1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Prism");v(this,"prismMesh");this.editor=new c6(this),t&&(this.prismMesh=new gd(R(R({},t.style),t)),this.add(this.prismMesh))}get data(){return Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.prismMesh.bottomPolygon.points)),heightPoint:yi(this.applyObjectMatrixWorld(this.prismMesh.heightPoint)),style:{color:this.prismMesh.color.getHex(),lineWidth:this.prismMesh.lineWidth,lineColor:this.prismMesh.lineColor.getHex()}})}highlight(){var t;(t=this.prismMesh)==null||t.highlight()}unhighlight(){var t;(t=this.prismMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.prismMesh=new gd(t),this.add(this.prismMesh),yield h6(this.prismMesh,this.pointSelector),this.editor.enable()})}}function h6(e,n){return ee(this,null,function*(){const t=e.parent;yield KM(e.bottomPolygon,n).finished;const i=new Ri;i.name="LineHelper",t.add(i);const r=e.bottomPolygon.points.at(-1),s=Nc(e.bottomPolygon.points).normalize(),o=r.clone().add(s.clone().multiplyScalar(10)),a=r.clone().sub(s.clone().multiplyScalar(10));return i.setPoints([o,a]),n.enable(),new Promise((l,c)=>{const h=m=>{d(),l()},u=m=>{if(!(m!=null&&m.raycaster))return;const p=so({raycaster:m.raycaster,line:new C.Line3(o,a)});p&&e.setPoints({heightPoint:p})},d=()=>{n.off("select",h),n.off("intersectionUpdate",u),n.off("disable",f),t.remove(i),n.disable()},f=()=>{d(),t.remove(e),c(new Error("Cancelled"))};n.on("select",h),n.on("intersectionUpdate",u),n.on("disable",f)})})}class u6 extends Uc{constructor(n){super(n,()=>({yAxis:n.rectangleMesh.up}))}}class d6 extends C.BufferGeometry{constructor(t){super();v(this,"name","RectangleGeometry");v(this,"points");if(t.length!==4){console.error("Invalid number of points, it's not a rectangle");return}this.points=t.slice(0,4),this.setAttribute("position",new C.BufferAttribute(new Float32Array(this.points.flatMap(i=>i.toArray())),3)),this.setIndex(new C.BufferAttribute(new Uint16Array([0,1,2,0,2,3]),1))}}function f6(e,n){const i=new C.Plane().setFromCoplanarPoints(e[0],e[1],e[2]).projectPoint(n,new C.Vector3);return new C.Vector3().subVectors(n,i).normalize()}class $M extends pd{constructor(t){super(t);v(this,"name","RectangleMesh")}get color(){return this.meshFont.material.color}get builtPoints(){var t,i;return(i=(t=this.meshFont)==null?void 0:t.geometry)==null?void 0:i.points.slice(0,3)}setPoints(t){const i=t.map(Ft).filter(At);if(i.length<3){console.error("Invalid position");return}if(t.length===3){const[r,s,o]=i,a=r.clone().add(o).sub(s);i.push(a)}this.up.copy(f6(i,sn.modules.five.camera.position)),this.points=i,this.geometry=new d6(i),this.planeHelperNeedUpdate=!0,this.geometryInfoNeedUpdate=!0}}class Fl extends $M{constructor(t){const s=t!=null?t:{},{points:i}=s,r=po(s,["points"]);super();v(this,"name","RectangleWithEdgeMesh");v(this,"line",new oo);i&&this.setPoints(i),r&&this.setStyle(r)}get style(){return R(R({},super.style),this.line.style)}get lineWidth(){return this.line.lineWidth}get lineColor(){return this.line.lineColor}setPoints(t){if(super.setPoints(t),this.points){const i=this.points;this.line.setPoints([i[0],i[1],i[2],i[3],i[0]]),this.addIfNotExists(this.line)}}setStyle(t){super.setStyle(t),this.line.setStyle(t)}highlight(){super.highlight(),this.line.highlight()}unhighlight(){super.unhighlight(),this.line.unhighlight()}}const iu=new C.Vector3;class L1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Rectangle");v(this,"rectangleMesh");this.config.canEdit&&(this.editor=new u6(this)),t&&(this.rectangleMesh=new Fl(R(R({},t.style),t)),this.add(this.rectangleMesh))}get data(){return Ee(R({},this.baseData),{points:this.rectangleMesh.builtPoints.map(t=>t.toArray()),style:{color:this.rectangleMesh.color.getHex(),lineWidth:this.rectangleMesh.lineWidth,lineColor:this.rectangleMesh.lineColor.getHex()}})}highlight(){var t;(t=this.rectangleMesh)==null||t.highlight()}unhighlight(){var t;(t=this.rectangleMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.removeChildren();const i=new Fl(t);this.rectangleMesh=i,this.add(this.rectangleMesh),yield eE(this.rectangleMesh,this.pointSelector,t)})}}function eE(e,n,t){return new Promise((i,r)=>{var A,w;const s=e.parent;if(!s)return r(new Error("No container"));const o=(A=t==null?void 0:t.limit)!=null?A:"none",a=(w=t==null?void 0:t.drawMethod)!=null?w:"diagonal",l=new Bl(Ee(R({},e.style),{dashed:!0,lengthEnable:!0})),c=new Bl(Ee(R({},e.style),{dashed:!0,lengthEnable:!1})),h=new Bl(Ee(R({},e.style),{dashed:!1,lengthEnable:!1}));s.add(l,h,c),n.enable();const u=[];let d=new C.Vector3,f=new C.Vector3;const m=new C.Plane,p=()=>{u.push(d.clone()),u.length===1?(o==="xoz"&&m.setFromNormalAndCoplanarPoint(new C.Vector3(0,1,0),u[0]),o==="none"&&m.setFromNormalAndCoplanarPoint(f,u[0])):u.length===2?o==="y"?(y(),i()):h.setPoints([u[0],u[1]]):u.length===3&&(y(),i())},g=x=>{var P;if(!(x!=null&&x.raycaster))return;const M=(P=u.at(-1))==null?void 0:P.clone();if(u.length===0){d=x.point.clone(),f=x.face.normal;return}if(u.length===1&&o==="y"){const T=new C.Line3(new C.Vector3(0,1,0).add(u[0]),new C.Vector3(0,-1,0).add(u[0])).closestPointToPoint(x.point,!1,new C.Vector3);e.setPoints([u[0],T,x.point]);return}if(u.length===1){m?(d=x.raycaster.ray.intersectPlane(m,iu),c.setPoints([d,x.point])):d=x.point.clone(),l.setPoints([M,d]);return}if(u.length===2){s.remove(l);const S=x.raycaster.ray.intersectPlane(m,iu);if(a==="diagonal"){const T=u[0].distanceTo(u[1])/2,z=new C.Vector3().lerpVectors(u[0],u[1],.5),D=new C.Vector3().subVectors(S,z).normalize();d=new C.Vector3().addVectors(z,D.multiplyScalar(T)),e.setPoints([u[0],d,u[1]])}else if(a==="vertex"){const T=iu.crossVectors(u[0].clone().sub(u[1]),m.normal).normalize();d=new C.Line3(u[1].clone().add(T),u[1].clone().sub(T)).closestPointToPoint(x.point,!1,iu),e.setPoints([u[0],u[1],d])}return}},y=()=>{n.off("select",p),n.off("intersectionUpdate",g),n.off("disable",b),n.disable(),s==null||s.remove(l,h,c)},b=()=>{y(),s==null||s.remove(e),r(new Error("Cancelled"))};n.on("select",p),n.on("intersectionUpdate",g),n.on("disable",b)})}class p6 extends Uc{constructor(n){super(n,()=>({yAxis:n.circleMesh.normal}))}}function tE(e){return Math.max(32,Math.min(128,Math.floor(e*40)))}class m6 extends sv{constructor(t){super(t);v(this,"_normal");v(this,"opacityBeforeHighlight");v(this,"highlighted",!1);t!=null&&t.center&&(t!=null&&t.normal)&&(t!=null&&t.radius)&&this.setPoints(t)}get center(){return this.position.clone()}get normal(){return this._normal}set normal(t){this._normal=t}get radius(){return this.meshFont.geometry.parameters.radius}setPoints(t){const i=Ft(t.center),r=Ft(t.normal),s=t.radius,o=tE(s);this.geometry=new C.CircleGeometry(s,o),this.position.copy(i),this.lookAt(r.clone().add(i)),this.normal=r.clone().normalize(),this.needsRender=!0}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.opacity,this.setStyle({opacity:this.opacity*ra}),this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.setStyle({opacity:this.opacityBeforeHighlight}),this.needsRender=!0)}}class vd extends m6{constructor(t){const a=t!=null?t:{},{normal:i,radius:r,center:s}=a,o=po(a,["normal","radius","center"]);super(o);v(this,"edgeLine");this.edgeLine=new Ri(o),this.add(this.edgeLine),i&&r&&s&&this.setPoints({normal:i,radius:r,center:s})}setPoints(...t){super.setPoints(...t);const i=this.meshFont.geometry.vertices.slice(1);this.edgeLine.setPoints(i.concat(i[0]))}setStyle(t){super.setStyle(t),this.edgeLine.setStyle(t)}highlight(){super.highlight(),this.edgeLine.highlight()}unhighlight(){super.unhighlight(),this.edgeLine.unhighlight()}}class k1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Circle");v(this,"circleMesh");this.editor=new p6(this),t&&(this.circleMesh=new vd(R(R({},t.style),t)),this.add(this.circleMesh))}get data(){return Ee(R({},this.baseData),{center:yi(this.applyObjectMatrixWorld(this.circleMesh.center)),normal:yi(this.applyObjectQuaternion(this.circleMesh.normal)),radius:this.circleMesh.radius,style:{color:this.circleMesh.color.getHex()}})}highlight(){var t;(t=this.circleMesh)==null||t.highlight()}unhighlight(){var t;(t=this.circleMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.children.forEach(r=>{r.parent===this&&this.remove(r)}),this.children.length=0;const i=new vd(t);this.circleMesh=i,this.add(this.circleMesh),yield nE(this.circleMesh,this.pointSelector),this.editor.enable()})}}function nE(e,n){return new Promise((t,i)=>{const r=e.parent;if(!r){i(new Error("No container"));return}const s=new oo({dashed:!0});r.add(s),n.enable();let o,a;const l=d=>{if(d){if(!o){o={point:d.point,normal:d.face.normal};return}o&&a&&(h(),t())}},c=d=>{if(!d||!o)return;const f=new C.Plane().setFromNormalAndCoplanarPoint(o.normal,o.point);if(a=d.raycaster.ray.intersectPlane(f,new C.Vector3),a){const m=o.point.distanceTo(a);e.setPoints({center:o.point,normal:o.normal,radius:m})}},h=()=>{n.off("select",l),n.off("intersectionUpdate",c),n.off("disable",u),n.disable(),r==null||r.remove(s)},u=()=>{h(),r==null||r.remove(e,s),i(new Error("Cancelled"))};n.on("select",l),n.on("intersectionUpdate",c),n.on("disable",u)})}class R1 extends ei{constructor(t){super();v(this,"bottomCircle");v(this,"topCircle");v(this,"edgeMesh");v(this,"opacityBeforeHighlight");v(this,"highlighted",!1);v(this,"params");this.params=t,this.bottomCircle=new vd(t),this.bottomCircle.name="bottomCircle",this.topCircle=new vd(t),this.topCircle.name="topCircle",this.edgeMesh=new sv(t),t!=null&&t.bottomCenter&&(t!=null&&t.topCenter)&&(t!=null&&t.radius)&&this.setPoints(t),this.addIfNotExists(this.bottomCircle)}get bottomCenter(){return this.bottomCircle.center}get topCenter(){return this.topCircle.center}get normal(){return this.bottomCircle.normal}get radius(){return this.bottomCircle.radius}get color(){return this.bottomCircle.color}setPoints(t){const i=Ft(t.topCenter),r=Ft(t.bottomCenter),s=i.clone().sub(r).normalize();this.bottomCircle.setPoints({center:r,normal:s,radius:t.radius}),this.setTopCenter(i),this.needsRender=!0}setTopCenter(t){this.addIfNotExists(this.topCircle),this.topCircle.setPoints({center:t,normal:this.normal,radius:this.radius}),this.setEdgeMesh()}setBottomCenter(t){this.addIfNotExists(this.bottomCircle),this.bottomCircle.setPoints({center:t,normal:this.normal,radius:this.radius}),this.setEdgeMesh()}setStyle(t){this.params=R(R({},this.params),t),At(t.color)&&this.bottomCircle.setStyle({color:t.color}),At(t.color)&&this.topCircle.setStyle({color:t.color})}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.edgeMesh.opacity,this.edgeMesh.setStyle({opacity:this.edgeMesh.opacity*ra}),this.bottomCircle.highlight(),this.topCircle.highlight(),this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.edgeMesh.setStyle({opacity:this.opacityBeforeHighlight}),this.bottomCircle.unhighlight(),this.topCircle.unhighlight(),this.needsRender=!0)}setEdgeMesh(){this.addIfNotExists(this.edgeMesh);const t=this.topCircle.center,i=this.bottomCircle.center;this.edgeMesh.geometry.dispose(),this.edgeMesh.geometry=new C.CylinderGeometry(this.radius,this.radius,t.distanceTo(i),tE(this.radius),1,!0);const r=new C.Quaternion().setFromUnitVectors(new C.Vector3(0,1,0),this.normal.clone().normalize());this.edgeMesh.position.copy(new C.Vector3().lerpVectors(i,t,.5)),this.edgeMesh.quaternion.copy(r)}}class g6 extends Uc{constructor(n){super(n,()=>{const t=()=>{const i=n.cylinderMesh.topCenter,r=n.cylinderMesh.bottomCenter,s=new C.Vector3().lerpVectors(i,r,.5);return{topCenter:i,bottomCenter:r,boxCenter:s}};return{positionFrom:"boundingBox",yAxis:n.cylinderMesh.normal,scaleHelper:{enable:!0,positions:()=>{const i=t();return[{id:"top",handlePosition:i.topCenter,basePosition:i.bottomCenter},{id:"bottom",handlePosition:i.bottomCenter,basePosition:i.topCenter}]},scaleCallback:i=>{const{intersectPoint:r,scalePosition:s}=i,{id:o}=s,{cylinderMesh:a}=n;o==="top"?a.setTopCenter(r):o==="bottom"&&a.setBottomCenter(r)}}}})}}class O1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Cylinder");v(this,"cylinderMesh");this.editor=new g6(this),t&&(this.cylinderMesh=new R1(R(R({},t.style),t)),this.add(this.cylinderMesh))}get data(){return Ee(R({},this.baseData),{bottomCenter:yi(this.applyObjectMatrixWorld(this.cylinderMesh.bottomCenter)),topCenter:yi(this.applyObjectMatrixWorld(this.cylinderMesh.topCenter)),radius:this.cylinderMesh.radius,style:{color:this.cylinderMesh.color.getHex()}})}highlight(){var t;(t=this.cylinderMesh)==null||t.highlight()}unhighlight(){var t;(t=this.cylinderMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.cylinderMesh=new R1(t),this.add(this.cylinderMesh),yield v6(this.cylinderMesh,this.pointSelector),this.editor.enable()})}}function v6(e,n){return ee(this,null,function*(){const t=e.parent;yield nE(e.bottomCircle,n);const i=new Ri;i.name="LineHelper",t.add(i);const r=n.position.point,s=e.normal.clone().normalize(),o=r.clone().add(s.clone().multiplyScalar(10)),a=r.clone().sub(s.clone().multiplyScalar(10));return i.setPoints([o,a]),n.enable(),new Promise((l,c)=>{const h=m=>{d(),l()},u=m=>{if(!(m!=null&&m.raycaster))return;const p=so({raycaster:m.raycaster,line:new C.Line3(o,a)}),y=new C.Plane().setFromNormalAndCoplanarPoint(e.normal,e.bottomCenter).projectPoint(p,new C.Vector3),b=p.clone().sub(y),A=e.bottomCenter.clone().add(b);p&&e.setTopCenter(A)},d=()=>{n.off("select",h),n.off("intersectionUpdate",u),n.off("disable",f),t.remove(i),n.disable()},f=()=>{d(),t.remove(e),c(new Error("Cancelled"))};n.on("select",h),n.on("intersectionUpdate",u),n.on("disable",f)})})}class y6 extends Uc{constructor(n){super(n,()=>{const t=()=>{var o,a;const i=(o=n.boxMesh.topPlane)==null?void 0:o.center,r=(a=n.boxMesh.bottomPlane)==null?void 0:a.center,s=new C.Vector3().lerpVectors(i,r,.5);return{topCenter:i,bottomCenter:r,boxCenter:s}};return{positionFrom:"boundingBox",yAxis:n.boxMesh.bottomPlane.up,scaleHelper:{enable:!0,positions:()=>{const i=t();return[{id:"top",handlePosition:i.topCenter,basePosition:i.bottomCenter},{id:"bottom",handlePosition:i.bottomCenter,basePosition:i.topCenter}]},scaleCallback:i=>{const{intersectPoint:r,scalePosition:s}=i,{id:o}=s,{boxMesh:a}=n;o==="top"?a.setTopHeightPoint(r):o==="bottom"&&a.setPoints({points:a.topPlane.points.map(l=>l.clone().add(r.clone().sub(s.basePosition)))})}}}})}}class z1 extends ei{constructor(t){super();v(this,"name","BoxMesh");v(this,"bottomPlane");v(this,"topPlane");v(this,"heightPoint");v(this,"edgePlanes",[]);this.bottomPlane=new Fl(t),this.topPlane=new Fl(t),this.add(this.bottomPlane),t!=null&&t.points&&this.setPoints(t)}get planes(){return this.children.filter(t=>t instanceof $M)}get color(){var t;return(t=this.bottomPlane)==null?void 0:t.color}get lineColor(){var t;return(t=this.bottomPlane)==null?void 0:t.lineColor}get lineWidth(){var t;return(t=this.bottomPlane)==null?void 0:t.lineWidth}get occlusionVisibility(){var t;return(t=this.bottomPlane)==null?void 0:t.occlusionVisibility}get occlusionMode(){var t;return(t=this.bottomPlane)==null?void 0:t.occlusionMode}setPoints(t){At(t.heightPoint)&&this.setTopHeightPoint(t.heightPoint),At(t.points)&&this.setBottomPoints(t.points)}setBottomPoints(t){const i=t.map(Ft).filter(At);if(i.length<3){console.error("Invalid position");return}this.bottomPlane.setPoints(i),this.heightPoint&&this.setTopHeightPoint(this.heightPoint)}setTopHeightPoint(t){if(!this.bottomPlane.points.length)return;const i=Ft(t);this.heightPoint=i,this.addIfNotExists(this.topPlane);const r=this.bottomPlane.projectPoint(i),s=i.clone().sub(r),o=this.bottomPlane.points.map(a=>a.clone().add(s));this.topPlane.setPoints(o),this.up.copy(s.clone().normalize()),this.setEdgePlanes()}setEdgePlanes(){for(let t=0;t<4;t++){let i=this.edgePlanes[t];i||(this.edgePlanes[t]=new Fl({color:this.color,lineColor:this.lineColor,lineWidth:this.lineWidth,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode}),i=this.edgePlanes[t]);const r=this.topPlane.points,s=this.bottomPlane.points,o=t===3?0:t+1;i.setPoints([r[t],s[t],s[o]]),i.line.setPoints([r[t],s[t]]),this.addIfNotExists(i)}}setStyle(t){this.planes.forEach(i=>i.setStyle(t))}highlight(){this.planes.forEach(t=>t.highlight())}unhighlight(){this.planes.forEach(t=>t.unhighlight())}}class B1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Box");v(this,"boxMesh");this.editor=new y6(this),t&&(this.boxMesh=new z1(R(R({},t.style),t)),this.add(this.boxMesh))}get data(){return Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.boxMesh.bottomPlane.points)),heightPoint:yi(this.applyObjectMatrixWorld(this.boxMesh.heightPoint)),style:{color:this.boxMesh.color.getHex(),lineWidth:this.boxMesh.lineWidth,lineColor:this.boxMesh.lineColor.getHex()}})}highlight(){var t;(t=this.boxMesh)==null||t.highlight()}unhighlight(){var t;(t=this.boxMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.removeChildren(),this.boxMesh=new z1(t),this.add(this.boxMesh),yield b6(this.boxMesh,this.pointSelector),this.editor.enable()})}}function b6(e,n){return ee(this,null,function*(){return yield eE(e.bottomPlane,n),new Promise((t,i)=>{const r=e.parent;if(!r){i(new Error("No container"));return}const s=new Ri,o=Nc(e.bottomPlane.points).normalize(),a=e.bottomPlane.builtPoints.at(-1),l=a.clone().add(o.clone().multiplyScalar(10)),c=a.clone().sub(o.clone().multiplyScalar(10));s.setPoints([l,c]),r.add(s),n.enable();const h=m=>{d(),t()},u=m=>{if(!(m!=null&&m.raycaster))return;const p=so({raycaster:m.raycaster,line:new C.Line3(l,c)});p&&e.setPoints({heightPoint:p})},d=()=>{n.off("select",h),n.off("intersectionUpdate",u),n.off("disable",f),n.disable(),r==null||r.remove(s)},f=()=>{d(),r==null||r.remove(e),i(new Error("Cancelled"))};n.on("select",h),n.on("intersectionUpdate",u),n.on("disable",f)})})}function A6(e,n){for(let t=e.length-1;t>=0;t--)n(e[t])}const N1=new C.Vector3;class F1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Line");v(this,"lineMesh");v(this,"creatingObject");t&&(this.lineMesh=new Um(R(R({},t.style),t)),this.add(this.lineMesh)),this.editor=new i6(this)}get data(){return Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.lineMesh.points)),style:{lineColor:new C.Color(this.lineMesh.color).getHex(),lineWidth:this.lineMesh.lineWidth,dashed:this.lineMesh.dashed}})}highlight(){var t;(t=this.lineMesh)==null||t.highlight()}unhighlight(){var t;(t=this.lineMesh)==null||t.unhighlight()}canUndo(){var t;(t=this.creatingObject)==null||t.canUndo()}canRedo(){var t;(t=this.creatingObject)==null||t.canRedo()}undo(){var t;(t=this.creatingObject)==null||t.undo()}redo(){var t;(t=this.creatingObject)==null||t.redo()}create(t){return ee(this,null,function*(){this.removeChildren();const i=new Um(t);this.lineMesh=i,this.add(this.lineMesh),this.creatingObject=w6(i,this.pointSelector,t),yield this.creatingObject.finished,this.editor.enable()})}}function w6(e,n,t){var P;const i=e.parent;if(!i)return;const{promise:r,resolve:s,reject:o}=rv(),a=(P=t==null?void 0:t.limit)!=null?P:"none",l=new Ri(e.style);i.add(l);const c=new Ri(Ee(R({},e.style),{dashed:!0,lengthEnable:!1}));i.add(c),n.enable();const h=[];let u,d,f;const m=[],p=()=>h.length>0,g=()=>m.length>0,y=()=>{p()&&(m.push(h.pop()),e.setPoints(h),w(f),n.pointSelectorHelper.magnifier.render())},b=()=>{g()&&(h.push(m.pop()),e.setPoints(h),w(f),n.pointSelectorHelper.magnifier.render())},A=S=>{m.length=0;const T=h.length===0?S.point:u.clone();h.push(T),e.setPoints(h),h.length===2&&(x(),s())},w=S=>{const T=()=>{l.setPoints([]),c.setPoints([]),n.pointSelectorHelper.magnifier.render()};if(!(h!=null&&h.length)||!S)return T();f=S;const z=h.at(-1).clone();a==="none"?(u=S.point,l.setPoints([z,u])):a==="xoz"?(n.plane=d,d=d!=null?d:new C.Plane().setFromNormalAndCoplanarPoint(new C.Vector3(0,1,0),h[0]),u=d.projectPoint(S.point,N1),l.setPoints([z,u]),c.setPoints([u,S.point])):a==="y"&&(S.isVirtual?(u=so({raycaster:S.raycaster,line:new C.Line3(h[0].clone(),new C.Vector3(0,1,0).add(h[0])),clampToLine:!1}),c.setPoints([])):(u=new C.Line3(h[0].clone(),new C.Vector3(0,1,0).add(h[0])).closestPointToPoint(S.point,!1,N1),c.setPoints([u,S.point])),l.setPoints([z,u]))},x=()=>{n.off("select",A),n.off("intersectionUpdate",w),n.off("disable",M),n.plane=null,n.disable(),i==null||i.remove(l,c)},M=()=>{x(),h.length!==2&&(i==null||i.remove(e)),o(new Error("Cancelled"))};return n.on("select",A),n.on("intersectionUpdate",w),n.on("disable",M),{finished:r,canUndo:p,canRedo:g,undo:y,redo:b}}const Jo=class extends Cn{constructor(t,i){super();v(this,"group");v(this,"theme");v(this,"five");v(this,"creatingItem",null);v(this,"undo",()=>{var t;console.log("undo"),(t=this.creatingItem)==null||t.undo(),this.five.needsRender=!0});v(this,"redo",()=>{var t;console.log("redo"),(t=this.creatingItem)==null||t.redo(),this.five.needsRender=!0});this.five=t,this.theme=i,this.group=new ei,this.group.name="Sculpt",t.scene.add(this.group),Jo.modules.init(t),ri("ctrl+z",this.undo),ri("ctrl+shift+z",this.redo),Jo.modules.fiveDomEvents.addEventListener(this.group,"click",({intersects:r,origDomEvent:s})=>{var a;const o=WM((a=r==null?void 0:r[0])==null?void 0:a.object,l=>l.isSculptObject);return o?this.emit("click",s,o):!1}),window.__SCULPT_DEBUG__=this,window.__SCULPT_MODULES_DEBUG__=Jo.modules}get data(){return{items:this.items.map(t=>{try{return t.data}catch(i){return console.error(i),null}}).filter(At)}}get items(){return this.group.children}load(t,i){var s;this.clear();const r=(s=t==null?void 0:t.items)==null?void 0:s.map(o=>{var l;const a=Ee(R({},o),{style:R(R({},(l=this.theme)==null?void 0:l[o.type.toLowerCase()]),o.style)});return o.type==="Point"?new _1(a,i):o.type==="line"?new F1(a,i):o.type==="Polyline"?new P1(a,i):o.type==="Polygon"?new T1(a,i):o.type==="Prism"?new D1(a,i):o.type==="Rectangle"?new L1(a,i):o.type==="Circle"?new k1(a,i):o.type==="Cylinder"?new O1(a,i):o.type==="Box"?new B1(a,i):null});this.group.add(...r),this.five.needsRender=!0}getItemById(t){return this.items.find(i=>i.uuid===t)}putObject(t){var s;this.group.add(t);const i=Jo.modules.object3DHelper,r=i.addObject3DHelper(t);return(s=r==null?void 0:r.moveController)==null||s.moveByMouse(),i}createPoint(t){return ee(this,null,function*(){var i;return this.createItem(_1,R(R({},(i=this.theme)==null?void 0:i.point),t))})}createline(t){return ee(this,null,function*(){var i;return this.createItem(F1,R(R({},(i=this.theme)==null?void 0:i.line),t))})}createPolyline(t){return ee(this,null,function*(){var i;return this.createItem(P1,R(R({},(i=this.theme)==null?void 0:i.polyline),t))})}createPolygon(t){return ee(this,null,function*(){var i;return this.createItem(T1,R(R({},(i=this.theme)==null?void 0:i.polygon),t))})}createPrism(t){return ee(this,null,function*(){var i;return this.createItem(D1,R(R({},(i=this.theme)==null?void 0:i.prism),t))})}createRectangle(t){return ee(this,null,function*(){var i;return this.createItem(L1,R(R({},(i=this.theme)==null?void 0:i.rectangle),t))})}createCircle(t){return ee(this,null,function*(){var i;return this.createItem(k1,R(R({},(i=this.theme)==null?void 0:i.circle),t))})}createCylinder(t){return ee(this,null,function*(){var i;return this.createItem(O1,R(R({},(i=this.theme)==null?void 0:i.cylinder),t))})}createBox(t){return ee(this,null,function*(){var i;return this.createItem(B1,R(R({},(i=this.theme)==null?void 0:i.box),t))})}canUndo(){var t;return this.creatingItem?(t=this.creatingItem)==null?void 0:t.canUndo():!1}canRedo(){var t;return this.creatingItem?(t=this.creatingItem)==null?void 0:t.canRedo():!1}clear(){A6(this.items,t=>t.delete()),this.five.needsRender=!0}createItem(t,...i){return ee(this,null,function*(){this.creatingItem&&(this.creatingItem.stopCreating(),this.creatingItem=null);const r=new t;return this.creatingItem=r,this.group.add(r),yield r.create(...i).then((...s)=>(this.creatingItem=null,s)).catch(s=>{console.error(s),this.group.remove(r)}),r})}};let sn=Jo;v(sn,"modules",UM);const x6=e=>new sn(e);function M6(e,...n){n.forEach(t=>{e.children.includes(t)||t&&e.add(t)})}let ru;const iE=e=>((!ru||e!==ru.five)&&(ru={instance:new Zg(e,{noEmitWhenHide:!0,noEmitWhenNotInScene:!0}),five:e}),ru.instance);class rE extends Cn{constructor(t){var r,s;super();v(this,"type");v(this,"tag");v(this,"rawData");v(this,"model");v(this,"five");v(this,"group");v(this,"fiveDomEvents");this.five=t.five,this.model=t.model,this.group=t.group,this.type=t.type,this.rawData=t.rawData,this.fiveDomEvents=iE(this.five);const i=(s=(r=t.position)!=null?r:this.model.center)!=null?s:Ga(this.model).getCenter(new C.Vector3);this.tag=j3(this.five,i,{wrapper:t.tagWrapper})}get container(){return this.tag.container}get state(){return{visible:this.model.visible,enabled:this.group.children.includes(this.model)}}show(){this.tag.show(),this.model.visible=!0,this.five.needsRender=!0,this.emit("show")}hide(){this.tag.hide(),this.model.visible=!1,this.five.needsRender=!0,this.emit("hide")}enable(){M6(this.group,this.model),this.five.needsRender=!0,this.model.updateMatrixWorld(!0),this.tag.setTransformMatrix(this.model.matrixWorld),this.tag.enable();const t=this.onClick.bind(this);this.fiveDomEvents.addEventListener(this.model,"click",t),this.emit("enable")}disable(){this.group.remove(this.model),this.five.needsRender=!0,this.tag.disable(),this.fiveDomEvents.removeEventListener(this.model,"click"),this.emit("disable")}onClick(){return this.emit("click",this)}}class sE extends rE{constructor(...t){super(...t);v(this,"hideTag",()=>{this.tag.hide()});this.enable(),this.tag.hide()}enable(){super.enable(),this.five.on("mode.change.request",this.hideTag),this.five.on("pano.request",this.hideTag)}disable(){super.disable(),this.five.off("mode.change.request",this.hideTag),this.five.off("pano.request",this.hideTag)}show(){this.model.visible=!0,this.five.needsRender=!0}onClick(){return this.tag.visible?this.tag.hide():this.tag.show(),super.onClick(),!0}}class E6 extends sE{constructor(...n){super(...n)}}function C6(e){Ue(e,"svelte-1q9fx3x",".model-maker-tag.svelte-1q9fx3x{position:absolute;width:-moz-max-content;width:max-content;left:50%;top:50%;transform:translate(-50%, -50%);color:#fff;font-size:0.875rem;font-weight:bold;text-shadow:0.125rem 0 0.5rem rgba(0, 0, 0, 0.15)}")}function V1(e){let n,t;return{c(){n=H("div"),t=xt(e[0]),_(n,"class","model-maker-tag svelte-1q9fx3x")},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r&1&&Ct(t,i[0])},d(i){i&&Y(n)}}}function P6(e){let n,t=e[0]&&V1(e);return{c(){t&&t.c(),n=ft()},m(i,r){t&&t.m(i,r),Z(i,n,r)},p(i,[r]){i[0]?t?t.p(i,r):(t=V1(i),t.c(),t.m(n.parentNode,n)):t&&(t.d(1),t=null)},i:de,o:de,d(i){t&&t.d(i),i&&Y(n)}}}function _6(e,n,t){let{text:i}=n;return e.$$set=r=>{"text"in r&&t(0,i=r.text)},[i]}class S6 extends ke{constructor(n){super(),Le(this,n,_6,P6,De,{text:0},C6)}}const G1=(e,n)=>{var i;const t=new S6({target:e,props:{text:(i=n.rawData)==null?void 0:i.name}});return()=>t.$destroy()},I6=(e,n)=>{var i;const t=new HM({target:e,props:{content:(i=n.rawData)==null?void 0:i.name}});return()=>t.$destroy()},T6={box:G1,triangles:G1,prism:I6};class D6 extends rE{constructor(...n){const t=n[0],i=Ga(t.model),r=new C.Vector3().lerpVectors(Cr(i,0),Cr(i,5),.5);super(Ee(R({},t),{position:r})),this.enable()}}class L6 extends Br{constructor(t,i){var r,s;super(t);v(this,"state");v(this,"items",[]);v(this,"group",new C.Group);v(this,"data");v(this,"tagRendererMap",{});v(this,"fiveDomEvents");v(this,"zFightingOffset",0);v(this,"tagWrapper");v(this,"occlusionVisibility");v(this,"occlusionMode");v(this,"onFiveModeChange",t=>{const i=this.occlusionVisibility;Array.isArray(i)&&this.items.forEach(r=>{r.model.setStyle instanceof Function&&r.model.setStyle({occlusionVisibility:i.includes(t)})})});v(this,"handleEnable",()=>{var t,i;this.five.scene.add(this.group),(i=(t=this.five.getElement())==null?void 0:t.parentElement)==null||i.appendChild(this.tagWrapper),this.five.needsRender=!0,this.onFiveModeChange(this.five.getCurrentState().mode),this.five.on("modeChange",this.onFiveModeChange)});v(this,"handleDisable",()=>{this.five.scene.remove(this.group),this.tagWrapper.remove(),this.five.needsRender=!0,this.five.off("modeChange",this.onFiveModeChange)});v(this,"updateTagRenderer",()=>{this.items.forEach(t=>{var r;const i=(r=this.tagRendererMap[t.type])!=null?r:T6[t.type];i&&t.__renderer!==i&&(t.__renderer=i,typeof t.__disposeRenderer=="function"&&t.__disposeRenderer(),t.tag.container.innerHTML="",t.__disposeRenderer=i(t.tag.container,t))})});this.group.name="ModelMakerPluginGroup",this.state={enabled:!0,visible:!0},this.occlusionVisibility=(r=i==null?void 0:i.occlusionVisibility)!=null?r:!1,this.occlusionMode=(s=i==null?void 0:i.occlusionMode)!=null?s:"translucence",this.fiveDomEvents=iE(t),this.tagWrapper=(()=>{var a;const o=document.createElement("div");return o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.pointerEvents="none",o.style.zIndex=`${(a=i==null?void 0:i.tagContainerZIndex)!=null?a:""}`,o})(),t.scene.add(this.group),this.handleEnable(),window.__MODELMAKER_DEBUG__=this}load(t){return ee(this,null,function*(){var o;if(this.clear(),this.data=t,yield Ha(this.five),this.data!==t)return;this.clear();const i=typeof this.occlusionVisibility=="boolean"?this.occlusionVisibility:!1,r=this.occlusionMode,s=1.6;(o=t==null?void 0:t.list)==null||o.forEach(a=>{var l,c,h;if(a.type==="triangles"){const u=new md;u.setPoints(a.object_data.points),u.setStyle({color:a.object_data.color,opacity:((l=a.object_data.opacity)!=null?l:.4)/2,lineColor:a.object_data.color,lineWidth:s,occlusionVisibility:i,occlusionMode:r}),this.fiveDomEvents.addEventListener(u,"hover",()=>u.highlight()),this.fiveDomEvents.addEventListener(u,"unHover",()=>u.unhighlight());const d=new sE({five:this.five,tagWrapper:this.tagWrapper,model:u,group:this.group,type:a.type,rawData:a});this.items.push(d)}else if(a.type==="prism"){const u=new gd;this.zFightingOffset+=1e-4;const d=a.object_data.points.map(g=>{var y;return[g[0],g[1]+((y=a.object_data.fixedY)!=null?y:0),g[2]]});d.push(d[0]);const f=a.object_data.height+((c=a.object_data.fixedHeight)!=null?c:0)+this.zFightingOffset,m=Ft(d[0]).add(new C.Vector3().setY(f));u.setPoints({points:d,heightPoint:m}),u.setStyle({color:a.object_data.color,opacity:((h=a.object_data.opacity)!=null?h:.4)/2,lineColor:a.object_data.color,lineWidth:s,occlusionVisibility:i,occlusionMode:r});const p=new D6({five:this.five,tagWrapper:this.tagWrapper,model:u,group:this.group,type:a.type,rawData:a});this.items.push(p)}else if(a.type==="box"){const u=new gd,{start:d,end:f,rotation:m=[0,0,0,0],opacity:p,color:g}=a.object_data,y=new C.Vector3().fromArray(d),b=new C.Vector3().fromArray(f),A=new C.Euler().fromArray(m),w=new C.Quaternion().setFromEuler(A),x=w.clone().inverse(),M=new C.Vector3().lerpVectors(y,b,.5),P=M.clone().negate(),S=y.clone().add(P).applyQuaternion(x),T=b.clone().add(P).applyQuaternion(x),z=new C.Box3(S.clone().max(T),S.clone().min(T));u.setPoints({points:[Cr(z,2),Cr(z,3),Cr(z,7),Cr(z,6),Cr(z,2)],heightPoint:Cr(z,0)}),u.position.copy(M),u.quaternion.copy(w),u.setStyle({color:g,opacity:(p!=null?p:.4)/2,lineColor:g,lineWidth:s,occlusionVisibility:i,occlusionMode:r});const D=new E6({five:this.five,tagWrapper:this.tagWrapper,model:u,group:this.group,type:a.type,rawData:a});this.items.push(D)}}),this.five.needsRender=!0,this.state.enabled?this.handleEnable():this.handleDisable(),this.state.visible?this.handleShow():this.handleHide(),this.updateTagRenderer(),this.hooks.emit("dataLoaded",t)})}setState(t){At(t.enabled)&&this.state.enabled!==t.enabled&&(this.state.enabled=t.enabled,t.enabled?this.handleEnable():this.handleDisable(),this.hooks.emit(t.enabled?"enable":"disable",{userAction:"我不知道捏"}),this.hooks.emit("stateChange",{state:this.state,userAction:"我不知道捏"})),At(t.visible)&&this.state.visible!==t.visible&&(this.state.visible=t.visible,t.visible?this.handleShow():this.handleHide(),this.hooks.emit(t.visible?"show":"hide",{userAction:"我不知道捏"}),this.hooks.emit("stateChange",{state:this.state,userAction:"我不知道捏"}))}getItemById(t){return this.items.find(i=>i.rawData.id===t)}registerTagRenderer(t){this.tagRendererMap=R(R({},this.tagRendererMap),t),this.updateTagRenderer()}hasCustomTagRenderer(t){return!!this.tagRendererMap[t]}enable(){this.setState({enabled:!0})}disable(){this.setState({enabled:!1})}show(){this.setState({visible:!0})}hide(){this.setState({visible:!1})}clear(){this.zFightingOffset=0,this.handleDisable(),this.group.children.length=0,this.five.needsRender=!0,this.items=[],this.tagWrapper.innerHTML="",this.fiveDomEvents.clear()}dispose(){this.hooks.emit("dispose"),this.clear()}onWorkCodeChange(){this.group.matrix.copy(this.workUtil.transform.clone()),this.group.matrix.decompose(this.group.position,this.group.quaternion,this.group.scale),this.group.updateMatrixWorld()}handleShow(){this.group.visible=!0,this.tagWrapper.style.visibility="visible",this.five.needsRender=!0}handleHide(){this.group.visible=!1,this.tagWrapper.style.visibility="hidden",this.five.needsRender=!0}}const k6=(...e)=>new L6(...e);fE();dE();exports.AreaMakerPlugin=N8;exports.CSS3DRender=Ia;exports.CSS3DRenderPlugin=Bc;exports.CameraMovementEffect=Lx;exports.CameraMovementPlugin=Qk;exports.ContentType=kM;exports.CruisePlugin=xV;exports.CruisePluginController=Vc;exports.CruisePluginTypes=wV;exports.CurrentPanoImagePlugin=V8;exports.DIRECTION=Yo;exports.DISPLAY_STRATEGY_TYPE=Bs;exports.DimensionType=RM;exports.FLOOR_PLAN_ATTACHED_TO=ss;exports.FLOOR_TYPE_MAP=zk;exports.GuideLineItem=yV;exports.GuideLineModeItem=uV;exports.GuideLinePlugin=qg;exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE=Ns;exports.ItemLabelPlugin=H4;exports.Magnifier=Ad;exports.MapviewFloorplanPlugin=uk;exports.ModelChassisCompassPlugin=Fk;exports.ModelEntryDoorGuidePlugin=jk;exports.ModelFloorplanPlugin=ak;exports.ModelItemLabelPlugin=w4;exports.ModelMakerPlugin=k6;exports.ModelRoomLabelPlugin=vD;exports.ModelTVVideoPlugin=P4;exports.ModelViewPlugin=IE;exports.MoveController=Jg;exports.MovePlugin=MV;exports.Object3DHelperController=ev;exports.Object3DHelperPlugin=o8;exports.PLUGIN=Gd;exports.PaintBrush=SE;exports.PaintBrushTypeEnum=wr;exports.PanoCompassPlugin=p5;exports.PanoCursorRaycasterPlugin=_T;exports.PanoDoorLabelPlugin=nO;exports.PanoFloorplanRadarPlugin=Rk;exports.PanoMeasurePlugin=XR;exports.PanoMeasurePluginLine=to;exports.PanoMeasurePluginModel=Rg;exports.PanoMeasurePluginPoint=ii;exports.PanoMeasurePluginPolyline=no;exports.PanoRulerPlugin=Kk;exports.PanoRulerProPlugin=c5;exports.PanoSpatialTagPlugin=c4;exports.PanoTagPlugin=nV;exports.PanoTagPluginController=fd;exports.PanoVideoPlugin=d8;exports.PanoVideoPluginType=u8;exports.PipelinePlugin=I8;exports.PointType=LM;exports.ROOM_FETILE_TYPE_MAP=Ok;exports.ROOM_TYPE_MAP=Bk;exports.Rotation=Yi;exports.Sculpt=sn;exports.SculptPlugin=x6;exports.TopviewFloorplanPlugin=fk;exports.Util=mT;exports.WalkController=Vc;exports.defaultGlobalConfig=DM;exports.itemLabelPluginServerParams=U4;exports.modelItemLabelPluginServerParams=x4;exports.modelRoomLabelPluginServerParams=yD;exports.pluginFlag=tV;
3761
+ `;class C8 extends Zo{constructor(t){super(t,E8);v(this,"initialDisplacement",0);v(this,"oldTime",new Date().getTime());v(this,"flowSpeed",.6);v(this,"rotateSpeed",0);v(this,"flowAnimationDisposer",()=>{})}setInitialDisplacement(t,i="backward"){this.initialDisplacement=Math.abs(t)*(i==="forward"?-1:1),this.moveFromOrigin(this.initialDisplacement)}moveFromOrigin(t){const i=t*this.uPreMeter;return this.material.uniforms.uOffset.value=i,this.material.needsUpdate=!0,this.needsRender=!0,!0}moveForwardFromInitialOffset(t){const i=t*-1,r=this.initialDisplacement+i;this.moveFromOrigin(r)}flow(){this.flowAnimationDisposer(),this.oldTime=new Date().getTime();let t=0,i=0;const r=ja(()=>{const s=new Date().getTime(),o=s-this.oldTime,a=this.flowSpeed*(o/1e3),l=this.rotateSpeed*(o/1e3);t=t+a,i=i+l;const c=1/360,h=i*c;this.material.uniforms.vOffset.value=h,this.moveForwardFromInitialOffset(t),this.oldTime=s});this.flowAnimationDisposer=function(){r(),this.moveForwardFromInitialOffset(0)}}stopFlow(){this.flowAnimationDisposer()}setSpeed(t){typeof(t==null?void 0:t.flowSpeed)=="number"&&(this.flowSpeed=t.flowSpeed),typeof(t==null?void 0:t.rotateSpeed)=="number"&&(this.rotateSpeed=t.rotateSpeed)}disposeAnime(){super.disposeAnime(),this.flowAnimationDisposer()}}const y1={flowSpeed:.6,rotateSpeed:0};let P8=class extends Br{constructor(t){super(t);v(this,"data");v(this,"state");v(this,"group");v(this,"pipeObjects",[]);v(this,"texturePromiseCache",new Map);v(this,"dispose",()=>{this.disable(),this.five.scene.remove(this.group),this.texturePromiseCache.forEach(t=>t.then(i=>i.dispose())),this.texturePromiseCache.clear()});v(this,"onWantsFiveTapGesture",(...t)=>{const[i]=t,r=i.intersectObjects(this.pipeObjects,!1);if(r.length===0||!this.data)return;const a=r[0].object.customID,l=this.data.pipes.find(({id:h})=>h===a),c=this.data.pipelines.find(h=>l&&h.pipes.includes(l));if(!(!l||!c))return this.hooks.emit("tap",{intersectObjects:r,pipe:l,pipeline:c,wantsFiveTapGestureParams:t}),!1});this.state={target:null,visible:!0,enabled:!0,isFlowing:!1,speed:y1},this.five=t,this.group=new C.Group,this.group.name="water-pipe-group",this.five.scene.add(this.group),this.five.once("dispose",this.dispose),this.five.on("wantsTapGesture",this.onWantsFiveTapGesture)}load(t,i,r,s){return ee(this,null,function*(){const o=this.data;this.data=yield this.formatData(t,s),this.removeAllPipes(),this.hooks.emit("dataChange",this.data,o),this.pipeObjects=yield Promise.all(this.data.pipes.filter(a=>!!(a!=null&&a.texture)).map(u=>ee(this,[u],function*({id:a,texture:l,path:c,radius:h}){const d=yield this.loadPipeTexture(l),f={id:a,path:c,textureURL:l,texture:d,geometryConfig:{radius:h}};return new C8(f)}))),this.data.pipelines.forEach(a=>{a.pipes.reduce((l,c)=>{const h=this.findPipeObjectWithID(c.id);return h==null||h.setInitialDisplacement(l),l+((h==null?void 0:h.pathLength)||0)},0)}),this.hooks.emit("dataLoaded",this.data),this.state.visible===!1&&this.pipeObjects.forEach(a=>a.setOpacity(0)),this.state.enabled&&(this.group.add(...this.pipeObjects),this.five.needsRender=!0),i&&this.setState(i,{userAction:r})})}setState(t,i={}){const r=this.state;if(Nn(t,r,{deep:!0}))return;const s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s,anime:{duration:500}};t.visible?this._show(o):this._hide(o)}if(t.isFlowing!==void 0&&r.isFlowing!==t.isFlowing&&(t.isFlowing?this._flow():this._stopFlow()),t.speed!==void 0&&!Nn(r.speed,this.state.speed,{deep:!0})&&this._setSpeed(t.speed),t.target!==void 0&&!Nn(r.target,this.state.target,{deep:!0})){const o={target:t.target,showAnime:{duration:500},hideAnime:{duration:500}};this._switchPipelines(o)}}enable(t={}){var r;if(this.state.enabled)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!0},i),this._enable({userAction:i})}disable(t={}){var r;if(this.state.enabled===!1)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!1,isFlowing:!1},i),this._disable({userAction:i})}show(){return ee(this,arguments,function*(t={}){if(this.state.visible)return;const i=R({userAction:!0,anime:{duration:500}},t);this.updateState({visible:!0},i.userAction),yield this._show(i)})}hide(){return ee(this,arguments,function*(t={}){if(this.state.visible===!1)return;const i=R({userAction:!0,anime:{duration:500}},t);this.updateState({visible:!1},i.userAction),yield this._hide(i)})}switchPipelines(t){return ee(this,null,function*(){var c,h,u,d,f,m;if(!this.data)return;const i=(c=t==null?void 0:t.target)!=null?c:null,r=(h=t==null?void 0:t.userAction)!=null?h:!0;this.updateState({target:i},r);const s={duration:500},o=(d=(u=t==null?void 0:t.hideAnime)!=null?u:t==null?void 0:t.anime)!=null?d:s,a=(m=(f=t==null?void 0:t.showAnime)!=null?f:t==null?void 0:t.anime)!=null?m:s,l={target:i,showAnime:a,hideAnime:o};this._switchPipelines(l)})}flow(t={}){var r;if(this.state.isFlowing)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({isFlowing:!0},i),this._flow()}stopFlow(t={}){var r;if(this.state.isFlowing===!1)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({isFlowing:!1},i),this._stopFlow()}setSpeed(t){var s,o;const i=(s=t==null?void 0:t.speed)!=null?s:y1,r=(o=t.userAction)!=null?o:!0;this.updateState({speed:i},r),this._setSpeed(i)}formatData(t,i){return ee(this,null,function*(){return f8(t,i)})}_enable(t){this.hooks.emit("enable",{userAction:t.userAction}),this.five.scene.add(this.group),this.five.needsRender=!0,this.five.on("wantsTapGesture",this.onWantsFiveTapGesture)}_disable(t){this.hooks.emit("disable",{userAction:t.userAction}),this.disposeAnime(),this.five.scene.remove(this.group),this.five.needsRender=!0,this.five.off("wantsTapGesture",this.onWantsFiveTapGesture)}_show(t){return ee(this,null,function*(){var s;this.hooks.emit("show",{userAction:t.userAction});const i=(s=t==null?void 0:t.anime)!=null?s:{duration:500},r=this.findPipeObjectWithTarget(this.state.target);yield Promise.all(r.map(o=>o==null?void 0:o.show(i))),this.five.needsRender=!0})}_hide(t){return ee(this,null,function*(){var r;this.hooks.emit("hide",{userAction:t.userAction});const i=(r=t==null?void 0:t.anime)!=null?r:{duration:500};yield Promise.all(this.pipeObjects.map(s=>s.hide(i))),this.five.needsRender=!0})}_switchPipelines(t){return ee(this,null,function*(){if(!this.data)return;const i=this.findPipeObjectWithTarget(t.target),r=t.hideAnime;yield Promise.all(this.pipeObjects.map(o=>o.hide(r)));const s=t.showAnime;yield Promise.all(i.map(o=>o.show(s)))})}_flow(){this.pipeObjects.forEach(t=>t.flow())}_stopFlow(){this.pipeObjects.forEach(t=>t.stopFlow())}_setSpeed(t){this.pipeObjects.forEach(i=>i.setSpeed(t))}updateState(t,i){const r=this.state;this.state=R(R({},this.state),t),this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}loadPipeTexture(t){return ee(this,null,function*(){const i=this.texturePromiseCache.get(t);if(i)return i;const r=Us(t);return this.texturePromiseCache.set(t,r),r})}disposeAnime(){this.pipeObjects.forEach(t=>t.disposeAnime()),this.five.needsRender=!0}removeAllPipes(){this.disposeAnime(),this.group.remove(...this.pipeObjects),this.pipeObjects.forEach(t=>t.dispose()),this.pipeObjects=[],this.five.needsRender=!0}findPipeObjectWithID(t){return this.pipeObjects.find(({customID:i})=>i===t)}findPipeObjectWithTarget(t){return t?u8({data:this.data,target:t}).map(({id:r})=>this.findPipeObjectWithID(r)).filter(At):this.pipeObjects}};const _8=e=>new P8(e),S8="data:image/png;base64,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";function I8(e){Ue(e,"svelte-1s88cj8",".room-label-item.svelte-1s88cj8{position:absolute;font-size:0.5rem;transform:none;cursor:pointer;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;color:#fff}.room-label-item__text.svelte-1s88cj8{position:absolute;left:0;top:-4rem;transform:translate(-50%, 0);display:flex;justify-content:center;align-items:center;height:1.25rem;min-width:2rem;padding:0 0.375rem;pointer-events:all;background-size:100% 100%;background-repeat:no-repeat;white-space:nowrap}.room-label-item__bar.svelte-1s88cj8{position:absolute;top:-2.75rem;height:3rem;width:0.0625rem;background-image:linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0))}.wide.svelte-1s88cj8{font-size:0.625rem}")}function b1(e){let n,t,i,r,s,o;return{c(){n=H("span"),t=xt(e[0]),i=ve(),r=H("div"),_(n,"class","room-label-item__text svelte-1s88cj8"),W(n,"background-image","url("+S8+")"),Ce(n,"wide",e[0].length>3),_(r,"class","room-label-item__bar svelte-1s88cj8")},m(a,l){Z(a,n,l),Q(n,t),Z(a,i,l),Z(a,r,l),s||(o=ot(n,"click",function(){hr(e[4])&&e[4].apply(this,arguments)}),s=!0)},p(a,l){e=a,l&1&&Ct(t,e[0]),l&1&&Ce(n,"wide",e[0].length>3)},d(a){a&&Y(n),a&&Y(i),a&&Y(r),s=!1,o()}}}function T8(e){let n,t=!e[5]&&b1(e);return{c(){n=H("div"),t&&t.c(),_(n,"class","room-label-item svelte-1s88cj8"),W(n,"z-index",e[2]),W(n,"transform",e[3]),W(n,"opacity",e[1]),W(n,"visibility",e[7])},m(i,r){Z(i,n,r),t&&t.m(n,null),e[10](n)},p(i,[r]){i[5]?t&&(t.d(1),t=null):t?t.p(i,r):(t=b1(i),t.c(),t.m(n,null)),r&4&&W(n,"z-index",i[2]),r&8&&W(n,"transform",i[3]),r&2&&W(n,"opacity",i[1]),r&128&&W(n,"visibility",i[7])},i:de,o:de,d(i){i&&Y(n),t&&t.d(),e[10](null)}}}function D8(e,n,t){let i,{content:r}=n,{visible:s=!0}=n,{opacity:o=1}=n,{zIndex:a=0}=n,{transform:l=void 0}=n,{onClick:c=()=>{}}=n,{rendererIfNeed:h=void 0}=n,{rendererData:u=void 0}=n,d,f;Yn(()=>{d&&typeof h=="function"&&(f=h(d,u))}),bi(()=>{f==null||f()});function m(p){Qt[p?"unshift":"push"](()=>{d=p,t(6,d)})}return e.$$set=p=>{"content"in p&&t(0,r=p.content),"visible"in p&&t(8,s=p.visible),"opacity"in p&&t(1,o=p.opacity),"zIndex"in p&&t(2,a=p.zIndex),"transform"in p&&t(3,l=p.transform),"onClick"in p&&t(4,c=p.onClick),"rendererIfNeed"in p&&t(5,h=p.rendererIfNeed),"rendererData"in p&&t(9,u=p.rendererData)},e.$$.update=()=>{e.$$.dirty&256&&t(7,i=s?"visible":"hidden")},[r,o,a,l,c,h,d,i,s,u,m]}class HM extends ke{constructor(n){super(),Le(this,n,D8,T8,De,{content:0,visible:8,opacity:1,zIndex:2,transform:3,onClick:4,rendererIfNeed:5,rendererData:9},I8)}}class L8 extends Zw{constructor(t){super();v(this,"areaMakerItem");this.areaMakerItem=t}raycast(t,i){this.areaMakerItem.makerObject.raycast(t,i)}}class k8{constructor(n,t){v(this,"id");v(this,"name","");v(this,"makerObject");v(this,"outline");v(this,"bottomY");v(this,"opacity");v(this,"height");v(this,"floorIndex");v(this,"shape");v(this,"mounted",!1);v(this,"checkMsg",{checkVisibleMsg:"",checkTagVisibleMsg:""});v(this,"modelGroup");v(this,"visible",!0);v(this,"tagApp");v(this,"tagVisible",null);v(this,"tagPosition",new C.Vector3);v(this,"tagNDCPosition",new C.Vector3);v(this,"tagTransform",{left:0,top:0});v(this,"tagZIndex",0);v(this,"hooks",new Cn);v(this,"itemRenderer");v(this,"data");v(this,"plugin");v(this,"opacityAnime");v(this,"isInContainerResizeAnimation",!1);v(this,"containerResizeTimeoutID",null);v(this,"resizeObserver");v(this,"doOpacityAnime",n=>{var a;(a=this.opacityAnime)==null||a.dispose();const t=n.duration,[i,r]=n.makerObjectOpacity,[s,o]=n.outlineOpacity;if(t===0){this.makerObject.material.opacity=r,this.outline.material.opacity=o;return}return new Promise(l=>{this.opacityAnime=new Pa({makerObjectOpacity:i,outlineOpacity:s}).to({makerObjectOpacity:r,outlineOpacity:o}).onUpdate(({makerObjectOpacity:c,outlineOpacity:h})=>{this.makerObject.material.opacity=c,this.outline.material.opacity=h,this.plugin.five.needsRender=!0}).onComplete(()=>l(!0)).onDispose(()=>{this.makerObject.material.opacity=r,this.outline.material.opacity=o,this.plugin.five.needsRender=!0,l(!1)}).play()})});v(this,"onPluginConfigChange",n=>{this.makerObject.material.depthTest=n.config.modelDepthTest,this.outline.material.depthTest=n.config.modelDepthTest,this.plugin.five.needsRender=!0});v(this,"onPluginStateChange",()=>{this.updateVisible(),this.updateTagVisible()});v(this,"updateVisible",()=>{var r;const{result:n,msg:t}=this.checkVisible();if(this.checkMsg.checkVisibleMsg=t,this.visible===n)return;this.visible=n;const i=(r=this.data.object_data.visible)!=null?r:!0;this.modelGroup.visible=n&&i,this.plugin.five.needsRender=!0});v(this,"checkVisible",()=>{if(!this.plugin.state.visible)return{result:!1,msg:"插件不可见"};const t=this.plugin.fiveUtil.model.shownFloor;return t===null||t===this.floorIndex?{result:!0,msg:""}:{result:!1,msg:`模型高亮楼层不符合展示条件, 当前高亮楼层为:${t}`}});v(this,"updateTag",()=>{this.tagApp&&(this.updateTagNDCPosition(),this.updateTagDomTransform(),this.updateTagVisible())});v(this,"updateTagNDCPosition",()=>{const t=this.tagPosition.clone().project(this.plugin.five.camera);this.tagNDCPosition.copy(t)});v(this,"updateTagDomTransform",()=>{var r;const n=this.tagNDCPosition,t=Math.round((n.x+1)/2*this.plugin.tagDomContainer.clientWidth),i=Math.round((-n.y+1)/2*this.plugin.tagDomContainer.clientHeight);this.tagTransform.left===t&&this.tagTransform.top===i||(this.tagTransform={left:t,top:i},(r=this.tagApp)==null||r.$set({transform:`translate(${t}px, ${i}px)`}))});v(this,"updateTagVisible",()=>{var i;const{result:n,msg:t}=this.checkTagVisible();this.checkMsg.checkTagVisibleMsg=t,this.tagVisible!==n&&(this.tagVisible=n,this.tagApp&&(this.tagVisible?this.hooks.emit("tagShow"):this.hooks.emit("tagHide"),(i=this.tagApp)==null||i.$set({visible:n})))});v(this,"checkTagVisible",()=>{if(!this.visible)return{result:!1,msg:"标注整体不可见"};if(this.isInContainerResizeAnimation)return{result:!1,msg:"处于容器 resize 动画中"};const t=this.plugin.five,i=t.camera.position.clone();rs.set(i.clone(),this.tagPosition.clone().sub(i).normalize());const[r]=this.plugin.fiveUtil.model.intersectRaycaster(rs),s=this.tagPosition.distanceTo(t.camera.position);if(r&&r.distance+.1<s)return{result:!1,msg:"标注标签被 Five 模型遮挡"};const o=this.tagNDCPosition;return Math.abs(o.x)>1.2||Math.abs(o.y)>1.2||Math.abs(o.z)>1?{result:!1,msg:"标注标签不在屏幕内"}:{result:!0,msg:""}});v(this,"onFiveCameraUpdate",()=>{this.tagApp&&this.visible&&(this.updateTagNDCPosition(),this.updateTagDomTransform(),this.updateTagVisible())});v(this,"onContainerResize",()=>{this.isInContainerResizeAnimation===!1&&(this.isInContainerResizeAnimation=!0,this.updateTag());const t=()=>{this.isInContainerResizeAnimation=!1,this.containerResizeTimeoutID=null,this.updateTag()};this.containerResizeTimeoutID&&clearTimeout(this.containerResizeTimeoutID),this.containerResizeTimeoutID=setTimeout(t,100)});var l,c,h,u;const i=t.object_data,r=i.bottom_y,s=i.height,o=new C.Color((l=i.color)!=null?l:"#FFFFFF"),a=(c=i.opacity)!=null?c:.4;this.data=t,this.id=t.id,this.name=(h=t.name)!=null?h:"",this.plugin=n,this.height=s,this.bottomY=r,this.opacity=a,this.shape=new C.Shape().fromJSON(i.shape),this.floorIndex=t.floor_index,this.makerObject=new C.Mesh(A1(this.shape,s),R8(o,a)),Ap(this.makerObject,r),this.makerObject.material.depthTest=this.plugin.config.modelDepthTest,this.outline=new Jw(new C.EdgesGeometry(this.makerObject.geometry),new C.LineBasicMaterial({color:o,transparent:!0})),Ap(this.outline,r),this.outline.material.depthTest=this.plugin.config.modelDepthTest,this.setHeight(s),this.modelGroup=new L8(this),this.modelGroup.visible=(u=i.visible)!=null?u:!0}mount(){if(this.mounted)return;this.mounted=!0,this.updateVisible(),this.makerObject.material.depthTest=this.plugin.config.modelDepthTest,this.outline.material.depthTest=this.plugin.config.modelDepthTest,this.modelGroup.add(this.makerObject,this.outline);const n=!!this.name,t=this.plugin.tagDomContainer;n&&(this.tagApp=new HM({target:t,props:{rendererData:this.data,content:this.name,visible:this.tagVisible,rendererIfNeed:this.itemRenderer,transform:`translate(${this.tagTransform.left}px, ${this.tagTransform.top}px)`,onClick:i=>this.hooks.emit("tagClick",{target:this,nativeEvent:i})}}),this.updateTag()),this.plugin.five.needsRender=!0,this.plugin.hooks.on("stateChange",this.onPluginStateChange),this.plugin.hooks.on("configChange",this.onPluginConfigChange),this.plugin.five.on("modeChange",this.updateVisible),this.plugin.five.on("modelShownFloorChange",this.updateVisible),this.plugin.five.on("cameraUpdate",this.onFiveCameraUpdate),this.resizeObserver=Bm(this.onContainerResize,t),this.resizeObserver.observe()}unmount(){var n,t;this.mounted&&(this.mounted=!1,this.modelGroup.remove(...this.modelGroup.children),(n=this.tagApp)==null||n.$destroy(),this.tagApp=null,this.plugin.hooks.off("stateChange",this.onPluginStateChange),this.plugin.hooks.off("configChange",this.onPluginConfigChange),this.plugin.five.off("modeChange",this.updateVisible),this.plugin.five.off("modelShownFloorChange",this.updateVisible),this.plugin.five.off("cameraUpdate",this.onFiveCameraUpdate),(t=this.resizeObserver)==null||t.unobserve())}setOpacity(n){var t;this.opacity=n,(t=this.opacityAnime)==null||t.dispose(),this.makerObject.material.opacity=n,this.plugin.five.needsRender=!0}setColor(n){const t=new C.Color(n);this.makerObject.material.color=t,this.outline.material.color=t,this.plugin.five.needsRender=!0}setHeight(n){if(n<=0)throw new Error("高度必须大于 0");this.height=n,this.makerObject.geometry=A1(this.shape,n),this.outline.geometry=new C.EdgesGeometry(this.makerObject.geometry);const t=this.shape.extractPoints(10).shape.slice(0,-1),i=Yk(t),r=new C.Vector3(i.x,i.y,n);Ap(r,this.bottomY),this.tagPosition.copy(r),this.updateTag(),this.plugin.five.needsRender=!0}setTagZIndex(n){var t;this.tagZIndex!==n&&((t=this.tagApp)==null||t.$set({zIndex:n}))}}function A1(e,n){return new C.ExtrudeBufferGeometry(e,{depth:n,bevelEnabled:!1})}function R8(e,n){return new C.MeshBasicMaterial({color:e,opacity:n,transparent:!0})}function Ap(e,n){const t=new C.Matrix4,i=new C.Matrix4().makeRotationX(Math.PI/2),r=new C.Matrix4().makeTranslation(0,0,-n),s=new C.Matrix4().makeScale(1,1,-1);t.multiply(i),t.multiply(r),t.multiply(s),e.applyMatrix4(t)}let O8=class extends Br{constructor(t,i){super(t);v(this,"state");v(this,"itemMap");v(this,"itemRenderer");v(this,"modelGroup");v(this,"data");v(this,"tagDomContainer");v(this,"checkMsg",{childrenMountedState:""});v(this,"isInFiveChangeModeAnime",!1);v(this,"childrenMountedState",!1);v(this,"_config");v(this,"_disposed",!1);v(this,"dispose",()=>{this.five.scene.remove(this.modelGroup)});v(this,"onFiveInitAnimationWillStart",()=>{this.isInFiveChangeModeAnime=!0,this.updateChildrenMountedState()});v(this,"onFiveInitAnimationEnded",()=>{this.isInFiveChangeModeAnime=!1,this.updateChildrenMountedState()});v(this,"onFiveCameraUpdate",()=>{const t=this.five.camera;[...this.itemMap.values()].sort((r,s)=>{const o=r.tagPosition.distanceTo(t.position);return s.tagPosition.distanceTo(t.position)-o}).forEach((r,s)=>{var o;(o=this.getMaskItemByID(r.id))==null||o.setTagZIndex(s*10)})});v(this,"onFiveModeChange",()=>{this.updateChildrenMountedState()});v(this,"onMakerTagClick",t=>{this.hooks.emit("wantsTap",{target:t.target,intersectObjects:[]})});v(this,"onWantsFiveTapGesture",t=>{const i=Array.from(this.itemMap.values()).filter(l=>l.mounted&&l.visible).map(l=>({makerItem:l,intersects:l.modelGroup.getRaycastIntersects(t)})).filter(({intersects:l})=>l.length>0);if(i.length===0)return;const r=i.reduce((l,c)=>{const h=l.intersects[0].distance,u=c.intersects[0].distance;return h<u?l:c}),s=this.fiveUtil.model.intersectRaycaster(t)[0];if(this.config.modelDepthTest&&s&&s.distance<r.intersects[0].distance)return;if(this.hooks.emit("wantsTap",{target:r.makerItem,intersectObjects:r.intersects}))return!1});this.five=t,this.tagDomContainer=document.createElement("div"),this.tagDomContainer.style.position="absolute",this.tagDomContainer.style.top="0",this.tagDomContainer.style.left="0",this.tagDomContainer.style.width="100%",this.tagDomContainer.style.height="100%",this.tagDomContainer.style.pointerEvents="none";const r={enabled:!0,visible:!0};this.state=Object.assign(r,i==null?void 0:i.initialState);const s=R({modelDepthTest:!0},i==null?void 0:i.config);this._config=s,this.modelGroup=new C.Group,this.modelGroup.name="ModelMakerPluginGroup",this.itemMap=new Map,this.state.enabled&&this._enable({userAction:!1})}get config(){return R({},this._config)}get disposed(){return this._disposed}load(t){return ee(this,null,function*(){const i=this.data;this.data=this.formatData(t),this.hooks.emit("dataChange",this.data,i),this.modelGroup.remove(...this.modelGroup.children),this.itemMap.forEach(r=>r.unmount()),this.itemMap.clear(),this.childrenMountedState=!1,this.checkMsg.childrenMountedState="",this.data.list.forEach(r=>{const s=new k8(this,r);s.itemRenderer=this.itemRenderer,this.modelGroup.add(s.modelGroup),this.itemMap.set(r.id,s),s.hooks.on("tagClick",this.onMakerTagClick)}),this.updateChildrenMountedState()})}appendTo(t){t.appendChild(this.tagDomContainer)}enable(t={}){var r;if(this.state.enabled)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!0},i),this._enable({userAction:i})}disable(t={}){var r;if(this.state.enabled===!1)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!1},i),this._disable({userAction:i})}show(t){return ee(this,null,function*(){if(this.state.visible)return Promise.resolve();if(this.disposed)return Promise.reject(new Error("不能在已销毁的插件上调用 show"));const i=R({userAction:!0},t);this.updateState({visible:!0},i.userAction),yield this._show(i)})}hide(t){return ee(this,null,function*(){if(this.state.visible===!1)return;const i=R({userAction:!0},t);this.updateState({visible:!1},i.userAction),yield this._hide(i)})}setState(t,i={}){const r=this.state;if(Nn(t,r,{deep:!0}))return;const s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s,anime:{duration:500}};t.visible?this._show(o):this._hide(o)}}updateConfig(t,i={}){var o;const r=this.config,s=R(R({},r),t);this._config=s,this.hooks.emit("configChange",{prevConfig:r,config:s,userAction:(o=i.userAction)!=null?o:!0})}getMaskItemByID(t){return this.itemMap.get(t)}formatData(t){function i(r){return r.list.length===0?!0:!("shape"in r.list[0].object_data)}return i(t)?{list:t.list.filter(r=>r.object_data.points.length>=3).map(r=>{const s=new C.Shape,o=r.object_data.points[0];return s.moveTo(o[0],o[2]),r.object_data.points.slice(1).forEach(l=>s.lineTo(l[0],l[2])),s.lineTo(o[0],o[2]),Ee(R({},r),{floor_index:r.object_data.floorIndex,object_data:Ee(R({},r.object_data),{bottom_y:o[1]+r.object_data.fixedY,shape:s.toJSON(),height:r.object_data.height+r.object_data.fixedHeight})})})}:t}checkChildrenMountedState(){const t=this.state,i=this.five;if(!t.enabled)return{result:!1,msg:"插件不可用"};const r=i.getCurrentState().mode;return r==="Panorama"?{result:!1,msg:`Five 模态不符合条件, 当前模态为:${r}`}:this.isInFiveChangeModeAnime?{result:!1,msg:"切换模态动画中不展示"}:{result:!0,msg:""}}updateChildrenMountedState(){const{result:t,msg:i}=this.checkChildrenMountedState();this.checkMsg.childrenMountedState=i,t!==this.childrenMountedState&&(this.childrenMountedState=t,this.itemMap.forEach(r=>{this.childrenMountedState?r.mount():r.unmount()}))}updateState(t,i){const r=this.state;this.state=R(R({},this.state),t),this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}_enable(t){this.hooks.emit("enable",{userAction:t.userAction}),this.five.scene.add(this.modelGroup),this.updateChildrenMountedState(),this.five.needsRender=!0,this.five.on("wantsTapGesture",this.onWantsFiveTapGesture),this.five.on("initAnimationWillStart",this.onFiveInitAnimationWillStart),this.five.on("initAnimationEnded",this.onFiveInitAnimationEnded),this.five.on("modeChange",this.onFiveModeChange),this.five.on("cameraUpdate",this.onFiveCameraUpdate)}_disable(t){this.hooks.emit("disable",{userAction:t.userAction}),this.five.scene.remove(this.modelGroup),this.updateChildrenMountedState(),this.five.needsRender=!0,this.five.off("wantsTapGesture",this.onWantsFiveTapGesture),this.five.off("initAnimationWillStart",this.onFiveInitAnimationWillStart),this.five.off("initAnimationEnded",this.onFiveInitAnimationEnded),this.five.off("modeChange",this.onFiveModeChange),this.five.off("cameraUpdate",this.onFiveCameraUpdate)}_show(t){return ee(this,null,function*(){this.hooks.emit("show",t),this.five.needsRender=!0})}_hide(t){return ee(this,null,function*(){this.hooks.emit("hide",t),this.five.needsRender=!0})}};const z8=(e,n)=>new O8(e,n);class B8 extends ws{constructor(t,i){super(t);v(this,"state");v(this,"checkMsg",{meshHidden:"",pluginDisabled:"",pluginHidden:""});v(this,"group",new C.Group);v(this,"mesh");v(this,"textureLoadingPromise");v(this,"opacityAnimeTween");v(this,"isInPanoMoveAnime",!1);v(this,"lastArrivedPanoIndex",-1);v(this,"_config");v(this,"_disposed",!1);v(this,"dispose",()=>{this.five.scene.remove(this.group),this.group.remove(...this.group.children),this.five.off("dispose",this.dispose),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive)});v(this,"checkMeshVisible",()=>this.state.visible?this.config.imageURL===""?{result:!1,msg:"图片不存在"}:this.mesh.material.map?this.five.work?this.five.getCurrentState().mode!=="Panorama"?{result:!1,msg:"非全景模式"}:this.isInPanoMoveAnime?{result:!1,msg:"处于走点动画中"}:{result:!0,msg:""}:{result:!1,msg:"Five 数据未加载"}:{result:!1,msg:"指南针贴图未加载"}:{result:!1,msg:"插件隐藏"});v(this,"onTextureLoaded",t=>{this.mesh.material.map=t,this.mesh.material.needsUpdate=!0,this.updateMeshVisible()});v(this,"onFiveWillLoad",()=>{this.lastArrivedPanoIndex=-1,this.updateMeshVisible()});v(this,"onFivePanoWillArrive",t=>{var i;t!==this.five.getCurrentState().panoIndex&&(this.isInPanoMoveAnime=!0,(i=this.opacityAnimeTween)==null||i.dispose(),this.updateMeshVisible())});v(this,"onFivePanoArrived",t=>{t!==this.lastArrivedPanoIndex&&(this.lastArrivedPanoIndex=t,this.isInPanoMoveAnime=!1,this.updateMeshPosition(t),this.updateMeshVisible(),this.five.needsRender=!0)});v(this,"onMeshVisibleChange",t=>{var i;if((i=this.opacityAnimeTween)==null||i.dispose(),!t){this.mesh.visible=!1;return}this.mesh.material.setValues({opacity:0}),this.mesh.visible=!0,this.opacityAnimeTween=Mc(1e3).onUpdate(({progress:r})=>{var s;(s=this.mesh)==null||s.material.setValues({opacity:r}),this.five.needsRender=!0}).play()});v(this,"onFiveModeChange",()=>{this.updateMeshVisible()});this.five=t;const r={enabled:!0,visible:!0};this.state=Object.assign(r,i==null?void 0:i.initialState);const s=R({width:1.4,yOffset:.01,yRotate:0,imageURL:this.absoluteUrl("/release/web/logo.7febb17f.png")},i==null?void 0:i.config);this._config=s,this.group.name="current-pano-image-plugin-group",this.mesh=new C.Mesh(new C.PlaneBufferGeometry(this.config.width,this.config.width),new C.MeshBasicMaterial({transparent:!0,opacity:0,depthTest:!1})),this.mesh.visible=!1,this.group.add(this.mesh),this.updateMeshQuaternion(this.config.yRotate),this.state.visible||(this.checkMsg.pluginHidden="初始值设置为隐藏"),this.state.enabled||(this.checkMsg.pluginDisabled="初始值设置为禁用"),this.state.enabled&&this._enable({userAction:!1}),this.five.once("dispose",this.dispose)}get config(){return R({},this._config)}get disposed(){return this._disposed}enable(t={}){var r;if(this.state.enabled)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!0},i),this.checkMsg.pluginDisabled="",this._enable({userAction:i})}disable(t={}){var r;if(this.state.enabled===!1)return;const i=(r=t.userAction)!=null?r:!0;this.updateState({enabled:!1},i),this.checkMsg.pluginDisabled="调用 disable 禁用",this._disable({userAction:i})}show(t){return ee(this,null,function*(){if(this.state.visible)return Promise.resolve();if(this.disposed)return Promise.reject(new Error("不能在已销毁的插件上调用 show"));const i=R({userAction:!0},t);this.updateState({visible:!0},i.userAction),this.checkMsg.pluginHidden="",this._show(i)})}hide(t){return ee(this,null,function*(){if(this.state.visible===!1)return;const i=R({userAction:!0},t);this.updateState({visible:!1},i.userAction),this.checkMsg.pluginDisabled="调用 hide 隐藏",this._hide(i)})}setState(t,i={}){const r=this.state;if(Nn(t,r,{deep:!0}))return;const s=i.userAction!==void 0?i.userAction:!0;if(this.updateState(t,s),t.enabled!==void 0&&r.enabled!==t.enabled&&(t.enabled?this.checkMsg.pluginDisabled="":this.checkMsg.pluginDisabled="调用 setState 禁用",t.enabled?this._enable({userAction:s}):this._disable({userAction:s})),t.visible!==void 0&&r.visible!==t.visible){const o={userAction:s,anime:{duration:500}};t.visible?this.checkMsg.pluginHidden="":this.checkMsg.pluginHidden="调用 setState 隐藏",t.visible?this._show(o):this._hide(o)}}updateConfig(t,i={}){var o;const r=this.config,s=R(R({},r),t);this._config=s,r.imageURL!==s.imageURL&&this.reloadTexture(s.imageURL),r.yOffset!==s.yOffset&&this.updateMeshPosition(this.five.getCurrentState().panoIndex),r.yRotate!==s.yRotate&&this.updateMeshQuaternion(s.yRotate),r.width!==s.width&&(this.mesh.geometry=new C.PlaneBufferGeometry(s.width,s.width)),this.hooks.emit("configChange",{prevConfig:r,config:s,userAction:(o=i.userAction)!=null?o:!0})}__whyCantSeeMesh(){if(this.disposed)return"插件已销毁";if(this.checkMsg.pluginDisabled)return this.checkMsg.pluginDisabled;if(this.checkMsg.pluginHidden)return this.checkMsg.pluginHidden;if(this.checkMsg.meshHidden)return this.checkMsg.meshHidden}updateState(t,i){const r=this.state;this.state=R(R({},this.state),t),this.hooks.emit("stateChange",{state:this.state,prevState:r,userAction:i})}updateMeshVisible(){const{result:t,msg:i}=this.checkMeshVisible();this.checkMsg.meshHidden=i,t!==this.mesh.visible&&this.onMeshVisibleChange(t)}updateMeshPosition(t){const i=this.workUtil.getObserverStandingPosition(t);if(!i){console.warn("CurrentPanoImagePlugin: 无法获取到当前点位的 standingPosition");return}const r=i.clone().setY(i.y+this.config.yOffset);r&&this.mesh.position.copy(r)}reloadTexture(t){return ee(this,null,function*(){if(this.mesh.material.map=null,t!==""){const i=Us(t);this.textureLoadingPromise=i;const r=yield i;r.minFilter=C.LinearFilter,this.textureLoadingPromise===i&&(this.onTextureLoaded(r),this.textureLoadingPromise=null)}this.updateMeshVisible()})}updateMeshQuaternion(t){const i=new C.Quaternion;i.multiplyQuaternions(new C.Quaternion().setFromAxisAngle(new C.Vector3(1,0,0),-Math.PI/2),new C.Quaternion().setFromAxisAngle(new C.Vector3(0,0,1),t)),this.mesh.quaternion.copy(i)}_enable(t){this.hooks.emit("enable",{userAction:t.userAction}),this.config.imageURL&&!this.mesh.material.map&&!this.textureLoadingPromise&&this.reloadTexture(this.config.imageURL),this.five.scene.add(this.group),this.five.needsRender=!0,this.five.work&&this.onFiveWillLoad(),this.five.getCurrentState().mode==="Panorama"&&(this.onFiveModeChange(),this.onFivePanoArrived(this.five.getCurrentState().panoIndex)),this.five.on("willLoad",this.onFiveWillLoad),this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("panoWillArrive",this.onFivePanoWillArrive),this.five.on("modeChange",this.onFiveModeChange)}_disable(t){this.hooks.emit("disable",{userAction:t.userAction}),this.five.scene.remove(this.group),this.five.needsRender=!0,this.five.off("willLoad",this.onFiveWillLoad),this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("panoWillArrive",this.onFivePanoWillArrive),this.five.off("modeChange",this.onFiveModeChange)}_show(t){this.hooks.emit("show",t),this.updateMeshVisible(),this.five.needsRender=!0}_hide(t){this.hooks.emit("hide",t),this.updateMeshVisible(),this.five.needsRender=!0}}const N8=(e,n)=>new B8(e,n),F8={auto:"",pen:"","pen-forbidden":"","pen-crosshair":"","pne-polygon":"","pen-circle":"","crosshair-rectangle":"","crosshair-circle":""};class V8{constructor(n){v(this,"container");v(this,"deleteButton");this.container=n}setType(n){const t=F8[n];t?this.container.style.cursor=`url(${t}), auto`:this.container.style.cursor=n}showDeleteButton(n){const{clientX:t,clientY:i,container:r,onClick:s}=n;let o=this.deleteButton;return o||(o=document.createElement("div"),o.style.position="absolute",o.style.width="20px",o.style.height="20px",o.style.transform="translate(-50%, -40px)",o.style.borderRadius="50%",o.style.cursor="pointer",o.style.zIndex="9999",o.style.cursor="pointer",o.style.userSelect="none",o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center",o.style.backgroundImage="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTciIGhlaWdodD0iMjUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IHgxPSIxMC43MDYlIiB5MT0iNDIuNzQ0JSIgeDI9Ijg5LjA2NCUiIHkyPSI1Ny4yMDglIiBpZD0icHJlZml4X19hIj48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRkZGIiBzdG9wLW9wYWNpdHk9Ii4zMDgiIG9mZnNldD0iNDkuNTY5JSIvPjxzdG9wIHN0b3AtY29sb3I9IiNGRkYiIHN0b3Atb3BhY2l0eT0iMCIgb2Zmc2V0PSIxMDAlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iLS4yNSIgeT0iLS4yNSIgd2lkdGg9IjU3LjUiIGhlaWdodD0iMjMuNSIgcng9IjExLjI1IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDEpIiBmaWxsPSIjMkMyQzJDIiBzdHJva2U9InVybCgjcHJlZml4X19hKSIgc3Ryb2tlLXdpZHRoPSIuNSIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsLW9wYWNpdHk9Ii4zMDMiLz48L3N2Zz4=)",o.innerHTML='<svg width="16px" height="17px" viewBox="0 0 16 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><linearGradient x1="22.185491%" y1="100%" x2="66.8316686%" y2="6.67239121%" id="1"><stop stop-color="#FFFCFC" stop-opacity="0.6"></stop><stop stop-color="#FFFFFF" offset="100%"></stop></linearGradient></defs> <path fill="url(#1)" fill-rule="nonzero" transform="translate(2.16 2.16)" d="M11.2979686,2.71818182 C11.611378,2.71818182 11.8654465,2.97561809 11.8654465,3.29318182 C11.8654465,3.58428191 11.6519584,3.82485822 11.374972,3.86293275 L11.2979686,3.86818182 L10.464,3.868 L9.7236795,10.6246222 C9.64153248,11.3737453 9.04854423,11.9512142 8.32013277,12.0165596 L8.18206028,12.0227273 L3.68338622,12.0227273 C2.89302127,12.0227273 2.22904821,11.4205655 2.141767,10.6246222 L2.141767,10.6246222 L1.4,3.868 L0.567477876,3.86818182 C0.254068499,3.86818182 0,3.61074555 0,3.29318182 C0,3.00208173 0.213488114,2.76150541 0.49047449,2.72343089 L0.567477876,2.71818182 L11.2979686,2.71818182 Z M9.322,3.868 L2.542,3.868 L3.26978106,10.4976259 C3.28762252,10.6603274 3.39528004,10.7928487 3.53932022,10.8467307 L3.61412483,10.866894 L3.68338622,10.8727273 L8.18206028,10.8727273 C8.39410941,10.8727273 8.57224853,10.7111717 8.59566544,10.4976259 L8.59566544,10.4976259 L9.322,3.868 Z M8.16824216,0 C8.48165153,0 8.73572003,0.257436269 8.73572003,0.575 C8.73572003,0.866100087 8.52223192,1.1066764 8.24524554,1.14475093 L8.16824216,1.15 L3.69720434,1.15 C3.38379497,1.15 3.12972647,0.892563731 3.12972647,0.575 C3.12972647,0.283899913 3.34321458,0.0433235966 3.62020096,0.00524907226 L3.69720434,0 L8.16824216,0 Z"></path></svg>'),this.deleteButton=o,r.appendChild(o),o.style.left=`${t}px`,o.style.top=`${i}px`,o.onclick=()=>{r.removeChild(o),s()},o}removeDeleteButton(){this.deleteButton&&this.deleteButton.remove()}tip(n){return()=>this.closeTip()}closeTip(){}reset(){this.container.style.cursor="auto"}}class G8{constructor(){v(this,"five");v(this,"_cursor");v(this,"_pointSelector");v(this,"_fiveDomEvents");v(this,"_object3DHelper");v(this,"inited",!1);v(this,"init",n=>{this.inited=!0,this.five=n,this._cursor=void 0,this._pointSelector=void 0,this._fiveDomEvents=void 0,this._object3DHelper=void 0})}get cursor(){if(!this.inited)throw new Error("Global not inited");return this._cursor?this._cursor:(this._cursor=new V8(this.five.getElement()),this._cursor)}get pointSelector(){if(!this.inited)throw new Error("Global not inited");return this._pointSelector?this._pointSelector:(this._pointSelector=new Qx(this.five,{mode:"cursor"}),this._pointSelector)}get fiveDomEvents(){if(!this.inited)throw new Error("Global not inited");return this._fiveDomEvents?this._fiveDomEvents:(this._fiveDomEvents=new Zg(this.five,{noEmitWhenNotInScene:!0}),this._fiveDomEvents)}get object3DHelper(){if(!this.inited)throw new Error("Global not inited");return this._object3DHelper?this._object3DHelper:(this._object3DHelper=new ev(this.five),this._object3DHelper)}}const UM=new G8;window.globalModules=UM;function WM(e,n){return e?n(e)?e:e.parent?WM(e.parent,n):null:null}const j8="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==";let w1=null;class Sc extends ei{constructor(t){var c,h;super();v(this,"name","PointMesh");v(this,"opacityBeforeHighlight");v(this,"highlighted",!1);v(this,"fontMesh");v(this,"backgroundMesh");const i=new C.BufferGeometry;i.setAttribute("position",new C.Float32BufferAttribute([0,0,0],3));const r={transparent:!0,side:C.DoubleSide,size:(c=t==null?void 0:t.size)!=null?c:8,map:w1||(w1=new C.TextureLoader().load(j8)),sizeAttenuation:!1},s=new C.PointsMaterial(Ee(R({},r),{color:(h=t==null?void 0:t.color)!=null?h:16777215,depthTest:!0,opacity:1})),o=new C.PointsMaterial(Ee(R({},r),{size:s.size,color:s.color,depthWrite:!1,depthTest:!1,opacity:.5})),a=new C.Points(i,s),l=new C.Points(i,o);this.fontMesh=a,this.backgroundMesh=l,a.name="FontMesh",l.name="BackgroundMesh",a.renderOrder=10,l.renderOrder=0,this.add(a,l),t!=null&&t.point&&this.position.copy(Ft(t.point)),t&&this.setStyle(t)}get color(){return this.fontMesh.material.color}get size(){return this.fontMesh.material.size}setStyle(t){At(t.color)&&(this.fontMesh.material.setValues({color:t.color}),this.backgroundMesh.material.setValues({color:t.color})),At(t.size)&&(this.fontMesh.material.setValues({side:t.size}),this.backgroundMesh.material.setValues({side:t.size})),At(t.occlusionVisibility)&&(t.occlusionVisibility?t.occlusionMode==="depthTest"?(this.fontMesh.material.depthTest=!1,this.backgroundMesh.visible=!1):(this.fontMesh.material.depthTest=!0,this.backgroundMesh.visible=!0):(this.fontMesh.material.depthTest=!0,this.backgroundMesh.visible=!1))}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.fontMesh.material.opacity,this.fontMesh.material.setValues({opacity:this.opacityBeforeHighlight*ra}))}unhighlight(){this.highlighted&&(this.highlighted=!1,this.fontMesh.material.setValues({opacity:this.opacityBeforeHighlight}))}}class Um extends Ri{constructor(t){super();v(this,"name","LineWithDotsMesh");v(this,"pointGroup",new ei);v(this,"_paramsStyle");v(this,"setStyle",t=>{super.setStyle(t),this._paramsStyle=R(R({},this._paramsStyle),t),this.pointMeshes.forEach(i=>i.setStyle(Ee(R({},this._paramsStyle),{color:t.lineColor}))),this.updateEdgePointsVisibility(),this.needsRender=!0});v(this,"highlight",()=>{super.highlight(),this.pointMeshes.forEach(t=>t.highlight())});v(this,"unhighlight",()=>{super.unhighlight(),this.pointMeshes.forEach(t=>t.unhighlight())});v(this,"updateEdgePointsVisibility",()=>{var t;At((t=this._paramsStyle)==null?void 0:t.pointVisibility)&&(this.startPoint&&(this.startPoint.visible=typeof this._paramsStyle.pointVisibility=="object"?this._paramsStyle.pointVisibility.startPoint:this._paramsStyle.pointVisibility),this.endPoint&&(this.endPoint.visible=typeof this._paramsStyle.pointVisibility=="object"?this._paramsStyle.pointVisibility.endPoint:this._paramsStyle.pointVisibility))});this.add(this.pointGroup),t&&this.setStyle(t),t!=null&&t.points&&this.setPoints(t.points)}get startPoint(){return this.pointMeshes[0]}get endPoint(){return this.pointMeshes.length<2?null:this.pointMeshes.at(-1)}get visiblePointMeshes(){return this.pointMeshes.filter(t=>t.visible)}get pointMeshes(){return this.pointGroup.children}setPoints(t){super.setPoints(t);const i=t.map(Ft).filter(At);this.pointGroup.removeChildren(),this.addIfNotExists(this.pointGroup),i.forEach(r=>{var o;const s=new Sc(Ee(R({},this.style),{color:(o=this._paramsStyle)==null?void 0:o.lineColor}));s.position.copy(r),this.pointGroup.add(s)}),this.updateEdgePointsVisibility(),this.needsRender=!0}}function H8(e){const n=[...e];if(e.length<3)return e;const t=e.at(-1),i=e[0];return t.equals(i)||n.push(i),n}class QM extends ei{constructor(t){super();v(this,"name","PolylineBaseMesh");v(this,"lines",[]);v(this,"withDots");v(this,"paramsStyle");const o=t,{withDots:i,points:r}=o,s=po(o,["withDots","points"]);this.withDots=i!=null?i:!0,r&&this.setPoints(r),s&&this.setStyle(s),this.addEventListener("removed",()=>{hg(this)})}get style(){var t;return{lineColor:this.lineColor,lineWidth:this.lineWidth,opacity:this.opacity,dashed:this.dashed,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode,lengthEnable:(t=this.paramsStyle)==null?void 0:t.lengthEnable}}get opacity(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.opacity)!=null?r:(i=this.paramsStyle)==null?void 0:i.opacity}get lineColor(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.color)!=null?r:(i=this.paramsStyle)!=null&&i.lineColor?new C.Color(this.paramsStyle.lineColor):void 0}get lineWidth(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.lineWidth)!=null?r:(i=this.paramsStyle)==null?void 0:i.lineWidth}get dashed(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.dashed)!=null?r:(i=this.paramsStyle)==null?void 0:i.dashed}get occlusionVisibility(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.occlusionVisibility)!=null?r:(i=this.paramsStyle)==null?void 0:i.occlusionVisibility}get occlusionMode(){var t,i,r;return(r=(t=this.lines[0])==null?void 0:t.occlusionMode)!=null?r:(i=this.paramsStyle)==null?void 0:i.occlusionMode}get points(){var t;return this.lines.map(i=>i.points[0]).concat((t=this.lines.at(-1))==null?void 0:t.points[1]).filter(Boolean)}setPoints(t,i={closed:!1}){let r=t.map(Ft);i.closed&&(r=H8(r)),r.forEach((s,o)=>{var c;const a=r[o+1];if(o!==0&&a===void 0)return;const l=(c=this.lines[o])!=null?c:(()=>{const h=new Um(Ee(R({},this.style),{pointVisibility:this.withDots?{startPoint:o===0,endPoint:!0}:!1}));return this.lines[o]=h,this.add(h),h})();l.setStyle(this.style),l.setPoints([s,a])}),r.length===0?(this.lines.forEach(s=>s.removeFromParent()),this.lines=[]):r.length===1||this.lines.length>r.length-1&&this.lines.splice(r.length-1).forEach(s=>s.removeFromParent())}setStyle(t){this.paramsStyle=R(R({},this.paramsStyle),t),this.lines.forEach(i=>i.setStyle(this.paramsStyle))}highlight(){this.lines.forEach(t=>t.highlight())}unhighlight(){this.lines.forEach(t=>t.unhighlight())}}class oo extends QM{constructor(...t){super(Ee(R({},t[0]),{withDots:!1}));v(this,"name","PolylineMesh")}}class Bl extends QM{constructor(...t){super(Ee(R({},t[0]),{withDots:!0}));v(this,"name","PolylineWithDotsMesh")}}const wp=typeof navigator!="undefined"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function xp(e,n,t,i){e.addEventListener?e.addEventListener(n,t,i):e.attachEvent&&e.attachEvent("on".concat(n),t)}function Al(e,n,t,i){e.removeEventListener?e.removeEventListener(n,t,i):e.detachEvent&&e.detachEvent("on".concat(n),t)}function YM(e,n){const t=n.slice(0,n.length-1);for(let i=0;i<t.length;i++)t[i]=e[t[i].toLowerCase()];return t}function XM(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");const n=e.split(",");let t=n.lastIndexOf("");for(;t>=0;)n[t-1]+=",",n.splice(t,1),t=n.lastIndexOf("");return n}function U8(e,n){const t=e.length>=n.length?e:n,i=e.length>=n.length?n:e;let r=!0;for(let s=0;s<t.length;s++)i.indexOf(t[s])===-1&&(r=!1);return r}const Ic={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":wp?173:189,"=":wp?61:187,";":wp?59:186,"'":222,"[":219,"]":221,"\\":220},ar={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},Wm={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},Dn={16:!1,18:!1,17:!1,91:!1},en={};for(let e=1;e<20;e++)Ic["f".concat(e)]=111+e;let Yt=[],Nl=null,ZM="all";const Mr=new Map,Hc=e=>Ic[e.toLowerCase()]||ar[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),W8=e=>Object.keys(Ic).find(n=>Ic[n]===e),Q8=e=>Object.keys(ar).find(n=>ar[n]===e);function JM(e){ZM=e||"all"}function Tc(){return ZM||"all"}function Y8(){return Yt.slice(0)}function X8(){return Yt.map(e=>W8(e)||Q8(e)||String.fromCharCode(e))}function Z8(){const e=[];return Object.keys(en).forEach(n=>{en[n].forEach(t=>{let{key:i,scope:r,mods:s,shortcut:o}=t;e.push({scope:r,shortcut:o,mods:s,keys:i.split("+").map(a=>Hc(a))})})}),e}function J8(e){const n=e.target||e.srcElement,{tagName:t}=n;let i=!0;const r=t==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(n.type);return(n.isContentEditable||(r||t==="TEXTAREA"||t==="SELECT")&&!n.readOnly)&&(i=!1),i}function q8(e){return typeof e=="string"&&(e=Hc(e)),Yt.indexOf(e)!==-1}function K8(e,n){let t,i;e||(e=Tc());for(const r in en)if(Object.prototype.hasOwnProperty.call(en,r))for(t=en[r],i=0;i<t.length;)t[i].scope===e?t.splice(i,1).forEach(o=>{let{element:a}=o;return tv(a)}):i++;Tc()===e&&JM(n||"all")}function $8(e){let n=e.keyCode||e.which||e.charCode;const t=Yt.indexOf(n);if(t>=0&&Yt.splice(t,1),e.key&&e.key.toLowerCase()==="meta"&&Yt.splice(0,Yt.length),(n===93||n===224)&&(n=91),n in Dn){Dn[n]=!1;for(const i in ar)ar[i]===n&&(ri[i]=!1)}}function qM(e){if(typeof e=="undefined")Object.keys(en).forEach(r=>{Array.isArray(en[r])&&en[r].forEach(s=>nu(s)),delete en[r]}),tv(null);else if(Array.isArray(e))e.forEach(r=>{r.key&&nu(r)});else if(typeof e=="object")e.key&&nu(e);else if(typeof e=="string"){for(var n=arguments.length,t=new Array(n>1?n-1:0),i=1;i<n;i++)t[i-1]=arguments[i];let[r,s]=t;typeof r=="function"&&(s=r,r=""),nu({key:e,scope:r,method:s,splitKey:"+"})}}const nu=e=>{let{key:n,scope:t,method:i,splitKey:r="+"}=e;XM(n).forEach(o=>{const a=o.split(r),l=a.length,c=a[l-1],h=c==="*"?"*":Hc(c);if(!en[h])return;t||(t=Tc());const u=l>1?YM(ar,a):[],d=[];en[h]=en[h].filter(f=>{const p=(i?f.method===i:!0)&&f.scope===t&&U8(f.mods,u);return p&&d.push(f.element),!p}),d.forEach(f=>tv(f))})};function x1(e,n,t,i){if(n.element!==i)return;let r;if(n.scope===t||n.scope==="all"){r=n.mods.length>0;for(const s in Dn)Object.prototype.hasOwnProperty.call(Dn,s)&&(!Dn[s]&&n.mods.indexOf(+s)>-1||Dn[s]&&n.mods.indexOf(+s)===-1)&&(r=!1);(n.mods.length===0&&!Dn[16]&&!Dn[18]&&!Dn[17]&&!Dn[91]||r||n.shortcut==="*")&&(n.keys=[],n.keys=n.keys.concat(Yt),n.method(e,n)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function M1(e,n){const t=en["*"];let i=e.keyCode||e.which||e.charCode;if(!ri.filter.call(this,e))return;if((i===93||i===224)&&(i=91),Yt.indexOf(i)===-1&&i!==229&&Yt.push(i),["ctrlKey","altKey","shiftKey","metaKey"].forEach(a=>{const l=Wm[a];e[a]&&Yt.indexOf(l)===-1?Yt.push(l):!e[a]&&Yt.indexOf(l)>-1?Yt.splice(Yt.indexOf(l),1):a==="metaKey"&&e[a]&&Yt.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(Yt=Yt.slice(Yt.indexOf(l))))}),i in Dn){Dn[i]=!0;for(const a in ar)ar[a]===i&&(ri[a]=!0);if(!t)return}for(const a in Dn)Object.prototype.hasOwnProperty.call(Dn,a)&&(Dn[a]=e[Wm[a]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(Yt.indexOf(17)===-1&&Yt.push(17),Yt.indexOf(18)===-1&&Yt.push(18),Dn[17]=!0,Dn[18]=!0);const r=Tc();if(t)for(let a=0;a<t.length;a++)t[a].scope===r&&(e.type==="keydown"&&t[a].keydown||e.type==="keyup"&&t[a].keyup)&&x1(e,t[a],r,n);if(!(i in en))return;const s=en[i],o=s.length;for(let a=0;a<o;a++)if((e.type==="keydown"&&s[a].keydown||e.type==="keyup"&&s[a].keyup)&&s[a].key){const l=s[a],{splitKey:c}=l,h=l.key.split(c),u=[];for(let d=0;d<h.length;d++)u.push(Hc(h[d]));u.sort().join("")===Yt.sort().join("")&&x1(e,l,r,n)}}function ri(e,n,t){Yt=[];const i=XM(e);let r=[],s="all",o=document,a=0,l=!1,c=!0,h="+",u=!1,d=!1;for(t===void 0&&typeof n=="function"&&(t=n),Object.prototype.toString.call(n)==="[object Object]"&&(n.scope&&(s=n.scope),n.element&&(o=n.element),n.keyup&&(l=n.keyup),n.keydown!==void 0&&(c=n.keydown),n.capture!==void 0&&(u=n.capture),typeof n.splitKey=="string"&&(h=n.splitKey),n.single===!0&&(d=!0)),typeof n=="string"&&(s=n),d&&qM(e,s);a<i.length;a++)e=i[a].split(h),r=[],e.length>1&&(r=YM(ar,e)),e=e[e.length-1],e=e==="*"?"*":Hc(e),e in en||(en[e]=[]),en[e].push({keyup:l,keydown:c,scope:s,mods:r,shortcut:i[a],method:t,key:i[a],splitKey:h,element:o});if(typeof o!="undefined"&&window){if(!Mr.has(o)){const f=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return M1(p,o)},m=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;M1(p,o),$8(p)};Mr.set(o,{keydownListener:f,keyupListenr:m,capture:u}),xp(o,"keydown",f,u),xp(o,"keyup",m,u)}if(!Nl){const f=()=>{Yt=[]};Nl={listener:f,capture:u},xp(window,"focus",f,u)}}}function e6(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(en).forEach(t=>{en[t].filter(r=>r.scope===n&&r.shortcut===e).forEach(r=>{r&&r.method&&r.method()})})}function tv(e){const n=Object.values(en).flat();if(n.findIndex(i=>{let{element:r}=i;return r===e})<0){const{keydownListener:i,keyupListenr:r,capture:s}=Mr.get(e)||{};i&&r&&(Al(e,"keyup",r,s),Al(e,"keydown",i,s),Mr.delete(e))}if((n.length<=0||Mr.size<=0)&&(Object.keys(Mr).forEach(r=>{const{keydownListener:s,keyupListenr:o,capture:a}=Mr.get(r)||{};s&&o&&(Al(r,"keyup",o,a),Al(r,"keydown",s,a),Mr.delete(r))}),Mr.clear(),Object.keys(en).forEach(r=>delete en[r]),Nl)){const{listener:r,capture:s}=Nl;Al(window,"focus",r,s),Nl=null}}const Mp={getPressedKeyString:X8,setScope:JM,getScope:Tc,deleteScope:K8,getPressedKeyCodes:Y8,getAllKeyCodes:Z8,isPressed:q8,filter:J8,trigger:e6,unbind:qM,keyMap:Ic,modifier:ar,modifierMap:Wm};for(const e in Mp)Object.prototype.hasOwnProperty.call(Mp,e)&&(ri[e]=Mp[e]);if(typeof window!="undefined"){const e=window.hotkeys;ri.noConflict=n=>(n&&window.hotkeys===ri&&(window.hotkeys=e),ri),window.hotkeys=ri}const E1=new Map;class Nr extends ei{constructor(t,i){super();v(this,"name","Sculpt");v(this,"isSculptObject",!0);v(this,"draggable");v(this,"selected");v(this,"config");v(this,"editor");v(this,"on",(t,i,r)=>sn.modules.fiveDomEvents.addEventListener(this,t,i,r));v(this,"off",(...t)=>sn.modules.fiveDomEvents.removeEventListener(this,...t));t!=null&&t.id&&(this.uuid=t.id),this.config=R({canEdit:!0,occlusionVisibility:!0,occlusionMode:"translucence"},i),t!=null&&t.style&&(t.style.occlusionVisibility=this.config.occlusionVisibility,t.style.occlusionMode=this.config.occlusionMode),this.addEventListener("removed",()=>{hg(this)}),ri("esc",()=>{this.stopCreating()}),this.config.canEdit&&(ri("backspace, delete",()=>{this.selected&&this.delete()}),this.on("click",()=>{var s;if(this.pointSelector.enabled)return;let r=E1.get(this.parent.uuid);r&&(r.selected=!1,r.unhighlight(),(s=r.editor)==null||s.disable()),E1.set(this.parent.uuid,this),this.selected=!0,this.highlight()}),ri("esc",()=>{var r;this.selected=!1,this.unhighlight(),!this.pointSelector.enabled&&((r=this.editor)==null||r.disable())}))}get baseData(){return{id:this.uuid,type:this.type}}get pointSelector(){return sn.modules.pointSelector}undo(){throw new Error("Method not implemented.")}redo(){throw new Error("Method not implemented.")}canUndo(){throw new Error("Method not implemented.")}canRedo(){throw new Error("Method not implemented.")}stopCreating(){sn.modules.pointSelector.disable()}delete(){var t;this.removeFromParent(),this.off(),(t=this.editor)==null||t.disable()}highlight(){}unhighlight(){}showDeleteButton(t,i){sn.modules.cursor.showDeleteButton({clientX:t,clientY:i,container:document.body,onClick:()=>this.delete()}),sn.modules.five.once("cameraUpdate",()=>{sn.modules.cursor.removeDeleteButton()})}applyObjectMatrixWorld(t){return this.updateMatrixWorld(),qu(this,t)}applyObjectQuaternion(t){const i=this.quaternion.clone();return Array.isArray(t)?t.map(r=>r.clone().applyQuaternion(i)):t.clone().applyQuaternion(i)}}class nv extends ei{constructor(t){super();v(this,"originObject");this.originObject=t}enable(){this.originObject.add(this)}disable(){this.originObject.remove(this)}}class Uc extends nv{constructor(t,i){super(t);v(this,"objectHelperConfig");this.objectHelperConfig=i}enable(){super.enable();const t=typeof this.objectHelperConfig=="function"?this.objectHelperConfig():this.objectHelperConfig;sn.modules.object3DHelper.addObject3DHelper(this.originObject,R({positionFrom:"boundingBox"},t))}disable(){super.disable(),sn.modules.object3DHelper.removeObject3DHelper(this.originObject)}}class iv extends nv{constructor(t){super(t);v(this,"draggingPoints",[]);v(this,"onDragstart",t=>{const i=t.target;this.draggingPoints=this.pointMeshes.filter(r=>r.position.equals(i.position))});v(this,"onDragend",t=>{this.draggingPoints=[]})}get pointMeshes(){return this.children.filter(t=>t instanceof Sc)}get pointHandles(){return this.children}enable(){super.enable(),this.points.filter(At).forEach(t=>{const i=new Sc;i.visible=!1,i.position.copy(t),i.draggable=!0,sn.modules.fiveDomEvents.addEventListener(i,"drag",this.onDrag),sn.modules.fiveDomEvents.addEventListener(i,"dragstart",this.onDragstart),sn.modules.fiveDomEvents.addEventListener(i,"dragend",this.onDragend),this.add(i)})}disable(){super.disable(),this.removeChildren()}}class t6 extends iv{constructor(t){super(t);v(this,"onDrag",t=>{if(!this.draggingPoints||this.draggingPoints.length===0)return;const i=Fc(sn.modules.five,t.raycaster);this.draggingPoints.forEach(r=>r.position.copy(i.point)),this.originObject.lineMesh.setPoints(this.pointMeshes.map(r=>r.position))})}get points(){return this.originObject.lineMesh.points}}class n6 extends iv{constructor(t){super(t);v(this,"onDrag",t=>{if(!this.draggingPoints||this.draggingPoints.length===0)return;const i=Fc(sn.modules.five,t.raycaster);this.draggingPoints.forEach(r=>r.position.copy(i.point)),this.originObject.polyLineMesh.setPoints(this.pointMeshes.map(r=>r.position))})}get points(){return this.originObject.polyLineMesh.points}}function yi(e){return Array.isArray(e)?e.map(n=>[n.x,n.y,n.z]):[e.x,e.y,e.z]}function rv(){let e,n;return{promise:new Promise((i,r)=>{e=i,n=r}),resolve:e,reject:n}}const C1=new C.Vector3;class P1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Polyline");v(this,"polyLineMesh");v(this,"creatingObject");t&&(this.polyLineMesh=new Bl(R(R({},t.style),t)),this.add(this.polyLineMesh)),this.editor=new n6(this)}get data(){return Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.polyLineMesh.points)),style:{lineColor:new C.Color(this.polyLineMesh.lineColor).getHex(),lineWidth:this.polyLineMesh.lineWidth,dashed:this.polyLineMesh.dashed}})}highlight(){var t;(t=this.polyLineMesh)==null||t.highlight()}unhighlight(){var t;(t=this.polyLineMesh)==null||t.unhighlight()}canUndo(){var t;(t=this.creatingObject)==null||t.canUndo()}canRedo(){var t;(t=this.creatingObject)==null||t.canRedo()}undo(){var t;(t=this.creatingObject)==null||t.undo()}redo(){var t;(t=this.creatingObject)==null||t.redo()}create(t){return ee(this,null,function*(){this.removeChildren();const i=new Bl(t);this.polyLineMesh=i,this.add(this.polyLineMesh),this.creatingObject=i6(i,this.pointSelector,t),yield this.creatingObject.finished,this.editor.enable()})}}function i6(e,n,t){var x;const i=e.parent;if(!i)return;const{promise:r,resolve:s,reject:o}=rv(),a=(x=t==null?void 0:t.limit)!=null?x:"none",l=new oo(e.style);i.add(l);const c=new oo(Ee(R({},e.style),{dashed:!0,lengthEnable:!1}));i.add(c),n.enable();const h=[];let u,d,f;const m=[],p=()=>h.length>0,g=()=>m.length>0,y=()=>{p()&&(m.push(h.pop()),e.setPoints(h),w(f),n.pointSelectorHelper.magnifier.render())},b=()=>{g()&&(h.push(m.pop()),e.setPoints(h),w(f),n.pointSelectorHelper.magnifier.render())},A=M=>{m.length=0;const P=h.length===0?M.point:u.clone();h.push(P),e.setPoints(h)},w=M=>{const P=()=>{l.setPoints([]),c.setPoints([]),u=null};if(!M||(f=M,!(h!=null&&h.length)))return P();const S=h.at(-1).clone();a==="none"?(u=M.point,l.setPoints([S,u])):a==="xoz"?(d=d!=null?d:new C.Plane().setFromNormalAndCoplanarPoint(new C.Vector3(0,1,0),h[0]),n.plane=d,u=d.projectPoint(M.point,C1),l.setPoints([S,u]),c.setPoints([u,M.point])):a==="y"&&(h.length===1?(u=M.point,l.setPoints([S,u])):(d=d!=null?d:new C.Plane().setFromCoplanarPoints(h[0],h[1],new C.Vector3(0,1,0).add(h[0])),n.plane=d,u=d.projectPoint(M.point,C1),l.setPoints([S,u]),c.setPoints([u,M.point])))};return n.on("select",A),n.on("intersectionUpdate",w),n.on("disable",()=>{if(n.off("select",A),n.off("intersectionUpdate",w),n.plane=null,i.remove(l),i.remove(c),h.length<2)return i.remove(e),o(new Error("Cancelled"));s()}),{finished:r,canUndo:p,canRedo:g,undo:y,redo:b}}class r6 extends nv{constructor(t){super(t);v(this,"onDrag",t=>{var r;const i=Fc(sn.modules.five,t.raycaster);(r=this.originObject.pointMesh)==null||r.position.copy(i.point)})}enable(){super.enable(),this.originObject.config.canEdit&&(this.originObject.draggable=!0,this.originObject.on("drag",this.onDrag))}disable(){super.disable(),this.originObject.config.canEdit&&(this.originObject.draggable=!1,this.originObject.off("drag",this.onDrag))}}class _1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Point");v(this,"pointMesh");this.editor=new r6(this),t&&(this.pointMesh=new Sc(R(R({},t.style),t)),this.add(this.pointMesh))}get data(){return Ee(R({},this.baseData),{point:yi(this.applyObjectMatrixWorld(this.pointMesh.position)),style:{color:this.pointMesh.color.getHex(),size:this.pointMesh.size}})}highlight(){var t;(t=this.pointMesh)==null||t.highlight()}unhighlight(){var t;(t=this.pointMesh)==null||t.unhighlight()}setStyle(t){this.pointMesh.setStyle(t)}create(t){return ee(this,null,function*(){this.pointMesh&&this.remove(this.pointMesh),this.add(this.pointMesh=new Sc(t)),yield s6(this.pointMesh,this.pointSelector),this.editor.enable()})}}function s6(e,n){return new Promise((t,i)=>{n.enable();const r=s=>{const{point:o}=s;e.position.copy(o),t(),n.disable()};n.on("disable",()=>{n.off("select",r),i(new Error("Cancelled"))}),n.once("select",r)})}class sv extends ei{constructor(t){var a,l;super();v(this,"name","ColoredMesh");v(this,"meshFont");v(this,"meshBackground");v(this,"paramsStyle",{});v(this,"_geometry",new C.BufferGeometry);this.paramsStyle=t!=null?t:{};const i=new C.MeshBasicMaterial({color:(a=t==null?void 0:t.color)!=null?a:$E,transparent:!0,side:C.DoubleSide,depthTest:!0,opacity:(l=t==null?void 0:t.opacity)!=null?l:.5}),r=new C.MeshBasicMaterial({color:16777215,transparent:!0,side:C.DoubleSide,depthTest:!1,depthWrite:!1,opacity:.3/.5*i.opacity}),s=new C.Mesh(this.geometry,i),o=new C.Mesh(this.geometry,r);s.name="MeshFront",o.name="MeshBackground",s.renderOrder=1,o.renderOrder=0,this.meshFont=s,this.meshBackground=o,this.add(s),this.setOcclusionVisibility({occlusionVisibility:t==null?void 0:t.occlusionVisibility,occlusionMode:t==null?void 0:t.occlusionMode})}get style(){return{color:this.color,opacity:this.opacity,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode}}get color(){return this.meshFont.material.color}get opacity(){return this.meshFont.material.opacity}get occlusionVisibility(){return!!this.meshBackground.parent||this.meshFont.material.depthTest===!1}get occlusionMode(){return this.meshFont.material.depthTest===!1?"depthTest":"translucence"}set geometry(t){this._geometry=t,this.meshFont.geometry=t,this.meshBackground.geometry=t}get geometry(){return this._geometry}setStyle(t){this.paramsStyle=R(R({},this.paramsStyle),t),At(t.color)&&(this.meshFont.material.color.set(t.color),this.needsRender=!0),At(t.opacity)&&(this.meshFont.material.opacity=t.opacity,this.meshBackground.material.opacity=.3/.5*t.opacity,this.needsRender=!0),this.setOcclusionVisibility(t)}setOcclusionVisibility(t){var s,o,a;const i=(o=(s=t.occlusionMode)!=null?s:this.paramsStyle.occlusionMode)!=null?o:"translucence",r=(a=t.occlusionVisibility)!=null?a:this.paramsStyle.occlusionVisibility;At(r)&&(r?i==="depthTest"?(this.meshFont.material.depthTest=!1,this.remove(this.meshBackground)):i==="translucence"&&(this.meshFont.material.depthTest=!0,this.addIfNotExists(this.meshBackground)):(this.meshFont.material.depthTest=!0,this.remove(this.meshBackground)))}}const ov=new C.BufferGeometry;ov.name="blankGeometry";ov.isBlank=!0;class pd extends sv{constructor(t){super(t);v(this,"name","PolygonMesh");v(this,"points",[]);v(this,"planeHelperNeedUpdate",!0);v(this,"geometryInfoNeedUpdate",!0);v(this,"_paramsStyle");v(this,"planeHelper",null);v(this,"_geometryInfo",null);v(this,"opacityBeforeHighlight");v(this,"highlighted",!1);v(this,"lastRenderAreaItem");v(this,"areaDom");t!=null&&t.points&&this.setPoints(t.points),this._paramsStyle=t!=null?t:{},this.updateAreaItems()}get style(){return Ee(R({},super.style),{lengthEnable:this._paramsStyle.lengthEnable})}get isBlank(){return!!this.geometry.isBlank}get center(){var t;return(t=this.geometryInfo)==null?void 0:t.center}get geometryInfo(){return this.geometryInfoNeedUpdate&&(this.isBlank?this._geometryInfo=null:this._geometryInfo=Hx(this.geometry),this.geometryInfoNeedUpdate=!1),this._geometryInfo}get five(){var t,i;return(i=(t=window.globalModules)==null?void 0:t.five)!=null?i:window.$five}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.center){const i=qu(this,this.center).toArray().join(",");i!==this.lastRenderAreaItem&&(this.updateAreaItems(),this.lastRenderAreaItem=i)}}setStyle(t){this._paramsStyle=R(R({},this._paramsStyle),t),super.setStyle(this._paramsStyle),this.updateAreaItems()}setPoints(t){var r;const i=t.map(Ft);this.points=i,this.geometry=(r=Gx(this.points,{checkLinesIntersect:!0}))!=null?r:ov,this.planeHelperNeedUpdate=!0,this.geometryInfoNeedUpdate=!0,this.updateAreaItems()}projectPoint(t){return t&&(this.planeHelperNeedUpdate&&this.updatePlaneHelper(),this.planeHelper?this.planeHelper.projectPoint(t,new C.Vector3):t)}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.opacity,this.setStyle({opacity:this.opacity*ra}),this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.setStyle({opacity:this.opacityBeforeHighlight}),this.needsRender=!0)}updatePlaneHelper(){this.points.length>=3?this.planeHelper=new C.Plane().setFromCoplanarPoints(this.points[0],this.points[1],this.points[2]):this.planeHelper=null,this.planeHelperNeedUpdate=!1}updateAreaItems(){var r;const t=()=>{var s;(s=this.areaDom)==null||s.destroy(),this.areaDom=void 0};if(!this._paramsStyle.lengthEnable||!this.geometryInfo)return t();if(!this.five)return console.error("Five not found");this.areaDom=(r=this.areaDom)!=null?r:(()=>{const s=new xc(this.five);return s.intersectCheck=!1,s.simulate3D=!0,s})(),this.areaDom.setPosition(this.center);const i=this.geometryInfo.area.toFixed(2);i==="0.00"?this.areaDom.container.innerHTML="":this.areaDom.container.innerHTML=Yw(i+"m²")}}class md extends pd{constructor(t){const s=t!=null?t:{},{points:i}=s,r=po(s,["points"]);super();v(this,"name","PolygonWithEdgeMesh");v(this,"line",new oo);i&&this.setPoints(i),r&&this.setStyle(r)}get style(){return Ee(R({},super.style),{lineWidth:this.lineWidth,lineColor:this.lineColor})}get lineWidth(){return this.line.lineWidth}get lineColor(){return this.line.lineColor}raycast(t,i){return this.children.forEach(r=>{Xg(r,t,i,!0)}),!1}setPoints(t,i={closed:!0}){super.setPoints(t),this.points&&(this.line.setPoints(this.points,i),this.addIfNotExists(this.line))}setStyle(t){super.setStyle(t),this.line.setStyle(t)}highlight(){super.highlight(),this.line.highlight()}unhighlight(){super.unhighlight(),this.line.unhighlight()}}class S1 extends md{constructor(){super(...arguments);v(this,"name","AreaMesh")}}class o6 extends iv{constructor(t){super(t);v(this,"onDrag",t=>{if(!this.draggingPoints||this.draggingPoints.length===0)return;const i=Fc(sn.modules.five,t.raycaster),r=this.originObject.areaMesh.projectPoint(i.point);this.draggingPoints.forEach(s=>s.position.copy(r)),this.originObject.areaMesh.setPoints(this.pointMeshes.map(s=>s.position))})}get points(){return this.originObject.areaMesh.points}}const I1=new C.Vector3;class T1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Polygon");v(this,"areaMesh");v(this,"creatingObject");this.editor=new o6(this),t&&(this.areaMesh=new S1(R(R({},t.style),t)),this.add(this.areaMesh))}get data(){return this.updateMatrixWorld(),Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.areaMesh.points)),style:{color:this.areaMesh.color.getHex(),lineColor:this.areaMesh.lineColor.getHex(),lineWidth:this.areaMesh.lineWidth}})}highlight(){var t;(t=this.areaMesh)==null||t.highlight()}unhighlight(){var t;(t=this.areaMesh)==null||t.unhighlight()}canUndo(){var t;(t=this.creatingObject)==null||t.canUndo()}canRedo(){var t;(t=this.creatingObject)==null||t.canRedo()}undo(){var t;(t=this.creatingObject)==null||t.undo()}redo(){var t;(t=this.creatingObject)==null||t.redo()}create(t){return ee(this,null,function*(){this.children.forEach(r=>{r.parent===this&&this.remove(r)}),this.children.length=0;const i=new S1(t);this.areaMesh=i,this.add(this.areaMesh),this.creatingObject=KM(this.areaMesh,this.pointSelector,t),yield this.creatingObject.finished,this.editor.enable()})}}function KM(e,n,t){var S;const{promise:i,resolve:r,reject:s}=rv(),o=e.parent;if(!o){s(new Error("No container"));return}const a=(S=t==null?void 0:t.limit)!=null?S:"none",l=new oo(Ee(R({},e.style),{opacity:1}));o==null||o.add(l);const c=new oo(Ee(R({},e.style),{dashed:!0,lengthEnable:!1}));o==null||o.add(c),n.enable();const h=[];let u,d,f=!1,m;const p=[],g=()=>h.length>0,y=()=>p.length>0,b=()=>{g()&&(p.push(h.pop()),x(m),n.pointSelectorHelper.magnifier.render())},A=()=>{y()&&(h.push(p.pop()),x(m),n.pointSelectorHelper.magnifier.render())},w=T=>{p.length=0;const z=h.length===0?T.point:u.clone();h.push(z),e.setPoints(h,{closed:!1}),f&&(M(),r())},x=T=>{const z=()=>{l.setPoints([]),c.setPoints([]),e.setPoints(h),n.pointSelectorHelper.magnifier.render()};if(!T||(m=T,!(h!=null&&h.length)))return z();const D=h.at(-1).clone();if(h.length<3&&(a==="none"?(u=T.point,l.setPoints([D,u]),c.setPoints([])):a==="xoz"?(d=d!=null?d:new C.Plane().setFromNormalAndCoplanarPoint(new C.Vector3(0,1,0),h[0]),n.plane=d,u=d.projectPoint(T.point,I1),l.setPoints([D,u]),c.setPoints([u,T.point])):a==="y"&&(h.length===1?(u=T.point,l.setPoints([D,u]),c.setPoints([])):(d=d!=null?d:new C.Plane().setFromCoplanarPoints(h[0],h[1],new C.Vector3(0,1,0).add(h[0])),n.plane=d,u=d.projectPoint(T.point,I1),l.setPoints([D,u]),c.setPoints([u,T.point])))),h.length>=3){u=e.projectPoint(T.point);const k=h[0],O=.2;k.distanceTo(u)<O||k.distanceTo(T.point)<O?(u=k,T.point.copy(k),n.pointSelectorHelper.updateWithIntersect(T,{emitEvent:!1}),f=!0):f=!1,l.setPoints([D,u]),c.setPoints([u,T.point])}h.length>=2?(e.setPoints([...h,u],{closed:!1}),e.line.setPoints(e.points.slice(0,-1)),e.isBlank?(n.cursorError=!0,l.setStyle({lineColor:16734553}),c.setStyle({lineColor:16734553})):(n.cursorError=!1,l.setStyle({lineColor:e.lineColor}),c.setStyle({lineColor:e.lineColor}))):e.setPoints([])},M=()=>{n.off("select",w),n.off("intersectionUpdate",x),n.off("disable",P),n.plane=null,n.disable(),o==null||o.remove(l,c)},P=()=>{M(),o==null||o.remove(e,c,l),s(new Error("Cancelled"))};return n.on("select",w),n.on("intersectionUpdate",x),n.on("disable",P),{finished:i,canUndo:g,canRedo:y,undo:b,redo:A}}class gd extends ei{constructor(t){super();v(this,"name","PrismMesh");v(this,"heightPoint");v(this,"bottomPolygon",new md);v(this,"topPolygon",new md);v(this,"paramStyle");v(this,"edgePlanes",new ei);this.topPolygon.name="TopPolygon",this.bottomPolygon.name="BottomPolygon",this.edgePlanes.name="EdgePlanes",this.addIfNotExists(this.bottomPolygon),t&&this.setPoints(t),t&&this.setStyle(t)}get center(){return this.localCenter}get localCenter(){var r,s;const t=(r=this.topPolygon)==null?void 0:r.center,i=(s=this.bottomPolygon)==null?void 0:s.center;if(t&&i)return new C.Vector3().lerpVectors(t,i,.5)}get worldCenter(){return this.updateMatrixWorld(),this.localToWorld(this.localCenter)}get color(){return this.bottomPolygon.color}get lineWidth(){return this.bottomPolygon.lineWidth}get lineColor(){return this.bottomPolygon.lineColor}setStyle(t){this.paramStyle=R(R({},this.paramStyle),t),this.bottomPolygon.setStyle(this.paramStyle),this.topPolygon.setStyle(this.paramStyle),this.edgePlanes.children.forEach(i=>{(i instanceof Ri||i instanceof pd)&&i.setStyle(this.paramStyle)})}setPoints(t){At(t.points)&&this.setBottomPoints(t.points),At(t.heightPoint)&&this.setTopHeightPoint(Ft(t.heightPoint))}highlight(){this.bottomPolygon.highlight(),this.topPolygon.highlight(),this.edgePlanes.children.forEach(t=>{typeof t.highlight=="function"&&t.highlight()})}unhighlight(){this.bottomPolygon.unhighlight(),this.topPolygon.unhighlight(),this.edgePlanes.children.forEach(t=>{typeof t.unhighlight=="function"&&t.unhighlight()})}setBottomPoints(t){this.bottomPolygon.setPoints(t.map(Ft)),this.heightPoint&&this.setTopHeightPoint(this.heightPoint)}setTopHeightPoint(t){this.heightPoint=t,this.addIfNotExists(this.topPolygon);const i=this.bottomPolygon.projectPoint(t),r=new C.Vector3().subVectors(t,i);this.up.copy(r.clone().normalize());const o=this.bottomPolygon.points.map(a=>a.clone().add(r));this.topPolygon.setPoints(o),this.setEdgePlanes()}raycast(t,i){return this.children.forEach(r=>{Xg(r,t,i,!0)}),!1}setEdgePlanes(){const t=this.bottomPolygon.points,i=this.topPolygon.points;this.addIfNotExists(this.edgePlanes),this.edgePlanes.removeChildren(),t.forEach((r,s)=>{if(s===0)return;const o=new pd({color:this.color});o.setPoints([t[s-1],t[s],i[s],i[s-1]]);const a=new Ri({lineColor:this.lineColor,lineWidth:this.lineWidth});a.name="EdgeLine",a.setPoints([t[s-1],i[s-1]]),this.edgePlanes.add(o,a)})}}class a6 extends Uc{constructor(n){super(n,()=>{const t=()=>{var o,a;const i=(o=n.prismMesh.topPolygon)==null?void 0:o.center,r=(a=n.prismMesh.bottomPolygon)==null?void 0:a.center,s=new C.Vector3().lerpVectors(i,r,.5);return{topCenter:i,bottomCenter:r,boxCenter:s}};return{positionFrom:()=>t().boxCenter.clone().applyMatrix4(n.matrixWorld),yAxis:n.prismMesh.up,scaleHelper:{enable:!0,positions:()=>{const i=t();return[{id:"top",handlePosition:i.topCenter,basePosition:i.bottomCenter},{id:"bottom",handlePosition:i.bottomCenter,basePosition:i.topCenter}]},scaleCallback:i=>{const{intersectPoint:r,scalePosition:s}=i,{id:o}=s,{prismMesh:a}=n;o==="top"?a.setPoints({heightPoint:r}):o==="bottom"&&a.setPoints({points:a.topPolygon.points.map(l=>l.clone().add(r.clone().sub(s.basePosition)))})}}}})}}class D1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Prism");v(this,"prismMesh");this.editor=new a6(this),t&&(this.prismMesh=new gd(R(R({},t.style),t)),this.add(this.prismMesh))}get data(){return Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.prismMesh.bottomPolygon.points)),heightPoint:yi(this.applyObjectMatrixWorld(this.prismMesh.heightPoint)),style:{color:this.prismMesh.color.getHex(),lineWidth:this.prismMesh.lineWidth,lineColor:this.prismMesh.lineColor.getHex()}})}highlight(){var t;(t=this.prismMesh)==null||t.highlight()}unhighlight(){var t;(t=this.prismMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.prismMesh=new gd(t),this.add(this.prismMesh),yield l6(this.prismMesh,this.pointSelector),this.editor.enable()})}}function l6(e,n){return ee(this,null,function*(){const t=e.parent;yield KM(e.bottomPolygon,n).finished;const i=new Ri;i.name="LineHelper",t.add(i);const r=e.bottomPolygon.points.at(-1),s=Nc(e.bottomPolygon.points).normalize(),o=r.clone().add(s.clone().multiplyScalar(10)),a=r.clone().sub(s.clone().multiplyScalar(10));return i.setPoints([o,a]),n.enable(),new Promise((l,c)=>{const h=m=>{d(),l()},u=m=>{if(!(m!=null&&m.raycaster))return;const p=so({raycaster:m.raycaster,line:new C.Line3(o,a)});p&&e.setPoints({heightPoint:p})},d=()=>{n.off("select",h),n.off("intersectionUpdate",u),n.off("disable",f),t.remove(i),n.disable()},f=()=>{d(),t.remove(e),c(new Error("Cancelled"))};n.on("select",h),n.on("intersectionUpdate",u),n.on("disable",f)})})}class c6 extends Uc{constructor(n){super(n,()=>({yAxis:n.rectangleMesh.up}))}}class h6 extends C.BufferGeometry{constructor(t){super();v(this,"name","RectangleGeometry");v(this,"points");if(t.length!==4){console.error("Invalid number of points, it's not a rectangle");return}this.points=t.slice(0,4),this.setAttribute("position",new C.BufferAttribute(new Float32Array(this.points.flatMap(i=>i.toArray())),3)),this.setIndex(new C.BufferAttribute(new Uint16Array([0,1,2,0,2,3]),1))}}function u6(e,n){const i=new C.Plane().setFromCoplanarPoints(e[0],e[1],e[2]).projectPoint(n,new C.Vector3);return new C.Vector3().subVectors(n,i).normalize()}class $M extends pd{constructor(t){super(t);v(this,"name","RectangleMesh")}get color(){return this.meshFont.material.color}get builtPoints(){var t,i;return(i=(t=this.meshFont)==null?void 0:t.geometry)==null?void 0:i.points.slice(0,3)}setPoints(t){const i=t.map(Ft).filter(At);if(i.length<3){console.error("Invalid position");return}if(t.length===3){const[r,s,o]=i,a=r.clone().add(o).sub(s);i.push(a)}this.up.copy(u6(i,sn.modules.five.camera.position)),this.points=i,this.geometry=new h6(i),this.planeHelperNeedUpdate=!0,this.geometryInfoNeedUpdate=!0}}class Fl extends $M{constructor(t){const s=t!=null?t:{},{points:i}=s,r=po(s,["points"]);super();v(this,"name","RectangleWithEdgeMesh");v(this,"line",new oo);i&&this.setPoints(i),r&&this.setStyle(r)}get style(){return R(R({},super.style),this.line.style)}get lineWidth(){return this.line.lineWidth}get lineColor(){return this.line.lineColor}setPoints(t){if(super.setPoints(t),this.points){const i=this.points;this.line.setPoints([i[0],i[1],i[2],i[3],i[0]]),this.addIfNotExists(this.line)}}setStyle(t){super.setStyle(t),this.line.setStyle(t)}highlight(){super.highlight(),this.line.highlight()}unhighlight(){super.unhighlight(),this.line.unhighlight()}}const iu=new C.Vector3;class L1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Rectangle");v(this,"rectangleMesh");this.config.canEdit&&(this.editor=new c6(this)),t&&(this.rectangleMesh=new Fl(R(R({},t.style),t)),this.add(this.rectangleMesh))}get data(){return Ee(R({},this.baseData),{points:this.rectangleMesh.builtPoints.map(t=>t.toArray()),style:{color:this.rectangleMesh.color.getHex(),lineWidth:this.rectangleMesh.lineWidth,lineColor:this.rectangleMesh.lineColor.getHex()}})}highlight(){var t;(t=this.rectangleMesh)==null||t.highlight()}unhighlight(){var t;(t=this.rectangleMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.removeChildren();const i=new Fl(t);this.rectangleMesh=i,this.add(this.rectangleMesh),yield eE(this.rectangleMesh,this.pointSelector,t)})}}function eE(e,n,t){return new Promise((i,r)=>{var A,w;const s=e.parent;if(!s)return r(new Error("No container"));const o=(A=t==null?void 0:t.limit)!=null?A:"none",a=(w=t==null?void 0:t.drawMethod)!=null?w:"diagonal",l=new Bl(Ee(R({},e.style),{dashed:!0,lengthEnable:!0})),c=new Bl(Ee(R({},e.style),{dashed:!0,lengthEnable:!1})),h=new Bl(Ee(R({},e.style),{dashed:!1,lengthEnable:!1}));s.add(l,h,c),n.enable();const u=[];let d=new C.Vector3,f=new C.Vector3;const m=new C.Plane,p=()=>{u.push(d.clone()),u.length===1?(o==="xoz"&&m.setFromNormalAndCoplanarPoint(new C.Vector3(0,1,0),u[0]),o==="none"&&m.setFromNormalAndCoplanarPoint(f,u[0])):u.length===2?o==="y"?(y(),i()):h.setPoints([u[0],u[1]]):u.length===3&&(y(),i())},g=x=>{var P;if(!(x!=null&&x.raycaster))return;const M=(P=u.at(-1))==null?void 0:P.clone();if(u.length===0){d=x.point.clone(),f=x.face.normal;return}if(u.length===1&&o==="y"){const T=new C.Line3(new C.Vector3(0,1,0).add(u[0]),new C.Vector3(0,-1,0).add(u[0])).closestPointToPoint(x.point,!1,new C.Vector3);e.setPoints([u[0],T,x.point]);return}if(u.length===1){m?(d=x.raycaster.ray.intersectPlane(m,iu),c.setPoints([d,x.point])):d=x.point.clone(),l.setPoints([M,d]);return}if(u.length===2){s.remove(l);const S=x.raycaster.ray.intersectPlane(m,iu);if(a==="diagonal"){const T=u[0].distanceTo(u[1])/2,z=new C.Vector3().lerpVectors(u[0],u[1],.5),D=new C.Vector3().subVectors(S,z).normalize();d=new C.Vector3().addVectors(z,D.multiplyScalar(T)),e.setPoints([u[0],d,u[1]])}else if(a==="vertex"){const T=iu.crossVectors(u[0].clone().sub(u[1]),m.normal).normalize();d=new C.Line3(u[1].clone().add(T),u[1].clone().sub(T)).closestPointToPoint(x.point,!1,iu),e.setPoints([u[0],u[1],d])}return}},y=()=>{n.off("select",p),n.off("intersectionUpdate",g),n.off("disable",b),n.disable(),s==null||s.remove(l,h,c)},b=()=>{y(),s==null||s.remove(e),r(new Error("Cancelled"))};n.on("select",p),n.on("intersectionUpdate",g),n.on("disable",b)})}class d6 extends Uc{constructor(n){super(n,()=>({yAxis:n.circleMesh.normal}))}}function tE(e){return Math.max(32,Math.min(128,Math.floor(e*40)))}class f6 extends sv{constructor(t){super(t);v(this,"_normal");v(this,"opacityBeforeHighlight");v(this,"highlighted",!1);t!=null&&t.center&&(t!=null&&t.normal)&&(t!=null&&t.radius)&&this.setPoints(t)}get center(){return this.position.clone()}get normal(){return this._normal}set normal(t){this._normal=t}get radius(){return this.meshFont.geometry.parameters.radius}setPoints(t){const i=Ft(t.center),r=Ft(t.normal),s=t.radius,o=tE(s);this.geometry=new C.CircleGeometry(s,o),this.position.copy(i),this.lookAt(r.clone().add(i)),this.normal=r.clone().normalize(),this.needsRender=!0}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.opacity,this.setStyle({opacity:this.opacity*ra}),this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.setStyle({opacity:this.opacityBeforeHighlight}),this.needsRender=!0)}}class vd extends f6{constructor(t){const a=t!=null?t:{},{normal:i,radius:r,center:s}=a,o=po(a,["normal","radius","center"]);super(o);v(this,"edgeLine");this.edgeLine=new Ri(o),this.add(this.edgeLine),i&&r&&s&&this.setPoints({normal:i,radius:r,center:s})}setPoints(...t){super.setPoints(...t);const i=this.meshFont.geometry.vertices.slice(1);this.edgeLine.setPoints(i.concat(i[0]))}setStyle(t){super.setStyle(t),this.edgeLine.setStyle(t)}highlight(){super.highlight(),this.edgeLine.highlight()}unhighlight(){super.unhighlight(),this.edgeLine.unhighlight()}}class k1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Circle");v(this,"circleMesh");this.editor=new d6(this),t&&(this.circleMesh=new vd(R(R({},t.style),t)),this.add(this.circleMesh))}get data(){return Ee(R({},this.baseData),{center:yi(this.applyObjectMatrixWorld(this.circleMesh.center)),normal:yi(this.applyObjectQuaternion(this.circleMesh.normal)),radius:this.circleMesh.radius,style:{color:this.circleMesh.color.getHex()}})}highlight(){var t;(t=this.circleMesh)==null||t.highlight()}unhighlight(){var t;(t=this.circleMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.children.forEach(r=>{r.parent===this&&this.remove(r)}),this.children.length=0;const i=new vd(t);this.circleMesh=i,this.add(this.circleMesh),yield nE(this.circleMesh,this.pointSelector),this.editor.enable()})}}function nE(e,n){return new Promise((t,i)=>{const r=e.parent;if(!r){i(new Error("No container"));return}const s=new oo({dashed:!0});r.add(s),n.enable();let o,a;const l=d=>{if(d){if(!o){o={point:d.point,normal:d.face.normal};return}o&&a&&(h(),t())}},c=d=>{if(!d||!o)return;const f=new C.Plane().setFromNormalAndCoplanarPoint(o.normal,o.point);if(a=d.raycaster.ray.intersectPlane(f,new C.Vector3),a){const m=o.point.distanceTo(a);e.setPoints({center:o.point,normal:o.normal,radius:m})}},h=()=>{n.off("select",l),n.off("intersectionUpdate",c),n.off("disable",u),n.disable(),r==null||r.remove(s)},u=()=>{h(),r==null||r.remove(e,s),i(new Error("Cancelled"))};n.on("select",l),n.on("intersectionUpdate",c),n.on("disable",u)})}class R1 extends ei{constructor(t){super();v(this,"bottomCircle");v(this,"topCircle");v(this,"edgeMesh");v(this,"opacityBeforeHighlight");v(this,"highlighted",!1);v(this,"params");this.params=t,this.bottomCircle=new vd(t),this.bottomCircle.name="bottomCircle",this.topCircle=new vd(t),this.topCircle.name="topCircle",this.edgeMesh=new sv(t),t!=null&&t.bottomCenter&&(t!=null&&t.topCenter)&&(t!=null&&t.radius)&&this.setPoints(t),this.addIfNotExists(this.bottomCircle)}get bottomCenter(){return this.bottomCircle.center}get topCenter(){return this.topCircle.center}get normal(){return this.bottomCircle.normal}get radius(){return this.bottomCircle.radius}get color(){return this.bottomCircle.color}setPoints(t){const i=Ft(t.topCenter),r=Ft(t.bottomCenter),s=i.clone().sub(r).normalize();this.bottomCircle.setPoints({center:r,normal:s,radius:t.radius}),this.setTopCenter(i),this.needsRender=!0}setTopCenter(t){this.addIfNotExists(this.topCircle),this.topCircle.setPoints({center:t,normal:this.normal,radius:this.radius}),this.setEdgeMesh()}setBottomCenter(t){this.addIfNotExists(this.bottomCircle),this.bottomCircle.setPoints({center:t,normal:this.normal,radius:this.radius}),this.setEdgeMesh()}setStyle(t){this.params=R(R({},this.params),t),At(t.color)&&this.bottomCircle.setStyle({color:t.color}),At(t.color)&&this.topCircle.setStyle({color:t.color})}highlight(){this.highlighted||(this.highlighted=!0,this.opacityBeforeHighlight=this.edgeMesh.opacity,this.edgeMesh.setStyle({opacity:this.edgeMesh.opacity*ra}),this.bottomCircle.highlight(),this.topCircle.highlight(),this.needsRender=!0)}unhighlight(){this.highlighted&&(this.highlighted=!1,this.edgeMesh.setStyle({opacity:this.opacityBeforeHighlight}),this.bottomCircle.unhighlight(),this.topCircle.unhighlight(),this.needsRender=!0)}setEdgeMesh(){this.addIfNotExists(this.edgeMesh);const t=this.topCircle.center,i=this.bottomCircle.center;this.edgeMesh.geometry.dispose(),this.edgeMesh.geometry=new C.CylinderGeometry(this.radius,this.radius,t.distanceTo(i),tE(this.radius),1,!0);const r=new C.Quaternion().setFromUnitVectors(new C.Vector3(0,1,0),this.normal.clone().normalize());this.edgeMesh.position.copy(new C.Vector3().lerpVectors(i,t,.5)),this.edgeMesh.quaternion.copy(r)}}class p6 extends Uc{constructor(n){super(n,()=>{const t=()=>{const i=n.cylinderMesh.topCenter,r=n.cylinderMesh.bottomCenter,s=new C.Vector3().lerpVectors(i,r,.5);return{topCenter:i,bottomCenter:r,boxCenter:s}};return{positionFrom:"boundingBox",yAxis:n.cylinderMesh.normal,scaleHelper:{enable:!0,positions:()=>{const i=t();return[{id:"top",handlePosition:i.topCenter,basePosition:i.bottomCenter},{id:"bottom",handlePosition:i.bottomCenter,basePosition:i.topCenter}]},scaleCallback:i=>{const{intersectPoint:r,scalePosition:s}=i,{id:o}=s,{cylinderMesh:a}=n;o==="top"?a.setTopCenter(r):o==="bottom"&&a.setBottomCenter(r)}}}})}}class O1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Cylinder");v(this,"cylinderMesh");this.editor=new p6(this),t&&(this.cylinderMesh=new R1(R(R({},t.style),t)),this.add(this.cylinderMesh))}get data(){return Ee(R({},this.baseData),{bottomCenter:yi(this.applyObjectMatrixWorld(this.cylinderMesh.bottomCenter)),topCenter:yi(this.applyObjectMatrixWorld(this.cylinderMesh.topCenter)),radius:this.cylinderMesh.radius,style:{color:this.cylinderMesh.color.getHex()}})}highlight(){var t;(t=this.cylinderMesh)==null||t.highlight()}unhighlight(){var t;(t=this.cylinderMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.cylinderMesh=new R1(t),this.add(this.cylinderMesh),yield m6(this.cylinderMesh,this.pointSelector),this.editor.enable()})}}function m6(e,n){return ee(this,null,function*(){const t=e.parent;yield nE(e.bottomCircle,n);const i=new Ri;i.name="LineHelper",t.add(i);const r=n.position.point,s=e.normal.clone().normalize(),o=r.clone().add(s.clone().multiplyScalar(10)),a=r.clone().sub(s.clone().multiplyScalar(10));return i.setPoints([o,a]),n.enable(),new Promise((l,c)=>{const h=m=>{d(),l()},u=m=>{if(!(m!=null&&m.raycaster))return;const p=so({raycaster:m.raycaster,line:new C.Line3(o,a)}),y=new C.Plane().setFromNormalAndCoplanarPoint(e.normal,e.bottomCenter).projectPoint(p,new C.Vector3),b=p.clone().sub(y),A=e.bottomCenter.clone().add(b);p&&e.setTopCenter(A)},d=()=>{n.off("select",h),n.off("intersectionUpdate",u),n.off("disable",f),t.remove(i),n.disable()},f=()=>{d(),t.remove(e),c(new Error("Cancelled"))};n.on("select",h),n.on("intersectionUpdate",u),n.on("disable",f)})})}class g6 extends Uc{constructor(n){super(n,()=>{const t=()=>{var o,a;const i=(o=n.boxMesh.topPlane)==null?void 0:o.center,r=(a=n.boxMesh.bottomPlane)==null?void 0:a.center,s=new C.Vector3().lerpVectors(i,r,.5);return{topCenter:i,bottomCenter:r,boxCenter:s}};return{positionFrom:"boundingBox",yAxis:n.boxMesh.bottomPlane.up,scaleHelper:{enable:!0,positions:()=>{const i=t();return[{id:"top",handlePosition:i.topCenter,basePosition:i.bottomCenter},{id:"bottom",handlePosition:i.bottomCenter,basePosition:i.topCenter}]},scaleCallback:i=>{const{intersectPoint:r,scalePosition:s}=i,{id:o}=s,{boxMesh:a}=n;o==="top"?a.setTopHeightPoint(r):o==="bottom"&&a.setPoints({points:a.topPlane.points.map(l=>l.clone().add(r.clone().sub(s.basePosition)))})}}}})}}class z1 extends ei{constructor(t){super();v(this,"name","BoxMesh");v(this,"bottomPlane");v(this,"topPlane");v(this,"heightPoint");v(this,"edgePlanes",[]);this.bottomPlane=new Fl(t),this.topPlane=new Fl(t),this.add(this.bottomPlane),t!=null&&t.points&&this.setPoints(t)}get planes(){return this.children.filter(t=>t instanceof $M)}get color(){var t;return(t=this.bottomPlane)==null?void 0:t.color}get lineColor(){var t;return(t=this.bottomPlane)==null?void 0:t.lineColor}get lineWidth(){var t;return(t=this.bottomPlane)==null?void 0:t.lineWidth}get occlusionVisibility(){var t;return(t=this.bottomPlane)==null?void 0:t.occlusionVisibility}get occlusionMode(){var t;return(t=this.bottomPlane)==null?void 0:t.occlusionMode}setPoints(t){At(t.heightPoint)&&this.setTopHeightPoint(t.heightPoint),At(t.points)&&this.setBottomPoints(t.points)}setBottomPoints(t){const i=t.map(Ft).filter(At);if(i.length<3){console.error("Invalid position");return}this.bottomPlane.setPoints(i),this.heightPoint&&this.setTopHeightPoint(this.heightPoint)}setTopHeightPoint(t){if(!this.bottomPlane.points.length)return;const i=Ft(t);this.heightPoint=i,this.addIfNotExists(this.topPlane);const r=this.bottomPlane.projectPoint(i),s=i.clone().sub(r),o=this.bottomPlane.points.map(a=>a.clone().add(s));this.topPlane.setPoints(o),this.up.copy(s.clone().normalize()),this.setEdgePlanes()}setEdgePlanes(){for(let t=0;t<4;t++){let i=this.edgePlanes[t];i||(this.edgePlanes[t]=new Fl({color:this.color,lineColor:this.lineColor,lineWidth:this.lineWidth,occlusionVisibility:this.occlusionVisibility,occlusionMode:this.occlusionMode}),i=this.edgePlanes[t]);const r=this.topPlane.points,s=this.bottomPlane.points,o=t===3?0:t+1;i.setPoints([r[t],s[t],s[o]]),i.line.setPoints([r[t],s[t]]),this.addIfNotExists(i)}}setStyle(t){this.planes.forEach(i=>i.setStyle(t))}highlight(){this.planes.forEach(t=>t.highlight())}unhighlight(){this.planes.forEach(t=>t.unhighlight())}}class B1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Box");v(this,"boxMesh");this.editor=new g6(this),t&&(this.boxMesh=new z1(R(R({},t.style),t)),this.add(this.boxMesh))}get data(){return Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.boxMesh.bottomPlane.points)),heightPoint:yi(this.applyObjectMatrixWorld(this.boxMesh.heightPoint)),style:{color:this.boxMesh.color.getHex(),lineWidth:this.boxMesh.lineWidth,lineColor:this.boxMesh.lineColor.getHex()}})}highlight(){var t;(t=this.boxMesh)==null||t.highlight()}unhighlight(){var t;(t=this.boxMesh)==null||t.unhighlight()}create(t){return ee(this,null,function*(){this.removeChildren(),this.boxMesh=new z1(t),this.add(this.boxMesh),yield v6(this.boxMesh,this.pointSelector),this.editor.enable()})}}function v6(e,n){return ee(this,null,function*(){return yield eE(e.bottomPlane,n),new Promise((t,i)=>{const r=e.parent;if(!r){i(new Error("No container"));return}const s=new Ri,o=Nc(e.bottomPlane.points).normalize(),a=e.bottomPlane.builtPoints.at(-1),l=a.clone().add(o.clone().multiplyScalar(10)),c=a.clone().sub(o.clone().multiplyScalar(10));s.setPoints([l,c]),r.add(s),n.enable();const h=m=>{d(),t()},u=m=>{if(!(m!=null&&m.raycaster))return;const p=so({raycaster:m.raycaster,line:new C.Line3(l,c)});p&&e.setPoints({heightPoint:p})},d=()=>{n.off("select",h),n.off("intersectionUpdate",u),n.off("disable",f),n.disable(),r==null||r.remove(s)},f=()=>{d(),r==null||r.remove(e),i(new Error("Cancelled"))};n.on("select",h),n.on("intersectionUpdate",u),n.on("disable",f)})})}function y6(e,n){for(let t=e.length-1;t>=0;t--)n(e[t])}const N1=new C.Vector3;class F1 extends Nr{constructor(t,i){super(t,i);v(this,"type","Line");v(this,"lineMesh");v(this,"creatingObject");t&&(this.lineMesh=new Um(R(R({},t.style),t)),this.add(this.lineMesh)),this.editor=new t6(this)}get data(){return Ee(R({},this.baseData),{points:yi(this.applyObjectMatrixWorld(this.lineMesh.points)),style:{lineColor:new C.Color(this.lineMesh.color).getHex(),lineWidth:this.lineMesh.lineWidth,dashed:this.lineMesh.dashed}})}highlight(){var t;(t=this.lineMesh)==null||t.highlight()}unhighlight(){var t;(t=this.lineMesh)==null||t.unhighlight()}canUndo(){var t;(t=this.creatingObject)==null||t.canUndo()}canRedo(){var t;(t=this.creatingObject)==null||t.canRedo()}undo(){var t;(t=this.creatingObject)==null||t.undo()}redo(){var t;(t=this.creatingObject)==null||t.redo()}create(t){return ee(this,null,function*(){this.removeChildren();const i=new Um(t);this.lineMesh=i,this.add(this.lineMesh),this.creatingObject=b6(i,this.pointSelector,t),yield this.creatingObject.finished,this.editor.enable()})}}function b6(e,n,t){var P;const i=e.parent;if(!i)return;const{promise:r,resolve:s,reject:o}=rv(),a=(P=t==null?void 0:t.limit)!=null?P:"none",l=new Ri(e.style);i.add(l);const c=new Ri(Ee(R({},e.style),{dashed:!0,lengthEnable:!1}));i.add(c),n.enable();const h=[];let u,d,f;const m=[],p=()=>h.length>0,g=()=>m.length>0,y=()=>{p()&&(m.push(h.pop()),e.setPoints(h),w(f),n.pointSelectorHelper.magnifier.render())},b=()=>{g()&&(h.push(m.pop()),e.setPoints(h),w(f),n.pointSelectorHelper.magnifier.render())},A=S=>{m.length=0;const T=h.length===0?S.point:u.clone();h.push(T),e.setPoints(h),h.length===2&&(x(),s())},w=S=>{const T=()=>{l.setPoints([]),c.setPoints([]),n.pointSelectorHelper.magnifier.render()};if(!(h!=null&&h.length)||!S)return T();f=S;const z=h.at(-1).clone();a==="none"?(u=S.point,l.setPoints([z,u])):a==="xoz"?(n.plane=d,d=d!=null?d:new C.Plane().setFromNormalAndCoplanarPoint(new C.Vector3(0,1,0),h[0]),u=d.projectPoint(S.point,N1),l.setPoints([z,u]),c.setPoints([u,S.point])):a==="y"&&(S.isVirtual?(u=so({raycaster:S.raycaster,line:new C.Line3(h[0].clone(),new C.Vector3(0,1,0).add(h[0])),clampToLine:!1}),c.setPoints([])):(u=new C.Line3(h[0].clone(),new C.Vector3(0,1,0).add(h[0])).closestPointToPoint(S.point,!1,N1),c.setPoints([u,S.point])),l.setPoints([z,u]))},x=()=>{n.off("select",A),n.off("intersectionUpdate",w),n.off("disable",M),n.plane=null,n.disable(),i==null||i.remove(l,c)},M=()=>{x(),h.length!==2&&(i==null||i.remove(e)),o(new Error("Cancelled"))};return n.on("select",A),n.on("intersectionUpdate",w),n.on("disable",M),{finished:r,canUndo:p,canRedo:g,undo:y,redo:b}}const Jo=class extends Cn{constructor(t,i){super();v(this,"group");v(this,"theme");v(this,"five");v(this,"creatingItem",null);v(this,"undo",()=>{var t;console.log("undo"),(t=this.creatingItem)==null||t.undo(),this.five.needsRender=!0});v(this,"redo",()=>{var t;console.log("redo"),(t=this.creatingItem)==null||t.redo(),this.five.needsRender=!0});this.five=t,this.theme=i,this.group=new ei,this.group.name="Sculpt",t.scene.add(this.group),Jo.modules.init(t),ri("ctrl+z",this.undo),ri("ctrl+shift+z",this.redo),Jo.modules.fiveDomEvents.addEventListener(this.group,"click",({intersects:r,origDomEvent:s})=>{var a;const o=WM((a=r==null?void 0:r[0])==null?void 0:a.object,l=>l.isSculptObject);return o?this.emit("click",s,o):!1}),window.__SCULPT_DEBUG__=this,window.__SCULPT_MODULES_DEBUG__=Jo.modules}get data(){return{items:this.items.map(t=>{try{return t.data}catch(i){return console.error(i),null}}).filter(At)}}get items(){return this.group.children}load(t,i){var s;this.clear();const r=(s=t==null?void 0:t.items)==null?void 0:s.map(o=>{var l;const a=Ee(R({},o),{style:R(R({},(l=this.theme)==null?void 0:l[o.type.toLowerCase()]),o.style)});return o.type==="Point"?new _1(a,i):o.type==="line"?new F1(a,i):o.type==="Polyline"?new P1(a,i):o.type==="Polygon"?new T1(a,i):o.type==="Prism"?new D1(a,i):o.type==="Rectangle"?new L1(a,i):o.type==="Circle"?new k1(a,i):o.type==="Cylinder"?new O1(a,i):o.type==="Box"?new B1(a,i):null});this.group.add(...r),this.five.needsRender=!0}getItemById(t){return this.items.find(i=>i.uuid===t)}putObject(t){var s;this.group.add(t);const i=Jo.modules.object3DHelper,r=i.addObject3DHelper(t);return(s=r==null?void 0:r.moveController)==null||s.moveByMouse(),i}createPoint(t){return ee(this,null,function*(){var i;return this.createItem(_1,R(R({},(i=this.theme)==null?void 0:i.point),t))})}createline(t){return ee(this,null,function*(){var i;return this.createItem(F1,R(R({},(i=this.theme)==null?void 0:i.line),t))})}createPolyline(t){return ee(this,null,function*(){var i;return this.createItem(P1,R(R({},(i=this.theme)==null?void 0:i.polyline),t))})}createPolygon(t){return ee(this,null,function*(){var i;return this.createItem(T1,R(R({},(i=this.theme)==null?void 0:i.polygon),t))})}createPrism(t){return ee(this,null,function*(){var i;return this.createItem(D1,R(R({},(i=this.theme)==null?void 0:i.prism),t))})}createRectangle(t){return ee(this,null,function*(){var i;return this.createItem(L1,R(R({},(i=this.theme)==null?void 0:i.rectangle),t))})}createCircle(t){return ee(this,null,function*(){var i;return this.createItem(k1,R(R({},(i=this.theme)==null?void 0:i.circle),t))})}createCylinder(t){return ee(this,null,function*(){var i;return this.createItem(O1,R(R({},(i=this.theme)==null?void 0:i.cylinder),t))})}createBox(t){return ee(this,null,function*(){var i;return this.createItem(B1,R(R({},(i=this.theme)==null?void 0:i.box),t))})}canUndo(){var t;return this.creatingItem?(t=this.creatingItem)==null?void 0:t.canUndo():!1}canRedo(){var t;return this.creatingItem?(t=this.creatingItem)==null?void 0:t.canRedo():!1}clear(){y6(this.items,t=>t.delete()),this.five.needsRender=!0}createItem(t,...i){return ee(this,null,function*(){this.creatingItem&&(this.creatingItem.stopCreating(),this.creatingItem=null);const r=new t;return this.creatingItem=r,this.group.add(r),yield r.create(...i).then((...s)=>(this.creatingItem=null,s)).catch(s=>{console.error(s),this.group.remove(r)}),r})}};let sn=Jo;v(sn,"modules",UM);const A6=e=>new sn(e);function w6(e,...n){n.forEach(t=>{e.children.includes(t)||t&&e.add(t)})}let ru;const iE=e=>((!ru||e!==ru.five)&&(ru={instance:new Zg(e,{noEmitWhenHide:!0,noEmitWhenNotInScene:!0}),five:e}),ru.instance);class rE extends Cn{constructor(t){var r,s;super();v(this,"type");v(this,"tag");v(this,"rawData");v(this,"model");v(this,"five");v(this,"group");v(this,"fiveDomEvents");this.five=t.five,this.model=t.model,this.group=t.group,this.type=t.type,this.rawData=t.rawData,this.fiveDomEvents=iE(this.five);const i=(s=(r=t.position)!=null?r:this.model.center)!=null?s:Ga(this.model).getCenter(new C.Vector3);this.tag=j3(this.five,i,{wrapper:t.tagWrapper})}get container(){return this.tag.container}get state(){return{visible:this.model.visible,enabled:this.group.children.includes(this.model)}}show(){this.tag.show(),this.model.visible=!0,this.five.needsRender=!0,this.emit("show")}hide(){this.tag.hide(),this.model.visible=!1,this.five.needsRender=!0,this.emit("hide")}enable(){w6(this.group,this.model),this.five.needsRender=!0,this.model.updateMatrixWorld(!0),this.tag.setTransformMatrix(this.model.matrixWorld),this.tag.enable();const t=this.onClick.bind(this);this.fiveDomEvents.addEventListener(this.model,"click",t),this.emit("enable")}disable(){this.group.remove(this.model),this.five.needsRender=!0,this.tag.disable(),this.fiveDomEvents.removeEventListener(this.model,"click"),this.emit("disable")}onClick(){return this.emit("click",this)}}class sE extends rE{constructor(...t){super(...t);v(this,"hideTag",()=>{this.tag.hide()});this.enable(),this.tag.hide()}enable(){super.enable(),this.five.on("mode.change.request",this.hideTag),this.five.on("pano.request",this.hideTag)}disable(){super.disable(),this.five.off("mode.change.request",this.hideTag),this.five.off("pano.request",this.hideTag)}show(){this.model.visible=!0,this.five.needsRender=!0}onClick(){return this.tag.visible?this.tag.hide():this.tag.show(),super.onClick(),!0}}class x6 extends sE{constructor(...n){super(...n)}}function M6(e){Ue(e,"svelte-1q9fx3x",".model-maker-tag.svelte-1q9fx3x{position:absolute;width:-moz-max-content;width:max-content;left:50%;top:50%;transform:translate(-50%, -50%);color:#fff;font-size:0.875rem;font-weight:bold;text-shadow:0.125rem 0 0.5rem rgba(0, 0, 0, 0.15)}")}function V1(e){let n,t;return{c(){n=H("div"),t=xt(e[0]),_(n,"class","model-maker-tag svelte-1q9fx3x")},m(i,r){Z(i,n,r),Q(n,t)},p(i,r){r&1&&Ct(t,i[0])},d(i){i&&Y(n)}}}function E6(e){let n,t=e[0]&&V1(e);return{c(){t&&t.c(),n=ft()},m(i,r){t&&t.m(i,r),Z(i,n,r)},p(i,[r]){i[0]?t?t.p(i,r):(t=V1(i),t.c(),t.m(n.parentNode,n)):t&&(t.d(1),t=null)},i:de,o:de,d(i){t&&t.d(i),i&&Y(n)}}}function C6(e,n,t){let{text:i}=n;return e.$$set=r=>{"text"in r&&t(0,i=r.text)},[i]}class P6 extends ke{constructor(n){super(),Le(this,n,C6,E6,De,{text:0},M6)}}const G1=(e,n)=>{var i;const t=new P6({target:e,props:{text:(i=n.rawData)==null?void 0:i.name}});return()=>t.$destroy()},_6=(e,n)=>{var i;const t=new HM({target:e,props:{content:(i=n.rawData)==null?void 0:i.name}});return()=>t.$destroy()},S6={box:G1,triangles:G1,prism:_6};class I6 extends rE{constructor(...n){const t=n[0],i=Ga(t.model),r=new C.Vector3().lerpVectors(Cr(i,0),Cr(i,5),.5);super(Ee(R({},t),{position:r})),this.enable()}}class T6 extends Br{constructor(t,i){var r,s;super(t);v(this,"state");v(this,"items",[]);v(this,"group",new C.Group);v(this,"data");v(this,"tagRendererMap",{});v(this,"fiveDomEvents");v(this,"zFightingOffset",0);v(this,"tagWrapper");v(this,"occlusionVisibility");v(this,"occlusionMode");v(this,"onFiveModeChange",t=>{const i=this.occlusionVisibility;Array.isArray(i)&&this.items.forEach(r=>{r.model.setStyle instanceof Function&&r.model.setStyle({occlusionVisibility:i.includes(t)})})});v(this,"handleEnable",()=>{var t,i;this.five.scene.add(this.group),(i=(t=this.five.getElement())==null?void 0:t.parentElement)==null||i.appendChild(this.tagWrapper),this.five.needsRender=!0,this.onFiveModeChange(this.five.getCurrentState().mode),this.five.on("modeChange",this.onFiveModeChange)});v(this,"handleDisable",()=>{this.five.scene.remove(this.group),this.tagWrapper.remove(),this.five.needsRender=!0,this.five.off("modeChange",this.onFiveModeChange)});v(this,"updateTagRenderer",()=>{this.items.forEach(t=>{var r;const i=(r=this.tagRendererMap[t.type])!=null?r:S6[t.type];i&&t.__renderer!==i&&(t.__renderer=i,typeof t.__disposeRenderer=="function"&&t.__disposeRenderer(),t.tag.container.innerHTML="",t.__disposeRenderer=i(t.tag.container,t))})});this.group.name="ModelMakerPluginGroup",this.state={enabled:!0,visible:!0},this.occlusionVisibility=(r=i==null?void 0:i.occlusionVisibility)!=null?r:!1,this.occlusionMode=(s=i==null?void 0:i.occlusionMode)!=null?s:"translucence",this.fiveDomEvents=iE(t),this.tagWrapper=(()=>{var a;const o=document.createElement("div");return o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.pointerEvents="none",o.style.zIndex=`${(a=i==null?void 0:i.tagContainerZIndex)!=null?a:""}`,o})(),t.scene.add(this.group),this.handleEnable(),window.__MODELMAKER_DEBUG__=this}load(t){return ee(this,null,function*(){var o;if(this.clear(),this.data=t,yield Ha(this.five),this.data!==t)return;this.clear();const i=typeof this.occlusionVisibility=="boolean"?this.occlusionVisibility:!1,r=this.occlusionMode,s=1.6;(o=t==null?void 0:t.list)==null||o.forEach(a=>{var l,c,h;if(a.type==="triangles"){const u=new md;u.setPoints(a.object_data.points),u.setStyle({color:a.object_data.color,opacity:((l=a.object_data.opacity)!=null?l:.4)/2,lineColor:a.object_data.color,lineWidth:s,occlusionVisibility:i,occlusionMode:r}),this.fiveDomEvents.addEventListener(u,"hover",()=>u.highlight()),this.fiveDomEvents.addEventListener(u,"unHover",()=>u.unhighlight());const d=new sE({five:this.five,tagWrapper:this.tagWrapper,model:u,group:this.group,type:a.type,rawData:a});this.items.push(d)}else if(a.type==="prism"){const u=new gd;this.zFightingOffset+=1e-4;const d=a.object_data.points.map(g=>{var y;return[g[0],g[1]+((y=a.object_data.fixedY)!=null?y:0),g[2]]});d.push(d[0]);const f=a.object_data.height+((c=a.object_data.fixedHeight)!=null?c:0)+this.zFightingOffset,m=Ft(d[0]).add(new C.Vector3().setY(f));u.setPoints({points:d,heightPoint:m}),u.setStyle({color:a.object_data.color,opacity:((h=a.object_data.opacity)!=null?h:.4)/2,lineColor:a.object_data.color,lineWidth:s,occlusionVisibility:i,occlusionMode:r});const p=new I6({five:this.five,tagWrapper:this.tagWrapper,model:u,group:this.group,type:a.type,rawData:a});this.items.push(p)}else if(a.type==="box"){const u=new gd,{start:d,end:f,rotation:m=[0,0,0,0],opacity:p,color:g}=a.object_data,y=new C.Vector3().fromArray(d),b=new C.Vector3().fromArray(f),A=new C.Euler().fromArray(m),w=new C.Quaternion().setFromEuler(A),x=w.clone().inverse(),M=new C.Vector3().lerpVectors(y,b,.5),P=M.clone().negate(),S=y.clone().add(P).applyQuaternion(x),T=b.clone().add(P).applyQuaternion(x),z=new C.Box3(S.clone().max(T),S.clone().min(T));u.setPoints({points:[Cr(z,2),Cr(z,3),Cr(z,7),Cr(z,6),Cr(z,2)],heightPoint:Cr(z,0)}),u.position.copy(M),u.quaternion.copy(w),u.setStyle({color:g,opacity:(p!=null?p:.4)/2,lineColor:g,lineWidth:s,occlusionVisibility:i,occlusionMode:r});const D=new x6({five:this.five,tagWrapper:this.tagWrapper,model:u,group:this.group,type:a.type,rawData:a});this.items.push(D)}}),this.five.needsRender=!0,this.state.enabled?this.handleEnable():this.handleDisable(),this.state.visible?this.handleShow():this.handleHide(),this.updateTagRenderer(),this.hooks.emit("dataLoaded",t)})}setState(t){At(t.enabled)&&this.state.enabled!==t.enabled&&(this.state.enabled=t.enabled,t.enabled?this.handleEnable():this.handleDisable(),this.hooks.emit(t.enabled?"enable":"disable",{userAction:"我不知道捏"}),this.hooks.emit("stateChange",{state:this.state,userAction:"我不知道捏"})),At(t.visible)&&this.state.visible!==t.visible&&(this.state.visible=t.visible,t.visible?this.handleShow():this.handleHide(),this.hooks.emit(t.visible?"show":"hide",{userAction:"我不知道捏"}),this.hooks.emit("stateChange",{state:this.state,userAction:"我不知道捏"}))}getItemById(t){return this.items.find(i=>i.rawData.id===t)}registerTagRenderer(t){this.tagRendererMap=R(R({},this.tagRendererMap),t),this.updateTagRenderer()}hasCustomTagRenderer(t){return!!this.tagRendererMap[t]}enable(){this.setState({enabled:!0})}disable(){this.setState({enabled:!1})}show(){this.setState({visible:!0})}hide(){this.setState({visible:!1})}clear(){this.zFightingOffset=0,this.handleDisable(),this.group.children.length=0,this.five.needsRender=!0,this.items=[],this.tagWrapper.innerHTML="",this.fiveDomEvents.clear()}dispose(){this.hooks.emit("dispose"),this.clear()}onWorkCodeChange(){this.group.matrix.copy(this.workUtil.transform.clone()),this.group.matrix.decompose(this.group.position,this.group.quaternion,this.group.scale),this.group.updateMatrixWorld()}handleShow(){this.group.visible=!0,this.tagWrapper.style.visibility="visible",this.five.needsRender=!0}handleHide(){this.group.visible=!1,this.tagWrapper.style.visibility="hidden",this.five.needsRender=!0}}const D6=(...e)=>new T6(...e);fE();dE();exports.AreaMakerPlugin=z8;exports.CSS3DRender=Ia;exports.CSS3DRenderPlugin=Bc;exports.CameraMovementEffect=Lx;exports.CameraMovementPlugin=Qk;exports.ContentType=kM;exports.CruisePlugin=AV;exports.CruisePluginController=Vc;exports.CruisePluginTypes=bV;exports.CurrentPanoImagePlugin=N8;exports.DIRECTION=Yo;exports.DISPLAY_STRATEGY_TYPE=Bs;exports.DimensionType=RM;exports.FLOOR_PLAN_ATTACHED_TO=ss;exports.FLOOR_TYPE_MAP=zk;exports.GuideLineItem=gV;exports.GuideLineModeItem=cV;exports.GuideLinePlugin=qg;exports.ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE=Ns;exports.ItemLabelPlugin=H4;exports.Magnifier=Ad;exports.MapviewFloorplanPlugin=uk;exports.ModelChassisCompassPlugin=Fk;exports.ModelEntryDoorGuidePlugin=jk;exports.ModelFloorplanPlugin=ak;exports.ModelItemLabelPlugin=w4;exports.ModelMakerPlugin=D6;exports.ModelRoomLabelPlugin=vD;exports.ModelTVVideoPlugin=P4;exports.ModelViewPlugin=IE;exports.MoveController=Jg;exports.MovePlugin=wV;exports.Object3DHelperController=ev;exports.Object3DHelperPlugin=r8;exports.PLUGIN=Gd;exports.PaintBrush=SE;exports.PaintBrushTypeEnum=wr;exports.PanoCompassPlugin=p5;exports.PanoCursorRaycasterPlugin=_T;exports.PanoDoorLabelPlugin=nO;exports.PanoFloorplanRadarPlugin=Rk;exports.PanoMeasurePlugin=XR;exports.PanoMeasurePluginLine=to;exports.PanoMeasurePluginModel=Rg;exports.PanoMeasurePluginPoint=ii;exports.PanoMeasurePluginPolyline=no;exports.PanoRulerPlugin=Kk;exports.PanoRulerProPlugin=c5;exports.PanoSpatialTagPlugin=c4;exports.PanoTagPlugin=eV;exports.PanoTagPluginController=fd;exports.PanoVideoPlugin=h8;exports.PanoVideoPluginType=c8;exports.PipelinePlugin=_8;exports.PointType=LM;exports.ROOM_FETILE_TYPE_MAP=Ok;exports.ROOM_TYPE_MAP=Bk;exports.Rotation=Yi;exports.Sculpt=sn;exports.SculptPlugin=A6;exports.TopviewFloorplanPlugin=fk;exports.Util=mT;exports.WalkController=Vc;exports.defaultGlobalConfig=DM;exports.itemLabelPluginServerParams=U4;exports.modelItemLabelPluginServerParams=x4;exports.modelRoomLabelPluginServerParams=yD;exports.pluginFlag=$F;