@hatiolab/things-scene 10.0.0-beta.2 → 10.0.0-beta.4

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.
Files changed (36) hide show
  1. package/dist-types/components/audio.d.ts +2 -2
  2. package/dist-types/components/container-abstract.d.ts +4 -4
  3. package/dist-types/components/container.d.ts +3 -3
  4. package/dist-types/components/ellipse.d.ts +2 -2
  5. package/dist-types/components/html-overlay-container.d.ts +3 -3
  6. package/dist-types/components/html-overlay-element.d.ts +4 -4
  7. package/dist-types/components/image-view.d.ts +2 -2
  8. package/dist-types/components/info-window.d.ts +2 -2
  9. package/dist-types/components/local-ref.d.ts +2 -2
  10. package/dist-types/components/mixins/connectable.d.ts +2 -2
  11. package/dist-types/components/mixins/data-source.d.ts +2 -2
  12. package/dist-types/components/mixins/html-element.d.ts +2 -2
  13. package/dist-types/components/mixins/move-handle.d.ts +2 -2
  14. package/dist-types/components/mixins/rect-path.d.ts +2 -2
  15. package/dist-types/components/mixins/value-holder.d.ts +2 -2
  16. package/dist-types/components/node.d.ts +2 -2
  17. package/dist-types/components/popup.d.ts +2 -2
  18. package/dist-types/components/rect.d.ts +4 -4
  19. package/dist-types/components/ruler.d.ts +2 -2
  20. package/dist-types/components/text.d.ts +2 -2
  21. package/dist-types/things-scene/index.d.ts +1 -0
  22. package/dist-types/things-scene/index.d.ts.map +1 -1
  23. package/dist-types/things-scene/scene.d.ts +1 -1
  24. package/dist-types/threed/factories/banner.d.ts +2 -2
  25. package/dist-types/threed/factories/camera.d.ts +2 -2
  26. package/dist-types/threed/factories/cube.d.ts +2 -2
  27. package/dist-types/threed/factories/gltf-object.d.ts +2 -2
  28. package/dist-types/threed/factories/sprite.d.ts +2 -2
  29. package/dist-types/threed/factories/wall.d.ts +2 -2
  30. package/dist-types/types/index.d.ts +1 -0
  31. package/dist-types/types/index.d.ts.map +1 -1
  32. package/package.json +1 -11
  33. package/things-scene-min.js +6 -6
  34. package/things-scene-min.js.map +1 -1
  35. package/things-scene.mjs +1 -1
  36. package/things-scene.mjs.map +1 -1
package/things-scene.mjs CHANGED
@@ -48,5 +48,5 @@ return!t||t.scalable?this.context2D:this.auxContext2D}draw(t){this.canvas&&this.
48
48
  </button>`:v}
49
49
  ${n?x`<button class="closable" @click=${this.closeContainer}>close</button>`:v}
50
50
  </div>
51
- `,this.element)}catch(t){}}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}zd=new WeakMap,qa.memoize(Ld.prototype,"bounds",!0),qa.register("container",Ld);const Fd=Math.sqrt(3),Nd=2;function Bd(t,e,n,r,i){const s=5+i,o=n.x,a=n.y,c=r.x,l=r.y;if(Math.abs(o-c)>s&&Math.abs(a-l)>s){const n=(l-a)/(c-o),r=a-n*o;if(Math.abs(e-(n*t+r))>s)return!1}let h,u,d,p;return o>c?(u=o,h=c):(u=c,h=o),a>l?(p=a,d=l):(p=l,d=a),!(u+5<t)&&(!(h-5>t)&&(!(p+5<e)&&!(d-5>e)))}function Yd(t,e,n,r=2){for(let i=0;i<n.length-1;i++)if(Bd(t,e,n[i],n[i+1],r))return!0;return!1}function Gd(t,e,n,r){if("arrow"!=t.slice(-5))return n;const i=Math.atan2(r.y-n.y,r.x-n.x),s=1.5*e;return{x:n.x+Math.cos(i)*s,y:n.y+Math.sin(i)*s}}function Ud(t,e,n){let{lineWidth:r=Nd,strokeStyle:i="#000000",lineCap:s=!1,alpha:o=1,begin:a="none",end:c="none",beginSize:l="size5",endSize:h="size5"}=n;if(("none"!=a||"none"!=c)&&(r=Number(r)||Nd,t.lineCap=s,t.lineWidth=r,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=o,"none"!=a&&Hd(t,e[0],e[1],r,a,Wd(l,r)),"none"!=c)){const n=e.length;Hd(t,e[n-1],e[n-2],r,c,Wd(h,r))}}function Hd(t,e,n,r,i,s){const{x:o,y:a}=e,c=Math.atan2(n.y-a,n.x-o);switch(t.beginPath(),t.translate(o,a),t.rotate(c),i){case"oval":t.ellipse(0,0,s.X,s.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-s.X,0),t.lineTo(0,-s.Y),t.lineTo(s.X,0),t.lineTo(0,s.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(Fd*s.X,-s.Y),t.lineTo(Fd*s.X,s.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Fd*s.X,-s.Y),t.lineTo(-s.X/1.5+Fd*s.X,0),t.lineTo(Fd*s.X,s.Y),t.fill();break;case"open-arrow":t.moveTo(Fd*s.X+r,-s.Y),t.lineTo(r,0),t.lineTo(Fd*s.X+r,s.Y),t.stroke()}t.rotate(-c),t.translate(-o,-a),t.closePath()}function Wd(t,e){const n={X:0,Y:0};switch(e*=1.2,t){case"size1":n.X=e,n.Y=e;break;case"size2":n.X=1.5*e,n.Y=e;break;case"size3":n.X=2*e,n.Y=e;break;case"size4":n.X=e,n.Y=1.5*e;break;case"size5":default:n.X=1.5*e,n.Y=1.5*e;break;case"size6":n.X=2*e,n.Y=1.5*e;break;case"size7":n.X=e,n.Y=2*e;break;case"size8":n.X=1.5*e,n.Y=2*e;break;case"size9":n.X=2*e,n.Y=2*e}return n}const Vd="N",Xd="S",qd="E",Kd="W";class Zd{constructor({component:t,anchor:e,position:n,self:r}){this.component=t,this._anchorName=e,this._position=n,this.self=r}get position(){const t=this.anchor;if(t){const{position:e}=t,n=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(n.x,n.y)}return this._position}set position({x:t,y:e}){this._position={x:t,y:e}}get anchor(){return this.component?.findAnchor(this._anchorName)}get direction(){const t=this.component.bounds,e=this.anchor;if(!e)return qd;const n=e.position;return n.y<=t.top?Vd:n.y>=t.top+t.height?Xd:n.x<=t.left?Kd:qd}get boundaryPosition(){const t=this.anchor;if(t){let{position:e}=t,n=0,r=0;switch(this.direction){case Xd:r=20;break;case Vd:r=-20;break;case Kd:n=-20;break;default:n=20}e={x:e.x+n,y:e.y+r};const i=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(i.x,i.y)}}}class Qd extends qa{isLine(){return!0}replaceRefids(t){["from","to"].forEach(e=>{const n=this.get(e);if(n?.component){const r=t.get(n.component)||n.component;this.set(e,{...n,component:r})}})}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:n}=this.getState("from")||{};if(!t)return;const r=this.root?.findByRefid?.(t);if(!r)return;this._fromEnd=new Zd({component:r,fromto:"from",anchor:e,position:n,self:this})}return this._fromEnd}get from(){return this.getState("from")}set from(t){delete this._fromEnd,this.set("from",t)}get toEnd(){if(this.parent&&!this._toEnd){const{component:t,anchor:e,position:n}=this.getState("to")||{};if(!t)return;const r=this.root?.findByRefid?.(t);if(!r)return;this._toEnd=new Zd({component:r,fromto:"to",anchor:e,position:n,self:this})}return this._toEnd}get to(){return this.getState("to")}set to(t){delete this._toEnd,this.set("to",t)}move({x:t,y:e},n){n&&(this.from={position:this._fromEnd?.position||this.getState("from")?.position||{x:0,y:0}},this.to={position:this._toEnd?.position||this.getState("to")?.position||{x:0,y:0}}),super.move({x:t,y:e})}render(t){const{begin:e="none",end:n="none",lineWidth:r,round:i=0}=this.state;let s=this.drawPath;Ud(t,s,this.state),t.beginPath();const o=Gd(e,r,s[0],s[1]),a=Gd(n,r,s[s.length-1],s[s.length-2]);s=[o,...s.slice(1,-1),a];let c={x:o.x,y:o.y};t.moveTo(o.x,o.y);for(let e=1;e<s.length;e++){const n=c;c=s[e];const r=s[e+1];if(n.x===c.x&&n.y===c.y)continue;if(!r){t.lineTo(c.x,c.y);break}let o=Math.sqrt((n.x-c.x)*(n.x-c.x)+(n.y-c.y)*(n.y-c.y)),a=0!==o?Math.atan2(n.x-c.x,n.y-c.y):0,l=Math.sin(a)*Math.min(i,o/2)+c.x,h=Math.cos(a)*Math.min(i,o/2)+c.y;const u=i>0||0!==o?{x:l,y:h}:c;o=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y)),a=0!==o?Math.atan2(r.x-c.x,r.y-c.y):0,l=Math.sin(a)*Math.min(i,o/2)+c.x,h=Math.cos(a)*Math.min(i,o/2)+c.y;const d=i>0||0!==o?{x:l,y:h}:c;t.lineTo(u.x,u.y),i>0&&t.quadraticCurveTo(c.x,c.y,d.x,d.y)}this.drawStroke(t,void 0)}contains(t,e){const{lineWidth:n}=this.state;return Yd(t,e,this.drawPath,n)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state,{x1:n,y1:r,x2:i,y2:s}=this.state;return[this.fromEnd?.position||t?.position||{x:n,y:r},this.toEnd?.position||e?.position||{x:i,y:s}]}set path(t){const[e,n]=t,{from:r,to:i}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...r,position:e},to:{...i,position:n}})}get textBounds(){const t=this.drawPath;let e,n,r=0;for(let i=1;i<t.length;i++){const s=t[i-1],o=t[i],a=(s.x-o.x)*(s.x-o.x)+(s.y-o.y)*(s.y-o.y);a>r&&(r=Math.ceil(a),e=s,n=o)}let{paddingTop:i,paddingLeft:s,paddingRight:o,paddingBottom:a}=this.state;return a||=0,i||=0,s||=0,o||=0,{left:Math.min(e.x,n.x)+s,top:Math.min(e.y,n.y)+i,width:Math.max(Math.abs(e.x-n.x)-s-o,0),height:Math.max(Math.abs(e.y-n.y)-i-a,0)}}get decorators(){return this.app.isEditMode?["decotag"]:[]}}Qd.getTipNeckPos=Gd,Qd.containedInPath=Yd,Qd.drawEndTips=Ud,qa.register("line",Qd);const Jd={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"angle",label:"start-angle",name:"startAngle",property:"startAngle"},{type:"angle",label:"end-angle",name:"endAngle",property:"endAngle"}],"value-property":"text"};class $d extends(Qh(Ka)){is3dish(){return!0}render(t){const{cx:e,cy:n,rx:r,ry:i,startAngle:s,endAngle:o,anticlockwise:a}=this.state;t.beginPath(),t.ellipse(e,n,Math.abs(r),Math.abs(i),0,s||0,o||2*Math.PI,a),void 0!==s&&void 0!==o&&(t.lineTo(e,n),t.closePath())}get path(){const{cx:t,cy:e,rx:n,ry:r}=this.state;return[{x:t-n,y:e-r},{x:t+n,y:e-r},{x:t+n,y:e+r},{x:t-n,y:e+r}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2,rx:(n.x-e.x)/2,ry:(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:r,rx:i,ry:s}=this.state,o=(t-n)/(2*i-.5),a=(e-r)/(2*s-.5);return o*o+a*a<.25}outline(t){return function(t,e){const{cx:n,cy:r,rx:i,ry:s}=t.model,o=2*Math.PI*e,a=n+i*Math.cos(o),c=r+s*Math.sin(o);return t.toScene(a,c)}(this,t)}get anchors(){return function(t){const{left:e,top:n,width:r,height:i}=t.bounds,s=e+r/2,o=n+i/2;return[{name:"TOP",position:{x:s,y:n}},{name:"RIGHT",position:{x:e+r,y:o}},{name:"BOTTOM",position:{x:s,y:n+i}},{name:"LEFT",position:{x:e,y:o}}]}(this)}get nature(){return Jd}}qa.memoize($d.prototype,"path",!1),qa.register("ellipse",$d);const tp={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e+1,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){n[e+1]=t})},ondragend:function(t,e,n){}},ep={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polygon"};class np extends Ka{is3dish(){return!0}get mutable(){return!0}get pathExtendable(){return!0}get path(){return this.state.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let r=!1;return n.forEach((i,s)=>{const o=(s+n.length+1)%n.length,a=i.x,c=i.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(r=!r)}),r}get controls(){const t=this.path;return t.map((e,n)=>{const r=t[n+1>=t.length?0:n+1];return{x:(e.x+r.x)/2,y:(e.y+r.y)/2,handler:tp}})}get nature(){return ep}}qa.memoize(np.prototype,"controls",!1),qa.register("polygon",np);const rp={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){n[e]=t})},ondragend:function(t,e,n){}},ip={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polyline"};class sp extends Qd{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:n}=this.state;return[this.fromEnd?.position||t?.position||n[0],...n.slice(1,-1),this.toEnd?.position||e?.position||n[n.length-1]]}set path(t){const{from:e,to:n}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...n,position:t[t.length-1]},path:t})}get controls(){const t=this.path,e=[];for(let n=0;n<t.length-1;n++){const r=t[n],i=t[n+1];0==n&&e.push({x:r.x,y:r.y,handler:rp}),e.push({x:(r.x+i.x)/2,y:(r.y+i.y)/2,handler:rp}),n==t.length-2&&e.push({x:i.x,y:i.y,handler:rp})}return e}get nature(){return ip}}qa.register("polyline",sp);const op={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/ortholine"};class ap extends Qd{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:n,direction:r,boundaryPosition:i=t}=this.fromEnd||{},{component:s,direction:o,boundaryPosition:a=e}=this.toEnd||{},c=[i,a],l=[];i&&l.push(i);let h,u=n?.bounds;u&&(h=n.toScene(u.left,u.top),h=this.transcoordT2P(h.x,h.y),u={...u,left:h.x,top:h.y});const d=u?{left:u.left-20,top:u.top-20,width:u.width+40,height:u.height+40}:{left:i.x,top:i.y,width:0,height:0};u=u||d;let p=s?.bounds;p&&(h=s.toScene(p.left,p.top),h=this.transcoordT2P(h.x,h.y),p={...p,left:h.x,top:h.y});const f=p?{left:p.left-20,top:p.top-20,width:p.width+40,height:p.height+40}:{left:a.x,top:a.y,width:0,height:0};p=p||f;const g=[d,f],m=d.left>f.left?f.left:d.left,y=d.top>f.top?f.top:d.top,b={left:m,top:y,width:d.left+d.width>f.left+f.width?d.left+d.width-m:f.left+f.width-m,height:d.top+d.height>f.top+f.height?d.top+d.height-y:f.top+f.height-y};let v,x,w,_,A,S,M,k,E,C,T=0,P=0;u.left+u.width<p.left?(_=0,A=1,E=r,C=o,v=(u.left+u.width+p.left)/2,T=p.left-v):p.left+p.width<u.left&&(_=1,A=0,E=o,C=r,v=(u.left+p.width+p.left)/2,T=u.left-v),u.top+u.height<p.top?(w=0,S=1,M=r,k=o,x=(u.top+u.height+p.top)/2,P=p.top-x):p.top+p.height<u.top&&(w=1,S=0,M=o,k=r,x=(u.top+p.height+p.top)/2,P=u.top-x);const O=[];if(v&&T>P){let t,e,n;switch(C){case Kd:switch(E){case qd:O.push({x:v,y:c[_].y}),O.push({x:v,y:c[A].y});break;case Kd:t=g[_].top+g[_].height/2,e=t>c[A].y?Math.min(g[_].top,c[A].y):Math.max(g[_].top+g[_].height,c[A].y),O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:c[A].y});break;case Vd:case Xd:e=E===Xd?Math.max(c[_].y,c[A].y):Math.min(c[_].y,c[A].y),O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:c[A].y});break;default:return this.path}break;case qd:switch(E){case qd:e=c[_].y<c[A].y?Math.min(g[A].top,c[_].y):Math.max(g[A].top+g[A].height,c[_].y),n=e;break;case Kd:e=void 0!==x?x:c[_].y<c[A].y?b.top-.5*T:b.top+b.height+.5*T,n=e;break;case Xd:e=void 0!==x?Math.max(x,c[_].y):b.top+b.height,n=e;break;case Vd:e=x?Math.min(x,g[_].top):b.top,n=e;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;case Xd:switch(E){case qd:e=c[_].y,n=c[_].y>c[A].y?c[_].y:g[A].top+g[A].height;break;case Kd:e=x?Math.max(x,g[A].top+g[A].height):b.top+b.height,n=e;break;case Xd:e=b.top+b.height,n=e;break;case Vd:e=x?Math.min(x,g[_].top):g[_].top,n=x?Math.max(x,g[A].top+g[A].height):g[A].top+g[A].height;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;case Vd:switch(E){case qd:e=c[_].y,n=c[_].y<c[A].y?c[_].y:g[A].top;break;case Kd:e=x?Math.min(x,g[A].top):b.top,n=e;break;case Xd:e=void 0!==x?Math.max(x,c[_].y):c[_].y,n=void 0!==x?Math.min(x,c[A].y):c[A].y;break;case Vd:e=b.top,n=e;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;default:return this.path}l.push(...0===_?O:O.reverse())}else if(x){let t,e,n;switch(k){case Vd:switch(M){case Xd:O.push({x:c[w].x,y:x}),O.push({x:c[S].x,y:x});break;case Vd:t=g[w].left+g[w].width/2,e=t>c[S].x?Math.min(g[w].left,c[S].x):Math.max(g[w].left+g[w].width,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;case Kd:e=Math.min(c[w].x,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;case qd:e=Math.max(c[w].x,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;default:return this.path}break;case Xd:switch(M){case Kd:e=b.left,n=e;break;case qd:e=void 0!==v?Math.max(v,c[w].x):b.left+b.width,n=e;break;case Vd:e=void 0!==v?v:c[w].x<c[S].x?b.left-.5*P:b.left+b.width+.5*P,n=e;break;case Xd:e=c[w].x,n=c[w].x<c[S].x?Math.min(g[S].left,c[w].x):Math.max(g[S].left+g[S].width,c[w].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;case qd:switch(M){case Kd:e=void 0!==v?Math.min(v,c[w].x):c[w].x,n=void 0!==v?Math.max(v,c[S].x):c[S].x;break;case qd:e=b.left+b.width,n=e;break;case Vd:e=void 0!==v?Math.max(v,c[S].x):b.left+b.width,n=e;break;case Xd:e=c[w].x,n=Math.max(g[S].left+g[S].width,c[w].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;case Kd:switch(M){case Kd:e=b.left,n=e;break;case qd:e=void 0!==v?Math.max(v,c[w].x):c[w].x,n=void 0!==v?Math.min(v,c[S].x):c[S].x;break;case Vd:e=b.left,n=e;break;case Xd:e=c[w].x<c[S].x?Math.min(g[S].left,c[w].x):c[w].x,n=Math.min(e,c[S].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;default:return this.path}l.push(...0===w?O:O.reverse())}else{let t,e;switch(r){case Vd:switch(o){case Vd:e=b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case Xd:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top+b.height}),l.push({x:c[1].x,y:b.top+b.height});break;case qd:t=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;case Kd:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case Xd:switch(o){case Vd:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top}),l.push({x:c[1].x,y:b.top});break;case Xd:case qd:case Kd:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;case Kd:switch(o){case Vd:t=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:b.left,e=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(b.top,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case Xd:t=b.left,e=Math.max(b.top+b.height,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case qd:t=b.left+b.width,l.push({x:c[0].x,y:b.top}),l.push({x:t,y:b.top}),l.push({x:t,y:c[1].y});break;case Kd:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case qd:switch(o){case Vd:e=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case Xd:e=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case qd:case Kd:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;default:return this.path}}return a&&l.push(a),[t,...l,e].filter((t,e,n)=>{if(0===e)return!0;const r=n[e-1];return t.x!==r.x||t.y!==r.y}).filter((t,e,n)=>{if(0===e||e>=n.length-1)return!0;const r=n[e-1],i=n[e+1];return!(t.x===r.x&&t.x===i.x||t.y===r.y&&t.y===i.y)})}get nature(){return op}}qa.register("ortholine",ap);const cp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"image-src",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"scene-image",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0}},{type:"select",label:"cross-origin",name:"crossOrigin",property:{options:["","anonymous","use-credentials"]}}],"value-property":"src",help:"scene/component/image-view"};class lp extends(Qa(Ka)){static get noimage(){return lp.NOIMAGE||(lp.NOIMAGE=new Image,lp.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),lp.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){const{left:e,top:n,width:r,height:i,isGray:s=!1,alpha:o=1,src:a}=this.state;if(this.prepareIf(!this._image&&a),t.beginPath(),t.globalAlpha*=o,this._image&&this._image.complete)if(s&&this._offcanvas)t.drawImage(this._offcanvas,e,n,r,i);else try{t.drawImage(this._image,e,n,r,i)}catch(s){t.drawImage(lp.noimage,e,n,r,i)}else!this.app.isViewMode&&t.drawImage(lp.noimage,e,n,r,i)}get nature(){return cp}get hasTextProperty(){return!1}async ready(){await super.ready(),this.prepareIf(!this._image&&this.state.src)}prepare(t,e){const{src:n,crossOrigin:r}=this.state;if(n){this._image=new Image;try{r&&(this._image.crossOrigin=r),this._image.src=this.app.url(n)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){const t=this._image.width,e=this._image.height;this._offcanvas=qa.createCanvas(t,e);const n=this._offcanvas.getContext("2d");n.drawImage(this._image,0,0);const r=function(t,e,n){let r;try{r=t.getImageData(0,0,e,n)}catch(t){return Br("Get Image Data Error: "+(t instanceof Error?t.message:String(t))),null}const i=r.data;for(let t=0;t<e*n*4;t+=4){const e=i[t],n=i[t+1],s=i[t+2],o=Math.floor((e+n+s)/3);r.data[t]=o,r.data[t+1]=o,r.data[t+2]=o}return r}(n,t,e);n.putImageData(r,0,0)}t(this)},this._image.onerror=t=>{this._image&&!this._image.currentSrc&&(this._image=null),e(t)}}else t(this)}get src(){return this.get("src")}set src(t){this.set("src",t)}onchange(t,e){(t.hasOwnProperty("src")||t.hasOwnProperty("isGray"))&&(this._offcanvas=null,this._image=null,this.prepareIf(t.src))}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("image/"))return void(this.src=e[n])}}qa.register("image-view",lp);class hp extends(Dd(Qa(qa))){is3dish(){return!0}prerender(){}}var up,dp,pp={},fp={},gp={};function mp(){if(dp)return fp;dp=1,Object.defineProperty(fp,"__esModule",{value:!0});var t=function(){if(up)return gp;up=1,Object.defineProperty(gp,"__esModule",{value:!0});var t=function(){function t(){}return t.bitsToNum=function(t){return t.reduce(function(t,e){return 2*t+e},0)},t.byteToBitArr=function(t){for(var e=[],n=7;n>=0;n--)e.push(!!(t&1<<n));return e},t.lzwDecode=function(t,e){for(var n,r,i=0,s=function(t){for(var n=0,r=0;r<t;r++)e.charCodeAt(i>>3)&1<<(7&i)&&(n|=1<<r),i++;return n},o=[],a=1<<t,c=a+1,l=t+1,h=[],u=function(){h=[],l=t+1;for(var e=0;e<a;e++)h[e]=[e];h[a]=[],h[c]=null};;)if(r=n,(n=s(l))!==a){if(n===c)break;if(n<h.length)r!==a&&h.push(h[r].concat(h[n][0]));else{if(n!==h.length)throw new Error("Invalid LZW code.");h.push(h[r].concat(h[r][0]))}o.push.apply(o,h[n]),h.length===1<<l&&l<12&&l++}else u();return o},t}();return gp.SuperGifUtils=t,gp}(),e=function(){function e(t,e){this.stream=t,this.handler=e}return e.prototype.parseCT=function(t){for(var e=[],n=0;n<t;n++)e.push(this.stream.readBytes(3));return e},e.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},e.prototype.parseHeader=function(){var e={};if(e.sig=this.stream.read(3),e.ver=this.stream.read(3),"GIF"!==e.sig)throw new Error("Not a GIF file.");e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.gctFlag=n.shift(),e.colorRes=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.sorted=n.shift(),e.gctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.bgColor=this.stream.readByte(),e.pixelAspectRatio=this.stream.readByte(),e.gctFlag&&(e.gct=this.parseCT(1<<e.gctSize+1)),this.handler.hdr&&this.handler.hdr(e)},e.prototype.parseExt=function(e){var n=this;switch(e.label=this.stream.readByte(),e.label){case 249:e.extType="gce",function(e){n.stream.readByte();var r=t.SuperGifUtils.byteToBitArr(n.stream.readByte());e.reserved=r.splice(0,3),e.disposalMethod=t.SuperGifUtils.bitsToNum(r.splice(0,3)),e.userInput=r.shift(),e.transparencyGiven=r.shift(),e.delayTime=n.stream.readUnsigned(),e.transparencyIndex=n.stream.readByte(),e.terminator=n.stream.readByte(),n.handler.gce&&n.handler.gce(e)}(e);break;case 254:e.extType="com",function(t){t.comment=n.readSubBlocks(),n.handler.com&&n.handler.com(t)}(e);break;case 1:e.extType="pte",function(t){n.stream.readByte(),t.ptHeader=n.stream.readBytes(12),t.ptData=n.readSubBlocks(),n.handler.pte&&n.handler.pte(t)}(e);break;case 255:e.extType="app",function(t){n.stream.readByte(),t.identifier=n.stream.read(8),t.authCode=n.stream.read(3),"NETSCAPE"===t.identifier?function(t){n.stream.readByte(),t.unknown=n.stream.readByte(),t.iterations=n.stream.readUnsigned(),t.terminator=n.stream.readByte(),n.handler.app&&n.handler.app.NETSCAPE&&n.handler.app.NETSCAPE(t)}(t):function(t){t.appData=n.readSubBlocks(),n.handler.app&&n.handler.app[t.identifier]&&n.handler.app[t.identifier](t)}(t)}(e);break;default:e.extType="unknown",function(t){t.data=n.readSubBlocks(),n.handler.unknown&&n.handler.unknown(t)}(e)}},e.prototype.parseImg=function(e){e.leftPos=this.stream.readUnsigned(),e.topPos=this.stream.readUnsigned(),e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.lctFlag=n.shift(),e.interlaced=n.shift(),e.sorted=n.shift(),e.reserved=n.splice(0,2),e.lctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.lctFlag&&(e.lct=this.parseCT(1<<e.lctSize+1)),e.lzwMinCodeSize=this.stream.readByte();var r=this.readSubBlocks();e.pixels=t.SuperGifUtils.lzwDecode(e.lzwMinCodeSize,r),e.interlaced&&(e.pixels=function(t,e){for(var n=new Array(t.length),r=t.length/e,i=function(r,i){var s=t.slice(i*e,(i+1)*e);n.splice.apply(n,[r*e,e].concat(s))},s=[0,4,2,1],o=[8,8,4,2],a=0,c=0;c<4;c++)for(var l=s[c];l<r;l+=o[c])i(l,a),a++;return n}(e.pixels,e.width)),this.handler.img&&this.handler.img(e)},e.prototype.parseBlock=function(){var t={};switch(t.sentinel=this.stream.readByte(),String.fromCharCode(t.sentinel)){case"!":t.type="ext",this.parseExt(t);break;case",":t.type="img",this.parseImg(t);break;case";":t.type="eof",this.handler.eof&&this.handler.eof(t);break;default:throw new Error("Unknown block: 0x"+t.sentinel.toString(16))}"eof"!==t.type&&setTimeout(this.parseBlock.bind(this),0)},e.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},e}();return fp.SuperGifParser=e,fp}var yp,bp,vp={};var xp=function(){if(bp)return pp;bp=1,Object.defineProperty(pp,"__esModule",{value:!0});var t=mp(),e=function(){if(yp)return vp;yp=1,Object.defineProperty(vp,"__esModule",{value:!0});var t=function(){function t(t){this.data=t,this.position=0}return t.prototype.readByte=function(){if(this.position>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.position++]:255&this.data.charCodeAt(this.position++)},t.prototype.readBytes=function(t){for(var e=[],n=0;n<t;n++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",n=0;n<t;n++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();return vp.SuperGifStream=t,vp}(),n=function(){function n(t,e){var n=this;for(var r in this.gifImgElement=t,this.options={autoPlay:!0},this.loading=!1,this.ready=!1,this.transparency=null,this.delay=null,this.disposalMethod=null,this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,this.playing=!0,this.forward=!0,this.ctxScaled=!1,this.frames=[],this.frameOffsets=[],this.initialized=!1,this.currentFrameIndex=-1,this.iterationCount=0,this.stepping=!1,this.handler={hdr:this.withProgress(this.doHdr.bind(this)),gce:this.withProgress(this.doGCE.bind(this)),com:this.withProgress(this.doNothing.bind(this)),app:{NETSCAPE:this.withProgress(this.doNothing.bind(this))},img:this.withProgress(this.doImg.bind(this)),eof:function(){n.pushFrame(),n.canvas.width=n.hdr.width*n.getCanvasScale(),n.canvas.height=n.hdr.height*n.getCanvasScale(),n.playerInit(),n.loading=!1,n.ready=!0,n.loadCallback&&n.loadCallback(n.gifImgElement)}},e)this.options[r]=e[r];this.onEndListener=e.onEnd,this.loopDelay=e.loopDelay||0,this.overrideLoopMode=null!=e.loopMode?e.loopMode:"auto",this.drawWhileLoading=null==e.drawWhileLoading||e.drawWhileLoading}return n.prototype.init=function(){var t=this.gifImgElement.parentNode,e=document.createElement("div");this.canvas=document.createElement("canvas"),this.canvasContext=this.canvas.getContext("2d"),this.tmpCanvas=document.createElement("canvas"),e.className=this.options.enclosingClass||"super-gif",e.appendChild(this.canvas),t&&(t.insertBefore(e,this.gifImgElement),t.removeChild(this.gifImgElement)),this.initialized=!0},n.prototype.loadSetup=function(t){return!this.loading&&(t&&(this.loadCallback=t),this.loading=!0,this.frames=[],this.clear(),this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,!0)},n.prototype.completeLoop=function(){this.onEndListener&&this.onEndListener(this.gifImgElement),this.iterationCount++,!1!==this.overrideLoopMode||this.iterationCount<0?this.doStep():(this.stepping=!1,this.playing=!1)},n.prototype.doStep=function(){if(this.stepping=this.playing,this.stepping){this.stepFrame(1);var t=10*this.frames[this.currentFrameIndex].delay;t||(t=100),0===this.getNextFrameNo()?(t+=this.loopDelay,setTimeout(this.completeLoop.bind(this),t)):setTimeout(this.doStep.bind(this),t)}},n.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},n.prototype.putFrame=function(){var t;this.currentFrameIndex=parseInt(this.currentFrameIndex.toString(),10),this.currentFrameIndex>this.frames.length-1&&(this.currentFrameIndex=0),this.currentFrameIndex<0&&(this.currentFrameIndex=0),t=this.frameOffsets[this.currentFrameIndex],this.tmpCanvas.getContext("2d").putImageData(this.frames[this.currentFrameIndex].data,t.x,t.y),this.canvasContext.globalCompositeOperation="copy",this.canvasContext.drawImage(this.tmpCanvas,0,0)},n.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},n.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},n.prototype.parseStream=function(e){try{new t.SuperGifParser(e,this.handler).parse()}catch(t){this.handleError("parse")}},n.prototype.setSizes=function(t,e){this.canvas.width=t*this.getCanvasScale(),this.canvas.height=e*this.getCanvasScale(),this.tmpCanvas.width=t,this.tmpCanvas.height=e,this.tmpCanvas.style.width=t+"px",this.tmpCanvas.style.height=e+"px",this.tmpCanvas.getContext("2d").setTransform(1,0,0,1,0,0)},n.prototype.drawError=function(){this.canvasContext.fillStyle="black",this.canvasContext.fillRect(0,0,this.hdr.width,this.hdr.height),this.canvasContext.strokeStyle="red",this.canvasContext.lineWidth=3,this.canvasContext.moveTo(0,0),this.canvasContext.lineTo(this.hdr.width,this.hdr.height),this.canvasContext.moveTo(0,this.hdr.height),this.canvasContext.lineTo(this.hdr.width,0),this.canvasContext.stroke()},n.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},n.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},n.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},n.prototype.pushFrame=function(){this.frame&&(this.frames.push({data:this.frame.getImageData(0,0,this.hdr.width,this.hdr.height),delay:this.delay}),this.frameOffsets.push({x:0,y:0}))},n.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var n=this.frames.length,r=t.lctFlag?t.lct:this.hdr.gct;n>0&&(3===this.lastDisposalMethod?null!==this.disposalRestoreFromIdx?this.frame.putImageData(frames[this.disposalRestoreFromIdx].data,0,0):this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height):this.disposalRestoreFromIdx=n-1,2===this.lastDisposalMethod&&this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height));var i=this.frame.getImageData(t.leftPos,t.topPos,t.width,t.height);t.pixels.forEach(function(t,n){t!==e.transparency&&(i.data[4*n+0]=r[t][0],i.data[4*n+1]=r[t][1],i.data[4*n+2]=r[t][2],i.data[4*n+3]=255)}),this.frame.putImageData(i,t.leftPos,t.topPos),this.ctxScaled||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.ctxScaled=!0),this.drawWhileLoading&&(this.canvasContext.drawImage(this.tmpCanvas,0,0),this.drawWhileLoading=this.options.autoPlay),this.lastImg=t},n.prototype.doNothing=function(){},n.prototype.withProgress=function(t){return function(e){t(e)}},n.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},n.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},n.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},n.prototype.play=function(){this.playing=!0,this.step()},n.prototype.pause=function(){this.playing=!1},n.prototype.isPlaying=function(){return this.playing},n.prototype.getCanvas=function(){return this.canvas},n.prototype.isLoading=function(){return this.loading},n.prototype.isReady=function(){return this.ready},n.prototype.isAutoPlay=function(){return this.options.autoPlay},n.prototype.getLength=function(){return this.frames.length},n.prototype.getCurrentFrame=function(){return this.currentFrameIndex},n.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},n.prototype.loadURL=function(t,n){var r=this;if(this.loadSetup(n)){var i=new XMLHttpRequest;i.open("GET",t,!0),"overrideMimeType"in i?i.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in i?i.responseType="arraybuffer":i.setRequestHeader("Accept-Charset","x-user-defined"),i.onloadstart=function(){r.initialized||r.init()},i.onload=function(){if(200===i.status){var t=i.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var n=new e.SuperGifStream(t);setTimeout(function(){r.parseStream(n)},0)}else r.handleError("xhr - response")},i.onerror=function(){r.handleError("xhr")},i.send()}},n.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},n}();return pp.SuperGif=n,pp}();const wp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"src",name:"src"},{type:"checkbox",label:"play",name:"play"}],"value-property":"src",help:"scene/component/gif-view"};class _p extends hp{async oncreate_element(t){const{src:e,play:n}=this.state;this.onchangesrc(e),this.onchangeplay(n)}buildImg(){const t=this.element;if(!t)return document.createElement("img");t.replaceChildren();const e=document.createElement("img");return e.style.width="100%",e.style.height="100%",t.appendChild(e),e}onchange(t,e){super.onchange(t,e),"src"in t&&this.onchangesrc(t.src),"play"in t&&this.onchangeplay(t.play)}setElementProperties(t){}onchangeplay(t){const e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){const e=this.buildImg();t||(t="data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw=="),e.src=t,e.setAttribute("rel:animated_src",t),e.setAttribute("rel:auto_play",String(0)),this._superGif=new xp.SuperGif(e,{autoPlay:!1}),this._superGif.init(),this.element&&Array.from(this.element.children).forEach(t=>{t.style.width="100%",t.style.height="100%"});const n=this._superGif.getCanvas();n.style.width="100%",n.style.height="100%",this._superGif.load(()=>{setTimeout(()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()},100)})}ondropfile(t,e){for(let n=0;n<t.length;n++)if(/\.gif$/.test(t[n].name))return void(this.src=e[n])}get src(){return this.getState("src")}set src(t){this.set("src",t)}get play(){return this.getState("play")}set play(t){this.setState("play",t)}get nature(){return wp}get tagName(){return"div"}}qa.register("gif-view",_p);const Ap={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"attachment-selector",label:"src",name:"src",property:{category:"audio"}},{type:"checkbox",label:"started",name:"started"},{type:"checkbox",label:"loop",name:"loop"}],"value-property":"src",help:"scene/component/audio"};class Sp extends(Qa(Ka)){static get image(){return Sp.IMAGE||(Sp.IMAGE=new Image,Sp.IMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAP1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzJYIvAAAAFHRSTlMA8BAwgNBgQKB/wCBwUJDg37CvXyUlBK8AABFYSURBVHja7NsBkqIwFIThTiAQgyBq3/+sm6p1tnamZkaTMhJJf1f4S/JeEIiIiIiIiIiIiIiIiEhD7Hg4BH84TpAKjJ4f3NFCtjVd+InXz2RTs+FXlxGylYHfcVfIJmb+YFWSLUyGVJKKBJJKUo+Rd6w63l/qzLuCkryO5fe0l2xk5mMWbe+v0fNBRqf7S3je6CipQ2ACr+dWcYEpzBFS1plpguatsnomMgdIQSOTuQ5SjmE6/UgK8szgdJIUM/FG41YlFmYJ2kkKsY5ZzAwBurHDk3WGeRY0bvYrGa1+rqNI22f7dS32ZnUK1GMr0eSK3mEc9dhKMxp+ZTo8kT2emOXS5LQ1kCxbJBocSd2k5PaIjMVzjWcdJPk9ooBnmzx1t5XbIxqBKpJ4NGTgzwKiGpK4do72gb+ZUMIYtCPm9WCPMsYTE5k2hq2ZvzujlCE1iRmwf3dvmRyKsT0T7b9I7HEPCpqCiqT2IIqaT1pI0noQZdlFC8l/PbYPAnRORT56VBEE6FXkb49agmByKhJ71BME6FsvEntUFQTdqekisUdlQWCXhovEHtUFAWbTapHYo8YgmFybO3vsUWcQY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}dispose(){super.dispose(),this.started=!1,delete this._audio}async ready(){super.ready(),this._audio=new Audio,this._audio.addEventListener("canplay",()=>{this.started&&this._audio.play()});const{src:t="",loop:e=!1,started:n=!1}=this.state;this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(n)}render(t){const{left:e,top:n,width:r,height:i}=this.state;t.beginPath(),this.drawImage(t,Sp.image,e,n,r,i)}get nature(){return Ap}get hasTextProperty(){return!1}get src(){return this.get("src")}set src(t){this.set("src",t)}get started(){return!!this.get("started")}set started(t){this.set("started",t)}start(){this._audio&&(this._audio.classList.add("active"),this._audio.play())}pause(){this._audio&&(this._audio.classList.remove("active"),this._audio.pause())}onchangeSrc(t){try{"data"!==String(t).substring(0,4)?this._audio.crossOrigin="use-credentials":this._audio.crossOrigin=null,this._audio.src="string"==typeof t?this.app.url(t):t}catch(t){return void Br(t)}}onchangeStarted(t){const e=this._audio;t?4==e.readyState&&e.play():e.pause()}onchangeLoop(t){this._audio.loop=t}onchange(t,e){"src"in t&&this.onchangeSrc(t.src),"started"in t&&this.onchangeStarted(t.started),"loop"in t&&this.onchangeLoop(t.loop)}ondblclick(t){this.started=!this.started}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("audio/"))return void(this.src=e[n])}}qa.register("audio",Sp);class Mp extends(Qa(qa)){is3dish(){return!0}}qa.register("text",Mp);const kp=["refid","left","top","width","height","rotation","animation"];class Ep extends Ld{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});const n=kp.reduce((e,n)=>(t.hasOwnProperty(n)&&(e[n]=t[n]),e),{});return super.set(n,void 0)}capture(t,e,n){const r=super.capture(t,e,n);if(r!==this)return r}set bounds(t){if(this.__MUTATING__)return void(super.bounds=t);const e=this.bounds,n=t.width/e.width,r=t.height/e.height;this.path=this.path.map(i=>({x:t.left+(i.x-e.left)*n,y:t.top+(i.y-e.top)*r})),this.components&&this.components.forEach(t=>{if(t.mutable)t.mutatePath(null,function(t){return t.map(function(t){return{x:t.x*n,y:t.y*r}})});else{const e=t.bounds,i=t.center,s={x:i.x*(1-n),y:i.y*(1-r)},o=e.width*(1-n),a=e.height*(1-r),c=-(s.x-o/2),l=-(s.y-a/2);t.bounds={left:e.left+c,top:e.top+l,width:e.width*n,height:e.height*r}}})}get focusible(){return!1}get bounds(){return super.bounds}get hasTextProperty(){return!1}isIdentifiable(){return!1}calculateBounds(){this.clearCache(),this.__MUTATING__=!0,this.mutateBounds(function(t){const e=qa.union(this.components.map(t=>t.bounds));return this.components.forEach(t=>{const n=t.bounds;t.bounds={left:n.left-e.left,top:n.top-e.top,width:n.width,height:n.height}}),{left:t.left+e.left,top:t.top+e.top,width:e.width,height:e.height}},this),this.__MUTATING__=!1,this.parent.isGroup()&&this.parent.calculateBounds?.()}render(t){}postrender(t){const{top:e,left:n}=this.state;t.translate(n,e),this.layout.drawables(this).forEach(e=>{e.draw(t)}),t.translate(-n,-e)}}qa.memoize(Ep.prototype,"bounds",!0),qa.register("group",Ep);const Cp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"id-input",label:"ref",name:"ref"},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio"]}}],"value-property":"ref",help:"scene/component/local-ref"};class Tp extends(Qa(Ka)){get ref(){const t=this.getState("ref");return t&&"string"==typeof t?this.root.findById?.(t):null}set ref(t){this.setState("ref",t)}get refScale(){const t=this.ref;if(!t)return{x:1,y:1};const e=t.bounds,n=this.bounds,r=n.width/e.width,i=n.height/e.height;return"both"===this.model.fit?{x:r,y:i}:{x:Math.min(r,i),y:Math.min(r,i)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){const e=this.ref.center,n=this.center,r=this.refScale;t.translate(n.x,n.y),t.scale(r.x,r.y),t.translate(-e.x,-e.y)}}postrender(t){if(this.ref)return this.ref.postrender(t);super.postrender(t)}render(t){if(this.ref)return this.ref.render(t);const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),t.rect(e,n,r,i)}get nature(){return Cp}get hasTextProperty(){return!1}}qa.memoize(Tp.prototype,"ref",!1),qa.memoize(Tp.prototype,"refScale",!1),qa.register("local-ref",Tp);class Pp extends(Dd(Sc)){render(t){}is3dish(){return!0}get layout(){return rc.get(this.get("layout"))||ic}}const Op={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"scene-number",name:"ref",placeholder:"SCENE-1"},{type:"number",label:"round",name:"round",property:{min:0}},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio","width","height","none"]}},{type:"select",label:"mode",name:"mode",property:{options:["view","interaction"]}}],"value-property":"ref",help:"scene/component/global-ref"};class Dp extends Pp{dispose(){this._releaseRef(),super.dispose()}get nature(){return Op}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){const{mode:e="view",round:n=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=n+"px"}async ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();const t=this._element_bounds,{offsetWidth:e,offsetHeight:n}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:n},(!t||t.offsetWidth!=e||t.offsetHeight!=n)&&this.ref&&this.root.target_element){const{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();const{ref:t,fit:e="ratio"}=this.state;if(!t)return;const n=this.app.refProvider;if(n&&t)try{this.__ref=await n.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data}catch(t){Br(t)}}get ref(){return this.__ref}set ref(t){this.setState("ref",t)}_releaseRef(){this.__ref&&this.__ref.release&&this.__ref.release(),delete this.__ref}onchange(t,e,n){super.onchange(t,e),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame(()=>{const{fit:t}=this.state;this.ref.fit(t)}),"data"in t&&this.ref&&requestAnimationFrame(()=>{this.ref.data=t.data})}}qa.register("global-ref",Dp);const zp="center-middle",Ip={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"board",name:"board"},{type:"checkbox",label:"modal",name:"modal"},{type:"checkbox",label:"closable",name:"closable"},{type:"checkbox",label:"draggable",name:"draggable"},{type:"checkbox",label:"minimizable",name:"minimizable"},{type:"checkbox",label:"show",name:"show"},{type:"select",label:"popup-position",name:"popupPosition",property:{options:["static","absolute"]}},{type:"select",label:"popup-origin",name:"origin",property:{options:["left-top","center-top","right-top","left-middle",zp,"right-middle","left-bottom","center-bottom","right-bottom","auto"]}},{type:"string",label:"title",name:"text"},{type:"data",label:"value",name:"value"}],help:"scene/component/popup"};class jp extends(Qa(Ka)){static get image(){return jp._image||(jp._image=new Image,jp._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjAgKE1hY2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Yg1SZetTTvUibqeFZ9QlfmvRWoV1VmCaCRzroXPpsuAjTV7gLUfPahBqD1OQMW/fazAWTKvQRI/ZgUSJR7U8CM/dHZ+/2VcatWdvdEZAaYUhiAwkerJXt0rnzXwdRKmHfDM0fHD5kxjTFyVLzVfvvirn7+cDJWjhy7c7XlYuwc6Urvu2tRhRypyhwAf1sKY+TIxfQA+H39q5wxc+RgVrcBduTmZTlj5khnDgH4IzKpMGaOVCbvyyvRGTNHGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),jp._image}async ready(){await super.ready(),this.show&&this.onchangeShow(!0)}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,jp.image,e,n,r,i)}onchange(t,e){"value"in t?this.show?this.onchangeShow(!0):this.show=!0:"show"in t&&this.onchangeShow(this.show)}onchangeShow(t){!this.app.isEditMode&&this.getState("board")&&(t?this.openPopup(this.value):this.hidePopup())}openPopup(t,e){this.app.isEditMode||xc.show(this,this.getState("board"),{origin:this.getState("origin")||zp,modal:this.getState("modal"),closable:this.getState("closable")||!1,draggable:this.getState("draggable")||!1,minimizable:this.getState("minimizable")||!1,popupPosition:this.getState("popupPosition"),title:this.text,data:t||this.value,...e})}hidePopup(){xc.hide(this)}get board(){return this.getState("board")}set board(t){this.set("board",t)}get show(){return this.getState("show")}set show(t){this.setState("show",t)}get started(){return this.getState("show")}set started(t){this.setState("show",t)}get value(){return this.getState("value")}set value(t){this.setState("value",t)}get hasTextProperty(){return!1}get nature(){return Ip}}qa.register("popup",jp);class Rp extends qa{render(t){const{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),this.drawStroke(t,void 0)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let r=!1;return n.forEach((i,s)=>{const o=(s+n.length+1)%n.length,a=i.x,c=i.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(r=!r)}),r}}qa.register("path",Rp);const Lp={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/triangle"};class Fp extends Ka{is3dish(){return!0}contains(t,e){const{x1:n,y1:r,x2:i,y2:s,x3:o,y3:a}=this.state,c=[n,r,i,s,o,a];let l=!1;for(let n=0;n<c.length;n+=2){const r=(n+2)%c.length,i=c[n],s=c[n+1],o=c[r+1];s>e!=o>e&&t<(c[r]-i)*(e-s)/(o-s)+i&&(l=!l)}return l}get mutable(){return!0}get path(){const{x1:t,y1:e,x2:n,y2:r,x3:i,y3:s}=this.state;return[{x:t,y:e},{x:n,y:r},{x:i,y:s}]}set path(t){this.set({x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y,x3:t[2].x,y3:t[2].y})}get nature(){return Lp}}qa.memoize(Fp.prototype,"path",!1),qa.register("triangle",Fp);const Np={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"},Bp={ondragmove:function(t,e,n){let{cx:r,rx:i}=n.model;i=Math.abs(i);let s=(n.fromParent(t.x,t.y).x-r)/i*100;s=s>=100||s<=-100?100:Math.abs(s),n.set({ratio:s})}};class Yp extends $d{is3dish(){return!0}render(t){let{ratio:e=50,cx:n,cy:r,rx:i,ry:s,startAngle:o,endAngle:a,anticlockwise:c}=this.state;i=Math.abs(i),s=Math.abs(s),t.beginPath(),t.ellipse(n,r,i,s,0,o||0,a||2*Math.PI,c),t.moveTo(n+i/100*e,r),t.ellipse(n,r,i/100*e,s/100*e,0,o||0,a||2*Math.PI,!0)}contains(t,e){let{cx:n,cy:r,rx:i,ry:s,ratio:o}=this.state;i=Math.abs(i),s=Math.abs(s);const a=(t-n)/(2*i-.5),c=(e-r)/(2*s-.5),l=(t-n)/(i/100*o*2-.5),h=(e-r)/(s/100*o*2-.5);let u=!1;return a*a+c*c<.25&&l*l+h*h>.25&&(u=!u),u}get controls(){let{cx:t,cy:e,rx:n,ratio:r}=this.state;return n=Math.abs(n),[{x:t+n/100*r,y:e,handler:Bp}]}get nature(){return Np}}qa.memoize(Yp.prototype,"controls",!1),qa.register("donut",Yp);const Gp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"},{type:"number",label:"wing",name:"wing",property:"wing"}],help:"scene/component/star"},Up={ondragmove:function(t,e,n){const{cy:r,ry:i}=n.model;let s=(n.fromParent(t.x,t.y).y-r)/i*100+100;s>=100?s=100:s<=0&&(s=0),n.set({ratio:s})}};class Hp extends $d{is3dish(){return!0}render(t){const{ratio:e=30,wing:n=5,cx:r,cy:i,rx:s,ry:o}=this.state;if(n<3)return;const a=1.5707963267948966,c=2*Math.PI/n,l=s-e/100*s,h=o-e/100*o;t.save(),t.beginPath(),t.translate(r,i),t.moveTo(s*Math.cos(-a),o*Math.sin(-a)),t.lineTo((s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let e=1;e<n;e++)t.lineTo(s*Math.cos(c*e-a),o*Math.sin(c*e-a)),t.lineTo((s-l)*(Math.cos(c*(e+1)-a)+Math.cos(c*e-a))/2,(o-h)*(Math.sin(c*(e+1)-a)+Math.sin(c*e-a))/2);t.closePath(),t.restore()}get controls(){const{cx:t,cy:e,ry:n,ratio:r}=this.state;return[{x:t,y:e-n+n*(r/100),handler:Up}]}get nature(){return Gp}}qa.memoize(Hp.prototype,"controls",!1),qa.register("star",Hp);const Wp={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class Vp extends(Qh(Ka)){is3dish(){return!1}isDescendible(){return!1}render(t){const{cx:e,cy:n,anticlockwise:r}=this.state,i=this.app?.scale||1;t.beginPath(),t.scale(1/i,1/i),t.ellipse(e,n,Math.abs(Vp.RADIUS),Math.abs(Vp.RADIUS),0,0,2*Math.PI,r),t.scale(i,i),t.closePath()}get path(){const{cx:t,cy:e}=this.state;return[{x:t-Vp.RADIUS,y:e-Vp.RADIUS},{x:t+Vp.RADIUS,y:e-Vp.RADIUS},{x:t+Vp.RADIUS,y:e+Vp.RADIUS},{x:t-Vp.RADIUS,y:e+Vp.RADIUS}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:r}=this.state,i=(t-n)/(2*Vp.RADIUS-.5),s=(e-r)/(2*Vp.RADIUS-.5);return i*i+s*s<.25}outline(t){const{cx:e,cy:n}=this.state;return this.toScene(e,n)}get nature(){return Wp}}function Xp(t){return class extends t{animOnValueChange(t,e=!1,n){if(t==this._lastValue)return;let r;r=e?t-(Number(n)||0):t-(this._lastValue||0),this._lastValue=t,this._anim_alpha=-r,this.animate({step:t=>{this._anim_alpha=r*(t-1),this.invalidate()},duration:1e3,delta:"circ",options:{x:1},ease:"out"}).start()}dispose(){super.dispose(),delete this._value_substitutor}onchange(t,e){t.hasOwnProperty("value")&&delete this._value_substitutor}get animAlpha(){return this._anim_alpha||0}get animValue(){return(this._lastValue||0)+(this._anim_alpha||0)}defaultValueSubstitutor(){return this.getState("value")}get valueSubstitutor(){return this._value_substitutor||(this._value_substitutor=ks(this.getState("value"),this,void 0)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(hr(t)))}}}function qp(t){return class extends t{_convertDataFormat(t,e){let n;if("json"===e)n=JSON.parse(t);else n=t;return n}isDataSource(){return!0}}}function Kp(t){return function(e){return Array.isArray(t)?t.forEach(t=>{qa.register(t,e)}):qa.register(t,e),e}}Vp.RADIUS=5,qa.memoize(Vp.prototype,"path",!1),qa.register("node",Vp);let Zp=0;const Qp=new FinalizationRegistry(()=>{Zp--});class Jp{static get residents(){return Zp}static get residentsCount(){return Zp}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,Zp++,Qp.register(this,Zp)}dispose(){if(this.disposer)for(const t in this.references)this.disposer(t,this.references[t]);this.references={},this.counters={}}get ids(){return Object.keys(this.references)}create(t){return new Promise((e,n)=>{this.creator?this.creator(t,n=>{n.release=()=>{this.disposer?.(t,n),delete n.release,Gr("RELEASED",t)},e(n)},n):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))})}add(t,e){const n=new Promise((n,r)=>{const i=this.references[t];if(i)i===e?r(Error("Reference ID and target duplicate")):e?r(Error("Reference ID duplicate")):n(i);else{const i=e=>{e.release=()=>{this.release(e)},this.references[t]=e,this.counters[t]=1,n(e)};if(e)i(e);else{if(!this.creator)return void r(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));this.creator(t,i,r)}}});return this.references[t]||(this.references[t]=n),n}async get(t,e=!1){let n=this.references[t];if(n){if(!(n instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,n}if(e)return n=await n,this.counters[t]++,n}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(const e in this.references){if(this.references[e]===t)return e}}release(t){const e=this._id(t);if(!e)return void Br("No Referenced ID");const n=this.references[e];n&&(this.counters[e]--,0==this.counters[e]&&(this.disposer?.(e,n),delete this.references[e],delete this.counters[e],delete t.release,Gr("RELEASED",e)))}}const $p={},tf={};let ef=[];function nf(t){const e=t.target,n="SCRIPT"===e.tagName?$p:tf,r=e.src||e.href;n[r]=!0,ef.forEach((t,e)=>{if(!t)return;const{resolve:i,scripts:s,styles:o}=t;if(n===$p){const t=s.indexOf(r);t>-1&&t<s.length-1&&sf(s[t+1])}s.some(t=>!$p[t])||o?.some(t=>!tf[t])||(i(),ef[e]=null)}),ef=ef.filter(Boolean)}function rf(t){if("string"==typeof t)return;const e=t.target,n=e.src,r="SCRIPT"===e.tagName?$p:tf;ef.forEach((e,i)=>{if(!e)return;const{reject:s,scripts:o,styles:a}=e;(r===$p&&o.includes(n)||r===tf&&!!a?.includes(n))&&(s(t),ef[i]=null)}),ef=ef.filter(Boolean),delete r[n],document.head.removeChild(e)}function sf(t){$p[t]=!1;const e=document.createElement("script");e.onload=nf,e.onerror=rf,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class of{static load(t,e){const n="string"==typeof t?[t]:t,r="string"==typeof e?[e]:e;return new Promise(function(t,e){if(n&&!Array.isArray(n)||r&&!Array.isArray(r))return void e(new Error("invalid sources for load"));let i,s=!0;if(r?.forEach(t=>{t in tf||function(t){tf[t]=!1;const e=document.createElement("link");e.onload=nf,e.onerror=rf,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),tf[t]||(s=!1)}),n&&n.length>0)for(const t of n)t in $p?$p[t]||(s=!1):i??=t;if(i)sf(i);else if(s)return void t();ef.push({resolve:t,reject:e,scripts:n,styles:r})})}}const af="0.0.0";class cf extends Sh{getObject3dInstance(){return new e.Sprite}build(){super.build(),this.buildMaterial()}get cz(){const{zPos:t=0}=this.component.state,{height:e}=this.component.bounds,{tz:n=0}=this.component.delta();return t+n+e/2}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;uh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=Sh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(t):e.opacity=0)}}function lf(t){if(!(t>0))return 1;let e=0;if(!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function hf(t){const{lineWidth:n=0}=t.state;let{width:r,height:i}=t.bounds;r+=n,i+=n;const s=lf(2*r),o=lf(2*i),a=ih(s,o),c=new e.CanvasTexture(a);return uf(a,t,2),c.needsUpdate=!0,c.wrapS=e.RepeatWrapping,c.wrapT=e.RepeatWrapping,c.offset.set(0,1-2*i/o),c.repeat.set(2*r/s,2*i/o),c.magFilter=e.NearestFilter,c.minFilter=e.LinearFilter,c.colorSpace=e.SRGBColorSpace,c}function uf(t,e,n){const{lineWidth:r=0}=e.state;let{left:i,top:s}=e.bounds;i-=r/2,s-=r/2;const o=t.getContext("2d");o.scale(n,n),o.translate(-i,-s),e.render(o),e.postrender(o)}class df extends cf{buildMaterial(){const t=this.object3d.material;t&&t.dispose(),this.object3d.material=new e.SpriteMaterial({map:hf(this.component),alphaTest:.01,sizeAttenuation:!1})}get scale(){const{width:t,height:e}=this.component.bounds,n=this.threeContainer,{width:r=1,height:i=1}=n?.bounds??{},{scale:s=1}=this.component.state;return{x:s*t/r,y:s*e/i,z:s}}update(){this.build(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateAlpha(){this.update()}updateText(){this.update()}}class pf extends Sh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const t=yh(this.component.state.material3d),n=new e.PlaneGeometry(1,1);n.rotateX(-Math.PI/2),this.object3d.geometry=n;const r=hf(this.component);this.object3d.material=new e.MeshStandardMaterial({map:r,transparent:!0,alphaTest:.01,side:e.DoubleSide,metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity}),this.object3d.castShadow=t.castShadow,this.object3d.receiveShadow=t.receiveShadow}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;uh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}update(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateText(){this.update()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=yh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return _h(this.object3d),super.clear()}}class ff extends Sh{getObject3dInstance(){return new e.Mesh}build(){super.build(),this.buildGeometry(),this.buildMaterial()}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;uh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=Sh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(t):e.opacity=0)}updateStrokeStyle(){const t=this.object3d.getObjectByName("__edgeLines__");t&&(this.object3d.remove(t),_h(t));const{strokeStyle:n}=this.component.state;if(!n||"transparent"===n||"none"===n)return;const r=this.object3d.geometry;if(!r?.getAttribute("position"))return;const i=new e.EdgesGeometry(r),s=new e.LineBasicMaterial({color:n}),o=new e.LineSegments(i,s);o.name="__edgeLines__",this.object3d.add(o)}updateDimension(){const{width:t,height:e}=this.component.bounds,{depth:n=1}=this.component.state;if(!this.object3d)return;this.object3d.geometry.computeBoundingBox();const r=this.object3d.geometry.boundingBox;if(r){const i=r.max.x-r.min.x,s=r.max.y-r.min.y,o=r.max.z-r.min.z;this.object3d.scale.set(t/i,n/s,e/o)}}buildMaterial(){const t=yh(this.component.state.material3d);this.object3d.material=new e.MeshStandardMaterial({transparent:!0,side:vh(t.side),metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity,opacity:t.opacity,envMapIntensity:t.envMapIntensity})}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=yh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.opacity=e.opacity,t.transparent=e.opacity<1,t.envMapIntensity=e.envMapIntensity,t.side=vh(e.side)}clear(){return _h(this.object3d),super.clear()}}function gf(t,e,n,r){return[["bold",t],["italic",e],[n+"px",!0],[r,!0]].filter(t=>t[1]).map(t=>t[0]).join(" ")}function mf(t){let e=0;if(t&&!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function yf(t,e,n){const{bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black"}=n||{},c=t.getContext("2d");c.imageSmoothingEnabled=!1,c.fillStyle=a,c.strokeStyle=a,c.font=gf(r,i,o,s),c.textBaseline="top",c.textAlign="left",c.fillText(String(e),0,0)}function bf(t,n,r,i){const s=mf(2*n),o=mf(2*r),a=ih(s,o);a.getContext("2d").scale(2,2),yf(a,t,i);const c=new e.CanvasTexture(a);return c.needsUpdate=!0,c.wrapS=e.RepeatWrapping,c.wrapT=e.RepeatWrapping,c.offset.set(0,1-2*r/o),c.repeat.set(2*n/s,2*r/o),c.minFilter=e.LinearFilter,c.colorSpace=e.SRGBColorSpace,c}function vf(t,e){let{bold:n=!1,italic:r=!1,fontFamily:i="Serif",fontSize:s=10,lineHeight:o="normal"}=e||{};t=void 0===t||""==t?" ":String(t);const a=document.createElement("span");a.style.font=gf(n,r,s,i),a.style.lineHeight=String(o),a.style.whiteSpace="pre",a.style.position="absolute",a.textContent=t,document.body.appendChild(a);const c=a.getBoundingClientRect();return document.body.removeChild(a),{width:c.width,height:c.height}}class xf extends ff{get syncZPosOffset(){return this.effectiveDepth}buildGeometry(){}updateDimension(){const{width:t,height:n}=this.component.state;this.object3d.geometry&&this.object3d.geometry.dispose();const r=new e.PlaneGeometry(t,n);r.rotateX(-Math.PI/2),this.object3d.geometry=r}updateText(){const t=this.object3d.material;if(!t)return;const{width:e,height:n,bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",fillStyle:c}=this.component.state,l=bf(this.component.text,e,n,{bold:r,italic:i,fontFamily:s,fontSize:o,fontColor:a});l?(t.map&&t.map.dispose(),t.map=l,l.needsUpdate=!0):"string"==typeof c&&("transparent"!==c?t.color.set(c):t.opacity=0)}updateAlpha(){const{alpha:t=1,fontColor:e="black"}=this.component.state;uh(this.object3d.material,t,e),this.object3d.material.transparent=!0}}Ch("text",t=>new xf(t));class wf extends Sh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const{width:t,height:n}=this.component.bounds;if(!t||!n)return;const r=yh(this.component.state.material3d),i=new e.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const s=hf(this.component);this.object3d.material=new e.MeshStandardMaterial({map:s,transparent:!0,side:e.DoubleSide,metalness:r.metalness,roughness:r.roughness,emissive:new e.Color(r.emissive),emissiveIntensity:r.emissiveIntensity}),this.object3d.castShadow=r.castShadow,this.object3d.receiveShadow=r.receiveShadow}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;uh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}_debouncedRebuild(){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=void 0,this._rebuildTexture()},100)}_rebuildTexture(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}updateFillStyle(){this._debouncedRebuild()}updateStrokeStyle(){this._debouncedRebuild()}updateText(){this._debouncedRebuild()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=yh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),_h(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),super.dispose()}}const _f={input:"css3d",select:"css3d",textarea:"css3d",button:"css3d",iframe:"css3d",video:"css3d",label:"texture",table:"texture",progress:"texture"};function Af(t){const e=function(t){const e=t.state?.material3d?.renderMode;if("css3d"===e||"texture"===e)return e;const n=t.model?.type??"";return _f[n]??"css3d"}(t);return"texture"===e?new wf(t):new Mh(t)}Ch("html-overlay-element",Af),Ch("html-overlay-container",Af);class Sf{setShape({extrudedShape:t,extrudedOptions:n}){this.extrudedShape=t,this.bb=new e.Box2,this.bb.setFromPoints(this.extrudedShape?.extractPoints(0).shape),this.extrudedOptions=n}generateTopUV(t,n,r,i,s){const o=n[3*r],a=n[3*r+1],c=n[3*i],l=n[3*i+1],h=n[3*s],u=n[3*s+1],d=this.bb,p=d.max.x-d.min.x,f=d.max.y-d.min.y;return[new e.Vector2((o-d.min.x)/p,1-(a-d.min.y)/f),new e.Vector2((c-d.min.x)/p,1-(l-d.min.y)/f),new e.Vector2((h-d.min.x)/p,1-(u-d.min.y)/f)]}generateSideWallUV(t,n,r,i,s,o){const a=n[3*r],c=n[3*r+1],l=n[3*r+2],h=n[3*i],u=n[3*i+1],d=n[3*i+2],p=n[3*s],f=n[3*s+1],g=n[3*s+2],m=n[3*o],y=n[3*o+1],b=n[3*o+2],v=this.extrudedOptions?.depth||100,x=this.bb,w=x.max.x-x.min.x,_=x.max.y-x.min.y;return Math.abs(c-u)<.01?[new e.Vector2(a/w,1-l/v),new e.Vector2(h/w,1-d/v),new e.Vector2(p/w,1-g/v),new e.Vector2(m/w,1-b/v)]:[new e.Vector2(c/_,1-l/v),new e.Vector2(u/_,1-d/v),new e.Vector2(f/_,1-g/v),new e.Vector2(y/_,1-b/v)]}}class Mf extends Sh{clear(){return this._mesh=void 0,super.clear()}get shape(){return null}get boundUVGenerator(){return this._boundUVGenerator||(this._boundUVGenerator=new Sf),this._boundUVGenerator}build(){super.build();const t=this.effectiveDepth,n=this.shape;if(!n)return;const r=this.boundUVGenerator;r&&r.setShape({extrudedShape:n,extrudedOptions:{depth:t}});const i=this.createGeometry(n),s=this.createMaterials();this._mesh=new e.Mesh(i,s),this._mesh.rotation.x=-Math.PI/2,this._mesh.rotation.y=-Math.PI,this._mesh.rotation.z=-Math.PI,this._mesh.castShadow=!0,this.object3d.add(this._mesh),this.updateFillStyle(),this.updateStrokeStyle()}createGeometry(t){const n=this.effectiveDepth,{lineWidth:r=0}=this.component.state,i={steps:1,depth:n,bevelEnabled:r>0,bevelThickness:0,bevelSize:r,bevelSegments:1,UVGenerator:this.boundUVGenerator},s=new e.ExtrudeGeometry(t,i);return s.center(),s}createMaterials(){const t=yh(this.component.state.material3d),n={metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity,opacity:t.opacity,transparent:t.opacity<1,envMapIntensity:t.envMapIntensity,side:vh(t.side)};return[new e.MeshStandardMaterial(n),new e.MeshStandardMaterial(n)]}createTexture(){function t(t){let e=0;if(t&&!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}const{width:n,height:r}=this.component.bounds,i=t(n),s=t(r),o=ih(i,s);this.component.render(o.getContext("2d"));const a=new e.CanvasTexture(o);return a.needsUpdate=!0,a.wrapS=e.RepeatWrapping,a.wrapT=e.RepeatWrapping,a.offset.set(0,1-r/s),a.repeat.set(n/i,r/s),a.minFilter=e.LinearFilter,a}getMaterials(){if(!this._mesh)return;const t=this._mesh.material;return Array.isArray(t)?t:void 0}updateMaterial3d(){super.updateMaterial3d();const t=yh(this.component.state.material3d),e=vh(t.side),n=this.getMaterials();if(n)for(const r of n)r.metalness=t.metalness,r.roughness=t.roughness,r.emissive.set(t.emissive),r.emissiveIntensity=t.emissiveIntensity,r.opacity=t.opacity,r.transparent=t.opacity<1,r.envMapIntensity=t.envMapIntensity,r.side=e}updateAlpha(){const{alpha:t=1,fillStyle:e,strokeStyle:n}=this.component.state,r=this.getMaterials();r&&(uh(r[0],t,e),uh(r[1],t,n))}updateStrokeStyle(){const t=this.getMaterials();if(!t)return;const{strokeStyle:e}=this.component.state;t[1].color.set(e)}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.getMaterials();if(!e)return;const n=e[0],r=Sh.buildFillStyleTexture(this.component);r?(n.map&&n.map.dispose(),n.map=r):n.color.set(t)}updateDimension(){super.updateDimension()}}class kf extends Mf{get shape(){const{cx:t=0,cy:n=0,rx:r=1,ry:i=1,startAngle:s=0,endAngle:o=2*Math.PI,anticlockwise:a=!1}=this.component.state,c=new e.EllipseCurve(t,n,Math.abs(r),Math.abs(i),s,o,a,0);return new e.Shape(c.getPoints(50))}}Ch("ellipse",t=>new kf(t));class Ef extends Mf{get shape(){const{width:t,height:n,round:r}=this.component.state,i=new e.Shape;if(r>0){const e=r/100*(t/2);i.moveTo(e,0),i.lineTo(t-e,0),i.quadraticCurveTo(t,0,t,e),i.lineTo(t,n-e),i.quadraticCurveTo(t,n,t-e,n),i.lineTo(e,n),i.quadraticCurveTo(0,n,0,n-e),i.lineTo(0,e),i.quadraticCurveTo(0,0,e,0)}else i.moveTo(0,0),i.lineTo(t,0),i.lineTo(t,n),i.lineTo(0,n),i.lineTo(0,0);return i}}Ch("rect",t=>new Ef(t));class Cf extends Mf{get shape(){const{path:t=[],round:n=0}=this.component.state,r=new e.Shape;for(let e=0;e<t.length;e++){const i=t[(e-1+t.length)%t.length],s=t[(e+t.length)%t.length],o=t[(e+1)%t.length];if(i.x===s.x&&i.y===s.y)continue;let a=Math.sqrt((i.x-s.x)*(i.x-s.x)+(i.y-s.y)*(i.y-s.y)),c=0!==a?Math.atan2(i.x-s.x,i.y-s.y):0,l=Math.sin(c)*Math.min(n,a/2)+s.x,h=Math.cos(c)*Math.min(n,a/2)+s.y;const u=n>0||0!==a?{x:l,y:h}:s;a=Math.sqrt((o.x-s.x)*(o.x-s.x)+(o.y-s.y)*(o.y-s.y)),c=0!==a?Math.atan2(o.x-s.x,o.y-s.y):0,l=Math.sin(c)*Math.min(n,a/2)+s.x,h=Math.cos(c)*Math.min(n,a/2)+s.y;const d=n>0||0!==a?{x:l,y:h}:s;0==e?r.moveTo(u.x,u.y):r.lineTo(u.x,u.y),n>0&&r.quadraticCurveTo(s.x,s.y,d.x,d.y)}return r}get minMax(){if(!this._minMax){const{path:t}=this.component.state;let e,n,r,i;t.forEach((t,s)=>{if(0==s)return e=r=t.x,void(n=i=t.y);e=Math.min(e,t.x),r=Math.max(r,t.x),n=Math.min(n,t.y),i=Math.max(i,t.y)}),this._minMax={minX:e,minY:n,maxX:r,maxY:i}}return this._minMax}}Ch("polygon",t=>new Cf(t));class Tf extends Mf{get shape(){const{cx:t=0,cy:n=0,rx:r=1,ry:i=1,ratio:s=50,startAngle:o=0,endAngle:a=2*Math.PI,anticlockwise:c=!1}=this.component.state,l=Math.abs(r),h=Math.abs(i),u=new e.EllipseCurve(t,n,l,h,o,a,c,0),d=new e.Shape(u.getPoints(50)),p=l/100*s,f=h/100*s;if(p>0&&f>0){const r=new e.EllipseCurve(t,n,p,f,o,a,c,0),i=new e.Path(r.getPoints(50));d.holes.push(i)}return d}}Ch("donut",t=>new Tf(t));class Pf extends Mf{get shape(){const{x1:t=0,y1:n=0,x2:r=0,y2:i=0,x3:s=0,y3:o=0}=this.component.state,a=new e.Shape;return a.moveTo(t,n),a.lineTo(r,i),a.lineTo(s,o),a.closePath(),a}}Ch("triangle",t=>new Pf(t));class Of extends Mf{get shape(){const{ratio:t=30,wing:n=5,cx:r=0,cy:i=0,rx:s=1,ry:o=1}=this.component.state;if(n<3)return null;const a=Math.PI/2,c=2*Math.PI/n,l=s-t/100*s,h=o-t/100*o,u=new e.Shape;u.moveTo(r+s*Math.cos(-a),i+o*Math.sin(-a)),u.lineTo(r+(s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,i+(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let t=1;t<n;t++)u.lineTo(r+s*Math.cos(c*t-a),i+o*Math.sin(c*t-a)),u.lineTo(r+(s-l)*(Math.cos(c*(t+1)-a)+Math.cos(c*t-a))/2,i+(o-h)*(Math.sin(c*(t+1)-a)+Math.sin(c*t-a))/2);return u.closePath(),u}}Ch("star",t=>new Of(t));const Df={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/sphere"};class zf extends ff{buildGeometry(){const{rx:t=0,ry:n=0,rz:r}=this.component.state,i=r??t,s=new e.SphereGeometry(1,32,16);s.scale(t,i,n),this.object3d.geometry=s}updateDimension(){this.buildGeometry()}}let If=class extends $d{is3dish(){return!0}buildRealObject(){return new zf(this)}get nature(){return Df}};If=Cd([Kp("sphere")],If);const jf={mutable:!1,resizable:!0,rotatable:!0,properties:[]};let Rf=class extends(Qa(Ka)){is3dish(){return!0}buildRealObject(){return new df(this)}get nature(){return jf}};Rf=Cd([Kp("sprite")],Rf);const Lf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cube"};class Ff extends ff{buildGeometry(){const{width:t=0,height:n=0,depth:r=0}=this.component.state,i=new e.BoxGeometry(1,1,1);i.scale(t,r,n),this.object3d.geometry=i}}let Nf=class extends(Qa(Ka)){is3dish(){return!0}buildRealObject(){return new Ff(this)}get nature(){return Lf}};Nf=Cd([Kp("cube")],Nf);const Bf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cylinder"};class Yf extends ff{buildGeometry(){const{rx:t=0,ry:n=0}=this.component.state,r=this.component.state.depth??1,i=new e.CylinderGeometry(1,1,1,25);i.scale(t||1,r||1,n||1),this.object3d.geometry=i}updateDimension(){this.buildGeometry()}}let Gf=class extends $d{is3dish(){return!0}buildRealObject(){return new Yf(this)}get nature(){return Bf}};Gf=Cd([Kp("cylinder")],Gf);const Uf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"color",label:"box-color",name:"boxColor",property:"boxColor"}],help:"scene/component/banner"};class Hf extends Sh{build(){super.build();const{width:t=1,height:e=1,depth:n=1}=this.component.state;this.object3d.add(this.createCube(t,e,n));const r=this.createTextureBoard(t,n);r.position.set(0,0,.5*e+1),this.object3d.add(r)}createCube(t,n,r){const{boxColor:i="#ccaa76"}=this.component.state,s=yh(this.component.state.material3d),o=new e.BoxGeometry(t,r,n),a=new e.MeshStandardMaterial({color:i,side:e.FrontSide,metalness:s.metalness,roughness:s.roughness,emissive:new e.Color(s.emissive),emissiveIntensity:s.emissiveIntensity}),c=new e.Mesh(o,a);return c.castShadow=s.castShadow,c.receiveShadow=s.receiveShadow,c}createTextureBoard(t,n){let r;const i=yh(this.component.state.material3d),{fillStyle:s="#ccaa76"}=this.component.state,o=Sh.buildFillStyleTexture(this.component);r=o?new e.MeshStandardMaterial({map:o,metalness:i.metalness,roughness:i.roughness,emissive:new e.Color(i.emissive),emissiveIntensity:i.emissiveIntensity}):new e.MeshStandardMaterial({color:s||"#ccaa76",side:e.FrontSide,metalness:i.metalness,roughness:i.roughness,emissive:new e.Color(i.emissive),emissiveIntensity:i.emissiveIntensity});const a=new e.PlaneGeometry(t,n,1,1),c=new e.Mesh(a,r);return c.castShadow=i.castShadow,c.receiveShadow=i.receiveShadow,c}updateMaterial3d(){super.updateMaterial3d();const t=yh(this.component.state.material3d);this.object3d.traverse(e=>{if(e.isMesh){const n=e.material;n&&(n.metalness=t.metalness,n.roughness=t.roughness,n.emissive.set(t.emissive),n.emissiveIntensity=t.emissiveIntensity),e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow}})}}let Wf=class extends(Qa(Ka)){is3dish(){return!0}get nature(){return Uf}buildRealObject(){return new Hf(this)}};var Vf;Wf=Cd([Kp("banner")],Wf);const Xf={far:1e5,fov:80,near:1,zoom:1},qf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"near",name:"near"},{type:"number",label:"far",name:"far"},{type:"number",label:"fov",name:"fov"},{type:"number",label:"zoom",name:"zoom"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/camera"};class Kf extends Sh{getObject3dInstance(){return new e.Mesh}updateCamera(){const{near:t=Xf.near,far:n=Xf.far,fov:r=Xf.fov,zoom:i=Xf.zoom,showHelper:s}=this.component.state;this.camera.far=n,this.camera.fov=r,this.camera.near=t,this.camera.zoom=i,s?this.helper||(this.helper=new e.CameraHelper(this.camera),this.object3d.add(this.helper)):this.helper&&(this.object3d.remove(this.helper),delete this.helper)}build(){super.build();const{width:t=0,height:n=0,depth:r=0,fillStyle:i="lightgray"}=this.component.state;this.object3d.geometry=new e.BoxGeometry(t,r,n),this.object3d.material=new e.MeshStandardMaterial({color:i,side:e.FrontSide}),this.camera=new e.PerspectiveCamera,this.camera.position.set(0,0,0),this.object3d.add(this.camera),this.object3d.lookAt(0,0,0),this.updateCamera()}}let Zf=Vf=class extends(Qa(Ka)){is3dish(){return!0}static get image(){return Vf._image||(Vf._image=new Image,Vf._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1IAAANSAQMAAABV6G1EAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEX6+voBAQGV71ZvAAAFO0lEQVR42u3dMZLkNBiGYakUKFRIqKOISxDvETiCTBEQcgQOQE7clyAi8REm7KDXIhgYoMa/7fbIX+2K9w022MCP/25Z28GW5RwRERERERERERERERERERERERERERERERERERERERERERERERHRl9mv7fdPn7879sf8Mcq3J3r5EJXaUy3Wddrcd6qNybx9F2/lZ63H+nVCa9Oe9elZa5ksa/dDbE+3fsm4v27C89bd+i6W3l+XdcnSWtuxyvPW+hqorbWb0Jr7Pl3m4tjfVMIZ625d6L5pxTPWw7rQY9P6pqu1dF8aq5d83cE3rXrGWluIxV6h53eotv4c1V3Ln7Nm66ZvvZf8SSues16sD2jubz2sC839fmvYiz7t//LJna27wsr7VjlnNWtPeHTfNlae2bZvnaTePUd+74fqV2LNxv6zdN8O3z9HSWhlc4F+dOvdsKbe2+F7q+zPddq6W2ts6r31vrN825/rtPWwvvcL5losy11uxQNz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Grzf9smmdWhyTddNzf8t8UqdtK/dZGq8P2DZ1ZnHcrQ/osWO5PkvDuby7NE58Yctk7Qq3PSv3+bpc3F0aJ56wF+uLX9xu6eOb4es9z/vWc0vR3oZuByjnf2t/fP/54B/2WvvWEREREREREREREREREREREREREREREREREREREREREREREREREX2J/QlrTpqHD8xO1gAAAABJRU5ErkJggg=="),Vf._image}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,Vf.image,e,n,r,i)}buildRealObject(){return new Kf(this)}get nature(){return qf}};Zf=Vf=Cd([Kp("camera")],Zf);const Qf="KHR_materials_pbrSpecularGlossiness";class Jf{constructor(t){this.name=Qf,this.parser=t}extendMaterialParams(t,e){const s=this.parser.json.materials?.[t],o=s?.extensions?.[Qf];if(!o)return Promise.resolve();const a=[];if(Array.isArray(o.diffuseFactor)){const[t,i,s,a]=o.diffuseFactor;e.color||(e.color=new n),e.color.setRGB(t,i,s,r),e.opacity=a}null!=o.diffuseTexture&&a.push(this.parser.assignTexture(e,"map",o.diffuseTexture,i));const c=o.glossinessFactor??1;e.roughness=1-c;const l=o.specularFactor??[1,1,1],h=Math.max(l[0],l[1],l[2]);return e.metalness=h>.5?h:0,Promise.all(a)}}const $f={once:e.LoopOnce,repeat:e.LoopRepeat,pingpong:e.LoopPingPong};class tg extends Sh{constructor(){super(...arguments),this.objectSize=new e.Vector3,this._nodeIndex=new Map,this._originals=new Map,this._animationActions=new Map,this._fillStyleOriginals=new Map,this._loadGen=0}static _getSharedLoader(t){if(!tg._sharedLoader){const t=new w;!function(t){t.register(t=>new Jf(t))}(t);const e=new _;e.setDecoderPath("/node_modules/three/examples/jsm/libs/draco/"),t.setDRACOLoader(e);const n=new A;n.setTranscoderPath("/node_modules/three/examples/jsm/libs/basis/"),t.setKTX2Loader(n),t.setMeshoptDecoder(S),t.setCrossOrigin("anonymous"),tg._sharedLoader=t}return tg._sharedLoader.ktx2Loader?.detectSupport(t),tg._sharedLoader}build(){super.build();const{src:t}=this.component.state;if(!t)return void this.clear();const e=++this._loadGen,n=tg._getSharedLoader(this.threeContainer.renderer3d),r=this.component.app.url(t);n.load(r,t=>{e===this._loadGen&&this.gltfLoaded(t)},void 0,t=>{e===this._loadGen&&(Br("GLTFLoader.load",t),this.clear(),this._showErrorPlaceholder(),this.component.setState({loadError:String(t)}))})}gltfLoaded(t){this.component.state.loadError&&this.component.setState({loadError:void 0});const n=t.scene,r=t.animations,i=n.clone();i.userData.context=this,i.traverse(t=>{t.isMesh&&(t.castShadow=!0)});const s=(new e.Box3).setFromObject(i),o=s.getCenter(i.position),a=s.getSize(new e.Vector3);o.multiplyScalar(-1),this.clear(),this.objectSize=a,this.pivot=new e.Object3D,this.object3d.add(this.pivot),this.pivot.add(i),this._buildNodeIndex(i),this.updateDimension(),r&&r.length&&this._setupAnimations(r);const c=this.component.state.nodes;c&&this._applyNodeStates(c),this.updateFillStyle()}_buildNodeIndex(t){this._nodeIndex.clear(),this._originals.clear(),t.traverse(t=>{if(!t.name)return;this._nodeIndex.set(t.name,t);const e={visible:t.visible,scale:t.scale.clone()};if(t.isMesh){const n=t.material;n&&(e.color=n.color.clone(),e.opacity=n.opacity,e.transparent=n.transparent,e.emissive=n.emissive.clone(),e.emissiveIntensity=n.emissiveIntensity)}this._originals.set(t.name,e)})}getNode(t){return this._nodeIndex.get(t)}get nodeNames(){return Array.from(this._nodeIndex.keys())}_applyNodeStates(t){for(const[e,n]of Object.entries(t)){const t=this._nodeIndex.get(e);if(t&&(void 0!==n.visible&&(t.visible=n.visible),void 0!==n.scale&&t.scale.setScalar(n.scale),t.isMesh)){const e=t.material;if(!e)continue;void 0!==n.color&&e.color.set(n.color),void 0!==n.opacity&&(e.opacity=n.opacity,e.transparent=n.opacity<1),void 0!==n.emissive&&e.emissive.set(n.emissive),void 0!==n.emissiveIntensity&&(e.emissiveIntensity=n.emissiveIntensity)}}}_resetNode(t){const e=this._nodeIndex.get(t),n=this._originals.get(t);if(e&&n&&(e.visible=n.visible,e.scale.copy(n.scale),e.isMesh)){const t=e.material;t&&n.color&&(t.color.copy(n.color),t.opacity=n.opacity,t.transparent=n.transparent,t.emissive.copy(n.emissive),t.emissiveIntensity=n.emissiveIntensity)}}_resetAllNodes(){for(const t of this._originals.keys())this._resetNode(t)}_setupAnimations(t){const e=this.threeContainer.mixer;this._animationActions.clear();for(const n of t){const t=e.clipAction(n);this._animationActions.set(n.name,t)}!1!==this.component.state.autoPlay&&this._animationActions.forEach(t=>t.play());const n=this.component.state.animations;n&&this._applyAnimationStates(n)}_applyAnimationStates(t){for(const[n,r]of Object.entries(t)){const t=this._animationActions.get(n);t&&(void 0!==r.loop&&(t.loop=$f[r.loop]??e.LoopRepeat,"once"===r.loop&&(t.clampWhenFinished=!0)),void 0!==r.speed&&(t.timeScale=r.speed),void 0!==r.weight&&(t.weight=r.weight),void 0!==r.play&&(r.play?t.play():t.stop()))}}get animationNames(){return Array.from(this._animationActions.keys())}_showErrorPlaceholder(){const t=new e.BoxGeometry(1,1,1),n=new e.MeshStandardMaterial({color:13369344,wireframe:!0}),r=new e.Mesh(t,n);r.name="__error_placeholder__",this.object3d.add(r)}updateFillStyle(){const t=this.component.state.fillStyleTargets;if(!t||0===t.length)return;const{fillStyle:e}=this.component.state;if(!e)return;const n=Sh.buildFillStyleTexture(this.component);for(const r of t){const t=this._nodeIndex.get(r);if(!t||!t.isMesh)continue;const i=t.material;i&&(this._fillStyleOriginals.has(r)||this._fillStyleOriginals.set(r,{color:i.color.clone(),map:i.map,opacity:i.opacity,transparent:i.transparent}),n?(i.map&&i.map!==this._fillStyleOriginals.get(r)?.map&&i.map.dispose(),n.needsUpdate=!0,i.map=n):"string"==typeof e&&("transparent"!==e?i.color.set(e):(i.opacity=0,i.transparent=!0)))}}_restoreFillStyleTargets(t){for(const e of t){const t=this._fillStyleOriginals.get(e);if(!t)continue;const n=this._nodeIndex.get(e);if(!n||!n.isMesh)continue;const r=n.material;r&&(r.map&&r.map!==t.map&&r.map.dispose(),r.color.copy(t.color),r.map=t.map,r.opacity=t.opacity,r.transparent=t.transparent,this._fillStyleOriginals.delete(e))}}clear(){return this._animationActions.forEach(t=>t.stop()),this._animationActions.clear(),this._nodeIndex.clear(),this._originals.clear(),this._fillStyleOriginals.clear(),this.pivot&&_h(this.pivot),this.pivot=void 0,this.objectSize=void 0,super.clear()}updateDimension(){const{width:t=1,height:e=1,depth:n=1}=this.component.state,{x:r=1,y:i=1,z:s=1}=this.objectSize||{};this.pivot&&this.pivot.scale.set(t/r,n/i,e/s),this.component.invalidate()}updateSource(){this.build()}onchange(t,e){if(super.onchange(t,e),"src"in t&&this.updateSource(),"nodes"in t){this._resetAllNodes();const e=t.nodes;e&&Object.keys(e).length>0&&this._applyNodeStates(e)}if("animations"in t){const e=t.animations;e&&this._applyAnimationStates(e)}if("fillStyleTargets"in t){const t=e.fillStyleTargets??[];t.length>0&&this._restoreFillStyleTargets(t),this.updateFillStyle()}"autoPlay"in t&&(!1!==t.autoPlay?this._animationActions.forEach(t=>t.play()):this._animationActions.forEach(t=>t.stop()))}}var eg;tg._sharedLoader=null;const ng={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"gltf-selector",label:"url",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"3d-model",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0,category:"application"},observe:function(t){this.parentNode.querySelector("[name=gltfInfo]").src=t;const e=this.parentNode.querySelector("[name=fillStyleTargets]");e&&(e.src=t)}},{type:"gltf-info",label:"",name:"gltfInfo",readonly:!0,property:{action:(t,e)=>{t.set(e)}},editor:{fullwidth:!0}},{type:"gltf-fill-targets",label:"fill-targets",name:"fillStyleTargets",editor:{fullwidth:!0}}],"value-property":"source",help:"scene/component/gltf-object"};let rg=eg=class extends(Qa(Ka)){is3dish(){return!0}static get image(){return eg._image||(eg._image=new Image,eg._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAA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c8vLvPUu++khOUpH86Ce2FAnnBYQuSCS2lJ195dhq8t2V2MpyZhrbFgK0839FrhtZGDfzntdViHu5ctgRSlrb9R1tcnz/camrrMm/aKwHnQ0MZ9l8+t9o6dMiuM1l1CBABoSeRwqGhpHBbAD0TC9tkE3ibhFzJrF69GApNvBNrhOW2BWR9pwjNor1vv1XHmRno0bGZVKF1l2EzlANP5LiWNn3H8Kl2U5vPvNV7IHRyQBjJ8OSlKBLH/22rWxZgqSRq7XXYPPGeg4+1QQjyJGxpsSoj82EDiFtd6JFkMRktfHyAUAQan88STRamGS/BzrjcHd8poYj7RD4D8hmQ2yRMs1/oj0tWQdL0Rj0leW36RPn6akpep2S7kcnqaVK9a4GMLQpdobRstXNMenZNNCeyavhzHVwQ740vCb2VY3HMsM94o1mAmhpafU42NNJtnhnpMc112fXh5YRc9YWy38kGTw5aJve0GfwpUeXGAXgzPYKfM43NeJndSK8Xuqyc1+uojauNHuhxsFFZzdPgtQ4JfpvgFRmBrIH6mrUy8xGxZSEiuWQtTx/wmeY2G2fliqBj0G+28bp0g9OuYWjNNDO8MMldPFNI8hsxcdN/IqFHmjjtdQRysZlAcHUxwYfaDf4A5EhMULm6S5hR+PL4Jkx7EYGMEsWzHg3L1WXBW6ZZYKxC3ukq4l+QNRbpGcchSCSEJkyLto9ijuBu7AXQZxt5GyZtVsrrK2kWWcrMUuv/ZkPjUXmWzuK9XS5DM4Cg7RJZcToIz3Y0fPohLWr6jKTqb0fRqyN/BH2xtiD+FhQ/h367kTejByq9cBvlLyWbN1R2/OKBp25wx/gT4u49IbRUAvDGrVoUPAf1FlE82oFnt3YTxWMSzB0yXCkl9CdE8eDZKFHn4Nn/BBgAXGwlQW2JqMAAAAAASUVORK5CYII="),eg._image}get controls(){return[]}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,eg.image,e,n,r,i)}buildRealObject(){return new tg(this)}get nature(){return ng}get source(){return this.getState("src")}set source(t){this.setState("src",t)}set dimension(t){const{width:e=1,height:n=1,depth:r=1}=t;this.setState({width:e,height:n,depth:r}),this.realObject?.updateDimension()}get nodes(){return this.getState("nodes")}set nodes(t){this.setState("nodes",t)}get animations(){return this.getState("animations")}set animations(t){this.setState("animations",t)}get autoPlay(){return!1!==this.getState("autoPlay")}set autoPlay(t){this.setState("autoPlay",t)}get fillStyleTargets(){return this.getState("fillStyleTargets")}set fillStyleTargets(t){this.setState("fillStyleTargets",t)}get nodeNames(){const t=this.realObject;return t?.nodeNames??[]}get animationNames(){const t=this.realObject;return t?.animationNames??[]}};rg=eg=Cd([Kp("gltf-object")],rg);const ig={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"light-type",name:"lightType",property:{options:["","point","directional"]}},{type:"number",label:"intensity",name:"intensity"},{type:"number",label:"distance",name:"distance"},{type:"number",label:"decay",name:"decay"},{type:"checkbox",label:"cast-shadow",name:"castShadow"},{type:"number",label:"near",name:"near",placeholder:"0.5"},{type:"number",label:"far",name:"far",placeholder:"1000"},{type:"number",label:"fov",name:"fov",placeholder:"90"},{type:"number",label:"zoom",name:"zoom",placeholder:"1"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/light"};class sg extends Sh{updatePointLight(){const{lightType:t="point",distance:n=0,intensity:r=10,decay:i=1,fillStyle:s="white",castShadow:o,near:a=.5,far:c=1e3,fov:l=90,zoom:h=1,showHelper:u}=this.component.state;if(this.object3d.color=new e.Color(s),"point"==t&&(this.object3d.distance=n,this.object3d.decay=i),this.object3d.intensity=r,this.object3d.castShadow=o,o){const t=this.object3d.shadow?.camera;t.far=c,t.near=a,t.fov=l,t.zoom=h}if(u){const t=this.object3d.shadow?.camera;this.helper||(this.helper=new e.CameraHelper(t),this.object3d.add(this.helper))}else this.helper&&(this.object3d.remove(this.helper),delete this.helper)}getObject3dInstance(){const{lightType:t="point"}=this.component.state;return"point"==t?new e.PointLight:new e.DirectionalLight}update(){this.clear(),this.build(),this.updateDimension(),this.updateHidden(),this.updatePointLight()}}let og=class extends $d{is3dish(){return!0}buildRealObject(){return new sg(this)}get anchors(){return[]}get nature(){return ig}};og=Cd([Kp("light")],og);const ag={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"}],help:"scene/component/wall"};class cg extends ff{buildGeometry(){const{width:t=0,height:n=0,depth:r=0}=this.component.state,i=new e.BoxGeometry(1,1,1);i.scale(t,r,n),this.object3d.geometry=i}}let lg=class extends(Qa(Ka)){is3dish(){return!0}buildRealObject(){return new cg(this)}get nature(){return ag}};lg=Cd([Kp("wall")],lg);class hg extends Sh{build(){super.build()}update(){}}const ug={far:1e5,fov:80,near:1,zoom:1};class dg extends Sh{build(){super.build()}update(){super.update(),this.updateCamera()}getObject3dInstance(){return new e.PerspectiveCamera}updateCamera(){const{near:t=ug.near,far:e=ug.far,fov:n=ug.fov,zoom:r=ug.zoom}=this.component.state;this.object3d.far=e,this.object3d.fov=n,this.object3d.near=t,this.object3d.zoom=r}}class pg extends Sh{getObject3dInstance(){return new e.Group}}class fg extends ff{buildGeometry(){const{width:t,height:n}=this.component.state.dimension;this.object3d.geometry=new e.PlaneGeometry(t,n)}buildMaterial(){this.object3d.material=new e.MeshStandardMaterial({opacity:0,side:e.DoubleSide,blending:e.NoBlending})}}class gg extends Sh{getObject3dInstance(){return new e.Scene}dispose(){for(const t of this.object3d.children)_h(t);this._animationMixer&&(this._animationMixer.stopAllAction(),this._animationMixer.uncacheRoot(this.object3d),this._animationMixer=void 0),super.dispose()}clear(){return this._floor&&(this.object3d.remove(this._floor),this._floor.material instanceof Array?this._floor.material.forEach(t=>t.dispose()):this._floor.material.dispose(),this._floor.geometry.dispose(),delete this._floor),super.clear()}get floor(){return this._floor}set floor(t){this._floor&&(this.object3d.remove(this._floor),this._floor.clear(),delete this._floor),t&&(this._floor=t,this.object3d.add(t)),this.component.invalidate()}build(){super.build(),this.floor=Dh(this.component)}updateTransform(){}updateDimension(){}updatePosition(){}updateRotate(){}updateScale(){}updateAlpha(){}updateHidden(){}get animationMixer(){return this._animationMixer||(this._animationMixer=new e.AnimationMixer(this.object3d)),this._animationMixer}}const mg={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"precision",name:"precision",property:{options:[{display:"High",value:"highp"},{display:"Medium",value:"mediump"},{display:"Low",value:"lowp"}]}},{type:"checkbox",label:"anti-alias",name:"antialias",property:"antialias"},{type:"checkbox",label:"3dmode",name:"threed",property:"threed"},{type:"checkbox",label:"auto-rotate",name:"autoRotate",property:"autoRotate"},{type:"checkbox",label:"debug",name:"debug",property:"debug"}],help:"scene/component/three-container"};let yg=class extends Ld{constructor(){super(...arguments),this._capability=new Hh}get sceneManager(){return this._capability.sceneManager}get cameraManager(){return this._capability.cameraManager}get rendererManager(){return this._capability.rendererManager}get lightManager(){return this._capability.lightManager}get controlsManager(){return this._capability.controlsManager}get eventManager(){return this._capability.eventManager}containable(t){return!0}is3dContainer(){return!0}getLightingConfig(){return{hemisphere:{skyColor:14540253,groundColor:3355443,intensity:.035}}}getCss3DSceneAttribute(){return"three-container:css3d-renderer"}init_scene3d(){this._capability.isInitialized&&this._capability.destroy(),this._capability.init(this,{lightingConfig:this.getLightingConfig(),css3DSceneAttribute:this.getCss3DSceneAttribute()}),this._capability.buildOverlays(),this._capability.resize(),this.onchangeData&&this.onchangeData(this.data,this.data)}destroy_scene3d(){this.stop(),this._capability.destroy()}stop(){}resize(){this._capability.resize()}get scene3d(){return this._capability.isInitialized||this.init_scene3d(),this._capability.scene3d}get renderer3d(){return this._capability.renderer3d}get mixer(){return this._capability.mixer}get zoom(){return this._capability.zoom}get css3DScene(){return this._capability.css3DScene}get css3DRenderer(){return this._capability.css3DRenderer}render_threed(){this._capability.renderThreeD()}render(t){this.app.isViewMode&&this.setState("threed",!0),!this.state.threed||this._capability.noSupportWebgl?super.render(t):this._capability.camera&&this._capability.renderCSS3D()}postrender(t){const{left:e,top:n,debug:r,threed:i}=this.state;let{width:s,height:o}=this.bounds;if(s=Math.floor(s),o=Math.floor(o),i){if(this._capability.isInitialized||(this.init_scene3d(),this._capability.renderThreeD()),this._capability.noSupportWebgl)return void this._capability.showWebglNoSupportText(t,this.state.width,this.state.height);if(!this._capability.renderer3d)return;const{width:i,height:a}=this._capability.getRendererSize();t.drawImage(this._capability.domElement,0,0,i,a,e,n,s,o),r&&this._capability.showDebugFPS(t)}else super.postrender(t)}dispose(){this._capability.dispose(),super.dispose()}get layout(){return rc.get("three")}get nature(){return mg}getObjectByRaycast(){return this._capability.getObjectByRaycast()}getObjectsByRaycast(){return this._capability.getObjectsByRaycast()}onchange(t,e){(t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&this._capability.destroy(),this._capability.onchange(t)}onmousedown(t){this._capability.onMouseDown(t)}onmouseup(t){this._capability.onMouseUp(t)}onmousemove(t){this._capability.onMouseMove(t)}onmouseleave(t){this._capability.onMouseLeave(t)}onwheel(t){this._capability.onWheel(t)}ondblclick(t){this._capability.onDblClick(t)}ondragstart(t){this._capability.onDragStart(t)}ondragmove(t){this._capability.onDragMove(t)}ondragend(t){this._capability.onDragEnd(t)}ontouchstart(t){this._capability.onTouchStart(t)}onpan(t){this._capability.onPan(t)}ontouchend(t){this._capability.onTouchEnd(t)}onkeydown(t){this._capability.onKeyDown(t)}onpinch(t){this._capability.onPinch(t)}ondoubletap(){this._capability.onDoubleTap()}};var bg;yg=Cd([Kp("3d-container")],yg),Th(t=>{const e=t.state.material3d?.spriteMode;return"plane"===e?new pf(t):new df(t)}),function(t){t.compile=il,t.duplicate=sl,t.select=wa,t.match=ba}(bg||(bg={})),Mr.registerResidents(()=>({componentResidentsCount:qa.residentsCount,sceneResidentsCount:Md.residentsCount,referenceMapResidentsCount:Jp.residentsCount,sceneResidents:qa.residents}));var vg=Object.freeze({__proto__:null,AbsoluteLayout:sc,AudioPlayer:Sp,get Banner(){return Wf},Banner3D:Hf,get Camera(){return Zf},Camera3D:Kf,CameraManager:Ih,CardLayout:ac,Component:qa,Connectable:Qh,Container:Ld,ContainerAbstract:Sc,ControlsManager:Fh,get Cube(){return Nf},Cube3D:Ff,get Cylinder(){return Gf},Cylinder3D:Yf,DEFAULT:Ii,DPPX:Oi,DataSource:qp,Donut:Yp,DonutExtrude:Tf,Ellipse:$d,EllipseExtrude:kf,EventManager3D:Nh,EventMap:Zu,FPS:nh,GESTURES:Di,get GLTFObject(){return rg},GifView:_p,GizmoManager:Bh,GizmoOperationManager:Yh,GlobalRef:Dp,Group:Ep,HTMLAbsoluteLayout:ic,HTMLOverlayContainer:Pp,HTMLOverlayElement:hp,ImageView:lp,InfoWindow:ec,InteractionManager:Gh,KEYEVENTS:zi,Layer:Mc,Layout:rc,LightManager:Rh,LightObject:sg,Line:Qd,LinearHorizontalLayout:lc,LinearVerticalLayout:uc,LocalRef:Tp,MATERIAL_PRESETS:mh,MAX_UNDO_SIZE:30,MODE_ADD:3,MODE_EDIT:1,MODE_PASTE_DATABIND:5,MODE_PASTE_STYLE:4,MODE_SHIFT:2,MODE_VIEW:0,get Model(){return bg},MoveHandle:_c,NOTHING:_i,Node:Vp,OrthoLine:ap,PIXEL_RATIO:rh,Path:Rp,PlacementManager:Uh,get PointLight(){return og},Polygon:np,PolygonExtrude:Cf,Polyline:sp,Popup:jp,RealObject:Sh,RealObjectCamera:dg,RealObjectDomElement:Mh,RealObjectDomTexture:wf,RealObjectDummy:hg,RealObjectExtrude:Mf,RealObjectGLTF:tg,RealObjectGroup:pg,RealObjectMesh:ff,RealObjectPlane:fg,RealObjectPlane2D:pf,RealObjectScene:gg,RealObjectSprite:cf,RealObjectSprite2D:df,RealObjectText:xf,Rect:tu,RectExtrude:Ef,RectPath:Qa,ReferenceMap:Jp,RendererManager:jh,RootContainer:hd,Ruler:nu,SCALE_MIN:hh,SCENE_MODE:Ti,Scene:Md,SceneManager:zh,ScenePopup:xc,ScriptLoader:of,Shape:Ka,get Sphere(){return If},Sphere3D:zf,get Sprite(){return Rf},Star:Hp,StarExtrude:Of,TableLayout:dc,Text:Mp,ThreeCapability:Hh,get ThreeContainer(){return yg},Triangle:Fp,TriangleExtrude:Pf,UNIT_DIMENSION:dh,UNIT_ROTATE:gh,UNIT_SCALE:ph,UNIT_TRANSLATE:fh,ValueHolder:Xp,get Wall(){return lg},Wall3D:cg,applyAlpha:uh,buildArrow3D:lh,create:Ed,createCanvas:ih,createCanvasTexture:hf,createFloor:Dh,createRealObjectFor:Ph,debug:Gr,disposeObject3D:_h,drawTextTexture:yf,error:Br,fontStyle:gf,initFontFamilyWatcher:Ri,inspector:_d,metrics:Mr,projectToScreen:Dc,registerDefaultRealObjectFactory:Th,registerRealObjectFactory:Ch,renderCanvasTexture:uf,resolveMaterial3d:yh,sceneComponent:Kp,stopFPSMeasure:eh,textBounds:vf,textTexture:bf,toThreeSide:vh,updateDefaultFontFamily:ji,version:af,warn:Yr});const xg=globalThis;"undefined"==typeof globalThis||xg.scene||(xg.scene=vg);export{sc as AbsoluteLayout,Sp as AudioPlayer,Wf as Banner,Hf as Banner3D,Zf as Camera,Kf as Camera3D,Ih as CameraManager,ac as CardLayout,qa as Component,Qh as Connectable,Ld as Container,Sc as ContainerAbstract,Fh as ControlsManager,Nf as Cube,Ff as Cube3D,Gf as Cylinder,Yf as Cylinder3D,Ii as DEFAULT,Oi as DPPX,qp as DataSource,Yp as Donut,Tf as DonutExtrude,$d as Ellipse,kf as EllipseExtrude,Nh as EventManager3D,Zu as EventMap,nh as FPS,Di as GESTURES,rg as GLTFObject,_p as GifView,Bh as GizmoManager,Yh as GizmoOperationManager,Dp as GlobalRef,Ep as Group,ic as HTMLAbsoluteLayout,Pp as HTMLOverlayContainer,hp as HTMLOverlayElement,lp as ImageView,ec as InfoWindow,Gh as InteractionManager,zi as KEYEVENTS,Mc as Layer,rc as Layout,Rh as LightManager,sg as LightObject,Qd as Line,lc as LinearHorizontalLayout,uc as LinearVerticalLayout,Tp as LocalRef,mh as MATERIAL_PRESETS,Pi as MAX_UNDO_SIZE,ki as MODE_ADD,Si as MODE_EDIT,Ci as MODE_PASTE_DATABIND,Ei as MODE_PASTE_STYLE,Mi as MODE_SHIFT,Ai as MODE_VIEW,bg as Model,_c as MoveHandle,_i as NOTHING,Vp as Node,ap as OrthoLine,rh as PIXEL_RATIO,Rp as Path,Uh as PlacementManager,og as PointLight,np as Polygon,Cf as PolygonExtrude,sp as Polyline,jp as Popup,Sh as RealObject,dg as RealObjectCamera,Mh as RealObjectDomElement,wf as RealObjectDomTexture,hg as RealObjectDummy,Mf as RealObjectExtrude,tg as RealObjectGLTF,pg as RealObjectGroup,ff as RealObjectMesh,fg as RealObjectPlane,pf as RealObjectPlane2D,gg as RealObjectScene,cf as RealObjectSprite,df as RealObjectSprite2D,xf as RealObjectText,tu as Rect,Ef as RectExtrude,Qa as RectPath,Jp as ReferenceMap,jh as RendererManager,hd as RootContainer,nu as Ruler,hh as SCALE_MIN,Ti as SCENE_MODE,Md as Scene,zh as SceneManager,xc as ScenePopup,of as ScriptLoader,Ka as Shape,If as Sphere,zf as Sphere3D,Rf as Sprite,Hp as Star,Of as StarExtrude,dc as TableLayout,Mp as Text,Hh as ThreeCapability,yg as ThreeContainer,Fp as Triangle,Pf as TriangleExtrude,dh as UNIT_DIMENSION,gh as UNIT_ROTATE,ph as UNIT_SCALE,fh as UNIT_TRANSLATE,Xp as ValueHolder,lg as Wall,cg as Wall3D,uh as applyAlpha,lh as buildArrow3D,Ed as create,ih as createCanvas,hf as createCanvasTexture,Dh as createFloor,Ph as createRealObjectFor,Gr as debug,_h as disposeObject3D,yf as drawTextTexture,Br as error,gf as fontStyle,Ri as initFontFamilyWatcher,_d as inspector,Mr as metrics,Dc as projectToScreen,Th as registerDefaultRealObjectFactory,Ch as registerRealObjectFactory,uf as renderCanvasTexture,yh as resolveMaterial3d,Kp as sceneComponent,eh as stopFPSMeasure,vf as textBounds,bf as textTexture,vh as toThreeSide,ji as updateDefaultFontFamily,af as version,Yr as warn};
51
+ `,this.element)}catch(t){}}onchangeMinimized(){const{minimized:t}=this.state;t?this.setState("height",24):this.setState("height",this.get("height"))}}zd=new WeakMap,qa.memoize(Ld.prototype,"bounds",!0),qa.register("container",Ld);const Fd=Math.sqrt(3),Nd=2;function Bd(t,e,n,r,i){const s=5+i,o=n.x,a=n.y,c=r.x,l=r.y;if(Math.abs(o-c)>s&&Math.abs(a-l)>s){const n=(l-a)/(c-o),r=a-n*o;if(Math.abs(e-(n*t+r))>s)return!1}let h,u,d,p;return o>c?(u=o,h=c):(u=c,h=o),a>l?(p=a,d=l):(p=l,d=a),!(u+5<t)&&(!(h-5>t)&&(!(p+5<e)&&!(d-5>e)))}function Yd(t,e,n,r=2){for(let i=0;i<n.length-1;i++)if(Bd(t,e,n[i],n[i+1],r))return!0;return!1}function Gd(t,e,n,r){if("arrow"!=t.slice(-5))return n;const i=Math.atan2(r.y-n.y,r.x-n.x),s=1.5*e;return{x:n.x+Math.cos(i)*s,y:n.y+Math.sin(i)*s}}function Ud(t,e,n){let{lineWidth:r=Nd,strokeStyle:i="#000000",lineCap:s=!1,alpha:o=1,begin:a="none",end:c="none",beginSize:l="size5",endSize:h="size5"}=n;if(("none"!=a||"none"!=c)&&(r=Number(r)||Nd,t.lineCap=s,t.lineWidth=r,t.strokeStyle=i,t.fillStyle=i,t.globalAlpha*=o,"none"!=a&&Hd(t,e[0],e[1],r,a,Wd(l,r)),"none"!=c)){const n=e.length;Hd(t,e[n-1],e[n-2],r,c,Wd(h,r))}}function Hd(t,e,n,r,i,s){const{x:o,y:a}=e,c=Math.atan2(n.y-a,n.x-o);switch(t.beginPath(),t.translate(o,a),t.rotate(c),i){case"oval":t.ellipse(0,0,s.X,s.Y,0,0,2*Math.PI),t.fill();break;case"diamond":t.moveTo(-s.X,0),t.lineTo(0,-s.Y),t.lineTo(s.X,0),t.lineTo(0,s.Y),t.fill();break;case"arrow":t.moveTo(0,0),t.lineTo(Fd*s.X,-s.Y),t.lineTo(Fd*s.X,s.Y),t.fill();break;case"sharp-arrow":t.moveTo(0,0),t.lineTo(Fd*s.X,-s.Y),t.lineTo(-s.X/1.5+Fd*s.X,0),t.lineTo(Fd*s.X,s.Y),t.fill();break;case"open-arrow":t.moveTo(Fd*s.X+r,-s.Y),t.lineTo(r,0),t.lineTo(Fd*s.X+r,s.Y),t.stroke()}t.rotate(-c),t.translate(-o,-a),t.closePath()}function Wd(t,e){const n={X:0,Y:0};switch(e*=1.2,t){case"size1":n.X=e,n.Y=e;break;case"size2":n.X=1.5*e,n.Y=e;break;case"size3":n.X=2*e,n.Y=e;break;case"size4":n.X=e,n.Y=1.5*e;break;case"size5":default:n.X=1.5*e,n.Y=1.5*e;break;case"size6":n.X=2*e,n.Y=1.5*e;break;case"size7":n.X=e,n.Y=2*e;break;case"size8":n.X=1.5*e,n.Y=2*e;break;case"size9":n.X=2*e,n.Y=2*e}return n}const Vd="N",Xd="S",qd="E",Kd="W";class Zd{constructor({component:t,anchor:e,position:n,self:r}){this.component=t,this._anchorName=e,this._position=n,this.self=r}get position(){const t=this.anchor;if(t){const{position:e}=t,n=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(n.x,n.y)}return this._position}set position({x:t,y:e}){this._position={x:t,y:e}}get anchor(){return this.component?.findAnchor(this._anchorName)}get direction(){const t=this.component.bounds,e=this.anchor;if(!e)return qd;const n=e.position;return n.y<=t.top?Vd:n.y>=t.top+t.height?Xd:n.x<=t.left?Kd:qd}get boundaryPosition(){const t=this.anchor;if(t){let{position:e}=t,n=0,r=0;switch(this.direction){case Xd:r=20;break;case Vd:r=-20;break;case Kd:n=-20;break;default:n=20}e={x:e.x+n,y:e.y+r};const i=this.component.toScene(e.x,e.y);return this.self.transcoordT2P(i.x,i.y)}}}class Qd extends qa{isLine(){return!0}replaceRefids(t){["from","to"].forEach(e=>{const n=this.get(e);if(n?.component){const r=t.get(n.component)||n.component;this.set(e,{...n,component:r})}})}get fromEnd(){if(this.parent&&!this._fromEnd){const{component:t,anchor:e,position:n}=this.getState("from")||{};if(!t)return;const r=this.root?.findByRefid?.(t);if(!r)return;this._fromEnd=new Zd({component:r,fromto:"from",anchor:e,position:n,self:this})}return this._fromEnd}get from(){return this.getState("from")}set from(t){delete this._fromEnd,this.set("from",t)}get toEnd(){if(this.parent&&!this._toEnd){const{component:t,anchor:e,position:n}=this.getState("to")||{};if(!t)return;const r=this.root?.findByRefid?.(t);if(!r)return;this._toEnd=new Zd({component:r,fromto:"to",anchor:e,position:n,self:this})}return this._toEnd}get to(){return this.getState("to")}set to(t){delete this._toEnd,this.set("to",t)}move({x:t,y:e},n){n&&(this.from={position:this._fromEnd?.position||this.getState("from")?.position||{x:0,y:0}},this.to={position:this._toEnd?.position||this.getState("to")?.position||{x:0,y:0}}),super.move({x:t,y:e})}render(t){const{begin:e="none",end:n="none",lineWidth:r,round:i=0}=this.state;let s=this.drawPath;Ud(t,s,this.state),t.beginPath();const o=Gd(e,r,s[0],s[1]),a=Gd(n,r,s[s.length-1],s[s.length-2]);s=[o,...s.slice(1,-1),a];let c={x:o.x,y:o.y};t.moveTo(o.x,o.y);for(let e=1;e<s.length;e++){const n=c;c=s[e];const r=s[e+1];if(n.x===c.x&&n.y===c.y)continue;if(!r){t.lineTo(c.x,c.y);break}let o=Math.sqrt((n.x-c.x)*(n.x-c.x)+(n.y-c.y)*(n.y-c.y)),a=0!==o?Math.atan2(n.x-c.x,n.y-c.y):0,l=Math.sin(a)*Math.min(i,o/2)+c.x,h=Math.cos(a)*Math.min(i,o/2)+c.y;const u=i>0||0!==o?{x:l,y:h}:c;o=Math.sqrt((r.x-c.x)*(r.x-c.x)+(r.y-c.y)*(r.y-c.y)),a=0!==o?Math.atan2(r.x-c.x,r.y-c.y):0,l=Math.sin(a)*Math.min(i,o/2)+c.x,h=Math.cos(a)*Math.min(i,o/2)+c.y;const d=i>0||0!==o?{x:l,y:h}:c;t.lineTo(u.x,u.y),i>0&&t.quadraticCurveTo(c.x,c.y,d.x,d.y)}this.drawStroke(t,void 0)}contains(t,e){const{lineWidth:n}=this.state;return Yd(t,e,this.drawPath,n)}get resizable(){return!1}get mutable(){return!0}get rotatable(){return!1}get path(){const{from:t,to:e}=this.state,{x1:n,y1:r,x2:i,y2:s}=this.state;return[this.fromEnd?.position||t?.position||{x:n,y:r},this.toEnd?.position||e?.position||{x:i,y:s}]}set path(t){const[e,n]=t,{from:r,to:i}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...r,position:e},to:{...i,position:n}})}get textBounds(){const t=this.drawPath;let e,n,r=0;for(let i=1;i<t.length;i++){const s=t[i-1],o=t[i],a=(s.x-o.x)*(s.x-o.x)+(s.y-o.y)*(s.y-o.y);a>r&&(r=Math.ceil(a),e=s,n=o)}let{paddingTop:i,paddingLeft:s,paddingRight:o,paddingBottom:a}=this.state;return a||=0,i||=0,s||=0,o||=0,{left:Math.min(e.x,n.x)+s,top:Math.min(e.y,n.y)+i,width:Math.max(Math.abs(e.x-n.x)-s-o,0),height:Math.max(Math.abs(e.y-n.y)-i-a,0)}}get decorators(){return this.app.isEditMode?["decotag"]:[]}}Qd.getTipNeckPos=Gd,Qd.containedInPath=Yd,Qd.drawEndTips=Ud,qa.register("line",Qd);const Jd={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"angle",label:"start-angle",name:"startAngle",property:"startAngle"},{type:"angle",label:"end-angle",name:"endAngle",property:"endAngle"}],"value-property":"text"};class $d extends(Qh(Ka)){is3dish(){return!0}render(t){const{cx:e,cy:n,rx:r,ry:i,startAngle:s,endAngle:o,anticlockwise:a}=this.state;t.beginPath(),t.ellipse(e,n,Math.abs(r),Math.abs(i),0,s||0,o||2*Math.PI,a),void 0!==s&&void 0!==o&&(t.lineTo(e,n),t.closePath())}get path(){const{cx:t,cy:e,rx:n,ry:r}=this.state;return[{x:t-n,y:e-r},{x:t+n,y:e-r},{x:t+n,y:e+r},{x:t-n,y:e+r}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2,rx:(n.x-e.x)/2,ry:(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:r,rx:i,ry:s}=this.state,o=(t-n)/(2*i-.5),a=(e-r)/(2*s-.5);return o*o+a*a<.25}outline(t){return function(t,e){const{cx:n,cy:r,rx:i,ry:s}=t.model,o=2*Math.PI*e,a=n+i*Math.cos(o),c=r+s*Math.sin(o);return t.toScene(a,c)}(this,t)}get anchors(){return function(t){const{left:e,top:n,width:r,height:i}=t.bounds,s=e+r/2,o=n+i/2;return[{name:"TOP",position:{x:s,y:n}},{name:"RIGHT",position:{x:e+r,y:o}},{name:"BOTTOM",position:{x:s,y:n+i}},{name:"LEFT",position:{x:e,y:o}}]}(this)}get nature(){return Jd}}qa.memoize($d.prototype,"path",!1),qa.register("ellipse",$d);const tp={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e+1,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){n[e+1]=t})},ondragend:function(t,e,n){}},ep={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polygon"};class np extends Ka{is3dish(){return!0}get mutable(){return!0}get pathExtendable(){return!0}get path(){return this.state.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let r=!1;return n.forEach((i,s)=>{const o=(s+n.length+1)%n.length,a=i.x,c=i.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(r=!r)}),r}get controls(){const t=this.path;return t.map((e,n)=>{const r=t[n+1>=t.length?0:n+1];return{x:(e.x+r.x)/2,y:(e.y+r.y)/2,handler:tp}})}get nature(){return ep}}qa.memoize(np.prototype,"controls",!1),qa.register("polygon",np);const rp={ondragstart:function(t,e,n){n.mutatePath(null,function(n){n.splice(e,0,t)})},ondragmove:function(t,e,n){n.mutatePath(null,function(n){n[e]=t})},ondragend:function(t,e,n){}},ip={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/polyline"};class sp extends Qd{get pathExtendable(){return!0}get path(){const{from:t,to:e}=this.state,{path:n}=this.state;return[this.fromEnd?.position||t?.position||n[0],...n.slice(1,-1),this.toEnd?.position||e?.position||n[n.length-1]]}set path(t){const{from:e,to:n}=this.state;delete this._fromEnd,delete this._toEnd,this.set({from:{...e,position:t[0]},to:{...n,position:t[t.length-1]},path:t})}get controls(){const t=this.path,e=[];for(let n=0;n<t.length-1;n++){const r=t[n],i=t[n+1];0==n&&e.push({x:r.x,y:r.y,handler:rp}),e.push({x:(r.x+i.x)/2,y:(r.y+i.y)/2,handler:rp}),n==t.length-2&&e.push({x:i.x,y:i.y,handler:rp})}return e}get nature(){return ip}}qa.register("polyline",sp);const op={mutable:!1,resizable:!1,rotatable:!1,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/ortholine"};class ap extends Qd{get pathExtendable(){return!1}get drawPath(){const t=this.path[0],e=this.path[1],{component:n,direction:r,boundaryPosition:i=t}=this.fromEnd||{},{component:s,direction:o,boundaryPosition:a=e}=this.toEnd||{},c=[i,a],l=[];i&&l.push(i);let h,u=n?.bounds;u&&(h=n.toScene(u.left,u.top),h=this.transcoordT2P(h.x,h.y),u={...u,left:h.x,top:h.y});const d=u?{left:u.left-20,top:u.top-20,width:u.width+40,height:u.height+40}:{left:i.x,top:i.y,width:0,height:0};u=u||d;let p=s?.bounds;p&&(h=s.toScene(p.left,p.top),h=this.transcoordT2P(h.x,h.y),p={...p,left:h.x,top:h.y});const f=p?{left:p.left-20,top:p.top-20,width:p.width+40,height:p.height+40}:{left:a.x,top:a.y,width:0,height:0};p=p||f;const g=[d,f],m=d.left>f.left?f.left:d.left,y=d.top>f.top?f.top:d.top,b={left:m,top:y,width:d.left+d.width>f.left+f.width?d.left+d.width-m:f.left+f.width-m,height:d.top+d.height>f.top+f.height?d.top+d.height-y:f.top+f.height-y};let v,x,w,_,A,S,M,k,E,C,T=0,P=0;u.left+u.width<p.left?(_=0,A=1,E=r,C=o,v=(u.left+u.width+p.left)/2,T=p.left-v):p.left+p.width<u.left&&(_=1,A=0,E=o,C=r,v=(u.left+p.width+p.left)/2,T=u.left-v),u.top+u.height<p.top?(w=0,S=1,M=r,k=o,x=(u.top+u.height+p.top)/2,P=p.top-x):p.top+p.height<u.top&&(w=1,S=0,M=o,k=r,x=(u.top+p.height+p.top)/2,P=u.top-x);const O=[];if(v&&T>P){let t,e,n;switch(C){case Kd:switch(E){case qd:O.push({x:v,y:c[_].y}),O.push({x:v,y:c[A].y});break;case Kd:t=g[_].top+g[_].height/2,e=t>c[A].y?Math.min(g[_].top,c[A].y):Math.max(g[_].top+g[_].height,c[A].y),O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:c[A].y});break;case Vd:case Xd:e=E===Xd?Math.max(c[_].y,c[A].y):Math.min(c[_].y,c[A].y),O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:c[A].y});break;default:return this.path}break;case qd:switch(E){case qd:e=c[_].y<c[A].y?Math.min(g[A].top,c[_].y):Math.max(g[A].top+g[A].height,c[_].y),n=e;break;case Kd:e=void 0!==x?x:c[_].y<c[A].y?b.top-.5*T:b.top+b.height+.5*T,n=e;break;case Xd:e=void 0!==x?Math.max(x,c[_].y):b.top+b.height,n=e;break;case Vd:e=x?Math.min(x,g[_].top):b.top,n=e;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;case Xd:switch(E){case qd:e=c[_].y,n=c[_].y>c[A].y?c[_].y:g[A].top+g[A].height;break;case Kd:e=x?Math.max(x,g[A].top+g[A].height):b.top+b.height,n=e;break;case Xd:e=b.top+b.height,n=e;break;case Vd:e=x?Math.min(x,g[_].top):g[_].top,n=x?Math.max(x,g[A].top+g[A].height):g[A].top+g[A].height;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;case Vd:switch(E){case qd:e=c[_].y,n=c[_].y<c[A].y?c[_].y:g[A].top;break;case Kd:e=x?Math.min(x,g[A].top):b.top,n=e;break;case Xd:e=void 0!==x?Math.max(x,c[_].y):c[_].y,n=void 0!==x?Math.min(x,c[A].y):c[A].y;break;case Vd:e=b.top,n=e;break;default:return this.path}O.push({x:c[_].x,y:e}),O.push({x:v,y:e}),O.push({x:v,y:n}),O.push({x:c[A].x,y:n});break;default:return this.path}l.push(...0===_?O:O.reverse())}else if(x){let t,e,n;switch(k){case Vd:switch(M){case Xd:O.push({x:c[w].x,y:x}),O.push({x:c[S].x,y:x});break;case Vd:t=g[w].left+g[w].width/2,e=t>c[S].x?Math.min(g[w].left,c[S].x):Math.max(g[w].left+g[w].width,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;case Kd:e=Math.min(c[w].x,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;case qd:e=Math.max(c[w].x,c[S].x),O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:c[S].x,y:x});break;default:return this.path}break;case Xd:switch(M){case Kd:e=b.left,n=e;break;case qd:e=void 0!==v?Math.max(v,c[w].x):b.left+b.width,n=e;break;case Vd:e=void 0!==v?v:c[w].x<c[S].x?b.left-.5*P:b.left+b.width+.5*P,n=e;break;case Xd:e=c[w].x,n=c[w].x<c[S].x?Math.min(g[S].left,c[w].x):Math.max(g[S].left+g[S].width,c[w].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;case qd:switch(M){case Kd:e=void 0!==v?Math.min(v,c[w].x):c[w].x,n=void 0!==v?Math.max(v,c[S].x):c[S].x;break;case qd:e=b.left+b.width,n=e;break;case Vd:e=void 0!==v?Math.max(v,c[S].x):b.left+b.width,n=e;break;case Xd:e=c[w].x,n=Math.max(g[S].left+g[S].width,c[w].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;case Kd:switch(M){case Kd:e=b.left,n=e;break;case qd:e=void 0!==v?Math.max(v,c[w].x):c[w].x,n=void 0!==v?Math.min(v,c[S].x):c[S].x;break;case Vd:e=b.left,n=e;break;case Xd:e=c[w].x<c[S].x?Math.min(g[S].left,c[w].x):c[w].x,n=Math.min(e,c[S].x);break;default:return this.path}O.push({x:e,y:c[w].y}),O.push({x:e,y:x}),O.push({x:n,y:x}),O.push({x:n,y:c[S].y});break;default:return this.path}l.push(...0===w?O:O.reverse())}else{let t,e;switch(r){case Vd:switch(o){case Vd:e=b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case Xd:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top+b.height}),l.push({x:c[1].x,y:b.top+b.height});break;case qd:t=c[1].y<c[0].y&&c[1].x<c[0].x?c[0].x:b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;case Kd:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case Xd:switch(o){case Vd:t=b.left+b.width,l.push({x:t,y:c[0].y}),l.push({x:t,y:b.top}),l.push({x:c[1].x,y:b.top});break;case Xd:case qd:case Kd:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;case Kd:switch(o){case Vd:t=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].x:b.left,e=c[0].x>c[1].x&&c[0].y<c[1].y?c[1].y:Math.min(b.top,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case Xd:t=b.left,e=Math.max(b.top+b.height,c[0].y),l.push({x:t,y:c[0].y}),l.push({x:t,y:e}),l.push({x:c[1].x,y:e});break;case qd:t=b.left+b.width,l.push({x:c[0].x,y:b.top}),l.push({x:t,y:b.top}),l.push({x:t,y:c[1].y});break;case Kd:t=b.left,l.push({x:t,y:c[0].y}),l.push({x:t,y:c[1].y});break;default:return this.path}break;case qd:switch(o){case Vd:e=c[0].y<c[1].y&&c[0].x<c[1].x?c[0].y:b.top,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case Xd:e=c[0].y>c[1].y&&c[0].x<c[1].x?c[0].y:b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;case qd:case Kd:e=b.top+b.height,l.push({x:c[0].x,y:e}),l.push({x:c[1].x,y:e});break;default:return this.path}break;default:return this.path}}return a&&l.push(a),[t,...l,e].filter((t,e,n)=>{if(0===e)return!0;const r=n[e-1];return t.x!==r.x||t.y!==r.y}).filter((t,e,n)=>{if(0===e||e>=n.length-1)return!0;const r=n[e-1],i=n[e+1];return!(t.x===r.x&&t.x===i.x||t.y===r.y&&t.y===i.y)})}get nature(){return op}}qa.register("ortholine",ap);const cp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"image-src",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"scene-image",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0}},{type:"select",label:"cross-origin",name:"crossOrigin",property:{options:["","anonymous","use-credentials"]}}],"value-property":"src",help:"scene/component/image-view"};class lp extends(Qa(Ka)){static get noimage(){return lp.NOIMAGE||(lp.NOIMAGE=new Image,lp.NOIMAGE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABIBAMAAAD7Se1QAAAAIVBMVEUAAABHcEwBAQEREREBAQEEBAQGBgYLCwsDAwMDAwMICAi6HF9tAAAAC3RSTlNNAEAERiMYCS41Eac10lYAAAEgSURBVHhe7dY9asQwEAXgh7DNertNiJy48pIitY3SB7bYdk0ukL1BDDmA9gZecoH4pmFQ3MQayUMguPBrNPD4wD9TCMvJmt3M/AtYwXOlXiWgqADVCUBD46MAnGhMBaCiUQmAm8VA/Eh/eWl9Fn5WcxD+OLuRrUYJDKLluwH2InACUgkoACSdADxQc50Bytadb9RkM0CT13TcvlCT1HFg8UTHvasuUVACCa3El6u2UdD8LFTlKhUFFgA+d3dj10aABkUN72N3jAADCrJq7PIIsPidcxBoTHIIAjMFmyCwmGYIAA1P9gFgfCANAOsDSccCDW+uLDB+kLGg94OkZoAGkwsDDAe2DOg5oPxAg03rBR88OHpBz4N8UVeHFSwma74BTW6Ge4rIRa4AAAAASUVORK5CYII="),lp.NOIMAGE}dispose(){super.dispose(),this._offcanvas=null,this._image=null}render(t){const{left:e,top:n,width:r,height:i,isGray:s=!1,alpha:o=1,src:a}=this.state;if(this.prepareIf(!this._image&&a),t.beginPath(),t.globalAlpha*=o,this._image&&this._image.complete)if(s&&this._offcanvas)t.drawImage(this._offcanvas,e,n,r,i);else try{t.drawImage(this._image,e,n,r,i)}catch(s){t.drawImage(lp.noimage,e,n,r,i)}else!this.app.isViewMode&&t.drawImage(lp.noimage,e,n,r,i)}get nature(){return cp}get hasTextProperty(){return!1}async ready(){await super.ready(),this.prepareIf(!this._image&&this.state.src)}prepare(t,e){const{src:n,crossOrigin:r}=this.state;if(n){this._image=new Image;try{r&&(this._image.crossOrigin=r),this._image.src=this.app.url(n)||""}catch(t){return void e(t)}this._image.onload=()=>{if(this.get("isGray")){const t=this._image.width,e=this._image.height;this._offcanvas=qa.createCanvas(t,e);const n=this._offcanvas.getContext("2d");n.drawImage(this._image,0,0);const r=function(t,e,n){let r;try{r=t.getImageData(0,0,e,n)}catch(t){return Br("Get Image Data Error: "+(t instanceof Error?t.message:String(t))),null}const i=r.data;for(let t=0;t<e*n*4;t+=4){const e=i[t],n=i[t+1],s=i[t+2],o=Math.floor((e+n+s)/3);r.data[t]=o,r.data[t+1]=o,r.data[t+2]=o}return r}(n,t,e);n.putImageData(r,0,0)}t(this)},this._image.onerror=t=>{this._image&&!this._image.currentSrc&&(this._image=null),e(t)}}else t(this)}get src(){return this.get("src")}set src(t){this.set("src",t)}onchange(t,e){(t.hasOwnProperty("src")||t.hasOwnProperty("isGray"))&&(this._offcanvas=null,this._image=null,this.prepareIf(t.src))}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("image/"))return void(this.src=e[n])}}qa.register("image-view",lp);class hp extends(Dd(Qa(qa))){is3dish(){return!0}prerender(){}}var up,dp,pp={},fp={},gp={};function mp(){if(dp)return fp;dp=1,Object.defineProperty(fp,"__esModule",{value:!0});var t=function(){if(up)return gp;up=1,Object.defineProperty(gp,"__esModule",{value:!0});var t=function(){function t(){}return t.bitsToNum=function(t){return t.reduce(function(t,e){return 2*t+e},0)},t.byteToBitArr=function(t){for(var e=[],n=7;n>=0;n--)e.push(!!(t&1<<n));return e},t.lzwDecode=function(t,e){for(var n,r,i=0,s=function(t){for(var n=0,r=0;r<t;r++)e.charCodeAt(i>>3)&1<<(7&i)&&(n|=1<<r),i++;return n},o=[],a=1<<t,c=a+1,l=t+1,h=[],u=function(){h=[],l=t+1;for(var e=0;e<a;e++)h[e]=[e];h[a]=[],h[c]=null};;)if(r=n,(n=s(l))!==a){if(n===c)break;if(n<h.length)r!==a&&h.push(h[r].concat(h[n][0]));else{if(n!==h.length)throw new Error("Invalid LZW code.");h.push(h[r].concat(h[r][0]))}o.push.apply(o,h[n]),h.length===1<<l&&l<12&&l++}else u();return o},t}();return gp.SuperGifUtils=t,gp}(),e=function(){function e(t,e){this.stream=t,this.handler=e}return e.prototype.parseCT=function(t){for(var e=[],n=0;n<t;n++)e.push(this.stream.readBytes(3));return e},e.prototype.readSubBlocks=function(){var t,e;e="";do{t=this.stream.readByte(),e+=this.stream.read(t)}while(0!==t);return e},e.prototype.parseHeader=function(){var e={};if(e.sig=this.stream.read(3),e.ver=this.stream.read(3),"GIF"!==e.sig)throw new Error("Not a GIF file.");e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.gctFlag=n.shift(),e.colorRes=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.sorted=n.shift(),e.gctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.bgColor=this.stream.readByte(),e.pixelAspectRatio=this.stream.readByte(),e.gctFlag&&(e.gct=this.parseCT(1<<e.gctSize+1)),this.handler.hdr&&this.handler.hdr(e)},e.prototype.parseExt=function(e){var n=this;switch(e.label=this.stream.readByte(),e.label){case 249:e.extType="gce",function(e){n.stream.readByte();var r=t.SuperGifUtils.byteToBitArr(n.stream.readByte());e.reserved=r.splice(0,3),e.disposalMethod=t.SuperGifUtils.bitsToNum(r.splice(0,3)),e.userInput=r.shift(),e.transparencyGiven=r.shift(),e.delayTime=n.stream.readUnsigned(),e.transparencyIndex=n.stream.readByte(),e.terminator=n.stream.readByte(),n.handler.gce&&n.handler.gce(e)}(e);break;case 254:e.extType="com",function(t){t.comment=n.readSubBlocks(),n.handler.com&&n.handler.com(t)}(e);break;case 1:e.extType="pte",function(t){n.stream.readByte(),t.ptHeader=n.stream.readBytes(12),t.ptData=n.readSubBlocks(),n.handler.pte&&n.handler.pte(t)}(e);break;case 255:e.extType="app",function(t){n.stream.readByte(),t.identifier=n.stream.read(8),t.authCode=n.stream.read(3),"NETSCAPE"===t.identifier?function(t){n.stream.readByte(),t.unknown=n.stream.readByte(),t.iterations=n.stream.readUnsigned(),t.terminator=n.stream.readByte(),n.handler.app&&n.handler.app.NETSCAPE&&n.handler.app.NETSCAPE(t)}(t):function(t){t.appData=n.readSubBlocks(),n.handler.app&&n.handler.app[t.identifier]&&n.handler.app[t.identifier](t)}(t)}(e);break;default:e.extType="unknown",function(t){t.data=n.readSubBlocks(),n.handler.unknown&&n.handler.unknown(t)}(e)}},e.prototype.parseImg=function(e){e.leftPos=this.stream.readUnsigned(),e.topPos=this.stream.readUnsigned(),e.width=this.stream.readUnsigned(),e.height=this.stream.readUnsigned();var n=t.SuperGifUtils.byteToBitArr(this.stream.readByte());e.lctFlag=n.shift(),e.interlaced=n.shift(),e.sorted=n.shift(),e.reserved=n.splice(0,2),e.lctSize=t.SuperGifUtils.bitsToNum(n.splice(0,3)),e.lctFlag&&(e.lct=this.parseCT(1<<e.lctSize+1)),e.lzwMinCodeSize=this.stream.readByte();var r=this.readSubBlocks();e.pixels=t.SuperGifUtils.lzwDecode(e.lzwMinCodeSize,r),e.interlaced&&(e.pixels=function(t,e){for(var n=new Array(t.length),r=t.length/e,i=function(r,i){var s=t.slice(i*e,(i+1)*e);n.splice.apply(n,[r*e,e].concat(s))},s=[0,4,2,1],o=[8,8,4,2],a=0,c=0;c<4;c++)for(var l=s[c];l<r;l+=o[c])i(l,a),a++;return n}(e.pixels,e.width)),this.handler.img&&this.handler.img(e)},e.prototype.parseBlock=function(){var t={};switch(t.sentinel=this.stream.readByte(),String.fromCharCode(t.sentinel)){case"!":t.type="ext",this.parseExt(t);break;case",":t.type="img",this.parseImg(t);break;case";":t.type="eof",this.handler.eof&&this.handler.eof(t);break;default:throw new Error("Unknown block: 0x"+t.sentinel.toString(16))}"eof"!==t.type&&setTimeout(this.parseBlock.bind(this),0)},e.prototype.parse=function(){this.parseHeader(),setTimeout(this.parseBlock.bind(this),0)},e}();return fp.SuperGifParser=e,fp}var yp,bp,vp={};var xp=function(){if(bp)return pp;bp=1,Object.defineProperty(pp,"__esModule",{value:!0});var t=mp(),e=function(){if(yp)return vp;yp=1,Object.defineProperty(vp,"__esModule",{value:!0});var t=function(){function t(t){this.data=t,this.position=0}return t.prototype.readByte=function(){if(this.position>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.position++]:255&this.data.charCodeAt(this.position++)},t.prototype.readBytes=function(t){for(var e=[],n=0;n<t;n++)e.push(this.readByte());return e},t.prototype.read=function(t){for(var e="",n=0;n<t;n++)e+=String.fromCharCode(this.readByte());return e},t.prototype.readUnsigned=function(){var t=this.readBytes(2);return(t[1]<<8)+t[0]},t}();return vp.SuperGifStream=t,vp}(),n=function(){function n(t,e){var n=this;for(var r in this.gifImgElement=t,this.options={autoPlay:!0},this.loading=!1,this.ready=!1,this.transparency=null,this.delay=null,this.disposalMethod=null,this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,this.playing=!0,this.forward=!0,this.ctxScaled=!1,this.frames=[],this.frameOffsets=[],this.initialized=!1,this.currentFrameIndex=-1,this.iterationCount=0,this.stepping=!1,this.handler={hdr:this.withProgress(this.doHdr.bind(this)),gce:this.withProgress(this.doGCE.bind(this)),com:this.withProgress(this.doNothing.bind(this)),app:{NETSCAPE:this.withProgress(this.doNothing.bind(this))},img:this.withProgress(this.doImg.bind(this)),eof:function(){n.pushFrame(),n.canvas.width=n.hdr.width*n.getCanvasScale(),n.canvas.height=n.hdr.height*n.getCanvasScale(),n.playerInit(),n.loading=!1,n.ready=!0,n.loadCallback&&n.loadCallback(n.gifImgElement)}},e)this.options[r]=e[r];this.onEndListener=e.onEnd,this.loopDelay=e.loopDelay||0,this.overrideLoopMode=null!=e.loopMode?e.loopMode:"auto",this.drawWhileLoading=null==e.drawWhileLoading||e.drawWhileLoading}return n.prototype.init=function(){var t=this.gifImgElement.parentNode,e=document.createElement("div");this.canvas=document.createElement("canvas"),this.canvasContext=this.canvas.getContext("2d"),this.tmpCanvas=document.createElement("canvas"),e.className=this.options.enclosingClass||"super-gif",e.appendChild(this.canvas),t&&(t.insertBefore(e,this.gifImgElement),t.removeChild(this.gifImgElement)),this.initialized=!0},n.prototype.loadSetup=function(t){return!this.loading&&(t&&(this.loadCallback=t),this.loading=!0,this.frames=[],this.clear(),this.disposalRestoreFromIdx=null,this.lastDisposalMethod=null,this.frame=null,this.lastImg=null,!0)},n.prototype.completeLoop=function(){this.onEndListener&&this.onEndListener(this.gifImgElement),this.iterationCount++,!1!==this.overrideLoopMode||this.iterationCount<0?this.doStep():(this.stepping=!1,this.playing=!1)},n.prototype.doStep=function(){if(this.stepping=this.playing,this.stepping){this.stepFrame(1);var t=10*this.frames[this.currentFrameIndex].delay;t||(t=100),0===this.getNextFrameNo()?(t+=this.loopDelay,setTimeout(this.completeLoop.bind(this),t)):setTimeout(this.doStep.bind(this),t)}},n.prototype.step=function(){this.stepping||setTimeout(this.doStep.bind(this),0)},n.prototype.putFrame=function(){var t;this.currentFrameIndex=parseInt(this.currentFrameIndex.toString(),10),this.currentFrameIndex>this.frames.length-1&&(this.currentFrameIndex=0),this.currentFrameIndex<0&&(this.currentFrameIndex=0),t=this.frameOffsets[this.currentFrameIndex],this.tmpCanvas.getContext("2d").putImageData(this.frames[this.currentFrameIndex].data,t.x,t.y),this.canvasContext.globalCompositeOperation="copy",this.canvasContext.drawImage(this.tmpCanvas,0,0)},n.prototype.playerInit=function(){this.loadErrorCause||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.options.autoPlay?this.step():(this.currentFrameIndex=0,this.putFrame()))},n.prototype.clear=function(){this.transparency=null,this.delay=null,this.lastDisposalMethod=this.disposalMethod,this.disposalMethod=null,this.frame=null},n.prototype.parseStream=function(e){try{new t.SuperGifParser(e,this.handler).parse()}catch(t){this.handleError("parse")}},n.prototype.setSizes=function(t,e){this.canvas.width=t*this.getCanvasScale(),this.canvas.height=e*this.getCanvasScale(),this.tmpCanvas.width=t,this.tmpCanvas.height=e,this.tmpCanvas.style.width=t+"px",this.tmpCanvas.style.height=e+"px",this.tmpCanvas.getContext("2d").setTransform(1,0,0,1,0,0)},n.prototype.drawError=function(){this.canvasContext.fillStyle="black",this.canvasContext.fillRect(0,0,this.hdr.width,this.hdr.height),this.canvasContext.strokeStyle="red",this.canvasContext.lineWidth=3,this.canvasContext.moveTo(0,0),this.canvasContext.lineTo(this.hdr.width,this.hdr.height),this.canvasContext.moveTo(0,this.hdr.height),this.canvasContext.lineTo(this.hdr.width,0),this.canvasContext.stroke()},n.prototype.handleError=function(t){this.loadErrorCause=t,this.hdr={width:this.gifImgElement.width,height:this.gifImgElement.height},this.frames=[],this.drawError()},n.prototype.doHdr=function(t){this.hdr=t,this.setSizes(this.hdr.width,this.hdr.height)},n.prototype.doGCE=function(t){this.pushFrame(),this.clear(),this.transparency=t.transparencyGiven?t.transparencyIndex:null,this.delay=t.delayTime,this.disposalMethod=t.disposalMethod},n.prototype.pushFrame=function(){this.frame&&(this.frames.push({data:this.frame.getImageData(0,0,this.hdr.width,this.hdr.height),delay:this.delay}),this.frameOffsets.push({x:0,y:0}))},n.prototype.doImg=function(t){var e=this;this.frame||(this.frame=this.tmpCanvas.getContext("2d"));var n=this.frames.length,r=t.lctFlag?t.lct:this.hdr.gct;n>0&&(3===this.lastDisposalMethod?null!==this.disposalRestoreFromIdx?this.frame.putImageData(frames[this.disposalRestoreFromIdx].data,0,0):this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height):this.disposalRestoreFromIdx=n-1,2===this.lastDisposalMethod&&this.frame.clearRect(this.lastImg.leftPos,this.lastImg.topPos,this.lastImg.width,this.lastImg.height));var i=this.frame.getImageData(t.leftPos,t.topPos,t.width,t.height);t.pixels.forEach(function(t,n){t!==e.transparency&&(i.data[4*n+0]=r[t][0],i.data[4*n+1]=r[t][1],i.data[4*n+2]=r[t][2],i.data[4*n+3]=255)}),this.frame.putImageData(i,t.leftPos,t.topPos),this.ctxScaled||(this.canvasContext.scale(this.getCanvasScale(),this.getCanvasScale()),this.ctxScaled=!0),this.drawWhileLoading&&(this.canvasContext.drawImage(this.tmpCanvas,0,0),this.drawWhileLoading=this.options.autoPlay),this.lastImg=t},n.prototype.doNothing=function(){},n.prototype.withProgress=function(t){return function(e){t(e)}},n.prototype.getNextFrameNo=function(){var t=this.forward?1:-1;return(this.currentFrameIndex+t+this.frames.length)%this.frames.length},n.prototype.stepFrame=function(t){this.currentFrameIndex=this.currentFrameIndex+t,this.putFrame()},n.prototype.getCanvasScale=function(){return this.options.maxWidth&&this.hdr&&this.hdr.width>this.options.maxWidth?this.options.maxWidth/this.hdr.width:window.devicePixelRatio||1},n.prototype.play=function(){this.playing=!0,this.step()},n.prototype.pause=function(){this.playing=!1},n.prototype.isPlaying=function(){return this.playing},n.prototype.getCanvas=function(){return this.canvas},n.prototype.isLoading=function(){return this.loading},n.prototype.isReady=function(){return this.ready},n.prototype.isAutoPlay=function(){return this.options.autoPlay},n.prototype.getLength=function(){return this.frames.length},n.prototype.getCurrentFrame=function(){return this.currentFrameIndex},n.prototype.moveTo=function(t){this.currentFrameIndex=t,this.putFrame()},n.prototype.loadURL=function(t,n){var r=this;if(this.loadSetup(n)){var i=new XMLHttpRequest;i.open("GET",t,!0),"overrideMimeType"in i?i.overrideMimeType("text/plain; charset=x-user-defined"):"responseType"in i?i.responseType="arraybuffer":i.setRequestHeader("Accept-Charset","x-user-defined"),i.onloadstart=function(){r.initialized||r.init()},i.onload=function(){if(200===i.status){var t=i.response;t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t));var n=new e.SuperGifStream(t);setTimeout(function(){r.parseStream(n)},0)}else r.handleError("xhr - response")},i.onerror=function(){r.handleError("xhr")},i.send()}},n.prototype.load=function(t){this.loadURL(this.gifImgElement.src,t)},n}();return pp.SuperGif=n,pp}();const wp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"image-selector",label:"src",name:"src"},{type:"checkbox",label:"play",name:"play"}],"value-property":"src",help:"scene/component/gif-view"};class _p extends hp{async oncreate_element(t){const{src:e,play:n}=this.state;this.onchangesrc(e),this.onchangeplay(n)}buildImg(){const t=this.element;if(!t)return document.createElement("img");t.replaceChildren();const e=document.createElement("img");return e.style.width="100%",e.style.height="100%",t.appendChild(e),e}onchange(t,e){super.onchange(t,e),"src"in t&&this.onchangesrc(t.src),"play"in t&&this.onchangeplay(t.play)}setElementProperties(t){}onchangeplay(t){const e=this._superGif;e&&e.isReady()&&(t?e.play():e.pause())}onchangesrc(t){const e=this.buildImg();t||(t="data:image/gif;base64,R0lGODlhYABIAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKio+Pj5iYmKCgoKampqurq66urrCwsLGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrOzs7S0tLa2tre3t7m5ubu7u7+/v8DAwMHBwcPDw8XFxcfHx8vLy8/Pz9LS0tXV1dfX193d3eTk5Onp6fj4+Pz8/P7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v///////////////////////////////////////////////////////////////////////////////yH5BAkAAPUAIf47R2VuZXJhdGVkIGJ5IGpzZ2lmIChodHRwczovL2dpdGh1Yi5jb20vYW50aW1hdHRlcjE1L2pzZ2lmLykALAAAAABgAEgAAAj+AGcJHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmR9VKqXMmypcuXMGPKnJkSIs2bOHPqZGlzp8+fQOv1DEq0KMyhRpMmRaq0KVCmTqPmhCq1qkyqLrFRSyYwGTVsVo1iZXmNa8Fk18ISHasSm1mDycCq/ck2JTWF1ObSfTjz7cFken3WFbow8M7BDA3rHOwXruKpfGXeTZg3qDVrUge7RRg3KLZjx+Q2HVyvLNy0QaMJjBaVdD2tZr2K/mmNIObRkR+n9AsYt0Pddg1WXppb8bWDx1CLLW74GcJnSl3TtDY8Zu2Et4tKl7n52eyWnxXvhl7+26jqrspbnlfIWjtz2gWPZV95neH8veU9NxZYfbfD3kFt99J6Bnmn0mQO9XfYezrVxxlmx0GUXIAM4hSeffsxBN1TFd5E4Ef3QZbfTg6CNJ5gHXJ3TEntLThiTh+KFCJNAqZU4kgAitjQTheepOBMNcZI0oQ6JpbTjSZtiNN2PZ400IxHpdiSc07G911M0iFZZYtAStnWilUeBGVLrlEZpmM0elmPlmfO8iOZXl4DZpsGEYmll2bSWWCXLwJXVY1+urhjoGEBSuiSah6K36CKtpZoo4s9CimielZq6aWYZqrpppx26umnoIZ6UkAAOw=="),e.src=t,e.setAttribute("rel:animated_src",t),e.setAttribute("rel:auto_play",String(0)),this._superGif=new xp.SuperGif(e,{autoPlay:!1}),this._superGif.init(),this.element&&Array.from(this.element.children).forEach(t=>{t.style.width="100%",t.style.height="100%"});const n=this._superGif.getCanvas();n.style.width="100%",n.style.height="100%",this._superGif.load(()=>{setTimeout(()=>{this._superGif.moveTo(0),this.play&&this._superGif.play()},100)})}ondropfile(t,e){for(let n=0;n<t.length;n++)if(/\.gif$/.test(t[n].name))return void(this.src=e[n])}get src(){return this.getState("src")}set src(t){this.set("src",t)}get play(){return this.getState("play")}set play(t){this.setState("play",t)}get nature(){return wp}get tagName(){return"div"}}qa.register("gif-view",_p);const Ap={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"attachment-selector",label:"src",name:"src",property:{category:"audio"}},{type:"checkbox",label:"started",name:"started"},{type:"checkbox",label:"loop",name:"loop"}],"value-property":"src",help:"scene/component/audio"};class Sp extends(Qa(Ka)){static get image(){return Sp.IMAGE||(Sp.IMA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pw3pwu6+9kRlvtiI5VtPhmHLltT4EKVQkfb8pcOHrXqk6nBAksUjgpKtuYsskaxGKYT0+84uYgziE4YQgMdx0m8PRfis2MbL33PMXoVjD6PEunI4HSjDjStiJP08vQk9hZzQ7oH/geoLYCUBDW4rf4FqCDFt7THUO6B+4jiDn2XNTW7zf4hqCMND4BOsGyw+yAmh0x+QeFh7EeqD5Ce8nLDrI8NpbDyIWHIQNruo4GyAPlhrEzuixBxHLDDJMnfYgYolBricHNfjIdgMWF+Qyu+pkgX4HCwuymL57ELGkIHZG7z2IWE6Q5VV7vGMhQewbtMcZiwhyHj26ne9+xs8PcvDQHnFFqCD7Au0RW4TK+fOKqw4eoOcqYqgU53HR3/5uShFPCfKey9hFDyJO/vAi7RDZnp7X5igyUH72xSDW1E2Pn4tMRCQgR8vLwbgii4gcmLvqQcSPGtIPX3M08wn6I4qYQ94cM/Yw9Xxhmw+X/59wHrtMlX1AmIkzdyaaAnLg1Nnw8WGYSk40X/BOh4+El6LMSBnN2Cd0tPq4w/LJXGrMbCX06PZ2dcM65yzlNertShSHf3SzRAyPM332IcSAHUKPi8EHmXU0l8Uglmni0yipDoi16s+jJKejhywLooz68yiMEcHr2qM4h81CJ++VPJfTu5UwBpv4Pp9DJSi6MJx0bvUwiw4ewgT8zNR0LHUL+OccOpY/3ElzyGKD5pBlMJpDlsOkMythRoNbXh95PJsdA67MrMtAEYbjeDqNo+7oKqWUUkoppZRSSimllFJKFfMXp4vmSjB8n6sAAAAASUVORK5CYII="),Sp.IMAGE}dispose(){super.dispose(),this.started=!1,delete this._audio}async ready(){super.ready(),this._audio=new Audio,this._audio.addEventListener("canplay",()=>{this.started&&this._audio.play()});const{src:t="",loop:e=!1,started:n=!1}=this.state;this.onchangeSrc(t),this.onchangeLoop(e),this.onchangeStarted(n)}render(t){const{left:e,top:n,width:r,height:i}=this.state;t.beginPath(),this.drawImage(t,Sp.image,e,n,r,i)}get nature(){return Ap}get hasTextProperty(){return!1}get src(){return this.get("src")}set src(t){this.set("src",t)}get started(){return!!this.get("started")}set started(t){this.set("started",t)}start(){this._audio&&(this._audio.classList.add("active"),this._audio.play())}pause(){this._audio&&(this._audio.classList.remove("active"),this._audio.pause())}onchangeSrc(t){try{"data"!==String(t).substring(0,4)?this._audio.crossOrigin="use-credentials":this._audio.crossOrigin=null,this._audio.src="string"==typeof t?this.app.url(t):t}catch(t){return void Br(t)}}onchangeStarted(t){const e=this._audio;t?4==e.readyState&&e.play():e.pause()}onchangeLoop(t){this._audio.loop=t}onchange(t,e){"src"in t&&this.onchangeSrc(t.src),"started"in t&&this.onchangeStarted(t.started),"loop"in t&&this.onchangeLoop(t.loop)}ondblclick(t){this.started=!this.started}ondropfile(t,e){for(let n=0;n<t.length;n++)if(t[n].type.startsWith("audio/"))return void(this.src=e[n])}}qa.register("audio",Sp);class Mp extends(Qa(qa)){is3dish(){return!0}}qa.register("text",Mp);const kp=["refid","left","top","width","height","rotation","animation"];class Ep extends Ld{isGroup(){return!0}get(t){return this._model[t]}set(t,e){if("string"==typeof t)return this.set({[t]:e});const n=kp.reduce((e,n)=>(t.hasOwnProperty(n)&&(e[n]=t[n]),e),{});return super.set(n,void 0)}capture(t,e,n){const r=super.capture(t,e,n);if(r!==this)return r}set bounds(t){if(this.__MUTATING__)return void(super.bounds=t);const e=this.bounds,n=t.width/e.width,r=t.height/e.height;this.path=this.path.map(i=>({x:t.left+(i.x-e.left)*n,y:t.top+(i.y-e.top)*r})),this.components&&this.components.forEach(t=>{if(t.mutable)t.mutatePath(null,function(t){return t.map(function(t){return{x:t.x*n,y:t.y*r}})});else{const e=t.bounds,i=t.center,s={x:i.x*(1-n),y:i.y*(1-r)},o=e.width*(1-n),a=e.height*(1-r),c=-(s.x-o/2),l=-(s.y-a/2);t.bounds={left:e.left+c,top:e.top+l,width:e.width*n,height:e.height*r}}})}get focusible(){return!1}get bounds(){return super.bounds}get hasTextProperty(){return!1}isIdentifiable(){return!1}calculateBounds(){this.clearCache(),this.__MUTATING__=!0,this.mutateBounds(function(t){const e=qa.union(this.components.map(t=>t.bounds));return this.components.forEach(t=>{const n=t.bounds;t.bounds={left:n.left-e.left,top:n.top-e.top,width:n.width,height:n.height}}),{left:t.left+e.left,top:t.top+e.top,width:e.width,height:e.height}},this),this.__MUTATING__=!1,this.parent.isGroup()&&this.parent.calculateBounds?.()}render(t){}postrender(t){const{top:e,left:n}=this.state;t.translate(n,e),this.layout.drawables(this).forEach(e=>{e.draw(t)}),t.translate(-n,-e)}}qa.memoize(Ep.prototype,"bounds",!0),qa.register("group",Ep);const Cp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"id-input",label:"ref",name:"ref"},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio"]}}],"value-property":"ref",help:"scene/component/local-ref"};class Tp extends(Qa(Ka)){get ref(){const t=this.getState("ref");return t&&"string"==typeof t?this.root.findById?.(t):null}set ref(t){this.setState("ref",t)}get refScale(){const t=this.ref;if(!t)return{x:1,y:1};const e=t.bounds,n=this.bounds,r=n.width/e.width,i=n.height/e.height;return"both"===this.model.fit?{x:r,y:i}:{x:Math.min(r,i),y:Math.min(r,i)}}draw(t){this._drawing||(this._drawing=!0,super.draw(t),this._drawing=!1)}prerender(t){if(super.prerender(t),this.ref){const e=this.ref.center,n=this.center,r=this.refScale;t.translate(n.x,n.y),t.scale(r.x,r.y),t.translate(-e.x,-e.y)}}postrender(t){if(this.ref)return this.ref.postrender(t);super.postrender(t)}render(t){if(this.ref)return this.ref.render(t);const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),t.rect(e,n,r,i)}get nature(){return Cp}get hasTextProperty(){return!1}}qa.memoize(Tp.prototype,"ref",!1),qa.memoize(Tp.prototype,"refScale",!1),qa.register("local-ref",Tp);class Pp extends(Dd(Sc)){render(t){}is3dish(){return!0}get layout(){return rc.get(this.get("layout"))||ic}}const Op={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"scene-number",name:"ref",placeholder:"SCENE-1"},{type:"number",label:"round",name:"round",property:{min:0}},{type:"select",label:"fit",name:"fit",property:{options:["","both","ratio","width","height","none"]}},{type:"select",label:"mode",name:"mode",property:{options:["view","interaction"]}}],"value-property":"ref",help:"scene/component/global-ref"};class Dp extends Pp{dispose(){this._releaseRef(),super.dispose()}get nature(){return Op}get hasTextProperty(){return!1}get tagName(){return"div"}setElementProperties(t){const{mode:e="view",round:n=0}=this.state;t.style.pointerEvents="view"==e?"none":"inherit",t.style.borderRadius=n+"px"}async ready(){super.ready(),this.fetchRef()}reposition(){if(!this.element)return;super.reposition();const t=this._element_bounds,{offsetWidth:e,offsetHeight:n}=this.element;if(this._element_bounds={offsetWidth:e,offsetHeight:n},(!t||t.offsetWidth!=e||t.offsetHeight!=n)&&this.ref&&this.root.target_element){const{fit:t="ratio"}=this.state;this.ref.fit(t)}}async fetchRef(){this._releaseRef();const{ref:t,fit:e="ratio"}=this.state;if(!t)return;const n=this.app.refProvider;if(n&&t)try{this.__ref=await n.get(t,!0),this.__ref.target=this.element,this.__ref.fit(e),this.__ref.data=this.data}catch(t){Br(t)}}get ref(){return this.__ref}set ref(t){this.setState("ref",t)}_releaseRef(){this.__ref&&this.__ref.release&&this.__ref.release(),delete this.__ref}onchange(t,e,n){super.onchange(t,e),"ref"in t&&this.fetchRef(),"fit"in t&&this.ref&&requestAnimationFrame(()=>{const{fit:t}=this.state;this.ref.fit(t)}),"data"in t&&this.ref&&requestAnimationFrame(()=>{this.ref.data=t.data})}}qa.register("global-ref",Dp);const zp="center-middle",Ip={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"board-selector",label:"board",name:"board"},{type:"checkbox",label:"modal",name:"modal"},{type:"checkbox",label:"closable",name:"closable"},{type:"checkbox",label:"draggable",name:"draggable"},{type:"checkbox",label:"minimizable",name:"minimizable"},{type:"checkbox",label:"show",name:"show"},{type:"select",label:"popup-position",name:"popupPosition",property:{options:["static","absolute"]}},{type:"select",label:"popup-origin",name:"origin",property:{options:["left-top","center-top","right-top","left-middle",zp,"right-middle","left-bottom","center-bottom","right-bottom","auto"]}},{type:"string",label:"title",name:"text"},{type:"data",label:"value",name:"value"}],help:"scene/component/popup"};class jp extends(Qa(Ka)){static get image(){return jp._image||(jp._image=new Image,jp._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAMAAABG8BK2AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZGFiYWNiYiwgMjAyMS8wNC8xNC0wMDozOTo0NCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjAgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkM4QzQxNUMzMzBEMTFFQ0JEMzZDMDUwQUI4MEI3QTAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkM4QzQxNUQzMzBEMTFFQ0JEMzZDMDUwQUI4MEI3QTAiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpENjlENTQ3R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HGtPrKypjXirM5jb910I4k69oQeKY+77EMAcALEsck/+W6f71tyCma/ZFROTrJVwMy7wmf3bv6/MX+Dgkkysblvxps/dhOKZb6IvrTakzXXuPApnpYneDGOeKvJlaSXcDmA7AicQyW84VeTOnY+NdiWcG1uiZksFEHdyAlsJEjEkmkwGNsKHNZCJGSKtVTYC1tO022mnjwUBrMdXg8dreuOBhv7D/62/8lGZ1wLxXyZKOm+iUHIQintyny0TkaATHjYgcjeAoFpEje9R/nGPqIx2aw3NU9odCQI6e6x/VLY32cKQXVBnkAAAAAElFTkSuQmCC"),jp._image}async ready(){await super.ready(),this.show&&this.onchangeShow(!0)}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,jp.image,e,n,r,i)}onchange(t,e){"value"in t?this.show?this.onchangeShow(!0):this.show=!0:"show"in t&&this.onchangeShow(this.show)}onchangeShow(t){!this.app.isEditMode&&this.getState("board")&&(t?this.openPopup(this.value):this.hidePopup())}openPopup(t,e){this.app.isEditMode||xc.show(this,this.getState("board"),{origin:this.getState("origin")||zp,modal:this.getState("modal"),closable:this.getState("closable")||!1,draggable:this.getState("draggable")||!1,minimizable:this.getState("minimizable")||!1,popupPosition:this.getState("popupPosition"),title:this.text,data:t||this.value,...e})}hidePopup(){xc.hide(this)}get board(){return this.getState("board")}set board(t){this.set("board",t)}get show(){return this.getState("show")}set show(t){this.setState("show",t)}get started(){return this.getState("show")}set started(t){this.setState("show",t)}get value(){return this.getState("value")}set value(t){this.setState("value",t)}get hasTextProperty(){return!1}get nature(){return Ip}}qa.register("popup",jp);class Rp extends qa{render(t){const{path:e=[]}=this.state;if(!(e.length<=1)){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let n=1;n<e.length;n++)t.lineTo(e[n].x,e[n].y);t.closePath(),this.drawStroke(t,void 0)}}get path(){return this.model.path}set path(t){this.set("path",t)}contains(t,e){const n=this.state.path;let r=!1;return n.forEach((i,s)=>{const o=(s+n.length+1)%n.length,a=i.x,c=i.y,l=n[o].x,h=n[o].y;c>e!=h>e&&t<(l-a)*(e-c)/(h-c)+a&&(r=!r)}),r}}qa.register("path",Rp);const Lp={mutable:!0,resizable:!1,rotatable:!0,properties:[{type:"number",label:"round",name:"round",property:{min:0,max:100,step:1}}],help:"scene/component/triangle"};class Fp extends Ka{is3dish(){return!0}contains(t,e){const{x1:n,y1:r,x2:i,y2:s,x3:o,y3:a}=this.state,c=[n,r,i,s,o,a];let l=!1;for(let n=0;n<c.length;n+=2){const r=(n+2)%c.length,i=c[n],s=c[n+1],o=c[r+1];s>e!=o>e&&t<(c[r]-i)*(e-s)/(o-s)+i&&(l=!l)}return l}get mutable(){return!0}get path(){const{x1:t,y1:e,x2:n,y2:r,x3:i,y3:s}=this.state;return[{x:t,y:e},{x:n,y:r},{x:i,y:s}]}set path(t){this.set({x1:t[0].x,y1:t[0].y,x2:t[1].x,y2:t[1].y,x3:t[2].x,y3:t[2].y})}get nature(){return Lp}}qa.memoize(Fp.prototype,"path",!1),qa.register("triangle",Fp);const Np={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"}],help:"scene/component/donut"},Bp={ondragmove:function(t,e,n){let{cx:r,rx:i}=n.model;i=Math.abs(i);let s=(n.fromParent(t.x,t.y).x-r)/i*100;s=s>=100||s<=-100?100:Math.abs(s),n.set({ratio:s})}};class Yp extends $d{is3dish(){return!0}render(t){let{ratio:e=50,cx:n,cy:r,rx:i,ry:s,startAngle:o,endAngle:a,anticlockwise:c}=this.state;i=Math.abs(i),s=Math.abs(s),t.beginPath(),t.ellipse(n,r,i,s,0,o||0,a||2*Math.PI,c),t.moveTo(n+i/100*e,r),t.ellipse(n,r,i/100*e,s/100*e,0,o||0,a||2*Math.PI,!0)}contains(t,e){let{cx:n,cy:r,rx:i,ry:s,ratio:o}=this.state;i=Math.abs(i),s=Math.abs(s);const a=(t-n)/(2*i-.5),c=(e-r)/(2*s-.5),l=(t-n)/(i/100*o*2-.5),h=(e-r)/(s/100*o*2-.5);let u=!1;return a*a+c*c<.25&&l*l+h*h>.25&&(u=!u),u}get controls(){let{cx:t,cy:e,rx:n,ratio:r}=this.state;return n=Math.abs(n),[{x:t+n/100*r,y:e,handler:Bp}]}get nature(){return Np}}qa.memoize(Yp.prototype,"controls",!1),qa.register("donut",Yp);const Gp={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"ratio",name:"ratio",property:"ratio"},{type:"number",label:"wing",name:"wing",property:"wing"}],help:"scene/component/star"},Up={ondragmove:function(t,e,n){const{cy:r,ry:i}=n.model;let s=(n.fromParent(t.x,t.y).y-r)/i*100+100;s>=100?s=100:s<=0&&(s=0),n.set({ratio:s})}};class Hp extends $d{is3dish(){return!0}render(t){const{ratio:e=30,wing:n=5,cx:r,cy:i,rx:s,ry:o}=this.state;if(n<3)return;const a=1.5707963267948966,c=2*Math.PI/n,l=s-e/100*s,h=o-e/100*o;t.save(),t.beginPath(),t.translate(r,i),t.moveTo(s*Math.cos(-a),o*Math.sin(-a)),t.lineTo((s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let e=1;e<n;e++)t.lineTo(s*Math.cos(c*e-a),o*Math.sin(c*e-a)),t.lineTo((s-l)*(Math.cos(c*(e+1)-a)+Math.cos(c*e-a))/2,(o-h)*(Math.sin(c*(e+1)-a)+Math.sin(c*e-a))/2);t.closePath(),t.restore()}get controls(){const{cx:t,cy:e,ry:n,ratio:r}=this.state;return[{x:t,y:e-n+n*(r/100),handler:Up}]}get nature(){return Gp}}qa.memoize(Hp.prototype,"controls",!1),qa.register("star",Hp);const Wp={mutable:!1,resizable:!1,rotatable:!1,properties:[]};class Vp extends(Qh(Ka)){is3dish(){return!1}isDescendible(){return!1}render(t){const{cx:e,cy:n,anticlockwise:r}=this.state,i=this.app?.scale||1;t.beginPath(),t.scale(1/i,1/i),t.ellipse(e,n,Math.abs(Vp.RADIUS),Math.abs(Vp.RADIUS),0,0,2*Math.PI,r),t.scale(i,i),t.closePath()}get path(){const{cx:t,cy:e}=this.state;return[{x:t-Vp.RADIUS,y:e-Vp.RADIUS},{x:t+Vp.RADIUS,y:e-Vp.RADIUS},{x:t+Vp.RADIUS,y:e+Vp.RADIUS},{x:t-Vp.RADIUS,y:e+Vp.RADIUS}]}set path(t){const e=t[0],n=t[2];this.set({cx:e.x+(n.x-e.x)/2,cy:e.y+(n.y-e.y)/2})}contains(t,e){const{cx:n,cy:r}=this.state,i=(t-n)/(2*Vp.RADIUS-.5),s=(e-r)/(2*Vp.RADIUS-.5);return i*i+s*s<.25}outline(t){const{cx:e,cy:n}=this.state;return this.toScene(e,n)}get nature(){return Wp}}function Xp(t){return class extends t{animOnValueChange(t,e=!1,n){if(t==this._lastValue)return;let r;r=e?t-(Number(n)||0):t-(this._lastValue||0),this._lastValue=t,this._anim_alpha=-r,this.animate({step:t=>{this._anim_alpha=r*(t-1),this.invalidate()},duration:1e3,delta:"circ",options:{x:1},ease:"out"}).start()}dispose(){super.dispose(),delete this._value_substitutor}onchange(t,e){t.hasOwnProperty("value")&&delete this._value_substitutor}get animAlpha(){return this._anim_alpha||0}get animValue(){return(this._lastValue||0)+(this._anim_alpha||0)}defaultValueSubstitutor(){return this.getState("value")}get valueSubstitutor(){return this._value_substitutor||(this._value_substitutor=ks(this.getState("value"),this,void 0)||this.defaultValueSubstitutor),this._value_substitutor}get value(){return Number(this.valueSubstitutor())||0}set value(t){delete this._value_substitutor,this.setState("value",Number(hr(t)))}}}function qp(t){return class extends t{_convertDataFormat(t,e){let n;if("json"===e)n=JSON.parse(t);else n=t;return n}isDataSource(){return!0}}}function Kp(t){return function(e){return Array.isArray(t)?t.forEach(t=>{qa.register(t,e)}):qa.register(t,e),e}}Vp.RADIUS=5,qa.memoize(Vp.prototype,"path",!1),qa.register("node",Vp);let Zp=0;const Qp=new FinalizationRegistry(()=>{Zp--});class Jp{static get residents(){return Zp}static get residentsCount(){return Zp}constructor(t,e){this.counters={},this.references={},this.creator=t,this.disposer=e,Zp++,Qp.register(this,Zp)}dispose(){if(this.disposer)for(const t in this.references)this.disposer(t,this.references[t]);this.references={},this.counters={}}get ids(){return Object.keys(this.references)}create(t){return new Promise((e,n)=>{this.creator?this.creator(t,n=>{n.release=()=>{this.disposer?.(t,n),delete n.release,Gr("RELEASED",t)},e(n)},n):n(Error("Reference id("+t+") could not be created. Reference creator should be defined."))})}add(t,e){const n=new Promise((n,r)=>{const i=this.references[t];if(i)i===e?r(Error("Reference ID and target duplicate")):e?r(Error("Reference ID duplicate")):n(i);else{const i=e=>{e.release=()=>{this.release(e)},this.references[t]=e,this.counters[t]=1,n(e)};if(e)i(e);else{if(!this.creator)return void r(Error("Reference id("+t+") is not allowed. Reference creator should be defined."));this.creator(t,i,r)}}});return this.references[t]||(this.references[t]=n),n}async get(t,e=!1){let n=this.references[t];if(n){if(!(n instanceof Promise)){if(!(t in this.counters))throw new Error("No Reference Count");return this.counters[t]++,n}if(e)return n=await n,this.counters[t]++,n}if(e)return await this.add(t);throw new Error("No References for "+t)}_id(t){for(const e in this.references){if(this.references[e]===t)return e}}release(t){const e=this._id(t);if(!e)return void Br("No Referenced ID");const n=this.references[e];n&&(this.counters[e]--,0==this.counters[e]&&(this.disposer?.(e,n),delete this.references[e],delete this.counters[e],delete t.release,Gr("RELEASED",e)))}}const $p={},tf={};let ef=[];function nf(t){const e=t.target,n="SCRIPT"===e.tagName?$p:tf,r=e.src||e.href;n[r]=!0,ef.forEach((t,e)=>{if(!t)return;const{resolve:i,scripts:s,styles:o}=t;if(n===$p){const t=s.indexOf(r);t>-1&&t<s.length-1&&sf(s[t+1])}s.some(t=>!$p[t])||o?.some(t=>!tf[t])||(i(),ef[e]=null)}),ef=ef.filter(Boolean)}function rf(t){if("string"==typeof t)return;const e=t.target,n=e.src,r="SCRIPT"===e.tagName?$p:tf;ef.forEach((e,i)=>{if(!e)return;const{reject:s,scripts:o,styles:a}=e;(r===$p&&o.includes(n)||r===tf&&!!a?.includes(n))&&(s(t),ef[i]=null)}),ef=ef.filter(Boolean),delete r[n],document.head.removeChild(e)}function sf(t){$p[t]=!1;const e=document.createElement("script");e.onload=nf,e.onerror=rf,e.type="text/javascript",e.src=t,document.head.appendChild(e)}class of{static load(t,e){const n="string"==typeof t?[t]:t,r="string"==typeof e?[e]:e;return new Promise(function(t,e){if(n&&!Array.isArray(n)||r&&!Array.isArray(r))return void e(new Error("invalid sources for load"));let i,s=!0;if(r?.forEach(t=>{t in tf||function(t){tf[t]=!1;const e=document.createElement("link");e.onload=nf,e.onerror=rf,e.type="text/css",e.rel="stylesheet",e.media="screen,print",e.href=t,document.head.appendChild(e)}(t),tf[t]||(s=!1)}),n&&n.length>0)for(const t of n)t in $p?$p[t]||(s=!1):i??=t;if(i)sf(i);else if(s)return void t();ef.push({resolve:t,reject:e,scripts:n,styles:r})})}}const af="0.0.0";class cf extends Sh{getObject3dInstance(){return new e.Sprite}build(){super.build(),this.buildMaterial()}get cz(){const{zPos:t=0}=this.component.state,{height:e}=this.component.bounds,{tz:n=0}=this.component.delta();return t+n+e/2}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;uh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=Sh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(t):e.opacity=0)}}function lf(t){if(!(t>0))return 1;let e=0;if(!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function hf(t){const{lineWidth:n=0}=t.state;let{width:r,height:i}=t.bounds;r+=n,i+=n;const s=lf(2*r),o=lf(2*i),a=ih(s,o),c=new e.CanvasTexture(a);return uf(a,t,2),c.needsUpdate=!0,c.wrapS=e.RepeatWrapping,c.wrapT=e.RepeatWrapping,c.offset.set(0,1-2*i/o),c.repeat.set(2*r/s,2*i/o),c.magFilter=e.NearestFilter,c.minFilter=e.LinearFilter,c.colorSpace=e.SRGBColorSpace,c}function uf(t,e,n){const{lineWidth:r=0}=e.state;let{left:i,top:s}=e.bounds;i-=r/2,s-=r/2;const o=t.getContext("2d");o.scale(n,n),o.translate(-i,-s),e.render(o),e.postrender(o)}class df extends cf{buildMaterial(){const t=this.object3d.material;t&&t.dispose(),this.object3d.material=new e.SpriteMaterial({map:hf(this.component),alphaTest:.01,sizeAttenuation:!1})}get scale(){const{width:t,height:e}=this.component.bounds,n=this.threeContainer,{width:r=1,height:i=1}=n?.bounds??{},{scale:s=1}=this.component.state;return{x:s*t/r,y:s*e/i,z:s}}update(){this.build(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateAlpha(){this.update()}updateText(){this.update()}}class pf extends Sh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const t=yh(this.component.state.material3d),n=new e.PlaneGeometry(1,1);n.rotateX(-Math.PI/2),this.object3d.geometry=n;const r=hf(this.component);this.object3d.material=new e.MeshStandardMaterial({map:r,transparent:!0,alphaTest:.01,side:e.DoubleSide,metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity}),this.object3d.castShadow=t.castShadow,this.object3d.receiveShadow=t.receiveShadow}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;uh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}update(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}updateFillStyle(){this.update()}updateStrokeStyle(){this.update()}updateText(){this.update()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=yh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return _h(this.object3d),super.clear()}}class ff extends Sh{getObject3dInstance(){return new e.Mesh}build(){super.build(),this.buildGeometry(),this.buildMaterial()}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;uh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.object3d.material;if(!e)return;const n=Sh.buildFillStyleTexture(this.component);n?(e.map&&e.map.dispose(),n.needsUpdate=!0,e.map=n):"string"==typeof t&&("transparent"!==t?e.color.set(t):e.opacity=0)}updateStrokeStyle(){const t=this.object3d.getObjectByName("__edgeLines__");t&&(this.object3d.remove(t),_h(t));const{strokeStyle:n}=this.component.state;if(!n||"transparent"===n||"none"===n)return;const r=this.object3d.geometry;if(!r?.getAttribute("position"))return;const i=new e.EdgesGeometry(r),s=new e.LineBasicMaterial({color:n}),o=new e.LineSegments(i,s);o.name="__edgeLines__",this.object3d.add(o)}updateDimension(){const{width:t,height:e}=this.component.bounds,{depth:n=1}=this.component.state;if(!this.object3d)return;this.object3d.geometry.computeBoundingBox();const r=this.object3d.geometry.boundingBox;if(r){const i=r.max.x-r.min.x,s=r.max.y-r.min.y,o=r.max.z-r.min.z;this.object3d.scale.set(t/i,n/s,e/o)}}buildMaterial(){const t=yh(this.component.state.material3d);this.object3d.material=new e.MeshStandardMaterial({transparent:!0,side:vh(t.side),metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity,opacity:t.opacity,envMapIntensity:t.envMapIntensity})}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=yh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.opacity=e.opacity,t.transparent=e.opacity<1,t.envMapIntensity=e.envMapIntensity,t.side=vh(e.side)}clear(){return _h(this.object3d),super.clear()}}function gf(t,e,n,r){return[["bold",t],["italic",e],[n+"px",!0],[r,!0]].filter(t=>t[1]).map(t=>t[0]).join(" ")}function mf(t){let e=0;if(t&&!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}function yf(t,e,n){const{bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black"}=n||{},c=t.getContext("2d");c.imageSmoothingEnabled=!1,c.fillStyle=a,c.strokeStyle=a,c.font=gf(r,i,o,s),c.textBaseline="top",c.textAlign="left",c.fillText(String(e),0,0)}function bf(t,n,r,i){const s=mf(2*n),o=mf(2*r),a=ih(s,o);a.getContext("2d").scale(2,2),yf(a,t,i);const c=new e.CanvasTexture(a);return c.needsUpdate=!0,c.wrapS=e.RepeatWrapping,c.wrapT=e.RepeatWrapping,c.offset.set(0,1-2*r/o),c.repeat.set(2*n/s,2*r/o),c.minFilter=e.LinearFilter,c.colorSpace=e.SRGBColorSpace,c}function vf(t,e){let{bold:n=!1,italic:r=!1,fontFamily:i="Serif",fontSize:s=10,lineHeight:o="normal"}=e||{};t=void 0===t||""==t?" ":String(t);const a=document.createElement("span");a.style.font=gf(n,r,s,i),a.style.lineHeight=String(o),a.style.whiteSpace="pre",a.style.position="absolute",a.textContent=t,document.body.appendChild(a);const c=a.getBoundingClientRect();return document.body.removeChild(a),{width:c.width,height:c.height}}class xf extends ff{get syncZPosOffset(){return this.effectiveDepth}buildGeometry(){}updateDimension(){const{width:t,height:n}=this.component.state;this.object3d.geometry&&this.object3d.geometry.dispose();const r=new e.PlaneGeometry(t,n);r.rotateX(-Math.PI/2),this.object3d.geometry=r}updateText(){const t=this.object3d.material;if(!t)return;const{width:e,height:n,bold:r=!1,italic:i=!1,fontFamily:s="Serif",fontSize:o=10,fontColor:a="black",fillStyle:c}=this.component.state,l=bf(this.component.text,e,n,{bold:r,italic:i,fontFamily:s,fontSize:o,fontColor:a});l?(t.map&&t.map.dispose(),t.map=l,l.needsUpdate=!0):"string"==typeof c&&("transparent"!==c?t.color.set(c):t.opacity=0)}updateAlpha(){const{alpha:t=1,fontColor:e="black"}=this.component.state;uh(this.object3d.material,t,e),this.object3d.material.transparent=!0}}Ch("text",t=>new xf(t));class wf extends Sh{get syncZPosOffset(){return this.effectiveDepth}getObject3dInstance(){return new e.Mesh}build(){super.build();const{width:t,height:n}=this.component.bounds;if(!t||!n)return;const r=yh(this.component.state.material3d),i=new e.PlaneGeometry(1,1);i.rotateX(-Math.PI/2),this.object3d.geometry=i;const s=hf(this.component);this.object3d.material=new e.MeshStandardMaterial({map:s,transparent:!0,side:e.DoubleSide,metalness:r.metalness,roughness:r.roughness,emissive:new e.Color(r.emissive),emissiveIntensity:r.emissiveIntensity}),this.object3d.castShadow=r.castShadow,this.object3d.receiveShadow=r.receiveShadow}updateDimension(){const{width:t,height:e}=this.component.bounds;this.object3d.scale.set(t,1,e)}updateAlpha(){const{alpha:t=1,fillStyle:e}=this.component.state;uh(this.object3d.material,t,e)}updateHidden(){this.object3d.visible=!this.component.state.hidden}_debouncedRebuild(){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this._debounceTimer=void 0,this._rebuildTexture()},100)}_rebuildTexture(){this.clear(),this.build(),this.updateDimension(),this.updateTransform(),this.updateHidden()}updateFillStyle(){this._debouncedRebuild()}updateStrokeStyle(){this._debouncedRebuild()}updateText(){this._debouncedRebuild()}updateMaterial3d(){super.updateMaterial3d();const t=this.object3d.material;if(!t)return;const e=yh(this.component.state.material3d);t.metalness=e.metalness,t.roughness=e.roughness,t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity}clear(){return this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),_h(this.object3d),super.clear()}dispose(){this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=void 0),super.dispose()}}const _f={input:"css3d",select:"css3d",textarea:"css3d",button:"css3d",iframe:"css3d",video:"css3d",label:"texture",table:"texture",progress:"texture"};function Af(t){const e=function(t){const e=t.state?.material3d?.renderMode;if("css3d"===e||"texture"===e)return e;const n=t.model?.type??"";return _f[n]??"css3d"}(t);return"texture"===e?new wf(t):new Mh(t)}Ch("html-overlay-element",Af),Ch("html-overlay-container",Af);class Sf{setShape({extrudedShape:t,extrudedOptions:n}){this.extrudedShape=t,this.bb=new e.Box2,this.bb.setFromPoints(this.extrudedShape?.extractPoints(0).shape),this.extrudedOptions=n}generateTopUV(t,n,r,i,s){const o=n[3*r],a=n[3*r+1],c=n[3*i],l=n[3*i+1],h=n[3*s],u=n[3*s+1],d=this.bb,p=d.max.x-d.min.x,f=d.max.y-d.min.y;return[new e.Vector2((o-d.min.x)/p,1-(a-d.min.y)/f),new e.Vector2((c-d.min.x)/p,1-(l-d.min.y)/f),new e.Vector2((h-d.min.x)/p,1-(u-d.min.y)/f)]}generateSideWallUV(t,n,r,i,s,o){const a=n[3*r],c=n[3*r+1],l=n[3*r+2],h=n[3*i],u=n[3*i+1],d=n[3*i+2],p=n[3*s],f=n[3*s+1],g=n[3*s+2],m=n[3*o],y=n[3*o+1],b=n[3*o+2],v=this.extrudedOptions?.depth||100,x=this.bb,w=x.max.x-x.min.x,_=x.max.y-x.min.y;return Math.abs(c-u)<.01?[new e.Vector2(a/w,1-l/v),new e.Vector2(h/w,1-d/v),new e.Vector2(p/w,1-g/v),new e.Vector2(m/w,1-b/v)]:[new e.Vector2(c/_,1-l/v),new e.Vector2(u/_,1-d/v),new e.Vector2(f/_,1-g/v),new e.Vector2(y/_,1-b/v)]}}class Mf extends Sh{clear(){return this._mesh=void 0,super.clear()}get shape(){return null}get boundUVGenerator(){return this._boundUVGenerator||(this._boundUVGenerator=new Sf),this._boundUVGenerator}build(){super.build();const t=this.effectiveDepth,n=this.shape;if(!n)return;const r=this.boundUVGenerator;r&&r.setShape({extrudedShape:n,extrudedOptions:{depth:t}});const i=this.createGeometry(n),s=this.createMaterials();this._mesh=new e.Mesh(i,s),this._mesh.rotation.x=-Math.PI/2,this._mesh.rotation.y=-Math.PI,this._mesh.rotation.z=-Math.PI,this._mesh.castShadow=!0,this.object3d.add(this._mesh),this.updateFillStyle(),this.updateStrokeStyle()}createGeometry(t){const n=this.effectiveDepth,{lineWidth:r=0}=this.component.state,i={steps:1,depth:n,bevelEnabled:r>0,bevelThickness:0,bevelSize:r,bevelSegments:1,UVGenerator:this.boundUVGenerator},s=new e.ExtrudeGeometry(t,i);return s.center(),s}createMaterials(){const t=yh(this.component.state.material3d),n={metalness:t.metalness,roughness:t.roughness,emissive:new e.Color(t.emissive),emissiveIntensity:t.emissiveIntensity,opacity:t.opacity,transparent:t.opacity<1,envMapIntensity:t.envMapIntensity,side:vh(t.side)};return[new e.MeshStandardMaterial(n),new e.MeshStandardMaterial(n)]}createTexture(){function t(t){let e=0;if(t&&!(t&t-1))return t;for(;0!=t;)t>>=1,e+=1;return 1<<e}const{width:n,height:r}=this.component.bounds,i=t(n),s=t(r),o=ih(i,s);this.component.render(o.getContext("2d"));const a=new e.CanvasTexture(o);return a.needsUpdate=!0,a.wrapS=e.RepeatWrapping,a.wrapT=e.RepeatWrapping,a.offset.set(0,1-r/s),a.repeat.set(n/i,r/s),a.minFilter=e.LinearFilter,a}getMaterials(){if(!this._mesh)return;const t=this._mesh.material;return Array.isArray(t)?t:void 0}updateMaterial3d(){super.updateMaterial3d();const t=yh(this.component.state.material3d),e=vh(t.side),n=this.getMaterials();if(n)for(const r of n)r.metalness=t.metalness,r.roughness=t.roughness,r.emissive.set(t.emissive),r.emissiveIntensity=t.emissiveIntensity,r.opacity=t.opacity,r.transparent=t.opacity<1,r.envMapIntensity=t.envMapIntensity,r.side=e}updateAlpha(){const{alpha:t=1,fillStyle:e,strokeStyle:n}=this.component.state,r=this.getMaterials();r&&(uh(r[0],t,e),uh(r[1],t,n))}updateStrokeStyle(){const t=this.getMaterials();if(!t)return;const{strokeStyle:e}=this.component.state;t[1].color.set(e)}updateFillStyle(){const{fillStyle:t}=this.component.state,e=this.getMaterials();if(!e)return;const n=e[0],r=Sh.buildFillStyleTexture(this.component);r?(n.map&&n.map.dispose(),n.map=r):n.color.set(t)}updateDimension(){super.updateDimension()}}class kf extends Mf{get shape(){const{cx:t=0,cy:n=0,rx:r=1,ry:i=1,startAngle:s=0,endAngle:o=2*Math.PI,anticlockwise:a=!1}=this.component.state,c=new e.EllipseCurve(t,n,Math.abs(r),Math.abs(i),s,o,a,0);return new e.Shape(c.getPoints(50))}}Ch("ellipse",t=>new kf(t));class Ef extends Mf{get shape(){const{width:t,height:n,round:r}=this.component.state,i=new e.Shape;if(r>0){const e=r/100*(t/2);i.moveTo(e,0),i.lineTo(t-e,0),i.quadraticCurveTo(t,0,t,e),i.lineTo(t,n-e),i.quadraticCurveTo(t,n,t-e,n),i.lineTo(e,n),i.quadraticCurveTo(0,n,0,n-e),i.lineTo(0,e),i.quadraticCurveTo(0,0,e,0)}else i.moveTo(0,0),i.lineTo(t,0),i.lineTo(t,n),i.lineTo(0,n),i.lineTo(0,0);return i}}Ch("rect",t=>new Ef(t));class Cf extends Mf{get shape(){const{path:t=[],round:n=0}=this.component.state,r=new e.Shape;for(let e=0;e<t.length;e++){const i=t[(e-1+t.length)%t.length],s=t[(e+t.length)%t.length],o=t[(e+1)%t.length];if(i.x===s.x&&i.y===s.y)continue;let a=Math.sqrt((i.x-s.x)*(i.x-s.x)+(i.y-s.y)*(i.y-s.y)),c=0!==a?Math.atan2(i.x-s.x,i.y-s.y):0,l=Math.sin(c)*Math.min(n,a/2)+s.x,h=Math.cos(c)*Math.min(n,a/2)+s.y;const u=n>0||0!==a?{x:l,y:h}:s;a=Math.sqrt((o.x-s.x)*(o.x-s.x)+(o.y-s.y)*(o.y-s.y)),c=0!==a?Math.atan2(o.x-s.x,o.y-s.y):0,l=Math.sin(c)*Math.min(n,a/2)+s.x,h=Math.cos(c)*Math.min(n,a/2)+s.y;const d=n>0||0!==a?{x:l,y:h}:s;0==e?r.moveTo(u.x,u.y):r.lineTo(u.x,u.y),n>0&&r.quadraticCurveTo(s.x,s.y,d.x,d.y)}return r}get minMax(){if(!this._minMax){const{path:t}=this.component.state;let e,n,r,i;t.forEach((t,s)=>{if(0==s)return e=r=t.x,void(n=i=t.y);e=Math.min(e,t.x),r=Math.max(r,t.x),n=Math.min(n,t.y),i=Math.max(i,t.y)}),this._minMax={minX:e,minY:n,maxX:r,maxY:i}}return this._minMax}}Ch("polygon",t=>new Cf(t));class Tf extends Mf{get shape(){const{cx:t=0,cy:n=0,rx:r=1,ry:i=1,ratio:s=50,startAngle:o=0,endAngle:a=2*Math.PI,anticlockwise:c=!1}=this.component.state,l=Math.abs(r),h=Math.abs(i),u=new e.EllipseCurve(t,n,l,h,o,a,c,0),d=new e.Shape(u.getPoints(50)),p=l/100*s,f=h/100*s;if(p>0&&f>0){const r=new e.EllipseCurve(t,n,p,f,o,a,c,0),i=new e.Path(r.getPoints(50));d.holes.push(i)}return d}}Ch("donut",t=>new Tf(t));class Pf extends Mf{get shape(){const{x1:t=0,y1:n=0,x2:r=0,y2:i=0,x3:s=0,y3:o=0}=this.component.state,a=new e.Shape;return a.moveTo(t,n),a.lineTo(r,i),a.lineTo(s,o),a.closePath(),a}}Ch("triangle",t=>new Pf(t));class Of extends Mf{get shape(){const{ratio:t=30,wing:n=5,cx:r=0,cy:i=0,rx:s=1,ry:o=1}=this.component.state;if(n<3)return null;const a=Math.PI/2,c=2*Math.PI/n,l=s-t/100*s,h=o-t/100*o,u=new e.Shape;u.moveTo(r+s*Math.cos(-a),i+o*Math.sin(-a)),u.lineTo(r+(s-l)*(Math.cos(c-a)+Math.cos(0-a))/2,i+(o-h)*(Math.sin(c-a)+Math.sin(0-a))/2);for(let t=1;t<n;t++)u.lineTo(r+s*Math.cos(c*t-a),i+o*Math.sin(c*t-a)),u.lineTo(r+(s-l)*(Math.cos(c*(t+1)-a)+Math.cos(c*t-a))/2,i+(o-h)*(Math.sin(c*(t+1)-a)+Math.sin(c*t-a))/2);return u.closePath(),u}}Ch("star",t=>new Of(t));const Df={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/sphere"};class zf extends ff{buildGeometry(){const{rx:t=0,ry:n=0,rz:r}=this.component.state,i=r??t,s=new e.SphereGeometry(1,32,16);s.scale(t,i,n),this.object3d.geometry=s}updateDimension(){this.buildGeometry()}}let If=class extends $d{is3dish(){return!0}buildRealObject(){return new zf(this)}get nature(){return Df}};If=Cd([Kp("sphere")],If);const jf={mutable:!1,resizable:!0,rotatable:!0,properties:[]};let Rf=class extends(Qa(Ka)){is3dish(){return!0}buildRealObject(){return new df(this)}get nature(){return jf}};Rf=Cd([Kp("sprite")],Rf);const Lf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cube"};class Ff extends ff{buildGeometry(){const{width:t=0,height:n=0,depth:r=0}=this.component.state,i=new e.BoxGeometry(1,1,1);i.scale(t,r,n),this.object3d.geometry=i}}let Nf=class extends(Qa(Ka)){is3dish(){return!0}buildRealObject(){return new Ff(this)}get nature(){return Lf}};Nf=Cd([Kp("cube")],Nf);const Bf={mutable:!1,resizable:!0,rotatable:!0,properties:[],help:"scene/component/cylinder"};class Yf extends ff{buildGeometry(){const{rx:t=0,ry:n=0}=this.component.state,r=this.component.state.depth??1,i=new e.CylinderGeometry(1,1,1,25);i.scale(t||1,r||1,n||1),this.object3d.geometry=i}updateDimension(){this.buildGeometry()}}let Gf=class extends $d{is3dish(){return!0}buildRealObject(){return new Yf(this)}get nature(){return Bf}};Gf=Cd([Kp("cylinder")],Gf);const Uf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"color",label:"box-color",name:"boxColor",property:"boxColor"}],help:"scene/component/banner"};class Hf extends Sh{build(){super.build();const{width:t=1,height:e=1,depth:n=1}=this.component.state;this.object3d.add(this.createCube(t,e,n));const r=this.createTextureBoard(t,n);r.position.set(0,0,.5*e+1),this.object3d.add(r)}createCube(t,n,r){const{boxColor:i="#ccaa76"}=this.component.state,s=yh(this.component.state.material3d),o=new e.BoxGeometry(t,r,n),a=new e.MeshStandardMaterial({color:i,side:e.FrontSide,metalness:s.metalness,roughness:s.roughness,emissive:new e.Color(s.emissive),emissiveIntensity:s.emissiveIntensity}),c=new e.Mesh(o,a);return c.castShadow=s.castShadow,c.receiveShadow=s.receiveShadow,c}createTextureBoard(t,n){let r;const i=yh(this.component.state.material3d),{fillStyle:s="#ccaa76"}=this.component.state,o=Sh.buildFillStyleTexture(this.component);r=o?new e.MeshStandardMaterial({map:o,metalness:i.metalness,roughness:i.roughness,emissive:new e.Color(i.emissive),emissiveIntensity:i.emissiveIntensity}):new e.MeshStandardMaterial({color:s||"#ccaa76",side:e.FrontSide,metalness:i.metalness,roughness:i.roughness,emissive:new e.Color(i.emissive),emissiveIntensity:i.emissiveIntensity});const a=new e.PlaneGeometry(t,n,1,1),c=new e.Mesh(a,r);return c.castShadow=i.castShadow,c.receiveShadow=i.receiveShadow,c}updateMaterial3d(){super.updateMaterial3d();const t=yh(this.component.state.material3d);this.object3d.traverse(e=>{if(e.isMesh){const n=e.material;n&&(n.metalness=t.metalness,n.roughness=t.roughness,n.emissive.set(t.emissive),n.emissiveIntensity=t.emissiveIntensity),e.castShadow=t.castShadow,e.receiveShadow=t.receiveShadow}})}}let Wf=class extends(Qa(Ka)){is3dish(){return!0}get nature(){return Uf}buildRealObject(){return new Hf(this)}};var Vf;Wf=Cd([Kp("banner")],Wf);const Xf={far:1e5,fov:80,near:1,zoom:1},qf={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"near",name:"near"},{type:"number",label:"far",name:"far"},{type:"number",label:"fov",name:"fov"},{type:"number",label:"zoom",name:"zoom"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/camera"};class Kf extends Sh{getObject3dInstance(){return new e.Mesh}updateCamera(){const{near:t=Xf.near,far:n=Xf.far,fov:r=Xf.fov,zoom:i=Xf.zoom,showHelper:s}=this.component.state;this.camera.far=n,this.camera.fov=r,this.camera.near=t,this.camera.zoom=i,s?this.helper||(this.helper=new e.CameraHelper(this.camera),this.object3d.add(this.helper)):this.helper&&(this.object3d.remove(this.helper),delete this.helper)}build(){super.build();const{width:t=0,height:n=0,depth:r=0,fillStyle:i="lightgray"}=this.component.state;this.object3d.geometry=new e.BoxGeometry(t,r,n),this.object3d.material=new e.MeshStandardMaterial({color:i,side:e.FrontSide}),this.camera=new e.PerspectiveCamera,this.camera.position.set(0,0,0),this.object3d.add(this.camera),this.object3d.lookAt(0,0,0),this.updateCamera()}}let Zf=Vf=class extends(Qa(Ka)){is3dish(){return!0}static get image(){return Vf._image||(Vf._image=new Image,Vf._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1IAAANSAQMAAABV6G1EAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAABlBMVEX6+voBAQGV71ZvAAAFO0lEQVR42u3dMZLkNBiGYakUKFRIqKOISxDvETiCTBEQcgQOQE7clyAi8REm7KDXIhgYoMa/7fbIX+2K9w022MCP/25Z28GW5RwRERERERERERERERERERERERERERERERERERERERERERERERHRl9mv7fdPn7879sf8Mcq3J3r5EJXaUy3Wddrcd6qNybx9F2/lZ63H+nVCa9Oe9elZa5ksa/dDbE+3fsm4v27C89bd+i6W3l+XdcnSWtuxyvPW+hqorbWb0Jr7Pl3m4tjfVMIZ625d6L5pxTPWw7rQY9P6pqu1dF8aq5d83cE3rXrGWluIxV6h53eotv4c1V3Ln7Nm66ZvvZf8SSues16sD2jubz2sC839fmvYiz7t//LJna27wsr7VjlnNWtPeHTfNlae2bZvnaTePUd+74fqV2LNxv6zdN8O3z9HSWhlc4F+dOvdsKbe2+F7q+zPddq6W2ts6r31vrN825/rtPWwvvcL5losy11uxQNz5U6fYT4w12mrWf80TUNZdetXal/LtwNW6WOFI1Y9bU3GVnfFXM9bneZKwrmKcK4qnKsK52q6uULTzRWFVjpkta/OykKrCq02puWFVhRaSWjlQa0itJrO8oNaQWgloZWFVhnUqjrLN50VBrWi0MpCqwitOqjVdFYQWlFopUGtLLSq0GpjWl5oRaGVBrWy0KpCq+ksP6gVhFYSWllolUGtqrNW/jvBZVYY1IpCKwutIrTqoFbTWUFoxUGtJLSK0KpCq41peaEVhVYa1MpCqwqtprP8oFYUWklo5UGtIrSazvJCKwxqRaGVhVYZ1Ko664ems34UWj8Nav0stBoWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhbW/9L6RWgp37WofIek8j2cyveLTkqrCq0itLLQSkJL+Q5k5budle/HVr73e/24gAHenZ6FlvK9+srzAoLQUp65oDy3QnoeRxFaWWgpz2pRnncThJbyzCDpuUtVaBWhlYWW8qwx5RlqynPovNBSnuUnPaOwCK0stJLQUp4BqjzbVHk+rFNaVWgVoZWFlvJc6Si0lGdzK88cV57bLj2PvgitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqwitLLSS0IpCKwgtL7Sc0qpCqxyyahcrH7JKFysJ54rCuYJwLi+cywnn+vdlLp+rCOfKwrnStXP95zLxiJX7WEFoeaHljO/xEqsaf9/FWqz1bM+VzloP655df2uxrnP9XPHKue7OeMDsuWInyx+Y67T1Yv0gs+cKvay6P5fvZZULrdnYFBbbcr2sdKF1MxbZFdZkLLItq3aay6/vJ102eusD2rJKl633nw/o3n+uxbrpLSv1svL6M95hQ3xYNz33t16sC21Zoc+28Xahm+u+Ic7WhbYs1+dRfrvQ5LpvHOaFNq3SZ8n/faEt6twDtli7wrJpxT6P1183/di0Ti36u3XT903Ld1qGrzf9smmdWhyTddNzf8t8UqdtK/dZGq8P2DZ1ZnHcrQ/osWO5PkvDuby7NE58Yctk7Qq3PSv3+bpc3F0aJ56wF+uLX9xu6eOb4es9z/vWc0vR3oZuByjnf2t/fP/54B/2WvvWEREREREREREREREREREREREREREREREREREREREREREREREREX2J/QlrTpqHD8xO1gAAAABJRU5ErkJggg=="),Vf._image}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,Vf.image,e,n,r,i)}buildRealObject(){return new Kf(this)}get nature(){return qf}};Zf=Vf=Cd([Kp("camera")],Zf);const Qf="KHR_materials_pbrSpecularGlossiness";class Jf{constructor(t){this.name=Qf,this.parser=t}extendMaterialParams(t,e){const s=this.parser.json.materials?.[t],o=s?.extensions?.[Qf];if(!o)return Promise.resolve();const a=[];if(Array.isArray(o.diffuseFactor)){const[t,i,s,a]=o.diffuseFactor;e.color||(e.color=new n),e.color.setRGB(t,i,s,r),e.opacity=a}null!=o.diffuseTexture&&a.push(this.parser.assignTexture(e,"map",o.diffuseTexture,i));const c=o.glossinessFactor??1;e.roughness=1-c;const l=o.specularFactor??[1,1,1],h=Math.max(l[0],l[1],l[2]);return e.metalness=h>.5?h:0,Promise.all(a)}}const $f={once:e.LoopOnce,repeat:e.LoopRepeat,pingpong:e.LoopPingPong};class tg extends Sh{constructor(){super(...arguments),this.objectSize=new e.Vector3,this._nodeIndex=new Map,this._originals=new Map,this._animationActions=new Map,this._fillStyleOriginals=new Map,this._loadGen=0}static _getSharedLoader(t){if(!tg._sharedLoader){const t=new w;!function(t){t.register(t=>new Jf(t))}(t);const e=new _;e.setDecoderPath("/node_modules/three/examples/jsm/libs/draco/"),t.setDRACOLoader(e);const n=new A;n.setTranscoderPath("/node_modules/three/examples/jsm/libs/basis/"),t.setKTX2Loader(n),t.setMeshoptDecoder(S),t.setCrossOrigin("anonymous"),tg._sharedLoader=t}return tg._sharedLoader.ktx2Loader?.detectSupport(t),tg._sharedLoader}build(){super.build();const{src:t}=this.component.state;if(!t)return void this.clear();const e=++this._loadGen,n=tg._getSharedLoader(this.threeContainer.renderer3d),r=this.component.app.url(t);n.load(r,t=>{e===this._loadGen&&this.gltfLoaded(t)},void 0,t=>{e===this._loadGen&&(Br("GLTFLoader.load",t),this.clear(),this._showErrorPlaceholder(),this.component.setState({loadError:String(t)}))})}gltfLoaded(t){this.component.state.loadError&&this.component.setState({loadError:void 0});const n=t.scene,r=t.animations,i=n.clone();i.userData.context=this,i.traverse(t=>{t.isMesh&&(t.castShadow=!0)});const s=(new e.Box3).setFromObject(i),o=s.getCenter(i.position),a=s.getSize(new e.Vector3);o.multiplyScalar(-1),this.clear(),this.objectSize=a,this.pivot=new e.Object3D,this.object3d.add(this.pivot),this.pivot.add(i),this._buildNodeIndex(i),this.updateDimension(),r&&r.length&&this._setupAnimations(r);const c=this.component.state.nodes;c&&this._applyNodeStates(c),this.updateFillStyle()}_buildNodeIndex(t){this._nodeIndex.clear(),this._originals.clear(),t.traverse(t=>{if(!t.name)return;this._nodeIndex.set(t.name,t);const e={visible:t.visible,scale:t.scale.clone()};if(t.isMesh){const n=t.material;n&&(e.color=n.color.clone(),e.opacity=n.opacity,e.transparent=n.transparent,e.emissive=n.emissive.clone(),e.emissiveIntensity=n.emissiveIntensity)}this._originals.set(t.name,e)})}getNode(t){return this._nodeIndex.get(t)}get nodeNames(){return Array.from(this._nodeIndex.keys())}_applyNodeStates(t){for(const[e,n]of Object.entries(t)){const t=this._nodeIndex.get(e);if(t&&(void 0!==n.visible&&(t.visible=n.visible),void 0!==n.scale&&t.scale.setScalar(n.scale),t.isMesh)){const e=t.material;if(!e)continue;void 0!==n.color&&e.color.set(n.color),void 0!==n.opacity&&(e.opacity=n.opacity,e.transparent=n.opacity<1),void 0!==n.emissive&&e.emissive.set(n.emissive),void 0!==n.emissiveIntensity&&(e.emissiveIntensity=n.emissiveIntensity)}}}_resetNode(t){const e=this._nodeIndex.get(t),n=this._originals.get(t);if(e&&n&&(e.visible=n.visible,e.scale.copy(n.scale),e.isMesh)){const t=e.material;t&&n.color&&(t.color.copy(n.color),t.opacity=n.opacity,t.transparent=n.transparent,t.emissive.copy(n.emissive),t.emissiveIntensity=n.emissiveIntensity)}}_resetAllNodes(){for(const t of this._originals.keys())this._resetNode(t)}_setupAnimations(t){const e=this.threeContainer.mixer;this._animationActions.clear();for(const n of t){const t=e.clipAction(n);this._animationActions.set(n.name,t)}!1!==this.component.state.autoPlay&&this._animationActions.forEach(t=>t.play());const n=this.component.state.animations;n&&this._applyAnimationStates(n)}_applyAnimationStates(t){for(const[n,r]of Object.entries(t)){const t=this._animationActions.get(n);t&&(void 0!==r.loop&&(t.loop=$f[r.loop]??e.LoopRepeat,"once"===r.loop&&(t.clampWhenFinished=!0)),void 0!==r.speed&&(t.timeScale=r.speed),void 0!==r.weight&&(t.weight=r.weight),void 0!==r.play&&(r.play?t.play():t.stop()))}}get animationNames(){return Array.from(this._animationActions.keys())}_showErrorPlaceholder(){const t=new e.BoxGeometry(1,1,1),n=new e.MeshStandardMaterial({color:13369344,wireframe:!0}),r=new e.Mesh(t,n);r.name="__error_placeholder__",this.object3d.add(r)}updateFillStyle(){const t=this.component.state.fillStyleTargets;if(!t||0===t.length)return;const{fillStyle:e}=this.component.state;if(!e)return;const n=Sh.buildFillStyleTexture(this.component);for(const r of t){const t=this._nodeIndex.get(r);if(!t||!t.isMesh)continue;const i=t.material;i&&(this._fillStyleOriginals.has(r)||this._fillStyleOriginals.set(r,{color:i.color.clone(),map:i.map,opacity:i.opacity,transparent:i.transparent}),n?(i.map&&i.map!==this._fillStyleOriginals.get(r)?.map&&i.map.dispose(),n.needsUpdate=!0,i.map=n):"string"==typeof e&&("transparent"!==e?i.color.set(e):(i.opacity=0,i.transparent=!0)))}}_restoreFillStyleTargets(t){for(const e of t){const t=this._fillStyleOriginals.get(e);if(!t)continue;const n=this._nodeIndex.get(e);if(!n||!n.isMesh)continue;const r=n.material;r&&(r.map&&r.map!==t.map&&r.map.dispose(),r.color.copy(t.color),r.map=t.map,r.opacity=t.opacity,r.transparent=t.transparent,this._fillStyleOriginals.delete(e))}}clear(){return this._animationActions.forEach(t=>t.stop()),this._animationActions.clear(),this._nodeIndex.clear(),this._originals.clear(),this._fillStyleOriginals.clear(),this.pivot&&_h(this.pivot),this.pivot=void 0,this.objectSize=void 0,super.clear()}updateDimension(){const{width:t=1,height:e=1,depth:n=1}=this.component.state,{x:r=1,y:i=1,z:s=1}=this.objectSize||{};this.pivot&&this.pivot.scale.set(t/r,n/i,e/s),this.component.invalidate()}updateSource(){this.build()}onchange(t,e){if(super.onchange(t,e),"src"in t&&this.updateSource(),"nodes"in t){this._resetAllNodes();const e=t.nodes;e&&Object.keys(e).length>0&&this._applyNodeStates(e)}if("animations"in t){const e=t.animations;e&&this._applyAnimationStates(e)}if("fillStyleTargets"in t){const t=e.fillStyleTargets??[];t.length>0&&this._restoreFillStyleTargets(t),this.updateFillStyle()}"autoPlay"in t&&(!1!==t.autoPlay?this._animationActions.forEach(t=>t.play()):this._animationActions.forEach(t=>t.stop()))}}var eg;tg._sharedLoader=null;const ng={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"gltf-selector",label:"url",name:"src",property:{displayField:"id",displayFullUrl:!0,baseUrlAlias:"$base_url",defaultStorage:"3d-model",storageFilters:{type:Array,value:[{name:"category",value:"image"}]},useUpload:!0,category:"application"},observe:function(t){this.parentNode.querySelector("[name=gltfInfo]").src=t;const e=this.parentNode.querySelector("[name=fillStyleTargets]");e&&(e.src=t)}},{type:"gltf-info",label:"",name:"gltfInfo",readonly:!0,property:{action:(t,e)=>{t.set(e)}},editor:{fullwidth:!0}},{type:"gltf-fill-targets",label:"fill-targets",name:"fillStyleTargets",editor:{fullwidth:!0}}],"value-property":"source",help:"scene/component/gltf-object"};let rg=eg=class extends(Qa(Ka)){is3dish(){return!0}static get image(){return eg._image||(eg._image=new Image,eg._image.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jM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ZgqSRq7XXYPPGeg4+1QQjyJGxpsSoj82EDiFtd6JFkMRktfHyAUAQan88STRamGS/BzrjcHd8poYj7RD4D8hmQ2yRMs1/oj0tWQdL0Rj0leW36RPn6akpep2S7kcnqaVK9a4GMLQpdobRstXNMenZNNCeyavhzHVwQ740vCb2VY3HMsM94o1mAmhpafU42NNJtnhnpMc112fXh5YRc9YWy38kGTw5aJve0GfwpUeXGAXgzPYKfM43NeJndSK8Xuqyc1+uojauNHuhxsFFZzdPgtQ4JfpvgFRmBrIH6mrUy8xGxZSEiuWQtTx/wmeY2G2fliqBj0G+28bp0g9OuYWjNNDO8MMldPFNI8hsxcdN/IqFHmjjtdQRysZlAcHUxwYfaDf4A5EhMULm6S5hR+PL4Jkx7EYGMEsWzHg3L1WXBW6ZZYKxC3ukq4l+QNRbpGcchSCSEJkyLto9ijuBu7AXQZxt5GyZtVsrrK2kWWcrMUuv/ZkPjUXmWzuK9XS5DM4Cg7RJZcToIz3Y0fPohLWr6jKTqb0fRqyN/BH2xtiD+FhQ/h367kTejByq9cBvlLyWbN1R2/OKBp25wx/gT4u49IbRUAvDGrVoUPAf1FlE82oFnt3YTxWMSzB0yXCkl9CdE8eDZKFHn4Nn/BBgAXGwlQW2JqMAAAAAASUVORK5CYII="),eg._image}get controls(){return[]}render(t){const{left:e,top:n,width:r,height:i}=this.bounds;t.beginPath(),this.drawImage(t,eg.image,e,n,r,i)}buildRealObject(){return new tg(this)}get nature(){return ng}get source(){return this.getState("src")}set source(t){this.setState("src",t)}set dimension(t){const{width:e=1,height:n=1,depth:r=1}=t;this.setState({width:e,height:n,depth:r}),this.realObject?.updateDimension()}get nodes(){return this.getState("nodes")}set nodes(t){this.setState("nodes",t)}get animations(){return this.getState("animations")}set animations(t){this.setState("animations",t)}get autoPlay(){return!1!==this.getState("autoPlay")}set autoPlay(t){this.setState("autoPlay",t)}get fillStyleTargets(){return this.getState("fillStyleTargets")}set fillStyleTargets(t){this.setState("fillStyleTargets",t)}get nodeNames(){const t=this.realObject;return t?.nodeNames??[]}get animationNames(){const t=this.realObject;return t?.animationNames??[]}};rg=eg=Cd([Kp("gltf-object")],rg);const ig={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"light-type",name:"lightType",property:{options:["","point","directional"]}},{type:"number",label:"intensity",name:"intensity"},{type:"number",label:"distance",name:"distance"},{type:"number",label:"decay",name:"decay"},{type:"checkbox",label:"cast-shadow",name:"castShadow"},{type:"number",label:"near",name:"near",placeholder:"0.5"},{type:"number",label:"far",name:"far",placeholder:"1000"},{type:"number",label:"fov",name:"fov",placeholder:"90"},{type:"number",label:"zoom",name:"zoom",placeholder:"1"},{type:"checkbox",label:"show-helper",name:"showHelper"}],help:"scene/component/light"};class sg extends Sh{updatePointLight(){const{lightType:t="point",distance:n=0,intensity:r=10,decay:i=1,fillStyle:s="white",castShadow:o,near:a=.5,far:c=1e3,fov:l=90,zoom:h=1,showHelper:u}=this.component.state;if(this.object3d.color=new e.Color(s),"point"==t&&(this.object3d.distance=n,this.object3d.decay=i),this.object3d.intensity=r,this.object3d.castShadow=o,o){const t=this.object3d.shadow?.camera;t.far=c,t.near=a,t.fov=l,t.zoom=h}if(u){const t=this.object3d.shadow?.camera;this.helper||(this.helper=new e.CameraHelper(t),this.object3d.add(this.helper))}else this.helper&&(this.object3d.remove(this.helper),delete this.helper)}getObject3dInstance(){const{lightType:t="point"}=this.component.state;return"point"==t?new e.PointLight:new e.DirectionalLight}update(){this.clear(),this.build(),this.updateDimension(),this.updateHidden(),this.updatePointLight()}}let og=class extends $d{is3dish(){return!0}buildRealObject(){return new sg(this)}get anchors(){return[]}get nature(){return ig}};og=Cd([Kp("light")],og);const ag={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"number",label:"depth",name:"depth",property:"depth"}],help:"scene/component/wall"};class cg extends ff{buildGeometry(){const{width:t=0,height:n=0,depth:r=0}=this.component.state,i=new e.BoxGeometry(1,1,1);i.scale(t,r,n),this.object3d.geometry=i}}let lg=class extends(Qa(Ka)){is3dish(){return!0}buildRealObject(){return new cg(this)}get nature(){return ag}};lg=Cd([Kp("wall")],lg);class hg extends Sh{build(){super.build()}update(){}}const ug={far:1e5,fov:80,near:1,zoom:1};class dg extends Sh{build(){super.build()}update(){super.update(),this.updateCamera()}getObject3dInstance(){return new e.PerspectiveCamera}updateCamera(){const{near:t=ug.near,far:e=ug.far,fov:n=ug.fov,zoom:r=ug.zoom}=this.component.state;this.object3d.far=e,this.object3d.fov=n,this.object3d.near=t,this.object3d.zoom=r}}class pg extends Sh{getObject3dInstance(){return new e.Group}}class fg extends ff{buildGeometry(){const{width:t,height:n}=this.component.state.dimension;this.object3d.geometry=new e.PlaneGeometry(t,n)}buildMaterial(){this.object3d.material=new e.MeshStandardMaterial({opacity:0,side:e.DoubleSide,blending:e.NoBlending})}}class gg extends Sh{getObject3dInstance(){return new e.Scene}dispose(){for(const t of this.object3d.children)_h(t);this._animationMixer&&(this._animationMixer.stopAllAction(),this._animationMixer.uncacheRoot(this.object3d),this._animationMixer=void 0),super.dispose()}clear(){return this._floor&&(this.object3d.remove(this._floor),this._floor.material instanceof Array?this._floor.material.forEach(t=>t.dispose()):this._floor.material.dispose(),this._floor.geometry.dispose(),delete this._floor),super.clear()}get floor(){return this._floor}set floor(t){this._floor&&(this.object3d.remove(this._floor),this._floor.clear(),delete this._floor),t&&(this._floor=t,this.object3d.add(t)),this.component.invalidate()}build(){super.build(),this.floor=Dh(this.component)}updateTransform(){}updateDimension(){}updatePosition(){}updateRotate(){}updateScale(){}updateAlpha(){}updateHidden(){}get animationMixer(){return this._animationMixer||(this._animationMixer=new e.AnimationMixer(this.object3d)),this._animationMixer}}const mg={mutable:!1,resizable:!0,rotatable:!0,properties:[{type:"select",label:"precision",name:"precision",property:{options:[{display:"High",value:"highp"},{display:"Medium",value:"mediump"},{display:"Low",value:"lowp"}]}},{type:"checkbox",label:"anti-alias",name:"antialias",property:"antialias"},{type:"checkbox",label:"3dmode",name:"threed",property:"threed"},{type:"checkbox",label:"auto-rotate",name:"autoRotate",property:"autoRotate"},{type:"checkbox",label:"debug",name:"debug",property:"debug"}],help:"scene/component/three-container"};let yg=class extends Ld{constructor(){super(...arguments),this._capability=new Hh}get sceneManager(){return this._capability.sceneManager}get cameraManager(){return this._capability.cameraManager}get rendererManager(){return this._capability.rendererManager}get lightManager(){return this._capability.lightManager}get controlsManager(){return this._capability.controlsManager}get eventManager(){return this._capability.eventManager}containable(t){return!0}is3dContainer(){return!0}getLightingConfig(){return{hemisphere:{skyColor:14540253,groundColor:3355443,intensity:.035}}}getCss3DSceneAttribute(){return"three-container:css3d-renderer"}init_scene3d(){this._capability.isInitialized&&this._capability.destroy(),this._capability.init(this,{lightingConfig:this.getLightingConfig(),css3DSceneAttribute:this.getCss3DSceneAttribute()}),this._capability.buildOverlays(),this._capability.resize(),this.onchangeData&&this.onchangeData(this.data,this.data)}destroy_scene3d(){this.stop(),this._capability.destroy()}stop(){}resize(){this._capability.resize()}get scene3d(){return this._capability.isInitialized||this.init_scene3d(),this._capability.scene3d}get renderer3d(){return this._capability.renderer3d}get mixer(){return this._capability.mixer}get zoom(){return this._capability.zoom}get css3DScene(){return this._capability.css3DScene}get css3DRenderer(){return this._capability.css3DRenderer}render_threed(){this._capability.renderThreeD()}render(t){this.app.isViewMode&&this.setState("threed",!0),!this.state.threed||this._capability.noSupportWebgl?super.render(t):this._capability.camera&&this._capability.renderCSS3D()}postrender(t){const{left:e,top:n,debug:r,threed:i}=this.state;let{width:s,height:o}=this.bounds;if(s=Math.floor(s),o=Math.floor(o),i){if(this._capability.isInitialized||(this.init_scene3d(),this._capability.renderThreeD()),this._capability.noSupportWebgl)return void this._capability.showWebglNoSupportText(t,this.state.width,this.state.height);if(!this._capability.renderer3d)return;const{width:i,height:a}=this._capability.getRendererSize();t.drawImage(this._capability.domElement,0,0,i,a,e,n,s,o),r&&this._capability.showDebugFPS(t)}else super.postrender(t)}dispose(){this._capability.dispose(),super.dispose()}get layout(){return rc.get("three")}get nature(){return mg}getObjectByRaycast(){return this._capability.getObjectByRaycast()}getObjectsByRaycast(){return this._capability.getObjectsByRaycast()}onchange(t,e){(t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&this._capability.destroy(),this._capability.onchange(t)}onmousedown(t){this._capability.onMouseDown(t)}onmouseup(t){this._capability.onMouseUp(t)}onmousemove(t){this._capability.onMouseMove(t)}onmouseleave(t){this._capability.onMouseLeave(t)}onwheel(t){this._capability.onWheel(t)}ondblclick(t){this._capability.onDblClick(t)}ondragstart(t){this._capability.onDragStart(t)}ondragmove(t){this._capability.onDragMove(t)}ondragend(t){this._capability.onDragEnd(t)}ontouchstart(t){this._capability.onTouchStart(t)}onpan(t){this._capability.onPan(t)}ontouchend(t){this._capability.onTouchEnd(t)}onkeydown(t){this._capability.onKeyDown(t)}onpinch(t){this._capability.onPinch(t)}ondoubletap(){this._capability.onDoubleTap()}};var bg;yg=Cd([Kp("3d-container")],yg),Th(t=>{const e=t.state.material3d?.spriteMode;return"plane"===e?new pf(t):new df(t)}),function(t){t.compile=il,t.duplicate=sl,t.select=wa,t.match=ba}(bg||(bg={})),Mr.registerResidents(()=>({componentResidentsCount:qa.residentsCount,sceneResidentsCount:Md.residentsCount,referenceMapResidentsCount:Jp.residentsCount,sceneResidents:qa.residents}));var vg=Object.freeze({__proto__:null,AbsoluteLayout:sc,Animation:qo,AudioPlayer:Sp,get Banner(){return Wf},Banner3D:Hf,get Camera(){return Zf},Camera3D:Kf,CameraManager:Ih,CardLayout:ac,Component:qa,Connectable:Qh,Container:Ld,ContainerAbstract:Sc,ControlsManager:Fh,get Cube(){return Nf},Cube3D:Ff,get Cylinder(){return Gf},Cylinder3D:Yf,DEFAULT:Ii,DPPX:Oi,DataSource:qp,Donut:Yp,DonutExtrude:Tf,Ellipse:$d,EllipseExtrude:kf,EventManager3D:Nh,EventMap:Zu,FPS:nh,GESTURES:Di,get GLTFObject(){return rg},GifView:_p,GizmoManager:Bh,GizmoOperationManager:Yh,GlobalRef:Dp,Group:Ep,HTMLAbsoluteLayout:ic,HTMLOverlayContainer:Pp,HTMLOverlayElement:hp,ImageView:lp,InfoWindow:ec,InteractionManager:Gh,KEYEVENTS:zi,Layer:Mc,Layout:rc,LightManager:Rh,LightObject:sg,Line:Qd,LinearHorizontalLayout:lc,LinearVerticalLayout:uc,LocalRef:Tp,MATERIAL_PRESETS:mh,MAX_UNDO_SIZE:30,MODE_ADD:3,MODE_EDIT:1,MODE_PASTE_DATABIND:5,MODE_PASTE_STYLE:4,MODE_SHIFT:2,MODE_VIEW:0,get Model(){return bg},MoveHandle:_c,NOTHING:_i,Node:Vp,OrthoLine:ap,PIXEL_RATIO:rh,Path:Rp,PlacementManager:Uh,get PointLight(){return og},Polygon:np,PolygonExtrude:Cf,Polyline:sp,Popup:jp,RealObject:Sh,RealObjectCamera:dg,RealObjectDomElement:Mh,RealObjectDomTexture:wf,RealObjectDummy:hg,RealObjectExtrude:Mf,RealObjectGLTF:tg,RealObjectGroup:pg,RealObjectMesh:ff,RealObjectPlane:fg,RealObjectPlane2D:pf,RealObjectScene:gg,RealObjectSprite:cf,RealObjectSprite2D:df,RealObjectText:xf,Rect:tu,RectExtrude:Ef,RectPath:Qa,ReferenceMap:Jp,RendererManager:jh,RootContainer:hd,Ruler:nu,SCALE_MIN:hh,SCENE_MODE:Ti,Scene:Md,SceneManager:zh,ScenePopup:xc,ScriptLoader:of,Shape:Ka,get Sphere(){return If},Sphere3D:zf,get Sprite(){return Rf},Star:Hp,StarExtrude:Of,TableLayout:dc,Text:Mp,ThreeCapability:Hh,get ThreeContainer(){return yg},Triangle:Fp,TriangleExtrude:Pf,UNIT_DIMENSION:dh,UNIT_ROTATE:gh,UNIT_SCALE:ph,UNIT_TRANSLATE:fh,ValueHolder:Xp,get Wall(){return lg},Wall3D:cg,animate:Xo,applyAlpha:uh,buildArrow3D:lh,compile:Zo,create:Ed,createCanvas:ih,createCanvasTexture:hf,createFloor:Dh,createRealObjectFor:Ph,debug:Gr,delta:Wo,disposeObject3D:_h,drawTextTexture:yf,error:Br,fontStyle:gf,initFontFamilyWatcher:Ri,inspector:_d,metrics:Mr,projectToScreen:Dc,registerDefaultRealObjectFactory:Th,registerRealObjectFactory:Ch,renderCanvasTexture:uf,resolveMaterial3d:yh,sceneComponent:Kp,stopFPSMeasure:eh,textBounds:vf,textTexture:bf,toThreeSide:vh,updateDefaultFontFamily:ji,version:af,warn:Yr});const xg=globalThis;"undefined"==typeof globalThis||xg.scene||(xg.scene=vg);export{sc as AbsoluteLayout,qo as Animation,Sp as AudioPlayer,Wf as Banner,Hf as Banner3D,Zf as Camera,Kf as Camera3D,Ih as CameraManager,ac as CardLayout,qa as Component,Qh as Connectable,Ld as Container,Sc as ContainerAbstract,Fh as ControlsManager,Nf as Cube,Ff as Cube3D,Gf as Cylinder,Yf as Cylinder3D,Ii as DEFAULT,Oi as DPPX,qp as DataSource,Yp as Donut,Tf as DonutExtrude,$d as Ellipse,kf as EllipseExtrude,Nh as EventManager3D,Zu as EventMap,nh as FPS,Di as GESTURES,rg as GLTFObject,_p as GifView,Bh as GizmoManager,Yh as GizmoOperationManager,Dp as GlobalRef,Ep as Group,ic as HTMLAbsoluteLayout,Pp as HTMLOverlayContainer,hp as HTMLOverlayElement,lp as ImageView,ec as InfoWindow,Gh as InteractionManager,zi as KEYEVENTS,Mc as Layer,rc as Layout,Rh as LightManager,sg as LightObject,Qd as Line,lc as LinearHorizontalLayout,uc as LinearVerticalLayout,Tp as LocalRef,mh as MATERIAL_PRESETS,Pi as MAX_UNDO_SIZE,ki as MODE_ADD,Si as MODE_EDIT,Ci as MODE_PASTE_DATABIND,Ei as MODE_PASTE_STYLE,Mi as MODE_SHIFT,Ai as MODE_VIEW,bg as Model,_c as MoveHandle,_i as NOTHING,Vp as Node,ap as OrthoLine,rh as PIXEL_RATIO,Rp as Path,Uh as PlacementManager,og as PointLight,np as Polygon,Cf as PolygonExtrude,sp as Polyline,jp as Popup,Sh as RealObject,dg as RealObjectCamera,Mh as RealObjectDomElement,wf as RealObjectDomTexture,hg as RealObjectDummy,Mf as RealObjectExtrude,tg as RealObjectGLTF,pg as RealObjectGroup,ff as RealObjectMesh,fg as RealObjectPlane,pf as RealObjectPlane2D,gg as RealObjectScene,cf as RealObjectSprite,df as RealObjectSprite2D,xf as RealObjectText,tu as Rect,Ef as RectExtrude,Qa as RectPath,Jp as ReferenceMap,jh as RendererManager,hd as RootContainer,nu as Ruler,hh as SCALE_MIN,Ti as SCENE_MODE,Md as Scene,zh as SceneManager,xc as ScenePopup,of as ScriptLoader,Ka as Shape,If as Sphere,zf as Sphere3D,Rf as Sprite,Hp as Star,Of as StarExtrude,dc as TableLayout,Mp as Text,Hh as ThreeCapability,yg as ThreeContainer,Fp as Triangle,Pf as TriangleExtrude,dh as UNIT_DIMENSION,gh as UNIT_ROTATE,ph as UNIT_SCALE,fh as UNIT_TRANSLATE,Xp as ValueHolder,lg as Wall,cg as Wall3D,Xo as animate,uh as applyAlpha,lh as buildArrow3D,Zo as compile,Ed as create,ih as createCanvas,hf as createCanvasTexture,Dh as createFloor,Ph as createRealObjectFor,Gr as debug,Wo as delta,_h as disposeObject3D,yf as drawTextTexture,Br as error,gf as fontStyle,Ri as initFontFamilyWatcher,_d as inspector,Mr as metrics,Dc as projectToScreen,Th as registerDefaultRealObjectFactory,Ch as registerRealObjectFactory,uf as renderCanvasTexture,yh as resolveMaterial3d,Kp as sceneComponent,eh as stopFPSMeasure,vf as textBounds,bf as textTexture,vh as toThreeSide,ji as updateDefaultFontFamily,af as version,Yr as warn};
52
52
  //# sourceMappingURL=things-scene.mjs.map