@realsee/dnalogel
Version:
101 lines (88 loc) • 1.1 MB
JavaScript
"use strict";var mm=Object.defineProperty,pm=Object.defineProperties;var Am=Object.getOwnPropertyDescriptors;var co=Object.getOwnPropertySymbols;var ic=Object.prototype.hasOwnProperty,nc=Object.prototype.propertyIsEnumerable;var ca=(n,t,e)=>t in n?mm(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,D=(n,t)=>{for(var e in t||(t={}))ic.call(t,e)&&ca(n,e,t[e]);if(co)for(var e of co(t))nc.call(t,e)&&ca(n,e,t[e]);return n},oe=(n,t)=>pm(n,Am(t));var ms=(n,t)=>{var e={};for(var i in n)ic.call(n,i)&&t.indexOf(i)<0&&(e[i]=n[i]);if(n!=null&&co)for(var i of co(n))t.indexOf(i)<0&&nc.call(n,i)&&(e[i]=n[i]);return e};var d=(n,t,e)=>(ca(n,typeof t!="symbol"?t+"":t,e),e);var G=(n,t,e)=>new Promise((i,s)=>{var o=l=>{try{a(e.next(l))}catch(c){s(c)}},r=l=>{try{a(e.throw(l))}catch(c){s(c)}},a=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,r);a((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Le=require("@realsee/five"),_=require("three"),Ro=require("three/examples/jsm/renderers/CSS3DRenderer"),lr=require("hammerjs"),Ho=require("animejs"),js=require("@realsee/five/line"),Uu=require("three/examples/jsm/loaders/FBXLoader"),vm=require("earcut"),bm=require("@realsee/five/gltf-loader");function ym(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const w=ym(_);function wm(){console.debug("%c %c@realsee/dnalogel %cv3.30.4",["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 Cm(){const n=typeof OffscreenCanvas!="undefined",t=n&&new OffscreenCanvas(1,1).getContext("webgl")!==null;n&&!t&&Object.assign(window,{OffscreenCanvas:function(e,i){const s=document.createElement("canvas");return s.width=e,s.height=i,s}})}function Yu(){}const sc=()=>Promise.resolve(),oc={__queue:Promise.resolve()};function Pm(n=sc){oc.__queue=oc.__queue.then(n).catch(sc)}function ho(n,t,e){const i=n.x,s=n.y,o=Math.floor(i/t*1e4)/1e4,r=Math.floor(s/e*1e4)/1e4;return{x:o,y:r}}function ha(n,t,e){const{x:i,y:s}=n,o=i*t,r=s*e;return{x:o,y:r}}function uo(n){if(n.length<2)return{};const t=n.slice(-2),e=t[0],i={x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2};return{control:e,end:i}}function Im(n,t,e=Yu){new Promise(i=>{setTimeout(()=>{e(),i(!0)},t*n)})}const Em=window,rc=window.requestAnimationFrame||Em.webkitRequestAnimationFrame||(n=>setTimeout(n,16));function Lo(n,t=0){t<=0?rc(n):rc(()=>Lo(n,t-1))}var Nt=Object.freeze({Linear:Object.freeze({None:function(n){return n},In:function(n){return this.None(n)},Out:function(n){return this.None(n)},InOut:function(n){return this.None(n)}}),Quadratic:Object.freeze({In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}}),Cubic:Object.freeze({In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}}),Quartic:Object.freeze({In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}}),Quintic:Object.freeze({In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}}),Sinusoidal:Object.freeze({In:function(n){return 1-Math.sin((1-n)*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.sin(Math.PI*(.5-n)))}}),Exponential:Object.freeze({In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}}),Circular:Object.freeze({In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}}),Elastic:Object.freeze({In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(n){var t=1.70158;return n===1?1:n*n*((t+1)*n-t)},Out:function(n){var t=1.70158;return n===0?0:--n*n*((t+1)*n+t)+1},InOut:function(n){var t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}}),Bounce:Object.freeze({In:function(n){return 1-Nt.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?Nt.Bounce.In(n*2)*.5:Nt.Bounce.Out(n*2-1)*.5+.5}}),generatePow:function(n){return n===void 0&&(n=4),n=n<Number.EPSILON?Number.EPSILON:n,n=n>1e4?1e4:n,{In:function(t){return Math.pow(t,n)},Out:function(t){return 1-Math.pow(1-t,n)},InOut:function(t){return t<.5?Math.pow(t*2,n)/2:(1-Math.pow(2-t*2,n))/2+.5}}}}),Mn=function(){return performance.now()},Xu=function(){function n(){this._tweens={},this._tweensAddedDuringUpdate={}}return n.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(e){return t._tweens[e]})},n.prototype.removeAll=function(){this._tweens={}},n.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},n.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},n.prototype.update=function(t,e){t===void 0&&(t=Mn()),e===void 0&&(e=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var s=0;s<i.length;s++){var o=this._tweens[i[s]],r=!e;o&&o.update(t,r)===!1&&!e&&delete this._tweens[i[s]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},n}(),_i={Linear:function(n,t){var e=n.length-1,i=e*t,s=Math.floor(i),o=_i.Utils.Linear;return t<0?o(n[0],n[1],i):t>1?o(n[e],n[e-1],e-i):o(n[s],n[s+1>e?e:s+1],i-s)},Bezier:function(n,t){for(var e=0,i=n.length-1,s=Math.pow,o=_i.Utils.Bernstein,r=0;r<=i;r++)e+=s(1-t,i-r)*s(t,r)*n[r]*o(i,r);return e},CatmullRom:function(n,t){var e=n.length-1,i=e*t,s=Math.floor(i),o=_i.Utils.CatmullRom;return n[0]===n[e]?(t<0&&(s=Math.floor(i=e*(1+t))),o(n[(s-1+e)%e],n[s],n[(s+1)%e],n[(s+2)%e],i-s)):t<0?n[0]-(o(n[0],n[0],n[1],n[1],-i)-n[0]):t>1?n[e]-(o(n[e],n[e],n[e-1],n[e-1],i-e)-n[e]):o(n[s?s-1:0],n[s],n[e<s+1?e:s+1],n[e<s+2?e:s+2],i-s)},Utils:{Linear:function(n,t,e){return(t-n)*e+n},Bernstein:function(n,t){var e=_i.Utils.Factorial;return e(n)/e(t)/e(n-t)},Factorial:function(){var n=[1];return function(t){var e=1;if(n[t])return n[t];for(var i=t;i>1;i--)e*=i;return n[t]=e,e}}(),CatmullRom:function(n,t,e,i,s){var o=(e-n)*.5,r=(i-t)*.5,a=s*s,l=s*a;return(2*t-2*e+o+r)*l+(-3*t+3*e-2*o-r)*a+o*s+t}}},al=function(){function n(){}return n.nextId=function(){return n._nextId++},n._nextId=0,n}(),Na=new Xu,cr=function(){function n(t,e){e===void 0&&(e=Na),this._object=t,this._group=e,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=Nt.Linear.None,this._interpolationFunction=_i.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=al.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return n.prototype.getId=function(){return this._id},n.prototype.isPlaying=function(){return this._isPlaying},n.prototype.isPaused=function(){return this._isPaused},n.prototype.getDuration=function(){return this._duration},n.prototype.to=function(t,e){if(e===void 0&&(e=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=t,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},n.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},n.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},n.prototype.start=function(t,e){if(t===void 0&&(t=Mn()),e===void 0&&(e=!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=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var s={};for(var o in this._valuesEnd)s[o]=this._valuesEnd[o];this._valuesEnd=s}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},n.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},n.prototype._setupProperties=function(t,e,i,s,o){for(var r in i){var a=t[r],l=Array.isArray(a),c=l?"array":typeof a,h=!l&&Array.isArray(i[r]);if(!(c==="undefined"||c==="function")){if(h){var u=i[r];if(u.length===0)continue;for(var f=[a],g=0,A=u.length;g<A;g+=1){var p=this._handleRelativeValue(a,u[g]);if(isNaN(p)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(p)}h&&(i[r]=f)}if((c==="object"||l)&&a&&!h){e[r]=l?[]:{};var m=a;for(var b in m)e[r][b]=m[b];s[r]=l?[]:{};var u=i[r];if(!this._isDynamic){var y={};for(var b in u)y[b]=u[b];i[r]=u=y}this._setupProperties(m,e[r],u,s[r],o)}else(typeof e[r]=="undefined"||o)&&(e[r]=a),l||(e[r]*=1),h?s[r]=i[r].slice().reverse():s[r]=e[r]||0}}},n.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},n.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},n.prototype.pause=function(t){return t===void 0&&(t=Mn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},n.prototype.resume=function(t){return t===void 0&&(t=Mn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},n.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},n.prototype.group=function(t){return t===void 0&&(t=Na),this._group=t,this},n.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},n.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},n.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},n.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},n.prototype.easing=function(t){return t===void 0&&(t=Nt.Linear.None),this._easingFunction=t,this},n.prototype.interpolation=function(t){return t===void 0&&(t=_i.Linear),this._interpolationFunction=t,this},n.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},n.prototype.onStart=function(t){return this._onStartCallback=t,this},n.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},n.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},n.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},n.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},n.prototype.onStop=function(t){return this._onStopCallback=t,this},n.prototype.update=function(t,e){var i=this,s;if(t===void 0&&(t=Mn()),e===void 0&&(e=!0),this._isPaused)return!0;var o,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)return!1;e&&this.start(t,!0)}if(this._goToEnd=!1,t<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=t-this._startTime,l=this._duration+((s=this._repeatDelayTime)!==null&&s!==void 0?s:this._delayTime),c=this._duration+this._repeat*l,h=function(){if(i._duration===0||a>c)return 1;var m=Math.trunc(a/l),b=a-m*l,y=Math.min(b/i._duration,1);return y===0&&a===i._duration?1:y},u=h(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||a>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var A=0,p=this._chainedTweens.length;A<p;A++)this._chainedTweens[A].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},n.prototype._updateProperties=function(t,e,i,s){for(var o in i)if(e[o]!==void 0){var r=e[o]||0,a=i[o],l=Array.isArray(t[o]),c=Array.isArray(a),h=!l&&c;h?t[o]=this._interpolationFunction(a,s):typeof a=="object"&&a?this._updateProperties(t[o],r,a,s):(a=this._handleRelativeValue(r,a),typeof a=="number"&&(t[o]=r+(a-r)*s))}},n.prototype._handleRelativeValue=function(t,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?t+parseFloat(e):parseFloat(e)},n.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=e},n}(),Mm="23.1.1",km=al.nextId,ei=Na,xm=ei.getAll.bind(ei),Dm=ei.removeAll.bind(ei),Sm=ei.add.bind(ei),Zu=ei.remove.bind(ei),Tm=ei.update.bind(ei),ac={Easing:Nt,Group:Xu,Interpolation:_i,now:Mn,Sequence:al,nextId:km,Tween:cr,VERSION:Mm,getAll:xm,removeAll:Dm,add:Sm,remove:Zu,update:Tm};function Lm(n,t,e,i=Nt.Linear.None){const s=new cr(n).to(t,e).easing(i).start();function o(r){s.update(r)&&requestAnimationFrame(o)}return requestAnimationFrame(o),s}var hi=(n=>(n.Drawline="Drawline",n.Undo="Undo",n.Exit="Exit",n))(hi||{});const Es=Symbol("$$PAINT_BRUSH_EVENT$$");function fo(n){return n[Es]||(n[Es]={}),n[Es]}function jm(n){n[Es]||delete n[Es]}let zm=class{hasListener(t){const e=fo(this);return e&&e[t]&&e[t].length>0}on(t,e,i){const s=fo(this);return s[t]||(s[t]=[]),s[t].push([e,i||!1]),()=>this.off(t,e)}once(t,e){return this.on(t,e,!0)}off(t,e){if(t===void 0){jm(this);return}const i=fo(this);if(i[t]||(i[t]=[]),e===void 0){i[t].length=0;return}let s=0;for(;s<i[t].length&&i[t][s][0]!==e;s++);s<i[t].length&&i[t].splice(s,1)}emit(t,...e){let i=!1;const o=fo(this)[t]||[];for(let r of o.slice()){const[a,l=!1]=r,c=a(...e);l&&this.off(t,a),c===!1&&(i=!0)}return i}};function Ci(){return((1+Math.random())*65536|0).toString(16).substring(1)}function st(){return(Ci()+Ci()+"-"+Ci()+"-4"+Ci().substr(0,3)+"-"+Ci()+"-"+Ci()+Ci()+Ci()).toLowerCase()}const Om=`
<style type="text/css">
#_gl_paintBrush {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
transform: translateZ(0);
z-index: 1997;
pointer-events: none;
opacity: 0;
transition: all 500ms;
}
#_gl_paintBrush.brushing {
opacity: 1;
}
#_gl_paintBrush ._paintBrush-canvas {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
#_gl_paintBrush ._paintBrush-canvas--sync {
pointer-events: none;
z-index: 0;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
#_gl_paintBrush ._paintBrush-canvas {
pointer-events: none;
z-index: 1;
}
#_gl_paintBrush.brushing ._paintBrush-canvas {
pointer-events: auto;
}
#_gl_paintBrush ._paintBrush-ctrl {
width: 140px;
height: 52px;
position: absolute;
bottom: 28px;
right: 50%;
transform: translateX(50%);
font-size: 10px;
color: white;
z-index: 2;
}
#_gl_paintBrush.brushing ._paintBrush-ctrl {
pointer-events: auto;
}
#_gl_paintBrush ._paintBrush-ctrl ._paintBrush-ctrlinner {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
height: 100%;
border-radius: 26px;
padding: 8px 16px;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2);
background-image: linear-gradient(180deg, hsl(0deg 0% 0% / 57%), hsl(0deg 0% 0% / 70%) 117%);
}
._paintBrush-ctrlitem {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 38px;
height: 38px;
cursor: pointer;
}
._paintBrush-ctrlitem--undo >.brush-icon{
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjJweCIgaGVpZ2h0PSIyMnB4IiB2aWV3Qm94PSIwIDAgMjIgMjIiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgeDE9IjUwJSIgeTE9IjQ1LjY3NTI0OCUiIHgyPSItMTYuOTYxMDIzJSIgeTI9Ijg0LjIzODQxOTglIiBpZD0ibGluZWFyR3JhZGllbnQtMSI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGRkZGRkYiIG9mZnNldD0iMCUiPjwvc3RvcD4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0ZGRkZGRiIgc3RvcC1vcGFjaXR5PSIwLjMwMzY3Njc5MiIgb2Zmc2V0PSIxMDAlIj48L3N0b3A+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxnIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNDAuMDAwMDAwLCAtNzQwLjAwMDAwMCkiPgogICAgICAgICAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNDAuMDAwMDAwLCA3NDAuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8cmVjdCBmaWxsPSIjRDhEOEQ4IiBvcGFjaXR5PSIwIiB4PSIwIiB5PSIwIiB3aWR0aD0iMjIiIGhlaWdodD0iMjIiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDQuMDAwMDAwLCAyLjk5MDY1OSkiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIj4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMCwzLjc1ODc1NzA5IEw5Ljg0Mzc1LDMuNzU4NzU3MDkgQzEyLjY5MTQ2ODIsMy43NTg3NTcwOSAxNSw2LjA2NzI4ODg1IDE1LDguOTE1MDA3MDkgQzE1LDExLjc2MjcyNTMgMTIuNjkxNDY4MiwxNC4wNzEyNTcxIDkuODQzNzUsMTQuMDcxMjU3MSBMMSwxNC4wNzEyNTcxIiBzdHJva2U9InVybCgjbGluZWFyR3JhZGllbnQtMSkiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cG9seWxpbmUgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBwb2ludHM9IjMuNzkwMjI3MDcgNy41Mzk2NjA2NCAwIDMuNzU4NzU3MDkgMy43OTAyMjcwNyAwIj48L3BvbHlsaW5lPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);
background-size: 100%;
width: 22px;
height: 22px;
}
._paintBrush-ctrlitem--close >.brush-icon {
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjJweCIgaGVpZ2h0PSIyMnB4IiB2aWV3Qm94PSIwIDAgMjIgMjIiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgeDE9IjUwLjAyMDY5MyUiIHkxPSItMTMuNzMzMzc1MSUiIHgyPSI1MCUiIHkyPSIxMTQuMTEwOTk0JSIgaWQ9ImxpbmVhckdyYWRpZW50LTEiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRkZGRkZGIiBvZmZzZXQ9IjAlIj48L3N0b3A+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGRkZGRkYiIHN0b3Atb3BhY2l0eT0iMC42MDEwNDM0ODgiIG9mZnNldD0iNDkuMzA4NDg4MiUiPjwvc3RvcD4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0ZGRkZGRiIgb2Zmc2V0PSIxMDAlIj48L3N0b3A+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgICAgICA8bGluZWFyR3JhZGllbnQgeDE9IjUwJSIgeTE9IjAlIiB4Mj0iNTAlIiB5Mj0iMTAwJSIgaWQ9ImxpbmVhckdyYWRpZW50LTIiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRkZGRkZGIiBvZmZzZXQ9IjAlIj48L3N0b3A+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGRkZGRkYiIG9mZnNldD0iNTUuOTY4MTUzNSUiPjwvc3RvcD4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0ZGRkZGRiIgb2Zmc2V0PSIxMDAlIj48L3N0b3A+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxnIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnPgogICAgICAgICAgICA8cmVjdCBmaWxsPSIjRDhEOEQ4IiBvcGFjaXR5PSIwIiB4PSIwIiB5PSIwIiB3aWR0aD0iMjIiIGhlaWdodD0iMjIiPjwvcmVjdD4KICAgICAgICAgICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNC4wMDAwMDAsIDUuMDAwMDAwKSIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgICAgIDxnPgogICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik03LC0yLjk4ODE2NTY4IEM3LjUxMjgzNTg0LC0yLjk4ODE2NTY4IDcuOTM1NTA3MTYsLTIuNjAyMTI1NDkgNy45OTMyNzIyNywtMi4xMDQ3ODY4MSBMOCwtMS45ODgxNjU2OCBMOCwxMy45OTgxMTQ2IEM4LDE0LjU1MDM5OTMgNy41NTIyODQ3NSwxNC45OTgxMTQ2IDcsMTQuOTk4MTE0NiBDNi40ODcxNjQxNiwxNC45OTgxMTQ2IDYuMDY0NDkyODQsMTQuNjEyMDc0NCA2LjAwNjcyNzczLDE0LjExNDczNTcgTDYsMTMuOTk4MTE0NiBMNiwtMS45ODgxNjU2OCBDNiwtMi41NDA0NTA0MyA2LjQ0NzcxNTI1LC0yLjk4ODE2NTY4IDcsLTIuOTg4MTY1NjggWiIgZmlsbD0idXJsKCNsaW5lYXJHcmFkaWVudC0xKSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNy4wMDAwMDAsIDYuMDA0OTc0KSByb3RhdGUoLTQ1LjAwMDAwMCkgdHJhbnNsYXRlKC03LjAwMDAwMCwgLTYuMDA0OTc0KSAiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNywtMi45ODgxNjU2OCBDNy41MTI4MzU4NCwtMi45ODgxNjU2OCA3LjkzNTUwNzE2LC0yLjYwMjEyNTQ5IDcuOTkzMjcyMjcsLTIuMTA0Nzg2ODEgTDgsLTEuOTg4MTY1NjggTDgsMTMuOTk4MTE0NiBDOCwxNC41NTAzOTkzIDcuNTUyMjg0NzUsMTQuOTk4MTE0NiA3LDE0Ljk5ODExNDYgQzYuNDg3MTY0MTYsMTQuOTk4MTE0NiA2LjA2NDQ5Mjg0LDE0LjYxMjA3NDQgNi4wMDY3Mjc3MywxNC4xMTQ3MzU3IEw2LDEzLjk5ODExNDYgTDYsLTEuOTg4MTY1NjggQzYsLTIuNTQwNDUwNDMgNi40NDc3MTUyNSwtMi45ODgxNjU2OCA3LC0yLjk4ODE2NTY4IFoiIGZpbGw9InVybCgjbGluZWFyR3JhZGllbnQtMikiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDcuMDAwMDAwLCA2LjAwNDk3NCkgcm90YXRlKC0xMzUuMDAwMDAwKSB0cmFuc2xhdGUoLTcuMDAwMDAwLCAtNi4wMDQ5NzQpICI+PC9wYXRoPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=);
background-size: 100%;
width: 22px;
height: 22px;
}
</style>
`;let Bm=class extends zm{constructor(e){super();d(this,"configs");d(this,"clientWidth");d(this,"clientHeight");d(this,"ready",!1);d(this,"uuid",st());d(this,"tween");d(this,"tweening",!1);d(this,"container");d(this,"canvas");d(this,"data",{});d(this,"tempLine",{});this.configs=e,this.clientWidth=document.body.clientWidth,this.clientHeight=document.body.clientHeight,this.container=this.ifInsertToDOM(),this.canvas={},this.initCtrl()}get color(){return this.configs.currentColor}get state(){return this.data}get dpr(){return this.configs.DPR||1}ifInsertToDOM(){if(this.container)return this.container;if(this.configs.container)this.configs.container.id="_gl_paintBrush",this.container=this.configs.container;else if(document.getElementById("_gl_paintBrush"))this.container=document.getElementById("_gl_paintBrush");else{const e=document.createElement("div");e.id="_gl_paintBrush",document.body.appendChild(e),this.container=e}return this.container.innerHTML=Om,this.container}initCanvas(e){const i=document.createElement("canvas");i.className=e,i.width=this.clientWidth,i.height=this.clientHeight;const s=i.getContext("2d");if(s)return s.lineWidth=5*this.dpr,s.lineCap="round",s.lineJoin="round",this.container.appendChild(i),i}initCtrl(){const e=document.createElement("div");e.className="_paintBrush-ctrl";const i=document.createElement("div");i.className="_paintBrush-ctrlinner";const s=document.createElement("a");s.className="_paintBrush-ctrlitem _paintBrush-ctrlitem--undo",s.addEventListener("click",a=>{var f;if(a.stopPropagation(),this.configs.onClickUndo&&this.configs.onClickUndo(),!this.canvas[this.uuid]||!this.data[this.uuid]||this.data[this.uuid].length===0)return;const l=this.data[this.uuid].pop();l&&this.emitStateChange({type:hi.Undo,color:this.color,ready:this.ready,state:l,uuid:this.uuid});const c=(f=this.canvas[this.uuid])==null?void 0:f.getContext("2d");if(!this.canvas[this.uuid])return;const{width:h,height:u}=this.canvas[this.uuid];c&&c.clearRect(0,0,h,u),this.data[this.uuid].forEach(g=>this.handleDrawLine(this.uuid,g,{withUndo:!0}))});const o=document.createElement("a");return o.className="_paintBrush-ctrlitem _paintBrush-ctrlitem--close",o.addEventListener("click",a=>{a.stopPropagation(),this.closeBrush(),this.configs.onClickClose&&this.configs.onClickClose()}),[s,o].forEach(a=>{const l=document.createElement("i");l.className="brush-icon";const c=document.createElement("span");c.className="brush-txt",c.innerText=a.className.endsWith("undo")?this.configs.onUndoText:this.configs.onExitText,a.appendChild(l),a.appendChild(c)}),i.appendChild(s),i.appendChild(o),e.appendChild(i),this.container.appendChild(e),e}openBrush(){if(this.ready)return;this.canvas[this.uuid]||(this.canvas[this.uuid]=this.initCanvas("_paintBrush-canvas")),this.container.className="brushing";const e=this.canvas[this.uuid];e.getContext("2d").clearRect(0,0,e.width,e.height),this.openBrushHandle(),this.ready=!0,this.emit("readyChange",!0)}closeBrush(){this.ready&&(this.container.className="",this.data={},this.tempLine={},Object.keys(this.canvas).forEach(e=>{this.canvas[e].ontouchstart=()=>!1,this.canvas[e].ontouchmove=()=>!1,this.canvas[e].ontouchend=()=>!1,this.canvas[e].ontouchcancel=()=>!1;const i=this.canvas[e].getContext("2d");i&&i.clearRect(0,0,this.canvas[e].width,this.canvas[e].height)}),this.ready=!1,this.emit("readyChange",!1),this.emitStateChange({type:hi.Exit,color:this.color,ready:!1,uuid:this.uuid}))}updateCurrentColor(e){const i=this.canvas[this.uuid];if(!i)return;const s=i.getContext("2d");s&&(this.configs.currentColor=e,s.strokeStyle=e)}openBrushHandle(){const e=this.canvas[this.uuid];if(!e)return;const i=e.getContext("2d");if(!i)return;const s=this.color||"#6D92FF";i.strokeStyle=s;let o=null,r=[],a,l=[],c=0;const h=(u,f,g)=>{const A=this.color||"#ff0000";i.strokeStyle=A,i.beginPath(),i.moveTo(u.x,u.y),i.quadraticCurveTo(f.x,f.y,g.x,g.y),i.stroke()};e.onmousedown=u=>{u.preventDefault(),c=Date.now();const f=u.clientX,g=u.clientY;r=[],r.push({x:f,y:g}),o={x:f,y:g},a=ho({x:f,y:g},this.clientWidth,this.clientHeight),l=[]},e.onmousemove=u=>{if(u.preventDefault(),!o)return;const f=Number(u.clientX),g=Number(u.clientY);if(Math.abs(f-o.x)<5&&Math.abs(g-o.y)<5||(r.push({x:f,y:g}),l.push(ho({x:f,y:g},this.clientWidth,this.clientHeight)),r.length<3))return;const{control:A,end:p}=uo(r);!A||!p||(h(o,A,p),o=p)},e.onmouseup=u=>{if(u.preventDefault(),o=null,r.length<3)return;this.data[this.uuid]||(this.data[this.uuid]=[]);const f=Date.now()-c,g={move:Object.assign({},a),uuid:this.uuid,line:[...l],color:this.color,duration:f<1280?f:f<2e3?1280:0};this.data[this.uuid].push(g),Lo(()=>{this.emitStateChange({type:hi.Drawline,color:this.color,ready:this.ready,state:g,uuid:this.uuid})})},e.ontouchstart=u=>{u.preventDefault(),c=Date.now();const f=u.touches[0].clientX,g=u.touches[0].clientY;r=[],r.push({x:f,y:g}),o={x:f,y:g},a=ho({x:f,y:g},this.clientWidth,this.clientHeight),l=[]},e.ontouchmove=u=>{if(u.preventDefault(),!o)return;const f=Number(u.touches[0].clientX),g=Number(u.touches[0].clientY);if(Math.abs(f-o.x)<5&&Math.abs(g-o.y)<5||(r.push({x:f,y:g}),l.push(ho({x:f,y:g},this.clientWidth,this.clientHeight)),r.length<3))return;const{control:A,end:p}=uo(r);!A||!p||(h(o,A,p),o=p)},e.ontouchend=e.ontouchcancel=u=>{if(u.preventDefault(),o=null,r.length<3)return;this.data[this.uuid]||(this.data[this.uuid]=[]);const f=Date.now()-c,g={move:Object.assign({},a),line:[...l],uuid:this.uuid,color:this.color,duration:f<1280?f:f<2e3?1280:0};this.data[this.uuid].push(g),Lo(()=>{this.emitStateChange({type:hi.Drawline,color:this.color,ready:this.ready,state:g,uuid:this.uuid})})}}emitStateChange(e,i=!0){if(e.type!==hi.Drawline){this.emit("stateChange",e,i);return}const s=Date.now(),o=e.state;if(!o||!o.line)return;const r=Math.ceil(o.line.length/100);for(let a=0;a<r;a++){const l={uuid:this.uuid,color:this.color,ready:this.ready,type:e.type,state:{uuid:this.uuid,move:o.move,duration:o.duration,color:this.color,line:o.line.slice(a*100,(a+1)*100)},timestamp:s,end:a===r-1};Im(a,20,()=>{this.emit("stateChange",l,i)})}}action(e){const{ready:i,type:s,uuid:o}=e;if(!i&&this.ready){this.closeBrush();return}if(i&&!this.ready){this.openBrush();return}if(this.ready)switch(s){case hi.Drawline:const{state:r,timestamp:a,end:l}=e;if(!a||!r)return;this.tempLine[a]=[].concat(this.tempLine[a]||[],r.line),l&&(Object.assign(r,{line:this.tempLine[a]}),this.handleDrawLine(o,r,{},()=>delete this.tempLine[a]));break;case hi.Undo:this.handleUndo(o);break}}handleDrawLine(e,i,{withUndo:s=!1},o=Yu){!i||Object.prototype.toString.call(i)!="[object Object]"||Object.keys(i).length===0||Pm(()=>new Promise(r=>{if(s||(this.canvas[e]||(this.canvas[e]=this.initCanvas("_paintBrush-canvas--sync")),this.data[e]||(this.data[e]=[]),this.data[e].push(i)),!this.canvas[e])return;const a=this.canvas[e].getContext("2d");if(!a)return;const{line:l=[],color:c="black",duration:h=0,uuid:u}=i,f=ha(i.move||{},this.clientWidth,this.clientHeight);let g=[f];if(a.strokeStyle=c,a.beginPath(),a.moveTo(f.x,f.y),h&&!s){let A=[];const p=this;p.tween=Lm({step:0},{step:l.length-1},h).onUpdate(({step:m})=>{var y;if(p.tweening=!0,!p.ready)return a.clearRect(0,0,p.canvas[u].width,p.canvas[u].height),(y=p.tween)==null?void 0:y.stop();const b=Math.floor(m);if(!A.find(P=>P===b)){if(A.push(b),g.push(ha(l[b],p.clientWidth,p.clientHeight)),g.length<3)return;const{control:P,end:I}=uo(g);if(!P||!I)return;a.quadraticCurveTo(P.x,P.y,I.x,I.y),a.stroke()}}).onComplete(m=>{p.tween=void 0,p.tweening=!1,A=[],g=[],o&&o(),r()})}else{for(let A=0;A<l.length;A++){if(g.push(ha(l[A],this.clientWidth,this.clientHeight)),g.length<3)continue;const{control:p,end:m}=uo(g);!p||!m||a.quadraticCurveTo(p.x,p.y,m.x,m.y)}a.stroke(),g=[],o&&o(),r()}}))}handleUndo(e){if(!this.canvas[e]||!this.data[e]||this.data[e].length===0)return;this.data[e].pop();const i=()=>{var o;const s=(o=this.canvas[e])==null?void 0:o.getContext("2d");s&&s.clearRect(0,0,this.canvas[e].width,this.canvas[e].height),this.data[e].forEach(r=>this.handleDrawLine(e,r,{withUndo:!0}))};if(this.tween&&this.tweening){this.tween.stop(),Lo(i,60);return}i()}destroyBrush(){this.closeBrush(),this.ready=!1,this.emit("readyChange",!0)}};class Vm{constructor(t={}){d(this,"controller");const e=Object.assign({currentColor:"#f44336",onUndoText:"回退",onExitText:"关闭"},t);this.controller=new Bm(e)}on(t,e){this.controller.on(t,e)}off(t,e){this.controller.off(t,e)}once(t,e){this.controller.once(t,e)}show(){this.controller.openBrush()}action(t){this.controller.action(t)}get state(){return this.controller.state}get configs(){return this.controller.configs}dispose(){return this.controller.destroyBrush()}setCurrentColor(t){this.controller.updateCurrentColor(t)}}const Rm=(n,t)=>{var Q,H;let e=(H=(Q=t==null?void 0:t.initialState)==null?void 0:Q.enabled)!=null?H:!0,i=!1,s=!0,o=null;const a=D(D({},{lookAtCurrentCamera:!1,lockedPanoIndex:null,lockedLatitude:null,lockedLongitude:null}),t==null?void 0:t.config),l=new w.Scene,c=new Le.Camera(60);let h=new w.Object3D,u,f;{const F=new w.DirectionalLight(16777215,.5);F.position.copy(new w.Vector3(1,1,1)),l.add(F)}{const F=new w.DirectionalLight(16777215,.3);l.add(F)}{const F=new w.AmbientLight(16777215,.3);l.add(F)}l.add(h);const g=()=>{if(i)return;u=k(n.model,c.fov,c.aspect),f=n.model.bounding.getCenter(new w.Vector3),l.remove(h),h=Y(n.model),l.add(h),i=!0,j();function F(J){const Z=J.clone();return Z.uniforms.modelAlpha.value=1,Z.uniforms.map.value&&(Z.uniforms.map.value.needsUpdate=!0),Z}function Y(J){if(J instanceof w.Mesh){const Z=J.geometry,ee=Array.isArray(J.material)?J.material.map(F):F(J.material);return new w.Mesh(Z,ee)}else if(J instanceof w.Group){const Z=new w.Group;return J.children.forEach(ee=>Z.add(Y(ee))),Z}else{const Z=new w.Object3D;return J.children.forEach(ee=>Z.add(Y(ee))),Z}}},A=()=>{if(n.renderer)return o||(o=new w.WebGLRenderer({antialias:!1,alpha:!0}),o.setPixelRatio(n.renderer.getPixelRatio()),o.outputEncoding=w.sRGBEncoding,o.setClearColor(1579548,0),o.autoClear=!0),o},p=()=>{h.traverse(F=>{F instanceof w.Mesh&&[].concat(F.material).forEach(J=>J.dispose())}),l.remove(h),h=new w.Object3D,l.add(h),i=!1,j()},m=()=>{e&&(i||g())},b=()=>{e||(e=!0,l.add(h),!i&&n.model.loaded&&g(),j())},y=()=>{e&&(l.remove(h),s=!0,R(),e=!1)},P=(F,Y={})=>{const J=A();if(!J)return;F.appendChild(J.domElement),I(Y);const Z=window.getComputedStyle(F).position;Z!=="relative"&&Z!=="absolute"&&Z!=="fixed"&&Z!=="sticky"&&(F.style.position="relative")},I=(F={})=>{if(!o)return;const J=o.domElement.parentNode;if(J!=null&&J.nodeName){const{width:Z=J.offsetWidth,height:ee=J.offsetHeight}=F;o.setSize(Z,ee),c.aspect=Z/ee,c.updateProjectionMatrix()}j()};function k(F,Y,J){const Z=F.bounding,ee=Math.pow(Math.pow(Z.max.x-Z.min.x+1,2)+Math.pow(Z.max.y-Z.min.y+1,2)+Math.pow(Z.max.z-Z.min.z+1,2),1/2);let de=ee/2/Math.tan(Math.PI*Y/360);return J<1&&(de=de/J),isNaN(de)?ee:de}function E(F){return n.work.observers[F].standingPosition.clone()}const j=()=>{if(!e||!u||!f)return;const F=n.getPose();F.fov=c.fov,F.offset=f,F.distance=u,typeof a.lockedLatitude=="number"&&(F.latitude=a.lockedLatitude),typeof a.lockedLongitude=="number"&&(F.longitude=a.lockedLongitude),typeof a.lockedPanoIndex=="number"&&(F.offset=E(a.lockedPanoIndex)),a.lookAtCurrentCamera&&(F.offset=n.camera.position.clone().setY(n.camera.position.y+1)),c.setFromPose(F),s=!0},R=()=>{!e||s!==!0||!o||!o.domElement.parentNode||o.domElement.parentNode.offsetWidth===0||(o.render(l,c),s=!1)},U=()=>{o&&o.dispose(),o=null},W=F=>{Object.assign(a,F),j()},N=()=>({enabled:e});return Object.assign(window,{camera:c}),n.on("modelLoaded",m),n.on("modelWillLoad",p),n.on("cameraDirectionUpdate",j),n.on("dispose",U),n.on("renderFrame",R),n.on("cameraPositionUpdate",j),{appendTo:P,refresh:I,changeConfigs:W,enable:b,disable:y,getCurrentState:N}},Hm=({x:n,y:t,z:e})=>new _.Vector3(n,t,e),ui=n=>new _.Vector3().fromArray(n),Ve=n=>{if(n)return n instanceof _.Vector3?n:Array.isArray(n)?ui(n):Hm(n)};function Nm(n){if(n)return Array.isArray(n)?typeof n[0]=="number"?Ve(n):n.map(Ve):Ve(n)}function mi(n){return arguments.length===0?[]:Array.isArray(n)?n:[n]}function qi(n){const t=[];return mi(n).forEach(i=>{i.traverse(s=>{s.isCSS3DObjectPlus&&t.push(s)})}),t}function No(n,t){const e=Math.round(n);return e%2===0?e:e+(t!=null&&t.floor?-1:1)}function Gm(n,t,e=!0){if(!n)return console.error("createResizeObserver: element is undefined"),{observe:()=>{},unobserve:()=>{}};const i=()=>{const o=No(n.clientWidth,{floor:!0}),r=No(n.clientHeight,{floor:!0});t(o,r)};if(typeof ResizeObserver=="undefined"||!ResizeObserver)return console.warn("createResizeObserver: ResizeObserver is undefined"),{observe:()=>i(),unobserve:()=>{}};const s=new ResizeObserver(i);return e&&i(),{observe:()=>s.observe(n),unobserve:()=>s.unobserve(n)}}class lc extends Ro.CSS3DRenderer{constructor(){super();d(this,"wrapper");d(this,"requestAnimationFrameId");d(this,"resizeDisoper");this.domElement.classList.add("ICSS3DRenderer"),this.domElement.style.position="absolute",this.domElement.style.top="0",this.domElement.style.left="0",this.domElement.style.userSelect="none",this.domElement.style.pointerEvents="none"}setWrapper(e){if(!e)throw new Error("CSS3DRenderer: wrapper is required");if(e.contains(this.domElement))return;const i=this.wrapper;return i&&i.contains(this.domElement)&&this.domElement.remove(),this.appendToElement(e),this.wrapper=e,this}appendToElement(e){e.appendChild(this.domElement);const i=(r,a)=>this.setSize(r,a),{observe:s,unobserve:o}=Gm(e,i,!0);s(),this.resizeDisoper=o,this.wrapper=e}renderEveryFrame(e,i){if(this.wrapper||console.warn("wrapper is not find, creating a html element and call setWrapper(wrapper)",this,e),this.requestAnimationFrameId)return;const s=()=>{this.requestAnimationFrameId=requestAnimationFrame(s),e.visible&&qi(e).length!==0&&this.render(e,i)};s()}stopRender(){this.requestAnimationFrameId&&cancelAnimationFrame(this.requestAnimationFrameId)}dispose(){var e;this.stopRender(),(e=this.resizeDisoper)==null||e.call(this),this.domElement.remove()}}function Qm(n){return typeof Symbol=="undefined"?`$Symbol<${n}>$`:Symbol(n)}const Ms=Qm("$$EVENT$$");function go(n){return n[Ms]||(n[Ms]={}),n[Ms]}function Fm(n){n[Ms]&&delete n[Ms]}class ti{hasListener(t){const e=go(this);return!!(e!=null&&e[t]&&e[t].length>0)}on(t,e,i){const s=go(this);return s[t]||(s[t]=[]),s[t].push([e,i||!1]),()=>this.off(t,e)}once(t,e){return this.on(t,e,!0)}off(t,e){if(t===void 0){Fm(this);return}const i=go(this);if(i[t]||(i[t]=[]),e===void 0){i[t].length=0;return}let s=0;for(;s<i[t].length&&i[t][s][0]!==e;s++);s<i[t].length&&i[t].splice(s,1)}emit(t,...e){let i=!1;const o=go(this)[t]||[];for(let r of o.slice()){const[a,l=!1]=r,c=a(...e);l&&this.off(t,a),c===!1&&(i=!0)}return i}}class _m extends w.Mesh{constructor(e,i){const s=new w.MeshBasicMaterial({opacity:0,color:0,transparent:!1,side:w.DoubleSide}),o=new w.PlaneGeometry(e,i);super(o,s);d(this,"name","opacity-mesh")}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}}function Si(...n){const t=new _.Vector3;return n.forEach(e=>t.add(e)),t.divideScalar(n.length),t}const ll=n=>n?n.visible===!1?!1:ll(n.parent):!0,Ju=1,Wm=`CSS3DObjectPlus@${Ju}`,Um=.00216,Ym=.003;class Xm extends Ro.CSS3DObject{constructor(e){var k,E,j;const i=e.container,s=e.cornerPoints,o=(k=e.ratio)!=null?k:Ym,r=(E=e.dpr)!=null?E:1,a=(j=e.pointerEvents)!=null?j:"auto",l=Math.max(Um,o),c=s[0].distanceTo(s[1]),h=s[1].distanceTo(s[2]),u=No(c/o*r),f=No(h/o*r),g=Si(...s);let A;if(l===o)i.style.width=`${u}px`,i.style.height=`${f}px`,A=i;else{const R=document.createElement("div");R.style.width=`${u}px`,R.style.height=`${f}px`,R.style.pointerEvents="none";const U=o/l;i.style.position="absolute",i.style.left="0",i.style.top="0",i.style.width=`${U*u}px`,i.style.height=`${U*f}px`,R.appendChild(i),A=R}super(A);d(this,"version",Ju);d(this,"isCSS3DObjectPlus",!0);d(this,"container");d(this,"width");d(this,"height");d(this,"domWidthPx");d(this,"domHeightPx");d(this,"cornerPoints");d(this,"centerPosition");d(this,"ratio");d(this,"mode","front");d(this,"hooks",new ti);d(this,"opacityMesh");d(this,"selfVisible",!0);d(this,"setVisible",e=>{this.selfVisible=e,this.visible=ll(this.parent)&&this.selfVisible,this.opacityMesh&&(this.opacityMesh.visible=this.visible)});d(this,"updateVisible",()=>{this.setVisible(this.selfVisible)});d(this,"createOpacityMesh",e=>{const{domWidthPx:i,domHeightPx:s}=e,o=new _m(i,s);return o.position.copy(e.position),o.rotation.copy(e.rotation),o.scale.copy(e.scale),o});if(i.style.pointerEvents=a,Object.assign(i.style,e.style),this.scale.set(l,l,l),this.cornerPoints=s,this.ratio=o,this.container=i,e.mode&&(this.mode=e.mode),l===o)this.width=c,this.height=h,this.domWidthPx=u,this.domHeightPx=f,this.centerPosition=g;else{const R=o/l;this.width=R*c,this.height=R*h,this.domWidthPx=R*u,this.domHeightPx=R*f,this.centerPosition=new _.Vector3().subVectors(g,s[0]).multiplyScalar(R).add(s[0])}i.classList.add(`${Wm}__container`);const p=new _.Vector3().subVectors(s[1],s[0]),m=new _.Vector3().subVectors(s[3],s[0]),b=new _.Vector3().crossVectors(p,m).normalize();this.lookAt(b);const y=this.up.clone().applyQuaternion(this.quaternion),P=m.clone(),I=new _.Vector3().crossVectors(y,P).normalize();this.rotateOnWorldAxis(I,y.angleTo(P)),this.position.copy(g),this.addEventListener("added",()=>{var R;this.mode==="front"&&((R=this.opacityMesh)==null||R.removeFromParent())}),this.addEventListener("removed",()=>{var R;(R=this.opacityMesh)==null||R.removeFromParent()})}removeFromParent(){var i;const e=this.parent;return e!==null&&e.remove(this),(i=this.opacityMesh)==null||i.removeFromParent(),this}removeOpacityMesh(){var e;return(e=this.opacityMesh)==null||e.removeFromParent(),this.opacityMesh=void 0,this}dispose(){var e;this.container.remove(),this.removeFromParent(),(e=this.opacityMesh)==null||e.removeFromParent()}getOpacityMesh(){if(this.opacityMesh)return this.opacityMesh;{const e=this.createOpacityMesh(this);return this.opacityMesh=e,e}}applyMatrix4(e){var i;super.applyMatrix4(e),(i=this.opacityMesh)==null||i.applyMatrix4(e)}applyQuaternion(e){var i;return super.applyQuaternion(e),(i=this.opacityMesh)==null||i.applyQuaternion(e),this}applyScaleMatrix4(e){var i;this.scale.applyMatrix4(e),(i=this.opacityMesh)==null||i.scale.applyMatrix4(e)}}class Zm extends w.Scene{constructor(){super()}add(...t){return super.add(...t),qi(t).forEach(e=>{e.mode="front"}),this}}class Jm extends w.Scene{constructor(e){super();d(this,"scene");if(!e)throw new Error("CSS3DBehindScene: scene is required");this.scene=e}add(...e){return super.add(...e),qi(e).forEach(i=>{i.mode="behind",this.scene.add(i.getOpacityMesh())}),this}remove(...e){return qi(e).forEach(i=>{var s;(s=i.opacityMesh)==null||s.removeFromParent(),i.opacityMesh=null}),super.remove(...e),this}}class qu extends w.Group{constructor(e){super();d(this,"isCSS3DGroup",!0);d(this,"mode");d(this,"CSS3DObjectLength",0);this.mode=e}add(...e){return qi(e).forEach(i=>{i.mode=this.mode}),super.add(...e),this.updateLength(),this}setVisible(e){this.visible=e,this.traverse(i=>{i.isCSS3DObjectPlus&&i.updateVisible()})}remove(...e){return super.remove(...e),this.updateLength(),this}updateLength(){this.CSS3DObjectLength=qi(this).length}}class qm extends qu{constructor(){super("front")}}class Km extends qu{constructor(e){super("behind");d(this,"scene");if(!e)throw new Error("CSS3DBehindScene: scene is required");this.scene=e}add(...e){return qi(e).forEach(i=>{this.scene.add(i.getOpacityMesh())}),super.add(...e),this}}const $m=3,Ga="CSS3DRenderer",Ps=`${Ga}@${$m}`,bn=()=>{console.error(`${Ps} is disposed`)},et={css3DObjects:[],frontModeStore:{css3DRenderer:(()=>{const n=new lc;return n.domElement.style.zIndex="1",n})()},behindModeStore:{css3DRenderer:new lc}};function cc(n){return et.css3DObjects.find(t=>t.id===n)}function ep(n){et.frontModeStore.css3DRenderer.setWrapper(n)}function tp(n){et.behindModeStore.css3DRenderer.setWrapper(n)}class zn{constructor(t){d(this,"hooks",new ti);d(this,"state",{enabled:!0,visible:!0,disposed:!1});d(this,"_scene");d(this,"store",{frontModeGroup:new qm});d(this,"create3DElement",(t,e,i)=>{if(this.state.disposed)return bn();const s=(()=>{const k={ratio:.00216,devicePixelRatio:1,mode:"front",autoRender:!0,container:document.createElement("div"),pointerEvents:"none",wrapperStyle:{}};return Object.assign(k,i)})(),o=e.map(Ve);if((o==null?void 0:o.length)<4)return console.error(`${Ps}: requires 4 point but params may have fewer`);const{ratio:r,devicePixelRatio:a,mode:l,autoRender:c,container:h,pointerEvents:u,wrapperStyle:f}=s;let g=!1;const A=this.createObject(o,{ratio:r,dpr:a,container:h,mode:l,pointerEvents:u,wrapperStyle:f});et.css3DObjects.push(A),s.scene&&this.setScene(s.scene);const p=()=>{if(g)return;const k=A.mode==="front"?this.getFrontCSS3DObjectGroup():this.getBehindCSS3DObjectGroup();k&&k.add(A)},m=()=>{g||(p(),this.render(t),this.hooks.emit("render"))},b=k=>this.setVisibleById(A.id,k),y=k=>this.setEnabledById(A.id,k),P=()=>(g=!0,A.removeFromParent(),!0),I=l==="front"?et.frontModeStore.css3DRenderer:et.behindModeStore.css3DRenderer;return c&&m(),{id:A.uuid,container:h,css3DObject:A,render:c?void 0:m,show:()=>b(!0),hide:()=>b(!1),setVisible:b,enable:()=>y(!0),disable:()=>y(!1),setEnabled:y,dispose:P,appendToElement:k=>I.setWrapper(k)}});d(this,"setVisibleById",(t,e)=>{var i;(i=cc(t))==null||i.setVisible(e)});d(this,"setEnabledById",(t,e)=>{const i=cc(t);if(!i)return;const s=i.mode==="front"?this.getFrontCSS3DObjectGroup({addGroupIfNotExists:!1}):this.getBehindCSS3DObjectGroup({addGroupIfNotExists:!1});s&&(e?s.add(i):s.remove(i))});d(this,"createObject",(t,e)=>{const i=new Xm(oe(D({cornerPoints:t},e),{style:e.wrapperStyle}));return i.element.classList.add(`${Ga}__container`),i.element.id=`${Ga}__container--${i.uuid}`,i});t&&this.setScene(t)}get scene(){return this._scene||console.error("scene doesn't exist!, please call setScene(scene) first"),this._scene}static get frontModeCSS3DRenderer(){return et.frontModeStore.css3DRenderer}static get behindModeCSS3DRenderer(){return et.behindModeStore.css3DRenderer}get frontModeCSS3DRenderer(){return et.frontModeStore.css3DRenderer}get behindModeCSS3DRenderer(){return et.behindModeStore.css3DRenderer}setScene(t){this._scene=t}getCurrentState(){return this.state}setState(t,e={userAction:!0}){if(this.state.disposed)return bn();const i=D({},this.state);this.state=Object.assign(this.state,t),i.visible!==this.state.visible&&(t.visible?this.handleShow():this.handleHide()),i.enabled!==this.state.enabled&&(t.enabled?this.handleEnable():this.handleDisable()),i.disposed!==this.state.disposed&&this.handleDispose(),this.hooks.emit("stateChange",{state:this.state,prevState:i,userAction:e.userAction})}dispose(){this.setState({disposed:!0}),this.hooks.emit("dispose")}show(){return G(this,arguments,function*({userAction:t}={userAction:!0}){if(this.state.disposed)return bn();this.setState({visible:!0},{userAction:t}),this.hooks.emit("show",{userAction:t})})}hide(){return G(this,arguments,function*({userAction:t}={userAction:!0}){if(this.state.disposed)return bn();this.setState({visible:!1},{userAction:t}),this.hooks.emit("hide",{userAction:t})})}enable({userAction:t}={userAction:!0}){if(this.state.disposed)return bn();this.setState({enabled:!0},{userAction:t}),this.hooks.emit("enable",{userAction:t})}disable({userAction:t}={userAction:!0}){if(this.state.disposed)return bn();this.setState({enabled:!1},{userAction:t}),this.hooks.emit("disable",{userAction:t})}getFrontCSS3DScene({createSceneIfNotExists:t=!1}={}){var i;const e=(i=et.frontModeStore)==null?void 0:i.css3DScene;if(e)return e;if(t){const s=new Zm;et.frontModeStore.css3DScene=s}return et.frontModeStore.css3DScene}getBehindCSS3DScene({createSceneIfNotExists:t=!1}={}){var i,s;const e=(i=et.behindModeStore)==null?void 0:i.css3DScene;if(e)return e;if(t){const o=(s=et.behindModeStore.scene)!=null?s:this.scene;if(!o){console.error(`${Ps}: scene is required when mode is behind`);return}const r=new Jm(o);et.behindModeStore.css3DScene=r,et.behindModeStore.scene=o}return et.behindModeStore.css3DScene}getFrontCSS3DObjectGroup({addGroupIfNotExists:t=!0}={}){const e=this.getFrontCSS3DScene({createSceneIfNotExists:t});return t&&e&&(e.getObjectById(this.store.frontModeGroup.id)||e.add(this.store.frontModeGroup)),this.store.frontModeGroup}getBehindCSS3DObjectGroup({addGroupIfNotExists:t=!0}={}){var i;const e=this.getBehindCSS3DScene({createSceneIfNotExists:t});if(t&&e&&this.scene){const s=(i=this.store.behindModeGroup)!=null?i:new Km(this.scene);this.store.behindModeGroup=s,e.getObjectById(s.id)||e.add(s)}return this.store.behindModeGroup}render(t){var e,i;if(this.getFrontCSS3DObjectGroup({addGroupIfNotExists:!1}).CSS3DObjectLength>0){const s=this.getFrontCSS3DScene({createSceneIfNotExists:!0});if(!s)return console.error(`${Ps}: css3DScene is required when mode is front`);et.frontModeStore.css3DRenderer.renderEveryFrame(s,t)}if(((i=(e=this.getBehindCSS3DObjectGroup({addGroupIfNotExists:!1}))==null?void 0:e.CSS3DObjectLength)!=null?i:0)>0){const s=this.getBehindCSS3DScene({createSceneIfNotExists:!0});if(!s)return console.error(`${Ps}: css3DScene is required when mode is behind`);et.behindModeStore.css3DRenderer.renderEveryFrame(s,t)}}handleShow(){return G(this,null,function*(){var t;this.store.frontModeGroup.setVisible(!0),(t=this.store.behindModeGroup)==null||t.setVisible(!0)})}handleHide(){return G(this,null,function*(){var t;this.store.frontModeGroup.setVisible(!1),(t=this.store.behindModeGroup)==null||t.setVisible(!1)})}handleEnable(){var t,e;(t=this.getFrontCSS3DScene())==null||t.add(this.store.frontModeGroup),this.store.behindModeGroup&&((e=this.getBehindCSS3DScene())==null||e.add(this.store.behindModeGroup))}handleDisable(){var t,e,i;this.store.frontModeGroup.children.forEach(s=>{s instanceof Ro.CSS3DObject&&s.element instanceof Element&&s.element.parentNode!==null&&s.element.remove()}),(t=this.store.behindModeGroup)==null||t.children.forEach(s=>{s instanceof Ro.CSS3DObject&&s.element instanceof Element&&s.element.parentNode!==null&&s.element.remove()}),(e=this.getFrontCSS3DScene())==null||e.remove(this.store.frontModeGroup),this.store.behindModeGroup&&((i=this.getBehindCSS3DScene())==null||i.remove(this.store.behindModeGroup))}handleDispose(){this.handleDisable()}}d(zn,"setFrontModeContainer",ep),d(zn,"setBehindModeContainer",tp);function Ku(n){return G(this,null,function*(){return new Promise(t=>{var e;if((e=n.model)!=null&&e.loaded){t();return}else n.once("modelLoaded",()=>t())})})}const Ht=document.createElement("div");Ht.classList.add("behindFiveElement");Ht.style.position="absolute";Ht.style.top="0";Ht.style.left="0";Ht.style.width="100%";Ht.style.height="100%";Ht.style.pointerEvents="none";function $u(n){var i,s,o,r,a;const t=(a=(s=da(n.ge