laymur 0.1.38 → 0.1.39

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.
@@ -1,26 +1,33 @@
1
- import type { Camera, Vector2Like, WebGLRenderer } from "three";
2
- import { Scene, Vector2 } from "three";
1
+ import type { Camera, WebGLRenderer } from "three";
2
+ import { Scene } from "three";
3
3
  import type { UILayer } from "../Layers/UILayer";
4
4
  import { renderSymbol } from "../Miscellaneous/symbols";
5
5
  import { UIElement } from "./UIElement";
6
+ export declare enum UISceneUpdateBehavior {
7
+ AUTO = "AUTO",
8
+ PROPERTY = "PROPERTY",
9
+ MANUAL = "MANUAL"
10
+ }
6
11
  export interface UISceneOptions {
7
12
  scene: Scene;
8
13
  camera: Camera;
9
- resolution: Vector2Like | number;
14
+ width: number;
15
+ height: number;
16
+ resolutionFactor: number;
10
17
  renderedByDefault: boolean;
18
+ useDepth: boolean;
11
19
  clearColor: number;
12
20
  clearAlpha: number;
13
- autoUpdate: boolean;
21
+ updateBehavior: UISceneUpdateBehavior;
14
22
  }
15
23
  export declare class UIScene extends UIElement {
16
24
  private readonly material;
17
25
  private readonly renderTarget;
18
26
  private clearColorInternal;
19
27
  private clearAlphaInternal;
20
- private autoUpdateInternal;
21
28
  private needsRenderInternal;
22
- private resolutionX;
23
- private resolutionY;
29
+ private readonly updateBehaviorInternal;
30
+ private resolutionFactorInternal;
24
31
  private sceneInternal;
25
32
  private cameraInternal;
26
33
  constructor(layer: UILayer, options?: Partial<UISceneOptions>);
@@ -31,16 +38,14 @@ export declare class UIScene extends UIElement {
31
38
  get camera(): Camera;
32
39
  get clearColor(): number;
33
40
  get clearAlpha(): number;
34
- get autoUpdate(): boolean;
35
- get resolution(): Vector2;
41
+ get resolutionFactor(): number;
36
42
  set color(value: number);
37
43
  set opacity(value: number);
38
44
  set scene(value: Scene);
39
- set camera(camera: Camera);
45
+ set camera(value: Camera);
40
46
  set clearColor(value: number);
41
47
  set clearAlpha(value: number);
42
- set autoUpdate(value: boolean);
43
- set resolution(value: Vector2Like | number);
48
+ set resolutionFactor(value: number);
44
49
  destroy(): void;
45
50
  requestRender(): void;
46
51
  [renderSymbol](renderer: WebGLRenderer): void;
@@ -1,12 +1,12 @@
1
+ import { Eventail } from "eventail";
1
2
  import { Constraint, Solver, Variable } from "kiwi.js";
2
3
  import type { Object3D, WebGLRenderer } from "three";
3
- import { Color, OrthographicCamera, Scene } from "three";
4
+ import { OrthographicCamera, Scene } from "three";
4
5
  import type { UIConstraint } from "../Constraints/UIConstraint";
5
6
  import { UIElement } from "../Elements/UIElement";
6
7
  import { addConstraintSymbol, addUIConstraintSymbol, addUIElementSymbol, addVariableSymbol, heightSymbol, removeConstraintSymbol, removeUIConstraintSymbol, removeUIElementSymbol, removeVariableSymbol, suggestVariableSymbol, widthSymbol, xSymbol, ySymbol } from "../Miscellaneous/symbols";
7
8
  import { UIBehavior } from "../Miscellaneous/UIBehavior";
8
9
  import { UIOrientation } from "../Miscellaneous/UIOrientation";
9
- export declare const color: Color;
10
10
  interface VariableDescription {
11
11
  strength: number;
12
12
  suggestedValue: number;
@@ -21,7 +21,10 @@ interface UIConstraintDescription {
21
21
  variables: Map<Variable, VariableDescription>;
22
22
  constraints: Set<Constraint>;
23
23
  }
24
- export declare abstract class UILayer {
24
+ export declare enum UILayerEvent {
25
+ ORIENTATION_CHANGED = "orientationChanged"
26
+ }
27
+ export declare abstract class UILayer extends Eventail {
25
28
  behavior: UIBehavior;
26
29
  readonly [xSymbol]: Variable;
27
30
  readonly [ySymbol]: Variable;
@@ -1,5 +1,7 @@
1
+ import type { UIElement } from "../Elements/UIElement";
1
2
  import { needsRecalculation } from "./symbols";
2
3
  export declare class UIMicroTransformations {
4
+ private readonly owner;
3
5
  [needsRecalculation]: boolean;
4
6
  private positionXInternal;
5
7
  private positionYInternal;
@@ -8,6 +10,7 @@ export declare class UIMicroTransformations {
8
10
  private scaleXInternal;
9
11
  private scaleYInternal;
10
12
  private rotationInternal;
13
+ constructor(owner: UIElement);
11
14
  get x(): number;
12
15
  get y(): number;
13
16
  get anchorX(): number;
@@ -24,5 +27,6 @@ export declare class UIMicroTransformations {
24
27
  set scaleY(value: number);
25
28
  set angle(value: number);
26
29
  set rotation(value: number);
30
+ setAnchorByGlobalPosition(x: number, y: number): void;
27
31
  reset(): void;
28
32
  }
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export * from "./Elements/UIProgress";
21
21
  export * from "./Elements/UIScene";
22
22
  export * from "./Elements/UIText";
23
23
  export * from "./Layers/UIFullScreenLayer";
24
+ export { UILayerEvent } from "./Layers/UILayer";
24
25
  export * from "./Layers/UIManualLayer";
25
26
  export * from "./Miscellaneous/UIBehavior";
26
27
  export { UIOrientation } from "./Miscellaneous/UIOrientation";
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{Vector2 as t,Box2 as i,MathUtils as n,ShaderMaterial as s,Color as o,PlaneGeometry as e,Scene as r,Mesh as h,OrthographicCamera as l,WebGLRenderTarget as u,UnsignedByteType as a,LinearFilter as d,RGBAFormat as c,NoBlending as v,Object3D as f,UniformsUtils as w,CanvasTexture as p,Texture as g,PerspectiveCamera as m}from"three";function y(){return new b}var b=function(){function t(){this.index={},this.array=[]}return t.prototype.size=function(){return this.array.length},t.prototype.empty=function(){return 0===this.array.length},t.prototype.itemAt=function(t){return this.array[t]},t.prototype.contains=function(t){return void 0!==this.index[t.id()]},t.prototype.find=function(t){var i=this.index[t.id()];return void 0===i?void 0:this.array[i]},t.prototype.setDefault=function(t,i){var n=this.index[t.id()];if(void 0===n){var s=new C(t,i());return this.index[t.id()]=this.array.length,this.array.push(s),s}return this.array[n]},t.prototype.insert=function(t,i){var n=new C(t,i),s=this.index[t.id()];return void 0===s?(this.index[t.id()]=this.array.length,this.array.push(n)):this.array[s]=n,n},t.prototype.erase=function(t){var i=this.index[t.id()];if(void 0!==i){this.index[t.id()]=void 0;var n=this.array[i],s=this.array.pop();return n!==s&&(this.array[i]=s,this.index[s.first.id()]=i),n}},t.prototype.copy=function(){for(var i=new t,n=0;n<this.array.length;n++){var s=this.array[n].copy();i.array[n]=s,i.index[s.first.id()]=n}return i},t}(),C=function(){function t(t,i){this.first=t,this.second=i}return t.prototype.copy=function(){return new t(this.first,this.second)},t}(),x=function(){function t(t){void 0===t&&(t=""),this.t=0,this.i=null,this.o=S++,this.h=t}return t.prototype.id=function(){return this.o},t.prototype.name=function(){return this.h},t.prototype.setName=function(t){this.h=t},t.prototype.context=function(){return this.i},t.prototype.setContext=function(t){this.i=t},t.prototype.value=function(){return this.t},t.prototype.setValue=function(t){this.t=t},t.prototype.plus=function(t){return new E(this,t)},t.prototype.minus=function(t){return new E(this,"number"==typeof t?-t:[-1,t])},t.prototype.multiply=function(t){return new E([t,this])},t.prototype.divide=function(t){return new E([1/t,this])},t.prototype.toJSON=function(){return{name:this.h,value:this.t}},t.prototype.toString=function(){return this.i+"["+this.h+":"+this.t+"]"},t}(),S=0,E=function(){function t(){var t=k(arguments);this.l=t.terms,this.u=t.constant}return t.prototype.terms=function(){return this.l},t.prototype.constant=function(){return this.u},t.prototype.value=function(){for(var t=this.u,i=0,n=this.l.size();i<n;i++){var s=this.l.itemAt(i);t+=s.first.value()*s.second}return t},t.prototype.plus=function(i){return new t(this,i)},t.prototype.minus=function(i){return new t(this,"number"==typeof i?-i:[-1,i])},t.prototype.multiply=function(i){return new t([i,this])},t.prototype.divide=function(i){return new t([1/i,this])},t.prototype.isConstant=function(){return 0==this.l.size()},t.prototype.toString=function(){var t=this.l.array.map((t=>t.second+"*"+t.first)).join(" + ");return this.isConstant()||0===this.u||(t+=" + "),t+this.u},t}();function k(t){for(var i=0,n=()=>0,s=y(),o=0,e=t.length;o<e;++o){var r=t[o];if("number"==typeof r)i+=r;else if(r instanceof x)s.setDefault(r,n).second+=1;else if(r instanceof E){i+=r.constant();for(var h=0,l=(c=r.terms()).size();h<l;h++){var u=c.itemAt(h);s.setDefault(u.first,n).second+=u.second}}else{if(!(r instanceof Array))throw Error("invalid Expression argument: "+r);if(2!==r.length)throw Error("array must have length 2");var a=r[0],d=r[1];if("number"!=typeof a)throw Error("array item 0 must be a number");if(d instanceof x)s.setDefault(d,n).second+=a;else{if(!(d instanceof E))throw Error("array item 1 must be a variable or expression");var c;for(i+=d.constant()*a,h=0,l=(c=d.terms()).size();h<l;h++)u=c.itemAt(h),s.setDefault(u.first,n).second+=u.second*a}}}return{terms:s,constant:i}}var O,T=(()=>{function t(){}return t.create=(t,i,n,s)=>{void 0===s&&(s=1);var o=0;return o+=1e6*Math.max(0,Math.min(1e3,t*s)),(o+=1e3*Math.max(0,Math.min(1e3,i*s)))+Math.max(0,Math.min(1e3,n*s))},t.clip=i=>Math.max(0,Math.min(t.required,i)),t.required=t.create(1e3,1e3,1e3),t.strong=t.create(1,0,0),t.medium=t.create(0,1,0),t.weak=t.create(0,0,1),t})();(t=>{t[t.Le=0]="Le",t[t.Ge=1]="Ge",t[t.Eq=2]="Eq"})(O||(O={}));var M,P=function(){function t(t,i,n,s){void 0===s&&(s=T.required),this.o=D++,this.v=i,this.p=T.clip(s),this.m=void 0===n&&t instanceof E?t:t.minus(n)}return t.prototype.id=function(){return this.o},t.prototype.expression=function(){return this.m},t.prototype.op=function(){return this.v},t.prototype.strength=function(){return this.p},t.prototype.toString=function(){return this.m+" "+["<=",">=","="][this.v]+" 0 ("+this.p+")"},t}(),D=0,I=function(){function t(){this.C=y(),this.S=y(),this.k=y(),this.O=y(),this.T=[],this.M=new F,this.P=null,this.D=0}return t.prototype.createConstraint=function(t,i,n,s){void 0===s&&(s=T.required);var o=new P(t,i,n,s);return this.addConstraint(o),o},t.prototype.addConstraint=function(t){if(void 0!==this.C.find(t))throw Error("duplicate constraint");var i=this.I(t),n=i.row,s=i.tag,o=this.$(n,s);if(o.type()===M.Invalid&&n.allDummies()){if(!$(n.constant()))throw Error("unsatisfiable constraint");o=s.marker}if(o.type()===M.Invalid){if(!this.A(n))throw Error("unsatisfiable constraint")}else n.solveFor(o),this.F(o,n),this.S.insert(o,n);this.C.insert(t,s),this.U(this.M)},t.prototype.removeConstraint=function(t){var i=this.C.erase(t);if(void 0===i)throw Error("unknown constraint");this.j(t,i.second);var n=i.second.marker,s=this.S.erase(n);if(void 0===s){var o=this.B(n);if(o.type()===M.Invalid)throw Error("failed to find leaving row");(s=this.S.erase(o)).second.solveForEx(o,n),this.F(n,s.second)}this.U(this.M)},t.prototype.hasConstraint=function(t){return this.C.contains(t)},t.prototype.addEditVariable=function(t,i){if(void 0!==this.O.find(t))throw Error("duplicate edit variable");if((i=T.clip(i))===T.required)throw Error("bad required strength");var n=new E(t),s=new P(n,O.Eq,void 0,i);this.addConstraint(s);var o=this.C.find(s).second;this.O.insert(t,{tag:o,constraint:s,constant:0})},t.prototype.removeEditVariable=function(t){var i=this.O.erase(t);if(void 0===i)throw Error("unknown edit variable");this.removeConstraint(i.second.constraint)},t.prototype.hasEditVariable=function(t){return this.O.contains(t)},t.prototype.suggestValue=function(t,i){var n=this.O.find(t);if(void 0===n)throw Error("unknown edit variable");var s=this.S,o=n.second,e=i-o.constant;o.constant=i;var r=o.tag.marker,h=s.find(r);if(void 0!==h)return h.second.add(-e)<0&&this.T.push(r),void this.H();var l=o.tag.other;if(void 0!==(h=s.find(l)))return h.second.add(e)<0&&this.T.push(l),void this.H();for(var u=0,a=s.size();u<a;++u){var d=s.itemAt(u),c=d.second,v=c.coefficientFor(r);0!==v&&c.add(e*v)<0&&d.first.type()!==M.External&&this.T.push(d.first)}this.H()},t.prototype.updateVariables=function(){for(var t=this.k,i=this.S,n=0,s=t.size();n<s;++n){var o=t.itemAt(n),e=i.find(o.second);o.first.setValue(void 0!==e?e.second.constant():0)}},t.prototype.V=function(t){var i=this;return this.k.setDefault(t,(()=>i.L(M.External))).second},t.prototype.I=function(t){for(var i=t.expression(),n=new F(i.constant()),s=i.terms(),o=0,e=s.size();o<e;++o){var r=s.itemAt(o);if(!$(r.second)){var h=this.V(r.first),l=this.S.find(h);void 0!==l?n.insertRow(l.second,r.second):n.insertSymbol(h,r.second)}}var u=this.M,a=t.strength(),d={marker:A,other:A};switch(t.op()){case O.Le:case O.Ge:var c=t.op()===O.Le?1:-1,v=this.L(M.Slack);if(d.marker=v,n.insertSymbol(v,c),a<T.required){var f=this.L(M.Error);d.other=f,n.insertSymbol(f,-c),u.insertSymbol(f,a)}break;case O.Eq:if(a<T.required){var w=this.L(M.Error),p=this.L(M.Error);d.marker=w,d.other=p,n.insertSymbol(w,-1),n.insertSymbol(p,1),u.insertSymbol(w,a),u.insertSymbol(p,a)}else{var g=this.L(M.Dummy);d.marker=g,n.insertSymbol(g)}}return n.constant()<0&&n.reverseSign(),{row:n,tag:d}},t.prototype.$=(t,i)=>{for(var n=t.cells(),s=0,o=n.size();s<o;++s){var e=n.itemAt(s);if(e.first.type()===M.External)return e.first}var r=i.marker.type();return(r===M.Slack||r===M.Error)&&t.coefficientFor(i.marker)<0?i.marker:((r=i.other.type())===M.Slack||r===M.Error)&&t.coefficientFor(i.other)<0?i.other:A},t.prototype.A=function(t){var i=this.L(M.Slack);this.S.insert(i,t.copy()),this.P=t.copy(),this.U(this.P);var n=$(this.P.constant());this.P=null;var s=this.S.erase(i);if(void 0!==s){var o=s.second;if(o.isConstant())return n;var e=this.R(o);if(e.type()===M.Invalid)return 0;o.solveForEx(i,e),this.F(e,o),this.S.insert(e,o)}for(var r=this.S,h=0,l=r.size();h<l;++h)r.itemAt(h).second.removeSymbol(i);return this.M.removeSymbol(i),n},t.prototype.F=function(t,i){for(var n=this.S,s=0,o=n.size();s<o;++s){var e=n.itemAt(s);e.second.substitute(t,i),e.second.constant()<0&&e.first.type()!==M.External&&this.T.push(e.first)}this.M.substitute(t,i),this.P&&this.P.substitute(t,i)},t.prototype.U=function(t){for(;;){var i=this.K(t);if(i.type()===M.Invalid)return;var n=this._(i);if(n.type()===M.Invalid)throw Error("the objective is unbounded");var s=this.S.erase(n).second;s.solveForEx(n,i),this.F(i,s),this.S.insert(i,s)}},t.prototype.H=function(){for(var t=this.S,i=this.T;0!==i.length;){var n=i.pop(),s=t.find(n);if(void 0!==s&&s.second.constant()<0){var o=this.N(s.second);if(o.type()===M.Invalid)throw Error("dual optimize failed");var e=s.second;t.erase(n),e.solveForEx(n,o),this.F(o,e),t.insert(o,e)}}},t.prototype.K=t=>{for(var i=t.cells(),n=0,s=i.size();n<s;++n){var o=i.itemAt(n),e=o.first;if(o.second<0&&e.type()!==M.Dummy)return e}return A},t.prototype.N=function(t){for(var i=Number.MAX_VALUE,n=A,s=t.cells(),o=0,e=s.size();o<e;++o){var r=s.itemAt(o),h=r.first,l=r.second;if(l>0&&h.type()!==M.Dummy){var u=this.M.coefficientFor(h)/l;u<i&&(i=u,n=h)}}return n},t.prototype._=function(t){for(var i=Number.MAX_VALUE,n=A,s=this.S,o=0,e=s.size();o<e;++o){var r=s.itemAt(o),h=r.first;if(h.type()!==M.External){var l=r.second,u=l.coefficientFor(t);if(u<0){var a=-l.constant()/u;a<i&&(i=a,n=h)}}}return n},t.prototype.B=function(t){for(var i=Number.MAX_VALUE,n=i,s=i,o=A,e=o,r=o,h=o,l=this.S,u=0,a=l.size();u<a;++u){var d=l.itemAt(u),c=d.second,v=c.coefficientFor(t);if(0!==v){var f=d.first;if(f.type()===M.External)h=f;else if(v<0)(w=-c.constant()/v)<n&&(n=w,e=f);else{var w;(w=c.constant()/v)<s&&(s=w,r=f)}}}return e!==o?e:r!==o?r:h},t.prototype.j=function(t,i){i.marker.type()===M.Error&&this.X(i.marker,t.strength()),i.other.type()===M.Error&&this.X(i.other,t.strength())},t.prototype.X=function(t,i){var n=this.S.find(t);void 0!==n?this.M.insertRow(n.second,-i):this.M.insertSymbol(t,-i)},t.prototype.R=t=>{for(var i=t.cells(),n=0,s=i.size();n<s;++n){var o=i.itemAt(n),e=o.first.type();if(e===M.Slack||e===M.Error)return o.first}return A},t.prototype.L=function(t){return new z(t,this.D++)},t}();function $(t){return t<0?-t<1e-8:t<1e-8}(t=>{t[t.Invalid=0]="Invalid",t[t.External=1]="External",t[t.Slack=2]="Slack",t[t.Error=3]="Error",t[t.Dummy=4]="Dummy"})(M||(M={}));var z=function(){function t(t,i){this.o=i,this.q=t}return t.prototype.id=function(){return this.o},t.prototype.type=function(){return this.q},t}(),A=new z(M.Invalid,-1),F=function(){function t(t){void 0===t&&(t=0),this.W=y(),this.u=t}return t.prototype.cells=function(){return this.W},t.prototype.constant=function(){return this.u},t.prototype.isConstant=function(){return this.W.empty()},t.prototype.allDummies=function(){for(var t=this.W,i=0,n=t.size();i<n;++i)if(t.itemAt(i).first.type()!==M.Dummy)return 0;return 1},t.prototype.copy=function(){var i=new t(this.u);return i.W=this.W.copy(),i},t.prototype.add=function(t){return this.u+=t},t.prototype.insertSymbol=function(t,i){void 0===i&&(i=1),$(this.W.setDefault(t,(()=>0)).second+=i)&&this.W.erase(t)},t.prototype.insertRow=function(t,i){void 0===i&&(i=1),this.u+=t.u*i;for(var n=t.W,s=0,o=n.size();s<o;++s){var e=n.itemAt(s);this.insertSymbol(e.first,e.second*i)}},t.prototype.removeSymbol=function(t){this.W.erase(t)},t.prototype.reverseSign=function(){this.u=-this.u;for(var t=this.W,i=0,n=t.size();i<n;++i){var s=t.itemAt(i);s.second=-s.second}},t.prototype.solveFor=function(t){var i=this.W,n=-1/i.erase(t).second;this.u*=n;for(var s=0,o=i.size();s<o;++s)i.itemAt(s).second*=n},t.prototype.solveForEx=function(t,i){this.insertSymbol(t,-1),this.solveFor(i)},t.prototype.coefficientFor=function(t){var i=this.W.find(t);return void 0!==i?i.second:0},t.prototype.substitute=function(t,i){var n=this.W.erase(t);void 0!==n&&this.insertRow(i,n.second)},t}();const U=Symbol("xSymbol"),j=Symbol("ySymbol"),B=Symbol("widthSymbol"),H=Symbol("heightSymbol"),V=Symbol("addUIElementSymbol"),L=Symbol("removeUIElementSymbol"),R=Symbol("addConstraintSymbol"),K=Symbol("removeUIConstraintSymbol"),_=Symbol("addConstraintSymbol"),N=Symbol("removeConstraintSymbol"),X=Symbol("addVariableSymbol"),q=Symbol("removeVariableSymbol"),W=Symbol("suggestVariableSymbol"),Y=Symbol("disableConstraintSymbol"),G=Symbol("enableConstraintSymbol"),Q=Symbol("needsRecalculation"),J=Symbol("renderSymbol"),Z=Symbol("clickSymbol");var tt,it,nt;function st(t){return null!==t&&Object.values(tt).some((i=>i===t))}function ot(t){return null!=t?t:tt.ALWAYS}(t=>{t[t.LANDSCAPE=0]="LANDSCAPE",t[t.PORTRAIT=1]="PORTRAIT",t[t.ALWAYS=2]="ALWAYS"})(tt||(tt={}));class et{constructor(t,i){this.layer=t,this.name="",this.layer[R](this,i)}destroy(){this.layer[K](this)}}function rt(t){return null!==t&&Object.values(it).some((i=>i===t))}function ht(t){return null!=t?t:it.P0}function lt(t){switch(t){case it.P0:return T.create(1e3,1e3,1e3);case it.P1:return T.create(100,0,0);case it.P2:return T.create(10,0,0);case it.P3:return T.create(0,100,0);case it.P4:return T.create(0,10,0);case it.P5:return T.create(0,0,100);case it.P6:return T.create(0,0,10);case it.P7:return T.create(0,0,1);default:return T.create(1e3,1e3,1e3)}}function ut(t){return null!==t&&Object.values(nt).some((i=>i===t))}function at(t){return null!=t?t:nt.EQUAL}function dt(t){switch(t){case nt.EQUAL:return O.Eq;case nt.LESS:return O.Le;case nt.GREATER:return O.Ge;default:return O.Eq}}(t=>{t[t.P0=0]="P0",t[t.P1=1]="P1",t[t.P2=2]="P2",t[t.P3=3]="P3",t[t.P4=4]="P4",t[t.P5=5]="P5",t[t.P6=6]="P6",t[t.P7=7]="P7"})(it||(it={})),(t=>{t[t.EQUAL=2]="EQUAL",t[t.LESS=0]="LESS",t[t.GREATER=1]="GREATER"})(nt||(nt={}));class ct extends et{constructor(t,i){var n;super(t.layer,new Set([t])),this.element=t,this.options={height:null!==(n=null==i?void 0:i.height)&&void 0!==n?n:t.height,power:ht(null==i?void 0:i.power),rule:at(null==i?void 0:i.rule),orientation:ot(null==i?void 0:i.orientation)},this.options.orientation!==tt.ALWAYS&&this.options.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[Y](t){this.options.orientation!==tt.ALWAYS&&t!==this.options.orientation&&this.destroyConstraints()}[G](t){this.options.orientation!==tt.ALWAYS&&t===this.options.orientation&&this.buildConstraints()}buildConstraints(){this.constraint=new P(new E(this.element[H]),dt(this.options.rule),this.options.height,lt(this.options.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class vt{constructor(){this.listeners=new Map}on(t,i,n,s=100){return this.addListener(t,i,n,s,0),this}once(t,i,n,s=100){return this.addListener(t,i,n,s,1),this}off(t,i,n){const s=this.listeners.get(t);if(!s)return this;if(!i)return this.listeners.delete(t),this;const o=s.filter((t=>t.callback!==i||void 0!==n&&t.context!==n));return o.length?this.listeners.set(t,o):this.listeners.delete(t),this}emit(t,...i){const n=this.listeners.get(t);if(!(null==n?void 0:n.length))return 0;for(const s of[...n])s.callback.apply(s.context,i),s.once&&this.off(t,s.callback,s.context);return 1}addListener(t,i,n,s,o){let e=this.listeners.get(t);if(e||(e=[],this.listeners.set(t,e)),e.some((t=>t.callback===i&&t.context===n)))throw Error("Event listener already exists");const r={callback:i,context:n,priority:s,once:o};let h=0;for(;h<e.length&&e[h].priority<=s;)h++;e.splice(h,0,r)}}const ft=new t,wt=new i;var pt,gt;(t=>{t[t.HIDDEN=0]="HIDDEN",t[t.VISIBLE=1]="VISIBLE",t[t.INTERACTIVE=2]="INTERACTIVE"})(pt||(pt={}));const mt=.5;class yt{constructor(){this[gt]=0,this.positionXInternal=0,this.positionYInternal=0,this.anchorXInternal=mt,this.anchorYInternal=mt,this.scaleXInternal=1,this.scaleYInternal=1,this.rotationInternal=0}get x(){return this.positionXInternal}get y(){return this.positionYInternal}get anchorX(){return this.anchorXInternal}get anchorY(){return this.anchorYInternal}get scaleX(){return this.scaleXInternal}get scaleY(){return this.scaleYInternal}get angle(){return n.radToDeg(this.rotationInternal)}get rotation(){return this.rotationInternal}set x(t){this.positionXInternal=t,this[Q]=1}set y(t){this.positionYInternal=t,this[Q]=1}set anchorX(t){this.anchorXInternal=t,this[Q]=1}set anchorY(t){this.anchorYInternal=t,this[Q]=1}set scaleX(t){this.scaleXInternal=t,this[Q]=1}set scaleY(t){this.scaleYInternal=t,this[Q]=1}set angle(t){this.rotationInternal=n.degToRad(t),this[Q]=1}set rotation(t){this.rotationInternal=t,this[Q]=1}reset(){this.positionXInternal=0,this.positionYInternal=0,this.anchorXInternal=mt,this.anchorYInternal=mt,this.scaleXInternal=1,this.scaleYInternal=1,this.rotationInternal=0,this[Q]=1}}gt=Q;class bt extends s{constructor(t){super({uniforms:{map:{value:t},opacity:{value:1},color:{value:new o(1,1,1)}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D map;\n uniform float opacity;\n uniform vec3 color;\n varying vec2 vUv;\n\n void main() {\n vec4 textureColor = texture2D(map, vUv);\n gl_FragColor = vec4(textureColor.rgb * color, textureColor.a * opacity);\n #include <colorspace_fragment>\n }\n ",transparent:1,lights:0,fog:0})}getTexture(){return this.uniforms.map.value}getColor(){return this.uniforms.color.value.getHex()}getOpacity(){return this.uniforms.opacity.value}setTexture(t){this.uniforms.map.value=t,this.uniformsNeedUpdate=1}setColor(t){this.uniforms.color.value.setHex(t),this.uniformsNeedUpdate=1}setOpacity(t){this.uniforms.opacity.value=t,this.uniformsNeedUpdate=1}}const Ct=new e(1,1).translate(.5,.5,0),xt=new r,St=new h(Ct);xt.add(St);class Et{constructor(t=0,i=0){this.paddingHorizontalInternal=t,this.paddingVerticalInternal=i,this.camera=new l(-1,1,1,-1,0,1),this.updateCameraTransform()}get paddingHorizontal(){return this.paddingHorizontalInternal}get paddingVertical(){return this.paddingVerticalInternal}set paddingHorizontal(t){this.paddingHorizontalInternal!==t&&(this.paddingHorizontalInternal=t,this.updateCameraTransform())}set paddingVertical(t){this.paddingVerticalInternal!==t&&(this.paddingVerticalInternal=t,this.updateCameraTransform())}render(t,i){St.material=i,t.render(xt,this.camera)}updateCameraTransform(){this.camera.left=-this.paddingHorizontalInternal,this.camera.right=1+this.paddingHorizontalInternal,this.camera.bottom=-this.paddingVerticalInternal,this.camera.top=1+this.paddingVerticalInternal,this.camera.updateProjectionMatrix()}}class kt{constructor(){this.passes=[],this.defaultMaterial=new bt,this.screen=new Et,this.needsUpdateInternal=0,this.lastPaddingHasChangedInternal=0,this.lastPaddingInternal=0;const t={format:c,minFilter:d,magFilter:d,type:a,depthBuffer:0,stencilBuffer:0};this.fromRenderTarget=new u(1,1,t),this.toRenderTarget=new u(1,1,t),this.fromRenderTarget.texture.generateMipmaps=0,this.toRenderTarget.texture.generateMipmaps=0}get needsUpdate(){return this.needsUpdateInternal&&this.hasValuablePasses()||this.hasPassesNeedingUpdate()}get lastPaddingHasChanged(){return this.lastPaddingHasChangedInternal}get lastPadding(){return this.lastPaddingInternal}requestUpdate(){this.needsUpdateInternal=1}compose(t,i,n,s,o=1){const e=this.hasValuablePasses();if(!(this.needsUpdateInternal&&e||this.hasPassesNeedingUpdate()))return e||(this.lastPaddingHasChangedInternal=0!==this.lastPaddingInternal,this.lastPaddingInternal=0),this.needsUpdateInternal=0,e?this.defaultMaterial:s;const r=this.calculatePadding();this.lastPaddingHasChangedInternal=this.lastPaddingInternal!==r,this.lastPaddingInternal=r;const h=i+2*r,l=n+2*r;this.fromRenderTarget.setSize(h,l),this.toRenderTarget.setSize(h,l),this.setScreenPadding(i,n,r),t.setClearColor(0,0),t.setRenderTarget(this.toRenderTarget),t.clear(1,0,0);const u=s.blending;o&&(s.blending=v),this.screen.render(t,s),s.blending=u;const a={width:i,height:n,padding:r};for(let i=0;i<this.passes.length;i++){const n=this.passes[i];(n.needsUpdate||n.isValuable)&&(this.reverseRenderTargets(),t.setRenderTarget(this.toRenderTarget),t.clear(1,0,0),this.passes[i].render(t,this.fromRenderTarget.texture,a))}return this.needsUpdateInternal=0,this.defaultMaterial.setTexture(this.toRenderTarget.texture),this.defaultMaterial}destroy(){this.fromRenderTarget.dispose(),this.toRenderTarget.dispose()}hasValuablePasses(){return this.passes.some((t=>t.isValuable))}hasPassesNeedingUpdate(){return this.passes.some((t=>t.needsUpdate))}calculatePadding(){return this.passes.reduce(((t,i)=>Math.max(t,i.padding)),0)}setScreenPadding(t,i,n){this.screen.paddingHorizontal=n/t,this.screen.paddingVertical=n/i}reverseRenderTargets(){const t=this.fromRenderTarget;this.fromRenderTarget=this.toRenderTarget,this.toRenderTarget=t}}var Ot,Tt,Mt,Pt,Dt,It,$t,zt,At,Ft;(t=>{t.CLICK="click"})(It||(It={}));class Ut extends vt{constructor(t,i,n,s,o,e){super(),this.layer=t,this.object=i,this.name="",this.micro=new yt,this[Ot]=new x("x"),this[Tt]=new x("y"),this[Mt]=new x("width"),this[Pt]=new x("height"),this[Dt]=0,this.behaviorInternal=pt.VISIBLE,this.composer=new kt,this.lastPadding=0,this.layer[V](this,this.object),this.layer[X](this,this[U],lt(it.P7)),this.layer[X](this,this[j],lt(it.P7)),this.layer[X](this,this[B],lt(it.P5)),this.layer[X](this,this[H],lt(it.P5)),this[U].setValue(n),this[j].setValue(s),this[B].setValue(o),this[H].setValue(e),this.layer[W](this,this[U],n),this.layer[W](this,this[j],s),this.layer[W](this,this[B],o),this.layer[W](this,this[H],e)}get passes(){return this.composer.passes}get x(){return this[U].value()}get y(){return this[j].value()}get width(){return this[B].value()}get height(){return this[H].value()}get zIndex(){return this.object.position.z}get behavior(){return this.behaviorInternal}set x(t){this.layer[W](this,this[U],t)}set y(t){this.layer[W](this,this[j],t)}set width(t){this.layer[W](this,this[B],t)}set height(t){this.layer[W](this,this[H],t)}set zIndex(t){this.object.position.z=t}set behavior(t){this.behaviorInternal=t,this.object.visible=t!==pt.HIDDEN}destroy(){this.composer.destroy(),this.layer[q](this,this[H]),this.layer[q](this,this[B]),this.layer[q](this,this[j]),this.layer[q](this,this[U]),this.layer[L](this)}[(Ot=U,Tt=j,Mt=B,Pt=H,Dt=Q,Z)](t,i){return this.behavior!==pt.INTERACTIVE?0:(this.flushTransform(),n=this.x,s=this.y,o=this.width,e=this.height,ft.set(t,i),wt.min.set(n,s),wt.max.set(o,e).add(wt.min),wt.containsPoint(ft)?(this.emit(It.CLICK,this),1):0);var n,s,o,e}flushTransform(){(this[Q]||this.micro[Q]||this.composer.lastPaddingHasChanged)&&(((t,i,n,s,o,e,r)=>{const h=this.x-r,l=this.y-r,u=this.width+2*r,a=this.height+2*r,d=h+u*i.anchorX,c=l+a*i.anchorY;let v=h-d,f=l-c;v*=i.scaleX,f*=i.scaleY;const w=Math.cos(i.rotation),p=Math.sin(i.rotation);v=v*w-f*p,f=v*p+f*w,v+=i.x,f+=i.y,t.position.x=v+d,t.position.y=f+c,t.rotation.z=i.rotation,t.scale.x=u*i.scaleX,t.scale.y=a*i.scaleY})(this.object,this.micro,0,0,0,0,this.composer.lastPadding),this[Q]=0,this.micro[Q]=0)}}const jt=new o(0);class Bt{constructor(){this.behavior=pt.VISIBLE,this[$t]=new x,this[zt]=new x,this[At]=new x,this[Ft]=new x,this.scene=new r,this.camera=new l,this.solver=new I,this.elements=new Map,this.constraints=new Map,this.orientationPrivate=tt.PORTRAIT,this.needsRecalculation=0}get orientation(){return this.orientationPrivate}destroy(){this.solver=void 0;for(const t of this.constraints.keys())t.destroy();for(const t of this.elements.keys())t.destroy()}[($t=U,zt=j,At=B,Ft=H,V)](t,i){if(this.elements.has(t))throw Error("Element already added");this.elements.set(t,{object:i,variables:new Map,constraints:new Set}),this.scene.add(i)}[L](t){const i=this.elements.get(t);if(void 0===i)throw Error("Element not found");if(i.variables.size>0)throw Error("Variables should be removed before removing element");if(i.constraints.size>0)throw Error("Constraints should be removed before removing element");this.elements.delete(t),this.scene.remove(i.object)}[R](t,i){if(this.constraints.has(t))throw Error("Constraint already added");for(const n of i){const i=this.elements.get(n);if(void 0===i)throw Error("Element not found");if(i.constraints.has(t))throw Error("Something went wrong");i.constraints.add(t)}this.constraints.set(t,{elements:i,variables:new Map,constraints:new Set})}[K](t){const i=this.constraints.get(t);if(void 0===i)throw Error("Constraint not found");if(i.variables.size>0)throw Error("Variables should be removed before removing constraint");if(i.constraints.size>0)throw Error("Constraints should be removed before removing constraint");for(const n of i.elements){const i=this.elements.get(n);if(void 0===i)throw Error("Element not found");if(!i.constraints.has(t))throw Error("Something went wrong");i.constraints.delete(t)}this.constraints.delete(t)}[_](t,i){var n;const s=this.constraints.get(t);if(void 0===s)throw Error("Before adding constraint you need to add it's owner");if(s.constraints.has(i))throw Error("Constraint already exists");s.constraints.add(i),null===(n=this.solver)||void 0===n||n.addConstraint(i),this.needsRecalculation=1}[N](t,i){var n;const s=this.constraints.get(t);if(void 0===s)throw Error("Before removing constraint you need to add it's owner");if(!s.constraints.has(i))throw Error("Constraint not found");s.constraints.delete(i),null===(n=this.solver)||void 0===n||n.removeConstraint(i),this.needsRecalculation=1}[X](t,i,n){var s;const o=t instanceof Ut?this.elements.get(t):this.constraints.get(t);if(void 0===o)throw Error("Before adding variable you need to add it's owner");if(o.variables.has(i))throw Error("Variable already exists");o.variables.set(i,{strength:n,suggestedValue:i.value()}),null===(s=this.solver)||void 0===s||s.addEditVariable(i,n),this.needsRecalculation=1}[q](t,i){var n;const s=t instanceof Ut?this.elements.get(t):this.constraints.get(t);if(void 0===s)throw Error("Before removing variable you need to add it's owner");if(!s.variables.has(i))throw Error("Variable does not exist");s.variables.delete(i),null===(n=this.solver)||void 0===n||n.removeEditVariable(i),this.needsRecalculation=1}[W](t,i,n){var s;const o=t instanceof Ut?this.elements.get(t):this.constraints.get(t);if(void 0===o)throw Error("Before suggesting variable you need to add it's owner");const e=o.variables.get(i);if(!e)throw Error("Variable does not exist");e.suggestedValue!==n&&(e.suggestedValue=n,null===(s=this.solver)||void 0===s||s.suggestValue(i,n),this.needsRecalculation=1)}render(t){var i;if(this.behavior===pt.HIDDEN)return;const n=t.getRenderTarget(),s=t.getClearColor(jt),o=t.getClearAlpha();if(this.needsRecalculation){this.needsRecalculation=0,null===(i=this.solver)||void 0===i||i.updateVariables();for(const t of this.elements.keys())t[Q]=1}for(const i of this.elements.keys())i[J](t);t.setRenderTarget(n),t.setClearColor(s),t.setClearAlpha(o),t.render(this.scene,this.camera)}clickInternal(t,i){if(this.behavior!==pt.INTERACTIVE)return;const n=[...this.elements.keys()].filter((t=>t.behavior===pt.INTERACTIVE)).sort(((t,i)=>t.zIndex-i.zIndex));for(const s of n)if(s[Z](t,i))break}resizeInternal(t,i){this.applyCameraSize(t,i),this.rebuildLayerConstraints(t,i),this.updateOrientation(t,i),this.needsRecalculation=1}applyCameraSize(t,i){this.camera.near=-1e3,this.camera.far=0,this.camera.bottom=0,this.camera.left=0,this.camera.right=t,this.camera.top=i,this.camera.updateProjectionMatrix()}rebuildLayerConstraints(t,i){var n,s,o,e,r,h,l,u;this.constraintX&&(null===(n=this.solver)||void 0===n||n.removeConstraint(this.constraintX),this.constraintX=void 0),this.constraintY&&(null===(s=this.solver)||void 0===s||s.removeConstraint(this.constraintY),this.constraintY=void 0),this.constraintW&&(null===(o=this.solver)||void 0===o||o.removeConstraint(this.constraintW),this.constraintW=void 0),this.constraintH&&(null===(e=this.solver)||void 0===e||e.removeConstraint(this.constraintH),this.constraintH=void 0),this.constraintX=new P(new E(this[U]),O.Eq,0,T.required),this.constraintY=new P(new E(this[j]),O.Eq,0,T.required),this.constraintW=new P(new E(this[B]),O.Eq,t,T.required),this.constraintH=new P(new E(this[H]),O.Eq,i,T.required),null===(r=this.solver)||void 0===r||r.addConstraint(this.constraintX),null===(h=this.solver)||void 0===h||h.addConstraint(this.constraintY),null===(l=this.solver)||void 0===l||l.addConstraint(this.constraintW),null===(u=this.solver)||void 0===u||u.addConstraint(this.constraintH)}updateOrientation(t,i){const n=this.orientationPrivate;if(this.orientationPrivate=t>i?tt.LANDSCAPE:tt.PORTRAIT,n!==this.orientationPrivate){this.solver=void 0;for(const t of this.constraints.keys())t[G](this.orientationPrivate);for(const t of this.constraints.keys())t[Y](this.orientationPrivate);this.solver=new I;const t=[...this.elements.values(),...this.constraints.values()];for(const i of t)for(const[t,n]of i.variables.entries())this.solver.addEditVariable(t,n.strength),this.solver.suggestValue(t,n.suggestedValue);this.constraintX&&this.solver.addConstraint(this.constraintX),this.constraintY&&this.solver.addConstraint(this.constraintY),this.constraintW&&this.solver.addConstraint(this.constraintW),this.constraintH&&this.solver.addConstraint(this.constraintH);for(const t of this.constraints.values())for(const i of t.constraints.values())this.solver.addConstraint(i)}}}function Ht(t,i){if((t instanceof Bt?t:t.layer)!==i.layer)throw Error(`Elements must be on the same layer - element "${i.constructor.name}" cannot interact with elements from a different layer`)}function Vt(t,i,n){if(t<=0||i<=0)throw Error(null!=n?n:`Invalid dimensions: width (${t}) and height (${i}) must both be positive numbers greater than 0`)}class Lt extends et{constructor(t,i,n){var s,o,e;Ht(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={anchorOne:null!==(s=null==n?void 0:n.anchorOne)&&void 0!==s?s:.5,anchorTwo:null!==(o=null==n?void 0:n.anchorTwo)&&void 0!==o?o:.5,distance:null!==(e=null==n?void 0:n.distance)&&void 0!==e?e:0,power:ht(null==n?void 0:n.power),rule:at(null==n?void 0:n.rule),orientation:ot(null==n?void 0:n.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[Y](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.elementOne[U]).plus(new E(this.elementOne[B]).multiply(this.parameters.anchorOne)),i=new E(this.elementTwo[U]).plus(new E(this.elementTwo[B]).multiply(this.parameters.anchorTwo));this.constraint=new P(i.minus(t),dt(this.parameters.rule),this.parameters.distance,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Rt extends et{constructor(t,i,n){var s;Ht(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={proportion:null!==(s=null==n?void 0:n.proportion)&&void 0!==s?s:1,power:ht(null==n?void 0:n.power),rule:at(null==n?void 0:n.rule),orientation:ot(null==n?void 0:n.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[Y](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.elementOne[B]).multiply(this.parameters.proportion),i=new E(this.elementTwo[B]);this.constraint=new P(t.minus(i),dt(this.parameters.rule),0,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Kt extends et{constructor(t,i,n){var s,o,e;Ht(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={anchorOne:null!==(s=null==n?void 0:n.anchorOne)&&void 0!==s?s:.5,anchorTwo:null!==(o=null==n?void 0:n.anchorTwo)&&void 0!==o?o:.5,distance:null!==(e=null==n?void 0:n.distance)&&void 0!==e?e:0,power:ht(null==n?void 0:n.power),rule:at(null==n?void 0:n.rule),orientation:ot(null==n?void 0:n.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[Y](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.elementOne[j]).plus(new E(this.elementOne[H]).multiply(this.parameters.anchorOne)),i=new E(this.elementTwo[j]).plus(new E(this.elementTwo[H]).multiply(this.parameters.anchorTwo));this.constraint=new P(i.minus(t),dt(this.parameters.rule),this.parameters.distance,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class _t extends et{constructor(t,i,n){var s;Ht(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={proportion:null!==(s=null==n?void 0:n.proportion)&&void 0!==s?s:1,power:ht(null==n?void 0:n.power),rule:at(null==n?void 0:n.rule),orientation:ot(null==n?void 0:n.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[Y](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.elementOne[H]).multiply(this.parameters.proportion),i=new E(this.elementTwo[H]);this.constraint=new P(t.minus(i),dt(this.parameters.rule),0,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Nt extends et{constructor(t,i){var n;super(t.layer,new Set([t])),this.element=t,this.options={width:null!==(n=null==i?void 0:i.width)&&void 0!==n?n:t.width,power:ht(null==i?void 0:i.power),rule:at(null==i?void 0:i.rule),orientation:ot(null==i?void 0:i.orientation)},this.options.orientation!==tt.ALWAYS&&this.options.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[Y](t){this.options.orientation!==tt.ALWAYS&&t!==this.options.orientation&&this.destroyConstraints()}[G](t){this.options.orientation!==tt.ALWAYS&&t===this.options.orientation&&this.buildConstraints()}buildConstraints(){this.constraint=new P(new E(this.element[B]),dt(this.options.rule),this.options.width,lt(this.options.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Xt{static size(t,i){var n,s,o,e,r,h,l,u;return{x:new Nt(t,{width:null===(n=i.size)||void 0===n?void 0:n.x,power:null===(s=i.power)||void 0===s?void 0:s.x,rule:null===(o=i.rule)||void 0===o?void 0:o.x,orientation:null===(e=i.orientation)||void 0===e?void 0:e.x}),y:new ct(t,{height:null===(r=i.size)||void 0===r?void 0:r.y,power:null===(h=i.power)||void 0===h?void 0:h.y,rule:null===(l=i.rule)||void 0===l?void 0:l.y,orientation:null===(u=i.orientation)||void 0===u?void 0:u.y})}}static distance(t,i,n){var s,o,e,r,h,l,u,a,d,c,v,f;return{x:new Lt(t,i,{anchorOne:null===(s=n.anchorOne)||void 0===s?void 0:s.x,anchorTwo:null===(o=n.anchorTwo)||void 0===o?void 0:o.x,distance:null===(e=n.distance)||void 0===e?void 0:e.x,power:null===(r=n.power)||void 0===r?void 0:r.x,rule:null===(h=n.rule)||void 0===h?void 0:h.x,orientation:null===(l=n.orientation)||void 0===l?void 0:l.x}),y:new Kt(t,i,{anchorOne:null===(u=n.anchorOne)||void 0===u?void 0:u.y,anchorTwo:null===(a=n.anchorTwo)||void 0===a?void 0:a.y,distance:null===(d=n.distance)||void 0===d?void 0:d.y,power:null===(c=n.power)||void 0===c?void 0:c.y,rule:null===(v=n.rule)||void 0===v?void 0:v.y,orientation:null===(f=n.orientation)||void 0===f?void 0:f.y})}}static proportion(t,i,n){var s,o,e,r,h,l,u,a;return{x:new Rt(t,i,{proportion:null===(s=n.proportion)||void 0===s?void 0:s.x,power:null===(o=n.power)||void 0===o?void 0:o.x,rule:null===(e=n.rule)||void 0===e?void 0:e.x,orientation:null===(r=n.orientation)||void 0===r?void 0:r.x}),y:new _t(t,i,{proportion:null===(h=n.proportion)||void 0===h?void 0:h.y,power:null===(l=n.power)||void 0===l?void 0:l.y,rule:null===(u=n.rule)||void 0===u?void 0:u.y,orientation:null===(a=n.orientation)||void 0===a?void 0:a.y})}}}class qt extends et{constructor(t,i){var n;super(t.layer,new Set([t])),this.element=t,this.parameters={aspect:null!==(n=null==i?void 0:i.aspect)&&void 0!==n?n:this.element.width/this.element.height,power:ht(null==i?void 0:i.power),rule:at(null==i?void 0:i.rule),orientation:ot(null==i?void 0:i.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[Y](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.element[B]).plus(new E(this.element[H]).multiply(-this.parameters.aspect));this.constraint=new P(t,dt(this.parameters.rule),0,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Wt extends et{constructor(t,i,n){var s,o,e;Ht(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={isStrict:null!==(s=null==n?void 0:n.isStrict)&&void 0!==s?s:1,horizontalAnchor:null!==(o=null==n?void 0:n.horizontalAnchor)&&void 0!==o?o:.5,verticalAnchor:null!==(e=null==n?void 0:n.verticalAnchor)&&void 0!==e?e:.5,orientation:ot(null==n?void 0:n.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[Y](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){this.constraintX=new P(new E(this.elementOne[U]).plus(new E(this.elementOne[B]).multiply(this.parameters.horizontalAnchor)),O.Eq,new E(this.elementTwo[U]).plus(new E(this.elementTwo[B]).multiply(this.parameters.horizontalAnchor))),this.constraintY=new P(new E(this.elementOne[j]).plus(new E(this.elementOne[H]).multiply(this.parameters.verticalAnchor)),O.Eq,new E(this.elementTwo[j]).plus(new E(this.elementTwo[H]).multiply(this.parameters.verticalAnchor))),this.constraintW=new P(new E(this.elementOne[B]),O.Le,new E(this.elementTwo[B])),this.constraintH=new P(new E(this.elementOne[H]),O.Le,new E(this.elementTwo[H])),this.layer[_](this,this.constraintX),this.layer[_](this,this.constraintY),this.layer[_](this,this.constraintW),this.layer[_](this,this.constraintH),this.parameters.isStrict||(this.constraintStrict=new P(new E(this.elementOne[H]),O.Eq,new E(this.elementTwo[H]),T.strong),this.layer[_](this,this.constraintStrict))}destroyConstraints(){this.constraintX&&(this.layer[N](this,this.constraintX),this.constraintX=void 0),this.constraintY&&(this.layer[N](this,this.constraintY),this.constraintY=void 0),this.constraintW&&(this.layer[N](this,this.constraintW),this.constraintW=void 0),this.constraintH&&(this.layer[N](this,this.constraintH),this.constraintH=void 0),this.constraintStrict&&(this.layer[N](this,this.constraintStrict),this.constraintStrict=void 0)}}function Yt(t){return null!==t&&"object"==typeof t&&("x"in t&&"number"==typeof t.x||"y"in t&&"number"==typeof t.y)}function Gt(t){return null!==t&&"object"==typeof t&&("x"in t&&rt(t.x)||"y"in t&&rt(t.y))}function Qt(t){return null!==t&&"object"==typeof t&&("x"in t&&ut(t.x)||"y"in t&&ut(t.y))}function Jt(t){return null!==t&&"object"==typeof t&&"elementOne"in t&&"elementTwo"in t&&(t.elementOne instanceof Ut||t.elementOne instanceof Bt)&&t.elementTwo instanceof Ut}function Zt(t){return Jt(t)&&"distance"in t&&Yt(t.distance)&&(!("anchorOne"in t)||"anchorOne"in t&&Yt(t.anchorOne))&&(!("anchorTwo"in t)||"anchorTwo"in t&&Yt(t.anchorTwo))&&(!("power"in t)||Gt(t.power))&&(!("rule"in t)||Qt(t.rule))&&(!("orientation"in t)||st(t.orientation))}function ti(t){return Jt(t)&&"proportion"in t&&Yt(t.proportion)&&(!("power"in t)||Gt(t.power))&&(!("rule"in t)||Qt(t.rule))&&(!("orientation"in t)||st(t.orientation))}function ii(t){return Jt(t)&&"isStrict"in t&&"boolean"==typeof t.isStrict&&(!("anchor"in t)||"anchor"in t&&Yt(t.anchor))}function ni(t){return null!==t&&"object"==typeof t&&"element"in t&&t.element instanceof Ut&&(!("power"in t)||rt(t.power))&&(!("rule"in t)||ut(t.rule))}function si(t){return ni(t)&&"height"in t&&"number"==typeof t.height}function oi(t){return ni(t)&&"keepAspect"in t&&"boolean"==typeof t.keepAspect}function ei(t){return ni(t)&&"keepSize"in t&&"boolean"==typeof t.keepSize}class ri{static fromDescription(t){const i=t instanceof Map?t.entries():Object.entries(t),n=new Map;for(const[t,o]of i){if(n.has(t))throw Error(`Duplicate constraint key "${t}" - each constraint must have a unique identifier`);if(ni(s=o)&&"width"in s&&"number"==typeof s.width)ri.buildWidthConstraint(t,o,n);else if(si(o))ri.buildHeightConstraint(t,o,n);else if(oi(o))ri.buildKeepAspectConstraint(t,o,n);else if(ei(o))ri.buildKeepSizeConstraint(t,o,n);else if(Zt(o))ri.buildDistanceConstraint(t,o,n);else if(ti(o))ri.buildProportionalConstraint(t,o,n);else{if(!ii(o))throw Error(`Invalid constraint type for "${t}". Expected one of: Width, Height, KeepAspect, KeepSize, Distance, Proportional, or Cover constraint`);ri.buildCoverConstraint(t,o,n)}}var s;return Object.fromEntries(n)}static buildWidthConstraint(t,i,n){n.set(t,new Nt(i.element,{width:i.width,power:i.power,rule:i.rule,orientation:i.orientation}))}static buildHeightConstraint(t,i,n){n.set(t,new ct(i.element,{height:i.height,power:i.power,rule:i.rule,orientation:i.orientation}))}static buildKeepAspectConstraint(t,i,n){n.set(t,new qt(i.element,{power:i.power,rule:i.rule,orientation:i.orientation}))}static buildKeepSizeConstraint(t,i,n){const s=t.replace(/(KeepSize|Keep)$/,"")+"KeepWidth",o=t.replace(/(KeepSize|Keep)$/,"")+"KeepHeight";n.set(s,new Nt(i.element,{power:i.power,rule:i.rule,orientation:i.orientation})),n.set(o,new ct(i.element,{power:i.power,rule:i.rule,orientation:i.orientation}))}static buildDistanceConstraint(t,i,n){var s,o,e,r,h,l,u,a;if("number"==typeof i.distance.x){const h=t.replace(/(HorizontalDistance|Distance)$/,"")+"HorizontalDistance";n.set(h,new Lt(i.elementOne,i.elementTwo,{distance:i.distance.x,anchorOne:null===(s=i.anchorOne)||void 0===s?void 0:s.x,anchorTwo:null===(o=i.anchorTwo)||void 0===o?void 0:o.x,power:null===(e=i.power)||void 0===e?void 0:e.x,rule:null===(r=i.rule)||void 0===r?void 0:r.x,orientation:i.orientation}))}if("number"==typeof i.distance.y){const s=t.replace(/(VerticalDistance|Distance)$/,"")+"VerticalDistance";n.set(s,new Kt(i.elementOne,i.elementTwo,{distance:i.distance.y,anchorOne:null===(h=i.anchorOne)||void 0===h?void 0:h.y,anchorTwo:null===(l=i.anchorTwo)||void 0===l?void 0:l.y,power:null===(u=i.power)||void 0===u?void 0:u.y,rule:null===(a=i.rule)||void 0===a?void 0:a.y,orientation:i.orientation}))}}static buildProportionalConstraint(t,i,n){var s,o,e,r;if("number"==typeof i.proportion.x){const e=t.replace(/(HorizontalProportional|HorizontalProportion|Proportional|Proportion)$/,"")+"HorizontalProportion";n.set(e,new Rt(i.elementOne,i.elementTwo,{proportion:i.proportion.x,power:null===(s=i.power)||void 0===s?void 0:s.x,rule:null===(o=i.rule)||void 0===o?void 0:o.x,orientation:i.orientation}))}if("number"==typeof i.proportion.y){const s=t.replace(/(VerticalProportional|VerticalProportion|Proportional|Proportion)$/,"")+"VerticalProportion";n.set(s,new _t(i.elementOne,i.elementTwo,{proportion:i.proportion.y,power:null===(e=i.power)||void 0===e?void 0:e.y,rule:null===(r=i.rule)||void 0===r?void 0:r.y,orientation:i.orientation}))}}static buildCoverConstraint(t,i,n){var s,o;n.set(t,new Wt(i.elementOne,i.elementTwo,{isStrict:i.isStrict,horizontalAnchor:null===(s=i.anchor)||void 0===s?void 0:s.x,verticalAnchor:null===(o=i.anchor)||void 0===o?void 0:o.y}))}}var hi;(t=>{t[t.FROM_LEFT_TOP=0]="FROM_LEFT_TOP",t[t.FROM_LEFT_BOTTOM=1]="FROM_LEFT_BOTTOM"})(hi||(hi={}));class li{static build(t,i,n,s={}){var o;const e=null!==(o=s.direction)&&void 0!==o?o:hi.FROM_LEFT_TOP,r=[],h=[];r.push(new Lt(t,i,{anchorOne:0,anchorTwo:0,distance:0,power:s.power,orientation:s.orientation}),new Lt(t,n,{anchorOne:1,anchorTwo:1,distance:0,power:s.power,orientation:s.orientation}));const l=e===hi.FROM_LEFT_TOP?1:0,u=e===hi.FROM_LEFT_TOP?0:1;return h.push(new Kt(t,i,{anchorOne:l,anchorTwo:l,distance:0,power:s.power,orientation:s.orientation}),new Kt(t,n,{anchorOne:u,anchorTwo:u,distance:0,power:s.power,orientation:s.orientation})),{horizontalDistances:r,verticalDistances:h}}}class ui{static buildHorizontal(t,i){return this.buildStack(t,i,{distanceConstraint:Lt,proportionConstraint:Rt,centerDistanceConstraint:Kt})}static buildVertical(t,i){return this.buildStack(t,i,{distanceConstraint:Kt,proportionConstraint:_t,centerDistanceConstraint:Lt})}static buildStack(t,i,n){const s=[],o=[],e=[];for(let r=0;r<t.length-1;r++){const h=t[r],l=t[r+1];s.push(new n.distanceConstraint(h,l,{anchorOne:1,anchorTwo:0,distance:i.distance,power:i.power,orientation:i.orientation})),0!=i.keepProportions&&o.push(new n.proportionConstraint(h,l,{power:i.power,orientation:i.orientation})),0!=i.keepAlignment&&e.push(new n.centerDistanceConstraint(h,l,{power:i.power,anchorOne:0,anchorTwo:0,orientation:i.orientation}))}return{distanceConstraints:s,proportionConstraints:o,alignmentConstraints:e}}}class ai extends Ut{constructor(t,i=1e3,n=1e3){super(t,new f,0,0,i,n),this.flushTransform()}[J](){this.flushTransform()}}class di extends Ut{constructor(t,i){var n,s;const o=null===(n=i.image)||void 0===n?void 0:n.width,e=null===(s=i.image)||void 0===s?void 0:s.height;Vt(o,e,`Invalid image dimensions - texture "${i.name||"unnamed"}" has invalid width (${o}) or height (${e}). Image dimensions must be non-zero positive numbers.`);const r=new bt(i);super(t,new h(Ct,r),0,0,o,e),this.material=r,this.textureInternal=i,this.flushTransform()}get texture(){return this.textureInternal}get color(){return this.material.getColor()}get opacity(){return this.material.getOpacity()}set color(t){this.material.setColor(t),this.composer.requestUpdate()}set opacity(t){this.material.setOpacity(t),this.composer.requestUpdate()}destroy(){this.material.dispose(),super.destroy()}[J](t){this.object.material=this.composer.compose(t,this.textureInternal.image.width,this.textureInternal.image.height,this.material),this.flushTransform()}}class ci extends s{constructor(t,i){super({uniforms:w.merge([{background:{value:i},foreground:{value:t},progress:{value:1},backgroundColor:{value:new o(1,1,1)},foregroundColor:{value:new o(1,1,1)},color:{value:new o(1,1,1)},backgroundOpacity:{value:1},foregroundOpacity:{value:1},opacity:{value:1},angle:{value:0},direction:{value:1}}]),vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D background;\n uniform sampler2D foreground;\n uniform float progress;\n uniform vec3 backgroundColor;\n uniform vec3 foregroundColor;\n uniform vec3 color;\n uniform float backgroundOpacity;\n uniform float foregroundOpacity;\n uniform float opacity;\n uniform float angle;\n uniform float direction;\n varying vec2 vUv;\n\n void main() {\n vec4 backgroundTexture = texture2D(background, vUv);\n vec4 foregroundTexture = texture2D(foreground, vUv);\n\n // Apply common color and opacity\n vec3 finalBackgroundColor = backgroundTexture.rgb * backgroundColor * color;\n vec3 finalForegroundColor = foregroundTexture.rgb * foregroundColor * color;\n float finalBackgroundOpacity = backgroundTexture.a * backgroundOpacity * opacity;\n float finalForegroundOpacity = foregroundTexture.a * foregroundOpacity * opacity;\n\n vec4 backgroundColor = vec4(finalBackgroundColor, finalBackgroundOpacity);\n vec4 foregroundColor = vec4(finalForegroundColor, finalForegroundOpacity);\n\n // Calculate progress threshold with angle and direction\n float adjustedX = mix(vUv.x, 1.0 - vUv.x, step(0.0, -direction));\n float tanAngle = tan(angle);\n float threshold = adjustedX - (vUv.y - 0.5) * tanAngle * sign(direction);\n float progressMask = smoothstep(threshold - 0.01, threshold + 0.01, progress);\n\n gl_FragColor = mix(backgroundColor, foregroundColor, progressMask);\n #include <colorspace_fragment>\n }\n ",transparent:1,lights:0,fog:0})}getProgress(){return this.uniforms.progress.value}getBackgroundTexture(){return this.uniforms.background.value}getForegroundTexture(){return this.uniforms.foreground.value}getBackgroundColor(){return this.uniforms.color.value.getHex()}getForegroundColor(){return this.uniforms.color.value.getHex()}getColor(){return this.uniforms.color.value.getHex()}getBackgroundOpacity(){return this.uniforms.backgroundOpacity.value}getForegroundOpacity(){return this.uniforms.foregroundOpacity.value}getOpacity(){return this.uniforms.opacity.value}getAngle(){return this.uniforms.angle.value}getIsForwardDirection(){return 1===this.uniforms.direction.value}setProgress(t){this.uniforms.progress.value=t,this.uniformsNeedUpdate=1}setBackgroundTexture(t){this.uniforms.background.value=t,this.uniformsNeedUpdate=1}setForegroundTexture(t){this.uniforms.foreground.value=t,this.uniformsNeedUpdate=1}setBackgroundColor(t){this.uniforms.color.value.setHex(t),this.uniformsNeedUpdate=1}setForegroundColor(t){this.uniforms.color.value.setHex(t),this.uniformsNeedUpdate=1}setColor(t){this.uniforms.color.value.setHex(t),this.uniformsNeedUpdate=1}setBackgroundOpacity(t){this.uniforms.backgroundOpacity.value=t,this.uniformsNeedUpdate=1}setForegroundOpacity(t){this.uniforms.foregroundOpacity.value=t,this.uniformsNeedUpdate=1}setOpacity(t){this.uniforms.opacity.value=t,this.uniformsNeedUpdate=1}setAngle(t){this.uniforms.angle.value=t,this.uniformsNeedUpdate=1}setIsForwardDirection(t){this.uniforms.direction.value=t?1:-1,this.uniformsNeedUpdate=1}}class vi extends Ut{constructor(t,i,s,o={}){var e,r,l,u;const a=null===(e=i.image)||void 0===e?void 0:e.width,d=null===(r=i.image)||void 0===r?void 0:r.height;Vt(a,d,`Invalid image dimensions - texture "${i.name||"unnamed"}" has invalid width (${a}) or height (${d}). Image dimensions must be non-zero positive numbers.`);const c=null===(l=null==s?void 0:s.image)||void 0===l?void 0:l.width,v=null===(u=null==s?void 0:s.image)||void 0===u?void 0:u.height;s&&Vt(c,v,`Invalid image dimensions - texture "${s.name||"unnamed"}" has invalid width (${c}) or height (${v}). Image dimensions must be non-zero positive numbers.`);const f=new ci(i,s),w=new h(Ct,f);o.progress&&f.setProgress(o.progress),o.isForegroundDirection&&f.setIsForwardDirection(o.isForegroundDirection),o.angle&&f.setAngle(n.degToRad(o.angle)),o.color&&f.setColor(o.color),o.opacity&&f.setOpacity(o.opacity),o.backgroundColor&&f.setBackgroundColor(o.backgroundColor),o.foregroundColor&&f.setForegroundColor(o.foregroundColor),o.backgroundOpacity&&f.setBackgroundOpacity(o.backgroundOpacity),o.foregroundOpacity&&f.setForegroundOpacity(o.foregroundOpacity);const p=null!=c?c:a,g=null!=d?d:v;super(t,w,0,0,p,g),this.material=f,this.imageWidth=p,this.imageHeight=g,this.flushTransform()}get progress(){return this.material.getProgress()}get backgroundTexture(){return this.material.getBackgroundTexture()}get foregroundTexture(){return this.material.getForegroundTexture()}get backgroundColor(){return this.material.getBackgroundColor()}get foregroundColor(){return this.material.getForegroundColor()}get color(){return this.material.getColor()}get backgroundOpacity(){return this.material.getBackgroundOpacity()}get foregroundOpacity(){return this.material.getForegroundOpacity()}get opacity(){return this.material.getOpacity()}get angle(){return n.radToDeg(this.material.getAngle())}get isForwardDirection(){return this.material.getIsForwardDirection()}set progress(t){this.material.setProgress(t),this.composer.requestUpdate()}set backgroundColor(t){this.material.setBackgroundColor(t),this.composer.requestUpdate()}set foregroundColor(t){this.material.setForegroundColor(t),this.composer.requestUpdate()}set color(t){this.material.setColor(t),this.composer.requestUpdate()}set backgroundOpacity(t){this.material.setBackgroundOpacity(t),this.composer.requestUpdate()}set foregroundOpacity(t){this.material.setForegroundOpacity(t),this.composer.requestUpdate()}set opacity(t){this.material.setOpacity(t),this.composer.requestUpdate()}set angle(t){this.material.setAngle(n.degToRad(t)),this.composer.requestUpdate()}set isForwardDirection(t){this.material.setIsForwardDirection(t),this.composer.requestUpdate()}destroy(){this.material.dispose(),super.destroy()}[J](t){this.object.material=this.composer.compose(t,this.imageWidth,this.imageHeight,this.material),this.flushTransform()}}function fi(t,i){var n,s,o,e,r,h,l,u,a,d,c,v,f,w,p,g,m,y,b,C,x,S,E,k,O,T,M,P;const D=Math.max(null!==(s=null!==(n=null==t?void 0:t.fontSize)&&void 0!==n?n:null==i?void 0:i.fontSize)&&void 0!==s?s:16,1),I=null!==(e=null!==(o=null==t?void 0:t.lineHeight)&&void 0!==o?o:null==i?void 0:i.lineHeight)&&void 0!==e?e:1.2*D,$=Math.max(null!==(h=null!==(r=null==t?void 0:t.shadowBlur)&&void 0!==r?r:null==i?void 0:i.shadowBlur)&&void 0!==h?h:0,0),z=Math.max(null!==(u=null!==(l=null==t?void 0:t.strokeWidth)&&void 0!==l?l:null==i?void 0:i.strokeWidth)&&void 0!==u?u:0,0);return{color:null!==(d=null!==(a=null==t?void 0:t.color)&&void 0!==a?a:null==i?void 0:i.color)&&void 0!==d?d:"#000000",fontFamily:null!==(v=null!==(c=null==t?void 0:t.fontFamily)&&void 0!==c?c:null==i?void 0:i.fontFamily)&&void 0!==v?v:"Arial",fontSize:D,fontStyle:null!==(w=null!==(f=null==t?void 0:t.fontStyle)&&void 0!==f?f:null==i?void 0:i.fontStyle)&&void 0!==w?w:"normal",fontWeight:null!==(g=null!==(p=null==t?void 0:t.fontWeight)&&void 0!==p?p:null==i?void 0:i.fontWeight)&&void 0!==g?g:"normal",lineHeight:I,enableShadow:null!==(y=null!==(m=null==t?void 0:t.enableShadow)&&void 0!==m?m:null==i?void 0:i.enableShadow)&&void 0!==y?y:0,shadowOffsetX:null!==(C=null!==(b=null==t?void 0:t.shadowOffsetX)&&void 0!==b?b:null==i?void 0:i.shadowOffsetX)&&void 0!==C?C:0,shadowOffsetY:null!==(S=null!==(x=null==t?void 0:t.shadowOffsetY)&&void 0!==x?x:null==i?void 0:i.shadowOffsetY)&&void 0!==S?S:0,shadowBlur:$,shadowColor:null!==(k=null!==(E=null==t?void 0:t.shadowColor)&&void 0!==E?E:null==i?void 0:i.shadowColor)&&void 0!==k?k:"transparent",enableStroke:null!==(T=null!==(O=null==t?void 0:t.enableStroke)&&void 0!==O?O:null==i?void 0:i.enableStroke)&&void 0!==T?T:0,strokeColor:null!==(P=null!==(M=null==t?void 0:t.strokeColor)&&void 0!==M?M:null==i?void 0:i.strokeColor)&&void 0!==P?P:"transparent",strokeWidth:z}}function wi(t){return t.match(/\S+|\s|\n/g)||[]}function pi(t,i,n){if(t.font=`${n.fontStyle} ${n.fontWeight} ${n.fontSize}px ${n.fontFamily}`,"\n"===i)return{width:0,height:n.lineHeight,baseline:0,lineHeight:n.lineHeight};const s=t.measureText(i),o=s.width,e=Math.ceil(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent);return{width:Math.ceil(o),height:e,baseline:s.actualBoundingBoxDescent,lineHeight:n.lineHeight}}function gi(t,i,n,s,o){o.font=`${s.fontStyle} ${s.fontWeight} ${s.fontSize}px ${s.fontFamily}`,s.enableShadow&&(o.shadowOffsetX=s.shadowOffsetX,o.shadowOffsetY=s.shadowOffsetY,o.shadowBlur=s.shadowBlur,o.shadowColor=s.shadowColor),s.enableStroke&&(o.strokeStyle=s.strokeColor,o.lineWidth=s.strokeWidth,o.strokeText(n,t,i)),o.fillStyle=s.color,o.fillText(n,t,i)}class mi extends Ut{constructor(t,i,n={}){var s;const o=document.createElement("canvas"),e=o.getContext("2d");if(!e)throw Error("Failed to create canvas context");const r=[],l=Array.isArray(i)?i:[i];for(const t of l){const i="string"==typeof t,s=i?t:t.text,o=fi(i?void 0:t.style,n.defaultStyle);for(const t of wi(s)){const i=pi(e,t,o);r.push({text:t,style:o,metrics:i})}}const u=((t,i)=>{const n=[];let s=[],o=0,e=0,r=0,h=0;for(const l of i)"\n"!==l.text?o+l.metrics.width<=t||0===s.length?(s.push(l),o+=l.metrics.width,e=Math.max(e,l.metrics.height),r=Math.max(r,l.metrics.baseline),h=Math.max(h,l.metrics.lineHeight)):(n.push({chunks:s,width:o,height:e,baseline:r,lineHeight:h}),s=[l],o=l.metrics.width,e=l.metrics.height,r=l.metrics.baseline,h=l.metrics.lineHeight):(s.length>0&&n.push({chunks:s,width:o,height:e,baseline:r,lineHeight:h}),s=[],o=0,e=0,r=0,h=0);return s.length>0&&n.push({chunks:s,width:o,height:e,baseline:r,lineHeight:h}),n})(null!==(s=n.maxWidth)&&void 0!==s?s:1024,r),a=(t=>{if(0===t.length)return{width:0,height:0};const i=Math.max(...t.map((t=>t.width)));let n=0;for(let i=0;i<t.length;i++){const s=t[i];n+=0===i?s.height:s.lineHeight,i===t.length-1&&(n+=s.baseline)}return{width:i,height:n}})(u),d=(t=>{var i,n,s,o;return"number"==typeof t?{left:t,right:t,top:t,bottom:t}:{left:Math.max(null!==(i=null==t?void 0:t.left)&&void 0!==i?i:0,0),right:Math.max(null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0,0),top:Math.max(null!==(s=null==t?void 0:t.top)&&void 0!==s?s:0,0),bottom:Math.max(null!==(o=null==t?void 0:t.bottom)&&void 0!==o?o:0,0)}})(n.padding);o.width=a.width+d.left+d.right,o.height=a.height+d.top+d.bottom;const c=new p(o),v=new bt(c);super(t,new h(Ct,v),0,0,a.width,a.height),this.lastSuggestedAspect=0,this.material=v,this.texture=c,this.canvas=o,this.context=e,this.textBlockSize=a,this.padding=d,((t,i,n,s)=>{let o=this.padding.top;for(let t=0;t<n.length;t++){const e=n[t];let r=i;o+=0===t?e.height:e.lineHeight;for(const t of e.chunks)gi(r,o,t.text,t.style,s),r+=t.metrics.width}})(0,this.padding.left,u,this.context),this.texture.needsUpdate=1,this.flushTransform()}get color(){return this.material.getColor()}get opacity(){return this.material.getOpacity()}set color(t){this.material.setColor(t),this.composer.requestUpdate()}set opacity(t){this.material.setOpacity(t),this.composer.requestUpdate()}destroy(){this.material.dispose(),this.texture.dispose(),this.canvas.remove(),super.destroy()}flushTransform(){super.flushTransform();const t=this.width/this.height;this.lastSuggestedAspect!==t&&(this.lastSuggestedAspect=t,this.layer[W](this,this[H],this.width/((this.textBlockSize.width+this.padding.left+this.padding.right)/(this.textBlockSize.height+this.padding.top+this.padding.bottom))))}[J](t){this.object.material=this.composer.compose(t,this.texture.image.width,this.texture.image.height,this.material),this.flushTransform()}}function yi(t){return null!==t&&"object"==typeof t&&"background"in t&&t.background instanceof g&&"foreground"in t&&t.foreground instanceof g}function bi(t){return null!==t&&"object"==typeof t&&"text"in t&&"string"==typeof t.text}function Ci(t){return null!==t&&"object"==typeof t&&"spans"in t&&Array.isArray(t.spans)&&t.spans.every((t=>"string"==typeof t||(t=>null!==t&&"object"==typeof t&&"text"in t&&"string"==typeof t.text)(t)))}function xi(t){return!(null===t||"object"!=typeof t||"width"in t&&"number"!=typeof t.width||"height"in t&&"number"!=typeof t.height)}class Si{static fromDescription(t,i){const n=i instanceof Map?i.entries():Object.entries(i),s=new Map;for(const[i,e]of n){if(s.has(i))throw Error(`Duplicate element key "${i}" - each UI element must have a unique identifier`);let n;if(e instanceof g)n=new di(t,e);else if(null!==(o=e)&&"object"==typeof o&&"texture"in o&&o.texture instanceof g)n=new di(t,e.texture);else if("string"==typeof e)n=new mi(t,[e]);else if(yi(e))n=new vi(t,e.background,e.foreground);else if(bi(e))n=new mi(t,[e.text],{defaultStyle:e.style});else if(Ci(e))n=new mi(t,e.spans,{defaultStyle:e.defaultStyle});else{if(!xi(e))throw Error(`Invalid UI element type for "${i}". Expected one of: Texture, UIImage, String, UITextDescription, or UITextEnhancedDescription`);n=new ai(t,e.width,e.height)}s.set(i,n)}var o;return Object.fromEntries(s)}}class Ei extends et{constructor(t,i,n){var s,o,e;super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,Ht(t,i),this.parameters={isStrict:null!==(s=null==n?void 0:n.isStrict)&&void 0!==s?s:1,horizontalAnchor:null!==(o=null==n?void 0:n.horizontalAnchor)&&void 0!==o?o:.5,verticalAnchor:null!==(e=null==n?void 0:n.verticalAnchor)&&void 0!==e?e:.5,orientation:ot(null==n?void 0:n.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[Y](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){this.constraintX=new P(new E(this.elementOne[U]).plus(new E(this.elementOne[B]).multiply(this.parameters.horizontalAnchor)),O.Eq,new E(this.elementTwo[U]).plus(new E(this.elementTwo[B]).multiply(this.parameters.horizontalAnchor))),this.constraintY=new P(new E(this.elementOne[j]).plus(new E(this.elementOne[H]).multiply(this.parameters.verticalAnchor)),O.Eq,new E(this.elementTwo[j]).plus(new E(this.elementTwo[H]).multiply(this.parameters.verticalAnchor))),this.constraintW=new P(new E(this.elementOne[B]),O.Ge,new E(this.elementTwo[B])),this.constraintH=new P(new E(this.elementOne[H]),O.Ge,new E(this.elementTwo[H])),this.layer[_](this,this.constraintX),this.layer[_](this,this.constraintY),this.layer[_](this,this.constraintW),this.layer[_](this,this.constraintH),0!=this.parameters.isStrict&&(this.constraintStrict=new P(new E(this.elementOne[H]),O.Eq,new E(this.elementTwo[H]),T.strong),this.layer[_](this,this.constraintStrict))}destroyConstraints(){this.constraintX&&(this.layer[N](this,this.constraintX),this.constraintX=void 0),this.constraintY&&(this.layer[N](this,this.constraintY),this.constraintY=void 0),this.constraintW&&(this.layer[N](this,this.constraintW),this.constraintW=void 0),this.constraintH&&(this.layer[N](this,this.constraintH),this.constraintH=void 0),this.constraintStrict&&(this.layer[N](this,this.constraintStrict),this.constraintStrict=void 0)}}const ki=512;class Oi extends Ut{constructor(t,i={}){var n,s,o,e,l;const{resolution:v=ki}=i,f="number"==typeof v?v:v.x,w="number"==typeof v?v:v.y;Vt(f,w,`Invalid resolution dimensions: width (${f}) and height (${w}) must both be greater than 0.`);const p=new u(f,w,{format:c,minFilter:d,magFilter:d,type:a,depthBuffer:1,stencilBuffer:0}),g=new bt(p.texture);super(t,new h(Ct,g),0,0,f,w),this.needsRenderInternal=0,this.clearColorInternal=null!==(n=i.clearColor)&&void 0!==n?n:0,this.clearAlphaInternal=null!==(s=i.clearAlpha)&&void 0!==s?s:0,this.autoUpdateInternal=null!==(o=i.autoUpdate)&&void 0!==o?o:0,this.sceneInternal=null!==(e=i.scene)&&void 0!==e?e:new r,this.cameraInternal=null!==(l=i.camera)&&void 0!==l?l:new m(75,f/w,.1,100),i.renderedByDefault&&(this.needsRenderInternal=1),this.resolutionX=f,this.resolutionY=w,this.renderTarget=p,this.material=g,this.flushTransform()}get needsRender(){return this.needsRenderInternal}get color(){return this.material.getColor()}get opacity(){return this.material.getOpacity()}get scene(){return this.sceneInternal}get camera(){return this.cameraInternal}get clearColor(){return this.clearColorInternal}get clearAlpha(){return this.clearAlphaInternal}get autoUpdate(){return this.autoUpdateInternal}get resolution(){return new t(this.resolutionX,this.resolutionY)}set color(t){this.material.setColor(t),this.composer.requestUpdate()}set opacity(t){this.material.setOpacity(t),this.composer.requestUpdate()}set scene(t){this.sceneInternal=t}set camera(t){this.cameraInternal=t}set clearColor(t){this.clearColorInternal=t}set clearAlpha(t){this.clearAlphaInternal=t}set autoUpdate(t){this.autoUpdateInternal=t}set resolution(t){const i="number"==typeof t?t:t.x,n="number"==typeof t?t:t.y;this.renderTarget.width===i&&this.renderTarget.height===n||(this.resolutionX=i,this.resolutionY=n,this.renderTarget.setSize(i,n))}destroy(){this.material.dispose(),this.renderTarget.dispose(),super.destroy()}requestRender(){this.needsRenderInternal=1,this.composer.requestUpdate()}[J](t){(this.needsRenderInternal||this.autoUpdateInternal)&&(this.needsRenderInternal=0,t.setClearColor(this.clearColorInternal,this.clearAlpha),t.setRenderTarget(this.renderTarget),t.clear(1,1,0),t.render(this.sceneInternal,this.cameraInternal)),this.object.material=this.composer.compose(t,this.resolutionX,this.resolutionY,this.material),this.flushTransform()}}class Ti extends Bt{constructor(){super(),this.targetScreenHeight=1920,this.onResize=()=>{const t=this.calculateScale();this.resizeInternal(window.innerWidth*t,window.innerHeight*t)},this.onClick=t=>{if(this.behavior!==pt.INTERACTIVE)return;const i=t.target instanceof HTMLElement?t.target.getBoundingClientRect():null,n=i?t.clientX-i.left:t.clientX,s=i?i.bottom-t.clientY:window.innerHeight-t.clientY,o=this.calculateScale();this.clickInternal(n*o,s*o)},window.addEventListener("resize",this.onResize),window.addEventListener("pointerdown",this.onClick),this.onResize()}get tergetScreenHeight(){return this.targetScreenHeight}set tergetScreenHeight(t){this.targetScreenHeight=t,this.resizeInternal(window.innerWidth,window.innerHeight)}destroy(){window.removeEventListener("resize",this.onResize),window.removeEventListener("pointerdown",this.onClick),super.destroy()}calculateScale(){var t;return(null!==(t=this.tergetScreenHeight)&&void 0!==t?t:window.innerHeight)/window.innerHeight}}class Mi extends Bt{click(t,i){this.clickInternal(t,i)}resize(t,i){this.resizeInternal(t,i)}}class Pi{}export{qt as UIAspectConstraint,pt as UIBehavior,Xt as UIConstraint2DBuilder,ri as UIConstraintBuilder,li as UIConstraintContainerBuilder,hi as UIConstraintContainerDirection,it as UIConstraintPower,nt as UIConstraintRule,ui as UIConstraintStackBuilder,Wt as UICoverConstraint,ai as UIDummy,Si as UIElementBuilder,It as UIElementEvent,Ei as UIFitConstraint,Ti as UIFullScreenLayer,Et as UIFullScreenQuad,ct as UIHeightConstraint,Lt as UIHorizontalDistanceConstraint,Rt as UIHorizontalProportionConstraint,di as UIImage,Mi as UIManualLayer,tt as UIOrientation,Pi as UIPass,vi as UIProgress,Oi as UIScene,mi as UIText,Kt as UIVerticalDistanceConstraint,_t as UIVerticalProportionConstraint,Nt as UIWidthConstraint};
1
+ import{Vector2 as t,Box2 as i,MathUtils as s,ShaderMaterial as n,Color as o,PlaneGeometry as r,Scene as e,Mesh as h,OrthographicCamera as l,WebGLRenderTarget as u,UnsignedByteType as a,LinearFilter as d,RGBAFormat as c,NoBlending as v,Object3D as f,UniformsUtils as w,CanvasTexture as p,Texture as g,PerspectiveCamera as m}from"three";function y(){return new b}var b=function(){function t(){this.index={},this.array=[]}return t.prototype.size=function(){return this.array.length},t.prototype.empty=function(){return 0===this.array.length},t.prototype.itemAt=function(t){return this.array[t]},t.prototype.contains=function(t){return void 0!==this.index[t.id()]},t.prototype.find=function(t){var i=this.index[t.id()];return void 0===i?void 0:this.array[i]},t.prototype.setDefault=function(t,i){var s=this.index[t.id()];if(void 0===s){var n=new x(t,i());return this.index[t.id()]=this.array.length,this.array.push(n),n}return this.array[s]},t.prototype.insert=function(t,i){var s=new x(t,i),n=this.index[t.id()];return void 0===n?(this.index[t.id()]=this.array.length,this.array.push(s)):this.array[n]=s,s},t.prototype.erase=function(t){var i=this.index[t.id()];if(void 0!==i){this.index[t.id()]=void 0;var s=this.array[i],n=this.array.pop();return s!==n&&(this.array[i]=n,this.index[n.first.id()]=i),s}},t.prototype.copy=function(){for(var i=new t,s=0;s<this.array.length;s++){var n=this.array[s].copy();i.array[s]=n,i.index[n.first.id()]=s}return i},t}(),x=function(){function t(t,i){this.first=t,this.second=i}return t.prototype.copy=function(){return new t(this.first,this.second)},t}(),C=function(){function t(t){void 0===t&&(t=""),this.t=0,this.i=null,this.o=S++,this.h=t}return t.prototype.id=function(){return this.o},t.prototype.name=function(){return this.h},t.prototype.setName=function(t){this.h=t},t.prototype.context=function(){return this.i},t.prototype.setContext=function(t){this.i=t},t.prototype.value=function(){return this.t},t.prototype.setValue=function(t){this.t=t},t.prototype.plus=function(t){return new E(this,t)},t.prototype.minus=function(t){return new E(this,"number"==typeof t?-t:[-1,t])},t.prototype.multiply=function(t){return new E([t,this])},t.prototype.divide=function(t){return new E([1/t,this])},t.prototype.toJSON=function(){return{name:this.h,value:this.t}},t.prototype.toString=function(){return this.i+"["+this.h+":"+this.t+"]"},t}(),S=0,E=function(){function t(){var t=k(arguments);this.l=t.terms,this.u=t.constant}return t.prototype.terms=function(){return this.l},t.prototype.constant=function(){return this.u},t.prototype.value=function(){for(var t=this.u,i=0,s=this.l.size();i<s;i++){var n=this.l.itemAt(i);t+=n.first.value()*n.second}return t},t.prototype.plus=function(i){return new t(this,i)},t.prototype.minus=function(i){return new t(this,"number"==typeof i?-i:[-1,i])},t.prototype.multiply=function(i){return new t([i,this])},t.prototype.divide=function(i){return new t([1/i,this])},t.prototype.isConstant=function(){return 0==this.l.size()},t.prototype.toString=function(){var t=this.l.array.map((t=>t.second+"*"+t.first)).join(" + ");return this.isConstant()||0===this.u||(t+=" + "),t+this.u},t}();function k(t){for(var i=0,s=()=>0,n=y(),o=0,r=t.length;o<r;++o){var e=t[o];if("number"==typeof e)i+=e;else if(e instanceof C)n.setDefault(e,s).second+=1;else if(e instanceof E){i+=e.constant();for(var h=0,l=(c=e.terms()).size();h<l;h++){var u=c.itemAt(h);n.setDefault(u.first,s).second+=u.second}}else{if(!(e instanceof Array))throw Error("invalid Expression argument: "+e);if(2!==e.length)throw Error("array must have length 2");var a=e[0],d=e[1];if("number"!=typeof a)throw Error("array item 0 must be a number");if(d instanceof C)n.setDefault(d,s).second+=a;else{if(!(d instanceof E))throw Error("array item 1 must be a variable or expression");var c;for(i+=d.constant()*a,h=0,l=(c=d.terms()).size();h<l;h++)u=c.itemAt(h),n.setDefault(u.first,s).second+=u.second*a}}}return{terms:n,constant:i}}var O,T=(()=>{function t(){}return t.create=(t,i,s,n)=>{void 0===n&&(n=1);var o=0;return o+=1e6*Math.max(0,Math.min(1e3,t*n)),(o+=1e3*Math.max(0,Math.min(1e3,i*n)))+Math.max(0,Math.min(1e3,s*n))},t.clip=i=>Math.max(0,Math.min(t.required,i)),t.required=t.create(1e3,1e3,1e3),t.strong=t.create(1,0,0),t.medium=t.create(0,1,0),t.weak=t.create(0,0,1),t})();(t=>{t[t.Le=0]="Le",t[t.Ge=1]="Ge",t[t.Eq=2]="Eq"})(O||(O={}));var M,P=function(){function t(t,i,s,n){void 0===n&&(n=T.required),this.o=I++,this.v=i,this.p=T.clip(n),this.m=void 0===s&&t instanceof E?t:t.minus(s)}return t.prototype.id=function(){return this.o},t.prototype.expression=function(){return this.m},t.prototype.op=function(){return this.v},t.prototype.strength=function(){return this.p},t.prototype.toString=function(){return this.m+" "+["<=",">=","="][this.v]+" 0 ("+this.p+")"},t}(),I=0,$=function(){function t(){this.C=y(),this.S=y(),this.k=y(),this.O=y(),this.T=[],this.M=new F,this.P=null,this.I=0}return t.prototype.createConstraint=function(t,i,s,n){void 0===n&&(n=T.required);var o=new P(t,i,s,n);return this.addConstraint(o),o},t.prototype.addConstraint=function(t){if(void 0!==this.C.find(t))throw Error("duplicate constraint");var i=this.$(t),s=i.row,n=i.tag,o=this.A(s,n);if(o.type()===M.Invalid&&s.allDummies()){if(!A(s.constant()))throw Error("unsatisfiable constraint");o=n.marker}if(o.type()===M.Invalid){if(!this.D(s))throw Error("unsatisfiable constraint")}else s.solveFor(o),this.F(o,s),this.S.insert(o,s);this.C.insert(t,n),this.U(this.M)},t.prototype.removeConstraint=function(t){var i=this.C.erase(t);if(void 0===i)throw Error("unknown constraint");this.j(t,i.second);var s=i.second.marker,n=this.S.erase(s);if(void 0===n){var o=this.B(s);if(o.type()===M.Invalid)throw Error("failed to find leaving row");(n=this.S.erase(o)).second.solveForEx(o,s),this.F(s,n.second)}this.U(this.M)},t.prototype.hasConstraint=function(t){return this.C.contains(t)},t.prototype.addEditVariable=function(t,i){if(void 0!==this.O.find(t))throw Error("duplicate edit variable");if((i=T.clip(i))===T.required)throw Error("bad required strength");var s=new E(t),n=new P(s,O.Eq,void 0,i);this.addConstraint(n);var o=this.C.find(n).second;this.O.insert(t,{tag:o,constraint:n,constant:0})},t.prototype.removeEditVariable=function(t){var i=this.O.erase(t);if(void 0===i)throw Error("unknown edit variable");this.removeConstraint(i.second.constraint)},t.prototype.hasEditVariable=function(t){return this.O.contains(t)},t.prototype.suggestValue=function(t,i){var s=this.O.find(t);if(void 0===s)throw Error("unknown edit variable");var n=this.S,o=s.second,r=i-o.constant;o.constant=i;var e=o.tag.marker,h=n.find(e);if(void 0!==h)return h.second.add(-r)<0&&this.T.push(e),void this.H();var l=o.tag.other;if(void 0!==(h=n.find(l)))return h.second.add(r)<0&&this.T.push(l),void this.H();for(var u=0,a=n.size();u<a;++u){var d=n.itemAt(u),c=d.second,v=c.coefficientFor(e);0!==v&&c.add(r*v)<0&&d.first.type()!==M.External&&this.T.push(d.first)}this.H()},t.prototype.updateVariables=function(){for(var t=this.k,i=this.S,s=0,n=t.size();s<n;++s){var o=t.itemAt(s),r=i.find(o.second);o.first.setValue(void 0!==r?r.second.constant():0)}},t.prototype.V=function(t){var i=this;return this.k.setDefault(t,(()=>i.R(M.External))).second},t.prototype.$=function(t){for(var i=t.expression(),s=new F(i.constant()),n=i.terms(),o=0,r=n.size();o<r;++o){var e=n.itemAt(o);if(!A(e.second)){var h=this.V(e.first),l=this.S.find(h);void 0!==l?s.insertRow(l.second,e.second):s.insertSymbol(h,e.second)}}var u=this.M,a=t.strength(),d={marker:z,other:z};switch(t.op()){case O.Le:case O.Ge:var c=t.op()===O.Le?1:-1,v=this.R(M.Slack);if(d.marker=v,s.insertSymbol(v,c),a<T.required){var f=this.R(M.Error);d.other=f,s.insertSymbol(f,-c),u.insertSymbol(f,a)}break;case O.Eq:if(a<T.required){var w=this.R(M.Error),p=this.R(M.Error);d.marker=w,d.other=p,s.insertSymbol(w,-1),s.insertSymbol(p,1),u.insertSymbol(w,a),u.insertSymbol(p,a)}else{var g=this.R(M.Dummy);d.marker=g,s.insertSymbol(g)}}return s.constant()<0&&s.reverseSign(),{row:s,tag:d}},t.prototype.A=(t,i)=>{for(var s=t.cells(),n=0,o=s.size();n<o;++n){var r=s.itemAt(n);if(r.first.type()===M.External)return r.first}var e=i.marker.type();return(e===M.Slack||e===M.Error)&&t.coefficientFor(i.marker)<0?i.marker:((e=i.other.type())===M.Slack||e===M.Error)&&t.coefficientFor(i.other)<0?i.other:z},t.prototype.D=function(t){var i=this.R(M.Slack);this.S.insert(i,t.copy()),this.P=t.copy(),this.U(this.P);var s=A(this.P.constant());this.P=null;var n=this.S.erase(i);if(void 0!==n){var o=n.second;if(o.isConstant())return s;var r=this.L(o);if(r.type()===M.Invalid)return 0;o.solveForEx(i,r),this.F(r,o),this.S.insert(r,o)}for(var e=this.S,h=0,l=e.size();h<l;++h)e.itemAt(h).second.removeSymbol(i);return this.M.removeSymbol(i),s},t.prototype.F=function(t,i){for(var s=this.S,n=0,o=s.size();n<o;++n){var r=s.itemAt(n);r.second.substitute(t,i),r.second.constant()<0&&r.first.type()!==M.External&&this.T.push(r.first)}this.M.substitute(t,i),this.P&&this.P.substitute(t,i)},t.prototype.U=function(t){for(;;){var i=this.K(t);if(i.type()===M.Invalid)return;var s=this._(i);if(s.type()===M.Invalid)throw Error("the objective is unbounded");var n=this.S.erase(s).second;n.solveForEx(s,i),this.F(i,n),this.S.insert(i,n)}},t.prototype.H=function(){for(var t=this.S,i=this.T;0!==i.length;){var s=i.pop(),n=t.find(s);if(void 0!==n&&n.second.constant()<0){var o=this.N(n.second);if(o.type()===M.Invalid)throw Error("dual optimize failed");var r=n.second;t.erase(s),r.solveForEx(s,o),this.F(o,r),t.insert(o,r)}}},t.prototype.K=t=>{for(var i=t.cells(),s=0,n=i.size();s<n;++s){var o=i.itemAt(s),r=o.first;if(o.second<0&&r.type()!==M.Dummy)return r}return z},t.prototype.N=function(t){for(var i=Number.MAX_VALUE,s=z,n=t.cells(),o=0,r=n.size();o<r;++o){var e=n.itemAt(o),h=e.first,l=e.second;if(l>0&&h.type()!==M.Dummy){var u=this.M.coefficientFor(h)/l;u<i&&(i=u,s=h)}}return s},t.prototype._=function(t){for(var i=Number.MAX_VALUE,s=z,n=this.S,o=0,r=n.size();o<r;++o){var e=n.itemAt(o),h=e.first;if(h.type()!==M.External){var l=e.second,u=l.coefficientFor(t);if(u<0){var a=-l.constant()/u;a<i&&(i=a,s=h)}}}return s},t.prototype.B=function(t){for(var i=Number.MAX_VALUE,s=i,n=i,o=z,r=o,e=o,h=o,l=this.S,u=0,a=l.size();u<a;++u){var d=l.itemAt(u),c=d.second,v=c.coefficientFor(t);if(0!==v){var f=d.first;if(f.type()===M.External)h=f;else if(v<0)(w=-c.constant()/v)<s&&(s=w,r=f);else{var w;(w=c.constant()/v)<n&&(n=w,e=f)}}}return r!==o?r:e!==o?e:h},t.prototype.j=function(t,i){i.marker.type()===M.Error&&this.X(i.marker,t.strength()),i.other.type()===M.Error&&this.X(i.other,t.strength())},t.prototype.X=function(t,i){var s=this.S.find(t);void 0!==s?this.M.insertRow(s.second,-i):this.M.insertSymbol(t,-i)},t.prototype.L=t=>{for(var i=t.cells(),s=0,n=i.size();s<n;++s){var o=i.itemAt(s),r=o.first.type();if(r===M.Slack||r===M.Error)return o.first}return z},t.prototype.R=function(t){return new D(t,this.I++)},t}();function A(t){return t<0?-t<1e-8:t<1e-8}(t=>{t[t.Invalid=0]="Invalid",t[t.External=1]="External",t[t.Slack=2]="Slack",t[t.Error=3]="Error",t[t.Dummy=4]="Dummy"})(M||(M={}));var D=function(){function t(t,i){this.o=i,this.Y=t}return t.prototype.id=function(){return this.o},t.prototype.type=function(){return this.Y},t}(),z=new D(M.Invalid,-1),F=function(){function t(t){void 0===t&&(t=0),this.q=y(),this.u=t}return t.prototype.cells=function(){return this.q},t.prototype.constant=function(){return this.u},t.prototype.isConstant=function(){return this.q.empty()},t.prototype.allDummies=function(){for(var t=this.q,i=0,s=t.size();i<s;++i)if(t.itemAt(i).first.type()!==M.Dummy)return 0;return 1},t.prototype.copy=function(){var i=new t(this.u);return i.q=this.q.copy(),i},t.prototype.add=function(t){return this.u+=t},t.prototype.insertSymbol=function(t,i){void 0===i&&(i=1),A(this.q.setDefault(t,(()=>0)).second+=i)&&this.q.erase(t)},t.prototype.insertRow=function(t,i){void 0===i&&(i=1),this.u+=t.u*i;for(var s=t.q,n=0,o=s.size();n<o;++n){var r=s.itemAt(n);this.insertSymbol(r.first,r.second*i)}},t.prototype.removeSymbol=function(t){this.q.erase(t)},t.prototype.reverseSign=function(){this.u=-this.u;for(var t=this.q,i=0,s=t.size();i<s;++i){var n=t.itemAt(i);n.second=-n.second}},t.prototype.solveFor=function(t){var i=this.q,s=-1/i.erase(t).second;this.u*=s;for(var n=0,o=i.size();n<o;++n)i.itemAt(n).second*=s},t.prototype.solveForEx=function(t,i){this.insertSymbol(t,-1),this.solveFor(i)},t.prototype.coefficientFor=function(t){var i=this.q.find(t);return void 0!==i?i.second:0},t.prototype.substitute=function(t,i){var s=this.q.erase(t);void 0!==s&&this.insertRow(i,s.second)},t}();const U=Symbol("xSymbol"),j=Symbol("ySymbol"),B=Symbol("widthSymbol"),H=Symbol("heightSymbol"),V=Symbol("addUIElementSymbol"),R=Symbol("removeUIElementSymbol"),L=Symbol("addConstraintSymbol"),K=Symbol("removeUIConstraintSymbol"),_=Symbol("addConstraintSymbol"),N=Symbol("removeConstraintSymbol"),X=Symbol("addVariableSymbol"),Y=Symbol("removeVariableSymbol"),q=Symbol("suggestVariableSymbol"),W=Symbol("disableConstraintSymbol"),G=Symbol("enableConstraintSymbol"),Q=Symbol("needsRecalculation"),J=Symbol("renderSymbol"),Z=Symbol("clickSymbol");var tt,it,st;function nt(t){return null!==t&&Object.values(tt).some((i=>i===t))}function ot(t){return null!=t?t:tt.ALWAYS}(t=>{t[t.LANDSCAPE=0]="LANDSCAPE",t[t.PORTRAIT=1]="PORTRAIT",t[t.ALWAYS=2]="ALWAYS"})(tt||(tt={}));class rt{constructor(t,i){this.layer=t,this.name="",this.layer[L](this,i)}destroy(){this.layer[K](this)}}function et(t){return null!==t&&Object.values(it).some((i=>i===t))}function ht(t){return null!=t?t:it.P0}function lt(t){switch(t){case it.P0:return T.create(1e3,1e3,1e3);case it.P1:return T.create(100,0,0);case it.P2:return T.create(10,0,0);case it.P3:return T.create(0,100,0);case it.P4:return T.create(0,10,0);case it.P5:return T.create(0,0,100);case it.P6:return T.create(0,0,10);case it.P7:return T.create(0,0,1);default:return T.create(1e3,1e3,1e3)}}function ut(t){return null!==t&&Object.values(st).some((i=>i===t))}function at(t){return null!=t?t:st.EQUAL}function dt(t){switch(t){case st.EQUAL:return O.Eq;case st.LESS:return O.Le;case st.GREATER:return O.Ge;default:return O.Eq}}(t=>{t[t.P0=0]="P0",t[t.P1=1]="P1",t[t.P2=2]="P2",t[t.P3=3]="P3",t[t.P4=4]="P4",t[t.P5=5]="P5",t[t.P6=6]="P6",t[t.P7=7]="P7"})(it||(it={})),(t=>{t[t.EQUAL=2]="EQUAL",t[t.LESS=0]="LESS",t[t.GREATER=1]="GREATER"})(st||(st={}));class ct extends rt{constructor(t,i){var s;super(t.layer,new Set([t])),this.element=t,this.options={height:null!==(s=null==i?void 0:i.height)&&void 0!==s?s:t.height,power:ht(null==i?void 0:i.power),rule:at(null==i?void 0:i.rule),orientation:ot(null==i?void 0:i.orientation)},this.options.orientation!==tt.ALWAYS&&this.options.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[W](t){this.options.orientation!==tt.ALWAYS&&t!==this.options.orientation&&this.destroyConstraints()}[G](t){this.options.orientation!==tt.ALWAYS&&t===this.options.orientation&&this.buildConstraints()}buildConstraints(){this.constraint=new P(new E(this.element[H]),dt(this.options.rule),this.options.height,lt(this.options.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class vt{constructor(){this.listeners=new Map}on(t,i,s,n=100){return this.addListener(t,i,s,n,0),this}once(t,i,s,n=100){return this.addListener(t,i,s,n,1),this}off(t,i,s){const n=this.listeners.get(t);if(!n)return this;if(!i)return this.listeners.delete(t),this;const o=n.filter((t=>t.callback!==i||void 0!==s&&t.context!==s));return o.length?this.listeners.set(t,o):this.listeners.delete(t),this}emit(t,...i){const s=this.listeners.get(t);if(!(null==s?void 0:s.length))return 0;for(const n of[...s])n.callback.apply(n.context,i),n.once&&this.off(t,n.callback,n.context);return 1}addListener(t,i,s,n,o){let r=this.listeners.get(t);if(r||(r=[],this.listeners.set(t,r)),r.some((t=>t.callback===i&&t.context===s)))throw Error("Event listener already exists");const e={callback:i,context:s,priority:n,once:o};let h=0;for(;h<r.length&&r[h].priority<=n;)h++;r.splice(h,0,e)}}const ft=new t,wt=new i;var pt,gt;(t=>{t[t.HIDDEN=0]="HIDDEN",t[t.VISIBLE=1]="VISIBLE",t[t.INTERACTIVE=2]="INTERACTIVE"})(pt||(pt={}));const mt=.5;class yt{constructor(t){this.owner=t,this[gt]=0,this.positionXInternal=0,this.positionYInternal=0,this.anchorXInternal=mt,this.anchorYInternal=mt,this.scaleXInternal=1,this.scaleYInternal=1,this.rotationInternal=0}get x(){return this.positionXInternal}get y(){return this.positionYInternal}get anchorX(){return this.anchorXInternal}get anchorY(){return this.anchorYInternal}get scaleX(){return this.scaleXInternal}get scaleY(){return this.scaleYInternal}get angle(){return s.radToDeg(this.rotationInternal)}get rotation(){return this.rotationInternal}set x(t){this.positionXInternal=t,this[Q]=1}set y(t){this.positionYInternal=t,this[Q]=1}set anchorX(t){this.anchorXInternal=t,this[Q]=1}set anchorY(t){this.anchorYInternal=t,this[Q]=1}set scaleX(t){this.scaleXInternal=t,this[Q]=1}set scaleY(t){this.scaleYInternal=t,this[Q]=1}set angle(t){this.rotationInternal=s.degToRad(t),this[Q]=1}set rotation(t){this.rotationInternal=t,this[Q]=1}setAnchorByGlobalPosition(t,i){const s=i-this.owner.y;this.anchorXInternal=(t-this.owner.x)/this.owner.width,this.anchorYInternal=s/this.owner.height,this[Q]=1}reset(){this.positionXInternal=0,this.positionYInternal=0,this.anchorXInternal=mt,this.anchorYInternal=mt,this.scaleXInternal=1,this.scaleYInternal=1,this.rotationInternal=0,this[Q]=1}}gt=Q;class bt extends n{constructor(t){super({uniforms:{map:{value:t},opacity:{value:1},color:{value:new o(1,1,1)}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D map;\n uniform float opacity;\n uniform vec3 color;\n varying vec2 vUv;\n\n void main() {\n vec4 textureColor = texture2D(map, vUv);\n gl_FragColor = vec4(textureColor.rgb * color, textureColor.a * opacity);\n #include <colorspace_fragment>\n }\n ",transparent:1,lights:0,fog:0})}getTexture(){return this.uniforms.map.value}getColor(){return this.uniforms.color.value.getHex()}getOpacity(){return this.uniforms.opacity.value}setTexture(t){this.uniforms.map.value=t,this.uniformsNeedUpdate=1}setColor(t){this.uniforms.color.value.setHex(t),this.uniformsNeedUpdate=1}setOpacity(t){this.uniforms.opacity.value=t,this.uniformsNeedUpdate=1}}const xt=new r(1,1).translate(.5,.5,0),Ct=new e,St=new h(xt);Ct.add(St);class Et{constructor(t=0,i=0){this.paddingHorizontalInternal=t,this.paddingVerticalInternal=i,this.camera=new l(-1,1,1,-1,0,1),this.updateCameraTransform()}get paddingHorizontal(){return this.paddingHorizontalInternal}get paddingVertical(){return this.paddingVerticalInternal}set paddingHorizontal(t){this.paddingHorizontalInternal!==t&&(this.paddingHorizontalInternal=t,this.updateCameraTransform())}set paddingVertical(t){this.paddingVerticalInternal!==t&&(this.paddingVerticalInternal=t,this.updateCameraTransform())}render(t,i){St.material=i,t.render(Ct,this.camera)}updateCameraTransform(){this.camera.left=-this.paddingHorizontalInternal,this.camera.right=1+this.paddingHorizontalInternal,this.camera.bottom=-this.paddingVerticalInternal,this.camera.top=1+this.paddingVerticalInternal,this.camera.updateProjectionMatrix()}}class kt{constructor(){this.passes=[],this.defaultMaterial=new bt,this.screen=new Et,this.needsUpdateInternal=0,this.lastPaddingHasChangedInternal=0,this.lastPaddingInternal=0;const t={format:c,minFilter:d,magFilter:d,type:a,depthBuffer:0,stencilBuffer:0};this.fromRenderTarget=new u(1,1,t),this.toRenderTarget=new u(1,1,t),this.fromRenderTarget.texture.generateMipmaps=0,this.toRenderTarget.texture.generateMipmaps=0}get needsUpdate(){return this.needsUpdateInternal&&this.hasValuablePasses()||this.hasPassesNeedingUpdate()}get lastPaddingHasChanged(){return this.lastPaddingHasChangedInternal}get lastPadding(){return this.lastPaddingInternal}requestUpdate(){this.needsUpdateInternal=1}compose(t,i,s,n,o=1){const r=this.hasValuablePasses();if(!(this.needsUpdateInternal&&r||this.hasPassesNeedingUpdate()))return r||(this.lastPaddingHasChangedInternal=0!==this.lastPaddingInternal,this.lastPaddingInternal=0),this.needsUpdateInternal=0,r?this.defaultMaterial:n;const e=this.calculatePadding();this.lastPaddingHasChangedInternal=this.lastPaddingInternal!==e,this.lastPaddingInternal=e;const h=i+2*e,l=s+2*e;this.fromRenderTarget.setSize(h,l),this.toRenderTarget.setSize(h,l),this.setScreenPadding(i,s,e),t.setClearColor(0,0),t.setRenderTarget(this.toRenderTarget),t.clear(1,0,0);const u=n.blending;o&&(n.blending=v),this.screen.render(t,n),n.blending=u;const a={width:i,height:s,padding:e};for(let i=0;i<this.passes.length;i++){const s=this.passes[i];(s.needsUpdate||s.isValuable)&&(this.reverseRenderTargets(),t.setRenderTarget(this.toRenderTarget),t.clear(1,0,0),this.passes[i].render(t,this.fromRenderTarget.texture,a))}return this.needsUpdateInternal=0,this.defaultMaterial.setTexture(this.toRenderTarget.texture),this.defaultMaterial}destroy(){this.fromRenderTarget.dispose(),this.toRenderTarget.dispose()}hasValuablePasses(){return this.passes.some((t=>t.isValuable))}hasPassesNeedingUpdate(){return this.passes.some((t=>t.needsUpdate))}calculatePadding(){return this.passes.reduce(((t,i)=>Math.max(t,i.padding)),0)}setScreenPadding(t,i,s){this.screen.paddingHorizontal=s/t,this.screen.paddingVertical=s/i}reverseRenderTargets(){const t=this.fromRenderTarget;this.fromRenderTarget=this.toRenderTarget,this.toRenderTarget=t}}var Ot,Tt,Mt,Pt,It,$t,At,Dt,zt,Ft;(t=>{t.CLICK="click"})($t||($t={}));class Ut extends vt{constructor(t,i,s,n,o,r){super(),this.layer=t,this.object=i,this.name="",this[Ot]=new C("x"),this[Tt]=new C("y"),this[Mt]=new C("width"),this[Pt]=new C("height"),this[It]=0,this.behaviorInternal=pt.VISIBLE,this.composer=new kt,this.lastPadding=0,this.micro=new yt(this),this.layer[V](this,this.object),this.layer[X](this,this[U],lt(it.P7)),this.layer[X](this,this[j],lt(it.P7)),this.layer[X](this,this[B],lt(it.P5)),this.layer[X](this,this[H],lt(it.P5)),this[U].setValue(s),this[j].setValue(n),this[B].setValue(o),this[H].setValue(r),this.layer[q](this,this[U],s),this.layer[q](this,this[j],n),this.layer[q](this,this[B],o),this.layer[q](this,this[H],r)}get passes(){return this.composer.passes}get x(){return this[U].value()}get y(){return this[j].value()}get width(){return this[B].value()}get height(){return this[H].value()}get zIndex(){return this.object.position.z}get behavior(){return this.behaviorInternal}set x(t){this.layer[q](this,this[U],t)}set y(t){this.layer[q](this,this[j],t)}set width(t){this.layer[q](this,this[B],t)}set height(t){this.layer[q](this,this[H],t)}set zIndex(t){this.object.position.z=t}set behavior(t){this.behaviorInternal=t,this.object.visible=t!==pt.HIDDEN}destroy(){this.composer.destroy(),this.layer[Y](this,this[H]),this.layer[Y](this,this[B]),this.layer[Y](this,this[j]),this.layer[Y](this,this[U]),this.layer[R](this)}[(Ot=U,Tt=j,Mt=B,Pt=H,It=Q,Z)](t,i){return this.behavior!==pt.INTERACTIVE?0:(this.flushTransform(),s=this.x,n=this.y,o=this.width,r=this.height,ft.set(t,i),wt.min.set(s,n),wt.max.set(o,r).add(wt.min),wt.containsPoint(ft)?(this.emit($t.CLICK,this),1):0);var s,n,o,r}flushTransform(){(this[Q]||this.micro[Q]||this.composer.lastPaddingHasChanged)&&(((t,i,s,n,o,r,e)=>{const h=this.x-e,l=this.y-e,u=this.width+2*e,a=this.height+2*e,d=h+u*i.anchorX,c=l+a*i.anchorY;let v=h-d,f=l-c;v*=i.scaleX,f*=i.scaleY;const w=Math.cos(i.rotation),p=Math.sin(i.rotation);v=v*w-f*p,f=v*p+f*w,v+=i.x,f+=i.y,t.position.x=v+d,t.position.y=f+c,t.rotation.z=i.rotation,t.scale.x=u*i.scaleX,t.scale.y=a*i.scaleY})(this.object,this.micro,0,0,0,0,this.composer.lastPadding),this[Q]=0,this.micro[Q]=0)}}const jt=new o(0);var Bt,Ht,Vt;(t=>{t.ORIENTATION_CHANGED="orientationChanged"})(Bt||(Bt={}));class Rt extends vt{constructor(){super(...arguments),this.behavior=pt.VISIBLE,this[At]=new C,this[Dt]=new C,this[zt]=new C,this[Ft]=new C,this.scene=new e,this.camera=new l,this.solver=new $,this.elements=new Map,this.constraints=new Map,this.orientationPrivate=tt.PORTRAIT,this.needsRecalculation=0}get orientation(){return this.orientationPrivate}destroy(){this.solver=void 0;for(const t of this.constraints.keys())t.destroy();for(const t of this.elements.keys())t.destroy()}[(At=U,Dt=j,zt=B,Ft=H,V)](t,i){if(this.elements.has(t))throw Error("Element already added");this.elements.set(t,{object:i,variables:new Map,constraints:new Set}),i.position.z=500,this.scene.add(i)}[R](t){const i=this.elements.get(t);if(void 0===i)throw Error("Element not found");if(i.variables.size>0)throw Error("Variables should be removed before removing element");if(i.constraints.size>0)throw Error("Constraints should be removed before removing element");this.elements.delete(t),this.scene.remove(i.object)}[L](t,i){if(this.constraints.has(t))throw Error("Constraint already added");for(const s of i){const i=this.elements.get(s);if(void 0===i)throw Error("Element not found");if(i.constraints.has(t))throw Error("Something went wrong");i.constraints.add(t)}this.constraints.set(t,{elements:i,variables:new Map,constraints:new Set})}[K](t){const i=this.constraints.get(t);if(void 0===i)throw Error("Constraint not found");if(i.variables.size>0)throw Error("Variables should be removed before removing constraint");if(i.constraints.size>0)throw Error("Constraints should be removed before removing constraint");for(const s of i.elements){const i=this.elements.get(s);if(void 0===i)throw Error("Element not found");if(!i.constraints.has(t))throw Error("Something went wrong");i.constraints.delete(t)}this.constraints.delete(t)}[_](t,i){var s;const n=this.constraints.get(t);if(void 0===n)throw Error("Before adding constraint you need to add it's owner");if(n.constraints.has(i))throw Error("Constraint already exists");n.constraints.add(i),null===(s=this.solver)||void 0===s||s.addConstraint(i),this.needsRecalculation=1}[N](t,i){var s;const n=this.constraints.get(t);if(void 0===n)throw Error("Before removing constraint you need to add it's owner");if(!n.constraints.has(i))throw Error("Constraint not found");n.constraints.delete(i),null===(s=this.solver)||void 0===s||s.removeConstraint(i),this.needsRecalculation=1}[X](t,i,s){var n;const o=t instanceof Ut?this.elements.get(t):this.constraints.get(t);if(void 0===o)throw Error("Before adding variable you need to add it's owner");if(o.variables.has(i))throw Error("Variable already exists");o.variables.set(i,{strength:s,suggestedValue:i.value()}),null===(n=this.solver)||void 0===n||n.addEditVariable(i,s),this.needsRecalculation=1}[Y](t,i){var s;const n=t instanceof Ut?this.elements.get(t):this.constraints.get(t);if(void 0===n)throw Error("Before removing variable you need to add it's owner");if(!n.variables.has(i))throw Error("Variable does not exist");n.variables.delete(i),null===(s=this.solver)||void 0===s||s.removeEditVariable(i),this.needsRecalculation=1}[q](t,i,s){var n;const o=t instanceof Ut?this.elements.get(t):this.constraints.get(t);if(void 0===o)throw Error("Before suggesting variable you need to add it's owner");const r=o.variables.get(i);if(!r)throw Error("Variable does not exist");r.suggestedValue!==s&&(r.suggestedValue=s,null===(n=this.solver)||void 0===n||n.suggestValue(i,s),this.needsRecalculation=1)}render(t){var i;if(this.behavior===pt.HIDDEN)return;const s=t.getRenderTarget(),n=t.getClearColor(jt),o=t.getClearAlpha();if(this.needsRecalculation){this.needsRecalculation=0,null===(i=this.solver)||void 0===i||i.updateVariables();for(const t of this.elements.keys())t[Q]=1}for(const i of this.elements.keys())i[J](t);t.setRenderTarget(s),t.setClearColor(n),t.setClearAlpha(o),t.render(this.scene,this.camera)}clickInternal(t,i){if(this.behavior!==pt.INTERACTIVE)return;const s=[...this.elements.keys()].filter((t=>t.behavior===pt.INTERACTIVE)).sort(((t,i)=>t.zIndex-i.zIndex));for(const n of s)if(n[Z](t,i))break}resizeInternal(t,i){this.applyCameraSize(t,i),this.rebuildLayerConstraints(t,i),this.updateOrientation(t,i),this.needsRecalculation=1}applyCameraSize(t,i){this.camera.near=-1e3,this.camera.far=0,this.camera.bottom=0,this.camera.left=0,this.camera.right=t,this.camera.top=i,this.camera.updateProjectionMatrix()}rebuildLayerConstraints(t,i){var s,n,o,r,e,h,l,u;this.constraintX&&(null===(s=this.solver)||void 0===s||s.removeConstraint(this.constraintX),this.constraintX=void 0),this.constraintY&&(null===(n=this.solver)||void 0===n||n.removeConstraint(this.constraintY),this.constraintY=void 0),this.constraintW&&(null===(o=this.solver)||void 0===o||o.removeConstraint(this.constraintW),this.constraintW=void 0),this.constraintH&&(null===(r=this.solver)||void 0===r||r.removeConstraint(this.constraintH),this.constraintH=void 0),this.constraintX=new P(new E(this[U]),O.Eq,0,T.required),this.constraintY=new P(new E(this[j]),O.Eq,0,T.required),this.constraintW=new P(new E(this[B]),O.Eq,t,T.required),this.constraintH=new P(new E(this[H]),O.Eq,i,T.required),null===(e=this.solver)||void 0===e||e.addConstraint(this.constraintX),null===(h=this.solver)||void 0===h||h.addConstraint(this.constraintY),null===(l=this.solver)||void 0===l||l.addConstraint(this.constraintW),null===(u=this.solver)||void 0===u||u.addConstraint(this.constraintH)}updateOrientation(t,i){const s=this.orientationPrivate;if(this.orientationPrivate=t>i?tt.LANDSCAPE:tt.PORTRAIT,s!==this.orientationPrivate){this.solver=void 0;for(const t of this.constraints.keys())t[G](this.orientationPrivate);for(const t of this.constraints.keys())t[W](this.orientationPrivate);this.solver=new $;const t=[...this.elements.values(),...this.constraints.values()];for(const i of t)for(const[t,s]of i.variables.entries())this.solver.addEditVariable(t,s.strength),this.solver.suggestValue(t,s.suggestedValue);this.constraintX&&this.solver.addConstraint(this.constraintX),this.constraintY&&this.solver.addConstraint(this.constraintY),this.constraintW&&this.solver.addConstraint(this.constraintW),this.constraintH&&this.solver.addConstraint(this.constraintH);for(const t of this.constraints.values())for(const i of t.constraints.values())this.solver.addConstraint(i);this.emit(Bt.ORIENTATION_CHANGED,this,this.orientation)}}}function Lt(t,i){if((t instanceof Rt?t:t.layer)!==i.layer)throw Error(`Elements must be on the same layer - element "${i.constructor.name}" cannot interact with elements from a different layer`)}function Kt(t,i,s){if(t<=0||i<=0)throw Error(null!=s?s:`Invalid dimensions: width (${t}) and height (${i}) must both be positive numbers greater than 0`)}class _t extends rt{constructor(t,i,s){var n,o,r;Lt(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={anchorOne:null!==(n=null==s?void 0:s.anchorOne)&&void 0!==n?n:.5,anchorTwo:null!==(o=null==s?void 0:s.anchorTwo)&&void 0!==o?o:.5,distance:null!==(r=null==s?void 0:s.distance)&&void 0!==r?r:0,power:ht(null==s?void 0:s.power),rule:at(null==s?void 0:s.rule),orientation:ot(null==s?void 0:s.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[W](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.elementOne[U]).plus(new E(this.elementOne[B]).multiply(this.parameters.anchorOne)),i=new E(this.elementTwo[U]).plus(new E(this.elementTwo[B]).multiply(this.parameters.anchorTwo));this.constraint=new P(i.minus(t),dt(this.parameters.rule),this.parameters.distance,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Nt extends rt{constructor(t,i,s){var n;Lt(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={proportion:null!==(n=null==s?void 0:s.proportion)&&void 0!==n?n:1,power:ht(null==s?void 0:s.power),rule:at(null==s?void 0:s.rule),orientation:ot(null==s?void 0:s.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[W](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.elementOne[B]).multiply(this.parameters.proportion),i=new E(this.elementTwo[B]);this.constraint=new P(t.minus(i),dt(this.parameters.rule),0,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Xt extends rt{constructor(t,i,s){var n,o,r;Lt(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={anchorOne:null!==(n=null==s?void 0:s.anchorOne)&&void 0!==n?n:.5,anchorTwo:null!==(o=null==s?void 0:s.anchorTwo)&&void 0!==o?o:.5,distance:null!==(r=null==s?void 0:s.distance)&&void 0!==r?r:0,power:ht(null==s?void 0:s.power),rule:at(null==s?void 0:s.rule),orientation:ot(null==s?void 0:s.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[W](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.elementOne[j]).plus(new E(this.elementOne[H]).multiply(this.parameters.anchorOne)),i=new E(this.elementTwo[j]).plus(new E(this.elementTwo[H]).multiply(this.parameters.anchorTwo));this.constraint=new P(i.minus(t),dt(this.parameters.rule),this.parameters.distance,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Yt extends rt{constructor(t,i,s){var n;Lt(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={proportion:null!==(n=null==s?void 0:s.proportion)&&void 0!==n?n:1,power:ht(null==s?void 0:s.power),rule:at(null==s?void 0:s.rule),orientation:ot(null==s?void 0:s.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[W](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.elementOne[H]).multiply(this.parameters.proportion),i=new E(this.elementTwo[H]);this.constraint=new P(t.minus(i),dt(this.parameters.rule),0,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class qt extends rt{constructor(t,i){var s;super(t.layer,new Set([t])),this.element=t,this.options={width:null!==(s=null==i?void 0:i.width)&&void 0!==s?s:t.width,power:ht(null==i?void 0:i.power),rule:at(null==i?void 0:i.rule),orientation:ot(null==i?void 0:i.orientation)},this.options.orientation!==tt.ALWAYS&&this.options.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[W](t){this.options.orientation!==tt.ALWAYS&&t!==this.options.orientation&&this.destroyConstraints()}[G](t){this.options.orientation!==tt.ALWAYS&&t===this.options.orientation&&this.buildConstraints()}buildConstraints(){this.constraint=new P(new E(this.element[B]),dt(this.options.rule),this.options.width,lt(this.options.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Wt{static size(t,i){var s,n,o,r,e,h,l,u;return{x:new qt(t,{width:null===(s=i.size)||void 0===s?void 0:s.x,power:null===(n=i.power)||void 0===n?void 0:n.x,rule:null===(o=i.rule)||void 0===o?void 0:o.x,orientation:null===(r=i.orientation)||void 0===r?void 0:r.x}),y:new ct(t,{height:null===(e=i.size)||void 0===e?void 0:e.y,power:null===(h=i.power)||void 0===h?void 0:h.y,rule:null===(l=i.rule)||void 0===l?void 0:l.y,orientation:null===(u=i.orientation)||void 0===u?void 0:u.y})}}static distance(t,i,s){var n,o,r,e,h,l,u,a,d,c,v,f;return{x:new _t(t,i,{anchorOne:null===(n=s.anchorOne)||void 0===n?void 0:n.x,anchorTwo:null===(o=s.anchorTwo)||void 0===o?void 0:o.x,distance:null===(r=s.distance)||void 0===r?void 0:r.x,power:null===(e=s.power)||void 0===e?void 0:e.x,rule:null===(h=s.rule)||void 0===h?void 0:h.x,orientation:null===(l=s.orientation)||void 0===l?void 0:l.x}),y:new Xt(t,i,{anchorOne:null===(u=s.anchorOne)||void 0===u?void 0:u.y,anchorTwo:null===(a=s.anchorTwo)||void 0===a?void 0:a.y,distance:null===(d=s.distance)||void 0===d?void 0:d.y,power:null===(c=s.power)||void 0===c?void 0:c.y,rule:null===(v=s.rule)||void 0===v?void 0:v.y,orientation:null===(f=s.orientation)||void 0===f?void 0:f.y})}}static proportion(t,i,s){var n,o,r,e,h,l,u,a;return{x:new Nt(t,i,{proportion:null===(n=s.proportion)||void 0===n?void 0:n.x,power:null===(o=s.power)||void 0===o?void 0:o.x,rule:null===(r=s.rule)||void 0===r?void 0:r.x,orientation:null===(e=s.orientation)||void 0===e?void 0:e.x}),y:new Yt(t,i,{proportion:null===(h=s.proportion)||void 0===h?void 0:h.y,power:null===(l=s.power)||void 0===l?void 0:l.y,rule:null===(u=s.rule)||void 0===u?void 0:u.y,orientation:null===(a=s.orientation)||void 0===a?void 0:a.y})}}}class Gt extends rt{constructor(t,i){var s;super(t.layer,new Set([t])),this.element=t,this.parameters={aspect:null!==(s=null==i?void 0:i.aspect)&&void 0!==s?s:this.element.width/this.element.height,power:ht(null==i?void 0:i.power),rule:at(null==i?void 0:i.rule),orientation:ot(null==i?void 0:i.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[W](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){const t=new E(this.element[B]).plus(new E(this.element[H]).multiply(-this.parameters.aspect));this.constraint=new P(t,dt(this.parameters.rule),0,lt(this.parameters.power)),this.layer[_](this,this.constraint)}destroyConstraints(){this.constraint&&(this.layer[N](this,this.constraint),this.constraint=void 0)}}class Qt extends rt{constructor(t,i,s){var n,o,r;Lt(t,i),super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,this.parameters={isStrict:null!==(n=null==s?void 0:s.isStrict)&&void 0!==n?n:1,horizontalAnchor:null!==(o=null==s?void 0:s.horizontalAnchor)&&void 0!==o?o:.5,verticalAnchor:null!==(r=null==s?void 0:s.verticalAnchor)&&void 0!==r?r:.5,orientation:ot(null==s?void 0:s.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[W](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){this.constraintX=new P(new E(this.elementOne[U]).plus(new E(this.elementOne[B]).multiply(this.parameters.horizontalAnchor)),O.Eq,new E(this.elementTwo[U]).plus(new E(this.elementTwo[B]).multiply(this.parameters.horizontalAnchor))),this.constraintY=new P(new E(this.elementOne[j]).plus(new E(this.elementOne[H]).multiply(this.parameters.verticalAnchor)),O.Eq,new E(this.elementTwo[j]).plus(new E(this.elementTwo[H]).multiply(this.parameters.verticalAnchor))),this.constraintW=new P(new E(this.elementOne[B]),O.Le,new E(this.elementTwo[B])),this.constraintH=new P(new E(this.elementOne[H]),O.Le,new E(this.elementTwo[H])),this.layer[_](this,this.constraintX),this.layer[_](this,this.constraintY),this.layer[_](this,this.constraintW),this.layer[_](this,this.constraintH),this.parameters.isStrict||(this.constraintStrict=new P(new E(this.elementOne[H]),O.Eq,new E(this.elementTwo[H]),T.strong),this.layer[_](this,this.constraintStrict))}destroyConstraints(){this.constraintX&&(this.layer[N](this,this.constraintX),this.constraintX=void 0),this.constraintY&&(this.layer[N](this,this.constraintY),this.constraintY=void 0),this.constraintW&&(this.layer[N](this,this.constraintW),this.constraintW=void 0),this.constraintH&&(this.layer[N](this,this.constraintH),this.constraintH=void 0),this.constraintStrict&&(this.layer[N](this,this.constraintStrict),this.constraintStrict=void 0)}}function Jt(t){return null!==t&&"object"==typeof t&&("x"in t&&"number"==typeof t.x||"y"in t&&"number"==typeof t.y)}function Zt(t){return null!==t&&"object"==typeof t&&("x"in t&&et(t.x)||"y"in t&&et(t.y))}function ti(t){return null!==t&&"object"==typeof t&&("x"in t&&ut(t.x)||"y"in t&&ut(t.y))}function ii(t){return null!==t&&"object"==typeof t&&"elementOne"in t&&"elementTwo"in t&&(t.elementOne instanceof Ut||t.elementOne instanceof Rt)&&t.elementTwo instanceof Ut}function si(t){return ii(t)&&"distance"in t&&Jt(t.distance)&&(!("anchorOne"in t)||"anchorOne"in t&&Jt(t.anchorOne))&&(!("anchorTwo"in t)||"anchorTwo"in t&&Jt(t.anchorTwo))&&(!("power"in t)||Zt(t.power))&&(!("rule"in t)||ti(t.rule))&&(!("orientation"in t)||nt(t.orientation))}function ni(t){return ii(t)&&"proportion"in t&&Jt(t.proportion)&&(!("power"in t)||Zt(t.power))&&(!("rule"in t)||ti(t.rule))&&(!("orientation"in t)||nt(t.orientation))}function oi(t){return ii(t)&&"isStrict"in t&&"boolean"==typeof t.isStrict&&(!("anchor"in t)||"anchor"in t&&Jt(t.anchor))}function ri(t){return null!==t&&"object"==typeof t&&"element"in t&&t.element instanceof Ut&&(!("power"in t)||et(t.power))&&(!("rule"in t)||ut(t.rule))}function ei(t){return ri(t)&&"height"in t&&"number"==typeof t.height}function hi(t){return ri(t)&&"keepAspect"in t&&"boolean"==typeof t.keepAspect}function li(t){return ri(t)&&"keepSize"in t&&"boolean"==typeof t.keepSize}class ui{static fromDescription(t){const i=t instanceof Map?t.entries():Object.entries(t),s=new Map;for(const[t,o]of i){if(s.has(t))throw Error(`Duplicate constraint key "${t}" - each constraint must have a unique identifier`);if(ri(n=o)&&"width"in n&&"number"==typeof n.width)ui.buildWidthConstraint(t,o,s);else if(ei(o))ui.buildHeightConstraint(t,o,s);else if(hi(o))ui.buildKeepAspectConstraint(t,o,s);else if(li(o))ui.buildKeepSizeConstraint(t,o,s);else if(si(o))ui.buildDistanceConstraint(t,o,s);else if(ni(o))ui.buildProportionalConstraint(t,o,s);else{if(!oi(o))throw Error(`Invalid constraint type for "${t}". Expected one of: Width, Height, KeepAspect, KeepSize, Distance, Proportional, or Cover constraint`);ui.buildCoverConstraint(t,o,s)}}var n;return Object.fromEntries(s)}static buildWidthConstraint(t,i,s){s.set(t,new qt(i.element,{width:i.width,power:i.power,rule:i.rule,orientation:i.orientation}))}static buildHeightConstraint(t,i,s){s.set(t,new ct(i.element,{height:i.height,power:i.power,rule:i.rule,orientation:i.orientation}))}static buildKeepAspectConstraint(t,i,s){s.set(t,new Gt(i.element,{power:i.power,rule:i.rule,orientation:i.orientation}))}static buildKeepSizeConstraint(t,i,s){const n=t.replace(/(KeepSize|Keep)$/,"")+"KeepWidth",o=t.replace(/(KeepSize|Keep)$/,"")+"KeepHeight";s.set(n,new qt(i.element,{power:i.power,rule:i.rule,orientation:i.orientation})),s.set(o,new ct(i.element,{power:i.power,rule:i.rule,orientation:i.orientation}))}static buildDistanceConstraint(t,i,s){var n,o,r,e,h,l,u,a;if("number"==typeof i.distance.x){const h=t.replace(/(HorizontalDistance|Distance)$/,"")+"HorizontalDistance";s.set(h,new _t(i.elementOne,i.elementTwo,{distance:i.distance.x,anchorOne:null===(n=i.anchorOne)||void 0===n?void 0:n.x,anchorTwo:null===(o=i.anchorTwo)||void 0===o?void 0:o.x,power:null===(r=i.power)||void 0===r?void 0:r.x,rule:null===(e=i.rule)||void 0===e?void 0:e.x,orientation:i.orientation}))}if("number"==typeof i.distance.y){const n=t.replace(/(VerticalDistance|Distance)$/,"")+"VerticalDistance";s.set(n,new Xt(i.elementOne,i.elementTwo,{distance:i.distance.y,anchorOne:null===(h=i.anchorOne)||void 0===h?void 0:h.y,anchorTwo:null===(l=i.anchorTwo)||void 0===l?void 0:l.y,power:null===(u=i.power)||void 0===u?void 0:u.y,rule:null===(a=i.rule)||void 0===a?void 0:a.y,orientation:i.orientation}))}}static buildProportionalConstraint(t,i,s){var n,o,r,e;if("number"==typeof i.proportion.x){const r=t.replace(/(HorizontalProportional|HorizontalProportion|Proportional|Proportion)$/,"")+"HorizontalProportion";s.set(r,new Nt(i.elementOne,i.elementTwo,{proportion:i.proportion.x,power:null===(n=i.power)||void 0===n?void 0:n.x,rule:null===(o=i.rule)||void 0===o?void 0:o.x,orientation:i.orientation}))}if("number"==typeof i.proportion.y){const n=t.replace(/(VerticalProportional|VerticalProportion|Proportional|Proportion)$/,"")+"VerticalProportion";s.set(n,new Yt(i.elementOne,i.elementTwo,{proportion:i.proportion.y,power:null===(r=i.power)||void 0===r?void 0:r.y,rule:null===(e=i.rule)||void 0===e?void 0:e.y,orientation:i.orientation}))}}static buildCoverConstraint(t,i,s){var n,o;s.set(t,new Qt(i.elementOne,i.elementTwo,{isStrict:i.isStrict,horizontalAnchor:null===(n=i.anchor)||void 0===n?void 0:n.x,verticalAnchor:null===(o=i.anchor)||void 0===o?void 0:o.y}))}}(t=>{t[t.FROM_LEFT_TOP=0]="FROM_LEFT_TOP",t[t.FROM_LEFT_BOTTOM=1]="FROM_LEFT_BOTTOM"})(Ht||(Ht={}));class ai{static build(t,i,s,n={}){var o;const r=null!==(o=n.direction)&&void 0!==o?o:Ht.FROM_LEFT_TOP,e=[],h=[];e.push(new _t(t,i,{anchorOne:0,anchorTwo:0,distance:0,power:n.power,orientation:n.orientation}),new _t(t,s,{anchorOne:1,anchorTwo:1,distance:0,power:n.power,orientation:n.orientation}));const l=r===Ht.FROM_LEFT_TOP?1:0,u=r===Ht.FROM_LEFT_TOP?0:1;return h.push(new Xt(t,i,{anchorOne:l,anchorTwo:l,distance:0,power:n.power,orientation:n.orientation}),new Xt(t,s,{anchorOne:u,anchorTwo:u,distance:0,power:n.power,orientation:n.orientation})),{horizontalDistances:e,verticalDistances:h}}}class di{static buildHorizontal(t,i){return this.buildStack(t,i,{distanceConstraint:_t,proportionConstraint:Nt,centerDistanceConstraint:Xt})}static buildVertical(t,i){return this.buildStack(t,i,{distanceConstraint:Xt,proportionConstraint:Yt,centerDistanceConstraint:_t})}static buildStack(t,i,s){const n=[],o=[],r=[];for(let e=0;e<t.length-1;e++){const h=t[e],l=t[e+1];n.push(new s.distanceConstraint(h,l,{anchorOne:1,anchorTwo:0,distance:i.distance,power:i.power,orientation:i.orientation})),0!=i.keepProportions&&o.push(new s.proportionConstraint(h,l,{power:i.power,orientation:i.orientation})),0!=i.keepAlignment&&r.push(new s.centerDistanceConstraint(h,l,{power:i.power,anchorOne:0,anchorTwo:0,orientation:i.orientation}))}return{distanceConstraints:n,proportionConstraints:o,alignmentConstraints:r}}}class ci extends Ut{constructor(t,i=1e3,s=1e3){super(t,new f,0,0,i,s),this.flushTransform()}[J](){this.flushTransform()}}class vi extends Ut{constructor(t,i){var s,n;const o=null===(s=i.image)||void 0===s?void 0:s.width,r=null===(n=i.image)||void 0===n?void 0:n.height;Kt(o,r,`Invalid image dimensions - texture "${i.name||"unnamed"}" has invalid width (${o}) or height (${r}). Image dimensions must be non-zero positive numbers.`);const e=new bt(i);super(t,new h(xt,e),0,0,o,r),this.material=e,this.textureInternal=i,this.flushTransform()}get texture(){return this.textureInternal}get color(){return this.material.getColor()}get opacity(){return this.material.getOpacity()}set color(t){this.material.setColor(t),this.composer.requestUpdate()}set opacity(t){this.material.setOpacity(t),this.composer.requestUpdate()}destroy(){this.material.dispose(),super.destroy()}[J](t){this.object.material=this.composer.compose(t,this.textureInternal.image.width,this.textureInternal.image.height,this.material),this.flushTransform()}}class fi extends n{constructor(t,i){super({uniforms:w.merge([{background:{value:i},foreground:{value:t},progress:{value:1},backgroundColor:{value:new o(1,1,1)},foregroundColor:{value:new o(1,1,1)},color:{value:new o(1,1,1)},backgroundOpacity:{value:1},foregroundOpacity:{value:1},opacity:{value:1},angle:{value:0},direction:{value:1}}]),vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D background;\n uniform sampler2D foreground;\n uniform float progress;\n uniform vec3 backgroundColor;\n uniform vec3 foregroundColor;\n uniform vec3 color;\n uniform float backgroundOpacity;\n uniform float foregroundOpacity;\n uniform float opacity;\n uniform float angle;\n uniform float direction;\n varying vec2 vUv;\n\n void main() {\n vec4 backgroundTexture = texture2D(background, vUv);\n vec4 foregroundTexture = texture2D(foreground, vUv);\n\n // Apply common color and opacity\n vec3 finalBackgroundColor = backgroundTexture.rgb * backgroundColor * color;\n vec3 finalForegroundColor = foregroundTexture.rgb * foregroundColor * color;\n float finalBackgroundOpacity = backgroundTexture.a * backgroundOpacity * opacity;\n float finalForegroundOpacity = foregroundTexture.a * foregroundOpacity * opacity;\n\n vec4 backgroundColor = vec4(finalBackgroundColor, finalBackgroundOpacity);\n vec4 foregroundColor = vec4(finalForegroundColor, finalForegroundOpacity);\n\n // Calculate progress threshold with angle and direction\n float adjustedX = mix(vUv.x, 1.0 - vUv.x, step(0.0, -direction));\n float tanAngle = tan(angle);\n float threshold = adjustedX - (vUv.y - 0.5) * tanAngle * sign(direction);\n float progressMask = smoothstep(threshold - 0.01, threshold + 0.01, progress);\n\n gl_FragColor = mix(backgroundColor, foregroundColor, progressMask);\n #include <colorspace_fragment>\n }\n ",transparent:1,lights:0,fog:0})}getProgress(){return this.uniforms.progress.value}getBackgroundTexture(){return this.uniforms.background.value}getForegroundTexture(){return this.uniforms.foreground.value}getBackgroundColor(){return this.uniforms.color.value.getHex()}getForegroundColor(){return this.uniforms.color.value.getHex()}getColor(){return this.uniforms.color.value.getHex()}getBackgroundOpacity(){return this.uniforms.backgroundOpacity.value}getForegroundOpacity(){return this.uniforms.foregroundOpacity.value}getOpacity(){return this.uniforms.opacity.value}getAngle(){return this.uniforms.angle.value}getIsForwardDirection(){return 1===this.uniforms.direction.value}setProgress(t){this.uniforms.progress.value=t,this.uniformsNeedUpdate=1}setBackgroundTexture(t){this.uniforms.background.value=t,this.uniformsNeedUpdate=1}setForegroundTexture(t){this.uniforms.foreground.value=t,this.uniformsNeedUpdate=1}setBackgroundColor(t){this.uniforms.color.value.setHex(t),this.uniformsNeedUpdate=1}setForegroundColor(t){this.uniforms.color.value.setHex(t),this.uniformsNeedUpdate=1}setColor(t){this.uniforms.color.value.setHex(t),this.uniformsNeedUpdate=1}setBackgroundOpacity(t){this.uniforms.backgroundOpacity.value=t,this.uniformsNeedUpdate=1}setForegroundOpacity(t){this.uniforms.foregroundOpacity.value=t,this.uniformsNeedUpdate=1}setOpacity(t){this.uniforms.opacity.value=t,this.uniformsNeedUpdate=1}setAngle(t){this.uniforms.angle.value=t,this.uniformsNeedUpdate=1}setIsForwardDirection(t){this.uniforms.direction.value=t?1:-1,this.uniformsNeedUpdate=1}}class wi extends Ut{constructor(t,i,n,o={}){var r,e,l,u;const a=null===(r=i.image)||void 0===r?void 0:r.width,d=null===(e=i.image)||void 0===e?void 0:e.height;Kt(a,d,`Invalid image dimensions - texture "${i.name||"unnamed"}" has invalid width (${a}) or height (${d}). Image dimensions must be non-zero positive numbers.`);const c=null===(l=null==n?void 0:n.image)||void 0===l?void 0:l.width,v=null===(u=null==n?void 0:n.image)||void 0===u?void 0:u.height;n&&Kt(c,v,`Invalid image dimensions - texture "${n.name||"unnamed"}" has invalid width (${c}) or height (${v}). Image dimensions must be non-zero positive numbers.`);const f=new fi(i,n),w=new h(xt,f);o.progress&&f.setProgress(o.progress),o.isForegroundDirection&&f.setIsForwardDirection(o.isForegroundDirection),o.angle&&f.setAngle(s.degToRad(o.angle)),o.color&&f.setColor(o.color),o.opacity&&f.setOpacity(o.opacity),o.backgroundColor&&f.setBackgroundColor(o.backgroundColor),o.foregroundColor&&f.setForegroundColor(o.foregroundColor),o.backgroundOpacity&&f.setBackgroundOpacity(o.backgroundOpacity),o.foregroundOpacity&&f.setForegroundOpacity(o.foregroundOpacity);const p=null!=c?c:a,g=null!=d?d:v;super(t,w,0,0,p,g),this.material=f,this.imageWidth=p,this.imageHeight=g,this.flushTransform()}get progress(){return this.material.getProgress()}get backgroundTexture(){return this.material.getBackgroundTexture()}get foregroundTexture(){return this.material.getForegroundTexture()}get backgroundColor(){return this.material.getBackgroundColor()}get foregroundColor(){return this.material.getForegroundColor()}get color(){return this.material.getColor()}get backgroundOpacity(){return this.material.getBackgroundOpacity()}get foregroundOpacity(){return this.material.getForegroundOpacity()}get opacity(){return this.material.getOpacity()}get angle(){return s.radToDeg(this.material.getAngle())}get isForwardDirection(){return this.material.getIsForwardDirection()}set progress(t){this.material.setProgress(t),this.composer.requestUpdate()}set backgroundColor(t){this.material.setBackgroundColor(t),this.composer.requestUpdate()}set foregroundColor(t){this.material.setForegroundColor(t),this.composer.requestUpdate()}set color(t){this.material.setColor(t),this.composer.requestUpdate()}set backgroundOpacity(t){this.material.setBackgroundOpacity(t),this.composer.requestUpdate()}set foregroundOpacity(t){this.material.setForegroundOpacity(t),this.composer.requestUpdate()}set opacity(t){this.material.setOpacity(t),this.composer.requestUpdate()}set angle(t){this.material.setAngle(s.degToRad(t)),this.composer.requestUpdate()}set isForwardDirection(t){this.material.setIsForwardDirection(t),this.composer.requestUpdate()}destroy(){this.material.dispose(),super.destroy()}[J](t){this.object.material=this.composer.compose(t,this.imageWidth,this.imageHeight,this.material),this.flushTransform()}}function pi(t,i){var s,n,o,r,e,h,l,u,a,d,c,v,f,w,p,g,m,y,b,x,C,S,E,k,O,T,M,P;const I=Math.max(null!==(n=null!==(s=null==t?void 0:t.fontSize)&&void 0!==s?s:null==i?void 0:i.fontSize)&&void 0!==n?n:16,1),$=null!==(r=null!==(o=null==t?void 0:t.lineHeight)&&void 0!==o?o:null==i?void 0:i.lineHeight)&&void 0!==r?r:1.2*I,A=Math.max(null!==(h=null!==(e=null==t?void 0:t.shadowBlur)&&void 0!==e?e:null==i?void 0:i.shadowBlur)&&void 0!==h?h:0,0),D=Math.max(null!==(u=null!==(l=null==t?void 0:t.strokeWidth)&&void 0!==l?l:null==i?void 0:i.strokeWidth)&&void 0!==u?u:0,0);return{color:null!==(d=null!==(a=null==t?void 0:t.color)&&void 0!==a?a:null==i?void 0:i.color)&&void 0!==d?d:"#000000",fontFamily:null!==(v=null!==(c=null==t?void 0:t.fontFamily)&&void 0!==c?c:null==i?void 0:i.fontFamily)&&void 0!==v?v:"Arial",fontSize:I,fontStyle:null!==(w=null!==(f=null==t?void 0:t.fontStyle)&&void 0!==f?f:null==i?void 0:i.fontStyle)&&void 0!==w?w:"normal",fontWeight:null!==(g=null!==(p=null==t?void 0:t.fontWeight)&&void 0!==p?p:null==i?void 0:i.fontWeight)&&void 0!==g?g:"normal",lineHeight:$,enableShadow:null!==(y=null!==(m=null==t?void 0:t.enableShadow)&&void 0!==m?m:null==i?void 0:i.enableShadow)&&void 0!==y?y:0,shadowOffsetX:null!==(x=null!==(b=null==t?void 0:t.shadowOffsetX)&&void 0!==b?b:null==i?void 0:i.shadowOffsetX)&&void 0!==x?x:0,shadowOffsetY:null!==(S=null!==(C=null==t?void 0:t.shadowOffsetY)&&void 0!==C?C:null==i?void 0:i.shadowOffsetY)&&void 0!==S?S:0,shadowBlur:A,shadowColor:null!==(k=null!==(E=null==t?void 0:t.shadowColor)&&void 0!==E?E:null==i?void 0:i.shadowColor)&&void 0!==k?k:"transparent",enableStroke:null!==(T=null!==(O=null==t?void 0:t.enableStroke)&&void 0!==O?O:null==i?void 0:i.enableStroke)&&void 0!==T?T:0,strokeColor:null!==(P=null!==(M=null==t?void 0:t.strokeColor)&&void 0!==M?M:null==i?void 0:i.strokeColor)&&void 0!==P?P:"transparent",strokeWidth:D}}function gi(t){return t.match(/\S+|\s|\n/g)||[]}function mi(t,i,s){if(t.font=`${s.fontStyle} ${s.fontWeight} ${s.fontSize}px ${s.fontFamily}`,"\n"===i)return{width:0,height:s.lineHeight,baseline:0,lineHeight:s.lineHeight};const n=t.measureText(i),o=n.width,r=Math.ceil(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent);return{width:Math.ceil(o),height:r,baseline:n.actualBoundingBoxDescent,lineHeight:s.lineHeight}}function yi(t,i,s,n,o){o.font=`${n.fontStyle} ${n.fontWeight} ${n.fontSize}px ${n.fontFamily}`,n.enableShadow&&(o.shadowOffsetX=n.shadowOffsetX,o.shadowOffsetY=n.shadowOffsetY,o.shadowBlur=n.shadowBlur,o.shadowColor=n.shadowColor),n.enableStroke&&(o.strokeStyle=n.strokeColor,o.lineWidth=n.strokeWidth,o.strokeText(s,t,i)),o.fillStyle=n.color,o.fillText(s,t,i)}class bi extends Ut{constructor(t,i,s={}){var n;const o=document.createElement("canvas"),r=o.getContext("2d");if(!r)throw Error("Failed to create canvas context");const e=[],l=Array.isArray(i)?i:[i];for(const t of l){const i="string"==typeof t,n=i?t:t.text,o=pi(i?void 0:t.style,s.defaultStyle);for(const t of gi(n)){const i=mi(r,t,o);e.push({text:t,style:o,metrics:i})}}const u=((t,i)=>{const s=[];let n=[],o=0,r=0,e=0,h=0;for(const l of i)"\n"!==l.text?o+l.metrics.width<=t||0===n.length?(n.push(l),o+=l.metrics.width,r=Math.max(r,l.metrics.height),e=Math.max(e,l.metrics.baseline),h=Math.max(h,l.metrics.lineHeight)):(s.push({chunks:n,width:o,height:r,baseline:e,lineHeight:h}),n=[l],o=l.metrics.width,r=l.metrics.height,e=l.metrics.baseline,h=l.metrics.lineHeight):(n.length>0&&s.push({chunks:n,width:o,height:r,baseline:e,lineHeight:h}),n=[],o=0,r=0,e=0,h=0);return n.length>0&&s.push({chunks:n,width:o,height:r,baseline:e,lineHeight:h}),s})(null!==(n=s.maxWidth)&&void 0!==n?n:1024,e),a=(t=>{if(0===t.length)return{width:0,height:0};const i=Math.max(...t.map((t=>t.width)));let s=0;for(let i=0;i<t.length;i++){const n=t[i];s+=0===i?n.height:n.lineHeight,i===t.length-1&&(s+=n.baseline)}return{width:i,height:s}})(u),d=(t=>{var i,s,n,o;return"number"==typeof t?{left:t,right:t,top:t,bottom:t}:{left:Math.max(null!==(i=null==t?void 0:t.left)&&void 0!==i?i:0,0),right:Math.max(null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0,0),top:Math.max(null!==(n=null==t?void 0:t.top)&&void 0!==n?n:0,0),bottom:Math.max(null!==(o=null==t?void 0:t.bottom)&&void 0!==o?o:0,0)}})(s.padding);o.width=a.width+d.left+d.right,o.height=a.height+d.top+d.bottom;const c=new p(o),v=new bt(c);super(t,new h(xt,v),0,0,a.width,a.height),this.lastSuggestedAspect=0,this.material=v,this.texture=c,this.canvas=o,this.context=r,this.textBlockSize=a,this.padding=d,((t,i,s,n)=>{let o=this.padding.top;for(let t=0;t<s.length;t++){const r=s[t];let e=i;o+=0===t?r.height:r.lineHeight;for(const t of r.chunks)yi(e,o,t.text,t.style,n),e+=t.metrics.width}})(0,this.padding.left,u,this.context),this.texture.needsUpdate=1,this.flushTransform()}get color(){return this.material.getColor()}get opacity(){return this.material.getOpacity()}set color(t){this.material.setColor(t),this.composer.requestUpdate()}set opacity(t){this.material.setOpacity(t),this.composer.requestUpdate()}destroy(){this.material.dispose(),this.texture.dispose(),this.canvas.remove(),super.destroy()}flushTransform(){super.flushTransform();const t=this.width/this.height;this.lastSuggestedAspect!==t&&(this.lastSuggestedAspect=t,this.layer[q](this,this[H],this.width/((this.textBlockSize.width+this.padding.left+this.padding.right)/(this.textBlockSize.height+this.padding.top+this.padding.bottom))))}[J](t){this.object.material=this.composer.compose(t,this.texture.image.width,this.texture.image.height,this.material),this.flushTransform()}}function xi(t){return null!==t&&"object"==typeof t&&"background"in t&&t.background instanceof g&&"foreground"in t&&t.foreground instanceof g}function Ci(t){return null!==t&&"object"==typeof t&&"text"in t&&"string"==typeof t.text}function Si(t){return null!==t&&"object"==typeof t&&"spans"in t&&Array.isArray(t.spans)&&t.spans.every((t=>"string"==typeof t||(t=>null!==t&&"object"==typeof t&&"text"in t&&"string"==typeof t.text)(t)))}function Ei(t){return!(null===t||"object"!=typeof t||"width"in t&&"number"!=typeof t.width||"height"in t&&"number"!=typeof t.height)}class ki{static fromDescription(t,i){const s=i instanceof Map?i.entries():Object.entries(i),n=new Map;for(const[i,r]of s){if(n.has(i))throw Error(`Duplicate element key "${i}" - each UI element must have a unique identifier`);let s;if(r instanceof g)s=new vi(t,r);else if(null!==(o=r)&&"object"==typeof o&&"texture"in o&&o.texture instanceof g)s=new vi(t,r.texture);else if("string"==typeof r)s=new bi(t,[r]);else if(xi(r))s=new wi(t,r.background,r.foreground);else if(Ci(r))s=new bi(t,[r.text],{defaultStyle:r.style});else if(Si(r))s=new bi(t,r.spans,{defaultStyle:r.defaultStyle});else{if(!Ei(r))throw Error(`Invalid UI element type for "${i}". Expected one of: Texture, UIImage, String, UITextDescription, or UITextEnhancedDescription`);s=new ci(t,r.width,r.height)}n.set(i,s)}var o;return Object.fromEntries(n)}}class Oi extends rt{constructor(t,i,s){var n,o,r;super(i.layer,new Set(t instanceof Ut?[t,i]:[i])),this.elementOne=t,this.elementTwo=i,Lt(t,i),this.parameters={isStrict:null!==(n=null==s?void 0:s.isStrict)&&void 0!==n?n:1,horizontalAnchor:null!==(o=null==s?void 0:s.horizontalAnchor)&&void 0!==o?o:.5,verticalAnchor:null!==(r=null==s?void 0:s.verticalAnchor)&&void 0!==r?r:.5,orientation:ot(null==s?void 0:s.orientation)},this.parameters.orientation!==tt.ALWAYS&&this.parameters.orientation!==this.layer.orientation||this.buildConstraints()}destroy(){this.destroyConstraints(),super.destroy()}[W](t){this.parameters.orientation!==tt.ALWAYS&&t!==this.parameters.orientation&&this.destroyConstraints()}[G](t){this.parameters.orientation!==tt.ALWAYS&&t===this.parameters.orientation&&this.buildConstraints()}buildConstraints(){this.constraintX=new P(new E(this.elementOne[U]).plus(new E(this.elementOne[B]).multiply(this.parameters.horizontalAnchor)),O.Eq,new E(this.elementTwo[U]).plus(new E(this.elementTwo[B]).multiply(this.parameters.horizontalAnchor))),this.constraintY=new P(new E(this.elementOne[j]).plus(new E(this.elementOne[H]).multiply(this.parameters.verticalAnchor)),O.Eq,new E(this.elementTwo[j]).plus(new E(this.elementTwo[H]).multiply(this.parameters.verticalAnchor))),this.constraintW=new P(new E(this.elementOne[B]),O.Ge,new E(this.elementTwo[B])),this.constraintH=new P(new E(this.elementOne[H]),O.Ge,new E(this.elementTwo[H])),this.layer[_](this,this.constraintX),this.layer[_](this,this.constraintY),this.layer[_](this,this.constraintW),this.layer[_](this,this.constraintH),0!=this.parameters.isStrict&&(this.constraintStrict=new P(new E(this.elementOne[H]),O.Eq,new E(this.elementTwo[H]),T.strong),this.layer[_](this,this.constraintStrict))}destroyConstraints(){this.constraintX&&(this.layer[N](this,this.constraintX),this.constraintX=void 0),this.constraintY&&(this.layer[N](this,this.constraintY),this.constraintY=void 0),this.constraintW&&(this.layer[N](this,this.constraintW),this.constraintW=void 0),this.constraintH&&(this.layer[N](this,this.constraintH),this.constraintH=void 0),this.constraintStrict&&(this.layer[N](this,this.constraintStrict),this.constraintStrict=void 0)}}(t=>{t.AUTO="AUTO",t.PROPERTY="PROPERTY",t.MANUAL="MANUAL"})(Vt||(Vt={}));const Ti=Vt.PROPERTY;class Mi extends Ut{constructor(t,i={}){var s,n,o,r,l,v,f,w,p,g;const y=null!==(s=i.resolutionFactor)&&void 0!==s?s:.5;if(y<.1||y>8)throw Error(`Invalid resolution factor: ${y}. Must be between 0.1 and 8.`);const b=null!==(n=i.width)&&void 0!==n?n:512,x=null!==(o=i.height)&&void 0!==o?o:512;Kt(b,x,`Invalid width or height: ${b}x${x}. Must be positive.`);const C=new u(b*y,x*y,{format:c,minFilter:d,magFilter:d,type:a,depthBuffer:null!==(r=i.useDepth)&&void 0!==r?r:1,stencilBuffer:0}),S=new bt(C.texture);super(t,new h(xt,S),0,0,b,x),this.needsRenderInternal=0,this.sceneInternal=null!==(l=i.scene)&&void 0!==l?l:new e,this.cameraInternal=null!==(v=i.camera)&&void 0!==v?v:new m(75,b/x,.1,100),this.resolutionFactorInternal=y,this.updateBehaviorInternal=null!==(f=i.updateBehavior)&&void 0!==f?f:Ti,null!==(w=i.renderedByDefault)&&void 0!==w&&w&&(this.needsRenderInternal=1),this.clearColorInternal=null!==(p=i.clearColor)&&void 0!==p?p:0,this.clearAlphaInternal=null!==(g=i.clearAlpha)&&void 0!==g?g:0,this.renderTarget=C,this.material=S,this.flushTransform()}get needsRender(){return this.needsRenderInternal}get color(){return this.material.getColor()}get opacity(){return this.material.getOpacity()}get scene(){return this.sceneInternal}get camera(){return this.cameraInternal}get clearColor(){return this.clearColorInternal}get clearAlpha(){return this.clearAlphaInternal}get resolutionFactor(){return this.resolutionFactorInternal}set color(t){this.material.setColor(t),this.composer.requestUpdate()}set opacity(t){this.material.setOpacity(t),this.composer.requestUpdate()}set scene(t){this.sceneInternal!==t&&(this.sceneInternal=t,this.updateBehaviorInternal===Vt.PROPERTY&&this.requestRender())}set camera(t){this.cameraInternal!==t&&(this.cameraInternal=t,this.updateBehaviorInternal===Vt.PROPERTY&&this.requestRender())}set clearColor(t){this.clearColorInternal!==t&&(this.clearColorInternal=t,this.updateBehaviorInternal===Vt.PROPERTY&&this.requestRender())}set clearAlpha(t){this.clearAlphaInternal!==t&&(this.clearAlphaInternal=t,this.updateBehaviorInternal===Vt.PROPERTY&&this.requestRender())}set resolutionFactor(t){this.resolutionFactorInternal!==t&&(this.resolutionFactorInternal=t,this.renderTarget.setSize(this.width*this.resolutionFactorInternal,this.height*this.resolutionFactorInternal),this.updateBehaviorInternal===Vt.PROPERTY&&this.requestRender())}destroy(){this.material.dispose(),this.renderTarget.dispose(),super.destroy()}requestRender(){this.needsRenderInternal=1,this.composer.requestUpdate()}[J](t){(this.needsRenderInternal||this.updateBehaviorInternal===Vt.AUTO)&&(this[Q]&&this.renderTarget.setSize(this.width*this.resolutionFactorInternal,this.height*this.resolutionFactorInternal),this.needsRenderInternal=0,t.setClearColor(this.clearColorInternal,this.clearAlpha),t.setRenderTarget(this.renderTarget),t.clear(1,1,0),t.render(this.sceneInternal,this.cameraInternal)),this.object.material=this.composer.compose(t,this.width*this.resolutionFactorInternal,this.height*this.resolutionFactorInternal,this.material),this.flushTransform()}}class Pi extends Rt{constructor(){super(),this.targetScreenHeight=1920,this.onResize=()=>{const t=this.calculateScale();this.resizeInternal(window.innerWidth*t,window.innerHeight*t)},this.onClick=t=>{if(this.behavior!==pt.INTERACTIVE)return;const i=t.target instanceof HTMLElement?t.target.getBoundingClientRect():null,s=i?t.clientX-i.left:t.clientX,n=i?i.bottom-t.clientY:window.innerHeight-t.clientY,o=this.calculateScale();this.clickInternal(s*o,n*o)},window.addEventListener("resize",this.onResize),window.addEventListener("pointerdown",this.onClick),this.onResize()}get tergetScreenHeight(){return this.targetScreenHeight}set tergetScreenHeight(t){this.targetScreenHeight=t,this.resizeInternal(window.innerWidth,window.innerHeight)}destroy(){window.removeEventListener("resize",this.onResize),window.removeEventListener("pointerdown",this.onClick),super.destroy()}calculateScale(){var t;return(null!==(t=this.tergetScreenHeight)&&void 0!==t?t:window.innerHeight)/window.innerHeight}}class Ii extends Rt{click(t,i){this.clickInternal(t,i)}resize(t,i){this.resizeInternal(t,i)}}class $i{}export{Gt as UIAspectConstraint,pt as UIBehavior,Wt as UIConstraint2DBuilder,ui as UIConstraintBuilder,ai as UIConstraintContainerBuilder,Ht as UIConstraintContainerDirection,it as UIConstraintPower,st as UIConstraintRule,di as UIConstraintStackBuilder,Qt as UICoverConstraint,ci as UIDummy,ki as UIElementBuilder,$t as UIElementEvent,Oi as UIFitConstraint,Pi as UIFullScreenLayer,Et as UIFullScreenQuad,ct as UIHeightConstraint,_t as UIHorizontalDistanceConstraint,Nt as UIHorizontalProportionConstraint,vi as UIImage,Bt as UILayerEvent,Ii as UIManualLayer,tt as UIOrientation,$i as UIPass,wi as UIProgress,Mi as UIScene,Vt as UISceneUpdateBehavior,bi as UIText,Xt as UIVerticalDistanceConstraint,Yt as UIVerticalProportionConstraint,qt as UIWidthConstraint};
2
2
  //# sourceMappingURL=index.js.map