1/*! For license information please see cocos_worker.js.LICENSE.txt */
2var _050c3e31727995d1749ba30b8ad948d6;
3
4() => {
5  var t = {
6    991: function(t, e, i) {
7      "use strict";
8      var s = this && this.__importDefault || function(t) {
9        return t && t.__esModule ? t : {
10          default: t
11        };
12      };
13      Object.defineProperty(e, "__esModule", {
14        value: !0
15      });
16      e.launchEngine = e.loadModule = void 0;
17      const n = s(i(582));
18      const r = {
19        "/src/application.js"() {
20          i(915);
21        },
22        "/src/chunks/bundle.js"() {
23          i(513);
24        },
25        "/src/cocos-js/cc.js"() {
26          i(61);
27        },
28        "assets/internal/index.js"() {
29          i(390);
30        },
31        "assets/main/index.js"() {
32          i(289);
33        }
34      };
35      function o(t) {
36        const e = r[t];
37        null == e || e();
38      }
39      e.loadModule = o;
40      const a = {};
41      console.time = function(t) {
42        a[t] = Date.now();
43      };
44      console.timeEnd = function(t) {
45        console.log(t + " " + (Date.now() - a[t]));
46        delete a[t];
47      };
48      e.launchEngine = function() {
49        return new Promise(((t, e) => {
50          window.global = window;
51          i(935)().then((() => {
52            window.oh.loadModule = o;
53            try {
54              i(693);
55            } catch (t) {
56              console.error("error in builtin ", t.stack, t.message);
57            }
58            i(457);
59            System.warmup({
60              importMap: n.default,
61              importMapUrl: "./src/import-map.js",
62              defaultHandler: t => {
63                console.info("urlNoSchema ", t);
64                o(t);
65              }
66            });
67            System.import("./src/application.js").then((({Application: t}) => new t)).then((t => {
68              System.import("cc").then((e => {
69                i(48);
70                e.macro.CLEANUP_IMAGE_CACHE = !1;
71                return t.init(e);
72              })).then((() => t.start())).catch((t => {
73                console.log("error in importing cc " + t.stack);
74              }));
75            })).catch((t => {
76              console.error("imported failed", t.message, t.stack);
77              e(t);
78            }));
79          }));
80        }));
81      };
82    },
83    31: (t, e) => {
84      "use strict";
85      Object.defineProperty(e, "__esModule", {
86        value: !0
87      });
88      e.Constants = e.ContextType = void 0;
89      !function(t) {
90        t[t.APP_LIFECYCLE = 0] = "APP_LIFECYCLE";
91        t[t.JSPAGE_LIFECYCLE = 1] = "JSPAGE_LIFECYCLE";
92        t[t.XCOMPONENT_CONTEXT = 2] = "XCOMPONENT_CONTEXT";
93        t[t.XCOMPONENT_REGISTER_LIFECYCLE_CALLBACK = 3] = "XCOMPONENT_REGISTER_LIFECYCLE_CALLBACK";
94        t[t.NATIVE_RENDER_API = 4] = "NATIVE_RENDER_API";
95        t[t.WORKER_INIT = 5] = "WORKER_INIT";
96        t[t.ENGINE_UTILS = 6] = "ENGINE_UTILS";
97        t[t.UV_ASYNC_SEND = 7] = "UV_ASYNC_SEND";
98      }(e.ContextType || (e.ContextType = {}));
99      class i {}
100      e.Constants = i;
101      i.APP_KEY_WORKER_MANAGER = "app_key_worker_manager";
102    },
103    565: function(t, e, i) {
104      "use strict";
105      this && this.__importDefault;
106      Object.defineProperty(e, "__esModule", {
107        value: !0
108      });
109      var s = globalThis.requireNapi("worker") || (isSystemplugin("worker", "ohos") ? globalThis.ohosplugin.worker : isSystemplugin("worker", "system") ? globalThis.systemplugin.worker : void 0);
110      var n = globalThis.requireNapi("cocos", !0);
111      const r = i(31);
112      const o = i(991);
113      n.getContext(r.ContextType.WORKER_INIT).workerInit();
114      s.parentPort.onmessage = function(t) {
115        if ("onXCLoad" === t.data.type) {
116          const t = n.getContext(r.ContextType.NATIVE_RENDER_API);
117          t.nativeEngineInit();
118          o.launchEngine().then((() => {
119            console.info("launch CC engien finished");
120          })).catch((t => {
121            console.error("launch CC engien failed");
122          }));
123          t.nativeEngineStart();
124        } else console.error("cocos worker: message type unknown");
125      };
126    },
127    390: () => {
128      "use strict";
129      System.register("chunks:///_virtual/internal", [], (function() {
130        return {
131          execute: function() {}
132        };
133      }));
134      t = "virtual:///prerequisite-imports/internal", e = "chunks:///_virtual/internal",
135      System.register(t, [ e ], (function(t, e) {
136        return {
137          setters: [ function(e) {
138            var i = {};
139            for (var s in e) "default" !== s && "__esModule" !== s && (i[s] = e[s]);
140            t(i);
141          } ],
142          execute: function() {}
143        };
144      }));
145      var t, e;
146    },
147    289: () => {
148      "use strict";
149      System.register("chunks:///_virtual/AudioManager.ts", [ "./rollupPluginModLoBabelHelpers.js", "cc" ], (function(t) {
150        var e, i, s, n, r, o, a;
151        return {
152          setters: [ function(t) {
153            e = t.applyDecoratedDescriptor;
154            i = t.initializerDefineProperty;
155          }, function(t) {
156            s = t.cclegacy;
157            n = t.AudioClip;
158            r = t._decorator;
159            o = t.Component;
160            a = t.AudioSource;
161          } ],
162          execute: function() {
163            var l, h, c, u, _;
164            s._RF.push({}, "cf05c4BsxJE975rw6fkExNU", "AudioManager", void 0);
165            const {ccclass: d, property: p} = r;
166            t("AudioManager", (l = d("AudioManager"), h = p([ n ]), l(c = (_ = e((u = class extends o {
167              constructor(...t) {
168                super(...t);
169                i(this, "audioList", _, this);
170                this._dict = {};
171                this._audioSource = null;
172              }
173              start() {
174                for (let t = 0; t < this.audioList.length; t++) {
175                  const e = this.audioList[t];
176                  this._dict[e.name] = e;
177                }
178                this._audioSource = this.getComponent(a);
179              }
180              play(t) {
181                const e = this._dict[t];
182                void 0 !== e && this._audioSource.playOneShot(e);
183              }
184            }).prototype, "audioList", [ h ], {
185              configurable: !0,
186              enumerable: !0,
187              writable: !0,
188              initializer: function() {
189                return [];
190              }
191            }), u)) || c));
192            s._RF.pop();
193          }
194        };
195      }));
196      System.register("chunks:///_virtual/Bullet.ts", [ "cc", "./Constant.ts", "./PoolManager.ts" ], (function(t) {
197        var e, i, s, n, r, o;
198        return {
199          setters: [ function(t) {
200            e = t.cclegacy;
201            i = t.Component;
202            s = t.Collider;
203            n = t._decorator;
204          }, function(t) {
205            r = t.Constant;
206          }, function(t) {
207            o = t.PoolManager;
208          } ],
209          execute: function() {
210            var a;
211            e._RF.push({}, "016d0bZIrlBGY2GbVGZZg1M", "Bullet", void 0);
212            const {ccclass: l, property: h} = n;
213            t("Bullet", l("Bullet")(a = class extends i {
214              constructor(...t) {
215                super(...t);
216                this._bulletSpeed = 0;
217                this._direction = r.Direction.MIDDLE;
218                this._isEnemyBullet = !1;
219              }
220              onEnable() {
221                this.getComponent(s).on("onTriggerEnter", this._onTriggerEnter, this);
222              }
223              onDisable() {
224                this.getComponent(s).off("onTriggerEnter", this._onTriggerEnter, this);
225              }
226              update(t) {
227                const e = this.node.position;
228                let i = 0;
229                if (this._isEnemyBullet) {
230                  i = e.z + this._bulletSpeed;
231                  this.node.setPosition(e.x, e.y, i);
232                  i > 50 && o.instance().putNode(this.node);
233                } else {
234                  i = e.z - this._bulletSpeed;
235                  this._direction === r.Direction.LEFT ? this.node.setPosition(e.x - .2 * this._bulletSpeed, e.y, i) : this._direction === r.Direction.RIGHT ? this.node.setPosition(e.x + .2 * this._bulletSpeed, e.y, i) : this.node.setPosition(e.x, e.y, i);
236                  i < -50 && o.instance().putNode(this.node);
237                }
238              }
239              show(t, e, i = r.Direction.MIDDLE) {
240                this._bulletSpeed = t;
241                this._isEnemyBullet = e;
242                this._direction = i;
243              }
244              _onTriggerEnter(t) {
245                o.instance().putNode(this.node);
246              }
247            }) || a);
248            e._RF.pop();
249          }
250        };
251      }));
252      System.register("chunks:///_virtual/BulletProp.ts", [ "cc", "./Constant.ts", "./PoolManager.ts" ], (function(t) {
253        var e, i, s, n, r, o;
254        return {
255          setters: [ function(t) {
256            e = t.cclegacy;
257            i = t.Component;
258            s = t.Collider;
259            n = t._decorator;
260          }, function(t) {
261            r = t.Constant;
262          }, function(t) {
263            o = t.PoolManager;
264          } ],
265          execute: function() {
266            var a;
267            e._RF.push({}, "83e2f0O6xJMU7LXZMbv8Q8U", "BulletProp", void 0);
268            const {ccclass: l, property: h} = n;
269            t("BulletProp", l("BulletProp")(a = class extends i {
270              constructor(...t) {
271                super(...t);
272                this._propSpeed = .3;
273                this._propXSpeed = .3;
274                this._gameManager = null;
275              }
276              onEnable() {
277                this.getComponent(s).on("onTriggerEnter", this._onTriggerEnter, this);
278              }
279              onDisable() {
280                this.getComponent(s).off("onTriggerEnter", this._onTriggerEnter, this);
281              }
282              update(t) {
283                let e = this.node.position;
284                e.x >= 15 ? this._propXSpeed = this._propSpeed : e.x <= -15 && (this._propXSpeed = -this._propSpeed);
285                this.node.setPosition(e.x + this._propXSpeed, e.y, e.z - this._propSpeed);
286                e = this.node.position;
287                e.z > 50 && o.instance().putNode(this.node);
288              }
289              show(t, e) {
290                this._gameManager = t;
291                this._propSpeed = e;
292              }
293              _onTriggerEnter(t) {
294                const e = t.selfCollider.node.name;
295                "bulletH" === e ? this._gameManager.changeBulletType(r.BulletPropType.BULLET_H) : "bulletS" === e ? this._gameManager.changeBulletType(r.BulletPropType.BULLET_S) : this._gameManager.changeBulletType(r.BulletPropType.BULLET_M);
296                o.instance().putNode(this.node);
297              }
298            }) || a);
299            e._RF.pop();
300          }
301        };
302      }));
303      System.register("chunks:///_virtual/Constant.ts", [ "cc" ], (function(t) {
304        var e;
305        return {
306          setters: [ function(t) {
307            e = t.cclegacy;
308          } ],
309          execute: function() {
310            e._RF.push({}, "9ba7ak0TVBK4bJaIq49qiJK", "Constant", void 0);
311            class i {}
312            t("Constant", i);
313            i.EnemyType = {
314              TYPE1: 1,
315              TYPE2: 2
316            };
317            i.Combination = {
318              PLAN1: 1,
319              PLAN2: 2,
320              PLAN3: 3
321            };
322            i.CollisionType = {
323              SELF_PLANE: 2,
324              ENEMY_PLANE: 4,
325              SELF_BULLET: 8,
326              ENEMY_BULLET: 16,
327              BULLET_PROP: 32
328            };
329            i.BulletPropType = {
330              BULLET_M: 1,
331              BULLET_H: 2,
332              BULLET_S: 3
333            };
334            i.Direction = {
335              LEFT: 1,
336              MIDDLE: 2,
337              RIGHT: 3
338            };
339            e._RF.pop();
340          }
341        };
342      }));
343      System.register("chunks:///_virtual/EnemyPlane.ts", [ "./rollupPluginModLoBabelHelpers.js", "cc", "./Constant.ts", "./PoolManager.ts" ], (function(t) {
344        var e, i, s, n, r, o, a, l;
345        return {
346          setters: [ function(t) {
347            e = t.applyDecoratedDescriptor;
348            i = t.initializerDefineProperty;
349          }, function(t) {
350            s = t.cclegacy;
351            n = t._decorator;
352            r = t.Component;
353            o = t.Collider;
354          }, function(t) {
355            a = t.Constant;
356          }, function(t) {
357            l = t.PoolManager;
358          } ],
359          execute: function() {
360            var h, c, u;
361            s._RF.push({}, "e4b84GYhj9IHoWH4mrALeYo", "EnemyPlane", void 0);
362            const {ccclass: _, property: d} = n;
363            t("EnemyPlane", _("EnemyPlane")(h = (u = e((c = class extends r {
364              constructor(...t) {
365                super(...t);
366                i(this, "createBulletTime", u, this);
367                this._enemySpeed = 0;
368                this._needBullet = !1;
369                this._gameManager = null;
370                this._currCreateBulletTime = 0;
371              }
372              onEnable() {
373                this.getComponent(o).on("onTriggerEnter", this._onTriggerEnter, this);
374              }
375              onDisable() {
376                this.getComponent(o).off("onTriggerEnter", this._onTriggerEnter, this);
377              }
378              update(t) {
379                const e = this.node.position;
380                const i = e.z + this._enemySpeed;
381                this.node.setPosition(e.x, e.y, i);
382                if (this._needBullet) {
383                  this._currCreateBulletTime += t;
384                  if (this._currCreateBulletTime > this.createBulletTime) {
385                    this._gameManager.createEnemyBullet(this.node.position);
386                    this._currCreateBulletTime = 0;
387                  }
388                }
389                i > 50 && l.instance().putNode(this.node);
390              }
391              show(t, e, i) {
392                this._gameManager = t;
393                this._enemySpeed = e;
394                this._needBullet = i;
395              }
396              _onTriggerEnter(t) {
397                const e = t.otherCollider.getGroup();
398                if (e === a.CollisionType.SELF_PLANE || e === a.CollisionType.SELF_BULLET) {
399                  this._gameManager.playAudioEffect("enemy");
400                  l.instance().putNode(this.node);
401                  this._gameManager.addScore();
402                  this._gameManager.createEnemyEffect(this.node.position);
403                }
404              }
405            }).prototype, "createBulletTime", [ d ], {
406              configurable: !0,
407              enumerable: !0,
408              writable: !0,
409              initializer: function() {
410                return .5;
411              }
412            }), c)) || h);
413            s._RF.pop();
414          }
415        };
416      }));
417      System.register("chunks:///_virtual/Explode.ts", [ "cc", "./PoolManager.ts" ], (function(t) {
418        var e, i, s, n;
419        return {
420          setters: [ function(t) {
421            e = t.cclegacy;
422            i = t.Component;
423            s = t._decorator;
424          }, function(t) {
425            n = t.PoolManager;
426          } ],
427          execute: function() {
428            var r;
429            e._RF.push({}, "aa341Z9YJdBX5Rd640Hxh42", "Explode", void 0);
430            const {ccclass: o, property: a} = s;
431            t("Explode", o("Explode")(r = class extends i {
432              onEnable() {
433                this.scheduleOnce(this._putBack, 1);
434              }
435              _putBack() {
436                n.instance().putNode(this.node);
437              }
438            }) || r);
439            e._RF.pop();
440          }
441        };
442      }));
443      System.register("chunks:///_virtual/GameManager.ts", [ "./rollupPluginModLoBabelHelpers.js", "cc", "./Bullet.ts", "./BulletProp.ts", "./EnemyPlane.ts", "./SelfPlane.ts", "./AudioManager.ts", "./Constant.ts", "./PoolManager.ts" ], (function(t) {
444        var e, i, s, n, r, o, a, l, h, c, u, _, d, p, m, f, g, y, b;
445        return {
446          setters: [ function(t) {
447            e = t.applyDecoratedDescriptor;
448            i = t.initializerDefineProperty;
449          }, function(t) {
450            s = t.cclegacy;
451            n = t.Prefab;
452            r = t.Node;
453            o = t.Label;
454            a = t.Animation;
455            l = t._decorator;
456            h = t.Component;
457            c = t.math;
458            u = t.BoxCollider;
459            _ = t.macro;
460          }, function(t) {
461            d = t.Bullet;
462          }, function(t) {
463            p = t.BulletProp;
464          }, function(t) {
465            m = t.EnemyPlane;
466          }, function(t) {
467            f = t.SelfPlane;
468          }, function(t) {
469            g = t.AudioManager;
470          }, function(t) {
471            y = t.Constant;
472          }, function(t) {
473            b = t.PoolManager;
474          } ],
475          execute: function() {
476            var S, A, T, v, E, C, x, w, R, I, M, B, D, P, O, N, L, F, V, k, U, G, z, H, j, X, W, Y, q, K, J, Z, Q, $, tt, et, it, st, nt, rt, ot, at, lt, ht, ct, ut, _t;
477            s._RF.push({}, "83611dElfRHkaQJyGfbjwko", "GameManager", void 0);
478            const {ccclass: dt, property: pt} = l;
479            t("GameManager", (S = dt("GameManager"), A = pt(f), T = pt(n), v = pt(n), E = pt(n),
480            C = pt(n), x = pt(n), w = pt(r), R = pt(n), I = pt(n), M = pt(n), B = pt(n), D = pt(n),
481            P = pt(n), O = pt(r), N = pt(r), L = pt(o), F = pt(o), V = pt(a), k = pt(g), S(U = (z = e((G = class extends h {
482              constructor(...t) {
483                super(...t);
484                i(this, "playerPlane", z, this);
485                i(this, "bullet01", H, this);
486                i(this, "bullet02", j, this);
487                i(this, "bullet03", X, this);
488                i(this, "bullet04", W, this);
489                i(this, "bullet05", Y, this);
490                i(this, "shootTime", q, this);
491                i(this, "bulletSpeed", K, this);
492                i(this, "bulletRoot", J, this);
493                i(this, "enemy01", Z, this);
494                i(this, "enemy02", Q, this);
495                i(this, "createEnemyTime", $, this);
496                i(this, "enemy1Speed", tt, this);
497                i(this, "enemy2Speed", et, this);
498                i(this, "enemyExplode", it, this);
499                i(this, "bulletPropM", st, this);
500                i(this, "bulletPropH", nt, this);
501                i(this, "bulletPropS", rt, this);
502                i(this, "bulletPropSpeed", ot, this);
503                i(this, "gamePage", at, this);
504                i(this, "gameOverPage", lt, this);
505                i(this, "gameScore", ht, this);
506                i(this, "gameOverScore", ct, this);
507                i(this, "overAnim", ut, this);
508                i(this, "audioEffect", _t, this);
509                this.isGameStart = !1;
510                this._currShootTime = 0;
511                this._isShooting = !1;
512                this._currCreateEnemyTime = 0;
513                this._combinationInterval = y.Combination.PLAN1;
514                this._bulletType = y.BulletPropType.BULLET_M;
515                this._score = 0;
516              }
517              start() {
518                this._init();
519              }
520              update(t) {
521                if (this.isGameStart) if (this.playerPlane.isDie) this.gameOver(); else {
522                  this._currShootTime += t;
523                  if (this._isShooting && this._currShootTime > this.shootTime) {
524                    this._bulletType === y.BulletPropType.BULLET_H ? this.createPlayerBulletH() : this._bulletType === y.BulletPropType.BULLET_S ? this.createPlayerBulletS() : this.createPlayerBulletM();
525                    const t = "bullet" + (this._bulletType % 2 + 1);
526                    this.playAudioEffect(t);
527                    this._currShootTime = 0;
528                  }
529                  this._currCreateEnemyTime += t;
530                  if (this._combinationInterval === y.Combination.PLAN1) {
531                    if (this._currCreateEnemyTime > this.createEnemyTime) {
532                      this.createEnemyPlane();
533                      this._currCreateEnemyTime = 0;
534                    }
535                  } else if (this._combinationInterval === y.Combination.PLAN2) {
536                    if (this._currCreateEnemyTime > 3 * this.createEnemyTime) {
537                      c.randomRangeInt(1, 3) === y.Combination.PLAN2 ? this.createCombination1() : this.createEnemyPlane();
538                      this._currCreateEnemyTime = 0;
539                    }
540                  } else if (this._currCreateEnemyTime > 2 * this.createEnemyTime) {
541                    const t = c.randomRangeInt(1, 4);
542                    t === y.Combination.PLAN2 ? this.createCombination1() : t === y.Combination.PLAN3 ? this.createCombination2() : this.createEnemyPlane();
543                    this._currCreateEnemyTime = 0;
544                  }
545                }
546              }
547              returnMain() {
548                this._currShootTime = 0;
549                this._currCreateEnemyTime = 0;
550                this._combinationInterval = y.Combination.PLAN1;
551                this._bulletType = y.BulletPropType.BULLET_M;
552                this.playerPlane.node.setPosition(0, 0, 15);
553                this._score = 0;
554              }
555              gameStart() {
556                this.isGameStart = !0;
557                this._changePlaneMode();
558                this._score = 0;
559                this.gameScore.string = this._score.toString();
560                this.playerPlane.init();
561              }
562              gameReStart() {
563                this.gameStart();
564                this._currShootTime = 0;
565                this._currCreateEnemyTime = 0;
566                this._combinationInterval = y.Combination.PLAN1;
567                this._bulletType = y.BulletPropType.BULLET_M;
568                this.playerPlane.node.setPosition(0, 0, 15);
569              }
570              gameOver() {
571                this.isGameStart = !1;
572                this.gamePage.active = !1;
573                this.gameOverPage.active = !0;
574                this.gameOverScore.string = this._score.toString();
575                this.overAnim.play();
576                this._isShooting = !1;
577                this.unschedule(this._modeChanged);
578                this._destroyAll();
579              }
580              addScore() {
581                this._score++;
582                this.gameScore.string = this._score.toString();
583              }
584              createPlayerBulletM() {
585                const t = b.instance().getNode(this.bullet01, this.bulletRoot);
586                const e = this.playerPlane.node.position;
587                t.setPosition(e.x, e.y, e.z - 7);
588                t.getComponent(d).show(this.bulletSpeed, !1);
589              }
590              createPlayerBulletH() {
591                const t = this.playerPlane.node.position;
592                const e = b.instance().getNode(this.bullet03, this.bulletRoot);
593                e.setPosition(t.x - 2.5, t.y, t.z - 7);
594                e.getComponent(d).show(this.bulletSpeed, !1);
595                const i = b.instance().getNode(this.bullet03, this.bulletRoot);
596                i.setPosition(t.x + 2.5, t.y, t.z - 7);
597                i.getComponent(d).show(this.bulletSpeed, !1);
598              }
599              createPlayerBulletS() {
600                const t = this.playerPlane.node.position;
601                const e = b.instance().getNode(this.bullet05, this.bulletRoot);
602                e.setPosition(t.x, t.y, t.z - 7);
603                e.getComponent(d).show(this.bulletSpeed, !1);
604                const i = b.instance().getNode(this.bullet05, this.bulletRoot);
605                i.setPosition(t.x - 4, t.y, t.z - 7);
606                i.getComponent(d).show(this.bulletSpeed, !1, y.Direction.LEFT);
607                const s = b.instance().getNode(this.bullet05, this.bulletRoot);
608                s.setPosition(t.x + 4, t.y, t.z - 7);
609                s.getComponent(d).show(this.bulletSpeed, !1, y.Direction.RIGHT);
610              }
611              createEnemyBullet(t) {
612                const e = b.instance().getNode(this.bullet02, this.bulletRoot);
613                e.setPosition(t.x, t.y, t.z + 6);
614                e.getComponent(d).show(1, !0);
615                const i = e.getComponent(u);
616                i.setGroup(y.CollisionType.ENEMY_BULLET);
617                i.setMask(y.CollisionType.SELF_PLANE);
618              }
619              createEnemyPlane() {
620                let t = null;
621                let e = 0;
622                if (c.randomRangeInt(1, 3) === y.EnemyType.TYPE1) {
623                  t = this.enemy01;
624                  e = this.enemy1Speed;
625                } else {
626                  t = this.enemy02;
627                  e = this.enemy2Speed;
628                }
629                const i = b.instance().getNode(t, this.node);
630                i.getComponent(m).show(this, e, !0);
631                const s = c.randomRangeInt(-25, 26);
632                i.setPosition(s, 0, -50);
633              }
634              createCombination1() {
635                const t = new Array(5);
636                for (let e = 0; e < t.length; e++) {
637                  t[e] = b.instance().getNode(this.enemy01, this.node);
638                  const i = t[e];
639                  i.setPosition(10 * e - 20, 0, -50);
640                  i.getComponent(m).show(this, this.enemy1Speed, !1);
641                }
642              }
643              createCombination2() {
644                const t = new Array(7);
645                const e = [ -21, 0, -60, -14, 0, -55, -7, 0, -50, 0, 0, -45, 7, 0, -50, 14, 0, -55, 21, 0, -60 ];
646                for (let i = 0; i < t.length; i++) {
647                  t[i] = b.instance().getNode(this.enemy02, this.node);
648                  const s = t[i];
649                  s.parent = this.node;
650                  const n = 3 * i;
651                  s.setPosition(e[n], e[n + 1], e[n + 2]);
652                  s.getComponent(m).show(this, this.enemy2Speed, !1);
653                }
654              }
655              createEnemyEffect(t) {
656                b.instance().getNode(this.enemyExplode, this.node).setPosition(t);
657              }
658              createBulletProp() {
659                const t = c.randomRangeInt(1, 4);
660                let e = null;
661                e = t === y.BulletPropType.BULLET_H ? this.bulletPropH : t === y.BulletPropType.BULLET_H ? this.bulletPropS : this.bulletPropM;
662                const i = b.instance().getNode(e, this.node);
663                i.setPosition(15, 0, -50);
664                i.getComponent(p).show(this, -this.bulletPropSpeed);
665              }
666              isShooting(t) {
667                this._isShooting = t;
668              }
669              changeBulletType(t) {
670                this._bulletType = t;
671              }
672              playAudioEffect(t) {
673                this.audioEffect.play(t);
674              }
675              _init() {
676                this._currShootTime = this.shootTime;
677                this.playerPlane.init();
678              }
679              _changePlaneMode() {
680                this.schedule(this._modeChanged, 10, _.REPEAT_FOREVER);
681              }
682              _modeChanged() {
683                this._combinationInterval++;
684                this.createBulletProp();
685              }
686              _destroyAll() {
687                let t = this.node.children;
688                let e = t.length;
689                let i = 0;
690                for (i = e - 1; i >= 0; i--) {
691                  const e = t[i];
692                  b.instance().putNode(e);
693                }
694                t = this.bulletRoot.children;
695                e = t.length;
696                for (i = e - 1; i >= 0; i--) {
697                  const e = t[i];
698                  b.instance().putNode(e);
699                }
700              }
701            }).prototype, "playerPlane", [ A ], {
702              configurable: !0,
703              enumerable: !0,
704              writable: !0,
705              initializer: function() {
706                return null;
707              }
708            }), H = e(G.prototype, "bullet01", [ T ], {
709              configurable: !0,
710              enumerable: !0,
711              writable: !0,
712              initializer: function() {
713                return null;
714              }
715            }), j = e(G.prototype, "bullet02", [ v ], {
716              configurable: !0,
717              enumerable: !0,
718              writable: !0,
719              initializer: function() {
720                return null;
721              }
722            }), X = e(G.prototype, "bullet03", [ E ], {
723              configurable: !0,
724              enumerable: !0,
725              writable: !0,
726              initializer: function() {
727                return null;
728              }
729            }), W = e(G.prototype, "bullet04", [ C ], {
730              configurable: !0,
731              enumerable: !0,
732              writable: !0,
733              initializer: function() {
734                return null;
735              }
736            }), Y = e(G.prototype, "bullet05", [ x ], {
737              configurable: !0,
738              enumerable: !0,
739              writable: !0,
740              initializer: function() {
741                return null;
742              }
743            }), q = e(G.prototype, "shootTime", [ pt ], {
744              configurable: !0,
745              enumerable: !0,
746              writable: !0,
747              initializer: function() {
748                return .3;
749              }
750            }), K = e(G.prototype, "bulletSpeed", [ pt ], {
751              configurable: !0,
752              enumerable: !0,
753              writable: !0,
754              initializer: function() {
755                return 1;
756              }
757            }), J = e(G.prototype, "bulletRoot", [ w ], {
758              configurable: !0,
759              enumerable: !0,
760              writable: !0,
761              initializer: function() {
762                return null;
763              }
764            }), Z = e(G.prototype, "enemy01", [ R ], {
765              configurable: !0,
766              enumerable: !0,
767              writable: !0,
768              initializer: function() {
769                return null;
770              }
771            }), Q = e(G.prototype, "enemy02", [ I ], {
772              configurable: !0,
773              enumerable: !0,
774              writable: !0,
775              initializer: function() {
776                return null;
777              }
778            }), $ = e(G.prototype, "createEnemyTime", [ pt ], {
779              configurable: !0,
780              enumerable: !0,
781              writable: !0,
782              initializer: function() {
783                return 1;
784              }
785            }), tt = e(G.prototype, "enemy1Speed", [ pt ], {
786              configurable: !0,
787              enumerable: !0,
788              writable: !0,
789              initializer: function() {
790                return .5;
791              }
792            }), et = e(G.prototype, "enemy2Speed", [ pt ], {
793              configurable: !0,
794              enumerable: !0,
795              writable: !0,
796              initializer: function() {
797                return .7;
798              }
799            }), it = e(G.prototype, "enemyExplode", [ M ], {
800              configurable: !0,
801              enumerable: !0,
802              writable: !0,
803              initializer: function() {
804                return null;
805              }
806            }), st = e(G.prototype, "bulletPropM", [ B ], {
807              configurable: !0,
808              enumerable: !0,
809              writable: !0,
810              initializer: function() {
811                return null;
812              }
813            }), nt = e(G.prototype, "bulletPropH", [ D ], {
814              configurable: !0,
815              enumerable: !0,
816              writable: !0,
817              initializer: function() {
818                return null;
819              }
820            }), rt = e(G.prototype, "bulletPropS", [ P ], {
821              configurable: !0,
822              enumerable: !0,
823              writable: !0,
824              initializer: function() {
825                return null;
826              }
827            }), ot = e(G.prototype, "bulletPropSpeed", [ pt ], {
828              configurable: !0,
829              enumerable: !0,
830              writable: !0,
831              initializer: function() {
832                return .3;
833              }
834            }), at = e(G.prototype, "gamePage", [ O ], {
835              configurable: !0,
836              enumerable: !0,
837              writable: !0,
838              initializer: function() {
839                return null;
840              }
841            }), lt = e(G.prototype, "gameOverPage", [ N ], {
842              configurable: !0,
843              enumerable: !0,
844              writable: !0,
845              initializer: function() {
846                return null;
847              }
848            }), ht = e(G.prototype, "gameScore", [ L ], {
849              configurable: !0,
850              enumerable: !0,
851              writable: !0,
852              initializer: function() {
853                return null;
854              }
855            }), ct = e(G.prototype, "gameOverScore", [ F ], {
856              configurable: !0,
857              enumerable: !0,
858              writable: !0,
859              initializer: function() {
860                return null;
861              }
862            }), ut = e(G.prototype, "overAnim", [ V ], {
863              configurable: !0,
864              enumerable: !0,
865              writable: !0,
866              initializer: function() {
867                return null;
868              }
869            }), _t = e(G.prototype, "audioEffect", [ k ], {
870              configurable: !0,
871              enumerable: !0,
872              writable: !0,
873              initializer: function() {
874                return null;
875              }
876            }), G)) || U));
877            s._RF.pop();
878          }
879        };
880      }));
881      System.register("chunks:///_virtual/main", [ "./Explode.ts", "./MovingSceneBg.ts", "./Bullet.ts", "./BulletProp.ts", "./AudioManager.ts", "./Constant.ts", "./GameManager.ts", "./PoolManager.ts", "./EnemyPlane.ts", "./SelfPlane.ts", "./UIMain.ts" ], (function() {
882        return {
883          setters: [ null, null, null, null, null, null, null, null, null, null, null ],
884          execute: function() {}
885        };
886      }));
887      System.register("chunks:///_virtual/MovingSceneBg.ts", [ "./rollupPluginModLoBabelHelpers.js", "cc" ], (function(t) {
888        var e, i, s, n, r, o;
889        return {
890          setters: [ function(t) {
891            e = t.applyDecoratedDescriptor;
892            i = t.initializerDefineProperty;
893          }, function(t) {
894            s = t.cclegacy;
895            n = t.Node;
896            r = t._decorator;
897            o = t.Component;
898          } ],
899          execute: function() {
900            var a, l, h, c, u, _, d;
901            s._RF.push({}, "96ab9fWUgFHu4WZkXRj7lzH", "MovingSceneBg", void 0);
902            const {ccclass: p, property: m} = r;
903            t("MovingSceneBg", (a = p("MovingSceneBg"), l = m(n), h = m(n), a(c = (_ = e((u = class extends o {
904              constructor(...t) {
905                super(...t);
906                i(this, "bg01", _, this);
907                i(this, "bg02", d, this);
908                this._bgSpeed = 10;
909                this._bgMovingRange = 90;
910              }
911              start() {
912                this._init();
913              }
914              update(t) {
915                this._moveBackground(t);
916              }
917              _init() {
918                this.bg01.setPosition(0, 0, 0);
919                this.bg02.setPosition(0, 0, -this._bgMovingRange);
920              }
921              _moveBackground(t) {
922                this.bg01.setPosition(0, 0, this.bg01.position.z + this._bgSpeed * t);
923                this.bg02.setPosition(0, 0, this.bg02.position.z + this._bgSpeed * t);
924                this.bg01.position.z > this._bgMovingRange ? this.bg01.setPosition(0, 0, this.bg02.position.z - this._bgMovingRange) : this.bg02.position.z > this._bgMovingRange && this.bg02.setPosition(0, 0, this.bg01.position.z - this._bgMovingRange);
925              }
926            }).prototype, "bg01", [ l ], {
927              configurable: !0,
928              enumerable: !0,
929              writable: !0,
930              initializer: function() {
931                return null;
932              }
933            }), d = e(u.prototype, "bg02", [ h ], {
934              configurable: !0,
935              enumerable: !0,
936              writable: !0,
937              initializer: function() {
938                return null;
939              }
940            }), u)) || c));
941            s._RF.pop();
942          }
943        };
944      }));
945      System.register("chunks:///_virtual/PoolManager.ts", [ "cc" ], (function(t) {
946        var e, i, s, n;
947        return {
948          setters: [ function(t) {
949            e = t.cclegacy;
950            i = t._decorator;
951            s = t.instantiate;
952            n = t.NodePool;
953          } ],
954          execute: function() {
955            var r, o;
956            e._RF.push({}, "f490aFvLS9C/bqwLGmSZgIL", "PoolManager", void 0);
957            const {ccclass: a, property: l} = i;
958            t("PoolManager", a("PoolManager")(r = (o = class t {
959              constructor() {
960                this._dictPool = {};
961                this._dictPrefab = {};
962              }
963              static instance() {
964                this._instance || (this._instance = new t);
965                return this._instance;
966              }
967              getNode(t, e) {
968                let i = t.data.name;
969                let r = null;
970                this._dictPrefab[i] = t;
971                const o = this._dictPool[i];
972                if (o) r = o.size() > 0 ? o.get() : s(t); else {
973                  this._dictPool[i] = new n;
974                  r = s(t);
975                }
976                r.parent = e;
977                r.active = !0;
978                return r;
979              }
980              putNode(t) {
981                let e = t.name;
982                t.parent = null;
983                this._dictPool[e] || (this._dictPool[e] = new n);
984                this._dictPool[e].put(t);
985              }
986            }, o._instance = void 0, o)) || r);
987            e._RF.pop();
988          }
989        };
990      }));
991      System.register("chunks:///_virtual/SelfPlane.ts", [ "./rollupPluginModLoBabelHelpers.js", "cc", "./Constant.ts" ], (function(t) {
992        var e, i, s, n, r, o, a, l, h;
993        return {
994          setters: [ function(t) {
995            e = t.applyDecoratedDescriptor;
996            i = t.initializerDefineProperty;
997          }, function(t) {
998            s = t.cclegacy;
999            n = t.Node;
1000            r = t._decorator;
1001            o = t.Component;
1002            a = t.AudioSource;
1003            l = t.Collider;
1004          }, function(t) {
1005            h = t.Constant;
1006          } ],
1007          execute: function() {
1008            var c, u, _, d, p, m, f, g, y;
1009            s._RF.push({}, "c839482eSFDR5T6mXfibPxw", "SelfPlane", void 0);
1010            const {ccclass: b, property: S} = r;
1011            t("SelfPlane", (c = b("SelfPlane"), u = S(n), _ = S(n), d = S(n), c(p = (f = e((m = class extends o {
1012              constructor(...t) {
1013                super(...t);
1014                i(this, "explode", f, this);
1015                i(this, "bloodFace", g, this);
1016                i(this, "blood", y, this);
1017                this.lifeValue = 5;
1018                this.isDie = !1;
1019                this._currLife = 0;
1020                this._audioEffect = null;
1021              }
1022              start() {
1023                this._audioEffect = this.getComponent(a);
1024              }
1025              onEnable() {
1026                this.getComponent(l).on("onTriggerEnter", this._onTriggerEnter, this);
1027              }
1028              onDisable() {
1029                this.getComponent(l).off("onTriggerEnter", this._onTriggerEnter, this);
1030              }
1031              init() {
1032                this._currLife = this.lifeValue;
1033                this.isDie = !1;
1034                this.explode.active = !1;
1035                this.bloodFace.setScale(1, 1, 1);
1036              }
1037              _onTriggerEnter(t) {
1038                if (100 == t.otherCollider.material.friction) return;
1039                const e = t.otherCollider.getGroup();
1040                if (e === h.CollisionType.ENEMY_PLANE || e === h.CollisionType.ENEMY_BULLET) {
1041                  this._currLife === this.lifeValue && (this.blood.active = !0);
1042                  this._currLife--;
1043                  this.bloodFace.setScale(this._currLife / this.lifeValue, 1, 1);
1044                  if (this._currLife <= 0) {
1045                    this.isDie = !0;
1046                    this._audioEffect.play();
1047                    this.explode.active = !0;
1048                    this.blood.active = !1;
1049                    console.log("self plane is die");
1050                  }
1051                }
1052              }
1053            }).prototype, "explode", [ u ], {
1054              configurable: !0,
1055              enumerable: !0,
1056              writable: !0,
1057              initializer: function() {
1058                return null;
1059              }
1060            }), g = e(m.prototype, "bloodFace", [ _ ], {
1061              configurable: !0,
1062              enumerable: !0,
1063              writable: !0,
1064              initializer: function() {
1065                return null;
1066              }
1067            }), y = e(m.prototype, "blood", [ d ], {
1068              configurable: !0,
1069              enumerable: !0,
1070              writable: !0,
1071              initializer: function() {
1072                return null;
1073              }
1074            }), m)) || p));
1075            s._RF.pop();
1076          }
1077        };
1078      }));
1079      System.register("chunks:///_virtual/UIMain.ts", [ "./rollupPluginModLoBabelHelpers.js", "cc", "./GameManager.ts" ], (function(t) {
1080        var e, i, s, n, r, o, a, l;
1081        return {
1082          setters: [ function(t) {
1083            e = t.applyDecoratedDescriptor;
1084            i = t.initializerDefineProperty;
1085          }, function(t) {
1086            s = t.cclegacy;
1087            n = t.Node;
1088            r = t._decorator;
1089            o = t.Component;
1090            a = t.SystemEvent;
1091          }, function(t) {
1092            l = t.GameManager;
1093          } ],
1094          execute: function() {
1095            var h, c, u, _, d, p, m, f, g, y, b, S, A, T;
1096            s._RF.push({}, "e690bV0ZVNGGaTOefuPwiRP", "UIMain", void 0);
1097            const {ccclass: v, property: E} = r;
1098            t("UIMain", (h = v("UIMain"), c = E(n), u = E(l), _ = E(n), d = E(n), p = E(n),
1099            h(m = (g = e((f = class extends o {
1100              constructor(...t) {
1101                super(...t);
1102                i(this, "planeSpeed", g, this);
1103                i(this, "playerPlane", y, this);
1104                i(this, "gameManager", b, this);
1105                i(this, "gameStart", S, this);
1106                i(this, "game", A, this);
1107                i(this, "gameOver", T, this);
1108              }
1109              start() {
1110                this.node.on(a.EventType.TOUCH_START, this._touchStart, this);
1111                this.node.on(a.EventType.TOUCH_MOVE, this._touchMove, this);
1112                this.node.on(a.EventType.TOUCH_END, this._touchEnd, this);
1113                this.gameStart.active = !0;
1114              }
1115              reStart() {
1116                this.gameOver.active = !1;
1117                this.game.active = !0;
1118                this.gameManager.playAudioEffect("button");
1119                this.gameManager.gameReStart();
1120              }
1121              returnMain() {
1122                this.gameOver.active = !1;
1123                this.gameStart.active = !0;
1124                this.gameManager.playAudioEffect("button");
1125                this.gameManager.returnMain();
1126              }
1127              _touchStart(t, e) {
1128                if (this.gameManager.isGameStart) this.gameManager.isShooting(!0); else {
1129                  this.gameStart.active = !1;
1130                  this.game.active = !0;
1131                  this.gameManager.playAudioEffect("button");
1132                  this.gameManager.gameStart();
1133                }
1134              }
1135              _touchMove(t, e) {
1136                if (!this.gameManager.isGameStart) return;
1137                const i = t.getDelta();
1138                let s = this.playerPlane.position;
1139                this.playerPlane.setPosition(s.x + .01 * this.planeSpeed * i.x, s.y, s.z - .01 * this.planeSpeed * i.y);
1140              }
1141              _touchEnd(t, e) {
1142                this.gameManager.isGameStart && this.gameManager.isShooting(!1);
1143              }
1144            }).prototype, "planeSpeed", [ E ], {
1145              configurable: !0,
1146              enumerable: !0,
1147              writable: !0,
1148              initializer: function() {
1149                return 1;
1150              }
1151            }), y = e(f.prototype, "playerPlane", [ c ], {
1152              configurable: !0,
1153              enumerable: !0,
1154              writable: !0,
1155              initializer: function() {
1156                return null;
1157              }
1158            }), b = e(f.prototype, "gameManager", [ u ], {
1159              configurable: !0,
1160              enumerable: !0,
1161              writable: !0,
1162              initializer: function() {
1163                return null;
1164              }
1165            }), S = e(f.prototype, "gameStart", [ _ ], {
1166              configurable: !0,
1167              enumerable: !0,
1168              writable: !0,
1169              initializer: function() {
1170                return null;
1171              }
1172            }), A = e(f.prototype, "game", [ d ], {
1173              configurable: !0,
1174              enumerable: !0,
1175              writable: !0,
1176              initializer: function() {
1177                return null;
1178              }
1179            }), T = e(f.prototype, "gameOver", [ p ], {
1180              configurable: !0,
1181              enumerable: !0,
1182              writable: !0,
1183              initializer: function() {
1184                return null;
1185              }
1186            }), f)) || m));
1187            s._RF.pop();
1188          }
1189        };
1190      }));
1191      t = "virtual:///prerequisite-imports/main", e = "chunks:///_virtual/main", System.register(t, [ e ], (function(t, e) {
1192        return {
1193          setters: [ function(e) {
1194            var i = {};
1195            for (var s in e) "default" !== s && "__esModule" !== s && (i[s] = e[s]);
1196            t(i);
1197          } ],
1198          execute: function() {}
1199        };
1200      }));
1201      var t, e;
1202    },
1203    48: () => {
1204      "use strict";
1205      !function t(e, i, s) {
1206        function n(o, a) {
1207          if (!i[o]) {
1208            if (!e[o]) {
1209              if (r) return r(o, !0);
1210              var l = new Error("Cannot find module '" + o + "'");
1211              throw l.code = "MODULE_NOT_FOUND", l;
1212            }
1213            var h = i[o] = {
1214              exports: {}
1215            };
1216            e[o][0].call(h.exports, (function(t) {
1217              return n(e[o][1][t] || t);
1218            }), h, h.exports, t, e, i, s);
1219          }
1220          return i[o].exports;
1221        }
1222        for (var r = void 0, o = 0; o < s.length; o++) n(s[o]);
1223        return n;
1224      }({
1225        1: [ function(t, e, i) {
1226          t("./jsb-assets-manager.js");
1227          t("./jsb-game.js");
1228          t("./jsb-gfx.js");
1229          t("./jsb-loader.js");
1230          t("./jsb-videoplayer.js");
1231          t("./jsb-webview.js");
1232          t("./jsb-editbox.js");
1233          t("./jsb-editor-support.js");
1234          t("./jsb-spine-skeleton.js");
1235          t("./jsb-dragonbones.js");
1236          cc.physics && cc.physics.PhysicsSystem.PHYSICS_PHYSX && t("./jsb-physics.js");
1237        }, {
1238          "./jsb-assets-manager.js": 2,
1239          "./jsb-dragonbones.js": 4,
1240          "./jsb-editbox.js": 5,
1241          "./jsb-editor-support.js": 6,
1242          "./jsb-game.js": 8,
1243          "./jsb-gfx.js": 9,
1244          "./jsb-loader.js": 10,
1245          "./jsb-physics.js": 11,
1246          "./jsb-spine-skeleton.js": 12,
1247          "./jsb-videoplayer.js": 13,
1248          "./jsb-webview.js": 14
1249        } ],
1250        2: [ function(t, e, i) {
1251          if (jsb.AssetsManager) {
1252            jsb.AssetsManager.State = {
1253              UNINITED: 0,
1254              UNCHECKED: 1,
1255              PREDOWNLOAD_VERSION: 2,
1256              DOWNLOADING_VERSION: 3,
1257              VERSION_LOADED: 4,
1258              PREDOWNLOAD_MANIFEST: 5,
1259              DOWNLOADING_MANIFEST: 6,
1260              MANIFEST_LOADED: 7,
1261              NEED_UPDATE: 8,
1262              READY_TO_UPDATE: 9,
1263              UPDATING: 10,
1264              UNZIPPING: 11,
1265              UP_TO_DATE: 12,
1266              FAIL_TO_UPDATE: 13
1267            };
1268            jsb.Manifest.DownloadState = {
1269              UNSTARTED: 0,
1270              DOWNLOADING: 1,
1271              SUCCESSED: 2,
1272              UNMARKED: 3
1273            };
1274            jsb.EventAssetsManager.ERROR_NO_LOCAL_MANIFEST = 0;
1275            jsb.EventAssetsManager.ERROR_DOWNLOAD_MANIFEST = 1;
1276            jsb.EventAssetsManager.ERROR_PARSE_MANIFEST = 2;
1277            jsb.EventAssetsManager.NEW_VERSION_FOUND = 3;
1278            jsb.EventAssetsManager.ALREADY_UP_TO_DATE = 4;
1279            jsb.EventAssetsManager.UPDATE_PROGRESSION = 5;
1280            jsb.EventAssetsManager.ASSET_UPDATED = 6;
1281            jsb.EventAssetsManager.ERROR_UPDATING = 7;
1282            jsb.EventAssetsManager.UPDATE_FINISHED = 8;
1283            jsb.EventAssetsManager.UPDATE_FAILED = 9;
1284            jsb.EventAssetsManager.ERROR_DECOMPRESS = 10;
1285          }
1286        }, {} ],
1287        3: [ function(t, e, i) {
1288          const {getUserDataPath: s, readJsonSync: n, makeDirSync: r, writeFileSync: o, deleteFile: a, rmdirSync: l} = t("./jsb-fs-utils");
1289          var h = null;
1290          var c = !1;
1291          const u = /^\w+:\/\/.*/;
1292          var _ = {
1293            cacheDir: "gamecaches",
1294            cachedFileName: "cacheList.json",
1295            deleteInterval: 500,
1296            writeFileInterval: 2e3,
1297            cachedFiles: null,
1298            version: "1.1",
1299            getCache(t) {
1300              this.updateLastTime(t);
1301              return this.cachedFiles.has(t) ? `${this.cacheDir}/${this.cachedFiles.get(t).url}` : "";
1302            },
1303            getTemp: t => "",
1304            init() {
1305              this.cacheDir = s() + "/" + this.cacheDir;
1306              var t = this.cacheDir + "/" + this.cachedFileName;
1307              var e = n(t);
1308              if (e instanceof Error || !e.version || e.version !== this.version) {
1309                e instanceof Error || l(this.cacheDir, !0);
1310                this.cachedFiles = new cc.AssetManager.Cache;
1311                r(this.cacheDir, !0);
1312                o(t, JSON.stringify({
1313                  files: this.cachedFiles._map,
1314                  version: this.version
1315                }), "utf8");
1316              } else this.cachedFiles = new cc.AssetManager.Cache(e.files);
1317            },
1318            updateLastTime(t) {
1319              if (this.cachedFiles.has(t)) {
1320                this.cachedFiles.get(t).lastTime = Date.now();
1321              }
1322            },
1323            _write() {
1324              h = null;
1325              o(this.cacheDir + "/" + this.cachedFileName, JSON.stringify({
1326                files: this.cachedFiles._map,
1327                version: this.version
1328              }), "utf8");
1329            },
1330            writeCacheFile() {
1331              h || (h = setTimeout(this._write.bind(this), this.writeFileInterval));
1332            },
1333            cacheFile(t, e, i) {
1334              this.cachedFiles.add(t, {
1335                bundle: i,
1336                url: e,
1337                lastTime: Date.now()
1338              });
1339              this.writeCacheFile();
1340            },
1341            clearCache() {
1342              l(this.cacheDir, !0);
1343              this.cachedFiles = new cc.AssetManager.Cache;
1344              r(this.cacheDir, !0);
1345              clearTimeout(h);
1346              this._write();
1347              cc.assetManager.bundles.forEach((t => {
1348                u.test(t.base) && this.makeBundleFolder(t.name);
1349              }));
1350            },
1351            clearLRU() {
1352              if (!c) {
1353                c = !0;
1354                var t = [];
1355                var e = this;
1356                this.cachedFiles.forEach(((e, i) => {
1357                  "internal" !== e.bundle && t.push({
1358                    originUrl: i,
1359                    url: this.getCache(i),
1360                    lastTime: e.lastTime
1361                  });
1362                }));
1363                t.sort((function(t, e) {
1364                  return t.lastTime - e.lastTime;
1365                }));
1366                t.length = Math.floor(t.length / 3);
1367                if (0 !== t.length) {
1368                  for (var i = 0, s = t.length; i < s; i++) this.cachedFiles.remove(t[i].originUrl);
1369                  clearTimeout(h);
1370                  this._write();
1371                  setTimeout((function i() {
1372                    var s = t.pop();
1373                    a(s.url);
1374                    t.length > 0 ? setTimeout(i, e.deleteInterval) : c = !1;
1375                  }), e.deleteInterval);
1376                }
1377              }
1378            },
1379            removeCache(t) {
1380              if (this.cachedFiles.has(t)) {
1381                var e = this.getCache(t);
1382                this.cachedFiles.remove(t);
1383                clearTimeout(h);
1384                this._write();
1385                a(e);
1386              }
1387            },
1388            makeBundleFolder(t) {
1389              r(this.cacheDir + "/" + t, !0);
1390            }
1391          };
1392          cc.assetManager.cacheManager = e.exports = _;
1393        }, {
1394          "./jsb-fs-utils": 7
1395        } ],
1396        4: [ function(t, e, i) {
1397          const s = t("./jsb-cache-manager");
1398          !function() {
1399            if (void 0 === window.dragonBones || void 0 === window.middleware) return;
1400            const t = cc.internal.ArmatureDisplay;
1401            if (void 0 === t) return;
1402            const e = window.dragonBones;
1403            const i = window.middleware;
1404            Object.defineProperty(e, "timeScale", {
1405              get() {
1406                return this._timeScale;
1407              },
1408              set(t) {
1409                this._timeScale = t;
1410                this.CCFactory.getInstance().setTimeScale(t);
1411              },
1412              configurable: !0
1413            });
1414            i.generateGetSet(e);
1415            const n = cc.color(0, 0, 255, 255);
1416            const r = cc.color(255, 0, 0, 255);
1417            const o = cc.color(0, 255, 0, 255);
1418            e.EventObject.START = "start";
1419            e.EventObject.LOOP_COMPLETE = "loopComplete";
1420            e.EventObject.COMPLETE = "complete";
1421            e.EventObject.FADE_IN = "fadeIn";
1422            e.EventObject.FADE_IN_COMPLETE = "fadeInComplete";
1423            e.EventObject.FADE_OUT = "fadeOut";
1424            e.EventObject.FADE_OUT_COMPLETE = "fadeOutComplete";
1425            e.EventObject.FRAME_EVENT = "frameEvent";
1426            e.EventObject.SOUND_EVENT = "soundEvent";
1427            e.DragonBones = {
1428              ANGLE_TO_RADIAN: Math.PI / 180,
1429              RADIAN_TO_ANGLE: 180 / Math.PI
1430            };
1431            const a = e.CCFactory.prototype;
1432            a.createArmatureNode = function(e, i, s) {
1433              let n = (s = s || new cc.Node).getComponent(t);
1434              n || (n = s.addComponent(t));
1435              s.name = i;
1436              n._armatureName = i;
1437              n._dragonAsset = e.dragonAsset;
1438              n._dragonAtlasAsset = e.dragonAtlasAsset;
1439              n._init();
1440              return n;
1441            };
1442            const l = a.replaceSkin;
1443            a.replaceSkin = function(t, e, i, s) {
1444              void 0 === i && (i = !1);
1445              s = s || [];
1446              l.call(this, t, e, i, s);
1447            };
1448            const h = a.changeSkin;
1449            a.changeSkin = function(t, e, i) {
1450              h.call(this, t, e, i);
1451            };
1452            e.CCFactory.getInstance = function() {
1453              return e.CCFactory.getFactory();
1454            };
1455            const c = e.AnimationState.prototype;
1456            const u = c.isPlaying;
1457            Object.defineProperty(c, "isPlaying", {
1458              get() {
1459                return u.call(this);
1460              }
1461            });
1462            const _ = e.Armature.prototype;
1463            _.addEventListener = function(t, e, i) {
1464              this.__persistentDisplay__ = this.getDisplay();
1465              this.__persistentDisplay__.on(t, e, i);
1466            };
1467            _.removeEventListener = function(t, e, i) {
1468              this.__persistentDisplay__ = this.getDisplay();
1469              this.__persistentDisplay__.off(t, e, i);
1470            };
1471            const d = e.CCArmatureDisplay.prototype;
1472            Object.defineProperty(d, "node", {
1473              get() {
1474                return this;
1475              }
1476            });
1477            d.getRootNode = function() {
1478              const t = this.getRootDisplay();
1479              return t && t._ccNode;
1480            };
1481            d.convertToWorldSpace = function(t) {
1482              let e = this.convertToRootSpace(t.x, t.y);
1483              e = cc.v3(e.x, e.y, 0);
1484              const i = this.getRootNode();
1485              if (!i) return e;
1486              return i._uiProps.uiTransformComp.convertToWorldSpaceAR(e);
1487            };
1488            d.initEvent = function() {
1489              if (!this._eventTarget) {
1490                this._eventTarget = new cc.EventTarget;
1491                this.setDBEventCallback((function(t) {
1492                  this._eventTarget.emit(t.type, t);
1493                }));
1494              }
1495            };
1496            d.on = function(t, e, i) {
1497              this.initEvent();
1498              this._eventTarget.on(t, e, i);
1499              this.addDBEventListener(t, e);
1500            };
1501            d.off = function(t, e, i) {
1502              this.initEvent();
1503              this._eventTarget.off(t, e, i);
1504              this.removeDBEventListener(t, e);
1505            };
1506            d.once = function(t, e, i) {
1507              this.initEvent();
1508              this._eventTarget.once(t, e, i);
1509              this.addDBEventListener(t, e);
1510            };
1511            const p = cc.internal.DragonBonesAtlasAsset.prototype;
1512            let m = 1;
1513            const f = {};
1514            const g = new WeakMap;
1515            const y = {};
1516            p.removeRecordTexture = function(t) {
1517              if (!t) return;
1518              delete y[t.image.url];
1519              const e = t.__textureIndex__;
1520              if (e) {
1521                const t = f[e];
1522                if (t && g.has(t)) {
1523                  g.delete(t);
1524                  delete f[e];
1525                }
1526              }
1527            };
1528            p.recordTexture = function() {
1529              if (this._texture && this._oldTexture !== this._texture) {
1530                this.removeRecordTexture(this._oldTexture);
1531                const t = f[m] = {
1532                  key: m
1533                };
1534                g.set(t, this._texture);
1535                this._oldTexture = this._texture;
1536                this._texture.__textureIndex__ = m;
1537                m++;
1538              }
1539            };
1540            p.getTextureByIndex = function(t) {
1541              const e = f[t];
1542              return e ? g.get(e) : null;
1543            };
1544            p.updateTextureAtlasData = function(t) {
1545              const e = this._texture.image.url;
1546              const s = y[e];
1547              let n;
1548              if (s) {
1549                n = s.index;
1550                this._textureAtlasData = t.getTextureAtlasDataByIndex(s.name, n);
1551                const e = f[s.index];
1552                g.set(e, this._texture);
1553                this._texture.__textureIndex__ = n;
1554                if (this._textureAtlasData) return;
1555              } else this.recordTexture();
1556              n = this._texture.__textureIndex__;
1557              this.jsbTexture = new i.Texture2D;
1558              this.jsbTexture.setRealTextureIndex(n);
1559              this.jsbTexture.setPixelsWide(this._texture.width);
1560              this.jsbTexture.setPixelsHigh(this._texture.height);
1561              this._textureAtlasData = t.parseTextureAtlasData(this.atlasJson, this.jsbTexture, this._uuid);
1562              y[e] = {
1563                name: this._textureAtlasData.name,
1564                index: n
1565              };
1566            };
1567            p.init = function(t) {
1568              this._factory = t;
1569              if (!this._uuid) {
1570                const t = JSON.parse(this.atlasJson);
1571                this._uuid = t.name;
1572              }
1573              this._textureAtlasData ? t.addTextureAtlasData(this._textureAtlasData, this._uuid) : this.updateTextureAtlasData(t);
1574            };
1575            p._clear = function(t) {
1576              if (this._factory) {
1577                this._factory.removeTextureAtlasData(this._uuid, !0);
1578                this._factory.removeDragonBonesDataByUUID(this._uuid, !0);
1579              }
1580              this._textureAtlasData = null;
1581              t || this.recordTexture();
1582            };
1583            p.destroy = function() {
1584              this.removeRecordTexture(this._texture);
1585              this._clear(!0);
1586              cc.Asset.prototype.destroy.call(this);
1587            };
1588            const b = cc.internal.DragonBonesAsset.prototype;
1589            b.init = function(t, e) {
1590              this._factory = t;
1591              if (!this._uuid && this.dragonBonesJson) {
1592                const t = JSON.parse(this.dragonBonesJson);
1593                this._uuid = t.name;
1594              }
1595              const i = `${this._uuid}#${e}`;
1596              if (this._factory.getDragonBonesData(i)) return i;
1597              let n = null;
1598              n = this.dragonBonesJson ? this.dragonBonesJson : s.getCache(this.nativeUrl) || this.nativeUrl;
1599              this._factory.parseDragonBonesDataByPath(n, i);
1600              return i;
1601            };
1602            const S = e.ArmatureCacheMgr.getInstance();
1603            e.armatureCacheMgr = S;
1604            b._clear = function() {
1605              this._factory && this._factory.removeDragonBonesDataByUUID(this._uuid, !0);
1606              S.removeArmatureCache(this._uuid);
1607            };
1608            const A = cc.internal.UIRenderer.prototype;
1609            const T = cc.internal.ArmatureDisplay.prototype;
1610            const v = cc.internal.ArmatureDisplay.AnimationCacheMode;
1611            const E = cc.internal.ArmatureSystem;
1612            T.initFactory = function() {
1613              this._factory = e.CCFactory.getFactory();
1614            };
1615            Object.defineProperty(T, "armatureName", {
1616              get() {
1617                return this._armatureName;
1618              },
1619              set(t) {
1620                this._armatureName = t;
1621                const e = this.getAnimationNames(this._armatureName);
1622                (!this.animationName || e.indexOf(this.animationName) < 0) && (this.animationName = "");
1623                const i = this._armature;
1624                if (this._armature) {
1625                  this.isAnimationCached() || this._factory.remove(this._armature);
1626                  this._armature = null;
1627                }
1628                this._nativeDisplay = null;
1629                this._refresh();
1630                i && i !== this._armature && i.dispose();
1631                this._armature && !this.isAnimationCached() && this._factory.add(this._armature);
1632              },
1633              visible: !1
1634            });
1635            Object.defineProperty(T, "premultipliedAlpha", {
1636              get() {
1637                return void 0 !== this._premultipliedAlpha && this._premultipliedAlpha;
1638              },
1639              set(t) {
1640                this._premultipliedAlpha = t;
1641                this._nativeDisplay && this._nativeDisplay.setOpacityModifyRGB(this._premultipliedAlpha);
1642              }
1643            });
1644            const C = T._initDebugDraw;
1645            T._initDebugDraw = function() {
1646              C.call(this);
1647              this._armature && !this.isAnimationCached() && this._nativeDisplay.setDebugBonesEnabled(this.debugBones);
1648            };
1649            T._buildArmature = function() {
1650              if (!this.dragonAsset || !this.dragonAtlasAsset || !this.armatureName) return;
1651              if (this._nativeDisplay) {
1652                this._nativeDisplay.dispose();
1653                this._nativeDisplay._comp = null;
1654                this._nativeDisplay = null;
1655              }
1656              const t = this.dragonAtlasAsset._uuid;
1657              this._armatureKey = this.dragonAsset.init(this._factory, t);
1658              if (this.isAnimationCached()) {
1659                const i = this._cacheMode === v.SHARED_CACHE;
1660                this._nativeDisplay = new e.CCArmatureCacheDisplay(this.armatureName, this._armatureKey, t, i);
1661                this._armature = this._nativeDisplay.armature();
1662              } else {
1663                this._nativeDisplay = this._factory.buildArmatureDisplay(this.armatureName, this._armatureKey, "", t);
1664                if (!this._nativeDisplay) return;
1665                this._nativeDisplay.setDebugBonesEnabled(this.debugBones);
1666                this._armature = this._nativeDisplay.armature();
1667                this._armature.animation.timeScale = this.timeScale;
1668                this._factory.add(this._armature);
1669              }
1670              const i = this._eventTarget._callbackTable;
1671              const s = function() {};
1672              for (const t in i) {
1673                const e = i[t];
1674                e && e.callbackInfos && e.callbackInfos.length && (this.isAnimationCached() ? this._nativeDisplay.addDBEventListener(t) : this._nativeDisplay.addDBEventListener(t, s));
1675              }
1676              this._preCacheMode = this._cacheMode;
1677              this._nativeDisplay._ccNode = this.node;
1678              this._nativeDisplay._comp = this;
1679              this._nativeDisplay._eventTarget = this._eventTarget;
1680              this._sharedBufferOffset = this._nativeDisplay.getSharedBufferOffset();
1681              this._sharedBufferOffset[0] = 0;
1682              this._useAttach = !1;
1683              this._renderOrder = -1;
1684              this._paramsBuffer = this._nativeDisplay.getParamsBuffer();
1685              this._paramsBuffer[0] = -1;
1686              this._nativeDisplay.setOpacityModifyRGB(this.premultipliedAlpha);
1687              const n = this.color;
1688              this._nativeDisplay.setColor(n.r, n.g, n.b, n.a);
1689              this._nativeDisplay.setDBEventCallback((function(t) {
1690                this._eventTarget.emit(t.type, t);
1691              }));
1692              this.attachUtil.init(this);
1693              this.animationName && this.playAnimation(this.animationName, this.playTimes);
1694              this.syncTransform(!0);
1695              this.markForUpdateRenderData();
1696            };
1697            T._updateColor = function() {
1698              if (this._nativeDisplay) {
1699                const t = this.color;
1700                this._nativeDisplay.setColor(t.r, t.g, t.b, t.a);
1701              }
1702            };
1703            T.playAnimation = function(t, e) {
1704              this.playTimes = void 0 === e ? -1 : e;
1705              this.animationName = t;
1706              if (this._nativeDisplay) {
1707                if (this.isAnimationCached()) return this._nativeDisplay.playAnimation(t, this.playTimes);
1708                if (this._armature) return this._armature.animation.play(t, this.playTimes);
1709              }
1710              return null;
1711            };
1712            T.updateAnimationCache = function(t) {
1713              this.isAnimationCached() && this._nativeDisplay && (t ? this._nativeDisplay.updateAnimationCache(t) : this._nativeDisplay.updateAllAnimationCache());
1714            };
1715            T.invalidAnimationCache = function() {
1716              this.isAnimationCached() && this._nativeDisplay && this._nativeDisplay.updateAllAnimationCache();
1717            };
1718            const x = A.onEnable;
1719            T.onEnable = function() {
1720              x && x.call(this);
1721              this._armature && !this.isAnimationCached() && this._factory.add(this._armature);
1722              this.syncTransform(!0);
1723              this._flushAssembler();
1724              E.getInstance().add(this);
1725              i.retain();
1726            };
1727            const w = A.onDisable;
1728            T.onDisable = function() {
1729              w && w.call(this);
1730              this._armature && !this.isAnimationCached() && this._factory.remove(this._armature);
1731              E.getInstance().remove(this);
1732              i.release();
1733            };
1734            T.once = function(t, e, i) {
1735              this._nativeDisplay && (this.isAnimationCached() ? this._nativeDisplay.addDBEventListener(t) : this._nativeDisplay.addDBEventListener(t, e));
1736              this._eventTarget.once(t, e, i);
1737            };
1738            T.addEventListener = function(t, e, i) {
1739              this._nativeDisplay && (this.isAnimationCached() ? this._nativeDisplay.addDBEventListener(t) : this._nativeDisplay.addDBEventListener(t, e));
1740              this._eventTarget.on(t, e, i);
1741            };
1742            T.removeEventListener = function(t, e, i) {
1743              this._nativeDisplay && (this.isAnimationCached() ? this._nativeDisplay.removeDBEventListener(t) : this._nativeDisplay.removeDBEventListener(t, e));
1744              this._eventTarget.off(t, e, i);
1745            };
1746            const R = T.onDestroy;
1747            T.onDestroy = function() {
1748              R.call(this);
1749              if (this._nativeDisplay) {
1750                this._nativeDisplay.dispose();
1751                this._nativeDisplay._comp = null;
1752                this._nativeDisplay = null;
1753              }
1754            };
1755            T.syncTransform = function(t) {
1756              const e = this.node;
1757              if (!e) return;
1758              const i = this._paramsBuffer;
1759              if (i && (t || e.hasChangedFlags || e._dirtyFlags)) {
1760                const t = e.getWorldMatrix();
1761                i[1] = t.m00;
1762                i[2] = t.m01;
1763                i[3] = t.m02;
1764                i[4] = t.m03;
1765                i[5] = t.m04;
1766                i[6] = t.m05;
1767                i[7] = t.m06;
1768                i[8] = t.m07;
1769                i[9] = t.m08;
1770                i[10] = t.m09;
1771                i[11] = t.m10;
1772                i[12] = t.m11;
1773                i[13] = t.m12;
1774                i[14] = t.m13;
1775                i[15] = t.m14;
1776                i[16] = t.m15;
1777              }
1778            };
1779            T.setAnimationCacheMode = function(t) {
1780              if (this._preCacheMode !== t) {
1781                this._cacheMode = t;
1782                this._buildArmature();
1783                this._armature && !this.isAnimationCached() && this._factory.add(this._armature);
1784                this._updateSocketBindings();
1785                this.markForUpdateRenderData();
1786              }
1787            };
1788            T.updateAnimation = function() {
1789              const t = this._nativeDisplay;
1790              if (!t) return;
1791              if (!this.node) return;
1792              const e = this._paramsBuffer;
1793              if (this._renderOrder !== i.renderOrder) {
1794                e[0] = i.renderOrder;
1795                this._renderOrder = i.renderOrder;
1796                i.renderOrder++;
1797              }
1798              this.syncTransform();
1799              if (void 0 === this.__preColor__ || !this.color.equals(this.__preColor__)) {
1800                const e = this.color;
1801                t.setColor(e.r, e.g, e.b, e.a);
1802                this.__preColor__ = e;
1803              }
1804              const s = this.socketNodes;
1805              if (!this._useAttach && s.size > 0) {
1806                this._useAttach = !0;
1807                t.setAttachEnabled(!0);
1808              }
1809              this.markForUpdateRenderData();
1810              if (!this.isAnimationCached() && this._debugDraw && this.debugBones) {
1811                const t = this._nativeDisplay;
1812                this._debugData = this._debugData || t.getDebugData();
1813                if (!this._debugData) return;
1814                const e = this._debugDraw;
1815                e.clear();
1816                const i = this._debugData;
1817                let s = 0;
1818                e.lineWidth = 5;
1819                e.strokeColor = r;
1820                e.fillColor = n;
1821                const a = i[s++];
1822                for (let t = 0; t < a; t += 4) {
1823                  const n = i[s++];
1824                  const r = i[s++];
1825                  const a = i[s++];
1826                  const l = i[s++];
1827                  e.moveTo(n, r);
1828                  e.lineTo(a, l);
1829                  e.stroke();
1830                  e.circle(n, r, 2 * Math.PI);
1831                  e.fill();
1832                  0 === t && (e.fillColor = o);
1833                }
1834              }
1835            };
1836            const I = cc.mat4();
1837            let M;
1838            let B;
1839            let D;
1840            T._render = function(t) {
1841              if (!this._nativeDisplay) return;
1842              if (!this.node) return;
1843              const e = this.renderEntity;
1844              e.clearDynamicRenderDrawInfos();
1845              const s = this._sharedBufferOffset;
1846              if (!s) return;
1847              const n = s[0];
1848              s[0] = 0;
1849              const r = this.sockets;
1850              if (r.length > 0) {
1851                const t = i.attachInfoMgr.attachInfo;
1852                const e = s[1];
1853                s[1] = 0;
1854                const n = this.socketNodes;
1855                for (let i = r.length - 1; i >= 0; i--) {
1856                  const s = r[i];
1857                  const o = s.target;
1858                  const a = s.boneIndex;
1859                  if (!o) continue;
1860                  if (!o.isValid) {
1861                    n.delete(s.path);
1862                    r.splice(i, 1);
1863                    continue;
1864                  }
1865                  const l = I;
1866                  const h = e + 16 * a;
1867                  l.m00 = t[h];
1868                  l.m01 = t[h + 1];
1869                  l.m04 = t[h + 4];
1870                  l.m05 = t[h + 5];
1871                  l.m12 = t[h + 12];
1872                  l.m13 = t[h + 13];
1873                  o.matrix = l;
1874                }
1875              }
1876              const o = i.renderInfoMgr.renderInfo;
1877              let a = 0;
1878              let l;
1879              let h;
1880              if (4294967295 !== o[n + a++]) return;
1881              const c = o[n + a++];
1882              if (0 !== c) for (let t = 0; t < c; t++) {
1883                l = o[n + a++];
1884                h = this.dragonAtlasAsset.getTextureByIndex(l);
1885                if (!h) return;
1886                const s = this.material;
1887                this.material = this.getMaterialForBlend(o[n + a++], o[n + a++]);
1888                M = o[n + a++];
1889                B = o[n + a++];
1890                D = o[n + a++];
1891                const r = i.RenderInfoLookup[i.vfmtPosUvColor][M];
1892                const c = this.requestDrawInfo(t);
1893                c.setDrawInfoType(r.drawInfoType);
1894                c.setAccAndBuffer(r.accessor.id, r.chunk.bufferId);
1895                c.setTexture(h.getGFXTexture());
1896                c.setSampler(h.getGFXSampler());
1897                c.setMaterial(this.material);
1898                c.setIndexOffset(B);
1899                c.setIBCount(D);
1900                e.setDynamicRenderDrawInfo(c, t);
1901                this.material = s;
1902              }
1903            };
1904            const P = cc.internal.DragonBonesAssembler;
1905            P.createData = function(t) {};
1906            P.updateRenderData = function(t) {
1907              t._render();
1908            };
1909            P.fillBuffers = function(t, e) {};
1910          }();
1911        }, {
1912          "./jsb-cache-manager": 3
1913        } ],
1914        5: [ function(t, e, i) {
1915          !function() {
1916            if (!(cc && cc.internal && cc.internal.EditBox)) return;
1917            const t = cc.internal.EditBox;
1918            const e = t.KeyboardReturnType;
1919            const i = t.InputMode;
1920            const s = t.InputFlag;
1921            const n = cc.mat4();
1922            function r(t) {
1923              switch (t) {
1924               case e.DEFAULT:
1925               case e.DONE:
1926                return "done";
1927
1928               case e.SEND:
1929                return "send";
1930
1931               case e.SEARCH:
1932                return "search";
1933
1934               case e.GO:
1935                return "go";
1936
1937               case e.NEXT:
1938                return "next";
1939              }
1940              return "done";
1941            }
1942            const o = t._EditBoxImpl;
1943            t._EditBoxImpl = class extends o {
1944              init(t) {
1945                t ? this._delegate = t : cc.error("EditBox init failed");
1946              }
1947              beginEditing() {
1948                const t = this;
1949                const e = this._delegate;
1950                const n = e.inputMode === i.ANY;
1951                const o = this._getRect();
1952                this.setMaxLength(e.maxLength);
1953                let a = function(t) {
1954                  switch (t) {
1955                   case i.EMAIL_ADDR:
1956                    return "email";
1957
1958                   case i.NUMERIC:
1959                   case i.DECIMAL:
1960                    return "number";
1961
1962                   case i.PHONE_NUMBER:
1963                    return "phone";
1964
1965                   case i.URL:
1966                    return "url";
1967
1968                   case i.SINGLE_LINE:
1969                   case i.ANY:
1970                   default:
1971                    return "text";
1972                  }
1973                }(e.inputMode);
1974                e.inputFlag === s.PASSWORD && (a = "password");
1975                jsb.inputBox.onInput((function(i) {
1976                  i.value.length > t._maxLength && (i.value = i.value.slice(0, t._maxLength));
1977                  e.string !== i.value && e._editBoxTextChanged(i.value);
1978                }));
1979                jsb.inputBox.onConfirm((function(t) {
1980                  e._editBoxEditingReturn();
1981                }));
1982                jsb.inputBox.onComplete((function(e) {
1983                  t.endEditing();
1984                }));
1985                cc.sys.isMobile || e._hideLabels();
1986                const l = e.textLabel;
1987                jsb.inputBox.show({
1988                  defaultValue: e.string,
1989                  maxLength: t._maxLength,
1990                  multiple: n,
1991                  confirmHold: !1,
1992                  confirmType: r(e.returnType),
1993                  inputType: a,
1994                  originX: o.x,
1995                  originY: o.y,
1996                  width: o.width,
1997                  height: o.height,
1998                  isBold: l.isBold,
1999                  isItalic: l.isItalic,
2000                  isUnderline: l.isUnderline,
2001                  underlineColor: 0,
2002                  fontSize: l.fontSize,
2003                  fontColor: l.color.toRGBValue(),
2004                  backColor: 16777215,
2005                  backgroundColor: e.placeholderLabel.color.toRGBValue(),
2006                  textAlignment: l.horizontalAlign
2007                });
2008                this._editing = !0;
2009                e._editBoxEditingDidBegan();
2010              }
2011              endEditing() {
2012                this._editing = !1;
2013                cc.sys.isMobile || this._delegate._showLabels();
2014                jsb.inputBox.offConfirm();
2015                jsb.inputBox.offInput();
2016                jsb.inputBox.offComplete();
2017                jsb.inputBox.hide();
2018                this._delegate._editBoxEditingDidEnded();
2019              }
2020              setMaxLength(t) {
2021                if (!isNaN(t)) {
2022                  t < 0 && (t = 65535);
2023                  this._maxLength = t;
2024                }
2025              }
2026              _getRect() {
2027                const t = this._delegate.node;
2028                let e = cc.view._scaleX;
2029                let i = cc.view._scaleY;
2030                const s = jsb.device.getDevicePixelRatio() || 1;
2031                t.getWorldMatrix(n);
2032                const r = t._uiProps.uiTransformComp;
2033                const o = cc.v3();
2034                let a = 0;
2035                let l = 0;
2036                if (r) {
2037                  const t = r.contentSize;
2038                  const e = r.anchorPoint;
2039                  a = t.width;
2040                  l = t.height;
2041                  o.x = -e.x * a;
2042                  o.y = -e.y * l;
2043                }
2044                cc.Mat4.translate(n, n, o);
2045                e /= s;
2046                i /= s;
2047                const h = n.m00 * e;
2048                const c = n.m05 * i;
2049                const u = cc.view._viewportRect;
2050                const _ = u.x / s;
2051                const d = u.y / s;
2052                return {
2053                  x: n.m12 * e + _,
2054                  y: n.m13 * i + d,
2055                  width: a * h,
2056                  height: l * c
2057                };
2058              }
2059            };
2060          }();
2061        }, {} ],
2062        6: [ function(t, e, i) {
2063          !function() {
2064            if (!window.middleware) return;
2065            const t = window.middleware;
2066            const e = t.MiddlewareManager.getInstance();
2067            let i = 0;
2068            const s = cc.director;
2069            const n = cc.game;
2070            const r = [];
2071            const o = t.vfmtPosUvColor = 6;
2072            const a = t.vfmtPosUvTwoColor = 7;
2073            const l = cc.internal.vfmtPosUvColor4B;
2074            const h = cc.internal.vfmtPosUvTwoColor4B;
2075            const c = t.RenderInfoLookup = {};
2076            c[o] = [];
2077            c[a] = [];
2078            t.reset = function() {
2079              t.preRenderComponent = null;
2080              t.preRenderBufferIndex = 0;
2081              t.preRenderBufferType = o;
2082              t.renderOrder = 0;
2083              t.indicesStart = 0;
2084              t.resetIndicesStart = !1;
2085            };
2086            t.reset();
2087            t.retain = function() {
2088              i++;
2089            };
2090            t.release = function() {
2091              if (0 !== i) {
2092                i--;
2093                if (0 === i) {
2094                  const t = c[o];
2095                  for (let e = 0; e < t.length; e++) cc.UI.RenderData.remove(t[e]);
2096                  t.length = 0;
2097                  const e = c[a];
2098                  for (let t = 0; t < e.length; t++) cc.UI.RenderData.remove(e[t]);
2099                  e.length = 0;
2100                  r.forEach((t => {
2101                    t.destroy();
2102                  }));
2103                }
2104              } else cc.warn("middleware reference error: reference count should be greater than 0");
2105            };
2106            function u(t, i, s) {
2107              if (!t) return;
2108              const n = e.getBufferCount(i);
2109              for (let t = 0; t < n; t++) {
2110                let e = c[i][t];
2111                if (!e) {
2112                  r[s] || (r[s] = cc.UI.RenderData.createStaticVBAccessor(s, 65535, 524280));
2113                  e = cc.UI.RenderData.add(s, r[s]);
2114                  e.multiOwner = !0;
2115                  e.drawInfoType = 2;
2116                  e.resize(65535, 524280);
2117                  e.getMeshBuffer().useLinkedData = !0;
2118                  c[i][t] = e;
2119                }
2120              }
2121            }
2122            s.on(cc.Director.EVENT_BEFORE_UPDATE, (() => {
2123              0 !== i && e.update(n.deltaTime);
2124            }));
2125            s.on(cc.Director.EVENT_BEFORE_DRAW, (() => {
2126              if (0 === i) return;
2127              e.render(n.deltaTime);
2128              t.reset();
2129              const r = s.root.batcher2D;
2130              u(r, o, l);
2131              u(r, a, h);
2132              if (window.dragonBones) {
2133                cc.internal.ArmatureSystem.getInstance().prepareRenderData();
2134              }
2135              if (window.spine) {
2136                cc.internal.SpineSkeletonSystem.getInstance().prepareRenderData();
2137              }
2138            }));
2139            const _ = e.getRenderInfoMgr();
2140            _.renderInfo = _.getSharedBuffer();
2141            _.setResizeCallback((function() {
2142              this.attachInfo = this.getSharedBuffer();
2143            }));
2144            _.__middleware__ = t;
2145            const d = e.getAttachInfoMgr();
2146            d.attachInfo = d.getSharedBuffer();
2147            d.setResizeCallback((function() {
2148              this.attachInfo = this.getSharedBuffer();
2149            }));
2150            t.renderInfoMgr = _;
2151            t.attachInfoMgr = d;
2152            t.generateGetSet = function(t) {
2153              for (const e in t) {
2154                const i = t[e] && t[e].prototype;
2155                if (i) for (const t in i) {
2156                  if (-1 === t.search(/^get/)) continue;
2157                  let e = t.replace(/^get/, "");
2158                  const s = e.split("");
2159                  const n = s[0].toLowerCase();
2160                  const r = s[0].toUpperCase();
2161                  s.splice(0, 1);
2162                  const o = s.join("");
2163                  e = n + o;
2164                  const a = `set${r}${o}`;
2165                  if (i.hasOwnProperty(e)) continue;
2166                  "function" == typeof i[a] ? Object.defineProperty(i, e, {
2167                    get() {
2168                      return this[t]();
2169                    },
2170                    set(t) {
2171                      this[a](t);
2172                    },
2173                    configurable: !0
2174                  }) : Object.defineProperty(i, e, {
2175                    get() {
2176                      return this[t]();
2177                    },
2178                    configurable: !0
2179                  });
2180                }
2181              }
2182            };
2183          }();
2184        }, {} ],
2185        7: [ function(t, e, i) {
2186          const s = jsb.fileUtils;
2187          let n = null;
2188          const r = new cc.AssetManager.Cache;
2189          let o = "";
2190          window.oh || (jsb.Downloader.prototype._ctor = function() {
2191            this.__nativeRefs = {};
2192          });
2193          var a = {
2194            fs: s,
2195            initJsbDownloader(t, e) {
2196              n = new jsb.Downloader({
2197                countOfMaxProcessingTasks: t || 32,
2198                timeoutInSeconds: e || 30,
2199                tempFileNameSuffix: ".tmp"
2200              });
2201              o = `${a.getUserDataPath()}/temp`;
2202              !s.isDirectoryExist(o) && s.createDirectory(o);
2203              n.onSuccess = t => {
2204                if (!r.has(t.requestURL)) return;
2205                const {onComplete: e} = r.remove(t.requestURL);
2206                e && e(null, t.storagePath);
2207              };
2208              n.onError = (t, e, i, s) => {
2209                if (!r.has(t.requestURL)) return;
2210                const {onComplete: n} = r.remove(t.requestURL);
2211                cc.error(`Download file failed: path: ${t.requestURL} message: ${s}, ${e}`);
2212                n(new Error(s), null);
2213              };
2214              n.onProgress = (t, e, i, s) => {
2215                if (!r.has(t.requestURL)) return;
2216                const {onProgress: n} = r.get(t.requestURL);
2217                n && n(i, s);
2218              };
2219            },
2220            getUserDataPath: () => s.getWritablePath().replace(/[\/\\]*$/, ""),
2221            checkFsValid() {
2222              if (!s) {
2223                cc.warn("can not get the file system!");
2224                return !1;
2225              }
2226              return !0;
2227            },
2228            deleteFile(t, e) {
2229              if (!0 === s.removeFile(t)) e && e(null); else {
2230                cc.warn(`Delete file failed: path: ${t}`);
2231                e && e(new Error("delete file failed"));
2232              }
2233            },
2234            downloadFile(t, e, i, s, a) {
2235              r.add(t, {
2236                onProgress: s,
2237                onComplete: a
2238              });
2239              let l = e;
2240              l || (l = `${o}/${performance.now()}${cc.path.extname(t)}`);
2241              n.createDownloadTask(t, l, i);
2242            },
2243            saveFile(t, e, i) {
2244              let n = null;
2245              const r = s.writeDataToFile(s.getDataFromFile(t), e);
2246              s.removeFile(t);
2247              if (!r) {
2248                n = new Error(`Save file failed: path: ${t}`);
2249                cc.warn(n.message);
2250              }
2251              i && i(n);
2252            },
2253            copyFile(t, e, i) {
2254              let n = null;
2255              if (!s.writeDataToFile(s.getDataFromFile(t), e)) {
2256                n = new Error(`Copy file failed: path: ${t}`);
2257                cc.warn(n.message);
2258              }
2259              i && i(n);
2260            },
2261            writeFile(t, e, i, n) {
2262              let r = null;
2263              let o = null;
2264              r = "utf-8" === i || "utf8" === i ? s.writeStringToFile(e, t) : s.writeDataToFile(e, t);
2265              if (!r) {
2266                o = new Error(`Write file failed: path: ${t}`);
2267                cc.warn(o.message);
2268              }
2269              n && n(o);
2270            },
2271            writeFileSync(t, e, i) {
2272              let n = null;
2273              n = "utf-8" === i || "utf8" === i ? s.writeStringToFile(e, t) : s.writeDataToFile(e, t);
2274              if (!n) {
2275                cc.warn(`Write file failed: path: ${t}`);
2276                return new Error(`Write file failed: path: ${t}`);
2277              }
2278            },
2279            readFile(t, e, i) {
2280              let n = null;
2281              let r = null;
2282              n = "utf-8" === e || "utf8" === e ? s.getStringFromFile(t) : s.getDataFromFile(t);
2283              if (!n) {
2284                r = new Error(`Read file failed: path: ${t}`);
2285                cc.warn(r.message);
2286              }
2287              i && i(r, n);
2288            },
2289            readDir(t, e) {
2290              let i = null;
2291              let n = null;
2292              try {
2293                i = s.listFiles(t);
2294              } catch (e) {
2295                cc.warn(`Read dir failed: path: ${t} message: ${e.message}`);
2296                n = new Error(e.message);
2297              }
2298              e && e(n, i);
2299            },
2300            readText(t, e) {
2301              a.readFile(t, "utf8", e);
2302            },
2303            readArrayBuffer(t, e) {
2304              a.readFile(t, "", e);
2305            },
2306            readJson(t, e) {
2307              a.readFile(t, "utf8", ((i, s) => {
2308                let n = null;
2309                if (!i) try {
2310                  n = JSON.parse(s);
2311                } catch (e) {
2312                  cc.warn(`Read json failed: path: ${t} message: ${e.message}`);
2313                  i = new Error(e.message);
2314                }
2315                e && e(i, n);
2316              }));
2317            },
2318            readJsonSync(t) {
2319              try {
2320                const e = s.getStringFromFile(t);
2321                return JSON.parse(e);
2322              } catch (e) {
2323                cc.warn(`Read json failed: path: ${t} message: ${e.message}`);
2324                return new Error(e.message);
2325              }
2326            },
2327            makeDirSync(t, e) {
2328              if (!s.createDirectory(t)) {
2329                cc.warn(`Make directory failed: path: ${t}`);
2330                return new Error(`Make directory failed: path: ${t}`);
2331              }
2332            },
2333            rmdirSync(t, e) {
2334              if (!s.removeDirectory(t)) {
2335                cc.warn(`rm directory failed: path: ${t}`);
2336                return new Error(`rm directory failed: path: ${t}`);
2337              }
2338            },
2339            exists(t, e) {
2340              const i = s.isFileExist(t);
2341              e && e(i);
2342            },
2343            loadSubpackage(t, e, i) {
2344              throw new Error("not implement");
2345            }
2346          };
2347          window.fsUtils = e.exports = a;
2348        }, {} ],
2349        8: [ function(t, e, i) {
2350          cc.game.restart = function() {
2351            cc.director.getScene().destroy();
2352            cc.Object._deferredDestroy();
2353            __restartVM();
2354          };
2355          jsb.onError((function(t, e, i) {
2356            console.error(t, e, i);
2357          }));
2358          jsb.onMemoryWarning = function() {
2359            cc.game.emit(cc.Game.EVENT_LOW_MEMORY);
2360          };
2361        }, {} ],
2362        9: [ function(t, e, i) {
2363          const s = gfx.Device.prototype;
2364          const n = gfx.Swapchain.prototype;
2365          const r = gfx.Buffer.prototype;
2366          const o = gfx.Texture.prototype;
2367          const a = gfx.DescriptorSet.prototype;
2368          const l = s.copyTexImagesToTexture;
2369          s.copyTexImagesToTexture = function(t, e, i) {
2370            const s = [];
2371            if (t) for (let e = 0; e < t.length; ++e) {
2372              const i = t[e];
2373              if (i instanceof HTMLCanvasElement) s.push(i._data.data); else {
2374                if (!(i instanceof HTMLImageElement)) {
2375                  console.log("copyTexImagesToTexture: Convert texImages to data buffers failed");
2376                  return;
2377                }
2378                s.push(i._data);
2379              }
2380            }
2381            l.call(this, s, e, i);
2382          };
2383          const h = s.createSwapchain;
2384          s.createSwapchain = function(t) {
2385            t.windowHandle = window.oh ? jsb.device.getWindowHandle() : window.windowHandler;
2386            return h.call(this, t);
2387          };
2388          const c = n.initialize;
2389          n.initialize = function(t) {
2390            t.windowHandle = window.windowHandler;
2391            c.call(this, t);
2392          };
2393          const u = r.update;
2394          r.update = function(t, e) {
2395            if (0 === t.byteLength) return;
2396            let i;
2397            if (64 & this.cachedUsage) {
2398              const {drawInfos: e} = t;
2399              t = new Uint32Array(7 * e.length);
2400              let s = 0;
2401              let n;
2402              for (let i = 0; i < e.length; ++i) {
2403                s = 7 * i;
2404                n = e[i];
2405                t[s] = n.vertexCount;
2406                t[s + 1] = n.firstVertex;
2407                t[s + 2] = n.indexCount;
2408                t[s + 3] = n.firstIndex;
2409                t[s + 4] = n.vertexOffset;
2410                t[s + 5] = n.instanceCount;
2411                t[s + 6] = n.firstInstance;
2412              }
2413              i = t.byteLength;
2414            } else i = void 0 !== e ? e : t.byteLength;
2415            u.call(this, t, i);
2416          };
2417          const _ = s.createBuffer;
2418          s.createBuffer = function(t) {
2419            let e;
2420            e = t.buffer ? _.call(this, t, !0) : _.call(this, t, !1);
2421            e.cachedUsage = t.usage;
2422            return e;
2423          };
2424          const d = r.initialize;
2425          r.initialize = function(t) {
2426            t.buffer ? d.call(this, t, !0) : d.call(this, t, !1);
2427          };
2428          const p = s.createTexture;
2429          s.createTexture = function(t) {
2430            return t.texture ? p.call(this, t, !0) : p.call(this, t, !1);
2431          };
2432          const m = o.initialize;
2433          o.initialize = function(t) {
2434            t.texture ? m.call(this, t, !0) : m.call(this, t, !1);
2435          };
2436          a.bindBuffer = function(t, e, i) {
2437            this.dirtyJSB = a.bindBufferJSB.call(this, t, e, i || 0);
2438          };
2439          a.bindSampler = function(t, e, i) {
2440            this.dirtyJSB = a.bindSamplerJSB.call(this, t, e, i || 0);
2441          };
2442          a.bindTexture = function(t, e, i) {
2443            this.dirtyJSB = a.bindTextureJSB.call(this, t, e, i || 0);
2444          };
2445          const f = a.update;
2446          a.update = function() {
2447            if (this.dirtyJSB) {
2448              f.call(this);
2449              this.dirtyJSB = !1;
2450            }
2451          };
2452          Object.defineProperty(s, "uboOffsetAlignment", {
2453            get() {
2454              void 0 === this.cachedUboOffsetAlignment && (this.cachedUboOffsetAlignment = this.getUboOffsetAlignment());
2455              return this.cachedUboOffsetAlignment;
2456            }
2457          });
2458        }, {} ],
2459        10: [ function(t, e, i) {
2460          const s = t("./jsb-cache-manager");
2461          const {downloadFile: n, readText: r, readArrayBuffer: o, readJson: a, getUserDataPath: l, initJsbDownloader: h} = t("./jsb-fs-utils");
2462          const c = /^\w+:\/\/.*/;
2463          const u = cc.assetManager.downloader;
2464          const _ = cc.assetManager.parser;
2465          const d = cc.assetManager.presets;
2466          u.maxConcurrency = 30;
2467          u.maxRequestsPerFrame = 60;
2468          d.preload.maxConcurrency = 15;
2469          d.preload.maxRequestsPerFrame = 30;
2470          d.scene.maxConcurrency = 32;
2471          d.scene.maxRequestsPerFrame = 64;
2472          d.bundle.maxConcurrency = 32;
2473          d.bundle.maxRequestsPerFrame = 64;
2474          let p = 0;
2475          const m = {};
2476          const f = {};
2477          function g(t, e, i) {
2478            if ("function" == typeof e) {
2479              i = e;
2480              e = null;
2481            }
2482            if (f[t]) return i && i();
2483            y(t, (function(e, i, s) {
2484              window.oh ? window.oh.loadModule(e) : window.require(e);
2485              f[t] = !0;
2486              s && s(null);
2487            }), e, e.onFileProgress, i);
2488          }
2489          function y(t, e, i, r, o) {
2490            var a = function(t, e) {
2491              var i = !1;
2492              var n = !1;
2493              if (c.test(t)) {
2494                if (e.reload) return {
2495                  url: t
2496                };
2497                var r = s.getCache(t);
2498                if (r) {
2499                  n = !0;
2500                  t = r;
2501                }
2502              } else i = !0;
2503              return {
2504                url: t,
2505                inLocal: i,
2506                inCache: n
2507              };
2508            }(t, i);
2509            if (a.inLocal) e(a.url, i, o); else if (a.inCache) {
2510              s.updateLastTime(t);
2511              e(a.url, i, (function(e, i) {
2512                e && s.removeCache(t);
2513                o(e, i);
2514              }));
2515            } else {
2516              var l = Date.now();
2517              var h = "";
2518              var u = m[t];
2519              h = u ? u.storagePath : i.__cacheBundleRoot__ ? `${i.__cacheBundleRoot__}/${l}${p++}${cc.path.extname(t)}` : `${l}${p++}${cc.path.extname(t)}`;
2520              n(t, `${s.cacheDir}/${h}`, i.header, r, (function(n, r) {
2521                if (n) {
2522                  if (u) {
2523                    u.retryCount++;
2524                    u.retryCount >= 5 && delete m[t];
2525                  } else m[t] = {
2526                    retryCount: 0,
2527                    storagePath: h
2528                  };
2529                  o(n, null);
2530                } else {
2531                  delete m[t];
2532                  e(r, i, (function(e, n) {
2533                    e || s.cacheFile(t, h, i.__cacheBundleRoot__);
2534                    o(e, n);
2535                  }));
2536                }
2537              }));
2538            }
2539          }
2540          function b(t, e, i) {
2541            i(null, t);
2542          }
2543          function S(t, e, i) {
2544            y(t, b, e, e.onFileProgress, i);
2545          }
2546          function A(t, e, i) {
2547            r(t, i);
2548          }
2549          function T(t, e, i) {
2550            a(t, i);
2551          }
2552          function v(t, e, i) {
2553            o(t, i);
2554          }
2555          function E(t, e, i) {
2556            y(t, T, e, e.onFileProgress, i);
2557          }
2558          function C(t, e, i) {
2559            y(t, v, e, e.onFileProgress, i);
2560          }
2561          function x(t, e, i) {
2562            let s = function(t) {
2563              var e = t.lastIndexOf(".ttf");
2564              if (-1 === e) return t;
2565              var i = t.lastIndexOf("/");
2566              var s;
2567              -1 !== (s = -1 === i ? t.substring(0, e) + "_LABEL" : t.substring(i + 1, e) + "_LABEL").indexOf(" ") && (s = '"' + s + '"');
2568              return s;
2569            }(t);
2570            let n = new FontFace(s, "url('" + t + "')");
2571            document.fonts.add(n);
2572            n.load();
2573            n.loaded.then((function() {
2574              i(null, s);
2575            }), (function() {
2576              cc.warnID(4933, s);
2577              i(null, s);
2578            }));
2579          }
2580          const w = _.parsePlist;
2581          let R = function(t, e, i) {
2582            r(t, (function(t, s) {
2583              if (t) return i(t);
2584              w(s, e, i);
2585            }));
2586          };
2587          _.parsePVRTex = u.downloadDomImage;
2588          _.parsePKMTex = u.downloadDomImage;
2589          _.parseASTCTex = u.downloadDomImage;
2590          _.parsePlist = R;
2591          u.downloadScript = g;
2592          function I(t, e, i) {
2593            cc.AudioPlayer.load(t).then((e => {
2594              const s = {
2595                player: e,
2596                url: t,
2597                duration: e.duration,
2598                type: e.type
2599              };
2600              i(null, s);
2601            })).catch((t => {
2602              i(t);
2603            }));
2604          }
2605          u.register({
2606            ".js": g,
2607            ".jsc": g,
2608            ".png": S,
2609            ".jpg": S,
2610            ".bmp": S,
2611            ".jpeg": S,
2612            ".gif": S,
2613            ".ico": S,
2614            ".tiff": S,
2615            ".webp": S,
2616            ".image": S,
2617            ".pvr": S,
2618            ".pkm": S,
2619            ".astc": S,
2620            ".mp3": S,
2621            ".ogg": S,
2622            ".wav": S,
2623            ".m4a": S,
2624            ".ccon": (t, e, i) => {
2625              E(t, e, ((e, s) => {
2626                if (e) {
2627                  i(e);
2628                  return;
2629                }
2630                const n = cc.internal.parseCCONJson(s);
2631                Promise.all(n.chunks.map((e => new Promise(((i, s) => {
2632                  C(`${cc.path.mainFileName(t)}${e}`, {}, ((t, e) => {
2633                    t ? s(t) : i(new Uint8Array(e));
2634                  }));
2635                }))))).then((t => {
2636                  const e = new cc.internal.CCON(n.document, t);
2637                  i(null, e);
2638                })).catch((t => {
2639                  i(t);
2640                }));
2641              }));
2642            },
2643            ".cconb": (t, e, i) => {
2644              C(t, e, ((t, e) => {
2645                if (t) i(t); else try {
2646                  const t = cc.internal.decodeCCONBinary(new Uint8Array(e));
2647                  i(null, t);
2648                } catch (t) {
2649                  i(t);
2650                }
2651              }));
2652            },
2653            ".mp4": S,
2654            ".avi": S,
2655            ".mov": S,
2656            ".mpg": S,
2657            ".mpeg": S,
2658            ".rm": S,
2659            ".rmvb": S,
2660            ".txt": S,
2661            ".xml": S,
2662            ".vsh": S,
2663            ".fsh": S,
2664            ".atlas": S,
2665            ".tmx": S,
2666            ".tsx": S,
2667            ".fnt": S,
2668            ".plist": S,
2669            ".json": E,
2670            ".ExportJson": S,
2671            ".binary": S,
2672            ".bin": S,
2673            ".dbbin": S,
2674            ".skel": S,
2675            ".font": S,
2676            ".eot": S,
2677            ".ttf": S,
2678            ".woff": S,
2679            ".svg": S,
2680            ".ttc": S,
2681            bundle: function(t, e, i) {
2682              let n = cc.path.basename(t);
2683              var r = e.version || u.bundleVers[n];
2684              let o;
2685              if (c.test(t) || t.startsWith(l())) {
2686                o = t;
2687                s.makeBundleFolder(n);
2688              } else if (-1 !== u.remoteBundles.indexOf(n)) {
2689                o = `${u.remoteServerAddress}remote/${n}`;
2690                s.makeBundleFolder(n);
2691              } else o = `assets/${n}`;
2692              var a = `${o}/cc.config.${r ? r + "." : ""}json`;
2693              e.__cacheBundleRoot__ = n;
2694              E(a, e, (function(t, s) {
2695                if (t) return i(t, null);
2696                let n = s;
2697                n && (n.base = o + "/");
2698                g(`${o}/index.${r ? r + "." : ""}${n.encrypted ? "jsc" : "js"}`, e, (function(t) {
2699                  if (t) return i(t, null);
2700                  i(null, n);
2701                }));
2702              }));
2703            },
2704            default: function(t, e, i) {
2705              y(t, A, e, e.onFileProgress, i);
2706            }
2707          });
2708          _.register({
2709            ".png": u.downloadDomImage,
2710            ".jpg": u.downloadDomImage,
2711            ".bmp": u.downloadDomImage,
2712            ".jpeg": u.downloadDomImage,
2713            ".gif": u.downloadDomImage,
2714            ".ico": u.downloadDomImage,
2715            ".tiff": u.downloadDomImage,
2716            ".webp": u.downloadDomImage,
2717            ".image": u.downloadDomImage,
2718            ".mp3": I,
2719            ".ogg": I,
2720            ".wav": I,
2721            ".m4a": I,
2722            ".pvr": u.downloadDomImage,
2723            ".pkm": u.downloadDomImage,
2724            ".astc": u.downloadDomImage,
2725            ".binary": v,
2726            ".bin": v,
2727            ".dbbin": v,
2728            ".skel": v,
2729            ".txt": A,
2730            ".xml": A,
2731            ".vsh": A,
2732            ".fsh": A,
2733            ".atlas": A,
2734            ".tmx": A,
2735            ".tsx": A,
2736            ".fnt": A,
2737            ".plist": R,
2738            ".font": x,
2739            ".eot": x,
2740            ".ttf": x,
2741            ".woff": x,
2742            ".svg": x,
2743            ".ttc": x,
2744            ".ExportJson": T
2745          });
2746          cc.assetManager.transformPipeline.append((function(t) {
2747            var e = t.output = t.input;
2748            for (var i = 0, s = e.length; i < s; i++) {
2749              var n = e[i];
2750              n.config && (n.options.__cacheBundleRoot__ = n.config.name);
2751              ".cconb" === n.ext ? n.url = n.url.replace(n.ext, ".bin") : ".ccon" === n.ext && (n.url = n.url.replace(n.ext, ".json"));
2752            }
2753          }));
2754          var M = cc.assetManager.init;
2755          cc.assetManager.init = function(t) {
2756            M.call(cc.assetManager, t);
2757            if (!window.oh) {
2758              const t = cc.settings.querySettings("assets", "jsbDownloaderMaxTasks");
2759              const e = cc.settings.querySettings("assets", "jsbDownloaderTimeout");
2760              h(t, e);
2761            }
2762            s.init();
2763          };
2764        }, {
2765          "./jsb-cache-manager": 3,
2766          "./jsb-fs-utils": 7
2767        } ],
2768        11: [ function(t, e, i) {
2769          const s = globalThis["jsb.physics"];
2770          s.CACHE = {
2771            trimesh: {},
2772            convex: {},
2773            height: {},
2774            material: {}
2775          };
2776          s.OBJECT = {
2777            books: [],
2778            ptrToObj: {},
2779            raycastOptions: {
2780              origin: null,
2781              unitDir: null,
2782              distance: 0,
2783              mask: 0,
2784              queryTrigger: !0
2785            }
2786          };
2787          s.CONFIG = {
2788            heightScale: 1 / 512
2789          };
2790          const n = s.OBJECT.books;
2791          const r = s.OBJECT.ptrToObj;
2792          const o = s.OBJECT.raycastOptions;
2793          const a = {
2794            type: "onTriggerEnter",
2795            selfCollider: null,
2796            otherCollider: null,
2797            impl: null
2798          };
2799          const l = {
2800            type: "onCollisionEnter",
2801            selfCollider: null,
2802            otherCollider: null,
2803            contacts: [],
2804            impl: null
2805          };
2806          function h(t, e, i, s) {
2807            a.type = t;
2808            a.impl = s;
2809            if (e.needTriggerEvent) {
2810              a.selfCollider = e;
2811              a.otherCollider = i;
2812              e.emit(t, a);
2813            }
2814            if (i.needTriggerEvent) {
2815              a.selfCollider = i;
2816              a.otherCollider = e;
2817              i.emit(t, a);
2818            }
2819          }
2820          const c = new cc.Quat;
2821          const u = [];
2822          class _ {
2823            constructor(t) {
2824              this.event = t;
2825              this.impl = null;
2826              this.colliderA = null;
2827              this.colliderB = null;
2828              this.index = 0;
2829            }
2830            get isBodyA() {
2831              return this.colliderA.uuid === this.event.selfCollider.uuid;
2832            }
2833            getLocalPointOnA(t) {
2834              this.getWorldPointOnB(t);
2835              cc.Vec3.subtract(t, t, this.colliderA.node.worldPosition);
2836            }
2837            getLocalPointOnB(t) {
2838              this.getWorldPointOnB(t);
2839              cc.Vec3.subtract(t, t, this.colliderB.node.worldPosition);
2840            }
2841            getWorldPointOnA(t) {
2842              this.getWorldPointOnB(t);
2843            }
2844            getWorldPointOnB(t) {
2845              const e = 12 * this.index;
2846              t.x = this.impl[e];
2847              t.y = this.impl[e + 1];
2848              t.z = this.impl[e + 2];
2849            }
2850            getLocalNormalOnA(t) {
2851              this.getWorldNormalOnA(t);
2852              cc.Quat.conjugate(c, this.colliderA.node.worldRotation);
2853              cc.Vec3.transformQuat(t, t, c);
2854            }
2855            getLocalNormalOnB(t) {
2856              this.getWorldNormalOnB(t);
2857              cc.Quat.conjugate(c, this.colliderB.node.worldRotation);
2858              cc.Vec3.transformQuat(out, out, c);
2859            }
2860            getWorldNormalOnA(t) {
2861              this.getWorldNormalOnB(t);
2862              this.isBodyA || cc.Vec3.negate(t, t);
2863            }
2864            getWorldNormalOnB(t) {
2865              const e = 12 * this.index + 3;
2866              t.x = this.impl[e];
2867              t.y = this.impl[e + 1];
2868              t.z = this.impl[e + 2];
2869            }
2870          }
2871          function d(t, e, i, s, n) {
2872            l.type = t;
2873            l.impl = s;
2874            const r = l.contacts;
2875            u.push.apply(u, r);
2876            r.length = 0;
2877            const o = n.length / 12;
2878            for (let t = 0; t < o; t++) {
2879              const s = u.length > 0 ? u.pop() : new _(l);
2880              s.colliderA = e;
2881              s.colliderB = i;
2882              s.impl = n;
2883              s.index = t;
2884              r.push(s);
2885            }
2886            if (e.needCollisionEvent) {
2887              l.selfCollider = e;
2888              l.otherCollider = i;
2889              e.emit(t, l);
2890            }
2891            if (i.needCollisionEvent) {
2892              l.selfCollider = i;
2893              l.otherCollider = e;
2894              i.emit(t, l);
2895            }
2896          }
2897          function p(t) {
2898            if (void 0 === t._physicsBookIndex) {
2899              t._physicsBookIndex = n.length;
2900              n.push(t);
2901            }
2902          }
2903          function m(t) {
2904            const e = t._physicsBookIndex;
2905            if (void 0 !== e) {
2906              n[e] = n[n.length - 1];
2907              n[e]._physicsBookIndex = e;
2908              n.length -= 1;
2909              t._physicsBookIndex = void 0;
2910            }
2911          }
2912          function f() {
2913            const t = cc.PhysicsSystem.instance;
2914            const e = t.physicsWorld.impl;
2915            const i = t.collisionMatrix;
2916            if (i.updateArray && i.updateArray.length > 0) {
2917              i.updateArray.forEach((t => {
2918                const s = i["" + (1 << t)];
2919                e.setCollisionMatrix(t, s);
2920              }));
2921              i.updateArray.length = 0;
2922            }
2923          }
2924          const g = {
2925            NONE: 0,
2926            QUERY_FILTER: 1,
2927            QUERY_SINGLE_HIT: 4,
2928            DETECT_TRIGGER_EVENT: 8,
2929            DETECT_CONTACT_EVENT: 16,
2930            DETECT_CONTACT_POINT: 32,
2931            DETECT_CONTACT_CCD: 64
2932          };
2933          class y {
2934            get impl() {
2935              return this._impl;
2936            }
2937            get collider() {
2938              return this._com;
2939            }
2940            get attachedRigidBody() {
2941              return this._attachedRigidBody;
2942            }
2943            constructor() {
2944              f();
2945            }
2946            initialize(t) {
2947              t.node.updateWorldTransform();
2948              this._com = t;
2949              this._impl.initialize(t.node);
2950              r[this._impl.getObjectID()] = this;
2951              p(t.node);
2952            }
2953            onLoad() {
2954              this.setMaterial(this._com.sharedMaterial);
2955              this.setCenter(this._com.center);
2956              this.setAsTrigger(this._com.isTrigger);
2957            }
2958            onEnable() {
2959              this._impl.onEnable();
2960            }
2961            onDisable() {
2962              this._impl.onDisable();
2963            }
2964            onDestroy() {
2965              m(this._com.node);
2966              delete r[this._impl.getObjectID()];
2967              r[this._impl.getObjectID()] = null;
2968              this._impl.onDestroy();
2969            }
2970            setMaterial(t) {
2971              const e = cc.PhysicsSystem.instance;
2972              t || (t = e.defaultMaterial);
2973              s.CACHE.material[t.id] || (s.CACHE.material[t.id] = e.physicsWorld.impl.createMaterial(t.id, t.friction, t.friction, t.restitution, 2, 2));
2974              this._impl.setMaterial(t.id, t.friction, t.friction, t.restitution, 2, 2);
2975            }
2976            setAsTrigger(t) {
2977              this._impl.setAsTrigger(t);
2978            }
2979            setCenter(t) {
2980              this._impl.setCenter(t.x, t.y, t.z);
2981            }
2982            getAABB(t) {
2983              t.copy(this._impl.getAABB());
2984            }
2985            getBoundingSphere(t) {
2986              t.copy(this._impl.getBoundingSphere());
2987            }
2988            updateEventListener() {
2989              let t = 0;
2990              t |= g.DETECT_CONTACT_CCD;
2991              this._com.isTrigger && (t |= g.IS_TRIGGER);
2992              (this._com.needTriggerEvent || this._com.needCollisionEvent) && (t |= g.NEED_EVENT);
2993              this._impl.updateEventListener(t);
2994            }
2995            setGroup(t) {
2996              this._impl.setGroup(t);
2997            }
2998            getGroup() {
2999              return this._impl.getGroup();
3000            }
3001            addGroup(t) {
3002              this.setGroup(this.getGroup() | t);
3003            }
3004            removeGroup(t) {
3005              this.setGroup(this.getGroup() & ~t);
3006            }
3007            setMask(t) {
3008              this._impl.setMask(t >>> 0);
3009            }
3010            getMask() {
3011              return this._impl.getMask();
3012            }
3013            addMask(t) {
3014              this.setMask(this.getMask() | t);
3015            }
3016            removeMask(t) {
3017              this.setMask(this.getMask() & ~t);
3018            }
3019          }
3020          class b {
3021            get impl() {
3022              return this._impl;
3023            }
3024            get joint() {
3025              return this._com;
3026            }
3027            setEnableCollision(t) {
3028              this._impl.setEnableCollision(t);
3029            }
3030            setConnectedBody(t) {
3031              this._impl.setConnectedBody(t ? t.body.impl.getObjectID() : 0);
3032            }
3033            initialize(t) {
3034              this._com = t;
3035              this._impl.initialize(t.node);
3036              r[this._impl.getObjectID()] = this;
3037              this.onLoad();
3038            }
3039            onLoad() {
3040              this.setConnectedBody(this._com.connectedBody);
3041              this.setEnableCollision(this._com.enableCollision);
3042            }
3043            onEnable() {
3044              this._impl.onEnable();
3045            }
3046            onDisable() {
3047              this._impl.onDisable();
3048            }
3049            onDestroy() {
3050              delete r[this._impl.getObjectID()];
3051              r[this._impl.getObjectID()] = null;
3052              this._impl.onDestroy();
3053            }
3054          }
3055          cc.physics.selector.register("physx", {
3056            PhysicsWorld: class {
3057              get impl() {
3058                return this._impl;
3059              }
3060              constructor() {
3061                this._impl = new s.World;
3062              }
3063              setGravity(t) {
3064                this._impl.setGravity(t.x, t.y, t.z);
3065              }
3066              setAllowSleep(t) {
3067                this._impl.setAllowSleep(t);
3068              }
3069              setDefaultMaterial(t) {}
3070              step(t, e, i) {
3071                this._impl.step(t);
3072              }
3073              raycast(t, e, i, s) {
3074                o.origin = t.o;
3075                o.unitDir = t.d;
3076                o.mask = e.mask >>> 0;
3077                o.distance = e.maxDistance;
3078                o.queryTrigger = !!e.queryTrigger;
3079                const n = this._impl.raycast(o);
3080                if (n) {
3081                  const t = this._impl.raycastResult();
3082                  for (let e = 0; e < t.length; e++) {
3083                    const n = t[e];
3084                    const o = i.add();
3085                    o._assign(n.hitPoint, n.distance, r[n.shape].collider, n.hitNormal);
3086                    s.push(o);
3087                  }
3088                }
3089                return n;
3090              }
3091              raycastClosest(t, e, i) {
3092                o.origin = t.o;
3093                o.unitDir = t.d;
3094                o.mask = e.mask >>> 0;
3095                o.distance = e.maxDistance;
3096                o.queryTrigger = !!e.queryTrigger;
3097                const s = this._impl.raycastClosest(o);
3098                if (s) {
3099                  const t = this._impl.raycastClosestResult();
3100                  i._assign(t.hitPoint, t.distance, r[t.shape].collider, t.hitNormal);
3101                }
3102                return s;
3103              }
3104              emitEvents() {
3105                this.emitTriggerEvent();
3106                this.emitCollisionEvent();
3107                this._impl.emitEvents();
3108              }
3109              syncSceneToPhysics() {
3110                this._impl.syncSceneToPhysics();
3111              }
3112              syncAfterEvents() {}
3113              destroy() {
3114                this._impl.destroy();
3115              }
3116              emitTriggerEvent() {
3117                const t = this._impl.getTriggerEventPairs();
3118                const e = t.length / 3;
3119                for (let i = 0; i < e; i++) {
3120                  const e = 3 * i;
3121                  const s = r[t[e + 0]];
3122                  const n = r[t[e + 1]];
3123                  if (!s || !n) continue;
3124                  const o = s.collider;
3125                  const a = n.collider;
3126                  if (!(o && o.isValid && a && a.isValid)) continue;
3127                  if (!o.needTriggerEvent && !a.needTriggerEvent) continue;
3128                  const l = t[e + 2];
3129                  h(1 === l ? "onTriggerStay" : 0 === l ? "onTriggerEnter" : "onTriggerExit", o, a, t);
3130                }
3131              }
3132              emitCollisionEvent() {
3133                const t = this._impl.getContactEventPairs();
3134                const e = t.length / 4;
3135                for (let i = 0; i < e; i++) {
3136                  const e = 4 * i;
3137                  const s = r[t[e + 0]];
3138                  const n = r[t[e + 1]];
3139                  if (!s || !n) continue;
3140                  const o = s.collider;
3141                  const a = n.collider;
3142                  if (!(o && o.isValid && a && a.isValid)) continue;
3143                  if (!o.needCollisionEvent && !a.needCollisionEvent) continue;
3144                  const l = t[e + 2];
3145                  d(1 === l ? "onCollisionStay" : 0 === l ? "onCollisionEnter" : "onCollisionExit", o, a, t, t[e + 3]);
3146                }
3147              }
3148            },
3149            RigidBody: class {
3150              get impl() {
3151                return this._impl;
3152              }
3153              get rigidBody() {
3154                return this._com;
3155              }
3156              get isAwake() {
3157                return this._impl.isAwake();
3158              }
3159              get isSleepy() {
3160                return !1;
3161              }
3162              get isSleeping() {
3163                return this._impl.isSleeping();
3164              }
3165              constructor() {
3166                f();
3167                this._impl = new s.RigidBody;
3168                this._isUsingCCD = !1;
3169              }
3170              initialize(t) {
3171                t.node.updateWorldTransform();
3172                this._com = t;
3173                this._impl.initialize(t.node, t.type, t._group);
3174                p(t.node);
3175              }
3176              onEnable() {
3177                this.setType(this._com.type);
3178                this.setMass(this._com.mass);
3179                this.setAllowSleep(this._com.allowSleep);
3180                this.setLinearDamping(this._com.linearDamping);
3181                this.setAngularDamping(this._com.angularDamping);
3182                this.setLinearFactor(this._com.linearFactor);
3183                this.setAngularFactor(this._com.angularFactor);
3184                this.useGravity(this._com.useGravity);
3185                this._impl.onEnable();
3186              }
3187              onDisable() {
3188                this._impl.onDisable();
3189              }
3190              onDestroy() {
3191                m(this._com.node);
3192                this._impl.onDestroy();
3193              }
3194              setGroup(t) {
3195                this._impl.setGroup(t);
3196              }
3197              getGroup() {
3198                return this._impl.getGroup();
3199              }
3200              addGroup(t) {
3201                this.setGroup(this.getGroup() | t);
3202              }
3203              removeGroup(t) {
3204                this.setGroup(this.getGroup() & ~t);
3205              }
3206              setMask(t) {
3207                this._impl.setMask(t >>> 0);
3208              }
3209              getMask() {
3210                return this._impl.getMask();
3211              }
3212              addMask(t) {
3213                this.setMask(this.getMask() | t);
3214              }
3215              removeMask(t) {
3216                this.setMask(this.getMask() & ~t);
3217              }
3218              setType(t) {
3219                this._impl.setType(t);
3220              }
3221              setMass(t) {
3222                this._impl.setMass(t);
3223              }
3224              setAllowSleep(t) {
3225                this._impl.setAllowSleep(t);
3226              }
3227              setLinearDamping(t) {
3228                const e = cc.PhysicsSystem.instance.fixedTimeStep;
3229                this._impl.setLinearDamping((1 - (1 - t) ** e) / e);
3230              }
3231              setAngularDamping(t) {
3232                const e = cc.PhysicsSystem.instance.fixedTimeStep;
3233                this._impl.setAngularDamping((1 - (1 - t) ** e) / e);
3234              }
3235              isUsingCCD() {
3236                return this._isUsingCCD;
3237              }
3238              useCCD(t) {
3239                this._isUsingCCD = t;
3240                return this._impl.useCCD(t);
3241              }
3242              useGravity(t) {
3243                this._impl.useGravity(t);
3244              }
3245              setLinearFactor(t) {
3246                this._impl.setLinearFactor(t.x, t.y, t.z);
3247              }
3248              setAngularFactor(t) {
3249                this._impl.setAngularFactor(t.x, t.y, t.z);
3250              }
3251              wakeUp() {
3252                this._impl.wakeUp();
3253              }
3254              sleep() {
3255                this._impl.sleep();
3256              }
3257              clearState() {
3258                this._impl.clearState();
3259              }
3260              clearForces() {
3261                this._impl.clearForces();
3262              }
3263              clearVelocity() {
3264                this._impl.clearVelocity();
3265              }
3266              setSleepThreshold(t) {
3267                this._impl.setSleepThreshold(t);
3268              }
3269              getSleepThreshold() {
3270                return this._impl.getSleepThreshold();
3271              }
3272              getLinearVelocity(t) {
3273                t.set(this._impl.getLinearVelocity());
3274              }
3275              setLinearVelocity(t) {
3276                this._impl.setLinearVelocity(t.x, t.y, t.z);
3277              }
3278              getAngularVelocity(t) {
3279                t.set(this._impl.getAngularVelocity());
3280              }
3281              setAngularVelocity(t) {
3282                this._impl.setAngularVelocity(t.x, t.y, t.z);
3283              }
3284              applyForce(t, e) {
3285                null == e && (e = cc.Vec3.ZERO);
3286                this._impl.applyForce(t.x, t.y, t.z, e.x, e.y, e.z);
3287              }
3288              applyLocalForce(t, e) {
3289                null == e && (e = cc.Vec3.ZERO);
3290                this._impl.applyLocalForce(t.x, t.y, t.z, e.x, e.y, e.z);
3291              }
3292              applyImpulse(t, e) {
3293                null == e && (e = cc.Vec3.ZERO);
3294                this._impl.applyImpulse(t.x, t.y, t.z, e.x, e.y, e.z);
3295              }
3296              applyLocalImpulse(t, e) {
3297                null == e && (e = cc.Vec3.ZERO);
3298                this._impl.applyLocalImpulse(t.x, t.y, t.z, e.x, e.y, e.z);
3299              }
3300              applyTorque(t) {
3301                this._impl.applyTorque(t.x, t.y, t.z);
3302              }
3303              applyLocalTorque(t) {
3304                this._impl.applyLocalTorque(t.x, t.y, t.z);
3305              }
3306            },
3307            SphereShape: class extends y {
3308              constructor() {
3309                super();
3310                this._impl = new s.SphereShape;
3311              }
3312              updateRadius() {
3313                this._impl.setRadius(this.collider.radius);
3314              }
3315              onLoad() {
3316                super.onLoad();
3317                this.updateRadius();
3318              }
3319            },
3320            BoxShape: class extends y {
3321              constructor() {
3322                super();
3323                this._impl = new s.BoxShape;
3324              }
3325              updateSize() {
3326                const t = this.collider.size;
3327                this._impl.setSize(t.x, t.y, t.z);
3328              }
3329              onLoad() {
3330                super.onLoad();
3331                this.updateSize();
3332              }
3333            },
3334            PlaneShape: class extends y {
3335              constructor() {
3336                super();
3337                this._impl = new s.PlaneShape;
3338              }
3339              setConstant(t) {
3340                this._impl.setConstant(t);
3341              }
3342              setNormal(t) {
3343                this._impl.setNormal(t.x, t.y, t.z);
3344              }
3345              onLoad() {
3346                super.onLoad();
3347                this.setNormal(this._com.normal);
3348                this.setConstant(this._com.constant);
3349              }
3350            },
3351            CapsuleShape: class extends y {
3352              constructor() {
3353                super();
3354                this._impl = new s.CapsuleShape;
3355              }
3356              setRadius(t) {
3357                this._impl.setRadius(t);
3358              }
3359              setDirection(t) {
3360                this._impl.setDirection(t);
3361              }
3362              setCylinderHeight(t) {
3363                this._impl.setCylinderHeight(t);
3364              }
3365              onLoad() {
3366                super.onLoad();
3367                this.setRadius(this._com.radius);
3368                this.setDirection(this._com.direction);
3369                this.setCylinderHeight(this._com.cylinderHeight);
3370              }
3371            },
3372            ConeShape: class extends y {
3373              constructor() {
3374                super();
3375                this._impl = new s.ConeShape;
3376              }
3377              setRadius(t) {
3378                this.updateGeometry();
3379              }
3380              setDirection(t) {
3381                this.updateGeometry();
3382              }
3383              setHeight(t) {
3384                this.updateGeometry();
3385              }
3386              updateGeometry() {
3387                this._impl.setCone(this._com.radius, this._com.height, this._com.direction);
3388              }
3389              initialize(t) {
3390                if (!s.CACHE.convex.CONE) {
3391                  const t = cc.physics.utils.cylinder(0, .5, 1, {
3392                    radialSegments: 32,
3393                    heightSegments: 1
3394                  });
3395                  const e = cc.physics.utils.shrinkPositions(t.positions);
3396                  const i = {
3397                    positions: new Float32Array(e),
3398                    positionLength: e.length / 3
3399                  };
3400                  const n = cc.PhysicsSystem.instance.physicsWorld.impl.createConvex(i);
3401                  s.CACHE.convex.CONE = n;
3402                }
3403                this._com = t;
3404                this._impl.setCone(t.radius, t.height, t.direction);
3405                this._impl.setConvex(s.CACHE.convex.CONE);
3406                super.initialize(t);
3407              }
3408            },
3409            CylinderShape: class extends y {
3410              constructor() {
3411                super();
3412                this._impl = new s.CylinderShape;
3413              }
3414              setRadius(t) {
3415                this.updateGeometry();
3416              }
3417              setDirection(t) {
3418                this.updateGeometry();
3419              }
3420              setHeight(t) {
3421                this.updateGeometry();
3422              }
3423              updateGeometry() {
3424                this._impl.setCylinder(this._com.radius, this._com.height, this._com.direction);
3425              }
3426              initialize(t) {
3427                if (!s.CACHE.convex.CYLINDER) {
3428                  const t = cc.physics.utils.cylinder(.5, .5, 2, {
3429                    radialSegments: 32,
3430                    heightSegments: 1
3431                  });
3432                  const e = cc.physics.utils.shrinkPositions(t.positions);
3433                  const i = {
3434                    positions: new Float32Array(e),
3435                    positionLength: e.length / 3
3436                  };
3437                  const n = cc.PhysicsSystem.instance.physicsWorld.impl.createConvex(i);
3438                  s.CACHE.convex.CYLINDER = n;
3439                }
3440                this._com = t;
3441                this._impl.setCylinder(t.radius, t.height, t.direction);
3442                this._impl.setConvex(s.CACHE.convex.CYLINDER);
3443                super.initialize(t);
3444              }
3445            },
3446            TrimeshShape: class extends y {
3447              constructor() {
3448                super();
3449                this._impl = new s.TrimeshShape;
3450              }
3451              setConvex(t) {
3452                this._impl.useConvex(t);
3453              }
3454              setMesh(t) {
3455                if (!t) return;
3456                const e = this._com.convex;
3457                this._impl.useConvex(e);
3458                const i = e ? function(t) {
3459                  if (!s.CACHE.convex[t._uuid]) {
3460                    const e = cc.physics.utils.shrinkPositions(t.readAttribute(0, "a_position"));
3461                    const i = cc.PhysicsSystem.instance.physicsWorld.impl;
3462                    const n = {
3463                      positions: new Float32Array(e),
3464                      positionLength: e.length / 3
3465                    };
3466                    s.CACHE.convex[t._uuid] = i.createConvex(n);
3467                  }
3468                  return s.CACHE.convex[t._uuid];
3469                }(t) : function(t) {
3470                  if (!s.CACHE.trimesh[t._uuid]) {
3471                    const e = t.readIndices(0);
3472                    const i = t.readAttribute(0, "a_position");
3473                    const n = cc.PhysicsSystem.instance.physicsWorld.impl;
3474                    const r = {
3475                      positions: new Float32Array(i),
3476                      positionLength: i.length / 3,
3477                      triangles: new Uint16Array(e),
3478                      triangleLength: e.length / 3,
3479                      isU16: !0
3480                    };
3481                    s.CACHE.trimesh[t._uuid] = n.createTrimesh(r);
3482                  }
3483                  return s.CACHE.trimesh[t._uuid];
3484                }(t);
3485                this._impl.setMesh(i);
3486              }
3487              initialize(t) {
3488                this._com = t;
3489                this.setConvex(t.convex);
3490                this.setMesh(t.mesh);
3491                super.initialize(t);
3492              }
3493            },
3494            TerrainShape: class extends y {
3495              constructor() {
3496                super();
3497                this._impl = new s.TerrainShape;
3498              }
3499              setTerrain(t) {
3500                if (!t) return;
3501                const e = function(t) {
3502                  if (!s.CACHE.height[t._uuid]) {
3503                    const e = t.getVertexCountI();
3504                    const i = t.getVertexCountJ();
3505                    const n = new Int16Array(e * i);
3506                    const r = s.CONFIG.heightScale;
3507                    for (let s = 0; s < e; s++) for (let e = 0; e < i; e++) n[e + s * i] = t.getHeight(s, e) / r;
3508                    const o = {
3509                      rows: e,
3510                      columns: i,
3511                      samples: n
3512                    };
3513                    const a = cc.PhysicsSystem.instance.physicsWorld.impl;
3514                    s.CACHE.height[t._uuid] = a.createHeightField(o);
3515                  }
3516                  return s.CACHE.height[t._uuid];
3517                }(t);
3518                this._impl.setTerrain(e, t.tileSize, t.tileSize, s.CONFIG.heightScale);
3519              }
3520              initialize(t) {
3521                this._com = t;
3522                this.setTerrain(t.terrain);
3523                super.initialize(t);
3524              }
3525            },
3526            PointToPointConstraint: class extends b {
3527              constructor() {
3528                super();
3529                this._impl = new s.DistanceJoint;
3530              }
3531              setPivotA(t) {
3532                this._impl.setPivotA(t.x, t.y, t.z);
3533              }
3534              setPivotB(t) {
3535                this._impl.setPivotB(t.x, t.y, t.z);
3536              }
3537              onLoad() {
3538                super.onLoad();
3539                this.setPivotA(this._com.pivotA);
3540                this.setPivotB(this._com.pivotB);
3541              }
3542            },
3543            HingeConstraint: class extends b {
3544              constructor() {
3545                super();
3546                this._impl = new s.RevoluteJoint;
3547              }
3548              setAxis(t) {
3549                this._impl.setAxis(t.x, t.y, t.z);
3550              }
3551              setPivotA(t) {
3552                this._impl.setPivotA(t.x, t.y, t.z);
3553              }
3554              setPivotB(t) {
3555                this._impl.setPivotB(t.x, t.y, t.z);
3556              }
3557              onLoad() {
3558                super.onLoad();
3559                this.setAxis(this._com.axis);
3560                this.setPivotA(this._com.pivotA);
3561                this.setPivotB(this._com.pivotB);
3562              }
3563            }
3564          });
3565        }, {} ],
3566        12: [ function(t, e, i) {
3567          const s = t("./jsb-cache-manager");
3568          !function() {
3569            if (void 0 === window.spine || void 0 === window.middleware) return;
3570            if (void 0 === cc.internal.SpineSkeletonData) return;
3571            const t = window.spine;
3572            const e = window.middleware;
3573            e.generateGetSet(t);
3574            Object.defineProperty(t, "timeScale", {
3575              get() {
3576                return this._timeScale;
3577              },
3578              set(e) {
3579                this._timeScale = e;
3580                t.SkeletonAnimation.setGlobalTimeScale(e);
3581              },
3582              configurable: !0
3583            });
3584            const i = cc.color(0, 0, 255, 255);
3585            const n = cc.color(255, 0, 0, 255);
3586            const r = cc.color(255, 255, 0, 255);
3587            const o = cc.color(0, 255, 0, 255);
3588            const a = cc.internal.SpineSkeletonData.prototype;
3589            let l = 1;
3590            const h = {};
3591            const c = new WeakMap;
3592            const u = t.SkeletonDataMgr.getInstance();
3593            t.skeletonDataMgr = u;
3594            u.setDestroyCallback((t => {
3595              if (!t) return;
3596              const e = h[t];
3597              if (e && c.has(e)) {
3598                c.delete(e);
3599                delete h[t];
3600              }
3601            }));
3602            const _ = t.SkeletonCacheMgr.getInstance();
3603            t.skeletonCacheMgr = _;
3604            a.destroy = function() {
3605              this.reset();
3606              _.removeSkeletonCache(this._uuid);
3607              cc.Asset.prototype.destroy.call(this);
3608            };
3609            a.reset = function() {
3610              if (this._skeletonCache) {
3611                t.disposeSkeletonData(this._uuid);
3612                this._jsbTextures = null;
3613                this._skeletonCache = null;
3614              }
3615              this._atlasCache = null;
3616            };
3617            a.getRuntimeData = function() {
3618              this._skeletonCache || this.init();
3619              return this._skeletonCache;
3620            };
3621            a.init = function() {
3622              if (this._skeletonCache) return;
3623              const i = this._uuid;
3624              if (!i) {
3625                cc.errorID(7504);
3626                return;
3627              }
3628              const n = this.atlasText;
3629              if (!n) {
3630                cc.errorID(7508, this.name);
3631                return;
3632              }
3633              const r = this.textures;
3634              const o = this.textureNames;
3635              if (!(r && r.length > 0 && o && o.length > 0)) {
3636                cc.errorID(7507, this.name);
3637                return;
3638              }
3639              const a = {};
3640              for (let t = 0; t < r.length; ++t) {
3641                const i = r[t];
3642                const s = this.recordTexture(i);
3643                const n = new e.Texture2D;
3644                n.setRealTextureIndex(s);
3645                n.setPixelsWide(i.width);
3646                n.setPixelsHigh(i.height);
3647                a[o[t]] = n;
3648              }
3649              this._jsbTextures = a;
3650              let l = null;
3651              l = this.skeletonJsonStr ? this.skeletonJsonStr : s.getCache(this.nativeUrl) || this.nativeUrl;
3652              this._skeletonCache = t.initSkeletonData(i, l, n, a, this.scale);
3653              if (this._skeletonCache) {
3654                this.width = this._skeletonCache.getWidth();
3655                this.height = this._skeletonCache.getHeight();
3656              }
3657            };
3658            a.recordTexture = function(t) {
3659              const e = l;
3660              const i = h[e] = {
3661                key: e
3662              };
3663              c.set(i, t);
3664              l++;
3665              return e;
3666            };
3667            a.getTextureByIndex = function(t) {
3668              const e = h[t];
3669              return e ? c.get(e) : null;
3670            };
3671            const d = t.SkeletonAnimation.prototype;
3672            d.setCompleteListener = function(t) {
3673              this._compeleteListener = t;
3674              this.setCompleteListenerNative((function(t) {
3675                const e = Math.floor(t.trackTime / t.animationEnd);
3676                this._compeleteListener && this._compeleteListener(t, e);
3677              }));
3678            };
3679            d.setTrackCompleteListener = function(t, e) {
3680              this._trackCompeleteListener = e;
3681              this.setTrackCompleteListenerNative(t, (function(t) {
3682                const e = Math.floor(t.trackTime / t.animationEnd);
3683                this._trackCompeleteListener && this._trackCompeleteListener(t, e);
3684              }));
3685            };
3686            d.setAnimationListener = function(t, e) {
3687              this._target = t;
3688              this._callback = e;
3689              const i = legacyCC.internal.SpineAnimationEventType;
3690              this.setStartListener((function(t) {
3691                this._target && this._callback && this._callback.call(this._target, this, t, i.START, null, 0);
3692              }));
3693              this.setInterruptListener((function(t) {
3694                this._target && this._callback && this._callback.call(this._target, this, t, i.INTERRUPT, null, 0);
3695              }));
3696              this.setEndListener((function(t) {
3697                this._target && this._callback && this._callback.call(this._target, this, t, i.END, null, 0);
3698              }));
3699              this.setDisposeListener((function(t) {
3700                this._target && this._callback && this._callback.call(this._target, this, t, i.DISPOSE, null, 0);
3701              }));
3702              this.setCompleteListener((function(t, e) {
3703                this._target && this._callback && this._callback.call(this._target, this, t, i.COMPLETE, null, e);
3704              }));
3705              this.setEventListener((function(t, e) {
3706                this._target && this._callback && this._callback.call(this._target, this, t, i.EVENT, e, 0);
3707              }));
3708            };
3709            const p = cc.internal.SpineSkeleton.prototype;
3710            const m = cc.internal.SpineSkeleton.AnimationCacheMode;
3711            Object.defineProperty(p, "paused", {
3712              get() {
3713                return this._paused || !1;
3714              },
3715              set(t) {
3716                this._paused = t;
3717                this._nativeSkeleton && this._nativeSkeleton.paused(t);
3718              }
3719            });
3720            Object.defineProperty(p, "premultipliedAlpha", {
3721              get() {
3722                return void 0 === this._premultipliedAlpha || this._premultipliedAlpha;
3723              },
3724              set(t) {
3725                this._premultipliedAlpha = t;
3726                this._nativeSkeleton && this._nativeSkeleton.setOpacityModifyRGB(this._premultipliedAlpha);
3727              }
3728            });
3729            Object.defineProperty(p, "timeScale", {
3730              get() {
3731                return void 0 === this._timeScale ? 1 : this._timeScale;
3732              },
3733              set(t) {
3734                this._timeScale = t;
3735                this._nativeSkeleton && this._nativeSkeleton.setTimeScale(this._timeScale);
3736              }
3737            });
3738            const f = p._updateDebugDraw;
3739            p._updateDebugDraw = function() {
3740              f.call(this);
3741              if (this._nativeSkeleton && !this.isAnimationCached()) {
3742                this._nativeSkeleton.setDebugMeshEnabled(this.debugMesh);
3743                this._nativeSkeleton.setDebugSlotsEnabled(this.debugSlots);
3744                this._nativeSkeleton.setDebugBonesEnabled(this.debugBones);
3745              }
3746            };
3747            const g = p._updateUseTint;
3748            p._updateUseTint = function() {
3749              g.call(this);
3750              this._nativeSkeleton && this._nativeSkeleton.setUseTint(this.useTint);
3751            };
3752            p.setSkeletonData = function(e) {
3753              if (null != e.width && null != e.height) {
3754                this.node._uiProps.uiTransformComp.setContentSize(e.width, e.height);
3755              }
3756              const i = e._uuid;
3757              if (!i) {
3758                cc.errorID(7504);
3759                return;
3760              }
3761              const s = e.textures;
3762              const n = e.textureNames;
3763              if (!(s && s.length > 0 && n && n.length > 0)) {
3764                cc.errorID(7507, e.name);
3765                return;
3766              }
3767              if (this._nativeSkeleton) {
3768                this._nativeSkeleton.stopSchedule();
3769                this._nativeSkeleton._comp = null;
3770                this._nativeSkeleton = null;
3771              }
3772              let r = null;
3773              if (this.isAnimationCached()) r = new t.SkeletonCacheAnimation(i, this._cacheMode === m.SHARED_CACHE); else {
3774                r = new t.SkeletonAnimation;
3775                try {
3776                  t.initSkeletonRenderer(r, i);
3777                } catch (t) {
3778                  cc._throw(t);
3779                  return;
3780                }
3781                r.setDebugSlotsEnabled(this.debugSlots);
3782                r.setDebugMeshEnabled(this.debugMesh);
3783                r.setDebugBonesEnabled(this.debugBones);
3784              }
3785              this._nativeSkeleton = r;
3786              r._comp = this;
3787              r.setUseTint(this.useTint);
3788              r.setOpacityModifyRGB(this.premultipliedAlpha);
3789              r.setTimeScale(this.timeScale);
3790              r.setBatchEnabled(this.enableBatch);
3791              const o = this.color;
3792              r.setColor(o.r, o.g, o.b, o.a);
3793              this._skeleton = r.getSkeleton();
3794              this._startListener && this.setStartListener(this._startListener);
3795              this._endListener && this.setEndListener(this._endListener);
3796              this._completeListener && this.setCompleteListener(this._completeListener);
3797              this._eventListener && this.setEventListener(this._eventListener);
3798              this._interruptListener && this.setInterruptListener(this._interruptListener);
3799              this._disposeListener && this.setDisposeListener(this._disposeListener);
3800              this._sharedBufferOffset = r.getSharedBufferOffset();
3801              this._sharedBufferOffset[0] = 0;
3802              this._useAttach = !1;
3803              this._renderOrder = -1;
3804              this._paramsBuffer = r.getParamsBuffer();
3805              this.syncTransform(!0);
3806              this.markForUpdateRenderData();
3807            };
3808            p._updateColor = function() {
3809              if (this._nativeSkeleton) {
3810                const t = this.color;
3811                this._nativeSkeleton.setColor(t.r, t.g, t.b, t.a);
3812                this.markForUpdateRenderData();
3813              }
3814            };
3815            p.setAnimationStateData = function(t) {
3816              if (this._nativeSkeleton && !this.isAnimationCached()) {
3817                this._stateData = t;
3818                this._nativeSkeleton.setAnimationStateData(t);
3819              }
3820            };
3821            const y = p.onEnable;
3822            p.onEnable = function() {
3823              y && y.call(this);
3824              this._nativeSkeleton && this._nativeSkeleton.onEnable();
3825              this.syncTransform(!0);
3826              e.retain();
3827            };
3828            const b = p.onDisable;
3829            p.onDisable = function() {
3830              b && b.call(this);
3831              this._nativeSkeleton && this._nativeSkeleton.onDisable();
3832              e.release();
3833            };
3834            p.setVertexEffectDelegate = function(t) {
3835              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setVertexEffectDelegate(t);
3836            };
3837            p.syncTransform = function(t) {
3838              const e = this.node;
3839              if (!e) return;
3840              const i = this._paramsBuffer;
3841              if (i && (t || e.hasChangedFlags || e._dirtyFlags)) {
3842                const t = e.getWorldMatrix();
3843                i[1] = t.m00;
3844                i[2] = t.m01;
3845                i[3] = t.m02;
3846                i[4] = t.m03;
3847                i[5] = t.m04;
3848                i[6] = t.m05;
3849                i[7] = t.m06;
3850                i[8] = t.m07;
3851                i[9] = t.m08;
3852                i[10] = t.m09;
3853                i[11] = t.m10;
3854                i[12] = t.m11;
3855                i[13] = t.m12;
3856                i[14] = t.m13;
3857                i[15] = t.m14;
3858                i[16] = t.m15;
3859              }
3860            };
3861            p.updateAnimation = function(t) {
3862              const s = this._nativeSkeleton;
3863              if (!s) return;
3864              if (!this.node) return;
3865              const a = this._paramsBuffer;
3866              if (this._renderOrder !== e.renderOrder) {
3867                a[0] = e.renderOrder;
3868                this._renderOrder = e.renderOrder;
3869                e.renderOrder++;
3870              }
3871              this.syncTransform();
3872              if (void 0 === this.__preColor__ || !this.color.equals(this.__preColor__)) {
3873                const t = this.color;
3874                s.setColor(t.r, t.g, t.b, t.a);
3875                this.__preColor__ = t;
3876              }
3877              const l = this.socketNodes;
3878              if (!this._useAttach && l.size > 0) {
3879                this._useAttach = !0;
3880                s.setAttachEnabled(!0);
3881              }
3882              if (!this.isAnimationCached() && (this.debugBones || this.debugSlots || this.debugMesh) && this._debugRenderer) {
3883                const t = this._debugRenderer;
3884                t.clear();
3885                t.lineWidth = 5;
3886                const e = this._debugData || s.getDebugData();
3887                if (!e) return;
3888                let a = 0;
3889                let l = 0;
3890                let h = 0;
3891                l = e[a++];
3892                for (;0 !== l; ) {
3893                  h = e[a++];
3894                  switch (l) {
3895                   case 1:
3896                    t.strokeColor = i;
3897                    for (let i = 0; i < h; i += 8) {
3898                      t.moveTo(e[a++], e[a++]);
3899                      t.lineTo(e[a++], e[a++]);
3900                      t.lineTo(e[a++], e[a++]);
3901                      t.lineTo(e[a++], e[a++]);
3902                      t.close();
3903                      t.stroke();
3904                    }
3905                    break;
3906
3907                   case 2:
3908                    t.strokeColor = r;
3909                    for (let i = 0; i < h; i += 6) {
3910                      t.moveTo(e[a++], e[a++]);
3911                      t.lineTo(e[a++], e[a++]);
3912                      t.lineTo(e[a++], e[a++]);
3913                      t.close();
3914                      t.stroke();
3915                    }
3916                    break;
3917
3918                   case 3:
3919                    t.strokeColor = n;
3920                    t.fillColor = i;
3921                    for (let i = 0; i < h; i += 4) {
3922                      const s = e[a++];
3923                      const n = e[a++];
3924                      const r = e[a++];
3925                      const l = e[a++];
3926                      t.moveTo(s, n);
3927                      t.lineTo(r, l);
3928                      t.stroke();
3929                      t.circle(s, n, 1.5 * Math.PI);
3930                      t.fill();
3931                      0 === i && (t.fillColor = o);
3932                    }
3933                    break;
3934
3935                   default:
3936                    return;
3937                  }
3938                  l = e[a++];
3939                }
3940              }
3941            };
3942            p.updateWorldTransform = function() {
3943              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.updateWorldTransform();
3944            };
3945            p.setToSetupPose = function() {
3946              this._nativeSkeleton && this._nativeSkeleton.setToSetupPose();
3947            };
3948            p.setBonesToSetupPose = function() {
3949              this._nativeSkeleton && this._nativeSkeleton.setBonesToSetupPose();
3950            };
3951            p.setSlotsToSetupPose = function() {
3952              this._nativeSkeleton && this._nativeSkeleton.setSlotsToSetupPose();
3953            };
3954            p.setSlotsRange = function(t, e) {
3955              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setSlotsRange(t, e);
3956            };
3957            p.updateAnimationCache = function(t) {
3958              this.isAnimationCached() && this._nativeSkeleton && (t ? this._nativeSkeleton.updateAnimationCache(t) : this._nativeSkeleton.updateAllAnimationCache());
3959            };
3960            p.invalidAnimationCache = function() {
3961              this.isAnimationCached() && this._nativeSkeleton && this._nativeSkeleton.updateAllAnimationCache();
3962            };
3963            p.findBone = function(t) {
3964              return this._nativeSkeleton ? this._nativeSkeleton.findBone(t) : null;
3965            };
3966            p.findSlot = function(t) {
3967              return this._nativeSkeleton ? this._nativeSkeleton.findSlot(t) : null;
3968            };
3969            p.setSkin = function(t) {
3970              return this._nativeSkeleton ? this._nativeSkeleton.setSkin(t) : null;
3971            };
3972            p.getAttachment = function(t, e) {
3973              return this._nativeSkeleton ? this._nativeSkeleton.getAttachment(t, e) : null;
3974            };
3975            p.setAttachment = function(t, e) {
3976              this._nativeSkeleton && this._nativeSkeleton.setAttachment(t, e);
3977            };
3978            p.getTextureAtlas = function(t) {
3979              cc.warn("Spine Skeleton getTextureAtlas not support in native");
3980              return null;
3981            };
3982            p.setMix = function(t, e, i) {
3983              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setMix(t, e, i);
3984            };
3985            p.setAnimation = function(t, e, i) {
3986              const s = e.toString();
3987              this._animationName = s;
3988              this._playTimes = i ? 0 : 1;
3989              let n = null;
3990              if (this._nativeSkeleton) {
3991                n = this.isAnimationCached() ? this._nativeSkeleton.setAnimation(s, i) : this._nativeSkeleton.setAnimation(t, s, i);
3992                this._nativeSkeleton.update(0);
3993              }
3994              return n;
3995            };
3996            p.addAnimation = function(t, e, i, s) {
3997              if (this._nativeSkeleton) {
3998                s = s || 0;
3999                return this.isAnimationCached() ? this._nativeSkeleton.addAnimation(e, i, s) : this._nativeSkeleton.addAnimation(t, e, i, s);
4000              }
4001              return null;
4002            };
4003            p.findAnimation = function(t) {
4004              return this._nativeSkeleton ? this._nativeSkeleton.findAnimation(t) : null;
4005            };
4006            p.getCurrent = function(t) {
4007              return this._nativeSkeleton && !this.isAnimationCached() ? this._nativeSkeleton.getCurrent(t) : null;
4008            };
4009            p.clearTracks = function() {
4010              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.clearTracks();
4011            };
4012            p.clearTrack = function(t) {
4013              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.clearTrack(t);
4014            };
4015            p.setStartListener = function(t) {
4016              this._startListener = t;
4017              this._nativeSkeleton && (this.isAnimationCached() ? this._nativeSkeleton.setStartListener((function(t) {
4018                const e = this._comp;
4019                e._startEntry.animation.name = t;
4020                e._startListener && e._startListener(e._startEntry);
4021              })) : this._nativeSkeleton.setStartListener(t));
4022            };
4023            p.setInterruptListener = function(t) {
4024              this._interruptListener = t;
4025              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setInterruptListener(t);
4026            };
4027            p.setEndListener = function(t) {
4028              this._endListener = t;
4029              this._nativeSkeleton && (this.isAnimationCached() ? this._nativeSkeleton.setEndListener((function(t) {
4030                const e = this._comp;
4031                e._endEntry.animation.name = t;
4032                e._endListener && e._endListener(e._endEntry);
4033              })) : this._nativeSkeleton.setEndListener(t));
4034            };
4035            p.setDisposeListener = function(t) {
4036              this._disposeListener = t;
4037              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setDisposeListener(t);
4038            };
4039            p.setCompleteListener = function(t) {
4040              this._completeListener = t;
4041              this._nativeSkeleton && (this.isAnimationCached() ? this._nativeSkeleton.setCompleteListener((function(t) {
4042                const e = this._comp;
4043                e._endEntry.animation.name = t;
4044                e._completeListener && e._completeListener(e._endEntry);
4045              })) : this._nativeSkeleton.setCompleteListener(t));
4046            };
4047            p.setEventListener = function(t) {
4048              this._eventListener = t;
4049              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setEventListener(t);
4050            };
4051            p.setTrackStartListener = function(t, e) {
4052              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setTrackStartListener(t, e);
4053            };
4054            p.setTrackInterruptListener = function(t, e) {
4055              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setTrackInterruptListener(t, e);
4056            };
4057            p.setTrackEndListener = function(t, e) {
4058              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setTrackEndListener(t, e);
4059            };
4060            p.setTrackDisposeListener = function(t, e) {
4061              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setTrackDisposeListener(t, e);
4062            };
4063            p.setTrackCompleteListener = function(t, e) {
4064              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setTrackCompleteListener(t, e);
4065            };
4066            p.setTrackEventListener = function(t, e) {
4067              this._nativeSkeleton && !this.isAnimationCached() && this._nativeSkeleton.setTrackEventListener(t, e);
4068            };
4069            p.getState = function() {
4070              return this._nativeSkeleton && !this.isAnimationCached() ? this._nativeSkeleton.getState() : null;
4071            };
4072            p._ensureListener = function() {
4073              cc.warn("Spine Skeleton _ensureListener not need in native");
4074            };
4075            p._updateSkeletonData = function() {
4076              if (this.skeletonData) {
4077                this.skeletonData.init();
4078                this.setSkeletonData(this.skeletonData);
4079                this._indexBoneSockets();
4080                this.attachUtil.init(this);
4081                this._preCacheMode = this._cacheMode;
4082                this.defaultSkin && this._nativeSkeleton.setSkin(this.defaultSkin);
4083                this.animation = this.defaultAnimation;
4084              } else if (this._nativeSkeleton) {
4085                this._nativeSkeleton.stopSchedule();
4086                this._nativeSkeleton._comp = null;
4087                this._nativeSkeleton = null;
4088              }
4089              this._needUpdateSkeltonData = !1;
4090            };
4091            const S = p.onDestroy;
4092            p.onDestroy = function() {
4093              S.call(this);
4094              if (this._nativeSkeleton) {
4095                this._nativeSkeleton.stopSchedule();
4096                this._nativeSkeleton._comp = null;
4097                this._nativeSkeleton = null;
4098              }
4099              this._stateData = null;
4100            };
4101            const A = cc.mat4();
4102            let T;
4103            let v;
4104            let E;
4105            let C;
4106            p._render = function(t) {
4107              if (!this._nativeSkeleton) return;
4108              if (!this.node) return;
4109              const i = this.renderEntity;
4110              i.clearDynamicRenderDrawInfos();
4111              const s = this._sharedBufferOffset;
4112              if (!s) return;
4113              const n = s[0];
4114              s[0] = 0;
4115              const r = this.socketNodes;
4116              if (r.size > 0) {
4117                const t = e.attachInfoMgr.attachInfo;
4118                const i = s[1];
4119                s[1] = 0;
4120                for (const e of r.keys()) {
4121                  const s = r.get(e);
4122                  if (!s || !s.isValid) {
4123                    r.delete(e);
4124                    continue;
4125                  }
4126                  const n = A;
4127                  const o = i + 16 * e;
4128                  n.m00 = t[o];
4129                  n.m01 = t[o + 1];
4130                  n.m04 = t[o + 4];
4131                  n.m05 = t[o + 5];
4132                  n.m12 = t[o + 12];
4133                  n.m13 = t[o + 13];
4134                  s.matrix = n;
4135                }
4136              }
4137              const o = e.renderInfoMgr.renderInfo;
4138              let a = 0;
4139              let l;
4140              let h;
4141              if (4294967295 !== o[n + a++]) return;
4142              const c = o[n + a++];
4143              const u = this.useTint || this.isAnimationCached();
4144              const _ = u ? e.vfmtPosUvTwoColor : e.vfmtPosUvColor;
4145              T = _;
4146              if (0 !== c) for (let t = 0; t < c; t++) {
4147                l = o[n + a++];
4148                h = this.skeletonData.getTextureByIndex(l);
4149                if (!h) return;
4150                const s = this.material;
4151                this.material = this.getMaterialForBlendAndTint(o[n + a++], o[n + a++], u ? 1 : 0);
4152                v = o[n + a++];
4153                E = o[n + a++];
4154                C = o[n + a++];
4155                const r = e.RenderInfoLookup[T][v];
4156                const c = this.requestDrawInfo(t);
4157                c.setDrawInfoType(r.drawInfoType);
4158                c.setAccAndBuffer(r.accessor.id, r.chunk.bufferId);
4159                c.setTexture(h.getGFXTexture());
4160                c.setSampler(h.getGFXSampler());
4161                c.setMaterial(this.material);
4162                c.setIndexOffset(E);
4163                c.setIBCount(C);
4164                i.setDynamicRenderDrawInfo(c, t);
4165                this.material = s;
4166              }
4167            };
4168            const x = cc.internal.SpineAssembler;
4169            x.createData = function(t) {};
4170            x.updateRenderData = function(t) {
4171              t._render();
4172            };
4173            x.fillBuffers = function(t, e) {};
4174          }();
4175        }, {
4176          "./jsb-cache-manager": 3
4177        } ],
4178        13: [ function(t, e, i) {
4179          if (cc.internal.VideoPlayer) {
4180            const {EventType: t} = cc.internal.VideoPlayer;
4181            let e = cc.Vec3;
4182            let i = cc.Mat4;
4183            let s = new i;
4184            let n = new e;
4185            let r = new e;
4186            cc.internal.VideoPlayerImplManager.getImpl = function(t) {
4187              return new o(t);
4188            };
4189            class o extends cc.internal.VideoPlayerImpl {
4190              constructor(t) {
4191                super(t);
4192                this._matViewProj_temp = new i;
4193              }
4194              syncClip(t) {
4195                this.removeVideoPlayer();
4196                t && this.createVideoPlayer(t._nativeAsset);
4197              }
4198              syncURL(t) {
4199                this.removeVideoPlayer();
4200                t && this.createVideoPlayer(t);
4201              }
4202              onCanplay() {
4203                if (!this._loaded) {
4204                  this._loaded = !0;
4205                  this.video.setVisible(this._visible);
4206                  this.dispatchEvent(t.READY_TO_PLAY);
4207                  this.delayedPlay();
4208                }
4209              }
4210              _bindEvent() {
4211                this.video.addEventListener("loadedmetadata", this.onLoadedMetadata.bind(this));
4212                this.video.addEventListener("suspend", this.onCanPlay.bind(this));
4213                this.video.addEventListener("play", this.onPlay.bind(this));
4214                this.video.addEventListener("pause", this.onPause.bind(this));
4215                this.video.addEventListener("stoped", this.onStoped.bind(this));
4216                this.video.addEventListener("click", this.onClick.bind(this));
4217                this.video.addEventListener("ended", this.onEnded.bind(this));
4218              }
4219              onLoadedMetadata() {
4220                this._loadedMeta = !0;
4221                this._forceUpdate = !0;
4222                this._visible ? this.enable() : this.disable();
4223                this.dispatchEvent(t.META_LOADED);
4224                this.delayedFullScreen();
4225                this.delayedPlay();
4226              }
4227              createVideoPlayer(t) {
4228                this._video = new jsb.VideoPlayer;
4229                this._bindEvent();
4230                this._video.setVisible(this._visible);
4231                this._video.setURL(t);
4232                this._forceUpdate = !0;
4233              }
4234              removeVideoPlayer() {
4235                let t = this.video;
4236                if (t) {
4237                  t.stop();
4238                  t.setVisible(!1);
4239                  t.destroy();
4240                  this._playing = !1;
4241                  this._loaded = !1;
4242                  this._loadedMeta = !1;
4243                  this._ignorePause = !1;
4244                  this._cachedCurrentTime = 0;
4245                  this._video = null;
4246                }
4247              }
4248              getDuration() {
4249                return this.video ? this.video.duration() : -1;
4250              }
4251              syncPlaybackRate() {
4252                cc.warn("The platform does not support");
4253              }
4254              syncVolume() {
4255                cc.warn("The platform does not support");
4256              }
4257              syncMute() {
4258                cc.warn("The platform does not support");
4259              }
4260              syncLoop() {
4261                cc.warn("The platform does not support");
4262              }
4263              syncStayOnBottom() {
4264                cc.warn("The platform does not support");
4265              }
4266              getCurrentTime() {
4267                if (this.video) {
4268                  this._cachedCurrentTime = this.video.currentTime();
4269                  return this._cachedCurrentTime;
4270                }
4271                return -1;
4272              }
4273              seekTo(t) {
4274                let e = this._video;
4275                if (e) {
4276                  e.seekTo(t);
4277                  this._cachedCurrentTime = t;
4278                }
4279              }
4280              disable(t) {
4281                if (this.video) {
4282                  t || this.video.pause();
4283                  this.video.setVisible(!1);
4284                  this._visible = !1;
4285                }
4286              }
4287              enable() {
4288                if (this.video) {
4289                  this.video.setVisible(!0);
4290                  this._visible = !0;
4291                }
4292              }
4293              canPlay() {
4294                this.video.play();
4295                this.syncCurrentTime();
4296              }
4297              resume() {
4298                if (this.video) {
4299                  this.video.resume();
4300                  this.syncCurrentTime();
4301                  this._playing = !0;
4302                }
4303              }
4304              pause() {
4305                if (this.video) {
4306                  this._cachedCurrentTime = this.video.currentTime();
4307                  this.video.pause();
4308                }
4309              }
4310              stop() {
4311                if (this.video) {
4312                  this._ignorePause = !0;
4313                  this.video.seekTo(0);
4314                  this._cachedCurrentTime = 0;
4315                  this.video.stop();
4316                }
4317              }
4318              canFullScreen(t) {
4319                this.video && this.video.setFullScreenEnabled(t);
4320              }
4321              syncKeepAspectRatio(t) {
4322                this.video && this.video.setKeepAspectRatioEnabled(t);
4323              }
4324              syncMatrix() {
4325                if (!this._video || !this._component || !this._uiTrans) return;
4326                const t = this.UICamera;
4327                if (!t) return;
4328                this._component.node.getWorldMatrix(s);
4329                const {width: i, height: o} = this._uiTrans.contentSize;
4330                if (!this._forceUpdate && t.matViewProj.equals(this._matViewProj_temp) && this._m00 === s.m00 && this._m01 === s.m01 && this._m04 === s.m04 && this._m05 === s.m05 && this._m12 === s.m12 && this._m13 === s.m13 && this._w === i && this._h === o) return;
4331                this._matViewProj_temp.set(t.matViewProj);
4332                this._m00 = s.m00;
4333                this._m01 = s.m01;
4334                this._m04 = s.m04;
4335                this._m05 = s.m05;
4336                this._m12 = s.m12;
4337                this._m13 = s.m13;
4338                this._w = i;
4339                this._h = o;
4340                cc.game.canvas.width;
4341                let a = cc.game.canvas.height;
4342                let l = this._uiTrans.anchorPoint;
4343                e.set(n, -l.x * this._w, (1 - l.y) * this._h, 0);
4344                e.set(r, (1 - l.x) * this._w, -l.y * this._h, 0);
4345                e.transformMat4(n, n, s);
4346                e.transformMat4(r, r, s);
4347                t.update();
4348                t.worldToScreen(n, n);
4349                t.worldToScreen(r, r);
4350                let h = r.x - n.x;
4351                let c = n.y - r.y;
4352                this._video.setFrame(n.x, a - n.y, h, c);
4353                this._forceUpdate = !1;
4354              }
4355            }
4356          }
4357        }, {} ],
4358        14: [ function(t, e, i) {
4359          if (cc.internal.WebView) {
4360            const {EventType: t} = cc.internal.WebView;
4361            let e = cc.Vec3;
4362            let i = cc.Mat4;
4363            let s = new i;
4364            let n = new e;
4365            let r = new e;
4366            cc.internal.WebViewImplManager.getImpl = function(t) {
4367              return new o(t);
4368            };
4369            class o extends cc.internal.WebViewImpl {
4370              constructor(t) {
4371                super(t);
4372                this.jsCallback = null;
4373                this.interfaceSchema = null;
4374                this._matViewProj_temp = new i;
4375              }
4376              _bindEvent() {
4377                this.webview.setOnDidFinishLoading((() => {
4378                  this._forceUpdate = !0;
4379                  this.dispatchEvent(t.LOADED);
4380                }));
4381                this.webview.setOnDidFailLoading((() => {
4382                  this.dispatchEvent(t.ERROR);
4383                }));
4384                this.jsCallback && this.setOnJSCallback(this.jsCallback);
4385                this.interfaceSchema && this.setJavascriptInterfaceScheme(this.interfaceSchema);
4386                this.jsCallback = null;
4387                this.interfaceSchema = null;
4388              }
4389              createWebView() {
4390                if (jsb.WebView) {
4391                  this._webview = jsb.WebView.create();
4392                  this._bindEvent();
4393                } else console.warn("jsb.WebView is null");
4394              }
4395              removeWebView() {
4396                if (this.webview) {
4397                  this.webview.destroy();
4398                  this.reset();
4399                }
4400              }
4401              disable() {
4402                this.webview && this.webview.setVisible(!1);
4403              }
4404              enable() {
4405                this.webview && this.webview.setVisible(!0);
4406              }
4407              setOnJSCallback(t) {
4408                let e = this.webview;
4409                e ? e.setOnJSCallback(t) : this.jsCallback = t;
4410              }
4411              setJavascriptInterfaceScheme(t) {
4412                let e = this.webview;
4413                e ? e.setJavascriptInterfaceScheme(t) : this.interfaceSchema = t;
4414              }
4415              loadURL(e) {
4416                let i = this.webview;
4417                if (i) {
4418                  i.src = e;
4419                  i.loadURL(e);
4420                  this.dispatchEvent(t.LOADING);
4421                }
4422              }
4423              evaluateJS(t) {
4424                let e = this.webview;
4425                if (e) return e.evaluateJS(t);
4426              }
4427              syncMatrix() {
4428                if (!this._webview || !this._component || !this._uiTrans) return;
4429                const t = this.UICamera;
4430                if (!t) return;
4431                this._component.node.getWorldMatrix(s);
4432                const {width: i, height: o} = this._uiTrans.contentSize;
4433                if (!this._forceUpdate && t.matViewProj.equals(this._matViewProj_temp) && this._m00 === s.m00 && this._m01 === s.m01 && this._m04 === s.m04 && this._m05 === s.m05 && this._m12 === s.m12 && this._m13 === s.m13 && this._w === i && this._h === o) return;
4434                this._matViewProj_temp.set(t.matViewProj);
4435                this._m00 = s.m00;
4436                this._m01 = s.m01;
4437                this._m04 = s.m04;
4438                this._m05 = s.m05;
4439                this._m12 = s.m12;
4440                this._m13 = s.m13;
4441                this._w = i;
4442                this._h = o;
4443                cc.game.canvas.width;
4444                let a = cc.game.canvas.height;
4445                let l = this._uiTrans.anchorPoint;
4446                e.set(n, -l.x * this._w, (1 - l.y) * this._h, 0);
4447                e.set(r, (1 - l.x) * this._w, -l.y * this._h, 0);
4448                e.transformMat4(n, n, s);
4449                e.transformMat4(r, r, s);
4450                t.update();
4451                t.worldToScreen(n, n);
4452                t.worldToScreen(r, r);
4453                let h = r.x - n.x;
4454                let c = n.y - r.y;
4455                this._webview.setFrame(n.x, a - n.y, h, c);
4456                this._forceUpdate = !1;
4457              }
4458            }
4459          }
4460        }, {} ]
4461      }, {}, [ 1 ]);
4462    },
4463    935: t => {
4464      "use strict";
4465      var e = globalThis.requireNapi("display") || (isSystemplugin("display", "ohos") ? globalThis.ohosplugin.display : isSystemplugin("display", "system") ? globalThis.systemplugin.display : void 0);
4466      window.oh = {};
4467      t.exports = function() {
4468        return new Promise((t => {
4469          "undefined" == typeof XMLHttpRequest && (window.XMLHttpRequest = function() {});
4470          e.getDefaultDisplay(((t, e) => {
4471            window.oh.display = e;
4472          }));
4473          t();
4474        }));
4475      };
4476    },
4477    693: (t, e, i) => {
4478      "use strict";
4479      var s;
4480      var n, r;
4481      !function t(e, i, s) {
4482        function n(o, a) {
4483          if (!i[o]) {
4484            if (!e[o]) {
4485              if (r) return r(o, !0);
4486              var l = new Error("Cannot find module '" + o + "'");
4487              throw l.code = "MODULE_NOT_FOUND", l;
4488            }
4489            var h = i[o] = {
4490              exports: {}
4491            };
4492            e[o][0].call(h.exports, (function(t) {
4493              return n(e[o][1][t] || t);
4494            }), h, h.exports, t, e, i, s);
4495          }
4496          return i[o].exports;
4497        }
4498        for (var r = void 0, o = 0; o < s.length; o++) n(s[o]);
4499        return n;
4500      }({
4501        1: [ function(t, e, i) {
4502          var s = e.exports = {};
4503          var n;
4504          var r;
4505          function o() {
4506            throw new Error("setTimeout has not been defined");
4507          }
4508          function a() {
4509            throw new Error("clearTimeout has not been defined");
4510          }
4511          !function() {
4512            try {
4513              n = "function" == typeof setTimeout ? setTimeout : o;
4514            } catch (t) {
4515              n = o;
4516            }
4517            try {
4518              r = "function" == typeof clearTimeout ? clearTimeout : a;
4519            } catch (t) {
4520              r = a;
4521            }
4522          }();
4523          function l(t) {
4524            if (n === setTimeout) return setTimeout(t, 0);
4525            if ((n === o || !n) && setTimeout) {
4526              n = setTimeout;
4527              return setTimeout(t, 0);
4528            }
4529            try {
4530              return n(t, 0);
4531            } catch (e) {
4532              try {
4533                return n.call(null, t, 0);
4534              } catch (e) {
4535                return n.call(this, t, 0);
4536              }
4537            }
4538          }
4539          var h = [];
4540          var c = !1;
4541          var u;
4542          var _ = -1;
4543          function d() {
4544            if (c && u) {
4545              c = !1;
4546              u.length ? h = u.concat(h) : _ = -1;
4547              h.length && p();
4548            }
4549          }
4550          function p() {
4551            if (!c) {
4552              var t = l(d);
4553              c = !0;
4554              var e = h.length;
4555              for (;e; ) {
4556                u = h;
4557                h = [];
4558                for (;++_ < e; ) u && u[_].run();
4559                _ = -1;
4560                e = h.length;
4561              }
4562              u = null;
4563              c = !1;
4564              !function(t) {
4565                if (r === clearTimeout) return clearTimeout(t);
4566                if ((r === a || !r) && clearTimeout) {
4567                  r = clearTimeout;
4568                  return clearTimeout(t);
4569                }
4570                try {
4571                  r(t);
4572                } catch (e) {
4573                  try {
4574                    return r.call(null, t);
4575                  } catch (e) {
4576                    return r.call(this, t);
4577                  }
4578                }
4579              }(t);
4580            }
4581          }
4582          s.nextTick = function(t) {
4583            var e = new Array(arguments.length - 1);
4584            if (arguments.length > 1) for (var i = 1; i < arguments.length; i++) e[i - 1] = arguments[i];
4585            h.push(new m(t, e));
4586            1 !== h.length || c || l(p);
4587          };
4588          function m(t, e) {
4589            this.fun = t;
4590            this.array = e;
4591          }
4592          m.prototype.run = function() {
4593            this.fun.apply(null, this.array);
4594          };
4595          s.title = "browser";
4596          s.browser = !0;
4597          s.env = {};
4598          s.argv = [];
4599          s.version = "";
4600          s.versions = {};
4601          function f() {}
4602          s.on = f;
4603          s.addListener = f;
4604          s.once = f;
4605          s.off = f;
4606          s.removeListener = f;
4607          s.removeAllListeners = f;
4608          s.emit = f;
4609          s.prependListener = f;
4610          s.prependOnceListener = f;
4611          s.listeners = function(t) {
4612            return [];
4613          };
4614          s.binding = function(t) {
4615            throw new Error("process.binding is not supported");
4616          };
4617          s.cwd = function() {
4618            return "/";
4619          };
4620          s.chdir = function(t) {
4621            throw new Error("process.chdir is not supported");
4622          };
4623          s.umask = function() {
4624            return 0;
4625          };
4626        }, {} ],
4627        2: [ function(t, e, i) {
4628          (function(e, s) {
4629            (function() {
4630              var n = t("process/browser.js").nextTick;
4631              var r = Function.prototype.apply;
4632              var o = Array.prototype.slice;
4633              var a = {};
4634              var l = 0;
4635              i.setTimeout = function() {
4636                return new h(r.call(setTimeout, window, arguments), clearTimeout);
4637              };
4638              i.setInterval = function() {
4639                return new h(r.call(setInterval, window, arguments), clearInterval);
4640              };
4641              i.clearTimeout = i.clearInterval = function(t) {
4642                t.close();
4643              };
4644              function h(t, e) {
4645                this._id = t;
4646                this._clearFn = e;
4647              }
4648              h.prototype.unref = h.prototype.ref = function() {};
4649              h.prototype.close = function() {
4650                this._clearFn.call(window, this._id);
4651              };
4652              i.enroll = function(t, e) {
4653                clearTimeout(t._idleTimeoutId);
4654                t._idleTimeout = e;
4655              };
4656              i.unenroll = function(t) {
4657                clearTimeout(t._idleTimeoutId);
4658                t._idleTimeout = -1;
4659              };
4660              i._unrefActive = i.active = function(t) {
4661                clearTimeout(t._idleTimeoutId);
4662                var e = t._idleTimeout;
4663                e >= 0 && (t._idleTimeoutId = setTimeout((function() {
4664                  t._onTimeout && t._onTimeout();
4665                }), e));
4666              };
4667              i.setImmediate = "function" == typeof e ? e : function(t) {
4668                var e = l++;
4669                var s = !(arguments.length < 2) && o.call(arguments, 1);
4670                a[e] = !0;
4671                n((function() {
4672                  if (a[e]) {
4673                    s ? t.apply(null, s) : t.call(null);
4674                    i.clearImmediate(e);
4675                  }
4676                }));
4677                return e;
4678              };
4679              i.clearImmediate = "function" == typeof s ? s : function(t) {
4680                delete a[t];
4681              };
4682            }).call(this);
4683          }).call(this, t("timers").setImmediate, t("timers").clearImmediate);
4684        }, {
4685          "process/browser.js": 1,
4686          timers: 2
4687        } ],
4688        3: [ function(t, e, i) {
4689          (function(t) {
4690            (function() {
4691              !function(t) {
4692                s = [ i ], n = function(e) {
4693                  e.URL = t.URL || t.webkitURL;
4694                  if (t.Blob && t.URL) try {
4695                    new Blob;
4696                    return;
4697                  } catch (t) {}
4698                  var i = t.BlobBuilder || t.WebKitBlobBuilder || t.MozBlobBuilder || function() {
4699                    var i = function(t) {
4700                      return Object.prototype.toString.call(t).match(/^\[object\s(.*)\]$/)[1];
4701                    }, s = function() {
4702                      this.data = [];
4703                    }, n = function(t, e, i) {
4704                      this.data = t;
4705                      this.size = t.length;
4706                      this.type = e;
4707                      this.encoding = i;
4708                    }, r = s.prototype, o = n.prototype, a = t.FileReaderSync, l = function(t) {
4709                      this.code = this[this.name = t];
4710                    }, h = "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "), c = h.length, u = t.URL || t.webkitURL || e, _ = u.createObjectURL, d = u.revokeObjectURL, p = u, m = t.btoa, f = t.atob, g = t.ArrayBuffer, y = t.Uint8Array, b = /^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;
4711                    n.fake = o.fake = !0;
4712                    for (;c--; ) l.prototype[h[c]] = c + 1;
4713                    u.createObjectURL || (p = e.URL = function(t) {
4714                      var e, i = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
4715                      i.href = t;
4716                      if (!("origin" in i)) if ("data:" === i.protocol.toLowerCase()) i.origin = null; else {
4717                        e = t.match(b);
4718                        i.origin = e && e[1];
4719                      }
4720                      return i;
4721                    });
4722                    p.createObjectURL = function(t) {
4723                      var e, i = t.type;
4724                      null === i && (i = "application/octet-stream");
4725                      if (t instanceof n) {
4726                        e = "data:" + i;
4727                        return "base64" === t.encoding ? e + ";base64," + t.data : "URI" === t.encoding ? e + "," + decodeURIComponent(t.data) : m ? e + ";base64," + m(t.data) : e + "," + encodeURIComponent(t.data);
4728                      }
4729                      if (_) return _.call(u, t);
4730                    };
4731                    p.revokeObjectURL = function(t) {
4732                      "data:" !== t.substring(0, 5) && d && d.call(u, t);
4733                    };
4734                    r.append = function(t) {
4735                      var e = this.data;
4736                      if (y && (t instanceof g || t instanceof y)) {
4737                        var s = "", r = new y(t), o = 0, h = r.length;
4738                        for (;o < h; o++) s += String.fromCharCode(r[o]);
4739                        e.push(s);
4740                      } else if ("Blob" === i(t) || "File" === i(t)) {
4741                        if (!a) throw new l("NOT_READABLE_ERR");
4742                        var c = new a;
4743                        e.push(c.readAsBinaryString(t));
4744                      } else if (t instanceof n) "base64" === t.encoding && f ? e.push(f(t.data)) : "URI" === t.encoding ? e.push(decodeURIComponent(t.data)) : "raw" === t.encoding && e.push(t.data); else {
4745                        "string" != typeof t && (t += "");
4746                        e.push(unescape(encodeURIComponent(t)));
4747                      }
4748                    };
4749                    r.getBlob = function(t) {
4750                      arguments.length || (t = null);
4751                      return new n(this.data.join(""), t, "raw");
4752                    };
4753                    r.toString = function() {
4754                      return "[object BlobBuilder]";
4755                    };
4756                    o.slice = function(t, e, i) {
4757                      var s = arguments.length;
4758                      s < 3 && (i = null);
4759                      return new n(this.data.slice(t, s > 1 ? e : this.data.length), i, this.encoding);
4760                    };
4761                    o.toString = function() {
4762                      return "[object Blob]";
4763                    };
4764                    o.close = function() {
4765                      this.size = 0;
4766                      delete this.data;
4767                    };
4768                    return s;
4769                  }();
4770                  e.Blob = function(t, e) {
4771                    var s = e && e.type || "";
4772                    var n = new i;
4773                    if (t) for (var r = 0, o = t.length; r < o; r++) Uint8Array && t[r] instanceof Uint8Array ? n.append(t[r].buffer) : n.append(t[r]);
4774                    var a = n.getBlob(s);
4775                    !a.slice && a.webkitSlice && (a.slice = a.webkitSlice);
4776                    return a;
4777                  };
4778                  var s = Object.getPrototypeOf || function(t) {
4779                    return t.__proto__;
4780                  };
4781                  e.Blob.prototype = s(new e.Blob);
4782                }, void 0 !== (r = "function" == typeof n ? n.apply(i, s) : n) && (e.exports = r);
4783              }("undefined" != typeof self && self || "undefined" != typeof window && window || void 0 !== t && t || (void 0).content || void 0);
4784            }).call(this);
4785          }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
4786        }, {} ],
4787        4: [ function(t, e, i) {
4788          !function() {
4789            function t(t) {
4790              this.message = t;
4791            }
4792            var e = void 0 !== i ? i : "undefined" != typeof self ? self : $.global, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
4793            t.prototype = new Error, t.prototype.name = "InvalidCharacterError", e.btoa || (e.btoa = function(e) {
4794              for (var i, n, r = String(e), o = 0, a = s, l = ""; r.charAt(0 | o) || (a = "=",
4795              o % 1); l += a.charAt(63 & i >> 8 - o % 1 * 8)) {
4796                if ((n = r.charCodeAt(o += .75)) > 255) throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
4797                i = i << 8 | n;
4798              }
4799              return l;
4800            }), e.atob || (e.atob = function(e) {
4801              var i = String(e).replace(/[=]+$/, "");
4802              if (i.length % 4 == 1) throw new t("'atob' failed: The string to be decoded is not correctly encoded.");
4803              for (var n, r, o = 0, a = 0, l = ""; r = i.charAt(a++); ~r && (n = o % 4 ? 64 * n + r : r,
4804              o++ % 4) ? l += String.fromCharCode(255 & n >> (-2 * o & 6)) : 0) r = s.indexOf(r);
4805              return l;
4806            });
4807          }();
4808        }, {} ],
4809        5: [ function(t, e, i) {
4810          jsb.device = jsb.Device;
4811          const {btoa: s, atob: n} = t("./base64/base64.min");
4812          window.btoa = s;
4813          window.atob = n;
4814          const {Blob: r, URL: o} = t("./Blob");
4815          window.Blob = r;
4816          window.URL = o;
4817          window.DOMParser = t("./xmldom/dom-parser").DOMParser;
4818          t("./jsb_prepare");
4819          t("./jsb-adapter");
4820          t("./jsb_audioengine");
4821          t("./jsb_input");
4822          let a = null;
4823          let l = 0;
4824          let h = {};
4825          let c = !0;
4826          window.requestAnimationFrame = function(t) {
4827            let e = ++l;
4828            h[e] = t;
4829            return e;
4830          };
4831          window.cancelAnimationFrame = function(t) {
4832            delete h[t];
4833          };
4834          let u = 0;
4835          class _ {
4836            constructor(t, e, i, s, n) {
4837              this.cb = t;
4838              this.id = ++u;
4839              this.start = performance.now();
4840              this.delay = e;
4841              this.isRepeat = i;
4842              this.target = s;
4843              this.args = n;
4844            }
4845          }
4846          let d = {};
4847          function p(t, e) {
4848            let i = t[0];
4849            if (!i) {
4850              console.error("createTimeoutInfo doesn't pass a callback ...");
4851              return 0;
4852            }
4853            let s = t.length > 1 ? t[1] : 0;
4854            let n;
4855            t.length > 2 && (n = Array.prototype.slice.call(t, 2));
4856            let r = new _(i, s, e, this, n);
4857            d[r.id] = r;
4858            return r.id;
4859          }
4860          if (!window.oh) {
4861            window.setTimeout = function(t) {
4862              return p(arguments, !1);
4863            };
4864            window.clearTimeout = function(t) {
4865              delete d[t];
4866            };
4867            window.setInterval = function(t) {
4868              return p(arguments, !0);
4869            };
4870            window.clearInterval = window.clearTimeout;
4871          }
4872          window.alert = console.error.bind(console);
4873          if (void 0 !== jsb.FileUtils) {
4874            jsb.fileUtils = jsb.FileUtils.getInstance();
4875            delete jsb.FileUtils;
4876          }
4877          XMLHttpRequest.prototype.addEventListener = function(t, e, i) {
4878            this["on" + t] = e;
4879          };
4880          XMLHttpRequest.prototype.removeEventListener = function(t, e, i) {
4881            this["on" + t] = null;
4882          };
4883          if (window.SocketIO) {
4884            window.io = window.SocketIO;
4885            SocketIO.prototype._Emit = SocketIO.prototype.emit;
4886            SocketIO.prototype.emit = function(t, e) {
4887              "object" == typeof e && (e = JSON.stringify(e));
4888              this._Emit(t, e);
4889            };
4890          }
4891          window.gameTick = function(t) {
4892            if (c) {
4893              c = !1;
4894              if (window.onload) {
4895                var e = new Event("load");
4896                e._target = window;
4897                window.onload(e);
4898              }
4899            }
4900            !function(t) {
4901              let e;
4902              for (let i in d) {
4903                e = d[i];
4904                if (e && e.cb && t - e.start >= e.delay) {
4905                  "string" == typeof e.cb ? Function(e.cb)() : "function" == typeof e.cb && e.cb.apply(e.target, e.args);
4906                  e.isRepeat ? e.start = t : delete d[i];
4907                }
4908              }
4909            }(t);
4910            for (let e in h) {
4911              a = h[e];
4912              if (a) {
4913                delete h[e];
4914                a(t);
4915              }
4916            }
4917          };
4918          jsb.generateGetSet = function(t) {
4919            for (let e in t) {
4920              let i = t[e] && t[e].prototype;
4921              if (i) for (let t in i) {
4922                if (-1 == t.search(/^get/)) continue;
4923                let e = t.replace(/^get/, "");
4924                let s = e.split("");
4925                let n = s[0].toLowerCase();
4926                let r = s[0].toUpperCase();
4927                s.splice(0, 1);
4928                let o = s.join("");
4929                e = n + o;
4930                let a = "set" + r + o;
4931                if (i.hasOwnProperty(e)) continue;
4932                "function" == typeof i[a] ? Object.defineProperty(i, e, {
4933                  get() {
4934                    return this[t]();
4935                  },
4936                  set(t) {
4937                    this[a](t);
4938                  },
4939                  configurable: !0
4940                }) : Object.defineProperty(i, e, {
4941                  get() {
4942                    return this[t]();
4943                  },
4944                  configurable: !0
4945                });
4946              }
4947            }
4948          };
4949          t("./promise.min");
4950        }, {
4951          "./Blob": 3,
4952          "./base64/base64.min": 4,
4953          "./jsb-adapter": 30,
4954          "./jsb_audioengine": 35,
4955          "./jsb_input": 36,
4956          "./jsb_prepare": 37,
4957          "./promise.min": 38,
4958          "./xmldom/dom-parser": 39
4959        } ],
4960        6: [ function(t, e, i) {
4961          const s = t("./ImageData");
4962          class n {
4963            constructor() {
4964              this.lineWidth = void 0;
4965              this.lineJoin = void 0;
4966              this.fillStyle = void 0;
4967              this.font = void 0;
4968              this.lineCap = void 0;
4969              this.textAlign = void 0;
4970              this.textBaseline = void 0;
4971              this.strokeStyle = void 0;
4972              this.globalCompositeOperation = void 0;
4973              this.shadowBlur = void 0;
4974              this.shadowColor = void 0;
4975              this.shadowOffsetX = void 0;
4976              this.shadowOffsetY = void 0;
4977            }
4978          }
4979          jsb.CanvasRenderingContext2D.prototype._ctor = function() {
4980            this.__nativeRefs = {};
4981          };
4982          e.exports = class {
4983            constructor(t, e) {
4984              this._nativeObj = new jsb.CanvasRenderingContext2D(t, e);
4985              this._attris = new n;
4986            }
4987            get width() {
4988              return this._nativeObj.width;
4989            }
4990            set width(t) {
4991              this._nativeObj.width = t;
4992            }
4993            get height() {
4994              return this._nativeObj.height;
4995            }
4996            set height(t) {
4997              this._nativeObj.height = t;
4998            }
4999            get lineWidth() {
5000              return this._attris.lineWidth;
5001            }
5002            set lineWidth(t) {
5003              this._attris.lineWidth = t;
5004            }
5005            get lineJoin() {
5006              return this._attris.lineJoin;
5007            }
5008            set lineJoin(t) {
5009              this._attris.lineJoin = t;
5010            }
5011            get fillStyle() {
5012              return this._attris.fillStyle;
5013            }
5014            set fillStyle(t) {
5015              this._attris.fillStyle = t;
5016            }
5017            get font() {
5018              return this._attris.font;
5019            }
5020            set font(t) {
5021              this._attris.font = t;
5022            }
5023            get lineCap() {
5024              return this._attris.lineCap;
5025            }
5026            set lineCap(t) {
5027              this._attris.lineCap = t;
5028            }
5029            get textAlign() {
5030              return this._attris.textAlign;
5031            }
5032            set textAlign(t) {
5033              this._attris.textAlign = t;
5034            }
5035            get textBaseline() {
5036              return this._attris.textBaseline;
5037            }
5038            set textBaseline(t) {
5039              this._attris.textBaseline = t;
5040            }
5041            get strokeStyle() {
5042              return this._attris.strokeStyle;
5043            }
5044            set strokeStyle(t) {
5045              this._attris.strokeStyle = t;
5046            }
5047            get globalCompositeOperation() {
5048              return this._attris.globalCompositeOperation;
5049            }
5050            set globalCompositeOperation(t) {
5051              this._attris.globalCompositeOperation = t;
5052            }
5053            get shadowBlur() {
5054              return this._attris.shadowBlur;
5055            }
5056            set shadowBlur(t) {
5057              this._attris.shadowBlur = t;
5058            }
5059            get shadowColor() {
5060              return this._attris.shadowColor;
5061            }
5062            set shadowColor(t) {
5063              this._attris.shadowColor = t;
5064            }
5065            get shadowOffsetX() {
5066              return this._attris.shadowOffsetX;
5067            }
5068            set shadowOffsetX(t) {
5069              this._attris.shadowOffsetX = t;
5070            }
5071            get shadowOffsetY() {
5072              return this._attris.shadowOffsetY;
5073            }
5074            set shadowOffsetY(t) {
5075              this._attris.shadowOffsetY = t;
5076            }
5077            restore() {
5078              this._nativeObj.restore();
5079            }
5080            moveTo(t, e) {
5081              this._nativeObj.moveTo(t, e);
5082            }
5083            lineTo(t, e) {
5084              this._nativeObj.lineTo(t, e);
5085            }
5086            setTransform(t, e, i, s, n, r) {
5087              this._nativeObj.setTransform(t, e, i, s, n, r);
5088            }
5089            stroke() {
5090              this._canvas._dataInner = null;
5091              this._nativeObj.stroke();
5092            }
5093            measureText(t) {
5094              return this._nativeObj.measureText(t, this._attris);
5095            }
5096            fill() {
5097              this._canvas._dataInner = null;
5098              this._nativeObj.fill();
5099            }
5100            _fillImageData(t, e, i, s, n) {
5101              this._canvas._dataInner = null;
5102              this._nativeObj._fillImageData(t, e, i, s, n);
5103            }
5104            scale(t, e) {
5105              this._nativeObj.scale(t, e);
5106            }
5107            clearRect(t, e, i, s) {
5108              this._canvas._dataInner = null;
5109              this._nativeObj.clearRect(t, e, i, s);
5110            }
5111            transform(t, e, i, s, n, r) {
5112              this._nativeObj.transform(t, e, i, s, n, r);
5113            }
5114            fillText(t, e, i, s) {
5115              this._canvas._dataInner = null;
5116              this._nativeObj.fillText(t, e, i, s, this._attris);
5117            }
5118            strokeText(t, e, i, s) {
5119              this._canvas._dataInner = null;
5120              this._nativeObj.strokeText(t, e, i, s, this._attris);
5121            }
5122            save() {
5123              this._nativeObj.save();
5124            }
5125            fillRect(t, e, i, s) {
5126              this._canvas._dataInner = null;
5127              this._nativeObj.fillRect(t, e, i, s, this._attris);
5128            }
5129            fetchData() {
5130              void 0 !== this._nativeObj.fetchData && this._nativeObj.fetchData();
5131            }
5132            rotate(t) {
5133              this._nativeObj.rotate(t);
5134            }
5135            beginPath() {
5136              this._nativeObj.beginPath();
5137            }
5138            rect(t, e, i, s) {
5139              this._nativeObj.rect(t, e, i, s);
5140            }
5141            translate(t, e) {
5142              this._nativeObj.translate(t, e);
5143            }
5144            createLinearGradient(t, e, i, s) {
5145              return this._nativeObj.createLinearGradient(t, e, i, s);
5146            }
5147            closePath() {
5148              this._nativeObj.closePath();
5149            }
5150            putImageData(t, e, i, s, n, r, o) {
5151              this._canvas._data = t;
5152            }
5153            createImageData(t, e) {
5154              return "number" == typeof t && "number" == typeof e ? new s(t, e) : t instanceof s ? new s(t.data, t.width, t.height) : void 0;
5155            }
5156            _setCanvasBufferUpdatedCallback(t) {
5157              this._nativeObj._setCanvasBufferUpdatedCallback(t);
5158            }
5159          };
5160        }, {
5161          "./ImageData": 22
5162        } ],
5163        7: [ function(t, e, i) {
5164          e.exports = class {
5165            constructor(t, e, i, s) {
5166              this.x = t || 0;
5167              this.y = e || 0;
5168              this.width = i || 0;
5169              this.height = s || 0;
5170              this.left = this.x;
5171              this.top = this.y;
5172              this.right = this.x + this.width;
5173              this.bottom = this.y + this.height;
5174            }
5175          };
5176        }, {} ],
5177        8: [ function(t, e, i) {
5178          const s = t("./Event");
5179          e.exports = class extends s {
5180            constructor(t) {
5181              super("devicemotion");
5182              if (t) {
5183                this._acceleration = t.acceleration ? t.acceleration : {
5184                  x: 0,
5185                  y: 0,
5186                  z: 0
5187                };
5188                this._accelerationIncludingGravity = t.accelerationIncludingGravity ? t.accelerationIncludingGravity : {
5189                  x: 0,
5190                  y: 0,
5191                  z: 0
5192                };
5193                this._rotationRate = t.rotationRate ? t.rotationRate : {
5194                  alpha: 0,
5195                  beta: 0,
5196                  gamma: 0
5197                };
5198                this._interval = t.interval;
5199              } else {
5200                this._acceleration = {
5201                  x: 0,
5202                  y: 0,
5203                  z: 0
5204                };
5205                this._accelerationIncludingGravity = {
5206                  x: 0,
5207                  y: 0,
5208                  z: 0
5209                };
5210                this._rotationRate = {
5211                  alpha: 0,
5212                  beta: 0,
5213                  gamma: 0
5214                };
5215                this._interval = 0;
5216              }
5217            }
5218            get acceleration() {
5219              return this._acceleration;
5220            }
5221            get accelerationIncludingGravity() {
5222              return this._accelerationIncludingGravity;
5223            }
5224            get rotationRate() {
5225              return this._rotationRate;
5226            }
5227            get interval() {
5228              return this._interval;
5229            }
5230          };
5231        }, {
5232          "./Event": 10
5233        } ],
5234        9: [ function(t, e, i) {
5235          const s = t("./Node");
5236          const n = t("./DOMRect");
5237          e.exports = class extends s {
5238            constructor() {
5239              super();
5240              this.className = "";
5241              this.children = [];
5242              this.clientLeft = 0;
5243              this.clientTop = 0;
5244              this.scrollLeft = 0;
5245              this.scrollTop = 0;
5246            }
5247            get clientWidth() {
5248              return 0;
5249            }
5250            get clientHeight() {
5251              return 0;
5252            }
5253            getBoundingClientRect() {
5254              return new n(0, 0, window.innerWidth, window.innerHeight);
5255            }
5256            removeAttribute(t) {}
5257          };
5258        }, {
5259          "./DOMRect": 7,
5260          "./Node": 26
5261        } ],
5262        10: [ function(t, e, i) {
5263          class s {
5264            constructor(t, e) {
5265              this._type = t;
5266              this._target = null;
5267              this._eventPhase = 2;
5268              this._currentTarget = null;
5269              this._canceled = !1;
5270              this._stopped = !1;
5271              this._passiveListener = null;
5272              this._timeStamp = Date.now();
5273            }
5274            get type() {
5275              return this._type;
5276            }
5277            get target() {
5278              return this._target;
5279            }
5280            get currentTarget() {
5281              return this._currentTarget;
5282            }
5283            get isTrusted() {
5284              return !1;
5285            }
5286            get timeStamp() {
5287              return this._timeStamp;
5288            }
5289            composedPath() {
5290              const t = this._currentTarget;
5291              return null === t ? [] : [ t ];
5292            }
5293            get eventPhase() {
5294              return this._eventPhase;
5295            }
5296            stopPropagation() {}
5297            stopImmediatePropagation() {
5298              this._stopped = !0;
5299            }
5300            get bubbles() {
5301              return !1;
5302            }
5303            get cancelable() {
5304              return !0;
5305            }
5306            preventDefault() {
5307              null === this._passiveListener ? this.cancelable && (this._canceled = !0) : console.warn("Event#preventDefault() was called from a passive listener:", this._passiveListener);
5308            }
5309            get defaultPrevented() {
5310              return this._canceled;
5311            }
5312            get composed() {
5313              return !1;
5314            }
5315            get timeStamp() {
5316              return this._timeStamp;
5317            }
5318          }
5319          s.NONE = 0;
5320          s.CAPTURING_PHASE = 1;
5321          s.AT_TARGET = 2;
5322          s.BUBBLING_PHASE = 3;
5323          e.exports = s;
5324        }, {} ],
5325        11: [ function(t, e, i) {
5326          var s = 0;
5327          var n = {
5328            touch: {},
5329            mouse: {},
5330            keyboard: {},
5331            devicemotion: {}
5332          };
5333          var r = {
5334            touch: 0,
5335            mouse: 0,
5336            keyboard: 0,
5337            devicemotion: 0
5338          };
5339          var o = {
5340            touch: null,
5341            mouse: null,
5342            keyboard: null,
5343            devicemotion: null
5344          };
5345          var a = {
5346            touch: null,
5347            mouse: null,
5348            keyboard: null,
5349            devicemotion: null
5350          };
5351          const l = {
5352            touch: [ "touchstart", "touchmove", "touchend", "touchcancel" ],
5353            mouse: [ "mousedown", "mousemove", "mouseup", "mousewheel" ],
5354            keyboard: [ "keydown", "keyup", "keypress" ],
5355            devicemotion: [ "devicemotion" ]
5356          };
5357          function h(t) {
5358            return t && "object" == typeof t;
5359          }
5360          e.exports = class {
5361            constructor() {
5362              this._targetID = ++s;
5363              this._listenerCount = {
5364                touch: 0,
5365                mouse: 0,
5366                keyboard: 0,
5367                devicemotion: 0
5368              };
5369              this._listeners = new Map;
5370            }
5371            _associateSystemEventListener(t) {
5372              for (var e in l) if (l[e].indexOf(t) > -1) {
5373                o[e] && 0 === r[e] && o[e]();
5374                0 === this._listenerCount[e] && (n[e][this._targetID] = this);
5375                ++this._listenerCount[e];
5376                ++r[e];
5377                break;
5378              }
5379            }
5380            _dissociateSystemEventListener(t) {
5381              for (var e in l) if (l[e].indexOf(t) > -1) {
5382                this._listenerCount[e] <= 0 && delete n[e][this._targetID];
5383                --r[e];
5384                a[e] && 0 === r[e] && a[e]();
5385                break;
5386              }
5387            }
5388            addEventListener(t, e, i) {
5389              if (!e) return !1;
5390              if ("function" != typeof e && !h(e)) throw new TypeError("'listener' should be a function or an object.");
5391              const s = this._listeners;
5392              const n = h(i);
5393              const r = (n ? Boolean(i.capture) : Boolean(i)) ? 1 : 2;
5394              const o = {
5395                listener: e,
5396                listenerType: r,
5397                passive: n && Boolean(i.passive),
5398                once: n && Boolean(i.once),
5399                next: null
5400              };
5401              let a = s.get(t);
5402              if (void 0 === a) {
5403                s.set(t, o);
5404                this._associateSystemEventListener(t);
5405                return !0;
5406              }
5407              let l = null;
5408              for (;a; ) {
5409                if (a.listener === e && a.listenerType === r) return !1;
5410                l = a;
5411                a = a.next;
5412              }
5413              l.next = o;
5414              this._associateSystemEventListener(t);
5415              return !0;
5416            }
5417            removeEventListener(t, e, i) {
5418              if (!e) return !1;
5419              const s = this._listeners;
5420              const n = (h(i) ? Boolean(i.capture) : Boolean(i)) ? 1 : 2;
5421              let r = null;
5422              let o = s.get(t);
5423              for (;o; ) {
5424                if (o.listener === e && o.listenerType === n) {
5425                  r ? r.next = o.next : o.next ? s.set(t, o.next) : s.delete(t);
5426                  this._dissociateSystemEventListener(t);
5427                  return !0;
5428                }
5429                r = o;
5430                o = o.next;
5431              }
5432              return !1;
5433            }
5434            dispatchEvent(t) {
5435              if (!t || "string" != typeof t.type) throw new TypeError('"event.type" should be a string.');
5436              const e = t.type;
5437              var i = this["on" + e];
5438              if (i && "function" == typeof i) {
5439                t._target = t._currentTarget = this;
5440                i.call(this, t);
5441                t._target = t._currentTarget = null;
5442                t._eventPhase = 0;
5443                t._passiveListener = null;
5444                if (t.defaultPrevented) return !1;
5445              }
5446              const s = this._listeners;
5447              let n = s.get(e);
5448              if (!n) return !0;
5449              t._target = t._currentTarget = this;
5450              let r = null;
5451              for (;n; ) {
5452                n.once ? r ? r.next = n.next : n.next ? s.set(e, n.next) : s.delete(e) : r = n;
5453                t._passiveListener = n.passive ? n.listener : null;
5454                "function" == typeof n.listener && n.listener.call(this, t);
5455                if (t._stopped) break;
5456                n = n.next;
5457              }
5458              t._target = t._currentTarget = null;
5459              t._eventPhase = 0;
5460              t._passiveListener = null;
5461              return !t.defaultPrevented;
5462            }
5463          };
5464        }, {} ],
5465        12: [ function(t, e, i) {
5466          const s = t("./EventTarget");
5467          e.exports = class extends s {
5468            construct() {
5469              this.result = null;
5470            }
5471            abort() {}
5472            readAsArrayBuffer() {}
5473            readAsDataURL(t) {
5474              this.result = "data:image/png;base64," + window.btoa(t);
5475              var e = new Event("load");
5476              this.dispatchEvent(e);
5477            }
5478            readAsText() {}
5479          };
5480        }, {
5481          "./EventTarget": 11
5482        } ],
5483        13: [ function(t, e, i) {
5484          e.exports = class {
5485            constructor(t, e, i) {
5486              this.family = t;
5487              this.source = e;
5488              this.descriptors = i;
5489              this._status = "unloaded";
5490              this._loaded = new Promise(((t, e) => {
5491                this._resolveCB = t;
5492                this._rejectCB = e;
5493              }));
5494            }
5495            load() {}
5496            get status() {
5497              return this._status;
5498            }
5499            get loaded() {
5500              return this._loaded;
5501            }
5502          };
5503        }, {} ],
5504        14: [ function(t, e, i) {
5505          const s = t("./EventTarget");
5506          const n = t("./Event");
5507          e.exports = class extends s {
5508            constructor() {
5509              super();
5510              this._status = "loading";
5511            }
5512            get status() {
5513              return this._status;
5514            }
5515            set onloading(t) {
5516              this.addEventListener("loading", t);
5517            }
5518            set onloadingdone(t) {
5519              this.addEventListener("loadingdone", t);
5520            }
5521            set onloadingerror(t) {
5522              this.addEventListener("loadingerror", t);
5523            }
5524            add(t) {
5525              this._status = t._status = "loading";
5526              this.dispatchEvent(new n("loading"));
5527              let e = jsb.loadFont(t.family, t.source);
5528              setTimeout((() => {
5529                if (e) {
5530                  t._status = this._status = "loaded";
5531                  t._resolveCB();
5532                  this.dispatchEvent(new n("loadingdone"));
5533                } else {
5534                  t._status = this._status = "error";
5535                  t._rejectCB();
5536                  this.dispatchEvent(new n("loadingerror"));
5537                }
5538              }), 0);
5539            }
5540            clear() {}
5541            delete() {}
5542            load() {}
5543            ready() {}
5544          };
5545        }, {
5546          "./Event": 10,
5547          "./EventTarget": 11
5548        } ],
5549        15: [ function(t, e, i) {
5550          const s = t("./HTMLElement");
5551          const n = t("./ImageData");
5552          const r = t("./DOMRect");
5553          const o = t("./CanvasRenderingContext2D");
5554          e.exports = class extends s {
5555            constructor(t, e) {
5556              super("canvas");
5557              this.id = "glcanvas";
5558              this.type = "canvas";
5559              this.top = 0;
5560              this.left = 0;
5561              this._width = t ? Math.ceil(t) : 0;
5562              this._height = e ? Math.ceil(e) : 0;
5563              this._context2D = null;
5564              this._dataInner = null;
5565            }
5566            getContext(t, e) {
5567              const i = this;
5568              if ("2d" === t) {
5569                if (!this._context2D) {
5570                  this._context2D = new o(this._width, this._height);
5571                  this._context2D._canvas = this;
5572                  this._context2D._setCanvasBufferUpdatedCallback((t => {
5573                    i._dataInner = new n(t, i._width, i._height);
5574                  }));
5575                }
5576                return this._context2D;
5577              }
5578              return null;
5579            }
5580            get _data() {
5581              if (null === this._context2D) return null;
5582              this._dataInner || this._context2D.fetchData();
5583              return this._dataInner;
5584            }
5585            set _data(t) {
5586              this._dataInner = t;
5587            }
5588            set width(t) {
5589              t = Math.ceil(t);
5590              if (this._width !== t) {
5591                this._dataInner = null;
5592                this._width = t;
5593                this._context2D && (this._context2D.width = t);
5594              }
5595            }
5596            get width() {
5597              return this._width;
5598            }
5599            set height(t) {
5600              t = Math.ceil(t);
5601              if (this._height !== t) {
5602                this._dataInner = null;
5603                this._height = t;
5604                this._context2D && (this._context2D.height = t);
5605              }
5606            }
5607            get height() {
5608              return this._height;
5609            }
5610            get clientWidth() {
5611              return window.innerWidth;
5612            }
5613            get clientHeight() {
5614              return window.innerHeight;
5615            }
5616            get data() {
5617              return this._data ? this._data.data : null;
5618            }
5619            getBoundingClientRect() {
5620              return new r(0, 0, window.innerWidth, window.innerHeight);
5621            }
5622            requestPointerLock() {
5623              jsb.setCursorEnabled(!1);
5624            }
5625          };
5626        }, {
5627          "./CanvasRenderingContext2D": 6,
5628          "./DOMRect": 7,
5629          "./HTMLElement": 16,
5630          "./ImageData": 22
5631        } ],
5632        16: [ function(t, e, i) {
5633          const s = t("./Element");
5634          const {noop: n} = t("./util");
5635          e.exports = class extends s {
5636            constructor(t = "") {
5637              super();
5638              this.tagName = t.toUpperCase();
5639              this.className = "";
5640              this.children = [];
5641              this.style = {
5642                width: `${window.innerWidth}px`,
5643                height: `${window.innerHeight}px`
5644              };
5645              this.innerHTML = "";
5646              this.parentElement = window.__canvas;
5647            }
5648            setAttribute(t, e) {
5649              this[t] = e;
5650            }
5651            getAttribute(t) {
5652              return this[t];
5653            }
5654            focus() {}
5655          };
5656        }, {
5657          "./Element": 9,
5658          "./util": 33
5659        } ],
5660        17: [ function(t, e, i) {
5661          const s = t("./HTMLElement");
5662          const n = t("./Event");
5663          e.exports = class extends s {
5664            constructor(t, e, i) {
5665              if (!i) throw new TypeError("Illegal constructor, use 'new Image(w, h); instead!'");
5666              super("img");
5667              this.width = t || 0;
5668              this.height = e || 0;
5669              this._data = null;
5670              this._src = null;
5671              this.complete = !1;
5672              this.crossOrigin = null;
5673            }
5674            destroy() {
5675              if (this._data) {
5676                jsb.destroyImage(this._data);
5677                this._data = null;
5678              }
5679              this._src = null;
5680            }
5681            set src(t) {
5682              this._src = t;
5683              "" !== t && jsb.loadImage(t, (t => {
5684                if (t) {
5685                  this.width = this.naturalWidth = t.width;
5686                  this.height = this.naturalHeight = t.height;
5687                  this._data = t.data;
5688                  this.complete = !0;
5689                  e = new n("load");
5690                  this.dispatchEvent(e);
5691                } else {
5692                  this._data = null;
5693                  var e = new n("error");
5694                  this.dispatchEvent(e);
5695                }
5696              }));
5697            }
5698            get src() {
5699              return this._src;
5700            }
5701            get clientWidth() {
5702              return this.width;
5703            }
5704            get clientHeight() {
5705              return this.height;
5706            }
5707            getBoundingClientRect() {
5708              return new DOMRect(0, 0, this.width, this.height);
5709            }
5710          };
5711        }, {
5712          "./Event": 10,
5713          "./HTMLElement": 16
5714        } ],
5715        18: [ function(t, e, i) {
5716          const s = t("./HTMLElement");
5717          const n = t("./MediaError");
5718          e.exports = class extends s {
5719            constructor(t) {
5720              super(t);
5721              this._volume = 1;
5722              this._duration = 0;
5723              this._isEnded = !1;
5724              this._isMute = !1;
5725              this._readyState = 0;
5726              this._error = new n;
5727            }
5728            addTextTrack() {}
5729            captureStream() {}
5730            fastSeek() {}
5731            load() {}
5732            pause() {}
5733            play() {}
5734            canPlayType(t) {
5735              return "";
5736            }
5737            set volume(t) {
5738              this._volume = t;
5739            }
5740            get volume() {
5741              return this._volume;
5742            }
5743            get duration() {
5744              return this._duration;
5745            }
5746            get ended() {
5747              return this._isEnded;
5748            }
5749            get muted() {
5750              return this._isMute;
5751            }
5752            get readyState() {
5753              return this._readyState;
5754            }
5755            get error() {
5756              return this._error;
5757            }
5758            get currentTime() {
5759              return 0;
5760            }
5761          };
5762        }, {
5763          "./HTMLElement": 16,
5764          "./MediaError": 24
5765        } ],
5766        19: [ function(t, e, i) {
5767          const s = t("./HTMLElement");
5768          const n = t("./Event");
5769          const r = [];
5770          class o extends s {
5771            constructor(t, e) {
5772              super("script");
5773            }
5774            set type(t) {
5775              "systemjs-importmap" === t && -1 === r.indexOf(this) && r.push(this);
5776            }
5777            set src(e) {
5778              setTimeout((() => {
5779                t(e);
5780                this.dispatchEvent(new n("load"));
5781              }), 0);
5782            }
5783          }
5784          o._getAllScriptElementsSystemJSImportType = function() {
5785            return r;
5786          };
5787          e.exports = o;
5788        }, {
5789          "./Event": 10,
5790          "./HTMLElement": 16
5791        } ],
5792        20: [ function(t, e, i) {
5793          const s = t("./HTMLMediaElement");
5794          e.exports = class extends s {
5795            constructor() {
5796              super("video");
5797            }
5798            canPlayType(t) {
5799              return "video/mp4" === t;
5800            }
5801          };
5802        }, {
5803          "./HTMLMediaElement": 18
5804        } ],
5805        21: [ function(t, e, i) {
5806          let s = t("./HTMLImageElement");
5807          e.exports = class extends s {
5808            constructor(t, e) {
5809              super(t, e, !0);
5810            }
5811          };
5812        }, {
5813          "./HTMLImageElement": 17
5814        } ],
5815        22: [ function(t, e, i) {
5816          e.exports = class {
5817            constructor(t, e, i) {
5818              if ("number" == typeof t && "number" == typeof e) {
5819                i = e;
5820                e = t;
5821                t = null;
5822              }
5823              this._data = null === t ? new Uint8ClampedArray(e * i * 4) : t;
5824              this._width = e;
5825              this._height = i;
5826            }
5827            get data() {
5828              return this._data;
5829            }
5830            get width() {
5831              return this._width;
5832            }
5833            get height() {
5834              return this._height;
5835            }
5836          };
5837        }, {} ],
5838        23: [ function(t, e, i) {
5839          const s = t("./Event");
5840          const n = {
5841            48: ")",
5842            49: "!",
5843            50: "@",
5844            51: "#",
5845            52: "$",
5846            53: "%",
5847            54: "^",
5848            55: "&",
5849            56: "*",
5850            57: "("
5851          };
5852          var r = !1;
5853          e.exports = class extends s {
5854            constructor(t, e) {
5855              super(t);
5856              if ("object" == typeof e) {
5857                this._altKeyActive = !!e.altKey && e.altKey;
5858                this._ctrlKeyActive = !!e.ctrlKey && e.ctrlKey;
5859                this._metaKeyActive = !!e.metaKey && e.metaKey;
5860                this._shiftKeyActive = !!e.shiftKey && e.shiftKey;
5861                this._keyCode = e.keyCode ? e.keyCode : -1;
5862                this._repeat = !!e.repeat && e.repeat;
5863              } else {
5864                this._altKeyActive = !1;
5865                this._ctrlKeyActive = !1;
5866                this._metaKeyActive = !1;
5867                this._shiftKeyActive = !1;
5868                this._keyCode = -1;
5869                this._repeat = !1;
5870              }
5871              var i = this._keyCode;
5872              if (i >= 48 && i <= 57) {
5873                var s = i - 48;
5874                this._code = "Digit" + s;
5875                this._key = this._shiftKeyActive ? n[i] : "" + s;
5876              } else if (i >= 10048 && i <= 10057) {
5877                s = (i = this._keyCode = i - 1e4) - 48;
5878                this._code = "Numpad" + s;
5879                this._key = "" + s;
5880              } else if (i >= 65 && i <= 90) {
5881                var o = String.fromCharCode(i);
5882                this._code = "Key" + o;
5883                this._key = this._shiftKeyActive ^ r ? o : o.toLowerCase();
5884              } else if (i >= 97 && i <= 122) {
5885                o = String.fromCharCode(i);
5886                this._keyCode = i - 32;
5887                this._code = "Key" + o;
5888                this._key = this._shiftKeyActive ^ r ? o.toUpperCase() : o;
5889              } else if (i >= 112 && i <= 123) this._code = this._key = "F" + (i - 111); else if (27 === i) this._code = this._key = "Escape"; else if (189 === i) {
5890                this._code = "Minus";
5891                this._key = this._shiftKeyActive ? "_" : "-";
5892              } else if (187 === i) {
5893                this._code = "Equal";
5894                this._key = this._shiftKeyActive ? "+" : "=";
5895              } else if (220 === i) {
5896                this._code = "Backslash";
5897                this._key = this._shiftKeyActive ? "|" : "\\";
5898              } else if (192 === i) {
5899                this._code = "Backquote";
5900                this._key = this._shiftKeyActive ? "~" : "`";
5901              } else if (8 === i) this._code = this._key = "Backspace"; else if (13 === i) this._code = this._key = "Enter"; else if (219 === i) {
5902                this._code = "BracketLeft";
5903                this._key = this._shiftKeyActive ? "{" : "[";
5904              } else if (221 === i) {
5905                this._code = "BracketRight";
5906                this._key = this._shiftKeyActive ? "}" : "]";
5907              } else if (186 === i) {
5908                this._code = "Semicolon";
5909                this._key = this._shiftKeyActive ? ":" : ";";
5910              } else if (222 === i) {
5911                this._code = "Quote";
5912                this._key = this._shiftKeyActive ? '"' : "'";
5913              } else if (9 === i) this._code = this._key = "Tab"; else if (17 === i) {
5914                this._code = "ControlLeft";
5915                this._key = "Control";
5916              } else if (20017 === i) {
5917                this._keyCode = 17;
5918                this._code = "ControlRight";
5919                this._key = "Control";
5920              } else if (16 === i) {
5921                this._code = "ShiftLeft";
5922                this._key = "Shift";
5923              } else if (20016 === i) {
5924                this._keyCode = 16;
5925                this._code = "ShiftRight";
5926                this._key = "Shift";
5927              } else if (18 === i) {
5928                this._code = "AltLeft";
5929                this._key = "Alt";
5930              } else if (20018 === i) {
5931                this._keyCode = 18;
5932                this._code = "AltRight";
5933                this._key = "Alt";
5934              } else if (91 === i) {
5935                this._code = "MetaLeft";
5936                this._key = "Meta";
5937              } else if (93 === i) {
5938                this._code = "MetaRight";
5939                this._key = "Meta";
5940              } else if (37 === i) this._code = this._key = "ArrowLeft"; else if (38 === i) this._code = this._key = "ArrowUp"; else if (39 === i) this._code = this._key = "ArrowRight"; else if (40 === i) this._code = this._key = "ArrowDown"; else if (20093 === i) {
5941                this._keyCode = 93;
5942                this._code = this._key = "ContextMenu";
5943              } else if (20013 === i) {
5944                this._keyCode = 13;
5945                this._code = "NumpadEnter";
5946                this._key = "Enter";
5947              } else if (107 === i) {
5948                this._code = "NumpadAdd";
5949                this._key = "+";
5950              } else if (109 === i) {
5951                this._code = "NumpadSubtract";
5952                this._key = "-";
5953              } else if (106 === i) {
5954                this._code = "NumpadMultiply";
5955                this._key = "*";
5956              } else if (111 === i) {
5957                this._code = "NumpadDivide";
5958                this._key = "/";
5959              } else if (12 === i) {
5960                this._code = "NumLock";
5961                this._key = "Clear";
5962              } else if (124 === i) this._code = this._key = "F13"; else if (36 === i) this._code = this._key = "Home"; else if (33 === i) this._code = this._key = "PageUp"; else if (34 === i) this._code = this._key = "PageDown"; else if (35 === i) this._code = this._key = "End"; else if (188 === i) {
5963                this._code = "Comma";
5964                this._key = this._shiftKeyActive ? "<" : ",";
5965              } else if (190 === i) {
5966                this._code = "Period";
5967                this._key = this._shiftKeyActive ? ">" : ".";
5968              } else if (191 === i) {
5969                this._code = "Slash";
5970                this._key = this._shiftKeyActive ? "?" : "/";
5971              } else if (32 === i) {
5972                this._code = "Space";
5973                this._key = " ";
5974              } else if (46 === i) this._code = this._key = "Delete"; else if (110 === i) {
5975                this._code = "NumpadDecimal";
5976                this._key = ".";
5977              } else if (20 === i) {
5978                this._code = this._key = "CapsLock";
5979                "keyup" === t && (r = !r);
5980              } else console.log("Unknown keyCode: " + this._keyCode);
5981            }
5982            getModifierState() {
5983              return !1;
5984            }
5985            get altKey() {
5986              return this._altKeyActive;
5987            }
5988            get code() {
5989              return this._code;
5990            }
5991            get ctrlKey() {
5992              return this._ctrlKeyActive;
5993            }
5994            get isComposing() {
5995              return !1;
5996            }
5997            get key() {
5998              return this._key;
5999            }
6000            get keyCode() {
6001              return this._keyCode;
6002            }
6003            get location() {
6004              return 0;
6005            }
6006            get metaKey() {
6007              return this._metaKeyActive;
6008            }
6009            get repeat() {
6010              return this._repeat;
6011            }
6012            get shiftKey() {
6013              return this._shiftKeyActive;
6014            }
6015          };
6016        }, {
6017          "./Event": 10
6018        } ],
6019        24: [ function(t, e, i) {
6020          e.exports = class {
6021            constructor() {}
6022            get code() {
6023              return 1;
6024            }
6025            get message() {
6026              return "";
6027            }
6028          };
6029        }, {} ],
6030        25: [ function(t, e, i) {
6031          const s = t("./Event");
6032          e.exports = class extends s {
6033            constructor(t, e) {
6034              super(t);
6035              this._button = e.button;
6036              this._which = e.which;
6037              this._wheelDelta = e.wheelDelta;
6038              this._clientX = e.clientX;
6039              this._clientY = e.clientY;
6040              this._screenX = e.screenX;
6041              this._screenY = e.screenY;
6042              this._pageX = e.pageX;
6043              this._pageY = e.pageY;
6044            }
6045            get button() {
6046              return this._button;
6047            }
6048            get which() {
6049              return this._which;
6050            }
6051            get wheelDelta() {
6052              return this._wheelDelta;
6053            }
6054            get clientX() {
6055              return this._clientX;
6056            }
6057            get clientY() {
6058              return this._clientY;
6059            }
6060            get screenX() {
6061              return this._screenX;
6062            }
6063            get screenY() {
6064              return this._screenY;
6065            }
6066            get pageX() {
6067              return this._pageX;
6068            }
6069            get pageY() {
6070              return this._pageY;
6071            }
6072          };
6073        }, {
6074          "./Event": 10
6075        } ],
6076        26: [ function(t, e, i) {
6077          const s = t("./EventTarget");
6078          class n extends s {
6079            constructor() {
6080              super();
6081              this.childNodes = [];
6082              this.parentNode = window.__canvas;
6083            }
6084            appendChild(t) {
6085              if (!(t instanceof n)) throw new TypeError("Failed to executed 'appendChild' on 'Node': parameter 1 is not of type 'Node'.");
6086              this.childNodes.push(t);
6087            }
6088            insertBefore(t, e) {
6089              return t;
6090            }
6091            replaceChild(t, e) {
6092              return e;
6093            }
6094            cloneNode() {
6095              const t = Object.create(this);
6096              Object.assign(t, this);
6097              return t;
6098            }
6099            removeChild(t) {
6100              const e = this.childNodes.findIndex((e => e === t));
6101              return e > -1 ? this.childNodes.splice(e, 1) : null;
6102            }
6103            contains(t) {
6104              return this.childNodes.indexOf(t) > -1;
6105            }
6106          }
6107          e.exports = n;
6108        }, {
6109          "./EventTarget": 11
6110        } ],
6111        27: [ function(t, e, i) {
6112          const s = t("./Event");
6113          e.exports = class extends s {
6114            constructor(t, e) {
6115              super(t);
6116              this.touches = [];
6117              this.targetTouches = [];
6118              this.changedTouches = [];
6119            }
6120          };
6121        }, {
6122          "./Event": 10
6123        } ],
6124        28: [ function(t, e, i) {
6125          const s = t("./HTMLElement");
6126          const n = t("./Image");
6127          const r = t("./HTMLCanvasElement");
6128          const o = t("./HTMLVideoElement");
6129          const a = t("./HTMLScriptElement");
6130          const l = t("./Node");
6131          const h = t("./FontFaceSet");
6132          let c = new class extends l {
6133            constructor() {
6134              super();
6135              this.readyState = "complete";
6136              this.visibilityState = "visible";
6137              this.documentElement = window;
6138              this.hidden = !1;
6139              this.style = {};
6140              this.location = t("./location");
6141              this.head = new s("head");
6142              this.body = new s("body");
6143              this.fonts = new h;
6144              this.scripts = [];
6145            }
6146            createElementNS(t, e, i) {
6147              return this.createElement(e);
6148            }
6149            createElement(t) {
6150              return "canvas" === t ? new r(1, 1) : "img" === t ? new n : "video" === t ? new o : "script" === t ? new a : new s(t);
6151            }
6152            getElementById(t) {
6153              return t === window.__canvas.id || "canvas" === t ? window.__canvas : new s(t);
6154            }
6155            getElementsByTagName(t) {
6156              return "head" === t ? [ c.head ] : "body" === t ? [ c.body ] : "canvas" === t ? [ window.__canvas ] : [ new s(t) ];
6157            }
6158            getElementsByName(t) {
6159              return "head" === t ? [ c.head ] : "body" === t ? [ c.body ] : "canvas" === t ? [ window.__canvas ] : [ new s(t) ];
6160            }
6161            querySelector(t) {
6162              return "head" === t ? c.head : "body" === t ? c.body : "canvas" === t || t === `#${window.__canvas.id}` ? window.__canvas : new s(t);
6163            }
6164            querySelectorAll(t) {
6165              return "head" === t ? [ c.head ] : "body" === t ? [ c.body ] : "canvas" === t ? [ window.__canvas ] : t.startsWith('script[type="systemjs-importmap"]') ? a._getAllScriptElementsSystemJSImportType() : [ new s(t) ];
6166            }
6167            createTextNode() {
6168              return new s("text");
6169            }
6170            elementFromPoint() {
6171              return window.canvas;
6172            }
6173            createEvent(t) {
6174              return window[t] ? new window[t] : null;
6175            }
6176            exitPointerLock() {
6177              jsb.setCursorEnabled(!0);
6178            }
6179          };
6180          e.exports = c;
6181        }, {
6182          "./FontFaceSet": 14,
6183          "./HTMLCanvasElement": 15,
6184          "./HTMLElement": 16,
6185          "./HTMLScriptElement": 19,
6186          "./HTMLVideoElement": 20,
6187          "./Image": 21,
6188          "./Node": 26,
6189          "./location": 31
6190        } ],
6191        29: [ function(t, e, i) {
6192          Object.defineProperty(i, "__esModule", {
6193            value: !0
6194          });
6195          i.Headers = p;
6196          i.Request = A;
6197          i.Response = E;
6198          i.fetch = w;
6199          i.DOMException = void 0;
6200          var s = window;
6201          var n = "URLSearchParams" in s, r = "Symbol" in s && "iterator" in Symbol, o = "FileReader" in s && "Blob" in s && function() {
6202            try {
6203              new Blob;
6204              return !0;
6205            } catch (t) {
6206              return !1;
6207            }
6208          }(), a = "FormData" in s, l = "ArrayBuffer" in s;
6209          if (l) {
6210            var h = [ "[object Int8Array]", "[object Uint8Array]", "[object Uint8ClampedArray]", "[object Int16Array]", "[object Uint16Array]", "[object Int32Array]", "[object Uint32Array]", "[object Float32Array]", "[object Float64Array]" ];
6211            var c = ArrayBuffer.isView || function(t) {
6212              return t && h.indexOf(Object.prototype.toString.call(t)) > -1;
6213            };
6214          }
6215          function u(t) {
6216            "string" != typeof t && (t = String(t));
6217            if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t) || "" === t) throw new TypeError("Invalid character in header field name");
6218            return t.toLowerCase();
6219          }
6220          function _(t) {
6221            "string" != typeof t && (t = String(t));
6222            return t;
6223          }
6224          function d(t) {
6225            var e = {
6226              next: function() {
6227                var e = t.shift();
6228                return {
6229                  done: void 0 === e,
6230                  value: e
6231                };
6232              }
6233            };
6234            r && (e[Symbol.iterator] = function() {
6235              return e;
6236            });
6237            return e;
6238          }
6239          function p(t) {
6240            this.map = {};
6241            t instanceof p ? t.forEach((function(t, e) {
6242              this.append(e, t);
6243            }), this) : Array.isArray(t) ? t.forEach((function(t) {
6244              this.append(t[0], t[1]);
6245            }), this) : t && Object.getOwnPropertyNames(t).forEach((function(e) {
6246              this.append(e, t[e]);
6247            }), this);
6248          }
6249          p.prototype.append = function(t, e) {
6250            t = u(t);
6251            e = _(e);
6252            var i = this.map[t];
6253            this.map[t] = i ? i + ", " + e : e;
6254          };
6255          p.prototype.delete = function(t) {
6256            delete this.map[u(t)];
6257          };
6258          p.prototype.get = function(t) {
6259            t = u(t);
6260            return this.has(t) ? this.map[t] : null;
6261          };
6262          p.prototype.has = function(t) {
6263            return this.map.hasOwnProperty(u(t));
6264          };
6265          p.prototype.set = function(t, e) {
6266            this.map[u(t)] = _(e);
6267          };
6268          p.prototype.forEach = function(t, e) {
6269            for (var i in this.map) this.map.hasOwnProperty(i) && t.call(e, this.map[i], i, this);
6270          };
6271          p.prototype.keys = function() {
6272            var t = [];
6273            this.forEach((function(e, i) {
6274              t.push(i);
6275            }));
6276            return d(t);
6277          };
6278          p.prototype.values = function() {
6279            var t = [];
6280            this.forEach((function(e) {
6281              t.push(e);
6282            }));
6283            return d(t);
6284          };
6285          p.prototype.entries = function() {
6286            var t = [];
6287            this.forEach((function(e, i) {
6288              t.push([ i, e ]);
6289            }));
6290            return d(t);
6291          };
6292          r && (p.prototype[Symbol.iterator] = p.prototype.entries);
6293          function m(t) {
6294            if (t.bodyUsed) return Promise.reject(new TypeError("Already read"));
6295            t.bodyUsed = !0;
6296          }
6297          function f(t) {
6298            return new Promise((function(e, i) {
6299              t.onload = function() {
6300                e(t.result);
6301              };
6302              t.onerror = function() {
6303                i(t.error);
6304              };
6305            }));
6306          }
6307          function g(t) {
6308            var e = new FileReader;
6309            var i = f(e);
6310            e.readAsArrayBuffer(t);
6311            return i;
6312          }
6313          function y(t) {
6314            if (t.slice) return t.slice(0);
6315            var e = new Uint8Array(t.byteLength);
6316            e.set(new Uint8Array(t));
6317            return e.buffer;
6318          }
6319          function b() {
6320            this.bodyUsed = !1;
6321            this._initBody = function(t) {
6322              this._bodyInit = t;
6323              if (t) if ("string" == typeof t) this._bodyText = t; else if (o && Blob.prototype.isPrototypeOf(t)) this._bodyBlob = t; else if (a && FormData.prototype.isPrototypeOf(t)) this._bodyFormData = t; else if (n && URLSearchParams.prototype.isPrototypeOf(t)) this._bodyText = t.toString(); else if (l && o && ((e = t) && DataView.prototype.isPrototypeOf(e))) {
6324                this._bodyArrayBuffer = y(t.buffer);
6325                this._bodyInit = new Blob([ this._bodyArrayBuffer ]);
6326              } else l && (ArrayBuffer.prototype.isPrototypeOf(t) || c(t)) ? this._bodyArrayBuffer = y(t) : this._bodyText = t = Object.prototype.toString.call(t); else this._bodyText = "";
6327              var e;
6328              this.headers.get("content-type") || ("string" == typeof t ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : n && URLSearchParams.prototype.isPrototypeOf(t) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
6329            };
6330            if (o) {
6331              this.blob = function() {
6332                var t = m(this);
6333                if (t) return t;
6334                if (this._bodyBlob) return Promise.resolve(this._bodyBlob);
6335                if (this._bodyArrayBuffer) return Promise.resolve(new Blob([ this._bodyArrayBuffer ]));
6336                if (this._bodyFormData) throw new Error("could not read FormData body as blob");
6337                return Promise.resolve(new Blob([ this._bodyText ]));
6338              };
6339              this.arrayBuffer = function() {
6340                return this._bodyArrayBuffer ? m(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(g);
6341              };
6342            }
6343            this.text = function() {
6344              var t = m(this);
6345              if (t) return t;
6346              if (this._bodyBlob) return function(t) {
6347                var e = new FileReader;
6348                var i = f(e);
6349                e.readAsText(t);
6350                return i;
6351              }(this._bodyBlob);
6352              if (this._bodyArrayBuffer) return Promise.resolve(function(t) {
6353                var e = new Uint8Array(t);
6354                var i = new Array(e.length);
6355                for (var s = 0; s < e.length; s++) i[s] = String.fromCharCode(e[s]);
6356                return i.join("");
6357              }(this._bodyArrayBuffer));
6358              if (this._bodyFormData) throw new Error("could not read FormData body as text");
6359              return Promise.resolve(this._bodyText);
6360            };
6361            a && (this.formData = function() {
6362              return this.text().then(T);
6363            });
6364            this.json = function() {
6365              return this.text().then(JSON.parse);
6366            };
6367            return this;
6368          }
6369          var S = [ "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT" ];
6370          function A(t, e) {
6371            var i = (e = e || {}).body;
6372            if (t instanceof A) {
6373              if (t.bodyUsed) throw new TypeError("Already read");
6374              this.url = t.url;
6375              this.credentials = t.credentials;
6376              e.headers || (this.headers = new p(t.headers));
6377              this.method = t.method;
6378              this.mode = t.mode;
6379              this.signal = t.signal;
6380              if (!i && null != t._bodyInit) {
6381                i = t._bodyInit;
6382                t.bodyUsed = !0;
6383              }
6384            } else this.url = String(t);
6385            this.credentials = e.credentials || this.credentials || "same-origin";
6386            !e.headers && this.headers || (this.headers = new p(e.headers));
6387            this.method = (s = e.method || this.method || "GET", n = s.toUpperCase(), S.indexOf(n) > -1 ? n : s);
6388            var s, n;
6389            this.mode = e.mode || this.mode || null;
6390            this.signal = e.signal || this.signal;
6391            this.referrer = null;
6392            if (("GET" === this.method || "HEAD" === this.method) && i) throw new TypeError("Body not allowed for GET or HEAD requests");
6393            this._initBody(i);
6394          }
6395          A.prototype.clone = function() {
6396            return new A(this, {
6397              body: this._bodyInit
6398            });
6399          };
6400          function T(t) {
6401            var e = new FormData;
6402            t.trim().split("&").forEach((function(t) {
6403              if (t) {
6404                var i = t.split("=");
6405                var s = i.shift().replace(/\+/g, " ");
6406                var n = i.join("=").replace(/\+/g, " ");
6407                e.append(decodeURIComponent(s), decodeURIComponent(n));
6408              }
6409            }));
6410            return e;
6411          }
6412          function v(t) {
6413            var e = new p;
6414            t.replace(/\r?\n[\t ]+/g, " ").split(/\r?\n/).forEach((function(t) {
6415              var i = t.split(":");
6416              var s = i.shift().trim();
6417              if (s) {
6418                var n = i.join(":").trim();
6419                e.append(s, n);
6420              }
6421            }));
6422            return e;
6423          }
6424          b.call(A.prototype);
6425          function E(t, e) {
6426            e || (e = {});
6427            this.type = "default";
6428            this.status = void 0 === e.status ? 200 : e.status;
6429            this.ok = this.status >= 200 && this.status < 300;
6430            this.statusText = "statusText" in e ? e.statusText : "OK";
6431            this.headers = new p(e.headers);
6432            this.url = e.url || "";
6433            this._initBody(t);
6434          }
6435          b.call(E.prototype);
6436          E.prototype.clone = function() {
6437            return new E(this._bodyInit, {
6438              status: this.status,
6439              statusText: this.statusText,
6440              headers: new p(this.headers),
6441              url: this.url
6442            });
6443          };
6444          E.error = function() {
6445            var t = new E(null, {
6446              status: 0,
6447              statusText: ""
6448            });
6449            t.type = "error";
6450            return t;
6451          };
6452          var C = [ 301, 302, 303, 307, 308 ];
6453          E.redirect = function(t, e) {
6454            if (-1 === C.indexOf(e)) throw new RangeError("Invalid status code");
6455            return new E(null, {
6456              status: e,
6457              headers: {
6458                location: t
6459              }
6460            });
6461          };
6462          var x = s.DOMException;
6463          i.DOMException = x;
6464          try {
6465            new x;
6466          } catch (t) {
6467            i.DOMException = x = function(t, e) {
6468              this.message = t;
6469              this.name = e;
6470              var i = Error(t);
6471              this.stack = i.stack;
6472            };
6473            x.prototype = Object.create(Error.prototype);
6474            x.prototype.constructor = x;
6475          }
6476          function w(t, e) {
6477            return new Promise((function(i, s) {
6478              var n = new A(t, e);
6479              if (n.signal && n.signal.aborted) return s(new x("Aborted", "AbortError"));
6480              var r = new XMLHttpRequest;
6481              function a() {
6482                r.abort();
6483              }
6484              r.onload = function() {
6485                var t = {
6486                  status: r.status,
6487                  statusText: r.statusText,
6488                  headers: v(r.getAllResponseHeaders() || "")
6489                };
6490                t.url = "responseURL" in r ? r.responseURL : t.headers.get("X-Request-URL");
6491                var e = "response" in r ? r.response : r.responseText;
6492                i(new E(e, t));
6493              };
6494              r.onerror = function() {
6495                s(new TypeError("Network request failed"));
6496              };
6497              r.ontimeout = function() {
6498                s(new TypeError("Network request failed"));
6499              };
6500              r.onabort = function() {
6501                s(new x("Aborted", "AbortError"));
6502              };
6503              r.open(n.method, n.url, !0);
6504              "include" === n.credentials ? r.withCredentials = !0 : "omit" === n.credentials && (r.withCredentials = !1);
6505              "responseType" in r && o && (r.responseType = "blob");
6506              n.headers.forEach((function(t, e) {
6507                r.setRequestHeader(e, t);
6508              }));
6509              if (n.signal) {
6510                n.signal.addEventListener("abort", a);
6511                r.onreadystatechange = function() {
6512                  4 === r.readyState && n.signal.removeEventListener("abort", a);
6513                };
6514              }
6515              r.send(void 0 === n._bodyInit ? null : n._bodyInit);
6516            }));
6517          }
6518          w.polyfill = !0;
6519        }, {} ],
6520        30: [ function(t, e, i) {
6521          t("./window");
6522        }, {
6523          "./window": 34
6524        } ],
6525        31: [ function(t, e, i) {
6526          const s = {
6527            href: "game.js",
6528            pathname: "game.js",
6529            search: "",
6530            hash: "",
6531            protocol: "",
6532            reload() {}
6533          };
6534          e.exports = s;
6535        }, {} ],
6536        32: [ function(t, e, i) {
6537          let {noop: s} = t("./util");
6538          const n = {
6539            platform: __getOS(),
6540            language: __getCurrentLanguage(),
6541            appVersion: "5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
6542            userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 NetType/WIFI Language/zh_CN",
6543            onLine: !0,
6544            geolocation: {
6545              getCurrentPosition: s,
6546              watchPosition: s,
6547              clearWatch: s
6548            },
6549            maxTouchPoints: 10
6550          };
6551          e.exports = n;
6552        }, {
6553          "./util": 33
6554        } ],
6555        33: [ function(t, e, i) {
6556          e.exports = function() {};
6557        }, {} ],
6558        34: [ function(t, e, i) {
6559          window._isInjected || function() {
6560            window.top = window.parent = window;
6561            window.ontouchstart = null;
6562            window.ontouchmove = null;
6563            window.ontouchend = null;
6564            window.ontouchcancel = null;
6565            window.pageXOffset = window.pageYOffset = window.clientTop = window.clientLeft = 0;
6566            window.outerWidth = window.innerWidth;
6567            window.outerHeight = window.innerHeight;
6568            window.clientWidth = window.innerWidth;
6569            window.clientHeight = window.innerHeight;
6570            window.location = t("./location");
6571            window.document = t("./document");
6572            window.CanvasRenderingContext2D = t("./CanvasRenderingContext2D");
6573            window.Element = t("./Element");
6574            window.HTMLElement = t("./HTMLElement");
6575            window.HTMLCanvasElement = t("./HTMLCanvasElement");
6576            window.HTMLImageElement = t("./HTMLImageElement");
6577            window.HTMLMediaElement = t("./HTMLMediaElement");
6578            window.HTMLVideoElement = t("./HTMLVideoElement");
6579            window.HTMLScriptElement = t("./HTMLScriptElement");
6580            window.__canvas = new HTMLCanvasElement;
6581            window.__canvas._width = window.innerWidth;
6582            window.__canvas._height = window.innerHeight;
6583            window.navigator = t("./navigator");
6584            window.Image = t("./Image");
6585            window.FileReader = t("./FileReader");
6586            window.FontFace = t("./FontFace");
6587            window.FontFaceSet = t("./FontFaceSet");
6588            window.EventTarget = t("./EventTarget");
6589            window.Event = t("./Event");
6590            window.TouchEvent = t("./TouchEvent");
6591            window.MouseEvent = t("./MouseEvent");
6592            window.KeyboardEvent = t("./KeyboardEvent");
6593            window.DeviceMotionEvent = t("./DeviceMotionEvent");
6594            var e = t("./fetch");
6595            window.fetch = e.fetch;
6596            window.Headers = e.Headers;
6597            window.Request = e.Request;
6598            window.Response = e.Response;
6599            window.orientation = jsb.device.getDeviceOrientation();
6600            Object.defineProperty(window, "devicePixelRatio", {
6601              get: function() {
6602                return jsb.device.getDevicePixelRatio ? jsb.device.getDevicePixelRatio() : 1;
6603              },
6604              set: function(t) {},
6605              enumerable: !0,
6606              configurable: !0
6607            });
6608            window.screen = {
6609              availTop: 0,
6610              availLeft: 0,
6611              availHeight: window.innerWidth,
6612              availWidth: window.innerHeight,
6613              colorDepth: 8,
6614              pixelDepth: 8,
6615              left: 0,
6616              top: 0,
6617              width: window.innerWidth,
6618              height: window.innerHeight,
6619              orientation: {
6620                type: "portrait-primary"
6621              },
6622              onorientationchange: function(t) {}
6623            };
6624            window.addEventListener = function(t, e, i) {
6625              window.__canvas.addEventListener(t, e, i);
6626            };
6627            window.removeEventListener = function(t, e, i) {
6628              window.__canvas.removeEventListener(t, e, i);
6629            };
6630            window.dispatchEvent = function(t) {
6631              window.__canvas.dispatchEvent(t);
6632            };
6633            window.getComputedStyle = function(t) {
6634              return {
6635                position: "absolute",
6636                left: "0px",
6637                top: "0px",
6638                height: "0px"
6639              };
6640            };
6641            window.resize = function(t, e) {
6642              window.innerWidth = t;
6643              window.innerHeight = e;
6644              window.outerWidth = window.innerWidth;
6645              window.outerHeight = window.innerHeight;
6646              window.__canvas._width = window.innerWidth;
6647              window.__canvas._height = window.innerHeight;
6648              window.screen.availWidth = window.innerWidth;
6649              window.screen.availHeight = window.innerHeight;
6650              window.screen.width = window.innerWidth;
6651              window.screen.height = window.innerHeight;
6652              window.clientWidth = window.innerWidth;
6653              window.clientHeight = window.innerHeight;
6654              let i = new Event("resize");
6655              i._target = window;
6656              window.dispatchEvent(i);
6657            };
6658            window.focus = function() {};
6659            window.scroll = function() {};
6660            window._isInjected = !0;
6661          }();
6662          window.localStorage = sys.localStorage;
6663        }, {
6664          "./CanvasRenderingContext2D": 6,
6665          "./DeviceMotionEvent": 8,
6666          "./Element": 9,
6667          "./Event": 10,
6668          "./EventTarget": 11,
6669          "./FileReader": 12,
6670          "./FontFace": 13,
6671          "./FontFaceSet": 14,
6672          "./HTMLCanvasElement": 15,
6673          "./HTMLElement": 16,
6674          "./HTMLImageElement": 17,
6675          "./HTMLMediaElement": 18,
6676          "./HTMLScriptElement": 19,
6677          "./HTMLVideoElement": 20,
6678          "./Image": 21,
6679          "./KeyboardEvent": 23,
6680          "./MouseEvent": 25,
6681          "./TouchEvent": 27,
6682          "./document": 28,
6683          "./fetch": 29,
6684          "./location": 31,
6685          "./navigator": 32
6686        } ],
6687        35: [ function(t, e, i) {
6688          !function(t) {
6689            if (t && t.AudioEngine) {
6690              t.AudioEngine.AudioState = {
6691                ERROR: -1,
6692                INITIALZING: 0,
6693                PLAYING: 1,
6694                PAUSED: 2,
6695                STOPPED: 3
6696              };
6697              t.AudioEngine.INVALID_AUDIO_ID = -1;
6698              t.AudioEngine.TIME_UNKNOWN = -1;
6699              t.AudioEngine.play = t.AudioEngine.play2d;
6700              t.AudioEngine.setErrorCallback = () => {};
6701            }
6702          }(jsb);
6703        }, {} ],
6704        36: [ function(t, e, i) {
6705          const s = t("./jsb-adapter/EventTarget");
6706          const n = t("./jsb-adapter/Event");
6707          var r = new s;
6708          var o = {};
6709          var a = {};
6710          var l = 1;
6711          var h = function(t) {
6712            if (!t) return null;
6713            var e = function(e) {
6714              t({
6715                value: e.text
6716              });
6717            };
6718            t.___index = l++;
6719            o[t.___index] = e;
6720            return e;
6721          };
6722          var c = function(t, e) {
6723            if (e) r.removeEventListener(t, function(t) {
6724              if (t && t.___index) {
6725                var e = o[t.___index];
6726                delete o[t.___index];
6727                return e;
6728              }
6729              return null;
6730            }(e)); else {
6731              var i = a[t];
6732              if (!i) return;
6733              for (var s = 0, n = i.length; s < n; ++s) r.removeEventListener(t, i[s]);
6734              delete a[t];
6735            }
6736          };
6737          var u = function(t, e) {
6738            if (e && t && "" !== t) {
6739              a[t] || (a[t] = []);
6740              a[t].push(e);
6741            }
6742          };
6743          jsb.inputBox = {
6744            onConfirm: function(t) {
6745              var e = h(t);
6746              r.addEventListener("confirm", e);
6747              u("confirm", e);
6748            },
6749            offConfirm: function(t) {
6750              c("confirm", t);
6751            },
6752            onComplete: function(t) {
6753              var e = h(t);
6754              r.addEventListener("complete", e);
6755              u("complete", e);
6756            },
6757            offComplete: function(t) {
6758              c("complete", t);
6759            },
6760            onInput: function(t) {
6761              var e = h(t);
6762              r.addEventListener("input", e);
6763              u("input", e);
6764            },
6765            offInput: function(t) {
6766              c("input", t);
6767            },
6768            show: function(t) {
6769              jsb.showInputBox(t);
6770            },
6771            hide: function() {
6772              jsb.hideInputBox();
6773            }
6774          };
6775          jsb.onTextInput = function(t, e) {
6776            var i = new n(t);
6777            i.text = e;
6778            r.dispatchEvent(i);
6779          };
6780        }, {
6781          "./jsb-adapter/Event": 10,
6782          "./jsb-adapter/EventTarget": 11
6783        } ],
6784        37: [ function(t, e, i) {
6785          jsb.__obj_ref_id = 0;
6786          jsb.registerNativeRef = function(t, e) {
6787            if (t && e && t !== e) {
6788              let i = e.__jsb_ref_id;
6789              void 0 === i && (i = e.__jsb_ref_id = jsb.__obj_ref_id++);
6790              let s = t.__nativeRefs;
6791              s || (s = t.__nativeRefs = {});
6792              s[i] = e;
6793            }
6794          };
6795          jsb.unregisterNativeRef = function(t, e) {
6796            if (t && e && t !== e) {
6797              let i = e.__jsb_ref_id;
6798              if (void 0 === i) return;
6799              let s = t.__nativeRefs;
6800              if (!s) return;
6801              delete s[i];
6802            }
6803          };
6804          jsb.unregisterAllNativeRefs = function(t) {
6805            t && delete t.__nativeRefs;
6806          };
6807          jsb.unregisterChildRefsForNode = function(t, e) {
6808            e = !!e;
6809            let i, s, n, r = t.getChildren();
6810            for (i = 0, s = r.length; i < s; ++i) {
6811              n = r[i];
6812              jsb.unregisterNativeRef(t, n);
6813              e && jsb.unregisterChildRefsForNode(n, e);
6814            }
6815          };
6816        }, {} ],
6817        38: [ function(t, e, s) {
6818          (function(t, o) {
6819            (function() {
6820              a = function() {
6821                function e(t) {
6822                  var e = this.constructor;
6823                  return this.then((function(i) {
6824                    return e.resolve(t()).then((function() {
6825                      return i;
6826                    }));
6827                  }), (function(i) {
6828                    return e.resolve(t()).then((function() {
6829                      return e.reject(i);
6830                    }));
6831                  }));
6832                }
6833                function i() {}
6834                function s(t) {
6835                  if (!(this instanceof s)) throw new TypeError("Promises must be constructed via new");
6836                  if ("function" != typeof t) throw new TypeError("not a function");
6837                  this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [],
6838                  h(t, this);
6839                }
6840                function n(t, e) {
6841                  for (;3 === t._state; ) t = t._value;
6842                  0 !== t._state ? (t._handled = !0, s._immediateFn((function() {
6843                    var i = 1 === t._state ? e.onFulfilled : e.onRejected;
6844                    if (null !== i) {
6845                      var s;
6846                      try {
6847                        s = i(t._value);
6848                      } catch (t) {
6849                        return void a(e.promise, t);
6850                      }
6851                      r(e.promise, s);
6852                    } else (1 === t._state ? r : a)(e.promise, t._value);
6853                  }))) : t._deferreds.push(e);
6854                }
6855                function r(t, e) {
6856                  try {
6857                    if (e === t) throw new TypeError("A promise cannot be resolved with itself.");
6858                    if (e && ("object" == typeof e || "function" == typeof e)) {
6859                      var i = e.then;
6860                      if (e instanceof s) return t._state = 3, t._value = e, void l(t);
6861                      if ("function" == typeof i) return void h(function(t, e) {
6862                        return function() {
6863                          t.apply(e, arguments);
6864                        };
6865                      }(i, e), t);
6866                    }
6867                    t._state = 1, t._value = e, l(t);
6868                  } catch (e) {
6869                    a(t, e);
6870                  }
6871                }
6872                function a(t, e) {
6873                  t._state = 2, t._value = e, l(t);
6874                }
6875                function l(t) {
6876                  2 === t._state && 0 === t._deferreds.length && s._immediateFn((function() {
6877                    t._handled || s._unhandledRejectionFn(t._value);
6878                  }));
6879                  for (var e = 0, i = t._deferreds.length; i > e; e++) n(t, t._deferreds[e]);
6880                  t._deferreds = null;
6881                }
6882                function h(t, e) {
6883                  var i = !1;
6884                  try {
6885                    t((function(t) {
6886                      i || (i = !0, r(e, t));
6887                    }), (function(t) {
6888                      i || (i = !0, a(e, t));
6889                    }));
6890                  } catch (t) {
6891                    if (i) return;
6892                    i = !0, a(e, t);
6893                  }
6894                }
6895                var c = setTimeout;
6896                s.prototype.catch = function(t) {
6897                  return this.then(null, t);
6898                }, s.prototype.then = function(t, e) {
6899                  var s = new this.constructor(i);
6900                  return n(this, new function(t, e, i) {
6901                    this.onFulfilled = "function" == typeof t ? t : null, this.onRejected = "function" == typeof e ? e : null,
6902                    this.promise = i;
6903                  }(t, e, s)), s;
6904                }, s.prototype.finally = e, s.all = function(t) {
6905                  return new s((function(e, i) {
6906                    function s(t, o) {
6907                      try {
6908                        if (o && ("object" == typeof o || "function" == typeof o)) {
6909                          var a = o.then;
6910                          if ("function" == typeof a) return void a.call(o, (function(e) {
6911                            s(t, e);
6912                          }), i);
6913                        }
6914                        n[t] = o, 0 == --r && e(n);
6915                      } catch (t) {
6916                        i(t);
6917                      }
6918                    }
6919                    if (!t || void 0 === t.length) throw new TypeError("Promise.all accepts an array");
6920                    var n = Array.prototype.slice.call(t);
6921                    if (0 === n.length) return e([]);
6922                    for (var r = n.length, o = 0; n.length > o; o++) s(o, n[o]);
6923                  }));
6924                }, s.resolve = function(t) {
6925                  return t && "object" == typeof t && t.constructor === s ? t : new s((function(e) {
6926                    e(t);
6927                  }));
6928                }, s.reject = function(t) {
6929                  return new s((function(e, i) {
6930                    i(t);
6931                  }));
6932                }, s.race = function(t) {
6933                  return new s((function(e, i) {
6934                    for (var s = 0, n = t.length; n > s; s++) t[s].then(e, i);
6935                  }));
6936                }, s._immediateFn = "function" == typeof o && function(t) {
6937                  o(t);
6938                } || function(t) {
6939                  c(t, 0);
6940                }, s._unhandledRejectionFn = function(t) {
6941                  void 0 !== console && console && console.warn("Possible Unhandled Promise Rejection:", t);
6942                };
6943                var u = function() {
6944                  if ("undefined" != typeof self) return self;
6945                  if ("undefined" != typeof window) return window;
6946                  if (void 0 !== t) return t;
6947                  throw Error("unable to locate global object");
6948                }();
6949                "Promise" in u ? u.Promise.prototype.finally || (u.Promise.prototype.finally = e) : u.Promise = s;
6950              }, "object" == typeof s && void 0 !== e ? a() : void 0 !== (r = "function" == typeof (n = a) ? n.call(s, i, s, e) : n) && (e.exports = r);
6951              var a;
6952            }).call(this);
6953          }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}, t("timers").setImmediate);
6954        }, {
6955          timers: 2
6956        } ],
6957        39: [ function(t, e, i) {
6958          function s(t) {
6959            this.options = t || {
6960              locator: {}
6961            };
6962          }
6963          s.prototype.parseFromString = function(t, e) {
6964            var i = this.options;
6965            var s = new c;
6966            var r = i.domBuilder || new n;
6967            var a = i.errorHandler;
6968            var l = i.locator;
6969            var u = i.xmlns || {};
6970            var _ = /\/x?html?$/.test(e);
6971            var d = _ ? h.entityMap : {
6972              lt: "<",
6973              gt: ">",
6974              amp: "&",
6975              quot: '"',
6976              apos: "'"
6977            };
6978            l && r.setDocumentLocator(l);
6979            s.errorHandler = function(t, e, i) {
6980              if (!t) {
6981                if (e instanceof n) return e;
6982                t = e;
6983              }
6984              var s = {};
6985              var r = t instanceof Function;
6986              i = i || {};
6987              function a(e) {
6988                var n = t[e];
6989                !n && r && (n = 2 == t.length ? function(i) {
6990                  t(e, i);
6991                } : t);
6992                s[e] = n && function(t) {
6993                  n("[xmldom " + e + "]\t" + t + o(i));
6994                } || function() {};
6995              }
6996              a("warning");
6997              a("error");
6998              a("fatalError");
6999              return s;
7000            }(a, r, l);
7001            s.domBuilder = i.domBuilder || r;
7002            _ && (u[""] = "http://www.w3.org/1999/xhtml");
7003            u.xml = u.xml || "http://www.w3.org/XML/1998/namespace";
7004            t ? s.parse(t, u, d) : s.errorHandler.error("invalid doc source");
7005            return r.doc;
7006          };
7007          function n() {
7008            this.cdata = !1;
7009          }
7010          function r(t, e) {
7011            e.lineNumber = t.lineNumber;
7012            e.columnNumber = t.columnNumber;
7013          }
7014          n.prototype = {
7015            startDocument: function() {
7016              this.doc = (new u).createDocument(null, null, null);
7017              this.locator && (this.doc.documentURI = this.locator.systemId);
7018            },
7019            startElement: function(t, e, i, s) {
7020              var n = this.doc;
7021              var o = n.createElementNS(t, i || e);
7022              var a = s.length;
7023              l(this, o);
7024              this.currentElement = o;
7025              this.locator && r(this.locator, o);
7026              for (var h = 0; h < a; h++) {
7027                t = s.getURI(h);
7028                var c = s.getValue(h);
7029                i = s.getQName(h);
7030                var u = n.createAttributeNS(t, i);
7031                this.locator && r(s.getLocator(h), u);
7032                u.value = u.nodeValue = c;
7033                o.setAttributeNode(u);
7034              }
7035            },
7036            endElement: function(t, e, i) {
7037              var s = this.currentElement;
7038              s.tagName;
7039              this.currentElement = s.parentNode;
7040            },
7041            startPrefixMapping: function(t, e) {},
7042            endPrefixMapping: function(t) {},
7043            processingInstruction: function(t, e) {
7044              var i = this.doc.createProcessingInstruction(t, e);
7045              this.locator && r(this.locator, i);
7046              l(this, i);
7047            },
7048            ignorableWhitespace: function(t, e, i) {},
7049            characters: function(t, e, i) {
7050              if (t = a.apply(this, arguments)) {
7051                if (this.cdata) var s = this.doc.createCDATASection(t); else s = this.doc.createTextNode(t);
7052                this.currentElement ? this.currentElement.appendChild(s) : /^\s*$/.test(t) && this.doc.appendChild(s);
7053                this.locator && r(this.locator, s);
7054              }
7055            },
7056            skippedEntity: function(t) {},
7057            endDocument: function() {
7058              this.doc.normalize();
7059            },
7060            setDocumentLocator: function(t) {
7061              (this.locator = t) && (t.lineNumber = 0);
7062            },
7063            comment: function(t, e, i) {
7064              t = a.apply(this, arguments);
7065              var s = this.doc.createComment(t);
7066              this.locator && r(this.locator, s);
7067              l(this, s);
7068            },
7069            startCDATA: function() {
7070              this.cdata = !0;
7071            },
7072            endCDATA: function() {
7073              this.cdata = !1;
7074            },
7075            startDTD: function(t, e, i) {
7076              var s = this.doc.implementation;
7077              if (s && s.createDocumentType) {
7078                var n = s.createDocumentType(t, e, i);
7079                this.locator && r(this.locator, n);
7080                l(this, n);
7081              }
7082            },
7083            warning: function(t) {
7084              console.warn("[xmldom warning]\t" + t, o(this.locator));
7085            },
7086            error: function(t) {
7087              console.error("[xmldom error]\t" + t, o(this.locator));
7088            },
7089            fatalError: function(t) {
7090              console.error("[xmldom fatalError]\t" + t, o(this.locator));
7091              throw t;
7092            }
7093          };
7094          function o(t) {
7095            if (t) return "\n@" + (t.systemId || "") + "#[line:" + t.lineNumber + ",col:" + t.columnNumber + "]";
7096          }
7097          function a(t, e, i) {
7098            return "string" == typeof t ? t.substr(e, i) : t.length >= e + i || e ? new java.lang.String(t, e, i) + "" : t;
7099          }
7100          "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, (function(t) {
7101            n.prototype[t] = function() {
7102              return null;
7103            };
7104          }));
7105          function l(t, e) {
7106            t.currentElement ? t.currentElement.appendChild(e) : t.doc.appendChild(e);
7107          }
7108          var h = t("./entities");
7109          var c = t("./sax").XMLReader;
7110          var u = i.DOMImplementation = t("./dom").DOMImplementation;
7111          i.XMLSerializer = t("./dom").XMLSerializer;
7112          i.DOMParser = s;
7113        }, {
7114          "./dom": 40,
7115          "./entities": 41,
7116          "./sax": 42
7117        } ],
7118        40: [ function(t, e, i) {
7119          function s(t, e) {
7120            for (var i in t) e[i] = t[i];
7121          }
7122          function n(t, e) {
7123            var i = t.prototype;
7124            if (!(i instanceof e)) {
7125              function n() {}
7126              n.prototype = e.prototype;
7127              s(i, n = new n);
7128              t.prototype = i = n;
7129            }
7130            if (i.constructor != t) {
7131              "function" != typeof t && console.error("unknow Class:" + t);
7132              i.constructor = t;
7133            }
7134          }
7135          var r = {};
7136          var o = r.ELEMENT_NODE = 1;
7137          var a = r.ATTRIBUTE_NODE = 2;
7138          var l = r.TEXT_NODE = 3;
7139          var h = r.CDATA_SECTION_NODE = 4;
7140          var c = r.ENTITY_REFERENCE_NODE = 5;
7141          var u = r.ENTITY_NODE = 6;
7142          var _ = r.PROCESSING_INSTRUCTION_NODE = 7;
7143          var d = r.COMMENT_NODE = 8;
7144          var p = r.DOCUMENT_NODE = 9;
7145          var m = r.DOCUMENT_TYPE_NODE = 10;
7146          var f = r.DOCUMENT_FRAGMENT_NODE = 11;
7147          var g = r.NOTATION_NODE = 12;
7148          var y = {};
7149          var b = {};
7150          y.INDEX_SIZE_ERR = (b[1] = "Index size error", 1);
7151          y.DOMSTRING_SIZE_ERR = (b[2] = "DOMString size error", 2);
7152          var S = y.HIERARCHY_REQUEST_ERR = (b[3] = "Hierarchy request error", 3);
7153          y.WRONG_DOCUMENT_ERR = (b[4] = "Wrong document", 4);
7154          y.INVALID_CHARACTER_ERR = (b[5] = "Invalid character", 5);
7155          y.NO_DATA_ALLOWED_ERR = (b[6] = "No data allowed", 6);
7156          y.NO_MODIFICATION_ALLOWED_ERR = (b[7] = "No modification allowed", 7);
7157          var A = y.NOT_FOUND_ERR = (b[8] = "Not found", 8);
7158          y.NOT_SUPPORTED_ERR = (b[9] = "Not supported", 9);
7159          var T = y.INUSE_ATTRIBUTE_ERR = (b[10] = "Attribute in use", 10);
7160          y.INVALID_STATE_ERR = (b[11] = "Invalid state", 11);
7161          y.SYNTAX_ERR = (b[12] = "Syntax error", 12);
7162          y.INVALID_MODIFICATION_ERR = (b[13] = "Invalid modification", 13);
7163          y.NAMESPACE_ERR = (b[14] = "Invalid namespace", 14);
7164          y.INVALID_ACCESS_ERR = (b[15] = "Invalid access", 15);
7165          function v(t, e) {
7166            if (e instanceof Error) var i = e; else {
7167              i = this;
7168              Error.call(this, b[t]);
7169              this.message = b[t];
7170              Error.captureStackTrace && Error.captureStackTrace(this, v);
7171            }
7172            i.code = t;
7173            e && (this.message = this.message + ": " + e);
7174            return i;
7175          }
7176          v.prototype = Error.prototype;
7177          s(y, v);
7178          function E() {}
7179          E.prototype = {
7180            length: 0,
7181            item: function(t) {
7182              return this[t] || null;
7183            },
7184            toString: function(t, e) {
7185              for (var i = [], s = 0; s < this.length; s++) et(this[s], i, t, e);
7186              return i.join("");
7187            }
7188          };
7189          function C(t, e) {
7190            this._node = t;
7191            this._refresh = e;
7192            x(this);
7193          }
7194          function x(t) {
7195            var e = t._node._inc || t._node.ownerDocument._inc;
7196            if (t._inc != e) {
7197              var i = t._refresh(t._node);
7198              nt(t, "length", i.length);
7199              s(i, t);
7200              t._inc = e;
7201            }
7202          }
7203          C.prototype.item = function(t) {
7204            x(this);
7205            return this[t];
7206          };
7207          n(C, E);
7208          function w() {}
7209          function R(t, e) {
7210            var i = t.length;
7211            for (;i--; ) if (t[i] === e) return i;
7212          }
7213          function I(t, e, i, s) {
7214            s ? e[R(e, s)] = i : e[e.length++] = i;
7215            if (t) {
7216              i.ownerElement = t;
7217              var n = t.ownerDocument;
7218              if (n) {
7219                s && L(n, t, s);
7220                !function(t, e, i) {
7221                  t && t._inc++;
7222                  "http://www.w3.org/2000/xmlns/" == i.namespaceURI && (e._nsMap[i.prefix ? i.localName : ""] = i.value);
7223                }(n, t, i);
7224              }
7225            }
7226          }
7227          function M(t, e, i) {
7228            var s = R(e, i);
7229            if (!(s >= 0)) throw v(A, new Error(t.tagName + "@" + i));
7230            var n = e.length - 1;
7231            for (;s < n; ) e[s] = e[++s];
7232            e.length = n;
7233            if (t) {
7234              var r = t.ownerDocument;
7235              if (r) {
7236                L(r, t, i);
7237                i.ownerElement = null;
7238              }
7239            }
7240          }
7241          w.prototype = {
7242            length: 0,
7243            item: E.prototype.item,
7244            getNamedItem: function(t) {
7245              var e = this.length;
7246              for (;e--; ) {
7247                var i = this[e];
7248                if (i.nodeName == t) return i;
7249              }
7250            },
7251            setNamedItem: function(t) {
7252              var e = t.ownerElement;
7253              if (e && e != this._ownerElement) throw new v(T);
7254              var i = this.getNamedItem(t.nodeName);
7255              I(this._ownerElement, this, t, i);
7256              return i;
7257            },
7258            setNamedItemNS: function(t) {
7259              var e, i = t.ownerElement;
7260              if (i && i != this._ownerElement) throw new v(T);
7261              e = this.getNamedItemNS(t.namespaceURI, t.localName);
7262              I(this._ownerElement, this, t, e);
7263              return e;
7264            },
7265            removeNamedItem: function(t) {
7266              var e = this.getNamedItem(t);
7267              M(this._ownerElement, this, e);
7268              return e;
7269            },
7270            removeNamedItemNS: function(t, e) {
7271              var i = this.getNamedItemNS(t, e);
7272              M(this._ownerElement, this, i);
7273              return i;
7274            },
7275            getNamedItemNS: function(t, e) {
7276              var i = this.length;
7277              for (;i--; ) {
7278                var s = this[i];
7279                if (s.localName == e && s.namespaceURI == t) return s;
7280              }
7281              return null;
7282            }
7283          };
7284          function B(t) {
7285            this._features = {};
7286            if (t) for (var e in t) this._features = t[e];
7287          }
7288          B.prototype = {
7289            hasFeature: function(t, e) {
7290              var i = this._features[t.toLowerCase()];
7291              return !(!i || e && !(e in i));
7292            },
7293            createDocument: function(t, e, i) {
7294              var s = new N;
7295              s.implementation = this;
7296              s.childNodes = new E;
7297              s.doctype = i;
7298              i && s.appendChild(i);
7299              if (e) {
7300                var n = s.createElementNS(t, e);
7301                s.appendChild(n);
7302              }
7303              return s;
7304            },
7305            createDocumentType: function(t, e, i) {
7306              var s = new W;
7307              s.name = t;
7308              s.nodeName = t;
7309              s.publicId = e;
7310              s.systemId = i;
7311              return s;
7312            }
7313          };
7314          function D() {}
7315          D.prototype = {
7316            firstChild: null,
7317            lastChild: null,
7318            previousSibling: null,
7319            nextSibling: null,
7320            attributes: null,
7321            parentNode: null,
7322            childNodes: null,
7323            ownerDocument: null,
7324            nodeValue: null,
7325            namespaceURI: null,
7326            prefix: null,
7327            localName: null,
7328            insertBefore: function(t, e) {
7329              return k(this, t, e);
7330            },
7331            replaceChild: function(t, e) {
7332              this.insertBefore(t, e);
7333              e && this.removeChild(e);
7334            },
7335            removeChild: function(t) {
7336              return V(this, t);
7337            },
7338            appendChild: function(t) {
7339              return this.insertBefore(t, null);
7340            },
7341            hasChildNodes: function() {
7342              return null != this.firstChild;
7343            },
7344            cloneNode: function(t) {
7345              return st(this.ownerDocument || this, this, t);
7346            },
7347            normalize: function() {
7348              var t = this.firstChild;
7349              for (;t; ) {
7350                var e = t.nextSibling;
7351                if (e && e.nodeType == l && t.nodeType == l) {
7352                  this.removeChild(e);
7353                  t.appendData(e.data);
7354                } else {
7355                  t.normalize();
7356                  t = e;
7357                }
7358              }
7359            },
7360            isSupported: function(t, e) {
7361              return this.ownerDocument.implementation.hasFeature(t, e);
7362            },
7363            hasAttributes: function() {
7364              return this.attributes.length > 0;
7365            },
7366            lookupPrefix: function(t) {
7367              var e = this;
7368              for (;e; ) {
7369                var i = e._nsMap;
7370                if (i) for (var s in i) if (i[s] == t) return s;
7371                e = e.nodeType == a ? e.ownerDocument : e.parentNode;
7372              }
7373              return null;
7374            },
7375            lookupNamespaceURI: function(t) {
7376              var e = this;
7377              for (;e; ) {
7378                var i = e._nsMap;
7379                if (i && t in i) return i[t];
7380                e = e.nodeType == a ? e.ownerDocument : e.parentNode;
7381              }
7382              return null;
7383            },
7384            isDefaultNamespace: function(t) {
7385              return null == this.lookupPrefix(t);
7386            }
7387          };
7388          function P(t) {
7389            return ("<" == t ? "&lt;" : ">" == t && "&gt;") || "&" == t && "&amp;" || '"' == t && "&quot;" || "&#" + t.charCodeAt() + ";";
7390          }
7391          s(r, D);
7392          s(r, D.prototype);
7393          function O(t, e) {
7394            if (e(t)) return !0;
7395            if (t = t.firstChild) do {
7396              if (O(t, e)) return !0;
7397            } while (t = t.nextSibling);
7398          }
7399          function N() {}
7400          function L(t, e, i, s) {
7401            t && t._inc++;
7402            "http://www.w3.org/2000/xmlns/" == i.namespaceURI && delete e._nsMap[i.prefix ? i.localName : ""];
7403          }
7404          function F(t, e, i) {
7405            if (t && t._inc) {
7406              t._inc++;
7407              var s = e.childNodes;
7408              if (i) s[s.length++] = i; else {
7409                var n = e.firstChild;
7410                var r = 0;
7411                for (;n; ) {
7412                  s[r++] = n;
7413                  n = n.nextSibling;
7414                }
7415                s.length = r;
7416              }
7417            }
7418          }
7419          function V(t, e) {
7420            var i = e.previousSibling;
7421            var s = e.nextSibling;
7422            i ? i.nextSibling = s : t.firstChild = s;
7423            s ? s.previousSibling = i : t.lastChild = i;
7424            F(t.ownerDocument, t);
7425            return e;
7426          }
7427          function k(t, e, i) {
7428            var s = e.parentNode;
7429            s && s.removeChild(e);
7430            if (e.nodeType === f) {
7431              var n = e.firstChild;
7432              if (null == n) return e;
7433              var r = e.lastChild;
7434            } else n = r = e;
7435            var o = i ? i.previousSibling : t.lastChild;
7436            n.previousSibling = o;
7437            r.nextSibling = i;
7438            o ? o.nextSibling = n : t.firstChild = n;
7439            null == i ? t.lastChild = r : i.previousSibling = r;
7440            do {
7441              n.parentNode = t;
7442            } while (n !== r && (n = n.nextSibling));
7443            F(t.ownerDocument || t, t);
7444            e.nodeType == f && (e.firstChild = e.lastChild = null);
7445            return e;
7446          }
7447          N.prototype = {
7448            nodeName: "#document",
7449            nodeType: p,
7450            doctype: null,
7451            documentElement: null,
7452            _inc: 1,
7453            insertBefore: function(t, e) {
7454              if (t.nodeType == f) {
7455                var i = t.firstChild;
7456                for (;i; ) {
7457                  var s = i.nextSibling;
7458                  this.insertBefore(i, e);
7459                  i = s;
7460                }
7461                return t;
7462              }
7463              null == this.documentElement && t.nodeType == o && (this.documentElement = t);
7464              return k(this, t, e), t.ownerDocument = this, t;
7465            },
7466            removeChild: function(t) {
7467              this.documentElement == t && (this.documentElement = null);
7468              return V(this, t);
7469            },
7470            importNode: function(t, e) {
7471              return it(this, t, e);
7472            },
7473            getElementById: function(t) {
7474              var e = null;
7475              O(this.documentElement, (function(i) {
7476                if (i.nodeType == o && i.getAttribute("id") == t) {
7477                  e = i;
7478                  return !0;
7479                }
7480              }));
7481              return e;
7482            },
7483            createElement: function(t) {
7484              var e = new U;
7485              e.ownerDocument = this;
7486              e.nodeName = t;
7487              e.tagName = t;
7488              e.childNodes = new E;
7489              (e.attributes = new w)._ownerElement = e;
7490              return e;
7491            },
7492            createDocumentFragment: function() {
7493              var t = new J;
7494              t.ownerDocument = this;
7495              t.childNodes = new E;
7496              return t;
7497            },
7498            createTextNode: function(t) {
7499              var e = new H;
7500              e.ownerDocument = this;
7501              e.appendData(t);
7502              return e;
7503            },
7504            createComment: function(t) {
7505              var e = new j;
7506              e.ownerDocument = this;
7507              e.appendData(t);
7508              return e;
7509            },
7510            createCDATASection: function(t) {
7511              var e = new X;
7512              e.ownerDocument = this;
7513              e.appendData(t);
7514              return e;
7515            },
7516            createProcessingInstruction: function(t, e) {
7517              var i = new Z;
7518              i.ownerDocument = this;
7519              i.tagName = i.target = t;
7520              i.nodeValue = i.data = e;
7521              return i;
7522            },
7523            createAttribute: function(t) {
7524              var e = new G;
7525              e.ownerDocument = this;
7526              e.name = t;
7527              e.nodeName = t;
7528              e.localName = t;
7529              e.specified = !0;
7530              return e;
7531            },
7532            createEntityReference: function(t) {
7533              var e = new K;
7534              e.ownerDocument = this;
7535              e.nodeName = t;
7536              return e;
7537            },
7538            createElementNS: function(t, e) {
7539              var i = new U;
7540              var s = e.split(":");
7541              var n = i.attributes = new w;
7542              i.childNodes = new E;
7543              i.ownerDocument = this;
7544              i.nodeName = e;
7545              i.tagName = e;
7546              i.namespaceURI = t;
7547              if (2 == s.length) {
7548                i.prefix = s[0];
7549                i.localName = s[1];
7550              } else i.localName = e;
7551              n._ownerElement = i;
7552              return i;
7553            },
7554            createAttributeNS: function(t, e) {
7555              var i = new G;
7556              var s = e.split(":");
7557              i.ownerDocument = this;
7558              i.nodeName = e;
7559              i.name = e;
7560              i.namespaceURI = t;
7561              i.specified = !0;
7562              if (2 == s.length) {
7563                i.prefix = s[0];
7564                i.localName = s[1];
7565              } else i.localName = e;
7566              return i;
7567            }
7568          };
7569          n(N, D);
7570          function U() {
7571            this._nsMap = {};
7572          }
7573          U.prototype = {
7574            nodeType: o,
7575            hasAttribute: function(t) {
7576              return null != this.getAttributeNode(t);
7577            },
7578            getAttribute: function(t) {
7579              var e = this.getAttributeNode(t);
7580              return e && e.value || "";
7581            },
7582            getAttributeNode: function(t) {
7583              return this.attributes.getNamedItem(t);
7584            },
7585            setAttribute: function(t, e) {
7586              var i = this.ownerDocument.createAttribute(t);
7587              i.value = i.nodeValue = "" + e;
7588              this.setAttributeNode(i);
7589            },
7590            removeAttribute: function(t) {
7591              var e = this.getAttributeNode(t);
7592              e && this.removeAttributeNode(e);
7593            },
7594            appendChild: function(t) {
7595              return t.nodeType === f ? this.insertBefore(t, null) : function(t, e) {
7596                var i = e.parentNode;
7597                if (i) {
7598                  var s = t.lastChild;
7599                  i.removeChild(e);
7600                  s = t.lastChild;
7601                }
7602                s = t.lastChild;
7603                e.parentNode = t;
7604                e.previousSibling = s;
7605                e.nextSibling = null;
7606                s ? s.nextSibling = e : t.firstChild = e;
7607                t.lastChild = e;
7608                F(t.ownerDocument, t, e);
7609                return e;
7610              }(this, t);
7611            },
7612            setAttributeNode: function(t) {
7613              return this.attributes.setNamedItem(t);
7614            },
7615            setAttributeNodeNS: function(t) {
7616              return this.attributes.setNamedItemNS(t);
7617            },
7618            removeAttributeNode: function(t) {
7619              return this.attributes.removeNamedItem(t.nodeName);
7620            },
7621            removeAttributeNS: function(t, e) {
7622              var i = this.getAttributeNodeNS(t, e);
7623              i && this.removeAttributeNode(i);
7624            },
7625            hasAttributeNS: function(t, e) {
7626              return null != this.getAttributeNodeNS(t, e);
7627            },
7628            getAttributeNS: function(t, e) {
7629              var i = this.getAttributeNodeNS(t, e);
7630              return i && i.value || "";
7631            },
7632            setAttributeNS: function(t, e, i) {
7633              var s = this.ownerDocument.createAttributeNS(t, e);
7634              s.value = s.nodeValue = "" + i;
7635              this.setAttributeNode(s);
7636            },
7637            getAttributeNodeNS: function(t, e) {
7638              return this.attributes.getNamedItemNS(t, e);
7639            },
7640            getElementsByTagName: function(t) {
7641              return new C(this, (function(e) {
7642                var i = [];
7643                O(e, (function(s) {
7644                  s === e || s.nodeType != o || "*" !== t && s.tagName != t || i.push(s);
7645                }));
7646                return i;
7647              }));
7648            },
7649            getElementsByTagNameNS: function(t, e) {
7650              return new C(this, (function(i) {
7651                var s = [];
7652                O(i, (function(n) {
7653                  n === i || n.nodeType !== o || "*" !== t && n.namespaceURI !== t || "*" !== e && n.localName != e || s.push(n);
7654                }));
7655                return s;
7656              }));
7657            }
7658          };
7659          N.prototype.getElementsByTagName = U.prototype.getElementsByTagName;
7660          N.prototype.getElementsByTagNameNS = U.prototype.getElementsByTagNameNS;
7661          n(U, D);
7662          function G() {}
7663          G.prototype.nodeType = a;
7664          n(G, D);
7665          function z() {}
7666          z.prototype = {
7667            data: "",
7668            substringData: function(t, e) {
7669              return this.data.substring(t, t + e);
7670            },
7671            appendData: function(t) {
7672              t = this.data + t;
7673              this.nodeValue = this.data = t;
7674              this.length = t.length;
7675            },
7676            insertData: function(t, e) {
7677              this.replaceData(t, 0, e);
7678            },
7679            appendChild: function(t) {
7680              throw new Error(b[S]);
7681            },
7682            deleteData: function(t, e) {
7683              this.replaceData(t, e, "");
7684            },
7685            replaceData: function(t, e, i) {
7686              i = this.data.substring(0, t) + i + this.data.substring(t + e);
7687              this.nodeValue = this.data = i;
7688              this.length = i.length;
7689            }
7690          };
7691          n(z, D);
7692          function H() {}
7693          H.prototype = {
7694            nodeName: "#text",
7695            nodeType: l,
7696            splitText: function(t) {
7697              var e = this.data;
7698              var i = e.substring(t);
7699              e = e.substring(0, t);
7700              this.data = this.nodeValue = e;
7701              this.length = e.length;
7702              var s = this.ownerDocument.createTextNode(i);
7703              this.parentNode && this.parentNode.insertBefore(s, this.nextSibling);
7704              return s;
7705            }
7706          };
7707          n(H, z);
7708          function j() {}
7709          j.prototype = {
7710            nodeName: "#comment",
7711            nodeType: d
7712          };
7713          n(j, z);
7714          function X() {}
7715          X.prototype = {
7716            nodeName: "#cdata-section",
7717            nodeType: h
7718          };
7719          n(X, z);
7720          function W() {}
7721          W.prototype.nodeType = m;
7722          n(W, D);
7723          function Y() {}
7724          Y.prototype.nodeType = g;
7725          n(Y, D);
7726          function q() {}
7727          q.prototype.nodeType = u;
7728          n(q, D);
7729          function K() {}
7730          K.prototype.nodeType = c;
7731          n(K, D);
7732          function J() {}
7733          J.prototype.nodeName = "#document-fragment";
7734          J.prototype.nodeType = f;
7735          n(J, D);
7736          function Z() {}
7737          Z.prototype.nodeType = _;
7738          n(Z, D);
7739          function Q() {}
7740          Q.prototype.serializeToString = function(t, e, i) {
7741            return $.call(t, e, i);
7742          };
7743          D.prototype.toString = $;
7744          function $(t, e) {
7745            var i = [];
7746            var s = 9 == this.nodeType && this.documentElement || this;
7747            var n = s.prefix;
7748            var r = s.namespaceURI;
7749            if (r && null == n) {
7750              if (null == (n = s.lookupPrefix(r))) var o = [ {
7751                namespace: r,
7752                prefix: null
7753              } ];
7754            }
7755            et(this, i, t, e, o);
7756            return i.join("");
7757          }
7758          function tt(t, e, i) {
7759            var s = t.prefix || "";
7760            var n = t.namespaceURI;
7761            if (!s && !n) return !1;
7762            if ("xml" === s && "http://www.w3.org/XML/1998/namespace" === n || "http://www.w3.org/2000/xmlns/" == n) return !1;
7763            var r = i.length;
7764            for (;r--; ) {
7765              var o = i[r];
7766              if (o.prefix == s) return o.namespace != n;
7767            }
7768            return !0;
7769          }
7770          function et(t, e, i, s, n) {
7771            if (s) {
7772              if (!(t = s(t))) return;
7773              if ("string" == typeof t) {
7774                e.push(t);
7775                return;
7776              }
7777            }
7778            switch (t.nodeType) {
7779             case o:
7780              n || (n = []);
7781              n.length;
7782              var r = t.attributes;
7783              var u = r.length;
7784              var g = t.firstChild;
7785              var y = t.tagName;
7786              i = "http://www.w3.org/1999/xhtml" === t.namespaceURI || i;
7787              e.push("<", y);
7788              for (var b = 0; b < u; b++) {
7789                "xmlns" == (S = r.item(b)).prefix ? n.push({
7790                  prefix: S.localName,
7791                  namespace: S.value
7792                }) : "xmlns" == S.nodeName && n.push({
7793                  prefix: "",
7794                  namespace: S.value
7795                });
7796              }
7797              for (b = 0; b < u; b++) {
7798                var S;
7799                if (tt(S = r.item(b), 0, n)) {
7800                  var A = S.prefix || "";
7801                  var T = S.namespaceURI;
7802                  var v = A ? " xmlns:" + A : " xmlns";
7803                  e.push(v, '="', T, '"');
7804                  n.push({
7805                    prefix: A,
7806                    namespace: T
7807                  });
7808                }
7809                et(S, e, i, s, n);
7810              }
7811              if (tt(t, 0, n)) {
7812                A = t.prefix || "";
7813                T = t.namespaceURI;
7814                v = A ? " xmlns:" + A : " xmlns";
7815                e.push(v, '="', T, '"');
7816                n.push({
7817                  prefix: A,
7818                  namespace: T
7819                });
7820              }
7821              if (g || i && !/^(?:meta|link|img|br|hr|input)$/i.test(y)) {
7822                e.push(">");
7823                if (i && /^script$/i.test(y)) for (;g; ) {
7824                  g.data ? e.push(g.data) : et(g, e, i, s, n);
7825                  g = g.nextSibling;
7826                } else for (;g; ) {
7827                  et(g, e, i, s, n);
7828                  g = g.nextSibling;
7829                }
7830                e.push("</", y, ">");
7831              } else e.push("/>");
7832              return;
7833
7834             case p:
7835             case f:
7836              g = t.firstChild;
7837              for (;g; ) {
7838                et(g, e, i, s, n);
7839                g = g.nextSibling;
7840              }
7841              return;
7842
7843             case a:
7844              return e.push(" ", t.name, '="', t.value.replace(/[<&"]/g, P), '"');
7845
7846             case l:
7847              return e.push(t.data.replace(/[<&]/g, P));
7848
7849             case h:
7850              return e.push("<![CDATA[", t.data, "]]>");
7851
7852             case d:
7853              return e.push("\x3c!--", t.data, "--\x3e");
7854
7855             case m:
7856              var E = t.publicId;
7857              var C = t.systemId;
7858              e.push("<!DOCTYPE ", t.name);
7859              if (E) {
7860                e.push(' PUBLIC "', E);
7861                C && "." != C && e.push('" "', C);
7862                e.push('">');
7863              } else if (C && "." != C) e.push(' SYSTEM "', C, '">'); else {
7864                var x = t.internalSubset;
7865                x && e.push(" [", x, "]");
7866                e.push(">");
7867              }
7868              return;
7869
7870             case _:
7871              return e.push("<?", t.target, " ", t.data, "?>");
7872
7873             case c:
7874              return e.push("&", t.nodeName, ";");
7875
7876             default:
7877              e.push("??", t.nodeName);
7878            }
7879          }
7880          function it(t, e, i) {
7881            var s;
7882            switch (e.nodeType) {
7883             case o:
7884              (s = e.cloneNode(!1)).ownerDocument = t;
7885
7886             case f:
7887              break;
7888
7889             case a:
7890              i = !0;
7891            }
7892            s || (s = e.cloneNode(!1));
7893            s.ownerDocument = t;
7894            s.parentNode = null;
7895            if (i) {
7896              var n = e.firstChild;
7897              for (;n; ) {
7898                s.appendChild(it(t, n, i));
7899                n = n.nextSibling;
7900              }
7901            }
7902            return s;
7903          }
7904          function st(t, e, i) {
7905            var s = new e.constructor;
7906            for (var n in e) {
7907              var r = e[n];
7908              "object" != typeof r && r != s[n] && (s[n] = r);
7909            }
7910            e.childNodes && (s.childNodes = new E);
7911            s.ownerDocument = t;
7912            switch (s.nodeType) {
7913             case o:
7914              var l = e.attributes;
7915              var h = s.attributes = new w;
7916              var c = l.length;
7917              h._ownerElement = s;
7918              for (var u = 0; u < c; u++) s.setAttributeNode(st(t, l.item(u), !0));
7919              break;
7920
7921             case a:
7922              i = !0;
7923            }
7924            if (i) {
7925              var _ = e.firstChild;
7926              for (;_; ) {
7927                s.appendChild(st(t, _, i));
7928                _ = _.nextSibling;
7929              }
7930            }
7931            return s;
7932          }
7933          function nt(t, e, i) {
7934            t[e] = i;
7935          }
7936          try {
7937            if (Object.defineProperty) {
7938              Object.defineProperty(C.prototype, "length", {
7939                get: function() {
7940                  x(this);
7941                  return this.$$length;
7942                }
7943              });
7944              Object.defineProperty(D.prototype, "textContent", {
7945                get: function() {
7946                  return rt(this);
7947                },
7948                set: function(t) {
7949                  switch (this.nodeType) {
7950                   case o:
7951                   case f:
7952                    for (;this.firstChild; ) this.removeChild(this.firstChild);
7953                    (t || String(t)) && this.appendChild(this.ownerDocument.createTextNode(t));
7954                    break;
7955
7956                   default:
7957                    this.data = t;
7958                    this.value = t;
7959                    this.nodeValue = t;
7960                  }
7961                }
7962              });
7963              function rt(t) {
7964                switch (t.nodeType) {
7965                 case o:
7966                 case f:
7967                  var e = [];
7968                  t = t.firstChild;
7969                  for (;t; ) {
7970                    7 !== t.nodeType && 8 !== t.nodeType && e.push(rt(t));
7971                    t = t.nextSibling;
7972                  }
7973                  return e.join("");
7974
7975                 default:
7976                  return t.nodeValue;
7977                }
7978              }
7979              nt = function(t, e, i) {
7980                t["$$" + e] = i;
7981              };
7982            }
7983          } catch (ot) {}
7984          i.DOMImplementation = B;
7985          i.XMLSerializer = Q;
7986        }, {} ],
7987        41: [ function(t, e, i) {
7988          i.entityMap = {
7989            lt: "<",
7990            gt: ">",
7991            amp: "&",
7992            quot: '"',
7993            apos: "'",
7994            Agrave: "À",
7995            Aacute: "Á",
7996            Acirc: "Â",
7997            Atilde: "Ã",
7998            Auml: "Ä",
7999            Aring: "Å",
8000            AElig: "Æ",
8001            Ccedil: "Ç",
8002            Egrave: "È",
8003            Eacute: "É",
8004            Ecirc: "Ê",
8005            Euml: "Ë",
8006            Igrave: "Ì",
8007            Iacute: "Í",
8008            Icirc: "Î",
8009            Iuml: "Ï",
8010            ETH: "Ð",
8011            Ntilde: "Ñ",
8012            Ograve: "Ò",
8013            Oacute: "Ó",
8014            Ocirc: "Ô",
8015            Otilde: "Õ",
8016            Ouml: "Ö",
8017            Oslash: "Ø",
8018            Ugrave: "Ù",
8019            Uacute: "Ú",
8020            Ucirc: "Û",
8021            Uuml: "Ü",
8022            Yacute: "Ý",
8023            THORN: "Þ",
8024            szlig: "ß",
8025            agrave: "à",
8026            aacute: "á",
8027            acirc: "â",
8028            atilde: "ã",
8029            auml: "ä",
8030            aring: "å",
8031            aelig: "æ",
8032            ccedil: "ç",
8033            egrave: "è",
8034            eacute: "é",
8035            ecirc: "ê",
8036            euml: "ë",
8037            igrave: "ì",
8038            iacute: "í",
8039            icirc: "î",
8040            iuml: "ï",
8041            eth: "ð",
8042            ntilde: "ñ",
8043            ograve: "ò",
8044            oacute: "ó",
8045            ocirc: "ô",
8046            otilde: "õ",
8047            ouml: "ö",
8048            oslash: "ø",
8049            ugrave: "ù",
8050            uacute: "ú",
8051            ucirc: "û",
8052            uuml: "ü",
8053            yacute: "ý",
8054            thorn: "þ",
8055            yuml: "ÿ",
8056            nbsp: " ",
8057            iexcl: "¡",
8058            cent: "¢",
8059            pound: "£",
8060            curren: "¤",
8061            yen: "¥",
8062            brvbar: "¦",
8063            sect: "§",
8064            uml: "¨",
8065            copy: "©",
8066            ordf: "ª",
8067            laquo: "«",
8068            not: "¬",
8069            shy: "­­",
8070            reg: "®",
8071            macr: "¯",
8072            deg: "°",
8073            plusmn: "±",
8074            sup2: "²",
8075            sup3: "³",
8076            acute: "´",
8077            micro: "µ",
8078            para: "¶",
8079            middot: "·",
8080            cedil: "¸",
8081            sup1: "¹",
8082            ordm: "º",
8083            raquo: "»",
8084            frac14: "¼",
8085            frac12: "½",
8086            frac34: "¾",
8087            iquest: "¿",
8088            times: "×",
8089            divide: "÷",
8090            forall: "∀",
8091            part: "∂",
8092            exist: "∃",
8093            empty: "∅",
8094            nabla: "∇",
8095            isin: "∈",
8096            notin: "∉",
8097            ni: "∋",
8098            prod: "∏",
8099            sum: "∑",
8100            minus: "−",
8101            lowast: "∗",
8102            radic: "√",
8103            prop: "∝",
8104            infin: "∞",
8105            ang: "∠",
8106            and: "∧",
8107            or: "∨",
8108            cap: "∩",
8109            cup: "∪",
8110            int: "∫",
8111            there4: "∴",
8112            sim: "∼",
8113            cong: "≅",
8114            asymp: "≈",
8115            ne: "≠",
8116            equiv: "≡",
8117            le: "≤",
8118            ge: "≥",
8119            sub: "⊂",
8120            sup: "⊃",
8121            nsub: "⊄",
8122            sube: "⊆",
8123            supe: "⊇",
8124            oplus: "⊕",
8125            otimes: "⊗",
8126            perp: "⊥",
8127            sdot: "⋅",
8128            Alpha: "Α",
8129            Beta: "Β",
8130            Gamma: "Γ",
8131            Delta: "Δ",
8132            Epsilon: "Ε",
8133            Zeta: "Ζ",
8134            Eta: "Η",
8135            Theta: "Θ",
8136            Iota: "Ι",
8137            Kappa: "Κ",
8138            Lambda: "Λ",
8139            Mu: "Μ",
8140            Nu: "Ν",
8141            Xi: "Ξ",
8142            Omicron: "Ο",
8143            Pi: "Π",
8144            Rho: "Ρ",
8145            Sigma: "Σ",
8146            Tau: "Τ",
8147            Upsilon: "Υ",
8148            Phi: "Φ",
8149            Chi: "Χ",
8150            Psi: "Ψ",
8151            Omega: "Ω",
8152            alpha: "α",
8153            beta: "β",
8154            gamma: "γ",
8155            delta: "δ",
8156            epsilon: "ε",
8157            zeta: "ζ",
8158            eta: "η",
8159            theta: "θ",
8160            iota: "ι",
8161            kappa: "κ",
8162            lambda: "λ",
8163            mu: "μ",
8164            nu: "ν",
8165            xi: "ξ",
8166            omicron: "ο",
8167            pi: "π",
8168            rho: "ρ",
8169            sigmaf: "ς",
8170            sigma: "σ",
8171            tau: "τ",
8172            upsilon: "υ",
8173            phi: "φ",
8174            chi: "χ",
8175            psi: "ψ",
8176            omega: "ω",
8177            thetasym: "ϑ",
8178            upsih: "ϒ",
8179            piv: "ϖ",
8180            OElig: "Œ",
8181            oelig: "œ",
8182            Scaron: "Š",
8183            scaron: "š",
8184            Yuml: "Ÿ",
8185            fnof: "ƒ",
8186            circ: "ˆ",
8187            tilde: "˜",
8188            ensp: " ",
8189            emsp: " ",
8190            thinsp: " ",
8191            zwnj: "‌",
8192            zwj: "‍",
8193            lrm: "‎",
8194            rlm: "‏",
8195            ndash: "–",
8196            mdash: "—",
8197            lsquo: "‘",
8198            rsquo: "’",
8199            sbquo: "‚",
8200            ldquo: "“",
8201            rdquo: "”",
8202            bdquo: "„",
8203            dagger: "†",
8204            Dagger: "‡",
8205            bull: "•",
8206            hellip: "…",
8207            permil: "‰",
8208            prime: "′",
8209            Prime: "″",
8210            lsaquo: "‹",
8211            rsaquo: "›",
8212            oline: "‾",
8213            euro: "€",
8214            trade: "™",
8215            larr: "←",
8216            uarr: "↑",
8217            rarr: "→",
8218            darr: "↓",
8219            harr: "↔",
8220            crarr: "↵",
8221            lceil: "⌈",
8222            rceil: "⌉",
8223            lfloor: "⌊",
8224            rfloor: "⌋",
8225            loz: "◊",
8226            spades: "♠",
8227            clubs: "♣",
8228            hearts: "♥",
8229            diams: "♦"
8230          };
8231        }, {} ],
8232        42: [ function(t, e, i) {
8233          var s = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
8234          var n = new RegExp("[\\-\\.0-9" + s.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
8235          var r = new RegExp("^" + s.source + n.source + "*(?::" + s.source + n.source + "*)?$");
8236          function o() {}
8237          o.prototype = {
8238            parse: function(t, e, i) {
8239              var s = this.domBuilder;
8240              s.startDocument();
8241              _(e, e = {});
8242              !function(t, e, i, s, n) {
8243                function r(t) {
8244                  if (t > 65535) {
8245                    var e = 55296 + ((t -= 65536) >> 10), i = 56320 + (1023 & t);
8246                    return String.fromCharCode(e, i);
8247                  }
8248                  return String.fromCharCode(t);
8249                }
8250                function o(t) {
8251                  var e = t.slice(1, -1);
8252                  if (e in i) return i[e];
8253                  if ("#" === e.charAt(0)) return r(parseInt(e.substr(1).replace("x", "0x")));
8254                  n.error("entity not found:" + t);
8255                  return t;
8256                }
8257                function _(e) {
8258                  if (e > v) {
8259                    var i = t.substring(v, e).replace(/&#?\w+;/g, o);
8260                    S && f(v);
8261                    s.characters(i, 0, e - v);
8262                    v = e;
8263                  }
8264                }
8265                function f(e, i) {
8266                  for (;e >= y && (i = b.exec(t)); ) {
8267                    g = i.index;
8268                    y = g + i[0].length;
8269                    S.lineNumber++;
8270                  }
8271                  S.columnNumber = e - g + 1;
8272                }
8273                var g = 0;
8274                var y = 0;
8275                var b = /.*(?:\r\n?|\n)|.*$/g;
8276                var S = s.locator;
8277                var A = [ {
8278                  currentNSMap: e
8279                } ];
8280                var T = {};
8281                var v = 0;
8282                for (;;) {
8283                  try {
8284                    var E = t.indexOf("<", v);
8285                    if (E < 0) {
8286                      if (!t.substr(v).match(/^\s*$/)) {
8287                        var C = s.doc;
8288                        var x = C.createTextNode(t.substr(v));
8289                        C.appendChild(x);
8290                        s.currentElement = x;
8291                      }
8292                      return;
8293                    }
8294                    E > v && _(E);
8295                    switch (t.charAt(E + 1)) {
8296                     case "/":
8297                      var w = t.indexOf(">", E + 3);
8298                      var R = t.substring(E + 2, w);
8299                      var I = A.pop();
8300                      if (w < 0) {
8301                        R = t.substring(E + 2).replace(/[\s<].*/, "");
8302                        n.error("end tag name: " + R + " is not complete:" + I.tagName);
8303                        w = E + 1 + R.length;
8304                      } else if (R.match(/\s</)) {
8305                        R = R.replace(/[\s<].*/, "");
8306                        n.error("end tag name: " + R + " maybe not complete");
8307                        w = E + 1 + R.length;
8308                      }
8309                      var M = I.localNSMap;
8310                      var B = I.tagName == R;
8311                      if (B || I.tagName && I.tagName.toLowerCase() == R.toLowerCase()) {
8312                        s.endElement(I.uri, I.localName, R);
8313                        if (M) for (var D in M) s.endPrefixMapping(D);
8314                        B || n.fatalError("end tag name: " + R + " is not match the current start tagName:" + I.tagName);
8315                      } else A.push(I);
8316                      w++;
8317                      break;
8318
8319                     case "?":
8320                      S && f(E);
8321                      w = p(t, E, s);
8322                      break;
8323
8324                     case "!":
8325                      S && f(E);
8326                      w = d(t, E, s, n);
8327                      break;
8328
8329                     default:
8330                      S && f(E);
8331                      var P = new m;
8332                      var O = A[A.length - 1].currentNSMap;
8333                      w = l(t, E, P, O, o, n);
8334                      var N = P.length;
8335                      if (!P.closed && u(t, w, P.tagName, T)) {
8336                        P.closed = !0;
8337                        i.nbsp || n.warning("unclosed xml attribute");
8338                      }
8339                      if (S && N) {
8340                        var L = a(S, {});
8341                        for (var F = 0; F < N; F++) {
8342                          var V = P[F];
8343                          f(V.offset);
8344                          V.locator = a(S, {});
8345                        }
8346                        s.locator = L;
8347                        h(P, s, O) && A.push(P);
8348                        s.locator = S;
8349                      } else h(P, s, O) && A.push(P);
8350                      "http://www.w3.org/1999/xhtml" !== P.uri || P.closed ? w++ : w = c(t, w, P.tagName, o, s);
8351                    }
8352                  } catch (t) {
8353                    n.error("element parse error: " + t);
8354                    w = -1;
8355                  }
8356                  w > v ? v = w : _(Math.max(E, v) + 1);
8357                }
8358              }(t, e, i, s, this.errorHandler);
8359              s.endDocument();
8360            }
8361          };
8362          function a(t, e) {
8363            e.lineNumber = t.lineNumber;
8364            e.columnNumber = t.columnNumber;
8365            return e;
8366          }
8367          function l(t, e, i, s, n, r) {
8368            var o;
8369            var a = ++e;
8370            var l = 0;
8371            for (;;) {
8372              var h = t.charAt(a);
8373              switch (h) {
8374               case "=":
8375                if (1 === l) {
8376                  o = t.slice(e, a);
8377                  l = 3;
8378                } else {
8379                  if (2 !== l) throw new Error("attribute equal must after attrName");
8380                  l = 3;
8381                }
8382                break;
8383
8384               case "'":
8385               case '"':
8386                if (3 === l || 1 === l) {
8387                  if (1 === l) {
8388                    r.warning('attribute value must after "="');
8389                    o = t.slice(e, a);
8390                  }
8391                  e = a + 1;
8392                  if (!((a = t.indexOf(h, e)) > 0)) throw new Error("attribute value no end '" + h + "' match");
8393                  c = t.slice(e, a).replace(/&#?\w+;/g, n);
8394                  i.add(o, c, e - 1);
8395                  l = 5;
8396                } else {
8397                  if (4 != l) throw new Error('attribute value must after "="');
8398                  c = t.slice(e, a).replace(/&#?\w+;/g, n);
8399                  i.add(o, c, e);
8400                  r.warning('attribute "' + o + '" missed start quot(' + h + ")!!");
8401                  e = a + 1;
8402                  l = 5;
8403                }
8404                break;
8405
8406               case "/":
8407                switch (l) {
8408                 case 0:
8409                  i.setTagName(t.slice(e, a));
8410
8411                 case 5:
8412                 case 6:
8413                 case 7:
8414                  l = 7;
8415                  i.closed = !0;
8416
8417                 case 4:
8418                 case 1:
8419                 case 2:
8420                  break;
8421
8422                 default:
8423                  throw new Error("attribute invalid close char('/')");
8424                }
8425                break;
8426
8427               case "":
8428                r.error("unexpected end of input");
8429                0 == l && i.setTagName(t.slice(e, a));
8430                return a;
8431
8432               case ">":
8433                switch (l) {
8434                 case 0:
8435                  i.setTagName(t.slice(e, a));
8436
8437                 case 5:
8438                 case 6:
8439                 case 7:
8440                  break;
8441
8442                 case 4:
8443                 case 1:
8444                  if ("/" === (c = t.slice(e, a)).slice(-1)) {
8445                    i.closed = !0;
8446                    c = c.slice(0, -1);
8447                  }
8448
8449                 case 2:
8450                  2 === l && (c = o);
8451                  if (4 == l) {
8452                    r.warning('attribute "' + c + '" missed quot(")!!');
8453                    i.add(o, c.replace(/&#?\w+;/g, n), e);
8454                  } else {
8455                    "http://www.w3.org/1999/xhtml" === s[""] && c.match(/^(?:disabled|checked|selected)$/i) || r.warning('attribute "' + c + '" missed value!! "' + c + '" instead!!');
8456                    i.add(c, c, e);
8457                  }
8458                  break;
8459
8460                 case 3:
8461                  throw new Error("attribute value missed!!");
8462                }
8463                return a;
8464
8465               case "":
8466                h = " ";
8467
8468               default:
8469                if (h <= " ") switch (l) {
8470                 case 0:
8471                  i.setTagName(t.slice(e, a));
8472                  l = 6;
8473                  break;
8474
8475                 case 1:
8476                  o = t.slice(e, a);
8477                  l = 2;
8478                  break;
8479
8480                 case 4:
8481                  var c = t.slice(e, a).replace(/&#?\w+;/g, n);
8482                  r.warning('attribute "' + c + '" missed quot(")!!');
8483                  i.add(o, c, e);
8484
8485                 case 5:
8486                  l = 6;
8487                } else switch (l) {
8488                 case 2:
8489                  i.tagName;
8490                  "http://www.w3.org/1999/xhtml" === s[""] && o.match(/^(?:disabled|checked|selected)$/i) || r.warning('attribute "' + o + '" missed value!! "' + o + '" instead2!!');
8491                  i.add(o, o, e);
8492                  e = a;
8493                  l = 1;
8494                  break;
8495
8496                 case 5:
8497                  r.warning('attribute space is required"' + o + '"!!');
8498
8499                 case 6:
8500                  l = 1;
8501                  e = a;
8502                  break;
8503
8504                 case 3:
8505                  l = 4;
8506                  e = a;
8507                  break;
8508
8509                 case 7:
8510                  throw new Error("elements closed character '/' and '>' must be connected to");
8511                }
8512              }
8513              a++;
8514            }
8515          }
8516          function h(t, e, i) {
8517            var s = t.tagName;
8518            var n = null;
8519            var r = t.length;
8520            for (;r--; ) {
8521              var o = t[r];
8522              var a = o.qName;
8523              var l = o.value;
8524              if ((d = a.indexOf(":")) > 0) {
8525                var h = o.prefix = a.slice(0, d);
8526                var c = a.slice(d + 1);
8527                var u = "xmlns" === h && c;
8528              } else {
8529                c = a;
8530                h = null;
8531                u = "xmlns" === a && "";
8532              }
8533              o.localName = c;
8534              if (!1 !== u) {
8535                if (null == n) {
8536                  n = {};
8537                  _(i, i = {});
8538                }
8539                i[u] = n[u] = l;
8540                o.uri = "http://www.w3.org/2000/xmlns/";
8541                e.startPrefixMapping(u, l);
8542              }
8543            }
8544            r = t.length;
8545            for (;r--; ) {
8546              if (h = (o = t[r]).prefix) {
8547                "xml" === h && (o.uri = "http://www.w3.org/XML/1998/namespace");
8548                "xmlns" !== h && (o.uri = i[h || ""]);
8549              }
8550            }
8551            var d;
8552            if ((d = s.indexOf(":")) > 0) {
8553              h = t.prefix = s.slice(0, d);
8554              c = t.localName = s.slice(d + 1);
8555            } else {
8556              h = null;
8557              c = t.localName = s;
8558            }
8559            var p = t.uri = i[h || ""];
8560            e.startElement(p, c, s, t);
8561            if (!t.closed) {
8562              t.currentNSMap = i;
8563              t.localNSMap = n;
8564              return !0;
8565            }
8566            e.endElement(p, c, s);
8567            if (n) for (h in n) e.endPrefixMapping(h);
8568          }
8569          function c(t, e, i, s, n) {
8570            if (/^(?:script|textarea)$/i.test(i)) {
8571              var r = t.indexOf("</" + i + ">", e);
8572              var o = t.substring(e + 1, r);
8573              if (/[&<]/.test(o)) {
8574                if (/^script$/i.test(i)) {
8575                  n.characters(o, 0, o.length);
8576                  return r;
8577                }
8578                o = o.replace(/&#?\w+;/g, s);
8579                n.characters(o, 0, o.length);
8580                return r;
8581              }
8582            }
8583            return e + 1;
8584          }
8585          function u(t, e, i, s) {
8586            var n = s[i];
8587            if (null == n) {
8588              (n = t.lastIndexOf("</" + i + ">")) < e && (n = t.lastIndexOf("</" + i));
8589              s[i] = n;
8590            }
8591            return n < e;
8592          }
8593          function _(t, e) {
8594            for (var i in t) e[i] = t[i];
8595          }
8596          function d(t, e, i, s) {
8597            if ("-" === t.charAt(e + 2)) {
8598              if ("-" === t.charAt(e + 3)) {
8599                if ((n = t.indexOf("--\x3e", e + 4)) > e) {
8600                  i.comment(t, e + 4, n - e - 4);
8601                  return n + 3;
8602                }
8603                s.error("Unclosed comment");
8604                return -1;
8605              }
8606              return -1;
8607            }
8608            if ("CDATA[" == t.substr(e + 3, 6)) {
8609              var n = t.indexOf("]]>", e + 9);
8610              i.startCDATA();
8611              i.characters(t, e + 9, n - e - 9);
8612              i.endCDATA();
8613              return n + 3;
8614            }
8615            var r = function(t, e) {
8616              var i;
8617              var s = [];
8618              var n = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
8619              n.lastIndex = e;
8620              n.exec(t);
8621              for (;i = n.exec(t); ) {
8622                s.push(i);
8623                if (i[1]) return s;
8624              }
8625            }(t, e);
8626            var o = r.length;
8627            if (o > 1 && /!doctype/i.test(r[0][0])) {
8628              var a = r[1][0];
8629              var l = o > 3 && /^public$/i.test(r[2][0]) && r[3][0];
8630              var h = o > 4 && r[4][0];
8631              var c = r[o - 1];
8632              i.startDTD(a, l && l.replace(/^(['"])(.*?)\1$/, "$2"), h && h.replace(/^(['"])(.*?)\1$/, "$2"));
8633              i.endDTD();
8634              return c.index + c[0].length;
8635            }
8636            return -1;
8637          }
8638          function p(t, e, i) {
8639            var s = t.indexOf("?>", e);
8640            if (s) {
8641              var n = t.substring(e, s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
8642              if (n) {
8643                n[0].length;
8644                i.processingInstruction(n[1], n[2]);
8645                return s + 2;
8646              }
8647              return -1;
8648            }
8649            return -1;
8650          }
8651          function m(t) {}
8652          m.prototype = {
8653            setTagName: function(t) {
8654              if (!r.test(t)) throw new Error("invalid tagName:" + t);
8655              this.tagName = t;
8656            },
8657            add: function(t, e, i) {
8658              if (!r.test(t)) throw new Error("invalid attribute:" + t);
8659              this[this.length++] = {
8660                qName: t,
8661                value: e,
8662                offset: i
8663              };
8664            },
8665            length: 0,
8666            getLocalName: function(t) {
8667              return this[t].localName;
8668            },
8669            getLocator: function(t) {
8670              return this[t].locator;
8671            },
8672            getQName: function(t) {
8673              return this[t].qName;
8674            },
8675            getURI: function(t) {
8676              return this[t].uri;
8677            },
8678            getValue: function(t) {
8679              return this[t].value;
8680            }
8681          };
8682          i.XMLReader = o;
8683        }, {} ]
8684      }, {}, [ 5 ]);
8685    },
8686    915: () => {
8687      "use strict";
8688      System.register([], (function(t, e) {
8689        var i;
8690        t("Application", void 0);
8691        return {
8692          setters: [],
8693          execute: function() {
8694            t("Application", class {
8695              constructor() {
8696                this.settingsPath = "src/settings.json";
8697                this.showFPS = !0;
8698              }
8699              init(t) {
8700                (i = t).game.onPostBaseInitDelegate.add(this.onPostInitBase.bind(this));
8701                i.game.onPostSubsystemInitDelegate.add(this.onPostSystemInit.bind(this));
8702              }
8703              onPostInitBase() {}
8704              onPostSystemInit() {}
8705              start() {
8706                return i.game.init({
8707                  debugMode: i.DebugMode.INFO,
8708                  settingsPath: this.settingsPath,
8709                  overrideSettings: {
8710                    profiling: {
8711                      showFPS: this.showFPS
8712                    }
8713                  }
8714                }).then((() => i.game.run()));
8715              }
8716            });
8717          }
8718        };
8719      }));
8720    },
8721    513: () => {
8722      "use strict";
8723      System.register([], (function(t, e) {
8724        return {
8725          execute: function() {
8726            System.register("chunks:///_virtual/rollupPluginModLoBabelHelpers.js", [], (function(t) {
8727              return {
8728                execute: function() {
8729                  t({
8730                    applyDecoratedDescriptor: function(t, e, i, s, n) {
8731                      var r = {};
8732                      Object.keys(s).forEach((function(t) {
8733                        r[t] = s[t];
8734                      }));
8735                      r.enumerable = !!r.enumerable;
8736                      r.configurable = !!r.configurable;
8737                      ("value" in r || r.initializer) && (r.writable = !0);
8738                      r = i.slice().reverse().reduce((function(i, s) {
8739                        return s(t, e, i) || i;
8740                      }), r);
8741                      if (n && void 0 !== r.initializer) {
8742                        r.value = r.initializer ? r.initializer.call(n) : void 0;
8743                        r.initializer = void 0;
8744                      }
8745                      if (void 0 === r.initializer) {
8746                        Object.defineProperty(t, e, r);
8747                        r = null;
8748                      }
8749                      return r;
8750                    },
8751                    initializerDefineProperty: function(t, e, i, s) {
8752                      if (!i) return;
8753                      Object.defineProperty(t, e, {
8754                        enumerable: i.enumerable,
8755                        configurable: i.configurable,
8756                        writable: i.writable,
8757                        value: i.initializer ? i.initializer.call(s) : void 0
8758                      });
8759                    }
8760                  });
8761                }
8762              };
8763            }));
8764          }
8765        };
8766      }));
8767    },
8768    61: (t, e, i) => {
8769      "use strict";
8770      System.register([], (function(t, e) {
8771        return {
8772          execute: function() {
8773            t({
8774              AntiAliasing: void 0,
8775              BitMask: ie,
8776              CCClass: si,
8777              CacheMode: void 0,
8778              DebugMode: void 0,
8779              DeviceType: void 0,
8780              EAxisDirection: void 0,
8781              ECollider2DType: void 0,
8782              EJoint2DType: void 0,
8783              EPhysics2DDrawFlags: void 0,
8784              ERaycast2DType: void 0,
8785              ERigidBody2DType: void 0,
8786              ERigidBodyType: void 0,
8787              Enum: oe,
8788              Eventify: To,
8789              ExtrapolationMode: void 0,
8790              HorizontalTextAlignment: void 0,
8791              InstanceMaterialType: void 0,
8792              KeyCode: void 0,
8793              NodeEventType: void 0,
8794              Overflow: void 0,
8795              Physics2DManifoldType: void 0,
8796              PhysicsGroup: void 0,
8797              PipelineEventType: void 0,
8798              QuatInterpolationMode: void 0,
8799              RealInterpolationMode: void 0,
8800              SystemEventType: void 0,
8801              TangentWeightMode: void 0,
8802              VerticalTextAlignment: void 0,
8803              WorldNode3DToLocalNodeUI: UR,
8804              WorldNode3DToWorldNodeUI: GR,
8805              XrControlEventType: void 0,
8806              XrKeyboardEventType: void 0,
8807              XrUIPressEventType: void 0,
8808              __checkObsoleteInNamespace__: function(t) {
8809                st || (st = "undefined" == typeof Proxy ? {} : new Proxy(t, {
8810                  get(t, e, i) {
8811                    it(e);
8812                    return Reflect.get(t, e, i);
8813                  }
8814                }));
8815                return st;
8816              },
8817              __checkObsolete__: function(t) {
8818                for (let e of t) it(e);
8819              },
8820              absMax: Ri,
8821              absMaxComponent: wi,
8822              approx: ui,
8823              assert: w,
8824              assertID: k,
8825              bezier: Qd,
8826              bezierByTime: rp,
8827              buildShadowPass: hI,
8828              buildShadowPasses: uI,
8829              ccenum: he,
8830              clamp: _i,
8831              clamp01: di,
8832              color: Di,
8833              computeRatioByType: KZ,
8834              debug: R,
8835              deprecateModuleExportedName: et,
8836              deserialize: o_,
8837              earcut: Dk,
8838              enumerableProps: Ii,
8839              equals: ci,
8840              error: x,
8841              errorID: F,
8842              find: mv,
8843              fragmentText: MM,
8844              getBaselineOffset: fM,
8845              getCameraUniqueID: dI,
8846              getEnglishWordPartAtFirst: RM,
8847              getEnglishWordPartAtLast: IM,
8848              getError: G,
8849              getLoadOpOfClearFlag: pI,
8850              getPathFromRoot: function(t, e) {
8851                let i = t;
8852                let s = "";
8853                for (;null !== i && i !== e; ) {
8854                  s = `${i.name}/${s}`;
8855                  i = i.parent;
8856                }
8857                return s.slice(0, -1);
8858              },
8859              getRenderArea: lI,
8860              getSerializationMetadata: function(t) {
8861                return t[Wl];
8862              },
8863              getWorldTransformUntilRoot: KW,
8864              instantiate: d_,
8865              inverseLerp: xi,
8866              isDisplayStats: z,
8867              isEnglishWordPartAtFirst: function(t) {
8868                return vM.test(t);
8869              },
8870              isEnglishWordPartAtLast: function(t) {
8871                return TM.test(t);
8872              },
8873              isUnicodeCJK: EM,
8874              isUnicodeSpace: CM,
8875              isValid: po,
8876              lerp: pi,
8877              log: E,
8878              logID: P,
8879              markAsWarning: void 0,
8880              mat4: Zi,
8881              murmurhash2_32_gc: Ur,
8882              nextPow2: vi,
8883              pingPong: Ci,
8884              pseudoRandom: Si,
8885              pseudoRandomRange: Ai,
8886              pseudoRandomRangeInt: Ti,
8887              quat: Wi,
8888              randomRange: yi,
8889              randomRangeInt: bi,
8890              rect: ls,
8891              removeProperty: void 0,
8892              repeat: Ei,
8893              replaceProperty: void 0,
8894              safeMeasureText: xM,
8895              sampleAnimationCurve: qZ,
8896              setDefaultLogTimes: function(t) {
8897                t > 0 && (X = t);
8898              },
8899              setDisplayStats: H,
8900              size: os,
8901              toDegree: fi,
8902              toRadian: mi,
8903              tween: _Ft,
8904              tweenUtil: dFt,
8905              v2: es,
8906              v3: Li,
8907              v4: ss,
8908              validPunctualLightsCulling: gI,
8909              warn: C,
8910              warnID: N
8911            });
8912            const s = 2147483647;
8913            function n(t) {
8914              return (t > 0) - (t < 0);
8915            }
8916            function r(t) {
8917              let e;
8918              let i;
8919              e = (t > 65535) << 4;
8920              i = ((t >>>= e) > 255) << 3;
8921              e |= i;
8922              i = ((t >>>= i) > 15) << 2;
8923              e |= i;
8924              i = ((t >>>= i) > 3) << 1;
8925              e |= i;
8926              return e | (t >>>= i) >> 1;
8927            }
8928            function o(t) {
8929              return 16843009 * ((t = (858993459 & (t -= t >>> 1 & 1431655765)) + (t >>> 2 & 858993459)) + (t >>> 4) & 252645135) >>> 24;
8930            }
8931            function a(t) {
8932              let e = 32;
8933              (t &= -t) && e--;
8934              65535 & t && (e -= 16);
8935              16711935 & t && (e -= 8);
8936              252645135 & t && (e -= 4);
8937              858993459 & t && (e -= 2);
8938              1431655765 & t && (e -= 1);
8939              return e;
8940            }
8941            function l(t) {
8942              --t;
8943              t |= t >>> 1;
8944              t |= t >>> 2;
8945              t |= t >>> 4;
8946              t |= t >>> 8;
8947              return (t |= t >>> 16) + 1;
8948            }
8949            const h = new Array(256);
8950            (t => {
8951              for (let e = 0; e < 256; ++e) {
8952                let i = e;
8953                let s = e;
8954                let n = 7;
8955                for (i >>>= 1; i; i >>>= 1) {
8956                  s <<= 1;
8957                  s |= 1 & i;
8958                  --n;
8959                }
8960                t[e] = s << n & 255;
8961              }
8962            })(h);
8963            var c = Object.freeze({
8964              __proto__: null,
8965              INT_BITS: 32,
8966              INT_MAX: s,
8967              INT_MIN: -2147483648,
8968              sign: n,
8969              abs: function(t) {
8970                const e = t >> 31;
8971                return (t ^ e) - e;
8972              },
8973              min: function(t, e) {
8974                return e ^ (t ^ e) & -(t < e);
8975              },
8976              max: function(t, e) {
8977                return t ^ (t ^ e) & -(t < e);
8978              },
8979              isPow2: function(t) {
8980                return !(t & t - 1 || !t);
8981              },
8982              log2: r,
8983              log10: function(t) {
8984                return t >= 1e9 ? 9 : t >= 1e8 ? 8 : t >= 1e7 ? 7 : t >= 1e6 ? 6 : t >= 1e5 ? 5 : t >= 1e4 ? 4 : t >= 1e3 ? 3 : t >= 100 ? 2 : t >= 10 ? 1 : 0;
8985              },
8986              popCount: o,
8987              countTrailingZeros: a,
8988              nextPow2: l,
8989              prevPow2: function(t) {
8990                t |= t >>> 1;
8991                t |= t >>> 2;
8992                t |= t >>> 4;
8993                t |= t >>> 8;
8994                return (t |= t >>> 16) - (t >>> 1);
8995              },
8996              parity: function(t) {
8997                t ^= t >>> 16;
8998                t ^= t >>> 8;
8999                t ^= t >>> 4;
9000                return 27030 >>> (t &= 15) & 1;
9001              },
9002              reverse: function(t) {
9003                return h[255 & t] << 24 | h[t >>> 8 & 255] << 16 | h[t >>> 16 & 255] << 8 | h[t >>> 24 & 255];
9004              },
9005              interleave2: function(t, e) {
9006                return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t &= 65535) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e &= 65535) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1;
9007              },
9008              deinterleave2: function(t, e) {
9009                return (t = 65535 & ((t = 16711935 & ((t = 252645135 & ((t = 858993459 & ((t = t >>> e & 1431655765) | t >>> 1)) | t >>> 2)) | t >>> 4)) | t >>> 16)) << 16 >> 16;
9010              },
9011              interleave3: function(t, e, i) {
9012                t = 1227133513 & ((t = 3272356035 & ((t = 251719695 & ((t = 4278190335 & ((t &= 1023) | t << 16)) | t << 8)) | t << 4)) | t << 2);
9013                return (t |= (e = 1227133513 & ((e = 3272356035 & ((e = 251719695 & ((e = 4278190335 & ((e &= 1023) | e << 16)) | e << 8)) | e << 4)) | e << 2)) << 1) | (i = 1227133513 & ((i = 3272356035 & ((i = 251719695 & ((i = 4278190335 & ((i &= 1023) | i << 16)) | i << 8)) | i << 4)) | i << 2)) << 2;
9014              },
9015              deinterleave3: function(t, e) {
9016                return (t = 1023 & ((t = 4278190335 & ((t = 251719695 & ((t = 3272356035 & ((t = t >>> e & 1227133513) | t >>> 2)) | t >>> 4)) | t >>> 8)) | t >>> 16)) << 22 >> 22;
9017              },
9018              nextCombination: function(t) {
9019                const e = t | t - 1;
9020                return e + 1 | (~e & -~e) - 1 >>> a(t) + 1;
9021              }
9022            });
9023            t("bits", c);
9024            function u(t, e) {
9025              const i = "undefined" == typeof window ? global : window;
9026              return void 0 === i[t] ? i[t] = e : i[t];
9027            }
9028            u("CC_WECHAT", !1);
9029            u("CC_BAIDU", !1);
9030            u("CC_XIAOMI", !1);
9031            u("CC_ALIPAY", !1);
9032            u("CC_BYTEDANCE", !1);
9033            u("CC_OPPO", !1);
9034            u("CC_VIVO", !1);
9035            u("CC_HIJ", !1);
9036            u("CC_COCOSPLAY", !1);
9037            u("CC_QTT", !1);
9038            u("CC_LINKSURE", !1);
9039            const _ = !1;
9040            u("CC_EDITOR", !1);
9041            u("CC_PREVIEW", !1);
9042            u("CC_BUILD", !0);
9043            u("CC_TEST", !1);
9044            u("CC_DEBUG", !0);
9045            u("CC_DEV", !1);
9046            u("CC_MINIGAME", !1);
9047            u("CC_RUNTIME_BASED", !1);
9048            u("CC_SUPPORT_JIT", !1);
9049            u("CC_JSB", !0);
9050            var d = {
9051              1006: "[Action step]. override me",
9052              1007: "[Action update]. override me",
9053              1008: "[Action reverse]. override me",
9054              1100: "Expected 'data' dict, but not found. Config file: %s",
9055              1101: "Please load the resource first : %s",
9056              1200: "cocos2d: Director: Error in gettimeofday",
9057              1204: "Running scene should not be null",
9058              1205: "The scene should not be null",
9059              1206: "loadScene: The scene index to load (%s) is out of range.",
9060              1207: "loadScene: Unknown name type to load: '%s'",
9061              1208: "loadScene: Failed to load scene '%s' because '%s' is already being loaded.",
9062              1209: "loadScene: Can not load the scene '%s' because it was not in the build settings before playing.",
9063              1210: "Failed to preload '%s', %s",
9064              1211: "loadScene: The scene index to load (%s) is out of range.",
9065              1212: "loadScene: Unknown name type to load: '%s'",
9066              1213: "loadScene: Failed to load scene '%s' because '%s' is already loading",
9067              1214: "loadScene: Can not load the scene '%s' because it was not in the build settings before playing.",
9068              1215: "Failed to preload '%s', %s",
9069              1216: "Director.runSceneImmediate: scene is not valid",
9070              1217: "Director._initOnEngineInitialized: renderer root initialization failed",
9071              1218: "Forward render pipeline initialized.",
9072              1219: "Deferred render pipeline initialized. Note that non-transparent materials with no lighting will not be rendered, such as builtin-unlit.",
9073              1220: "Failed to set shading scale, pipelineSceneData is invalid.",
9074              1221: "Setting orientation is not supported yet.",
9075              1300: "%s is not in the model pool and cannot be destroyed by destroyModel.",
9076              1400: "'%s' is deprecated, please use '%s' instead.",
9077              1404: "cc.spriteFrameCache is removed, please use cc.loader to load and cache sprite frames of atlas format.",
9078              1406: "'%s.%s' is removed",
9079              1408: "'%s' is removed",
9080              1409: "element type is wrong!",
9081              1502: "cc.scheduler.scheduleCallbackForTarget(): target should be non-null.",
9082              1503: "cc.Scheduler.pauseTarget():target should be non-null",
9083              1504: "cc.Scheduler.resumeTarget():target should be non-null",
9084              1505: "cc.Scheduler.isTargetPaused():target should be non-null",
9085              1506: "warning: you CANNOT change update priority in scheduled function",
9086              1507: "scheduler#scheduleSelector. Selector already scheduled. Updating interval from: %.4f to %.4f",
9087              1508: "Argument callback must not be empty",
9088              1509: "Argument target must be non-nullptr",
9089              1510: "cc.Scheduler: Illegal target which doesn't have id, you should do Scheduler.enableForTarget(target) before all scheduler API usage on target",
9090              1511: "cc.Scheduler: pause state of the scheduled task doesn't match the element pause state in Scheduler, the given paused state will be ignored.",
9091              1513: "cc.Scheduler: scheduler stopped using `__instanceId` as id since v2.0, you should do Scheduler.enableForTarget(target) before all scheduler API usage on target",
9092              1607: "removeFromParentAndCleanup is deprecated. Use removeFromParent instead",
9093              1619: "callback function must be non-null",
9094              1620: "interval must be positive",
9095              1623: "Set '%s' to normal node (not persist root node).",
9096              1624: "Replacing with the same sgNode",
9097              1625: "The replacement sgNode should not contain any child.",
9098              1626: "Should not set alpha via 'color', set 'opacity' please.",
9099              1627: "Not support for asynchronous creating node in SG",
9100              1632: "Node name can not include '/'.",
9101              1633: "Internal error, should not remove unknown node from parent.",
9102              1635: "reorderChild: this child is not in children list.",
9103              1636: "Node's zIndex value can't be greater than cc.macro.MAX_ZINDEX, setting to the maximum value",
9104              1637: "Node's zIndex value can't be smaller than cc.macro.MIN_ZINDEX, setting to the minimum value",
9105              1638: "Private node's zIndex can't be set, it will keep cc.macro.MIN_ZINDEX as its value",
9106              1800: "cc._EventListenerKeyboard.checkAvailable(): Invalid EventListenerKeyboard!",
9107              1801: "cc._EventListenerTouchOneByOne.checkAvailable(): Invalid EventListenerTouchOneByOne!",
9108              1802: "cc._EventListenerTouchAllAtOnce.checkAvailable(): Invalid EventListenerTouchAllAtOnce!",
9109              1803: "cc._EventListenerAcceleration.checkAvailable():_onAccelerationEvent must be non-nil",
9110              1900: "Invalid parameter.",
9111              2104: "Layer collision. The name of layer (%s) is collided with the name or value of some layer",
9112              2200: "Design resolution not valid",
9113              2201: "should set resolutionPolicy",
9114              2300: "The touches is more than MAX_TOUCHES, nUnusedIndex = %s",
9115              2402: "Forward pipeline startup failed!",
9116              3103: "cc.Texture.addImage(): path should be non-null",
9117              3119: "Lazy init texture with image element failed due to image loading failure: %s",
9118              3120: "Loading texture with unsupported type: '%s'. Add '%s' into 'cc.macro.SUPPORT_TEXTURE_FORMATS' please.",
9119              3121: "Can't find a texture format supported by the current platform! Please add a fallback format in the editor.",
9120              3122: "Error Texture in %s.",
9121              3123: "Set same texture %s.",
9122              3124: "Texture: setMipRange failed because base level is larger than max level",
9123              3300: "Rect width exceeds maximum margin: %s",
9124              3301: "Rect height exceeds maximum margin: %s",
9125              3500: "0 priority is forbidden for fixed priority since it's used for scene graph based priority.",
9126              3501: "Invalid listener type!",
9127              3502: "Can't set fixed priority with scene graph based listener.",
9128              3503: "Invalid parameters.",
9129              3504: "listener must be a cc.EventListener object when adding a fixed priority listener",
9130              3505: "The listener has been registered, please don't register it again.",
9131              3506: "Unsupported listener target.",
9132              3507: "Invalid scene graph priority!",
9133              3508: "If program goes here, there should be event in dispatch.",
9134              3509: "_inDispatch should be 1 here.",
9135              3510: "%s's scene graph node not contains in the parent's children",
9136              3511: "event is undefined",
9137              3512: "Event manager only support scene graph priority for ui nodes which contain UIComponent",
9138              3520: "Device Motion Event request permission: %s",
9139              3521: "Device Motion Event request permission failed: %s",
9140              3601: "The editor property 'playOnFocus' should be used with 'executeInEditMode' in class '%s'",
9141              3602: "Unknown editor property '%s' in class '%s'.",
9142              3603: "Use 'cc.Float' or 'cc.Integer' instead of 'cc.Number' please.",
9143              3604: "Can only indicate one type attribute for %s.",
9144              3605: "The default value of %s is not instance of %s.",
9145              3606: "No needs to indicate the '%s' attribute for %s, which its default value is type of %s.",
9146              3607: "The default value of %s must be an empty string.",
9147              3608: "The type of %s must be CCString, not String.",
9148              3609: "The type of %s must be CCBoolean, not Boolean.",
9149              3610: "The type of %s must be CCFloat or CCInteger, not Number.",
9150              3611: "Can not indicate the '%s' attribute for %s, which its default value is type of %s.",
9151              3612: "%s Just set the default value to 'new %s()' and it will be handled properly.",
9152              3613: "'No need to use 'serializable: false' or 'editorOnly: true' for the getter of '%s.%s', every getter is actually non-serialized.",
9153              3614: "Should not define constructor for cc.Component %s.",
9154              3615: "Each script can have at most one Component.",
9155              3616: "Should not specify class name %s for Component which defines in project.",
9156              3618: "ctor of '%s' can not be another CCClass",
9157              3623: "Can not use 'editor' attribute, '%s' not inherits from Components.",
9158              3625: "[isChildClassOf] superclass should be function type, not",
9159              3626: "Can't remove '%s' because '%s' depends on it.",
9160              3627: "Should not add renderer component (%s) to a Canvas node.",
9161              3628: "Should not add %s to a node which size is already used by its other component.",
9162              3633: "Properties function of '%s' should return an object!",
9163              3634: "Disallow to use '.' in property name",
9164              3637: "Can not declare %s.%s, it is already defined in the prototype of %s",
9165              3639: "Can not apply the specified attribute to the getter of '%s.%s', attribute index: %s",
9166              3640: "'%s': the setter of '%s' is already defined!",
9167              3641: "Can not construct %s because it contains object property.",
9168              3644: "Please define 'type' parameter of %s.%s as the actual constructor.",
9169              3645: "Please define 'type' parameter of %s.%s as the constructor of %s.",
9170              3646: "Unknown 'type' parameter of %s.%s:%s",
9171              3647: "The length of range array must be equal or greater than 2",
9172              3648: "Can not declare %s.%s method, it is already defined in the properties of %s.",
9173              3652: "Failed to `new %s()` under the hood, %s\nIt is used for getting default values declared in TypeScript in the first place.\nPlease ensure the constructor can be called during the script's initialization.",
9174              3653: 'Please do not specifiy "default" attribute in decorator of "%s" property in "%s" class.\nDefault value must be initialized at their declaration:\n\n \n// Before:\n@property({\n  type: cc.SpriteFrame\n  default: null  // <--\n})\nmyProp;\n// After:\n@property({\n  type: cc.SpriteFrame\n})\nmyProp = null;   // <--',
9175              3654: 'Please specifiy a default value for "%s.%s" property at its declaration:\n\n \n// Before:\n@property(...)\nmyProp;\n// After:\n@property(...)\nmyProp = 0;',
9176              3655: 'Can not specifiy "get" or "set"  attribute in decorator for "%s" property in "%s" class.\nPlease use:\n\n \n@property(...)\nget %s () {\n    ...\n}\n@property\nset %s (value) {\n    ...\n}',
9177              3659: "Violation error: extending enumerations shall have non-overlaped member names or member values",
9178              3660: "You are explicitly specifying `undefined` type to cc property \"%s\" of cc class \"%s\".\nIs this intended? If not, this may indicate a circular reference.\nFor example:\n\n \n// foo.ts\nimport { _decorator } from 'cc';\nimport { Bar } from './bar';  // Given that './bar' also reference 'foo.ts'.\n                              // When importing './bar', execution of './bar' is hung on to wait execution of 'foo.ts',\n                              // the `Bar` imported here is `undefined` until './bar' finish its execution.\n                              // It leads to that\n@_decorator.ccclass           //  ↓\nexport class Foo {            //  ↓\n    @_decorator.type(Bar)     //  → is equivalent to `@_decorator.type(undefined)`\n    public bar: Bar;          // To eliminate this error, either:\n                              // - Refactor your module structure(recommended), or\n                              // - specify the type as cc class name: `@_decorator.type('Bar'/* or any name you specified for `Bar` */)`\n}",
9179              3700: "internal error: _prefab is undefined",
9180              3701: "Failed to load prefab asset for node '%s'",
9181              3800: "The target can not be made persist because it's not a cc.Node or it doesn't have _id property.",
9182              3801: "The node can not be made persist because it's not under root node.",
9183              3802: "The node can not be made persist because it's not in current scene.",
9184              3803: "The target can not be made persist because it's not a cc.Node or it doesn't have _id property.",
9185              3804: "getComponent: Type must be non-nil",
9186              3805: "Can't add component '%s' because %s already contains the same component.",
9187              3806: "Can't add component '%s' to %s because it conflicts with the existing '%s' derived component.",
9188              3807: "addComponent: Failed to get class '%s'",
9189              3808: "addComponent: Should not add component ('%s') when the scripts are still loading.",
9190              3809: "addComponent: The component to add must be a constructor",
9191              3810: "addComponent: The component to add must be child class of cc.Component",
9192              3811: "_addComponentAt: The component to add must be a constructor",
9193              3812: "_addComponentAt: Index out of range",
9194              3813: "removeComponent: Component must be non-nil",
9195              3814: "Argument must be non-nil",
9196              3815: "Component not owned by this entity",
9197              3816: "Node '%s' is already activating",
9198              3817: "Sorry, the component of '%s' which with an index of %s is corrupted! It has been removed.",
9199              3818: "Failed to read or parse project.json",
9200              3819: "Warning: target element is not a DIV or CANVAS",
9201              3820: "The renderer doesn't support the renderMode %s",
9202              3821: "Cannot change hierarchy while activating or deactivating the parent.",
9203              3822: "addComponent: Cannot add any component to the scene.",
9204              3823: "The enabled component (id: %s, name: %s) doesn't have a valid node",
9205              3900: "Invalid clip to add",
9206              3901: "Invalid clip to remove",
9207              3902: "clip is defaultClip, set force to true to force remove clip and animation state",
9208              3903: "animation state is playing, set force to true to force stop and remove clip and animation state",
9209              3904: "motion path of target [%s] in prop [%s] frame [%s] is not valid",
9210              3905: "sprite frames must be an Array.",
9211              3906: "Can't find easing type [%s]",
9212              3907: "Animation state is not playing or already removed",
9213              3912: "already-playing",
9214              3920: "Current context does not allow root motion.",
9215              3921: "You provided a ill-formed track path. The last component of track path should be property key, or the setter should not be empty.",
9216              3923: "Root motion is ignored since root bone could not be located in animation.",
9217              3924: "Root motion is ignored since the root bone could not be located in scene.",
9218              3925: "Target of hierarchy path should be of type Node.",
9219              3926: 'Node "%s" has no path "%s".',
9220              3927: "Target of component path should be of type Node.",
9221              3928: 'Node "%s" has no component "%s".',
9222              3929: 'Target object has no property "%s".',
9223              3930: "Can not decide type for untyped track: runtime binding does not provide a getter.",
9224              3931: "Can not decide type for untyped track: got a unsupported value from runtime binding.",
9225              3932: "Common targets should only target Vectors/`Size`/`Color`.",
9226              3933: "Each curve that has common target should be numeric curve and targets string property.",
9227              3934: "Misconfigured legacy curve: the first keyframe value is number but others aren't.",
9228              3935: "We don't currently support conversion of \\`CubicSplineQuatValue\\`.",
9229              3936: "Instancing/Batching enabled for non-baked skinning model '%s', this may result in unexpected rendering artifacts. Consider turning it off in the material if you do not intend to do this.",
9230              3937: "Previous error occurred when instantiating animation clip %s on node %s.",
9231              3938: "'%s' is not found from '%s'. It's specified as the root node to play animation clip '%s'.",
9232              4003: "Label font size can't be shirnked less than 0!",
9233              4004: "force notify all fonts loaded!",
9234              4011: "Property spriteFrame of Font '%s' is invalid. Using system font instead.",
9235              4012: "The texture of Font '%s' must be already loaded on JSB. Using system font instead.",
9236              4013: "Sorry, lineHeight of system font not supported on JSB.",
9237              4200: "MaskType: IMAGE_STENCIL only support WebGL mode.",
9238              4201: "The alphaThreshold invalid in Canvas Mode.",
9239              4202: "The inverted invalid in Canvas Mode.",
9240              4300: "Can not found the %s page.",
9241              4301: "Can not add a page without UITransform.",
9242              4302: "Can not set the scroll view content when it hasn't UITransform or its parent hasn't UITransform.",
9243              4400: "Invalid RichText img tag! The sprite frame name can't be found in the ImageAtlas!",
9244              4500: "Graphics: There is no model in %s.",
9245              4600: "Script attached to '%s' is missing or invalid.",
9246              4700: "The dom control is not created!",
9247              4800: "unknown asset type",
9248              4901: "loadRes: should not specify the extname in %s %s",
9249              4902: "No need to release non-cached asset.",
9250              4914: "Resources url '%s' does not exist.",
9251              4915: "Pack indices and data do not match in size",
9252              4916: "Failed to download package for %s",
9253              4921: "Invalid pipe or invalid index provided!",
9254              4922: "The pipe to be inserted is already in the pipeline!",
9255              4923: "Uuid Loader: Parse asset [ %s ] failed : %s",
9256              4924: "JSON Loader: Input item doesn't contain string content",
9257              4925: "Uuid Loader: Deserialize asset [ %s ] failed : %s",
9258              4926: "Audio Downloader: no web audio context.",
9259              4927: "Audio Downloader: audio not supported on this browser!",
9260              4928: "Load %s failed!",
9261              4929: "Load Webp ( %s ) failed",
9262              4930: "Load image ( %s ) failed",
9263              4932: 'Since v1.10, for any atlas ("%s") in the "resources" directory, it is not possible to find the contained SpriteFrames via `loadRes`, `getRes` or `releaseRes`. Load the SpriteAtlas first and then use `spriteAtlas.getSpriteFrame(name)` instead please.',
9264              4933: "Download Font [ %s ] failed, using Arial or system default font instead",
9265              4934: "Please assure that the full path of sub asset is correct!",
9266              4935: "Failed to skip prefab asset while deserializing PrefabInfo",
9267              5e3: "You are trying to destroy a object twice or more.",
9268              5001: "object not yet destroyed",
9269              5100: "Not a plist file!",
9270              5200: "Warning: localStorage isn't enabled. Please confirm browser cookie or privacy option",
9271              5201: "browser don't support web audio",
9272              5202: "This feature supports WebGL render mode only.",
9273              5300: "Type of target to deserialize not matched with data: target is %s, data is %s",
9274              5301: "Can not find script '%s'",
9275              5302: "Can not find class '%s'",
9276              5303: "Failed to deserialize %s, missing _deserialize function.",
9277              5304: "Unable to deserialize version %s data.",
9278              5402: "cc.js.addon called on non-object:",
9279              5403: "cc.js.mixin: arguments must be type object:",
9280              5404: "The base class to extend from must be non-nil",
9281              5405: "The class to extend must be non-nil",
9282              5406: "Class should be extended before assigning any prototype members.",
9283              5500: "'notify' can not be used in 'get/set' !",
9284              5501: "'notify' must be used with 'default' !",
9285              5507: "The 'default' attribute of '%s.%s' must be an array",
9286              5508: "Invalid type of %s.%s",
9287              5510: "The 'type' attribute of '%s.%s' can not be 'Number', use cc.Float or cc.Integer instead please.",
9288              5511: "The 'type' attribute of '%s.%s' is undefined when loading script",
9289              5512: "Can not serialize '%s.%s' because the specified type is anonymous, please provide a class name or set the 'serializable' attribute of '%s.%s' to 'false'.",
9290              5513: "The 'default' value of '%s.%s' should not be used with a 'get' function.",
9291              5514: "The 'default' value of '%s.%s' should not be used with a 'set' function.",
9292              5515: "The 'default' value of '%s.%s' can not be an constructor. Set default to null please.",
9293              5517: "'%s.%s' hides inherited property '%s.%s'. To make the current property override that implementation, add the `override: true` attribute please.",
9294              5601: "Can not get current scene.",
9295              5602: "Scene is destroyed",
9296              5603: "reference node is destroyed",
9297              5700: "no %s or %s on %s",
9298              5800: "%s.lerp not yet implemented.",
9299              5801: "%s.clone not yet implemented.",
9300              5802: "%s.equals not yet implemented.",
9301              5900: "MotionStreak only support WebGL mode.",
9302              5901: "cc.MotionStreak.getOpacity has not been supported.",
9303              5902: "cc.MotionStreak.setOpacity has not been supported.",
9304              6e3: "Custom should not be false if file is not specified.",
9305              6001: "The new %s must not be NaN",
9306              6017: "Incomplete or corrupt PNG file",
9307              6018: "Invalid filter algorithm: %s",
9308              6019: "Invalid byte order value.",
9309              6020: "You forgot your towel!",
9310              6021: "Unknown Field Tag: %s",
9311              6022: "Too many bits requested",
9312              6023: "No bits requested",
9313              6024: "Cannot recover from missing StripByteCounts",
9314              6025: "Cannot handle sub-byte bits per sample",
9315              6026: "Cannot handle sub-byte bits per pixel",
9316              6027: "Palette image missing color map",
9317              6028: "Unknown Photometric Interpretation: %s",
9318              6029: "Unkown error",
9319              6030: "cc.ParticleSystem: error decoding or ungzipping textureImageData",
9320              6031: "cc.ParticleSystem: unknown image format with Data",
9321              6032: "cc.ParticleSystem.initWithDictionary() : error loading the texture",
9322              6033: "cc.ParticleSystem: not allowing create to be invoked twice with different particle system",
9323              6034: "cc.ParticleSystem: shouldn't be initialized repetitively, otherwise there will be potential leak",
9324              6035: "cc.ParticleSystem: change material failed, please use proper particle material",
9325              6036: "cc.ParticleSystem: life time should bigger than 1 or buffer will be insufficient",
9326              6400: "asset.url is not usable in core process",
9327              6402: "AssetLibrary has already been initialized!",
9328              6500: "Widget target must be one of the parent nodes of it",
9329              6600: "collider not added or already removed",
9330              6601: "Can't find testFunc for (%s, $s).",
9331              6700: "Can't init canvas '%s' because it conflicts with the existing '%s', the scene should only have one active canvas at the same time.",
9332              6705: "Argument must be non-nil",
9333              6706: "Priority can't be set in RenderRoot2D node",
9334              6800: "Callback of event must be non-nil",
9335              6801: "The message must be provided",
9336              6900: "The thing you want to instantiate must be an object",
9337              6901: "The thing you want to instantiate is nil",
9338              6902: "The thing you want to instantiate is destroyed",
9339              6903: "The instantiate method for given asset do not implemented",
9340              6904: "Can not instantiate array",
9341              6905: "Can not instantiate DOM element",
9342              7100: "%s already defined in Enum.",
9343              7101: "Sorry, 'cc.Enum' not available on this platform, please report this error here: <https://github.com/cocos-creator/engine/issues/new>",
9344              7200: "Method 'initWithTMXFile' is no effect now, please set property 'tmxAsset' instead.",
9345              7201: "Method 'initWithXML' is no effect now, please set property 'tmxAsset' instead.",
9346              7202: "Add component TiledLayer into node failed.",
9347              7203: "Property 'mapLoaded' is unused now. Please write the logic to the callback 'start'.",
9348              7210: "TMX Hexa zOrder not supported",
9349              7211: "TMX invalid value",
9350              7215: "cocos2d: Warning: TMX Layer %s has no tiles",
9351              7216: "cocos2d: TMXFormat: Unsupported TMX version: %s",
9352              7217: "cocos2d: TMXFomat: Unsupported orientation: %s",
9353              7218: "cc.TMXMapInfo.parseXMLFile(): unsupported compression method",
9354              7219: "cc.TMXMapInfo.parseXMLFile(): Only base64 and/or gzip/zlib maps are supported",
9355              7221: "cc.TMXMapInfo.parseXMLFile(): Texture '%s' not found.",
9356              7222: "Parse %s failed.",
9357              7236: "cc.TMXLayer.getTileAt(): TMXLayer: the tiles map has been released",
9358              7237: "cc.TMXLayer.getTileGIDAt(): TMXLayer: the tiles map has been released",
9359              7238: "cc.TMXLayer.setTileGID(): TMXLayer: the tiles map has been released",
9360              7239: "cc.TMXLayer.setTileGID(): invalid gid: %s",
9361              7240: "cc.TMXLayer.getTileFlagsAt(): TMXLayer: the tiles map has been released",
9362              7241: "cc.TiledMap.initWithXML(): Map not found. Please check the filename.",
9363              7401: "Failed to set _defaultArmatureIndex for '%s' because the index is out of range.",
9364              7402: "Failed to set _animationIndex for '%s' because the index is out of range.",
9365              7501: "Failed to set _defaultSkinIndex for '%s' because the index is out of range.",
9366              7502: "Failed to set _animationIndex for '%s' because its skeletonData is invalid.",
9367              7503: "Failed to set _animationIndex for '%s' because the index is out of range.",
9368              7504: "Can not render dynamic created SkeletonData",
9369              7506: "Failed to load spine atlas '$s'",
9370              7507: "Please re-import '%s' because its textures is not initialized! (This workflow will be improved in the future.)",
9371              7508: "The atlas asset of '%s' is not exists!",
9372              7509: "Spine: Animation not found: %s",
9373              7510: "Spine: Animation not found: %s",
9374              7600: "The context of RenderTexture is invalid.",
9375              7601: "cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;",
9376              7602: "Could not attach texture to the framebuffer",
9377              7603: "clearDepth isn't supported on Cocos2d-Html5",
9378              7604: "saveToFile isn't supported on Cocos2d-Html5",
9379              7605: "newCCImage isn't supported on Cocos2d-Html5",
9380              7606: "GFXTexture is null",
9381              7607: "readPixels buffer size smaller than %d",
9382              7700: "On the web is always keep the aspect ratio",
9383              7701: "Can't know status",
9384              7702: "Video player's duration is not ready to get now!",
9385              7703: "Video Downloader: video not supported on this browser!",
9386              7800: "Web does not support loading",
9387              7801: "Web does not support query history",
9388              7802: "Web does not support query history",
9389              7803: "The current browser does not support the GoBack",
9390              7804: "The current browser does not support the GoForward",
9391              7805: "Web does not support zoom",
9392              7900: "cc.math.Matrix3.assign(): current matrix equals matIn",
9393              7901: "cc.math.mat4Assign(): pOut equals pIn",
9394              7902: "cc.mat.Matrix4.assignFrom(): mat4 equals current matrix",
9395              7903: "cc.math.Matrix4 equal: pMat1 and pMat2 are same object.",
9396              7904: "cc.math.Matrix4.extractPlane: Invalid plane index",
9397              7905: "cc.math.mat4Assign(): pOut equals pIn",
9398              7906: "cc.mat.Matrix4.assignFrom(): mat4 equals current matrix",
9399              7907: "cc.math.Matrix4 equals: pMat1 and pMat2 are same object.",
9400              7908: "Invalid matrix mode specified",
9401              7909: "current quaternion is an invalid value",
9402              8e3: "Can't handle this field type or size",
9403              8001: "No bytes requested",
9404              8002: "Too many bytes requested",
9405              8003: "Missing StripByteCounts!",
9406              8100: "cocos2d: ERROR: Failed to compile shader:\n %s",
9407              8101: "cocos2d: ERROR: Failed to compile vertex shader",
9408              8102: "cocos2d: ERROR: Failed to compile fragment shader",
9409              8103: "cc.GLProgram.link(): Cannot link invalid program",
9410              8104: "cocos2d: ERROR: Failed to link program: %s",
9411              8105: "cocos2d: cc.shaderCache._loadDefaultShader, error shader type",
9412              8106: "Please load the resource firset : %s",
9413              8107: "cc.GLProgram.getUniformLocationForName(): uniform name should be non-null",
9414              8108: "cc.GLProgram.getUniformLocationForName(): Invalid operation. Cannot get uniform location when program is not initialized",
9415              8109: "modelView matrix is undefined.",
9416              8200: "Please set node's active instead of rigidbody's enabled.",
9417              8300: "Should only one camera exists, please check your project.",
9418              8301: "Camera does not support Canvas Mode.",
9419              8302: "Camera.viewport is deprecated, please use setViewportInOrientedSpace instead.",
9420              8400: "Wrong type arguments, 'filePath' must be a String.",
9421              9e3: "Stencil manager does not support level bigger than %d in this device.",
9422              9001: "Stencil manager is already empty, cannot pop any mask",
9423              9002: "Failed to request any buffer from a mesh buffer without accessor",
9424              9003: "The internal state of LinearBufferAccessor have severe issue and irreversible, please check the reason",
9425              9004: "Failed to allocate chunk in StaticVBAccessor, the requested buffer might be too large: %d bytes",
9426              9005: "BATCHER2D_MEM_INCREMENT is too large, the Max value for BATCHER2D_MEM_INCREMENT is 2303KB (smaller than 65536 *9* 4 / 1024 = 2304KB)",
9427              9006: "QuadRenderData is removed, please use MeshRenderData instead.",
9428              9007: "Since v3.6, Because mask changes the inheritance relationship, you can directly manipulate the rendering components under the same node to complete the operation.",
9429              9100: "texture size exceeds current device limits %d/%d",
9430              9201: "Cannot access game frame or container.",
9431              9202: "Setting window size is not supported.",
9432              9300: "The current buffer beyond the limit in ui static component, please reduce the amount",
9433              9301: "The UI has not been initialized",
9434              9302: "Can't getGFXSampler with out device",
9435              9600: "[Physics]: please check to see if physics modules are included",
9436              9610: "[Physics]: cannon.js physics system doesn't support capsule collider",
9437              9611: "[Physics]: builtin physics system doesn't support mesh collider",
9438              9612: "[Physics]: builtin physics system doesn't support cylinder collider",
9439              9620: "[Physics][Ammo]: changing the mesh is not supported after the initialization is completed",
9440              10001: "The sub-mesh contains %d vertices, which beyonds the capability (%d vertices most) of renderer of your platform.",
9441              10002: "Sub-mesh may include at most %d morph targets, but you specified %d.",
9442              11e3: "WebGL context lost.",
9443              12001: "BlendFactors are disabled when using custom material, please modify the blend state in the material instead.",
9444              12002: "Can't add renderable component to this node because it already have one.",
9445              12004: "SubModel can only support %d passes.",
9446              12005: "Material already initialized, request aborted.",
9447              12006: "Pass already destroyed.",
9448              12007: "This is old usage, please swap the parameters.",
9449              12008: "GeometryRenderer: too many lines.",
9450              12009: "GeometryRenderer: too many triangles.",
9451              12100: "The font size is too big to be fitted into texture atlas. Please switch to other label cache modes or choose a smaller font size.",
9452              12101: "The asset %s has been destroyed!",
9453              13100: "Incorrect CCON magic.",
9454              13101: "Unknown CCON version number: %d.",
9455              13102: "CCON Format error.",
9456              13103: "Can not encode CCON binary: lack of text encoder.",
9457              13104: "Can not decode CCON binary: lack of text decoder.",
9458              14e3: "Graph update has been interrupted since too many transitions(greater than %s) occurred during one frame.",
9459              14100: "Pool.destroy no longer take a function as parameter, Please specify destruct function in the construction of Pool instead",
9460              14200: "Can not update a static mesh.",
9461              14201: "The primitiveIndex is out of range.",
9462              14300: "Can not keep world transform due to the zero scaling of parent node",
9463              14400: "Spline error: less than 2 knots.",
9464              14401: "Spline error: less than 4 knots or not a multiple of 4.\n\n\x3c!-- Rendering algorithm reserved: 15000 - 16000 --\x3e",
9465              15e3: "Can not find corresponding diffuse map for environment lighting, use hemisphere diffuse instead, change environment lighting type to regenerate diffuse map",
9466              15001: "Can not find environment map, disable IBL lighting",
9467              15002: "Diffuse map resource is missing, please change environment lighting type to regenerate resource",
9468              15003: "The shadow visible distance is so small that CSM stratification is not effective, Please change the value of shadowDistance so that it is 10 times greater than 0.1",
9469              15004: "The native folder may be generated from older versions, please refer https://docs.cocos.com/creator/manual/en/release-notes/ to upgrade.",
9470              16e3: "'%s' is deprecated since v%s.",
9471              16001: "'%s' is deprecated since v%s, please use '%s' instead.",
9472              16002: "'%s' is removed since v%s.",
9473              16003: "'%s' is removed since v%s, please use '%s' instead.",
9474              16101: "The effect('%s') you are looking for does not exist, please confirm the effect name in the editor. NOTE: Since 3.6, the name of the built-in effect has been changed to its name in the editor, please check it out. More information please refer to https://docs.cocos.com/creator/manual/en/shader/effect-inspector.html",
9475              16201: "The asset replacing failed, can not found override asset('%s') for '%s'",
9476              "0100": "%s not yet implemented.",
9477              "0200": "You should specify a valid DOM canvas element."
9478            };
9479            const p = "undefined" == typeof window ? global : window;
9480            const m = t("cclegacy", {
9481              _global: p
9482            });
9483            m.internal = {};
9484            const f = t("VERSION", "3.6.1");
9485            p.CocosEngine = m.ENGINE_VERSION = f;
9486            p.cc = m;
9487            let g = null;
9488            let y = console.log.bind(console);
9489            let b = y;
9490            let S = y;
9491            let A = (t, e, ...i) => {
9492              t || console.log(`ASSERT: ${v(e, ...i)}`);
9493            };
9494            let T = y;
9495            function v(t, ...e) {
9496              return m.js.formatStr.apply(null, [ t ].concat(e));
9497            }
9498            function E(t, ...e) {
9499              return y(t, ...e);
9500            }
9501            function C(t, ...e) {
9502              return b(t, ...e);
9503            }
9504            function x(t, ...e) {
9505              return S(t, ...e);
9506            }
9507            function w(t, e, ...i) {
9508              return A(t, e, ...i);
9509            }
9510            function R(...t) {
9511              return T(...t);
9512            }
9513            function I(t) {
9514              y = b = S = A = T = () => {};
9515              if (t !== U.NONE) {
9516                if (t > U.ERROR) {
9517                  const e = t => {
9518                    if (m.game.canvas) {
9519                      if (!g) {
9520                        const t = document.createElement("Div");
9521                        t.setAttribute("id", "logInfoDiv");
9522                        t.setAttribute("width", "200");
9523                        t.setAttribute("height", m.game.canvas.height);
9524                        const e = t.style;
9525                        e.zIndex = "99999";
9526                        e.position = "absolute";
9527                        e.top = e.left = "0";
9528                        g = document.createElement("textarea");
9529                        g.setAttribute("rows", "20");
9530                        g.setAttribute("cols", "30");
9531                        g.setAttribute("disabled", "true");
9532                        const i = g.style;
9533                        i.backgroundColor = "transparent";
9534                        i.borderBottom = "1px solid #cccccc";
9535                        i.borderTopWidth = i.borderLeftWidth = i.borderRightWidth = "0px";
9536                        i.borderTopStyle = i.borderLeftStyle = i.borderRightStyle = "none";
9537                        i.padding = "0px";
9538                        i.margin = "0px";
9539                        t.appendChild(g);
9540                        m.game.canvas.parentNode.appendChild(t);
9541                      }
9542                      g.value = `${g.value + t}\r\n`;
9543                      g.scrollTop = g.scrollHeight;
9544                    }
9545                  };
9546                  S = (t, ...i) => {
9547                    e(`ERROR :  ${v(t, ...i)}`);
9548                  };
9549                  A = (t, i, ...s) => {
9550                    t || e(`ASSERT: ${v(i, ...s)}`);
9551                  };
9552                  t !== U.ERROR_FOR_WEB_PAGE && (b = (t, ...i) => {
9553                    e(`WARN :  ${v(t, ...i)}`);
9554                  });
9555                  t === U.INFO_FOR_WEB_PAGE && (y = (t, ...i) => {
9556                    e(v(t, ...i));
9557                  });
9558                } else if (console) {
9559                  console.error || (console.error = console.log);
9560                  console.warn || (console.warn = console.log);
9561                  S = console.error.bind ? console.error.bind(console) : console.error;
9562                  A = (t, e, ...i) => {
9563                    if (!t) {
9564                      const t = v(e, ...i);
9565                      throw new Error(t);
9566                    }
9567                  };
9568                }
9569                t !== U.ERROR && (b = console.warn.bind && !window.oh ? console.warn.bind(console) : console.warn);
9570                t <= U.INFO && (y = "JavaScriptCore" === scriptEngineType ? (t, ...e) => console.log.apply(console, [ t, ...e ]) : console.log);
9571                if (t <= U.VERBOSE && "function" == typeof console.debug) {
9572                  const t = console.debug.bind(console);
9573                  T = (...e) => t(...e);
9574                }
9575              }
9576            }
9577            function M(t) {
9578              {
9579                const e = t.stack;
9580                x(e ? `${t}\n${e}` : t);
9581                return;
9582              }
9583            }
9584            function B(t) {
9585              return (t, ...e) => {
9586                const i = d[t] || "unknown id";
9587                return 0 === e.length ? i : v(i, ...e);
9588              };
9589            }
9590            const D = B();
9591            function P(t, ...e) {
9592              E(D(t, ...e));
9593            }
9594            const O = B();
9595            function N(t, ...e) {
9596              C(O(t, ...e));
9597            }
9598            const L = B();
9599            function F(t, ...e) {
9600              x(L(t, ...e));
9601            }
9602            const V = B();
9603            function k(t, e, ...i) {
9604              t || w(!1, V(e, ...i));
9605            }
9606            let U;
9607            !function(t) {
9608              t[t.NONE = 0] = "NONE";
9609              t[t.VERBOSE = 1] = "VERBOSE";
9610              t[t.INFO = 2] = "INFO";
9611              t[t.WARN = 3] = "WARN";
9612              t[t.ERROR = 4] = "ERROR";
9613              t[t.INFO_FOR_WEB_PAGE = 5] = "INFO_FOR_WEB_PAGE";
9614              t[t.WARN_FOR_WEB_PAGE = 6] = "WARN_FOR_WEB_PAGE";
9615              t[t.ERROR_FOR_WEB_PAGE = 7] = "ERROR_FOR_WEB_PAGE";
9616            }(U || (U = t("DebugMode", {})));
9617            function G(t, ...e) {
9618              return L(t, ...e);
9619            }
9620            function z() {
9621              return !!m.profiler && m.profiler.isShowingStats();
9622            }
9623            function H(t) {
9624              m.profiler && (t ? m.profiler.showStats() : m.profiler.hideStats());
9625            }
9626            var j = Object.freeze({
9627              __proto__: null,
9628              log: E,
9629              warn: C,
9630              error: x,
9631              assert: w,
9632              debug: R,
9633              _resetDebugSetting: I,
9634              _throw: M,
9635              logID: P,
9636              warnID: N,
9637              errorID: F,
9638              assertID: k,
9639              get DebugMode() {
9640                return U;
9641              },
9642              getError: G,
9643              isDisplayStats: z,
9644              setDisplayStats: H
9645            });
9646            let X = 10;
9647            let W;
9648            let Y;
9649            let q;
9650            let K;
9651            let J;
9652            let Z;
9653            let Q = 0;
9654            const $ = new Map;
9655            K = (t, e, i, s, n, r, o) => {
9656              const a = $.get(r);
9657              if (a && a.logTimes > a.count) {
9658                n(`'%s' is deprecated, please use '%s' instead. ${o}`, `${t}.${e}`, `${i}.${s}`);
9659                a.count++;
9660              }
9661            };
9662            W = t("replaceProperty", ((t, e, i) => {
9663              null != t && i.forEach((i => {
9664                const s = Q++;
9665                $.set(s, {
9666                  id: s,
9667                  count: 0,
9668                  logTimes: void 0 !== i.logTimes ? i.logTimes : X
9669                });
9670                const n = null != i.target ? i.target : t;
9671                const r = null != i.newName ? i.newName : i.name;
9672                const o = null != i.targetName ? i.targetName : e;
9673                const a = n === t;
9674                const l = i.suggest ? `(${i.suggest})` : "";
9675                if (null != i.customFunction) t[i.name] = function() {
9676                  K(e, i.name, o, r, C, s, l);
9677                  return i.customFunction.call(this, ...arguments);
9678                }; else if (null != i.customSetter || null != i.customGetter) {
9679                  const n = null != i.customSetter;
9680                  const a = null != i.customGetter;
9681                  n && a ? Object.defineProperty(t, i.name, {
9682                    get() {
9683                      K(e, i.name, o, r, C, s, l);
9684                      return i.customGetter.call(this);
9685                    },
9686                    set(t) {
9687                      K(e, i.name, o, r, C, s, l);
9688                      i.customSetter.call(this, t);
9689                    },
9690                    enumerable: !1
9691                  }) : n ? Object.defineProperty(t, i.name, {
9692                    set(t) {
9693                      K(e, i.name, o, r, C, s, l);
9694                      i.customSetter.call(this, t);
9695                    },
9696                    enumerable: !1
9697                  }) : a && Object.defineProperty(t, i.name, {
9698                    get() {
9699                      K(e, i.name, o, r, C, s, l);
9700                      return i.customGetter.call(this);
9701                    },
9702                    enumerable: !1
9703                  });
9704                } else Object.defineProperty(t, i.name, {
9705                  get() {
9706                    K(e, i.name, o, r, C, s, l);
9707                    return a ? this[r] : n[r];
9708                  },
9709                  set(t) {
9710                    K(e, i.name, o, r, C, s, l);
9711                    a ? this[r] = t : n[r] = t;
9712                  },
9713                  enumerable: !1
9714                });
9715              }));
9716            }));
9717            Z = (t, e, i, s, n) => {
9718              const r = $.get(s);
9719              if (r && r.logTimes > r.count) {
9720                i(`'%s' has been removed. ${n}`, `${t}.${e}`);
9721                r.count++;
9722              }
9723            };
9724            Y = t("removeProperty", ((t, e, i) => {
9725              null != t && i.forEach((i => {
9726                const s = Q++;
9727                $.set(s, {
9728                  id: s,
9729                  count: 0,
9730                  logTimes: void 0 !== i.logTimes ? i.logTimes : X
9731                });
9732                const n = i.suggest ? `(${i.suggest})` : "";
9733                Object.defineProperty(t, i.name, {
9734                  get: () => Z(e, i.name, x, s, n),
9735                  set() {
9736                    Z(e, i.name, x, s, n);
9737                  },
9738                  enumerable: !1
9739                });
9740              }));
9741            }));
9742            J = (t, e, i, s, n) => {
9743              const r = $.get(s);
9744              if (r && r.logTimes > r.count) {
9745                i(`'%s' is deprecated. ${n}`, `${t}.${e}`);
9746                r.count++;
9747              }
9748            };
9749            q = t("markAsWarning", ((t, e, i) => {
9750              if (null == t) return;
9751              const s = (e, i, s, n, r, o) => {
9752                if (e.get) {
9753                  const t = e.get;
9754                  e.get = function() {
9755                    J(i, s, n, r, o);
9756                    return t.call(this);
9757                  };
9758                }
9759                if (e.set) {
9760                  const t = e.set;
9761                  e.set = function(e) {
9762                    J(i, s, n, r, o);
9763                    t.call(this, e);
9764                  };
9765                }
9766                Object.defineProperty(t, s, e);
9767              };
9768              i.forEach((i => {
9769                const n = i.name;
9770                const r = Object.getOwnPropertyDescriptor(t, n);
9771                if (!r || !r.configurable) return;
9772                const o = Q++;
9773                $.set(o, {
9774                  id: o,
9775                  count: 0,
9776                  logTimes: void 0 !== i.logTimes ? i.logTimes : X
9777                });
9778                const a = i.suggest ? `(${i.suggest})` : "";
9779                if (void 0 !== r.value) if ("function" == typeof r.value) {
9780                  const i = r.value;
9781                  t[n] = function() {
9782                    J(e, n, C, o, a);
9783                    return i.call(this, ...arguments);
9784                  };
9785                } else {
9786                  let i = r.value;
9787                  Object.defineProperty(t, n, {
9788                    configurable: !0,
9789                    get() {
9790                      J(e, n, C, o, a);
9791                      return i;
9792                    }
9793                  });
9794                  r.writable && Object.defineProperty(t, n, {
9795                    set(t) {
9796                      J(e, n, C, o, a);
9797                      i = t;
9798                    }
9799                  });
9800                } else s(r, e, n, C, o, a);
9801                Object.defineProperty(t, n, {
9802                  enumerable: !1
9803                });
9804              }));
9805            }));
9806            const tt = {};
9807            function et(t) {
9808              for (let e in t) {
9809                const i = t[e];
9810                tt[e] = i;
9811              }
9812            }
9813            function it(t) {
9814              const e = tt[t];
9815              if (!e) return;
9816              const {newName: i, since: s, removed: n} = e;
9817              n ? i ? F(16003, t, s, i) : F(16002, t, s) : i ? N(16001, t, s, i) : N(16e3, t, s);
9818            }
9819            let st;
9820            class nt {
9821              constructor(t) {
9822                this.i = 0;
9823                this.array = t;
9824              }
9825              get length() {
9826                return this.array.length;
9827              }
9828              set length(t) {
9829                this.array.length = t;
9830                this.i >= t && (this.i = t - 1);
9831              }
9832              remove(t) {
9833                const e = this.array.indexOf(t);
9834                e >= 0 && this.removeAt(e);
9835              }
9836              removeAt(t) {
9837                this.array.splice(t, 1);
9838                t <= this.i && --this.i;
9839              }
9840              fastRemove(t) {
9841                const e = this.array.indexOf(t);
9842                e >= 0 && this.fastRemoveAt(e);
9843              }
9844              fastRemoveAt(t) {
9845                const e = this.array;
9846                e[t] = e[e.length - 1];
9847                --e.length;
9848                t <= this.i && --this.i;
9849              }
9850              push(t) {
9851                this.array.push(t);
9852              }
9853            }
9854            function rt(t, e) {
9855              t.splice(e, 1);
9856            }
9857            function ot(t, e) {
9858              const i = t.length;
9859              if (!(e < 0 || e >= i)) {
9860                t[e] = t[i - 1];
9861                t.length = i - 1;
9862              }
9863            }
9864            function at(t, e) {
9865              const i = t.indexOf(e);
9866              if (i >= 0) {
9867                rt(t, i);
9868                return !0;
9869              }
9870              return !1;
9871            }
9872            function lt(t, e) {
9873              const i = t.findIndex(e);
9874              if (i >= 0) {
9875                const e = t[i];
9876                rt(t, i);
9877                return e;
9878              }
9879            }
9880            function ht(t, e) {
9881              return t.indexOf(e) >= 0;
9882            }
9883            var ct = Object.freeze({
9884              __proto__: null,
9885              removeAt: rt,
9886              fastRemoveAt: ot,
9887              remove: at,
9888              fastRemove: function(t, e) {
9889                const i = t.indexOf(e);
9890                if (i >= 0) {
9891                  t[i] = t[t.length - 1];
9892                  --t.length;
9893                }
9894              },
9895              removeIf: lt,
9896              verifyType: function(t, e) {
9897                if (t && t.length > 0) for (const i of t) if (!(i instanceof e)) {
9898                  P(1300);
9899                  return !1;
9900                }
9901                return !0;
9902              },
9903              removeArray: function(t, e) {
9904                for (let i = 0, s = e.length; i < s; i++) at(t, e[i]);
9905              },
9906              appendObjectsAt: function(t, e, i) {
9907                t.splice.apply(t, [ i, 0, ...e ]);
9908                return t;
9909              },
9910              contains: ht,
9911              copy: function(t) {
9912                const e = t.length;
9913                const i = new Array(e);
9914                for (let s = 0; s < e; s += 1) i[s] = t[s];
9915                return i;
9916              },
9917              MutableForwardIterator: nt
9918            });
9919            class ut {
9920              constructor(t) {
9921                this.id = void 0;
9922                this.prefix = void 0;
9923                this.id = 0 | 998 * Math.random();
9924                this.prefix = t ? t + "." : "";
9925              }
9926              getNewId() {
9927                return this.prefix + ++this.id;
9928              }
9929            }
9930            ut.global = new ut("global");
9931            const _t = new ut("TmpCId.");
9932            const dt = "undefined" == typeof Symbol ? "__aliases__" : Symbol("[[Aliases]]");
9933            const pt = "__classname__";
9934            const mt = "__cid__";
9935            function ft(t) {
9936              return "number" == typeof t || t instanceof Number;
9937            }
9938            function gt(t) {
9939              return "string" == typeof t || t instanceof String;
9940            }
9941            function yt(t) {
9942              for (const e in t) return !1;
9943              return !0;
9944            }
9945            const bt = (() => {
9946              const t = {
9947                value: void 0,
9948                enumerable: !1,
9949                writable: !1,
9950                configurable: !0
9951              };
9952              return (e, i, s, n, r) => {
9953                t.value = s;
9954                t.writable = n;
9955                t.enumerable = r;
9956                Object.defineProperty(e, i, t);
9957                t.value = void 0;
9958              };
9959            })();
9960            const St = (() => {
9961              const t = {
9962                get: void 0,
9963                set: void 0,
9964                enumerable: !1
9965              };
9966              return (e, i, s, n, r = !1, o = !1) => {
9967                if ("boolean" == typeof n) {
9968                  r = n;
9969                  n = void 0;
9970                }
9971                t.get = s;
9972                t.set = n;
9973                t.enumerable = r;
9974                t.configurable = o;
9975                Object.defineProperty(e, i, t);
9976                t.get = void 0;
9977                t.set = void 0;
9978              };
9979            })();
9980            const At = (() => {
9981              const t = {
9982                get: void 0,
9983                enumerable: !1,
9984                configurable: !1
9985              };
9986              return (e, i, s, n, r) => {
9987                t.get = s;
9988                t.enumerable = n;
9989                t.configurable = r;
9990                Object.defineProperty(e, i, t);
9991                t.get = void 0;
9992              };
9993            })();
9994            const Tt = (() => {
9995              const t = {
9996                set: void 0,
9997                enumerable: !1,
9998                configurable: !1
9999              };
10000              return (e, i, s, n, r) => {
10001                t.set = s;
10002                t.enumerable = n;
10003                t.configurable = r;
10004                Object.defineProperty(e, i, t);
10005                t.set = void 0;
10006              };
10007            })();
10008            function vt(t) {
10009              const e = Object.create(null);
10010              if (t) {
10011                const t = ".";
10012                const i = "/";
10013                e[t] = 1;
10014                e[i] = 1;
10015                delete e[t];
10016                delete e[i];
10017              }
10018              return e;
10019            }
10020            function Et(t) {
10021              if ("function" == typeof t) {
10022                const e = t.prototype;
10023                if (e && e.hasOwnProperty(pt) && e.__classname__) return e.__classname__;
10024                let i = "";
10025                t.name && (i = t.name);
10026                if (t.toString) {
10027                  let e;
10028                  const s = t.toString();
10029                  e = "[" === s.charAt(0) ? /\[\w+\s*(\w+)\]/.exec(s) : /function\s*(\w+)/.exec(s);
10030                  e && 2 === e.length && (i = e[1]);
10031                }
10032                return "Object" !== i ? i : "";
10033              }
10034              return t && t.constructor ? Et(t.constructor) : "";
10035            }
10036            function Ct(t, e, i, s) {
10037              const n = /([^.]+)$/;
10038              const r = n.exec(e)[0];
10039              const o = n.exec(i)[0];
10040              function a() {
10041                return this[o];
10042              }
10043              s ? St(t, r, a, (function(t) {
10044                this[o] = t;
10045              })) : At(t, r, a);
10046            }
10047            function xt(t, e, i, s) {
10048              for (const n in i) {
10049                Ct(t, `${e}.${n}`, i[n], s);
10050              }
10051            }
10052            const wt = /(%d)|(%s)/;
10053            const Rt = /%s/;
10054            function It(t, ...e) {
10055              if (0 === arguments.length) return "";
10056              if (0 === e.length) return `${t}`;
10057              const i = "string" == typeof t && wt.test(t);
10058              if (i) for (const i of e) {
10059                const e = "number" == typeof i ? wt : Rt;
10060                if (e.test(t)) {
10061                  const s = `${i}`;
10062                  t = t.replace(e, s);
10063                } else t += ` ${i}`;
10064              } else for (const i of e) t += ` ${i}`;
10065              return t;
10066            }
10067            function Mt() {
10068              const t = arguments.length - 1;
10069              const e = new Array(t);
10070              for (let i = 0; i < t; ++i) e[i] = arguments[i + 1];
10071              return e;
10072            }
10073            function Bt(t, e) {
10074              for (;t; ) {
10075                const i = Object.getOwnPropertyDescriptor(t, e);
10076                if (i) return i;
10077                t = Object.getPrototypeOf(t);
10078              }
10079              return null;
10080            }
10081            function Dt(t, e, i) {
10082              const s = Bt(e, t);
10083              s && Object.defineProperty(i, t, s);
10084            }
10085            function Pt(t, e, i) {
10086              const s = Object.getOwnPropertyNames(t);
10087              for (let n = 0, r = s.length; n < r; ++n) {
10088                const r = s[n];
10089                -1 === i.indexOf(r) && Dt(r, t, e);
10090              }
10091            }
10092            function Ot(t, ...e) {
10093              t = t || {};
10094              for (const i of e) if (i) {
10095                if ("object" != typeof i) {
10096                  F(5402, i);
10097                  continue;
10098                }
10099                for (const e in i) e in t || Dt(e, i, t);
10100              }
10101              return t;
10102            }
10103            function Nt(t, ...e) {
10104              t = t || {};
10105              for (const i of e) if (i) {
10106                if ("object" != typeof i) {
10107                  F(5403, i);
10108                  continue;
10109                }
10110                for (const e in i) Dt(e, i, t);
10111              }
10112              return t;
10113            }
10114            function Lt(t, e) {
10115              for (const i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
10116              t.prototype = Object.create(e.prototype, {
10117                constructor: {
10118                  value: t,
10119                  writable: !0,
10120                  configurable: !0
10121                }
10122              });
10123              return t;
10124            }
10125            function Ft(t) {
10126              const e = t.prototype;
10127              const i = e && Object.getPrototypeOf(e);
10128              return i && i.constructor;
10129            }
10130            function Vt(t, e) {
10131              if (t && e) {
10132                if ("function" != typeof t) return !1;
10133                if ("function" != typeof e) return !1;
10134                if (t === e) return !0;
10135                for (;;) {
10136                  if (!(t = Ft(t))) return !1;
10137                  if (t === e) return !0;
10138                }
10139              }
10140              return !1;
10141            }
10142            function kt(t) {
10143              for (const e of Object.keys(t)) delete t[e];
10144            }
10145            const Ut = vt(!0);
10146            const Gt = vt(!0);
10147            function zt(t, e, i) {
10148              return function(s, n) {
10149                n.prototype.hasOwnProperty(t) && delete e[n.prototype[t]];
10150                bt(n.prototype, t, s);
10151                if (s) {
10152                  const r = e[s];
10153                  if (!i && r && r !== n) {
10154                    x(`A Class already exists with the same ${t} : "${s}".`);
10155                  } else e[s] = n;
10156                }
10157              };
10158            }
10159            const Ht = zt("__cid__", Ut, !1);
10160            const jt = zt("__classname__", Gt, !0);
10161            function Xt(t, e) {
10162              jt(t, e);
10163              if (!e.prototype.hasOwnProperty(mt)) {
10164                const i = t || _t.getNewId();
10165                i && Ht(i, e);
10166              }
10167            }
10168            function Wt(t, e) {
10169              const i = Gt[e];
10170              const s = Ut[e];
10171              let n = !0;
10172              if (i && i !== t) {
10173                x(`"${e}" has already been set as name or alias of another class.`);
10174                n = !1;
10175              }
10176              if (s && s !== t) {
10177                x(`"${e}" has already been set as id or alias of another class.`);
10178                n = !1;
10179              }
10180              if (n) {
10181                let i = t[dt];
10182                if (!i) {
10183                  i = [];
10184                  t[dt] = i;
10185                }
10186                i.push(e);
10187                Gt[e] = t;
10188                Ut[e] = t;
10189              }
10190            }
10191            function Yt(...t) {
10192              for (const e of t) {
10193                const t = e.prototype;
10194                const i = t.__cid__;
10195                i && delete Ut[i];
10196                const s = t.__classname__;
10197                s && delete Gt[s];
10198                const n = t[dt];
10199                if (n) for (let t = 0; t < n.length; ++t) {
10200                  const e = n[t];
10201                  delete Gt[e];
10202                  delete Ut[e];
10203                }
10204              }
10205            }
10206            function qt(t) {
10207              return Kt(t);
10208            }
10209            function Kt(t) {
10210              return Ut[t];
10211            }
10212            function Jt(t) {
10213              return Gt[t];
10214            }
10215            function Zt(t, e) {
10216              return Qt(t, e);
10217            }
10218            function Qt(t, e) {
10219              e = void 0 === e || e;
10220              let i;
10221              if ("function" == typeof t && t.prototype.hasOwnProperty(mt)) {
10222                i = t.prototype.__cid__;
10223                0;
10224                return i;
10225              }
10226              if (t && t.constructor) {
10227                const e = t.constructor.prototype;
10228                if (e && e.hasOwnProperty(mt)) {
10229                  i = t.__cid__;
10230                  0;
10231                  return i;
10232                }
10233              }
10234              return "";
10235            }
10236            class $t {
10237              get() {
10238                return this._get();
10239              }
10240              constructor(t, e) {
10241                this.count = void 0;
10242                this._pool = void 0;
10243                this._cleanup = void 0;
10244                const i = void 0 === e ? t : e;
10245                const s = void 0 === e ? null : t;
10246                this.count = 0;
10247                this._pool = new Array(i);
10248                this._cleanup = s;
10249              }
10250              _get() {
10251                if (this.count > 0) {
10252                  --this.count;
10253                  const t = this._pool[this.count];
10254                  this._pool[this.count] = null;
10255                  return t;
10256                }
10257                return null;
10258              }
10259              put(t) {
10260                const e = this._pool;
10261                if (this.count < e.length) {
10262                  if (this._cleanup && !1 === this._cleanup(t)) return;
10263                  e[this.count] = t;
10264                  ++this.count;
10265                }
10266              }
10267              resize(t) {
10268                if (t >= 0) {
10269                  this._pool.length = t;
10270                  this.count > t && (this.count = t);
10271                }
10272              }
10273            }
10274            const te = ct;
10275            const ee = {
10276              IDGenerator: ut,
10277              Pool: $t,
10278              array: ct,
10279              isNumber: ft,
10280              isString: gt,
10281              isEmptyObject: yt,
10282              getPropertyDescriptor: Bt,
10283              addon: Ot,
10284              mixin: Nt,
10285              extend: Lt,
10286              getSuper: Ft,
10287              isChildClassOf: Vt,
10288              clear: kt,
10289              value: bt,
10290              getset: St,
10291              get: At,
10292              set: Tt,
10293              unregisterClass: Yt,
10294              getClassName: Et,
10295              setClassName: Xt,
10296              setClassAlias: Wt,
10297              getClassByName: Jt,
10298              getClassById: Kt,
10299              get _registeredClassNames() {
10300                return {
10301                  ...Gt
10302                };
10303              },
10304              set _registeredClassNames(t) {
10305                kt(Gt);
10306                Object.assign(Gt, t);
10307              },
10308              get _registeredClassIds() {
10309                return {
10310                  ...Ut
10311                };
10312              },
10313              set _registeredClassIds(t) {
10314                kt(Ut);
10315                Object.assign(Ut, t);
10316              },
10317              _getClassId: Zt,
10318              getClassId: Qt,
10319              _setClassId: Ht,
10320              _getClassById: qt,
10321              obsolete: Ct,
10322              obsoletes: xt,
10323              formatStr: It,
10324              shiftArguments: Mt,
10325              createMap: vt
10326            };
10327            m.js = ee;
10328            t("js", Object.freeze({
10329              __proto__: null,
10330              array: te,
10331              js: ee,
10332              IDGenerator: ut,
10333              Pool: $t,
10334              isNumber: ft,
10335              isString: gt,
10336              isEmptyObject: yt,
10337              value: bt,
10338              getset: St,
10339              get: At,
10340              set: Tt,
10341              createMap: vt,
10342              getClassName: Et,
10343              obsolete: Ct,
10344              obsoletes: xt,
10345              formatStr: It,
10346              shiftArguments: Mt,
10347              getPropertyDescriptor: Bt,
10348              copyAllProperties: Pt,
10349              addon: Ot,
10350              mixin: Nt,
10351              extend: Lt,
10352              getSuper: Ft,
10353              isChildClassOf: Vt,
10354              clear: kt,
10355              _idToClass: Ut,
10356              _nameToClass: Gt,
10357              _setClassId: Ht,
10358              setClassName: Xt,
10359              setClassAlias: Wt,
10360              unregisterClass: Yt,
10361              _getClassById: qt,
10362              getClassById: Kt,
10363              getClassByName: Jt,
10364              _getClassId: Zt,
10365              getClassId: Qt
10366            }));
10367            function ie(t) {
10368              if ("__bitmask__" in t) return t;
10369              bt(t, "__bitmask__", null, !0);
10370              let e = -1;
10371              const i = Object.keys(t);
10372              for (let s = 0; s < i.length; s++) {
10373                const n = i[s];
10374                let r = t[n];
10375                if (-1 === r) {
10376                  r = ++e;
10377                  t[n] = r;
10378                } else if ("number" == typeof r) e = r; else if ("string" == typeof r && Number.isInteger(parseFloat(n))) continue;
10379                const o = `${r}`;
10380                n !== o && bt(t, o, n);
10381              }
10382              return t;
10383            }
10384            ie.isBitMask = t => t && t.hasOwnProperty("__bitmask__");
10385            ie.getList = t => {
10386              if (t.__bitmask__) return t.__bitmask__;
10387              const e = t.__bitmask__ = [];
10388              for (const i in t) {
10389                const s = t[i];
10390                Number.isInteger(s) && e.push({
10391                  name: i,
10392                  value: s
10393                });
10394              }
10395              e.sort(((t, e) => t.value - e.value));
10396              return e;
10397            };
10398            m.BitMask = ie;
10399            function se(t, e) {
10400              ne(!(null == t), e);
10401            }
10402            function ne(t, e) {
10403              if (!t) throw new Error(`Assertion failed: ${null != e ? e : "<no-message>"}`);
10404            }
10405            function re(t, e) {
10406              ne(e >= 0 && e < t.length, `Array index ${e} out of bounds: [0, ${t.length})`);
10407            }
10408            function oe(t) {
10409              if ("__enums__" in t) return t;
10410              bt(t, "__enums__", null, !0);
10411              return oe.update(t);
10412            }
10413            oe.update = t => {
10414              let e = -1;
10415              const i = Object.keys(t);
10416              for (let s = 0; s < i.length; s++) {
10417                const n = i[s];
10418                let r = t[n];
10419                if (-1 === r) {
10420                  r = ++e;
10421                  t[n] = r;
10422                } else if ("number" == typeof r) e = r; else if ("string" == typeof r && Number.isInteger(parseFloat(n))) continue;
10423                const o = `${r}`;
10424                n !== o && bt(t, o, n);
10425              }
10426              Array.isArray(t.__enums__) && le(t);
10427              return t;
10428            };
10429            oe || (oe = t("Enum", {}));
10430            oe.isEnum = t => t && t.hasOwnProperty("__enums__");
10431            function ae(t) {
10432              ne(t.hasOwnProperty("__enums__"));
10433            }
10434            oe.getList = t => {
10435              ae(t);
10436              return t.__enums__ ? t.__enums__ : le(t);
10437            };
10438            function le(t) {
10439              ae(t);
10440              const e = t.__enums__ || [];
10441              e.length = 0;
10442              for (const i in t) {
10443                const s = t[i];
10444                Number.isInteger(s) && e.push({
10445                  name: i,
10446                  value: s
10447                });
10448              }
10449              e.sort(((t, e) => t.value - e.value));
10450              t.__enums__ = e;
10451              return e;
10452            }
10453            function he(t) {
10454              "__enums__" in t || bt(t, "__enums__", null, !0);
10455            }
10456            m.Enum = oe;
10457            class ce {
10458              clone() {
10459                F(100, `${Et(this)}.clone`);
10460                return this;
10461              }
10462              equals(t) {
10463                return !1;
10464              }
10465              set(t) {
10466                F(100, `${Et(this)}.set`);
10467              }
10468              toString() {
10469                return "";
10470              }
10471            }
10472            t("ValueType", ce);
10473            Xt("cc.ValueType", ce);
10474            m.ValueType = ce;
10475            var ue;
10476            !function(t) {
10477              t.PATH = "path";
10478              t.ENGINE = "engine";
10479              t.ASSETS = "assets";
10480              t.SCRIPTING = "scripting";
10481              t.PHYSICS = "physics";
10482              t.RENDERING = "rendering";
10483              t.LAUNCH = "launch";
10484              t.SCREEN = "screen";
10485              t.SPLASH_SCREEN = "splashScreen";
10486              t.ANIMATION = "animation";
10487              t.PROFILING = "profiling";
10488              t.PLUGINS = "plugins";
10489            }(ue || (ue = {}));
10490            class _e {
10491              constructor() {
10492                this._settings = {};
10493                this._override = {};
10494              }
10495              init(t = "", e = {}) {
10496                for (const t in e) {
10497                  const i = e[t];
10498                  if (i) for (const e in i) this.overrideSettings(t, e, i[e]);
10499                }
10500                if (!t) return Promise.resolve();
10501                if (window.oh) {
10502                  this._settings = i(266);
10503                  return Promise.resolve();
10504                }
10505                return new Promise(((e, i) => {
10506                  if (t.startsWith("http")) {
10507                    const s = new XMLHttpRequest;
10508                    s.open("GET", t);
10509                    s.responseType = "text";
10510                    s.onload = () => {
10511                      this._settings = JSON.parse(s.response);
10512                      e();
10513                    };
10514                    s.onerror = () => {
10515                      i(new Error("request settings failed!"));
10516                    };
10517                    s.send(null);
10518                  } else {
10519                    const s = fsUtils.readJsonSync(t);
10520                    if (s instanceof Error) i(s); else {
10521                      this._settings = s;
10522                      e();
10523                    }
10524                  }
10525                }));
10526              }
10527              overrideSettings(t, e, i) {
10528                t in this._override || (this._override[t] = {});
10529                this._override[t][e] = i;
10530              }
10531              querySettings(t, e) {
10532                if (t in this._override) {
10533                  const i = this._override[t];
10534                  if (i && e in i) return i[e];
10535                }
10536                if (t in this._settings) {
10537                  const i = this._settings[t];
10538                  if (i && e in i) return i[e];
10539                }
10540                return null;
10541              }
10542            }
10543            t("Settings", _e);
10544            _e.Category = ue;
10545            const de = t("settings", new _e);
10546            m.settings = de;
10547            const pe = t("macro", {
10548              SUPPORT_TEXTURE_FORMATS: [ ".astc", ".pkm", ".pvr", ".webp", ".jpg", ".jpeg", ".bmp", ".png" ],
10549              KEY: {
10550                none: 0,
10551                back: 6,
10552                menu: 18,
10553                backspace: 8,
10554                tab: 9,
10555                enter: 13,
10556                shift: 16,
10557                ctrl: 17,
10558                alt: 18,
10559                pause: 19,
10560                capslock: 20,
10561                escape: 27,
10562                space: 32,
10563                pageup: 33,
10564                pagedown: 34,
10565                end: 35,
10566                home: 36,
10567                left: 37,
10568                up: 38,
10569                right: 39,
10570                down: 40,
10571                select: 41,
10572                insert: 45,
10573                Delete: 46,
10574                0: 48,
10575                1: 49,
10576                2: 50,
10577                3: 51,
10578                4: 52,
10579                5: 53,
10580                6: 54,
10581                7: 55,
10582                8: 56,
10583                9: 57,
10584                a: 65,
10585                b: 66,
10586                c: 67,
10587                d: 68,
10588                e: 69,
10589                f: 70,
10590                g: 71,
10591                h: 72,
10592                i: 73,
10593                j: 74,
10594                k: 75,
10595                l: 76,
10596                m: 77,
10597                n: 78,
10598                o: 79,
10599                p: 80,
10600                q: 81,
10601                r: 82,
10602                s: 83,
10603                t: 84,
10604                u: 85,
10605                v: 86,
10606                w: 87,
10607                x: 88,
10608                y: 89,
10609                z: 90,
10610                num0: 96,
10611                num1: 97,
10612                num2: 98,
10613                num3: 99,
10614                num4: 100,
10615                num5: 101,
10616                num6: 102,
10617                num7: 103,
10618                num8: 104,
10619                num9: 105,
10620                "*": 106,
10621                "+": 107,
10622                "-": 109,
10623                numdel: 110,
10624                "/": 111,
10625                f1: 112,
10626                f2: 113,
10627                f3: 114,
10628                f4: 115,
10629                f5: 116,
10630                f6: 117,
10631                f7: 118,
10632                f8: 119,
10633                f9: 120,
10634                f10: 121,
10635                f11: 122,
10636                f12: 123,
10637                numlock: 144,
10638                scrolllock: 145,
10639                ";": 186,
10640                semicolon: 186,
10641                equal: 187,
10642                "=": 187,
10643                ",": 188,
10644                comma: 188,
10645                dash: 189,
10646                ".": 190,
10647                period: 190,
10648                forwardslash: 191,
10649                grave: 192,
10650                "[": 219,
10651                openbracket: 219,
10652                backslash: 220,
10653                "]": 221,
10654                closebracket: 221,
10655                quote: 222,
10656                dpadLeft: 1e3,
10657                dpadRight: 1001,
10658                dpadUp: 1003,
10659                dpadDown: 1004,
10660                dpadCenter: 1005
10661              },
10662              RAD: Math.PI / 180,
10663              DEG: 180 / Math.PI,
10664              REPEAT_FOREVER: Number.MAX_VALUE - 1,
10665              FLT_EPSILON: 1.192092896e-7,
10666              ORIENTATION_PORTRAIT: 1,
10667              ORIENTATION_LANDSCAPE: 2,
10668              ORIENTATION_AUTO: 3,
10669              ENABLE_TILEDMAP_CULLING: !0,
10670              TOUCH_TIMEOUT: 5e3,
10671              ENABLE_TRANSPARENT_CANVAS: !1,
10672              ENABLE_WEBGL_ANTIALIAS: !0,
10673              ENABLE_ANTIALIAS_FXAA: !1,
10674              ENABLE_BLOOM: !1,
10675              CLEANUP_IMAGE_CACHE: !1,
10676              ENABLE_MULTI_TOUCH: !0,
10677              MAX_LABEL_CANVAS_POOL_SIZE: 20,
10678              ENABLE_WEBGL_HIGHP_STRUCT_VALUES: !1,
10679              BATCHER2D_MEM_INCREMENT: 144,
10680              CUSTOM_PIPELINE_NAME: "",
10681              init() {
10682                this.CLEANUP_IMAGE_CACHE = !0;
10683                const t = de.querySettings(_e.Category.ENGINE, "macros");
10684                if (t) for (const e in t) pe[e] = t[e];
10685              }
10686            });
10687            m.macro = pe;
10688            const me = /^(?:cc|dragonBones|sp|ccsg)\..+/;
10689            const fe = new Array(123);
10690            for (let t = 0; t < 123; ++t) fe[t] = 64;
10691            for (let t = 0; t < 64; ++t) fe["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(t)] = t;
10692            const ge = fe;
10693            function ye(t, e, i) {
10694              function s(t, e, i, s) {
10695                const n = Object.getOwnPropertyDescriptor(t, e);
10696                if (n) {
10697                  n.get && (t[i] = n.get);
10698                  n.set && s && (t[s] = n.set);
10699                } else {
10700                  const n = t[i];
10701                  St(t, e, n, t[s]);
10702                }
10703              }
10704              let n;
10705              const r = t.prototype;
10706              for (let t = 0; t < e.length; t++) {
10707                n = e[t];
10708                const i = n[0].toUpperCase() + n.slice(1);
10709                s(r, n, `get${i}`, `set${i}`);
10710              }
10711              for (n in i) {
10712                const t = i[n];
10713                s(r, n, t[0], t[1]);
10714              }
10715            }
10716            function be(t, e, i, s) {
10717              const n = t[e];
10718              if (n) if (Array.isArray(n)) if (s) {
10719                n.push(n[0]);
10720                n[0] = i;
10721              } else n.push(i); else t[e] = s ? [ i, n ] : [ n, i ]; else t[e] = i;
10722            }
10723            function Se(t, e) {
10724              if ("function" == typeof t.contains) return t.contains(e);
10725              if ("function" == typeof t.compareDocumentPosition) return !!(16 & t.compareDocumentPosition(e));
10726              {
10727                let i = e.parentNode;
10728                if (i) do {
10729                  if (i === t) return !0;
10730                  i = i.parentNode;
10731                } while (null !== i);
10732                return !1;
10733              }
10734            }
10735            function Ae(t) {
10736              return "object" == typeof window && "function" == typeof Node ? t instanceof Node : !!t && "object" == typeof t && "number" == typeof t.nodeType && "string" == typeof t.nodeName;
10737            }
10738            function Te(t, e, i) {
10739              t && setTimeout((() => {
10740                t(e, i);
10741              }), 0);
10742            }
10743            function ve(t) {
10744              return !(!t || t.constructor !== Object) && yt(t);
10745            }
10746            function Ee(t, e, i) {
10747              if (e > i) {
10748                const t = e;
10749                e = i;
10750                i = t;
10751              }
10752              return t < e ? e : t < i ? t : i;
10753            }
10754            function Ce(t) {
10755              return t * pe.RAD;
10756            }
10757            function xe(t) {
10758              return t * pe.DEG;
10759            }
10760            m.misc = {
10761              BUILTIN_CLASSID_RE: me,
10762              BASE64_VALUES: ge,
10763              propertyDefine: ye,
10764              pushToMap: be,
10765              contains: Se,
10766              isDomNode: Ae,
10767              callInNextTick: Te,
10768              isPlainEmptyObj_DEV: ve,
10769              clampf: Ee,
10770              degreesToRadians: Ce,
10771              radiansToDegrees: xe
10772            };
10773            t("misc", Object.freeze({
10774              __proto__: null,
10775              BUILTIN_CLASSID_RE: me,
10776              BASE64_VALUES: ge,
10777              propertyDefine: ye,
10778              pushToMap: be,
10779              contains: Se,
10780              isDomNode: Ae,
10781              callInNextTick: Te,
10782              tryCatchFunctor_EDITOR: function(t) {
10783                return Function("target", `try {\n  target.${t}();\n}\ncatch (e) {\n  cc._throw(e);\n}`);
10784              },
10785              isPlainEmptyObj_DEV: ve,
10786              clampf: Ee,
10787              degreesToRadians: Ce,
10788              radiansToDegrees: xe
10789            }));
10790            const we = "$_$";
10791            function Re(t, e) {
10792              const i = e ? Object.create(e) : {};
10793              bt(t, "__attrs__", i);
10794              return i;
10795            }
10796            function Ie(t) {
10797              if ("function" != typeof t) {
10798                return Re(t, Be(t.constructor));
10799              }
10800              let e;
10801              const i = m.Class.getInheritanceChain(t);
10802              for (let t = i.length - 1; t >= 0; t--) {
10803                const s = i[t];
10804                if (!(s.hasOwnProperty("__attrs__") && s.__attrs__)) {
10805                  e = i[t + 1];
10806                  Re(s, e && e.__attrs__);
10807                }
10808              }
10809              e = i[0];
10810              Re(t, e && e.__attrs__);
10811              return t.__attrs__;
10812            }
10813            function Me(t, e) {
10814              const i = Be(t);
10815              const s = e + we;
10816              const n = {};
10817              for (const t in i) t.startsWith(s) && (n[t.slice(s.length)] = i[t]);
10818              return n;
10819            }
10820            function Be(t) {
10821              return t.hasOwnProperty("__attrs__") && t.__attrs__ || Ie(t);
10822            }
10823            function De(t, e, i, s) {
10824              Be(t)[e + we + i] = s;
10825            }
10826            class Pe {
10827              constructor(t, e) {
10828                this.name = void 0;
10829                this.default = void 0;
10830                this.name = t;
10831                this.default = e;
10832              }
10833              toString() {
10834                return this.name;
10835              }
10836            }
10837            const Oe = t("CCInteger", new Pe("Integer", 0));
10838            m.Integer = Oe;
10839            m.CCInteger = Oe;
10840            const Ne = t("CCFloat", new Pe("Float", 0));
10841            m.Float = Ne;
10842            m.CCFloat = Ne;
10843            const Le = t("CCBoolean", new Pe("Boolean", !1));
10844            m.Boolean = Le;
10845            m.CCBoolean = Le;
10846            const Fe = t("CCString", new Pe("String", ""));
10847            m.String = Fe;
10848            m.CCString = Fe;
10849            function Ve(t, e) {
10850              return function(i, s) {
10851                const n = `"${Et(i)}.${s}"`;
10852                const r = Me(i, s);
10853                let o = r.type;
10854                o === Oe || o === Ne ? o = "Number" : o !== Fe && o !== Le || (o = `${o}`);
10855                if (o !== t) {
10856                  N(3604, n);
10857                  return;
10858                }
10859                if (!r.hasOwnProperty("default")) return;
10860                const a = r.default;
10861                if (void 0 === a) return;
10862                if (Array.isArray(a) || ve(a)) return;
10863                const l = typeof a;
10864                const h = t.toLowerCase();
10865                if (l === h) if ("object" === h) {
10866                  if (!a || a instanceof r.ctor) return;
10867                  N(3605, n, Et(r.ctor));
10868                } else "Number" !== t && N(3606, e, n, t); else {
10869                  if ("function" === l) return;
10870                  t === Fe.default && null == a ? N(3607, n) : N(3611, e, n, l);
10871                }
10872                delete r.type;
10873              };
10874            }
10875            var ke = Object.freeze({
10876              __proto__: null,
10877              DELIMETER: we,
10878              createAttrsSingle: Re,
10879              createAttrs: Ie,
10880              attr: Me,
10881              getClassAttrs: Be,
10882              setClassAttr: De,
10883              PrimitiveType: Pe,
10884              CCInteger: Oe,
10885              CCFloat: Ne,
10886              CCBoolean: Le,
10887              CCString: Fe,
10888              getTypeChecker_ET: Ve,
10889              getObjTypeChecker_ET: function(t) {
10890                return function(e, i) {
10891                  Ve("Object", "type")(e, i);
10892                  const s = Be(e)[`${i + we}default`];
10893                  const n = m.Class.getDefault(s);
10894                  if (!Array.isArray(n) && Vt(t, m.ValueType)) {
10895                    const n = Et(t);
10896                    const r = It('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.', Et(e), i, n);
10897                    s ? E(r) : N(3612, r, n, Et(e), i, n);
10898                  }
10899                };
10900              }
10901            });
10902            const Ue = {
10903              default: {},
10904              serializable: {},
10905              editorOnly: {},
10906              formerlySerializedAs: {}
10907            };
10908            function Ge(t, e, i, s) {
10909              if (!t.get && !t.set && t.hasOwnProperty("default")) {
10910                const n = `_N$${e}`;
10911                t.get = function() {
10912                  return this[n];
10913                };
10914                t.set = function(t) {
10915                  const e = this[n];
10916                  this[n] = t;
10917                  i.call(this, e);
10918                };
10919                const r = {};
10920                s[n] = r;
10921                for (const e in Ue) {
10922                  const i = Ue[e];
10923                  if (t.hasOwnProperty(e)) {
10924                    r[e] = t[e];
10925                    i.canUsedInGet || delete t[e];
10926                  }
10927                }
10928              }
10929            }
10930            function ze(t, e, i, s) {
10931              if (Array.isArray(e)) {
10932                if (!(e.length > 0)) return F(5508, i, s);
10933                t.type = e = e[0];
10934              }
10935              "function" == typeof e && (e === String ? t.type = m.String : e === Boolean ? t.type = m.Boolean : e === Number && (t.type = m.Float));
10936            }
10937            function He(t, e, i) {
10938              const s = t ? {
10939                _short: !0
10940              } : {
10941                _short: !0,
10942                default: e
10943              };
10944              i && (s.type = i);
10945              return s;
10946            }
10947            function je(t, e) {
10948              if (!(t && t.constructor === Object)) {
10949                if (Array.isArray(t) && t.length > 0) return He(e, [], t);
10950                if ("function" == typeof t) {
10951                  const i = t;
10952                  return He(e, Vt(i, m.ValueType) ? new i : null, i);
10953                }
10954                return He(e, t instanceof Pe ? t.default : t);
10955              }
10956              return null;
10957            }
10958            let Xe = [];
10959            function We() {
10960              return Xe[Xe.length - 1];
10961            }
10962            m._RF = {
10963              push: function(t, e, i, s) {
10964                if (void 0 === i) {
10965                  i = e;
10966                  e = "";
10967                }
10968                Xe.push({
10969                  uuid: e,
10970                  script: i,
10971                  module: t,
10972                  exports: t.exports,
10973                  beh: null,
10974                  importMeta: s
10975                });
10976              },
10977              pop: function() {
10978                const t = Xe.pop();
10979                const e = t.module;
10980                let i = e.exports;
10981                if (i === t.exports) {
10982                  for (const t in i) return;
10983                  e.exports = i = t.cls;
10984                }
10985              },
10986              peek: We
10987            };
10988            let Ye;
10989            !function(t) {
10990              t[t.STANDALONE = 1] = "STANDALONE";
10991              t[t.IMPLICIT_VISIBLE = 2] = "IMPLICIT_VISIBLE";
10992              t[t.IMPLICIT_SERIALIZABLE = 4] = "IMPLICIT_SERIALIZABLE";
10993            }(Ye || (Ye = {}));
10994            const qe = we;
10995            const Ke = "__ctors__";
10996            const Je = "Enum";
10997            const Ze = "BitMask";
10998            function Qe(t, e, i, s) {
10999              !function(t, e) {
11000                !function(t, e) {
11001                  t.indexOf(e) < 0 && t.push(e);
11002                }(t.__props__, e);
11003              }(t, i);
11004              oi(t, s, e, i);
11005            }
11006            function $e(t, e, i, s) {
11007              const n = s.get;
11008              s.set;
11009              if (n) {
11010                oi(t, s, e, i);
11011                De(t, i, "serializable", !1);
11012              }
11013            }
11014            function ti(t) {
11015              return "function" == typeof t ? t() : t;
11016            }
11017            function ei(t, e, i) {
11018              const s = m.Component;
11019              const n = We();
11020              if (n && Vt(e, s)) {
11021                if (Vt(n.cls, s)) {
11022                  F(3615);
11023                  return null;
11024                }
11025                t = t || n.script;
11026              }
11027              const r = function(t, e, i) {
11028                const s = i.ctor;
11029                bt(s, Ke, !0, !0);
11030                s.prototype;
11031                e && (s.$super = e);
11032                Xt(t, s);
11033                return s;
11034              }(t, e, i);
11035              if (n) if (Vt(e, s)) {
11036                const t = n.uuid;
11037                t && Ht(t, r);
11038                n.cls = r;
11039              } else Vt(n.cls, s) || (n.cls = r);
11040              return r;
11041            }
11042            function ii(t, e, i, s) {
11043              t.__props__ = [];
11044              s && s.__props__ && (t.__props__ = s.__props__.slice());
11045              if (i) {
11046                !function(t, e, i) {
11047                  for (const i in t) {
11048                    let s = t[i];
11049                    const n = je(s, !1);
11050                    n && (s = t[i] = n);
11051                    if (s) {
11052                      const n = s.notify;
11053                      n && Ge(s, i, n, t);
11054                      "type" in s && ze(s, s.type, e, i);
11055                    }
11056                  }
11057                }(i, e);
11058                for (const s in i) {
11059                  const n = i[s];
11060                  n.get || n.set ? $e(t, e, s, n) : Qe(t, e, s, n);
11061                }
11062              }
11063              const n = Be(t);
11064              t.__values__ = t.__props__.filter((t => !1 !== n[`${t + qe}serializable`]));
11065            }
11066            function si(t) {
11067              let e = t.name;
11068              const i = t.extends;
11069              const s = ei(e, i, t);
11070              e || (e = m.js.getClassName(s));
11071              s._sealed = !0;
11072              i && (i._sealed = !1);
11073              ii(s, e, t.properties, i);
11074              const n = t.editor;
11075              n && Vt(i, m.Component) && m.Component._registerEditorProps(s, n);
11076              return s;
11077            }
11078            si._isCCClass = function(t) {
11079              var e;
11080              return null == t || null === (e = t.hasOwnProperty) || void 0 === e ? void 0 : e.call(t, Ke);
11081            };
11082            si.fastDefine = function(t, e, i) {
11083              Xt(t, e);
11084              const s = e.__props__ = e.__values__ = Object.keys(i);
11085              const n = Be(e);
11086              for (let t = 0; t < s.length; t++) {
11087                const e = s[t];
11088                n[`${e + qe}visible`] = !1;
11089                n[`${e + qe}default`] = i[e];
11090              }
11091            };
11092            si.Attr = ke;
11093            si.attr = Me;
11094            function ni(t) {
11095              var e;
11096              return null == t || null === (e = t.hasOwnProperty) || void 0 === e ? void 0 : e.call(t, "__values__");
11097            }
11098            si.isCCClassOrFastDefined = ni;
11099            si.getInheritanceChain = function(t) {
11100              const e = [];
11101              for (;t = Ft(t); ) t !== Object && e.push(t);
11102              return e;
11103            };
11104            const ri = {
11105              Integer: "Number",
11106              Float: "Number",
11107              Boolean: "Boolean",
11108              String: "String"
11109            };
11110            function oi(t, e, i, s, n) {
11111              let r = null;
11112              let o = "";
11113              function a() {
11114                o = s + qe;
11115                return r = Be(t);
11116              }
11117              "type" in e && void 0 === e.type && N(3660, s, i);
11118              const l = e.type;
11119              if (l) {
11120                if (ri[l]) (r || a())[`${o}type`] = l; else if ("Object" === l) ; else if ("object" == typeof l) {
11121                  if (oe.isEnum(l)) {
11122                    (r || a())[`${o}type`] = Je;
11123                    r[`${o}enumList`] = oe.getList(l);
11124                  } else if (ie.isBitMask(l)) {
11125                    (r || a())[`${o}type`] = Ze;
11126                    r[`${o}bitmaskList`] = ie.getList(l);
11127                  }
11128                } else if ("function" == typeof l) {
11129                  (r || a())[`${o}type`] = "Object";
11130                  r[`${o}ctor`] = l;
11131                }
11132              }
11133              "default" in e && ((r || a())[`${o}default`] = e.default);
11134              const h = (t, i) => {
11135                if (t in e) {
11136                  const s = e[t];
11137                  typeof s === i && ((r || a())[o + t] = s);
11138                }
11139              };
11140              e.editorOnly && ((r || a())[`${o}editorOnly`] = !0);
11141              let c;
11142              e.__internalFlags & Ye.STANDALONE ? c = !0 === e.serializable || 0 != (e.__internalFlags & Ye.IMPLICIT_SERIALIZABLE) : !1 === e.serializable && (c = !1);
11143              void 0 !== c && ((r || a())[`${o}serializable`] = c);
11144              h("formerlySerializedAs", "string");
11145              const u = e.range;
11146              if (u && Array.isArray(u) && u.length >= 2) {
11147                (r || a())[`${o}min`] = u[0];
11148                r[`${o}max`] = u[1];
11149                u.length > 2 && (r[`${o}step`] = u[2]);
11150              }
11151              h("min", "number");
11152              h("max", "number");
11153              h("step", "number");
11154            }
11155            si.isArray = function(t) {
11156              t = ti(t);
11157              return Array.isArray(t);
11158            };
11159            si.getDefault = ti;
11160            si.escapeForJS = function(t) {
11161              return JSON.stringify(t).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
11162            };
11163            si.IDENTIFIER_RE = /^[A-Za-z_$][0-9A-Za-z_$]*$/;
11164            si.getNewValueTypeCode = !1;
11165            m.Class = si;
11166            const ai = Math.PI / 180;
11167            const li = 180 / Math.PI;
11168            const hi = t("EPSILON", 1e-6);
11169            function ci(t, e) {
11170              return Math.abs(t - e) <= hi * Math.max(1, Math.abs(t), Math.abs(e));
11171            }
11172            function ui(t, e, i) {
11173              i = i || hi;
11174              return Math.abs(t - e) <= i;
11175            }
11176            function _i(t, e, i) {
11177              if (e > i) {
11178                const t = e;
11179                e = i;
11180                i = t;
11181              }
11182              return t < e ? e : t > i ? i : t;
11183            }
11184            function di(t) {
11185              return t < 0 ? 0 : t > 1 ? 1 : t;
11186            }
11187            function pi(t, e, i) {
11188              return t + (e - t) * i;
11189            }
11190            function mi(t) {
11191              return t * ai;
11192            }
11193            function fi(t) {
11194              return t * li;
11195            }
11196            const gi = t("random", Math.random);
11197            function yi(t, e) {
11198              return Math.random() * (e - t) + t;
11199            }
11200            function bi(t, e) {
11201              return Math.floor(yi(t, e));
11202            }
11203            function Si(t) {
11204              return (t = (9301 * t + 49297) % 233280) / 233280;
11205            }
11206            function Ai(t, e, i) {
11207              return Si(t) * (i - e) + e;
11208            }
11209            function Ti(t, e, i) {
11210              return Math.floor(Ai(t, e, i));
11211            }
11212            function vi(t) {
11213              --t;
11214              t |= t >> 1;
11215              t |= t >> 2;
11216              t |= t >> 4;
11217              t |= t >> 8;
11218              t |= t >> 16;
11219              return ++t;
11220            }
11221            function Ei(t, e) {
11222              return t - Math.floor(t / e) * e;
11223            }
11224            function Ci(t, e) {
11225              t = Ei(t, 2 * e);
11226              return t = e - Math.abs(t - e);
11227            }
11228            function xi(t, e, i) {
11229              return (i - t) / (e - t);
11230            }
11231            function wi(t) {
11232              return Math.abs(t.x) > Math.abs(t.y) ? Math.abs(t.x) > Math.abs(t.z) ? t.x : t.z : Math.abs(t.y) > Math.abs(t.z) ? t.y : t.z;
11233            }
11234            function Ri(t, e) {
11235              return Math.abs(t) > Math.abs(e) ? t : e;
11236            }
11237            function Ii(t, e) {
11238              e.forEach((e => {
11239                Object.defineProperty(t, e, {
11240                  enumerable: !0
11241                });
11242              }));
11243            }
11244            const Mi = 1 / 255;
11245            class Bi extends ce {
11246              static clone(t) {
11247                const e = new Bi;
11248                t._val ? e._val = t._val : e._val = (t.a << 24 >>> 0) + (t.b << 16) + (t.g << 8) + t.r;
11249                return e;
11250              }
11251              static copy(t, e) {
11252                t.r = e.r;
11253                t.g = e.g;
11254                t.b = e.b;
11255                t.a = e.a;
11256                return t;
11257              }
11258              static set(t, e, i, s, n) {
11259                t.r = e;
11260                t.g = i;
11261                t.b = s;
11262                t.a = n;
11263                return t;
11264              }
11265              static fromHEX(t, e) {
11266                e = 0 === e.indexOf("#") ? e.substring(1) : e;
11267                t.r = parseInt(e.substr(0, 2), 16) || 0;
11268                t.g = parseInt(e.substr(2, 2), 16) || 0;
11269                t.b = parseInt(e.substr(4, 2), 16) || 0;
11270                const i = parseInt(e.substr(6, 2), 16);
11271                t.a = Number.isNaN(i) ? 255 : i;
11272                t._val = (t.a << 24 >>> 0) + (t.b << 16) + (t.g << 8) + t.r;
11273                return t;
11274              }
11275              static add(t, e, i) {
11276                t.r = e.r + i.r;
11277                t.g = e.g + i.g;
11278                t.b = e.b + i.b;
11279                t.a = e.a + i.a;
11280                return t;
11281              }
11282              static subtract(t, e, i) {
11283                t.r = e.r - i.r;
11284                t.g = e.g - i.g;
11285                t.b = e.b - i.b;
11286                t.a = e.a - i.a;
11287                return t;
11288              }
11289              static multiply(t, e, i) {
11290                t.r = e.r * i.r;
11291                t.g = e.g * i.g;
11292                t.b = e.b * i.b;
11293                t.a = e.a * i.a;
11294                return t;
11295              }
11296              static divide(t, e, i) {
11297                t.r = e.r / i.r;
11298                t.g = e.g / i.g;
11299                t.b = e.b / i.b;
11300                t.a = e.a / i.a;
11301                return t;
11302              }
11303              static scale(t, e, i) {
11304                t.r = e.r * i;
11305                t.g = e.g * i;
11306                t.b = e.b * i;
11307                t.a = e.a * i;
11308                return t;
11309              }
11310              static lerp(t, e, i, s) {
11311                let n = e.r;
11312                let r = e.g;
11313                let o = e.b;
11314                let a = e.a;
11315                n += (i.r - n) * s;
11316                r += (i.g - r) * s;
11317                o += (i.b - o) * s;
11318                a += (i.a - a) * s;
11319                t._val = Math.floor((a << 24 >>> 0) + (o << 16) + (r << 8) + n);
11320                return t;
11321              }
11322              static toArray(t, e, i = 0) {
11323                const s = e instanceof Bi || e.a > 1 ? 1 / 255 : 1;
11324                t[i + 0] = e.r * s;
11325                t[i + 1] = e.g * s;
11326                t[i + 2] = e.b * s;
11327                t[i + 3] = e.a * s;
11328                return t;
11329              }
11330              static fromArray(t, e, i = 0) {
11331                e.r = 255 * t[i + 0];
11332                e.g = 255 * t[i + 1];
11333                e.b = 255 * t[i + 2];
11334                e.a = 255 * t[i + 3];
11335                return e;
11336              }
11337              static strictEquals(t, e) {
11338                return t.r === e.r && t.g === e.g && t.b === e.b && t.a === e.a;
11339              }
11340              static equals(t, e, i = hi) {
11341                return Math.abs(t.r - e.r) <= i * Math.max(1, Math.abs(t.r), Math.abs(e.r)) && Math.abs(t.g - e.g) <= i * Math.max(1, Math.abs(t.g), Math.abs(e.g)) && Math.abs(t.b - e.b) <= i * Math.max(1, Math.abs(t.b), Math.abs(e.b)) && Math.abs(t.a - e.a) <= i * Math.max(1, Math.abs(t.a), Math.abs(e.a));
11342              }
11343              static hex(t) {
11344                return (255 * t.r << 24 | 255 * t.g << 16 | 255 * t.b << 8 | 255 * t.a) >>> 0;
11345              }
11346              get r() {
11347                return 255 & this._val;
11348              }
11349              set r(t) {
11350                t = ~~_i(t, 0, 255);
11351                this._val = (4294967040 & this._val | t) >>> 0;
11352              }
11353              get g() {
11354                return (65280 & this._val) >> 8;
11355              }
11356              set g(t) {
11357                t = ~~_i(t, 0, 255);
11358                this._val = (4294902015 & this._val | t << 8) >>> 0;
11359              }
11360              get b() {
11361                return (16711680 & this._val) >> 16;
11362              }
11363              set b(t) {
11364                t = ~~_i(t, 0, 255);
11365                this._val = (4278255615 & this._val | t << 16) >>> 0;
11366              }
11367              get a() {
11368                return (4278190080 & this._val) >>> 24;
11369              }
11370              set a(t) {
11371                t = ~~_i(t, 0, 255);
11372                this._val = (16777215 & this._val | t << 24) >>> 0;
11373              }
11374              get x() {
11375                return this.r * Mi;
11376              }
11377              set x(t) {
11378                this.r = 255 * t;
11379              }
11380              get y() {
11381                return this.g * Mi;
11382              }
11383              set y(t) {
11384                this.g = 255 * t;
11385              }
11386              get z() {
11387                return this.b * Mi;
11388              }
11389              set z(t) {
11390                this.b = 255 * t;
11391              }
11392              get w() {
11393                return this.a * Mi;
11394              }
11395              set w(t) {
11396                this.a = 255 * t;
11397              }
11398              constructor(t, e, i, s) {
11399                super();
11400                this._val = 0;
11401                "string" == typeof t ? this.fromHEX(t) : void 0 !== e ? this.set(t, e, i, s) : this.set(t);
11402              }
11403              clone() {
11404                const t = new Bi;
11405                t._val = this._val;
11406                return t;
11407              }
11408              equals(t) {
11409                return t && this._val === t._val;
11410              }
11411              lerp(t, e) {
11412                let i = this.r;
11413                let s = this.g;
11414                let n = this.b;
11415                let r = this.a;
11416                i += (t.r - i) * e;
11417                s += (t.g - s) * e;
11418                n += (t.b - n) * e;
11419                r += (t.a - r) * e;
11420                this._val = Math.floor((r << 24 >>> 0) + (n << 16) + (s << 8) + i);
11421                return this;
11422              }
11423              toString() {
11424                return `rgba(${this.r.toFixed()}, ${this.g.toFixed()}, ${this.b.toFixed()}, ${this.a.toFixed()})`;
11425              }
11426              toCSS(t = "rgba") {
11427                return "rgba" === t ? `rgba(${this.r},${this.g},${this.b},${(this.a * Mi).toFixed(2)})` : "rgb" === t ? `rgb(${this.r},${this.g},${this.b})` : `#${this.toHEX(t)}`;
11428              }
11429              fromHEX(t) {
11430                t = 0 === t.indexOf("#") ? t.substring(1) : t;
11431                const e = parseInt(t.substr(0, 2), 16) || 0;
11432                const i = parseInt(t.substr(2, 2), 16) || 0;
11433                const s = parseInt(t.substr(4, 2), 16) || 0;
11434                let n = parseInt(t.substr(6, 2), 16);
11435                n = Number.isNaN(n) ? 255 : n;
11436                this._val = (n << 24 >>> 0) + (s << 16) + (i << 8) + (0 | e);
11437                return this;
11438              }
11439              toHEX(t = "#rrggbb") {
11440                const e = "0";
11441                const i = [ (this.r < 16 ? e : "") + this.r.toString(16), (this.g < 16 ? e : "") + this.g.toString(16), (this.b < 16 ? e : "") + this.b.toString(16) ];
11442                if ("#rgb" === t) {
11443                  i[0] = i[0][0];
11444                  i[1] = i[1][0];
11445                  i[2] = i[2][0];
11446                } else "#rrggbbaa" === t && i.push((this.a < 16 ? e : "") + this.a.toString(16));
11447                return i.join("");
11448              }
11449              toRGBValue() {
11450                return 16777215 & this._val;
11451              }
11452              fromHSV(t, e, i) {
11453                let s = 0;
11454                let n = 0;
11455                let r = 0;
11456                if (0 === e) s = n = r = i; else if (0 === i) s = n = r = 0; else {
11457                  1 === t && (t = 0);
11458                  t *= 6;
11459                  const o = Math.floor(t);
11460                  const a = t - o;
11461                  const l = i * (1 - e);
11462                  const h = i * (1 - e * a);
11463                  const c = i * (1 - e * (1 - a));
11464                  switch (o) {
11465                   case 0:
11466                    s = i;
11467                    n = c;
11468                    r = l;
11469                    break;
11470
11471                   case 1:
11472                    s = h;
11473                    n = i;
11474                    r = l;
11475                    break;
11476
11477                   case 2:
11478                    s = l;
11479                    n = i;
11480                    r = c;
11481                    break;
11482
11483                   case 3:
11484                    s = l;
11485                    n = h;
11486                    r = i;
11487                    break;
11488
11489                   case 4:
11490                    s = c;
11491                    n = l;
11492                    r = i;
11493                    break;
11494
11495                   case 5:
11496                    s = i;
11497                    n = l;
11498                    r = h;
11499                  }
11500                }
11501                s *= 255;
11502                n *= 255;
11503                r *= 255;
11504                this._val = (this.a << 24 >>> 0) + (r << 16) + (n << 8) + (0 | s);
11505                return this;
11506              }
11507              toHSV() {
11508                const t = this.r * Mi;
11509                const e = this.g * Mi;
11510                const i = this.b * Mi;
11511                const s = {
11512                  h: 0,
11513                  s: 0,
11514                  v: 0
11515                };
11516                const n = Math.max(t, e, i);
11517                const r = Math.min(t, e, i);
11518                let o = 0;
11519                s.v = n;
11520                s.s = n ? (n - r) / n : 0;
11521                if (s.s) {
11522                  o = n - r;
11523                  s.h = t === n ? (e - i) / o : e === n ? 2 + (i - t) / o : 4 + (t - e) / o;
11524                  s.h /= 6;
11525                  s.h < 0 && (s.h += 1);
11526                } else s.h = 0;
11527                return s;
11528              }
11529              set(t, e, i, s) {
11530                if ("object" == typeof t) if (null != t._val) this._val = t._val; else {
11531                  e = t.g || 0;
11532                  i = t.b || 0;
11533                  s = "number" == typeof t.a ? t.a : 255;
11534                  t = t.r || 0;
11535                  this._val = (s << 24 >>> 0) + (i << 16) + (e << 8) + (0 | t);
11536                } else {
11537                  t = t || 0;
11538                  e = e || 0;
11539                  i = i || 0;
11540                  s = "number" == typeof s ? s : 255;
11541                  this._val = (s << 24 >>> 0) + (i << 16) + (e << 8) + (0 | t);
11542                }
11543                return this;
11544              }
11545              multiply(t) {
11546                const e = (255 & this._val) * t.r >> 8;
11547                const i = (65280 & this._val) * t.g >> 8;
11548                const s = (16711680 & this._val) * t.b >> 8;
11549                const n = ((4278190080 & this._val) >>> 8) * t.a;
11550                this._val = 4278190080 & n | 16711680 & s | 65280 & i | 255 & e;
11551                return this;
11552              }
11553              _set_r_unsafe(t) {
11554                this._val = (4294967040 & this._val | t) >>> 0;
11555                return this;
11556              }
11557              _set_g_unsafe(t) {
11558                this._val = (4294902015 & this._val | t << 8) >>> 0;
11559                return this;
11560              }
11561              _set_b_unsafe(t) {
11562                this._val = (4278255615 & this._val | t << 16) >>> 0;
11563                return this;
11564              }
11565              _set_a_unsafe(t) {
11566                this._val = (16777215 & this._val | t << 24) >>> 0;
11567                return this;
11568              }
11569            }
11570            t("Color", Bi);
11571            Bi.WHITE = Object.freeze(new Bi(255, 255, 255, 255));
11572            Bi.GRAY = Object.freeze(new Bi(127, 127, 127, 255));
11573            Bi.BLACK = Object.freeze(new Bi(0, 0, 0, 255));
11574            Bi.TRANSPARENT = Object.freeze(new Bi(0, 0, 0, 0));
11575            Bi.RED = Object.freeze(new Bi(255, 0, 0, 255));
11576            Bi.GREEN = Object.freeze(new Bi(0, 255, 0, 255));
11577            Bi.BLUE = Object.freeze(new Bi(0, 0, 255, 255));
11578            Bi.CYAN = Object.freeze(new Bi(0, 255, 255, 255));
11579            Bi.MAGENTA = Object.freeze(new Bi(255, 0, 255, 255));
11580            Bi.YELLOW = Object.freeze(new Bi(255, 255, 0, 255));
11581            si.fastDefine("cc.Color", Bi, {
11582              r: 0,
11583              g: 0,
11584              b: 0,
11585              a: 255
11586            });
11587            m.Color = Bi;
11588            function Di(t, e, i, s) {
11589              return new Bi(t, e, i, s);
11590            }
11591            m.color = Di;
11592            class Pi extends ce {
11593              static zero(t) {
11594                t.x = 0;
11595                t.y = 0;
11596                t.z = 0;
11597                return t;
11598              }
11599              static clone(t) {
11600                return new Pi(t.x, t.y, t.z);
11601              }
11602              static copy(t, e) {
11603                t.x = e.x;
11604                t.y = e.y;
11605                t.z = e.z;
11606                return t;
11607              }
11608              static set(t, e, i, s) {
11609                t.x = e;
11610                t.y = i;
11611                t.z = s;
11612                return t;
11613              }
11614              static add(t, e, i) {
11615                t.x = e.x + i.x;
11616                t.y = e.y + i.y;
11617                t.z = e.z + i.z;
11618                return t;
11619              }
11620              static subtract(t, e, i) {
11621                t.x = e.x - i.x;
11622                t.y = e.y - i.y;
11623                t.z = e.z - i.z;
11624                return t;
11625              }
11626              static multiply(t, e, i) {
11627                t.x = e.x * i.x;
11628                t.y = e.y * i.y;
11629                t.z = e.z * i.z;
11630                return t;
11631              }
11632              static divide(t, e, i) {
11633                t.x = e.x / i.x;
11634                t.y = e.y / i.y;
11635                t.z = e.z / i.z;
11636                return t;
11637              }
11638              static ceil(t, e) {
11639                t.x = Math.ceil(e.x);
11640                t.y = Math.ceil(e.y);
11641                t.z = Math.ceil(e.z);
11642                return t;
11643              }
11644              static floor(t, e) {
11645                t.x = Math.floor(e.x);
11646                t.y = Math.floor(e.y);
11647                t.z = Math.floor(e.z);
11648                return t;
11649              }
11650              static min(t, e, i) {
11651                t.x = Math.min(e.x, i.x);
11652                t.y = Math.min(e.y, i.y);
11653                t.z = Math.min(e.z, i.z);
11654                return t;
11655              }
11656              static max(t, e, i) {
11657                t.x = Math.max(e.x, i.x);
11658                t.y = Math.max(e.y, i.y);
11659                t.z = Math.max(e.z, i.z);
11660                return t;
11661              }
11662              static round(t, e) {
11663                t.x = Math.round(e.x);
11664                t.y = Math.round(e.y);
11665                t.z = Math.round(e.z);
11666                return t;
11667              }
11668              static multiplyScalar(t, e, i) {
11669                t.x = e.x * i;
11670                t.y = e.y * i;
11671                t.z = e.z * i;
11672                return t;
11673              }
11674              static scaleAndAdd(t, e, i, s) {
11675                t.x = e.x + i.x * s;
11676                t.y = e.y + i.y * s;
11677                t.z = e.z + i.z * s;
11678                return t;
11679              }
11680              static distance(t, e) {
11681                const i = e.x - t.x;
11682                const s = e.y - t.y;
11683                const n = e.z - t.z;
11684                return Math.sqrt(i * i + s * s + n * n);
11685              }
11686              static squaredDistance(t, e) {
11687                const i = e.x - t.x;
11688                const s = e.y - t.y;
11689                const n = e.z - t.z;
11690                return i * i + s * s + n * n;
11691              }
11692              static len(t) {
11693                const e = t.x;
11694                const i = t.y;
11695                const s = t.z;
11696                return Math.sqrt(e * e + i * i + s * s);
11697              }
11698              static lengthSqr(t) {
11699                const e = t.x;
11700                const i = t.y;
11701                const s = t.z;
11702                return e * e + i * i + s * s;
11703              }
11704              static negate(t, e) {
11705                t.x = -e.x;
11706                t.y = -e.y;
11707                t.z = -e.z;
11708                return t;
11709              }
11710              static invert(t, e) {
11711                t.x = 1 / e.x;
11712                t.y = 1 / e.y;
11713                t.z = 1 / e.z;
11714                return t;
11715              }
11716              static invertSafe(t, e) {
11717                const i = e.x;
11718                const s = e.y;
11719                const n = e.z;
11720                Math.abs(i) < hi ? t.x = 0 : t.x = 1 / i;
11721                Math.abs(s) < hi ? t.y = 0 : t.y = 1 / s;
11722                Math.abs(n) < hi ? t.z = 0 : t.z = 1 / n;
11723                return t;
11724              }
11725              static normalize(t, e) {
11726                const i = e.x;
11727                const s = e.y;
11728                const n = e.z;
11729                let r = i * i + s * s + n * n;
11730                if (r > 0) {
11731                  r = 1 / Math.sqrt(r);
11732                  t.x = i * r;
11733                  t.y = s * r;
11734                  t.z = n * r;
11735                }
11736                return t;
11737              }
11738              static dot(t, e) {
11739                return t.x * e.x + t.y * e.y + t.z * e.z;
11740              }
11741              static cross(t, e, i) {
11742                const {x: s, y: n, z: r} = e;
11743                const {x: o, y: a, z: l} = i;
11744                t.x = n * l - r * a;
11745                t.y = r * o - s * l;
11746                t.z = s * a - n * o;
11747                return t;
11748              }
11749              static lerp(t, e, i, s) {
11750                t.x = e.x + s * (i.x - e.x);
11751                t.y = e.y + s * (i.y - e.y);
11752                t.z = e.z + s * (i.z - e.z);
11753                return t;
11754              }
11755              static random(t, e) {
11756                e = e || 1;
11757                const i = 2 * gi() * Math.PI;
11758                const s = 2 * gi() - 1;
11759                const n = Math.sqrt(1 - s * s);
11760                t.x = n * Math.cos(i) * e;
11761                t.y = n * Math.sin(i) * e;
11762                t.z = s * e;
11763                return t;
11764              }
11765              static transformMat4(t, e, i) {
11766                const s = e.x;
11767                const n = e.y;
11768                const r = e.z;
11769                let o = i.m03 * s + i.m07 * n + i.m11 * r + i.m15;
11770                o = o ? Math.abs(1 / o) : 1;
11771                t.x = (i.m00 * s + i.m04 * n + i.m08 * r + i.m12) * o;
11772                t.y = (i.m01 * s + i.m05 * n + i.m09 * r + i.m13) * o;
11773                t.z = (i.m02 * s + i.m06 * n + i.m10 * r + i.m14) * o;
11774                return t;
11775              }
11776              static transformMat4Normal(t, e, i) {
11777                const s = e.x;
11778                const n = e.y;
11779                const r = e.z;
11780                let o = i.m03 * s + i.m07 * n + i.m11 * r;
11781                o = o ? Math.abs(1 / o) : 1;
11782                t.x = (i.m00 * s + i.m04 * n + i.m08 * r) * o;
11783                t.y = (i.m01 * s + i.m05 * n + i.m09 * r) * o;
11784                t.z = (i.m02 * s + i.m06 * n + i.m10 * r) * o;
11785                return t;
11786              }
11787              static transformMat3(t, e, i) {
11788                const s = e.x;
11789                const n = e.y;
11790                const r = e.z;
11791                t.x = s * i.m00 + n * i.m03 + r * i.m06;
11792                t.y = s * i.m01 + n * i.m04 + r * i.m07;
11793                t.z = s * i.m02 + n * i.m05 + r * i.m08;
11794                return t;
11795              }
11796              static transformAffine(t, e, i) {
11797                const s = e.x;
11798                const n = e.y;
11799                const r = e.z;
11800                t.x = i.m00 * s + i.m04 * n + i.m08 * r + i.m12;
11801                t.y = i.m01 * s + i.m05 * n + i.m09 * r + i.m13;
11802                t.z = i.m02 * s + i.m06 * n + i.m10 * r + i.m14;
11803                return t;
11804              }
11805              static transformQuat(t, e, i) {
11806                const s = i.w * e.x + i.y * e.z - i.z * e.y;
11807                const n = i.w * e.y + i.z * e.x - i.x * e.z;
11808                const r = i.w * e.z + i.x * e.y - i.y * e.x;
11809                const o = -i.x * e.x - i.y * e.y - i.z * e.z;
11810                t.x = s * i.w + o * -i.x + n * -i.z - r * -i.y;
11811                t.y = n * i.w + o * -i.y + r * -i.x - s * -i.z;
11812                t.z = r * i.w + o * -i.z + s * -i.y - n * -i.x;
11813                return t;
11814              }
11815              static transformRTS(t, e, i, s, n) {
11816                const r = e.x * n.x;
11817                const o = e.y * n.y;
11818                const a = e.z * n.z;
11819                const l = i.w * r + i.y * a - i.z * o;
11820                const h = i.w * o + i.z * r - i.x * a;
11821                const c = i.w * a + i.x * o - i.y * r;
11822                const u = -i.x * r - i.y * o - i.z * a;
11823                t.x = l * i.w + u * -i.x + h * -i.z - c * -i.y + s.x;
11824                t.y = h * i.w + u * -i.y + c * -i.x - l * -i.z + s.y;
11825                t.z = c * i.w + u * -i.z + l * -i.y - h * -i.x + s.z;
11826                return t;
11827              }
11828              static transformInverseRTS(t, e, i, s, n) {
11829                const r = e.x - s.x;
11830                const o = e.y - s.y;
11831                const a = e.z - s.z;
11832                const l = i.w * r - i.y * a + i.z * o;
11833                const h = i.w * o - i.z * r + i.x * a;
11834                const c = i.w * a - i.x * o + i.y * r;
11835                const u = i.x * r + i.y * o + i.z * a;
11836                t.x = (l * i.w + u * i.x + h * i.z - c * i.y) / n.x;
11837                t.y = (h * i.w + u * i.y + c * i.x - l * i.z) / n.y;
11838                t.z = (c * i.w + u * i.z + l * i.y - h * i.x) / n.z;
11839                return t;
11840              }
11841              static rotateX(t, e, i, s) {
11842                const n = e.x - i.x;
11843                const r = e.y - i.y;
11844                const o = e.z - i.z;
11845                const a = Math.cos(s);
11846                const l = Math.sin(s);
11847                const h = n;
11848                const c = r * a - o * l;
11849                const u = r * l + o * a;
11850                t.x = h + i.x;
11851                t.y = c + i.y;
11852                t.z = u + i.z;
11853                return t;
11854              }
11855              static rotateY(t, e, i, s) {
11856                const n = e.x - i.x;
11857                const r = e.y - i.y;
11858                const o = e.z - i.z;
11859                const a = Math.cos(s);
11860                const l = Math.sin(s);
11861                const h = o * l + n * a;
11862                const c = r;
11863                const u = o * a - n * l;
11864                t.x = h + i.x;
11865                t.y = c + i.y;
11866                t.z = u + i.z;
11867                return t;
11868              }
11869              static rotateZ(t, e, i, s) {
11870                const n = e.x - i.x;
11871                const r = e.y - i.y;
11872                const o = e.z - i.z;
11873                const a = Math.cos(s);
11874                const l = Math.sin(s);
11875                const h = n * a - r * l;
11876                const c = n * l + r * a;
11877                const u = o;
11878                t.x = h + i.x;
11879                t.y = c + i.y;
11880                t.z = u + i.z;
11881                return t;
11882              }
11883              static toArray(t, e, i = 0) {
11884                t[i + 0] = e.x;
11885                t[i + 1] = e.y;
11886                t[i + 2] = e.z;
11887                return t;
11888              }
11889              static fromArray(t, e, i = 0) {
11890                t.x = e[i + 0];
11891                t.y = e[i + 1];
11892                t.z = e[i + 2];
11893                return t;
11894              }
11895              static strictEquals(t, e) {
11896                return t.x === e.x && t.y === e.y && t.z === e.z;
11897              }
11898              static equals(t, e, i = hi) {
11899                const {x: s, y: n, z: r} = t;
11900                const {x: o, y: a, z: l} = e;
11901                return Math.abs(s - o) <= i * Math.max(1, Math.abs(s), Math.abs(o)) && Math.abs(n - a) <= i * Math.max(1, Math.abs(n), Math.abs(a)) && Math.abs(r - l) <= i * Math.max(1, Math.abs(r), Math.abs(l));
11902              }
11903              static angle(t, e) {
11904                Pi.normalize(Oi, t);
11905                Pi.normalize(Ni, e);
11906                const i = Pi.dot(Oi, Ni);
11907                return i > 1 ? 0 : i < -1 ? Math.PI : Math.acos(i);
11908              }
11909              static projectOnPlane(t, e, i) {
11910                return Pi.subtract(t, e, Pi.project(t, e, i));
11911              }
11912              static project(t, e, i) {
11913                const s = Pi.lengthSqr(i);
11914                return s < 1e-6 ? Pi.set(t, 0, 0, 0) : Pi.multiplyScalar(t, i, Pi.dot(e, i) / s);
11915              }
11916              constructor(t, e, i) {
11917                super();
11918                if (t && "object" == typeof t) {
11919                  this.x = t.x;
11920                  this.y = t.y;
11921                  this.z = t.z;
11922                } else {
11923                  this.x = t || 0;
11924                  this.y = e || 0;
11925                  this.z = i || 0;
11926                }
11927              }
11928              clone() {
11929                return new Pi(this.x, this.y, this.z);
11930              }
11931              set(t, e, i) {
11932                if (t && "object" == typeof t) {
11933                  this.x = t.x;
11934                  this.y = t.y;
11935                  this.z = t.z;
11936                } else {
11937                  this.x = t || 0;
11938                  this.y = e || 0;
11939                  this.z = i || 0;
11940                }
11941                return this;
11942              }
11943              equals(t, e = hi) {
11944                return Math.abs(this.x - t.x) <= e * Math.max(1, Math.abs(this.x), Math.abs(t.x)) && Math.abs(this.y - t.y) <= e * Math.max(1, Math.abs(this.y), Math.abs(t.y)) && Math.abs(this.z - t.z) <= e * Math.max(1, Math.abs(this.z), Math.abs(t.z));
11945              }
11946              equals3f(t, e, i, s = hi) {
11947                return Math.abs(this.x - t) <= s * Math.max(1, Math.abs(this.x), Math.abs(t)) && Math.abs(this.y - e) <= s * Math.max(1, Math.abs(this.y), Math.abs(e)) && Math.abs(this.z - i) <= s * Math.max(1, Math.abs(this.z), Math.abs(i));
11948              }
11949              strictEquals(t) {
11950                return this.x === t.x && this.y === t.y && this.z === t.z;
11951              }
11952              strictEquals3f(t, e, i) {
11953                return this.x === t && this.y === e && this.z === i;
11954              }
11955              toString() {
11956                return `(${this.x.toFixed(2)}, ${this.y.toFixed(2)}, ${this.z.toFixed(2)})`;
11957              }
11958              lerp(t, e) {
11959                this.x += e * (t.x - this.x);
11960                this.y += e * (t.y - this.y);
11961                this.z += e * (t.z - this.z);
11962                return this;
11963              }
11964              add(t) {
11965                this.x += t.x;
11966                this.y += t.y;
11967                this.z += t.z;
11968                return this;
11969              }
11970              add3f(t, e, i) {
11971                this.x += t;
11972                this.y += e;
11973                this.z += i;
11974                return this;
11975              }
11976              subtract(t) {
11977                this.x -= t.x;
11978                this.y -= t.y;
11979                this.z -= t.z;
11980                return this;
11981              }
11982              subtract3f(t, e, i) {
11983                this.x -= t;
11984                this.y -= e;
11985                this.z -= i;
11986                return this;
11987              }
11988              multiplyScalar(t) {
11989                "object" == typeof t && console.warn("should use Vec3.multiply for vector * vector operation");
11990                this.x *= t;
11991                this.y *= t;
11992                this.z *= t;
11993                return this;
11994              }
11995              multiply(t) {
11996                "object" != typeof t && console.warn("should use Vec3.scale for vector * scalar operation");
11997                this.x *= t.x;
11998                this.y *= t.y;
11999                this.z *= t.z;
12000                return this;
12001              }
12002              multiply3f(t, e, i) {
12003                this.x *= t;
12004                this.y *= e;
12005                this.z *= i;
12006                return this;
12007              }
12008              divide(t) {
12009                this.x /= t.x;
12010                this.y /= t.y;
12011                this.z /= t.z;
12012                return this;
12013              }
12014              divide3f(t, e, i) {
12015                this.x /= t;
12016                this.y /= e;
12017                this.z /= i;
12018                return this;
12019              }
12020              negative() {
12021                this.x = -this.x;
12022                this.y = -this.y;
12023                this.z = -this.z;
12024                return this;
12025              }
12026              clampf(t, e) {
12027                this.x = _i(this.x, t.x, e.x);
12028                this.y = _i(this.y, t.y, e.y);
12029                this.z = _i(this.z, t.z, e.z);
12030                return this;
12031              }
12032              dot(t) {
12033                return this.x * t.x + this.y * t.y + this.z * t.z;
12034              }
12035              cross(t) {
12036                const {x: e, y: i, z: s} = this;
12037                const {x: n, y: r, z: o} = t;
12038                this.x = i * o - s * r;
12039                this.y = s * n - e * o;
12040                this.z = e * r - i * n;
12041                return this;
12042              }
12043              length() {
12044                return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
12045              }
12046              lengthSqr() {
12047                return this.x * this.x + this.y * this.y + this.z * this.z;
12048              }
12049              normalize() {
12050                const t = this.x;
12051                const e = this.y;
12052                const i = this.z;
12053                let s = t * t + e * e + i * i;
12054                if (s > 0) {
12055                  s = 1 / Math.sqrt(s);
12056                  this.x = t * s;
12057                  this.y = e * s;
12058                  this.z = i * s;
12059                }
12060                return this;
12061              }
12062              transformMat4(t) {
12063                const e = this.x;
12064                const i = this.y;
12065                const s = this.z;
12066                let n = t.m03 * e + t.m07 * i + t.m11 * s + t.m15;
12067                n = n ? 1 / n : 1;
12068                this.x = (t.m00 * e + t.m04 * i + t.m08 * s + t.m12) * n;
12069                this.y = (t.m01 * e + t.m05 * i + t.m09 * s + t.m13) * n;
12070                this.z = (t.m02 * e + t.m06 * i + t.m10 * s + t.m14) * n;
12071                return this;
12072              }
12073            }
12074            t("Vec3", Pi);
12075            Pi.UNIT_X = Object.freeze(new Pi(1, 0, 0));
12076            Pi.UNIT_Y = Object.freeze(new Pi(0, 1, 0));
12077            Pi.UNIT_Z = Object.freeze(new Pi(0, 0, 1));
12078            Pi.RIGHT = Object.freeze(new Pi(1, 0, 0));
12079            Pi.UP = Object.freeze(new Pi(0, 1, 0));
12080            Pi.FORWARD = Object.freeze(new Pi(0, 0, -1));
12081            Pi.ZERO = Object.freeze(new Pi(0, 0, 0));
12082            Pi.ONE = Object.freeze(new Pi(1, 1, 1));
12083            Pi.NEG_ONE = Object.freeze(new Pi(-1, -1, -1));
12084            const Oi = new Pi;
12085            const Ni = new Pi;
12086            si.fastDefine("cc.Vec3", Pi, {
12087              x: 0,
12088              y: 0,
12089              z: 0
12090            });
12091            m.Vec3 = Pi;
12092            function Li(t, e, i) {
12093              return new Pi(t, e, i);
12094            }
12095            m.v3 = Li;
12096            class Fi extends ce {
12097              static clone(t) {
12098                return new Fi(t.m00, t.m01, t.m02, t.m03, t.m04, t.m05, t.m06, t.m07, t.m08);
12099              }
12100              static copy(t, e) {
12101                t.m00 = e.m00;
12102                t.m01 = e.m01;
12103                t.m02 = e.m02;
12104                t.m03 = e.m03;
12105                t.m04 = e.m04;
12106                t.m05 = e.m05;
12107                t.m06 = e.m06;
12108                t.m07 = e.m07;
12109                t.m08 = e.m08;
12110                return t;
12111              }
12112              static set(t, e, i, s, n, r, o, a, l, h) {
12113                t.m00 = e;
12114                t.m01 = i;
12115                t.m02 = s;
12116                t.m03 = n;
12117                t.m04 = r;
12118                t.m05 = o;
12119                t.m06 = a;
12120                t.m07 = l;
12121                t.m08 = h;
12122                return t;
12123              }
12124              static identity(t) {
12125                t.m00 = 1;
12126                t.m01 = 0;
12127                t.m02 = 0;
12128                t.m03 = 0;
12129                t.m04 = 1;
12130                t.m05 = 0;
12131                t.m06 = 0;
12132                t.m07 = 0;
12133                t.m08 = 1;
12134                return t;
12135              }
12136              static transpose(t, e) {
12137                if (t === e) {
12138                  const i = e.m01;
12139                  const s = e.m02;
12140                  const n = e.m05;
12141                  t.m01 = e.m03;
12142                  t.m02 = e.m06;
12143                  t.m03 = i;
12144                  t.m05 = e.m07;
12145                  t.m06 = s;
12146                  t.m07 = n;
12147                } else {
12148                  t.m00 = e.m00;
12149                  t.m01 = e.m03;
12150                  t.m02 = e.m06;
12151                  t.m03 = e.m01;
12152                  t.m04 = e.m04;
12153                  t.m05 = e.m07;
12154                  t.m06 = e.m02;
12155                  t.m07 = e.m05;
12156                  t.m08 = e.m08;
12157                }
12158                return t;
12159              }
12160              static invert(t, e) {
12161                const i = e.m00;
12162                const s = e.m01;
12163                const n = e.m02;
12164                const r = e.m03;
12165                const o = e.m04;
12166                const a = e.m05;
12167                const l = e.m06;
12168                const h = e.m07;
12169                const c = e.m08;
12170                const u = c * o - a * h;
12171                const _ = -c * r + a * l;
12172                const d = h * r - o * l;
12173                let p = i * u + s * _ + n * d;
12174                if (0 === p) {
12175                  t.m00 = 0;
12176                  t.m01 = 0;
12177                  t.m02 = 0;
12178                  t.m03 = 0;
12179                  t.m04 = 0;
12180                  t.m05 = 0;
12181                  t.m06 = 0;
12182                  t.m07 = 0;
12183                  t.m08 = 0;
12184                  return t;
12185                }
12186                p = 1 / p;
12187                t.m00 = u * p;
12188                t.m01 = (-c * s + n * h) * p;
12189                t.m02 = (a * s - n * o) * p;
12190                t.m03 = _ * p;
12191                t.m04 = (c * i - n * l) * p;
12192                t.m05 = (-a * i + n * r) * p;
12193                t.m06 = d * p;
12194                t.m07 = (-h * i + s * l) * p;
12195                t.m08 = (o * i - s * r) * p;
12196                return t;
12197              }
12198              static determinant(t) {
12199                const e = t.m00;
12200                const i = t.m01;
12201                const s = t.m02;
12202                const n = t.m03;
12203                const r = t.m04;
12204                const o = t.m05;
12205                const a = t.m06;
12206                const l = t.m07;
12207                const h = t.m08;
12208                return e * (h * r - o * l) + i * (-h * n + o * a) + s * (l * n - r * a);
12209              }
12210              static multiply(t, e, i) {
12211                const s = e.m00;
12212                const n = e.m01;
12213                const r = e.m02;
12214                const o = e.m03;
12215                const a = e.m04;
12216                const l = e.m05;
12217                const h = e.m06;
12218                const c = e.m07;
12219                const u = e.m08;
12220                const _ = i.m00;
12221                const d = i.m01;
12222                const p = i.m02;
12223                const m = i.m03;
12224                const f = i.m04;
12225                const g = i.m05;
12226                const y = i.m06;
12227                const b = i.m07;
12228                const S = i.m08;
12229                t.m00 = _ * s + d * o + p * h;
12230                t.m01 = _ * n + d * a + p * c;
12231                t.m02 = _ * r + d * l + p * u;
12232                t.m03 = m * s + f * o + g * h;
12233                t.m04 = m * n + f * a + g * c;
12234                t.m05 = m * r + f * l + g * u;
12235                t.m06 = y * s + b * o + S * h;
12236                t.m07 = y * n + b * a + S * c;
12237                t.m08 = y * r + b * l + S * u;
12238                return t;
12239              }
12240              static multiplyMat4(t, e, i) {
12241                const s = e.m00;
12242                const n = e.m01;
12243                const r = e.m02;
12244                const o = e.m03;
12245                const a = e.m04;
12246                const l = e.m05;
12247                const h = e.m06;
12248                const c = e.m07;
12249                const u = e.m08;
12250                const _ = i.m00;
12251                const d = i.m01;
12252                const p = i.m02;
12253                const m = i.m04;
12254                const f = i.m05;
12255                const g = i.m06;
12256                const y = i.m08;
12257                const b = i.m09;
12258                const S = i.m10;
12259                t.m00 = _ * s + d * o + p * h;
12260                t.m01 = _ * n + d * a + p * c;
12261                t.m02 = _ * r + d * l + p * u;
12262                t.m03 = m * s + f * o + g * h;
12263                t.m04 = m * n + f * a + g * c;
12264                t.m05 = m * r + f * l + g * u;
12265                t.m06 = y * s + b * o + S * h;
12266                t.m07 = y * n + b * a + S * c;
12267                t.m08 = y * r + b * l + S * u;
12268                return t;
12269              }
12270              static transform(t, e, i) {
12271                const s = e.m00;
12272                const n = e.m01;
12273                const r = e.m02;
12274                const o = e.m03;
12275                const a = e.m04;
12276                const l = e.m05;
12277                const h = e.m06;
12278                const c = e.m07;
12279                const u = e.m08;
12280                const _ = i.x;
12281                const d = i.y;
12282                t.m00 = s;
12283                t.m01 = n;
12284                t.m02 = r;
12285                t.m03 = o;
12286                t.m04 = a;
12287                t.m05 = l;
12288                t.m06 = _ * s + d * o + h;
12289                t.m07 = _ * n + d * a + c;
12290                t.m08 = _ * r + d * l + u;
12291                return t;
12292              }
12293              static scale(t, e, i) {
12294                const s = i.x;
12295                const n = i.y;
12296                t.m00 = s * e.m00;
12297                t.m01 = s * e.m01;
12298                t.m02 = s * e.m02;
12299                t.m03 = n * e.m03;
12300                t.m04 = n * e.m04;
12301                t.m05 = n * e.m05;
12302                t.m06 = e.m06;
12303                t.m07 = e.m07;
12304                t.m08 = e.m08;
12305                return t;
12306              }
12307              static rotate(t, e, i) {
12308                const s = e.m00;
12309                const n = e.m01;
12310                const r = e.m02;
12311                const o = e.m03;
12312                const a = e.m04;
12313                const l = e.m05;
12314                const h = e.m06;
12315                const c = e.m07;
12316                const u = e.m08;
12317                const _ = Math.sin(i);
12318                const d = Math.cos(i);
12319                t.m00 = d * s + _ * o;
12320                t.m01 = d * n + _ * a;
12321                t.m02 = d * r + _ * l;
12322                t.m03 = d * o - _ * s;
12323                t.m04 = d * a - _ * n;
12324                t.m05 = d * l - _ * r;
12325                t.m06 = h;
12326                t.m07 = c;
12327                t.m08 = u;
12328                return t;
12329              }
12330              static fromMat4(t, e) {
12331                t.m00 = e.m00;
12332                t.m01 = e.m01;
12333                t.m02 = e.m02;
12334                t.m03 = e.m04;
12335                t.m04 = e.m05;
12336                t.m05 = e.m06;
12337                t.m06 = e.m08;
12338                t.m07 = e.m09;
12339                t.m08 = e.m10;
12340                return t;
12341              }
12342              static fromViewUp(t, e, i) {
12343                if (Pi.lengthSqr(e) < hi * hi) {
12344                  Fi.identity(t);
12345                  return t;
12346                }
12347                i = i || Pi.UNIT_Y;
12348                Pi.normalize(Vi, Pi.cross(Vi, i, e));
12349                if (Pi.lengthSqr(Vi) < hi * hi) {
12350                  Fi.identity(t);
12351                  return t;
12352                }
12353                Pi.cross(ki, e, Vi);
12354                Fi.set(t, Vi.x, Vi.y, Vi.z, ki.x, ki.y, ki.z, e.x, e.y, e.z);
12355                return t;
12356              }
12357              static fromTranslation(t, e) {
12358                t.m00 = 1;
12359                t.m01 = 0;
12360                t.m02 = 0;
12361                t.m03 = 0;
12362                t.m04 = 1;
12363                t.m05 = 0;
12364                t.m06 = e.x;
12365                t.m07 = e.y;
12366                t.m08 = 1;
12367                return t;
12368              }
12369              static fromScaling(t, e) {
12370                t.m00 = e.x;
12371                t.m01 = 0;
12372                t.m02 = 0;
12373                t.m03 = 0;
12374                t.m04 = e.y;
12375                t.m05 = 0;
12376                t.m06 = 0;
12377                t.m07 = 0;
12378                t.m08 = 1;
12379                return t;
12380              }
12381              static fromRotation(t, e) {
12382                const i = Math.sin(e);
12383                const s = Math.cos(e);
12384                t.m00 = s;
12385                t.m01 = i;
12386                t.m02 = 0;
12387                t.m03 = -i;
12388                t.m04 = s;
12389                t.m05 = 0;
12390                t.m06 = 0;
12391                t.m07 = 0;
12392                t.m08 = 1;
12393                return t;
12394              }
12395              static fromQuat(t, e) {
12396                const i = e.x;
12397                const s = e.y;
12398                const n = e.z;
12399                const r = e.w;
12400                const o = i + i;
12401                const a = s + s;
12402                const l = n + n;
12403                const h = i * o;
12404                const c = s * o;
12405                const u = s * a;
12406                const _ = n * o;
12407                const d = n * a;
12408                const p = n * l;
12409                const m = r * o;
12410                const f = r * a;
12411                const g = r * l;
12412                t.m00 = 1 - u - p;
12413                t.m03 = c - g;
12414                t.m06 = _ + f;
12415                t.m01 = c + g;
12416                t.m04 = 1 - h - p;
12417                t.m07 = d - m;
12418                t.m02 = _ - f;
12419                t.m05 = d + m;
12420                t.m08 = 1 - h - u;
12421                return t;
12422              }
12423              static inverseTransposeMat4(t, e) {
12424                const i = e.m00;
12425                const s = e.m01;
12426                const n = e.m02;
12427                const r = e.m03;
12428                const o = e.m04;
12429                const a = e.m05;
12430                const l = e.m06;
12431                const h = e.m07;
12432                const c = e.m08;
12433                const u = e.m09;
12434                const _ = e.m10;
12435                const d = e.m11;
12436                const p = e.m12;
12437                const m = e.m13;
12438                const f = e.m14;
12439                const g = e.m15;
12440                const y = i * a - s * o;
12441                const b = i * l - n * o;
12442                const S = i * h - r * o;
12443                const A = s * l - n * a;
12444                const T = s * h - r * a;
12445                const v = n * h - r * l;
12446                const E = c * m - u * p;
12447                const C = c * f - _ * p;
12448                const x = c * g - d * p;
12449                const w = u * f - _ * m;
12450                const R = u * g - d * m;
12451                const I = _ * g - d * f;
12452                let M = y * I - b * R + S * w + A * x - T * C + v * E;
12453                if (!M) return null;
12454                M = 1 / M;
12455                t.m00 = (a * I - l * R + h * w) * M;
12456                t.m01 = (l * x - o * I - h * C) * M;
12457                t.m02 = (o * R - a * x + h * E) * M;
12458                t.m03 = (n * R - s * I - r * w) * M;
12459                t.m04 = (i * I - n * x + r * C) * M;
12460                t.m05 = (s * x - i * R - r * E) * M;
12461                t.m06 = (m * v - f * T + g * A) * M;
12462                t.m07 = (f * S - p * v - g * b) * M;
12463                t.m08 = (p * T - m * S + g * y) * M;
12464                return t;
12465              }
12466              static toArray(t, e, i = 0) {
12467                t[i + 0] = e.m00;
12468                t[i + 1] = e.m01;
12469                t[i + 2] = e.m02;
12470                t[i + 3] = e.m03;
12471                t[i + 4] = e.m04;
12472                t[i + 5] = e.m05;
12473                t[i + 6] = e.m06;
12474                t[i + 7] = e.m07;
12475                t[i + 8] = e.m08;
12476                return t;
12477              }
12478              static fromArray(t, e, i = 0) {
12479                t.m00 = e[i + 0];
12480                t.m01 = e[i + 1];
12481                t.m02 = e[i + 2];
12482                t.m03 = e[i + 3];
12483                t.m04 = e[i + 4];
12484                t.m05 = e[i + 5];
12485                t.m06 = e[i + 6];
12486                t.m07 = e[i + 7];
12487                t.m08 = e[i + 8];
12488                return t;
12489              }
12490              static add(t, e, i) {
12491                t.m00 = e.m00 + i.m00;
12492                t.m01 = e.m01 + i.m01;
12493                t.m02 = e.m02 + i.m02;
12494                t.m03 = e.m03 + i.m03;
12495                t.m04 = e.m04 + i.m04;
12496                t.m05 = e.m05 + i.m05;
12497                t.m06 = e.m06 + i.m06;
12498                t.m07 = e.m07 + i.m07;
12499                t.m08 = e.m08 + i.m08;
12500                return t;
12501              }
12502              static subtract(t, e, i) {
12503                t.m00 = e.m00 - i.m00;
12504                t.m01 = e.m01 - i.m01;
12505                t.m02 = e.m02 - i.m02;
12506                t.m03 = e.m03 - i.m03;
12507                t.m04 = e.m04 - i.m04;
12508                t.m05 = e.m05 - i.m05;
12509                t.m06 = e.m06 - i.m06;
12510                t.m07 = e.m07 - i.m07;
12511                t.m08 = e.m08 - i.m08;
12512                return t;
12513              }
12514              static multiplyScalar(t, e, i) {
12515                t.m00 = e.m00 * i;
12516                t.m01 = e.m01 * i;
12517                t.m02 = e.m02 * i;
12518                t.m03 = e.m03 * i;
12519                t.m04 = e.m04 * i;
12520                t.m05 = e.m05 * i;
12521                t.m06 = e.m06 * i;
12522                t.m07 = e.m07 * i;
12523                t.m08 = e.m08 * i;
12524                return t;
12525              }
12526              static multiplyScalarAndAdd(t, e, i, s) {
12527                t.m00 = i.m00 * s + e.m00;
12528                t.m01 = i.m01 * s + e.m01;
12529                t.m02 = i.m02 * s + e.m02;
12530                t.m03 = i.m03 * s + e.m03;
12531                t.m04 = i.m04 * s + e.m04;
12532                t.m05 = i.m05 * s + e.m05;
12533                t.m06 = i.m06 * s + e.m06;
12534                t.m07 = i.m07 * s + e.m07;
12535                t.m08 = i.m08 * s + e.m08;
12536                return t;
12537              }
12538              static strictEquals(t, e) {
12539                return t.m00 === e.m00 && t.m01 === e.m01 && t.m02 === e.m02 && t.m03 === e.m03 && t.m04 === e.m04 && t.m05 === e.m05 && t.m06 === e.m06 && t.m07 === e.m07 && t.m08 === e.m08;
12540              }
12541              static equals(t, e, i = hi) {
12542                return Math.abs(t.m00 - e.m00) <= i * Math.max(1, Math.abs(t.m00), Math.abs(e.m00)) && Math.abs(t.m01 - e.m01) <= i * Math.max(1, Math.abs(t.m01), Math.abs(e.m01)) && Math.abs(t.m02 - e.m02) <= i * Math.max(1, Math.abs(t.m02), Math.abs(e.m02)) && Math.abs(t.m03 - e.m03) <= i * Math.max(1, Math.abs(t.m03), Math.abs(e.m03)) && Math.abs(t.m04 - e.m04) <= i * Math.max(1, Math.abs(t.m04), Math.abs(e.m04)) && Math.abs(t.m05 - e.m05) <= i * Math.max(1, Math.abs(t.m05), Math.abs(e.m05)) && Math.abs(t.m06 - e.m06) <= i * Math.max(1, Math.abs(t.m06), Math.abs(e.m06)) && Math.abs(t.m07 - e.m07) <= i * Math.max(1, Math.abs(t.m07), Math.abs(e.m07)) && Math.abs(t.m08 - e.m08) <= i * Math.max(1, Math.abs(t.m08), Math.abs(e.m08));
12543              }
12544              constructor(t = 1, e = 0, i = 0, s = 0, n = 1, r = 0, o = 0, a = 0, l = 1) {
12545                super();
12546                if ("object" == typeof t) {
12547                  this.m00 = t.m00;
12548                  this.m01 = t.m01;
12549                  this.m02 = t.m02;
12550                  this.m03 = t.m03;
12551                  this.m04 = t.m04;
12552                  this.m05 = t.m05;
12553                  this.m06 = t.m06;
12554                  this.m07 = t.m07;
12555                  this.m08 = t.m08;
12556                } else {
12557                  this.m00 = t;
12558                  this.m01 = e;
12559                  this.m02 = i;
12560                  this.m03 = s;
12561                  this.m04 = n;
12562                  this.m05 = r;
12563                  this.m06 = o;
12564                  this.m07 = a;
12565                  this.m08 = l;
12566                }
12567              }
12568              clone() {
12569                const t = this;
12570                return new Fi(t.m00, t.m01, t.m02, t.m03, t.m04, t.m05, t.m06, t.m07, t.m08);
12571              }
12572              set(t = 1, e = 0, i = 0, s = 0, n = 1, r = 0, o = 0, a = 0, l = 1) {
12573                if ("object" == typeof t) {
12574                  this.m00 = t.m00;
12575                  this.m01 = t.m01;
12576                  this.m02 = t.m02;
12577                  this.m03 = t.m03;
12578                  this.m04 = t.m04;
12579                  this.m05 = t.m05;
12580                  this.m06 = t.m06;
12581                  this.m07 = t.m07;
12582                  this.m08 = t.m08;
12583                } else {
12584                  this.m00 = t;
12585                  this.m01 = e;
12586                  this.m02 = i;
12587                  this.m03 = s;
12588                  this.m04 = n;
12589                  this.m05 = r;
12590                  this.m06 = o;
12591                  this.m07 = a;
12592                  this.m08 = l;
12593                }
12594                return this;
12595              }
12596              equals(t, e = hi) {
12597                return Math.abs(this.m00 - t.m00) <= e * Math.max(1, Math.abs(this.m00), Math.abs(t.m00)) && Math.abs(this.m01 - t.m01) <= e * Math.max(1, Math.abs(this.m01), Math.abs(t.m01)) && Math.abs(this.m02 - t.m02) <= e * Math.max(1, Math.abs(this.m02), Math.abs(t.m02)) && Math.abs(this.m03 - t.m03) <= e * Math.max(1, Math.abs(this.m03), Math.abs(t.m03)) && Math.abs(this.m04 - t.m04) <= e * Math.max(1, Math.abs(this.m04), Math.abs(t.m04)) && Math.abs(this.m05 - t.m05) <= e * Math.max(1, Math.abs(this.m05), Math.abs(t.m05)) && Math.abs(this.m06 - t.m06) <= e * Math.max(1, Math.abs(this.m06), Math.abs(t.m06)) && Math.abs(this.m07 - t.m07) <= e * Math.max(1, Math.abs(this.m07), Math.abs(t.m07)) && Math.abs(this.m08 - t.m08) <= e * Math.max(1, Math.abs(this.m08), Math.abs(t.m08));
12598              }
12599              strictEquals(t) {
12600                return this.m00 === t.m00 && this.m01 === t.m01 && this.m02 === t.m02 && this.m03 === t.m03 && this.m04 === t.m04 && this.m05 === t.m05 && this.m06 === t.m06 && this.m07 === t.m07 && this.m08 === t.m08;
12601              }
12602              toString() {
12603                const t = this;
12604                return `[\n${t.m00}, ${t.m01}, ${t.m02},\n${t.m03},\n${t.m04}, ${t.m05},\n${t.m06}, ${t.m07},\n${t.m08}\n]`;
12605              }
12606              identity() {
12607                this.m00 = 1;
12608                this.m01 = 0;
12609                this.m02 = 0;
12610                this.m03 = 0;
12611                this.m04 = 1;
12612                this.m05 = 0;
12613                this.m06 = 0;
12614                this.m07 = 0;
12615                this.m08 = 1;
12616                return this;
12617              }
12618              transpose() {
12619                const t = this.m01;
12620                const e = this.m02;
12621                const i = this.m05;
12622                this.m01 = this.m03;
12623                this.m02 = this.m06;
12624                this.m03 = t;
12625                this.m05 = this.m07;
12626                this.m06 = e;
12627                this.m07 = i;
12628                return this;
12629              }
12630              invert() {
12631                const t = this.m00;
12632                const e = this.m01;
12633                const i = this.m02;
12634                const s = this.m03;
12635                const n = this.m04;
12636                const r = this.m05;
12637                const o = this.m06;
12638                const a = this.m07;
12639                const l = this.m08;
12640                const h = l * n - r * a;
12641                const c = -l * s + r * o;
12642                const u = a * s - n * o;
12643                let _ = t * h + e * c + i * u;
12644                if (0 === _) {
12645                  this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
12646                  return this;
12647                }
12648                _ = 1 / _;
12649                this.m00 = h * _;
12650                this.m01 = (-l * e + i * a) * _;
12651                this.m02 = (r * e - i * n) * _;
12652                this.m03 = c * _;
12653                this.m04 = (l * t - i * o) * _;
12654                this.m05 = (-r * t + i * s) * _;
12655                this.m06 = u * _;
12656                this.m07 = (-a * t + e * o) * _;
12657                this.m08 = (n * t - e * s) * _;
12658                return this;
12659              }
12660              determinant() {
12661                const t = this.m00;
12662                const e = this.m01;
12663                const i = this.m02;
12664                const s = this.m03;
12665                const n = this.m04;
12666                const r = this.m05;
12667                const o = this.m06;
12668                const a = this.m07;
12669                const l = this.m08;
12670                return t * (l * n - r * a) + e * (-l * s + r * o) + i * (a * s - n * o);
12671              }
12672              add(t) {
12673                this.m00 += t.m00;
12674                this.m01 += t.m01;
12675                this.m02 += t.m02;
12676                this.m03 += t.m03;
12677                this.m04 += t.m04;
12678                this.m05 += t.m05;
12679                this.m06 += t.m06;
12680                this.m07 += t.m07;
12681                this.m08 += t.m08;
12682                return this;
12683              }
12684              subtract(t) {
12685                this.m00 -= t.m00;
12686                this.m01 -= t.m01;
12687                this.m02 -= t.m02;
12688                this.m03 -= t.m03;
12689                this.m04 -= t.m04;
12690                this.m05 -= t.m05;
12691                this.m06 -= t.m06;
12692                this.m07 -= t.m07;
12693                this.m08 -= t.m08;
12694                return this;
12695              }
12696              multiply(t) {
12697                const e = this.m00;
12698                const i = this.m01;
12699                const s = this.m02;
12700                const n = this.m03;
12701                const r = this.m04;
12702                const o = this.m05;
12703                const a = this.m06;
12704                const l = this.m07;
12705                const h = this.m08;
12706                const c = t.m00;
12707                const u = t.m01;
12708                const _ = t.m02;
12709                const d = t.m03;
12710                const p = t.m04;
12711                const m = t.m05;
12712                const f = t.m06;
12713                const g = t.m07;
12714                const y = t.m08;
12715                this.m00 = c * e + u * n + _ * a;
12716                this.m01 = c * i + u * r + _ * l;
12717                this.m02 = c * s + u * o + _ * h;
12718                this.m03 = d * e + p * n + m * a;
12719                this.m04 = d * i + p * r + m * l;
12720                this.m05 = d * s + p * o + m * h;
12721                this.m06 = f * e + g * n + y * a;
12722                this.m07 = f * i + g * r + y * l;
12723                this.m08 = f * s + g * o + y * h;
12724                return this;
12725              }
12726              multiplyScalar(t) {
12727                this.m00 *= t;
12728                this.m01 *= t;
12729                this.m02 *= t;
12730                this.m03 *= t;
12731                this.m04 *= t;
12732                this.m05 *= t;
12733                this.m06 *= t;
12734                this.m07 *= t;
12735                this.m08 *= t;
12736                return this;
12737              }
12738              scale(t) {
12739                const e = t.x;
12740                const i = t.y;
12741                this.m00 = e * this.m00;
12742                this.m01 = e * this.m01;
12743                this.m02 = e * this.m02;
12744                this.m03 = i * this.m03;
12745                this.m04 = i * this.m04;
12746                this.m05 = i * this.m05;
12747                this.m06 = this.m06;
12748                this.m07 = this.m07;
12749                this.m08 = this.m08;
12750                return this;
12751              }
12752              rotate(t) {
12753                const e = this.m00;
12754                const i = this.m01;
12755                const s = this.m02;
12756                const n = this.m03;
12757                const r = this.m04;
12758                const o = this.m05;
12759                const a = this.m06;
12760                const l = this.m07;
12761                const h = this.m08;
12762                const c = Math.sin(t);
12763                const u = Math.cos(t);
12764                this.m00 = u * e + c * n;
12765                this.m01 = u * i + c * r;
12766                this.m02 = u * s + c * o;
12767                this.m03 = u * n - c * e;
12768                this.m04 = u * r - c * i;
12769                this.m05 = u * o - c * s;
12770                this.m06 = a;
12771                this.m07 = l;
12772                this.m08 = h;
12773                return this;
12774              }
12775              fromQuat(t) {
12776                const e = t.x;
12777                const i = t.y;
12778                const s = t.z;
12779                const n = t.w;
12780                const r = e + e;
12781                const o = i + i;
12782                const a = s + s;
12783                const l = e * r;
12784                const h = i * r;
12785                const c = i * o;
12786                const u = s * r;
12787                const _ = s * o;
12788                const d = s * a;
12789                const p = n * r;
12790                const m = n * o;
12791                const f = n * a;
12792                this.m00 = 1 - c - d;
12793                this.m03 = h - f;
12794                this.m06 = u + m;
12795                this.m01 = h + f;
12796                this.m04 = 1 - l - d;
12797                this.m07 = _ - p;
12798                this.m02 = u - m;
12799                this.m05 = _ + p;
12800                this.m08 = 1 - l - c;
12801                return this;
12802              }
12803            }
12804            t("Mat3", Fi);
12805            Fi.IDENTITY = Object.freeze(new Fi);
12806            const Vi = new Pi;
12807            const ki = new Pi;
12808            si.fastDefine("cc.Mat3", Fi, {
12809              m00: 1,
12810              m01: 0,
12811              m02: 0,
12812              m03: 0,
12813              m04: 1,
12814              m05: 0,
12815              m06: 0,
12816              m07: 0,
12817              m08: 1
12818            });
12819            m.Mat3 = Fi;
12820            class Ui extends ce {
12821              static clone(t) {
12822                return new Ui(t.x, t.y, t.z, t.w);
12823              }
12824              static copy(t, e) {
12825                t.x = e.x;
12826                t.y = e.y;
12827                t.z = e.z;
12828                t.w = e.w;
12829                return t;
12830              }
12831              static set(t, e, i, s, n) {
12832                t.x = e;
12833                t.y = i;
12834                t.z = s;
12835                t.w = n;
12836                return t;
12837              }
12838              static identity(t) {
12839                t.x = 0;
12840                t.y = 0;
12841                t.z = 0;
12842                t.w = 1;
12843                return t;
12844              }
12845              static rotationTo(t, e, i) {
12846                const s = Pi.dot(e, i);
12847                if (s < -.999999) {
12848                  Pi.cross(Hi, Pi.UNIT_X, e);
12849                  Hi.length() < 1e-6 && Pi.cross(Hi, Pi.UNIT_Y, e);
12850                  Pi.normalize(Hi, Hi);
12851                  Ui.fromAxisAngle(t, Hi, Math.PI);
12852                  return t;
12853                }
12854                if (s > .999999) {
12855                  t.x = 0;
12856                  t.y = 0;
12857                  t.z = 0;
12858                  t.w = 1;
12859                  return t;
12860                }
12861                Pi.cross(Hi, e, i);
12862                t.x = Hi.x;
12863                t.y = Hi.y;
12864                t.z = Hi.z;
12865                t.w = 1 + s;
12866                return Ui.normalize(t, t);
12867              }
12868              static getAxisAngle(t, e) {
12869                const i = 2 * Math.acos(e.w);
12870                const s = Math.sin(i / 2);
12871                if (0 !== s) {
12872                  t.x = e.x / s;
12873                  t.y = e.y / s;
12874                  t.z = e.z / s;
12875                } else {
12876                  t.x = 1;
12877                  t.y = 0;
12878                  t.z = 0;
12879                }
12880                return i;
12881              }
12882              static multiply(t, e, i) {
12883                const s = e.x * i.w + e.w * i.x + e.y * i.z - e.z * i.y;
12884                const n = e.y * i.w + e.w * i.y + e.z * i.x - e.x * i.z;
12885                const r = e.z * i.w + e.w * i.z + e.x * i.y - e.y * i.x;
12886                const o = e.w * i.w - e.x * i.x - e.y * i.y - e.z * i.z;
12887                t.x = s;
12888                t.y = n;
12889                t.z = r;
12890                t.w = o;
12891                return t;
12892              }
12893              static multiplyScalar(t, e, i) {
12894                t.x = e.x * i;
12895                t.y = e.y * i;
12896                t.z = e.z * i;
12897                t.w = e.w * i;
12898                return t;
12899              }
12900              static scaleAndAdd(t, e, i, s) {
12901                t.x = e.x + i.x * s;
12902                t.y = e.y + i.y * s;
12903                t.z = e.z + i.z * s;
12904                t.w = e.w + i.w * s;
12905                return t;
12906              }
12907              static rotateX(t, e, i) {
12908                i *= .5;
12909                const s = Math.sin(i);
12910                const n = Math.cos(i);
12911                const {x: r, y: o, z: a, w: l} = e;
12912                t.x = r * n + l * s;
12913                t.y = o * n + a * s;
12914                t.z = a * n - o * s;
12915                t.w = l * n - r * s;
12916                return t;
12917              }
12918              static rotateY(t, e, i) {
12919                i *= .5;
12920                const s = Math.sin(i);
12921                const n = Math.cos(i);
12922                const {x: r, y: o, z: a, w: l} = e;
12923                t.x = r * n - a * s;
12924                t.y = o * n + l * s;
12925                t.z = a * n + r * s;
12926                t.w = l * n - o * s;
12927                return t;
12928              }
12929              static rotateZ(t, e, i) {
12930                i *= .5;
12931                const s = Math.sin(i);
12932                const n = Math.cos(i);
12933                const {x: r, y: o, z: a, w: l} = e;
12934                t.x = r * n + o * s;
12935                t.y = o * n - r * s;
12936                t.z = a * n + l * s;
12937                t.w = l * n - a * s;
12938                return t;
12939              }
12940              static rotateAround(t, e, i, s) {
12941                Ui.invert(Gi, e);
12942                Pi.transformQuat(Hi, i, Gi);
12943                Ui.fromAxisAngle(Gi, Hi, s);
12944                Ui.multiply(t, e, Gi);
12945                return t;
12946              }
12947              static rotateAroundLocal(t, e, i, s) {
12948                Ui.fromAxisAngle(Gi, i, s);
12949                Ui.multiply(t, e, Gi);
12950                return t;
12951              }
12952              static calculateW(t, e) {
12953                t.x = e.x;
12954                t.y = e.y;
12955                t.z = e.z;
12956                t.w = Math.sqrt(Math.abs(1 - e.x * e.x - e.y * e.y - e.z * e.z));
12957                return t;
12958              }
12959              static dot(t, e) {
12960                return t.x * e.x + t.y * e.y + t.z * e.z + t.w * e.w;
12961              }
12962              static lerp(t, e, i, s) {
12963                t.x = e.x + s * (i.x - e.x);
12964                t.y = e.y + s * (i.y - e.y);
12965                t.z = e.z + s * (i.z - e.z);
12966                t.w = e.w + s * (i.w - e.w);
12967                return t;
12968              }
12969              static slerp(t, e, i, s) {
12970                let n = 0;
12971                let r = 0;
12972                let o = i.x;
12973                let a = i.y;
12974                let l = i.z;
12975                let h = i.w;
12976                let c = e.x * i.x + e.y * i.y + e.z * i.z + e.w * i.w;
12977                if (c < 0) {
12978                  c = -c;
12979                  o = -o;
12980                  a = -a;
12981                  l = -l;
12982                  h = -h;
12983                }
12984                if (1 - c > 1e-6) {
12985                  const t = Math.acos(c);
12986                  const e = Math.sin(t);
12987                  n = Math.sin((1 - s) * t) / e;
12988                  r = Math.sin(s * t) / e;
12989                } else {
12990                  n = 1 - s;
12991                  r = s;
12992                }
12993                t.x = n * e.x + r * o;
12994                t.y = n * e.y + r * a;
12995                t.z = n * e.z + r * l;
12996                t.w = n * e.w + r * h;
12997                return t;
12998              }
12999              static sqlerp(t, e, i, s, n, r) {
13000                Ui.slerp(Gi, e, n, r);
13001                Ui.slerp(zi, i, s, r);
13002                Ui.slerp(t, Gi, zi, 2 * r * (1 - r));
13003                return t;
13004              }
13005              static invert(t, e) {
13006                const i = e.x * e.x + e.y * e.y + e.z * e.z + e.w * e.w;
13007                const s = i ? 1 / i : 0;
13008                t.x = -e.x * s;
13009                t.y = -e.y * s;
13010                t.z = -e.z * s;
13011                t.w = e.w * s;
13012                return t;
13013              }
13014              static conjugate(t, e) {
13015                t.x = -e.x;
13016                t.y = -e.y;
13017                t.z = -e.z;
13018                t.w = e.w;
13019                return t;
13020              }
13021              static len(t) {
13022                return Math.sqrt(t.x * t.x + t.y * t.y + t.z * t.z + t.w * t.w);
13023              }
13024              static lengthSqr(t) {
13025                return t.x * t.x + t.y * t.y + t.z * t.z + t.w * t.w;
13026              }
13027              static normalize(t, e) {
13028                let i = e.x * e.x + e.y * e.y + e.z * e.z + e.w * e.w;
13029                if (i > 0) {
13030                  i = 1 / Math.sqrt(i);
13031                  t.x = e.x * i;
13032                  t.y = e.y * i;
13033                  t.z = e.z * i;
13034                  t.w = e.w * i;
13035                }
13036                return t;
13037              }
13038              static fromAxes(t, e, i, s) {
13039                Fi.set(ji, e.x, e.y, e.z, i.x, i.y, i.z, s.x, s.y, s.z);
13040                return Ui.normalize(t, Ui.fromMat3(t, ji));
13041              }
13042              static fromViewUp(t, e, i) {
13043                Fi.fromViewUp(ji, e, i);
13044                return Ui.normalize(t, Ui.fromMat3(t, ji));
13045              }
13046              static fromAxisAngle(t, e, i) {
13047                i *= .5;
13048                const s = Math.sin(i);
13049                t.x = s * e.x;
13050                t.y = s * e.y;
13051                t.z = s * e.z;
13052                t.w = Math.cos(i);
13053                return t;
13054              }
13055              static fromMat3(t, e) {
13056                const {m00: i, m03: s, m06: n, m01: r, m04: o, m07: a, m02: l, m05: h, m08: c} = e;
13057                const u = i + o + c;
13058                if (u > 0) {
13059                  const e = .5 / Math.sqrt(u + 1);
13060                  t.w = .25 / e;
13061                  t.x = (h - a) * e;
13062                  t.y = (n - l) * e;
13063                  t.z = (r - s) * e;
13064                } else if (i > o && i > c) {
13065                  const e = 2 * Math.sqrt(1 + i - o - c);
13066                  t.w = (h - a) / e;
13067                  t.x = .25 * e;
13068                  t.y = (s + r) / e;
13069                  t.z = (n + l) / e;
13070                } else if (o > c) {
13071                  const e = 2 * Math.sqrt(1 + o - i - c);
13072                  t.w = (n - l) / e;
13073                  t.x = (s + r) / e;
13074                  t.y = .25 * e;
13075                  t.z = (a + h) / e;
13076                } else {
13077                  const e = 2 * Math.sqrt(1 + c - i - o);
13078                  t.w = (r - s) / e;
13079                  t.x = (n + l) / e;
13080                  t.y = (a + h) / e;
13081                  t.z = .25 * e;
13082                }
13083                return t;
13084              }
13085              static fromEuler(t, e, i, s) {
13086                e *= Xi;
13087                i *= Xi;
13088                s *= Xi;
13089                const n = Math.sin(e);
13090                const r = Math.cos(e);
13091                const o = Math.sin(i);
13092                const a = Math.cos(i);
13093                const l = Math.sin(s);
13094                const h = Math.cos(s);
13095                t.x = n * a * h + r * o * l;
13096                t.y = r * o * h + n * a * l;
13097                t.z = r * a * l - n * o * h;
13098                t.w = r * a * h - n * o * l;
13099                return t;
13100              }
13101              static fromAngleZ(t, e) {
13102                e *= Xi;
13103                t.x = t.y = 0;
13104                t.z = Math.sin(e);
13105                t.w = Math.cos(e);
13106                return t;
13107              }
13108              static toAxisX(t, e) {
13109                const i = 2 * e.y;
13110                const s = 2 * e.z;
13111                t.x = 1 - i * e.y - s * e.z;
13112                t.y = i * e.x + s * e.w;
13113                t.z = s * e.x + i * e.w;
13114                return t;
13115              }
13116              static toAxisY(t, e) {
13117                const i = 2 * e.x;
13118                const s = 2 * e.y;
13119                const n = 2 * e.z;
13120                t.x = s * e.x - n * e.w;
13121                t.y = 1 - i * e.x - n * e.z;
13122                t.z = n * e.y + i * e.w;
13123                return t;
13124              }
13125              static toAxisZ(t, e) {
13126                const i = 2 * e.x;
13127                const s = 2 * e.y;
13128                const n = 2 * e.z;
13129                t.x = n * e.x - s * e.w;
13130                t.y = n * e.y - i * e.w;
13131                t.z = 1 - i * e.x - s * e.y;
13132                return t;
13133              }
13134              static toEuler(t, e, i) {
13135                const {x: s, y: n, z: r, w: o} = e;
13136                let a = 0;
13137                let l = 0;
13138                let h = 0;
13139                const c = s * n + r * o;
13140                if (c > .499999) {
13141                  a = 0;
13142                  l = fi(2 * Math.atan2(s, o));
13143                  h = 90;
13144                } else if (c < -.499999) {
13145                  a = 0;
13146                  l = -fi(2 * Math.atan2(s, o));
13147                  h = -90;
13148                } else {
13149                  const t = s * s;
13150                  const e = n * n;
13151                  const u = r * r;
13152                  a = fi(Math.atan2(2 * s * o - 2 * n * r, 1 - 2 * t - 2 * u));
13153                  l = fi(Math.atan2(2 * n * o - 2 * s * r, 1 - 2 * e - 2 * u));
13154                  h = fi(Math.asin(2 * c));
13155                  if (i) {
13156                    a = -180 * Math.sign(a + 1e-6) + a;
13157                    l = -180 * Math.sign(l + 1e-6) + l;
13158                    h = 180 * Math.sign(h + 1e-6) - h;
13159                  }
13160                }
13161                t.x = a;
13162                t.y = l;
13163                t.z = h;
13164                return t;
13165              }
13166              static toArray(t, e, i = 0) {
13167                t[i + 0] = e.x;
13168                t[i + 1] = e.y;
13169                t[i + 2] = e.z;
13170                t[i + 3] = e.w;
13171                return t;
13172              }
13173              static fromArray(t, e, i = 0) {
13174                t.x = e[i + 0];
13175                t.y = e[i + 1];
13176                t.z = e[i + 2];
13177                t.w = e[i + 3];
13178                return t;
13179              }
13180              static strictEquals(t, e) {
13181                return t.x === e.x && t.y === e.y && t.z === e.z && t.w === e.w;
13182              }
13183              static equals(t, e, i = hi) {
13184                return Math.abs(t.x - e.x) <= i * Math.max(1, Math.abs(t.x), Math.abs(e.x)) && Math.abs(t.y - e.y) <= i * Math.max(1, Math.abs(t.y), Math.abs(e.y)) && Math.abs(t.z - e.z) <= i * Math.max(1, Math.abs(t.z), Math.abs(e.z)) && Math.abs(t.w - e.w) <= i * Math.max(1, Math.abs(t.w), Math.abs(e.w));
13185              }
13186              constructor(t, e, i, s) {
13187                super();
13188                if (t && "object" == typeof t) {
13189                  this.x = t.x;
13190                  this.y = t.y;
13191                  this.z = t.z;
13192                  this.w = t.w;
13193                } else {
13194                  this.x = t || 0;
13195                  this.y = e || 0;
13196                  this.z = i || 0;
13197                  this.w = null != s ? s : 1;
13198                }
13199              }
13200              clone() {
13201                return new Ui(this.x, this.y, this.z, this.w);
13202              }
13203              set(t, e, i, s) {
13204                if (t && "object" == typeof t) {
13205                  this.x = t.x;
13206                  this.y = t.y;
13207                  this.z = t.z;
13208                  this.w = t.w;
13209                } else {
13210                  this.x = t || 0;
13211                  this.y = e || 0;
13212                  this.z = i || 0;
13213                  this.w = null != s ? s : 1;
13214                }
13215                return this;
13216              }
13217              equals(t, e = hi) {
13218                return Math.abs(this.x - t.x) <= e * Math.max(1, Math.abs(this.x), Math.abs(t.x)) && Math.abs(this.y - t.y) <= e * Math.max(1, Math.abs(this.y), Math.abs(t.y)) && Math.abs(this.z - t.z) <= e * Math.max(1, Math.abs(this.z), Math.abs(t.z)) && Math.abs(this.w - t.w) <= e * Math.max(1, Math.abs(this.w), Math.abs(t.w));
13219              }
13220              strictEquals(t) {
13221                return t && this.x === t.x && this.y === t.y && this.z === t.z && this.w === t.w;
13222              }
13223              getEulerAngles(t) {
13224                return Ui.toEuler(t, this);
13225              }
13226              lerp(t, e) {
13227                this.x += e * (t.x - this.x);
13228                this.y += e * (t.y - this.y);
13229                this.z += e * (t.z - this.z);
13230                this.w += e * (t.w - this.w);
13231                return this;
13232              }
13233              slerp(t, e) {
13234                return Ui.slerp(this, this, t, e);
13235              }
13236              length() {
13237                return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
13238              }
13239              lengthSqr() {
13240                return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
13241              }
13242            }
13243            t("Quat", Ui);
13244            Ui.IDENTITY = Object.freeze(new Ui);
13245            const Gi = new Ui;
13246            const zi = new Ui;
13247            const Hi = new Pi;
13248            const ji = new Fi;
13249            const Xi = .5 * Math.PI / 180;
13250            si.fastDefine("cc.Quat", Ui, {
13251              x: 0,
13252              y: 0,
13253              z: 0,
13254              w: 1
13255            });
13256            m.Quat = Ui;
13257            function Wi(t = 0, e = 0, i = 0, s = 1) {
13258              return new Ui(t, e, i, s);
13259            }
13260            m.quat = Wi;
13261            const Yi = Object.freeze([ Object.freeze([ 1, 0, 0, 1 ]), Object.freeze([ 0, 1, -1, 0 ]), Object.freeze([ -1, 0, 0, -1 ]), Object.freeze([ 0, -1, 1, 0 ]) ]);
13262            class qi extends ce {
13263              static clone(t) {
13264                return new qi(t.m00, t.m01, t.m02, t.m03, t.m04, t.m05, t.m06, t.m07, t.m08, t.m09, t.m10, t.m11, t.m12, t.m13, t.m14, t.m15);
13265              }
13266              static copy(t, e) {
13267                t.m00 = e.m00;
13268                t.m01 = e.m01;
13269                t.m02 = e.m02;
13270                t.m03 = e.m03;
13271                t.m04 = e.m04;
13272                t.m05 = e.m05;
13273                t.m06 = e.m06;
13274                t.m07 = e.m07;
13275                t.m08 = e.m08;
13276                t.m09 = e.m09;
13277                t.m10 = e.m10;
13278                t.m11 = e.m11;
13279                t.m12 = e.m12;
13280                t.m13 = e.m13;
13281                t.m14 = e.m14;
13282                t.m15 = e.m15;
13283                return t;
13284              }
13285              static set(t, e, i, s, n, r, o, a, l, h, c, u, _, d, p, m, f) {
13286                t.m00 = e;
13287                t.m01 = i;
13288                t.m02 = s;
13289                t.m03 = n;
13290                t.m04 = r;
13291                t.m05 = o;
13292                t.m06 = a;
13293                t.m07 = l;
13294                t.m08 = h;
13295                t.m09 = c;
13296                t.m10 = u;
13297                t.m11 = _;
13298                t.m12 = d;
13299                t.m13 = p;
13300                t.m14 = m;
13301                t.m15 = f;
13302                return t;
13303              }
13304              static identity(t) {
13305                t.m00 = 1;
13306                t.m01 = 0;
13307                t.m02 = 0;
13308                t.m03 = 0;
13309                t.m04 = 0;
13310                t.m05 = 1;
13311                t.m06 = 0;
13312                t.m07 = 0;
13313                t.m08 = 0;
13314                t.m09 = 0;
13315                t.m10 = 1;
13316                t.m11 = 0;
13317                t.m12 = 0;
13318                t.m13 = 0;
13319                t.m14 = 0;
13320                t.m15 = 1;
13321                return t;
13322              }
13323              static transpose(t, e) {
13324                if (t === e) {
13325                  const i = e.m01;
13326                  const s = e.m02;
13327                  const n = e.m03;
13328                  const r = e.m06;
13329                  const o = e.m07;
13330                  const a = e.m11;
13331                  t.m01 = e.m04;
13332                  t.m02 = e.m08;
13333                  t.m03 = e.m12;
13334                  t.m04 = i;
13335                  t.m06 = e.m09;
13336                  t.m07 = e.m13;
13337                  t.m08 = s;
13338                  t.m09 = r;
13339                  t.m11 = e.m14;
13340                  t.m12 = n;
13341                  t.m13 = o;
13342                  t.m14 = a;
13343                } else {
13344                  t.m00 = e.m00;
13345                  t.m01 = e.m04;
13346                  t.m02 = e.m08;
13347                  t.m03 = e.m12;
13348                  t.m04 = e.m01;
13349                  t.m05 = e.m05;
13350                  t.m06 = e.m09;
13351                  t.m07 = e.m13;
13352                  t.m08 = e.m02;
13353                  t.m09 = e.m06;
13354                  t.m10 = e.m10;
13355                  t.m11 = e.m14;
13356                  t.m12 = e.m03;
13357                  t.m13 = e.m07;
13358                  t.m14 = e.m11;
13359                  t.m15 = e.m15;
13360                }
13361                return t;
13362              }
13363              static invert(t, e) {
13364                const i = e.m00;
13365                const s = e.m01;
13366                const n = e.m02;
13367                const r = e.m03;
13368                const o = e.m04;
13369                const a = e.m05;
13370                const l = e.m06;
13371                const h = e.m07;
13372                const c = e.m08;
13373                const u = e.m09;
13374                const _ = e.m10;
13375                const d = e.m11;
13376                const p = e.m12;
13377                const m = e.m13;
13378                const f = e.m14;
13379                const g = e.m15;
13380                const y = i * a - s * o;
13381                const b = i * l - n * o;
13382                const S = i * h - r * o;
13383                const A = s * l - n * a;
13384                const T = s * h - r * a;
13385                const v = n * h - r * l;
13386                const E = c * m - u * p;
13387                const C = c * f - _ * p;
13388                const x = c * g - d * p;
13389                const w = u * f - _ * m;
13390                const R = u * g - d * m;
13391                const I = _ * g - d * f;
13392                let M = y * I - b * R + S * w + A * x - T * C + v * E;
13393                if (0 === M) {
13394                  t.m00 = 0;
13395                  t.m01 = 0;
13396                  t.m02 = 0;
13397                  t.m03 = 0;
13398                  t.m04 = 0;
13399                  t.m05 = 0;
13400                  t.m06 = 0;
13401                  t.m07 = 0;
13402                  t.m08 = 0;
13403                  t.m09 = 0;
13404                  t.m10 = 0;
13405                  t.m11 = 0;
13406                  t.m12 = 0;
13407                  t.m13 = 0;
13408                  t.m14 = 0;
13409                  t.m15 = 0;
13410                  return t;
13411                }
13412                M = 1 / M;
13413                t.m00 = (a * I - l * R + h * w) * M;
13414                t.m01 = (n * R - s * I - r * w) * M;
13415                t.m02 = (m * v - f * T + g * A) * M;
13416                t.m03 = (_ * T - u * v - d * A) * M;
13417                t.m04 = (l * x - o * I - h * C) * M;
13418                t.m05 = (i * I - n * x + r * C) * M;
13419                t.m06 = (f * S - p * v - g * b) * M;
13420                t.m07 = (c * v - _ * S + d * b) * M;
13421                t.m08 = (o * R - a * x + h * E) * M;
13422                t.m09 = (s * x - i * R - r * E) * M;
13423                t.m10 = (p * T - m * S + g * y) * M;
13424                t.m11 = (u * S - c * T - d * y) * M;
13425                t.m12 = (a * C - o * w - l * E) * M;
13426                t.m13 = (i * w - s * C + n * E) * M;
13427                t.m14 = (m * b - p * A - f * y) * M;
13428                t.m15 = (c * A - u * b + _ * y) * M;
13429                return t;
13430              }
13431              static determinant(t) {
13432                const e = t.m00;
13433                const i = t.m01;
13434                const s = t.m02;
13435                const n = t.m03;
13436                const r = t.m04;
13437                const o = t.m05;
13438                const a = t.m06;
13439                const l = t.m07;
13440                const h = t.m08;
13441                const c = t.m09;
13442                const u = t.m10;
13443                const _ = t.m11;
13444                const d = t.m12;
13445                const p = t.m13;
13446                const m = t.m14;
13447                const f = t.m15;
13448                return (e * o - i * r) * (u * f - _ * m) - (e * a - s * r) * (c * f - _ * p) + (e * l - n * r) * (c * m - u * p) + (i * a - s * o) * (h * f - _ * d) - (i * l - n * o) * (h * m - u * d) + (s * l - n * a) * (h * p - c * d);
13449              }
13450              static multiply(t, e, i) {
13451                const s = e.m00;
13452                const n = e.m01;
13453                const r = e.m02;
13454                const o = e.m03;
13455                const a = e.m04;
13456                const l = e.m05;
13457                const h = e.m06;
13458                const c = e.m07;
13459                const u = e.m08;
13460                const _ = e.m09;
13461                const d = e.m10;
13462                const p = e.m11;
13463                const m = e.m12;
13464                const f = e.m13;
13465                const g = e.m14;
13466                const y = e.m15;
13467                let b = i.m00;
13468                let S = i.m01;
13469                let A = i.m02;
13470                let T = i.m03;
13471                t.m00 = b * s + S * a + A * u + T * m;
13472                t.m01 = b * n + S * l + A * _ + T * f;
13473                t.m02 = b * r + S * h + A * d + T * g;
13474                t.m03 = b * o + S * c + A * p + T * y;
13475                b = i.m04;
13476                S = i.m05;
13477                A = i.m06;
13478                T = i.m07;
13479                t.m04 = b * s + S * a + A * u + T * m;
13480                t.m05 = b * n + S * l + A * _ + T * f;
13481                t.m06 = b * r + S * h + A * d + T * g;
13482                t.m07 = b * o + S * c + A * p + T * y;
13483                b = i.m08;
13484                S = i.m09;
13485                A = i.m10;
13486                T = i.m11;
13487                t.m08 = b * s + S * a + A * u + T * m;
13488                t.m09 = b * n + S * l + A * _ + T * f;
13489                t.m10 = b * r + S * h + A * d + T * g;
13490                t.m11 = b * o + S * c + A * p + T * y;
13491                b = i.m12;
13492                S = i.m13;
13493                A = i.m14;
13494                T = i.m15;
13495                t.m12 = b * s + S * a + A * u + T * m;
13496                t.m13 = b * n + S * l + A * _ + T * f;
13497                t.m14 = b * r + S * h + A * d + T * g;
13498                t.m15 = b * o + S * c + A * p + T * y;
13499                return t;
13500              }
13501              static transform(t, e, i) {
13502                const s = i.x;
13503                const n = i.y;
13504                const r = i.z;
13505                if (e === t) {
13506                  t.m12 = e.m00 * s + e.m04 * n + e.m08 * r + e.m12;
13507                  t.m13 = e.m01 * s + e.m05 * n + e.m09 * r + e.m13;
13508                  t.m14 = e.m02 * s + e.m06 * n + e.m10 * r + e.m14;
13509                  t.m15 = e.m03 * s + e.m07 * n + e.m11 * r + e.m15;
13510                } else {
13511                  const i = e.m00;
13512                  const o = e.m01;
13513                  const a = e.m02;
13514                  const l = e.m03;
13515                  const h = e.m04;
13516                  const c = e.m05;
13517                  const u = e.m06;
13518                  const _ = e.m07;
13519                  const d = e.m08;
13520                  const p = e.m09;
13521                  const m = e.m10;
13522                  const f = e.m11;
13523                  e.m12;
13524                  e.m13;
13525                  e.m14;
13526                  e.m15;
13527                  t.m00 = i;
13528                  t.m01 = o;
13529                  t.m02 = a;
13530                  t.m03 = l;
13531                  t.m04 = h;
13532                  t.m05 = c;
13533                  t.m06 = u;
13534                  t.m07 = _;
13535                  t.m08 = d;
13536                  t.m09 = p;
13537                  t.m10 = m;
13538                  t.m11 = f;
13539                  t.m12 = i * s + h * n + d * r + e.m12;
13540                  t.m13 = o * s + c * n + p * r + e.m13;
13541                  t.m14 = a * s + u * n + m * r + e.m14;
13542                  t.m15 = l * s + _ * n + f * r + e.m15;
13543                }
13544                return t;
13545              }
13546              static translate(t, e, i) {
13547                if (e === t) {
13548                  t.m12 += i.x;
13549                  t.m13 += i.y;
13550                  t.m14 += i.z;
13551                } else {
13552                  t.m00 = e.m00;
13553                  t.m01 = e.m01;
13554                  t.m02 = e.m02;
13555                  t.m03 = e.m03;
13556                  t.m04 = e.m04;
13557                  t.m05 = e.m05;
13558                  t.m06 = e.m06;
13559                  t.m07 = e.m07;
13560                  t.m08 = e.m08;
13561                  t.m09 = e.m09;
13562                  t.m10 = e.m10;
13563                  t.m11 = e.m11;
13564                  t.m12 += i.x;
13565                  t.m13 += i.y;
13566                  t.m14 += i.z;
13567                  t.m15 = e.m15;
13568                }
13569                return t;
13570              }
13571              static scale(t, e, i) {
13572                const s = i.x;
13573                const n = i.y;
13574                const r = i.z;
13575                t.m00 = e.m00 * s;
13576                t.m01 = e.m01 * s;
13577                t.m02 = e.m02 * s;
13578                t.m03 = e.m03 * s;
13579                t.m04 = e.m04 * n;
13580                t.m05 = e.m05 * n;
13581                t.m06 = e.m06 * n;
13582                t.m07 = e.m07 * n;
13583                t.m08 = e.m08 * r;
13584                t.m09 = e.m09 * r;
13585                t.m10 = e.m10 * r;
13586                t.m11 = e.m11 * r;
13587                t.m12 = e.m12;
13588                t.m13 = e.m13;
13589                t.m14 = e.m14;
13590                t.m15 = e.m15;
13591                return t;
13592              }
13593              static rotate(t, e, i, s) {
13594                let n = s.x;
13595                let r = s.y;
13596                let o = s.z;
13597                let a = Math.sqrt(n * n + r * r + o * o);
13598                if (Math.abs(a) < hi) return null;
13599                a = 1 / a;
13600                n *= a;
13601                r *= a;
13602                o *= a;
13603                const l = Math.sin(i);
13604                const h = Math.cos(i);
13605                const c = 1 - h;
13606                const u = e.m00;
13607                const _ = e.m01;
13608                const d = e.m02;
13609                const p = e.m03;
13610                const m = e.m04;
13611                const f = e.m05;
13612                const g = e.m06;
13613                const y = e.m07;
13614                const b = e.m08;
13615                const S = e.m09;
13616                const A = e.m10;
13617                const T = e.m11;
13618                const v = n * n * c + h;
13619                const E = r * n * c + o * l;
13620                const C = o * n * c - r * l;
13621                const x = n * r * c - o * l;
13622                const w = r * r * c + h;
13623                const R = o * r * c + n * l;
13624                const I = n * o * c + r * l;
13625                const M = r * o * c - n * l;
13626                const B = o * o * c + h;
13627                t.m00 = u * v + m * E + b * C;
13628                t.m01 = _ * v + f * E + S * C;
13629                t.m02 = d * v + g * E + A * C;
13630                t.m03 = p * v + y * E + T * C;
13631                t.m04 = u * x + m * w + b * R;
13632                t.m05 = _ * x + f * w + S * R;
13633                t.m06 = d * x + g * w + A * R;
13634                t.m07 = p * x + y * w + T * R;
13635                t.m08 = u * I + m * M + b * B;
13636                t.m09 = _ * I + f * M + S * B;
13637                t.m10 = d * I + g * M + A * B;
13638                t.m11 = p * I + y * M + T * B;
13639                if (e !== t) {
13640                  t.m12 = e.m12;
13641                  t.m13 = e.m13;
13642                  t.m14 = e.m14;
13643                  t.m15 = e.m15;
13644                }
13645                return t;
13646              }
13647              static rotateX(t, e, i) {
13648                const s = Math.sin(i);
13649                const n = Math.cos(i);
13650                const r = e.m04;
13651                const o = e.m05;
13652                const a = e.m06;
13653                const l = e.m07;
13654                const h = e.m08;
13655                const c = e.m09;
13656                const u = e.m10;
13657                const _ = e.m11;
13658                if (e !== t) {
13659                  t.m00 = e.m00;
13660                  t.m01 = e.m01;
13661                  t.m02 = e.m02;
13662                  t.m03 = e.m03;
13663                  t.m12 = e.m12;
13664                  t.m13 = e.m13;
13665                  t.m14 = e.m14;
13666                  t.m15 = e.m15;
13667                }
13668                t.m04 = r * n + h * s;
13669                t.m05 = o * n + c * s;
13670                t.m06 = a * n + u * s;
13671                t.m07 = l * n + _ * s;
13672                t.m08 = h * n - r * s;
13673                t.m09 = c * n - o * s;
13674                t.m10 = u * n - a * s;
13675                t.m11 = _ * n - l * s;
13676                return t;
13677              }
13678              static rotateY(t, e, i) {
13679                const s = Math.sin(i);
13680                const n = Math.cos(i);
13681                const r = e.m00;
13682                const o = e.m01;
13683                const a = e.m02;
13684                const l = e.m03;
13685                const h = e.m08;
13686                const c = e.m09;
13687                const u = e.m10;
13688                const _ = e.m11;
13689                if (e !== t) {
13690                  t.m04 = e.m04;
13691                  t.m05 = e.m05;
13692                  t.m06 = e.m06;
13693                  t.m07 = e.m07;
13694                  t.m12 = e.m12;
13695                  t.m13 = e.m13;
13696                  t.m14 = e.m14;
13697                  t.m15 = e.m15;
13698                }
13699                t.m00 = r * n - h * s;
13700                t.m01 = o * n - c * s;
13701                t.m02 = a * n - u * s;
13702                t.m03 = l * n - _ * s;
13703                t.m08 = r * s + h * n;
13704                t.m09 = o * s + c * n;
13705                t.m10 = a * s + u * n;
13706                t.m11 = l * s + _ * n;
13707                return t;
13708              }
13709              static rotateZ(t, e, i) {
13710                const s = Math.sin(i);
13711                const n = Math.cos(i);
13712                const r = e.m00;
13713                const o = e.m01;
13714                const a = e.m02;
13715                const l = e.m03;
13716                const h = e.m04;
13717                const c = e.m05;
13718                const u = e.m06;
13719                const _ = e.m07;
13720                if (e !== t) {
13721                  t.m08 = e.m08;
13722                  t.m09 = e.m09;
13723                  t.m10 = e.m10;
13724                  t.m11 = e.m11;
13725                  t.m12 = e.m12;
13726                  t.m13 = e.m13;
13727                  t.m14 = e.m14;
13728                  t.m15 = e.m15;
13729                }
13730                t.m00 = r * n + h * s;
13731                t.m01 = o * n + c * s;
13732                t.m02 = a * n + u * s;
13733                t.m03 = l * n + _ * s;
13734                t.m04 = h * n - r * s;
13735                t.m05 = c * n - o * s;
13736                t.m06 = u * n - a * s;
13737                t.m07 = _ * n - l * s;
13738                return t;
13739              }
13740              static fromTranslation(t, e) {
13741                t.m00 = 1;
13742                t.m01 = 0;
13743                t.m02 = 0;
13744                t.m03 = 0;
13745                t.m04 = 0;
13746                t.m05 = 1;
13747                t.m06 = 0;
13748                t.m07 = 0;
13749                t.m08 = 0;
13750                t.m09 = 0;
13751                t.m10 = 1;
13752                t.m11 = 0;
13753                t.m12 = e.x;
13754                t.m13 = e.y;
13755                t.m14 = e.z;
13756                t.m15 = 1;
13757                return t;
13758              }
13759              static fromScaling(t, e) {
13760                t.m00 = e.x;
13761                t.m01 = 0;
13762                t.m02 = 0;
13763                t.m03 = 0;
13764                t.m04 = 0;
13765                t.m05 = e.y;
13766                t.m06 = 0;
13767                t.m07 = 0;
13768                t.m08 = 0;
13769                t.m09 = 0;
13770                t.m10 = e.z;
13771                t.m11 = 0;
13772                t.m12 = 0;
13773                t.m13 = 0;
13774                t.m14 = 0;
13775                t.m15 = 1;
13776                return t;
13777              }
13778              static fromRotation(t, e, i) {
13779                let s = i.x;
13780                let n = i.y;
13781                let r = i.z;
13782                let o = Math.sqrt(s * s + n * n + r * r);
13783                if (Math.abs(o) < hi) return null;
13784                o = 1 / o;
13785                s *= o;
13786                n *= o;
13787                r *= o;
13788                const a = Math.sin(e);
13789                const l = Math.cos(e);
13790                const h = 1 - l;
13791                t.m00 = s * s * h + l;
13792                t.m01 = n * s * h + r * a;
13793                t.m02 = r * s * h - n * a;
13794                t.m03 = 0;
13795                t.m04 = s * n * h - r * a;
13796                t.m05 = n * n * h + l;
13797                t.m06 = r * n * h + s * a;
13798                t.m07 = 0;
13799                t.m08 = s * r * h + n * a;
13800                t.m09 = n * r * h - s * a;
13801                t.m10 = r * r * h + l;
13802                t.m11 = 0;
13803                t.m12 = 0;
13804                t.m13 = 0;
13805                t.m14 = 0;
13806                t.m15 = 1;
13807                return t;
13808              }
13809              static fromXRotation(t, e) {
13810                const i = Math.sin(e);
13811                const s = Math.cos(e);
13812                t.m00 = 1;
13813                t.m01 = 0;
13814                t.m02 = 0;
13815                t.m03 = 0;
13816                t.m04 = 0;
13817                t.m05 = s;
13818                t.m06 = i;
13819                t.m07 = 0;
13820                t.m08 = 0;
13821                t.m09 = -i;
13822                t.m10 = s;
13823                t.m11 = 0;
13824                t.m12 = 0;
13825                t.m13 = 0;
13826                t.m14 = 0;
13827                t.m15 = 1;
13828                return t;
13829              }
13830              static fromYRotation(t, e) {
13831                const i = Math.sin(e);
13832                const s = Math.cos(e);
13833                t.m00 = s;
13834                t.m01 = 0;
13835                t.m02 = -i;
13836                t.m03 = 0;
13837                t.m04 = 0;
13838                t.m05 = 1;
13839                t.m06 = 0;
13840                t.m07 = 0;
13841                t.m08 = i;
13842                t.m09 = 0;
13843                t.m10 = s;
13844                t.m11 = 0;
13845                t.m12 = 0;
13846                t.m13 = 0;
13847                t.m14 = 0;
13848                t.m15 = 1;
13849                return t;
13850              }
13851              static fromZRotation(t, e) {
13852                const i = Math.sin(e);
13853                const s = Math.cos(e);
13854                t.m00 = s;
13855                t.m01 = i;
13856                t.m02 = 0;
13857                t.m03 = 0;
13858                t.m04 = -i;
13859                t.m05 = s;
13860                t.m06 = 0;
13861                t.m07 = 0;
13862                t.m08 = 0;
13863                t.m09 = 0;
13864                t.m10 = 1;
13865                t.m11 = 0;
13866                t.m12 = 0;
13867                t.m13 = 0;
13868                t.m14 = 0;
13869                t.m15 = 1;
13870                return t;
13871              }
13872              static fromRT(t, e, i) {
13873                const s = e.x;
13874                const n = e.y;
13875                const r = e.z;
13876                const o = e.w;
13877                const a = s + s;
13878                const l = n + n;
13879                const h = r + r;
13880                const c = s * a;
13881                const u = s * l;
13882                const _ = s * h;
13883                const d = n * l;
13884                const p = n * h;
13885                const m = r * h;
13886                const f = o * a;
13887                const g = o * l;
13888                const y = o * h;
13889                t.m00 = 1 - (d + m);
13890                t.m01 = u + y;
13891                t.m02 = _ - g;
13892                t.m03 = 0;
13893                t.m04 = u - y;
13894                t.m05 = 1 - (c + m);
13895                t.m06 = p + f;
13896                t.m07 = 0;
13897                t.m08 = _ + g;
13898                t.m09 = p - f;
13899                t.m10 = 1 - (c + d);
13900                t.m11 = 0;
13901                t.m12 = i.x;
13902                t.m13 = i.y;
13903                t.m14 = i.z;
13904                t.m15 = 1;
13905                return t;
13906              }
13907              static getTranslation(t, e) {
13908                t.x = e.m12;
13909                t.y = e.m13;
13910                t.z = e.m14;
13911                return t;
13912              }
13913              static getScaling(t, e) {
13914                const i = Ji.m00 = e.m00;
13915                const s = Ji.m01 = e.m01;
13916                const n = Ji.m02 = e.m02;
13917                const r = Ji.m03 = e.m04;
13918                const o = Ji.m04 = e.m05;
13919                const a = Ji.m05 = e.m06;
13920                const l = Ji.m06 = e.m08;
13921                const h = Ji.m07 = e.m09;
13922                const c = Ji.m08 = e.m10;
13923                t.x = Math.sqrt(i * i + s * s + n * n);
13924                t.y = Math.sqrt(r * r + o * o + a * a);
13925                t.z = Math.sqrt(l * l + h * h + c * c);
13926                Fi.determinant(Ji) < 0 && (t.x *= -1);
13927                return t;
13928              }
13929              static getRotation(t, e) {
13930                const i = e.m00 + e.m05 + e.m10;
13931                let s = 0;
13932                if (i > 0) {
13933                  s = 2 * Math.sqrt(i + 1);
13934                  t.w = .25 * s;
13935                  t.x = (e.m06 - e.m09) / s;
13936                  t.y = (e.m08 - e.m02) / s;
13937                  t.z = (e.m01 - e.m04) / s;
13938                } else if (e.m00 > e.m05 && e.m00 > e.m10) {
13939                  s = 2 * Math.sqrt(1 + e.m00 - e.m05 - e.m10);
13940                  t.w = (e.m06 - e.m09) / s;
13941                  t.x = .25 * s;
13942                  t.y = (e.m01 + e.m04) / s;
13943                  t.z = (e.m08 + e.m02) / s;
13944                } else if (e.m05 > e.m10) {
13945                  s = 2 * Math.sqrt(1 + e.m05 - e.m00 - e.m10);
13946                  t.w = (e.m08 - e.m02) / s;
13947                  t.x = (e.m01 + e.m04) / s;
13948                  t.y = .25 * s;
13949                  t.z = (e.m06 + e.m09) / s;
13950                } else {
13951                  s = 2 * Math.sqrt(1 + e.m10 - e.m00 - e.m05);
13952                  t.w = (e.m01 - e.m04) / s;
13953                  t.x = (e.m08 + e.m02) / s;
13954                  t.y = (e.m06 + e.m09) / s;
13955                  t.z = .25 * s;
13956                }
13957                return t;
13958              }
13959              static toRTS(t, e, i, s) {
13960                s.x = Pi.set(Ki, t.m00, t.m01, t.m02).length();
13961                Ji.m00 = t.m00 / s.x;
13962                Ji.m01 = t.m01 / s.x;
13963                Ji.m02 = t.m02 / s.x;
13964                s.y = Pi.set(Ki, t.m04, t.m05, t.m06).length();
13965                Ji.m03 = t.m04 / s.y;
13966                Ji.m04 = t.m05 / s.y;
13967                Ji.m05 = t.m06 / s.y;
13968                s.z = Pi.set(Ki, t.m08, t.m09, t.m10).length();
13969                Ji.m06 = t.m08 / s.z;
13970                Ji.m07 = t.m09 / s.z;
13971                Ji.m08 = t.m10 / s.z;
13972                if (Fi.determinant(Ji) < 0) {
13973                  s.x *= -1;
13974                  Ji.m00 *= -1;
13975                  Ji.m01 *= -1;
13976                  Ji.m02 *= -1;
13977                }
13978                Ui.fromMat3(e, Ji);
13979                Pi.set(i, t.m12, t.m13, t.m14);
13980              }
13981              static fromRTS(t, e, i, s) {
13982                const n = e.x;
13983                const r = e.y;
13984                const o = e.z;
13985                const a = e.w;
13986                const l = n + n;
13987                const h = r + r;
13988                const c = o + o;
13989                const u = n * l;
13990                const _ = n * h;
13991                const d = n * c;
13992                const p = r * h;
13993                const m = r * c;
13994                const f = o * c;
13995                const g = a * l;
13996                const y = a * h;
13997                const b = a * c;
13998                const S = s.x;
13999                const A = s.y;
14000                const T = s.z;
14001                t.m00 = (1 - (p + f)) * S;
14002                t.m01 = (_ + b) * S;
14003                t.m02 = (d - y) * S;
14004                t.m03 = 0;
14005                t.m04 = (_ - b) * A;
14006                t.m05 = (1 - (u + f)) * A;
14007                t.m06 = (m + g) * A;
14008                t.m07 = 0;
14009                t.m08 = (d + y) * T;
14010                t.m09 = (m - g) * T;
14011                t.m10 = (1 - (u + p)) * T;
14012                t.m11 = 0;
14013                t.m12 = i.x;
14014                t.m13 = i.y;
14015                t.m14 = i.z;
14016                t.m15 = 1;
14017                return t;
14018              }
14019              static fromRTSOrigin(t, e, i, s, n) {
14020                const r = e.x;
14021                const o = e.y;
14022                const a = e.z;
14023                const l = e.w;
14024                const h = r + r;
14025                const c = o + o;
14026                const u = a + a;
14027                const _ = r * h;
14028                const d = r * c;
14029                const p = r * u;
14030                const m = o * c;
14031                const f = o * u;
14032                const g = a * u;
14033                const y = l * h;
14034                const b = l * c;
14035                const S = l * u;
14036                const A = s.x;
14037                const T = s.y;
14038                const v = s.z;
14039                const E = n.x;
14040                const C = n.y;
14041                const x = n.z;
14042                t.m00 = (1 - (m + g)) * A;
14043                t.m01 = (d + S) * A;
14044                t.m02 = (p - b) * A;
14045                t.m03 = 0;
14046                t.m04 = (d - S) * T;
14047                t.m05 = (1 - (_ + g)) * T;
14048                t.m06 = (f + y) * T;
14049                t.m07 = 0;
14050                t.m08 = (p + b) * v;
14051                t.m09 = (f - y) * v;
14052                t.m10 = (1 - (_ + m)) * v;
14053                t.m11 = 0;
14054                t.m12 = i.x + E - (t.m00 * E + t.m04 * C + t.m08 * x);
14055                t.m13 = i.y + C - (t.m01 * E + t.m05 * C + t.m09 * x);
14056                t.m14 = i.z + x - (t.m02 * E + t.m06 * C + t.m10 * x);
14057                t.m15 = 1;
14058                return t;
14059              }
14060              static fromQuat(t, e) {
14061                const i = e.x;
14062                const s = e.y;
14063                const n = e.z;
14064                const r = e.w;
14065                const o = i + i;
14066                const a = s + s;
14067                const l = n + n;
14068                const h = i * o;
14069                const c = s * o;
14070                const u = s * a;
14071                const _ = n * o;
14072                const d = n * a;
14073                const p = n * l;
14074                const m = r * o;
14075                const f = r * a;
14076                const g = r * l;
14077                t.m00 = 1 - u - p;
14078                t.m01 = c + g;
14079                t.m02 = _ - f;
14080                t.m03 = 0;
14081                t.m04 = c - g;
14082                t.m05 = 1 - h - p;
14083                t.m06 = d + m;
14084                t.m07 = 0;
14085                t.m08 = _ + f;
14086                t.m09 = d - m;
14087                t.m10 = 1 - h - u;
14088                t.m11 = 0;
14089                t.m12 = 0;
14090                t.m13 = 0;
14091                t.m14 = 0;
14092                t.m15 = 1;
14093                return t;
14094              }
14095              static frustum(t, e, i, s, n, r, o) {
14096                const a = 1 / (i - e);
14097                const l = 1 / (n - s);
14098                const h = 1 / (r - o);
14099                t.m00 = 2 * r * a;
14100                t.m01 = 0;
14101                t.m02 = 0;
14102                t.m03 = 0;
14103                t.m04 = 0;
14104                t.m05 = 2 * r * l;
14105                t.m06 = 0;
14106                t.m07 = 0;
14107                t.m08 = (i + e) * a;
14108                t.m09 = (n + s) * l;
14109                t.m10 = (o + r) * h;
14110                t.m11 = -1;
14111                t.m12 = 0;
14112                t.m13 = 0;
14113                t.m14 = o * r * 2 * h;
14114                t.m15 = 0;
14115                return t;
14116              }
14117              static perspective(t, e, i, s, n, r = !0, o = -1, a = 1, l = 0) {
14118                const h = 1 / Math.tan(e / 2);
14119                const c = 1 / (s - n);
14120                const u = r ? h / i : h;
14121                const _ = (r ? h : h * i) * a;
14122                const d = Yi[l];
14123                t.m00 = u * d[0];
14124                t.m01 = u * d[1];
14125                t.m02 = 0;
14126                t.m03 = 0;
14127                t.m04 = _ * d[2];
14128                t.m05 = _ * d[3];
14129                t.m06 = 0;
14130                t.m07 = 0;
14131                t.m08 = 0;
14132                t.m09 = 0;
14133                t.m10 = (n - o * s) * c;
14134                t.m11 = -1;
14135                t.m12 = 0;
14136                t.m13 = 0;
14137                t.m14 = n * s * c * (1 - o);
14138                t.m15 = 0;
14139                return t;
14140              }
14141              static ortho(t, e, i, s, n, r, o, a = -1, l = 1, h = 0) {
14142                const c = 1 / (e - i);
14143                const u = 1 / (s - n) * l;
14144                const _ = 1 / (r - o);
14145                const d = -2 * c;
14146                const p = -2 * u;
14147                const m = (e + i) * c;
14148                const f = (n + s) * u;
14149                const g = Yi[h];
14150                t.m00 = d * g[0];
14151                t.m01 = d * g[1];
14152                t.m02 = 0;
14153                t.m03 = 0;
14154                t.m04 = p * g[2];
14155                t.m05 = p * g[3];
14156                t.m06 = 0;
14157                t.m07 = 0;
14158                t.m08 = 0;
14159                t.m09 = 0;
14160                t.m10 = _ * (1 - a);
14161                t.m11 = 0;
14162                t.m12 = m * g[0] + f * g[2];
14163                t.m13 = m * g[1] + f * g[3];
14164                t.m14 = (r - a * o) * _;
14165                t.m15 = 1;
14166                return t;
14167              }
14168              static lookAt(t, e, i, s) {
14169                const n = e.x;
14170                const r = e.y;
14171                const o = e.z;
14172                const a = s.x;
14173                const l = s.y;
14174                const h = s.z;
14175                let c = n - i.x;
14176                let u = r - i.y;
14177                let _ = o - i.z;
14178                let d = 1 / Math.sqrt(c * c + u * u + _ * _);
14179                c *= d;
14180                u *= d;
14181                _ *= d;
14182                let p = l * _ - h * u;
14183                let m = h * c - a * _;
14184                let f = a * u - l * c;
14185                d = 1 / Math.sqrt(p * p + m * m + f * f);
14186                p *= d;
14187                m *= d;
14188                f *= d;
14189                const g = u * f - _ * m;
14190                const y = _ * p - c * f;
14191                const b = c * m - u * p;
14192                t.m00 = p;
14193                t.m01 = g;
14194                t.m02 = c;
14195                t.m03 = 0;
14196                t.m04 = m;
14197                t.m05 = y;
14198                t.m06 = u;
14199                t.m07 = 0;
14200                t.m08 = f;
14201                t.m09 = b;
14202                t.m10 = _;
14203                t.m11 = 0;
14204                t.m12 = -(p * n + m * r + f * o);
14205                t.m13 = -(g * n + y * r + b * o);
14206                t.m14 = -(c * n + u * r + _ * o);
14207                t.m15 = 1;
14208                return t;
14209              }
14210              static inverseTranspose(t, e) {
14211                const i = e.m00;
14212                const s = e.m01;
14213                const n = e.m02;
14214                const r = e.m03;
14215                const o = e.m04;
14216                const a = e.m05;
14217                const l = e.m06;
14218                const h = e.m07;
14219                const c = e.m08;
14220                const u = e.m09;
14221                const _ = e.m10;
14222                const d = e.m11;
14223                const p = e.m12;
14224                const m = e.m13;
14225                const f = e.m14;
14226                const g = e.m15;
14227                const y = i * a - s * o;
14228                const b = i * l - n * o;
14229                const S = i * h - r * o;
14230                const A = s * l - n * a;
14231                const T = s * h - r * a;
14232                const v = n * h - r * l;
14233                const E = c * m - u * p;
14234                const C = c * f - _ * p;
14235                const x = c * g - d * p;
14236                const w = u * f - _ * m;
14237                const R = u * g - d * m;
14238                const I = _ * g - d * f;
14239                let M = y * I - b * R + S * w + A * x - T * C + v * E;
14240                if (!M) return null;
14241                M = 1 / M;
14242                t.m00 = (a * I - l * R + h * w) * M;
14243                t.m01 = (l * x - o * I - h * C) * M;
14244                t.m02 = (o * R - a * x + h * E) * M;
14245                t.m03 = 0;
14246                t.m04 = (n * R - s * I - r * w) * M;
14247                t.m05 = (i * I - n * x + r * C) * M;
14248                t.m06 = (s * x - i * R - r * E) * M;
14249                t.m07 = 0;
14250                t.m08 = (m * v - f * T + g * A) * M;
14251                t.m09 = (f * S - p * v - g * b) * M;
14252                t.m10 = (p * T - m * S + g * y) * M;
14253                t.m11 = 0;
14254                t.m12 = 0;
14255                t.m13 = 0;
14256                t.m14 = 0;
14257                t.m15 = 1;
14258                return t;
14259              }
14260              static toArray(t, e, i = 0) {
14261                t[i + 0] = e.m00;
14262                t[i + 1] = e.m01;
14263                t[i + 2] = e.m02;
14264                t[i + 3] = e.m03;
14265                t[i + 4] = e.m04;
14266                t[i + 5] = e.m05;
14267                t[i + 6] = e.m06;
14268                t[i + 7] = e.m07;
14269                t[i + 8] = e.m08;
14270                t[i + 9] = e.m09;
14271                t[i + 10] = e.m10;
14272                t[i + 11] = e.m11;
14273                t[i + 12] = e.m12;
14274                t[i + 13] = e.m13;
14275                t[i + 14] = e.m14;
14276                t[i + 15] = e.m15;
14277                return t;
14278              }
14279              static fromArray(t, e, i = 0) {
14280                t.m00 = e[i + 0];
14281                t.m01 = e[i + 1];
14282                t.m02 = e[i + 2];
14283                t.m03 = e[i + 3];
14284                t.m04 = e[i + 4];
14285                t.m05 = e[i + 5];
14286                t.m06 = e[i + 6];
14287                t.m07 = e[i + 7];
14288                t.m08 = e[i + 8];
14289                t.m09 = e[i + 9];
14290                t.m10 = e[i + 10];
14291                t.m11 = e[i + 11];
14292                t.m12 = e[i + 12];
14293                t.m13 = e[i + 13];
14294                t.m14 = e[i + 14];
14295                t.m15 = e[i + 15];
14296                return t;
14297              }
14298              static add(t, e, i) {
14299                t.m00 = e.m00 + i.m00;
14300                t.m01 = e.m01 + i.m01;
14301                t.m02 = e.m02 + i.m02;
14302                t.m03 = e.m03 + i.m03;
14303                t.m04 = e.m04 + i.m04;
14304                t.m05 = e.m05 + i.m05;
14305                t.m06 = e.m06 + i.m06;
14306                t.m07 = e.m07 + i.m07;
14307                t.m08 = e.m08 + i.m08;
14308                t.m09 = e.m09 + i.m09;
14309                t.m10 = e.m10 + i.m10;
14310                t.m11 = e.m11 + i.m11;
14311                t.m12 = e.m12 + i.m12;
14312                t.m13 = e.m13 + i.m13;
14313                t.m14 = e.m14 + i.m14;
14314                t.m15 = e.m15 + i.m15;
14315                return t;
14316              }
14317              static subtract(t, e, i) {
14318                t.m00 = e.m00 - i.m00;
14319                t.m01 = e.m01 - i.m01;
14320                t.m02 = e.m02 - i.m02;
14321                t.m03 = e.m03 - i.m03;
14322                t.m04 = e.m04 - i.m04;
14323                t.m05 = e.m05 - i.m05;
14324                t.m06 = e.m06 - i.m06;
14325                t.m07 = e.m07 - i.m07;
14326                t.m08 = e.m08 - i.m08;
14327                t.m09 = e.m09 - i.m09;
14328                t.m10 = e.m10 - i.m10;
14329                t.m11 = e.m11 - i.m11;
14330                t.m12 = e.m12 - i.m12;
14331                t.m13 = e.m13 - i.m13;
14332                t.m14 = e.m14 - i.m14;
14333                t.m15 = e.m15 - i.m15;
14334                return t;
14335              }
14336              static multiplyScalar(t, e, i) {
14337                t.m00 = e.m00 * i;
14338                t.m01 = e.m01 * i;
14339                t.m02 = e.m02 * i;
14340                t.m03 = e.m03 * i;
14341                t.m04 = e.m04 * i;
14342                t.m05 = e.m05 * i;
14343                t.m06 = e.m06 * i;
14344                t.m07 = e.m07 * i;
14345                t.m08 = e.m08 * i;
14346                t.m09 = e.m09 * i;
14347                t.m10 = e.m10 * i;
14348                t.m11 = e.m11 * i;
14349                t.m12 = e.m12 * i;
14350                t.m13 = e.m13 * i;
14351                t.m14 = e.m14 * i;
14352                t.m15 = e.m15 * i;
14353                return t;
14354              }
14355              static multiplyScalarAndAdd(t, e, i, s) {
14356                t.m00 = e.m00 + i.m00 * s;
14357                t.m01 = e.m01 + i.m01 * s;
14358                t.m02 = e.m02 + i.m02 * s;
14359                t.m03 = e.m03 + i.m03 * s;
14360                t.m04 = e.m04 + i.m04 * s;
14361                t.m05 = e.m05 + i.m05 * s;
14362                t.m06 = e.m06 + i.m06 * s;
14363                t.m07 = e.m07 + i.m07 * s;
14364                t.m08 = e.m08 + i.m08 * s;
14365                t.m09 = e.m09 + i.m09 * s;
14366                t.m10 = e.m10 + i.m10 * s;
14367                t.m11 = e.m11 + i.m11 * s;
14368                t.m12 = e.m12 + i.m12 * s;
14369                t.m13 = e.m13 + i.m13 * s;
14370                t.m14 = e.m14 + i.m14 * s;
14371                t.m15 = e.m15 + i.m15 * s;
14372                return t;
14373              }
14374              static strictEquals(t, e) {
14375                return t.m00 === e.m00 && t.m01 === e.m01 && t.m02 === e.m02 && t.m03 === e.m03 && t.m04 === e.m04 && t.m05 === e.m05 && t.m06 === e.m06 && t.m07 === e.m07 && t.m08 === e.m08 && t.m09 === e.m09 && t.m10 === e.m10 && t.m11 === e.m11 && t.m12 === e.m12 && t.m13 === e.m13 && t.m14 === e.m14 && t.m15 === e.m15;
14376              }
14377              static equals(t, e, i = hi) {
14378                return Math.abs(t.m00 - e.m00) <= i * Math.max(1, Math.abs(t.m00), Math.abs(e.m00)) && Math.abs(t.m01 - e.m01) <= i * Math.max(1, Math.abs(t.m01), Math.abs(e.m01)) && Math.abs(t.m02 - e.m02) <= i * Math.max(1, Math.abs(t.m02), Math.abs(e.m02)) && Math.abs(t.m03 - e.m03) <= i * Math.max(1, Math.abs(t.m03), Math.abs(e.m03)) && Math.abs(t.m04 - e.m04) <= i * Math.max(1, Math.abs(t.m04), Math.abs(e.m04)) && Math.abs(t.m05 - e.m05) <= i * Math.max(1, Math.abs(t.m05), Math.abs(e.m05)) && Math.abs(t.m06 - e.m06) <= i * Math.max(1, Math.abs(t.m06), Math.abs(e.m06)) && Math.abs(t.m07 - e.m07) <= i * Math.max(1, Math.abs(t.m07), Math.abs(e.m07)) && Math.abs(t.m08 - e.m08) <= i * Math.max(1, Math.abs(t.m08), Math.abs(e.m08)) && Math.abs(t.m09 - e.m09) <= i * Math.max(1, Math.abs(t.m09), Math.abs(e.m09)) && Math.abs(t.m10 - e.m10) <= i * Math.max(1, Math.abs(t.m10), Math.abs(e.m10)) && Math.abs(t.m11 - e.m11) <= i * Math.max(1, Math.abs(t.m11), Math.abs(e.m11)) && Math.abs(t.m12 - e.m12) <= i * Math.max(1, Math.abs(t.m12), Math.abs(e.m12)) && Math.abs(t.m13 - e.m13) <= i * Math.max(1, Math.abs(t.m13), Math.abs(e.m13)) && Math.abs(t.m14 - e.m14) <= i * Math.max(1, Math.abs(t.m14), Math.abs(e.m14)) && Math.abs(t.m15 - e.m15) <= i * Math.max(1, Math.abs(t.m15), Math.abs(e.m15));
14379              }
14380              constructor(t = 1, e = 0, i = 0, s = 0, n = 0, r = 1, o = 0, a = 0, l = 0, h = 0, c = 1, u = 0, _ = 0, d = 0, p = 0, m = 1) {
14381                super();
14382                this.m00 = void 0;
14383                this.m01 = void 0;
14384                this.m02 = void 0;
14385                this.m03 = void 0;
14386                this.m04 = void 0;
14387                this.m05 = void 0;
14388                this.m06 = void 0;
14389                this.m07 = void 0;
14390                this.m08 = void 0;
14391                this.m09 = void 0;
14392                this.m10 = void 0;
14393                this.m11 = void 0;
14394                this.m12 = void 0;
14395                this.m13 = void 0;
14396                this.m14 = void 0;
14397                this.m15 = void 0;
14398                if ("object" == typeof t) {
14399                  this.m00 = t.m00;
14400                  this.m01 = t.m01;
14401                  this.m02 = t.m02;
14402                  this.m03 = t.m03;
14403                  this.m04 = t.m04;
14404                  this.m05 = t.m05;
14405                  this.m06 = t.m06;
14406                  this.m07 = t.m07;
14407                  this.m08 = t.m08;
14408                  this.m09 = t.m09;
14409                  this.m10 = t.m10;
14410                  this.m11 = t.m11;
14411                  this.m12 = t.m12;
14412                  this.m13 = t.m13;
14413                  this.m14 = t.m14;
14414                  this.m15 = t.m15;
14415                } else {
14416                  this.m00 = t;
14417                  this.m01 = e;
14418                  this.m02 = i;
14419                  this.m03 = s;
14420                  this.m04 = n;
14421                  this.m05 = r;
14422                  this.m06 = o;
14423                  this.m07 = a;
14424                  this.m08 = l;
14425                  this.m09 = h;
14426                  this.m10 = c;
14427                  this.m11 = u;
14428                  this.m12 = _;
14429                  this.m13 = d;
14430                  this.m14 = p;
14431                  this.m15 = m;
14432                }
14433              }
14434              clone() {
14435                return new qi(this.m00, this.m01, this.m02, this.m03, this.m04, this.m05, this.m06, this.m07, this.m08, this.m09, this.m10, this.m11, this.m12, this.m13, this.m14, this.m15);
14436              }
14437              set(t = 1, e = 0, i = 0, s = 0, n = 0, r = 1, o = 0, a = 0, l = 0, h = 0, c = 1, u = 0, _ = 0, d = 0, p = 0, m = 1) {
14438                if ("object" == typeof t) {
14439                  this.m01 = t.m01;
14440                  this.m02 = t.m02;
14441                  this.m03 = t.m03;
14442                  this.m04 = t.m04;
14443                  this.m05 = t.m05;
14444                  this.m06 = t.m06;
14445                  this.m07 = t.m07;
14446                  this.m08 = t.m08;
14447                  this.m09 = t.m09;
14448                  this.m10 = t.m10;
14449                  this.m11 = t.m11;
14450                  this.m12 = t.m12;
14451                  this.m13 = t.m13;
14452                  this.m14 = t.m14;
14453                  this.m15 = t.m15;
14454                  this.m00 = t.m00;
14455                } else {
14456                  this.m01 = e;
14457                  this.m02 = i;
14458                  this.m03 = s;
14459                  this.m04 = n;
14460                  this.m05 = r;
14461                  this.m06 = o;
14462                  this.m07 = a;
14463                  this.m08 = l;
14464                  this.m09 = h;
14465                  this.m10 = c;
14466                  this.m11 = u;
14467                  this.m12 = _;
14468                  this.m13 = d;
14469                  this.m14 = p;
14470                  this.m15 = m;
14471                  this.m00 = t;
14472                }
14473                return this;
14474              }
14475              equals(t, e = hi) {
14476                return Math.abs(this.m00 - t.m00) <= e * Math.max(1, Math.abs(this.m00), Math.abs(t.m00)) && Math.abs(this.m01 - t.m01) <= e * Math.max(1, Math.abs(this.m01), Math.abs(t.m01)) && Math.abs(this.m02 - t.m02) <= e * Math.max(1, Math.abs(this.m02), Math.abs(t.m02)) && Math.abs(this.m03 - t.m03) <= e * Math.max(1, Math.abs(this.m03), Math.abs(t.m03)) && Math.abs(this.m04 - t.m04) <= e * Math.max(1, Math.abs(this.m04), Math.abs(t.m04)) && Math.abs(this.m05 - t.m05) <= e * Math.max(1, Math.abs(this.m05), Math.abs(t.m05)) && Math.abs(this.m06 - t.m06) <= e * Math.max(1, Math.abs(this.m06), Math.abs(t.m06)) && Math.abs(this.m07 - t.m07) <= e * Math.max(1, Math.abs(this.m07), Math.abs(t.m07)) && Math.abs(this.m08 - t.m08) <= e * Math.max(1, Math.abs(this.m08), Math.abs(t.m08)) && Math.abs(this.m09 - t.m09) <= e * Math.max(1, Math.abs(this.m09), Math.abs(t.m09)) && Math.abs(this.m10 - t.m10) <= e * Math.max(1, Math.abs(this.m10), Math.abs(t.m10)) && Math.abs(this.m11 - t.m11) <= e * Math.max(1, Math.abs(this.m11), Math.abs(t.m11)) && Math.abs(this.m12 - t.m12) <= e * Math.max(1, Math.abs(this.m12), Math.abs(t.m12)) && Math.abs(this.m13 - t.m13) <= e * Math.max(1, Math.abs(this.m13), Math.abs(t.m13)) && Math.abs(this.m14 - t.m14) <= e * Math.max(1, Math.abs(this.m14), Math.abs(t.m14)) && Math.abs(this.m15 - t.m15) <= e * Math.max(1, Math.abs(this.m15), Math.abs(t.m15));
14477              }
14478              strictEquals(t) {
14479                return this.m00 === t.m00 && this.m01 === t.m01 && this.m02 === t.m02 && this.m03 === t.m03 && this.m04 === t.m04 && this.m05 === t.m05 && this.m06 === t.m06 && this.m07 === t.m07 && this.m08 === t.m08 && this.m09 === t.m09 && this.m10 === t.m10 && this.m11 === t.m11 && this.m12 === t.m12 && this.m13 === t.m13 && this.m14 === t.m14 && this.m15 === t.m15;
14480              }
14481              toString() {
14482                return `[\n${this.m00}, ${this.m01}, ${this.m02}, ${this.m03},\n${this.m04}, ${this.m05}, ${this.m06}, ${this.m07},\n${this.m08}, ${this.m09}, ${this.m10}, ${this.m11},\n${this.m12}, ${this.m13}, ${this.m14}, ${this.m15}\n]`;
14483              }
14484              identity() {
14485                this.m00 = 1;
14486                this.m01 = 0;
14487                this.m02 = 0;
14488                this.m03 = 0;
14489                this.m04 = 0;
14490                this.m05 = 1;
14491                this.m06 = 0;
14492                this.m07 = 0;
14493                this.m08 = 0;
14494                this.m09 = 0;
14495                this.m10 = 1;
14496                this.m11 = 0;
14497                this.m12 = 0;
14498                this.m13 = 0;
14499                this.m14 = 0;
14500                this.m15 = 1;
14501                return this;
14502              }
14503              zero() {
14504                this.m00 = 0;
14505                this.m01 = 0;
14506                this.m02 = 0;
14507                this.m03 = 0;
14508                this.m04 = 0;
14509                this.m05 = 0;
14510                this.m06 = 0;
14511                this.m07 = 0;
14512                this.m08 = 0;
14513                this.m09 = 0;
14514                this.m10 = 0;
14515                this.m11 = 0;
14516                this.m12 = 0;
14517                this.m13 = 0;
14518                this.m14 = 0;
14519                this.m15 = 0;
14520                return this;
14521              }
14522              transpose() {
14523                const t = this.m01;
14524                const e = this.m02;
14525                const i = this.m03;
14526                const s = this.m06;
14527                const n = this.m07;
14528                const r = this.m11;
14529                this.m01 = this.m04;
14530                this.m02 = this.m08;
14531                this.m03 = this.m12;
14532                this.m04 = t;
14533                this.m06 = this.m09;
14534                this.m07 = this.m13;
14535                this.m08 = e;
14536                this.m09 = s;
14537                this.m11 = this.m14;
14538                this.m12 = i;
14539                this.m13 = n;
14540                this.m14 = r;
14541                return this;
14542              }
14543              invert() {
14544                const t = this.m00;
14545                const e = this.m01;
14546                const i = this.m02;
14547                const s = this.m03;
14548                const n = this.m04;
14549                const r = this.m05;
14550                const o = this.m06;
14551                const a = this.m07;
14552                const l = this.m08;
14553                const h = this.m09;
14554                const c = this.m10;
14555                const u = this.m11;
14556                const _ = this.m12;
14557                const d = this.m13;
14558                const p = this.m14;
14559                const m = this.m15;
14560                const f = t * r - e * n;
14561                const g = t * o - i * n;
14562                const y = t * a - s * n;
14563                const b = e * o - i * r;
14564                const S = e * a - s * r;
14565                const A = i * a - s * o;
14566                const T = l * d - h * _;
14567                const v = l * p - c * _;
14568                const E = l * m - u * _;
14569                const C = h * p - c * d;
14570                const x = h * m - u * d;
14571                const w = c * m - u * p;
14572                let R = f * w - g * x + y * C + b * E - S * v + A * T;
14573                if (0 === R) {
14574                  this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
14575                  return this;
14576                }
14577                R = 1 / R;
14578                this.m00 = (r * w - o * x + a * C) * R;
14579                this.m01 = (i * x - e * w - s * C) * R;
14580                this.m02 = (d * A - p * S + m * b) * R;
14581                this.m03 = (c * S - h * A - u * b) * R;
14582                this.m04 = (o * E - n * w - a * v) * R;
14583                this.m05 = (t * w - i * E + s * v) * R;
14584                this.m06 = (p * y - _ * A - m * g) * R;
14585                this.m07 = (l * A - c * y + u * g) * R;
14586                this.m08 = (n * x - r * E + a * T) * R;
14587                this.m09 = (e * E - t * x - s * T) * R;
14588                this.m10 = (_ * S - d * y + m * f) * R;
14589                this.m11 = (h * y - l * S - u * f) * R;
14590                this.m12 = (r * v - n * C - o * T) * R;
14591                this.m13 = (t * C - e * v + i * T) * R;
14592                this.m14 = (d * g - _ * b - p * f) * R;
14593                this.m15 = (l * b - h * g + c * f) * R;
14594                return this;
14595              }
14596              determinant() {
14597                const t = this.m00;
14598                const e = this.m01;
14599                const i = this.m02;
14600                const s = this.m03;
14601                const n = this.m04;
14602                const r = this.m05;
14603                const o = this.m06;
14604                const a = this.m07;
14605                const l = this.m08;
14606                const h = this.m09;
14607                const c = this.m10;
14608                const u = this.m11;
14609                const _ = this.m12;
14610                const d = this.m13;
14611                const p = this.m14;
14612                const m = this.m15;
14613                return (t * r - e * n) * (c * m - u * p) - (t * o - i * n) * (h * m - u * d) + (t * a - s * n) * (h * p - c * d) + (e * o - i * r) * (l * m - u * _) - (e * a - s * r) * (l * p - c * _) + (i * a - s * o) * (l * d - h * _);
14614              }
14615              add(t) {
14616                this.m00 += t.m00;
14617                this.m01 += t.m01;
14618                this.m02 += t.m02;
14619                this.m03 += t.m03;
14620                this.m04 += t.m04;
14621                this.m05 += t.m05;
14622                this.m06 += t.m06;
14623                this.m07 += t.m07;
14624                this.m08 += t.m08;
14625                this.m09 += t.m09;
14626                this.m10 += t.m10;
14627                this.m11 += t.m11;
14628                this.m12 += t.m12;
14629                this.m13 += t.m13;
14630                this.m14 += t.m14;
14631                this.m15 += t.m15;
14632                return this;
14633              }
14634              subtract(t) {
14635                this.m00 -= t.m00;
14636                this.m01 -= t.m01;
14637                this.m02 -= t.m02;
14638                this.m03 -= t.m03;
14639                this.m04 -= t.m04;
14640                this.m05 -= t.m05;
14641                this.m06 -= t.m06;
14642                this.m07 -= t.m07;
14643                this.m08 -= t.m08;
14644                this.m09 -= t.m09;
14645                this.m10 -= t.m10;
14646                this.m11 -= t.m11;
14647                this.m12 -= t.m12;
14648                this.m13 -= t.m13;
14649                this.m14 -= t.m14;
14650                this.m15 -= t.m15;
14651                return this;
14652              }
14653              multiply(t) {
14654                const e = this.m00;
14655                const i = this.m01;
14656                const s = this.m02;
14657                const n = this.m03;
14658                const r = this.m04;
14659                const o = this.m05;
14660                const a = this.m06;
14661                const l = this.m07;
14662                const h = this.m08;
14663                const c = this.m09;
14664                const u = this.m10;
14665                const _ = this.m11;
14666                const d = this.m12;
14667                const p = this.m13;
14668                const m = this.m14;
14669                const f = this.m15;
14670                let g = t.m00;
14671                let y = t.m01;
14672                let b = t.m02;
14673                let S = t.m03;
14674                this.m00 = g * e + y * r + b * h + S * d;
14675                this.m01 = g * i + y * o + b * c + S * p;
14676                this.m02 = g * s + y * a + b * u + S * m;
14677                this.m03 = g * n + y * l + b * _ + S * f;
14678                g = t.m04;
14679                y = t.m05;
14680                b = t.m06;
14681                S = t.m07;
14682                this.m04 = g * e + y * r + b * h + S * d;
14683                this.m05 = g * i + y * o + b * c + S * p;
14684                this.m06 = g * s + y * a + b * u + S * m;
14685                this.m07 = g * n + y * l + b * _ + S * f;
14686                g = t.m08;
14687                y = t.m09;
14688                b = t.m10;
14689                S = t.m11;
14690                this.m08 = g * e + y * r + b * h + S * d;
14691                this.m09 = g * i + y * o + b * c + S * p;
14692                this.m10 = g * s + y * a + b * u + S * m;
14693                this.m11 = g * n + y * l + b * _ + S * f;
14694                g = t.m12;
14695                y = t.m13;
14696                b = t.m14;
14697                S = t.m15;
14698                this.m12 = g * e + y * r + b * h + S * d;
14699                this.m13 = g * i + y * o + b * c + S * p;
14700                this.m14 = g * s + y * a + b * u + S * m;
14701                this.m15 = g * n + y * l + b * _ + S * f;
14702                return this;
14703              }
14704              multiplyScalar(t) {
14705                this.m00 *= t;
14706                this.m01 *= t;
14707                this.m02 *= t;
14708                this.m03 *= t;
14709                this.m04 *= t;
14710                this.m05 *= t;
14711                this.m06 *= t;
14712                this.m07 *= t;
14713                this.m08 *= t;
14714                this.m09 *= t;
14715                this.m10 *= t;
14716                this.m11 *= t;
14717                this.m12 *= t;
14718                this.m13 *= t;
14719                this.m14 *= t;
14720                this.m15 *= t;
14721                return this;
14722              }
14723              translate(t) {
14724                this.m12 += t.x;
14725                this.m13 += t.y;
14726                this.m14 += t.z;
14727                return this;
14728              }
14729              scale(t) {
14730                const e = t.x;
14731                const i = t.y;
14732                const s = t.z;
14733                this.m00 *= e;
14734                this.m01 *= e;
14735                this.m02 *= e;
14736                this.m03 *= e;
14737                this.m04 *= i;
14738                this.m05 *= i;
14739                this.m06 *= i;
14740                this.m07 *= i;
14741                this.m08 *= s;
14742                this.m09 *= s;
14743                this.m10 *= s;
14744                this.m11 *= s;
14745                return this;
14746              }
14747              rotate(t, e) {
14748                let i = e.x;
14749                let s = e.y;
14750                let n = e.z;
14751                let r = Math.sqrt(i * i + s * s + n * n);
14752                if (Math.abs(r) < hi) return null;
14753                r = 1 / r;
14754                i *= r;
14755                s *= r;
14756                n *= r;
14757                const o = Math.sin(t);
14758                const a = Math.cos(t);
14759                const l = 1 - a;
14760                const h = this.m00;
14761                const c = this.m01;
14762                const u = this.m02;
14763                const _ = this.m03;
14764                const d = this.m04;
14765                const p = this.m05;
14766                const m = this.m06;
14767                const f = this.m07;
14768                const g = this.m08;
14769                const y = this.m09;
14770                const b = this.m10;
14771                const S = this.m11;
14772                const A = i * i * l + a;
14773                const T = s * i * l + n * o;
14774                const v = n * i * l - s * o;
14775                const E = i * s * l - n * o;
14776                const C = s * s * l + a;
14777                const x = n * s * l + i * o;
14778                const w = i * n * l + s * o;
14779                const R = s * n * l - i * o;
14780                const I = n * n * l + a;
14781                this.m00 = h * A + d * T + g * v;
14782                this.m01 = c * A + p * T + y * v;
14783                this.m02 = u * A + m * T + b * v;
14784                this.m03 = _ * A + f * T + S * v;
14785                this.m04 = h * E + d * C + g * x;
14786                this.m05 = c * E + p * C + y * x;
14787                this.m06 = u * E + m * C + b * x;
14788                this.m07 = _ * E + f * C + S * x;
14789                this.m08 = h * w + d * R + g * I;
14790                this.m09 = c * w + p * R + y * I;
14791                this.m10 = u * w + m * R + b * I;
14792                this.m11 = _ * w + f * R + S * I;
14793                return this;
14794              }
14795              getTranslation(t) {
14796                t.x = this.m12;
14797                t.y = this.m13;
14798                t.z = this.m14;
14799                return t;
14800              }
14801              getScale(t) {
14802                const e = Ji.m00 = this.m00;
14803                const i = Ji.m01 = this.m01;
14804                const s = Ji.m02 = this.m02;
14805                const n = Ji.m03 = this.m04;
14806                const r = Ji.m04 = this.m05;
14807                const o = Ji.m05 = this.m06;
14808                const a = Ji.m06 = this.m08;
14809                const l = Ji.m07 = this.m09;
14810                const h = Ji.m08 = this.m10;
14811                t.x = Math.sqrt(e * e + i * i + s * s);
14812                t.y = Math.sqrt(n * n + r * r + o * o);
14813                t.z = Math.sqrt(a * a + l * l + h * h);
14814                Fi.determinant(Ji) < 0 && (t.x *= -1);
14815                return t;
14816              }
14817              getRotation(t) {
14818                const e = this.m00 + this.m05 + this.m10;
14819                let i = 0;
14820                if (e > 0) {
14821                  i = 2 * Math.sqrt(e + 1);
14822                  t.w = .25 * i;
14823                  t.x = (this.m06 - this.m09) / i;
14824                  t.y = (this.m08 - this.m02) / i;
14825                  t.z = (this.m01 - this.m04) / i;
14826                } else if (this.m00 > this.m05 && this.m00 > this.m10) {
14827                  i = 2 * Math.sqrt(1 + this.m00 - this.m05 - this.m10);
14828                  t.w = (this.m06 - this.m09) / i;
14829                  t.x = .25 * i;
14830                  t.y = (this.m01 + this.m04) / i;
14831                  t.z = (this.m08 + this.m02) / i;
14832                } else if (this.m05 > this.m10) {
14833                  i = 2 * Math.sqrt(1 + this.m05 - this.m00 - this.m10);
14834                  t.w = (this.m08 - this.m02) / i;
14835                  t.x = (this.m01 + this.m04) / i;
14836                  t.y = .25 * i;
14837                  t.z = (this.m06 + this.m09) / i;
14838                } else {
14839                  i = 2 * Math.sqrt(1 + this.m10 - this.m00 - this.m05);
14840                  t.w = (this.m01 - this.m04) / i;
14841                  t.x = (this.m08 + this.m02) / i;
14842                  t.y = (this.m06 + this.m09) / i;
14843                  t.z = .25 * i;
14844                }
14845                return t;
14846              }
14847              fromRTS(t, e, i) {
14848                const s = t.x;
14849                const n = t.y;
14850                const r = t.z;
14851                const o = t.w;
14852                const a = s + s;
14853                const l = n + n;
14854                const h = r + r;
14855                const c = s * a;
14856                const u = s * l;
14857                const _ = s * h;
14858                const d = n * l;
14859                const p = n * h;
14860                const m = r * h;
14861                const f = o * a;
14862                const g = o * l;
14863                const y = o * h;
14864                const b = i.x;
14865                const S = i.y;
14866                const A = i.z;
14867                this.m00 = (1 - (d + m)) * b;
14868                this.m01 = (u + y) * b;
14869                this.m02 = (_ - g) * b;
14870                this.m03 = 0;
14871                this.m04 = (u - y) * S;
14872                this.m05 = (1 - (c + m)) * S;
14873                this.m06 = (p + f) * S;
14874                this.m07 = 0;
14875                this.m08 = (_ + g) * A;
14876                this.m09 = (p - f) * A;
14877                this.m10 = (1 - (c + d)) * A;
14878                this.m11 = 0;
14879                this.m12 = e.x;
14880                this.m13 = e.y;
14881                this.m14 = e.z;
14882                this.m15 = 1;
14883                return this;
14884              }
14885              fromQuat(t) {
14886                const e = t.x;
14887                const i = t.y;
14888                const s = t.z;
14889                const n = t.w;
14890                const r = e + e;
14891                const o = i + i;
14892                const a = s + s;
14893                const l = e * r;
14894                const h = i * r;
14895                const c = i * o;
14896                const u = s * r;
14897                const _ = s * o;
14898                const d = s * a;
14899                const p = n * r;
14900                const m = n * o;
14901                const f = n * a;
14902                this.m00 = 1 - c - d;
14903                this.m01 = h + f;
14904                this.m02 = u - m;
14905                this.m03 = 0;
14906                this.m04 = h - f;
14907                this.m05 = 1 - l - d;
14908                this.m06 = _ + p;
14909                this.m07 = 0;
14910                this.m08 = u + m;
14911                this.m09 = _ - p;
14912                this.m10 = 1 - l - c;
14913                this.m11 = 0;
14914                this.m12 = 0;
14915                this.m13 = 0;
14916                this.m14 = 0;
14917                this.m15 = 1;
14918                return this;
14919              }
14920            }
14921            t("Mat4", qi);
14922            qi.IDENTITY = Object.freeze(new qi);
14923            const Ki = new Pi;
14924            const Ji = new Fi;
14925            si.fastDefine("cc.Mat4", qi, {
14926              m00: 1,
14927              m01: 0,
14928              m02: 0,
14929              m03: 0,
14930              m04: 0,
14931              m05: 1,
14932              m06: 0,
14933              m07: 0,
14934              m08: 0,
14935              m09: 0,
14936              m10: 1,
14937              m11: 0,
14938              m12: 0,
14939              m13: 0,
14940              m14: 0,
14941              m15: 1
14942            });
14943            m.Mat4 = qi;
14944            function Zi(t, e, i, s, n, r, o, a, l, h, c, u, _, d, p, m) {
14945              return new qi(t, e, i, s, n, r, o, a, l, h, c, u, _, d, p, m);
14946            }
14947            m.mat4 = Zi;
14948            class Qi extends ce {
14949              static clone(t) {
14950                return new Qi(t.x, t.y);
14951              }
14952              static copy(t, e) {
14953                t.x = e.x;
14954                t.y = e.y;
14955                return t;
14956              }
14957              static set(t, e, i) {
14958                t.x = e;
14959                t.y = i;
14960                return t;
14961              }
14962              static add(t, e, i) {
14963                t.x = e.x + i.x;
14964                t.y = e.y + i.y;
14965                return t;
14966              }
14967              static subtract(t, e, i) {
14968                t.x = e.x - i.x;
14969                t.y = e.y - i.y;
14970                return t;
14971              }
14972              static multiply(t, e, i) {
14973                t.x = e.x * i.x;
14974                t.y = e.y * i.y;
14975                return t;
14976              }
14977              static divide(t, e, i) {
14978                t.x = e.x / i.x;
14979                t.y = e.y / i.y;
14980                return t;
14981              }
14982              static ceil(t, e) {
14983                t.x = Math.ceil(e.x);
14984                t.y = Math.ceil(e.y);
14985                return t;
14986              }
14987              static floor(t, e) {
14988                t.x = Math.floor(e.x);
14989                t.y = Math.floor(e.y);
14990                return t;
14991              }
14992              static min(t, e, i) {
14993                t.x = Math.min(e.x, i.x);
14994                t.y = Math.min(e.y, i.y);
14995                return t;
14996              }
14997              static max(t, e, i) {
14998                t.x = Math.max(e.x, i.x);
14999                t.y = Math.max(e.y, i.y);
15000                return t;
15001              }
15002              static round(t, e) {
15003                t.x = Math.round(e.x);
15004                t.y = Math.round(e.y);
15005                return t;
15006              }
15007              static multiplyScalar(t, e, i) {
15008                t.x = e.x * i;
15009                t.y = e.y * i;
15010                return t;
15011              }
15012              static scaleAndAdd(t, e, i, s) {
15013                t.x = e.x + i.x * s;
15014                t.y = e.y + i.y * s;
15015                return t;
15016              }
15017              static distance(t, e) {
15018                const i = e.x - t.x;
15019                const s = e.y - t.y;
15020                return Math.sqrt(i * i + s * s);
15021              }
15022              static squaredDistance(t, e) {
15023                const i = e.x - t.x;
15024                const s = e.y - t.y;
15025                return i * i + s * s;
15026              }
15027              static len(t) {
15028                const e = t.x;
15029                const i = t.y;
15030                return Math.sqrt(e * e + i * i);
15031              }
15032              static lengthSqr(t) {
15033                const e = t.x;
15034                const i = t.y;
15035                return e * e + i * i;
15036              }
15037              static negate(t, e) {
15038                t.x = -e.x;
15039                t.y = -e.y;
15040                return t;
15041              }
15042              static inverse(t, e) {
15043                t.x = 1 / e.x;
15044                t.y = 1 / e.y;
15045                return t;
15046              }
15047              static inverseSafe(t, e) {
15048                const i = e.x;
15049                const s = e.y;
15050                Math.abs(i) < hi ? t.x = 0 : t.x = 1 / i;
15051                Math.abs(s) < hi ? t.y = 0 : t.y = 1 / s;
15052                return t;
15053              }
15054              static normalize(t, e) {
15055                const i = e.x;
15056                const s = e.y;
15057                let n = i * i + s * s;
15058                if (n > 0) {
15059                  n = 1 / Math.sqrt(n);
15060                  t.x = i * n;
15061                  t.y = s * n;
15062                }
15063                return t;
15064              }
15065              static dot(t, e) {
15066                return t.x * e.x + t.y * e.y;
15067              }
15068              static cross(t, e, i) {
15069                if (t instanceof Pi) {
15070                  t.x = t.y = 0;
15071                  t.z = e.x * i.y - e.y * i.x;
15072                  return t;
15073                }
15074                return t.x * e.y - t.y * e.x;
15075              }
15076              static lerp(t, e, i, s) {
15077                const n = e.x;
15078                const r = e.y;
15079                t.x = n + s * (i.x - n);
15080                t.y = r + s * (i.y - r);
15081                return t;
15082              }
15083              static random(t, e) {
15084                e = e || 1;
15085                const i = 2 * gi() * Math.PI;
15086                t.x = Math.cos(i) * e;
15087                t.y = Math.sin(i) * e;
15088                return t;
15089              }
15090              static transformMat3(t, e, i) {
15091                const s = e.x;
15092                const n = e.y;
15093                t.x = i.m00 * s + i.m03 * n + i.m06;
15094                t.y = i.m01 * s + i.m04 * n + i.m07;
15095                return t;
15096              }
15097              static transformMat4(t, e, i) {
15098                const s = e.x;
15099                const n = e.y;
15100                t.x = i.m00 * s + i.m04 * n + i.m12;
15101                t.y = i.m01 * s + i.m05 * n + i.m13;
15102                return t;
15103              }
15104              static str(t) {
15105                return `Vec2(${t.x}, ${t.y})`;
15106              }
15107              static toArray(t, e, i = 0) {
15108                t[i + 0] = e.x;
15109                t[i + 1] = e.y;
15110                return t;
15111              }
15112              static fromArray(t, e, i = 0) {
15113                t.x = e[i + 0];
15114                t.y = e[i + 1];
15115                return t;
15116              }
15117              static strictEquals(t, e) {
15118                return t.x === e.x && t.y === e.y;
15119              }
15120              static equals(t, e, i = hi) {
15121                return Math.abs(t.x - e.x) <= i * Math.max(1, Math.abs(t.x), Math.abs(e.x)) && Math.abs(t.y - e.y) <= i * Math.max(1, Math.abs(t.y), Math.abs(e.y));
15122              }
15123              static angle(t, e) {
15124                Qi.normalize($i, t);
15125                Qi.normalize(ts, e);
15126                const i = Qi.dot($i, ts);
15127                return i > 1 ? 0 : i < -1 ? Math.PI : Math.acos(i);
15128              }
15129              constructor(t, e) {
15130                super();
15131                if (t && "object" == typeof t) {
15132                  this.x = t.x;
15133                  this.y = t.y;
15134                } else {
15135                  this.x = t || 0;
15136                  this.y = e || 0;
15137                }
15138              }
15139              clone() {
15140                return new Qi(this.x, this.y);
15141              }
15142              set(t, e) {
15143                if (t && "object" == typeof t) {
15144                  this.x = t.x;
15145                  this.y = t.y;
15146                } else {
15147                  this.x = t || 0;
15148                  this.y = e || 0;
15149                }
15150                return this;
15151              }
15152              equals(t, e = hi) {
15153                return Math.abs(this.x - t.x) <= e * Math.max(1, Math.abs(this.x), Math.abs(t.x)) && Math.abs(this.y - t.y) <= e * Math.max(1, Math.abs(this.y), Math.abs(t.y));
15154              }
15155              equals2f(t, e, i = hi) {
15156                return Math.abs(this.x - t) <= i * Math.max(1, Math.abs(this.x), Math.abs(t)) && Math.abs(this.y - e) <= i * Math.max(1, Math.abs(this.y), Math.abs(e));
15157              }
15158              strictEquals(t) {
15159                return t && this.x === t.x && this.y === t.y;
15160              }
15161              strictEquals2f(t, e) {
15162                return this.x === t && this.y === e;
15163              }
15164              toString() {
15165                return `(${this.x.toFixed(2)}, ${this.y.toFixed(2)})`;
15166              }
15167              lerp(t, e) {
15168                const i = this.x;
15169                const s = this.y;
15170                this.x = i + e * (t.x - i);
15171                this.y = s + e * (t.y - s);
15172                return this;
15173              }
15174              clampf(t, e) {
15175                this.x = _i(this.x, t.x, e.x);
15176                this.y = _i(this.y, t.y, e.y);
15177                return this;
15178              }
15179              add(t) {
15180                this.x += t.x;
15181                this.y += t.y;
15182                return this;
15183              }
15184              add2f(t, e) {
15185                this.x += t;
15186                this.y += e;
15187                return this;
15188              }
15189              subtract(t) {
15190                this.x -= t.x;
15191                this.y -= t.y;
15192                return this;
15193              }
15194              subtract2f(t, e) {
15195                this.x -= t;
15196                this.y -= e;
15197                return this;
15198              }
15199              multiplyScalar(t) {
15200                "object" == typeof t && console.warn("should use Vec2.multiply for vector * vector operation");
15201                this.x *= t;
15202                this.y *= t;
15203                return this;
15204              }
15205              multiply(t) {
15206                "object" != typeof t && console.warn("should use Vec2.scale for vector * scalar operation");
15207                this.x *= t.x;
15208                this.y *= t.y;
15209                return this;
15210              }
15211              multiply2f(t, e) {
15212                this.x *= t;
15213                this.y *= e;
15214                return this;
15215              }
15216              divide(t) {
15217                this.x /= t.x;
15218                this.y /= t.y;
15219                return this;
15220              }
15221              divide2f(t, e) {
15222                this.x /= t;
15223                this.y /= e;
15224                return this;
15225              }
15226              negative() {
15227                this.x = -this.x;
15228                this.y = -this.y;
15229                return this;
15230              }
15231              dot(t) {
15232                return this.x * t.x + this.y * t.y;
15233              }
15234              cross(t) {
15235                return this.x * t.y - this.y * t.x;
15236              }
15237              length() {
15238                return Math.sqrt(this.x * this.x + this.y * this.y);
15239              }
15240              lengthSqr() {
15241                return this.x * this.x + this.y * this.y;
15242              }
15243              normalize() {
15244                const t = this.x;
15245                const e = this.y;
15246                let i = t * t + e * e;
15247                if (i > 0) {
15248                  i = 1 / Math.sqrt(i);
15249                  this.x *= i;
15250                  this.y *= i;
15251                }
15252                return this;
15253              }
15254              angle(t) {
15255                const e = this.lengthSqr();
15256                const i = t.lengthSqr();
15257                if (0 === e || 0 === i) {
15258                  console.warn("Can't get angle between zero vector");
15259                  return 0;
15260                }
15261                let s = this.dot(t) / Math.sqrt(e * i);
15262                s = _i(s, -1, 1);
15263                return Math.acos(s);
15264              }
15265              signAngle(t) {
15266                const e = this.angle(t);
15267                return this.cross(t) < 0 ? -e : e;
15268              }
15269              rotate(t) {
15270                const e = this.x;
15271                const i = this.y;
15272                const s = Math.sin(t);
15273                const n = Math.cos(t);
15274                this.x = n * e - s * i;
15275                this.y = s * e + n * i;
15276                return this;
15277              }
15278              project(t) {
15279                const e = this.dot(t) / t.dot(t);
15280                this.x = t.x * e;
15281                this.y = t.y * e;
15282                return this;
15283              }
15284              transformMat4(t) {
15285                const e = this.x;
15286                const i = this.y;
15287                this.x = t.m00 * e + t.m04 * i + t.m12;
15288                this.y = t.m01 * e + t.m05 * i + t.m13;
15289                return this;
15290              }
15291            }
15292            t("Vec2", Qi);
15293            Qi.ZERO = Object.freeze(new Qi(0, 0));
15294            Qi.ONE = Object.freeze(new Qi(1, 1));
15295            Qi.NEG_ONE = Object.freeze(new Qi(-1, -1));
15296            Qi.UNIT_X = Object.freeze(new Qi(1, 0));
15297            Qi.UNIT_Y = Object.freeze(new Qi(0, 1));
15298            const $i = new Qi;
15299            const ts = new Qi;
15300            si.fastDefine("cc.Vec2", Qi, {
15301              x: 0,
15302              y: 0
15303            });
15304            m.Vec2 = Qi;
15305            function es(t, e) {
15306              return new Qi(t, e);
15307            }
15308            m.v2 = es;
15309            class is extends ce {
15310              static clone(t) {
15311                return new is(t.x, t.y, t.z, t.w);
15312              }
15313              static copy(t, e) {
15314                t.x = e.x;
15315                t.y = e.y;
15316                t.z = e.z;
15317                t.w = e.w;
15318                return t;
15319              }
15320              static set(t, e, i, s, n) {
15321                t.x = e;
15322                t.y = i;
15323                t.z = s;
15324                t.w = n;
15325                return t;
15326              }
15327              static add(t, e, i) {
15328                t.x = e.x + i.x;
15329                t.y = e.y + i.y;
15330                t.z = e.z + i.z;
15331                t.w = e.w + i.w;
15332                return t;
15333              }
15334              static subtract(t, e, i) {
15335                t.x = e.x - i.x;
15336                t.y = e.y - i.y;
15337                t.z = e.z - i.z;
15338                t.w = e.w - i.w;
15339                return t;
15340              }
15341              static multiply(t, e, i) {
15342                t.x = e.x * i.x;
15343                t.y = e.y * i.y;
15344                t.z = e.z * i.z;
15345                t.w = e.w * i.w;
15346                return t;
15347              }
15348              static divide(t, e, i) {
15349                t.x = e.x / i.x;
15350                t.y = e.y / i.y;
15351                t.z = e.z / i.z;
15352                t.w = e.w / i.w;
15353                return t;
15354              }
15355              static ceil(t, e) {
15356                t.x = Math.ceil(e.x);
15357                t.y = Math.ceil(e.y);
15358                t.z = Math.ceil(e.z);
15359                t.w = Math.ceil(e.w);
15360                return t;
15361              }
15362              static floor(t, e) {
15363                t.x = Math.floor(e.x);
15364                t.y = Math.floor(e.y);
15365                t.z = Math.floor(e.z);
15366                t.w = Math.floor(e.w);
15367                return t;
15368              }
15369              static min(t, e, i) {
15370                t.x = Math.min(e.x, i.x);
15371                t.y = Math.min(e.y, i.y);
15372                t.z = Math.min(e.z, i.z);
15373                t.w = Math.min(e.w, i.w);
15374                return t;
15375              }
15376              static max(t, e, i) {
15377                t.x = Math.max(e.x, i.x);
15378                t.y = Math.max(e.y, i.y);
15379                t.z = Math.max(e.z, i.z);
15380                t.w = Math.max(e.w, i.w);
15381                return t;
15382              }
15383              static round(t, e) {
15384                t.x = Math.round(e.x);
15385                t.y = Math.round(e.y);
15386                t.z = Math.round(e.z);
15387                t.w = Math.round(e.w);
15388                return t;
15389              }
15390              static multiplyScalar(t, e, i) {
15391                t.x = e.x * i;
15392                t.y = e.y * i;
15393                t.z = e.z * i;
15394                t.w = e.w * i;
15395                return t;
15396              }
15397              static scaleAndAdd(t, e, i, s) {
15398                t.x = e.x + i.x * s;
15399                t.y = e.y + i.y * s;
15400                t.z = e.z + i.z * s;
15401                t.w = e.w + i.w * s;
15402                return t;
15403              }
15404              static distance(t, e) {
15405                const i = e.x - t.x;
15406                const s = e.y - t.y;
15407                const n = e.z - t.z;
15408                const r = e.w - t.w;
15409                return Math.sqrt(i * i + s * s + n * n + r * r);
15410              }
15411              static squaredDistance(t, e) {
15412                const i = e.x - t.x;
15413                const s = e.y - t.y;
15414                const n = e.z - t.z;
15415                const r = e.w - t.w;
15416                return i * i + s * s + n * n + r * r;
15417              }
15418              static len(t) {
15419                const e = t.x;
15420                const i = t.y;
15421                const s = t.z;
15422                const n = t.w;
15423                return Math.sqrt(e * e + i * i + s * s + n * n);
15424              }
15425              static lengthSqr(t) {
15426                const e = t.x;
15427                const i = t.y;
15428                const s = t.z;
15429                const n = t.w;
15430                return e * e + i * i + s * s + n * n;
15431              }
15432              static negate(t, e) {
15433                t.x = -e.x;
15434                t.y = -e.y;
15435                t.z = -e.z;
15436                t.w = -e.w;
15437                return t;
15438              }
15439              static inverse(t, e) {
15440                t.x = 1 / e.x;
15441                t.y = 1 / e.y;
15442                t.z = 1 / e.z;
15443                t.w = 1 / e.w;
15444                return t;
15445              }
15446              static inverseSafe(t, e) {
15447                const i = e.x;
15448                const s = e.y;
15449                const n = e.z;
15450                const r = e.w;
15451                Math.abs(i) < hi ? t.x = 0 : t.x = 1 / i;
15452                Math.abs(s) < hi ? t.y = 0 : t.y = 1 / s;
15453                Math.abs(n) < hi ? t.z = 0 : t.z = 1 / n;
15454                Math.abs(r) < hi ? t.w = 0 : t.w = 1 / r;
15455                return t;
15456              }
15457              static normalize(t, e) {
15458                const i = e.x;
15459                const s = e.y;
15460                const n = e.z;
15461                const r = e.w;
15462                let o = i * i + s * s + n * n + r * r;
15463                if (o > 0) {
15464                  o = 1 / Math.sqrt(o);
15465                  t.x = i * o;
15466                  t.y = s * o;
15467                  t.z = n * o;
15468                  t.w = r * o;
15469                }
15470                return t;
15471              }
15472              static dot(t, e) {
15473                return t.x * e.x + t.y * e.y + t.z * e.z + t.w * e.w;
15474              }
15475              static lerp(t, e, i, s) {
15476                t.x = e.x + s * (i.x - e.x);
15477                t.y = e.y + s * (i.y - e.y);
15478                t.z = e.z + s * (i.z - e.z);
15479                t.w = e.w + s * (i.w - e.w);
15480                return t;
15481              }
15482              static random(t, e) {
15483                e = e || 1;
15484                const i = 2 * gi() * Math.PI;
15485                const s = 2 * gi() - 1;
15486                const n = Math.sqrt(1 - s * s);
15487                t.x = n * Math.cos(i) * e;
15488                t.y = n * Math.sin(i) * e;
15489                t.z = s * e;
15490                t.w = 0;
15491                return t;
15492              }
15493              static transformMat4(t, e, i) {
15494                const s = e.x;
15495                const n = e.y;
15496                const r = e.z;
15497                const o = e.w;
15498                t.x = i.m00 * s + i.m04 * n + i.m08 * r + i.m12 * o;
15499                t.y = i.m01 * s + i.m05 * n + i.m09 * r + i.m13 * o;
15500                t.z = i.m02 * s + i.m06 * n + i.m10 * r + i.m14 * o;
15501                t.w = i.m03 * s + i.m07 * n + i.m11 * r + i.m15 * o;
15502                return t;
15503              }
15504              static transformAffine(t, e, i) {
15505                const s = e.x;
15506                const n = e.y;
15507                const r = e.z;
15508                const o = e.w;
15509                t.x = i.m00 * s + i.m04 * n + i.m08 * r + i.m12 * o;
15510                t.y = i.m01 * s + i.m05 * n + i.m09 * r + i.m13 * o;
15511                t.z = i.m02 * s + i.m06 * n + i.m10 * r + i.m14 * o;
15512                t.w = e.w;
15513                return t;
15514              }
15515              static transformQuat(t, e, i) {
15516                const {x: s, y: n, z: r} = e;
15517                const o = i.x;
15518                const a = i.y;
15519                const l = i.z;
15520                const h = i.w;
15521                const c = h * s + a * r - l * n;
15522                const u = h * n + l * s - o * r;
15523                const _ = h * r + o * n - a * s;
15524                const d = -o * s - a * n - l * r;
15525                t.x = c * h + d * -o + u * -l - _ * -a;
15526                t.y = u * h + d * -a + _ * -o - c * -l;
15527                t.z = _ * h + d * -l + c * -a - u * -o;
15528                t.w = e.w;
15529                return t;
15530              }
15531              static toArray(t, e, i = 0) {
15532                t[i + 0] = e.x;
15533                t[i + 1] = e.y;
15534                t[i + 2] = e.z;
15535                t[i + 3] = e.w;
15536                return t;
15537              }
15538              static fromArray(t, e, i = 0) {
15539                t.x = e[i + 0];
15540                t.y = e[i + 1];
15541                t.z = e[i + 2];
15542                t.w = e[i + 3];
15543                return t;
15544              }
15545              static strictEquals(t, e) {
15546                return t.x === e.x && t.y === e.y && t.z === e.z && t.w === e.w;
15547              }
15548              static equals(t, e, i = hi) {
15549                return Math.abs(t.x - e.x) <= i * Math.max(1, Math.abs(t.x), Math.abs(e.x)) && Math.abs(t.y - e.y) <= i * Math.max(1, Math.abs(t.y), Math.abs(e.y)) && Math.abs(t.z - e.z) <= i * Math.max(1, Math.abs(t.z), Math.abs(e.z)) && Math.abs(t.w - e.w) <= i * Math.max(1, Math.abs(t.w), Math.abs(e.w));
15550              }
15551              constructor(t, e, i, s) {
15552                super();
15553                if (t && "object" == typeof t) {
15554                  this.x = t.x;
15555                  this.y = t.y;
15556                  this.z = t.z;
15557                  this.w = t.w;
15558                } else {
15559                  this.x = t || 0;
15560                  this.y = e || 0;
15561                  this.z = i || 0;
15562                  this.w = s || 0;
15563                }
15564              }
15565              clone() {
15566                return new is(this.x, this.y, this.z, this.w);
15567              }
15568              set(t, e, i, s) {
15569                if (t && "object" == typeof t) {
15570                  this.x = t.x;
15571                  this.y = t.y;
15572                  this.z = t.z;
15573                  this.w = t.w;
15574                } else {
15575                  this.x = t || 0;
15576                  this.y = e || 0;
15577                  this.z = i || 0;
15578                  this.w = s || 0;
15579                }
15580                return this;
15581              }
15582              equals(t, e = hi) {
15583                return Math.abs(this.x - t.x) <= e * Math.max(1, Math.abs(this.x), Math.abs(t.x)) && Math.abs(this.y - t.y) <= e * Math.max(1, Math.abs(this.y), Math.abs(t.y)) && Math.abs(this.z - t.z) <= e * Math.max(1, Math.abs(this.z), Math.abs(t.z)) && Math.abs(this.w - t.w) <= e * Math.max(1, Math.abs(this.w), Math.abs(t.w));
15584              }
15585              equals4f(t, e, i, s, n = hi) {
15586                return Math.abs(this.x - t) <= n * Math.max(1, Math.abs(this.x), Math.abs(t)) && Math.abs(this.y - e) <= n * Math.max(1, Math.abs(this.y), Math.abs(e)) && Math.abs(this.z - i) <= n * Math.max(1, Math.abs(this.z), Math.abs(i)) && Math.abs(this.w - s) <= n * Math.max(1, Math.abs(this.w), Math.abs(s));
15587              }
15588              strictEquals(t) {
15589                return this.x === t.x && this.y === t.y && this.z === t.z && this.w === t.w;
15590              }
15591              strictEquals4f(t, e, i, s) {
15592                return this.x === t && this.y === e && this.z === i && this.w === s;
15593              }
15594              lerp(t, e) {
15595                const i = this.x;
15596                const s = this.y;
15597                const n = this.z;
15598                const r = this.w;
15599                this.x = i + e * (t.x - i);
15600                this.y = s + e * (t.y - s);
15601                this.z = n + e * (t.z - n);
15602                this.w = r + e * (t.w - r);
15603                return this;
15604              }
15605              toString() {
15606                return `(${this.x.toFixed(2)}, ${this.y.toFixed(2)}, ${this.z.toFixed(2)}, ${this.w.toFixed(2)})`;
15607              }
15608              clampf(t, e) {
15609                this.x = _i(this.x, t.x, e.x);
15610                this.y = _i(this.y, t.y, e.y);
15611                this.z = _i(this.z, t.z, e.z);
15612                this.w = _i(this.w, t.w, e.w);
15613                return this;
15614              }
15615              add(t) {
15616                this.x += t.x;
15617                this.y += t.y;
15618                this.z += t.z;
15619                this.w += t.w;
15620                return this;
15621              }
15622              add4f(t, e, i, s) {
15623                this.x += t;
15624                this.y += e;
15625                this.z += i;
15626                this.w += s;
15627                return this;
15628              }
15629              subtract(t) {
15630                this.x -= t.x;
15631                this.y -= t.y;
15632                this.z -= t.z;
15633                this.w -= t.w;
15634                return this;
15635              }
15636              subtract4f(t, e, i, s) {
15637                this.x -= t;
15638                this.y -= e;
15639                this.z -= i;
15640                this.w -= s;
15641                return this;
15642              }
15643              multiplyScalar(t) {
15644                "object" == typeof t && console.warn("should use Vec4.multiply for vector * vector operation");
15645                this.x *= t;
15646                this.y *= t;
15647                this.z *= t;
15648                this.w *= t;
15649                return this;
15650              }
15651              multiply(t) {
15652                "object" != typeof t && console.warn("should use Vec4.scale for vector * scalar operation");
15653                this.x *= t.x;
15654                this.y *= t.y;
15655                this.z *= t.z;
15656                this.w *= t.w;
15657                return this;
15658              }
15659              multiply4f(t, e, i, s) {
15660                this.x *= t;
15661                this.y *= e;
15662                this.z *= i;
15663                this.w *= s;
15664                return this;
15665              }
15666              divide(t) {
15667                this.x /= t.x;
15668                this.y /= t.y;
15669                this.z /= t.z;
15670                this.w /= t.w;
15671                return this;
15672              }
15673              divide4f(t, e, i, s) {
15674                this.x /= t;
15675                this.y /= e;
15676                this.z /= i;
15677                this.w /= s;
15678                return this;
15679              }
15680              negative() {
15681                this.x = -this.x;
15682                this.y = -this.y;
15683                this.z = -this.z;
15684                this.w = -this.w;
15685                return this;
15686              }
15687              dot(t) {
15688                return this.x * t.x + this.y * t.y + this.z * t.z + this.w * t.w;
15689              }
15690              cross(t) {
15691                const {x: e, y: i, z: s} = this;
15692                const {x: n, y: r, z: o} = t;
15693                this.x = i * o - s * r;
15694                this.y = s * n - e * o;
15695                this.z = e * r - i * n;
15696                return this;
15697              }
15698              length() {
15699                const t = this.x;
15700                const e = this.y;
15701                const i = this.z;
15702                const s = this.w;
15703                return Math.sqrt(t * t + e * e + i * i + s * s);
15704              }
15705              lengthSqr() {
15706                const t = this.x;
15707                const e = this.y;
15708                const i = this.z;
15709                const s = this.w;
15710                return t * t + e * e + i * i + s * s;
15711              }
15712              normalize() {
15713                const t = this.x;
15714                const e = this.y;
15715                const i = this.z;
15716                const s = this.w;
15717                let n = t * t + e * e + i * i + s * s;
15718                if (n > 0) {
15719                  n = 1 / Math.sqrt(n);
15720                  this.x = t * n;
15721                  this.y = e * n;
15722                  this.z = i * n;
15723                  this.w = s * n;
15724                }
15725                return this;
15726              }
15727              transformMat4(t) {
15728                const e = this.x;
15729                const i = this.y;
15730                const s = this.z;
15731                const n = this.w;
15732                this.x = t.m00 * e + t.m04 * i + t.m08 * s + t.m12 * n;
15733                this.y = t.m01 * e + t.m05 * i + t.m09 * s + t.m13 * n;
15734                this.z = t.m02 * e + t.m06 * i + t.m10 * s + t.m14 * n;
15735                this.w = t.m03 * e + t.m07 * i + t.m11 * s + t.m15 * n;
15736                return this;
15737              }
15738            }
15739            t("Vec4", is);
15740            is.ZERO = Object.freeze(new is(0, 0, 0, 0));
15741            is.ONE = Object.freeze(new is(1, 1, 1, 1));
15742            is.NEG_ONE = Object.freeze(new is(-1, -1, -1, -1));
15743            si.fastDefine("cc.Vec4", is, {
15744              x: 0,
15745              y: 0,
15746              z: 0,
15747              w: 0
15748            });
15749            m.Vec4 = is;
15750            function ss(t, e, i, s) {
15751              return new is(t, e, i, s);
15752            }
15753            m.v4 = ss;
15754            W(Qi, "Vec2", [ {
15755              name: "sub",
15756              newName: "subtract",
15757              target: Qi,
15758              targetName: "Vec2"
15759            }, {
15760              name: "mul",
15761              newName: "multiply",
15762              target: Qi,
15763              targetName: "Vec2"
15764            }, {
15765              name: "div",
15766              newName: "divide",
15767              target: Qi,
15768              targetName: "Vec2"
15769            }, {
15770              name: "dist",
15771              newName: "distance",
15772              target: Qi,
15773              targetName: "Vec2"
15774            }, {
15775              name: "sqrDist",
15776              newName: "squaredDistance",
15777              target: Qi,
15778              targetName: "Vec2"
15779            }, {
15780              name: "mag",
15781              newName: "len",
15782              target: Qi,
15783              targetName: "Vec2"
15784            }, {
15785              name: "sqrMag",
15786              newName: "lengthSqr",
15787              target: Qi,
15788              targetName: "Vec2"
15789            }, {
15790              name: "scale",
15791              newName: "multiplyScalar",
15792              target: Qi,
15793              targetName: "Vec2"
15794            }, {
15795              name: "exactEquals",
15796              newName: "strictEquals",
15797              target: Qi,
15798              targetName: "Vec2"
15799            } ]);
15800            W(Qi.prototype, "Vec2", [ {
15801              name: "mag",
15802              newName: "length",
15803              target: Qi.prototype,
15804              targetName: "Vec2"
15805            }, {
15806              name: "magSqr",
15807              newName: "lengthSqr",
15808              target: Qi.prototype,
15809              targetName: "Vec2"
15810            }, {
15811              name: "scale",
15812              newName: "multiplyScalar",
15813              target: Qi.prototype,
15814              targetName: "Vec2"
15815            }, {
15816              name: "exactEquals",
15817              newName: "strictEquals",
15818              target: Qi.prototype,
15819              targetName: "Vec2"
15820            } ]);
15821            W(Pi, "Vec3", [ {
15822              name: "sub",
15823              newName: "subtract",
15824              target: Pi,
15825              targetName: "Vec3"
15826            }, {
15827              name: "mul",
15828              newName: "multiply",
15829              target: Pi,
15830              targetName: "Vec3"
15831            }, {
15832              name: "div",
15833              newName: "divide",
15834              target: Pi,
15835              targetName: "Vec3"
15836            }, {
15837              name: "dist",
15838              newName: "distance",
15839              target: Pi,
15840              targetName: "Vec3"
15841            }, {
15842              name: "sqrDist",
15843              newName: "squaredDistance",
15844              target: Pi,
15845              targetName: "Vec3"
15846            }, {
15847              name: "mag",
15848              newName: "len",
15849              target: Pi,
15850              targetName: "Vec3"
15851            }, {
15852              name: "sqrMag",
15853              newName: "lengthSqr",
15854              target: Pi,
15855              targetName: "Vec3"
15856            }, {
15857              name: "scale",
15858              newName: "multiplyScalar",
15859              target: Pi,
15860              targetName: "Vec3"
15861            }, {
15862              name: "exactEquals",
15863              newName: "strictEquals",
15864              target: Pi,
15865              targetName: "Vec3"
15866            } ]);
15867            W(Pi.prototype, "Vec3", [ {
15868              name: "mag",
15869              newName: "length",
15870              target: Pi.prototype,
15871              targetName: "Vec3"
15872            }, {
15873              name: "magSqr",
15874              newName: "lengthSqr",
15875              target: Pi.prototype,
15876              targetName: "Vec3"
15877            }, {
15878              name: "scale",
15879              newName: "multiplyScalar",
15880              target: Pi.prototype,
15881              targetName: "Vec3"
15882            }, {
15883              name: "exactEquals",
15884              newName: "strictEquals",
15885              target: Pi.prototype,
15886              targetName: "Vec3"
15887            } ]);
15888            W(is, "Vec4", [ {
15889              name: "sub",
15890              newName: "subtract",
15891              target: is,
15892              targetName: "Vec4"
15893            }, {
15894              name: "mul",
15895              newName: "multiply",
15896              target: is,
15897              targetName: "Vec4"
15898            }, {
15899              name: "div",
15900              newName: "divide",
15901              target: is,
15902              targetName: "Vec4"
15903            }, {
15904              name: "dist",
15905              newName: "distance",
15906              target: is,
15907              targetName: "Vec4"
15908            }, {
15909              name: "sqrDist",
15910              newName: "squaredDistance",
15911              target: is,
15912              targetName: "Vec4"
15913            }, {
15914              name: "mag",
15915              newName: "len",
15916              target: is,
15917              targetName: "Vec4"
15918            }, {
15919              name: "sqrMag",
15920              newName: "lengthSqr",
15921              target: is,
15922              targetName: "Vec4"
15923            }, {
15924              name: "scale",
15925              newName: "multiplyScalar",
15926              target: is,
15927              targetName: "Vec4"
15928            }, {
15929              name: "exactEquals",
15930              newName: "strictEquals",
15931              target: is,
15932              targetName: "Vec4"
15933            } ]);
15934            W(is.prototype, "Vec4", [ {
15935              name: "mag",
15936              newName: "length",
15937              target: is.prototype,
15938              targetName: "Vec4"
15939            }, {
15940              name: "magSqr",
15941              newName: "lengthSqr",
15942              target: is.prototype,
15943              targetName: "Vec4"
15944            }, {
15945              name: "scale",
15946              newName: "multiplyScalar",
15947              target: is.prototype,
15948              targetName: "Vec4"
15949            }, {
15950              name: "exactEquals",
15951              newName: "strictEquals",
15952              target: is.prototype,
15953              targetName: "Vec4"
15954            } ]);
15955            W(Ui, "Quat", [ {
15956              name: "mag",
15957              newName: "len",
15958              target: Ui,
15959              targetName: "Quat"
15960            }, {
15961              name: "mul",
15962              newName: "multiply",
15963              target: Ui,
15964              targetName: "Quat"
15965            }, {
15966              name: "sqrMag",
15967              newName: "lengthSqr",
15968              target: Ui,
15969              targetName: "Quat"
15970            }, {
15971              name: "scale",
15972              newName: "multiplyScalar",
15973              target: Ui,
15974              targetName: "Quat"
15975            }, {
15976              name: "exactEquals",
15977              newName: "strictEquals",
15978              target: Ui,
15979              targetName: "Quat"
15980            } ]);
15981            W(Ui.prototype, "Quat", [ {
15982              name: "scale",
15983              newName: "multiplyScalar",
15984              target: Ui.prototype,
15985              targetName: "Quat"
15986            }, {
15987              name: "exactEquals",
15988              newName: "strictEquals",
15989              target: Ui.prototype,
15990              targetName: "Quat"
15991            } ]);
15992            W(Bi, "Color", [ {
15993              name: "sub",
15994              newName: "subtract",
15995              target: Bi,
15996              targetName: "Color"
15997            }, {
15998              name: "mul",
15999              newName: "multiply",
16000              target: Bi,
16001              targetName: "Color"
16002            }, {
16003              name: "div",
16004              newName: "divide",
16005              target: Bi,
16006              targetName: "Color"
16007            }, {
16008              name: "exactEquals",
16009              newName: "strictEquals",
16010              target: Bi,
16011              targetName: "Color"
16012            }, {
16013              name: "fromHex",
16014              newName: "fromHEX",
16015              customFunction(...t) {
16016                const e = t[1].toString(16);
16017                return m.Color.fromHEX(t[0], e);
16018              }
16019            } ]);
16020            W(Fi, "Mat3", [ {
16021              name: "sub",
16022              newName: "subtract",
16023              target: Fi,
16024              targetName: "Mat3"
16025            }, {
16026              name: "mul",
16027              newName: "multiply",
16028              target: Fi,
16029              targetName: "Mat3"
16030            }, {
16031              name: "exactEquals",
16032              newName: "strictEquals",
16033              target: Fi,
16034              targetName: "Mat3"
16035            }, {
16036              name: "transfrom",
16037              newName: "transform",
16038              target: Fi,
16039              targetName: "Mat3"
16040            } ]);
16041            W(Fi.prototype, "Mat3", [ {
16042              name: "sub",
16043              newName: "subtract",
16044              target: Fi.prototype,
16045              targetName: "Mat3"
16046            }, {
16047              name: "mul",
16048              newName: "multiply",
16049              target: Fi.prototype,
16050              targetName: "Mat3"
16051            }, {
16052              name: "mulScalar",
16053              newName: "multiplyScalar",
16054              target: Fi.prototype,
16055              targetName: "Mat3"
16056            }, {
16057              name: "exactEquals",
16058              newName: "strictEquals",
16059              target: Fi.prototype,
16060              targetName: "Mat3"
16061            } ]);
16062            W(qi, "Mat4", [ {
16063              name: "sub",
16064              newName: "subtract",
16065              target: qi,
16066              targetName: "Mat4"
16067            }, {
16068              name: "mul",
16069              newName: "multiply",
16070              target: qi,
16071              targetName: "Mat4"
16072            }, {
16073              name: "exactEquals",
16074              newName: "strictEquals",
16075              target: qi,
16076              targetName: "Mat4"
16077            } ]);
16078            W(qi.prototype, "Mat4", [ {
16079              name: "sub",
16080              newName: "subtract",
16081              target: qi.prototype,
16082              targetName: "Mat4"
16083            }, {
16084              name: "mul",
16085              newName: "multiply",
16086              target: qi.prototype,
16087              targetName: "Mat4"
16088            }, {
16089              name: "mulScalar",
16090              newName: "multiplyScalar",
16091              target: qi.prototype,
16092              targetName: "Mat4"
16093            }, {
16094              name: "exactEquals",
16095              newName: "strictEquals",
16096              target: qi.prototype,
16097              targetName: "Mat4"
16098            } ]);
16099            class ns {
16100              static identity() {
16101                return new ns;
16102              }
16103              static clone(t) {
16104                return new ns(t.a, t.b, t.c, t.d, t.tx, t.ty);
16105              }
16106              static concat(t, e, i) {
16107                const s = e.a;
16108                const n = e.b;
16109                const r = e.c;
16110                const o = e.d;
16111                const a = e.tx;
16112                const l = e.ty;
16113                t.a = s * i.a + n * i.c;
16114                t.b = s * i.b + n * i.d;
16115                t.c = r * i.a + o * i.c;
16116                t.d = r * i.b + o * i.d;
16117                t.tx = a * i.a + l * i.c + i.tx;
16118                t.ty = a * i.b + l * i.d + i.ty;
16119              }
16120              static invert(t, e) {
16121                const i = 1 / (e.a * e.d - e.b * e.c);
16122                t.a = i * e.d;
16123                t.b = -i * e.b;
16124                t.c = -i * e.c;
16125                t.d = i * e.a;
16126                t.tx = i * (e.c * e.ty - e.d * e.tx);
16127                t.ty = i * (e.b * e.tx - e.a * e.ty);
16128              }
16129              static fromMat4(t, e) {
16130                t.a = e.m00;
16131                t.b = e.m01;
16132                t.c = e.m04;
16133                t.d = e.m05;
16134                t.tx = e.m12;
16135                t.ty = e.m13;
16136              }
16137              static transformVec2(t, e, i, s) {
16138                let n;
16139                let r;
16140                if (s) {
16141                  n = e;
16142                  r = i;
16143                } else {
16144                  s = i;
16145                  n = e.x;
16146                  r = e.y;
16147                }
16148                t.x = s.a * n + s.c * r + s.tx;
16149                t.y = s.b * n + s.d * r + s.ty;
16150              }
16151              static transformSize(t, e, i) {
16152                t.width = i.a * e.width + i.c * e.height;
16153                t.height = i.b * e.width + i.d * e.height;
16154              }
16155              static transformRect(t, e, i) {
16156                const s = e.x + e.width;
16157                const n = e.y + e.height;
16158                const r = i.a * e.x + i.c * e.y + i.tx;
16159                const o = i.b * e.x + i.d * e.y + i.ty;
16160                const a = i.a * s + i.c * e.y + i.tx;
16161                const l = i.b * s + i.d * e.y + i.ty;
16162                const h = i.a * e.x + i.c * n + i.tx;
16163                const c = i.b * e.x + i.d * n + i.ty;
16164                const u = i.a * s + i.c * n + i.tx;
16165                const _ = i.b * s + i.d * n + i.ty;
16166                const d = Math.min(r, a, h, u);
16167                const p = Math.max(r, a, h, u);
16168                const m = Math.min(o, l, c, _);
16169                const f = Math.max(o, l, c, _);
16170                t.x = d;
16171                t.y = m;
16172                t.width = p - d;
16173                t.height = f - m;
16174              }
16175              static transformObb(t, e, i, s, n, r) {
16176                const o = r.a * n.x + r.c * n.y + r.tx;
16177                const a = r.b * n.x + r.d * n.y + r.ty;
16178                const l = r.a * n.width;
16179                const h = r.b * n.width;
16180                const c = r.c * n.height;
16181                const u = r.d * n.height;
16182                e.x = o;
16183                e.y = a;
16184                i.x = l + o;
16185                i.y = h + a;
16186                t.x = c + o;
16187                t.y = u + a;
16188                s.x = l + c + o;
16189                s.y = h + u + a;
16190              }
16191              constructor(t = 1, e = 0, i = 0, s = 1, n = 0, r = 0) {
16192                this.a = t;
16193                this.b = e;
16194                this.c = i;
16195                this.d = s;
16196                this.tx = n;
16197                this.ty = r;
16198              }
16199            }
16200            t("AffineTransform", ns);
16201            m.AffineTransform = ns;
16202            class rs extends ce {
16203              static lerp(t, e, i, s) {
16204                t.width = e.width + (i.width - e.width) * s;
16205                t.height = e.height + (i.height - e.height) * s;
16206                return t;
16207              }
16208              set x(t) {
16209                this.width = t;
16210              }
16211              get x() {
16212                return this.width;
16213              }
16214              set y(t) {
16215                this.height = t;
16216              }
16217              get y() {
16218                return this.height;
16219              }
16220              constructor(t, e) {
16221                super();
16222                if (t && "object" == typeof t) {
16223                  this.width = t.width;
16224                  this.height = t.height;
16225                } else {
16226                  this.width = t || 0;
16227                  this.height = e || 0;
16228                }
16229              }
16230              clone() {
16231                return new rs(this.width, this.height);
16232              }
16233              set(t, e) {
16234                if (t && "object" == typeof t) {
16235                  this.height = t.height;
16236                  this.width = t.width;
16237                } else {
16238                  this.width = t || 0;
16239                  this.height = e || 0;
16240                }
16241                return this;
16242              }
16243              equals(t) {
16244                return this.width === t.width && this.height === t.height;
16245              }
16246              lerp(t, e) {
16247                this.width += (t.width - this.width) * e;
16248                this.height += (t.height - this.height) * e;
16249                return this;
16250              }
16251              toString() {
16252                return `(${this.width.toFixed(2)}, ${this.height.toFixed(2)})`;
16253              }
16254            }
16255            t("Size", rs);
16256            rs.ZERO = Object.freeze(new rs(0, 0));
16257            rs.ONE = Object.freeze(new rs(1, 1));
16258            si.fastDefine("cc.Size", rs, {
16259              width: 0,
16260              height: 0
16261            });
16262            function os(t = 0, e = 0) {
16263              return new rs(t, e);
16264            }
16265            m.size = os;
16266            m.Size = rs;
16267            class as extends ce {
16268              static fromMinMax(t, e, i) {
16269                const s = Math.min(e.x, i.x);
16270                const n = Math.min(e.y, i.y);
16271                const r = Math.max(e.x, i.x);
16272                const o = Math.max(e.y, i.y);
16273                t.x = s;
16274                t.y = n;
16275                t.width = r - s;
16276                t.height = o - n;
16277                return t;
16278              }
16279              static lerp(t, e, i, s) {
16280                const n = e.x;
16281                const r = e.y;
16282                const o = e.width;
16283                const a = e.height;
16284                t.x = n + (i.x - n) * s;
16285                t.y = r + (i.y - r) * s;
16286                t.width = o + (i.width - o) * s;
16287                t.height = a + (i.height - a) * s;
16288                return t;
16289              }
16290              static intersection(t, e, i) {
16291                const s = e.x;
16292                const n = e.y;
16293                const r = e.x + e.width;
16294                const o = e.y + e.height;
16295                const a = i.x;
16296                const l = i.y;
16297                const h = i.x + i.width;
16298                const c = i.y + i.height;
16299                t.x = Math.max(s, a);
16300                t.y = Math.max(n, l);
16301                t.width = Math.min(r, h) - t.x;
16302                t.height = Math.min(o, c) - t.y;
16303                return t;
16304              }
16305              static union(t, e, i) {
16306                const s = e.x;
16307                const n = e.y;
16308                const r = e.width;
16309                const o = e.height;
16310                const a = i.x;
16311                const l = i.y;
16312                const h = i.width;
16313                const c = i.height;
16314                t.x = Math.min(s, a);
16315                t.y = Math.min(n, l);
16316                t.width = Math.max(s + r, a + h) - t.x;
16317                t.height = Math.max(n + o, l + c) - t.y;
16318                return t;
16319              }
16320              get xMin() {
16321                return this.x;
16322              }
16323              set xMin(t) {
16324                this.width += this.x - t;
16325                this.x = t;
16326              }
16327              get yMin() {
16328                return this.y;
16329              }
16330              set yMin(t) {
16331                this.height += this.y - t;
16332                this.y = t;
16333              }
16334              get xMax() {
16335                return this.x + this.width;
16336              }
16337              set xMax(t) {
16338                this.width = t - this.x;
16339              }
16340              get yMax() {
16341                return this.y + this.height;
16342              }
16343              set yMax(t) {
16344                this.height = t - this.y;
16345              }
16346              get center() {
16347                return new Qi(this.x + .5 * this.width, this.y + .5 * this.height);
16348              }
16349              set center(t) {
16350                this.x = t.x - .5 * this.width;
16351                this.y = t.y - .5 * this.height;
16352              }
16353              get origin() {
16354                return new Qi(this.x, this.y);
16355              }
16356              set origin(t) {
16357                this.x = t.x;
16358                this.y = t.y;
16359              }
16360              get size() {
16361                return new rs(this.width, this.height);
16362              }
16363              set size(t) {
16364                this.width = t.width;
16365                this.height = t.height;
16366              }
16367              set z(t) {
16368                this.width = t;
16369              }
16370              get z() {
16371                return this.width;
16372              }
16373              set w(t) {
16374                this.height = t;
16375              }
16376              get w() {
16377                return this.height;
16378              }
16379              constructor(t, e, i, s) {
16380                super();
16381                if (t && "object" == typeof t) {
16382                  this.y = t.y;
16383                  this.width = t.width;
16384                  this.height = t.height;
16385                  this.x = t.x;
16386                } else {
16387                  this.x = t || 0;
16388                  this.y = e || 0;
16389                  this.width = i || 0;
16390                  this.height = s || 0;
16391                }
16392              }
16393              clone() {
16394                return new as(this.x, this.y, this.width, this.height);
16395              }
16396              set(t, e, i, s) {
16397                if (t && "object" == typeof t) {
16398                  this.y = t.y;
16399                  this.width = t.width;
16400                  this.height = t.height;
16401                  this.x = t.x;
16402                } else {
16403                  this.x = t || 0;
16404                  this.y = e || 0;
16405                  this.width = i || 0;
16406                  this.height = s || 0;
16407                }
16408                return this;
16409              }
16410              equals(t) {
16411                return this.x === t.x && this.y === t.y && this.width === t.width && this.height === t.height;
16412              }
16413              lerp(t, e) {
16414                const i = this.x;
16415                const s = this.y;
16416                const n = this.width;
16417                const r = this.height;
16418                this.x = i + (t.x - i) * e;
16419                this.y = s + (t.y - s) * e;
16420                this.width = n + (t.width - n) * e;
16421                this.height = r + (t.height - r) * e;
16422                return this;
16423              }
16424              toString() {
16425                return `(${this.x.toFixed(2)}, ${this.y.toFixed(2)}, ${this.width.toFixed(2)}, ${this.height.toFixed(2)})`;
16426              }
16427              intersects(t) {
16428                const e = this.x + this.width;
16429                const i = this.y + this.height;
16430                const s = t.x + t.width;
16431                const n = t.y + t.height;
16432                return !(e < t.x || s < this.x || i < t.y || n < this.y);
16433              }
16434              contains(t) {
16435                return this.x <= t.x && this.x + this.width >= t.x && this.y <= t.y && this.y + this.height >= t.y;
16436              }
16437              containsRect(t) {
16438                return this.x <= t.x && this.x + this.width >= t.x + t.width && this.y <= t.y && this.y + this.height >= t.y + t.height;
16439              }
16440              transformMat4(t) {
16441                const e = this.x;
16442                const i = this.y;
16443                const s = e + this.width;
16444                const n = i + this.height;
16445                const r = t.m00 * e + t.m04 * i + t.m12;
16446                const o = t.m01 * e + t.m05 * i + t.m13;
16447                const a = t.m00 * s + t.m04 * i + t.m12;
16448                const l = t.m01 * s + t.m05 * i + t.m13;
16449                const h = t.m00 * e + t.m04 * n + t.m12;
16450                const c = t.m01 * e + t.m05 * n + t.m13;
16451                const u = t.m00 * s + t.m04 * n + t.m12;
16452                const _ = t.m01 * s + t.m05 * n + t.m13;
16453                const d = Math.min(r, a, h, u);
16454                const p = Math.max(r, a, h, u);
16455                const m = Math.min(o, l, c, _);
16456                const f = Math.max(o, l, c, _);
16457                this.x = d;
16458                this.y = m;
16459                this.width = p - d;
16460                this.height = f - m;
16461                return this;
16462              }
16463              transformMat4ToPoints(t, e, i, s, n) {
16464                const r = this.x;
16465                const o = this.y;
16466                const a = r + this.width;
16467                const l = o + this.height;
16468                e.x = t.m00 * r + t.m04 * o + t.m12;
16469                e.y = t.m01 * r + t.m05 * o + t.m13;
16470                n.x = t.m00 * a + t.m04 * o + t.m12;
16471                n.y = t.m01 * a + t.m05 * o + t.m13;
16472                i.x = t.m00 * r + t.m04 * l + t.m12;
16473                i.y = t.m01 * r + t.m05 * l + t.m13;
16474                s.x = t.m00 * a + t.m04 * l + t.m12;
16475                s.y = t.m01 * a + t.m05 * l + t.m13;
16476              }
16477            }
16478            t("Rect", as);
16479            si.fastDefine("cc.Rect", as, {
16480              x: 0,
16481              y: 0,
16482              width: 0,
16483              height: 0
16484            });
16485            m.Rect = as;
16486            function ls(t = 0, e = 0, i = 0, s = 0) {
16487              return new as(t, e, i, s);
16488            }
16489            m.rect = ls;
16490            const hs = t("MATH_FLOAT_ARRAY", Float32Array);
16491            class cs extends ce {
16492              static createFloatArray(t) {
16493                return new hs(t);
16494              }
16495              get array() {
16496                return this._array;
16497              }
16498            }
16499            t("MathBase", cs);
16500            var us = Object.freeze({
16501              __proto__: null,
16502              bits: c,
16503              Vec2: Qi,
16504              v2: es,
16505              Vec3: Pi,
16506              v3: Li,
16507              Vec4: is,
16508              v4: ss,
16509              Quat: Ui,
16510              quat: Wi,
16511              Mat3: Fi,
16512              Mat4: qi,
16513              mat4: Zi,
16514              AffineTransform: ns,
16515              Size: rs,
16516              size: os,
16517              Rect: as,
16518              rect: ls,
16519              Color: Bi,
16520              color: Di,
16521              EPSILON: hi,
16522              equals: ci,
16523              approx: ui,
16524              clamp: _i,
16525              clamp01: di,
16526              lerp: pi,
16527              toRadian: mi,
16528              toDegree: fi,
16529              random: gi,
16530              randomRange: yi,
16531              randomRangeInt: bi,
16532              pseudoRandom: Si,
16533              pseudoRandomRange: Ai,
16534              pseudoRandomRangeInt: Ti,
16535              nextPow2: vi,
16536              repeat: Ei,
16537              pingPong: Ci,
16538              inverseLerp: xi,
16539              absMaxComponent: wi,
16540              absMax: Ri,
16541              enumerableProps: Ii,
16542              MATH_FLOAT_ARRAY: hs,
16543              MathBase: cs
16544            });
16545            t("math", us);
16546            const _s = new class {
16547              constructor() {
16548                this._finalizationRegistry = null;
16549                this._gcObjects = new WeakMap;
16550              }
16551              registerGCObject(t) {
16552                return t;
16553              }
16554              init() {}
16555              finalizationRegistryCallback(t) {
16556                const e = this._gcObjects.get(t);
16557                if (e) {
16558                  this._gcObjects.delete(t);
16559                  e.destroy();
16560                }
16561                this._finalizationRegistry.unregister(t);
16562              }
16563              destroy() {}
16564            };
16565            const ds = (t, e, i) => {
16566              for (let s = 0; s < e.length; ++s) {
16567                t.length <= s && t.push(new i);
16568                t[s].copy(e[s]);
16569              }
16570              t.length = e.length;
16571            };
16572            let ps;
16573            !function(t) {
16574              t[t.UNKNOWN = 0] = "UNKNOWN";
16575              t[t.SWAPCHAIN = 1] = "SWAPCHAIN";
16576              t[t.BUFFER = 2] = "BUFFER";
16577              t[t.TEXTURE = 3] = "TEXTURE";
16578              t[t.RENDER_PASS = 4] = "RENDER_PASS";
16579              t[t.FRAMEBUFFER = 5] = "FRAMEBUFFER";
16580              t[t.SAMPLER = 6] = "SAMPLER";
16581              t[t.SHADER = 7] = "SHADER";
16582              t[t.DESCRIPTOR_SET_LAYOUT = 8] = "DESCRIPTOR_SET_LAYOUT";
16583              t[t.PIPELINE_LAYOUT = 9] = "PIPELINE_LAYOUT";
16584              t[t.PIPELINE_STATE = 10] = "PIPELINE_STATE";
16585              t[t.DESCRIPTOR_SET = 11] = "DESCRIPTOR_SET";
16586              t[t.INPUT_ASSEMBLER = 12] = "INPUT_ASSEMBLER";
16587              t[t.COMMAND_BUFFER = 13] = "COMMAND_BUFFER";
16588              t[t.QUEUE = 14] = "QUEUE";
16589              t[t.QUERY_POOL = 15] = "QUERY_POOL";
16590              t[t.GLOBAL_BARRIER = 16] = "GLOBAL_BARRIER";
16591              t[t.TEXTURE_BARRIER = 17] = "TEXTURE_BARRIER";
16592              t[t.BUFFER_BARRIER = 18] = "BUFFER_BARRIER";
16593              t[t.COUNT = 19] = "COUNT";
16594            }(ps || (ps = {}));
16595            let ms;
16596            !function(t) {
16597              t[t.UNREADY = 0] = "UNREADY";
16598              t[t.FAILED = 1] = "FAILED";
16599              t[t.SUCCESS = 2] = "SUCCESS";
16600            }(ms || (ms = {}));
16601            let fs;
16602            !function(t) {
16603              t[t.UNKNOWN = 0] = "UNKNOWN";
16604              t[t.GLES2 = 1] = "GLES2";
16605              t[t.GLES3 = 2] = "GLES3";
16606              t[t.METAL = 3] = "METAL";
16607              t[t.VULKAN = 4] = "VULKAN";
16608              t[t.NVN = 5] = "NVN";
16609              t[t.WEBGL = 6] = "WEBGL";
16610              t[t.WEBGL2 = 7] = "WEBGL2";
16611              t[t.WEBGPU = 8] = "WEBGPU";
16612            }(fs || (fs = {}));
16613            let gs;
16614            !function(t) {
16615              t[t.IDENTITY = 0] = "IDENTITY";
16616              t[t.ROTATE_90 = 1] = "ROTATE_90";
16617              t[t.ROTATE_180 = 2] = "ROTATE_180";
16618              t[t.ROTATE_270 = 3] = "ROTATE_270";
16619            }(gs || (gs = {}));
16620            let ys;
16621            !function(t) {
16622              t[t.ELEMENT_INDEX_UINT = 0] = "ELEMENT_INDEX_UINT";
16623              t[t.INSTANCED_ARRAYS = 1] = "INSTANCED_ARRAYS";
16624              t[t.MULTIPLE_RENDER_TARGETS = 2] = "MULTIPLE_RENDER_TARGETS";
16625              t[t.BLEND_MINMAX = 3] = "BLEND_MINMAX";
16626              t[t.COMPUTE_SHADER = 4] = "COMPUTE_SHADER";
16627              t[t.INPUT_ATTACHMENT_BENEFIT = 5] = "INPUT_ATTACHMENT_BENEFIT";
16628              t[t.COUNT = 6] = "COUNT";
16629            }(ys || (ys = {}));
16630            let bs;
16631            !function(t) {
16632              t[t.UNKNOWN = 0] = "UNKNOWN";
16633              t[t.A8 = 1] = "A8";
16634              t[t.L8 = 2] = "L8";
16635              t[t.LA8 = 3] = "LA8";
16636              t[t.R8 = 4] = "R8";
16637              t[t.R8SN = 5] = "R8SN";
16638              t[t.R8UI = 6] = "R8UI";
16639              t[t.R8I = 7] = "R8I";
16640              t[t.R16F = 8] = "R16F";
16641              t[t.R16UI = 9] = "R16UI";
16642              t[t.R16I = 10] = "R16I";
16643              t[t.R32F = 11] = "R32F";
16644              t[t.R32UI = 12] = "R32UI";
16645              t[t.R32I = 13] = "R32I";
16646              t[t.RG8 = 14] = "RG8";
16647              t[t.RG8SN = 15] = "RG8SN";
16648              t[t.RG8UI = 16] = "RG8UI";
16649              t[t.RG8I = 17] = "RG8I";
16650              t[t.RG16F = 18] = "RG16F";
16651              t[t.RG16UI = 19] = "RG16UI";
16652              t[t.RG16I = 20] = "RG16I";
16653              t[t.RG32F = 21] = "RG32F";
16654              t[t.RG32UI = 22] = "RG32UI";
16655              t[t.RG32I = 23] = "RG32I";
16656              t[t.RGB8 = 24] = "RGB8";
16657              t[t.SRGB8 = 25] = "SRGB8";
16658              t[t.RGB8SN = 26] = "RGB8SN";
16659              t[t.RGB8UI = 27] = "RGB8UI";
16660              t[t.RGB8I = 28] = "RGB8I";
16661              t[t.RGB16F = 29] = "RGB16F";
16662              t[t.RGB16UI = 30] = "RGB16UI";
16663              t[t.RGB16I = 31] = "RGB16I";
16664              t[t.RGB32F = 32] = "RGB32F";
16665              t[t.RGB32UI = 33] = "RGB32UI";
16666              t[t.RGB32I = 34] = "RGB32I";
16667              t[t.RGBA8 = 35] = "RGBA8";
16668              t[t.BGRA8 = 36] = "BGRA8";
16669              t[t.SRGB8_A8 = 37] = "SRGB8_A8";
16670              t[t.RGBA8SN = 38] = "RGBA8SN";
16671              t[t.RGBA8UI = 39] = "RGBA8UI";
16672              t[t.RGBA8I = 40] = "RGBA8I";
16673              t[t.RGBA16F = 41] = "RGBA16F";
16674              t[t.RGBA16UI = 42] = "RGBA16UI";
16675              t[t.RGBA16I = 43] = "RGBA16I";
16676              t[t.RGBA32F = 44] = "RGBA32F";
16677              t[t.RGBA32UI = 45] = "RGBA32UI";
16678              t[t.RGBA32I = 46] = "RGBA32I";
16679              t[t.R5G6B5 = 47] = "R5G6B5";
16680              t[t.R11G11B10F = 48] = "R11G11B10F";
16681              t[t.RGB5A1 = 49] = "RGB5A1";
16682              t[t.RGBA4 = 50] = "RGBA4";
16683              t[t.RGB10A2 = 51] = "RGB10A2";
16684              t[t.RGB10A2UI = 52] = "RGB10A2UI";
16685              t[t.RGB9E5 = 53] = "RGB9E5";
16686              t[t.DEPTH = 54] = "DEPTH";
16687              t[t.DEPTH_STENCIL = 55] = "DEPTH_STENCIL";
16688              t[t.BC1 = 56] = "BC1";
16689              t[t.BC1_ALPHA = 57] = "BC1_ALPHA";
16690              t[t.BC1_SRGB = 58] = "BC1_SRGB";
16691              t[t.BC1_SRGB_ALPHA = 59] = "BC1_SRGB_ALPHA";
16692              t[t.BC2 = 60] = "BC2";
16693              t[t.BC2_SRGB = 61] = "BC2_SRGB";
16694              t[t.BC3 = 62] = "BC3";
16695              t[t.BC3_SRGB = 63] = "BC3_SRGB";
16696              t[t.BC4 = 64] = "BC4";
16697              t[t.BC4_SNORM = 65] = "BC4_SNORM";
16698              t[t.BC5 = 66] = "BC5";
16699              t[t.BC5_SNORM = 67] = "BC5_SNORM";
16700              t[t.BC6H_UF16 = 68] = "BC6H_UF16";
16701              t[t.BC6H_SF16 = 69] = "BC6H_SF16";
16702              t[t.BC7 = 70] = "BC7";
16703              t[t.BC7_SRGB = 71] = "BC7_SRGB";
16704              t[t.ETC_RGB8 = 72] = "ETC_RGB8";
16705              t[t.ETC2_RGB8 = 73] = "ETC2_RGB8";
16706              t[t.ETC2_SRGB8 = 74] = "ETC2_SRGB8";
16707              t[t.ETC2_RGB8_A1 = 75] = "ETC2_RGB8_A1";
16708              t[t.ETC2_SRGB8_A1 = 76] = "ETC2_SRGB8_A1";
16709              t[t.ETC2_RGBA8 = 77] = "ETC2_RGBA8";
16710              t[t.ETC2_SRGB8_A8 = 78] = "ETC2_SRGB8_A8";
16711              t[t.EAC_R11 = 79] = "EAC_R11";
16712              t[t.EAC_R11SN = 80] = "EAC_R11SN";
16713              t[t.EAC_RG11 = 81] = "EAC_RG11";
16714              t[t.EAC_RG11SN = 82] = "EAC_RG11SN";
16715              t[t.PVRTC_RGB2 = 83] = "PVRTC_RGB2";
16716              t[t.PVRTC_RGBA2 = 84] = "PVRTC_RGBA2";
16717              t[t.PVRTC_RGB4 = 85] = "PVRTC_RGB4";
16718              t[t.PVRTC_RGBA4 = 86] = "PVRTC_RGBA4";
16719              t[t.PVRTC2_2BPP = 87] = "PVRTC2_2BPP";
16720              t[t.PVRTC2_4BPP = 88] = "PVRTC2_4BPP";
16721              t[t.ASTC_RGBA_4X4 = 89] = "ASTC_RGBA_4X4";
16722              t[t.ASTC_RGBA_5X4 = 90] = "ASTC_RGBA_5X4";
16723              t[t.ASTC_RGBA_5X5 = 91] = "ASTC_RGBA_5X5";
16724              t[t.ASTC_RGBA_6X5 = 92] = "ASTC_RGBA_6X5";
16725              t[t.ASTC_RGBA_6X6 = 93] = "ASTC_RGBA_6X6";
16726              t[t.ASTC_RGBA_8X5 = 94] = "ASTC_RGBA_8X5";
16727              t[t.ASTC_RGBA_8X6 = 95] = "ASTC_RGBA_8X6";
16728              t[t.ASTC_RGBA_8X8 = 96] = "ASTC_RGBA_8X8";
16729              t[t.ASTC_RGBA_10X5 = 97] = "ASTC_RGBA_10X5";
16730              t[t.ASTC_RGBA_10X6 = 98] = "ASTC_RGBA_10X6";
16731              t[t.ASTC_RGBA_10X8 = 99] = "ASTC_RGBA_10X8";
16732              t[t.ASTC_RGBA_10X10 = 100] = "ASTC_RGBA_10X10";
16733              t[t.ASTC_RGBA_12X10 = 101] = "ASTC_RGBA_12X10";
16734              t[t.ASTC_RGBA_12X12 = 102] = "ASTC_RGBA_12X12";
16735              t[t.ASTC_SRGBA_4X4 = 103] = "ASTC_SRGBA_4X4";
16736              t[t.ASTC_SRGBA_5X4 = 104] = "ASTC_SRGBA_5X4";
16737              t[t.ASTC_SRGBA_5X5 = 105] = "ASTC_SRGBA_5X5";
16738              t[t.ASTC_SRGBA_6X5 = 106] = "ASTC_SRGBA_6X5";
16739              t[t.ASTC_SRGBA_6X6 = 107] = "ASTC_SRGBA_6X6";
16740              t[t.ASTC_SRGBA_8X5 = 108] = "ASTC_SRGBA_8X5";
16741              t[t.ASTC_SRGBA_8X6 = 109] = "ASTC_SRGBA_8X6";
16742              t[t.ASTC_SRGBA_8X8 = 110] = "ASTC_SRGBA_8X8";
16743              t[t.ASTC_SRGBA_10X5 = 111] = "ASTC_SRGBA_10X5";
16744              t[t.ASTC_SRGBA_10X6 = 112] = "ASTC_SRGBA_10X6";
16745              t[t.ASTC_SRGBA_10X8 = 113] = "ASTC_SRGBA_10X8";
16746              t[t.ASTC_SRGBA_10X10 = 114] = "ASTC_SRGBA_10X10";
16747              t[t.ASTC_SRGBA_12X10 = 115] = "ASTC_SRGBA_12X10";
16748              t[t.ASTC_SRGBA_12X12 = 116] = "ASTC_SRGBA_12X12";
16749              t[t.COUNT = 117] = "COUNT";
16750            }(bs || (bs = {}));
16751            let Ss;
16752            !function(t) {
16753              t[t.NONE = 0] = "NONE";
16754              t[t.UNORM = 1] = "UNORM";
16755              t[t.SNORM = 2] = "SNORM";
16756              t[t.UINT = 3] = "UINT";
16757              t[t.INT = 4] = "INT";
16758              t[t.UFLOAT = 5] = "UFLOAT";
16759              t[t.FLOAT = 6] = "FLOAT";
16760            }(Ss || (Ss = {}));
16761            let As;
16762            !function(t) {
16763              t[t.UNKNOWN = 0] = "UNKNOWN";
16764              t[t.BOOL = 1] = "BOOL";
16765              t[t.BOOL2 = 2] = "BOOL2";
16766              t[t.BOOL3 = 3] = "BOOL3";
16767              t[t.BOOL4 = 4] = "BOOL4";
16768              t[t.INT = 5] = "INT";
16769              t[t.INT2 = 6] = "INT2";
16770              t[t.INT3 = 7] = "INT3";
16771              t[t.INT4 = 8] = "INT4";
16772              t[t.UINT = 9] = "UINT";
16773              t[t.UINT2 = 10] = "UINT2";
16774              t[t.UINT3 = 11] = "UINT3";
16775              t[t.UINT4 = 12] = "UINT4";
16776              t[t.FLOAT = 13] = "FLOAT";
16777              t[t.FLOAT2 = 14] = "FLOAT2";
16778              t[t.FLOAT3 = 15] = "FLOAT3";
16779              t[t.FLOAT4 = 16] = "FLOAT4";
16780              t[t.MAT2 = 17] = "MAT2";
16781              t[t.MAT2X3 = 18] = "MAT2X3";
16782              t[t.MAT2X4 = 19] = "MAT2X4";
16783              t[t.MAT3X2 = 20] = "MAT3X2";
16784              t[t.MAT3 = 21] = "MAT3";
16785              t[t.MAT3X4 = 22] = "MAT3X4";
16786              t[t.MAT4X2 = 23] = "MAT4X2";
16787              t[t.MAT4X3 = 24] = "MAT4X3";
16788              t[t.MAT4 = 25] = "MAT4";
16789              t[t.SAMPLER1D = 26] = "SAMPLER1D";
16790              t[t.SAMPLER1D_ARRAY = 27] = "SAMPLER1D_ARRAY";
16791              t[t.SAMPLER2D = 28] = "SAMPLER2D";
16792              t[t.SAMPLER2D_ARRAY = 29] = "SAMPLER2D_ARRAY";
16793              t[t.SAMPLER3D = 30] = "SAMPLER3D";
16794              t[t.SAMPLER_CUBE = 31] = "SAMPLER_CUBE";
16795              t[t.SAMPLER = 32] = "SAMPLER";
16796              t[t.TEXTURE1D = 33] = "TEXTURE1D";
16797              t[t.TEXTURE1D_ARRAY = 34] = "TEXTURE1D_ARRAY";
16798              t[t.TEXTURE2D = 35] = "TEXTURE2D";
16799              t[t.TEXTURE2D_ARRAY = 36] = "TEXTURE2D_ARRAY";
16800              t[t.TEXTURE3D = 37] = "TEXTURE3D";
16801              t[t.TEXTURE_CUBE = 38] = "TEXTURE_CUBE";
16802              t[t.IMAGE1D = 39] = "IMAGE1D";
16803              t[t.IMAGE1D_ARRAY = 40] = "IMAGE1D_ARRAY";
16804              t[t.IMAGE2D = 41] = "IMAGE2D";
16805              t[t.IMAGE2D_ARRAY = 42] = "IMAGE2D_ARRAY";
16806              t[t.IMAGE3D = 43] = "IMAGE3D";
16807              t[t.IMAGE_CUBE = 44] = "IMAGE_CUBE";
16808              t[t.SUBPASS_INPUT = 45] = "SUBPASS_INPUT";
16809              t[t.COUNT = 46] = "COUNT";
16810            }(As || (As = {}));
16811            let Ts;
16812            !function(t) {
16813              t[t.NONE = 0] = "NONE";
16814              t[t.TRANSFER_SRC = 1] = "TRANSFER_SRC";
16815              t[t.TRANSFER_DST = 2] = "TRANSFER_DST";
16816              t[t.INDEX = 4] = "INDEX";
16817              t[t.VERTEX = 8] = "VERTEX";
16818              t[t.UNIFORM = 16] = "UNIFORM";
16819              t[t.STORAGE = 32] = "STORAGE";
16820              t[t.INDIRECT = 64] = "INDIRECT";
16821            }(Ts || (Ts = {}));
16822            let vs;
16823            !function(t) {
16824              t[t.NONE = 0] = "NONE";
16825            }(vs || (vs = {}));
16826            let Es;
16827            !function(t) {
16828              t[t.NONE = 0] = "NONE";
16829              t[t.READ_ONLY = 1] = "READ_ONLY";
16830              t[t.WRITE_ONLY = 2] = "WRITE_ONLY";
16831              t[t.READ_WRITE = 3] = "READ_WRITE";
16832            }(Es || (Es = {}));
16833            let Cs;
16834            !function(t) {
16835              t[t.NONE = 0] = "NONE";
16836              t[t.DEVICE = 1] = "DEVICE";
16837              t[t.HOST = 2] = "HOST";
16838            }(Cs || (Cs = {}));
16839            let xs;
16840            !function(t) {
16841              t[t.TEX1D = 0] = "TEX1D";
16842              t[t.TEX2D = 1] = "TEX2D";
16843              t[t.TEX3D = 2] = "TEX3D";
16844              t[t.CUBE = 3] = "CUBE";
16845              t[t.TEX1D_ARRAY = 4] = "TEX1D_ARRAY";
16846              t[t.TEX2D_ARRAY = 5] = "TEX2D_ARRAY";
16847            }(xs || (xs = {}));
16848            let ws;
16849            !function(t) {
16850              t[t.NONE = 0] = "NONE";
16851              t[t.TRANSFER_SRC = 1] = "TRANSFER_SRC";
16852              t[t.TRANSFER_DST = 2] = "TRANSFER_DST";
16853              t[t.SAMPLED = 4] = "SAMPLED";
16854              t[t.STORAGE = 8] = "STORAGE";
16855              t[t.COLOR_ATTACHMENT = 16] = "COLOR_ATTACHMENT";
16856              t[t.DEPTH_STENCIL_ATTACHMENT = 32] = "DEPTH_STENCIL_ATTACHMENT";
16857              t[t.INPUT_ATTACHMENT = 64] = "INPUT_ATTACHMENT";
16858            }(ws || (ws = {}));
16859            let Rs;
16860            !function(t) {
16861              t[t.NONE = 0] = "NONE";
16862              t[t.GEN_MIPMAP = 1] = "GEN_MIPMAP";
16863              t[t.GENERAL_LAYOUT = 2] = "GENERAL_LAYOUT";
16864            }(Rs || (Rs = {}));
16865            let Is;
16866            !function(t) {
16867              t[t.NONE = 0] = "NONE";
16868              t[t.RENDER_TARGET = 1] = "RENDER_TARGET";
16869              t[t.SAMPLED_TEXTURE = 2] = "SAMPLED_TEXTURE";
16870              t[t.LINEAR_FILTER = 4] = "LINEAR_FILTER";
16871              t[t.STORAGE_TEXTURE = 8] = "STORAGE_TEXTURE";
16872              t[t.VERTEX_ATTRIBUTE = 16] = "VERTEX_ATTRIBUTE";
16873            }(Is || (Is = {}));
16874            let Ms;
16875            !function(t) {
16876              t[t.ONE = 0] = "ONE";
16877              t[t.MULTIPLE_PERFORMANCE = 1] = "MULTIPLE_PERFORMANCE";
16878              t[t.MULTIPLE_BALANCE = 2] = "MULTIPLE_BALANCE";
16879              t[t.MULTIPLE_QUALITY = 3] = "MULTIPLE_QUALITY";
16880            }(Ms || (Ms = {}));
16881            let Bs;
16882            !function(t) {
16883              t[t.OFF = 0] = "OFF";
16884              t[t.ON = 1] = "ON";
16885              t[t.RELAXED = 2] = "RELAXED";
16886              t[t.MAILBOX = 3] = "MAILBOX";
16887              t[t.HALF = 4] = "HALF";
16888            }(Bs || (Bs = {}));
16889            let Ds;
16890            !function(t) {
16891              t[t.NONE = 0] = "NONE";
16892              t[t.POINT = 1] = "POINT";
16893              t[t.LINEAR = 2] = "LINEAR";
16894              t[t.ANISOTROPIC = 3] = "ANISOTROPIC";
16895            }(Ds || (Ds = {}));
16896            let Ps;
16897            !function(t) {
16898              t[t.WRAP = 0] = "WRAP";
16899              t[t.MIRROR = 1] = "MIRROR";
16900              t[t.CLAMP = 2] = "CLAMP";
16901              t[t.BORDER = 3] = "BORDER";
16902            }(Ps || (Ps = {}));
16903            let Os;
16904            !function(t) {
16905              t[t.NEVER = 0] = "NEVER";
16906              t[t.LESS = 1] = "LESS";
16907              t[t.EQUAL = 2] = "EQUAL";
16908              t[t.LESS_EQUAL = 3] = "LESS_EQUAL";
16909              t[t.GREATER = 4] = "GREATER";
16910              t[t.NOT_EQUAL = 5] = "NOT_EQUAL";
16911              t[t.GREATER_EQUAL = 6] = "GREATER_EQUAL";
16912              t[t.ALWAYS = 7] = "ALWAYS";
16913            }(Os || (Os = {}));
16914            let Ns;
16915            !function(t) {
16916              t[t.ZERO = 0] = "ZERO";
16917              t[t.KEEP = 1] = "KEEP";
16918              t[t.REPLACE = 2] = "REPLACE";
16919              t[t.INCR = 3] = "INCR";
16920              t[t.DECR = 4] = "DECR";
16921              t[t.INVERT = 5] = "INVERT";
16922              t[t.INCR_WRAP = 6] = "INCR_WRAP";
16923              t[t.DECR_WRAP = 7] = "DECR_WRAP";
16924            }(Ns || (Ns = {}));
16925            let Ls;
16926            !function(t) {
16927              t[t.ZERO = 0] = "ZERO";
16928              t[t.ONE = 1] = "ONE";
16929              t[t.SRC_ALPHA = 2] = "SRC_ALPHA";
16930              t[t.DST_ALPHA = 3] = "DST_ALPHA";
16931              t[t.ONE_MINUS_SRC_ALPHA = 4] = "ONE_MINUS_SRC_ALPHA";
16932              t[t.ONE_MINUS_DST_ALPHA = 5] = "ONE_MINUS_DST_ALPHA";
16933              t[t.SRC_COLOR = 6] = "SRC_COLOR";
16934              t[t.DST_COLOR = 7] = "DST_COLOR";
16935              t[t.ONE_MINUS_SRC_COLOR = 8] = "ONE_MINUS_SRC_COLOR";
16936              t[t.ONE_MINUS_DST_COLOR = 9] = "ONE_MINUS_DST_COLOR";
16937              t[t.SRC_ALPHA_SATURATE = 10] = "SRC_ALPHA_SATURATE";
16938              t[t.CONSTANT_COLOR = 11] = "CONSTANT_COLOR";
16939              t[t.ONE_MINUS_CONSTANT_COLOR = 12] = "ONE_MINUS_CONSTANT_COLOR";
16940              t[t.CONSTANT_ALPHA = 13] = "CONSTANT_ALPHA";
16941              t[t.ONE_MINUS_CONSTANT_ALPHA = 14] = "ONE_MINUS_CONSTANT_ALPHA";
16942            }(Ls || (Ls = {}));
16943            let Fs;
16944            !function(t) {
16945              t[t.ADD = 0] = "ADD";
16946              t[t.SUB = 1] = "SUB";
16947              t[t.REV_SUB = 2] = "REV_SUB";
16948              t[t.MIN = 3] = "MIN";
16949              t[t.MAX = 4] = "MAX";
16950            }(Fs || (Fs = {}));
16951            let Vs;
16952            !function(t) {
16953              t[t.NONE = 0] = "NONE";
16954              t[t.R = 1] = "R";
16955              t[t.G = 2] = "G";
16956              t[t.B = 4] = "B";
16957              t[t.A = 8] = "A";
16958              t[t.ALL = 15] = "ALL";
16959            }(Vs || (Vs = {}));
16960            let ks;
16961            !function(t) {
16962              t[t.NONE = 0] = "NONE";
16963              t[t.VERTEX = 1] = "VERTEX";
16964              t[t.CONTROL = 2] = "CONTROL";
16965              t[t.EVALUATION = 4] = "EVALUATION";
16966              t[t.GEOMETRY = 8] = "GEOMETRY";
16967              t[t.FRAGMENT = 16] = "FRAGMENT";
16968              t[t.COMPUTE = 32] = "COMPUTE";
16969              t[t.ALL = 63] = "ALL";
16970            }(ks || (ks = {}));
16971            let Us;
16972            !function(t) {
16973              t[t.LOAD = 0] = "LOAD";
16974              t[t.CLEAR = 1] = "CLEAR";
16975              t[t.DISCARD = 2] = "DISCARD";
16976            }(Us || (Us = {}));
16977            let Gs;
16978            !function(t) {
16979              t[t.STORE = 0] = "STORE";
16980              t[t.DISCARD = 1] = "DISCARD";
16981            }(Gs || (Gs = {}));
16982            let zs;
16983            !function(t) {
16984              t[t.NONE = 0] = "NONE";
16985              t[t.INDIRECT_BUFFER = 1] = "INDIRECT_BUFFER";
16986              t[t.INDEX_BUFFER = 2] = "INDEX_BUFFER";
16987              t[t.VERTEX_BUFFER = 4] = "VERTEX_BUFFER";
16988              t[t.VERTEX_SHADER_READ_UNIFORM_BUFFER = 8] = "VERTEX_SHADER_READ_UNIFORM_BUFFER";
16989              t[t.VERTEX_SHADER_READ_TEXTURE = 16] = "VERTEX_SHADER_READ_TEXTURE";
16990              t[t.VERTEX_SHADER_READ_OTHER = 32] = "VERTEX_SHADER_READ_OTHER";
16991              t[t.FRAGMENT_SHADER_READ_UNIFORM_BUFFER = 64] = "FRAGMENT_SHADER_READ_UNIFORM_BUFFER";
16992              t[t.FRAGMENT_SHADER_READ_TEXTURE = 128] = "FRAGMENT_SHADER_READ_TEXTURE";
16993              t[t.FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT = 256] = "FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT";
16994              t[t.FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT = 512] = "FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT";
16995              t[t.FRAGMENT_SHADER_READ_OTHER = 1024] = "FRAGMENT_SHADER_READ_OTHER";
16996              t[t.COLOR_ATTACHMENT_READ = 2048] = "COLOR_ATTACHMENT_READ";
16997              t[t.DEPTH_STENCIL_ATTACHMENT_READ = 4096] = "DEPTH_STENCIL_ATTACHMENT_READ";
16998              t[t.COMPUTE_SHADER_READ_UNIFORM_BUFFER = 8192] = "COMPUTE_SHADER_READ_UNIFORM_BUFFER";
16999              t[t.COMPUTE_SHADER_READ_TEXTURE = 16384] = "COMPUTE_SHADER_READ_TEXTURE";
17000              t[t.COMPUTE_SHADER_READ_OTHER = 32768] = "COMPUTE_SHADER_READ_OTHER";
17001              t[t.TRANSFER_READ = 65536] = "TRANSFER_READ";
17002              t[t.HOST_READ = 131072] = "HOST_READ";
17003              t[t.PRESENT = 262144] = "PRESENT";
17004              t[t.VERTEX_SHADER_WRITE = 524288] = "VERTEX_SHADER_WRITE";
17005              t[t.FRAGMENT_SHADER_WRITE = 1048576] = "FRAGMENT_SHADER_WRITE";
17006              t[t.COLOR_ATTACHMENT_WRITE = 2097152] = "COLOR_ATTACHMENT_WRITE";
17007              t[t.DEPTH_STENCIL_ATTACHMENT_WRITE = 4194304] = "DEPTH_STENCIL_ATTACHMENT_WRITE";
17008              t[t.COMPUTE_SHADER_WRITE = 8388608] = "COMPUTE_SHADER_WRITE";
17009              t[t.TRANSFER_WRITE = 16777216] = "TRANSFER_WRITE";
17010              t[t.HOST_PREINITIALIZED = 33554432] = "HOST_PREINITIALIZED";
17011              t[t.HOST_WRITE = 67108864] = "HOST_WRITE";
17012            }(zs || (zs = {}));
17013            let Hs;
17014            !function(t) {
17015              t[t.NONE = 0] = "NONE";
17016              t[t.SAMPLE_ZERO = 1] = "SAMPLE_ZERO";
17017              t[t.AVERAGE = 2] = "AVERAGE";
17018              t[t.MIN = 3] = "MIN";
17019              t[t.MAX = 4] = "MAX";
17020            }(Hs || (Hs = {}));
17021            let js;
17022            !function(t) {
17023              t[t.GRAPHICS = 0] = "GRAPHICS";
17024              t[t.COMPUTE = 1] = "COMPUTE";
17025              t[t.RAY_TRACING = 2] = "RAY_TRACING";
17026            }(js || (js = {}));
17027            let Xs;
17028            !function(t) {
17029              t[t.POINT_LIST = 0] = "POINT_LIST";
17030              t[t.LINE_LIST = 1] = "LINE_LIST";
17031              t[t.LINE_STRIP = 2] = "LINE_STRIP";
17032              t[t.LINE_LOOP = 3] = "LINE_LOOP";
17033              t[t.LINE_LIST_ADJACENCY = 4] = "LINE_LIST_ADJACENCY";
17034              t[t.LINE_STRIP_ADJACENCY = 5] = "LINE_STRIP_ADJACENCY";
17035              t[t.ISO_LINE_LIST = 6] = "ISO_LINE_LIST";
17036              t[t.TRIANGLE_LIST = 7] = "TRIANGLE_LIST";
17037              t[t.TRIANGLE_STRIP = 8] = "TRIANGLE_STRIP";
17038              t[t.TRIANGLE_FAN = 9] = "TRIANGLE_FAN";
17039              t[t.TRIANGLE_LIST_ADJACENCY = 10] = "TRIANGLE_LIST_ADJACENCY";
17040              t[t.TRIANGLE_STRIP_ADJACENCY = 11] = "TRIANGLE_STRIP_ADJACENCY";
17041              t[t.TRIANGLE_PATCH_ADJACENCY = 12] = "TRIANGLE_PATCH_ADJACENCY";
17042              t[t.QUAD_PATCH_LIST = 13] = "QUAD_PATCH_LIST";
17043            }(Xs || (Xs = {}));
17044            let Ws;
17045            !function(t) {
17046              t[t.FILL = 0] = "FILL";
17047              t[t.POINT = 1] = "POINT";
17048              t[t.LINE = 2] = "LINE";
17049            }(Ws || (Ws = {}));
17050            let Ys;
17051            !function(t) {
17052              t[t.GOURAND = 0] = "GOURAND";
17053              t[t.FLAT = 1] = "FLAT";
17054            }(Ys || (Ys = {}));
17055            let qs;
17056            !function(t) {
17057              t[t.NONE = 0] = "NONE";
17058              t[t.FRONT = 1] = "FRONT";
17059              t[t.BACK = 2] = "BACK";
17060            }(qs || (qs = {}));
17061            let Ks;
17062            !function(t) {
17063              t[t.NONE = 0] = "NONE";
17064              t[t.LINE_WIDTH = 1] = "LINE_WIDTH";
17065              t[t.DEPTH_BIAS = 2] = "DEPTH_BIAS";
17066              t[t.BLEND_CONSTANTS = 4] = "BLEND_CONSTANTS";
17067              t[t.DEPTH_BOUNDS = 8] = "DEPTH_BOUNDS";
17068              t[t.STENCIL_WRITE_MASK = 16] = "STENCIL_WRITE_MASK";
17069              t[t.STENCIL_COMPARE_MASK = 32] = "STENCIL_COMPARE_MASK";
17070            }(Ks || (Ks = {}));
17071            let Js;
17072            !function(t) {
17073              t[t.FRONT = 1] = "FRONT";
17074              t[t.BACK = 2] = "BACK";
17075              t[t.ALL = 3] = "ALL";
17076            }(Js || (Js = {}));
17077            let Zs;
17078            !function(t) {
17079              t[t.UNKNOWN = 0] = "UNKNOWN";
17080              t[t.UNIFORM_BUFFER = 1] = "UNIFORM_BUFFER";
17081              t[t.DYNAMIC_UNIFORM_BUFFER = 2] = "DYNAMIC_UNIFORM_BUFFER";
17082              t[t.STORAGE_BUFFER = 4] = "STORAGE_BUFFER";
17083              t[t.DYNAMIC_STORAGE_BUFFER = 8] = "DYNAMIC_STORAGE_BUFFER";
17084              t[t.SAMPLER_TEXTURE = 16] = "SAMPLER_TEXTURE";
17085              t[t.SAMPLER = 32] = "SAMPLER";
17086              t[t.TEXTURE = 64] = "TEXTURE";
17087              t[t.STORAGE_IMAGE = 128] = "STORAGE_IMAGE";
17088              t[t.INPUT_ATTACHMENT = 256] = "INPUT_ATTACHMENT";
17089            }(Zs || (Zs = {}));
17090            let Qs;
17091            !function(t) {
17092              t[t.GRAPHICS = 0] = "GRAPHICS";
17093              t[t.COMPUTE = 1] = "COMPUTE";
17094              t[t.TRANSFER = 2] = "TRANSFER";
17095            }(Qs || (Qs = {}));
17096            let $s;
17097            !function(t) {
17098              t[t.OCCLUSION = 0] = "OCCLUSION";
17099              t[t.PIPELINE_STATISTICS = 1] = "PIPELINE_STATISTICS";
17100              t[t.TIMESTAMP = 2] = "TIMESTAMP";
17101            }($s || ($s = {}));
17102            let tn;
17103            !function(t) {
17104              t[t.PRIMARY = 0] = "PRIMARY";
17105              t[t.SECONDARY = 1] = "SECONDARY";
17106            }(tn || (tn = {}));
17107            let en;
17108            !function(t) {
17109              t[t.NONE = 0] = "NONE";
17110              t[t.COLOR = 1] = "COLOR";
17111              t[t.DEPTH = 2] = "DEPTH";
17112              t[t.STENCIL = 4] = "STENCIL";
17113              t[t.DEPTH_STENCIL = 6] = "DEPTH_STENCIL";
17114              t[t.ALL = 7] = "ALL";
17115            }(en || (en = {}));
17116            let sn;
17117            !function(t) {
17118              t[t.FULL = 0] = "FULL";
17119              t[t.SPLIT_BEGIN = 1] = "SPLIT_BEGIN";
17120              t[t.SPLIT_END = 2] = "SPLIT_END";
17121            }(sn || (sn = {}));
17122            let nn;
17123            !function(t) {
17124              t[t.RASTER = 0] = "RASTER";
17125              t[t.COMPUTE = 1] = "COMPUTE";
17126              t[t.COPY = 2] = "COPY";
17127              t[t.MOVE = 3] = "MOVE";
17128              t[t.RAYTRACE = 4] = "RAYTRACE";
17129              t[t.PRESENT = 5] = "PRESENT";
17130            }(nn || (nn = {}));
17131            class rn {
17132              constructor(t = 0, e = 0, i = 0) {
17133                this.x = t;
17134                this.y = e;
17135                this.z = i;
17136              }
17137              copy(t) {
17138                this.x = t.x;
17139                this.y = t.y;
17140                this.z = t.z;
17141                return this;
17142              }
17143            }
17144            class on {
17145              constructor(t = 0, e = 0, i = 0, s = 0, n = 0, r = 0, o = 0, a = 0, l = 0, h = 0, c = 0, u = 0, _ = 0, d = 1, p = 0, m = 0, f = new rn, g = new rn, y = !1, b = -1, S = 1, A = 1) {
17146                this.maxVertexAttributes = t;
17147                this.maxVertexUniformVectors = e;
17148                this.maxFragmentUniformVectors = i;
17149                this.maxTextureUnits = s;
17150                this.maxImageUnits = n;
17151                this.maxVertexTextureUnits = r;
17152                this.maxColorRenderTargets = o;
17153                this.maxShaderStorageBufferBindings = a;
17154                this.maxShaderStorageBlockSize = l;
17155                this.maxUniformBufferBindings = h;
17156                this.maxUniformBlockSize = c;
17157                this.maxTextureSize = u;
17158                this.maxCubeMapTextureSize = _;
17159                this.uboOffsetAlignment = d;
17160                this.maxComputeSharedMemorySize = p;
17161                this.maxComputeWorkGroupInvocations = m;
17162                this.maxComputeWorkGroupSize = f;
17163                this.maxComputeWorkGroupCount = g;
17164                this.supportQuery = y;
17165                this.clipSpaceMinZ = b;
17166                this.screenSpaceSignY = S;
17167                this.clipSpaceSignY = A;
17168              }
17169              copy(t) {
17170                this.maxVertexAttributes = t.maxVertexAttributes;
17171                this.maxVertexUniformVectors = t.maxVertexUniformVectors;
17172                this.maxFragmentUniformVectors = t.maxFragmentUniformVectors;
17173                this.maxTextureUnits = t.maxTextureUnits;
17174                this.maxImageUnits = t.maxImageUnits;
17175                this.maxVertexTextureUnits = t.maxVertexTextureUnits;
17176                this.maxColorRenderTargets = t.maxColorRenderTargets;
17177                this.maxShaderStorageBufferBindings = t.maxShaderStorageBufferBindings;
17178                this.maxShaderStorageBlockSize = t.maxShaderStorageBlockSize;
17179                this.maxUniformBufferBindings = t.maxUniformBufferBindings;
17180                this.maxUniformBlockSize = t.maxUniformBlockSize;
17181                this.maxTextureSize = t.maxTextureSize;
17182                this.maxCubeMapTextureSize = t.maxCubeMapTextureSize;
17183                this.uboOffsetAlignment = t.uboOffsetAlignment;
17184                this.maxComputeSharedMemorySize = t.maxComputeSharedMemorySize;
17185                this.maxComputeWorkGroupInvocations = t.maxComputeWorkGroupInvocations;
17186                this.maxComputeWorkGroupSize.copy(t.maxComputeWorkGroupSize);
17187                this.maxComputeWorkGroupCount.copy(t.maxComputeWorkGroupCount);
17188                this.supportQuery = t.supportQuery;
17189                this.clipSpaceMinZ = t.clipSpaceMinZ;
17190                this.screenSpaceSignY = t.screenSpaceSignY;
17191                this.clipSpaceSignY = t.clipSpaceSignY;
17192                return this;
17193              }
17194            }
17195            class an {
17196              constructor(t = !0) {
17197                this.enableBarrierDeduce = t;
17198              }
17199              copy(t) {
17200                this.enableBarrierDeduce = t.enableBarrierDeduce;
17201                return this;
17202              }
17203            }
17204            class ln {
17205              constructor(t = 0, e = 0, i = 0) {
17206                this.x = t;
17207                this.y = e;
17208                this.z = i;
17209              }
17210              copy(t) {
17211                this.x = t.x;
17212                this.y = t.y;
17213                this.z = t.z;
17214                return this;
17215              }
17216            }
17217            class hn {
17218              constructor(t = 0, e = 0, i = 0, s = 0) {
17219                this.x = t;
17220                this.y = e;
17221                this.width = i;
17222                this.height = s;
17223              }
17224              copy(t) {
17225                this.x = t.x;
17226                this.y = t.y;
17227                this.width = t.width;
17228                this.height = t.height;
17229                return this;
17230              }
17231            }
17232            class cn {
17233              constructor(t = 0, e = 0, i = 1) {
17234                this.width = t;
17235                this.height = e;
17236                this.depth = i;
17237              }
17238              copy(t) {
17239                this.width = t.width;
17240                this.height = t.height;
17241                this.depth = t.depth;
17242                return this;
17243              }
17244            }
17245            class un {
17246              constructor(t = 0, e = 0, i = 1) {
17247                this.mipLevel = t;
17248                this.baseArrayLayer = e;
17249                this.layerCount = i;
17250              }
17251              copy(t) {
17252                this.mipLevel = t.mipLevel;
17253                this.baseArrayLayer = t.baseArrayLayer;
17254                this.layerCount = t.layerCount;
17255                return this;
17256              }
17257            }
17258            class _n {
17259              constructor(t = 0, e = 1, i = 0, s = 1) {
17260                this.baseMipLevel = t;
17261                this.levelCount = e;
17262                this.baseArrayLayer = i;
17263                this.layerCount = s;
17264              }
17265              copy(t) {
17266                this.baseMipLevel = t.baseMipLevel;
17267                this.levelCount = t.levelCount;
17268                this.baseArrayLayer = t.baseArrayLayer;
17269                this.layerCount = t.layerCount;
17270                return this;
17271              }
17272            }
17273            class dn {
17274              constructor(t = new un, e = new ln, i = new un, s = new ln, n = new cn) {
17275                this.srcSubres = t;
17276                this.srcOffset = e;
17277                this.dstSubres = i;
17278                this.dstOffset = s;
17279                this.extent = n;
17280              }
17281              copy(t) {
17282                this.srcSubres.copy(t.srcSubres);
17283                this.srcOffset.copy(t.srcOffset);
17284                this.dstSubres.copy(t.dstSubres);
17285                this.dstOffset.copy(t.dstOffset);
17286                this.extent.copy(t.extent);
17287                return this;
17288              }
17289            }
17290            class pn {
17291              constructor(t = new un, e = new ln, i = new cn, s = new un, n = new ln, r = new cn) {
17292                this.srcSubres = t;
17293                this.srcOffset = e;
17294                this.srcExtent = i;
17295                this.dstSubres = s;
17296                this.dstOffset = n;
17297                this.dstExtent = r;
17298              }
17299              copy(t) {
17300                this.srcSubres.copy(t.srcSubres);
17301                this.srcOffset.copy(t.srcOffset);
17302                this.srcExtent.copy(t.srcExtent);
17303                this.dstSubres.copy(t.dstSubres);
17304                this.dstOffset.copy(t.dstOffset);
17305                this.dstExtent.copy(t.dstExtent);
17306                return this;
17307              }
17308            }
17309            class mn {
17310              constructor(t = 0, e = 0, i = 0, s = new ln, n = new cn, r = new un) {
17311                this.buffOffset = t;
17312                this.buffStride = e;
17313                this.buffTexHeight = i;
17314                this.texOffset = s;
17315                this.texExtent = n;
17316                this.texSubres = r;
17317              }
17318              copy(t) {
17319                this.buffOffset = t.buffOffset;
17320                this.buffStride = t.buffStride;
17321                this.buffTexHeight = t.buffTexHeight;
17322                this.texOffset.copy(t.texOffset);
17323                this.texExtent.copy(t.texExtent);
17324                this.texSubres.copy(t.texSubres);
17325                return this;
17326              }
17327            }
17328            class fn {
17329              constructor(t = 0, e = 0, i = 0, s = 0, n = 0, r = 1) {
17330                this.left = t;
17331                this.top = e;
17332                this.width = i;
17333                this.height = s;
17334                this.minDepth = n;
17335                this.maxDepth = r;
17336              }
17337              copy(t) {
17338                this.left = t.left;
17339                this.top = t.top;
17340                this.width = t.width;
17341                this.height = t.height;
17342                this.minDepth = t.minDepth;
17343                this.maxDepth = t.maxDepth;
17344                return this;
17345              }
17346            }
17347            class gn {
17348              constructor(t = 0, e = 0, i = 0, s = 0) {
17349                this.x = t;
17350                this.y = e;
17351                this.z = i;
17352                this.w = s;
17353              }
17354              copy(t) {
17355                this.x = t.x;
17356                this.y = t.y;
17357                this.z = t.z;
17358                this.w = t.w;
17359                return this;
17360              }
17361            }
17362            class yn {
17363              constructor(t = [ 0 ], e = [ 0 ], i = [ 0 ], s = [ 0 ], n = [ 0 ], r = [ 0 ], o = [ 0 ], a = [ 0 ]) {
17364                this.maxBlockCounts = t;
17365                this.maxSamplerTextureCounts = e;
17366                this.maxSamplerCounts = i;
17367                this.maxTextureCounts = s;
17368                this.maxBufferCounts = n;
17369                this.maxImageCounts = r;
17370                this.maxSubpassInputCounts = o;
17371                this.setIndices = a;
17372              }
17373              copy(t) {
17374                this.maxBlockCounts = t.maxBlockCounts.slice();
17375                this.maxSamplerTextureCounts = t.maxSamplerTextureCounts.slice();
17376                this.maxSamplerCounts = t.maxSamplerCounts.slice();
17377                this.maxTextureCounts = t.maxTextureCounts.slice();
17378                this.maxBufferCounts = t.maxBufferCounts.slice();
17379                this.maxImageCounts = t.maxImageCounts.slice();
17380                this.maxSubpassInputCounts = t.maxSubpassInputCounts.slice();
17381                this.setIndices = t.setIndices.slice();
17382                return this;
17383              }
17384            }
17385            class bn {
17386              constructor(t = null, e = Bs.ON, i = 0, s = 0) {
17387                this.windowHandle = t;
17388                this.vsyncMode = e;
17389                this.width = i;
17390                this.height = s;
17391              }
17392              copy(t) {
17393                this.windowHandle = t.windowHandle;
17394                this.vsyncMode = t.vsyncMode;
17395                this.width = t.width;
17396                this.height = t.height;
17397                return this;
17398              }
17399            }
17400            class Sn {
17401              constructor(t = new yn) {
17402                this.bindingMappingInfo = t;
17403              }
17404              copy(t) {
17405                this.bindingMappingInfo.copy(t.bindingMappingInfo);
17406                return this;
17407              }
17408            }
17409            class An {
17410              constructor(t = Ts.NONE, e = Cs.NONE, i = 0, s = 1, n = vs.NONE) {
17411                this.usage = t;
17412                this.memUsage = e;
17413                this.size = i;
17414                this.stride = s;
17415                this.flags = n;
17416              }
17417              copy(t) {
17418                this.usage = t.usage;
17419                this.memUsage = t.memUsage;
17420                this.size = t.size;
17421                this.stride = t.stride;
17422                this.flags = t.flags;
17423                return this;
17424              }
17425            }
17426            class Tn {
17427              constructor(t = null, e = 0, i = 0) {
17428                this.buffer = t;
17429                this.offset = e;
17430                this.range = i;
17431              }
17432              copy(t) {
17433                this.buffer = t.buffer;
17434                this.offset = t.offset;
17435                this.range = t.range;
17436                return this;
17437              }
17438            }
17439            class vn {
17440              constructor(t = 0, e = 0, i = 0, s = 0, n = 0, r = 0, o = 0) {
17441                this.vertexCount = t;
17442                this.firstVertex = e;
17443                this.indexCount = i;
17444                this.firstIndex = s;
17445                this.vertexOffset = n;
17446                this.instanceCount = r;
17447                this.firstInstance = o;
17448              }
17449              copy(t) {
17450                this.vertexCount = t.vertexCount;
17451                this.firstVertex = t.firstVertex;
17452                this.indexCount = t.indexCount;
17453                this.firstIndex = t.firstIndex;
17454                this.vertexOffset = t.vertexOffset;
17455                this.instanceCount = t.instanceCount;
17456                this.firstInstance = t.firstInstance;
17457                return this;
17458              }
17459            }
17460            class En {
17461              constructor(t = 0, e = 0, i = 0, s = null, n = 0) {
17462                this.groupCountX = t;
17463                this.groupCountY = e;
17464                this.groupCountZ = i;
17465                this.indirectBuffer = s;
17466                this.indirectOffset = n;
17467              }
17468              copy(t) {
17469                this.groupCountX = t.groupCountX;
17470                this.groupCountY = t.groupCountY;
17471                this.groupCountZ = t.groupCountZ;
17472                this.indirectBuffer = t.indirectBuffer;
17473                this.indirectOffset = t.indirectOffset;
17474                return this;
17475              }
17476            }
17477            class Cn {
17478              constructor(t = []) {
17479                this.drawInfos = t;
17480              }
17481              copy(t) {
17482                ds(this.drawInfos, t.drawInfos, vn);
17483                return this;
17484              }
17485            }
17486            class xn {
17487              constructor(t = xs.TEX2D, e = ws.NONE, i = bs.UNKNOWN, s = 0, n = 0, r = Rs.NONE, o = 1, a = 1, l = Ms.ONE, h = 1, c = 0) {
17488                this.type = t;
17489                this.usage = e;
17490                this.format = i;
17491                this.width = s;
17492                this.height = n;
17493                this.flags = r;
17494                this.layerCount = o;
17495                this.levelCount = a;
17496                this.samples = l;
17497                this.depth = h;
17498                this.externalRes = c;
17499              }
17500              copy(t) {
17501                this.type = t.type;
17502                this.usage = t.usage;
17503                this.format = t.format;
17504                this.width = t.width;
17505                this.height = t.height;
17506                this.flags = t.flags;
17507                this.layerCount = t.layerCount;
17508                this.levelCount = t.levelCount;
17509                this.samples = t.samples;
17510                this.depth = t.depth;
17511                this.externalRes = t.externalRes;
17512                return this;
17513              }
17514            }
17515            class wn {
17516              constructor(t = null, e = xs.TEX2D, i = bs.UNKNOWN, s = 0, n = 1, r = 0, o = 1) {
17517                this.texture = t;
17518                this.type = e;
17519                this.format = i;
17520                this.baseLevel = s;
17521                this.levelCount = n;
17522                this.baseLayer = r;
17523                this.layerCount = o;
17524              }
17525              copy(t) {
17526                this.texture = t.texture;
17527                this.type = t.type;
17528                this.format = t.format;
17529                this.baseLevel = t.baseLevel;
17530                this.levelCount = t.levelCount;
17531                this.baseLayer = t.baseLayer;
17532                this.layerCount = t.layerCount;
17533                return this;
17534              }
17535            }
17536            class Rn {
17537              constructor(t = Ds.LINEAR, e = Ds.LINEAR, i = Ds.NONE, s = Ps.WRAP, n = Ps.WRAP, r = Ps.WRAP, o = 0, a = Os.ALWAYS) {
17538                this.minFilter = t;
17539                this.magFilter = e;
17540                this.mipFilter = i;
17541                this.addressU = s;
17542                this.addressV = n;
17543                this.addressW = r;
17544                this.maxAnisotropy = o;
17545                this.cmpFunc = a;
17546              }
17547              copy(t) {
17548                this.minFilter = t.minFilter;
17549                this.magFilter = t.magFilter;
17550                this.mipFilter = t.mipFilter;
17551                this.addressU = t.addressU;
17552                this.addressV = t.addressV;
17553                this.addressW = t.addressW;
17554                this.maxAnisotropy = t.maxAnisotropy;
17555                this.cmpFunc = t.cmpFunc;
17556                return this;
17557              }
17558            }
17559            class In {
17560              constructor(t = "", e = As.UNKNOWN, i = 0) {
17561                this.name = t;
17562                this.type = e;
17563                this.count = i;
17564              }
17565              copy(t) {
17566                this.name = t.name;
17567                this.type = t.type;
17568                this.count = t.count;
17569                return this;
17570              }
17571            }
17572            class Mn {
17573              constructor(t = 0, e = 0, i = "", s = [], n = 0) {
17574                this.set = t;
17575                this.binding = e;
17576                this.name = i;
17577                this.members = s;
17578                this.count = n;
17579              }
17580              copy(t) {
17581                this.set = t.set;
17582                this.binding = t.binding;
17583                this.name = t.name;
17584                ds(this.members, t.members, In);
17585                this.count = t.count;
17586                return this;
17587              }
17588            }
17589            class Bn {
17590              constructor(t = 0, e = 0, i = "", s = As.UNKNOWN, n = 0) {
17591                this.set = t;
17592                this.binding = e;
17593                this.name = i;
17594                this.type = s;
17595                this.count = n;
17596              }
17597              copy(t) {
17598                this.set = t.set;
17599                this.binding = t.binding;
17600                this.name = t.name;
17601                this.type = t.type;
17602                this.count = t.count;
17603                return this;
17604              }
17605            }
17606            class Dn {
17607              constructor(t = 0, e = 0, i = "", s = 0) {
17608                this.set = t;
17609                this.binding = e;
17610                this.name = i;
17611                this.count = s;
17612              }
17613              copy(t) {
17614                this.set = t.set;
17615                this.binding = t.binding;
17616                this.name = t.name;
17617                this.count = t.count;
17618                return this;
17619              }
17620            }
17621            class Pn {
17622              constructor(t = 0, e = 0, i = "", s = As.UNKNOWN, n = 0) {
17623                this.set = t;
17624                this.binding = e;
17625                this.name = i;
17626                this.type = s;
17627                this.count = n;
17628              }
17629              copy(t) {
17630                this.set = t.set;
17631                this.binding = t.binding;
17632                this.name = t.name;
17633                this.type = t.type;
17634                this.count = t.count;
17635                return this;
17636              }
17637            }
17638            class On {
17639              constructor(t = 0, e = 0, i = "", s = As.UNKNOWN, n = 0, r = Es.READ_WRITE) {
17640                this.set = t;
17641                this.binding = e;
17642                this.name = i;
17643                this.type = s;
17644                this.count = n;
17645                this.memoryAccess = r;
17646              }
17647              copy(t) {
17648                this.set = t.set;
17649                this.binding = t.binding;
17650                this.name = t.name;
17651                this.type = t.type;
17652                this.count = t.count;
17653                this.memoryAccess = t.memoryAccess;
17654                return this;
17655              }
17656            }
17657            class Nn {
17658              constructor(t = 0, e = 0, i = "", s = 0, n = Es.READ_WRITE) {
17659                this.set = t;
17660                this.binding = e;
17661                this.name = i;
17662                this.count = s;
17663                this.memoryAccess = n;
17664              }
17665              copy(t) {
17666                this.set = t.set;
17667                this.binding = t.binding;
17668                this.name = t.name;
17669                this.count = t.count;
17670                this.memoryAccess = t.memoryAccess;
17671                return this;
17672              }
17673            }
17674            class Ln {
17675              constructor(t = 0, e = 0, i = "", s = 0) {
17676                this.set = t;
17677                this.binding = e;
17678                this.name = i;
17679                this.count = s;
17680              }
17681              copy(t) {
17682                this.set = t.set;
17683                this.binding = t.binding;
17684                this.name = t.name;
17685                this.count = t.count;
17686                return this;
17687              }
17688            }
17689            class Fn {
17690              constructor(t = ks.NONE, e = "") {
17691                this.stage = t;
17692                this.source = e;
17693              }
17694              copy(t) {
17695                this.stage = t.stage;
17696                this.source = t.source;
17697                return this;
17698              }
17699            }
17700            class Vn {
17701              constructor(t = "", e = bs.UNKNOWN, i = !1, s = 0, n = !1, r = 0) {
17702                this.name = t;
17703                this.format = e;
17704                this.isNormalized = i;
17705                this.stream = s;
17706                this.isInstanced = n;
17707                this.location = r;
17708              }
17709              copy(t) {
17710                this.name = t.name;
17711                this.format = t.format;
17712                this.isNormalized = t.isNormalized;
17713                this.stream = t.stream;
17714                this.isInstanced = t.isInstanced;
17715                this.location = t.location;
17716                return this;
17717              }
17718            }
17719            class kn {
17720              constructor(t = "", e = [], i = [], s = [], n = [], r = [], o = [], a = [], l = [], h = []) {
17721                this.name = t;
17722                this.stages = e;
17723                this.attributes = i;
17724                this.blocks = s;
17725                this.buffers = n;
17726                this.samplerTextures = r;
17727                this.samplers = o;
17728                this.textures = a;
17729                this.images = l;
17730                this.subpassInputs = h;
17731              }
17732              copy(t) {
17733                this.name = t.name;
17734                ds(this.stages, t.stages, Fn);
17735                ds(this.attributes, t.attributes, Vn);
17736                ds(this.blocks, t.blocks, Mn);
17737                ds(this.buffers, t.buffers, Nn);
17738                ds(this.samplerTextures, t.samplerTextures, Bn);
17739                ds(this.samplers, t.samplers, Dn);
17740                ds(this.textures, t.textures, Pn);
17741                ds(this.images, t.images, On);
17742                ds(this.subpassInputs, t.subpassInputs, Ln);
17743                return this;
17744              }
17745            }
17746            class Un {
17747              constructor(t = [], e = [], i = null, s = null) {
17748                this.attributes = t;
17749                this.vertexBuffers = e;
17750                this.indexBuffer = i;
17751                this.indirectBuffer = s;
17752              }
17753              copy(t) {
17754                ds(this.attributes, t.attributes, Vn);
17755                this.vertexBuffers = t.vertexBuffers.slice();
17756                this.indexBuffer = t.indexBuffer;
17757                this.indirectBuffer = t.indirectBuffer;
17758                return this;
17759              }
17760            }
17761            class Gn {
17762              constructor(t = bs.UNKNOWN, e = Ms.ONE, i = Us.CLEAR, s = Gs.STORE, n = null, r = !1) {
17763                this.format = t;
17764                this.sampleCount = e;
17765                this.loadOp = i;
17766                this.storeOp = s;
17767                this.barrier = n;
17768                this.isGeneralLayout = r;
17769              }
17770              copy(t) {
17771                this.format = t.format;
17772                this.sampleCount = t.sampleCount;
17773                this.loadOp = t.loadOp;
17774                this.storeOp = t.storeOp;
17775                this.barrier = t.barrier;
17776                this.isGeneralLayout = t.isGeneralLayout;
17777                return this;
17778              }
17779            }
17780            class zn {
17781              constructor(t = bs.UNKNOWN, e = Ms.ONE, i = Us.CLEAR, s = Gs.STORE, n = Us.CLEAR, r = Gs.STORE, o = null, a = !1) {
17782                this.format = t;
17783                this.sampleCount = e;
17784                this.depthLoadOp = i;
17785                this.depthStoreOp = s;
17786                this.stencilLoadOp = n;
17787                this.stencilStoreOp = r;
17788                this.barrier = o;
17789                this.isGeneralLayout = a;
17790              }
17791              copy(t) {
17792                this.format = t.format;
17793                this.sampleCount = t.sampleCount;
17794                this.depthLoadOp = t.depthLoadOp;
17795                this.depthStoreOp = t.depthStoreOp;
17796                this.stencilLoadOp = t.stencilLoadOp;
17797                this.stencilStoreOp = t.stencilStoreOp;
17798                this.barrier = t.barrier;
17799                this.isGeneralLayout = t.isGeneralLayout;
17800                return this;
17801              }
17802            }
17803            class Hn {
17804              constructor(t = [], e = [], i = [], s = [], n = -1, r = -1, o = Hs.NONE, a = Hs.NONE) {
17805                this.inputs = t;
17806                this.colors = e;
17807                this.resolves = i;
17808                this.preserves = s;
17809                this.depthStencil = n;
17810                this.depthStencilResolve = r;
17811                this.depthResolveMode = o;
17812                this.stencilResolveMode = a;
17813              }
17814              copy(t) {
17815                this.inputs = t.inputs.slice();
17816                this.colors = t.colors.slice();
17817                this.resolves = t.resolves.slice();
17818                this.preserves = t.preserves.slice();
17819                this.depthStencil = t.depthStencil;
17820                this.depthStencilResolve = t.depthStencilResolve;
17821                this.depthResolveMode = t.depthResolveMode;
17822                this.stencilResolveMode = t.stencilResolveMode;
17823                return this;
17824              }
17825            }
17826            class jn {
17827              constructor(t = 0, e = 0, i = null, s = null, n = null, r = 0, o = null, a = null, l = 0) {
17828                this.srcSubpass = t;
17829                this.dstSubpass = e;
17830                this.generalBarrier = i;
17831                this.bufferBarriers = s;
17832                this.buffers = n;
17833                this.bufferBarrierCount = r;
17834                this.textureBarriers = o;
17835                this.textures = a;
17836                this.textureBarrierCount = l;
17837              }
17838              copy(t) {
17839                this.srcSubpass = t.srcSubpass;
17840                this.dstSubpass = t.dstSubpass;
17841                this.generalBarrier = t.generalBarrier;
17842                this.bufferBarriers = t.bufferBarriers;
17843                this.buffers = t.buffers;
17844                this.bufferBarrierCount = t.bufferBarrierCount;
17845                this.textureBarriers = t.textureBarriers;
17846                this.textures = t.textures;
17847                this.textureBarrierCount = t.textureBarrierCount;
17848                return this;
17849              }
17850            }
17851            class Xn {
17852              constructor(t = [], e = new zn, i = [], s = []) {
17853                this.colorAttachments = t;
17854                this.depthStencilAttachment = e;
17855                this.subpasses = i;
17856                this.dependencies = s;
17857              }
17858              copy(t) {
17859                ds(this.colorAttachments, t.colorAttachments, Gn);
17860                this.depthStencilAttachment.copy(t.depthStencilAttachment);
17861                ds(this.subpasses, t.subpasses, Hn);
17862                ds(this.dependencies, t.dependencies, jn);
17863                return this;
17864              }
17865            }
17866            class Wn {
17867              constructor(t = zs.NONE, e = zs.NONE, i = sn.FULL) {
17868                this.prevAccesses = t;
17869                this.nextAccesses = e;
17870                this.type = i;
17871              }
17872              copy(t) {
17873                this.prevAccesses = t.prevAccesses;
17874                this.nextAccesses = t.nextAccesses;
17875                this.type = t.type;
17876                return this;
17877              }
17878            }
17879            class Yn {
17880              constructor(t = zs.NONE, e = zs.NONE, i = sn.FULL, s = 0, n = 1, r = 0, o = 1, a = !1, l = null, h = null) {
17881                this.prevAccesses = t;
17882                this.nextAccesses = e;
17883                this.type = i;
17884                this.baseMipLevel = s;
17885                this.levelCount = n;
17886                this.baseSlice = r;
17887                this.sliceCount = o;
17888                this.discardContents = a;
17889                this.srcQueue = l;
17890                this.dstQueue = h;
17891              }
17892              copy(t) {
17893                this.prevAccesses = t.prevAccesses;
17894                this.nextAccesses = t.nextAccesses;
17895                this.type = t.type;
17896                this.baseMipLevel = t.baseMipLevel;
17897                this.levelCount = t.levelCount;
17898                this.baseSlice = t.baseSlice;
17899                this.sliceCount = t.sliceCount;
17900                this.discardContents = t.discardContents;
17901                this.srcQueue = t.srcQueue;
17902                this.dstQueue = t.dstQueue;
17903                return this;
17904              }
17905            }
17906            class qn {
17907              constructor(t = zs.NONE, e = zs.NONE, i = sn.FULL, s = 0, n = 0, r = !1, o = null, a = null) {
17908                this.prevAccesses = t;
17909                this.nextAccesses = e;
17910                this.type = i;
17911                this.offset = s;
17912                this.size = n;
17913                this.discardContents = r;
17914                this.srcQueue = o;
17915                this.dstQueue = a;
17916              }
17917              copy(t) {
17918                this.prevAccesses = t.prevAccesses;
17919                this.nextAccesses = t.nextAccesses;
17920                this.type = t.type;
17921                this.offset = t.offset;
17922                this.size = t.size;
17923                this.discardContents = t.discardContents;
17924                this.srcQueue = t.srcQueue;
17925                this.dstQueue = t.dstQueue;
17926                return this;
17927              }
17928            }
17929            class Kn {
17930              constructor(t = null, e = [], i = null) {
17931                this.renderPass = t;
17932                this.colorTextures = e;
17933                this.depthStencilTexture = i;
17934              }
17935              copy(t) {
17936                this.renderPass = t.renderPass;
17937                this.colorTextures = t.colorTextures.slice();
17938                this.depthStencilTexture = t.depthStencilTexture;
17939                return this;
17940              }
17941            }
17942            class Jn {
17943              constructor(t = -1, e = Zs.UNKNOWN, i = 0, s = ks.NONE, n = []) {
17944                this.binding = t;
17945                this.descriptorType = e;
17946                this.count = i;
17947                this.stageFlags = s;
17948                this.immutableSamplers = n;
17949              }
17950              copy(t) {
17951                this.binding = t.binding;
17952                this.descriptorType = t.descriptorType;
17953                this.count = t.count;
17954                this.stageFlags = t.stageFlags;
17955                this.immutableSamplers = t.immutableSamplers.slice();
17956                return this;
17957              }
17958            }
17959            class Zn {
17960              constructor(t = []) {
17961                this.bindings = t;
17962              }
17963              copy(t) {
17964                ds(this.bindings, t.bindings, Jn);
17965                return this;
17966              }
17967            }
17968            class Qn {
17969              constructor(t = null) {
17970                this.layout = t;
17971              }
17972              copy(t) {
17973                this.layout = t.layout;
17974                return this;
17975              }
17976            }
17977            class $n {
17978              constructor(t = []) {
17979                this.setLayouts = t;
17980              }
17981              copy(t) {
17982                this.setLayouts = t.setLayouts.slice();
17983                return this;
17984              }
17985            }
17986            class tr {
17987              constructor(t = []) {
17988                this.attributes = t;
17989              }
17990              copy(t) {
17991                ds(this.attributes, t.attributes, Vn);
17992                return this;
17993              }
17994            }
17995            class er {
17996              constructor(t = null, e = tn.PRIMARY) {
17997                this.queue = t;
17998                this.type = e;
17999              }
18000              copy(t) {
18001                this.queue = t.queue;
18002                this.type = t.type;
18003                return this;
18004              }
18005            }
18006            class ir {
18007              constructor(t = Qs.GRAPHICS) {
18008                this.type = t;
18009              }
18010              copy(t) {
18011                this.type = t.type;
18012                return this;
18013              }
18014            }
18015            class sr {
18016              constructor(t = $s.OCCLUSION, e = 32767, i = !0) {
18017                this.type = t;
18018                this.maxQueryObjects = e;
18019                this.forceWait = i;
18020              }
18021              copy(t) {
18022                this.type = t.type;
18023                this.maxQueryObjects = t.maxQueryObjects;
18024                this.forceWait = t.forceWait;
18025                return this;
18026              }
18027            }
18028            class rr {
18029              constructor(t = "", e = 0, i = 0, s = Ss.NONE, n = !1, r = !1, o = !1, a = !1) {
18030                this.name = t;
18031                this.size = e;
18032                this.count = i;
18033                this.type = s;
18034                this.hasAlpha = n;
18035                this.hasDepth = r;
18036                this.hasStencil = o;
18037                this.isCompressed = a;
18038              }
18039            }
18040            class or {
18041              constructor(t = 0, e = 0) {
18042                this.bufferSize = t;
18043                this.textureSize = e;
18044              }
18045              copy(t) {
18046                this.bufferSize = t.bufferSize;
18047                this.textureSize = t.textureSize;
18048                return this;
18049              }
18050            }
18051            class ar {
18052              constructor(t = 0, e = 0, i = 0) {
18053                this.writeMask = t;
18054                this.compareMask = e;
18055                this.reference = i;
18056              }
18057              copy(t) {
18058                this.writeMask = t.writeMask;
18059                this.compareMask = t.compareMask;
18060                this.reference = t.reference;
18061                return this;
18062              }
18063            }
18064            class lr {
18065              constructor(t = new fn, e = new hn, i = new gn, s = 1, n = 0, r = 0, o = 0, a = 0, l = 0, h = new ar, c = new ar) {
18066                this.viewport = t;
18067                this.scissor = e;
18068                this.blendConstant = i;
18069                this.lineWidth = s;
18070                this.depthBiasConstant = n;
18071                this.depthBiasClamp = r;
18072                this.depthBiasSlope = o;
18073                this.depthMinBounds = a;
18074                this.depthMaxBounds = l;
18075                this.stencilStatesFront = h;
18076                this.stencilStatesBack = c;
18077              }
18078              copy(t) {
18079                this.viewport.copy(t.viewport);
18080                this.scissor.copy(t.scissor);
18081                this.blendConstant.copy(t.blendConstant);
18082                this.lineWidth = t.lineWidth;
18083                this.depthBiasConstant = t.depthBiasConstant;
18084                this.depthBiasClamp = t.depthBiasClamp;
18085                this.depthBiasSlope = t.depthBiasSlope;
18086                this.depthMinBounds = t.depthMinBounds;
18087                this.depthMaxBounds = t.depthMaxBounds;
18088                this.stencilStatesFront.copy(t.stencilStatesFront);
18089                this.stencilStatesBack.copy(t.stencilStatesBack);
18090                return this;
18091              }
18092            }
18093            class hr extends class {
18094              constructor() {
18095                return _s.registerGCObject(this);
18096              }
18097              destroy() {}
18098            } {
18099              get objectType() {
18100                return this._objectType;
18101              }
18102              get objectID() {
18103                return this._objectID;
18104              }
18105              get typedID() {
18106                return this._typedID;
18107              }
18108              constructor(t) {
18109                super();
18110                this._objectType = ps.UNKNOWN;
18111                this._objectID = 0;
18112                this._typedID = 0;
18113                this._objectType = t;
18114                this._objectID = hr._idTable[ps.UNKNOWN]++;
18115                this._typedID = hr._idTable[t]++;
18116              }
18117            }
18118            hr._idTable = Array(ps.COUNT).fill(65536);
18119            let cr;
18120            !function(t) {
18121              t.ATTR_POSITION = "a_position";
18122              t.ATTR_NORMAL = "a_normal";
18123              t.ATTR_TANGENT = "a_tangent";
18124              t.ATTR_BITANGENT = "a_bitangent";
18125              t.ATTR_WEIGHTS = "a_weights";
18126              t.ATTR_JOINTS = "a_joints";
18127              t.ATTR_COLOR = "a_color";
18128              t.ATTR_COLOR1 = "a_color1";
18129              t.ATTR_COLOR2 = "a_color2";
18130              t.ATTR_TEX_COORD = "a_texCoord";
18131              t.ATTR_TEX_COORD1 = "a_texCoord1";
18132              t.ATTR_TEX_COORD2 = "a_texCoord2";
18133              t.ATTR_TEX_COORD3 = "a_texCoord3";
18134              t.ATTR_TEX_COORD4 = "a_texCoord4";
18135              t.ATTR_TEX_COORD5 = "a_texCoord5";
18136              t.ATTR_TEX_COORD6 = "a_texCoord6";
18137              t.ATTR_TEX_COORD7 = "a_texCoord7";
18138              t.ATTR_TEX_COORD8 = "a_texCoord8";
18139              t.ATTR_BATCH_ID = "a_batch_id";
18140              t.ATTR_BATCH_UV = "a_batch_uv";
18141            }(cr || (cr = {}));
18142            const ur = Object.freeze([ new rr("UNKNOWN", 0, 0, Ss.NONE, !1, !1, !1, !1), new rr("A8", 1, 1, Ss.UNORM, !0, !1, !1, !1), new rr("L8", 1, 1, Ss.UNORM, !1, !1, !1, !1), new rr("LA8", 1, 2, Ss.UNORM, !0, !1, !1, !1), new rr("R8", 1, 1, Ss.UNORM, !1, !1, !1, !1), new rr("R8SN", 1, 1, Ss.SNORM, !1, !1, !1, !1), new rr("R8UI", 1, 1, Ss.UINT, !1, !1, !1, !1), new rr("R8I", 1, 1, Ss.INT, !1, !1, !1, !1), new rr("R16F", 2, 1, Ss.FLOAT, !1, !1, !1, !1), new rr("R16UI", 2, 1, Ss.UINT, !1, !1, !1, !1), new rr("R16I", 2, 1, Ss.INT, !1, !1, !1, !1), new rr("R32F", 4, 1, Ss.FLOAT, !1, !1, !1, !1), new rr("R32UI", 4, 1, Ss.UINT, !1, !1, !1, !1), new rr("R32I", 4, 1, Ss.INT, !1, !1, !1, !1), new rr("RG8", 2, 2, Ss.UNORM, !1, !1, !1, !1), new rr("RG8SN", 2, 2, Ss.SNORM, !1, !1, !1, !1), new rr("RG8UI", 2, 2, Ss.UINT, !1, !1, !1, !1), new rr("RG8I", 2, 2, Ss.INT, !1, !1, !1, !1), new rr("RG16F", 4, 2, Ss.FLOAT, !1, !1, !1, !1), new rr("RG16UI", 4, 2, Ss.UINT, !1, !1, !1, !1), new rr("RG16I", 4, 2, Ss.INT, !1, !1, !1, !1), new rr("RG32F", 8, 2, Ss.FLOAT, !1, !1, !1, !1), new rr("RG32UI", 8, 2, Ss.UINT, !1, !1, !1, !1), new rr("RG32I", 8, 2, Ss.INT, !1, !1, !1, !1), new rr("RGB8", 3, 3, Ss.UNORM, !1, !1, !1, !1), new rr("SRGB8", 3, 3, Ss.UNORM, !1, !1, !1, !1), new rr("RGB8SN", 3, 3, Ss.SNORM, !1, !1, !1, !1), new rr("RGB8UI", 3, 3, Ss.UINT, !1, !1, !1, !1), new rr("RGB8I", 3, 3, Ss.INT, !1, !1, !1, !1), new rr("RGB16F", 6, 3, Ss.FLOAT, !1, !1, !1, !1), new rr("RGB16UI", 6, 3, Ss.UINT, !1, !1, !1, !1), new rr("RGB16I", 6, 3, Ss.INT, !1, !1, !1, !1), new rr("RGB32F", 12, 3, Ss.FLOAT, !1, !1, !1, !1), new rr("RGB32UI", 12, 3, Ss.UINT, !1, !1, !1, !1), new rr("RGB32I", 12, 3, Ss.INT, !1, !1, !1, !1), new rr("RGBA8", 4, 4, Ss.UNORM, !0, !1, !1, !1), new rr("BGRA8", 4, 4, Ss.UNORM, !0, !1, !1, !1), new rr("SRGB8_A8", 4, 4, Ss.UNORM, !0, !1, !1, !1), new rr("RGBA8SN", 4, 4, Ss.SNORM, !0, !1, !1, !1), new rr("RGBA8UI", 4, 4, Ss.UINT, !0, !1, !1, !1), new rr("RGBA8I", 4, 4, Ss.INT, !0, !1, !1, !1), new rr("RGBA16F", 8, 4, Ss.FLOAT, !0, !1, !1, !1), new rr("RGBA16UI", 8, 4, Ss.UINT, !0, !1, !1, !1), new rr("RGBA16I", 8, 4, Ss.INT, !0, !1, !1, !1), new rr("RGBA32F", 16, 4, Ss.FLOAT, !0, !1, !1, !1), new rr("RGBA32UI", 16, 4, Ss.UINT, !0, !1, !1, !1), new rr("RGBA32I", 16, 4, Ss.INT, !0, !1, !1, !1), new rr("R5G6B5", 2, 3, Ss.UNORM, !1, !1, !1, !1), new rr("R11G11B10F", 4, 3, Ss.FLOAT, !1, !1, !1, !1), new rr("RGB5A1", 2, 4, Ss.UNORM, !0, !1, !1, !1), new rr("RGBA4", 2, 4, Ss.UNORM, !0, !1, !1, !1), new rr("RGB10A2", 2, 4, Ss.UNORM, !0, !1, !1, !1), new rr("RGB10A2UI", 2, 4, Ss.UINT, !0, !1, !1, !1), new rr("RGB9E5", 2, 4, Ss.FLOAT, !0, !1, !1, !1), new rr("DEPTH", 4, 1, Ss.FLOAT, !1, !0, !1, !1), new rr("DEPTH_STENCIL", 5, 2, Ss.FLOAT, !1, !0, !0, !1), new rr("BC1", 1, 3, Ss.UNORM, !1, !1, !1, !0), new rr("BC1_ALPHA", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("BC1_SRGB", 1, 3, Ss.UNORM, !1, !1, !1, !0), new rr("BC1_SRGB_ALPHA", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("BC2", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("BC2_SRGB", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("BC3", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("BC3_SRGB", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("BC4", 1, 1, Ss.UNORM, !1, !1, !1, !0), new rr("BC4_SNORM", 1, 1, Ss.SNORM, !1, !1, !1, !0), new rr("BC5", 1, 2, Ss.UNORM, !1, !1, !1, !0), new rr("BC5_SNORM", 1, 2, Ss.SNORM, !1, !1, !1, !0), new rr("BC6H_UF16", 1, 3, Ss.UFLOAT, !1, !1, !1, !0), new rr("BC6H_SF16", 1, 3, Ss.FLOAT, !1, !1, !1, !0), new rr("BC7", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("BC7_SRGB", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ETC_RGB8", 1, 3, Ss.UNORM, !1, !1, !1, !0), new rr("ETC2_RGB8", 1, 3, Ss.UNORM, !1, !1, !1, !0), new rr("ETC2_SRGB8", 1, 3, Ss.UNORM, !1, !1, !1, !0), new rr("ETC2_RGB8_A1", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ETC2_SRGB8_A1", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ETC2_RGBA8", 2, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ETC2_SRGB8_A8", 2, 4, Ss.UNORM, !0, !1, !1, !0), new rr("EAC_R11", 1, 1, Ss.UNORM, !1, !1, !1, !0), new rr("EAC_R11SN", 1, 1, Ss.SNORM, !1, !1, !1, !0), new rr("EAC_RG11", 2, 2, Ss.UNORM, !1, !1, !1, !0), new rr("EAC_RG11SN", 2, 2, Ss.SNORM, !1, !1, !1, !0), new rr("PVRTC_RGB2", 2, 3, Ss.UNORM, !1, !1, !1, !0), new rr("PVRTC_RGBA2", 2, 4, Ss.UNORM, !0, !1, !1, !0), new rr("PVRTC_RGB4", 2, 3, Ss.UNORM, !1, !1, !1, !0), new rr("PVRTC_RGBA4", 2, 4, Ss.UNORM, !0, !1, !1, !0), new rr("PVRTC2_2BPP", 2, 4, Ss.UNORM, !0, !1, !1, !0), new rr("PVRTC2_4BPP", 2, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_4x4", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_5x4", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_5x5", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_6x5", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_6x6", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_8x5", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_8x6", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_8x8", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_10x5", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_10x6", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_10x8", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_10x10", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_12x10", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_RGBA_12x12", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_4x4", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_5x4", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_5x5", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_6x5", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_6x6", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_8x5", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_8x6", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_8x8", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_10x5", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_10x6", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_10x8", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_10x10", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_12x10", 1, 4, Ss.UNORM, !0, !1, !1, !0), new rr("ASTC_SRGBA_12x12", 1, 4, Ss.UNORM, !0, !1, !1, !0) ]);
18143            const _r = Zs.UNIFORM_BUFFER | Zs.DYNAMIC_UNIFORM_BUFFER | Zs.STORAGE_BUFFER | Zs.DYNAMIC_STORAGE_BUFFER;
18144            const dr = Zs.SAMPLER_TEXTURE | Zs.SAMPLER | Zs.TEXTURE | Zs.STORAGE_IMAGE | Zs.INPUT_ATTACHMENT;
18145            const pr = Zs.DYNAMIC_STORAGE_BUFFER | Zs.DYNAMIC_UNIFORM_BUFFER;
18146            const mr = 28;
18147            function fr(t) {
18148              return t > 0 && 0 == (t & t - 1);
18149            }
18150            function gr(t, e, i, s) {
18151              if (!ur[t].isCompressed) return e * i * s * ur[t].size;
18152              switch (t) {
18153               case bs.BC1:
18154               case bs.BC1_ALPHA:
18155               case bs.BC1_SRGB:
18156               case bs.BC1_SRGB_ALPHA:
18157                return Math.ceil(e / 4) * Math.ceil(i / 4) * 8 * s;
18158
18159               case bs.BC2:
18160               case bs.BC2_SRGB:
18161               case bs.BC3:
18162               case bs.BC3_SRGB:
18163               case bs.BC4:
18164               case bs.BC4_SNORM:
18165               case bs.BC6H_SF16:
18166               case bs.BC6H_UF16:
18167               case bs.BC7:
18168               case bs.BC7_SRGB:
18169                return Math.ceil(e / 4) * Math.ceil(i / 4) * 16 * s;
18170
18171               case bs.BC5:
18172               case bs.BC5_SNORM:
18173                return Math.ceil(e / 4) * Math.ceil(i / 4) * 32 * s;
18174
18175               case bs.ETC_RGB8:
18176               case bs.ETC2_RGB8:
18177               case bs.ETC2_SRGB8:
18178               case bs.ETC2_RGB8_A1:
18179               case bs.EAC_R11:
18180               case bs.EAC_R11SN:
18181                return Math.ceil(e / 4) * Math.ceil(i / 4) * 8 * s;
18182
18183               case bs.ETC2_RGBA8:
18184               case bs.ETC2_SRGB8_A1:
18185               case bs.EAC_RG11:
18186               case bs.EAC_RG11SN:
18187                return Math.ceil(e / 4) * Math.ceil(i / 4) * 16 * s;
18188
18189               case bs.PVRTC_RGB2:
18190               case bs.PVRTC_RGBA2:
18191               case bs.PVRTC2_2BPP:
18192                return Math.ceil(e / 8) * Math.ceil(i / 4) * 8 * s;
18193
18194               case bs.PVRTC_RGB4:
18195               case bs.PVRTC_RGBA4:
18196               case bs.PVRTC2_4BPP:
18197                return Math.ceil(e / 4) * Math.ceil(i / 4) * 8 * s;
18198
18199               case bs.ASTC_RGBA_4X4:
18200               case bs.ASTC_SRGBA_4X4:
18201                return Math.ceil(e / 4) * Math.ceil(i / 4) * 16 * s;
18202
18203               case bs.ASTC_RGBA_5X4:
18204               case bs.ASTC_SRGBA_5X4:
18205                return Math.ceil(e / 5) * Math.ceil(i / 4) * 16 * s;
18206
18207               case bs.ASTC_RGBA_5X5:
18208               case bs.ASTC_SRGBA_5X5:
18209                return Math.ceil(e / 5) * Math.ceil(i / 5) * 16 * s;
18210
18211               case bs.ASTC_RGBA_6X5:
18212               case bs.ASTC_SRGBA_6X5:
18213                return Math.ceil(e / 6) * Math.ceil(i / 5) * 16 * s;
18214
18215               case bs.ASTC_RGBA_6X6:
18216               case bs.ASTC_SRGBA_6X6:
18217                return Math.ceil(e / 6) * Math.ceil(i / 6) * 16 * s;
18218
18219               case bs.ASTC_RGBA_8X5:
18220               case bs.ASTC_SRGBA_8X5:
18221                return Math.ceil(e / 8) * Math.ceil(i / 5) * 16 * s;
18222
18223               case bs.ASTC_RGBA_8X6:
18224               case bs.ASTC_SRGBA_8X6:
18225                return Math.ceil(e / 8) * Math.ceil(i / 6) * 16 * s;
18226
18227               case bs.ASTC_RGBA_8X8:
18228               case bs.ASTC_SRGBA_8X8:
18229                return Math.ceil(e / 8) * Math.ceil(i / 8) * 16 * s;
18230
18231               case bs.ASTC_RGBA_10X5:
18232               case bs.ASTC_SRGBA_10X5:
18233                return Math.ceil(e / 10) * Math.ceil(i / 5) * 16 * s;
18234
18235               case bs.ASTC_RGBA_10X6:
18236               case bs.ASTC_SRGBA_10X6:
18237                return Math.ceil(e / 10) * Math.ceil(i / 6) * 16 * s;
18238
18239               case bs.ASTC_RGBA_10X8:
18240               case bs.ASTC_SRGBA_10X8:
18241                return Math.ceil(e / 10) * Math.ceil(i / 8) * 16 * s;
18242
18243               case bs.ASTC_RGBA_10X10:
18244               case bs.ASTC_SRGBA_10X10:
18245                return Math.ceil(e / 10) * Math.ceil(i / 10) * 16 * s;
18246
18247               case bs.ASTC_RGBA_12X10:
18248               case bs.ASTC_SRGBA_12X10:
18249                return Math.ceil(e / 12) * Math.ceil(i / 10) * 16 * s;
18250
18251               case bs.ASTC_RGBA_12X12:
18252               case bs.ASTC_SRGBA_12X12:
18253                return Math.ceil(e / 12) * Math.ceil(i / 12) * 16 * s;
18254
18255               default:
18256                return 0;
18257              }
18258            }
18259            function yr(t, e, i, s, n) {
18260              let r = 0;
18261              for (let o = 0; o < n; ++o) {
18262                r += gr(t, e, i, s);
18263                e = Math.max(e >> 1, 1);
18264                i = Math.max(i >> 1, 1);
18265              }
18266              return r;
18267            }
18268            const br = [ 0, 4, 8, 12, 16, 4, 8, 12, 16, 4, 8, 12, 16, 4, 8, 12, 16, 16, 24, 32, 24, 36, 48, 32, 48, 64, 4, 4, 4, 4, 4, 4 ];
18269            function Sr(t) {
18270              return br[t] || 0;
18271            }
18272            function Ar(t) {
18273              if (t.isCompressed) return Uint8Array;
18274              const e = t.size / t.count;
18275              switch (t.type) {
18276               case Ss.UNORM:
18277               case Ss.UINT:
18278                switch (e) {
18279                 case 1:
18280                 default:
18281                  return Uint8Array;
18282
18283                 case 2:
18284                  return Uint16Array;
18285
18286                 case 4:
18287                  return Uint32Array;
18288                }
18289
18290               case Ss.SNORM:
18291               case Ss.INT:
18292                switch (e) {
18293                 case 1:
18294                 default:
18295                  return Int8Array;
18296
18297                 case 2:
18298                  return Int16Array;
18299
18300                 case 4:
18301                  return Int32Array;
18302                }
18303
18304               case Ss.FLOAT:
18305                return Float32Array;
18306              }
18307              return Float32Array;
18308            }
18309            function Tr(t) {
18310              switch (t) {
18311               case bs.BC1:
18312               case bs.BC1_ALPHA:
18313               case bs.BC1_SRGB:
18314               case bs.BC1_SRGB_ALPHA:
18315               case bs.BC2:
18316               case bs.BC2_SRGB:
18317               case bs.BC3:
18318               case bs.BC3_SRGB:
18319               case bs.BC4:
18320               case bs.BC4_SNORM:
18321               case bs.BC6H_SF16:
18322               case bs.BC6H_UF16:
18323               case bs.BC7:
18324               case bs.BC7_SRGB:
18325               case bs.BC5:
18326               case bs.BC5_SNORM:
18327               case bs.ETC_RGB8:
18328               case bs.ETC2_RGB8:
18329               case bs.ETC2_SRGB8:
18330               case bs.ETC2_RGB8_A1:
18331               case bs.EAC_R11:
18332               case bs.EAC_R11SN:
18333               case bs.ETC2_RGBA8:
18334               case bs.ETC2_SRGB8_A1:
18335               case bs.EAC_RG11:
18336               case bs.EAC_RG11SN:
18337                return {
18338                  width: 4,
18339                  height: 4
18340                };
18341
18342               case bs.PVRTC_RGB2:
18343               case bs.PVRTC_RGBA2:
18344               case bs.PVRTC2_2BPP:
18345                return {
18346                  width: 8,
18347                  height: 4
18348                };
18349
18350               case bs.PVRTC_RGB4:
18351               case bs.PVRTC_RGBA4:
18352               case bs.PVRTC2_4BPP:
18353               case bs.ASTC_RGBA_4X4:
18354               case bs.ASTC_SRGBA_4X4:
18355                return {
18356                  width: 4,
18357                  height: 4
18358                };
18359
18360               case bs.ASTC_RGBA_5X4:
18361               case bs.ASTC_SRGBA_5X4:
18362                return {
18363                  width: 5,
18364                  height: 4
18365                };
18366
18367               case bs.ASTC_RGBA_5X5:
18368               case bs.ASTC_SRGBA_5X5:
18369                return {
18370                  width: 5,
18371                  height: 5
18372                };
18373
18374               case bs.ASTC_RGBA_6X5:
18375               case bs.ASTC_SRGBA_6X5:
18376                return {
18377                  width: 6,
18378                  height: 5
18379                };
18380
18381               case bs.ASTC_RGBA_6X6:
18382               case bs.ASTC_SRGBA_6X6:
18383                return {
18384                  width: 6,
18385                  height: 6
18386                };
18387
18388               case bs.ASTC_RGBA_8X5:
18389               case bs.ASTC_SRGBA_8X5:
18390                return {
18391                  width: 8,
18392                  height: 5
18393                };
18394
18395               case bs.ASTC_RGBA_8X6:
18396               case bs.ASTC_SRGBA_8X6:
18397                return {
18398                  width: 8,
18399                  height: 6
18400                };
18401
18402               case bs.ASTC_RGBA_8X8:
18403               case bs.ASTC_SRGBA_8X8:
18404                return {
18405                  width: 8,
18406                  height: 8
18407                };
18408
18409               case bs.ASTC_RGBA_10X5:
18410               case bs.ASTC_SRGBA_10X5:
18411                return {
18412                  width: 10,
18413                  height: 5
18414                };
18415
18416               case bs.ASTC_RGBA_10X6:
18417               case bs.ASTC_SRGBA_10X6:
18418                return {
18419                  width: 10,
18420                  height: 6
18421                };
18422
18423               case bs.ASTC_RGBA_10X8:
18424               case bs.ASTC_SRGBA_10X8:
18425                return {
18426                  width: 10,
18427                  height: 8
18428                };
18429
18430               case bs.ASTC_RGBA_10X10:
18431               case bs.ASTC_SRGBA_10X10:
18432                return {
18433                  width: 10,
18434                  height: 10
18435                };
18436
18437               case bs.ASTC_RGBA_12X10:
18438               case bs.ASTC_SRGBA_12X10:
18439                return {
18440                  width: 12,
18441                  height: 10
18442                };
18443
18444               case bs.ASTC_RGBA_12X12:
18445               case bs.ASTC_SRGBA_12X12:
18446                return {
18447                  width: 12,
18448                  height: 12
18449                };
18450
18451               default:
18452                return {
18453                  width: 1,
18454                  height: 1
18455                };
18456              }
18457            }
18458            function vr(t, e) {
18459              return Math.ceil(t / e) * e;
18460            }
18461            var Er = Object.freeze({
18462              __proto__: null,
18463              get ObjectType() {
18464                return ps;
18465              },
18466              get Status() {
18467                return ms;
18468              },
18469              get API() {
18470                return fs;
18471              },
18472              get SurfaceTransform() {
18473                return gs;
18474              },
18475              get Feature() {
18476                return ys;
18477              },
18478              get Format() {
18479                return bs;
18480              },
18481              get FormatType() {
18482                return Ss;
18483              },
18484              get Type() {
18485                return As;
18486              },
18487              get BufferUsageBit() {
18488                return Ts;
18489              },
18490              get BufferFlagBit() {
18491                return vs;
18492              },
18493              get MemoryAccessBit() {
18494                return Es;
18495              },
18496              get MemoryUsageBit() {
18497                return Cs;
18498              },
18499              get TextureType() {
18500                return xs;
18501              },
18502              get TextureUsageBit() {
18503                return ws;
18504              },
18505              get TextureFlagBit() {
18506                return Rs;
18507              },
18508              get FormatFeatureBit() {
18509                return Is;
18510              },
18511              get SampleCount() {
18512                return Ms;
18513              },
18514              get VsyncMode() {
18515                return Bs;
18516              },
18517              get Filter() {
18518                return Ds;
18519              },
18520              get Address() {
18521                return Ps;
18522              },
18523              get ComparisonFunc() {
18524                return Os;
18525              },
18526              get StencilOp() {
18527                return Ns;
18528              },
18529              get BlendFactor() {
18530                return Ls;
18531              },
18532              get BlendOp() {
18533                return Fs;
18534              },
18535              get ColorMask() {
18536                return Vs;
18537              },
18538              get ShaderStageFlagBit() {
18539                return ks;
18540              },
18541              get LoadOp() {
18542                return Us;
18543              },
18544              get StoreOp() {
18545                return Gs;
18546              },
18547              get AccessFlagBit() {
18548                return zs;
18549              },
18550              get ResolveMode() {
18551                return Hs;
18552              },
18553              get PipelineBindPoint() {
18554                return js;
18555              },
18556              get PrimitiveMode() {
18557                return Xs;
18558              },
18559              get PolygonMode() {
18560                return Ws;
18561              },
18562              get ShadeModel() {
18563                return Ys;
18564              },
18565              get CullMode() {
18566                return qs;
18567              },
18568              get DynamicStateFlagBit() {
18569                return Ks;
18570              },
18571              get StencilFace() {
18572                return Js;
18573              },
18574              get DescriptorType() {
18575                return Zs;
18576              },
18577              get QueueType() {
18578                return Qs;
18579              },
18580              get QueryType() {
18581                return $s;
18582              },
18583              get CommandBufferType() {
18584                return tn;
18585              },
18586              get ClearFlagBit() {
18587                return en;
18588              },
18589              get BarrierType() {
18590                return sn;
18591              },
18592              get PassType() {
18593                return nn;
18594              },
18595              Size: rn,
18596              DeviceCaps: on,
18597              DeviceOptions: an,
18598              Offset: ln,
18599              Rect: hn,
18600              Extent: cn,
18601              TextureSubresLayers: un,
18602              TextureSubresRange: _n,
18603              TextureCopy: dn,
18604              TextureBlit: pn,
18605              BufferTextureCopy: mn,
18606              Viewport: fn,
18607              Color: gn,
18608              BindingMappingInfo: yn,
18609              SwapchainInfo: bn,
18610              DeviceInfo: Sn,
18611              BufferInfo: An,
18612              BufferViewInfo: Tn,
18613              DrawInfo: vn,
18614              DispatchInfo: En,
18615              IndirectBuffer: Cn,
18616              TextureInfo: xn,
18617              TextureViewInfo: wn,
18618              SamplerInfo: Rn,
18619              Uniform: In,
18620              UniformBlock: Mn,
18621              UniformSamplerTexture: Bn,
18622              UniformSampler: Dn,
18623              UniformTexture: Pn,
18624              UniformStorageImage: On,
18625              UniformStorageBuffer: Nn,
18626              UniformInputAttachment: Ln,
18627              ShaderStage: Fn,
18628              Attribute: Vn,
18629              ShaderInfo: kn,
18630              InputAssemblerInfo: Un,
18631              ColorAttachment: Gn,
18632              DepthStencilAttachment: zn,
18633              SubpassInfo: Hn,
18634              SubpassDependency: jn,
18635              RenderPassInfo: Xn,
18636              GeneralBarrierInfo: Wn,
18637              TextureBarrierInfo: Yn,
18638              BufferBarrierInfo: qn,
18639              FramebufferInfo: Kn,
18640              DescriptorSetLayoutBinding: Jn,
18641              DescriptorSetLayoutInfo: Zn,
18642              DescriptorSetInfo: Qn,
18643              PipelineLayoutInfo: $n,
18644              InputState: tr,
18645              CommandBufferInfo: er,
18646              QueueInfo: ir,
18647              QueryPoolInfo: sr,
18648              FormatInfo: rr,
18649              MemoryStatus: or,
18650              DynamicStencilStates: ar,
18651              DynamicStates: lr,
18652              GFXObject: hr,
18653              get AttributeName() {
18654                return cr;
18655              },
18656              FormatInfos: ur,
18657              DESCRIPTOR_BUFFER_TYPE: _r,
18658              DESCRIPTOR_SAMPLER_TYPE: dr,
18659              DESCRIPTOR_DYNAMIC_TYPE: pr,
18660              DRAW_INFO_SIZE: mr,
18661              IsPowerOf2: fr,
18662              FormatSize: gr,
18663              FormatSurfaceSize: yr,
18664              GetTypeSize: Sr,
18665              getTypedArrayConstructor: Ar,
18666              formatAlignment: Tr,
18667              alignTo: vr
18668            });
18669            class Cr {
18670              constructor(t = !1, e = Ws.FILL, i = Ys.GOURAND, s = qs.BACK, n = !0, r = !1, o = 0, a = 0, l = 0, h = !0, c = !1, u = 1) {
18671                this._nativeObj = void 0;
18672                this._isDiscard = !1;
18673                this._polygonMode = Ws.FILL;
18674                this._shadeModel = Ys.GOURAND;
18675                this._cullMode = qs.BACK;
18676                this._isFrontFaceCCW = !0;
18677                this._depthBiasEnabled = !1;
18678                this._depthBias = 0;
18679                this._depthBiasClamp = 0;
18680                this._depthBiasSlop = 0;
18681                this._isDepthClip = !0;
18682                this._isMultisample = !1;
18683                this._lineWidth = 1;
18684                this._nativeObj = new gfx.RasterizerState;
18685                this.assignProperties(t, e, i, s, n, r, o, a, l, h, c, u);
18686              }
18687              get native() {
18688                return this._nativeObj;
18689              }
18690              get isDiscard() {
18691                return this._isDiscard;
18692              }
18693              set isDiscard(t) {
18694                this._isDiscard = t;
18695                this._nativeObj.isDiscard = t;
18696              }
18697              get polygonMode() {
18698                return this._polygonMode;
18699              }
18700              set polygonMode(t) {
18701                this._polygonMode = t;
18702                this._nativeObj.polygonMode = t;
18703              }
18704              get shadeModel() {
18705                return this._shadeModel;
18706              }
18707              set shadeModel(t) {
18708                this._shadeModel = t;
18709                this._nativeObj.shadeModel = t;
18710              }
18711              get cullMode() {
18712                return this._cullMode;
18713              }
18714              set cullMode(t) {
18715                this._cullMode = t;
18716                this._nativeObj.cullMode = t;
18717              }
18718              get isFrontFaceCCW() {
18719                return this._isFrontFaceCCW;
18720              }
18721              set isFrontFaceCCW(t) {
18722                this._isFrontFaceCCW = t;
18723                this._nativeObj.isFrontFaceCCW = t;
18724              }
18725              get depthBiasEnabled() {
18726                return this._depthBiasEnabled;
18727              }
18728              set depthBiasEnabled(t) {
18729                this._depthBiasEnabled = t;
18730                this._nativeObj.depthBiasEnabled = t;
18731              }
18732              get depthBias() {
18733                return this._depthBias;
18734              }
18735              set depthBias(t) {
18736                this._depthBias = t;
18737                this._nativeObj.depthBias = t;
18738              }
18739              get depthBiasClamp() {
18740                return this._depthBiasClamp;
18741              }
18742              set depthBiasClamp(t) {
18743                this._depthBiasClamp = t;
18744                this._nativeObj.depthBiasClamp = t;
18745              }
18746              get depthBiasSlop() {
18747                return this._depthBiasSlop;
18748              }
18749              set depthBiasSlop(t) {
18750                this._depthBiasSlop = t;
18751                this._nativeObj.depthBiasSlop = t;
18752              }
18753              get isDepthClip() {
18754                return this._isDepthClip;
18755              }
18756              set isDepthClip(t) {
18757                this._isDepthClip = t;
18758                this._nativeObj.isDepthClip = t;
18759              }
18760              get isMultisample() {
18761                return this._isMultisample;
18762              }
18763              set isMultisample(t) {
18764                this._isMultisample = t;
18765                this._nativeObj.isMultisample = t;
18766              }
18767              get lineWidth() {
18768                return this._lineWidth;
18769              }
18770              set lineWidth(t) {
18771                this._lineWidth = t;
18772                this._nativeObj.lineWidth = t;
18773              }
18774              reset() {
18775                this.assignProperties(!1, Ws.FILL, Ys.GOURAND, qs.BACK, !0, !1, 0, 0, 0, !0, !1, 1);
18776              }
18777              assign(t) {
18778                t && this.assignProperties(t.isDiscard, t.polygonMode, t.shadeModel, t.cullMode, t.isFrontFaceCCW, t.depthBiasEnabled, t.depthBias, t.depthBiasClamp, t.depthBiasSlop, t.isDepthClip, t.isMultisample, t.lineWidth);
18779              }
18780              destroy() {
18781                this._nativeObj = null;
18782              }
18783              assignProperties(t, e, i, s, n, r, o, a, l, h, c, u) {
18784                void 0 !== t && (this.isDiscard = t);
18785                void 0 !== e && (this.polygonMode = e);
18786                void 0 !== i && (this.shadeModel = i);
18787                void 0 !== s && (this.cullMode = s);
18788                void 0 !== n && (this.isFrontFaceCCW = n);
18789                void 0 !== r && (this.depthBiasEnabled = r);
18790                void 0 !== o && (this.depthBias = o);
18791                void 0 !== a && (this.depthBiasClamp = a);
18792                void 0 !== l && (this.depthBiasSlop = l);
18793                void 0 !== h && (this.isDepthClip = h);
18794                void 0 !== c && (this.isMultisample = c);
18795                void 0 !== u && (this.lineWidth = u);
18796              }
18797            }
18798            class wr {
18799              constructor(t = !0, e = !0, i = Os.LESS, s = !1, n = Os.ALWAYS, r = 65535, o = 65535, a = Ns.KEEP, l = Ns.KEEP, h = Ns.KEEP, c = 1, u = !1, _ = Os.ALWAYS, d = 65535, p = 65535, m = Ns.KEEP, f = Ns.KEEP, g = Ns.KEEP, y = 1) {
18800                this._nativeObj = void 0;
18801                this._depthTest = !0;
18802                this._depthWrite = !0;
18803                this._depthFunc = Os.LESS;
18804                this._stencilTestFront = !1;
18805                this._stencilFuncFront = Os.ALWAYS;
18806                this._stencilReadMaskFront = 65535;
18807                this._stencilWriteMaskFront = 65535;
18808                this._stencilFailOpFront = Ns.KEEP;
18809                this._stencilZFailOpFront = Ns.KEEP;
18810                this._stencilPassOpFront = Ns.KEEP;
18811                this._stencilRefFront = 1;
18812                this._stencilTestBack = !1;
18813                this._stencilFuncBack = Os.ALWAYS;
18814                this._stencilReadMaskBack = 65535;
18815                this._stencilWriteMaskBack = 65535;
18816                this._stencilFailOpBack = Ns.KEEP;
18817                this._stencilZFailOpBack = Ns.KEEP;
18818                this._stencilPassOpBack = Ns.KEEP;
18819                this._stencilRefBack = 1;
18820                this._nativeObj = new gfx.DepthStencilState;
18821                this.assignProperties(t, e, i, s, n, r, o, a, l, h, c, u, _, d, p, m, f, g, y);
18822              }
18823              get native() {
18824                return this._nativeObj;
18825              }
18826              get depthTest() {
18827                return this._depthTest;
18828              }
18829              set depthTest(t) {
18830                this._depthTest = t;
18831                this._nativeObj.depthTest = t;
18832              }
18833              get depthWrite() {
18834                return this._depthWrite;
18835              }
18836              set depthWrite(t) {
18837                this._depthWrite = t;
18838                this._nativeObj.depthWrite = t;
18839              }
18840              get depthFunc() {
18841                return this._depthFunc;
18842              }
18843              set depthFunc(t) {
18844                this._depthFunc = t;
18845                this._nativeObj.depthFunc = t;
18846              }
18847              get stencilTestFront() {
18848                return this._stencilTestFront;
18849              }
18850              set stencilTestFront(t) {
18851                this._stencilTestFront = t;
18852                this._nativeObj.stencilTestFront = t;
18853              }
18854              get stencilFuncFront() {
18855                return this._stencilFuncFront;
18856              }
18857              set stencilFuncFront(t) {
18858                this._stencilFuncFront = t;
18859                this._nativeObj.stencilFuncFront = t;
18860              }
18861              get stencilReadMaskFront() {
18862                return this._stencilReadMaskFront;
18863              }
18864              set stencilReadMaskFront(t) {
18865                this._stencilReadMaskFront = t;
18866                this._nativeObj.stencilReadMaskFront = t;
18867              }
18868              get stencilWriteMaskFront() {
18869                return this._stencilWriteMaskFront;
18870              }
18871              set stencilWriteMaskFront(t) {
18872                this._stencilWriteMaskFront = t;
18873                this._nativeObj.stencilWriteMaskFront = t;
18874              }
18875              get stencilFailOpFront() {
18876                return this._stencilFailOpFront;
18877              }
18878              set stencilFailOpFront(t) {
18879                this._stencilFailOpFront = t;
18880                this._nativeObj.stencilFailOpFront = t;
18881              }
18882              get stencilZFailOpFront() {
18883                return this._stencilZFailOpFront;
18884              }
18885              set stencilZFailOpFront(t) {
18886                this._stencilZFailOpFront = t;
18887                this._nativeObj.stencilZFailOpFront = t;
18888              }
18889              get stencilPassOpFront() {
18890                return this._stencilPassOpFront;
18891              }
18892              set stencilPassOpFront(t) {
18893                this._stencilPassOpFront = t;
18894                this._nativeObj.stencilPassOpFront = t;
18895              }
18896              get stencilRefFront() {
18897                return this._stencilRefFront;
18898              }
18899              set stencilRefFront(t) {
18900                this._stencilRefFront = t;
18901                this._nativeObj.stencilRefFront = t;
18902              }
18903              get stencilTestBack() {
18904                return this._stencilTestBack;
18905              }
18906              set stencilTestBack(t) {
18907                this._stencilTestBack = t;
18908                this._nativeObj.stencilTestBack = t;
18909              }
18910              get stencilFuncBack() {
18911                return this._stencilFuncBack;
18912              }
18913              set stencilFuncBack(t) {
18914                this._stencilFuncBack = t;
18915                this._nativeObj.stencilFuncBack = t;
18916              }
18917              get stencilReadMaskBack() {
18918                return this._stencilReadMaskBack;
18919              }
18920              set stencilReadMaskBack(t) {
18921                this._stencilReadMaskBack = t;
18922                this._nativeObj.stencilReadMaskBack = t;
18923              }
18924              get stencilWriteMaskBack() {
18925                return this._stencilWriteMaskBack;
18926              }
18927              set stencilWriteMaskBack(t) {
18928                this._stencilWriteMaskBack = t;
18929                this._nativeObj.stencilWriteMaskBack = t;
18930              }
18931              get stencilFailOpBack() {
18932                return this._stencilFailOpBack;
18933              }
18934              set stencilFailOpBack(t) {
18935                this._stencilFailOpBack = t;
18936                this._nativeObj.stencilFailOpBack = t;
18937              }
18938              get stencilZFailOpBack() {
18939                return this._stencilZFailOpBack;
18940              }
18941              set stencilZFailOpBack(t) {
18942                this._stencilZFailOpBack = t;
18943                this._nativeObj.stencilZFailOpBack = t;
18944              }
18945              get stencilPassOpBack() {
18946                return this._stencilPassOpBack;
18947              }
18948              set stencilPassOpBack(t) {
18949                this._stencilPassOpBack = t;
18950                this._nativeObj.stencilPassOpBack = t;
18951              }
18952              get stencilRefBack() {
18953                return this._stencilRefBack;
18954              }
18955              set stencilRefBack(t) {
18956                this._stencilRefBack = t;
18957                this._nativeObj.stencilRefBack = t;
18958              }
18959              reset() {
18960                this.assignProperties(!0, !0, Os.LESS, !1, Os.ALWAYS, 65535, 65535, Ns.KEEP, Ns.KEEP, Ns.KEEP, 1, !1, Os.ALWAYS, 65535, 65535, Ns.KEEP, Ns.KEEP, Ns.KEEP, 1);
18961              }
18962              assign(t) {
18963                t && this.assignProperties(t.depthTest, t.depthWrite, t.depthFunc, t.stencilTestFront, t.stencilFuncFront, t.stencilReadMaskFront, t.stencilWriteMaskFront, t.stencilFailOpFront, t.stencilZFailOpFront, t.stencilPassOpFront, t.stencilRefFront, t.stencilTestBack, t.stencilFuncBack, t.stencilReadMaskBack, t.stencilWriteMaskBack, t.stencilFailOpBack, t.stencilZFailOpBack, t.stencilPassOpBack, t.stencilRefBack);
18964              }
18965              destroy() {
18966                this._nativeObj = null;
18967              }
18968              assignProperties(t, e, i, s, n, r, o, a, l, h, c, u, _, d, p, m, f, g, y) {
18969                void 0 !== t && (this.depthTest = t);
18970                void 0 !== e && (this.depthWrite = e);
18971                void 0 !== i && (this.depthFunc = i);
18972                void 0 !== s && (this.stencilTestFront = s);
18973                void 0 !== n && (this.stencilFuncFront = n);
18974                void 0 !== r && (this.stencilReadMaskFront = r);
18975                void 0 !== o && (this.stencilWriteMaskFront = o);
18976                void 0 !== a && (this.stencilFailOpFront = a);
18977                void 0 !== l && (this.stencilZFailOpFront = l);
18978                void 0 !== h && (this.stencilPassOpFront = h);
18979                void 0 !== c && (this.stencilRefFront = c);
18980                void 0 !== u && (this.stencilTestBack = u);
18981                void 0 !== _ && (this.stencilFuncBack = _);
18982                void 0 !== d && (this.stencilReadMaskBack = d);
18983                void 0 !== p && (this.stencilWriteMaskBack = p);
18984                void 0 !== m && (this.stencilFailOpBack = m);
18985                void 0 !== f && (this.stencilZFailOpBack = f);
18986                void 0 !== g && (this.stencilPassOpBack = g);
18987                void 0 !== y && (this.stencilRefBack = y);
18988              }
18989            }
18990            class Rr {
18991              get native() {
18992                return this._nativeObj;
18993              }
18994              constructor(t = !1, e = Ls.ONE, i = Ls.ZERO, s = Fs.ADD, n = Ls.ONE, r = Ls.ZERO, o = Fs.ADD, a = Vs.ALL) {
18995                this._nativeObj = void 0;
18996                this._blend = !1;
18997                this._blendSrc = Ls.ONE;
18998                this._blendDst = Ls.ZERO;
18999                this._blendEq = Fs.ADD;
19000                this._blendSrcAlpha = Ls.ONE;
19001                this._blendDstAlpha = Ls.ZERO;
19002                this._blendAlphaEq = Fs.ADD;
19003                this._blendColorMask = Vs.ALL;
19004                this._nativeObj = new gfx.BlendTarget;
19005                this.assignProperties(t, e, i, s, n, r, o, a);
19006              }
19007              get blend() {
19008                return this._blend;
19009              }
19010              set blend(t) {
19011                this._blend = t;
19012                this._nativeObj.blend = t;
19013              }
19014              get blendSrc() {
19015                return this._blendSrc;
19016              }
19017              set blendSrc(t) {
19018                this._blendSrc = t;
19019                this._nativeObj.blendSrc = t;
19020              }
19021              get blendDst() {
19022                return this._blendDst;
19023              }
19024              set blendDst(t) {
19025                this._blendDst = t;
19026                this._nativeObj.blendDst = t;
19027              }
19028              get blendEq() {
19029                return this._blendEq;
19030              }
19031              set blendEq(t) {
19032                this._blendEq = t;
19033                this._nativeObj.blendEq = t;
19034              }
19035              get blendSrcAlpha() {
19036                return this._blendSrcAlpha;
19037              }
19038              set blendSrcAlpha(t) {
19039                this._blendSrcAlpha = t;
19040                this._nativeObj.blendSrcAlpha = t;
19041              }
19042              get blendDstAlpha() {
19043                return this._blendDstAlpha;
19044              }
19045              set blendDstAlpha(t) {
19046                this._blendDstAlpha = t;
19047                this._nativeObj.blendDstAlpha = t;
19048              }
19049              get blendAlphaEq() {
19050                return this._blendAlphaEq;
19051              }
19052              set blendAlphaEq(t) {
19053                this._blendAlphaEq = t;
19054                this._nativeObj.blendAlphaEq = t;
19055              }
19056              get blendColorMask() {
19057                return this._blendColorMask;
19058              }
19059              set blendColorMask(t) {
19060                this._blendColorMask = t;
19061                this._nativeObj.blendColorMask = t;
19062              }
19063              reset() {
19064                this.assignProperties(!1, Ls.ONE, Ls.ZERO, Fs.ADD, Ls.ONE, Ls.ZERO, Fs.ADD, Vs.ALL);
19065              }
19066              destroy() {
19067                this._nativeObj = null;
19068              }
19069              assign(t) {
19070                t && this.assignProperties(t.blend, t.blendSrc, t.blendDst, t.blendEq, t.blendSrcAlpha, t.blendDstAlpha, t.blendAlphaEq, t.blendColorMask);
19071              }
19072              assignProperties(t, e, i, s, n, r, o, a) {
19073                void 0 !== t && (this.blend = t);
19074                void 0 !== e && (this.blendSrc = e);
19075                void 0 !== i && (this.blendDst = i);
19076                void 0 !== s && (this.blendEq = s);
19077                void 0 !== n && (this.blendSrcAlpha = n);
19078                void 0 !== r && (this.blendDstAlpha = r);
19079                void 0 !== o && (this.blendAlphaEq = o);
19080                void 0 !== a && (this.blendColorMask = a);
19081              }
19082            }
19083            class Ir {
19084              _setTargets(t) {
19085                this.targets = t;
19086                const e = "$__nativeObj";
19087                this._syncTargetsToNativeObj(e);
19088                !function(t, e, i, s, n) {
19089                  for (let r = 0, o = e.length; r < o; r++) {
19090                    let o = e[r];
19091                    let a = o[i][s] || o[i];
19092                    o[i] = new Proxy(a, {
19093                      get: (t, e) => e === s ? t : Reflect.get(t, e),
19094                      set: (e, i, s) => {
19095                        Reflect.set(e, i, s);
19096                        n(t, r, e, i, s);
19097                        return !0;
19098                      }
19099                    });
19100                  }
19101                }(this, this.targets, "_nativeObj", e, ((t, i, s, n, r) => {
19102                  t._syncTargetsToNativeObj(e);
19103                }));
19104              }
19105              _syncTargetsToNativeObj(t) {
19106                const e = this.targets.map((e => e.native[t] || e.native));
19107                this._nativeObj.targets = e;
19108              }
19109              get native() {
19110                return this._nativeObj;
19111              }
19112              constructor(t = !1, e = !1, i = new gn, s = [ new Rr ]) {
19113                this.targets = void 0;
19114                this._blendColor = void 0;
19115                this._nativeObj = void 0;
19116                this._isA2C = !1;
19117                this._isIndepend = !1;
19118                this._nativeObj = new gfx.BlendState;
19119                this._setTargets(s);
19120                this.blendColor = i;
19121                this.isA2c = t;
19122                this.isIndepend = e;
19123              }
19124              get isA2c() {
19125                return this._isA2C;
19126              }
19127              set isA2c(t) {
19128                this._isA2C = t;
19129                this._nativeObj.isA2C = t;
19130              }
19131              get isIndepend() {
19132                return this._isIndepend;
19133              }
19134              set isIndepend(t) {
19135                this._isIndepend = t;
19136                this._nativeObj.isIndepend = t;
19137              }
19138              get blendColor() {
19139                return this._blendColor;
19140              }
19141              set blendColor(t) {
19142                this._blendColor = t;
19143                this._nativeObj.blendColor = t;
19144              }
19145              setTarget(t, e) {
19146                let i = this.targets[t];
19147                i || (i = this.targets[t] = new Rr);
19148                i.assign(e);
19149                this._setTargets(this.targets);
19150              }
19151              reset() {
19152                this.isA2c = !1;
19153                this.isIndepend = !1;
19154                this.blendColor = new gn(0, 0, 0, 0);
19155                const t = this.targets;
19156                for (let e = 1, i = t.length; e < i; ++e) t[e].destroy();
19157                t.length = 1;
19158                t[0].reset();
19159                this._setTargets(t);
19160              }
19161              destroy() {
19162                for (let t = 0, e = this.targets.length; t < e; ++t) this.targets[t].destroy();
19163                this.targets = null;
19164                this._nativeObj = null;
19165              }
19166            }
19167            const Mr = gfx.PipelineState;
19168            const Br = gfx.PipelineStateInfo;
19169            class Dr extends hr {
19170              get layout() {
19171                return this._layout;
19172              }
19173              constructor() {
19174                super(ps.DESCRIPTOR_SET);
19175                this._layout = null;
19176                this._buffers = [];
19177                this._textures = [];
19178                this._samplers = [];
19179                this._isDirty = !1;
19180              }
19181              bindBuffer(t, e, i = 0) {
19182                const s = this._layout.bindingIndices[t];
19183                const n = this._layout.bindings[s];
19184                if (n && n.descriptorType & _r) {
19185                  const s = this._layout.descriptorIndices[t];
19186                  if (this._buffers[s + i] !== e) {
19187                    this._buffers[s + i] = e;
19188                    this._isDirty = !0;
19189                  }
19190                }
19191              }
19192              bindSampler(t, e, i = 0) {
19193                const s = this._layout.bindingIndices[t];
19194                const n = this._layout.bindings[s];
19195                if (n && n.descriptorType & dr) {
19196                  const s = this._layout.descriptorIndices[t];
19197                  if (this._samplers[s + i] !== e) {
19198                    this._samplers[s + i] = e;
19199                    this._isDirty = !0;
19200                  }
19201                }
19202              }
19203              bindTexture(t, e, i = 0) {
19204                const s = this._layout.bindingIndices[t];
19205                const n = this._layout.bindings[s];
19206                if (n && n.descriptorType & dr) {
19207                  const s = this._layout.descriptorIndices[t];
19208                  if (this._textures[s + i] !== e) {
19209                    this._textures[s + i] = e;
19210                    this._isDirty = !0;
19211                  }
19212                }
19213              }
19214              getBuffer(t, e = 0) {
19215                const i = this._layout.descriptorIndices[t];
19216                return this._buffers[i + e];
19217              }
19218              getSampler(t, e = 0) {
19219                const i = this._layout.descriptorIndices[t];
19220                return this._samplers[i + e];
19221              }
19222              getTexture(t, e = 0) {
19223                const i = this._layout.descriptorIndices[t];
19224                return this._textures[i + e];
19225              }
19226            }
19227            class Pr extends hr {
19228              get usage() {
19229                return this._usage;
19230              }
19231              get memUsage() {
19232                return this._memUsage;
19233              }
19234              get size() {
19235                return this._size;
19236              }
19237              get stride() {
19238                return this._stride;
19239              }
19240              get count() {
19241                return this._count;
19242              }
19243              get flags() {
19244                return this._flags;
19245              }
19246              constructor() {
19247                super(ps.BUFFER);
19248                this._usage = Ts.NONE;
19249                this._memUsage = Cs.NONE;
19250                this._size = 0;
19251                this._stride = 1;
19252                this._count = 0;
19253                this._flags = vs.NONE;
19254                this._isBufferView = !1;
19255              }
19256            }
19257            class Or extends hr {
19258              get type() {
19259                return this._type;
19260              }
19261              get queue() {
19262                return this._queue;
19263              }
19264              get numDrawCalls() {
19265                return this._numDrawCalls;
19266              }
19267              get numInstances() {
19268                return this._numInstances;
19269              }
19270              get numTris() {
19271                return this._numTris;
19272              }
19273              constructor() {
19274                super(ps.COMMAND_BUFFER);
19275                this._queue = null;
19276                this._type = tn.PRIMARY;
19277                this._numDrawCalls = 0;
19278                this._numInstances = 0;
19279                this._numTris = 0;
19280              }
19281            }
19282            class Nr {
19283              constructor() {
19284                this._gfxAPI = fs.UNKNOWN;
19285                this._renderer = "";
19286                this._vendor = "";
19287                this._features = new Array(ys.COUNT);
19288                this._formatFeatures = new Array(bs.COUNT);
19289                this._queue = null;
19290                this._cmdBuff = null;
19291                this._numDrawCalls = 0;
19292                this._numInstances = 0;
19293                this._numTris = 0;
19294                this._memoryStatus = new or;
19295                this._caps = new on;
19296                this._bindingMappingInfo = new yn;
19297                this._samplers = new Map;
19298                this._generalBarrierss = new Map;
19299                this._textureBarriers = new Map;
19300                this._bufferBarriers = new Map;
19301              }
19302              get gfxAPI() {
19303                return this._gfxAPI;
19304              }
19305              get queue() {
19306                return this._queue;
19307              }
19308              get commandBuffer() {
19309                return this._cmdBuff;
19310              }
19311              get renderer() {
19312                return this._renderer;
19313              }
19314              get vendor() {
19315                return this._vendor;
19316              }
19317              get numDrawCalls() {
19318                return this._numDrawCalls;
19319              }
19320              get numInstances() {
19321                return this._numInstances;
19322              }
19323              get numTris() {
19324                return this._numTris;
19325              }
19326              get memoryStatus() {
19327                return this._memoryStatus;
19328              }
19329              get capabilities() {
19330                return this._caps;
19331              }
19332              get bindingMappingInfo() {
19333                return this._bindingMappingInfo;
19334              }
19335              hasFeature(t) {
19336                return this._features[t];
19337              }
19338              getFormatFeatures(t) {
19339                return this._formatFeatures[t];
19340              }
19341            }
19342            Nr.canvas = void 0;
19343            class Lr extends hr {
19344              get colorTexture() {
19345                return this._colorTexture;
19346              }
19347              get depthStencilTexture() {
19348                return this._depthStencilTexture;
19349              }
19350              get surfaceTransform() {
19351                return this._transform;
19352              }
19353              get width() {
19354                return this._colorTexture.width;
19355              }
19356              get height() {
19357                return this._colorTexture.height;
19358              }
19359              constructor() {
19360                super(ps.SWAPCHAIN);
19361                this._transform = gs.IDENTITY;
19362                this._colorTexture = null;
19363                this._depthStencilTexture = null;
19364              }
19365            }
19366            class Fr extends hr {
19367              get renderPass() {
19368                return this._renderPass;
19369              }
19370              get colorTextures() {
19371                return this._colorTextures;
19372              }
19373              get depthStencilTexture() {
19374                return this._depthStencilTexture;
19375              }
19376              constructor() {
19377                super(ps.FRAMEBUFFER);
19378                this._renderPass = null;
19379                this._colorTextures = [];
19380                this._depthStencilTexture = null;
19381              }
19382            }
19383            const Vr = String.prototype.charCodeAt;
19384            function kr(t) {
19385              return this[t];
19386            }
19387            function Ur(t, e) {
19388              let i = t.length;
19389              let s = e ^ i;
19390              let n = 0;
19391              const r = "string" == typeof t ? Vr : kr;
19392              for (;i >= 4; ) {
19393                let e = 255 & r.call(t, n) | (255 & r.call(t, ++n)) << 8 | (255 & r.call(t, ++n)) << 16 | (255 & r.call(t, ++n)) << 24;
19394                e = 1540483477 * (65535 & e) + ((1540483477 * (e >>> 16) & 65535) << 16);
19395                e ^= e >>> 24;
19396                e = 1540483477 * (65535 & e) + ((1540483477 * (e >>> 16) & 65535) << 16);
19397                s = 1540483477 * (65535 & s) + ((1540483477 * (s >>> 16) & 65535) << 16) ^ e;
19398                i -= 4;
19399                ++n;
19400              }
19401              switch (i) {
19402               case 3:
19403                s ^= (255 & r.call(t, n + 2)) << 16;
19404
19405               case 2:
19406                s ^= (255 & r.call(t, n + 1)) << 8;
19407
19408               case 1:
19409                s ^= 255 & r.call(t, n);
19410                s = 1540483477 * (65535 & s) + ((1540483477 * (s >>> 16) & 65535) << 16);
19411              }
19412              s ^= s >>> 13;
19413              s = 1540483477 * (65535 & s) + ((1540483477 * (s >>> 16) & 65535) << 16);
19414              s ^= s >>> 15;
19415              return s >>> 0;
19416            }
19417            class Gr extends hr {
19418              get attributes() {
19419                return this._attributes;
19420              }
19421              get vertexBuffers() {
19422                return this._vertexBuffers;
19423              }
19424              get indexBuffer() {
19425                return this._indexBuffer;
19426              }
19427              get indirectBuffer() {
19428                return this._indirectBuffer;
19429              }
19430              get attributesHash() {
19431                return this._attributesHash;
19432              }
19433              set vertexCount(t) {
19434                this._drawInfo.vertexCount = t;
19435              }
19436              get vertexCount() {
19437                return this._drawInfo.vertexCount;
19438              }
19439              set firstVertex(t) {
19440                this._drawInfo.firstVertex = t;
19441              }
19442              get firstVertex() {
19443                return this._drawInfo.firstVertex;
19444              }
19445              set indexCount(t) {
19446                this._drawInfo.indexCount = t;
19447              }
19448              get indexCount() {
19449                return this._drawInfo.indexCount;
19450              }
19451              set firstIndex(t) {
19452                this._drawInfo.firstIndex = t;
19453              }
19454              get firstIndex() {
19455                return this._drawInfo.firstIndex;
19456              }
19457              set vertexOffset(t) {
19458                this._drawInfo.vertexOffset = t;
19459              }
19460              get vertexOffset() {
19461                return this._drawInfo.vertexOffset;
19462              }
19463              set instanceCount(t) {
19464                this._drawInfo.instanceCount = t;
19465              }
19466              get instanceCount() {
19467                return this._drawInfo.instanceCount;
19468              }
19469              set firstInstance(t) {
19470                this._drawInfo.firstInstance = t;
19471              }
19472              get firstInstance() {
19473                return this._drawInfo.firstInstance;
19474              }
19475              set drawInfo(t) {
19476                this._drawInfo = t;
19477              }
19478              get drawInfo() {
19479                return this._drawInfo;
19480              }
19481              constructor() {
19482                super(ps.INPUT_ASSEMBLER);
19483                this._attributes = [];
19484                this._attributesHash = 0;
19485                this._vertexBuffers = [];
19486                this._indexBuffer = null;
19487                this._indirectBuffer = null;
19488                this._drawInfo = new vn;
19489              }
19490              getVertexBuffer(t = 0) {
19491                return t < this._vertexBuffers.length ? this._vertexBuffers[t] : null;
19492              }
19493              computeAttributesHash() {
19494                let t = "attrs";
19495                for (let e = 0; e < this.attributes.length; ++e) {
19496                  const i = this.attributes[e];
19497                  t += `,${i.name},${i.format},${i.isNormalized},${i.stream},${i.isInstanced},${i.location}`;
19498                }
19499                return Ur(t, 666);
19500              }
19501            }
19502            class zr extends hr {
19503              get bindings() {
19504                return this._bindings;
19505              }
19506              get bindingIndices() {
19507                return this._bindingIndices;
19508              }
19509              get descriptorIndices() {
19510                return this._descriptorIndices;
19511              }
19512              constructor() {
19513                super(ps.DESCRIPTOR_SET_LAYOUT);
19514                this._bindings = [];
19515                this._bindingIndices = [];
19516                this._descriptorIndices = [];
19517              }
19518            }
19519            class Hr extends hr {
19520              get setLayouts() {
19521                return this._setLayouts;
19522              }
19523              constructor() {
19524                super(ps.PIPELINE_LAYOUT);
19525                this._setLayouts = [];
19526              }
19527            }
19528            class jr extends hr {
19529              get type() {
19530                return this._type;
19531              }
19532              constructor() {
19533                super(ps.QUEUE);
19534                this._type = Qs.GRAPHICS;
19535              }
19536            }
19537            class Xr extends hr {
19538              get colorAttachments() {
19539                return this._colorInfos;
19540              }
19541              get depthStencilAttachment() {
19542                return this._depthStencilInfo;
19543              }
19544              get subPasses() {
19545                return this._subpasses;
19546              }
19547              get hash() {
19548                return this._hash;
19549              }
19550              constructor() {
19551                super(ps.RENDER_PASS);
19552                this._colorInfos = [];
19553                this._depthStencilInfo = null;
19554                this._subpasses = [];
19555                this._hash = 0;
19556              }
19557              computeHash() {
19558                let t = "";
19559                if (this._subpasses.length) for (let e = 0; e < this._subpasses.length; ++e) {
19560                  const i = this._subpasses[e];
19561                  if (i.inputs.length) {
19562                    t += "ia";
19563                    for (let e = 0; e < i.inputs.length; ++e) {
19564                      const s = this._colorInfos[i.inputs[e]];
19565                      t += `,${s.format},${s.sampleCount}`;
19566                    }
19567                  }
19568                  if (i.colors.length) {
19569                    t += "ca";
19570                    for (let e = 0; e < i.inputs.length; ++e) {
19571                      const s = this._colorInfos[i.inputs[e]];
19572                      t += `,${s.format},${s.sampleCount}`;
19573                    }
19574                  }
19575                  if (i.depthStencil >= 0) {
19576                    const e = this._colorInfos[i.depthStencil];
19577                    t += `ds,${e.format},${e.sampleCount}`;
19578                  }
19579                } else {
19580                  t += "ca";
19581                  for (let e = 0; e < this._colorInfos.length; ++e) {
19582                    const i = this._colorInfos[e];
19583                    t += `,${i.format},${i.sampleCount}`;
19584                  }
19585                  const e = this._depthStencilInfo;
19586                  e && (t += `ds,${e.format},${e.sampleCount}`);
19587                }
19588                return Ur(t, 666);
19589              }
19590            }
19591            class Wr extends hr {
19592              get name() {
19593                return this._name;
19594              }
19595              get attributes() {
19596                return this._attributes;
19597              }
19598              get blocks() {
19599                return this._blocks;
19600              }
19601              get samplers() {
19602                return this._samplers;
19603              }
19604              constructor() {
19605                super(ps.SHADER);
19606                this._name = "";
19607                this._stages = [];
19608                this._attributes = [];
19609                this._blocks = [];
19610                this._samplers = [];
19611              }
19612            }
19613            class Yr extends hr {
19614              get type() {
19615                return this._info.type;
19616              }
19617              get usage() {
19618                return this._info.usage;
19619              }
19620              get format() {
19621                return this._info.format;
19622              }
19623              get width() {
19624                return this._info.width;
19625              }
19626              get height() {
19627                return this._info.height;
19628              }
19629              get depth() {
19630                return this._info.depth;
19631              }
19632              get layerCount() {
19633                return this._info.layerCount;
19634              }
19635              get levelCount() {
19636                return this._info.levelCount;
19637              }
19638              get samples() {
19639                return this._info.samples;
19640              }
19641              get flags() {
19642                return this._info.flags;
19643              }
19644              get size() {
19645                return this._size;
19646              }
19647              get info() {
19648                return this._info;
19649              }
19650              get viewInfo() {
19651                return this._viewInfo;
19652              }
19653              get isTextureView() {
19654                return this._isTextureView;
19655              }
19656              constructor() {
19657                super(ps.TEXTURE);
19658                this._info = new xn;
19659                this._viewInfo = new wn;
19660                this._isPowerOf2 = !1;
19661                this._isTextureView = !1;
19662                this._size = 0;
19663              }
19664              static getLevelCount(t, e) {
19665                return Math.floor(Math.log2(Math.max(t, e)));
19666              }
19667            }
19668            class qr extends hr {
19669              get info() {
19670                return this._info;
19671              }
19672              get hash() {
19673                return this._hash;
19674              }
19675              constructor(t, e) {
19676                super(ps.SAMPLER);
19677                this._info = new Rn;
19678                this._hash = 0;
19679                this._info.copy(t);
19680                this._hash = e;
19681              }
19682              static computeHash(t) {
19683                let e = t.minFilter;
19684                e |= t.magFilter << 2;
19685                e |= t.mipFilter << 4;
19686                e |= t.addressU << 6;
19687                e |= t.addressV << 8;
19688                e |= t.addressW << 10;
19689                e |= t.maxAnisotropy << 12;
19690                e |= t.cmpFunc << 16;
19691                return e;
19692              }
19693              static unpackFromHash(t) {
19694                const e = new Rn;
19695                e.minFilter = (3 & t) >> 0;
19696                e.magFilter = (3 & t) >> 2;
19697                e.mipFilter = (3 & t) >> 4;
19698                e.addressU = (3 & t) >> 6;
19699                e.addressV = (3 & t) >> 8;
19700                e.addressW = (3 & t) >> 10;
19701                e.maxAnisotropy = (15 & t) >> 12;
19702                e.cmpFunc = (7 & t) >> 16;
19703                return e;
19704              }
19705            }
19706            class Kr extends hr {
19707              get info() {
19708                return this._info;
19709              }
19710              get hash() {
19711                return this._hash;
19712              }
19713              constructor(t, e) {
19714                super(ps.GLOBAL_BARRIER);
19715                this._info = new Wn;
19716                this._hash = 0;
19717                this._info.copy(t);
19718                this._hash = e;
19719              }
19720              static computeHash(t) {
19721                return Ur(`${t.prevAccesses} ${t.nextAccesses} ${t.type}`, 666);
19722              }
19723            }
19724            class Jr extends hr {
19725              get info() {
19726                return this._info;
19727              }
19728              get hash() {
19729                return this._hash;
19730              }
19731              constructor(t, e) {
19732                super(ps.TEXTURE_BARRIER);
19733                this._info = new Yn;
19734                this._hash = 0;
19735                this._info.copy(t);
19736                this._hash = e;
19737              }
19738              static computeHash(t) {
19739                let e = `${t.prevAccesses} ${t.nextAccesses}`;
19740                e += t.type;
19741                e += t.baseMipLevel;
19742                e += t.levelCount;
19743                e += t.baseSlice;
19744                e += t.sliceCount;
19745                e += t.discardContents;
19746                e += t.srcQueue ? t.srcQueue.type : 0;
19747                e += t.dstQueue ? t.dstQueue.type : 0;
19748                return Ur(e, 666);
19749              }
19750            }
19751            const Zr = new class {
19752              constructor() {
19753                this._pools = [];
19754                this._lastShrinkPassed = 0;
19755                this.shrinkTimeSpan = 5;
19756              }
19757              addContainer(t) {
19758                if (-1 === t._poolHandle) {
19759                  t._poolHandle = this._pools.length;
19760                  this._pools.push(t);
19761                }
19762              }
19763              removeContainer(t) {
19764                if (-1 !== t._poolHandle) {
19765                  this._pools[this._pools.length - 1]._poolHandle = t._poolHandle;
19766                  ot(this._pools, t._poolHandle);
19767                  t._poolHandle = -1;
19768                }
19769              }
19770              tryShrink() {
19771                for (let t = 0; t < this._pools.length; t++) this._pools[t].tryShrink();
19772              }
19773              update(t) {
19774                this._lastShrinkPassed += t;
19775                if (this._lastShrinkPassed > this.shrinkTimeSpan) {
19776                  this.tryShrink();
19777                  this._lastShrinkPassed -= this.shrinkTimeSpan;
19778                }
19779              }
19780            };
19781            class Qr {
19782              constructor() {
19783                this._poolHandle = -1;
19784                Zr.addContainer(this);
19785              }
19786              destroy() {
19787                Zr.removeContainer(this);
19788              }
19789            }
19790            class $r extends Qr {
19791              constructor(t, e, i) {
19792                super();
19793                this._ctor = void 0;
19794                this._elementsPerBatch = void 0;
19795                this._nextAvail = void 0;
19796                this._freepool = [];
19797                this._dtor = void 0;
19798                this._ctor = t;
19799                this._dtor = i || null;
19800                this._elementsPerBatch = Math.max(e, 1);
19801                this._nextAvail = this._elementsPerBatch - 1;
19802                for (let e = 0; e < this._elementsPerBatch; ++e) this._freepool.push(t());
19803              }
19804              alloc() {
19805                if (this._nextAvail < 0) {
19806                  this._freepool.length = this._elementsPerBatch;
19807                  for (let t = 0; t < this._elementsPerBatch; t++) this._freepool[t] = this._ctor();
19808                  this._nextAvail = this._elementsPerBatch - 1;
19809                }
19810                return this._freepool[this._nextAvail--];
19811              }
19812              free(t) {
19813                this._freepool[++this._nextAvail] = t;
19814              }
19815              freeArray(t) {
19816                this._freepool.length = this._nextAvail + 1;
19817                Array.prototype.push.apply(this._freepool, t);
19818                this._nextAvail += t.length;
19819              }
19820              tryShrink() {
19821                if (this._nextAvail >> 1 > this._elementsPerBatch) {
19822                  if (this._dtor) for (let t = this._nextAvail >> 1; t <= this._nextAvail; t++) this._dtor(this._freepool[t]);
19823                  this._freepool.length = this._nextAvail >> 1;
19824                  this._nextAvail = this._freepool.length - 1;
19825                }
19826              }
19827              destroy() {
19828                const t = arguments.length > 0 ? arguments[0] : null;
19829                t && N(14100);
19830                const e = t || this._dtor;
19831                if (e) for (let t = 0; t <= this._nextAvail; t++) e(this._freepool[t]);
19832                this._freepool.length = 0;
19833                this._nextAvail = -1;
19834                super.destroy();
19835              }
19836            }
19837            t("Pool", $r);
19838            class to extends Qr {
19839              constructor(t, e, i) {
19840                super();
19841                this._fn = void 0;
19842                this._dtor = null;
19843                this._count = 0;
19844                this._data = void 0;
19845                this._initSize = 0;
19846                this._fn = t;
19847                this._dtor = i || null;
19848                this._data = new Array(e);
19849                this._initSize = e;
19850                for (let i = 0; i < e; ++i) this._data[i] = t();
19851              }
19852              get length() {
19853                return this._count;
19854              }
19855              get data() {
19856                return this._data;
19857              }
19858              reset() {
19859                this._count = 0;
19860              }
19861              resize(t) {
19862                if (t > this._data.length) for (let e = this._data.length; e < t; ++e) this._data[e] = this._fn();
19863              }
19864              add() {
19865                this._count >= this._data.length && this.resize(this._data.length << 1);
19866                return this._data[this._count++];
19867              }
19868              destroy() {
19869                if (this._dtor) for (let t = 0; t < this._data.length; t++) this._dtor(this._data[t]);
19870                this._data.length = 0;
19871                this._count = 0;
19872                super.destroy();
19873              }
19874              tryShrink() {
19875                if (this._data.length >> 2 > this._count) {
19876                  const t = Math.max(this._initSize, this._data.length >> 1);
19877                  if (this._dtor) for (let e = t; e < this._data.length; e++) this._dtor(this._data[e]);
19878                  this._data.length = t;
19879                }
19880              }
19881              removeAt(t) {
19882                if (t >= this._count) return;
19883                const e = this._count - 1;
19884                const i = this._data[t];
19885                this._data[t] = this._data[e];
19886                this._data[e] = i;
19887                this._count -= 1;
19888              }
19889            }
19890            t("RecyclePool", to);
19891            class eo extends Qr {
19892              constructor(t, e) {
19893                super();
19894                this.array = void 0;
19895                this.length = 0;
19896                this._compareFn = void 0;
19897                this._initSize = 0;
19898                this.array = new Array(t);
19899                this._initSize = t;
19900                this.length = 0;
19901                this._compareFn = e;
19902              }
19903              push(t) {
19904                this.array[this.length++] = t;
19905              }
19906              pop() {
19907                return this.array[--this.length];
19908              }
19909              get(t) {
19910                return this.array[t];
19911              }
19912              clear() {
19913                this.length = 0;
19914              }
19915              destroy() {
19916                this.length = 0;
19917                this.array.length = 0;
19918                super.destroy();
19919              }
19920              tryShrink() {
19921                this.array.length >> 2 > this.length && (this.array.length = Math.max(this._initSize, this.array.length >> 1));
19922              }
19923              sort() {
19924                this.array.length = this.length;
19925                this.array.sort(this._compareFn);
19926              }
19927              concat(t) {
19928                for (let e = 0; e < t.length; ++e) this.array[this.length++] = t[e];
19929              }
19930              fastRemove(t) {
19931                if (t >= this.length || t < 0) return;
19932                const e = --this.length;
19933                this.array[t] = this.array[e];
19934              }
19935              indexOf(t) {
19936                for (let e = 0, i = this.length; e < i; ++e) if (this.array[e] === t) return e;
19937                return -1;
19938              }
19939            }
19940            t("CachedArray", eo);
19941            t("memop", Object.freeze({
19942              __proto__: null,
19943              Pool: $r,
19944              RecyclePool: to,
19945              CachedArray: eo
19946            }));
19947            const io = t("editorExtrasTag", "__editorExtras__");
19948            const so = 1 << 17;
19949            const no = 1 << 18;
19950            const ro = 1 << 19;
19951            const oo = 1 << 20;
19952            const ao = 1 << 21;
19953            const lo = 1 << 22;
19954            const ho = [];
19955            class co {
19956              static _deferredDestroy() {
19957                const t = ho.length;
19958                for (let e = 0; e < t; ++e) {
19959                  const t = ho[e];
19960                  1 & t._objFlags || t._destroyImmediate();
19961                }
19962                t === ho.length ? ho.length = 0 : ho.splice(0, t);
19963              }
19964              constructor(t = "") {
19965                this._objFlags = void 0;
19966                this._name = void 0;
19967                this._name = t;
19968                this._objFlags = 0;
19969              }
19970              get name() {
19971                return this._name;
19972              }
19973              set name(t) {
19974                this._name = t;
19975              }
19976              set hideFlags(t) {
19977                const e = t & co.Flags.AllHideMasks;
19978                this._objFlags = this._objFlags & ~co.Flags.AllHideMasks | e;
19979              }
19980              get hideFlags() {
19981                return this._objFlags & co.Flags.AllHideMasks;
19982              }
19983              set replicated(t) {
19984                t ? this._objFlags |= lo : this._objFlags &= -4194305;
19985              }
19986              get replicated() {
19987                return !!(this._objFlags & lo);
19988              }
19989              get isValid() {
19990                return !(1 & this._objFlags);
19991              }
19992              destroy() {
19993                if (1 & this._objFlags) {
19994                  N(5e3);
19995                  return !1;
19996                }
19997                if (4 & this._objFlags) return !1;
19998                this._objFlags |= 4;
19999                ho.push(this);
20000                this._destroy();
20001                return !0;
20002              }
20003              _destruct() {
20004                const t = this.constructor;
20005                let e = t.__destruct__;
20006                if (!e) {
20007                  e = function(t, e) {
20008                    const i = t instanceof m._BaseNode || t instanceof m.Component;
20009                    const s = i ? "_id" : null;
20010                    let n;
20011                    const r = {};
20012                    for (n in t) if (t.hasOwnProperty(n)) {
20013                      if (n === s) continue;
20014                      switch (typeof t[n]) {
20015                       case "string":
20016                        r[n] = "";
20017                        break;
20018
20019                       case "object":
20020                       case "function":
20021                        r[n] = null;
20022                      }
20023                    }
20024                    if (si._isCCClass(e)) {
20025                      const t = m.Class.Attr.getClassAttrs(e);
20026                      const s = e.__props__;
20027                      for (let e = 0; e < s.length; e++) {
20028                        n = s[e];
20029                        const o = `${n}`;
20030                        if (o in t) {
20031                          if (i && "_id" === n) continue;
20032                          switch (typeof t[o]) {
20033                           case "string":
20034                            r[n] = "";
20035                            break;
20036
20037                           case "object":
20038                           case "function":
20039                            r[n] = null;
20040                            break;
20041
20042                           case "undefined":
20043                            r[n] = void 0;
20044                          }
20045                        }
20046                      }
20047                    }
20048                    return t => {
20049                      for (const e in r) t[e] = r[e];
20050                    };
20051                  }(this, t);
20052                  bt(t, "__destruct__", e, !0);
20053                }
20054                e(this);
20055              }
20056              _destroyImmediate() {
20057                if (1 & this._objFlags) F(5e3); else {
20058                  this._onPreDestroy && this._onPreDestroy();
20059                  this._destruct();
20060                  this._objFlags |= 1;
20061                }
20062              }
20063            }
20064            t("CCObject", co);
20065            const uo = co.prototype;
20066            uo._deserialize = null;
20067            uo._onPreDestroy = null;
20068            si.fastDefine("cc.Object", co, {
20069              _name: "",
20070              _objFlags: 0,
20071              [io]: {}
20072            });
20073            si.Attr.setClassAttr(co, io, "editorOnly", !0);
20074            si.Attr.setClassAttr(co, "replicated", "visible", !1);
20075            bt(co, "Flags", {
20076              Destroyed: 1,
20077              DontSave: 8,
20078              EditorOnly: 16,
20079              Dirty: 32,
20080              DontDestroy: 64,
20081              PersistentMask: -4192741,
20082              Destroying: 128,
20083              Deactivating: 256,
20084              LockedInEditor: 512,
20085              HideInHierarchy: 1024,
20086              AllHideMasks: 1560,
20087              IsPreloadStarted: 8192,
20088              IsOnLoadStarted: 32768,
20089              IsOnLoadCalled: 16384,
20090              IsOnEnableCalled: 2048,
20091              IsStartCalled: 65536,
20092              IsEditorOnEnableCalled: 4096,
20093              IsPositionLocked: ao,
20094              IsRotationLocked: so,
20095              IsScaleLocked: no,
20096              IsAnchorLocked: ro,
20097              IsSizeLocked: oo
20098            });
20099            function _o(t) {
20100              return t instanceof co;
20101            }
20102            function po(t, e) {
20103              return "object" == typeof t ? !(!t || t._objFlags & (e ? 5 : 1)) : void 0 !== t;
20104            }
20105            m.isValid = po;
20106            Pt(co, jsb.CCObject, [ "prototype", "length", "name" ]);
20107            Pt(co.prototype, jsb.CCObject.prototype, [ "constructor", "name", "hideFlags", "replicated", "isValid" ]);
20108            co = t("CCObject", jsb.CCObject);
20109            m.Object = co;
20110            const mo = te.fastRemoveAt;
20111            function fo() {}
20112            class go {
20113              constructor() {
20114                this.callback = fo;
20115                this.target = void 0;
20116                this.once = !1;
20117              }
20118              set(t, e, i) {
20119                this.callback = t || fo;
20120                this.target = e;
20121                this.once = !!i;
20122              }
20123              reset() {
20124                this.target = void 0;
20125                this.callback = fo;
20126                this.once = !1;
20127              }
20128              check() {
20129                return !(_o(this.target) && !po(this.target, !0));
20130              }
20131            }
20132            const yo = new $r((() => new go), 32);
20133            class bo {
20134              constructor() {
20135                this.callbackInfos = [];
20136                this.isInvoking = !1;
20137                this.containCanceled = !1;
20138              }
20139              removeByCallback(t) {
20140                for (let e = 0; e < this.callbackInfos.length; ++e) {
20141                  const i = this.callbackInfos[e];
20142                  if (i && i.callback === t) {
20143                    i.reset();
20144                    yo.free(i);
20145                    mo(this.callbackInfos, e);
20146                    --e;
20147                  }
20148                }
20149              }
20150              removeByTarget(t) {
20151                for (let e = 0; e < this.callbackInfos.length; ++e) {
20152                  const i = this.callbackInfos[e];
20153                  if (i && i.target === t) {
20154                    i.reset();
20155                    yo.free(i);
20156                    mo(this.callbackInfos, e);
20157                    --e;
20158                  }
20159                }
20160              }
20161              cancel(t) {
20162                const e = this.callbackInfos[t];
20163                if (e) {
20164                  e.reset();
20165                  this.isInvoking ? this.callbackInfos[t] = null : mo(this.callbackInfos, t);
20166                  yo.free(e);
20167                }
20168                this.containCanceled = !0;
20169              }
20170              cancelAll() {
20171                for (let t = 0; t < this.callbackInfos.length; t++) {
20172                  const e = this.callbackInfos[t];
20173                  if (e) {
20174                    e.reset();
20175                    yo.free(e);
20176                    this.callbackInfos[t] = null;
20177                  }
20178                }
20179                this.containCanceled = !0;
20180              }
20181              purgeCanceled() {
20182                for (let t = this.callbackInfos.length - 1; t >= 0; --t) {
20183                  this.callbackInfos[t] || mo(this.callbackInfos, t);
20184                }
20185                this.containCanceled = !1;
20186              }
20187              clear() {
20188                this.cancelAll();
20189                this.callbackInfos.length = 0;
20190                this.isInvoking = !1;
20191                this.containCanceled = !1;
20192              }
20193            }
20194            const So = new $r((() => new bo), 16);
20195            class Ao {
20196              constructor() {
20197                this._callbackTable = vt(!0);
20198                this._offCallback = void 0;
20199              }
20200              on(t, e, i, s) {
20201                if (!this.hasEventListener(t, e, i)) {
20202                  let n = this._callbackTable[t];
20203                  n || (n = this._callbackTable[t] = So.alloc());
20204                  const r = yo.alloc();
20205                  r.set(e, i, s);
20206                  n.callbackInfos.push(r);
20207                }
20208                return e;
20209              }
20210              hasEventListener(t, e, i) {
20211                const s = this._callbackTable && this._callbackTable[t];
20212                if (!s) return !1;
20213                const n = s.callbackInfos;
20214                if (!e) {
20215                  if (s.isInvoking) {
20216                    for (let t = 0; t < n.length; ++t) if (n[t]) return !0;
20217                    return !1;
20218                  }
20219                  return n.length > 0;
20220                }
20221                for (let t = 0; t < n.length; ++t) {
20222                  const s = n[t];
20223                  if (s && s.check() && s.callback === e && s.target === i) return !0;
20224                }
20225                return !1;
20226              }
20227              removeAll(t) {
20228                const e = typeof t;
20229                if ("string" === e || "number" === e) {
20230                  const e = this._callbackTable && this._callbackTable[t];
20231                  if (e) if (e.isInvoking) e.cancelAll(); else {
20232                    e.clear();
20233                    So.free(e);
20234                    delete this._callbackTable[t];
20235                  }
20236                } else if (t) for (const e in this._callbackTable) {
20237                  const i = this._callbackTable[e];
20238                  if (i.isInvoking) {
20239                    const e = i.callbackInfos;
20240                    for (let s = 0; s < e.length; ++s) {
20241                      const n = e[s];
20242                      n && n.target === t && i.cancel(s);
20243                    }
20244                  } else i.removeByTarget(t);
20245                }
20246              }
20247              off(t, e, i) {
20248                var s;
20249                const n = this._callbackTable && this._callbackTable[t];
20250                if (n) {
20251                  const s = n.callbackInfos;
20252                  if (e) for (let t = 0; t < s.length; ++t) {
20253                    const r = s[t];
20254                    if (r && r.callback === e && r.target === i) {
20255                      n.cancel(t);
20256                      break;
20257                    }
20258                  } else this.removeAll(t);
20259                }
20260                null === (s = this._offCallback) || void 0 === s || s.call(this);
20261              }
20262              emit(t, e, i, s, n, r) {
20263                const o = this._callbackTable && this._callbackTable[t];
20264                if (o) {
20265                  const a = !o.isInvoking;
20266                  o.isInvoking = !0;
20267                  const l = o.callbackInfos;
20268                  for (let o = 0, a = l.length; o < a; ++o) {
20269                    const a = l[o];
20270                    if (a) {
20271                      const o = a.callback;
20272                      const l = a.target;
20273                      a.once && this.off(t, o, l);
20274                      a.check() ? l ? o.call(l, e, i, s, n, r) : o(e, i, s, n, r) : this.off(t, o, l);
20275                    }
20276                  }
20277                  if (a) {
20278                    o.isInvoking = !1;
20279                    o.containCanceled && o.purgeCanceled();
20280                  }
20281                }
20282              }
20283              clear() {
20284                for (const t in this._callbackTable) {
20285                  const e = this._callbackTable[t];
20286                  if (e) {
20287                    e.clear();
20288                    So.free(e);
20289                    delete this._callbackTable[t];
20290                  }
20291                }
20292              }
20293              _registerOffCallback(t) {
20294                this._offCallback = t;
20295              }
20296            }
20297            function To(t) {
20298              class e extends t {
20299                constructor(...t) {
20300                  super(...t);
20301                  this._callbackTable = vt(!0);
20302                }
20303                once(t, e, i) {
20304                  return this.on(t, e, i, !0);
20305                }
20306                targetOff(t) {
20307                  this.removeAll(t);
20308                }
20309              }
20310              const i = Ao.prototype;
20311              const s = Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i));
20312              for (let t = 0; t < s.length; ++t) {
20313                const n = s[t];
20314                if (!(n in e.prototype)) {
20315                  const t = Object.getOwnPropertyDescriptor(i, n);
20316                  t && Object.defineProperty(e.prototype, n, t);
20317                }
20318              }
20319              return e;
20320            }
20321            const vo = t("EventTarget", To(class {}));
20322            m.EventTarget = vo;
20323            class Eo {
20324              constructor() {
20325                this._delegates = [];
20326              }
20327              add(t) {
20328                this._delegates.includes(t) || this._delegates.push(t);
20329              }
20330              hasListener(t) {
20331                return this._delegates.includes(t);
20332              }
20333              remove(t) {
20334                ee.array.fastRemove(this._delegates, t);
20335              }
20336              dispatch(...t) {
20337                return Promise.all(this._delegates.map((t => t(...arguments))).filter(Boolean));
20338              }
20339            }
20340            t("AsyncDelegate", Eo);
20341            let Co;
20342            !function(t) {
20343              t.UNKNOWN = "unknown";
20344              t.WECHAT = "wechat";
20345              t.ABC = "abcbrowser";
20346              t.IE = "ie";
20347              t.EDGE = "edge";
20348              t.QQ = "qqbrowser";
20349              t.MOBILE_QQ = "mqqbrowser";
20350              t.UC = "ucbrowser";
20351              t.UCBS = "ucbs";
20352              t.BROWSER_360 = "360browser";
20353              t.BAIDU_APP = "baiduboxapp";
20354              t.BAIDU = "baidubrowser";
20355              t.MAXTHON = "maxthon";
20356              t.OPERA = "opera";
20357              t.OUPENG = "oupeng";
20358              t.MIUI = "miuibrowser";
20359              t.FIREFOX = "firefox";
20360              t.SAFARI = "safari";
20361              t.CDE = "cde";
20362              t.LIEBAO = "liebao";
20363              t.QZONE = "qzone";
20364              t.SOUGOU = "sogou";
20365              t.HIJ = "hij";
20366            }(Co || (Co = {}));
20367            let xo;
20368            !function(t) {
20369              t.UNKNOWN = "unknown";
20370              t.ENGLISH = "en";
20371              t.CHINESE = "zh";
20372              t.FRENCH = "fr";
20373              t.ITALIAN = "it";
20374              t.GERMAN = "de";
20375              t.SPANISH = "es";
20376              t.DUTCH = "du";
20377              t.RUSSIAN = "ru";
20378              t.KOREAN = "ko";
20379              t.JAPANESE = "ja";
20380              t.HUNGARIAN = "hu";
20381              t.PORTUGUESE = "pt";
20382              t.ARABIC = "ar";
20383              t.NORWEGIAN = "no";
20384              t.POLISH = "pl";
20385              t.TURKISH = "tr";
20386              t.UKRAINIAN = "uk";
20387              t.ROMANIAN = "ro";
20388              t.BULGARIAN = "bg";
20389            }(xo || (xo = {}));
20390            let wo;
20391            !function(t) {
20392              t[t.NONE = 0] = "NONE";
20393              t[t.LAN = 1] = "LAN";
20394              t[t.WWAN = 2] = "WWAN";
20395            }(wo || (wo = {}));
20396            let Ro;
20397            !function(t) {
20398              t.UNKNOWN = "Unknown";
20399              t.IOS = "iOS";
20400              t.ABC = "Abc";
20401              t.WINDOWS = "Windows";
20402              t.LINUX = "Linux";
20403              t.OSX = "OS X";
20404              t.OHOS = "OHOS";
20405            }(Ro || (Ro = {}));
20406            let Io;
20407            !function(t) {
20408              t.UNKNOWN = "UNKNOWN";
20409              t.EDITOR_PAGE = "EDITOR_PAGE";
20410              t.EDITOR_CORE = "EDITOR_CORE";
20411              t.MOBILE_BROWSER = "MOBILE_BROWSER";
20412              t.DESKTOP_BROWSER = "DESKTOP_BROWSER";
20413              t.WIN32 = "WIN32";
20414              t.ABC = "ABC";
20415              t.IOS = "IOS";
20416              t.MACOS = "MACOS";
20417              t.OHOS = "OHOS";
20418              t.WECHAT_GAME = "WECHAT_GAME";
20419              t.BAIDU_MINI_GAME = "BAIDU_MINI_GAME";
20420              t.XIAOMI_QUICK_GAME = "XIAOMI_QUICK_GAME";
20421              t.ALIPAY_MINI_GAME = "ALIPAY_MINI_GAME";
20422              t.BYTEDANCE_MINI_GAME = "BYTEDANCE_MINI_GAME";
20423              t.OPPO_MINI_GAME = "OPPO_MINI_GAME";
20424              t.VIVO_MINI_GAME = "VIVO_MINI_GAME";
20425              t.HIJ_QUICK_GAME = "HIJ_QUICK_GAME";
20426              t.COCOSPLAY = "COCOSPLAY";
20427              t.LINKSURE_MINI_GAME = "LINKSURE_MINI_GAME";
20428              t.QTT_MINI_GAME = "QTT_MINI_GAME";
20429            }(Io || (Io = {}));
20430            let Mo;
20431            !function(t) {
20432              t.WEBP = "WEBP";
20433              t.IMAGE_BITMAP = "IMAGE_BITMAP";
20434              t.WEB_VIEW = "WEB_VIEW";
20435              t.VIDEO_PLAYER = "VIDEO_PLAYER";
20436              t.SAFE_AREA = "SAFE_AREA";
20437              t.INPUT_TOUCH = "INPUT_TOUCH";
20438              t.EVENT_KEYBOARD = "EVENT_KEYBOARD";
20439              t.EVENT_MOUSE = "EVENT_MOUSE";
20440              t.EVENT_TOUCH = "EVENT_TOUCH";
20441              t.EVENT_ACCELEROMETER = "EVENT_ACCELEROMETER";
20442              t.EVENT_GAMEPAD = "EVENT_GAMEPAD";
20443              t.EVENT_HANDLE = "EVENT_HANDLE";
20444              t.EVENT_HMD = "EVENT_HMD";
20445            }(Mo || (Mo = {}));
20446            const Bo = {
20447              0: wo.NONE,
20448              1: wo.LAN,
20449              2: wo.WWAN
20450            };
20451            const Do = {
20452              0: Io.WIN32,
20453              2: Io.MACOS,
20454              3: Io.ABC,
20455              4: Io.IOS,
20456              5: Io.IOS,
20457              6: Io.OHOS
20458            };
20459            const Po = new class extends vo {
20460              get networkType() {
20461                return Bo[jsb.device.getNetworkType()];
20462              }
20463              constructor() {
20464                super();
20465                this.isNative = void 0;
20466                this.isBrowser = void 0;
20467                this.isMobile = void 0;
20468                this.isLittleEndian = void 0;
20469                this.platform = void 0;
20470                this.language = void 0;
20471                this.nativeLanguage = void 0;
20472                this.os = void 0;
20473                this.osVersion = void 0;
20474                this.osMainVersion = void 0;
20475                this.browserType = void 0;
20476                this.browserVersion = void 0;
20477                this.isXR = void 0;
20478                this._featureMap = void 0;
20479                this.isNative = !0;
20480                this.isBrowser = !1;
20481                this.platform = Do[__getPlatform()];
20482                this.isMobile = this.platform === Io.ABC || this.platform === Io.IOS || this.platform === Io.OHOS;
20483                this.isLittleEndian = (() => {
20484                  const t = new ArrayBuffer(2);
20485                  new DataView(t).setInt16(0, 256, !0);
20486                  return 256 === new Int16Array(t)[0];
20487                })();
20488                const t = __getCurrentLanguageCode();
20489                this.nativeLanguage = t ? t.toLowerCase() : xo.UNKNOWN;
20490                this.language = __getCurrentLanguage();
20491                this.os = __getOS();
20492                this.osVersion = __getOSVersion();
20493                this.osMainVersion = parseInt(this.osVersion);
20494                this.browserType = Co.UNKNOWN;
20495                this.browserVersion = "";
20496                this.isXR = "undefined" != typeof xr;
20497                this._featureMap = {
20498                  [Mo.WEBP]: !0,
20499                  [Mo.IMAGE_BITMAP]: !1,
20500                  [Mo.WEB_VIEW]: this.isMobile,
20501                  [Mo.VIDEO_PLAYER]: this.isMobile,
20502                  [Mo.SAFE_AREA]: this.isMobile,
20503                  [Mo.INPUT_TOUCH]: this.isMobile,
20504                  [Mo.EVENT_KEYBOARD]: !0,
20505                  [Mo.EVENT_MOUSE]: !this.isMobile,
20506                  [Mo.EVENT_TOUCH]: !0,
20507                  [Mo.EVENT_ACCELEROMETER]: this.isMobile,
20508                  [Mo.EVENT_GAMEPAD]: !0,
20509                  [Mo.EVENT_HANDLE]: this.isXR,
20510                  [Mo.EVENT_HMD]: this.isXR
20511                };
20512                this._registerEvent();
20513              }
20514              _registerEvent() {
20515                jsb.onPause = () => {
20516                  this.emit("hide");
20517                };
20518                jsb.onResume = () => {
20519                  this.emit("show");
20520                };
20521                jsb.onClose = () => {
20522                  this.emit("close");
20523                };
20524              }
20525              hasFeature(t) {
20526                return this._featureMap[t];
20527              }
20528              getBatteryLevel() {
20529                return jsb.device.getBatteryLevel();
20530              }
20531              triggerGC() {
20532                jsb.garbageCollect();
20533              }
20534              openURL(t) {
20535                jsb.openURL(t);
20536              }
20537              now() {
20538                return Date.now ? Date.now() : +new Date;
20539              }
20540              restartJSVM() {
20541                __restartVM();
20542              }
20543              close() {
20544                __close();
20545              }
20546            };
20547            let Oo;
20548            !function(t) {
20549              t[t.PORTRAIT = 1] = "PORTRAIT";
20550              t[t.PORTRAIT_UPSIDE_DOWN = 2] = "PORTRAIT_UPSIDE_DOWN";
20551              t[t.LANDSCAPE_LEFT = 4] = "LANDSCAPE_LEFT";
20552              t[t.LANDSCAPE_RIGHT = 8] = "LANDSCAPE_RIGHT";
20553              t[t.LANDSCAPE = 12] = "LANDSCAPE";
20554              t[t.AUTO = 13] = "AUTO";
20555            }(Oo || (Oo = {}));
20556            const No = {
20557              0: Oo.PORTRAIT,
20558              "-90": Oo.LANDSCAPE_LEFT,
20559              90: Oo.LANDSCAPE_RIGHT,
20560              180: Oo.PORTRAIT_UPSIDE_DOWN
20561            };
20562            const Lo = new class extends vo {
20563              get supportFullScreen() {
20564                return !1;
20565              }
20566              get isFullScreen() {
20567                return !1;
20568              }
20569              get devicePixelRatio() {
20570                return jsb.device.getDevicePixelRatio() || 1;
20571              }
20572              get windowSize() {
20573                const t = this.devicePixelRatio;
20574                const e = globalThis.oh ? jsb.device.getInnerWidth() : window.innerWidth;
20575                const i = globalThis.oh ? jsb.device.getInnerHeight() : window.innerHeight;
20576                const s = Math.round(e);
20577                const n = Math.round(i);
20578                return new rs(s * t, n * t);
20579              }
20580              set windowSize(t) {
20581                console.warn("Setting window size is not supported yet.");
20582              }
20583              get resolution() {
20584                const t = this.windowSize;
20585                const e = this.resolutionScale;
20586                return new rs(t.width * e, t.height * e);
20587              }
20588              get resolutionScale() {
20589                return this._resolutionScale;
20590              }
20591              set resolutionScale(t) {
20592                var e;
20593                if (t !== this._resolutionScale) {
20594                  this._resolutionScale = t;
20595                  null === (e = this._cbToUpdateFrameBuffer) || void 0 === e || e.call(this);
20596                }
20597              }
20598              get orientation() {
20599                return No[jsb.device.getDeviceOrientation()];
20600              }
20601              set orientation(t) {
20602                console.warn("Setting orientation is not supported yet.");
20603              }
20604              get safeAreaEdge() {
20605                const t = jsb.device.getSafeAreaEdge();
20606                const e = this.devicePixelRatio;
20607                let i = t.x * e;
20608                let s = t.z * e;
20609                let n = t.y * e;
20610                let r = t.w * e;
20611                this.orientation === Oo.PORTRAIT ? i < s ? i = s : s = i : n < r ? n = r : r = n;
20612                return {
20613                  top: i,
20614                  bottom: s,
20615                  left: n,
20616                  right: r
20617                };
20618              }
20619              get isProportionalToFrame() {
20620                return this._isProportionalToFrame;
20621              }
20622              set isProportionalToFrame(t) {}
20623              constructor() {
20624                super();
20625                this.isFrameRotated = !1;
20626                this.handleResizeEvent = !0;
20627                this._cbToUpdateFrameBuffer = void 0;
20628                this._resolutionScale = 1;
20629                this._isProportionalToFrame = !1;
20630                this._registerEvent();
20631              }
20632              init(t, e) {
20633                this._cbToUpdateFrameBuffer = e;
20634                this._cbToUpdateFrameBuffer();
20635              }
20636              requestFullScreen() {
20637                return Promise.reject(new Error("request fullscreen has not been supported yet on this platform."));
20638              }
20639              exitFullScreen() {
20640                return Promise.reject(new Error("exit fullscreen has not been supported yet on this platform."));
20641              }
20642              _registerEvent() {
20643                jsb.onResize = t => {
20644                  if (0 !== t.width && 0 !== t.height) {
20645                    t.width /= this.devicePixelRatio;
20646                    t.height /= this.devicePixelRatio;
20647                    window.resize(t.width, t.height);
20648                    this.emit("window-resize");
20649                  }
20650                };
20651                jsb.onOrientationChanged = t => {
20652                  this.emit("orientation-change");
20653                };
20654              }
20655            };
20656            const Fo = t("screen", new class {
20657              init() {
20658                var t, e;
20659                const i = null === (t = de.querySettings(_e.Category.SCREEN, "exactFitScreen")) || void 0 === t || t;
20660                const s = null !== (e = de.querySettings(_e.Category.SCREEN, "orientation")) && void 0 !== e ? e : "auto";
20661                Lo.init({
20662                  exactFitScreen: i,
20663                  configOrientation: s
20664                }, (() => {
20665                  var t;
20666                  const e = m.director;
20667                  (null === (t = e.root) || void 0 === t ? void 0 : t.pipeline) ? e.root.pipeline.shadingScale = Lo.resolutionScale : N(1220);
20668                }));
20669              }
20670              get devicePixelRatio() {
20671                return Lo.devicePixelRatio;
20672              }
20673              get windowSize() {
20674                return Lo.windowSize;
20675              }
20676              set windowSize(t) {
20677                Lo.windowSize = t;
20678              }
20679              get resolution() {
20680                return Lo.resolution;
20681              }
20682              get supportsFullScreen() {
20683                return Lo.supportFullScreen;
20684              }
20685              fullScreen() {
20686                return Lo.isFullScreen;
20687              }
20688              requestFullScreen(t, e, i) {
20689                arguments.length > 0 && N(1400, "screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)", "screen.requestFullScreen(): Promise");
20690                return Lo.requestFullScreen().then((() => {
20691                  null == e || e();
20692                })).catch((t => {
20693                  console.error(t);
20694                  null == i || i();
20695                }));
20696              }
20697              exitFullScreen() {
20698                return Lo.exitFullScreen();
20699              }
20700              autoFullScreen(t, e) {
20701                var i;
20702                null === (i = this.requestFullScreen(t, e)) || void 0 === i || i.catch((t => {}));
20703              }
20704              disableAutoFullScreen(t) {}
20705            });
20706            m.screen = Fo;
20707            const Vo = t("sys", {
20708              Feature: Mo,
20709              hasFeature: t => Po.hasFeature(t),
20710              NetworkType: wo,
20711              Language: xo,
20712              OS: Ro,
20713              Platform: Io,
20714              BrowserType: Co,
20715              isNative: Po.isNative,
20716              isBrowser: Po.isBrowser,
20717              isMobile: Po.isMobile,
20718              isLittleEndian: Po.isLittleEndian,
20719              platform: Po.platform,
20720              language: Po.language,
20721              languageCode: Po.nativeLanguage,
20722              os: Po.os,
20723              osVersion: Po.osVersion,
20724              osMainVersion: Po.osMainVersion,
20725              browserType: Po.browserType,
20726              browserVersion: Po.browserVersion,
20727              isXR: Po.isXR,
20728              windowPixelResolution: Fo.windowSize,
20729              capabilities: {
20730                canvas: !0,
20731                opengl: !0,
20732                webp: Po.hasFeature(Mo.WEBP),
20733                imageBitmap: Po.hasFeature(Mo.IMAGE_BITMAP),
20734                touches: Po.hasFeature(Mo.INPUT_TOUCH),
20735                mouse: Po.hasFeature(Mo.EVENT_MOUSE),
20736                keyboard: Po.hasFeature(Mo.EVENT_KEYBOARD),
20737                accelerometer: Po.hasFeature(Mo.EVENT_ACCELEROMETER)
20738              },
20739              localStorage: {},
20740              getNetworkType: () => Po.networkType,
20741              getBatteryLevel: () => Po.getBatteryLevel(),
20742              garbageCollect() {
20743                Po.triggerGC();
20744              },
20745              isObjectValid: t => null != t,
20746              dump() {
20747                let t = "";
20748                t += `isMobile : ${this.isMobile}\r\n`;
20749                t += `language : ${this.language}\r\n`;
20750                t += `browserType : ${this.browserType}\r\n`;
20751                t += `browserVersion : ${this.browserVersion}\r\n`;
20752                t += `capabilities : ${JSON.stringify(this.capabilities)}\r\n`;
20753                t += `os : ${this.os}\r\n`;
20754                t += `osVersion : ${this.osVersion}\r\n`;
20755                t += `platform : ${this.platform}\r\n`;
20756                t += `Using ${m.game.renderType === m.game.RENDER_TYPE_WEBGL ? "WEBGL" : "CANVAS"} renderer.\r\n`;
20757                E(t);
20758              },
20759              openURL(t) {
20760                Po.openURL(t);
20761              },
20762              init() {
20763                try {
20764                  let t = Vo.localStorage = window.localStorage;
20765                  t.setItem("storage", "");
20766                  t.removeItem("storage");
20767                  t = null;
20768                } catch (t) {
20769                  const e = function() {
20770                    N(5200);
20771                  };
20772                  this.localStorage = {
20773                    getItem: e,
20774                    setItem: e,
20775                    clear: e,
20776                    removeItem: e
20777                  };
20778                }
20779                this.__isWebIOS14OrIPadOS14Env = (Vo.os === Ro.IOS || Vo.os === Ro.OSX) && Po.isBrowser && /(OS 14)|(Version\/14)/.test(window.navigator.userAgent);
20780              },
20781              now: () => Po.now(),
20782              restartVM() {
20783                Po.restartJSVM();
20784              },
20785              getSafeAreaRect() {
20786                const t = m.view;
20787                const e = Lo.safeAreaEdge;
20788                const i = Lo.windowSize;
20789                const s = new Qi(e.left, e.bottom);
20790                const n = new Qi(i.width - e.right, i.height - e.top);
20791                t._convertToUISpace(s);
20792                t._convertToUISpace(n);
20793                const r = s.x;
20794                const o = s.y;
20795                const a = n.x - s.x;
20796                const l = n.y - s.y;
20797                return new as(r, o, a, l);
20798              }
20799            });
20800            m.sys = Vo;
20801            let ko;
20802            !function(t) {
20803              t[t.AUTO = 0] = "AUTO";
20804              t[t.CANVAS = 1] = "CANVAS";
20805              t[t.WEBGL = 2] = "WEBGL";
20806              t[t.HEADLESS = 3] = "HEADLESS";
20807            }(ko || (ko = {}));
20808            let Uo;
20809            !function(t) {
20810              t[t.UNKNOWN = -1] = "UNKNOWN";
20811              t[t.CANVAS = 0] = "CANVAS";
20812              t[t.WEBGL = 1] = "WEBGL";
20813              t[t.OPENGL = 2] = "OPENGL";
20814              t[t.HEADLESS = 3] = "HEADLESS";
20815            }(Uo || (Uo = {}));
20816            class Go {
20817              constructor() {
20818                this.initialized = !1;
20819                this._canvas = null;
20820                this._renderType = Uo.UNKNOWN;
20821              }
20822              get gfxDevice() {
20823                return this._gfxDevice;
20824              }
20825              get swapchain() {
20826                return this._swapchain;
20827              }
20828              init(t, e) {
20829                if (this.initialized) return;
20830                const i = de.querySettings(_e.Category.RENDERING, "renderMode");
20831                this._canvas = t;
20832                this._renderType = this._determineRenderType(i);
20833                if (this._renderType === Uo.WEBGL) {
20834                  const i = new Sn(e);
20835                  if (window.gfx) this._gfxDevice = gfx.DeviceManager.create(i); else {
20836                    let e = !!window.WebGL2RenderingContext;
20837                    const s = window.navigator.userAgent.toLowerCase();
20838                    (-1 !== s.indexOf("safari") && -1 === s.indexOf("cde") || Vo.browserType === Co.UC) && (e = !1);
20839                    const n = [];
20840                    e && m.WebGL2Device && n.push(m.WebGL2Device);
20841                    m.WebGLDevice && n.push(m.WebGLDevice);
20842                    m.EmptyDevice && n.push(m.EmptyDevice);
20843                    Nr.canvas = t;
20844                    for (let t = 0; t < n.length; t++) {
20845                      this._gfxDevice = new n[t];
20846                      if (this._gfxDevice.initialize(i)) break;
20847                    }
20848                  }
20849                } else if (this._renderType === Uo.HEADLESS && m.EmptyDevice) {
20850                  this._gfxDevice = new m.EmptyDevice;
20851                  this._gfxDevice.initialize(new Sn(e));
20852                }
20853                if (!this._gfxDevice) {
20854                  x("can not support canvas rendering in 3D");
20855                  this._renderType = Uo.UNKNOWN;
20856                  return;
20857                }
20858                const s = new bn(this._canvas);
20859                const n = Fo.windowSize;
20860                s.width = n.width;
20861                s.height = n.height;
20862                this._swapchain = this._gfxDevice.createSwapchain(s);
20863                this._canvas && (this._canvas.oncontextmenu = () => !1);
20864              }
20865              _determineRenderType(t) {
20866                ("number" != typeof t || t > Uo.HEADLESS || t < ko.AUTO) && (t = ko.AUTO);
20867                let e = Uo.CANVAS;
20868                let i = !1;
20869                if (t === ko.CANVAS) {
20870                  e = Uo.CANVAS;
20871                  i = !0;
20872                } else if (t === ko.AUTO || t === ko.WEBGL) {
20873                  e = Uo.WEBGL;
20874                  i = !0;
20875                } else if (t === ko.HEADLESS) {
20876                  e = Uo.HEADLESS;
20877                  i = !0;
20878                }
20879                if (!i) throw new Error(G(3820, t));
20880                return e;
20881              }
20882            }
20883            const zo = new Go;
20884            const Ho = {
20885              GFXDevice: !0,
20886              GFXBuffer: !0,
20887              GFXTexture: !0,
20888              GFXSampler: !0,
20889              GFXShader: !0,
20890              GFXInputAssembler: !0,
20891              GFXRenderPass: !0,
20892              GFXFramebuffer: !0,
20893              GFXPipelineState: !0,
20894              GFXCommandBuffer: !0,
20895              GFXQueue: !0,
20896              GFXObjectType: !0,
20897              GFXObject: !1,
20898              GFXAttributeName: !0,
20899              GFXType: !0,
20900              GFXFormat: !0,
20901              GFXBufferUsageBit: !0,
20902              GFXMemoryUsageBit: !0,
20903              GFXBufferFlagBit: !0,
20904              GFXBufferAccessBit: "MemoryAccessBit",
20905              GFXPrimitiveMode: !0,
20906              GFXPolygonMode: !0,
20907              GFXShadeModel: !0,
20908              GFXCullMode: !0,
20909              GFXComparisonFunc: !0,
20910              GFXStencilOp: !0,
20911              GFXBlendOp: !0,
20912              GFXBlendFactor: !0,
20913              GFXColorMask: !0,
20914              GFXFilter: !0,
20915              GFXAddress: !0,
20916              GFXTextureType: !0,
20917              GFXTextureUsageBit: !0,
20918              GFXSampleCount: !0,
20919              GFXTextureFlagBit: !0,
20920              GFXShaderStageFlagBit: !0,
20921              GFXDescriptorType: !0,
20922              GFXCommandBufferType: !0,
20923              GFXLoadOp: !0,
20924              GFXStoreOp: !0,
20925              GFXPipelineBindPoint: !0,
20926              GFXDynamicStateFlagBit: !0,
20927              GFXStencilFace: !0,
20928              GFXQueueType: !0,
20929              GFXRect: !0,
20930              GFXViewport: !0,
20931              GFXColor: !0,
20932              GFXClearFlag: !0,
20933              GFXOffset: !0,
20934              GFXExtent: !0,
20935              GFXTextureSubres: "TextureSubresLayers",
20936              GFXTextureCopy: !0,
20937              GFXBufferTextureCopy: !0,
20938              GFXFormatType: !0,
20939              GFXFormatInfo: !0,
20940              GFXMemoryStatus: !0,
20941              GFXFormatInfos: !0,
20942              GFXFormatSize: !0,
20943              GFXFormatSurfaceSize: !0,
20944              GFXGetTypeSize: !0,
20945              getTypedArrayConstructor: !1
20946            };
20947            for (const t in Ho) {
20948              let e = Ho[t];
20949              !0 === e ? e = t.slice(3) : !1 === e && (e = t);
20950              W(m, "cc", [ {
20951                name: t,
20952                newName: e,
20953                target: m.gfx,
20954                targetName: "cc.gfx"
20955              } ]);
20956            }
20957            Y(m, "cc", [ {
20958              name: "GFX_MAX_VERTEX_ATTRIBUTES"
20959            }, {
20960              name: "GFX_MAX_TEXTURE_UNITS"
20961            }, {
20962              name: "GFX_MAX_ATTACHMENTS"
20963            }, {
20964              name: "GFX_MAX_BUFFER_BINDINGS"
20965            }, {
20966              name: "GFXTextureLayout"
20967            } ]);
20968            const jo = Object.assign({}, Er);
20969            jo.Device = gfx.Device;
20970            jo.Swapchain = gfx.Swapchain;
20971            jo.Buffer = gfx.Buffer;
20972            jo.Texture = gfx.Texture;
20973            jo.Sampler = gfx.Sampler;
20974            jo.Shader = gfx.Shader;
20975            jo.InputAssembler = gfx.InputAssembler;
20976            jo.RenderPass = gfx.RenderPass;
20977            jo.Framebuffer = gfx.Framebuffer;
20978            jo.DescriptorSet = gfx.DescriptorSet;
20979            jo.DescriptorSetLayout = gfx.DescriptorSetLayout;
20980            jo.PipelineLayout = gfx.PipelineLayout;
20981            jo.PipelineState = gfx.PipelineState;
20982            jo.CommandBuffer = gfx.CommandBuffer;
20983            jo.Queue = gfx.Queue;
20984            m.gfx = jo;
20985            jo.BlendTarget = Rr;
20986            jo.BlendState = Ir;
20987            jo.RasterizerState = Cr;
20988            jo.DepthStencilState = wr;
20989            jo.PipelineStateInfo = Br;
20990            t("gfx", Object.freeze({
20991              __proto__: null,
20992              DescriptorSet: Dr,
20993              Buffer: Pr,
20994              CommandBuffer: Or,
20995              get ObjectType() {
20996                return ps;
20997              },
20998              get Status() {
20999                return ms;
21000              },
21001              get API() {
21002                return fs;
21003              },
21004              get SurfaceTransform() {
21005                return gs;
21006              },
21007              get Feature() {
21008                return ys;
21009              },
21010              get Format() {
21011                return bs;
21012              },
21013              get FormatType() {
21014                return Ss;
21015              },
21016              get Type() {
21017                return As;
21018              },
21019              get BufferUsageBit() {
21020                return Ts;
21021              },
21022              get BufferFlagBit() {
21023                return vs;
21024              },
21025              get MemoryAccessBit() {
21026                return Es;
21027              },
21028              get MemoryUsageBit() {
21029                return Cs;
21030              },
21031              get TextureType() {
21032                return xs;
21033              },
21034              get TextureUsageBit() {
21035                return ws;
21036              },
21037              get TextureFlagBit() {
21038                return Rs;
21039              },
21040              get FormatFeatureBit() {
21041                return Is;
21042              },
21043              get SampleCount() {
21044                return Ms;
21045              },
21046              get VsyncMode() {
21047                return Bs;
21048              },
21049              get Filter() {
21050                return Ds;
21051              },
21052              get Address() {
21053                return Ps;
21054              },
21055              get ComparisonFunc() {
21056                return Os;
21057              },
21058              get StencilOp() {
21059                return Ns;
21060              },
21061              get BlendFactor() {
21062                return Ls;
21063              },
21064              get BlendOp() {
21065                return Fs;
21066              },
21067              get ColorMask() {
21068                return Vs;
21069              },
21070              get ShaderStageFlagBit() {
21071                return ks;
21072              },
21073              get LoadOp() {
21074                return Us;
21075              },
21076              get StoreOp() {
21077                return Gs;
21078              },
21079              get AccessFlagBit() {
21080                return zs;
21081              },
21082              get ResolveMode() {
21083                return Hs;
21084              },
21085              get PipelineBindPoint() {
21086                return js;
21087              },
21088              get PrimitiveMode() {
21089                return Xs;
21090              },
21091              get PolygonMode() {
21092                return Ws;
21093              },
21094              get ShadeModel() {
21095                return Ys;
21096              },
21097              get CullMode() {
21098                return qs;
21099              },
21100              get DynamicStateFlagBit() {
21101                return Ks;
21102              },
21103              get StencilFace() {
21104                return Js;
21105              },
21106              get DescriptorType() {
21107                return Zs;
21108              },
21109              get QueueType() {
21110                return Qs;
21111              },
21112              get QueryType() {
21113                return $s;
21114              },
21115              get CommandBufferType() {
21116                return tn;
21117              },
21118              get ClearFlagBit() {
21119                return en;
21120              },
21121              get BarrierType() {
21122                return sn;
21123              },
21124              get PassType() {
21125                return nn;
21126              },
21127              Size: rn,
21128              DeviceCaps: on,
21129              DeviceOptions: an,
21130              Offset: ln,
21131              Rect: hn,
21132              Extent: cn,
21133              TextureSubresLayers: un,
21134              TextureSubresRange: _n,
21135              TextureCopy: dn,
21136              TextureBlit: pn,
21137              BufferTextureCopy: mn,
21138              Viewport: fn,
21139              Color: gn,
21140              BindingMappingInfo: yn,
21141              SwapchainInfo: bn,
21142              DeviceInfo: Sn,
21143              BufferInfo: An,
21144              BufferViewInfo: Tn,
21145              DrawInfo: vn,
21146              DispatchInfo: En,
21147              IndirectBuffer: Cn,
21148              TextureInfo: xn,
21149              TextureViewInfo: wn,
21150              SamplerInfo: Rn,
21151              Uniform: In,
21152              UniformBlock: Mn,
21153              UniformSamplerTexture: Bn,
21154              UniformSampler: Dn,
21155              UniformTexture: Pn,
21156              UniformStorageImage: On,
21157              UniformStorageBuffer: Nn,
21158              UniformInputAttachment: Ln,
21159              ShaderStage: Fn,
21160              Attribute: Vn,
21161              ShaderInfo: kn,
21162              InputAssemblerInfo: Un,
21163              ColorAttachment: Gn,
21164              DepthStencilAttachment: zn,
21165              SubpassInfo: Hn,
21166              SubpassDependency: jn,
21167              RenderPassInfo: Xn,
21168              GeneralBarrierInfo: Wn,
21169              TextureBarrierInfo: Yn,
21170              BufferBarrierInfo: qn,
21171              FramebufferInfo: Kn,
21172              DescriptorSetLayoutBinding: Jn,
21173              DescriptorSetLayoutInfo: Zn,
21174              DescriptorSetInfo: Qn,
21175              PipelineLayoutInfo: $n,
21176              InputState: tr,
21177              CommandBufferInfo: er,
21178              QueueInfo: ir,
21179              QueryPoolInfo: sr,
21180              FormatInfo: rr,
21181              MemoryStatus: or,
21182              DynamicStencilStates: ar,
21183              DynamicStates: lr,
21184              GFXObject: hr,
21185              get AttributeName() {
21186                return cr;
21187              },
21188              FormatInfos: ur,
21189              DESCRIPTOR_BUFFER_TYPE: _r,
21190              DESCRIPTOR_SAMPLER_TYPE: dr,
21191              DESCRIPTOR_DYNAMIC_TYPE: pr,
21192              DRAW_INFO_SIZE: mr,
21193              IsPowerOf2: fr,
21194              FormatSize: gr,
21195              FormatSurfaceSize: yr,
21196              GetTypeSize: Sr,
21197              getTypedArrayConstructor: Ar,
21198              formatAlignment: Tr,
21199              alignTo: vr,
21200              Device: Nr,
21201              Swapchain: Lr,
21202              Framebuffer: Fr,
21203              InputAssembler: Gr,
21204              DescriptorSetLayout: zr,
21205              PipelineLayout: Hr,
21206              RasterizerState: Cr,
21207              DepthStencilState: wr,
21208              BlendTarget: Rr,
21209              BlendState: Ir,
21210              PipelineState: Mr,
21211              PipelineStateInfo: Br,
21212              Queue: jr,
21213              RenderPass: Xr,
21214              Shader: Wr,
21215              Texture: Yr,
21216              Sampler: qr,
21217              GeneralBarrier: Kr,
21218              TextureBarrier: Jr,
21219              get LegacyRenderMode() {
21220                return ko;
21221              },
21222              get RenderType() {
21223                return Uo;
21224              },
21225              DeviceManager: Go,
21226              deviceManager: zo
21227            }));
21228            const Xo = new Pi;
21229            const Wo = new Pi;
21230            const Yo = new Pi;
21231            const qo = new Pi;
21232            const Ko = new Pi;
21233            const Jo = new Pi;
21234            const Zo = new Array(3);
21235            const Qo = new Array(3);
21236            function $o(t, e) {
21237              return Pi.dot(e.n, t) - e.d;
21238            }
21239            function ta(t, e, i) {
21240              Pi.copy(t, e);
21241              Pi.subtract(Ko, i.center, i.halfExtents);
21242              Pi.add(Jo, i.center, i.halfExtents);
21243              t.x = t.x < Ko.x ? Ko.x : t.x;
21244              t.y = t.y < Ko.y ? Ko.y : t.y;
21245              t.z = t.z < Ko.z ? Ko.z : t.z;
21246              t.x = t.x > Jo.x ? Jo.x : t.x;
21247              t.y = t.y > Jo.y ? Jo.y : t.y;
21248              t.z = t.z > Jo.z ? Jo.z : t.z;
21249              return t;
21250            }
21251            function ea(t, e, i) {
21252              Pi.set(Xo, i.orientation.m00, i.orientation.m01, i.orientation.m02);
21253              Pi.set(Wo, i.orientation.m03, i.orientation.m04, i.orientation.m05);
21254              Pi.set(Yo, i.orientation.m06, i.orientation.m07, i.orientation.m08);
21255              Zo[0] = Xo;
21256              Zo[1] = Wo;
21257              Zo[2] = Yo;
21258              Qo[0] = i.halfExtents.x;
21259              Qo[1] = i.halfExtents.y;
21260              Qo[2] = i.halfExtents.z;
21261              Pi.subtract(qo, e, i.center);
21262              Pi.set(t, i.center.x, i.center.y, i.center.z);
21263              for (let e = 0; e < 3; e++) {
21264                let i = Pi.dot(qo, Zo[e]);
21265                i > Qo[e] && (i = Qo[e]);
21266                i < -Qo[e] && (i = -Qo[e]);
21267                t.x += i * Zo[e].x;
21268                t.y += i * Zo[e].y;
21269                t.z += i * Zo[e].z;
21270              }
21271              return t;
21272            }
21273            var ia = Object.freeze({
21274              __proto__: null,
21275              point_plane: $o,
21276              pt_point_plane: function(t, e, i) {
21277                const s = $o(e, i);
21278                return Pi.subtract(t, e, Pi.multiplyScalar(t, i.n, s));
21279              },
21280              pt_point_aabb: ta,
21281              pt_point_obb: ea,
21282              pt_point_line: function(t, e, i, s) {
21283                Pi.subtract(Xo, i, s);
21284                const n = Xo;
21285                const r = Pi.lengthSqr(n);
21286                if (0 == r) Pi.copy(t, i); else {
21287                  Pi.subtract(Xo, e, i);
21288                  const o = Pi.dot(Xo, n) / r;
21289                  o < 0 ? Pi.copy(t, i) : o > 1 ? Pi.copy(t, s) : Pi.scaleAndAdd(t, i, n, o);
21290                }
21291              }
21292            });
21293            var sa = {
21294              SHAPE_RAY: 1,
21295              SHAPE_LINE: 2,
21296              SHAPE_SPHERE: 4,
21297              SHAPE_AABB: 8,
21298              SHAPE_OBB: 16,
21299              SHAPE_PLANE: 32,
21300              SHAPE_TRIANGLE: 64,
21301              SHAPE_FRUSTUM: 128,
21302              SHAPE_FRUSTUM_ACCURATE: 256,
21303              SHAPE_CAPSULE: 512,
21304              SHAPE_SPLINE: 1024
21305            };
21306            class na {
21307              static create(t, e, i, s, n, r) {
21308                return new na(t, e, i, s, n, r);
21309              }
21310              static clone(t) {
21311                return new na(t.s.x, t.s.y, t.s.z, t.e.x, t.e.y, t.e.z);
21312              }
21313              static copy(t, e) {
21314                Pi.copy(t.s, e.s);
21315                Pi.copy(t.e, e.e);
21316                return t;
21317              }
21318              static fromPoints(t, e, i) {
21319                Pi.copy(t.s, e);
21320                Pi.copy(t.e, i);
21321                return t;
21322              }
21323              static set(t, e, i, s, n, r, o) {
21324                t.s.x = e;
21325                t.s.y = i;
21326                t.s.z = s;
21327                t.e.x = n;
21328                t.e.y = r;
21329                t.e.z = o;
21330                return t;
21331              }
21332              static len(t) {
21333                return Pi.distance(t.s, t.e);
21334              }
21335              get type() {
21336                return this._type;
21337              }
21338              constructor(t = 0, e = 0, i = 0, s = 0, n = 0, r = -1) {
21339                this.s = void 0;
21340                this.e = void 0;
21341                this._type = void 0;
21342                this._type = sa.SHAPE_LINE;
21343                this.s = new Pi(t, e, i);
21344                this.e = new Pi(s, n, r);
21345              }
21346              length() {
21347                return Pi.distance(this.s, this.e);
21348              }
21349            }
21350            class ra {
21351              static create(t = 0, e = 0, i = 0, s = 0, n = 0, r = 1) {
21352                return new ra(t, e, i, s, n, r);
21353              }
21354              static clone(t) {
21355                return new ra(t.o.x, t.o.y, t.o.z, t.d.x, t.d.y, t.d.z);
21356              }
21357              static copy(t, e) {
21358                Pi.copy(t.o, e.o);
21359                Pi.copy(t.d, e.d);
21360                return t;
21361              }
21362              static fromPoints(t, e, i) {
21363                Pi.copy(t.o, e);
21364                Pi.normalize(t.d, Pi.subtract(t.d, i, e));
21365                return t;
21366              }
21367              static set(t, e, i, s, n, r, o) {
21368                t.o.x = e;
21369                t.o.y = i;
21370                t.o.z = s;
21371                t.d.x = n;
21372                t.d.y = r;
21373                t.d.z = o;
21374                return t;
21375              }
21376              get type() {
21377                return this._type;
21378              }
21379              constructor(t = 0, e = 0, i = 0, s = 0, n = 0, r = -1) {
21380                this.o = void 0;
21381                this.d = void 0;
21382                this._type = void 0;
21383                this._type = sa.SHAPE_RAY;
21384                this.o = new Pi(t, e, i);
21385                this.d = new Pi(s, n, r);
21386              }
21387              computeHit(t, e) {
21388                Pi.normalize(t, this.d);
21389                Pi.scaleAndAdd(t, this.o, t, e);
21390              }
21391            }
21392            const oa = new Pi;
21393            const aa = new Pi;
21394            const la = new Pi;
21395            const ha = new Pi;
21396            function ca(t) {
21397              return Math.max(Math.max(t.x, t.y), t.z);
21398            }
21399            class ua {
21400              static create(t, e, i, s) {
21401                return new ua(t, e, i, s);
21402              }
21403              static clone(t) {
21404                return new ua(t.center.x, t.center.y, t.center.z, t.radius);
21405              }
21406              static copy(t, e) {
21407                Pi.copy(t.center, e.center);
21408                t.radius = e.radius;
21409                return t;
21410              }
21411              static fromPoints(t, e, i) {
21412                Pi.multiplyScalar(t.center, Pi.add(oa, e, i), .5);
21413                t.radius = .5 * Pi.subtract(oa, i, e).length();
21414                return t;
21415              }
21416              static set(t, e, i, s, n) {
21417                t.center.x = e;
21418                t.center.y = i;
21419                t.center.z = s;
21420                t.radius = n;
21421                return t;
21422              }
21423              get center() {
21424                return this._center;
21425              }
21426              set center(t) {
21427                this._center = t;
21428              }
21429              get radius() {
21430                return this._radius;
21431              }
21432              set radius(t) {
21433                this._radius = t;
21434              }
21435              get type() {
21436                return this._type;
21437              }
21438              constructor(t = 0, e = 0, i = 0, s = 1) {
21439                this._center = new Pi(0, 0, 0);
21440                this._radius = 0;
21441                this._type = void 0;
21442                this._type = sa.SHAPE_SPHERE;
21443                this._center = new Pi(t, e, i);
21444                this._radius = s;
21445              }
21446              destroy() {}
21447              clone() {
21448                return ua.clone(this);
21449              }
21450              copy(t) {
21451                return ua.copy(this, t);
21452              }
21453              getBoundary(t, e) {
21454                Pi.set(t, this.center.x - this.radius, this.center.y - this.radius, this.center.z - this.radius);
21455                Pi.set(e, this.center.x + this.radius, this.center.y + this.radius, this.center.z + this.radius);
21456              }
21457              transform(t, e, i, s, n) {
21458                Pi.transformMat4(n.center, this.center, t);
21459                n.radius = this.radius * ca(s);
21460              }
21461              translateAndRotate(t, e, i) {
21462                Pi.transformMat4(i.center, this.center, t);
21463              }
21464              setScale(t, e) {
21465                e.radius = this.radius * ca(t);
21466              }
21467              mergePoint(t) {
21468                if (this.radius < 0) {
21469                  this.center.set(t);
21470                  this.radius = 0;
21471                }
21472                Pi.subtract(aa, t, this.center);
21473                const e = aa.length();
21474                if (e > this.radius) {
21475                  const t = .5 * (e - this.radius);
21476                  this.radius += t;
21477                  Pi.multiplyScalar(aa, aa, t / e);
21478                  Pi.add(this.center, this.center, aa);
21479                }
21480              }
21481              mergePoints(t) {
21482                const e = t.length;
21483                if (!(e < 1)) {
21484                  this.radius = -1;
21485                  for (let i = 0; i < e; i++) this.mergePoint(t[i]);
21486                }
21487              }
21488              mergeAABB(t) {
21489                t.getBoundary(la, ha);
21490                this.mergePoint(la);
21491                this.mergePoint(ha);
21492              }
21493            }
21494            class _a {
21495              static create(t = 1, e = 0, i = 0, s = 0, n = 0, r = 0, o = 0, a = 0, l = 1) {
21496                return new _a(t, e, i, s, n, r, o, a, l);
21497              }
21498              static clone(t) {
21499                return new _a(t.a.x, t.a.y, t.a.z, t.b.x, t.b.y, t.b.z, t.c.x, t.c.y, t.c.z);
21500              }
21501              static copy(t, e) {
21502                Pi.copy(t.a, e.a);
21503                Pi.copy(t.b, e.b);
21504                Pi.copy(t.c, e.c);
21505                return t;
21506              }
21507              static fromPoints(t, e, i, s) {
21508                Pi.copy(t.a, e);
21509                Pi.copy(t.b, i);
21510                Pi.copy(t.c, s);
21511                return t;
21512              }
21513              static set(t, e, i, s, n, r, o, a, l, h) {
21514                t.a.x = e;
21515                t.a.y = i;
21516                t.a.z = s;
21517                t.b.x = n;
21518                t.b.y = r;
21519                t.b.z = o;
21520                t.c.x = a;
21521                t.c.y = l;
21522                t.c.z = h;
21523                return t;
21524              }
21525              get type() {
21526                return this._type;
21527              }
21528              constructor(t = 0, e = 0, i = 0, s = 1, n = 0, r = 0, o = 0, a = 1, l = 0) {
21529                this.a = void 0;
21530                this.b = void 0;
21531                this.c = void 0;
21532                this._type = void 0;
21533                this._type = sa.SHAPE_TRIANGLE;
21534                this.a = new Pi(t, e, i);
21535                this.b = new Pi(s, n, r);
21536                this.c = new Pi(o, a, l);
21537              }
21538            }
21539            let da;
21540            !function(t) {
21541              t[t.ALL = 0] = "ALL";
21542              t[t.CLOSEST = 1] = "CLOSEST";
21543              t[t.ANY = 2] = "ANY";
21544            }(da || (da = {}));
21545            const pa = function() {
21546              const t = new Pi(0, 0, 0);
21547              return function(e, i) {
21548                const s = Pi.dot(e.d, i.n);
21549                if (Math.abs(s) < Number.EPSILON) return 0;
21550                Pi.multiplyScalar(t, i.n, i.d);
21551                const n = Pi.dot(Pi.subtract(t, t, e.o), i.n) / s;
21552                return n < 0 ? 0 : n;
21553              };
21554            }();
21555            const ma = function() {
21556              const t = new Pi(0, 0, 0);
21557              const e = new Pi(0, 0, 0);
21558              const i = new Pi(0, 0, 0);
21559              const s = new Pi(0, 0, 0);
21560              const n = new Pi(0, 0, 0);
21561              return function(r, o, a) {
21562                Pi.subtract(t, o.b, o.a);
21563                Pi.subtract(e, o.c, o.a);
21564                Pi.cross(i, r.d, e);
21565                const l = Pi.dot(t, i);
21566                if (l < Number.EPSILON && (!a || l > -Number.EPSILON)) return 0;
21567                const h = 1 / l;
21568                Pi.subtract(s, r.o, o.a);
21569                const c = Pi.dot(s, i) * h;
21570                if (c < 0 || c > 1) return 0;
21571                Pi.cross(n, s, t);
21572                const u = Pi.dot(r.d, n) * h;
21573                if (u < 0 || c + u > 1) return 0;
21574                const _ = Pi.dot(e, n) * h;
21575                return _ < 0 ? 0 : _;
21576              };
21577            }();
21578            const fa = function() {
21579              const t = new Pi(0, 0, 0);
21580              return function(e, i) {
21581                const s = i.radius;
21582                const n = i.center;
21583                const r = e.o;
21584                const o = e.d;
21585                const a = s * s;
21586                Pi.subtract(t, n, r);
21587                const l = t.lengthSqr();
21588                const h = Pi.dot(t, o);
21589                const c = a - (l - h * h);
21590                if (c < 0) return 0;
21591                const u = Math.sqrt(c);
21592                const _ = l < a ? h + u : h - u;
21593                return _ < 0 ? 0 : _;
21594              };
21595            }();
21596            const ga = function() {
21597              const t = new Pi;
21598              const e = new Pi;
21599              return function(i, s) {
21600                Pi.subtract(t, s.center, s.halfExtents);
21601                Pi.add(e, s.center, s.halfExtents);
21602                return ya(i, t, e);
21603              };
21604            }();
21605            function ya(t, e, i) {
21606              const s = t.o;
21607              const n = t.d;
21608              const r = 1 / n.x;
21609              const o = 1 / n.y;
21610              const a = 1 / n.z;
21611              const l = (e.x - s.x) * r;
21612              const h = (i.x - s.x) * r;
21613              const c = (e.y - s.y) * o;
21614              const u = (i.y - s.y) * o;
21615              const _ = (e.z - s.z) * a;
21616              const d = (i.z - s.z) * a;
21617              const p = Math.max(Math.max(Math.min(l, h), Math.min(c, u)), Math.min(_, d));
21618              const m = Math.min(Math.min(Math.max(l, h), Math.max(c, u)), Math.max(_, d));
21619              return m < 0 || p > m ? 0 : p > 0 ? p : m;
21620            }
21621            const ba = function() {
21622              let t = new Pi;
21623              let e = new Pi;
21624              let i = new Pi;
21625              const s = new Pi;
21626              const n = new Pi;
21627              const r = new Pi;
21628              const o = new Pi;
21629              const a = new Array(3);
21630              const l = new Array(3);
21631              const h = new Array(3);
21632              const c = new Array(6);
21633              return function(u, _) {
21634                a[0] = _.halfExtents.x;
21635                a[1] = _.halfExtents.y;
21636                a[2] = _.halfExtents.z;
21637                t = _.center;
21638                e = u.o;
21639                i = u.d;
21640                Pi.set(s, _.orientation.m00, _.orientation.m01, _.orientation.m02);
21641                Pi.set(n, _.orientation.m03, _.orientation.m04, _.orientation.m05);
21642                Pi.set(r, _.orientation.m06, _.orientation.m07, _.orientation.m08);
21643                Pi.subtract(o, t, e);
21644                l[0] = Pi.dot(s, i);
21645                l[1] = Pi.dot(n, i);
21646                l[2] = Pi.dot(r, i);
21647                h[0] = Pi.dot(s, o);
21648                h[1] = Pi.dot(n, o);
21649                h[2] = Pi.dot(r, o);
21650                for (let t = 0; t < 3; ++t) {
21651                  if (0 === l[t]) {
21652                    if (-h[t] - a[t] > 0 || -h[t] + a[t] < 0) return 0;
21653                    l[t] = 1e-7;
21654                  }
21655                  c[2 * t + 0] = (h[t] + a[t]) / l[t];
21656                  c[2 * t + 1] = (h[t] - a[t]) / l[t];
21657                }
21658                const d = Math.max(Math.max(Math.min(c[0], c[1]), Math.min(c[2], c[3])), Math.min(c[4], c[5]));
21659                const p = Math.min(Math.min(Math.max(c[0], c[1]), Math.max(c[2], c[3])), Math.max(c[4], c[5]));
21660                return p < 0 || d > p ? 0 : d > 0 ? d : p;
21661              };
21662            }();
21663            const Sa = function() {
21664              const t = new Pi;
21665              const e = new Pi;
21666              const i = new Pi;
21667              const s = new Pi;
21668              const n = new Pi;
21669              const r = new Pi;
21670              const o = new Pi;
21671              const a = new ua;
21672              return function(l, h) {
21673                const c = h.radius * h.radius;
21674                const u = Pi.normalize(t, l.d);
21675                const _ = h.ellipseCenter0;
21676                const d = h.ellipseCenter1;
21677                const p = Pi.subtract(e, d, _);
21678                if (p.equals(Pi.ZERO)) {
21679                  a.radius = h.radius;
21680                  a.center.set(h.ellipseCenter0);
21681                  return Za.raySphere(l, a);
21682                }
21683                const m = l.o;
21684                const f = Pi.subtract(i, m, _);
21685                const g = Pi.cross(s, u, p);
21686                const y = g.lengthSqr();
21687                if (0 === y) {
21688                  a.radius = h.radius;
21689                  const t = Pi.subtract(n, d, m);
21690                  f.lengthSqr() < t.lengthSqr() ? a.center.set(h.ellipseCenter0) : a.center.set(h.ellipseCenter1);
21691                  return Za.raySphere(l, a);
21692                }
21693                const b = Pi.cross(n, f, p);
21694                const S = p.lengthSqr();
21695                const A = 2 * Pi.dot(g, b);
21696                const T = A * A - 4 * y * (b.lengthSqr() - c * S);
21697                if (T < 0) return 0;
21698                const v = (-A - Math.sqrt(T)) / (2 * y);
21699                if (v < 0) {
21700                  a.radius = h.radius;
21701                  const t = Pi.subtract(r, d, m);
21702                  f.lengthSqr() < t.lengthSqr() ? a.center.set(h.ellipseCenter0) : a.center.set(h.ellipseCenter1);
21703                  return Za.raySphere(l, a);
21704                }
21705                {
21706                  const t = Pi.scaleAndAdd(r, l.o, u, v);
21707                  const e = Pi.subtract(o, t, _);
21708                  const i = Pi.dot(e, p) / S;
21709                  if (i >= 0 && i <= 1) return v;
21710                  if (i < 0) {
21711                    a.radius = h.radius;
21712                    a.center.set(h.ellipseCenter0);
21713                    return Za.raySphere(l, a);
21714                  }
21715                  if (i > 1) {
21716                    a.radius = h.radius;
21717                    a.center.set(h.ellipseCenter1);
21718                    return Za.raySphere(l, a);
21719                  }
21720                  return 0;
21721                }
21722              };
21723            }();
21724            const Aa = function() {
21725              const t = _a.create();
21726              const e = {
21727                distance: 1 / 0,
21728                doubleSided: !1,
21729                mode: da.ANY
21730              };
21731              let i = 0;
21732              const s = (t, e, s, n, r, o) => {
21733                if (t === da.CLOSEST) {
21734                  if (i > e || 0 === i) {
21735                    i = e;
21736                    if (o) if (0 === o.length) o.push({
21737                      distance: e,
21738                      vertexIndex0: s / 3,
21739                      vertexIndex1: n / 3,
21740                      vertexIndex2: r / 3
21741                    }); else {
21742                      o[0].distance = e;
21743                      o[0].vertexIndex0 = s / 3;
21744                      o[0].vertexIndex1 = n / 3;
21745                      o[0].vertexIndex2 = r / 3;
21746                    }
21747                  }
21748                } else {
21749                  i = e;
21750                  o && o.push({
21751                    distance: e,
21752                    vertexIndex0: s / 3,
21753                    vertexIndex1: n / 3,
21754                    vertexIndex2: r / 3
21755                  });
21756                }
21757              };
21758              return function(n, r, o) {
21759                i = 0;
21760                if (0 === r.geometricInfo.positions.length) return i;
21761                const a = void 0 === o ? e : o;
21762                if (ya(n, r.geometricInfo.boundingBox.min, r.geometricInfo.boundingBox.max)) {
21763                  const e = r.primitiveMode;
21764                  const {positions: i, indices: o} = r.geometricInfo;
21765                  ((e, i, n, r, o) => {
21766                    if (n === Xs.TRIANGLE_LIST) {
21767                      const n = i.length;
21768                      for (let a = 0; a < n; a += 3) {
21769                        const n = 3 * i[a];
21770                        const l = 3 * i[a + 1];
21771                        const h = 3 * i[a + 2];
21772                        Pi.set(t.a, e[n], e[n + 1], e[n + 2]);
21773                        Pi.set(t.b, e[l], e[l + 1], e[l + 2]);
21774                        Pi.set(t.c, e[h], e[h + 1], e[h + 2]);
21775                        const c = Za.rayTriangle(r, t, o.doubleSided);
21776                        if (!(0 === c || c > o.distance)) {
21777                          s(o.mode, c, n, l, h, o.result);
21778                          if (o.mode === da.ANY) return c;
21779                        }
21780                      }
21781                    } else if (n === Xs.TRIANGLE_STRIP) {
21782                      const n = i.length - 2;
21783                      let a = 0;
21784                      for (let l = 0; l < n; l += 1) {
21785                        const n = 3 * i[l - a];
21786                        const h = 3 * i[l + a + 1];
21787                        const c = 3 * i[l + 2];
21788                        Pi.set(t.a, e[n], e[n + 1], e[n + 2]);
21789                        Pi.set(t.b, e[h], e[h + 1], e[h + 2]);
21790                        Pi.set(t.c, e[c], e[c + 1], e[c + 2]);
21791                        a = ~a;
21792                        const u = Za.rayTriangle(r, t, o.doubleSided);
21793                        if (!(0 === u || u > o.distance)) {
21794                          s(o.mode, u, n, h, c, o.result);
21795                          if (o.mode === da.ANY) return u;
21796                        }
21797                      }
21798                    } else if (n === Xs.TRIANGLE_FAN) {
21799                      const n = i.length - 1;
21800                      const a = 3 * i[0];
21801                      Pi.set(t.a, e[a], e[a + 1], e[a + 2]);
21802                      for (let l = 1; l < n; l += 1) {
21803                        const n = 3 * i[l];
21804                        const h = 3 * i[l + 1];
21805                        Pi.set(t.b, e[n], e[n + 1], e[n + 2]);
21806                        Pi.set(t.c, e[h], e[h + 1], e[h + 2]);
21807                        const c = Za.rayTriangle(r, t, o.doubleSided);
21808                        if (!(0 === c || c > o.distance)) {
21809                          s(o.mode, c, a, n, h, o.result);
21810                          if (o.mode === da.ANY) return c;
21811                        }
21812                      }
21813                    }
21814                  })(i, o, e, n, a);
21815                }
21816                return i;
21817              };
21818            }();
21819            const Ta = function() {
21820              let t = 0;
21821              const e = {
21822                distance: 1 / 0,
21823                doubleSided: !1,
21824                mode: da.ANY
21825              };
21826              return function(i, s, n) {
21827                t = 0;
21828                const r = void 0 === n ? e : n;
21829                const o = s.renderingSubMeshes.length;
21830                const a = s.struct.minPosition;
21831                const l = s.struct.maxPosition;
21832                if (a && l && !ya(i, a, l)) return t;
21833                for (let e = 0; e < o; e++) {
21834                  const n = s.renderingSubMeshes[e];
21835                  const o = Aa(i, n, r);
21836                  if (o) if (r.mode === da.CLOSEST) {
21837                    if (0 === t || t > o) {
21838                      t = o;
21839                      r.subIndices && (r.subIndices[0] = e);
21840                    }
21841                  } else {
21842                    t = o;
21843                    r.subIndices && r.subIndices.push(e);
21844                    if (r.mode === da.ANY) return o;
21845                  }
21846                }
21847                if (t && r.mode === da.CLOSEST) {
21848                  if (r.result) {
21849                    r.result[0].distance = t;
21850                    r.result.length = 1;
21851                  }
21852                  r.subIndices && (r.subIndices.length = 1);
21853                }
21854                return t;
21855              };
21856            }();
21857            const va = function() {
21858              let t = 0;
21859              const e = {
21860                distance: 1 / 0,
21861                doubleSided: !1,
21862                mode: da.ANY
21863              };
21864              const i = new ra;
21865              const s = new qi;
21866              return function(n, r, o) {
21867                t = 0;
21868                const a = void 0 === o ? e : o;
21869                const l = r.worldBounds;
21870                if (l && !ga(n, l)) return t;
21871                ra.copy(i, n);
21872                if (r.node) {
21873                  qi.invert(s, r.node.getWorldMatrix(s));
21874                  Pi.transformMat4(i.o, n.o, s);
21875                  Pi.transformMat4Normal(i.d, n.d, s);
21876                }
21877                const h = r.subModels;
21878                for (let e = 0; e < h.length; e++) {
21879                  const s = h[e].subMesh;
21880                  const n = Aa(i, s, a);
21881                  if (n) if (a.mode === da.CLOSEST) {
21882                    if (0 === t || t > n) {
21883                      t = n;
21884                      a.subIndices && (a.subIndices[0] = e);
21885                    }
21886                  } else {
21887                    t = n;
21888                    a.subIndices && a.subIndices.push(e);
21889                    if (a.mode === da.ANY) return n;
21890                  }
21891                }
21892                if (t && a.mode === da.CLOSEST) {
21893                  if (a.result) {
21894                    a.result[0].distance = t;
21895                    a.result.length = 1;
21896                  }
21897                  a.subIndices && (a.subIndices.length = 1);
21898                }
21899                return t;
21900              };
21901            }();
21902            const Ea = function() {
21903              const t = new Pi(0, 0, 0);
21904              return function(e, i) {
21905                Pi.subtract(t, e.e, e.s);
21906                const s = (i.d - Pi.dot(e.s, i.n)) / Pi.dot(t, i.n);
21907                return s < 0 || s > 1 ? 0 : s;
21908              };
21909            }();
21910            const Ca = function() {
21911              const t = new Pi(0, 0, 0);
21912              const e = new Pi(0, 0, 0);
21913              const i = new Pi(0, 0, 0);
21914              const s = new Pi(0, 0, 0);
21915              const n = new Pi(0, 0, 0);
21916              const r = new Pi(0, 0, 0);
21917              return function(o, a, l) {
21918                Pi.subtract(t, a.b, a.a);
21919                Pi.subtract(e, a.c, a.a);
21920                Pi.subtract(i, o.s, o.e);
21921                Pi.cross(n, t, e);
21922                const h = Pi.dot(i, n);
21923                if (h <= 0) return 0;
21924                Pi.subtract(s, o.s, a.a);
21925                const c = Pi.dot(s, n);
21926                if (c < 0 || c > h) return 0;
21927                Pi.cross(r, i, s);
21928                let u = Pi.dot(e, r);
21929                if (u < 0 || u > h) return 0;
21930                let _ = -Pi.dot(t, r);
21931                if (_ < 0 || u + _ > h) return 0;
21932                if (l) {
21933                  const t = 1 / h;
21934                  u *= t;
21935                  _ *= t;
21936                  const e = 1 - u - _;
21937                  Pi.set(l, a.a.x * e + a.b.x * u + a.c.x * _, a.a.y * e + a.b.y * u + a.c.y * _, a.a.z * e + a.b.z * u + a.c.z * _);
21938                }
21939                return 1;
21940              };
21941            }();
21942            const xa = new ra;
21943            function wa(t, e) {
21944              xa.o.set(t.s);
21945              Pi.subtract(xa.d, t.e, t.s);
21946              xa.d.normalize();
21947              const i = ga(xa, e);
21948              return i <= t.length() ? i : 0;
21949            }
21950            function Ra(t, e) {
21951              xa.o.set(t.s);
21952              Pi.subtract(xa.d, t.e, t.s);
21953              xa.d.normalize();
21954              const i = ba(xa, e);
21955              return i <= t.length() ? i : 0;
21956            }
21957            function Ia(t, e) {
21958              xa.o.set(t.s);
21959              Pi.subtract(xa.d, t.e, t.s);
21960              xa.d.normalize();
21961              const i = fa(xa, e);
21962              return i <= t.length() ? i : 0;
21963            }
21964            const Ma = function() {
21965              const t = new Pi;
21966              const e = new Pi;
21967              const i = new Pi;
21968              const s = new Pi;
21969              return function(n, r) {
21970                Pi.subtract(t, n.center, n.halfExtents);
21971                Pi.add(e, n.center, n.halfExtents);
21972                Pi.subtract(i, r.center, r.halfExtents);
21973                Pi.add(s, r.center, r.halfExtents);
21974                return t.x <= s.x && e.x >= i.x && t.y <= s.y && e.y >= i.y && t.z <= s.z && e.z >= i.z;
21975              };
21976            }();
21977            function Ba(t, e, i, s, n, r) {
21978              Pi.set(r[0], t.x + i.x * e.x + s.x * e.y + n.x * e.z, t.y + i.y * e.x + s.y * e.y + n.y * e.z, t.z + i.z * e.x + s.z * e.y + n.z * e.z);
21979              Pi.set(r[1], t.x - i.x * e.x + s.x * e.y + n.x * e.z, t.y - i.y * e.x + s.y * e.y + n.y * e.z, t.z - i.z * e.x + s.z * e.y + n.z * e.z);
21980              Pi.set(r[2], t.x + i.x * e.x - s.x * e.y + n.x * e.z, t.y + i.y * e.x - s.y * e.y + n.y * e.z, t.z + i.z * e.x - s.z * e.y + n.z * e.z);
21981              Pi.set(r[3], t.x + i.x * e.x + s.x * e.y - n.x * e.z, t.y + i.y * e.x + s.y * e.y - n.y * e.z, t.z + i.z * e.x + s.z * e.y - n.z * e.z);
21982              Pi.set(r[4], t.x - i.x * e.x - s.x * e.y - n.x * e.z, t.y - i.y * e.x - s.y * e.y - n.y * e.z, t.z - i.z * e.x - s.z * e.y - n.z * e.z);
21983              Pi.set(r[5], t.x + i.x * e.x - s.x * e.y - n.x * e.z, t.y + i.y * e.x - s.y * e.y - n.y * e.z, t.z + i.z * e.x - s.z * e.y - n.z * e.z);
21984              Pi.set(r[6], t.x - i.x * e.x + s.x * e.y - n.x * e.z, t.y - i.y * e.x + s.y * e.y - n.y * e.z, t.z - i.z * e.x + s.z * e.y - n.z * e.z);
21985              Pi.set(r[7], t.x - i.x * e.x - s.x * e.y + n.x * e.z, t.y - i.y * e.x - s.y * e.y + n.y * e.z, t.z - i.z * e.x - s.z * e.y + n.z * e.z);
21986            }
21987            function Da(t, e) {
21988              let i = Pi.dot(e, t[0]);
21989              let s = i;
21990              for (let n = 1; n < 8; ++n) {
21991                const r = Pi.dot(e, t[n]);
21992                i = r < i ? r : i;
21993                s = r > s ? r : s;
21994              }
21995              return [ i, s ];
21996            }
21997            const Pa = function() {
21998              const t = new Array(15);
21999              for (let e = 0; e < 15; e++) t[e] = new Pi(0, 0, 0);
22000              const e = new Array(8);
22001              const i = new Array(8);
22002              for (let t = 0; t < 8; t++) {
22003                e[t] = new Pi(0, 0, 0);
22004                i[t] = new Pi(0, 0, 0);
22005              }
22006              const s = new Pi;
22007              const n = new Pi;
22008              return function(r, o) {
22009                Pi.set(t[0], 1, 0, 0);
22010                Pi.set(t[1], 0, 1, 0);
22011                Pi.set(t[2], 0, 0, 1);
22012                Pi.set(t[3], o.orientation.m00, o.orientation.m01, o.orientation.m02);
22013                Pi.set(t[4], o.orientation.m03, o.orientation.m04, o.orientation.m05);
22014                Pi.set(t[5], o.orientation.m06, o.orientation.m07, o.orientation.m08);
22015                for (let e = 0; e < 3; ++e) {
22016                  Pi.cross(t[6 + 3 * e + 0], t[e], t[3]);
22017                  Pi.cross(t[6 + 3 * e + 1], t[e], t[4]);
22018                  Pi.cross(t[6 + 3 * e + 1], t[e], t[5]);
22019                }
22020                Pi.subtract(s, r.center, r.halfExtents);
22021                Pi.add(n, r.center, r.halfExtents);
22022                !function(t, e, i) {
22023                  Pi.set(i[0], t.x, e.y, e.z);
22024                  Pi.set(i[1], t.x, e.y, t.z);
22025                  Pi.set(i[2], t.x, t.y, e.z);
22026                  Pi.set(i[3], t.x, t.y, t.z);
22027                  Pi.set(i[4], e.x, e.y, e.z);
22028                  Pi.set(i[5], e.x, e.y, t.z);
22029                  Pi.set(i[6], e.x, t.y, e.z);
22030                  Pi.set(i[7], e.x, t.y, t.z);
22031                }(s, n, e);
22032                Ba(o.center, o.halfExtents, t[3], t[4], t[5], i);
22033                for (let s = 0; s < 15; ++s) {
22034                  const n = Da(e, t[s]);
22035                  const r = Da(i, t[s]);
22036                  if (r[0] > n[1] || n[0] > r[1]) return 0;
22037                }
22038                return 1;
22039              };
22040            }();
22041            const Oa = function(t, e) {
22042              const i = t.halfExtents.x * Math.abs(e.n.x) + t.halfExtents.y * Math.abs(e.n.y) + t.halfExtents.z * Math.abs(e.n.z);
22043              const s = Pi.dot(e.n, t.center);
22044              return s + i < e.d ? -1 : s - i > e.d ? 0 : 1;
22045            };
22046            const Na = function(t, e) {
22047              for (let i = 0; i < e.planes.length; i++) if (-1 === Oa(t, e.planes[i])) return 0;
22048              return 1;
22049            };
22050            const La = function() {
22051              const t = new Array(8);
22052              let e = 0;
22053              let i = 0;
22054              for (let e = 0; e < t.length; e++) t[e] = new Pi(0, 0, 0);
22055              return function(s, n) {
22056                let r = 0;
22057                let o = !1;
22058                for (let t = 0; t < n.planes.length; t++) {
22059                  r = Oa(s, n.planes[t]);
22060                  if (-1 === r) return 0;
22061                  1 === r && (o = !0);
22062                }
22063                if (!o) return 1;
22064                for (let e = 0; e < n.vertices.length; e++) Pi.subtract(t[e], n.vertices[e], s.center);
22065                e = 0, i = 0;
22066                for (let r = 0; r < n.vertices.length; r++) t[r].x > s.halfExtents.x ? e++ : t[r].x < -s.halfExtents.x && i++;
22067                if (e === n.vertices.length || i === n.vertices.length) return 0;
22068                e = 0;
22069                i = 0;
22070                for (let r = 0; r < n.vertices.length; r++) t[r].y > s.halfExtents.y ? e++ : t[r].y < -s.halfExtents.y && i++;
22071                if (e === n.vertices.length || i === n.vertices.length) return 0;
22072                e = 0;
22073                i = 0;
22074                for (let r = 0; r < n.vertices.length; r++) t[r].z > s.halfExtents.z ? e++ : t[r].z < -s.halfExtents.z && i++;
22075                return e === n.vertices.length || i === n.vertices.length ? 0 : 1;
22076              };
22077            }();
22078            const Fa = function() {
22079              const t = new Pi(0, 0, 0);
22080              const e = new Fi;
22081              return function(i, s) {
22082                Pi.subtract(t, s, i.center);
22083                Pi.transformMat3(t, t, Fi.transpose(e, i.orientation));
22084                return n = t, r = i.halfExtents, Math.abs(n.x) < r.x && Math.abs(n.y) < r.y && Math.abs(n.z) < r.z;
22085                var n, r;
22086              };
22087            }();
22088            const Va = function() {
22089              const t = function(t, e, i, s) {
22090                return Math.abs(t.x * e + t.y * i + t.z * s);
22091              };
22092              return function(e, i) {
22093                const s = e.halfExtents.x * t(i.n, e.orientation.m00, e.orientation.m01, e.orientation.m02) + e.halfExtents.y * t(i.n, e.orientation.m03, e.orientation.m04, e.orientation.m05) + e.halfExtents.z * t(i.n, e.orientation.m06, e.orientation.m07, e.orientation.m08);
22094                const n = Pi.dot(i.n, e.center);
22095                return n + s < i.d ? -1 : n - s > i.d ? 0 : 1;
22096              };
22097            }();
22098            const ka = function(t, e) {
22099              for (let i = 0; i < e.planes.length; i++) if (-1 === Va(t, e.planes[i])) return 0;
22100              return 1;
22101            };
22102            const Ua = function() {
22103              const t = new Array(8);
22104              let e = 0;
22105              let i = 0;
22106              let s = 0;
22107              for (let e = 0; e < t.length; e++) t[e] = new Pi(0, 0, 0);
22108              const n = function(t, e, i, s) {
22109                return t.x * e + t.y * i + t.z * s;
22110              };
22111              return function(r, o) {
22112                let a = 0;
22113                let l = !1;
22114                for (let t = 0; t < o.planes.length; t++) {
22115                  a = Va(r, o.planes[t]);
22116                  if (-1 === a) return 0;
22117                  1 === a && (l = !0);
22118                }
22119                if (!l) return 1;
22120                for (let e = 0; e < o.vertices.length; e++) Pi.subtract(t[e], o.vertices[e], r.center);
22121                i = 0, s = 0;
22122                for (let a = 0; a < o.vertices.length; a++) {
22123                  e = n(t[a], r.orientation.m00, r.orientation.m01, r.orientation.m02);
22124                  e > r.halfExtents.x ? i++ : e < -r.halfExtents.x && s++;
22125                }
22126                if (i === o.vertices.length || s === o.vertices.length) return 0;
22127                i = 0;
22128                s = 0;
22129                for (let a = 0; a < o.vertices.length; a++) {
22130                  e = n(t[a], r.orientation.m03, r.orientation.m04, r.orientation.m05);
22131                  e > r.halfExtents.y ? i++ : e < -r.halfExtents.y && s++;
22132                }
22133                if (i === o.vertices.length || s === o.vertices.length) return 0;
22134                i = 0;
22135                s = 0;
22136                for (let a = 0; a < o.vertices.length; a++) {
22137                  e = n(t[a], r.orientation.m06, r.orientation.m07, r.orientation.m08);
22138                  e > r.halfExtents.z ? i++ : e < -r.halfExtents.z && s++;
22139                }
22140                return i === o.vertices.length || s === o.vertices.length ? 0 : 1;
22141              };
22142            }();
22143            const Ga = function() {
22144              const t = new Array(15);
22145              for (let e = 0; e < 15; e++) t[e] = new Pi(0, 0, 0);
22146              const e = new Array(8);
22147              const i = new Array(8);
22148              for (let t = 0; t < 8; t++) {
22149                e[t] = new Pi(0, 0, 0);
22150                i[t] = new Pi(0, 0, 0);
22151              }
22152              return function(s, n) {
22153                Pi.set(t[0], s.orientation.m00, s.orientation.m01, s.orientation.m02);
22154                Pi.set(t[1], s.orientation.m03, s.orientation.m04, s.orientation.m05);
22155                Pi.set(t[2], s.orientation.m06, s.orientation.m07, s.orientation.m08);
22156                Pi.set(t[3], n.orientation.m00, n.orientation.m01, n.orientation.m02);
22157                Pi.set(t[4], n.orientation.m03, n.orientation.m04, n.orientation.m05);
22158                Pi.set(t[5], n.orientation.m06, n.orientation.m07, n.orientation.m08);
22159                for (let e = 0; e < 3; ++e) {
22160                  Pi.cross(t[6 + 3 * e + 0], t[e], t[3]);
22161                  Pi.cross(t[6 + 3 * e + 1], t[e], t[4]);
22162                  Pi.cross(t[6 + 3 * e + 2], t[e], t[5]);
22163                }
22164                Ba(s.center, s.halfExtents, t[0], t[1], t[2], e);
22165                Ba(n.center, n.halfExtents, t[3], t[4], t[5], i);
22166                for (let s = 0; s < 15; ++s) {
22167                  const n = Da(e, t[s]);
22168                  const r = Da(i, t[s]);
22169                  if (r[0] > n[1] || n[0] > r[1]) return 0;
22170                }
22171                return 1;
22172              };
22173            }();
22174            const za = function() {
22175              const t = new ua;
22176              const e = new Pi;
22177              const i = new Pi;
22178              const s = new Pi;
22179              const n = new Array(8);
22180              for (let t = 0; t < 8; t++) n[t] = new Pi;
22181              const r = new Array(8);
22182              for (let t = 0; t < 8; t++) r[t] = new Pi;
22183              return function(o, a) {
22184                if (0 === Pi.squaredDistance(a.ellipseCenter0, a.ellipseCenter1)) {
22185                  t.radius = a.radius;
22186                  t.center.set(a.ellipseCenter0);
22187                  return Za.sphereOBB(t, o);
22188                }
22189                {
22190                  e.x = o.orientation.m00;
22191                  e.y = o.orientation.m01;
22192                  e.z = o.orientation.m02;
22193                  i.x = o.orientation.m03;
22194                  i.y = o.orientation.m04;
22195                  i.z = o.orientation.m05;
22196                  s.x = o.orientation.m06;
22197                  s.y = o.orientation.m07;
22198                  s.z = o.orientation.m08;
22199                  Ba(o.center, o.halfExtents, e, i, s, n);
22200                  const t = r;
22201                  const l = Pi.copy(t[0], e);
22202                  const h = Pi.copy(t[1], i);
22203                  const c = Pi.copy(t[2], s);
22204                  Pi.subtract(t[3], a.center, o.center).normalize();
22205                  const u = Pi.subtract(t[4], a.ellipseCenter0, a.ellipseCenter1);
22206                  u.normalize();
22207                  Pi.cross(t[5], l, u);
22208                  Pi.cross(t[6], h, u);
22209                  Pi.cross(t[7], c, u);
22210                  for (let e = 0; e < 8; ++e) {
22211                    const i = Da(n, t[e]);
22212                    const s = Pi.dot(t[e], a.ellipseCenter0);
22213                    const r = Pi.dot(t[e], a.ellipseCenter1);
22214                    const o = Math.max(s, r);
22215                    const l = Math.min(s, r) - a.radius;
22216                    const h = o + a.radius;
22217                    if (l > i[1] || i[0] > h) return 0;
22218                  }
22219                  return 1;
22220                }
22221              };
22222            }();
22223            const Ha = function(t, e) {
22224              const i = Pi.dot(e.n, t.center);
22225              const s = t.radius * e.n.length();
22226              return i + s < e.d ? -1 : i - s > e.d ? 0 : 1;
22227            };
22228            const ja = function(t, e) {
22229              for (let i = 0; i < e.planes.length; i++) if (-1 === Ha(t, e.planes[i])) return 0;
22230              return 1;
22231            };
22232            const Xa = function() {
22233              const t = new Pi(0, 0, 0);
22234              const e = [ 1, -1, 1, -1, 1, -1 ];
22235              return function(i, s) {
22236                for (let n = 0; n < 6; n++) {
22237                  const r = s.planes[n];
22238                  const o = i.radius;
22239                  const a = i.center;
22240                  const l = r.n;
22241                  const h = r.d;
22242                  const c = Pi.dot(l, a);
22243                  if (c + o < h) return 0;
22244                  if (!(c - o > h)) {
22245                    Pi.add(t, a, Pi.multiplyScalar(t, l, o));
22246                    for (let i = 0; i < 6; i++) {
22247                      if (i === n || i === n + e[n]) continue;
22248                      const r = s.planes[i];
22249                      if (Pi.dot(r.n, t) < r.d) return 0;
22250                    }
22251                  }
22252                }
22253                return 1;
22254              };
22255            }();
22256            const Wa = function(t, e) {
22257              const i = t.radius + e.radius;
22258              return Pi.squaredDistance(t.center, e.center) < i * i;
22259            };
22260            const Ya = function() {
22261              const t = new Pi;
22262              return function(e, i) {
22263                ta(t, e.center, i);
22264                return Pi.squaredDistance(e.center, t) < e.radius * e.radius;
22265              };
22266            }();
22267            const qa = function() {
22268              const t = new Pi;
22269              return function(e, i) {
22270                ea(t, e.center, i);
22271                return Pi.squaredDistance(e.center, t) < e.radius * e.radius;
22272              };
22273            }();
22274            const Ka = function() {
22275              const t = new Pi;
22276              const e = new Pi;
22277              return function(i, s) {
22278                const n = i.radius + s.radius;
22279                const r = n * n;
22280                const o = Pi.squaredDistance(s.ellipseCenter0, s.ellipseCenter1);
22281                if (0 === o) return Pi.squaredDistance(i.center, s.center) < r;
22282                {
22283                  Pi.subtract(t, i.center, s.ellipseCenter0);
22284                  Pi.subtract(e, s.ellipseCenter1, s.ellipseCenter0);
22285                  const n = Pi.dot(t, e) / o;
22286                  if (n < 0) return Pi.squaredDistance(i.center, s.ellipseCenter0) < r;
22287                  if (n > 1) return Pi.squaredDistance(i.center, s.ellipseCenter1) < r;
22288                  Pi.scaleAndAdd(t, s.ellipseCenter0, e, n);
22289                  return Pi.squaredDistance(i.center, t) < r;
22290                }
22291              };
22292            }();
22293            const Ja = function() {
22294              const t = new Pi;
22295              const e = new Pi;
22296              const i = new Pi;
22297              const s = new Pi;
22298              const n = new Pi;
22299              const r = new Pi;
22300              return function(o, a) {
22301                const l = Pi.subtract(t, o.ellipseCenter1, o.ellipseCenter0);
22302                const h = Pi.subtract(e, a.ellipseCenter1, a.ellipseCenter0);
22303                const c = Pi.subtract(i, o.ellipseCenter0, a.ellipseCenter0);
22304                const u = Pi.dot(l, l);
22305                const _ = Pi.dot(l, h);
22306                const d = Pi.dot(h, h);
22307                const p = Pi.dot(l, c);
22308                const m = Pi.dot(h, c);
22309                const f = u * d - _ * _;
22310                let g;
22311                let y = f;
22312                let b;
22313                let S = f;
22314                if (f < hi) {
22315                  g = 0;
22316                  y = 1;
22317                  b = m;
22318                  S = d;
22319                } else {
22320                  g = _ * m - d * p;
22321                  b = u * m - _ * p;
22322                  if (g < 0) {
22323                    g = 0;
22324                    b = m;
22325                    S = d;
22326                  } else if (g > y) {
22327                    g = y;
22328                    b = m + _;
22329                    S = d;
22330                  }
22331                }
22332                if (b < 0) {
22333                  b = 0;
22334                  if (-p < 0) g = 0; else if (-p > u) g = y; else {
22335                    g = -p;
22336                    y = u;
22337                  }
22338                } else if (b > S) {
22339                  b = S;
22340                  if (-p + _ < 0) g = 0; else if (-p + _ > u) g = y; else {
22341                    g = -p + _;
22342                    y = u;
22343                  }
22344                }
22345                const A = Math.abs(g) < hi ? 0 : g / y;
22346                const T = Math.abs(b) < hi ? 0 : b / S;
22347                const v = s;
22348                v.set(c);
22349                v.add(Pi.multiplyScalar(n, l, A));
22350                v.subtract(Pi.multiplyScalar(r, h, T));
22351                const E = o.radius + a.radius;
22352                return v.lengthSqr() < E * E;
22353              };
22354            }();
22355            const Za = {
22356              raySphere: fa,
22357              rayAABB: ga,
22358              rayOBB: ba,
22359              rayPlane: pa,
22360              rayTriangle: ma,
22361              rayCapsule: Sa,
22362              raySubMesh: Aa,
22363              rayMesh: Ta,
22364              rayModel: va,
22365              lineSphere: Ia,
22366              lineAABB: wa,
22367              lineOBB: Ra,
22368              linePlane: Ea,
22369              lineTriangle: Ca,
22370              sphereWithSphere: Wa,
22371              sphereAABB: Ya,
22372              sphereOBB: qa,
22373              spherePlane: Ha,
22374              sphereFrustum: ja,
22375              sphereFrustumAccurate: Xa,
22376              sphereCapsule: Ka,
22377              aabbWithAABB: Ma,
22378              aabbWithOBB: Pa,
22379              aabbPlane: Oa,
22380              aabbFrustum: Na,
22381              aabbFrustumAccurate: La,
22382              obbWithOBB: Ga,
22383              obbPlane: Va,
22384              obbFrustum: ka,
22385              obbFrustumAccurate: Ua,
22386              obbPoint: Fa,
22387              obbCapsule: za,
22388              aabbFrustumCompletelyInside: function(t, e) {
22389                for (let i = 0; i < e.planes.length; i++) if (0 !== Oa(t, e.planes[i])) return 0;
22390                return 1;
22391              },
22392              capsuleWithCapsule: Ja,
22393              resolve(t, e, i = null) {
22394                const s = t._type;
22395                const n = e._type;
22396                const r = this[s | n];
22397                return s < n ? r(t, e, i) : r(e, t, i);
22398              }
22399            };
22400            Za[sa.SHAPE_RAY | sa.SHAPE_SPHERE] = fa;
22401            Za[sa.SHAPE_RAY | sa.SHAPE_AABB] = ga;
22402            Za[sa.SHAPE_RAY | sa.SHAPE_OBB] = ba;
22403            Za[sa.SHAPE_RAY | sa.SHAPE_PLANE] = pa;
22404            Za[sa.SHAPE_RAY | sa.SHAPE_TRIANGLE] = ma;
22405            Za[sa.SHAPE_RAY | sa.SHAPE_CAPSULE] = Sa;
22406            Za[sa.SHAPE_LINE | sa.SHAPE_SPHERE] = Ia;
22407            Za[sa.SHAPE_LINE | sa.SHAPE_AABB] = wa;
22408            Za[sa.SHAPE_LINE | sa.SHAPE_OBB] = Ra;
22409            Za[sa.SHAPE_LINE | sa.SHAPE_PLANE] = Ea;
22410            Za[sa.SHAPE_LINE | sa.SHAPE_TRIANGLE] = Ca;
22411            Za[sa.SHAPE_SPHERE] = Wa;
22412            Za[sa.SHAPE_SPHERE | sa.SHAPE_AABB] = Ya;
22413            Za[sa.SHAPE_SPHERE | sa.SHAPE_OBB] = qa;
22414            Za[sa.SHAPE_SPHERE | sa.SHAPE_PLANE] = Ha;
22415            Za[sa.SHAPE_SPHERE | sa.SHAPE_FRUSTUM] = ja;
22416            Za[sa.SHAPE_SPHERE | sa.SHAPE_FRUSTUM_ACCURATE] = Xa;
22417            Za[sa.SHAPE_SPHERE | sa.SHAPE_CAPSULE] = Ka;
22418            Za[sa.SHAPE_AABB] = Ma;
22419            Za[sa.SHAPE_AABB | sa.SHAPE_OBB] = Pa;
22420            Za[sa.SHAPE_AABB | sa.SHAPE_PLANE] = Oa;
22421            Za[sa.SHAPE_AABB | sa.SHAPE_FRUSTUM] = Na;
22422            Za[sa.SHAPE_AABB | sa.SHAPE_FRUSTUM_ACCURATE] = La;
22423            Za[sa.SHAPE_OBB] = Ga;
22424            Za[sa.SHAPE_OBB | sa.SHAPE_PLANE] = Va;
22425            Za[sa.SHAPE_OBB | sa.SHAPE_FRUSTUM] = ka;
22426            Za[sa.SHAPE_OBB | sa.SHAPE_FRUSTUM_ACCURATE] = Ua;
22427            Za[sa.SHAPE_OBB | sa.SHAPE_CAPSULE] = za;
22428            Za[sa.SHAPE_CAPSULE] = Ja;
22429            W(na.prototype, "line", [ {
22430              name: "mag",
22431              newName: "len"
22432            }, {
22433              name: "magnitude",
22434              newName: "len"
22435            } ]);
22436            Y(Za, "intersect", [ {
22437              name: "line_quad"
22438            } ]);
22439            const Qa = new Pi(0, 0, 0);
22440            const $a = new Pi(0, 0, 0);
22441            const tl = m.mat4();
22442            const el = m.v4();
22443            class il {
22444              static create(t, e, i, s) {
22445                return new il(t, e, i, s);
22446              }
22447              static clone(t) {
22448                return new il(t.n.x, t.n.y, t.n.z, t.d);
22449              }
22450              static copy(t, e) {
22451                Pi.copy(t.n, e.n);
22452                t.d = e.d;
22453                return t;
22454              }
22455              static fromPoints(t, e, i, s) {
22456                Pi.subtract(Qa, i, e);
22457                Pi.subtract($a, s, e);
22458                Pi.normalize(t.n, Pi.cross(t.n, Qa, $a));
22459                t.d = Pi.dot(t.n, e);
22460                return t;
22461              }
22462              static set(t, e, i, s, n) {
22463                t.n.x = e;
22464                t.n.y = i;
22465                t.n.z = s;
22466                t.d = n;
22467                return t;
22468              }
22469              static fromNormalAndPoint(t, e, i) {
22470                Pi.copy(t.n, e);
22471                t.d = Pi.dot(e, i);
22472                return t;
22473              }
22474              static normalize(t, e) {
22475                const i = e.n.length();
22476                Pi.normalize(t.n, e.n);
22477                i > 0 && (t.d = e.d / i);
22478                return t;
22479              }
22480              get type() {
22481                return this._type;
22482              }
22483              set x(t) {
22484                this.n.x = t;
22485              }
22486              get x() {
22487                return this.n.x;
22488              }
22489              set y(t) {
22490                this.n.y = t;
22491              }
22492              get y() {
22493                return this.n.y;
22494              }
22495              set z(t) {
22496                this.n.z = t;
22497              }
22498              get z() {
22499                return this.n.z;
22500              }
22501              set w(t) {
22502                this.d = t;
22503              }
22504              get w() {
22505                return this.d;
22506              }
22507              constructor(t = 0, e = 1, i = 0, s = 0) {
22508                this.n = void 0;
22509                this.d = void 0;
22510                this._type = void 0;
22511                this._type = sa.SHAPE_PLANE;
22512                this.n = new Pi(t, e, i);
22513                this.d = s;
22514              }
22515              transform(t) {
22516                qi.invert(tl, t);
22517                qi.transpose(tl, tl);
22518                is.set(el, this.n.x, this.n.y, this.n.z, this.d);
22519                is.transformMat4(el, el, tl);
22520                Pi.set(this.n, el.x, el.y, el.z);
22521                this.d = el.w;
22522              }
22523            }
22524            const sl = new Pi;
22525            const nl = new Pi;
22526            const rl = new Pi;
22527            const ol = new Pi;
22528            const al = new Fi;
22529            const ll = (t, e, i) => {
22530              al.m00 = Math.abs(i.m00);
22531              al.m01 = Math.abs(i.m01);
22532              al.m02 = Math.abs(i.m02);
22533              al.m03 = Math.abs(i.m04);
22534              al.m04 = Math.abs(i.m05);
22535              al.m05 = Math.abs(i.m06);
22536              al.m06 = Math.abs(i.m08);
22537              al.m07 = Math.abs(i.m09);
22538              al.m08 = Math.abs(i.m10);
22539              Pi.transformMat3(t, e, al);
22540            };
22541            class hl {
22542              static create(t, e, i, s, n, r) {
22543                return new hl(t, e, i, s, n, r);
22544              }
22545              static clone(t) {
22546                return new hl(t.center.x, t.center.y, t.center.z, t.halfExtents.x, t.halfExtents.y, t.halfExtents.z);
22547              }
22548              static copy(t, e) {
22549                Pi.copy(t.center, e.center);
22550                Pi.copy(t.halfExtents, e.halfExtents);
22551                return t;
22552              }
22553              static fromPoints(t, e, i) {
22554                Pi.add(sl, i, e);
22555                Pi.subtract(nl, i, e);
22556                Pi.multiplyScalar(t.center, sl, .5);
22557                Pi.multiplyScalar(t.halfExtents, nl, .5);
22558                return t;
22559              }
22560              static set(t, e, i, s, n, r, o) {
22561                t.center.set(e, i, s);
22562                t.halfExtents.set(n, r, o);
22563                return t;
22564              }
22565              static merge(t, e, i) {
22566                Pi.subtract(sl, e.center, e.halfExtents);
22567                Pi.subtract(nl, i.center, i.halfExtents);
22568                Pi.add(rl, e.center, e.halfExtents);
22569                Pi.add(ol, i.center, i.halfExtents);
22570                Pi.max(ol, rl, ol);
22571                Pi.min(rl, sl, nl);
22572                return hl.fromPoints(t, rl, ol);
22573              }
22574              static toBoundingSphere(t, e) {
22575                t.center.set(e.center);
22576                t.radius = e.halfExtents.length();
22577                return t;
22578              }
22579              static transform(t, e, i) {
22580                Pi.transformMat4(t.center, e.center, i);
22581                ll(t.halfExtents, e.halfExtents, i);
22582                return t;
22583              }
22584              get type() {
22585                return this._type;
22586              }
22587              constructor(t = 0, e = 0, i = 0, s = 1, n = 1, r = 1) {
22588                this.center = void 0;
22589                this.halfExtents = void 0;
22590                this._type = void 0;
22591                this._type = sa.SHAPE_AABB;
22592                this.center = new Pi(t, e, i);
22593                this.halfExtents = new Pi(s, n, r);
22594              }
22595              getBoundary(t, e) {
22596                Pi.subtract(t, this.center, this.halfExtents);
22597                Pi.add(e, this.center, this.halfExtents);
22598              }
22599              transform(t, e, i, s, n) {
22600                Pi.transformMat4(n.center, this.center, t);
22601                ll(n.halfExtents, this.halfExtents, t);
22602              }
22603              clone() {
22604                return hl.clone(this);
22605              }
22606              copy(t) {
22607                return hl.copy(this, t);
22608              }
22609              mergePoint(t) {
22610                this.getBoundary(sl, nl);
22611                t.x < sl.x && (sl.x = t.x);
22612                t.y < sl.y && (sl.y = t.y);
22613                t.z < sl.z && (sl.z = t.z);
22614                t.x > nl.x && (nl.x = t.x);
22615                t.y > nl.y && (nl.y = t.y);
22616                t.z > nl.z && (nl.z = t.z);
22617                Pi.add(rl, sl, nl);
22618                this.center.set(Pi.multiplyScalar(rl, rl, .5));
22619                this.halfExtents.set(nl.x - rl.x, nl.y - rl.y, nl.z - rl.z);
22620              }
22621              mergePoints(t) {
22622                if (!(t.length < 1)) for (let e = 0; e < t.length; e++) this.mergePoint(t[e]);
22623              }
22624              mergeFrustum(t) {
22625                return this.mergePoints(t.vertices);
22626              }
22627            }
22628            const cl = new Pi;
22629            const ul = new Pi;
22630            const _l = new Fi;
22631            class dl {
22632              static create(t, e, i, s, n, r, o, a, l, h, c, u, _, d, p) {
22633                return new dl(t, e, i, s, n, r, o, a, l, h, c, u, _, d, p);
22634              }
22635              static clone(t) {
22636                return new dl(t.center.x, t.center.y, t.center.z, t.halfExtents.x, t.halfExtents.y, t.halfExtents.z, t.orientation.m00, t.orientation.m01, t.orientation.m02, t.orientation.m03, t.orientation.m04, t.orientation.m05, t.orientation.m06, t.orientation.m07, t.orientation.m08);
22637              }
22638              static copy(t, e) {
22639                Pi.copy(t.center, e.center);
22640                Pi.copy(t.halfExtents, e.halfExtents);
22641                Fi.copy(t.orientation, e.orientation);
22642                return t;
22643              }
22644              static fromPoints(t, e, i) {
22645                Pi.multiplyScalar(t.center, Pi.add(cl, e, i), .5);
22646                Pi.multiplyScalar(t.halfExtents, Pi.subtract(ul, i, e), .5);
22647                Fi.identity(t.orientation);
22648                return t;
22649              }
22650              static set(t, e, i, s, n, r, o, a, l, h, c, u, _, d, p, m) {
22651                Pi.set(t.center, e, i, s);
22652                Pi.set(t.halfExtents, n, r, o);
22653                Fi.set(t.orientation, a, l, h, c, u, _, d, p, m);
22654                return t;
22655              }
22656              get type() {
22657                return this._type;
22658              }
22659              constructor(t = 0, e = 0, i = 0, s = 1, n = 1, r = 1, o = 1, a = 0, l = 0, h = 0, c = 1, u = 0, _ = 0, d = 0, p = 1) {
22660                this.center = void 0;
22661                this.halfExtents = void 0;
22662                this.orientation = void 0;
22663                this._type = void 0;
22664                this._type = sa.SHAPE_OBB;
22665                this.center = new Pi(t, e, i);
22666                this.halfExtents = new Pi(s, n, r);
22667                this.orientation = new Fi(o, a, l, h, c, u, _, d, p);
22668              }
22669              getBoundary(t, e) {
22670                ((t, e, i) => {
22671                  _l.m00 = Math.abs(i.m00);
22672                  _l.m01 = Math.abs(i.m01);
22673                  _l.m02 = Math.abs(i.m02);
22674                  _l.m03 = Math.abs(i.m03);
22675                  _l.m04 = Math.abs(i.m04);
22676                  _l.m05 = Math.abs(i.m05);
22677                  _l.m06 = Math.abs(i.m06);
22678                  _l.m07 = Math.abs(i.m07);
22679                  _l.m08 = Math.abs(i.m08);
22680                  Pi.transformMat3(t, e, _l);
22681                })(cl, this.halfExtents, this.orientation);
22682                Pi.subtract(t, this.center, cl);
22683                Pi.add(e, this.center, cl);
22684              }
22685              transform(t, e, i, s, n) {
22686                Pi.transformMat4(n.center, this.center, t);
22687                Fi.fromQuat(n.orientation, i);
22688                Pi.multiply(n.halfExtents, this.halfExtents, s);
22689              }
22690              translateAndRotate(t, e, i) {
22691                Pi.transformMat4(i.center, this.center, t);
22692                Fi.fromQuat(i.orientation, e);
22693              }
22694              setScale(t, e) {
22695                Pi.multiply(e.halfExtents, this.halfExtents, t);
22696              }
22697            }
22698            class pl {
22699              get type() {
22700                return this._type;
22701              }
22702              constructor(t = .5, e = .5, i = 1) {
22703                this._type = void 0;
22704                this.radius = void 0;
22705                this.halfHeight = void 0;
22706                this.axis = void 0;
22707                this.center = void 0;
22708                this.rotation = void 0;
22709                this.ellipseCenter0 = void 0;
22710                this.ellipseCenter1 = void 0;
22711                this._type = sa.SHAPE_CAPSULE;
22712                this.radius = t;
22713                this.halfHeight = e;
22714                this.axis = i;
22715                this.center = new Pi;
22716                this.rotation = new Ui;
22717                this.ellipseCenter0 = new Pi(0, e, 0);
22718                this.ellipseCenter1 = new Pi(0, -e, 0);
22719                this.updateCache();
22720              }
22721              transform(t, e, i, s, n) {
22722                const r = s;
22723                const o = wi(r);
22724                n.radius = this.radius * Math.abs(o);
22725                let a = (this.halfHeight + this.radius) * Math.abs(r.y) - n.radius;
22726                a < 0 && (a = 0);
22727                n.halfHeight = a;
22728                Pi.transformMat4(n.center, this.center, t);
22729                Ui.multiply(n.rotation, this.rotation, i);
22730                n.updateCache();
22731              }
22732              updateCache() {
22733                this.updateLocalCenter();
22734                Pi.transformQuat(this.ellipseCenter0, this.ellipseCenter0, this.rotation);
22735                Pi.transformQuat(this.ellipseCenter1, this.ellipseCenter1, this.rotation);
22736                this.ellipseCenter0.add(this.center);
22737                this.ellipseCenter1.add(this.center);
22738              }
22739              updateLocalCenter() {
22740                const t = this.halfHeight;
22741                switch (this.axis) {
22742                 case 0:
22743                  this.ellipseCenter0.set(t, 0, 0);
22744                  this.ellipseCenter1.set(-t, 0, 0);
22745                  break;
22746
22747                 case 1:
22748                  this.ellipseCenter0.set(0, t, 0);
22749                  this.ellipseCenter1.set(0, -t, 0);
22750                  break;
22751
22752                 case 2:
22753                  this.ellipseCenter0.set(0, 0, t);
22754                  this.ellipseCenter1.set(0, 0, -t);
22755                }
22756              }
22757            }
22758            const ml = new Array(8);
22759            ml[0] = new Pi(1, 1, 1);
22760            ml[1] = new Pi(-1, 1, 1);
22761            ml[2] = new Pi(-1, -1, 1);
22762            ml[3] = new Pi(1, -1, 1);
22763            ml[4] = new Pi(1, 1, -1);
22764            ml[5] = new Pi(-1, 1, -1);
22765            ml[6] = new Pi(-1, -1, -1);
22766            ml[7] = new Pi(1, -1, -1);
22767            const fl = new Pi;
22768            const gl = new Pi;
22769            const yl = new Pi;
22770            class bl {
22771              static createFromAABB(t, e) {
22772                const i = new Pi;
22773                const s = new Pi;
22774                Pi.subtract(i, e.center, e.halfExtents);
22775                Pi.add(s, e.center, e.halfExtents);
22776                t.vertices[0].set(i.x, s.y, i.z);
22777                t.vertices[1].set(s.x, s.y, i.z);
22778                t.vertices[2].set(s.x, i.y, i.z);
22779                t.vertices[3].set(i.x, i.y, i.z);
22780                t.vertices[4].set(i.x, s.y, s.z);
22781                t.vertices[5].set(s.x, s.y, s.z);
22782                t.vertices[6].set(s.x, i.y, s.z);
22783                t.vertices[7].set(i.x, i.y, s.z);
22784                if (t._type !== sa.SHAPE_FRUSTUM_ACCURATE) return t;
22785                t.updatePlanes();
22786                return t;
22787              }
22788              static split(t, e, i, s, n) {
22789                const r = Math.tan(.5 * e.fov);
22790                const o = r * e.aspect;
22791                fl.set(s * o, s * r, s);
22792                gl.set(n * o, n * r, n);
22793                const a = t.vertices;
22794                yl.set(fl.x, fl.y, fl.z);
22795                Pi.transformMat4(a[0], yl, i);
22796                yl.set(-fl.x, fl.y, fl.z);
22797                Pi.transformMat4(a[1], yl, i);
22798                yl.set(-fl.x, -fl.y, fl.z);
22799                Pi.transformMat4(a[2], yl, i);
22800                yl.set(fl.x, -fl.y, fl.z);
22801                Pi.transformMat4(a[3], yl, i);
22802                yl.set(gl.x, gl.y, gl.z);
22803                Pi.transformMat4(a[4], yl, i);
22804                yl.set(-gl.x, gl.y, gl.z);
22805                Pi.transformMat4(a[5], yl, i);
22806                yl.set(-gl.x, -gl.y, gl.z);
22807                Pi.transformMat4(a[6], yl, i);
22808                yl.set(gl.x, -gl.y, gl.z);
22809                Pi.transformMat4(a[7], yl, i);
22810                t.updatePlanes();
22811                return t;
22812              }
22813              static create() {
22814                return new bl;
22815              }
22816              static clone(t) {
22817                return bl.copy(new bl, t);
22818              }
22819              static copy(t, e) {
22820                t._type = e.type;
22821                for (let i = 0; i < 6; ++i) il.copy(t.planes[i], e.planes[i]);
22822                for (let i = 0; i < 8; ++i) Pi.copy(t.vertices[i], e.vertices[i]);
22823                return t;
22824              }
22825              set accurate(t) {
22826                this._type = t ? sa.SHAPE_FRUSTUM_ACCURATE : sa.SHAPE_FRUSTUM;
22827              }
22828              get type() {
22829                return this._type;
22830              }
22831              constructor() {
22832                this.planes = void 0;
22833                this.vertices = void 0;
22834                this._type = void 0;
22835                this._type = sa.SHAPE_FRUSTUM;
22836                this.planes = new Array(6);
22837                for (let t = 0; t < 6; ++t) this.planes[t] = il.create(0, 0, 0, 0);
22838                this.vertices = new Array(8);
22839                for (let t = 0; t < 8; ++t) this.vertices[t] = new Pi;
22840              }
22841              update(t, e) {
22842                Pi.set(this.planes[0].n, t.m03 + t.m00, t.m07 + t.m04, t.m11 + t.m08);
22843                this.planes[0].d = -(t.m15 + t.m12);
22844                Pi.set(this.planes[1].n, t.m03 - t.m00, t.m07 - t.m04, t.m11 - t.m08);
22845                this.planes[1].d = -(t.m15 - t.m12);
22846                Pi.set(this.planes[2].n, t.m03 + t.m01, t.m07 + t.m05, t.m11 + t.m09);
22847                this.planes[2].d = -(t.m15 + t.m13);
22848                Pi.set(this.planes[3].n, t.m03 - t.m01, t.m07 - t.m05, t.m11 - t.m09);
22849                this.planes[3].d = -(t.m15 - t.m13);
22850                Pi.set(this.planes[4].n, t.m03 + t.m02, t.m07 + t.m06, t.m11 + t.m10);
22851                this.planes[4].d = -(t.m15 + t.m14);
22852                Pi.set(this.planes[5].n, t.m03 - t.m02, t.m07 - t.m06, t.m11 - t.m10);
22853                this.planes[5].d = -(t.m15 - t.m14);
22854                if (this._type === sa.SHAPE_FRUSTUM_ACCURATE) {
22855                  for (let t = 0; t < 6; t++) {
22856                    const e = this.planes[t];
22857                    const i = 1 / e.n.length();
22858                    Pi.multiplyScalar(e.n, e.n, i);
22859                    e.d *= i;
22860                  }
22861                  for (let t = 0; t < 8; t++) Pi.transformMat4(this.vertices[t], ml[t], e);
22862                }
22863              }
22864              transform(t) {
22865                if (this._type === sa.SHAPE_FRUSTUM_ACCURATE) {
22866                  for (let e = 0; e < 8; e++) Pi.transformMat4(this.vertices[e], this.vertices[e], t);
22867                  this.updatePlanes();
22868                }
22869              }
22870              zero() {
22871                for (let t = 0; t < 8; t++) this.vertices[t].set(0, 0, 0);
22872                this.updatePlanes();
22873              }
22874              updatePlanes() {
22875                il.fromPoints(this.planes[0], this.vertices[1], this.vertices[6], this.vertices[5]);
22876                il.fromPoints(this.planes[1], this.vertices[3], this.vertices[4], this.vertices[7]);
22877                il.fromPoints(this.planes[2], this.vertices[6], this.vertices[3], this.vertices[7]);
22878                il.fromPoints(this.planes[3], this.vertices[0], this.vertices[5], this.vertices[4]);
22879                il.fromPoints(this.planes[4], this.vertices[2], this.vertices[0], this.vertices[3]);
22880                il.fromPoints(this.planes[5], this.vertices[7], this.vertices[5], this.vertices[6]);
22881              }
22882            }
22883            bl.createOrtho = (t, e, i, s, n, r) => {
22884              const o = e / 2;
22885              const a = i / 2;
22886              Pi.set(yl, o, a, -s);
22887              Pi.transformMat4(t.vertices[0], yl, r);
22888              Pi.set(yl, -o, a, -s);
22889              Pi.transformMat4(t.vertices[1], yl, r);
22890              Pi.set(yl, -o, -a, -s);
22891              Pi.transformMat4(t.vertices[2], yl, r);
22892              Pi.set(yl, o, -a, -s);
22893              Pi.transformMat4(t.vertices[3], yl, r);
22894              Pi.set(yl, o, a, -n);
22895              Pi.transformMat4(t.vertices[4], yl, r);
22896              Pi.set(yl, -o, a, -n);
22897              Pi.transformMat4(t.vertices[5], yl, r);
22898              Pi.set(yl, -o, -a, -n);
22899              Pi.transformMat4(t.vertices[6], yl, r);
22900              Pi.set(yl, o, -a, -n);
22901              Pi.transformMat4(t.vertices[7], yl, r);
22902              il.fromPoints(t.planes[0], t.vertices[1], t.vertices[6], t.vertices[5]);
22903              il.fromPoints(t.planes[1], t.vertices[3], t.vertices[4], t.vertices[7]);
22904              il.fromPoints(t.planes[2], t.vertices[6], t.vertices[3], t.vertices[7]);
22905              il.fromPoints(t.planes[3], t.vertices[0], t.vertices[5], t.vertices[4]);
22906              il.fromPoints(t.planes[4], t.vertices[2], t.vertices[0], t.vertices[3]);
22907              il.fromPoints(t.planes[5], t.vertices[7], t.vertices[5], t.vertices[6]);
22908            };
22909            let Sl;
22910            !function(t) {
22911              t[t.Default = 0] = "Default";
22912              t[t.Normal = 1] = "Normal";
22913              t[t.Loop = 2] = "Loop";
22914              t[t.ShouldWrap = 4] = "ShouldWrap";
22915              t[t.Clamp = 8] = "Clamp";
22916              t[t.PingPong = 22] = "PingPong";
22917              t[t.Reverse = 36] = "Reverse";
22918            }(Sl || (Sl = {}));
22919            let Al;
22920            !function(t) {
22921              t[t.Default = Sl.Default] = "Default";
22922              t[t.Normal = Sl.Normal] = "Normal";
22923              t[t.Reverse = Sl.Reverse] = "Reverse";
22924              t[t.Loop = Sl.Loop] = "Loop";
22925              t[t.LoopReverse = Sl.Loop | Sl.Reverse] = "LoopReverse";
22926              t[t.PingPong = Sl.PingPong] = "PingPong";
22927              t[t.PingPongReverse = Sl.PingPong | Sl.Reverse] = "PingPongReverse";
22928            }(Al || (Al = {}));
22929            he(Al);
22930            class Tl {
22931              constructor(t) {
22932                this.ratio = 0;
22933                this.time = 0;
22934                this.direction = 1;
22935                this.stopped = !0;
22936                this.iterations = 0;
22937                this.frameIndex = void 0;
22938                t && this.set(t);
22939              }
22940              set(t) {
22941                this.ratio = t.ratio;
22942                this.time = t.time;
22943                this.direction = t.direction;
22944                this.stopped = t.stopped;
22945                this.iterations = t.iterations;
22946                this.frameIndex = t.frameIndex;
22947              }
22948            }
22949            function vl(t, e, i = 1e-6) {
22950              let s = 0;
22951              let n = t.length - 1;
22952              let r = n >>> 1;
22953              for (;s <= n; r = s + n >>> 1) {
22954                const o = t[r];
22955                if (o > e + i) n = r - 1; else {
22956                  if (!(o < e - i)) return r;
22957                  s = r + 1;
22958                }
22959              }
22960              return ~s;
22961            }
22962            let El;
22963            El = Symbol.iterator;
22964            class Cl {
22965              constructor() {
22966                this._times = [];
22967                this._values = [];
22968              }
22969              get keyFramesCount() {
22970                return this._times.length;
22971              }
22972              get rangeMin() {
22973                return this._times[0];
22974              }
22975              get rangeMax() {
22976                return this._times[this._values.length - 1];
22977              }
22978              [El]() {
22979                let t = 0;
22980                return {
22981                  next: () => {
22982                    if (t >= this._times.length) return {
22983                      done: !0,
22984                      value: void 0
22985                    };
22986                    {
22987                      const e = [ this._times[t], this._values[t] ];
22988                      ++t;
22989                      return {
22990                        done: !1,
22991                        value: e
22992                      };
22993                    }
22994                  }
22995                };
22996              }
22997              keyframes() {
22998                return this;
22999              }
23000              times() {
23001                return this._times;
23002              }
23003              values() {
23004                return this._values;
23005              }
23006              getKeyframeTime(t) {
23007                return this._times[t];
23008              }
23009              getKeyframeValue(t) {
23010                return this._values[t];
23011              }
23012              addKeyFrame(t, e) {
23013                return this._insertNewKeyframe(t, e);
23014              }
23015              removeKeyframe(t) {
23016                this._times.splice(t, 1);
23017                this._values.splice(t, 1);
23018              }
23019              indexOfKeyframe(t) {
23020                return vl(this._times, t);
23021              }
23022              updateTime(t, e) {
23023                const i = this._values[t];
23024                this.removeKeyframe(t);
23025                this._insertNewKeyframe(e, i);
23026              }
23027              assignSorted(t, e) {
23028                if (void 0 !== e) {
23029                  ne(Array.isArray(t));
23030                  this.setKeyframes(t.slice(), e.slice());
23031                } else {
23032                  const e = Array.from(t);
23033                  this.setKeyframes(e.map((([t]) => t)), e.map((([, t]) => t)));
23034                }
23035              }
23036              clear() {
23037                this._times.length = 0;
23038                this._values.length = 0;
23039              }
23040              searchKeyframe(t) {
23041                return vl(this._times, t);
23042              }
23043              setKeyframes(t, e) {
23044                ne(t.length === e.length);
23045                ne(function(t) {
23046                  return t.every(((t, e, i) => 0 === e || t > i[e - 1] || ui(t, i[e - 1], 1e-6)));
23047                }(t));
23048                this._times = t;
23049                this._values = e;
23050              }
23051              _insertNewKeyframe(t, e) {
23052                const i = this._times;
23053                const s = this._values;
23054                const n = i.length;
23055                const r = vl(i, t);
23056                if (r >= 0) return r;
23057                const o = ~r;
23058                if (0 === o) {
23059                  i.unshift(t);
23060                  s.unshift(e);
23061                } else if (o === n) {
23062                  i.push(t);
23063                  s.push(e);
23064                } else {
23065                  ne(n > 1);
23066                  i.splice(o - 1, 0, t);
23067                  s.splice(o - 1, 0, e);
23068                }
23069                return o;
23070              }
23071            }
23072            si.fastDefine("cc.KeyframeCurve", Cl, {
23073              _times: [],
23074              _values: []
23075            });
23076            let xl;
23077            !function(t) {
23078              t[t.LINEAR = 0] = "LINEAR";
23079              t[t.CONSTANT = 1] = "CONSTANT";
23080              t[t.CUBIC = 2] = "CUBIC";
23081            }(xl || (xl = t("RealInterpolationMode", {})));
23082            let wl;
23083            !function(t) {
23084              t[t.LINEAR = 0] = "LINEAR";
23085              t[t.CLAMP = 1] = "CLAMP";
23086              t[t.LOOP = 2] = "LOOP";
23087              t[t.PING_PONG = 3] = "PING_PONG";
23088            }(wl || (wl = t("ExtrapolationMode", {})));
23089            let Rl;
23090            !function(t) {
23091              t[t.NONE = 0] = "NONE";
23092              t[t.LEFT = 1] = "LEFT";
23093              t[t.RIGHT = 2] = "RIGHT";
23094              t[t.BOTH = 3] = "BOTH";
23095            }(Rl || (Rl = t("TangentWeightMode", {})));
23096            function Il(t) {
23097              return t > -1e-9 && t < 1e-9;
23098            }
23099            function Ml(t, e, i, s) {
23100              i && Object.defineProperty(t, e, {
23101                enumerable: i.enumerable,
23102                configurable: i.configurable,
23103                writable: i.writable,
23104                value: i.initializer ? i.initializer.call(s) : void 0
23105              });
23106            }
23107            function Bl(t, e, i, s, n) {
23108              var r = {};
23109              Object.keys(s).forEach((function(t) {
23110                r[t] = s[t];
23111              }));
23112              r.enumerable = !!r.enumerable;
23113              r.configurable = !!r.configurable;
23114              ("value" in r || r.initializer) && (r.writable = !0);
23115              r = i.slice().reverse().reduce((function(i, s) {
23116                return s(t, e, i) || i;
23117              }), r);
23118              if (n && void 0 !== r.initializer) {
23119                r.value = r.initializer ? r.initializer.call(n) : void 0;
23120                r.initializer = void 0;
23121              }
23122              if (void 0 === r.initializer) {
23123                Object.defineProperty(t, e, r);
23124                r = null;
23125              }
23126              return r;
23127            }
23128            const Dl = () => {};
23129            const Pl = () => Dl;
23130            const Ol = Nl((() => {}));
23131            function Nl(t) {
23132              return function(e) {
23133                return "function" == typeof e ? t(e) : function(i) {
23134                  return t(i, e);
23135                };
23136              };
23137            }
23138            function Ll(t) {
23139              return e => i => {
23140                !function(t, e, i) {
23141                  const s = Vl(t);
23142                  if (s) {
23143                    const t = kl(s, "proto");
23144                    kl(t, "editor")[e] = i;
23145                  }
23146                }(i, t, e);
23147              };
23148            }
23149            const Fl = "__ccclassCache__";
23150            function Vl(t, e) {
23151              return kl(t, Fl);
23152            }
23153            function kl(t, e) {
23154              return t[e] || (t[e] = {});
23155            }
23156            const Ul = Nl(((t, e) => {
23157              let i = ee.getSuper(t);
23158              i === Object && (i = null);
23159              const s = {
23160                name: e,
23161                extends: i,
23162                ctor: t
23163              };
23164              const n = t[Fl];
23165              if (n) {
23166                const e = n.proto;
23167                e && ee.mixin(s, e);
23168                t[Fl] = void 0;
23169              }
23170              return si(s);
23171            }));
23172            const Gl = Ll("requireComponent");
23173            const zl = Ll("executionOrder");
23174            const Hl = Ol;
23175            function jl(t, e, i) {
23176              let s = null;
23177              function n(t, e, i) {
23178                !function(t) {
23179                  Vl(t.constructor);
23180                }(t);
23181                const n = function(t, e) {
23182                  var i, s;
23183                  const n = kl(Vl(t.constructor), "proto");
23184                  const r = kl(n, "properties");
23185                  return null !== (s = r[i = e]) && void 0 !== s ? s : r[i] = {};
23186                }(t, e);
23187                t.constructor;
23188                !function(t, e, i, s, n, r) {
23189                  let o;
23190                  const a = r && (r.get || r.set);
23191                  n && (o = je(n, a));
23192                  const l = ee.mixin(e, o || n || {});
23193                  if (a) {
23194                    r.get && (l.get = r.get);
23195                    r.set && (l.set = r.set);
23196                  }
23197                }(0, n, 0, 0, s, i);
23198              }
23199              if (void 0 === t) return jl({
23200                type: void 0
23201              });
23202              if (void 0 === e) {
23203                s = t;
23204                return n;
23205              }
23206              n(t, e, i);
23207            }
23208            function Xl(t, e, i) {
23209              var s, n;
23210              const r = Vl(t.constructor);
23211              const o = kl(r, "proto");
23212              const a = kl(o, "properties");
23213              const l = null !== (n = a[s = e]) && void 0 !== n ? n : a[s] = {};
23214              l.__internalFlags |= Ye.STANDALONE;
23215              if (i && (i.get || i.set)) {
23216                i.get && (l.get = i.get);
23217                i.set && (l.set = i.set);
23218              } else t.constructor;
23219              return l;
23220            }
23221            const Wl = Symbol("cc:SerializationMetadata");
23222            const Yl = (t, e, i) => {
23223              Jl(Xl(t, e, i));
23224            };
23225            function ql(t) {
23226              return (e, i, s) => {
23227                const n = Xl(e, i, s);
23228                n.formerlySerializedAs = t;
23229                Jl(n);
23230              };
23231            }
23232            const Kl = (t, e, i) => {
23233              const s = Xl(t, e, i);
23234              s.editorOnly = !0;
23235              Jl(s);
23236            };
23237            function Jl(t) {
23238              t.__internalFlags |= Ye.IMPLICIT_SERIALIZABLE;
23239            }
23240            const Zl = Dl;
23241            const Ql = Ol;
23242            const $l = Pl;
23243            const th = Ol;
23244            const eh = Pl;
23245            const ih = Pl;
23246            const sh = Pl;
23247            const nh = Dl;
23248            const rh = Pl;
23249            const oh = Dl;
23250            const ah = Pl;
23251            const lh = Pl;
23252            const hh = Pl;
23253            const ch = Pl;
23254            const uh = Pl;
23255            const _h = Pl;
23256            const dh = Dl;
23257            const ph = Pl;
23258            const mh = Dl;
23259            const fh = Dl;
23260            const gh = Dl;
23261            const yh = Th(Oe);
23262            const bh = Th(Ne);
23263            const Sh = Th(Le);
23264            const Ah = Th(Fe);
23265            function Th(t) {
23266              return jl({
23267                type: t
23268              });
23269            }
23270            const vh = (t, e, i) => {
23271              Xl(t, e, i).override = !0;
23272            };
23273            class Eh {}
23274            const Ch = null != xh ? xh : Eh;
23275            var xh;
23276            ne("__editorExtras__" === io, "editorExtrasTag needs to be updated.");
23277            var wh = Object.freeze({
23278              __proto__: null,
23279              uniquelyReferenced: Zl,
23280              ccclass: Ul,
23281              property: jl,
23282              requireComponent: Gl,
23283              executionOrder: zl,
23284              disallowMultiple: Hl,
23285              allowReplicated: t => {
23286                si.Attr.setClassAttr(t, "replicated", "visible", !0);
23287              },
23288              executeInEditMode: Ql,
23289              menu: $l,
23290              playOnFocus: th,
23291              inspector: eh,
23292              icon: ih,
23293              help: sh,
23294              type: Th,
23295              integer: yh,
23296              float: bh,
23297              boolean: Sh,
23298              string: Ah
23299            });
23300            t("_decorator", wh);
23301            class Rh {
23302              constructor(t) {
23303                this._map = null;
23304                this._count = 0;
23305                if (t) {
23306                  this._map = t;
23307                  this._count = Object.keys(t).length;
23308                } else {
23309                  this._map = ee.createMap(!0);
23310                  this._count = 0;
23311                }
23312              }
23313              add(t, e) {
23314                t in this._map || this._count++;
23315                return this._map[t] = e;
23316              }
23317              get(t) {
23318                return this._map[t];
23319              }
23320              has(t) {
23321                return t in this._map;
23322              }
23323              remove(t) {
23324                const e = this._map[t];
23325                if (t in this._map) {
23326                  delete this._map[t];
23327                  this._count--;
23328                }
23329                return e;
23330              }
23331              clear() {
23332                if (0 !== this._count) {
23333                  this._map = ee.createMap(!0);
23334                  this._count = 0;
23335                }
23336              }
23337              forEach(t) {
23338                for (const e in this._map) t(this._map[e], e);
23339              }
23340              find(t) {
23341                for (const e in this._map) if (t(this._map[e], e)) return this._map[e];
23342                return null;
23343              }
23344              get count() {
23345                return this._count;
23346              }
23347              destroy() {
23348                this._map = null;
23349              }
23350            }
23351            class Ih {
23352              constructor(t, e) {
23353                this.id = Ih._pipelineId++;
23354                this.name = "";
23355                this.pipes = [];
23356                this.name = t;
23357                for (let t = 0, i = e.length; t < i; t++) this.pipes.push(e[t]);
23358              }
23359              insert(t, e) {
23360                if (e > this.pipes.length) {
23361                  N(4921);
23362                  return this;
23363                }
23364                this.pipes.splice(e, 0, t);
23365                return this;
23366              }
23367              append(t) {
23368                this.pipes.push(t);
23369                return this;
23370              }
23371              remove(t) {
23372                this.pipes.splice(t, 1);
23373                return this;
23374              }
23375              sync(t) {
23376                const e = this.pipes;
23377                if (0 === e.length) return null;
23378                t.isFinish = !1;
23379                for (let i = 0, s = e.length; i < s; ) {
23380                  const n = (0, e[i])(t);
23381                  if (n) {
23382                    t.isFinish = !0;
23383                    return n;
23384                  }
23385                  i++;
23386                  if (i !== s) {
23387                    t.input = t.output;
23388                    t.output = null;
23389                  }
23390                }
23391                t.isFinish = !0;
23392                return t.output;
23393              }
23394              async(t) {
23395                if (0 !== this.pipes.length) {
23396                  t.isFinish = !1;
23397                  this._flow(0, t);
23398                }
23399              }
23400              _flow(t, e) {
23401                (0, this.pipes[t])(e, (i => {
23402                  if (i) {
23403                    e.isFinish = !0;
23404                    e.dispatch("complete", i);
23405                  } else if (++t < this.pipes.length) {
23406                    e.input = e.output;
23407                    e.output = null;
23408                    this._flow(t, e);
23409                  } else {
23410                    e.isFinish = !0;
23411                    e.dispatch("complete", i, e.output);
23412                  }
23413                }));
23414              }
23415            }
23416            Ih._pipelineId = 0;
23417            const Mh = new Rh;
23418            const Bh = new Rh;
23419            const Dh = new Rh;
23420            const Ph = new Rh;
23421            const Oh = new Ih("normal load", []);
23422            const Nh = new Ih("fetch", []);
23423            const Lh = new Ih("transform url", []);
23424            const Fh = new Map;
23425            let Vh;
23426            !function(t) {
23427              t.UUID = "uuid";
23428              t.PATH = "path";
23429              t.DIR = "dir";
23430              t.URL = "url";
23431              t.SCENE = "scene";
23432            }(Vh || (Vh = {}));
23433            const kh = {
23434              default: {
23435                priority: 0
23436              },
23437              preload: {
23438                maxConcurrency: 6,
23439                maxRequestsPerFrame: 2,
23440                priority: -1
23441              },
23442              scene: {
23443                maxConcurrency: 20,
23444                maxRequestsPerFrame: 20,
23445                priority: 1
23446              },
23447              bundle: {
23448                maxConcurrency: 20,
23449                maxRequestsPerFrame: 20,
23450                priority: 2
23451              },
23452              remote: {
23453                maxRetryCount: 4
23454              }
23455            };
23456            let Uh;
23457            !function(t) {
23458              t.INTERNAL = "internal";
23459              t.RESOURCES = "resources";
23460              t.MAIN = "main";
23461              t.START_SCENE = "start-scene";
23462            }(Uh || (Uh = {}));
23463            class Gh {
23464              static create(t) {
23465                let e;
23466                if (0 !== Gh._deadPool.length) {
23467                  e = Gh._deadPool.pop();
23468                  e.set(t);
23469                } else e = new Gh(t);
23470                return e;
23471              }
23472              constructor(t) {
23473                this.id = Gh._taskId++;
23474                this.onComplete = null;
23475                this.onProgress = null;
23476                this.onError = null;
23477                this.source = null;
23478                this.output = null;
23479                this.input = null;
23480                this.progress = null;
23481                this.options = null;
23482                this.isFinish = !0;
23483                this.set(t);
23484              }
23485              set(t = Object.create(null)) {
23486                this.onComplete = t.onComplete || null;
23487                this.onProgress = t.onProgress || null;
23488                this.onError = t.onError || null;
23489                this.source = this.input = t.input;
23490                this.output = null;
23491                this.progress = t.progress;
23492                this.options = t.options || Object.create(null);
23493              }
23494              dispatch(t, e, i, s, n) {
23495                switch (t) {
23496                 case "complete":
23497                  this.onComplete && this.onComplete(e, i);
23498                  break;
23499
23500                 case "progress":
23501                  this.onProgress && this.onProgress(e, i, s, n);
23502                  break;
23503
23504                 case "error":
23505                  this.onError && this.onError(e, i, s, n);
23506                  break;
23507
23508                 default:
23509                  {
23510                    const r = `on${t[0].toUpperCase()}${t.substr(1)}`;
23511                    "function" == typeof this[r] && this[r](e, i, s, n);
23512                    break;
23513                  }
23514                }
23515              }
23516              recycle() {
23517                if (Gh._deadPool.length !== Gh.MAX_DEAD_NUM) {
23518                  this.onComplete = null;
23519                  this.onProgress = null;
23520                  this.onError = null;
23521                  this.source = this.output = this.input = null;
23522                  this.progress = null;
23523                  this.options = null;
23524                  Gh._deadPool.push(this);
23525                }
23526              }
23527            }
23528            Gh.MAX_DEAD_NUM = 500;
23529            Gh._taskId = 0;
23530            Gh._deadPool = [];
23531            const zh = "0123456789abcdef".split("");
23532            const Hh = [ "", "", "", "" ];
23533            const jh = Hh.concat(Hh, "-", Hh, "-", Hh, "-", Hh, "-", Hh, Hh, Hh);
23534            const Xh = jh.map(((t, e) => "-" === t ? NaN : e)).filter(isFinite);
23535            function Wh(t) {
23536              const e = t.split("@")[0];
23537              if (22 !== e.length) return t;
23538              jh[0] = t[0];
23539              jh[1] = t[1];
23540              for (let e = 2, i = 2; e < 22; e += 2) {
23541                const s = ge[t.charCodeAt(e)];
23542                const n = ge[t.charCodeAt(e + 1)];
23543                jh[Xh[i++]] = zh[s >> 2];
23544                jh[Xh[i++]] = zh[(3 & s) << 2 | n >> 4];
23545                jh[Xh[i++]] = zh[15 & n];
23546              }
23547              return t.replace(e, jh.join(""));
23548            }
23549            const Yh = /.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;
23550            function qh(t) {
23551              const e = Yh.exec(t);
23552              return e ? e[1] : "";
23553            }
23554            function Kh(t, e) {
23555              (e = e || Object.create(null)).__isNative__ = e.isNative;
23556              e.nativeExt && (e.ext = e.nativeExt);
23557              const i = Ph.find((e => !!e.getAssetInfo(t)));
23558              i && (e.bundle = i.name);
23559              return Qh(t, e);
23560            }
23561            function Jh(t) {
23562              return !!t && (t instanceof m.SceneAsset || t instanceof m.Scene);
23563            }
23564            function Zh(t) {
23565              t && (46 === t.charCodeAt(0) && 47 === t.charCodeAt(1) ? t = t.slice(2) : 47 === t.charCodeAt(0) && (t = t.slice(1)));
23566              return t;
23567            }
23568            function Qh(t, e) {
23569              const i = Gh.create({
23570                input: t,
23571                options: e
23572              });
23573              const s = [];
23574              try {
23575                const t = Lh.sync(i);
23576                for (const e of t) {
23577                  const t = e.url;
23578                  e.recycle();
23579                  s.push(t);
23580                }
23581              } catch (t) {
23582                for (const t of i.output) t.recycle();
23583                x(t.message, t.stack);
23584              }
23585              i.recycle();
23586              return s.length > 1 ? s : s[0];
23587            }
23588            var $h = Object.freeze({
23589              __proto__: null,
23590              getUuidFromURL: qh,
23591              getUrlWithUuid: Kh,
23592              isScene: Jh,
23593              normalize: Zh,
23594              transform: Qh,
23595              decodeUuid: Wh
23596            });
23597            const tc = /(\.[^\.\/\?\\]*)(\?.*)?$/;
23598            const ec = /((.*)(\/|\\|\\\\))?(.*?\..*$)?/;
23599            const ic = /[^\.\/]+\/\.\.\//;
23600            function sc(...t) {
23601              let e = "";
23602              for (const i of t) e = (e + ("" === e ? "" : "/") + i).replace(/(\/|\\\\)$/, "");
23603              return e;
23604            }
23605            function nc(t) {
23606              const e = tc.exec(t);
23607              return e ? e[1] : "";
23608            }
23609            function rc(t) {
23610              if (t) {
23611                const e = t.lastIndexOf(".");
23612                if (-1 !== e) return t.substring(0, e);
23613              }
23614              return t;
23615            }
23616            function oc(t, e) {
23617              const i = t.indexOf("?");
23618              i > 0 && (t = t.substring(0, i));
23619              const s = /(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/, ""));
23620              if (!s) return t;
23621              const n = s[2];
23622              return e && t.substring(t.length - e.length).toLowerCase() === e.toLowerCase() ? n.substring(0, n.length - e.length) : n;
23623            }
23624            function ac(t) {
23625              const e = ec.exec(t);
23626              return e ? e[2] : "";
23627            }
23628            function lc(t, e) {
23629              e = e || "";
23630              let i = t.indexOf("?");
23631              let s = "";
23632              if (i > 0) {
23633                s = t.substring(i);
23634                t = t.substring(0, i);
23635              }
23636              i = t.lastIndexOf(".");
23637              return i < 0 ? t + e + s : t.substring(0, i) + e + s;
23638            }
23639            function hc(t, e, i) {
23640              if (0 === e.indexOf(".")) return lc(t, e);
23641              let s = t.indexOf("?");
23642              let n = "";
23643              const r = i ? nc(t) : "";
23644              if (s > 0) {
23645                n = t.substring(s);
23646                t = t.substring(0, s);
23647              }
23648              s = t.lastIndexOf("/");
23649              s = s <= 0 ? 0 : s + 1;
23650              return t.substring(0, s) + e + r + n;
23651            }
23652            function cc(t) {
23653              let e = t = String(t);
23654              do {
23655                e = t;
23656                t = t.replace(ic, "");
23657              } while (e.length !== t.length);
23658              return t;
23659            }
23660            function uc(t) {
23661              return t.replace(/[\/\\]$/, "");
23662            }
23663            function _c() {
23664              return Po.os === Ro.WINDOWS ? "\\" : "/";
23665            }
23666            t("path", Object.freeze({
23667              __proto__: null,
23668              join: sc,
23669              extname: nc,
23670              mainFileName: rc,
23671              basename: oc,
23672              dirname: ac,
23673              changeExtname: lc,
23674              changeBasename: hc,
23675              _normalize: cc,
23676              stripSep: uc,
23677              getSeperator: _c
23678            }));
23679            function dc(t) {
23680              if (!t) return;
23681              const e = t._children;
23682              if (!e) return;
23683              const i = e.length;
23684              if (i) {
23685                t._setChildren(e);
23686                for (let t = 0; t < i; ++t) {
23687                  dc(e[t]);
23688                }
23689              }
23690            }
23691            function pc() {}
23692            pc.prototype.once = function(t, e, i) {
23693              return this.on(t, e, i, !0);
23694            };
23695            pc.prototype.targetOff = function(t) {
23696              this.removeAll(t);
23697            };
23698            mc = jsb.Asset, [ Ao, pc ].forEach((t => {
23699              Object.getOwnPropertyNames(t.prototype).forEach((e => {
23700                "constructor" !== e && Object.defineProperty(mc.prototype, e, Object.getOwnPropertyDescriptor(t.prototype, e));
23701              }));
23702            }));
23703            var mc;
23704            const fc = jsb.Asset.prototype;
23705            fc._ctor = function() {
23706              this._ref = 0;
23707              this.__nativeRefs = {};
23708              this.__jsb_ref_id = void 0;
23709              this._iN$t = null;
23710              this.__editorExtras__ = {
23711                editorOnly: !0
23712              };
23713              this._callbackTable = vt(!0);
23714              this._file = null;
23715            };
23716            Object.defineProperty(fc, "_nativeAsset", {
23717              get() {
23718                return this._file;
23719              },
23720              set(t) {
23721                this._file = t;
23722              }
23723            });
23724            Object.defineProperty(fc, "nativeUrl", {
23725              get() {
23726                if (!this._nativeUrl) {
23727                  if (!this._native) return "";
23728                  const t = this._native;
23729                  if (47 === t.charCodeAt(0)) return t.slice(1);
23730                  46 === t.charCodeAt(0) ? this._nativeUrl = Kh(this._uuid, {
23731                    nativeExt: t,
23732                    isNative: !0
23733                  }) : this._nativeUrl = Kh(this._uuid, {
23734                    __nativeName__: t,
23735                    nativeExt: nc(t),
23736                    isNative: !0
23737                  });
23738                }
23739                return this._nativeUrl;
23740              }
23741            });
23742            Object.defineProperty(fc, "refCount", {
23743              configurable: !0,
23744              enumerable: !0,
23745              get() {
23746                return this._ref;
23747              }
23748            });
23749            fc.addRef = function() {
23750              this._ref++;
23751              this.addAssetRef();
23752              return this;
23753            };
23754            fc.decRef = function(t = !0) {
23755              this.decAssetRef();
23756              this._ref > 0 && this._ref--;
23757              t && m.assetManager._releaseManager.tryRelease(this);
23758              return this;
23759            };
23760            fc.toString = function() {
23761              return this.nativeUrl;
23762            };
23763            fc.createNode = null;
23764            const gc = t("Asset", jsb.Asset);
23765            m.Asset = jsb.Asset;
23766            const yc = gc.prototype;
23767            Yl(yc, "_native");
23768            jl(yc, "_nativeAsset", Object.getOwnPropertyDescriptor(yc, "_nativeAsset"));
23769            Ul("cc.Asset")(gc);
23770            var bc, Sc, Ac;
23771            let Tc = t("Script", Ul("cc.Script")(bc = class extends gc {}) || bc);
23772            m._Script = Tc;
23773            let vc = t("JavaScript", Ul("cc.JavaScript")(Sc = class extends Tc {}) || Sc);
23774            m._JavaScript = vc;
23775            let Ec = t("TypeScript", Ul("cc.TypeScript")(Ac = class extends Tc {}) || Ac);
23776            m._TypeScript = Ec;
23777            var Cc, xc, wc, Rc, Ic, Mc, Bc, Dc, Pc, Oc, Nc, Lc, Fc;
23778            let Vc = t("EventHandler", (Cc = Ul("cc.ClickEvent"), xc = lh(), wc = lh(), Rc = lh(),
23779            Ic = lh(), Cc(Mc = (Bc = (Fc = class t {
23780              constructor() {
23781                Ml(this, "target", Dc, this);
23782                Ml(this, "component", Pc, this);
23783                Ml(this, "_componentId", Oc, this);
23784                Ml(this, "handler", Nc, this);
23785                Ml(this, "customEventData", Lc, this);
23786              }
23787              get _componentName() {
23788                this._genCompIdIfNeeded();
23789                return this._compId2Name(this._componentId);
23790              }
23791              set _componentName(t) {
23792                this._componentId = this._compName2Id(t);
23793              }
23794              static emitEvents(e, ...i) {
23795                for (let s = 0, n = e.length; s < n; s++) {
23796                  const n = e[s];
23797                  n instanceof t && n.emit(i);
23798                }
23799              }
23800              emit(t) {
23801                const e = this.target;
23802                if (!m.isValid(e)) return;
23803                this._genCompIdIfNeeded();
23804                const i = m.js.getClassById(this._componentId);
23805                const s = e.getComponent(i);
23806                if (!m.isValid(s)) return;
23807                const n = s[this.handler];
23808                if ("function" == typeof n) {
23809                  null != this.customEventData && "" !== this.customEventData && (t = t.slice()).push(this.customEventData);
23810                  n.apply(s, t);
23811                }
23812              }
23813              _compName2Id(t) {
23814                const e = m.js.getClassByName(t);
23815                return m.js.getClassId(e);
23816              }
23817              _compId2Name(t) {
23818                const e = m.js.getClassById(t);
23819                return m.js.getClassName(e);
23820              }
23821              _genCompIdIfNeeded() {
23822                if (!this._componentId) {
23823                  this._componentName = this.component;
23824                  this.component = "";
23825                }
23826              }
23827            }, Fc), Dc = Bl(Bc.prototype, "target", [ Yl, xc ], {
23828              configurable: !0,
23829              enumerable: !0,
23830              writable: !0,
23831              initializer: function() {
23832                return null;
23833              }
23834            }), Pc = Bl(Bc.prototype, "component", [ Yl, nh, wc ], {
23835              configurable: !0,
23836              enumerable: !0,
23837              writable: !0,
23838              initializer: function() {
23839                return "";
23840              }
23841            }), Oc = Bl(Bc.prototype, "_componentId", [ Yl ], {
23842              configurable: !0,
23843              enumerable: !0,
23844              writable: !0,
23845              initializer: function() {
23846                return "";
23847              }
23848            }), Nc = Bl(Bc.prototype, "handler", [ Yl, nh, Rc ], {
23849              configurable: !0,
23850              enumerable: !0,
23851              writable: !0,
23852              initializer: function() {
23853                return "";
23854              }
23855            }), Lc = Bl(Bc.prototype, "customEventData", [ Yl, nh, Ic ], {
23856              configurable: !0,
23857              enumerable: !0,
23858              writable: !0,
23859              initializer: function() {
23860                return "";
23861              }
23862            }), Bc)) || Mc));
23863            var kc, Uc, Gc, zc, Hc, jc, Xc, Wc, Yc, qc, Kc;
23864            const Jc = new ut("Comp");
23865            const Zc = co.Flags.IsOnLoadCalled;
23866            let Qc = t("Component", (kc = Ul("cc.Component"), Uc = ah(), Gc = Th(Tc), zc = lh(),
23867            kc(Hc = (jc = (Kc = qc = class extends co {
23868              constructor(...t) {
23869                super(...t);
23870                Ml(this, "node", Xc, this);
23871                Ml(this, "_enabled", Wc, this);
23872                Ml(this, "__prefab", Yc, this);
23873                this._sceneGetter = null;
23874                this._id = Jc.getNewId();
23875              }
23876              get name() {
23877                if (this._name) return this._name;
23878                let t = Et(this);
23879                const e = t.lastIndexOf(".");
23880                e >= 0 && (t = t.slice(e + 1));
23881                return this.node ? `${this.node.name}<${t}>` : t;
23882              }
23883              set name(t) {
23884                this._name = t;
23885              }
23886              get uuid() {
23887                return this._id;
23888              }
23889              get __scriptAsset() {
23890                return null;
23891              }
23892              get enabled() {
23893                return this._enabled;
23894              }
23895              set enabled(t) {
23896                if (this._enabled !== t) {
23897                  this._enabled = t;
23898                  if (this.node.activeInHierarchy) {
23899                    const e = m.director._compScheduler;
23900                    t ? e.enableComp(this) : e.disableComp(this);
23901                  }
23902                }
23903              }
23904              get enabledInHierarchy() {
23905                return this._enabled && this.node && this.node.activeInHierarchy;
23906              }
23907              get _isOnLoadCalled() {
23908                return this._objFlags & Zc;
23909              }
23910              _getRenderScene() {
23911                return this._sceneGetter ? this._sceneGetter() : this.node.scene.renderScene;
23912              }
23913              addComponent(t) {
23914                return this.node.addComponent(t);
23915              }
23916              getComponent(t) {
23917                return this.node.getComponent(t);
23918              }
23919              getComponents(t) {
23920                return this.node.getComponents(t);
23921              }
23922              getComponentInChildren(t) {
23923                return this.node.getComponentInChildren(t);
23924              }
23925              getComponentsInChildren(t) {
23926                return this.node.getComponentsInChildren(t);
23927              }
23928              destroy() {
23929                if (super.destroy()) {
23930                  this._enabled && this.node.activeInHierarchy && m.director._compScheduler.disableComp(this);
23931                  return !0;
23932                }
23933                return !1;
23934              }
23935              _onPreDestroy() {
23936                this.unscheduleAllCallbacks();
23937                m.director._nodeActivator.destroyComp(this);
23938                this.node._removeComponent(this);
23939              }
23940              _instantiate(t) {
23941                t || (t = m.instantiate._clone(this, this));
23942                t && (t.node = null);
23943                return t;
23944              }
23945              schedule(t, e = 0, i = m.macro.REPEAT_FOREVER, s = 0) {
23946                k(t, 1619);
23947                k((e = e || 0) >= 0, 1620);
23948                i = Number.isNaN(i) ? m.macro.REPEAT_FOREVER : i;
23949                s = s || 0;
23950                const n = m.director.getScheduler();
23951                const r = n.isTargetPaused(this);
23952                n.schedule(t, this, e, i, s, r);
23953              }
23954              scheduleOnce(t, e = 0) {
23955                this.schedule(t, 0, 0, e);
23956              }
23957              unschedule(t) {
23958                t && m.director.getScheduler().unschedule(t, this);
23959              }
23960              unscheduleAllCallbacks() {
23961                m.director.getScheduler().unscheduleAllForTarget(this);
23962              }
23963            }, qc.EventHandler = Vc, qc.system = null, Kc), Bl(jc.prototype, "__scriptAsset", [ Uc, Gc, zc, gh ], Object.getOwnPropertyDescriptor(jc.prototype, "__scriptAsset"), jc.prototype),
23964            Xc = Bl(jc.prototype, "node", [ Yl ], {
23965              configurable: !0,
23966              enumerable: !0,
23967              writable: !0,
23968              initializer: function() {
23969                return null;
23970              }
23971            }), Wc = Bl(jc.prototype, "_enabled", [ Yl ], {
23972              configurable: !0,
23973              enumerable: !0,
23974              writable: !0,
23975              initializer: function() {
23976                return !0;
23977              }
23978            }), Yc = Bl(jc.prototype, "__prefab", [ Yl ], {
23979              configurable: !0,
23980              enumerable: !0,
23981              writable: !0,
23982              initializer: function() {
23983                return null;
23984              }
23985            }), jc)) || Hc));
23986            const $c = Qc.prototype;
23987            $c.update = null;
23988            $c.lateUpdate = null;
23989            $c.__preload = null;
23990            $c.onLoad = null;
23991            $c.start = null;
23992            $c.onEnable = null;
23993            $c.onDisable = null;
23994            $c.onDestroy = null;
23995            $c.onFocusInEditor = null;
23996            $c.onLostFocusInEditor = null;
23997            $c.resetInEditor = null;
23998            $c._getLocalBounds = null;
23999            $c.onRestore = null;
24000            Qc._requireComponent = null;
24001            Qc._executionOrder = 0;
24002            bt(Qc, "_registerEditorProps", ((t, e) => {
24003              let i = e.requireComponent;
24004              if (i) {
24005                Array.isArray(i) && (i = i.filter(Boolean));
24006                t._requireComponent = i;
24007              }
24008              const s = e.executionOrder;
24009              s && "number" == typeof s && (t._executionOrder = s);
24010            }));
24011            m.Component = Qc;
24012            var tu, eu, iu;
24013            let su = t("MissingScript", Ul("cc.MissingScript")(tu = eh()(tu = (eu = class extends Qc {
24014              static safeFindClass(t) {
24015                const e = Kt(t);
24016                if (e) return e;
24017                m.deserialize.reportMissingClass(t);
24018              }
24019              constructor() {
24020                super();
24021                Ml(this, "_$erialized", iu, this);
24022              }
24023              onLoad() {
24024                N(4600, this.node.name);
24025              }
24026            }, iu = Bl(eu.prototype, "_$erialized", [ Yl, Kl ], {
24027              configurable: !0,
24028              enumerable: !0,
24029              writable: !0,
24030              initializer: function() {
24031                return null;
24032              }
24033            }), eu)) || tu) || tu);
24034            m._MissingScript = su;
24035            try {
24036              const t = su.__values__;
24037              if (0 === t.length || "_$erialized" !== t[t.length - 1]) {
24038                x("The '_$erialized' prop in MissingScript is missing. Please contact jare.");
24039                x(`    Error props: ['${t}']`);
24040              }
24041            } catch (Qo) {
24042              x(`Error when checking MissingScript 5, ${Qo}`);
24043            }
24044            const nu = t("serializeTag", Symbol("[[Serialize]]"));
24045            const ru = t("deserializeTag", Symbol("[[Deserialize]]"));
24046            class ou {
24047              constructor(t, e) {
24048                this._document = void 0;
24049                this._chunks = void 0;
24050                this._document = t;
24051                this._chunks = e;
24052              }
24053              get document() {
24054                return this._document;
24055              }
24056              get chunks() {
24057                return this._chunks;
24058              }
24059            }
24060            function au(t) {
24061              const e = t;
24062              return {
24063                chunks: e.chunks,
24064                document: e.document
24065              };
24066            }
24067            function lu(t) {
24068              if (t.length < 16) throw new hu(G(13102));
24069              const e = new DataView(t.buffer, t.byteOffset, t.byteLength);
24070              if (1313817411 !== e.getUint32(0, !0)) throw new hu(G(13100));
24071              const i = e.getUint32(4, !0);
24072              if (1 !== i) throw new hu(G(13101, i));
24073              if (e.getUint32(8, !0) !== e.byteLength) throw new hu(G(13102));
24074              let s = 12;
24075              const n = e.getUint32(s, !0);
24076              s += 4;
24077              const r = new Uint8Array(e.buffer, s + e.byteOffset, n);
24078              s += n;
24079              const o = function(t) {
24080                if ("undefined" != typeof TextDecoder) return (new TextDecoder).decode(t);
24081                if ("Buffer" in globalThis) {
24082                  const {Buffer: e} = globalThis;
24083                  return e.from(t.buffer, t.byteOffset, t.byteLength).toString();
24084                }
24085                throw new Error(G(13104));
24086              }(r);
24087              let a;
24088              try {
24089                a = JSON.parse(o);
24090              } catch (t) {
24091                throw new hu(t);
24092              }
24093              const l = [];
24094              for (;s < e.byteLength; ) {
24095                if (s % 8 != 0) {
24096                  s += 8 - s % 8;
24097                }
24098                const t = e.getUint32(s, !0);
24099                s += 4;
24100                l.push(new Uint8Array(e.buffer, s + e.byteOffset, t));
24101                s += t;
24102              }
24103              if (s !== e.byteLength) throw new hu(G(13102));
24104              return new ou(a, l);
24105            }
24106            class hu extends Error {}
24107            m.internal.parseCCONJson = au;
24108            m.internal.decodeCCONBinary = lu;
24109            m.internal.CCON = ou;
24110            const cu = function(t, e) {
24111              const i = me.test(Qt(e));
24112              const s = Vt(e, m._BaseNode) || Vt(e, m.Component);
24113              let n = !1;
24114              const r = [];
24115              let o = r;
24116              const a = [];
24117              let l = a;
24118              const h = [];
24119              (() => {
24120                const t = e.__values__;
24121                n = "_$erialized" === t[t.length - 1];
24122                const s = Be(e);
24123                for (let e = 0; e < t.length; e++) {
24124                  const n = t[e];
24125                  let c = n;
24126                  s[n + du] && (c = s[n + du]);
24127                  const u = si.getDefault(s[n + _u]);
24128                  const _ = s[n + uu];
24129                  let d = !1;
24130                  if (i && (void 0 !== u || _)) if (void 0 === u) d = _ instanceof Pe || _ === Je || _ === Ze; else {
24131                    const t = typeof u;
24132                    d = "string" === t || "number" === t || "boolean" === t;
24133                  }
24134                  if (i && d) {
24135                    c !== n && o === r && (o = r.slice());
24136                    r.push(n);
24137                    o !== r && o.push(c);
24138                  } else {
24139                    c !== n && l === a && (l = a.slice());
24140                    a.push(n);
24141                    l !== a && l.push(c);
24142                    h.push(u instanceof m.ValueType && u.constructor);
24143                  }
24144                }
24145              })();
24146              return (t, e, c, u) => {
24147                for (let t = 0; t < r.length; ++t) {
24148                  const i = c[o[t]];
24149                  void 0 !== i && (e[r[t]] = i);
24150                }
24151                for (let s = 0; s < a.length; ++s) {
24152                  const n = a[s];
24153                  const r = c[l[s]];
24154                  if (void 0 !== r) if ("object" != typeof r) e[n] = r; else {
24155                    const o = h[s];
24156                    o ? i || r ? t._deserializeFastDefinedObject(e[n], r, o) : e[n] = null : r ? t._deserializeAndAssignField(e, r, n) : e[n] = null;
24157                  }
24158                }
24159                s && c._id && (e._id = c._id);
24160                if (n) {
24161                  e._$erialized = JSON.parse(JSON.stringify(c));
24162                  t._fillPlainObject(e._$erialized, c);
24163                }
24164              };
24165            };
24166            const uu = "$_$type";
24167            const _u = "$_$default";
24168            const du = "$_$formerlySerializedAs";
24169            class pu {
24170              constructor(t, e, i, s, n) {
24171                this.deserializedList = void 0;
24172                this.deserializedData = void 0;
24173                this._ignoreEditorOnly = void 0;
24174                this.result = t;
24175                this.customEnv = s;
24176                this.deserializedList = [];
24177                this.deserializedData = null;
24178                this._classFinder = e;
24179                this._reportMissingClass = i;
24180                this._onDereferenced = null == e ? void 0 : e.onDereferenced;
24181              }
24182              reset(t, e, i, s, n) {
24183                this.result = t;
24184                this.customEnv = s;
24185                this._classFinder = e;
24186                this._reportMissingClass = i;
24187                this._onDereferenced = null == e ? void 0 : e.onDereferenced;
24188              }
24189              clear() {
24190                this.result = null;
24191                this.customEnv = null;
24192                this.deserializedList.length = 0;
24193                this.deserializedData = null;
24194                this._classFinder = null;
24195                this._reportMissingClass = null;
24196                this._onDereferenced = null;
24197              }
24198              deserialize(t) {
24199                let e = !1;
24200                let i;
24201                if (t instanceof ou) {
24202                  e = !0;
24203                  i = t.document;
24204                  if (t.chunks.length > 0) {
24205                    ne(1 === t.chunks.length);
24206                    this._mainBinChunk = t.chunks[0];
24207                  }
24208                } else i = t;
24209                this._serializedData = i;
24210                this._context = {
24211                  fromCCON: e
24212                };
24213                const s = Array.isArray(i) ? i[0] : i;
24214                this.deserializedData = this._deserializeObject(s, 0);
24215                this._serializedData = void 0;
24216                this._mainBinChunk = void 0;
24217                this._context = void 0;
24218                return this.deserializedData;
24219              }
24220              _deserializeObject(t, e, i, s) {
24221                switch (t.__type__) {
24222                 case "TypedArray":
24223                  return this._deserializeTypedArrayView(t);
24224
24225                 case "TypedArrayRef":
24226                  return this._deserializeTypedArrayViewRef(t);
24227
24228                 default:
24229                  return t.__type__ ? this._deserializeTypeTaggedObject(t, e, i, s) : Array.isArray(t) ? this._deserializeArray(t) : this._deserializePlainObject(t);
24230                }
24231              }
24232              _deserializeTypedArrayView(t) {
24233                return globalThis[t.ctor].from(t.array);
24234              }
24235              _deserializeTypedArrayViewRef(t) {
24236                const {offset: e, length: i, ctor: s} = t;
24237                return new globalThis[s](this._mainBinChunk.buffer, this._mainBinChunk.byteOffset + e, i);
24238              }
24239              _deserializeArray(t) {
24240                const e = new Array(t.length);
24241                let i;
24242                for (let s = 0; s < t.length; s++) {
24243                  i = t[s];
24244                  if ("object" == typeof i && i) {
24245                    this._deserializeAndAssignField(e, i, `${s}`) && (e[s] = null);
24246                  } else e[s] = i;
24247                }
24248                return e;
24249              }
24250              _deserializePlainObject(t) {
24251                const e = {};
24252                this._fillPlainObject(e, t);
24253                return e;
24254              }
24255              _deserializeTypeTaggedObject(t, e, i, s) {
24256                const n = t.__type__;
24257                const r = this._classFinder(n, t, i, s);
24258                if (!r) {
24259                  this._classFinder === Kt && this._reportMissingClass(n);
24260                  return null;
24261                }
24262                const o = t => {
24263                  const i = new t;
24264                  e >= 0 && (this.deserializedList[e] = i);
24265                  return i;
24266                };
24267                {
24268                  const e = o(r);
24269                  this._deserializeInto(t, e, r);
24270                  return e;
24271                }
24272              }
24273              _deserializeInto(t, e, i, s = !1) {
24274                s || !e[ru] ? e._deserialize ? e._deserialize(t.content, this) : m.Class._isCCClass(i) ? this._deserializeFireClass(e, t, i) : this._deserializeFastDefinedObject(e, t, i) : this._runCustomizedDeserialize(t, e, i);
24275              }
24276              _runCustomizedDeserialize(t, e, i) {
24277                const s = {
24278                  readProperty: e => {
24279                    const i = t[e];
24280                    return "object" == typeof i && i ? this._deserializeObjectField(i) : i;
24281                  },
24282                  readThis: () => {
24283                    this._deserializeInto(t, e, i, !0);
24284                  },
24285                  readSuper: () => {
24286                    const s = Ft(i);
24287                    s && this._deserializeInto(t, e, s);
24288                  }
24289                };
24290                e[ru](s, this._context);
24291              }
24292              _deserializeFireClass(t, e, i) {
24293                let s;
24294                if (i.hasOwnProperty("__deserialize__")) s = i.__deserialize__; else {
24295                  s = cu(this, i);
24296                  try {
24297                    if (i === su) {
24298                      const t = i.__values__;
24299                      if (0 === t.length || "_$erialized" !== t[t.length - 1]) {
24300                        x("The '_$erialized' prop of MissingScript is missing. Will force the raw data to be save.");
24301                        x(`    Error props: ['${t}']. Please contact jare.`);
24302                      }
24303                      const e = s;
24304                      s = function(t, i, s, n) {
24305                        e(t, i, s, n);
24306                        i._$erialized || x(`Unable to stash previously serialized data. ${JSON.stringify(s)}`);
24307                      };
24308                    }
24309                  } catch (t) {
24310                    x(`Error when checking MissingScript 6, ${t}`);
24311                  }
24312                  bt(i, "__deserialize__", s, !0);
24313                }
24314                s(this, t, e, i);
24315              }
24316              _deserializeAndAssignField(t, e, i) {
24317                const s = e.__id__;
24318                if ("number" == typeof s) {
24319                  const e = this.deserializedList[s];
24320                  if (e) t[i] = e; else {
24321                    var n;
24322                    const e = this._serializedData[s];
24323                    t[i] = this._deserializeObject(e, s, void 0, i);
24324                    null === (n = this._onDereferenced) || void 0 === n || n.call(this, this.deserializedList, s, t, i);
24325                  }
24326                } else {
24327                  const s = e.__uuid__;
24328                  if (s) {
24329                    const n = e.__expectedType__;
24330                    this.result.push(t, i, s, n);
24331                  } else t[i] = this._deserializeObject(e, -1);
24332                }
24333                return !1;
24334              }
24335              _deserializeObjectField(t) {
24336                const e = t.__id__;
24337                if ("number" == typeof e) {
24338                  const t = this.deserializedList[e];
24339                  if (t) return t;
24340                  {
24341                    const t = this._serializedData[e];
24342                    return this._deserializeObject(t, e, void 0, void 0);
24343                  }
24344                }
24345                if (t.__uuid__) {
24346                  t.__expectedType__;
24347                  throw new Error("Asset reference field serialization is currently not supported in custom serialization.");
24348                }
24349                return this._deserializeObject(t, -1);
24350              }
24351              _fillPlainObject(t, e) {
24352                for (const i in e) {
24353                  if (!e.hasOwnProperty(i)) continue;
24354                  const s = e[i];
24355                  if ("object" != typeof s) "__type__" !== i && (t[i] = s); else if (s) {
24356                    this._deserializeAndAssignField(t, s, i) && (t[i] = null);
24357                  } else t[i] = null;
24358                }
24359              }
24360              _deserializeFastDefinedObject(t, e, i) {
24361                if (i === m.Vec2) {
24362                  t.x = e.x || 0;
24363                  t.y = e.y || 0;
24364                  return;
24365                }
24366                if (i === m.Vec3) {
24367                  t.x = e.x || 0;
24368                  t.y = e.y || 0;
24369                  t.z = e.z || 0;
24370                  return;
24371                }
24372                if (i === m.Color) {
24373                  t.r = e.r || 0;
24374                  t.g = e.g || 0;
24375                  t.b = e.b || 0;
24376                  const i = e.a;
24377                  t.a = void 0 === i ? 255 : i;
24378                  return;
24379                }
24380                if (i === m.Size) {
24381                  t.width = e.width || 0;
24382                  t.height = e.height || 0;
24383                  return;
24384                }
24385                const s = Be(i);
24386                const n = i.__values__;
24387                n || x(`Unable to deserialize ${Et(i)}. For non-CCClass types, they can only be marked as serializable by \`CCClass.fastDefine\`.`);
24388                for (let i = 0; i < n.length; i++) {
24389                  const r = n[i];
24390                  let o = e[r];
24391                  void 0 !== o || e.hasOwnProperty(r) || (o = si.getDefault(s[r + _u]));
24392                  "object" != typeof o ? t[r] = o : o ? this._deserializeAndAssignField(t, o, r) : t[r] = null;
24393                }
24394              }
24395            }
24396            pu.pool = new class extends $t {
24397              constructor() {
24398                super((t => {
24399                  t.clear();
24400                }), 1);
24401              }
24402              get(t, e, i, s, n) {
24403                const r = this._get();
24404                if (r) {
24405                  r.reset(t, e, i, s, n);
24406                  return r;
24407                }
24408                return new pu(t, e, i, s, n);
24409              }
24410            };
24411            const mu = [ Qi, Pi, is, Ui, Bi, rs, as, qi ];
24412            function fu(t, e) {
24413              t.x = e[1];
24414              t.y = e[2];
24415              t.z = e[3];
24416              t.w = e[4];
24417            }
24418            const gu = [ (t, e) => {
24419              t.x = e[1];
24420              t.y = e[2];
24421            }, (t, e) => {
24422              t.x = e[1];
24423              t.y = e[2];
24424              t.z = e[3];
24425            }, fu, fu, (t, e) => {
24426              t._val = e[1];
24427            }, (t, e) => {
24428              t.width = e[1];
24429              t.height = e[2];
24430            }, (t, e) => {
24431              t.x = e[1];
24432              t.y = e[2];
24433              t.width = e[3];
24434              t.height = e[4];
24435            }, (t, e) => {
24436              qi.fromArray(t, e, 1);
24437            } ];
24438            const yu = 0, bu = 1, Su = 2, Au = 3, Tu = 4, vu = 5, Eu = 6, Cu = 7, xu = 8, wu = 9, Ru = 10, Iu = 11, Mu = 12, Bu = 13;
24439            const Du = 3, Pu = 1, Ou = 2;
24440            const Nu = 0, Lu = 0, Fu = 1, Vu = 2, ku = 3, Uu = 4, Gu = 5, zu = 6, Hu = 7, ju = 8, Xu = 9, Wu = 10;
24441            const Yu = Gu;
24442            class qu {
24443              constructor() {
24444                this.uuidObjList = null;
24445                this.uuidPropList = null;
24446                this.uuidList = null;
24447                this.uuidTypeList = [];
24448              }
24449              init(t) {
24450                if (t) {
24451                  this.uuidObjList = t[ju];
24452                  this.uuidPropList = t[Xu];
24453                  this.uuidList = t[Wu];
24454                } else {
24455                  if (!this.uuidList) {
24456                    this.uuidList = [];
24457                    this.uuidObjList = [];
24458                    this.uuidPropList = [];
24459                    this.uuidTypeList = [];
24460                  }
24461                }
24462              }
24463              reset() {
24464                if (this.uuidList) {
24465                  this.uuidList.length = 0;
24466                  this.uuidObjList.length = 0;
24467                  this.uuidPropList.length = 0;
24468                  this.uuidTypeList.length = 0;
24469                }
24470              }
24471              push(t, e, i, s) {
24472                this.uuidObjList.push(t);
24473                this.uuidPropList.push(e);
24474                this.uuidList.push(i);
24475                this.uuidTypeList.push(s || "");
24476              }
24477            }
24478            t("Details", qu);
24479            qu.pool = new $t((t => {
24480              t.reset();
24481            }), 5);
24482            qu.pool.get = function() {
24483              return this._get() || new qu;
24484            };
24485            function Ku(t, e) {
24486              const i = t[Uu][e[0]];
24487              const s = i[0];
24488              const n = new (0, s[0]);
24489              const r = s[1];
24490              const o = s[2];
24491              const a = i[i.length - 1];
24492              let l = 1;
24493              for (;l < a; ++l) {
24494                n[r[i[l]]] = e[l];
24495              }
24496              for (;l < e.length; ++l) {
24497                const a = r[i[l]];
24498                const h = s[i[l] + o];
24499                (0, e_[h])(t, n, a, e[l]);
24500              }
24501              return n;
24502            }
24503            function Ju(t, e, i) {
24504              const s = new e;
24505              s._deserialize ? s._deserialize(i, t[Lu]) : F(5303, Et(e));
24506              return s;
24507            }
24508            function Zu(t, e, i, s) {
24509              s >= 0 ? e[i] = t[Gu][s] : t[Hu][~s * Du] = e;
24510            }
24511            function Qu(t) {
24512              return (e, i, s, n) => {
24513                i[s] = n;
24514                for (let i = 0; i < n.length; ++i) t(e, n, i, n[i]);
24515              };
24516            }
24517            function $u(t, e, i, s) {
24518              e[i] = null;
24519              t[ju][s] = e;
24520            }
24521            function t_(t, e, i, s) {
24522              e[i] = Ku(t, s);
24523            }
24524            const e_ = new Array(Bu);
24525            e_[yu] = function(t, e, i, s) {
24526              e[i] = s;
24527            };
24528            e_[bu] = Zu;
24529            e_[Su] = Qu(Zu);
24530            e_[Au] = Qu($u);
24531            e_[Tu] = t_;
24532            e_[vu] = function(t, e, i, s) {
24533              {
24534                const t = e[i];
24535                gu[s[0]](t, s);
24536                e[i] = t;
24537              }
24538            };
24539            e_[Eu] = $u;
24540            e_[Cu] = function(t, e, i, s) {
24541              e[i].set(s);
24542            };
24543            e_[xu] = function(t, e, i, s) {
24544              const n = new mu[s[0]];
24545              gu[s[0]](n, s);
24546              e[i] = n;
24547            };
24548            e_[wu] = Qu(t_);
24549            e_[Ru] = function(t, e, i, s) {
24550              const n = t[ku][s[0]];
24551              e[i] = Ju(t, n, s[1]);
24552            };
24553            e_[Iu] = function(t, e, i, s) {
24554              const n = s[0];
24555              e[i] = n;
24556              for (let e = 1; e < s.length; e += 3) {
24557                const i = s[e];
24558                const r = s[e + 1];
24559                const o = s[e + 2];
24560                (0, e_[r])(t, n, i, o);
24561              }
24562            };
24563            e_[Mu] = function(t, e, i, s) {
24564              const n = s[0];
24565              e[i] = n;
24566              for (let e = 0; e < n.length; ++e) {
24567                const i = n[e];
24568                const r = s[e + 1];
24569                if (r !== yu) {
24570                  (0, e_[r])(t, n, e, i);
24571                }
24572              }
24573            };
24574            function i_(t, e, i) {
24575              t || i(e);
24576              return Object;
24577            }
24578            function s_(t, e, i, s, n, r, o) {
24579              let a = t(e);
24580              if (!a) {
24581                if (n) {
24582                  i[s] = (l = i, h = s, c = e, function() {
24583                    const e = t(c) || i_(r, c, o);
24584                    l[h] = e;
24585                    return new e;
24586                  });
24587                  return;
24588                }
24589                a = i_(r, e, o);
24590              }
24591              var l, h, c;
24592              i[s] = a;
24593            }
24594            function n_(t, e, i, s) {
24595              const n = i || Kt;
24596              const r = t[ku];
24597              for (let t = 0; t < r.length; ++t) {
24598                const o = r[t];
24599                if ("string" != typeof o) {
24600                  if ("function" == typeof o[0]) throw new Error("Can not deserialize the same JSON data again.");
24601                  s_(n, o[0], o, 0, e, i, s);
24602                } else s_(n, o, r, t, e, i, s);
24603              }
24604            }
24605            function r_(t) {
24606              const e = t[Uu];
24607              if (e) {
24608                const i = t[ku];
24609                for (let t = 0; t < e.length; ++t) {
24610                  const s = e[t];
24611                  s[0] = i[s[0]];
24612                }
24613              }
24614            }
24615            function o_(t, e, i) {
24616              "string" == typeof t && (t = JSON.parse(t));
24617              const s = !e;
24618              e = e || qu.pool.get();
24619              let n;
24620              if (function(t) {
24621                if (Array.isArray(t)) {
24622                  const e = t[0];
24623                  return "number" == typeof e || e instanceof a_;
24624                }
24625                return !1;
24626              }(t)) {
24627                e.init(t);
24628                i = i || {};
24629                let s = t[Nu];
24630                let o = !1;
24631                if ("object" == typeof s) {
24632                  o = s.preprocessed;
24633                  s = s.version;
24634                }
24635                if (s < 1) throw new Error(G(5304, s));
24636                i._version = s;
24637                i.result = e;
24638                t[Lu] = i;
24639                if (!o) {
24640                  var r;
24641                  n_(t, !1, i.classFinder, null !== (r = i.reportMissingClass) && void 0 !== r ? r : o_.reportMissingClass);
24642                  r_(t);
24643                }
24644                m.game._isCloning = !0;
24645                const a = t[Gu];
24646                const l = function(t) {
24647                  const e = t[Gu];
24648                  const i = t[zu];
24649                  const s = 0 === i ? 0 : i.length;
24650                  let n = e[e.length - 1];
24651                  let r = e.length - s;
24652                  if ("number" != typeof n) n = 0; else {
24653                    n < 0 && (n = ~n);
24654                    --r;
24655                  }
24656                  let o = 0;
24657                  for (;o < r; ++o) e[o] = Ku(t, e[o]);
24658                  const a = t[ku];
24659                  for (let n = 0; n < s; ++n, ++o) {
24660                    let s = i[n];
24661                    const r = e[o];
24662                    if (s >= 0) {
24663                      const i = a[s];
24664                      e[o] = Ju(t, i, r);
24665                    } else {
24666                      s = ~s;
24667                      (0, e_[s])(t, e, o, r);
24668                    }
24669                  }
24670                  return n;
24671                }(t);
24672                m.game._isCloning = !1;
24673                t[Hu] && function(t, e, i) {
24674                  const s = t.length - 1;
24675                  let n = 0;
24676                  const r = t[s] * Du;
24677                  for (;n < r; n += Du) {
24678                    const s = t[n];
24679                    const r = e[t[n + Ou]];
24680                    const o = t[n + Pu];
24681                    o >= 0 ? s[i[o]] = r : s[~o] = r;
24682                  }
24683                  for (;n < s; n += Du) {
24684                    const s = e[t[n]];
24685                    const r = e[t[n + Ou]];
24686                    const o = t[n + Pu];
24687                    o >= 0 ? s[i[o]] = r : s[~o] = r;
24688                  }
24689                }(t[Hu], a, t[Vu]);
24690                !function(t) {
24691                  const e = t[Gu];
24692                  const i = t[Vu];
24693                  const s = t[Fu];
24694                  const n = t[ju];
24695                  const r = t[Xu];
24696                  const o = t[Wu];
24697                  for (let t = 0; t < n.length; ++t) {
24698                    const a = n[t];
24699                    "number" == typeof a && (n[t] = e[a]);
24700                    let l = r[t];
24701                    if ("number" == typeof l) {
24702                      l = l >= 0 ? i[l] : ~l;
24703                      r[t] = l;
24704                    }
24705                    const h = o[t];
24706                    "number" == typeof h && (o[t] = s[h]);
24707                  }
24708                }(t);
24709                n = a[l];
24710              } else n = function(t, e, i) {
24711                var s;
24712                const n = (i = i || {}).classFinder || Kt;
24713                const r = i.createAssetRefs || Vo.platform === Io.EDITOR_CORE;
24714                const o = i.customEnv;
24715                const a = i.ignoreEditorOnly;
24716                const l = null !== (s = i.reportMissingClass) && void 0 !== s ? s : m.deserialize.reportMissingClass;
24717                e.init();
24718                const h = pu.pool.get(e, n, l, o, a);
24719                m.game._isCloning = !0;
24720                const c = h.deserialize(t);
24721                m.game._isCloning = !1;
24722                pu.pool.put(h);
24723                r && e.assignAssetsBy(((t, e) => EditorExtends.serialize.asAsset(t, e.type)));
24724                return c;
24725              }(t, e, i);
24726              s && qu.pool.put(e);
24727              return n;
24728            }
24729            o_.Details = qu;
24730            o_.reportMissingClass = function(t) {
24731              F(5302, t);
24732            };
24733            class a_ {
24734              constructor(t) {
24735                this.preprocessed = !0;
24736                this.version = t;
24737              }
24738            }
24739            function l_(t, e, i) {
24740              return [ 1, 0, 0, [ t ], 0, i ? [ e, -1 ] : [ e ], [ 0 ], 0, [], [], [] ];
24741            }
24742            function h_(t) {
24743              return function(t) {
24744                const e = t[Fu];
24745                return t[Wu].map((t => e[t]));
24746              }(t);
24747            }
24748            m.deserialize = o_;
24749            const c_ = co.Flags.Destroyed;
24750            const u_ = co.Flags.PersistentMask;
24751            const __ = [];
24752            function d_(t, e) {
24753              let i;
24754              if (_o(t)) {
24755                if (t._instantiate) {
24756                  m.game._isCloning = !0;
24757                  i = t._instantiate(null, !0);
24758                  m.game._isCloning = !1;
24759                  dc(i);
24760                  return i;
24761                }
24762                if (t instanceof m.Asset) throw new TypeError(G(6903));
24763              }
24764              m.game._isCloning = !0;
24765              i = p_(t);
24766              m.game._isCloning = !1;
24767              dc(i);
24768              return i;
24769            }
24770            function p_(t, e) {
24771              let i;
24772              if (t._iN$t) i = t._iN$t; else if (t.constructor) {
24773                i = new (0, t.constructor);
24774              } else i = Object.create(null);
24775              m_(t, i, e);
24776              for (let t = 0, e = __.length; t < e; ++t) __[t]._iN$t = null;
24777              __.length = 0;
24778              return i;
24779            }
24780            function m_(t, e, i) {
24781              ee.value(t, "_iN$t", e, !0);
24782              __.push(t);
24783              const s = t.constructor;
24784              if (ni(s)) !function(t, e, i, s) {
24785                const n = t.__values__;
24786                for (let t = 0; t < n.length; t++) {
24787                  const r = n[t];
24788                  const o = e[r];
24789                  if ("object" == typeof o && o) {
24790                    const t = i[r];
24791                    t instanceof ce && t.constructor === o.constructor ? t.set(o) : i[r] = o._iN$t || f_(o, s);
24792                  } else i[r] = o;
24793                }
24794              }(s, t, e, i); else for (const s in t) {
24795                if (!t.hasOwnProperty(s) || 95 === s.charCodeAt(0) && 95 === s.charCodeAt(1) && "__type__" !== s && "__prefab" !== s) continue;
24796                const n = t[s];
24797                if ("object" == typeof n && n) {
24798                  if (n === e) continue;
24799                  e[s] = n._iN$t || f_(n, i);
24800                } else e[s] = n;
24801              }
24802              _o(t) && (e._objFlags &= u_);
24803            }
24804            function f_(t, e) {
24805              if (t instanceof ce) return t.clone();
24806              if (t instanceof m.Asset) return t;
24807              let i;
24808              if (ArrayBuffer.isView(t)) {
24809                const e = t.length;
24810                i = new t.constructor(e);
24811                t._iN$t = i;
24812                __.push(t);
24813                for (let s = 0; s < e; ++s) i[s] = t[s];
24814                return i;
24815              }
24816              if (Array.isArray(t)) {
24817                const s = t.length;
24818                i = new Array(s);
24819                t._iN$t = i;
24820                __.push(t);
24821                for (let n = 0; n < s; ++n) {
24822                  const s = t[n];
24823                  i[n] = "object" == typeof s && s ? s._iN$t || f_(s, e) : s;
24824                }
24825                return i;
24826              }
24827              if (t._objFlags & c_) return null;
24828              const s = t.constructor;
24829              if (ni(s)) {
24830                if (e) if (e instanceof m.Component) {
24831                  if (t instanceof m._BaseNode || t instanceof m.Component) return t;
24832                } else if (e instanceof m._BaseNode) if (t instanceof m._BaseNode) {
24833                  if (!t.isChildOf(e)) return t;
24834                } else if (t instanceof m.Component && t.node && !t.node.isChildOf(e)) return t;
24835                i = new s;
24836              } else if (s === Object) i = {}; else {
24837                if (s) return t;
24838                i = Object.create(null);
24839              }
24840              m_(t, i, e);
24841              return i;
24842            }
24843            d_._clone = p_;
24844            m.instantiate = d_;
24845            var g_, y_, b_, S_, A_, T_, v_, E_;
24846            let C_;
24847            !function(t) {
24848              t[t.Uint8 = 0] = "Uint8";
24849              t[t.Uint16 = 1] = "Uint16";
24850              t[t.Uint32 = 2] = "Uint32";
24851              t[t.Int8 = 3] = "Int8";
24852              t[t.Int16 = 4] = "Int16";
24853              t[t.Int32 = 5] = "Int32";
24854              t[t.Float32 = 6] = "Float32";
24855              t[t.Float64 = 7] = "Float64";
24856            }(C_ || (C_ = {}));
24857            let x_;
24858            !function(t) {
24859              t[t.Scalar = 0] = "Scalar";
24860              t[t.Vec2 = 1] = "Vec2";
24861              t[t.Vec3 = 2] = "Vec3";
24862              t[t.Vec4 = 3] = "Vec4";
24863              t[t.Quat = 4] = "Quat";
24864              t[t.Mat4 = 5] = "Mat4";
24865            }(x_ || (x_ = {}));
24866            function w_(t, e) {
24867              return (e << 3) + t;
24868            }
24869            t("CompactValueTypeArray", Ul("cc.CompactValueTypeArray")(g_ = (y_ = (E_ = v_ = class t {
24870              constructor() {
24871                Ml(this, "_byteOffset", b_, this);
24872                Ml(this, "_unitCount", S_, this);
24873                Ml(this, "_unitElement", A_, this);
24874                Ml(this, "_length", T_, this);
24875              }
24876              static lengthFor(t, e, i) {
24877                return R_(e).requiredUnits * t.length * I_(i).BYTES_PER_ELEMENT;
24878              }
24879              static compress(e, i, s, n, r, o) {
24880                const a = R_(i);
24881                const l = I_(s);
24882                const h = a.requiredUnits * e.length;
24883                const c = new l(n, r, h);
24884                for (let t = 0; t < e.length; ++t) a.compress(c, t, e[t]);
24885                const u = new t;
24886                u._unitElement = w_(s, i);
24887                u._byteOffset = o;
24888                u._unitCount = h;
24889                u._length = e.length;
24890                return u;
24891              }
24892              decompress(t) {
24893                const {storageUnit: e, elementType: i} = {
24894                  storageUnit: 7 & (s = this._unitElement),
24895                  elementType: s >> 3
24896                };
24897                var s;
24898                const n = R_(i);
24899                const r = new (I_(e))(t, this._byteOffset, this._unitCount);
24900                const o = new Array(this._length);
24901                for (let t = 0; t < this._length; ++t) o[t] = n.decompress(r, t);
24902                return o;
24903              }
24904            }, v_.StorageUnit = C_, v_.ElementType = x_, E_), b_ = Bl(y_.prototype, "_byteOffset", [ Yl ], {
24905              configurable: !0,
24906              enumerable: !0,
24907              writable: !0,
24908              initializer: function() {
24909                return 0;
24910              }
24911            }), S_ = Bl(y_.prototype, "_unitCount", [ Yl ], {
24912              configurable: !0,
24913              enumerable: !0,
24914              writable: !0,
24915              initializer: function() {
24916                return 0;
24917              }
24918            }), A_ = Bl(y_.prototype, "_unitElement", [ Yl ], {
24919              configurable: !0,
24920              enumerable: !0,
24921              writable: !0,
24922              initializer: function() {
24923                return w_(C_.Uint8, x_.Scalar);
24924              }
24925            }), T_ = Bl(y_.prototype, "_length", [ Yl ], {
24926              configurable: !0,
24927              enumerable: !0,
24928              writable: !0,
24929              initializer: function() {
24930                return 0;
24931              }
24932            }), y_)) || g_);
24933            function R_(t) {
24934              return M_[t];
24935            }
24936            function I_(t) {
24937              switch (t) {
24938               case C_.Uint8:
24939                return Uint8Array;
24940
24941               case C_.Uint16:
24942                return Uint16Array;
24943
24944               case C_.Uint32:
24945                return Uint32Array;
24946
24947               case C_.Int8:
24948                return Int8Array;
24949
24950               case C_.Int16:
24951                return Int16Array;
24952
24953               case C_.Int32:
24954                return Int32Array;
24955
24956               case C_.Float32:
24957                return Float32Array;
24958
24959               case C_.Float64:
24960                return Float64Array;
24961              }
24962            }
24963            const M_ = {
24964              [x_.Scalar]: {
24965                requiredUnits: 1,
24966                compress(t, e, i) {
24967                  t[e] = i;
24968                },
24969                decompress: (t, e) => t[e]
24970              },
24971              [x_.Vec2]: {
24972                requiredUnits: 2,
24973                compress(t, e, i) {
24974                  t[2 * e] = i.x;
24975                  t[2 * e + 1] = i.y;
24976                },
24977                decompress: (t, e) => new Pi(t[2 * e], t[2 * e + 1])
24978              },
24979              [x_.Vec3]: {
24980                requiredUnits: 3,
24981                compress(t, e, i) {
24982                  t[3 * e] = i.x;
24983                  t[3 * e + 1] = i.y;
24984                  t[3 * e + 2] = i.z;
24985                },
24986                decompress: (t, e) => new Pi(t[3 * e], t[3 * e + 1], t[3 * e + 2])
24987              },
24988              [x_.Vec4]: {
24989                requiredUnits: 4,
24990                compress(t, e, i) {
24991                  t[4 * e] = i.x;
24992                  t[4 * e + 1] = i.y;
24993                  t[4 * e + 2] = i.z;
24994                  t[4 * e + 3] = i.w;
24995                },
24996                decompress: (t, e) => new is(t[4 * e], t[4 * e + 1], t[4 * e + 2], t[4 * e + 3])
24997              },
24998              [x_.Quat]: {
24999                requiredUnits: 4,
25000                compress(t, e, i) {
25001                  t[4 * e] = i.x;
25002                  t[4 * e + 1] = i.y;
25003                  t[4 * e + 2] = i.z;
25004                  t[4 * e + 3] = i.w;
25005                },
25006                decompress: (t, e) => new Ui(t[4 * e], t[4 * e + 1], t[4 * e + 2], t[4 * e + 3])
25007              },
25008              [x_.Mat4]: {
25009                requiredUnits: 16,
25010                compress(t, e, i) {
25011                  qi.toArray(t, i, 16 * e);
25012                },
25013                decompress: (t, e) => qi.fromArray(new qi, t, 16 * e)
25014              }
25015            };
25016            m._decorator = wh;
25017            function B_() {
25018              return 0;
25019            }
25020            function D_(t) {
25021              return t;
25022            }
25023            function P_(t) {
25024              return t * t;
25025            }
25026            function O_(t) {
25027              return t * (2 - t);
25028            }
25029            function N_(t) {
25030              return (t *= 2) < 1 ? .5 * t * t : -.5 * (--t * (t - 2) - 1);
25031            }
25032            function L_(t) {
25033              return t * t * t;
25034            }
25035            function F_(t) {
25036              return --t * t * t + 1;
25037            }
25038            function V_(t) {
25039              return (t *= 2) < 1 ? .5 * t * t * t : .5 * ((t -= 2) * t * t + 2);
25040            }
25041            function k_(t) {
25042              return t * t * t * t;
25043            }
25044            function U_(t) {
25045              return 1 - --t * t * t * t;
25046            }
25047            function G_(t) {
25048              return (t *= 2) < 1 ? .5 * t * t * t * t : -.5 * ((t -= 2) * t * t * t - 2);
25049            }
25050            function z_(t) {
25051              return t * t * t * t * t;
25052            }
25053            function H_(t) {
25054              return --t * t * t * t * t + 1;
25055            }
25056            function j_(t) {
25057              return (t *= 2) < 1 ? .5 * t * t * t * t * t : .5 * ((t -= 2) * t * t * t * t + 2);
25058            }
25059            function X_(t) {
25060              return 1 === t ? 1 : 1 - Math.cos(t * Math.PI / 2);
25061            }
25062            function W_(t) {
25063              return Math.sin(t * Math.PI / 2);
25064            }
25065            function Y_(t) {
25066              return .5 * (1 - Math.cos(Math.PI * t));
25067            }
25068            function q_(t) {
25069              return 0 === t ? 0 : Math.pow(1024, t - 1);
25070            }
25071            function K_(t) {
25072              return 1 === t ? 1 : 1 - Math.pow(2, -10 * t);
25073            }
25074            function J_(t) {
25075              return 0 === t ? 0 : 1 === t ? 1 : (t *= 2) < 1 ? .5 * Math.pow(1024, t - 1) : .5 * (2 - Math.pow(2, -10 * (t - 1)));
25076            }
25077            function Z_(t) {
25078              return 1 - Math.sqrt(1 - t * t);
25079            }
25080            function Q_(t) {
25081              return Math.sqrt(1 - --t * t);
25082            }
25083            function $_(t) {
25084              return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
25085            }
25086            function td(t) {
25087              let e;
25088              let i = .1;
25089              if (0 === t) return 0;
25090              if (1 === t) return 1;
25091              if (!i || i < 1) {
25092                i = 1;
25093                e = .1;
25094              } else e = .4 * Math.asin(1 / i) / (2 * Math.PI);
25095              return -i * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / .4);
25096            }
25097            function ed(t) {
25098              let e;
25099              let i = .1;
25100              if (0 === t) return 0;
25101              if (1 === t) return 1;
25102              if (!i || i < 1) {
25103                i = 1;
25104                e = .1;
25105              } else e = .4 * Math.asin(1 / i) / (2 * Math.PI);
25106              return i * Math.pow(2, -10 * t) * Math.sin((t - e) * (2 * Math.PI) / .4) + 1;
25107            }
25108            function id(t) {
25109              let e;
25110              let i = .1;
25111              const s = .4;
25112              if (0 === t) return 0;
25113              if (1 === t) return 1;
25114              if (!i || i < 1) {
25115                i = 1;
25116                e = .1;
25117              } else e = s * Math.asin(1 / i) / (2 * Math.PI);
25118              return (t *= 2) < 1 ? i * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / s) * -.5 : i * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - e) * (2 * Math.PI) / s) * .5 + 1;
25119            }
25120            function sd(t) {
25121              if (1 === t) return 1;
25122              const e = 1.70158;
25123              return t * t * ((e + 1) * t - e);
25124            }
25125            function nd(t) {
25126              if (0 === t) return 0;
25127              const e = 1.70158;
25128              return --t * t * ((e + 1) * t + e) + 1;
25129            }
25130            function rd(t) {
25131              const e = 2.5949095;
25132              return (t *= 2) < 1 ? t * t * ((e + 1) * t - e) * .5 : .5 * ((t -= 2) * t * ((e + 1) * t + e) + 2);
25133            }
25134            function od(t) {
25135              return 1 - ad(1 - t);
25136            }
25137            function ad(t) {
25138              return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
25139            }
25140            function ld(t) {
25141              return t < .5 ? .5 * od(2 * t) : .5 * ad(2 * t - 1) + .5;
25142            }
25143            function hd(t) {
25144              return t <= 0 ? 0 : t >= 1 ? 1 : t * t * (3 - 2 * t);
25145            }
25146            function cd(t) {
25147              return t <= 0 ? 0 : t >= 1 ? 1 : t * t * t * (t * (6 * t - 15) + 10);
25148            }
25149            const ud = Ad(P_, O_);
25150            const _d = Ad(L_, F_);
25151            const dd = Ad(k_, U_);
25152            const pd = Ad(z_, H_);
25153            const md = Ad(X_, W_);
25154            const fd = Ad(q_, K_);
25155            const gd = Ad(Z_, Q_);
25156            const yd = Ad(td, ed);
25157            const bd = Ad(sd, nd);
25158            const Sd = Ad(od, ad);
25159            function Ad(t, e) {
25160              return i => i < .5 ? e(2 * i) / 2 : t(2 * i - 1) / 2 + .5;
25161            }
25162            var Td = Object.freeze({
25163              __proto__: null,
25164              constant: B_,
25165              linear: D_,
25166              quadIn: P_,
25167              quadOut: O_,
25168              quadInOut: N_,
25169              cubicIn: L_,
25170              cubicOut: F_,
25171              cubicInOut: V_,
25172              quartIn: k_,
25173              quartOut: U_,
25174              quartInOut: G_,
25175              quintIn: z_,
25176              quintOut: H_,
25177              quintInOut: j_,
25178              sineIn: X_,
25179              sineOut: W_,
25180              sineInOut: Y_,
25181              expoIn: q_,
25182              expoOut: K_,
25183              expoInOut: J_,
25184              circIn: Z_,
25185              circOut: Q_,
25186              circInOut: $_,
25187              elasticIn: td,
25188              elasticOut: ed,
25189              elasticInOut: id,
25190              backIn: sd,
25191              backOut: nd,
25192              backInOut: rd,
25193              bounceIn: od,
25194              bounceOut: ad,
25195              bounceInOut: ld,
25196              smooth: hd,
25197              fade: cd,
25198              quadOutIn: ud,
25199              cubicOutIn: _d,
25200              quartOutIn: dd,
25201              quintOutIn: pd,
25202              sineOutIn: md,
25203              expoOutIn: fd,
25204              circOutIn: gd,
25205              elasticOutIn: yd,
25206              backOutIn: bd,
25207              bounceOutIn: Sd
25208            });
25209            t("easing", Td);
25210            let vd;
25211            !function(t) {
25212              t[t.LINEAR = 0] = "LINEAR";
25213              t[t.CONSTANT = 1] = "CONSTANT";
25214              t[t.QUAD_IN = 2] = "QUAD_IN";
25215              t[t.QUAD_OUT = 3] = "QUAD_OUT";
25216              t[t.QUAD_IN_OUT = 4] = "QUAD_IN_OUT";
25217              t[t.QUAD_OUT_IN = 5] = "QUAD_OUT_IN";
25218              t[t.CUBIC_IN = 6] = "CUBIC_IN";
25219              t[t.CUBIC_OUT = 7] = "CUBIC_OUT";
25220              t[t.CUBIC_IN_OUT = 8] = "CUBIC_IN_OUT";
25221              t[t.CUBIC_OUT_IN = 9] = "CUBIC_OUT_IN";
25222              t[t.QUART_IN = 10] = "QUART_IN";
25223              t[t.QUART_OUT = 11] = "QUART_OUT";
25224              t[t.QUART_IN_OUT = 12] = "QUART_IN_OUT";
25225              t[t.QUART_OUT_IN = 13] = "QUART_OUT_IN";
25226              t[t.QUINT_IN = 14] = "QUINT_IN";
25227              t[t.QUINT_OUT = 15] = "QUINT_OUT";
25228              t[t.QUINT_IN_OUT = 16] = "QUINT_IN_OUT";
25229              t[t.QUINT_OUT_IN = 17] = "QUINT_OUT_IN";
25230              t[t.SINE_IN = 18] = "SINE_IN";
25231              t[t.SINE_OUT = 19] = "SINE_OUT";
25232              t[t.SINE_IN_OUT = 20] = "SINE_IN_OUT";
25233              t[t.SINE_OUT_IN = 21] = "SINE_OUT_IN";
25234              t[t.EXPO_IN = 22] = "EXPO_IN";
25235              t[t.EXPO_OUT = 23] = "EXPO_OUT";
25236              t[t.EXPO_IN_OUT = 24] = "EXPO_IN_OUT";
25237              t[t.EXPO_OUT_IN = 25] = "EXPO_OUT_IN";
25238              t[t.CIRC_IN = 26] = "CIRC_IN";
25239              t[t.CIRC_OUT = 27] = "CIRC_OUT";
25240              t[t.CIRC_IN_OUT = 28] = "CIRC_IN_OUT";
25241              t[t.CIRC_OUT_IN = 29] = "CIRC_OUT_IN";
25242              t[t.ELASTIC_IN = 30] = "ELASTIC_IN";
25243              t[t.ELASTIC_OUT = 31] = "ELASTIC_OUT";
25244              t[t.ELASTIC_IN_OUT = 32] = "ELASTIC_IN_OUT";
25245              t[t.ELASTIC_OUT_IN = 33] = "ELASTIC_OUT_IN";
25246              t[t.BACK_IN = 34] = "BACK_IN";
25247              t[t.BACK_OUT = 35] = "BACK_OUT";
25248              t[t.BACK_IN_OUT = 36] = "BACK_IN_OUT";
25249              t[t.BACK_OUT_IN = 37] = "BACK_OUT_IN";
25250              t[t.BOUNCE_IN = 38] = "BOUNCE_IN";
25251              t[t.BOUNCE_OUT = 39] = "BOUNCE_OUT";
25252              t[t.BOUNCE_IN_OUT = 40] = "BOUNCE_IN_OUT";
25253              t[t.BOUNCE_OUT_IN = 41] = "BOUNCE_OUT_IN";
25254              t[t.SMOOTH = 42] = "SMOOTH";
25255              t[t.FADE = 43] = "FADE";
25256            }(vd || (vd = {}));
25257            const Ed = {
25258              [vd.CONSTANT]: B_,
25259              [vd.LINEAR]: D_,
25260              [vd.QUAD_IN]: P_,
25261              [vd.QUAD_OUT]: O_,
25262              [vd.QUAD_IN_OUT]: N_,
25263              [vd.QUAD_OUT_IN]: ud,
25264              [vd.CUBIC_IN]: L_,
25265              [vd.CUBIC_OUT]: F_,
25266              [vd.CUBIC_IN_OUT]: V_,
25267              [vd.CUBIC_OUT_IN]: _d,
25268              [vd.QUART_IN]: k_,
25269              [vd.QUART_OUT]: U_,
25270              [vd.QUART_IN_OUT]: G_,
25271              [vd.QUART_OUT_IN]: dd,
25272              [vd.QUINT_IN]: z_,
25273              [vd.QUINT_OUT]: H_,
25274              [vd.QUINT_IN_OUT]: j_,
25275              [vd.QUINT_OUT_IN]: pd,
25276              [vd.SINE_IN]: X_,
25277              [vd.SINE_OUT]: W_,
25278              [vd.SINE_IN_OUT]: Y_,
25279              [vd.SINE_OUT_IN]: md,
25280              [vd.EXPO_IN]: q_,
25281              [vd.EXPO_OUT]: K_,
25282              [vd.EXPO_IN_OUT]: J_,
25283              [vd.EXPO_OUT_IN]: fd,
25284              [vd.CIRC_IN]: Z_,
25285              [vd.CIRC_OUT]: Q_,
25286              [vd.CIRC_IN_OUT]: $_,
25287              [vd.CIRC_OUT_IN]: gd,
25288              [vd.ELASTIC_IN]: td,
25289              [vd.ELASTIC_OUT]: ed,
25290              [vd.ELASTIC_IN_OUT]: id,
25291              [vd.ELASTIC_OUT_IN]: yd,
25292              [vd.BACK_IN]: sd,
25293              [vd.BACK_OUT]: nd,
25294              [vd.BACK_IN_OUT]: rd,
25295              [vd.BACK_OUT_IN]: bd,
25296              [vd.BOUNCE_IN]: od,
25297              [vd.BOUNCE_OUT]: ad,
25298              [vd.BOUNCE_IN_OUT]: ld,
25299              [vd.BOUNCE_OUT_IN]: Sd,
25300              [vd.SMOOTH]: hd,
25301              [vd.FADE]: cd
25302            };
25303            function Cd(t) {
25304              ne(t in Ed);
25305              return Ed[t];
25306            }
25307            const xd = 65280;
25308            const wd = 255 << 16;
25309            ne(8 === 0 + o(255));
25310            ne(16 === 8 + o(xd));
25311            const Rd = xl.LINEAR << 0 | Rl.NONE << 8 | vd.LINEAR << 16;
25312            class Id extends Ch {
25313              constructor(...t) {
25314                super(...t);
25315                this.value = 0;
25316                this.rightTangent = 0;
25317                this.rightTangentWeight = 0;
25318                this.leftTangent = 0;
25319                this.leftTangentWeight = 0;
25320                this._flags = Rd;
25321              }
25322              get interpolationMode() {
25323                return (255 & this._flags) >> 0;
25324              }
25325              set interpolationMode(t) {
25326                this._flags &= -256;
25327                this._flags |= t << 0;
25328              }
25329              get tangentWeightMode() {
25330                return (this._flags & xd) >> 8;
25331              }
25332              set tangentWeightMode(t) {
25333                this._flags &= -65281;
25334                this._flags |= t << 8;
25335              }
25336              get easingMethod() {
25337                return (this._flags & wd) >> 16;
25338              }
25339              set easingMethod(t) {
25340                this._flags &= -16711681;
25341                this._flags |= t << 16;
25342              }
25343            }
25344            si.fastDefine("cc.RealKeyframeValue", Id, {
25345              interpolationMode: xl.LINEAR,
25346              tangentWeightMode: Rl.NONE,
25347              value: 0,
25348              rightTangent: 0,
25349              rightTangentWeight: 0,
25350              leftTangent: 0,
25351              leftTangentWeight: 0,
25352              easingMethod: vd.LINEAR,
25353              [io]: void 0
25354            });
25355            si.Attr.setClassAttr(Id, io, "editorOnly", !0);
25356            (Md = Id, null !== (Dd = (Bd = Md)[Wl]) && void 0 !== Dd ? Dd : Bd[Wl] = {}).uniquelyReferenced = !0;
25357            var Md, Bd, Dd;
25358            function Pd(t) {
25359              const e = new Id;
25360              if ("number" == typeof t) e.value = t; else {
25361                const {interpolationMode: i, tangentWeightMode: s, value: n, rightTangent: r, rightTangentWeight: o, leftTangent: a, leftTangentWeight: l, easingMethod: h, [io]: c} = t;
25362                e.value = null != n ? n : e.value;
25363                e.rightTangent = null != r ? r : e.rightTangent;
25364                e.rightTangentWeight = null != o ? o : e.rightTangentWeight;
25365                e.leftTangent = null != a ? a : e.leftTangent;
25366                e.leftTangentWeight = null != l ? l : e.leftTangentWeight;
25367                e.interpolationMode = null != i ? i : e.interpolationMode;
25368                e.tangentWeightMode = null != s ? s : e.tangentWeightMode;
25369                e.easingMethod = null != h ? h : e.easingMethod;
25370                c && (e[io] = c);
25371              }
25372              return e;
25373            }
25374            class Od extends Cl {
25375              constructor(...t) {
25376                super(...t);
25377                this.preExtrapolation = wl.CLAMP;
25378                this.postExtrapolation = wl.CLAMP;
25379              }
25380              evaluate(t) {
25381                const {_times: e, _values: i} = this;
25382                const s = e.length;
25383                if (0 === s) return 0;
25384                const n = e[0];
25385                const r = e[s - 1];
25386                if (t < n) {
25387                  const {preExtrapolation: o} = this;
25388                  const a = i[0];
25389                  if (o === wl.CLAMP || s < 2) return a.value;
25390                  switch (o) {
25391                   case wl.LINEAR:
25392                    return Jd(n, i[0].value, e[1], i[1].value, t);
25393
25394                   case wl.LOOP:
25395                    t = qd(t, n, r);
25396                    break;
25397
25398                   case wl.PING_PONG:
25399                    t = Kd(t, n, r);
25400                    break;
25401
25402                   default:
25403                    return a.value;
25404                  }
25405                } else if (t > r) {
25406                  const {postExtrapolation: o} = this;
25407                  const a = i[s - 1];
25408                  if (o === wl.CLAMP || s < 2) return a.value;
25409                  switch (o) {
25410                   case wl.LINEAR:
25411                    return Jd(r, a.value, e[s - 2], i[s - 2].value, t);
25412
25413                   case wl.LOOP:
25414                    t = qd(t, n, r);
25415                    break;
25416
25417                   case wl.PING_PONG:
25418                    t = Kd(t, n, r);
25419                    break;
25420
25421                   default:
25422                    return a.value;
25423                  }
25424                }
25425                const o = vl(e, t);
25426                if (o >= 0) return i[o].value;
25427                const a = ~o;
25428                ne(0 !== a && a !== s && s > 1);
25429                const l = a - 1;
25430                const h = e[l];
25431                const c = i[l];
25432                const u = e[a];
25433                const _ = i[a];
25434                ne(u > t && t > h);
25435                return function(t, e, i, s, n) {
25436                  const r = i - t;
25437                  switch (e.interpolationMode) {
25438                   default:
25439                   case xl.CONSTANT:
25440                    return e.value;
25441
25442                   case xl.LINEAR:
25443                    {
25444                      const t = e.easingMethod === vd.LINEAR ? n : Cd(e.easingMethod)(n);
25445                      return pi(e.value, s.value, t);
25446                    }
25447
25448                   case xl.CUBIC:
25449                    {
25450                      const o = 1 / 3;
25451                      const {rightTangent: a, rightTangentWeight: l} = e;
25452                      const h = 0 != (e.tangentWeightMode & Rl.RIGHT);
25453                      const {leftTangent: c, leftTangentWeight: u} = s;
25454                      const _ = function(t) {
25455                        return 0 != (t & Rl.LEFT);
25456                      }(s.tangentWeightMode);
25457                      if (h || _) {
25458                        let d = 0;
25459                        if (h) d = l; else {
25460                          const t = r;
25461                          const e = r * a;
25462                          d = Math.sqrt(t * t + e * e) * o;
25463                        }
25464                        const p = Math.atan(a);
25465                        const m = Math.cos(p) * d + t;
25466                        const f = Math.sin(p) * d + e.value;
25467                        let g = 0;
25468                        if (_) g = u; else {
25469                          const t = r;
25470                          const e = r * c;
25471                          g = Math.sqrt(t * t + e * e) * o;
25472                        }
25473                        const y = Math.atan(c);
25474                        const b = (m - t) / r;
25475                        const S = (-Math.cos(y) * g + i - t) / r;
25476                        const A = f;
25477                        const T = -Math.sin(y) * g + s.value;
25478                        const v = [ 0, 0, 0 ];
25479                        const E = function(t, e, i, s, n) {
25480                          const r = i / s;
25481                          const o = e / s;
25482                          const a = r * r;
25483                          const l = 1 / 3 * (-1 / 3 * a + o);
25484                          const h = .5 * (2 / 27 * r * a - 1 / 3 * r * o + t / s);
25485                          const c = l * l * l;
25486                          const u = h * h + c;
25487                          let _ = 0;
25488                          if (Il(u)) {
25489                            if (Il(h)) {
25490                              n[0] = 0;
25491                              return 1;
25492                            }
25493                            {
25494                              const t = Math.cbrt(-h);
25495                              n[0] = 2 * t;
25496                              n[1] = -t;
25497                              return 2;
25498                            }
25499                          }
25500                          if (u < 0) {
25501                            const t = 1 / 3 * Math.acos(-h / Math.sqrt(-c));
25502                            const e = 2 * Math.sqrt(-l);
25503                            n[0] = e * Math.cos(t);
25504                            n[1] = -e * Math.cos(t + Math.PI / 3);
25505                            n[2] = -e * Math.cos(t - Math.PI / 3);
25506                            _ = 3;
25507                          } else {
25508                            const t = Math.sqrt(u);
25509                            const e = Math.cbrt(t - h);
25510                            const i = -Math.cbrt(t + h);
25511                            n[0] = e + i;
25512                            _ = 1;
25513                          }
25514                          const d = 1 / 3 * r;
25515                          for (let t = 0; t < _; ++t) n[t] -= d;
25516                          return _;
25517                        }(0 - n, 3 * b, 3 * S - 6 * b, 3 * (b - S) + 1, v);
25518                        const C = function(t, e, i) {
25519                          let s = i;
25520                          if (1 === e) s = t[0]; else {
25521                            s = -1 / 0;
25522                            for (let i = 0; i < e; ++i) {
25523                              const e = t[i];
25524                              e >= 0 && e <= 1 && e > s && (s = e);
25525                            }
25526                            s === -1 / 0 && (s = 0);
25527                          }
25528                          return s;
25529                        }(v, E, n);
25530                        return Zd(e.value, A, T, s.value, C);
25531                      }
25532                      {
25533                        const t = e.value + o * a * r;
25534                        const i = s.value - o * c * r;
25535                        return Zd(e.value, t, i, s.value, n);
25536                      }
25537                    }
25538                  }
25539                }(h, c, u, _, (t - h) / (u - h));
25540              }
25541              addKeyFrame(t, e) {
25542                return super.addKeyFrame(t, Pd(e));
25543              }
25544              assignSorted(t, e) {
25545                if (void 0 !== e) {
25546                  ne(Array.isArray(t));
25547                  this.setKeyframes(t.slice(), e.map((t => Pd(t))));
25548                } else {
25549                  const e = Array.from(t);
25550                  this.setKeyframes(e.map((([t]) => t)), e.map((([, t]) => Pd(t))));
25551                }
25552              }
25553              isConstant(t) {
25554                if (this._values.length <= 1) return !0;
25555                const e = this._values[0].value;
25556                return this._values.every((i => ui(i.value, e, t)));
25557              }
25558              [nu](t, e) {
25559                if (!e.toCCON) {
25560                  t.writeThis();
25561                  return;
25562                }
25563                const {_times: i, _values: s} = this;
25564                const n = i.length;
25565                const r = new DataView(new ArrayBuffer(0 + Ld + Ld + Fd + Vd * n + Xd * n));
25566                let o = 0;
25567                r.setUint8(o, this.preExtrapolation);
25568                o += Ld;
25569                r.setUint8(o, this.postExtrapolation);
25570                o += Ld;
25571                r.setUint32(o, n, !0);
25572                o += Fd;
25573                i.forEach(((t, e) => r.setFloat32(o + Vd * e, t, !0)));
25574                o += Vd * n;
25575                for (const t of s) o = Wd(r, t, o);
25576                const a = new Uint8Array(r.buffer, 0, o);
25577                t.writeProperty("bytes", a);
25578                const l = s.map((t => t[io]));
25579                l.some((t => void 0 !== t)) && t.writeProperty("keyframeValueEditorExtras", l);
25580              }
25581              [ru](t, e) {
25582                if (!e.fromCCON) {
25583                  t.readThis();
25584                  return;
25585                }
25586                const i = t.readProperty("bytes");
25587                const s = new DataView(i.buffer, i.byteOffset, i.byteLength);
25588                let n = 0;
25589                this.preExtrapolation = s.getUint8(n);
25590                n += Ld;
25591                this.postExtrapolation = s.getUint8(n);
25592                n += Ld;
25593                const r = s.getUint32(n, !0);
25594                n += Fd;
25595                const o = Array.from({
25596                  length: r
25597                }, ((t, e) => s.getFloat32(n + Vd * e, !0)));
25598                n += Vd * r;
25599                const a = new Array(r);
25600                for (let t = 0; t < r; ++t) {
25601                  const e = Pd({});
25602                  n = Yd(s, e, n);
25603                  a[t] = e;
25604                }
25605                ne(n === i.byteLength);
25606                const l = t.readProperty("keyframeValueEditorExtras");
25607                if (l) {
25608                  ne(l.length === r);
25609                  l.forEach(((t, e) => a[e][io] = t));
25610                }
25611                this._times = o;
25612                this._values = a;
25613              }
25614            }
25615            t("RealCurve", Od);
25616            si.fastDefine("cc.RealCurve", Od, {
25617              _times: [],
25618              _values: [],
25619              preExtrapolation: wl.CLAMP,
25620              postExtrapolation: wl.CLAMP
25621            });
25622            var Nd;
25623            !function(t) {
25624              t[t.VALUE = 1] = "VALUE";
25625              t[t.INTERPOLATION_MODE = 2] = "INTERPOLATION_MODE";
25626              t[t.TANGENT_WEIGHT_MODE = 4] = "TANGENT_WEIGHT_MODE";
25627              t[t.LEFT_TANGENT = 8] = "LEFT_TANGENT";
25628              t[t.LEFT_TANGENT_WEIGHT = 16] = "LEFT_TANGENT_WEIGHT";
25629              t[t.RIGHT_TANGENT = 32] = "RIGHT_TANGENT";
25630              t[t.RIGHT_TANGENT_WEIGHT = 64] = "RIGHT_TANGENT_WEIGHT";
25631            }(Nd || (Nd = {}));
25632            const Ld = 1;
25633            const Fd = 4;
25634            const Vd = 4;
25635            const {interpolationMode: kd, tangentWeightMode: Ud, leftTangent: Gd, leftTangentWeight: zd, rightTangent: Hd, rightTangentWeight: jd} = Pd({});
25636            const Xd = 26;
25637            function Wd(t, e, i) {
25638              let s = 0;
25639              let n = i;
25640              const r = n;
25641              n += 4;
25642              const {value: o, interpolationMode: a, tangentWeightMode: l, rightTangent: h, rightTangentWeight: c, leftTangent: u, leftTangentWeight: _, easingMethod: d} = e;
25643              t.setFloat32(n, o, !0);
25644              n += 4;
25645              if (a !== kd) {
25646                s |= Nd.INTERPOLATION_MODE;
25647                t.setUint8(n, a);
25648                n += 1;
25649              }
25650              if (l !== Ud) {
25651                s |= Nd.TANGENT_WEIGHT_MODE;
25652                t.setUint8(n, l);
25653                n += 1;
25654              }
25655              if (u !== Gd) {
25656                s |= Nd.LEFT_TANGENT;
25657                t.setFloat32(n, u, !0);
25658                n += 4;
25659              }
25660              if (_ !== zd) {
25661                s |= Nd.LEFT_TANGENT_WEIGHT;
25662                t.setFloat32(n, _, !0);
25663                n += 4;
25664              }
25665              if (h !== Hd) {
25666                s |= Nd.RIGHT_TANGENT;
25667                t.setFloat32(n, h, !0);
25668                n += 4;
25669              }
25670              if (c !== jd) {
25671                s |= Nd.RIGHT_TANGENT_WEIGHT;
25672                t.setFloat32(n, c, !0);
25673                n += 4;
25674              }
25675              s |= d << 8;
25676              t.setUint32(r, s, !0);
25677              return n;
25678            }
25679            function Yd(t, e, i) {
25680              let s = i;
25681              const n = t.getUint32(s, !0);
25682              s += 4;
25683              e.value = t.getFloat32(s, !0);
25684              s += 4;
25685              if (n & Nd.INTERPOLATION_MODE) {
25686                e.interpolationMode = t.getUint8(s);
25687                s += 1;
25688              }
25689              if (n & Nd.TANGENT_WEIGHT_MODE) {
25690                e.tangentWeightMode = t.getUint8(s);
25691                s += 1;
25692              }
25693              if (n & Nd.LEFT_TANGENT) {
25694                e.leftTangent = t.getFloat32(s, !0);
25695                s += 4;
25696              }
25697              if (n & Nd.LEFT_TANGENT_WEIGHT) {
25698                e.leftTangentWeight = t.getFloat32(s, !0);
25699                s += 4;
25700              }
25701              if (n & Nd.RIGHT_TANGENT) {
25702                e.rightTangent = t.getFloat32(s, !0);
25703                s += 4;
25704              }
25705              if (n & Nd.RIGHT_TANGENT_WEIGHT) {
25706                e.rightTangentWeight = t.getFloat32(s, !0);
25707                s += 4;
25708              }
25709              const r = (65280 & n) >> 8;
25710              e.easingMethod = r;
25711              return s;
25712            }
25713            function qd(t, e, i) {
25714              return e + Ei(t - e, i - e);
25715            }
25716            function Kd(t, e, i) {
25717              return e + Ci(t - e, i - e);
25718            }
25719            function Jd(t, e, i, s, n) {
25720              return e + (n - t) * ((s - e) / (i - t));
25721            }
25722            function Zd(t, e, i, s, n) {
25723              const r = 1 - n;
25724              return r * r * r * t + 3 * r * r * n * e + 3 * r * n * n * i + n * n * n * s;
25725            }
25726            function Qd(t, e, i, s, n) {
25727              const r = 1 - n;
25728              return r * (r * (t + (3 * e - t) * n) + 3 * i * n * n) + s * n * n * n;
25729            }
25730            m.bezier = Qd;
25731            const $d = Math.cos;
25732            const tp = Math.acos;
25733            const ep = Math.max;
25734            const ip = 2 * Math.PI;
25735            const sp = Math.sqrt;
25736            function np(t) {
25737              return t < 0 ? -Math.pow(-t, 1 / 3) : Math.pow(t, 1 / 3);
25738            }
25739            function rp(t, e) {
25740              const i = function(t, e) {
25741                const i = e - 0;
25742                const s = e - t[0];
25743                const n = 3 * i;
25744                const r = 3 * s;
25745                const o = 3 * (e - t[2]);
25746                const a = 1 / (-i + r - o + (e - 1));
25747                const l = 1 / 3;
25748                const h = (n - 6 * s + o) * a;
25749                const c = h * l;
25750                const u = (-n + r) * a;
25751                const _ = (3 * u - h * h) * l;
25752                const d = _ * l;
25753                const p = (2 * h * h * h - 9 * h * u + i * a * 27) / 27;
25754                const m = p / 2;
25755                const f = m * m + d * d * d;
25756                let g;
25757                let y;
25758                let b;
25759                let S;
25760                let A;
25761                if (f < 0) {
25762                  const t = -_ * l;
25763                  const e = sp(t * t * t);
25764                  const i = -p / (2 * e);
25765                  const s = tp(i < -1 ? -1 : i > 1 ? 1 : i);
25766                  const n = 2 * np(e);
25767                  b = n * $d(s * l) - c;
25768                  S = n * $d((s + ip) * l) - c;
25769                  A = n * $d((s + 2 * ip) * l) - c;
25770                  return b >= 0 && b <= 1 ? S >= 0 && S <= 1 ? A >= 0 && A <= 1 ? ep(b, S, A) : ep(b, S) : A >= 0 && A <= 1 ? ep(b, A) : b : S >= 0 && S <= 1 ? A >= 0 && A <= 1 ? ep(S, A) : S : A;
25771                }
25772                if (0 === f) {
25773                  g = m < 0 ? np(-m) : -np(m);
25774                  b = 2 * g - c;
25775                  S = -g - c;
25776                  return b >= 0 && b <= 1 ? S >= 0 && S <= 1 ? ep(b, S) : b : S;
25777                }
25778                {
25779                  const t = sp(f);
25780                  g = np(-m + t);
25781                  y = np(m + t);
25782                  b = g - y - c;
25783                  return b;
25784                }
25785              }(t, e);
25786              const s = t[1];
25787              return ((1 - i) * (s + (t[3] - s) * i) * 3 + i * i) * i;
25788            }
25789            m.bezierByTime = rp;
25790            var op, ap, lp, hp, cp, up, _p, dp, pp, mp, fp;
25791            let gp;
25792            !function(t) {
25793              t[t.SLERP = 0] = "SLERP";
25794              t[t.CONSTANT = 1] = "CONSTANT";
25795            }(gp || (gp = t("QuatInterpolationMode", {})));
25796            let yp = Ul("cc.QuatKeyframeValue")(op = Zl(op = (ap = (up = class {
25797              constructor({value: t, interpolationMode: e, easingMethod: i} = {}) {
25798                Ml(this, "interpolationMode", lp, this);
25799                Ml(this, "value", hp, this);
25800                Ml(this, "easingMethod", cp, this);
25801                this.value = t ? Ui.clone(t) : this.value;
25802                this.interpolationMode = null != e ? e : this.interpolationMode;
25803                this.easingMethod = null != i ? i : this.easingMethod;
25804              }
25805            }, up), lp = Bl(ap.prototype, "interpolationMode", [ Yl ], {
25806              configurable: !0,
25807              enumerable: !0,
25808              writable: !0,
25809              initializer: function() {
25810                return gp.SLERP;
25811              }
25812            }), hp = Bl(ap.prototype, "value", [ Yl ], {
25813              configurable: !0,
25814              enumerable: !0,
25815              writable: !0,
25816              initializer: function() {
25817                return Ui.clone(Ui.IDENTITY);
25818              }
25819            }), cp = Bl(ap.prototype, "easingMethod", [ Yl ], {
25820              configurable: !0,
25821              enumerable: !0,
25822              writable: !0,
25823              initializer: function() {
25824                return vd.LINEAR;
25825              }
25826            }), ap)) || op) || op;
25827            function bp(t) {
25828              return new yp(t);
25829            }
25830            let Sp = t("QuatCurve", Ul("cc.QuatCurve")(_p = (dp = (fp = class extends Cl {
25831              constructor(...t) {
25832                super(...t);
25833                Ml(this, "preExtrapolation", pp, this);
25834                Ml(this, "postExtrapolation", mp, this);
25835              }
25836              evaluate(t, e) {
25837                var i;
25838                null !== (i = e) && void 0 !== i || (e = new Ui);
25839                const {_times: s, _values: n, postExtrapolation: r, preExtrapolation: o} = this;
25840                const a = s.length;
25841                if (0 === a) return e;
25842                const l = s[0];
25843                const h = s[a - 1];
25844                if (t < l) {
25845                  const i = n[0];
25846                  switch (o) {
25847                   case wl.LOOP:
25848                    t = l + Ei(t - l, h - l);
25849                    break;
25850
25851                   case wl.PING_PONG:
25852                    t = l + Ci(t - l, h - l);
25853                    break;
25854
25855                   case wl.CLAMP:
25856                   default:
25857                    return Ui.copy(e, i.value);
25858                  }
25859                } else if (t > h) {
25860                  const i = n[a - 1];
25861                  switch (r) {
25862                   case wl.LOOP:
25863                    t = l + Ei(t - l, h - l);
25864                    break;
25865
25866                   case wl.PING_PONG:
25867                    t = l + Ci(t - l, h - l);
25868                    break;
25869
25870                   case wl.CLAMP:
25871                   default:
25872                    return Ui.copy(e, i.value);
25873                  }
25874                }
25875                const c = vl(s, t);
25876                if (c >= 0) return Ui.copy(e, n[c].value);
25877                const u = ~c;
25878                ne(0 !== u && u !== a && a > 1);
25879                const _ = u - 1;
25880                const d = s[_];
25881                const p = n[_];
25882                const m = s[u];
25883                const f = n[u];
25884                ne(m > t && t > d);
25885                const g = (t - d) / (m - d);
25886                switch (p.interpolationMode) {
25887                 default:
25888                 case gp.CONSTANT:
25889                  return Ui.copy(e, p.value);
25890
25891                 case gp.SLERP:
25892                  {
25893                    const {easingMethod: t} = p;
25894                    const i = t === vd.LINEAR ? g : Array.isArray(t) ? rp(t, g) : Cd(t)(g);
25895                    return Ui.slerp(e, p.value, f.value, i);
25896                  }
25897                }
25898              }
25899              addKeyFrame(t, e) {
25900                const i = new yp(e);
25901                return super.addKeyFrame(t, i);
25902              }
25903              assignSorted(t, e) {
25904                if (void 0 !== e) {
25905                  ne(Array.isArray(t));
25906                  this.setKeyframes(t.slice(), e.map((t => bp(t))));
25907                } else {
25908                  const e = Array.from(t);
25909                  this.setKeyframes(e.map((([t]) => t)), e.map((([, t]) => bp(t))));
25910                }
25911              }
25912              [nu](t, e) {
25913                if (!e.toCCON) {
25914                  t.writeThis();
25915                  return;
25916                }
25917                const {_times: i, _values: s} = this;
25918                let n = !0;
25919                s.forEach(((t, e, [i]) => {
25920                  n && t.interpolationMode !== i.interpolationMode && (n = !1);
25921                }));
25922                const r = i.length;
25923                const o = xp * (n ? 1 : r);
25924                const a = s.reduce(((t, {easingMethod: e}) => t + (Array.isArray(e) ? wp + 4 * Ip : wp)), 0);
25925                let l = 0;
25926                l += Tp + vp + Ep * r + 4 * Cp * r + a + o + 0;
25927                const h = new DataView(new ArrayBuffer(l));
25928                let c = 0;
25929                let u = 0;
25930                n && (u |= Ap.INTERPOLATION_MODE);
25931                h.setUint32(c, u, !0);
25932                c += Tp;
25933                h.setUint32(c, r, !0);
25934                c += vp;
25935                i.forEach(((t, e) => h.setFloat32(c + Ep * e, t, !0)));
25936                c += Ep * r;
25937                s.forEach((({value: {x: t, y: e, z: i, w: s}}, n) => {
25938                  const r = c + 4 * Cp * n;
25939                  h.setFloat32(r + 0 * Cp, t, !0);
25940                  h.setFloat32(r + 1 * Cp, e, !0);
25941                  h.setFloat32(r + 2 * Cp, i, !0);
25942                  h.setFloat32(r + 3 * Cp, s, !0);
25943                }));
25944                c += 4 * Cp * r;
25945                s.forEach((({easingMethod: t}, e) => {
25946                  if (Array.isArray(t)) {
25947                    h.setUint8(c, Rp);
25948                    ++c;
25949                    h.setFloat32(c + 0 * Ip, t[0], !0);
25950                    h.setFloat32(c + 1 * Ip, t[1], !0);
25951                    h.setFloat32(c + 2 * Ip, t[2], !0);
25952                    h.setFloat32(c + 3 * Ip, t[3], !0);
25953                    c += 4 * Ip;
25954                  } else {
25955                    h.setUint8(c, t);
25956                    ++c;
25957                  }
25958                }));
25959                const _ = c;
25960                c += o;
25961                let d = _;
25962                s.forEach((({interpolationMode: t}) => {
25963                  h.setUint8(d, t);
25964                  n || (d += xp);
25965                }));
25966                const p = new Uint8Array(h.buffer);
25967                t.writeProperty("bytes", p);
25968              }
25969              [ru](t, e) {
25970                if (!e.fromCCON) {
25971                  t.readThis();
25972                  return;
25973                }
25974                const i = t.readProperty("bytes");
25975                const s = new DataView(i.buffer, i.byteOffset, i.byteLength);
25976                let n = 0;
25977                const r = s.getUint32(n, !0);
25978                n += Tp;
25979                const o = r & Ap.INTERPOLATION_MODE;
25980                const a = s.getUint32(n, !0);
25981                n += vp;
25982                const l = Array.from({
25983                  length: a
25984                }, ((t, e) => s.getFloat32(n + Ep * e, !0)));
25985                n += Ep * a;
25986                const h = n;
25987                n += 4 * Cp * a;
25988                const c = Array.from({
25989                  length: a
25990                }, ((t, e) => {
25991                  const i = h + 4 * Cp * e;
25992                  const r = s.getFloat32(i + 0 * Cp, !0);
25993                  const o = s.getFloat32(i + 1 * Cp, !0);
25994                  const a = s.getFloat32(i + 2 * Cp, !0);
25995                  const l = s.getFloat32(i + 3 * Cp, !0);
25996                  const c = s.getUint8(n);
25997                  ++n;
25998                  const u = bp({
25999                    value: {
26000                      x: r,
26001                      y: o,
26002                      z: a,
26003                      w: l
26004                    }
26005                  });
26006                  if (c !== Rp) u.easingMethod = c; else {
26007                    u.easingMethod = [ s.getFloat32(n + 0 * Ip, !0), s.getFloat32(n + 1 * Ip, !0), s.getFloat32(n + 2 * Ip, !0), s.getFloat32(n + 3 * Ip, !0) ];
26008                    n += 4 * Ip;
26009                  }
26010                  return u;
26011                }));
26012                if (o) {
26013                  const t = s.getUint8(n);
26014                  ++n;
26015                  for (let e = 0; e < a; ++e) c[e].interpolationMode = t;
26016                } else {
26017                  for (let t = 0; t < a; ++t) {
26018                    const e = s.getUint8(n + t);
26019                    c[t].interpolationMode = e;
26020                  }
26021                  n += a;
26022                }
26023                this._times = l;
26024                this._values = c;
26025              }
26026            }, fp), pp = Bl(dp.prototype, "preExtrapolation", [ Yl ], {
26027              configurable: !0,
26028              enumerable: !0,
26029              writable: !0,
26030              initializer: function() {
26031                return wl.CLAMP;
26032              }
26033            }), mp = Bl(dp.prototype, "postExtrapolation", [ Yl ], {
26034              configurable: !0,
26035              enumerable: !0,
26036              writable: !0,
26037              initializer: function() {
26038                return wl.CLAMP;
26039              }
26040            }), dp)) || _p);
26041            var Ap;
26042            !function(t) {
26043              t[t.INTERPOLATION_MODE = 1] = "INTERPOLATION_MODE";
26044            }(Ap || (Ap = {}));
26045            const Tp = 1;
26046            const vp = 4;
26047            const Ep = 4;
26048            const Cp = 4;
26049            const xp = 1;
26050            const wp = 1;
26051            const Rp = 255;
26052            const Ip = 4;
26053            var Mp;
26054            let Bp = t("ObjectCurve", Ul("cc.ObjectCurve")(Mp = class extends Cl {
26055              evaluate(t) {
26056                const e = this.searchKeyframe(t);
26057                if (e >= 0) return this._values[e];
26058                const i = _i(~e - 1, 0, this._values.length - 1);
26059                return this._values[i];
26060              }
26061            }) || Mp);
26062            class Dp {
26063              constructor() {
26064                this.time = 0;
26065                this.value = 0;
26066                this.inTangent = 0;
26067                this.outTangent = 0;
26068              }
26069            }
26070            si.fastDefine("cc.Keyframe", Dp, {
26071              time: 0,
26072              value: 0,
26073              inTangent: 0,
26074              outTangent: 0
26075            });
26076            class Pp {
26077              constructor() {
26078                this.index = void 0;
26079                this.time = void 0;
26080                this.endTime = void 0;
26081                this.coefficient = void 0;
26082                this.index = -1;
26083                this.time = 0;
26084                this.endTime = 0;
26085                this.coefficient = new Float32Array(4);
26086              }
26087              evaluate(t) {
26088                return function(t, e) {
26089                  return t * (t * (t * e[0] + e[1]) + e[2]) + e[3];
26090                }(t - this.time, this.coefficient);
26091              }
26092            }
26093            class Op {
26094              get _internalCurve() {
26095                return this._curve;
26096              }
26097              get keyFrames() {
26098                return Array.from(this._curve.keyframes()).map((([t, e]) => {
26099                  const i = new Dp;
26100                  i.time = t;
26101                  i.value = e.value;
26102                  i.inTangent = e.leftTangent;
26103                  i.outTangent = e.rightTangent;
26104                  return i;
26105                }));
26106              }
26107              set keyFrames(t) {
26108                this._curve.assignSorted(t.map((t => [ t.time, {
26109                  interpolationMode: xl.CUBIC,
26110                  value: t.value,
26111                  leftTangent: t.inTangent,
26112                  rightTangent: t.outTangent
26113                } ])));
26114              }
26115              get preWrapMode() {
26116                return Lp(this._curve.preExtrapolation);
26117              }
26118              set preWrapMode(t) {
26119                this._curve.preExtrapolation = Np(t);
26120              }
26121              get postWrapMode() {
26122                return Lp(this._curve.postExtrapolation);
26123              }
26124              set postWrapMode(t) {
26125                this._curve.postExtrapolation = Np(t);
26126              }
26127              constructor(t = null) {
26128                this.cachedKey = void 0;
26129                if (t instanceof Od) this._curve = t; else {
26130                  const e = new Od;
26131                  this._curve = e;
26132                  e.preExtrapolation = wl.LOOP;
26133                  e.postExtrapolation = wl.CLAMP;
26134                  t ? e.assignSorted(t.map((t => [ t.time, {
26135                    interpolationMode: xl.CUBIC,
26136                    value: t.value,
26137                    leftTangent: t.inTangent,
26138                    rightTangent: t.outTangent
26139                  } ]))) : e.assignSorted([ [ 0, {
26140                    interpolationMode: xl.CUBIC,
26141                    value: 1
26142                  } ], [ 1, {
26143                    interpolationMode: xl.CUBIC,
26144                    value: 1
26145                  } ] ]);
26146                }
26147                this.cachedKey = new Pp;
26148              }
26149              addKey(t) {
26150                t ? this._curve.addKeyFrame(t.time, {
26151                  interpolationMode: xl.CUBIC,
26152                  value: t.value,
26153                  leftTangent: t.inTangent,
26154                  rightTangent: t.outTangent
26155                }) : this._curve.clear();
26156              }
26157              evaluate_slow(t) {
26158                return this._curve.evaluate(t);
26159              }
26160              evaluate(t) {
26161                const {cachedKey: e, _curve: i} = this;
26162                const s = i.keyFramesCount - 1;
26163                let n = t;
26164                const r = t < 0 ? i.preExtrapolation : i.postExtrapolation;
26165                const o = i.getKeyframeTime(0);
26166                const a = i.getKeyframeTime(s);
26167                switch (r) {
26168                 case wl.LOOP:
26169                  n = Ei(t - o, a - o) + o;
26170                  break;
26171
26172                 case wl.PING_PONG:
26173                  n = Ci(t - o, a - o) + o;
26174                  break;
26175
26176                 case wl.CLAMP:
26177                 default:
26178                  n = _i(t, o, a);
26179                }
26180                if (n >= e.time && n < e.endTime) return e.evaluate(n);
26181                const l = this.findIndex(e, n);
26182                const h = Math.min(l + 1, s);
26183                this.calcOptimizedKey(e, l, h);
26184                return e.evaluate(n);
26185              }
26186              calcOptimizedKey(t, e, i) {
26187                const s = this._curve.getKeyframeTime(e);
26188                const n = this._curve.getKeyframeTime(i);
26189                const {value: r, leftTangent: o} = this._curve.getKeyframeValue(e);
26190                const {value: a, rightTangent: l} = this._curve.getKeyframeValue(i);
26191                t.index = e;
26192                t.time = s;
26193                t.endTime = n;
26194                const h = n - s;
26195                const c = a - r;
26196                const u = 1 / (h * h);
26197                const _ = o * h;
26198                const d = l * h;
26199                t.coefficient[0] = (_ + d - c - c) * u / h;
26200                t.coefficient[1] = (c + c + c - _ - _ - d) * u;
26201                t.coefficient[2] = o;
26202                t.coefficient[3] = r;
26203              }
26204              findIndex(t, e) {
26205                const {_curve: i} = this;
26206                const s = i.keyFramesCount;
26207                const n = t.index;
26208                if (-1 !== n) {
26209                  if (e > i.getKeyframeTime(n)) for (let t = 0; t < 3; t++) {
26210                    const r = n + t;
26211                    if (r + 1 < s && i.getKeyframeTime(r + 1) > e) return r;
26212                  } else for (let t = 0; t < 3; t++) {
26213                    const s = n - t;
26214                    if (s >= 0 && i.getKeyframeTime(s - 1) <= e) return s - 1;
26215                  }
26216                }
26217                let r = 0;
26218                let o = s;
26219                let a;
26220                for (;o - r > 1; ) {
26221                  a = Math.floor((r + o) / 2);
26222                  i.getKeyframeTime(a) >= e ? o = a : r = a;
26223                }
26224                return r;
26225              }
26226            }
26227            Op.defaultKF = [ {
26228              time: 0,
26229              value: 1,
26230              inTangent: 0,
26231              outTangent: 0
26232            }, {
26233              time: 1,
26234              value: 1,
26235              inTangent: 0,
26236              outTangent: 0
26237            } ];
26238            si.fastDefine("cc.AnimationCurve", Op, {
26239              _curve: null
26240            });
26241            function Np(t) {
26242              switch (t) {
26243               default:
26244               case Sl.Default:
26245               case Sl.Normal:
26246               case Sl.Clamp:
26247                return wl.CLAMP;
26248
26249               case Sl.PingPong:
26250                return wl.PING_PONG;
26251
26252               case Sl.Loop:
26253                return wl.LOOP;
26254              }
26255            }
26256            function Lp(t) {
26257              switch (t) {
26258               default:
26259               case wl.LINEAR:
26260               case wl.CLAMP:
26261                return Sl.Clamp;
26262
26263               case wl.PING_PONG:
26264                return Sl.PingPong;
26265
26266               case wl.LOOP:
26267                return Sl.Loop;
26268              }
26269            }
26270            function Fp() {
26271              const t = new Od;
26272              t.assignSorted([ [ 0, {
26273                interpolationMode: xl.CUBIC,
26274                value: 1
26275              } ], [ 1, {
26276                interpolationMode: xl.CUBIC,
26277                value: 1
26278              } ] ]);
26279              return t;
26280            }
26281            let Vp;
26282            !function(t) {
26283              t[t.LINEAR = 0] = "LINEAR";
26284              t[t.BEZIER = 1] = "BEZIER";
26285              t[t.CATMULL_ROM = 2] = "CATMULL_ROM";
26286            }(Vp || (Vp = {}));
26287            const kp = 4294967295;
26288            const Up = new Pi;
26289            const Gp = new Pi;
26290            const zp = new Pi;
26291            const Hp = new Pi;
26292            class jp {
26293              constructor(t = Vp.CATMULL_ROM, e = []) {
26294                this._type = void 0;
26295                this._mode = Vp.CATMULL_ROM;
26296                this._knots = [];
26297                this._type = sa.SHAPE_SPLINE;
26298                this._mode = t;
26299                for (let t = 0; t < e.length; t++) this._knots[t] = new Pi(e[t]);
26300              }
26301              static create(t, e = []) {
26302                return new jp(t, e);
26303              }
26304              static clone(t) {
26305                return new jp(t.mode, t.knots);
26306              }
26307              static copy(t, e) {
26308                t._mode = e.mode;
26309                t._knots.length = 0;
26310                const i = e.knots;
26311                const s = i.length;
26312                for (let e = 0; e < s; e++) t._knots[e] = new Pi(i[e]);
26313                return t;
26314              }
26315              get type() {
26316                return this._type;
26317              }
26318              get mode() {
26319                return this._mode;
26320              }
26321              get knots() {
26322                return this._knots;
26323              }
26324              setModeAndKnots(t, e) {
26325                this._mode = t;
26326                this._knots.length = 0;
26327                for (let t = 0; t < e.length; t++) this._knots[t] = new Pi(e[t]);
26328              }
26329              clearKnots() {
26330                this._knots.length = 0;
26331              }
26332              getKnotCount() {
26333                return this._knots.length;
26334              }
26335              addKnot(t) {
26336                this._knots.push(new Pi(t));
26337              }
26338              insertKnot(t, e) {
26339                const i = new Pi(e);
26340                t >= this._knots.length ? this._knots.push(i) : this._knots.splice(t, 0, i);
26341              }
26342              removeKnot(t) {
26343                ne(t >= 0 && t < this._knots.length, "Spline: invalid index");
26344                this._knots.splice(t, 1);
26345              }
26346              setKnot(t, e) {
26347                ne(t >= 0 && t < this._knots.length, "Spline: invalid index");
26348                this._knots[t].set(e);
26349              }
26350              getKnot(t) {
26351                ne(t >= 0 && t < this._knots.length, "Spline: invalid index");
26352                return this._knots[t];
26353              }
26354              getPoint(t, e = 4294967295) {
26355                t = _i(t, 0, 1);
26356                const i = this.getSegments();
26357                if (0 == i) return new Pi(0, 0, 0);
26358                if (e == kp) {
26359                  const s = 1 / i;
26360                  e = Math.floor(t / s);
26361                  t = t % s / s;
26362                }
26363                if (e >= i) return new Pi(this._knots[this._knots.length - 1]);
26364                switch (this._mode) {
26365                 case Vp.LINEAR:
26366                  return jp.calcLinear(this._knots[e], this._knots[e + 1], t);
26367
26368                 case Vp.BEZIER:
26369                  return jp.calcBezier(this._knots[4 * e], this._knots[4 * e + 1], this._knots[4 * e + 2], this._knots[4 * e + 3], t);
26370
26371                 case Vp.CATMULL_ROM:
26372                  {
26373                    const i = e > 0 ? this._knots[e - 1] : this._knots[e];
26374                    const s = e + 2 < this._knots.length ? this._knots[e + 2] : this._knots[e + 1];
26375                    return jp.calcCatmullRom(i, this._knots[e], this._knots[e + 1], s, t);
26376                  }
26377
26378                 default:
26379                  return new Pi(0, 0, 0);
26380                }
26381              }
26382              getPoints(t, e = 4294967295) {
26383                if (0 == t) return [];
26384                if (1 == t) {
26385                  return [ this.getPoint(0, e) ];
26386                }
26387                const i = [];
26388                const s = 1 / (t - 1);
26389                for (let n = 0; n < t; n++) {
26390                  const t = n * s;
26391                  const r = this.getPoint(t, e);
26392                  i.push(r);
26393                }
26394                return i;
26395              }
26396              getSegments() {
26397                const t = this._knots.length;
26398                switch (this._mode) {
26399                 case Vp.LINEAR:
26400                 case Vp.CATMULL_ROM:
26401                  if (t < 2) {
26402                    N(14300);
26403                    return 0;
26404                  }
26405                  return t - 1;
26406
26407                 case Vp.BEZIER:
26408                  if (t < 4 || t % 4 != 0) {
26409                    N(14301);
26410                    return 0;
26411                  }
26412                  return t / 4;
26413
26414                 default:
26415                  ne(!1, "Spline error: invalid mode");
26416                }
26417              }
26418              static calcLinear(t, e, i) {
26419                const s = new Pi;
26420                Pi.multiplyScalar(Up, t, 1 - i);
26421                Pi.multiplyScalar(Gp, e, i);
26422                Pi.add(s, Up, Gp);
26423                return s;
26424              }
26425              static calcBezier(t, e, i, s, n) {
26426                const r = new Pi;
26427                const o = 1 - n;
26428                Pi.multiplyScalar(Up, t, o * o * o);
26429                Pi.multiplyScalar(Gp, e, 3 * n * o * o);
26430                Pi.multiplyScalar(zp, i, 3 * n * n * o);
26431                Pi.multiplyScalar(Hp, s, n * n * n);
26432                Pi.add(Up, Up, Gp);
26433                Pi.add(zp, zp, Hp);
26434                Pi.add(r, Up, zp);
26435                return r;
26436              }
26437              static calcCatmullRom(t, e, i, s, n) {
26438                const r = new Pi;
26439                const o = n * n;
26440                const a = o * n;
26441                Pi.multiplyScalar(Up, t, -.5 * a + o - .5 * n);
26442                Pi.multiplyScalar(Gp, e, 1.5 * a - 2.5 * o + 1);
26443                Pi.multiplyScalar(zp, i, -1.5 * a + 2 * o + .5 * n);
26444                Pi.multiplyScalar(Hp, s, .5 * a - .5 * o);
26445                Pi.add(Up, Up, Gp);
26446                Pi.add(zp, zp, Hp);
26447                Pi.add(r, Up, zp);
26448                return r;
26449              }
26450            }
26451            W(Za, "intersect", [ {
26452              name: "ray_aabb",
26453              newName: "rayAABB"
26454            }, {
26455              name: "ray_plane",
26456              newName: "rayPlane"
26457            }, {
26458              name: "ray_triangle",
26459              newName: "rayTriangle"
26460            }, {
26461              name: "ray_sphere",
26462              newName: "raySphere"
26463            }, {
26464              name: "ray_obb",
26465              newName: "rayOBB"
26466            }, {
26467              name: "ray_capsule",
26468              newName: "rayCapsule"
26469            }, {
26470              name: "ray_subMesh",
26471              newName: "raySubMesh"
26472            }, {
26473              name: "ray_mesh",
26474              newName: "rayMesh"
26475            }, {
26476              name: "ray_model",
26477              newName: "rayModel"
26478            }, {
26479              name: "line_plane",
26480              newName: "linePlane"
26481            }, {
26482              name: "line_triangle",
26483              newName: "lineTriangle"
26484            }, {
26485              name: "line_aabb",
26486              newName: "lineAABB"
26487            }, {
26488              name: "line_obb",
26489              newName: "lineOBB"
26490            }, {
26491              name: "line_sphere",
26492              newName: "lineSphere"
26493            }, {
26494              name: "aabb_aabb",
26495              newName: "aabbWithAABB"
26496            }, {
26497              name: "aabb_obb",
26498              newName: "aabbWithOBB"
26499            }, {
26500              name: "aabb_plane",
26501              newName: "aabbPlane"
26502            }, {
26503              name: "aabb_frustum",
26504              newName: "aabbFrustum"
26505            }, {
26506              name: "aabbFrustum_accurate",
26507              newName: "aabbFrustumAccurate"
26508            }, {
26509              name: "obb_point",
26510              newName: "obbPoint"
26511            }, {
26512              name: "obb_plane",
26513              newName: "obbPlane"
26514            }, {
26515              name: "obb_frustum",
26516              newName: "obbFrustum"
26517            }, {
26518              name: "obbFrustum_accurate",
26519              newName: "obbFrustumAccurate"
26520            }, {
26521              name: "obb_obb",
26522              newName: "obbWithOBB"
26523            }, {
26524              name: "obb_capsule",
26525              newName: "obbCapsule"
26526            }, {
26527              name: "sphere_plane",
26528              newName: "spherePlane"
26529            }, {
26530              name: "sphere_frustum",
26531              newName: "sphereFrustum"
26532            }, {
26533              name: "sphereFrustum_accurate",
26534              newName: "sphereFrustumAccurate"
26535            }, {
26536              name: "sphere_sphere",
26537              newName: "sphereWithSphere"
26538            }, {
26539              name: "sphere_aabb",
26540              newName: "sphereAABB"
26541            }, {
26542              name: "sphere_obb",
26543              newName: "sphereOBB"
26544            }, {
26545              name: "sphere_capsule",
26546              newName: "sphereCapsule"
26547            }, {
26548              name: "capsule_capsule",
26549              newName: "capsuleWithCapsule"
26550            } ]);
26551            function Xp(t, e) {
26552              console.warn(`${t} is deprecated, please use ${e} instead.`);
26553            }
26554            var Wp = Object.freeze({
26555              __proto__: null,
26556              distance: ia,
26557              enums: sa,
26558              intersect: Za,
26559              Line: na,
26560              Plane: il,
26561              Ray: ra,
26562              Triangle: _a,
26563              Sphere: ua,
26564              AABB: hl,
26565              OBB: dl,
26566              Capsule: pl,
26567              Frustum: bl,
26568              Keyframe: Dp,
26569              AnimationCurve: Op,
26570              get SplineMode() {
26571                return Vp;
26572              },
26573              Spline: jp,
26574              get ERaycastMode() {
26575                return da;
26576              },
26577              line: class extends na {
26578                constructor() {
26579                  super();
26580                  Xp("line", "Line");
26581                }
26582              },
26583              plane: class extends il {
26584                constructor() {
26585                  super();
26586                  Xp("plane", "Plane");
26587                }
26588              },
26589              ray: class extends ra {
26590                constructor() {
26591                  super();
26592                  Xp("ray", "Ray");
26593                }
26594              },
26595              triangle: class extends _a {
26596                constructor() {
26597                  super();
26598                  Xp("triangle", "Triangle");
26599                }
26600              },
26601              sphere: class extends ua {
26602                constructor() {
26603                  super();
26604                  Xp("sphere", "Sphere");
26605                }
26606              },
26607              aabb: class extends hl {
26608                constructor() {
26609                  super();
26610                  Xp("aabb", "AABB");
26611                }
26612              },
26613              obb: class extends dl {
26614                constructor() {
26615                  super();
26616                  Xp("obb", "OBB");
26617                }
26618              },
26619              capsule: class extends pl {
26620                constructor() {
26621                  super();
26622                  Xp("capsule", "Capsule");
26623                }
26624              },
26625              frustum: class extends bl {
26626                constructor() {
26627                  super();
26628                  Xp("frustum", "Frustum");
26629                }
26630              }
26631            });
26632            t("geometry", Wp);
26633            const Yp = t("EffectAsset", jsb.EffectAsset);
26634            m.EffectAsset = Yp;
26635            Yp.prototype._ctor = function() {
26636              jsb.Asset.prototype._ctor.apply(this, arguments);
26637              this.hideInEditor = !1;
26638            };
26639            const qp = Yp.prototype;
26640            Yl(qp, "techniques");
26641            Yl(qp, "shaders");
26642            Yl(qp, "combinations");
26643            Kl(qp, "hideInEditor");
26644            Yl(qp, "hideInEditor");
26645            Ul("cc.EffectAsset")(Yp);
26646            const Kp = 1024;
26647            let Jp;
26648            !function(t) {
26649              t[t.RGB565 = bs.R5G6B5] = "RGB565";
26650              t[t.RGB5A1 = bs.RGB5A1] = "RGB5A1";
26651              t[t.RGBA4444 = bs.RGBA4] = "RGBA4444";
26652              t[t.RGB888 = bs.RGB8] = "RGB888";
26653              t[t.RGB32F = bs.RGB32F] = "RGB32F";
26654              t[t.RGBA8888 = bs.RGBA8] = "RGBA8888";
26655              t[t.RGBA32F = bs.RGBA32F] = "RGBA32F";
26656              t[t.A8 = bs.A8] = "A8";
26657              t[t.I8 = bs.L8] = "I8";
26658              t[t.AI8 = bs.LA8] = "AI8";
26659              t[t.RGB_PVRTC_2BPPV1 = bs.PVRTC_RGB2] = "RGB_PVRTC_2BPPV1";
26660              t[t.RGBA_PVRTC_2BPPV1 = bs.PVRTC_RGBA2] = "RGBA_PVRTC_2BPPV1";
26661              t[t.RGB_A_PVRTC_2BPPV1 = Kp] = "RGB_A_PVRTC_2BPPV1";
26662              t[t.RGB_PVRTC_4BPPV1 = bs.PVRTC_RGB4] = "RGB_PVRTC_4BPPV1";
26663              t[t.RGBA_PVRTC_4BPPV1 = bs.PVRTC_RGBA4] = "RGBA_PVRTC_4BPPV1";
26664              t[t.RGB_A_PVRTC_4BPPV1 = 1025] = "RGB_A_PVRTC_4BPPV1";
26665              t[t.RGB_ETC1 = bs.ETC_RGB8] = "RGB_ETC1";
26666              t[t.RGBA_ETC1 = 1026] = "RGBA_ETC1";
26667              t[t.RGB_ETC2 = bs.ETC2_RGB8] = "RGB_ETC2";
26668              t[t.RGBA_ETC2 = bs.ETC2_RGBA8] = "RGBA_ETC2";
26669              t[t.RGBA_ASTC_4x4 = bs.ASTC_RGBA_4X4] = "RGBA_ASTC_4x4";
26670              t[t.RGBA_ASTC_5x4 = bs.ASTC_RGBA_5X4] = "RGBA_ASTC_5x4";
26671              t[t.RGBA_ASTC_5x5 = bs.ASTC_RGBA_5X5] = "RGBA_ASTC_5x5";
26672              t[t.RGBA_ASTC_6x5 = bs.ASTC_RGBA_6X5] = "RGBA_ASTC_6x5";
26673              t[t.RGBA_ASTC_6x6 = bs.ASTC_RGBA_6X6] = "RGBA_ASTC_6x6";
26674              t[t.RGBA_ASTC_8x5 = bs.ASTC_RGBA_8X5] = "RGBA_ASTC_8x5";
26675              t[t.RGBA_ASTC_8x6 = bs.ASTC_RGBA_8X6] = "RGBA_ASTC_8x6";
26676              t[t.RGBA_ASTC_8x8 = bs.ASTC_RGBA_8X8] = "RGBA_ASTC_8x8";
26677              t[t.RGBA_ASTC_10x5 = bs.ASTC_RGBA_10X5] = "RGBA_ASTC_10x5";
26678              t[t.RGBA_ASTC_10x6 = bs.ASTC_RGBA_10X6] = "RGBA_ASTC_10x6";
26679              t[t.RGBA_ASTC_10x8 = bs.ASTC_RGBA_10X8] = "RGBA_ASTC_10x8";
26680              t[t.RGBA_ASTC_10x10 = bs.ASTC_RGBA_10X10] = "RGBA_ASTC_10x10";
26681              t[t.RGBA_ASTC_12x10 = bs.ASTC_RGBA_12X10] = "RGBA_ASTC_12x10";
26682              t[t.RGBA_ASTC_12x12 = bs.ASTC_RGBA_12X12] = "RGBA_ASTC_12x12";
26683            }(Jp || (Jp = {}));
26684            let Zp;
26685            !function(t) {
26686              t[t.REPEAT = Ps.WRAP] = "REPEAT";
26687              t[t.CLAMP_TO_EDGE = Ps.CLAMP] = "CLAMP_TO_EDGE";
26688              t[t.MIRRORED_REPEAT = Ps.MIRROR] = "MIRRORED_REPEAT";
26689              t[t.CLAMP_TO_BORDER = Ps.BORDER] = "CLAMP_TO_BORDER";
26690            }(Zp || (Zp = {}));
26691            let Qp;
26692            !function(t) {
26693              t[t.NONE = Ds.NONE] = "NONE";
26694              t[t.LINEAR = Ds.LINEAR] = "LINEAR";
26695              t[t.NEAREST = Ds.POINT] = "NEAREST";
26696            }(Qp || (Qp = {}));
26697            const $p = jsb.TextureBase.prototype;
26698            $p._serialize = function(t) {
26699              return EDITOR || TEST ? `${this._minFilter},${this._magFilter},${this._wrapS},${this._wrapT},${this._mipFilter},${this._anisotropy}` : "";
26700            };
26701            $p._deserialize = function(t, e) {
26702              const i = t.split(",");
26703              i.unshift("");
26704              if (i.length >= 5) {
26705                this.setFilters(parseInt(i[1]), parseInt(i[2]));
26706                this.setWrapMode(parseInt(i[3]), parseInt(i[4]));
26707              }
26708              if (i.length >= 7) {
26709                this.setMipFilter(parseInt(i[5]));
26710                this.setAnisotropy(parseInt(i[6]));
26711              }
26712            };
26713            $p._getGFXDevice = function() {
26714              return zo.gfxDevice;
26715            };
26716            $p._getGFXFormat = function() {
26717              return this._getGFXPixelFormat(this.format);
26718            };
26719            $p._setGFXFormat = function(t) {
26720              this.format = void 0 === t ? Jp.RGBA8888 : t;
26721            };
26722            $p._getGFXPixelFormat = function(t) {
26723              t === Jp.RGBA_ETC1 ? t = Jp.RGB_ETC1 : t === Jp.RGB_A_PVRTC_4BPPV1 ? t = Jp.RGB_PVRTC_4BPPV1 : t === Jp.RGB_A_PVRTC_2BPPV1 && (t = Jp.RGB_PVRTC_2BPPV1);
26724              return t;
26725            };
26726            $p.createNode = null;
26727            const tm = jsb.TextureBase;
26728            tm.Filter = Qp;
26729            tm.PixelFormat = Jp;
26730            tm.WrapMode = Zp;
26731            $p._ctor = function() {
26732              jsb.Asset.prototype._ctor.apply(this, arguments);
26733              this._gfxSampler = null;
26734              this._samplerInfo = null;
26735              this._textureHash = 0;
26736              this._registerGFXSamplerUpdatedListener();
26737            };
26738            const em = $p.getGFXSampler;
26739            $p.getGFXSampler = function() {
26740              this._gfxSampler || (this._gfxSampler = em.call(this));
26741              return this._gfxSampler;
26742            };
26743            const im = $p.getHash;
26744            $p.getHash = function() {
26745              0 === this._textureHash && (this._textureHash = im.call(this));
26746              return this._textureHash;
26747            };
26748            const sm = $p.getSamplerInfo;
26749            $p.getSamplerInfo = function() {
26750              this._samplerInfo || (this._samplerInfo = sm.call(this));
26751              return this._samplerInfo;
26752            };
26753            const nm = $p.destroy;
26754            $p.destroy = function() {
26755              var t;
26756              (null === (t = m.director.root) || void 0 === t ? void 0 : t.batcher2D) && m.director.root.batcher2D._releaseDescriptorSetCache(this.getGFXTexture(), this.getGFXSampler());
26757              return nm.call(this);
26758            };
26759            $p._onGFXSamplerUpdated = function(t, e) {
26760              this._gfxSampler = t;
26761              this._samplerInfo = e;
26762            };
26763            m.TextureBase = jsb.TextureBase;
26764            const rm = tm.prototype;
26765            Yl(rm, "_format");
26766            Yl(rm, "_minFilter");
26767            Yl(rm, "_magFilter");
26768            Yl(rm, "_mipFilter");
26769            Yl(rm, "_wrapS");
26770            Yl(rm, "_wrapT");
26771            Yl(rm, "_wrapR");
26772            Yl(rm, "_anisotropy");
26773            Ul("cc.TextureBase")(tm);
26774            const om = jsb.Material.prototype;
26775            function am(t, e, i, s, n) {
26776              null != n ? t.call(e, i, s, n) : t.call(e, i, s);
26777            }
26778            var lm;
26779            !function(t) {
26780              t[t.VEC2 = 0] = "VEC2";
26781              t[t.VEC3 = 1] = "VEC3";
26782              t[t.VEC4 = 2] = "VEC4";
26783              t[t.QUATERNION = 3] = "QUATERNION";
26784              t[t.MAT3 = 4] = "MAT3";
26785              t[t.MAT4 = 5] = "MAT4";
26786              t[t.SIZE = 6] = "SIZE";
26787              t[t.RECT = 7] = "RECT";
26788              t[t.COLOR = 8] = "COLOR";
26789            }(lm || (lm = {}));
26790            om.setProperty = function(t, e, i) {
26791              if (Array.isArray(e)) {
26792                const s = e[0];
26793                "number" == typeof s ? Number.isInteger(s) ? am(this.setPropertyInt32Array, this, t, e, i) : am(this.setPropertyFloat32Array, this, t, e, i) : s instanceof Qi ? am(this.setPropertyVec2Array, this, t, e, i) : s instanceof Pi ? am(this.setPropertyVec3Array, this, t, e, i) : s instanceof is ? am(this.setPropertyVec4Array, this, t, e, i) : s instanceof Bi ? am(this.setPropertyColorArray, this, t, e, i) : s instanceof Fi ? am(this.setPropertyMat3Array, this, t, e, i) : s instanceof qi ? am(this.setPropertyMat4Array, this, t, e, i) : s instanceof Ui ? am(this.setPropertyQuatArray, this, t, e, i) : s instanceof tm ? am(this.setPropertyTextureBaseArray, this, t, e, i) : s instanceof Yr ? am(this.setPropertyGFXTextureArray, this, t, e, i) : m.error(`Material.setProperty Unknown type: ${e}`);
26794              } else "number" == typeof e ? Number.isInteger(e) ? am(this.setPropertyInt32, this, t, e, i) : am(this.setPropertyFloat32, this, t, e, i) : e instanceof Qi ? am(this.setPropertyVec2, this, t, e, i) : e instanceof Pi ? am(this.setPropertyVec3, this, t, e, i) : e instanceof is ? am(this.setPropertyVec4, this, t, e, i) : e instanceof Bi ? am(this.setPropertyColor, this, t, e, i) : e instanceof Fi ? am(this.setPropertyMat3, this, t, e, i) : e instanceof qi ? am(this.setPropertyMat4, this, t, e, i) : e instanceof Ui ? am(this.setPropertyQuat, this, t, e, i) : e instanceof tm ? am(this.setPropertyTextureBase, this, t, e, i) : e instanceof Yr ? am(this.setPropertyGFXTexture, this, t, e, i) : null === e ? i ? this.setPropertyNull(t, i) : this.setPropertyNull(t) : m.error(`Material.setProperty Unknown type: ${e}`);
26795            };
26796            om.getProperty = function(t, e) {
26797              let i;
26798              i = void 0 !== e ? this._getProperty(t, e) : this._getProperty(t);
26799              if (Array.isArray(i)) {
26800                const t = i[0];
26801                const e = [];
26802                if (t instanceof jsb.Vec2 || t.type === lm.VEC2) for (let t = 0, s = i.length; t < s; ++t) {
26803                  const s = i[t];
26804                  e.push(new Qi(s.x, s.y));
26805                } else if (t.type === lm.VEC3) for (let t = 0, s = i.length; t < s; ++t) {
26806                  const s = i[t];
26807                  e.push(new Pi(s.x, s.y, s.z));
26808                } else if (t.type === lm.VEC4) for (let t = 0, s = i.length; t < s; ++t) {
26809                  const s = i[t];
26810                  e.push(new is(s.x, s.y, s.z, s.w));
26811                } else if (t instanceof jsb.Color) for (let t = 0, s = i.length; t < s; ++t) {
26812                  const s = i[t];
26813                  e.push(new Bi(s.r, s.g, s.b, s.a));
26814                } else if (t.type === lm.MAT3) for (let t = 0, s = i.length; t < s; ++t) {
26815                  const s = i[t];
26816                  e.push(new Fi(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8]));
26817                } else if (t.type === lm.MAT4) for (let t = 0, s = i.length; t < s; ++t) {
26818                  const s = i[t];
26819                  e.push(new qi(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11], s[12], s[13], s[14], s[15]));
26820                } else if (t.type === lm.QUATERNION) for (let t = 0, s = i.length; t < s; ++t) {
26821                  const s = i[t];
26822                  e.push(new Ui(s.x, s.y, s.z, s.w));
26823                }
26824                return e || i;
26825              }
26826              let s;
26827              const n = i;
26828              i instanceof jsb.Vec2 || i.type === lm.VEC2 ? s = new Pi(n.x, n.y) : i.type === lm.VEC3 ? s = new Pi(n.x, n.y, n.z) : i.type === lm.VEC4 ? s = new is(n.x, n.y, n.z, n.w) : i instanceof jsb.Color ? s = new Bi(n.r, n.g, n.b, n.a) : i.type === lm.MAT3 ? s = new Fi(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8]) : i.type === lm.MAT4 ? s = new qi(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14], n[15]) : i.type === lm.QUATERNION && (s = new Ui(n.x, n.y, n.z, n.w));
26829              return s || i;
26830            };
26831            const hm = t("Material", jsb.Material);
26832            m.Material = hm;
26833            const cm = hm.prototype;
26834            cm._ctor = function() {
26835              jsb.Asset.prototype._ctor.apply(this, arguments);
26836              this._props = [];
26837              this._passes = [];
26838              this._registerPassesUpdatedListener();
26839              this._isCtorCalled = !0;
26840            };
26841            const um = cm.onLoaded;
26842            cm.onLoaded = function() {
26843              this._propsInternal = this._props;
26844              um.call(this);
26845            };
26846            cm._onPassesUpdated = function() {
26847              this._passes = this.getPasses();
26848            };
26849            Object.defineProperty(cm, "passes", {
26850              enumerable: !0,
26851              configurable: !0,
26852              get() {
26853                if (!this._isCtorCalled) {
26854                  this._ctor();
26855                  this._passes = this.getPasses();
26856                }
26857                return this._passes;
26858              }
26859            });
26860            const _m = hm.prototype;
26861            Th(Yp)(_m, "_effectAsset");
26862            Yl(_m, "_techIdx");
26863            Yl(_m, "_defines");
26864            Yl(_m, "_states");
26865            Yl(_m, "_props");
26866            Ul("cc.Material")(hm);
26867            const dm = (() => {
26868              const t = new Map;
26869              let e = 0;
26870              return i => {
26871                if ("number" == typeof i) return i;
26872                if (!t.has(i)) {
26873                  t.set(i, 1 << e);
26874                  e++;
26875                }
26876                return t.get(i);
26877              };
26878            })();
26879            const pm = {
26880              NONE: 0,
26881              IGNORE_RAYCAST: 1 << 20,
26882              GIZMOS: 1 << 21,
26883              EDITOR: 1 << 22,
26884              UI_3D: 1 << 23,
26885              SCENE_GIZMO: 1 << 24,
26886              UI_2D: 1 << 25,
26887              PROFILER: 1 << 28,
26888              DEFAULT: 1 << 30,
26889              ALL: 4294967295
26890            };
26891            class mm {
26892              static init() {
26893                const t = de.querySettings(_e.Category.ENGINE, "customLayers");
26894                if (t) for (let e = 0; e < t.length; e++) {
26895                  const i = t[e];
26896                  mm.addLayer(i.name, i.bit);
26897                }
26898              }
26899              static makeMaskInclude(t) {
26900                let e = 0;
26901                for (const i of t) e |= i;
26902                return e;
26903              }
26904              static makeMaskExclude(t) {
26905                return ~mm.makeMaskInclude(t);
26906              }
26907              static addLayer(t, e) {
26908                if (void 0 === e) {
26909                  console.warn("bitNum can't be undefined");
26910                  return;
26911                }
26912                if (e > 19 || e < 0) {
26913                  console.warn("maximum layers reached.");
26914                  return;
26915                }
26916                const i = 1 << e;
26917                ne(!mm.Enum[t], G(2104, t));
26918                mm.Enum[t] = i;
26919                ee.value(mm.Enum, String(i), t);
26920                mm.BitMask[t] = i;
26921                ee.value(mm.BitMask, String(i), t);
26922              }
26923              static deleteLayer(t) {
26924                if (t > 19 || t < 0) {
26925                  console.warn("do not change buildin layers.");
26926                  return;
26927                }
26928                const e = 1 << t;
26929                delete mm.Enum[mm.Enum[e]];
26930                delete mm.Enum[e];
26931                delete mm.BitMask[mm.BitMask[e]];
26932                delete mm.BitMask[e];
26933              }
26934              static nameToLayer(t) {
26935                if (void 0 === t) {
26936                  console.warn("name can't be undefined");
26937                  return -1;
26938                }
26939                return r(mm.Enum[t]);
26940              }
26941              static layerToName(t) {
26942                if (t > 31 || t < 0) {
26943                  console.warn("Unable to access unknown layer.");
26944                  return "";
26945                }
26946                return mm.Enum[1 << t];
26947              }
26948            }
26949            t("Layers", mm);
26950            mm.Enum = oe(pm);
26951            mm.BitMask = ie({
26952              ...pm
26953            });
26954            m.Layers = mm;
26955            let fm;
26956            !function(t) {
26957              t[t.DEFAULT = 100] = "DEFAULT";
26958              t[t.UI = 200] = "UI";
26959            }(fm || (fm = {}));
26960            m.RenderPassStage = fm;
26961            let gm;
26962            !function(t) {
26963              t[t.MIN = 0] = "MIN";
26964              t[t.MAX = 255] = "MAX";
26965              t[t.DEFAULT = 128] = "DEFAULT";
26966            }(gm || (gm = {}));
26967            const ym = {
26968              bindings: [],
26969              layouts: {}
26970            };
26971            const bm = {
26972              bindings: [],
26973              layouts: {}
26974            };
26975            let Sm;
26976            !function(t) {
26977              t[t.UBO_GLOBAL = 0] = "UBO_GLOBAL";
26978              t[t.UBO_CAMERA = 1] = "UBO_CAMERA";
26979              t[t.UBO_SHADOW = 2] = "UBO_SHADOW";
26980              t[t.UBO_CSM = 3] = "UBO_CSM";
26981              t[t.SAMPLER_SHADOWMAP = 4] = "SAMPLER_SHADOWMAP";
26982              t[t.SAMPLER_ENVIRONMENT = 5] = "SAMPLER_ENVIRONMENT";
26983              t[t.SAMPLER_SPOT_SHADOW_MAP = 6] = "SAMPLER_SPOT_SHADOW_MAP";
26984              t[t.SAMPLER_DIFFUSEMAP = 7] = "SAMPLER_DIFFUSEMAP";
26985              t[t.COUNT = 8] = "COUNT";
26986            }(Sm || (Sm = {}));
26987            const Am = Sm.SAMPLER_SHADOWMAP;
26988            const Tm = Sm.COUNT - Am;
26989            let vm;
26990            !function(t) {
26991              t[t.UBO_LOCAL = 0] = "UBO_LOCAL";
26992              t[t.UBO_FORWARD_LIGHTS = 1] = "UBO_FORWARD_LIGHTS";
26993              t[t.UBO_SKINNING_ANIMATION = 2] = "UBO_SKINNING_ANIMATION";
26994              t[t.UBO_SKINNING_TEXTURE = 3] = "UBO_SKINNING_TEXTURE";
26995              t[t.UBO_MORPH = 4] = "UBO_MORPH";
26996              t[t.UBO_UI_LOCAL = 5] = "UBO_UI_LOCAL";
26997              t[t.SAMPLER_JOINTS = 6] = "SAMPLER_JOINTS";
26998              t[t.SAMPLER_MORPH_POSITION = 7] = "SAMPLER_MORPH_POSITION";
26999              t[t.SAMPLER_MORPH_NORMAL = 8] = "SAMPLER_MORPH_NORMAL";
27000              t[t.SAMPLER_MORPH_TANGENT = 9] = "SAMPLER_MORPH_TANGENT";
27001              t[t.SAMPLER_LIGHTMAP = 10] = "SAMPLER_LIGHTMAP";
27002              t[t.SAMPLER_SPRITE = 11] = "SAMPLER_SPRITE";
27003              t[t.SAMPLER_REFLECTION = 12] = "SAMPLER_REFLECTION";
27004              t[t.STORAGE_REFLECTION = 13] = "STORAGE_REFLECTION";
27005              t[t.COUNT = 14] = "COUNT";
27006            }(vm || (vm = {}));
27007            const Em = vm.SAMPLER_JOINTS;
27008            const Cm = vm.STORAGE_REFLECTION - Em;
27009            const xm = vm.COUNT - Em - Cm;
27010            let wm;
27011            !function(t) {
27012              t[t.GLOBAL = 0] = "GLOBAL";
27013              t[t.MATERIAL = 1] = "MATERIAL";
27014              t[t.LOCAL = 2] = "LOCAL";
27015            }(wm || (wm = {}));
27016            const Rm = new yn([ Am, 0, Em ], [ Tm, 0, Cm ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, xm ], [ 0, 0, 0 ], [ 0, 2, 1 ]);
27017            class Im {}
27018            Im.TIME_OFFSET = 0;
27019            Im.SCREEN_SIZE_OFFSET = Im.TIME_OFFSET + 4;
27020            Im.NATIVE_SIZE_OFFSET = Im.SCREEN_SIZE_OFFSET + 4;
27021            Im.DEBUG_VIEW_MODE_OFFSET = Im.NATIVE_SIZE_OFFSET + 4;
27022            Im.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET = Im.DEBUG_VIEW_MODE_OFFSET + 4;
27023            Im.DEBUG_VIEW_COMPOSITE_PACK_2_OFFSET = Im.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET + 4;
27024            Im.DEBUG_VIEW_COMPOSITE_PACK_3_OFFSET = Im.DEBUG_VIEW_COMPOSITE_PACK_2_OFFSET + 4;
27025            Im.COUNT = Im.DEBUG_VIEW_COMPOSITE_PACK_3_OFFSET + 4;
27026            Im.SIZE = 4 * Im.COUNT;
27027            Im.NAME = "CCGlobal";
27028            Im.BINDING = Sm.UBO_GLOBAL;
27029            Im.DESCRIPTOR = new Jn(Im.BINDING, Zs.UNIFORM_BUFFER, 1, ks.ALL);
27030            Im.LAYOUT = new Mn(wm.GLOBAL, Im.BINDING, Im.NAME, [ new In("cc_time", As.FLOAT4, 1), new In("cc_screenSize", As.FLOAT4, 1), new In("cc_nativeSize", As.FLOAT4, 1), new In("cc_debug_view_mode", As.FLOAT, 4), new In("cc_debug_view_composite_pack_1", As.FLOAT, 4), new In("cc_debug_view_composite_pack_2", As.FLOAT, 4), new In("cc_debug_view_composite_pack_3", As.FLOAT, 4) ], 1);
27031            ym.layouts[Im.NAME] = Im.LAYOUT;
27032            ym.bindings[Im.BINDING] = Im.DESCRIPTOR;
27033            class Mm {}
27034            Mm.MAT_VIEW_OFFSET = 0;
27035            Mm.MAT_VIEW_INV_OFFSET = Mm.MAT_VIEW_OFFSET + 16;
27036            Mm.MAT_PROJ_OFFSET = Mm.MAT_VIEW_INV_OFFSET + 16;
27037            Mm.MAT_PROJ_INV_OFFSET = Mm.MAT_PROJ_OFFSET + 16;
27038            Mm.MAT_VIEW_PROJ_OFFSET = Mm.MAT_PROJ_INV_OFFSET + 16;
27039            Mm.MAT_VIEW_PROJ_INV_OFFSET = Mm.MAT_VIEW_PROJ_OFFSET + 16;
27040            Mm.CAMERA_POS_OFFSET = Mm.MAT_VIEW_PROJ_INV_OFFSET + 16;
27041            Mm.SURFACE_TRANSFORM_OFFSET = Mm.CAMERA_POS_OFFSET + 4;
27042            Mm.SCREEN_SCALE_OFFSET = Mm.SURFACE_TRANSFORM_OFFSET + 4;
27043            Mm.EXPOSURE_OFFSET = Mm.SCREEN_SCALE_OFFSET + 4;
27044            Mm.MAIN_LIT_DIR_OFFSET = Mm.EXPOSURE_OFFSET + 4;
27045            Mm.MAIN_LIT_COLOR_OFFSET = Mm.MAIN_LIT_DIR_OFFSET + 4;
27046            Mm.AMBIENT_SKY_OFFSET = Mm.MAIN_LIT_COLOR_OFFSET + 4;
27047            Mm.AMBIENT_GROUND_OFFSET = Mm.AMBIENT_SKY_OFFSET + 4;
27048            Mm.GLOBAL_FOG_COLOR_OFFSET = Mm.AMBIENT_GROUND_OFFSET + 4;
27049            Mm.GLOBAL_FOG_BASE_OFFSET = Mm.GLOBAL_FOG_COLOR_OFFSET + 4;
27050            Mm.GLOBAL_FOG_ADD_OFFSET = Mm.GLOBAL_FOG_BASE_OFFSET + 4;
27051            Mm.NEAR_FAR_OFFSET = Mm.GLOBAL_FOG_ADD_OFFSET + 4;
27052            Mm.VIEW_PORT_OFFSET = Mm.NEAR_FAR_OFFSET + 4;
27053            Mm.COUNT = Mm.VIEW_PORT_OFFSET + 4;
27054            Mm.SIZE = 4 * Mm.COUNT;
27055            Mm.NAME = "CCCamera";
27056            Mm.BINDING = Sm.UBO_CAMERA;
27057            Mm.DESCRIPTOR = new Jn(Mm.BINDING, Zs.UNIFORM_BUFFER, 1, ks.ALL);
27058            Mm.LAYOUT = new Mn(wm.GLOBAL, Mm.BINDING, Mm.NAME, [ new In("cc_matView", As.MAT4, 1), new In("cc_matViewInv", As.MAT4, 1), new In("cc_matProj", As.MAT4, 1), new In("cc_matProjInv", As.MAT4, 1), new In("cc_matViewProj", As.MAT4, 1), new In("cc_matViewProjInv", As.MAT4, 1), new In("cc_cameraPos", As.FLOAT4, 1), new In("cc_surfaceTransform", As.FLOAT4, 1), new In("cc_screenScale", As.FLOAT4, 1), new In("cc_exposure", As.FLOAT4, 1), new In("cc_mainLitDir", As.FLOAT4, 1), new In("cc_mainLitColor", As.FLOAT4, 1), new In("cc_ambientSky", As.FLOAT4, 1), new In("cc_ambientGround", As.FLOAT4, 1), new In("cc_fogColor", As.FLOAT4, 1), new In("cc_fogBase", As.FLOAT4, 1), new In("cc_fogAdd", As.FLOAT4, 1), new In("cc_nearFar", As.FLOAT4, 1), new In("cc_viewPort", As.FLOAT4, 1) ], 1);
27059            ym.layouts[Mm.NAME] = Mm.LAYOUT;
27060            ym.bindings[Mm.BINDING] = Mm.DESCRIPTOR;
27061            class Bm {}
27062            Bm.MAT_LIGHT_VIEW_OFFSET = 0;
27063            Bm.MAT_LIGHT_VIEW_PROJ_OFFSET = Bm.MAT_LIGHT_VIEW_OFFSET + 16;
27064            Bm.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET = Bm.MAT_LIGHT_VIEW_PROJ_OFFSET + 16;
27065            Bm.SHADOW_PROJ_DEPTH_INFO_OFFSET = Bm.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET + 4;
27066            Bm.SHADOW_PROJ_INFO_OFFSET = Bm.SHADOW_PROJ_DEPTH_INFO_OFFSET + 4;
27067            Bm.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET = Bm.SHADOW_PROJ_INFO_OFFSET + 4;
27068            Bm.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET = Bm.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET + 4;
27069            Bm.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET = Bm.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET + 4;
27070            Bm.SHADOW_COLOR_OFFSET = Bm.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET + 4;
27071            Bm.PLANAR_NORMAL_DISTANCE_INFO_OFFSET = Bm.SHADOW_COLOR_OFFSET + 4;
27072            Bm.COUNT = Bm.PLANAR_NORMAL_DISTANCE_INFO_OFFSET + 4;
27073            Bm.SIZE = 4 * Bm.COUNT;
27074            Bm.NAME = "CCShadow";
27075            Bm.BINDING = Sm.UBO_SHADOW;
27076            Bm.DESCRIPTOR = new Jn(Bm.BINDING, Zs.UNIFORM_BUFFER, 1, ks.ALL);
27077            Bm.LAYOUT = new Mn(wm.GLOBAL, Bm.BINDING, Bm.NAME, [ new In("cc_matLightView", As.MAT4, 1), new In("cc_matLightViewProj", As.MAT4, 1), new In("cc_shadowInvProjDepthInfo", As.FLOAT4, 1), new In("cc_shadowProjDepthInfo", As.FLOAT4, 1), new In("cc_shadowProjInfo", As.FLOAT4, 1), new In("cc_shadowNFLSInfo", As.FLOAT4, 1), new In("cc_shadowWHPBInfo", As.FLOAT4, 1), new In("cc_shadowLPNNInfo", As.FLOAT4, 1), new In("cc_shadowColor", As.FLOAT4, 1), new In("cc_planarNDInfo", As.FLOAT4, 1) ], 1);
27078            ym.layouts[Bm.NAME] = Bm.LAYOUT;
27079            ym.bindings[Bm.BINDING] = Bm.DESCRIPTOR;
27080            class Dm {}
27081            Dm.CSM_LEVEL_COUNT = 4;
27082            Dm.CSM_VIEW_DIR_0_OFFSET = 0;
27083            Dm.CSM_VIEW_DIR_1_OFFSET = Dm.CSM_VIEW_DIR_0_OFFSET + 4 * Dm.CSM_LEVEL_COUNT;
27084            Dm.CSM_VIEW_DIR_2_OFFSET = Dm.CSM_VIEW_DIR_1_OFFSET + 4 * Dm.CSM_LEVEL_COUNT;
27085            Dm.CSM_ATLAS_OFFSET = Dm.CSM_VIEW_DIR_2_OFFSET + 4 * Dm.CSM_LEVEL_COUNT;
27086            Dm.MAT_CSM_VIEW_PROJ_OFFSET = Dm.CSM_ATLAS_OFFSET + 4 * Dm.CSM_LEVEL_COUNT;
27087            Dm.CSM_PROJ_DEPTH_INFO_OFFSET = Dm.MAT_CSM_VIEW_PROJ_OFFSET + 16 * Dm.CSM_LEVEL_COUNT;
27088            Dm.CSM_PROJ_INFO_OFFSET = Dm.CSM_PROJ_DEPTH_INFO_OFFSET + 4 * Dm.CSM_LEVEL_COUNT;
27089            Dm.CSM_SPLITS_INFO_OFFSET = Dm.CSM_PROJ_INFO_OFFSET + 4 * Dm.CSM_LEVEL_COUNT;
27090            Dm.COUNT = Dm.CSM_SPLITS_INFO_OFFSET + 4;
27091            Dm.SIZE = 4 * Dm.COUNT;
27092            Dm.NAME = "CCCSM";
27093            Dm.BINDING = Sm.UBO_CSM;
27094            Dm.DESCRIPTOR = new Jn(Dm.BINDING, Zs.UNIFORM_BUFFER, 1, ks.ALL);
27095            Dm.LAYOUT = new Mn(wm.GLOBAL, Dm.BINDING, Dm.NAME, [ new In("cc_csmViewDir0", As.FLOAT4, Dm.CSM_LEVEL_COUNT), new In("cc_csmViewDir1", As.FLOAT4, Dm.CSM_LEVEL_COUNT), new In("cc_csmViewDir2", As.FLOAT4, Dm.CSM_LEVEL_COUNT), new In("cc_csmAtlas", As.FLOAT4, Dm.CSM_LEVEL_COUNT), new In("cc_matCSMViewProj", As.MAT4, Dm.CSM_LEVEL_COUNT), new In("cc_csmProjDepthInfo", As.FLOAT4, Dm.CSM_LEVEL_COUNT), new In("cc_csmProjInfo", As.FLOAT4, Dm.CSM_LEVEL_COUNT), new In("cc_csmSplitsInfo", As.FLOAT4, 1) ], 1);
27096            ym.layouts[Dm.NAME] = Dm.LAYOUT;
27097            ym.bindings[Dm.BINDING] = Dm.DESCRIPTOR;
27098            const Pm = "cc_shadowMap";
27099            const Om = Sm.SAMPLER_SHADOWMAP;
27100            const Nm = new Jn(Om, Zs.SAMPLER_TEXTURE, 1, ks.FRAGMENT);
27101            const Lm = new Bn(wm.GLOBAL, Om, Pm, As.SAMPLER2D, 1);
27102            ym.layouts.cc_shadowMap = Lm;
27103            ym.bindings[Om] = Nm;
27104            const Fm = "cc_environment";
27105            const Vm = Sm.SAMPLER_ENVIRONMENT;
27106            const km = new Jn(Vm, Zs.SAMPLER_TEXTURE, 1, ks.FRAGMENT);
27107            const Um = new Bn(wm.GLOBAL, Vm, Fm, As.SAMPLER_CUBE, 1);
27108            ym.layouts.cc_environment = Um;
27109            ym.bindings[Vm] = km;
27110            const Gm = "cc_diffuseMap";
27111            const zm = Sm.SAMPLER_DIFFUSEMAP;
27112            const Hm = new Jn(zm, Zs.SAMPLER_TEXTURE, 1, ks.FRAGMENT);
27113            const jm = new Bn(wm.GLOBAL, zm, Gm, As.SAMPLER_CUBE, 1);
27114            ym.layouts.cc_diffuseMap = jm;
27115            ym.bindings[zm] = Hm;
27116            const Xm = "cc_spotShadowMap";
27117            const Wm = Sm.SAMPLER_SPOT_SHADOW_MAP;
27118            const Ym = new Jn(Wm, Zs.SAMPLER_TEXTURE, 1, ks.FRAGMENT);
27119            const qm = new Bn(wm.GLOBAL, Wm, Xm, As.SAMPLER2D, 1);
27120            ym.layouts.cc_spotShadowMap = qm;
27121            ym.bindings[Wm] = Ym;
27122            class Km {}
27123            Km.MAT_WORLD_OFFSET = 0;
27124            Km.MAT_WORLD_IT_OFFSET = Km.MAT_WORLD_OFFSET + 16;
27125            Km.LIGHTINGMAP_UVPARAM = Km.MAT_WORLD_IT_OFFSET + 16;
27126            Km.LOCAL_SHADOW_BIAS = Km.LIGHTINGMAP_UVPARAM + 4;
27127            Km.COUNT = Km.LOCAL_SHADOW_BIAS + 4;
27128            Km.SIZE = 4 * Km.COUNT;
27129            Km.NAME = "CCLocal";
27130            Km.BINDING = vm.UBO_LOCAL;
27131            Km.DESCRIPTOR = new Jn(Km.BINDING, Zs.UNIFORM_BUFFER, 1, ks.VERTEX | ks.COMPUTE);
27132            Km.LAYOUT = new Mn(wm.LOCAL, Km.BINDING, Km.NAME, [ new In("cc_matWorld", As.MAT4, 1), new In("cc_matWorldIT", As.MAT4, 1), new In("cc_lightingMapUVParam", As.FLOAT4, 1), new In("cc_localShadowBias", As.FLOAT4, 1) ], 1);
27133            bm.layouts[Km.NAME] = Km.LAYOUT;
27134            bm.bindings[Km.BINDING] = Km.DESCRIPTOR;
27135            class Jm {}
27136            Jm.WORLD_BOUND_CENTER = 0;
27137            Jm.WORLD_BOUND_HALF_EXTENTS = Jm.WORLD_BOUND_CENTER + 4;
27138            Jm.COUNT = Jm.WORLD_BOUND_HALF_EXTENTS + 4;
27139            Jm.SIZE = 4 * Jm.COUNT;
27140            Jm.NAME = "CCWorldBound";
27141            Jm.BINDING = vm.UBO_LOCAL;
27142            Jm.DESCRIPTOR = new Jn(Jm.BINDING, Zs.UNIFORM_BUFFER, 1, ks.VERTEX | ks.COMPUTE);
27143            Jm.LAYOUT = new Mn(wm.LOCAL, Jm.BINDING, Jm.NAME, [ new In("cc_worldBoundCenter", As.FLOAT4, 1), new In("cc_worldBoundHalfExtents", As.FLOAT4, 1) ], 1);
27144            bm.layouts[Jm.NAME] = Jm.LAYOUT;
27145            bm.bindings[Jm.BINDING] = Jm.DESCRIPTOR;
27146            class Zm {}
27147            Zm.BATCHING_COUNT = 10;
27148            Zm.MAT_WORLDS_OFFSET = 0;
27149            Zm.COUNT = 16 * Zm.BATCHING_COUNT;
27150            Zm.SIZE = 4 * Zm.COUNT;
27151            Zm.NAME = "CCLocalBatched";
27152            Zm.BINDING = vm.UBO_LOCAL;
27153            Zm.DESCRIPTOR = new Jn(Zm.BINDING, Zs.UNIFORM_BUFFER, 1, ks.VERTEX | ks.COMPUTE);
27154            Zm.LAYOUT = new Mn(wm.LOCAL, Zm.BINDING, Zm.NAME, [ new In("cc_matWorlds", As.MAT4, Zm.BATCHING_COUNT) ], 1);
27155            bm.layouts[Zm.NAME] = Zm.LAYOUT;
27156            bm.bindings[Zm.BINDING] = Zm.DESCRIPTOR;
27157            class Qm {}
27158            Qm.LIGHTS_PER_PASS = 1;
27159            Qm.LIGHT_POS_OFFSET = 0;
27160            Qm.LIGHT_COLOR_OFFSET = Qm.LIGHT_POS_OFFSET + 4 * Qm.LIGHTS_PER_PASS;
27161            Qm.LIGHT_SIZE_RANGE_ANGLE_OFFSET = Qm.LIGHT_COLOR_OFFSET + 4 * Qm.LIGHTS_PER_PASS;
27162            Qm.LIGHT_DIR_OFFSET = Qm.LIGHT_SIZE_RANGE_ANGLE_OFFSET + 4 * Qm.LIGHTS_PER_PASS;
27163            Qm.COUNT = Qm.LIGHT_DIR_OFFSET + 4 * Qm.LIGHTS_PER_PASS;
27164            Qm.SIZE = 4 * Qm.COUNT;
27165            Qm.NAME = "CCForwardLight";
27166            Qm.BINDING = vm.UBO_FORWARD_LIGHTS;
27167            Qm.DESCRIPTOR = new Jn(Qm.BINDING, Zs.DYNAMIC_UNIFORM_BUFFER, 1, ks.FRAGMENT);
27168            Qm.LAYOUT = new Mn(wm.LOCAL, Qm.BINDING, Qm.NAME, [ new In("cc_lightPos", As.FLOAT4, Qm.LIGHTS_PER_PASS), new In("cc_lightColor", As.FLOAT4, Qm.LIGHTS_PER_PASS), new In("cc_lightSizeRangeAngle", As.FLOAT4, Qm.LIGHTS_PER_PASS), new In("cc_lightDir", As.FLOAT4, Qm.LIGHTS_PER_PASS) ], 1);
27169            bm.layouts[Qm.NAME] = Qm.LAYOUT;
27170            bm.bindings[Qm.BINDING] = Qm.DESCRIPTOR;
27171            class $m {}
27172            $m.LIGHTS_PER_PASS = 10;
27173            class tf {}
27174            tf.JOINTS_TEXTURE_INFO_OFFSET = 0;
27175            tf.COUNT = tf.JOINTS_TEXTURE_INFO_OFFSET + 4;
27176            tf.SIZE = 4 * tf.COUNT;
27177            tf.NAME = "CCSkinningTexture";
27178            tf.BINDING = vm.UBO_SKINNING_TEXTURE;
27179            tf.DESCRIPTOR = new Jn(tf.BINDING, Zs.UNIFORM_BUFFER, 1, ks.VERTEX);
27180            tf.LAYOUT = new Mn(wm.LOCAL, tf.BINDING, tf.NAME, [ new In("cc_jointTextureInfo", As.FLOAT4, 1) ], 1);
27181            bm.layouts[tf.NAME] = tf.LAYOUT;
27182            bm.bindings[tf.BINDING] = tf.DESCRIPTOR;
27183            class ef {}
27184            ef.JOINTS_ANIM_INFO_OFFSET = 0;
27185            ef.COUNT = ef.JOINTS_ANIM_INFO_OFFSET + 4;
27186            ef.SIZE = 4 * ef.COUNT;
27187            ef.NAME = "CCSkinningAnimation";
27188            ef.BINDING = vm.UBO_SKINNING_ANIMATION;
27189            ef.DESCRIPTOR = new Jn(ef.BINDING, Zs.UNIFORM_BUFFER, 1, ks.VERTEX);
27190            ef.LAYOUT = new Mn(wm.LOCAL, ef.BINDING, ef.NAME, [ new In("cc_jointAnimInfo", As.FLOAT4, 1) ], 1);
27191            bm.layouts[ef.NAME] = ef.LAYOUT;
27192            bm.bindings[ef.BINDING] = ef.DESCRIPTOR;
27193            class sf {
27194              static get JOINT_UNIFORM_CAPACITY() {
27195                return sf._jointUniformCapacity;
27196              }
27197              static get COUNT() {
27198                return sf._count;
27199              }
27200              static get SIZE() {
27201                return sf._size;
27202              }
27203              static initLayout(t) {
27204                sf._jointUniformCapacity = t;
27205                sf._count = 12 * t;
27206                sf._size = 4 * sf._count;
27207                sf.LAYOUT.members[0].count = 3 * t;
27208              }
27209            }
27210            sf._jointUniformCapacity = 0;
27211            sf._count = 0;
27212            sf._size = 0;
27213            sf.NAME = "CCSkinning";
27214            sf.BINDING = vm.UBO_SKINNING_TEXTURE;
27215            sf.DESCRIPTOR = new Jn(sf.BINDING, Zs.UNIFORM_BUFFER, 1, ks.VERTEX);
27216            sf.LAYOUT = new Mn(wm.LOCAL, sf.BINDING, sf.NAME, [ new In("cc_joints", As.FLOAT4, 1) ], 1);
27217            class nf {}
27218            nf.MAX_MORPH_TARGET_COUNT = 60;
27219            nf.OFFSET_OF_WEIGHTS = 0;
27220            nf.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH = 4 * nf.MAX_MORPH_TARGET_COUNT;
27221            nf.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT = nf.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH + 4;
27222            nf.OFFSET_OF_VERTICES_COUNT = nf.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT + 4;
27223            nf.COUNT_BASE_4_BYTES = 4 * Math.ceil(nf.MAX_MORPH_TARGET_COUNT / 4) + 4;
27224            nf.SIZE = 4 * nf.COUNT_BASE_4_BYTES;
27225            nf.NAME = "CCMorph";
27226            nf.BINDING = vm.UBO_MORPH;
27227            nf.DESCRIPTOR = new Jn(nf.BINDING, Zs.UNIFORM_BUFFER, 1, ks.VERTEX);
27228            nf.LAYOUT = new Mn(wm.LOCAL, nf.BINDING, nf.NAME, [ new In("cc_displacementWeights", As.FLOAT4, nf.MAX_MORPH_TARGET_COUNT / 4), new In("cc_displacementTextureInfo", As.FLOAT4, 1) ], 1);
27229            bm.layouts[nf.NAME] = nf.LAYOUT;
27230            bm.bindings[nf.BINDING] = nf.DESCRIPTOR;
27231            class rf {}
27232            rf.NAME = "CCUILocal";
27233            rf.BINDING = vm.UBO_UI_LOCAL;
27234            rf.DESCRIPTOR = new Jn(rf.BINDING, Zs.DYNAMIC_UNIFORM_BUFFER, 1, ks.VERTEX);
27235            rf.LAYOUT = new Mn(wm.LOCAL, rf.BINDING, rf.NAME, [ new In("cc_local_data", As.FLOAT4, 1) ], 1);
27236            bm.layouts[rf.NAME] = rf.LAYOUT;
27237            bm.bindings[rf.BINDING] = rf.DESCRIPTOR;
27238            const of = "cc_jointTexture";
27239            const af = vm.SAMPLER_JOINTS;
27240            const lf = new Jn(af, Zs.SAMPLER_TEXTURE, 1, ks.VERTEX);
27241            const hf = new Bn(wm.LOCAL, af, of, As.SAMPLER2D, 1);
27242            bm.layouts.cc_jointTexture = hf;
27243            bm.bindings[af] = lf;
27244            const cf = "cc_realtimeJoint";
27245            const uf = vm.SAMPLER_JOINTS;
27246            const _f = new Jn(uf, Zs.SAMPLER_TEXTURE, 1, ks.VERTEX);
27247            const df = new Bn(wm.LOCAL, uf, cf, As.SAMPLER2D, 1);
27248            bm.layouts.cc_realtimeJoint = df;
27249            bm.bindings[uf] = _f;
27250            const pf = "cc_PositionDisplacements";
27251            const mf = vm.SAMPLER_MORPH_POSITION;
27252            const ff = new Jn(mf, Zs.SAMPLER_TEXTURE, 1, ks.VERTEX);
27253            const gf = new Bn(wm.LOCAL, mf, pf, As.SAMPLER2D, 1);
27254            bm.layouts.cc_PositionDisplacements = gf;
27255            bm.bindings[mf] = ff;
27256            const yf = "cc_NormalDisplacements";
27257            const bf = vm.SAMPLER_MORPH_NORMAL;
27258            const Sf = new Jn(bf, Zs.SAMPLER_TEXTURE, 1, ks.VERTEX);
27259            const Af = new Bn(wm.LOCAL, bf, yf, As.SAMPLER2D, 1);
27260            bm.layouts.cc_NormalDisplacements = Af;
27261            bm.bindings[bf] = Sf;
27262            const Tf = "cc_TangentDisplacements";
27263            const vf = vm.SAMPLER_MORPH_TANGENT;
27264            const Ef = new Jn(vf, Zs.SAMPLER_TEXTURE, 1, ks.VERTEX);
27265            const Cf = new Bn(wm.LOCAL, vf, Tf, As.SAMPLER2D, 1);
27266            bm.layouts.cc_TangentDisplacements = Cf;
27267            bm.bindings[vf] = Ef;
27268            const xf = "cc_lightingMap";
27269            const wf = vm.SAMPLER_LIGHTMAP;
27270            const Rf = new Jn(wf, Zs.SAMPLER_TEXTURE, 1, ks.FRAGMENT);
27271            const If = new Bn(wm.LOCAL, wf, xf, As.SAMPLER2D, 1);
27272            bm.layouts.cc_lightingMap = If;
27273            bm.bindings[wf] = Rf;
27274            const Mf = "cc_spriteTexture";
27275            const Bf = vm.SAMPLER_SPRITE;
27276            const Df = new Jn(Bf, Zs.SAMPLER_TEXTURE, 1, ks.FRAGMENT);
27277            const Pf = new Bn(wm.LOCAL, Bf, Mf, As.SAMPLER2D, 1);
27278            bm.layouts.cc_spriteTexture = Pf;
27279            bm.bindings[Bf] = Df;
27280            const Of = "cc_reflectionTexture";
27281            const Nf = vm.SAMPLER_REFLECTION;
27282            const Lf = new Jn(Nf, Zs.SAMPLER_TEXTURE, 1, ks.FRAGMENT);
27283            const Ff = new Bn(wm.LOCAL, Nf, Of, As.SAMPLER2D, 1);
27284            bm.layouts.cc_reflectionTexture = Ff;
27285            bm.bindings[Nf] = Lf;
27286            const Vf = "cc_reflectionStorage";
27287            const kf = vm.STORAGE_REFLECTION;
27288            const Uf = new Jn(kf, Zs.STORAGE_IMAGE, 1, ks.COMPUTE);
27289            const Gf = new On(wm.LOCAL, kf, Vf, As.IMAGE2D, 1);
27290            bm.layouts.cc_reflectionStorage = Gf;
27291            bm.bindings[kf] = Uf;
27292            const zf = mm.makeMaskExclude([ mm.BitMask.UI_2D, mm.BitMask.GIZMOS, mm.BitMask.EDITOR, mm.BitMask.SCENE_GIZMO, mm.BitMask.PROFILER ]);
27293            const Hf = mm.makeMaskExclude([ mm.BitMask.UI_2D, mm.BitMask.PROFILER ]);
27294            const jf = mm.Enum.ALL;
27295            function Xf(t) {
27296              return (t.getFormatFeatures(bs.R32F) & (Is.RENDER_TARGET | Is.SAMPLED_TEXTURE)) == (Is.RENDER_TARGET | Is.SAMPLED_TEXTURE);
27297            }
27298            t("pipeline", Object.freeze({
27299              __proto__: null,
27300              PIPELINE_FLOW_MAIN: "MainFlow",
27301              PIPELINE_FLOW_FORWARD: "ForwardFlow",
27302              PIPELINE_FLOW_SHADOW: "ShadowFlow",
27303              PIPELINE_FLOW_SMAA: "SMAAFlow",
27304              PIPELINE_FLOW_TONEMAP: "ToneMapFlow",
27305              get RenderPassStage() {
27306                return fm;
27307              },
27308              get RenderPriority() {
27309                return gm;
27310              },
27311              globalDescriptorSetLayout: ym,
27312              localDescriptorSetLayout: bm,
27313              get PipelineGlobalBindings() {
27314                return Sm;
27315              },
27316              get ModelLocalBindings() {
27317                return vm;
27318              },
27319              get SetIndex() {
27320                return wm;
27321              },
27322              bindingMappingInfo: Rm,
27323              UBOGlobal: Im,
27324              UBOCamera: Mm,
27325              UBOShadow: Bm,
27326              UBOCSM: Dm,
27327              UNIFORM_SHADOWMAP_BINDING: Om,
27328              UNIFORM_ENVIRONMENT_BINDING: Vm,
27329              UNIFORM_DIFFUSEMAP_BINDING: zm,
27330              UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING: Wm,
27331              UBOLocal: Km,
27332              UBOWorldBound: Jm,
27333              INST_MAT_WORLD: "a_matWorld0",
27334              UBOLocalBatched: Zm,
27335              UBOForwardLight: Qm,
27336              UBODeferredLight: $m,
27337              JOINT_UNIFORM_CAPACITY: 30,
27338              UBOSkinningTexture: tf,
27339              UBOSkinningAnimation: ef,
27340              INST_JOINT_ANIM_INFO: "a_jointAnimInfo",
27341              UBOSkinning: sf,
27342              localDescriptorSetLayout_ResizeMaxJoints: function(t) {
27343                sf.initLayout(t);
27344                bm.layouts[sf.NAME] = sf.LAYOUT;
27345                bm.bindings[sf.BINDING] = sf.DESCRIPTOR;
27346              },
27347              UBOMorph: nf,
27348              UBOUILocal: rf,
27349              UNIFORM_JOINT_TEXTURE_BINDING: af,
27350              UNIFORM_REALTIME_JOINT_TEXTURE_BINDING: uf,
27351              UNIFORM_POSITION_MORPH_TEXTURE_BINDING: mf,
27352              UNIFORM_NORMAL_MORPH_TEXTURE_BINDING: bf,
27353              UNIFORM_TANGENT_MORPH_TEXTURE_BINDING: vf,
27354              UNIFORM_LIGHTMAP_TEXTURE_BINDING: wf,
27355              UNIFORM_SPRITE_TEXTURE_BINDING: Bf,
27356              UNIFORM_REFLECTION_TEXTURE_BINDING: Nf,
27357              UNIFORM_REFLECTION_STORAGE_BINDING: kf,
27358              CAMERA_DEFAULT_MASK: zf,
27359              CAMERA_EDITOR_MASK: Hf,
27360              MODEL_ALWAYS_MASK: jf,
27361              supportsR16HalfFloatTexture: function(t) {
27362                return (t.getFormatFeatures(bs.R16F) & (Is.RENDER_TARGET | Is.SAMPLED_TEXTURE)) == (Is.RENDER_TARGET | Is.SAMPLED_TEXTURE);
27363              },
27364              supportsR32FloatTexture: Xf
27365            }));
27366            let Wf;
27367            !function(t) {
27368              t.RENDER_FRAME_BEGIN = "render-frame-begin";
27369              t.RENDER_FRAME_END = "render-frame-end";
27370              t.RENDER_CAMERA_BEGIN = "render-camera-begin";
27371              t.RENDER_CAMERA_END = "render-camera-end";
27372              t.ATTACHMENT_SCALE_CAHNGED = "attachment-scale-changed";
27373            }(Wf || (Wf = t("PipelineEventType", {})));
27374            nr.getPhaseID = dm;
27375            t("RenderPipeline", nr.RenderPipeline);
27376            t("RenderFlow", nr.RenderFlow);
27377            t("RenderStage", nr.RenderStage);
27378            t("InstancedBuffer", nr.InstancedBuffer);
27379            const Yf = t("PipelineStateManager", nr.PipelineStateManager);
27380            const qf = t("ForwardPipeline", nr.ForwardPipeline);
27381            const Kf = t("ForwardFlow", nr.ForwardFlow);
27382            const Jf = t("ShadowFlow", nr.ShadowFlow);
27383            const Zf = t("ForwardStage", nr.ForwardStage);
27384            const Qf = t("ShadowStage", nr.ShadowStage);
27385            const $f = t("DeferredPipeline", nr.DeferredPipeline);
27386            const tg = t("MainFlow", nr.MainFlow);
27387            const eg = t("LightingStage", nr.LightingStage);
27388            const ig = t("PostProcessStage", nr.PostProcessStage);
27389            const sg = t("GbufferStage", nr.GbufferStage);
27390            const ng = t("BloomStage", nr.BloomStage);
27391            let rg = nr.PipelineStateManager.getOrCreatePipelineState;
27392            nr.PipelineStateManager.getOrCreatePipelineState = function(t, e, i, s, n) {
27393              return rg(e, i, s, n);
27394            };
27395            const og = qf.prototype;
27396            og._ctor = function() {
27397              this._tag = 0;
27398              this._flows = [];
27399            };
27400            og.init = function() {
27401              for (let t = 0; t < this._flows.length; t++) this._flows[t].init(this);
27402              const t = new nr.RenderPipelineInfo(this._tag, this._flows);
27403              this.initialize(t);
27404            };
27405            const ag = og.onLoaded;
27406            og.onLoaded = function() {
27407              ag && ag.call(this);
27408              for (let t = 0; t < this._flows.length; t++) this._flows[t].init(this);
27409              const t = new nr.RenderPipelineInfo(this._tag, this._flows);
27410              this.initialize(t);
27411            };
27412            const lg = Kf.prototype;
27413            lg._ctor = function() {
27414              this._name = 0;
27415              this._priority = 0;
27416              this._tag = 0;
27417              this._stages = [];
27418            };
27419            lg.init = function(t) {
27420              for (let e = 0; e < this._stages.length; e++) this._stages[e].init(t);
27421              const e = new nr.RenderFlowInfo(this._name, this._priority, this._tag, this._stages);
27422              this.initialize(e);
27423            };
27424            const hg = Jf.prototype;
27425            hg._ctor = function() {
27426              this._name = 0;
27427              this._priority = 0;
27428              this._tag = 0;
27429              this._stages = [];
27430            };
27431            hg.init = function(t) {
27432              for (let e = 0; e < this._stages.length; e++) this._stages[e].init(t);
27433              const e = new nr.RenderFlowInfo(this._name, this._priority, this._tag, this._stages);
27434              this.initialize(e);
27435            };
27436            const cg = Zf.prototype;
27437            cg._ctor = function() {
27438              this._name = 0;
27439              this._priority = 0;
27440              this._tag = 0;
27441              this.renderQueues = [];
27442            };
27443            cg.init = function(t) {
27444              const e = [];
27445              for (let t = 0; t < this.renderQueues.length; t++) e.push(this.renderQueues[t].init());
27446              const i = new nr.RenderStageInfo(this._name, this._priority, this._tag, e);
27447              this.initialize(i);
27448            };
27449            const ug = Qf.prototype;
27450            ug._ctor = function() {
27451              this._name = 0;
27452              this._priority = 0;
27453              this._tag = 0;
27454            };
27455            ug.init = function(t) {
27456              const e = new nr.RenderStageInfo(this._name, this._priority, this._tag, []);
27457              this.initialize(e);
27458            };
27459            class _g {
27460              constructor() {
27461                this.isTransparent = !1;
27462                this.sortMode = 0;
27463                this.stages = [];
27464                this.isTransparent = !1;
27465                this.sortMode = 0;
27466                this.stages = [];
27467              }
27468              init() {
27469                return new nr.RenderQueueDesc(this.isTransparent, this.sortMode, this.stages);
27470              }
27471            }
27472            t("RenderQueueDesc", _g);
27473            const dg = $f.prototype;
27474            dg._ctor = function() {
27475              this._tag = 0;
27476              this._flows = [];
27477              this.renderTextures = [];
27478              this.materials = [];
27479            };
27480            const pg = dg.onLoaded;
27481            dg.onLoaded = function() {
27482              pg && pg.call(this);
27483              for (let t = 0; t < this._flows.length; t++) this._flows[t].init(this);
27484              let t = new nr.RenderPipelineInfo(this._tag, this._flows);
27485              this.initialize(t);
27486            };
27487            const mg = tg.prototype;
27488            mg._ctor = function() {
27489              this._name = 0;
27490              this._priority = 0;
27491              this._tag = 0;
27492              this._stages = [];
27493            };
27494            mg.init = function(t) {
27495              for (let e = 0; e < this._stages.length; e++) this._stages[e].init(t);
27496              let e = new nr.RenderFlowInfo(this._name, this._priority, this._tag, this._stages);
27497              this.initialize(e);
27498            };
27499            const fg = sg.prototype;
27500            fg._ctor = function() {
27501              this._name = 0;
27502              this._priority = 0;
27503              this._tag = 0;
27504              this.renderQueues = [];
27505            };
27506            fg.init = function(t) {
27507              const e = [];
27508              for (let t = 0; t < this.renderQueues.length; t++) e.push(this.renderQueues[t].init());
27509              let i = new nr.RenderStageInfo(this._name, this._priority, this._tag, e);
27510              this.initialize(i);
27511            };
27512            const gg = eg.prototype;
27513            gg._ctor = function() {
27514              this._name = 0;
27515              this._priority = 0;
27516              this._tag = 0;
27517              this.renderQueues = [];
27518              this._deferredMaterial = null;
27519            };
27520            gg.init = function(t) {
27521              const e = [];
27522              for (let t = 0; t < this.renderQueues.length; t++) e.push(this.renderQueues[t].init());
27523              t.pipelineSceneData.deferredLightingMaterial = this._deferredMaterial;
27524              let i = new nr.RenderStageInfo(this._name, this._priority, this._tag, e);
27525              this.initialize(i);
27526            };
27527            const yg = ng.prototype;
27528            yg._ctor = function() {
27529              this._name = 0;
27530              this._priority = 0;
27531              this._tag = 0;
27532              this.renderQueues = [];
27533              this._bloomMaterial = null;
27534            };
27535            yg.init = function(t) {
27536              const e = [];
27537              for (let t = 0; t < this.renderQueues.length; t++) e.push(this.renderQueues[t].init());
27538              t.pipelineSceneData.bloomMaterial = this._bloomMaterial;
27539              let i = new nr.RenderStageInfo(this._name, this._priority, this._tag, e);
27540              this.initialize(i);
27541            };
27542            const bg = ig.prototype;
27543            bg._ctor = function() {
27544              this._name = 0;
27545              this._priority = 0;
27546              this._tag = 0;
27547              this.renderQueues = [];
27548              this._postProcessMaterial = null;
27549            };
27550            bg.init = function(t) {
27551              const e = [];
27552              for (let t = 0; t < this.renderQueues.length; t++) e.push(this.renderQueues[t].init());
27553              t.pipelineSceneData.postProcessMaterial = this._postProcessMaterial;
27554              let i = new nr.RenderStageInfo(this._name, this._priority, this._tag, e);
27555              this.initialize(i);
27556            };
27557            Xt("DeferredPipeline", $f);
27558            Xt("MainFlow", tg);
27559            Xt("GbufferStage", sg);
27560            Xt("LightingStage", eg);
27561            Xt("BloomStage", ng);
27562            Xt("PostProcessStage", ig);
27563            Xt("ForwardPipeline", qf);
27564            Xt("ForwardFlow", Kf);
27565            Xt("ShadowFlow", Jf);
27566            Xt("ForwardStage", Zf);
27567            Xt("ShadowStage", Qf);
27568            Xt("RenderQueueDesc", _g);
27569            const Sg = new Qi;
27570            class Ag {
27571              get isFinished() {
27572                return this._curTime >= this.settings.totalTime;
27573              }
27574              set curTime(t) {
27575                this._curTime = t;
27576              }
27577              get curTime() {
27578                return this._curTime;
27579              }
27580              init() {
27581                var t, e, i, s, n, r, o;
27582                this.settings = {
27583                  enabled: null === (t = de.querySettings(_e.Category.SPLASH_SCREEN, "enabled")) || void 0 === t || t,
27584                  totalTime: null !== (e = de.querySettings(_e.Category.SPLASH_SCREEN, "totalTime")) && void 0 !== e ? e : 3e3,
27585                  base64src: null !== (i = de.querySettings(_e.Category.SPLASH_SCREEN, "base64src")) && void 0 !== i ? i : "",
27586                  effect: null !== (s = de.querySettings(_e.Category.SPLASH_SCREEN, "effect")) && void 0 !== s ? s : "FADE-INOUT",
27587                  clearColor: null !== (n = de.querySettings(_e.Category.SPLASH_SCREEN, "clearColor")) && void 0 !== n ? n : new gn(.88, .88, .88, 1),
27588                  displayRatio: null !== (r = de.querySettings(_e.Category.SPLASH_SCREEN, "displayRatio")) && void 0 !== r ? r : .4,
27589                  displayWatermark: null === (o = de.querySettings(_e.Category.SPLASH_SCREEN, "displayWatermark")) || void 0 === o || o
27590                };
27591                this._curTime = 0;
27592                if (this.settings.enabled && "" !== this.settings.base64src && !(this.settings.totalTime <= 0)) {
27593                  this.device = m.director.root.device;
27594                  this.swapchain = m.director.root.mainWindow.swapchain;
27595                  this.framebuffer = m.director.root.mainWindow.framebuffer;
27596                  this.preInit();
27597                  this.settings.displayWatermark && this.initWarterMark();
27598                  return new Promise(((t, e) => {
27599                    this.logoImage = new Image;
27600                    this.logoImage.onload = () => {
27601                      this.initLogo();
27602                      t();
27603                    };
27604                    this.logoImage.onerror = () => {
27605                      e();
27606                    };
27607                    this.logoImage.src = this.settings.base64src;
27608                  }));
27609                }
27610                this.settings.totalTime = 0;
27611                return Promise.resolve();
27612              }
27613              preInit() {
27614                const t = this.settings.clearColor;
27615                this.clearColors = [ new gn(t.x, t.y, t.z, t.w) ];
27616                const {device: e, swapchain: i} = this;
27617                this.renderArea = new hn(0, 0, i.width, i.height);
27618                this.cmdBuff = e.commandBuffer;
27619                const s = new Float32Array([ .5, .5, 1, 0, -.5, .5, 0, 0, .5, -.5, 1, 1, -.5, -.5, 0, 1 ]);
27620                const n = 4 * Float32Array.BYTES_PER_ELEMENT;
27621                const r = 4 * n;
27622                this.vertexBuffers = e.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.DEVICE, r, n));
27623                this.vertexBuffers.update(s);
27624                const o = new Uint16Array([ 0, 1, 2, 1, 3, 2 ]);
27625                const a = Uint16Array.BYTES_PER_ELEMENT;
27626                const l = 6 * a;
27627                this.indicesBuffers = e.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, l, a));
27628                this.indicesBuffers.update(o);
27629                const h = [ new Vn("a_position", bs.RG32F), new Vn("a_texCoord", bs.RG32F) ];
27630                const c = new Un(h, [ this.vertexBuffers ], this.indicesBuffers);
27631                this.quadAssmebler = e.createInputAssembler(c);
27632                this.projection = new qi;
27633                qi.ortho(this.projection, -1, 1, -1, 1, -1, 1, e.capabilities.clipSpaceMinZ, e.capabilities.clipSpaceSignY, i.surfaceTransform);
27634              }
27635              update(t) {
27636                const e = this.settings;
27637                const {device: i, swapchain: s} = this;
27638                qi.ortho(this.projection, -1, 1, -1, 1, -1, 1, i.capabilities.clipSpaceMinZ, i.capabilities.clipSpaceSignY, s.surfaceTransform);
27639                const n = s.width;
27640                const r = s.height;
27641                const o = n < r ? n : r;
27642                this._curTime += 1e3 * t;
27643                let a = F_(di(this._curTime / e.totalTime));
27644                "NONE" === e.effect && (a = 1);
27645                const l = this.logoTexture.width;
27646                const h = this.logoTexture.height;
27647                const c = o * e.displayRatio;
27648                let u = c * l / h;
27649                let _ = c;
27650                if (s.surfaceTransform === gs.ROTATE_90 || s.surfaceTransform === gs.ROTATE_270) {
27651                  u = c * n / r;
27652                  _ = c * h / l * r / n;
27653                }
27654                this.logoMat.setProperty("resolution", Sg.set(n, r), 0);
27655                this.logoMat.setProperty("scale", Sg.set(u, _), 0);
27656                this.logoMat.setProperty("translate", Sg.set(.5 * n, .5 * r), 0);
27657                this.logoMat.setProperty("percent", a);
27658                this.logoMat.setProperty("u_projection", this.projection);
27659                this.logoMat.passes[0].update();
27660                if (e.displayWatermark && this.watermarkMat) {
27661                  const t = .5 * o;
27662                  const e = this.watermarkTexture.width;
27663                  let i = t;
27664                  let l = t * this.watermarkTexture.height / e;
27665                  if (s.surfaceTransform === gs.ROTATE_90 || s.surfaceTransform === gs.ROTATE_270) {
27666                    i = .5 * t;
27667                    l = t * n / r * .5;
27668                  }
27669                  this.watermarkMat.setProperty("resolution", Sg.set(n, r), 0);
27670                  this.watermarkMat.setProperty("scale", Sg.set(i, l), 0);
27671                  this.watermarkMat.setProperty("translate", Sg.set(.5 * n, .1 * r), 0);
27672                  this.watermarkMat.setProperty("percent", a);
27673                  this.watermarkMat.setProperty("u_projection", this.projection);
27674                  this.watermarkMat.passes[0].update();
27675                }
27676                this.frame();
27677              }
27678              initLogo() {
27679                const t = this.device;
27680                this.logoMat = new hm;
27681                this.logoMat.initialize({
27682                  effectName: "util/splash-screen"
27683                });
27684                const e = new Rn;
27685                e.addressU = Ps.CLAMP;
27686                e.addressV = Ps.CLAMP;
27687                e.addressW = Ps.CLAMP;
27688                this.sampler = t.getSampler(e);
27689                this.logoTexture = t.createTexture(new xn(xs.TEX2D, ws.SAMPLED | ws.TRANSFER_DST, bs.RGBA8, this.logoImage.width, this.logoImage.height));
27690                const i = this.logoMat.passes[0];
27691                const s = i.getBinding("mainTexture");
27692                i.bindTexture(s, this.logoTexture);
27693                this.shader = i.getShaderVariant();
27694                const n = i.descriptorSet;
27695                n.bindSampler(s, this.sampler);
27696                n.update();
27697                const r = new mn;
27698                r.texExtent.width = this.logoImage.width;
27699                r.texExtent.height = this.logoImage.height;
27700                r.texExtent.depth = 1;
27701                t.copyTexImagesToTexture([ this.logoImage ], this.logoTexture, [ r ]);
27702              }
27703              initWarterMark() {
27704                const t = document.createElement("canvas");
27705                t.width = 330;
27706                t.height = 30;
27707                t.style.width = `${t.width}`;
27708                t.style.height = `${t.height}`;
27709                const e = t.getContext("2d");
27710                e.font = "18px Arial";
27711                e.textBaseline = "top";
27712                e.textAlign = "left";
27713                e.fillStyle = "`#424242`";
27714                const i = "Powered by Cocos Creator";
27715                const s = e.measureText(i);
27716                e.fillText(i, (330 - s.width) / 2, 6);
27717                const n = new mn;
27718                n.texExtent.width = t.width;
27719                n.texExtent.height = t.height;
27720                n.texExtent.depth = 1;
27721                this.watermarkTexture = this.device.createTexture(new xn(xs.TEX2D, ws.SAMPLED | ws.TRANSFER_DST, bs.RGBA8, t.width, t.height));
27722                this.device.copyTexImagesToTexture([ t ], this.watermarkTexture, [ n ]);
27723                this.watermarkMat = new hm;
27724                this.watermarkMat.initialize({
27725                  effectName: "util/splash-screen"
27726                });
27727                const r = this.watermarkMat.passes[0];
27728                const o = r.getBinding("mainTexture");
27729                r.bindTexture(o, this.watermarkTexture);
27730                r.descriptorSet.update();
27731              }
27732              frame() {
27733                const {device: t, swapchain: e} = this;
27734                if (!Vo.isXR || xr.entry.isRenderAllowable()) {
27735                  const i = Vo.isXR ? 2 : 1;
27736                  for (let s = 0; s < i; s++) {
27737                    Vo.isXR && xr.entry.renderLoopStart(s);
27738                    t.acquire([ e ]);
27739                    const i = this.cmdBuff;
27740                    const n = this.framebuffer;
27741                    const r = this.renderArea;
27742                    r.width = e.width;
27743                    r.height = e.height;
27744                    i.begin();
27745                    i.beginRenderPass(n.renderPass, n, r, this.clearColors, 1, 0);
27746                    const o = this.logoMat.passes[0];
27747                    const a = Yf.getOrCreatePipelineState(t, o, this.shader, n.renderPass, this.quadAssmebler);
27748                    i.bindPipelineState(a);
27749                    i.bindDescriptorSet(wm.MATERIAL, o.descriptorSet);
27750                    i.bindInputAssembler(this.quadAssmebler);
27751                    i.draw(this.quadAssmebler);
27752                    if (this.settings.displayWatermark && this.watermarkMat) {
27753                      const e = this.watermarkMat.passes[0];
27754                      const s = Yf.getOrCreatePipelineState(t, e, this.shader, n.renderPass, this.quadAssmebler);
27755                      i.bindPipelineState(s);
27756                      i.bindDescriptorSet(wm.MATERIAL, e.descriptorSet);
27757                      i.bindInputAssembler(this.quadAssmebler);
27758                      i.draw(this.quadAssmebler);
27759                    }
27760                    i.endRenderPass();
27761                    i.end();
27762                    t.flushCommands([ i ]);
27763                    t.queue.submit([ i ]);
27764                    t.present();
27765                    Vo.isXR && xr.entry.renderLoopEnd(s);
27766                  }
27767                }
27768              }
27769              destroy() {
27770                this.device = null;
27771                this.swapchain = null;
27772                this.clearColors = null;
27773                this.logoImage.destroy && this.logoImage.destroy();
27774                this.logoImage = null;
27775                this.framebuffer = null;
27776                this.renderArea = null;
27777                this.cmdBuff = null;
27778                this.shader = null;
27779                this.logoMat.destroy();
27780                this.logoMat = null;
27781                this.logoTexture.destroy();
27782                this.logoTexture = null;
27783                this.quadAssmebler.destroy();
27784                this.quadAssmebler = null;
27785                this.vertexBuffers.destroy();
27786                this.vertexBuffers = null;
27787                this.indicesBuffers.destroy();
27788                this.indicesBuffers = null;
27789                this.sampler = null;
27790                if (this.watermarkTexture) {
27791                  this.watermarkMat.destroy();
27792                  this.watermarkMat = null;
27793                  this.watermarkTexture.destroy();
27794                  this.watermarkTexture = null;
27795                }
27796                this.settings = null;
27797              }
27798              static get instance() {
27799                Ag._ins || (Ag._ins = new Ag);
27800                return Ag._ins;
27801              }
27802              constructor() {
27803                this._curTime = 0;
27804              }
27805            }
27806            Ag._ins = void 0;
27807            m.internal.SplashScreen = Ag;
27808            class Tg {
27809              constructor() {
27810                this._id = "";
27811                this._priority = 0;
27812                this._executeInEditMode = !1;
27813              }
27814              set priority(t) {
27815                this._priority = t;
27816              }
27817              get priority() {
27818                return this._priority;
27819              }
27820              set id(t) {
27821                this._id = t;
27822              }
27823              get id() {
27824                return this._id;
27825              }
27826              static sortByPriority(t, e) {
27827                return t._priority < e._priority ? 1 : t._priority > e.priority ? -1 : 0;
27828              }
27829              init() {}
27830              update(t) {}
27831              postUpdate(t) {}
27832              destroy() {}
27833            }
27834            t("System", Tg);
27835            Tg.Priority = oe({
27836              LOW: 0,
27837              MEDIUM: 100,
27838              HIGH: 200,
27839              SCHEDULER: 1 << 31 >>> 0
27840            });
27841            const vg = new ut("Scheduler");
27842            class Eg {
27843              constructor(t, e, i, s) {
27844                this.target = void 0;
27845                this.priority = void 0;
27846                this.paused = void 0;
27847                this.markedForDeletion = void 0;
27848                this.target = t;
27849                this.priority = e;
27850                this.paused = i;
27851                this.markedForDeletion = s;
27852              }
27853            }
27854            Eg.get = (t, e, i, s) => {
27855              let n = Eg._listEntries.pop();
27856              if (n) {
27857                n.target = t;
27858                n.priority = e;
27859                n.paused = i;
27860                n.markedForDeletion = s;
27861              } else n = new Eg(t, e, i, s);
27862              return n;
27863            };
27864            Eg.put = t => {
27865              if (Eg._listEntries.length < 20) {
27866                t.target = null;
27867                Eg._listEntries.push(t);
27868              }
27869            };
27870            Eg._listEntries = [];
27871            class Cg {
27872              constructor(t, e, i, s) {
27873                this.list = void 0;
27874                this.entry = void 0;
27875                this.target = void 0;
27876                this.callback = void 0;
27877                this.list = t;
27878                this.entry = e;
27879                this.target = i;
27880                this.callback = s;
27881              }
27882            }
27883            Cg.get = (t, e, i, s) => {
27884              let n = Cg._hashUpdateEntries.pop();
27885              if (n) {
27886                n.list = t;
27887                n.entry = e;
27888                n.target = i;
27889                n.callback = s;
27890              } else n = new Cg(t, e, i, s);
27891              return n;
27892            };
27893            Cg.put = t => {
27894              if (Cg._hashUpdateEntries.length < 20) {
27895                t.list = t.entry = t.target = t.callback = null;
27896                Cg._hashUpdateEntries.push(t);
27897              }
27898            };
27899            Cg._hashUpdateEntries = [];
27900            class xg {
27901              constructor(t, e, i, s, n, r) {
27902                this.timers = void 0;
27903                this.target = void 0;
27904                this.timerIndex = void 0;
27905                this.currentTimer = void 0;
27906                this.currentTimerSalvaged = void 0;
27907                this.paused = void 0;
27908                this.timers = t;
27909                this.target = e;
27910                this.timerIndex = i;
27911                this.currentTimer = s;
27912                this.currentTimerSalvaged = n;
27913                this.paused = r;
27914              }
27915            }
27916            xg.get = (t, e, i, s, n, r) => {
27917              let o = xg._hashTimerEntries.pop();
27918              if (o) {
27919                o.timers = t;
27920                o.target = e;
27921                o.timerIndex = i;
27922                o.currentTimer = s;
27923                o.currentTimerSalvaged = n;
27924                o.paused = r;
27925              } else o = new xg(t, e, i, s, n, r);
27926              return o;
27927            };
27928            xg.put = t => {
27929              if (xg._hashTimerEntries.length < 20) {
27930                t.timers = t.target = t.currentTimer = null;
27931                xg._hashTimerEntries.push(t);
27932              }
27933            };
27934            xg._hashTimerEntries = [];
27935            class wg {
27936              constructor() {
27937                this._lock = void 0;
27938                this._scheduler = void 0;
27939                this._elapsed = void 0;
27940                this._runForever = void 0;
27941                this._useDelay = void 0;
27942                this._timesExecuted = void 0;
27943                this._repeat = void 0;
27944                this._delay = void 0;
27945                this._interval = void 0;
27946                this._target = void 0;
27947                this._callback = void 0;
27948                this._lock = !1;
27949                this._scheduler = null;
27950                this._elapsed = -1;
27951                this._runForever = !1;
27952                this._useDelay = !1;
27953                this._timesExecuted = 0;
27954                this._repeat = 0;
27955                this._delay = 0;
27956                this._interval = 0;
27957                this._target = null;
27958                this._callback = null;
27959              }
27960              initWithCallback(t, e, i, s, n, r) {
27961                this._lock = !1;
27962                this._scheduler = t;
27963                this._target = i;
27964                this._callback = e;
27965                this._elapsed = -1;
27966                this._interval = s;
27967                this._delay = r;
27968                this._useDelay = this._delay > 0;
27969                this._repeat = n;
27970                this._runForever = this._repeat === m.macro.REPEAT_FOREVER;
27971                return !0;
27972              }
27973              getInterval() {
27974                return this._interval;
27975              }
27976              setInterval(t) {
27977                this._interval = t;
27978              }
27979              update(t) {
27980                if (-1 === this._elapsed) {
27981                  this._elapsed = 0;
27982                  this._timesExecuted = 0;
27983                } else {
27984                  this._elapsed += t;
27985                  if (this._runForever && !this._useDelay) {
27986                    if (this._elapsed >= this._interval) {
27987                      this.trigger();
27988                      this._elapsed = 0;
27989                    }
27990                  } else {
27991                    if (this._useDelay) {
27992                      if (this._elapsed >= this._delay) {
27993                        this.trigger();
27994                        this._elapsed -= this._delay;
27995                        this._timesExecuted += 1;
27996                        this._useDelay = !1;
27997                      }
27998                    } else if (this._elapsed >= this._interval) {
27999                      this.trigger();
28000                      this._elapsed = 0;
28001                      this._timesExecuted += 1;
28002                    }
28003                    this._callback && !this._runForever && this._timesExecuted > this._repeat && this.cancel();
28004                  }
28005                }
28006              }
28007              getCallback() {
28008                return this._callback;
28009              }
28010              trigger() {
28011                if (this._target && this._callback) {
28012                  this._lock = !0;
28013                  this._callback.call(this._target, this._elapsed);
28014                  this._lock = !1;
28015                }
28016              }
28017              cancel() {
28018                this._scheduler.unschedule(this._callback, this._target);
28019              }
28020            }
28021            wg._timers = [];
28022            wg.get = () => wg._timers.pop() || new wg;
28023            wg.put = t => {
28024              if (wg._timers.length < 20 && !t._lock) {
28025                t._scheduler = t._target = t._callback = null;
28026                wg._timers.push(t);
28027              }
28028            };
28029            class Rg extends Tg {
28030              static enableForTarget(t) {
28031                let e = !1;
28032                (t.uuid || t.id) && (e = !0);
28033                e || (t.__instanceId ? N(1513) : t.id = vg.getNewId());
28034              }
28035              constructor() {
28036                super();
28037                this._timeScale = void 0;
28038                this._updatesNegList = void 0;
28039                this._updates0List = void 0;
28040                this._updatesPosList = void 0;
28041                this._hashForUpdates = void 0;
28042                this._hashForTimers = void 0;
28043                this._currentTarget = void 0;
28044                this._currentTargetSalvaged = void 0;
28045                this._updateHashLocked = void 0;
28046                this._arrayForTimers = void 0;
28047                this._timeScale = 1;
28048                this._updatesNegList = [];
28049                this._updates0List = [];
28050                this._updatesPosList = [];
28051                this._hashForUpdates = vt(!0);
28052                this._hashForTimers = vt(!0);
28053                this._currentTarget = null;
28054                this._currentTargetSalvaged = !1;
28055                this._updateHashLocked = !1;
28056                this._arrayForTimers = [];
28057              }
28058              setTimeScale(t) {
28059                this._timeScale = t;
28060              }
28061              getTimeScale() {
28062                return this._timeScale;
28063              }
28064              update(t) {
28065                this._updateHashLocked = !0;
28066                1 !== this._timeScale && (t *= this._timeScale);
28067                let e;
28068                let i;
28069                let s;
28070                let n;
28071                for (e = 0, i = this._updatesNegList, s = i.length; e < s; e++) {
28072                  n = i[e];
28073                  n.paused || n.markedForDeletion || n.target.update(t);
28074                }
28075                for (e = 0, i = this._updates0List, s = i.length; e < s; e++) {
28076                  n = i[e];
28077                  n.paused || n.markedForDeletion || n.target.update(t);
28078                }
28079                for (e = 0, i = this._updatesPosList, s = i.length; e < s; e++) {
28080                  n = i[e];
28081                  n.paused || n.markedForDeletion || n.target.update(t);
28082                }
28083                let r;
28084                const o = this._arrayForTimers;
28085                for (e = 0; e < o.length; e++) {
28086                  r = o[e];
28087                  this._currentTarget = r;
28088                  this._currentTargetSalvaged = !1;
28089                  if (!r.paused) for (r.timerIndex = 0; r.timerIndex < r.timers.length; ++r.timerIndex) {
28090                    r.currentTimer = r.timers[r.timerIndex];
28091                    r.currentTimerSalvaged = !1;
28092                    r.currentTimer.update(t);
28093                    r.currentTimer = null;
28094                  }
28095                  if (this._currentTargetSalvaged && 0 === this._currentTarget.timers.length) {
28096                    this._removeHashElement(this._currentTarget);
28097                    --e;
28098                  }
28099                }
28100                for (e = 0, i = this._updatesNegList; e < i.length; ) {
28101                  n = i[e];
28102                  n.markedForDeletion ? this._removeUpdateFromHash(n) : e++;
28103                }
28104                for (e = 0, i = this._updates0List; e < i.length; ) {
28105                  n = i[e];
28106                  n.markedForDeletion ? this._removeUpdateFromHash(n) : e++;
28107                }
28108                for (e = 0, i = this._updatesPosList; e < i.length; ) {
28109                  n = i[e];
28110                  n.markedForDeletion ? this._removeUpdateFromHash(n) : e++;
28111                }
28112                this._updateHashLocked = !1;
28113                this._currentTarget = null;
28114              }
28115              schedule(t, e, i, s, n, r) {
28116                if ("function" != typeof t) {
28117                  const i = t;
28118                  t = e;
28119                  e = i;
28120                }
28121                if (3 === arguments.length || 4 === arguments.length || 5 === arguments.length) {
28122                  r = !!s;
28123                  s = m.macro.REPEAT_FOREVER;
28124                  n = 0;
28125                }
28126                k(e, 1502);
28127                const o = e.uuid || e.id;
28128                if (!o) {
28129                  F(1510);
28130                  return;
28131                }
28132                let a = this._hashForTimers[o];
28133                if (a) a.paused !== r && N(1511); else {
28134                  a = xg.get(null, e, 0, null, null, r);
28135                  this._arrayForTimers.push(a);
28136                  this._hashForTimers[o] = a;
28137                }
28138                let l;
28139                let h;
28140                if (null == a.timers) a.timers = []; else for (h = 0; h < a.timers.length; ++h) {
28141                  l = a.timers[h];
28142                  if (l && t === l._callback) {
28143                    P(1507, l.getInterval(), i);
28144                    l._interval = i;
28145                    return;
28146                  }
28147                }
28148                l = wg.get();
28149                l.initWithCallback(this, t, e, i, s, n);
28150                a.timers.push(l);
28151                this._currentTarget === a && this._currentTargetSalvaged && (this._currentTargetSalvaged = !1);
28152              }
28153              scheduleUpdate(t, e, i) {
28154                const s = t.uuid || t.id;
28155                if (!s) {
28156                  F(1510);
28157                  return;
28158                }
28159                const n = this._hashForUpdates[s];
28160                if (n && n.entry) {
28161                  if (n.entry.priority === e) {
28162                    n.entry.markedForDeletion = !1;
28163                    n.entry.paused = i;
28164                    return;
28165                  }
28166                  if (this._updateHashLocked) {
28167                    P(1506);
28168                    n.entry.markedForDeletion = !1;
28169                    n.entry.paused = i;
28170                    return;
28171                  }
28172                  this.unscheduleUpdate(t);
28173                }
28174                const r = Eg.get(t, e, i, !1);
28175                let o;
28176                if (0 === e) {
28177                  o = this._updates0List;
28178                  this._appendIn(o, r);
28179                } else {
28180                  o = e < 0 ? this._updatesNegList : this._updatesPosList;
28181                  this._priorityIn(o, r, e);
28182                }
28183                this._hashForUpdates[s] = Cg.get(o, r, t, null);
28184              }
28185              unschedule(t, e) {
28186                if (!e || !t) return;
28187                const i = e.uuid || e.id;
28188                if (!i) {
28189                  F(1510);
28190                  return;
28191                }
28192                const s = this._hashForTimers[i];
28193                if (s) {
28194                  const e = s.timers;
28195                  for (let i = 0, n = e.length; i < n; i++) {
28196                    const n = e[i];
28197                    if (t === n._callback) {
28198                      n !== s.currentTimer || s.currentTimerSalvaged || (s.currentTimerSalvaged = !0);
28199                      e.splice(i, 1);
28200                      wg.put(n);
28201                      s.timerIndex >= i && s.timerIndex--;
28202                      0 === e.length && (this._currentTarget === s ? this._currentTargetSalvaged = !0 : this._removeHashElement(s));
28203                      return;
28204                    }
28205                  }
28206                }
28207              }
28208              unscheduleUpdate(t) {
28209                if (!t) return;
28210                const e = t.uuid || t.id;
28211                if (!e) {
28212                  F(1510);
28213                  return;
28214                }
28215                const i = this._hashForUpdates[e];
28216                i && (this._updateHashLocked ? i.entry.markedForDeletion = !0 : this._removeUpdateFromHash(i.entry));
28217              }
28218              unscheduleAllForTarget(t) {
28219                if (!t) return;
28220                const e = t.uuid || t.id;
28221                if (!e) {
28222                  F(1510);
28223                  return;
28224                }
28225                const i = this._hashForTimers[e];
28226                if (i) {
28227                  const t = i.timers;
28228                  t.indexOf(i.currentTimer) > -1 && !i.currentTimerSalvaged && (i.currentTimerSalvaged = !0);
28229                  for (let e = 0, i = t.length; e < i; e++) wg.put(t[e]);
28230                  t.length = 0;
28231                  this._currentTarget === i ? this._currentTargetSalvaged = !0 : this._removeHashElement(i);
28232                }
28233                this.unscheduleUpdate(t);
28234              }
28235              unscheduleAll() {
28236                this.unscheduleAllWithMinPriority(Tg.Priority.SCHEDULER);
28237              }
28238              unscheduleAllWithMinPriority(t) {
28239                let e;
28240                let i;
28241                const s = this._arrayForTimers;
28242                for (e = s.length - 1; e >= 0; e--) {
28243                  i = s[e];
28244                  this.unscheduleAllForTarget(i.target);
28245                }
28246                let n;
28247                let r = 0;
28248                if (t < 0) for (e = 0; e < this._updatesNegList.length; ) {
28249                  r = this._updatesNegList.length;
28250                  n = this._updatesNegList[e];
28251                  n && n.priority >= t && this.unscheduleUpdate(n.target);
28252                  r === this._updatesNegList.length && e++;
28253                }
28254                if (t <= 0) for (e = 0; e < this._updates0List.length; ) {
28255                  r = this._updates0List.length;
28256                  n = this._updates0List[e];
28257                  n && this.unscheduleUpdate(n.target);
28258                  r === this._updates0List.length && e++;
28259                }
28260                for (e = 0; e < this._updatesPosList.length; ) {
28261                  r = this._updatesPosList.length;
28262                  n = this._updatesPosList[e];
28263                  n && n.priority >= t && this.unscheduleUpdate(n.target);
28264                  r === this._updatesPosList.length && e++;
28265                }
28266              }
28267              isScheduled(t, e) {
28268                k(t, 1508);
28269                k(e, 1509);
28270                const i = e.uuid || e.id;
28271                if (!i) {
28272                  F(1510);
28273                  return !1;
28274                }
28275                const s = this._hashForTimers[i];
28276                if (!s) return !1;
28277                if (null == s.timers) return !1;
28278                {
28279                  const e = s.timers;
28280                  for (let i = 0; i < e.length; ++i) {
28281                    if (t === e[i]._callback) return !0;
28282                  }
28283                  return !1;
28284                }
28285              }
28286              pauseAllTargets() {
28287                return this.pauseAllTargetsWithMinPriority(Tg.Priority.SCHEDULER);
28288              }
28289              pauseAllTargetsWithMinPriority(t) {
28290                const e = [];
28291                let i;
28292                const s = this._arrayForTimers;
28293                let n;
28294                let r;
28295                for (n = 0, r = s.length; n < r; n++) {
28296                  i = s[n];
28297                  if (i) {
28298                    i.paused = !0;
28299                    e.push(i.target);
28300                  }
28301                }
28302                let o;
28303                if (t < 0) for (n = 0; n < this._updatesNegList.length; n++) {
28304                  o = this._updatesNegList[n];
28305                  if (o && o.priority >= t) {
28306                    o.paused = !0;
28307                    e.push(o.target);
28308                  }
28309                }
28310                if (t <= 0) for (n = 0; n < this._updates0List.length; n++) {
28311                  o = this._updates0List[n];
28312                  if (o) {
28313                    o.paused = !0;
28314                    e.push(o.target);
28315                  }
28316                }
28317                for (n = 0; n < this._updatesPosList.length; n++) {
28318                  o = this._updatesPosList[n];
28319                  if (o && o.priority >= t) {
28320                    o.paused = !0;
28321                    e.push(o.target);
28322                  }
28323                }
28324                return e;
28325              }
28326              resumeTargets(t) {
28327                if (t) for (let e = 0; e < t.length; e++) this.resumeTarget(t[e]);
28328              }
28329              pauseTarget(t) {
28330                k(t, 1503);
28331                const e = t.uuid || t.id;
28332                if (!e) {
28333                  F(1510);
28334                  return;
28335                }
28336                const i = this._hashForTimers[e];
28337                i && (i.paused = !0);
28338                const s = this._hashForUpdates[e];
28339                s && (s.entry.paused = !0);
28340              }
28341              resumeTarget(t) {
28342                k(t, 1504);
28343                const e = t.uuid || t.id;
28344                if (!e) {
28345                  F(1510);
28346                  return;
28347                }
28348                const i = this._hashForTimers[e];
28349                i && (i.paused = !1);
28350                const s = this._hashForUpdates[e];
28351                s && (s.entry.paused = !1);
28352              }
28353              isTargetPaused(t) {
28354                k(t, 1505);
28355                const e = t.uuid || t.id;
28356                if (!e) {
28357                  F(1510);
28358                  return !1;
28359                }
28360                const i = this._hashForTimers[e];
28361                if (i) return i.paused;
28362                const s = this._hashForUpdates[e];
28363                return !!s && s.entry.paused;
28364              }
28365              _removeHashElement(t) {
28366                const e = t.target.uuid || t.target.id;
28367                delete this._hashForTimers[e];
28368                const i = this._arrayForTimers;
28369                for (let e = 0, s = i.length; e < s; e++) if (i[e] === t) {
28370                  i.splice(e, 1);
28371                  break;
28372                }
28373                xg.put(t);
28374              }
28375              _removeUpdateFromHash(t) {
28376                const e = t.target.uuid || t.target.id;
28377                const i = this._hashForUpdates[e];
28378                if (i) {
28379                  const t = i.list;
28380                  const s = i.entry;
28381                  for (let e = 0, i = t.length; e < i; e++) if (t[e] === s) {
28382                    t.splice(e, 1);
28383                    break;
28384                  }
28385                  delete this._hashForUpdates[e];
28386                  Eg.put(s);
28387                  Cg.put(i);
28388                }
28389              }
28390              _priorityIn(t, e, i) {
28391                for (let s = 0; s < t.length; s++) if (i < t[s].priority) {
28392                  t.splice(s, 0, e);
28393                  return;
28394                }
28395                t.push(e);
28396              }
28397              _appendIn(t, e) {
28398                t.push(e);
28399              }
28400            }
28401            t("Scheduler", Rg);
28402            Rg.ID = "scheduler";
28403            m.Scheduler = Rg;
28404            const Ig = jsb.SubModel;
28405            const Mg = 0, Bg = 1, Dg = 2;
28406            const Pg = 0;
28407            const Og = 12;
28408            class Ng {
28409              get singleMode() {
28410                return this._singleMode;
28411              }
28412              set singleMode(t) {
28413                this._singleMode = t;
28414                this._updatePipeline();
28415                this._nativeConfig && (this._nativeConfig.singleMode = this._singleMode);
28416              }
28417              get lightingWithAlbedo() {
28418                return this._lightingWithAlbedo;
28419              }
28420              set lightingWithAlbedo(t) {
28421                this._lightingWithAlbedo = t;
28422                this._updatePipeline();
28423                this._nativeConfig && (this._nativeConfig.lightingWithAlbedo = this._lightingWithAlbedo);
28424              }
28425              get csmLayerColoration() {
28426                return this._csmLayerColoration;
28427              }
28428              set csmLayerColoration(t) {
28429                this._csmLayerColoration = t;
28430                this._updatePipeline();
28431                this._nativeConfig && (this._nativeConfig.csmLayerColoration = this._csmLayerColoration);
28432              }
28433              constructor() {
28434                this._singleMode = Pg;
28435                this._compositeModeValue = 0;
28436                this._lightingWithAlbedo = !0;
28437                this._csmLayerColoration = !1;
28438                this._nativeConfig = null;
28439                this._activate();
28440                if (null === this._nativeConfig) {
28441                  this._nativeConfig = new jsb.DebugViewConfig;
28442                  this._nativeConfig.compositeModeBitCount = Og;
28443                }
28444              }
28445              isCompositeModeEnabled(t) {
28446                return 0 !== (this._compositeModeValue & 1 << t);
28447              }
28448              enableCompositeMode(t, e) {
28449                this._enableCompositeMode(t, e);
28450                this._updatePipeline();
28451              }
28452              enableAllCompositeMode(t) {
28453                this._enableAllCompositeMode(t);
28454                this._updatePipeline();
28455              }
28456              isEnabled() {
28457                return this._getType() !== Mg;
28458              }
28459              reset() {
28460                this._activate();
28461                this._updatePipeline();
28462              }
28463              _activate() {
28464                this._singleMode = Pg;
28465                this._enableAllCompositeMode(!0);
28466                this._lightingWithAlbedo = !0;
28467                this._csmLayerColoration = !1;
28468                if (this._nativeConfig) {
28469                  this._nativeConfig.singleMode = this._singleMode;
28470                  this._nativeConfig.compositeModeValue = this._compositeModeValue;
28471                  this._nativeConfig.lightingWithAlbedo = this._lightingWithAlbedo;
28472                  this._nativeConfig.csmLayerColoration = this._csmLayerColoration;
28473                }
28474              }
28475              _updatePipeline() {
28476                const t = m.director.root;
28477                const e = t.pipeline;
28478                const i = this._getType();
28479                if (e.macros.CC_USE_DEBUG_VIEW !== i) {
28480                  e.macros.CC_USE_DEBUG_VIEW = i;
28481                  t.onGlobalPipelineStateChanged();
28482                }
28483              }
28484              _enableCompositeMode(t, e) {
28485                e ? this._compositeModeValue |= 1 << t : this._compositeModeValue &= ~(1 << t);
28486                this._nativeConfig && (this._nativeConfig.compositeModeValue = this._compositeModeValue);
28487              }
28488              _enableAllCompositeMode(t) {
28489                for (let e = 0; e < Og; e++) {
28490                  t ? this._compositeModeValue |= 1 << e : this._compositeModeValue &= ~(1 << e);
28491                  this._nativeConfig && (this._nativeConfig.compositeModeValue = this._compositeModeValue);
28492                }
28493              }
28494              _getType() {
28495                if (this._singleMode !== Pg) return Bg;
28496                if (!0 !== this._lightingWithAlbedo || !1 !== this._csmLayerColoration) return Dg;
28497                for (let t = 0; t < Og; t++) if (!this.isCompositeModeEnabled(t)) return Dg;
28498                return Mg;
28499              }
28500            }
28501            const Lg = jsb.RenderTexture.prototype;
28502            const Fg = jsb.TextureBase.prototype;
28503            Lg.createNode = null;
28504            const Vg = t("RenderTexture", jsb.RenderTexture);
28505            Vg.Filter = Qp;
28506            Vg.PixelFormat = Jp;
28507            Vg.WrapMode = Zp;
28508            Lg._serialize = function(t) {
28509              return {};
28510            };
28511            Lg._deserialize = function(t, e) {
28512              const i = t;
28513              this._width = i.w;
28514              this._height = i.h;
28515              this._name = i.n;
28516              Fg._deserialize.call(this, i.base, e);
28517            };
28518            const kg = Lg.readPixels;
28519            Lg.readPixels = function(t, e, i, s, n) {
28520              t = t || 0;
28521              e = e || 0;
28522              i = i || this.width;
28523              s = s || this.height;
28524              let r = kg.call(this, t, e, i, s);
28525              return 0 == r.length ? null : r;
28526            };
28527            m.RenderTexture = jsb.RenderTexture;
28528            Ul("cc.RenderTexture")(Vg);
28529            Y(tm.prototype, "TextureBase.prototype", [ {
28530              name: "hasPremultipliedAlpha"
28531            }, {
28532              name: "setPremultiplyAlpha"
28533            }, {
28534              name: "setFlipY"
28535            } ]);
28536            W(Vg.prototype, "RenderTexture.prototype", [ {
28537              name: "getGFXWindow",
28538              customFunction() {
28539                return this._window;
28540              }
28541            } ]);
28542            const Ug = t("BufferAsset", jsb.BufferAsset);
28543            m.BufferAsset = jsb.BufferAsset;
28544            const Gg = Ug.prototype;
28545            vh(Gg, "_nativeAsset", Object.getOwnPropertyDescriptor(Gg, "_nativeAsset"));
28546            Ul("cc.BufferAsset")(Ug);
28547            function zg(t, e) {
28548              for (const i of e) Array.isArray(i) ? zg(t, i) : t.push(i);
28549            }
28550            function Hg(t) {
28551              const e = [];
28552              zg(e, t);
28553              return e.join("");
28554            }
28555            const jg = co.Flags.Destroyed;
28556            const Xg = co.Flags.PersistentMask;
28557            const Wg = si.IDENTIFIER_RE;
28558            const Yg = "var ";
28559            const qg = "o";
28560            const Kg = {
28561              "cc.ClickEvent": !1,
28562              "cc.PrefabInfo": !1
28563            };
28564            const Jg = si.escapeForJS;
28565            class Zg {
28566              constructor(t, e) {
28567                this.varName = void 0;
28568                this.expression = void 0;
28569                this.varName = t;
28570                this.expression = e;
28571              }
28572              toString() {
28573                return `${Yg + this.varName}=${this.expression};`;
28574              }
28575            }
28576            function Qg(t, e) {
28577              return e instanceof Zg ? new Zg(e.varName, t + e.expression) : t + e;
28578            }
28579            function $g(t, e, i) {
28580              if (Array.isArray(i)) {
28581                i[0] = Qg(e, i[0]);
28582                t.push(i);
28583              } else t.push(`${Qg(e, i)};`);
28584            }
28585            class ty {
28586              constructor(t) {
28587                this._exps = void 0;
28588                this._targetExp = void 0;
28589                this._exps = [];
28590                this._targetExp = t;
28591              }
28592              append(t, e) {
28593                this._exps.push([ t, e ]);
28594              }
28595              writeCode(t) {
28596                let e;
28597                if (this._exps.length > 1) {
28598                  t.push(`t=${this._targetExp};`);
28599                  e = "t";
28600                } else {
28601                  if (1 !== this._exps.length) return;
28602                  e = this._targetExp;
28603                }
28604                for (let i = 0; i < this._exps.length; i++) {
28605                  const s = this._exps[i];
28606                  $g(t, `${e + ey(s[0])}=`, s[1]);
28607                }
28608              }
28609            }
28610            ty.pool = void 0;
28611            ty.pool = new $t((t => {
28612              t._exps.length = 0;
28613              t._targetExp = null;
28614            }), 1);
28615            ty.pool.get = function(t) {
28616              const e = this._get() || new ty;
28617              e._targetExp = t;
28618              return e;
28619            };
28620            function ey(t) {
28621              return Wg.test(t) ? `.${t}` : `[${Jg(t)}]`;
28622            }
28623            class iy {
28624              constructor(t, e) {
28625                this.parent = void 0;
28626                this.objsToClear_iN$t = void 0;
28627                this.codeArray = void 0;
28628                this.objs = void 0;
28629                this.funcs = void 0;
28630                this.funcModuleCache = void 0;
28631                this.globalVariables = void 0;
28632                this.globalVariableId = void 0;
28633                this.localVariableId = void 0;
28634                this.result = void 0;
28635                this.parent = e;
28636                this.objsToClear_iN$t = [];
28637                this.codeArray = [];
28638                this.objs = [];
28639                this.funcs = [];
28640                this.funcModuleCache = vt();
28641                Nt(this.funcModuleCache, Kg);
28642                this.globalVariables = [];
28643                this.globalVariableId = 0;
28644                this.localVariableId = 0;
28645                this.codeArray.push("var o,t;", "if(R){", "o=R;", "}else{", `o=R=new ${this.getFuncModule(t.constructor, !0)}();`, "}");
28646                t._iN$t = {
28647                  globalVar: "R"
28648                };
28649                this.objsToClear_iN$t.push(t);
28650                this.enumerateObject(this.codeArray, t);
28651                let i;
28652                this.globalVariables.length > 0 && (i = `${Yg + this.globalVariables.join(",")};`);
28653                const s = Hg([ "return (function(R){", i || [], this.codeArray, "return o;", "})" ]);
28654                this.result = Function("O", "F", s)(this.objs, this.funcs);
28655                for (let t = 0, e = this.objsToClear_iN$t.length; t < e; ++t) this.objsToClear_iN$t[t]._iN$t = null;
28656                this.objsToClear_iN$t.length = 0;
28657              }
28658              getFuncModule(t, e) {
28659                const i = Et(t);
28660                if (i) {
28661                  const e = this.funcModuleCache[i];
28662                  if (e) return e;
28663                  if (void 0 === e) {
28664                    let e = -1 !== i.indexOf(".");
28665                    if (e) try {
28666                      e = t === Function(`return ${i}`)();
28667                      if (e) {
28668                        this.funcModuleCache[i] = i;
28669                        return i;
28670                      }
28671                    } catch (t) {}
28672                  }
28673                }
28674                let s = this.funcs.indexOf(t);
28675                if (s < 0) {
28676                  s = this.funcs.length;
28677                  this.funcs.push(t);
28678                }
28679                let n = `F[${s}]`;
28680                e && (n = `(${n})`);
28681                this.funcModuleCache[i] = n;
28682                return n;
28683              }
28684              getObjRef(t) {
28685                let e = this.objs.indexOf(t);
28686                if (e < 0) {
28687                  e = this.objs.length;
28688                  this.objs.push(t);
28689                }
28690                return `O[${e}]`;
28691              }
28692              setValueType(t, e, i, s) {
28693                const n = ty.pool.get(s);
28694                let r = e.constructor.__props__;
28695                r || (r = Object.keys(e));
28696                for (let t = 0; t < r.length; t++) {
28697                  const s = r[t];
28698                  const o = i[s];
28699                  if (e[s] === o) continue;
28700                  const a = this.enumerateField(i, s, o);
28701                  n.append(s, a);
28702                }
28703                n.writeCode(t);
28704                ty.pool.put(n);
28705              }
28706              enumerateCCClass(t, e, i) {
28707                const s = i.__values__;
28708                const n = Be(i);
28709                for (let i = 0; i < s.length; i++) {
28710                  const r = s[i];
28711                  const o = e[r];
28712                  let a = n[r + "$_$default"];
28713                  if (!sy(a, o)) {
28714                    if ("object" == typeof o && o instanceof m.ValueType) {
28715                      a = si.getDefault(a);
28716                      if (a && a.constructor === o.constructor) {
28717                        const e = qg + ey(r);
28718                        this.setValueType(t, a, o, e);
28719                        continue;
28720                      }
28721                    }
28722                    this.setObjProp(t, e, r, o);
28723                  }
28724                }
28725              }
28726              instantiateArray(t) {
28727                if (0 === t.length) return "[]";
28728                const e = "a" + ++this.localVariableId;
28729                const i = [ new Zg(e, `new Array(${t.length})`) ];
28730                t._iN$t = {
28731                  globalVar: "",
28732                  source: i
28733                };
28734                this.objsToClear_iN$t.push(t);
28735                for (let s = 0; s < t.length; ++s) {
28736                  $g(i, `${e}[${s}]=`, this.enumerateField(t, s, t[s]));
28737                }
28738                return i;
28739              }
28740              instantiateTypedArray(t) {
28741                const e = t.constructor.name;
28742                if (0 === t.length) return `new ${e}`;
28743                const i = "a" + ++this.localVariableId;
28744                const s = [ new Zg(i, `new ${e}(${t.length})`) ];
28745                t._iN$t = {
28746                  globalVar: "",
28747                  source: s
28748                };
28749                this.objsToClear_iN$t.push(t);
28750                for (let e = 0; e < t.length; ++e) if (0 !== t[e]) {
28751                  $g(s, `${i}[${e}]=`, t[e]);
28752                }
28753                return s;
28754              }
28755              enumerateField(t, e, i) {
28756                if ("object" == typeof i && i) {
28757                  const t = i._iN$t;
28758                  if (t) {
28759                    let e = t.globalVar;
28760                    if (!e) {
28761                      e = t.globalVar = "v" + ++this.globalVariableId;
28762                      this.globalVariables.push(e);
28763                      const i = t.source[0];
28764                      t.source[0] = Qg(`${e}=`, i);
28765                    }
28766                    return e;
28767                  }
28768                  return ArrayBuffer.isView(i) ? this.instantiateTypedArray(i) : Array.isArray(i) ? this.instantiateArray(i) : this.instantiateObj(i);
28769                }
28770                if ("function" == typeof i) return this.getFuncModule(i);
28771                if ("string" == typeof i) return Jg(i);
28772                "_objFlags" === e && _o(t) && (i &= Xg);
28773                return i;
28774              }
28775              setObjProp(t, e, i, s) {
28776                $g(t, `${qg + ey(i)}=`, this.enumerateField(e, i, s));
28777              }
28778              enumerateObject(t, e) {
28779                const i = e.constructor;
28780                if (ni(i)) this.enumerateCCClass(t, e, i); else for (const i in e) {
28781                  if (!e.hasOwnProperty(i) || 95 === i.charCodeAt(0) && 95 === i.charCodeAt(1) && "__type__" !== i) continue;
28782                  const s = e[i];
28783                  "object" == typeof s && s && s === e._iN$t || this.setObjProp(t, e, i, s);
28784                }
28785              }
28786              instantiateObj(t) {
28787                if (t instanceof m.ValueType) return si.getNewValueTypeCode(t);
28788                if (t instanceof m.Asset) return this.getObjRef(t);
28789                if (t._objFlags & jg) return null;
28790                let e;
28791                const i = t.constructor;
28792                if (ni(i)) {
28793                  if (this.parent) if (this.parent instanceof m.Component) {
28794                    if (t instanceof m._BaseNode || t instanceof m.Component) return this.getObjRef(t);
28795                  } else if (this.parent instanceof m._BaseNode) if (t instanceof m._BaseNode) {
28796                    if (!t.isChildOf(this.parent)) return this.getObjRef(t);
28797                  } else if (t instanceof m.Component) {
28798                    var s;
28799                    if (!(null === (s = t.node) || void 0 === s ? void 0 : s.isChildOf(this.parent))) return this.getObjRef(t);
28800                  }
28801                  e = new Zg(qg, `new ${this.getFuncModule(i, !0)}()`);
28802                } else if (i === Object) e = new Zg(qg, "{}"); else {
28803                  if (i) return this.getObjRef(t);
28804                  e = new Zg(qg, "Object.create(null)");
28805                }
28806                const n = [ e ];
28807                t._iN$t = {
28808                  globalVar: "",
28809                  source: n
28810                };
28811                this.objsToClear_iN$t.push(t);
28812                this.enumerateObject(n, t);
28813                return [ "(function(){", n, "return o;})();" ];
28814              }
28815            }
28816            function sy(t, e) {
28817              if ("function" == typeof t) try {
28818                t = t();
28819              } catch (t) {
28820                return !1;
28821              }
28822              if (t === e) return !0;
28823              if (t && e && "object" == typeof t && "object" == typeof e && t.constructor === e.constructor) if (t instanceof m.ValueType) {
28824                if (t.equals(e)) return !0;
28825              } else {
28826                if (Array.isArray(t)) return 0 === t.length && 0 === e.length;
28827                if (t.constructor === Object) return yt(t) && yt(e);
28828              }
28829              return !1;
28830            }
28831            let ny;
28832            !function(t) {
28833              t.TOUCH_START = "touch-start";
28834              t.TOUCH_MOVE = "touch-move";
28835              t.TOUCH_END = "touch-end";
28836              t.TOUCH_CANCEL = "touch-cancel";
28837              t.MOUSE_DOWN = "mouse-down";
28838              t.MOUSE_MOVE = "mouse-move";
28839              t.MOUSE_UP = "mouse-up";
28840              t.MOUSE_WHEEL = "mouse-wheel";
28841              t.MOUSE_ENTER = "mouse-enter";
28842              t.MOUSE_LEAVE = "mouse-leave";
28843              t.KEY_DOWN = "keydown";
28844              t.KEY_UP = "keyup";
28845              t.DEVICEMOTION = "devicemotion";
28846              t.TRANSFORM_CHANGED = "transform-changed";
28847              t.SCENE_CHANGED_FOR_PERSISTS = "scene-changed-for-persists";
28848              t.SIZE_CHANGED = "size-changed";
28849              t.ANCHOR_CHANGED = "anchor-changed";
28850              t.COLOR_CHANGED = "color-changed";
28851              t.CHILD_ADDED = "child-added";
28852              t.CHILD_REMOVED = "child-removed";
28853              t.PARENT_CHANGED = "parent-changed";
28854              t.NODE_DESTROYED = "node-destroyed";
28855              t.LAYER_CHANGED = "layer-changed";
28856              t.SIBLING_ORDER_CHANGED = "sibling-order-changed";
28857              t.ACTIVE_IN_HIERARCHY_CHANGED = "active-in-hierarchy-changed";
28858              t.COMPONENT_ADDED = "component-added";
28859              t.COMPONENT_REMOVED = "component-removed";
28860            }(ny || (ny = t("NodeEventType", {})));
28861            class ry {
28862              get uiTransformComp() {
28863                this._uiTransformComp || (this._uiTransformComp = this._node.getComponent("cc.UITransform"));
28864                return this._uiTransformComp;
28865              }
28866              set uiTransformComp(t) {
28867                this._uiTransformComp = t;
28868              }
28869              get uiComp() {
28870                return this._uiComp;
28871              }
28872              set uiComp(t) {
28873                this._uiComp && t ? N(12002) : this._uiComp = t;
28874              }
28875              get opacity() {
28876                return this._opacity;
28877              }
28878              get localOpacity() {
28879                return this._localOpacity;
28880              }
28881              set localOpacity(t) {
28882                this._localOpacity = t;
28883                this.colorDirty = !0;
28884              }
28885              constructor(t) {
28886                this._uiComp = null;
28887                this._opacity = 1;
28888                this._localOpacity = 1;
28889                this.colorDirty = !0;
28890                this._uiTransformComp = null;
28891                this._node = void 0;
28892                this._node = t;
28893              }
28894              applyOpacity(t) {
28895                this._opacity = this._localOpacity * t;
28896              }
28897              static markOpacityTree(t, e = !0) {}
28898            }
28899            let oy;
28900            !function(t) {
28901              t[t.LOCAL = 0] = "LOCAL";
28902              t[t.WORLD = 1] = "WORLD";
28903            }(oy || (oy = {}));
28904            let ay;
28905            !function(t) {
28906              t[t.NONE = 0] = "NONE";
28907              t[t.POSITION = 1] = "POSITION";
28908              t[t.ROTATION = 2] = "ROTATION";
28909              t[t.SCALE = 4] = "SCALE";
28910              t[t.RS = t.ROTATION | t.SCALE] = "RS";
28911              t[t.TRS = t.POSITION | t.ROTATION | t.SCALE] = "TRS";
28912              t[t.TRS_MASK = ~t.TRS] = "TRS_MASK";
28913            }(ay || (ay = {}));
28914            m.internal.TransformBit = ay;
28915            const ly = new Float32Array(jsb.createExternalArrayBuffer(80));
28916            const hy = function(t) {
28917              qi.set(t, ly[0], ly[1], ly[2], ly[3], ly[4], ly[5], ly[6], ly[7], ly[8], ly[9], ly[10], ly[11], ly[12], ly[13], ly[14], ly[15]);
28918            };
28919            co.Flags.Destroying;
28920            jsb.BaseNode.prototype.createNode = null;
28921            const cy = jsb.BaseNode;
28922            m._BaseNode = cy;
28923            Ul("cc.BaseNode")(cy);
28924            const uy = Symbol("ReserveContentsForAllSyncablePrefab");
28925            const _y = t("Node", jsb.Node);
28926            m.Node = _y;
28927            const dy = _y;
28928            dy.reserveContentsForAllSyncablePrefabTag = uy;
28929            dy.EventType = ny;
28930            dy.NodeSpace = oy;
28931            dy.TransformDirtyBit = ay;
28932            dy.TransformBit = ay;
28933            const py = ay.TRS;
28934            const my = jsb.Node.prototype;
28935            const fy = t("TRANSFORM_ON", 1);
28936            const gy = co.Flags.Destroying;
28937            _y._setTempFloatArray(ly.buffer);
28938            function yy(t) {
28939              return t ? "string" == typeof t ? Jt(t) : t : null;
28940            }
28941            my.attr = function(t) {
28942              Nt(this, t);
28943            };
28944            my.getComponent = function(t) {
28945              const e = yy(t);
28946              return e ? dy._findComponent(this, e) : null;
28947            };
28948            my.getComponents = function(t) {
28949              const e = yy(t);
28950              const i = [];
28951              e && dy._findComponents(this, e, i);
28952              return i;
28953            };
28954            my.getComponentInChildren = function(t) {
28955              const e = yy(t);
28956              return e ? dy._findChildComponent(this._children, e) : null;
28957            };
28958            my.getComponentsInChildren = function(t) {
28959              const e = yy(t);
28960              const i = [];
28961              if (e) {
28962                dy._findComponents(this, e, i);
28963                dy._findChildComponents(this.children, e, i);
28964              }
28965              return i;
28966            };
28967            my.addComponent = function(t) {
28968              let e;
28969              if ("string" == typeof t) {
28970                e = Jt(t);
28971                if (!e) {
28972                  m._RF.peek() && F(3808, t);
28973                  throw TypeError(G(3807, t));
28974                }
28975              } else {
28976                if (!t) throw TypeError(G(3804));
28977                e = t;
28978              }
28979              if ("function" != typeof e) throw TypeError(G(3809));
28980              if (!Vt(e, Qc)) throw TypeError(G(3810));
28981              const i = e._requireComponent;
28982              i && !this.getComponent(i) && this.addComponent(i);
28983              const s = new e;
28984              s.node = this;
28985              this._components.push(s);
28986              this.emit(ny.COMPONENT_ADDED, s);
28987              this._activeInHierarchy && m.director._nodeActivator.activateComp(s);
28988              return s;
28989            };
28990            my.removeComponent = function(t) {
28991              if (!t) {
28992                F(3813);
28993                return;
28994              }
28995              let e = null;
28996              e = t instanceof Qc ? t : this.getComponent(t);
28997              e && e.destroy();
28998            };
28999            my.on = function(t, e, i, s = !1) {
29000              switch (t) {
29001               case ny.TRANSFORM_CHANGED:
29002                this._eventMask |= fy;
29003                if (!(1 & this._registeredNodeEventTypeMask)) {
29004                  this._registerOnTransformChanged();
29005                  this._registeredNodeEventTypeMask |= 1;
29006                }
29007                break;
29008
29009               case ny.PARENT_CHANGED:
29010                if (!(2 & this._registeredNodeEventTypeMask)) {
29011                  this._registerOnParentChanged();
29012                  this._registeredNodeEventTypeMask |= 2;
29013                }
29014                break;
29015
29016               case ny.LAYER_CHANGED:
29017                if (!(4 & this._registeredNodeEventTypeMask)) {
29018                  this._registerOnLayerChanged();
29019                  this._registeredNodeEventTypeMask |= 4;
29020                }
29021                break;
29022
29023               case ny.CHILD_REMOVED:
29024                if (!(8 & this._registeredNodeEventTypeMask)) {
29025                  this._registerOnChildRemoved();
29026                  this._registeredNodeEventTypeMask |= 8;
29027                }
29028                break;
29029
29030               case ny.CHILD_ADDED:
29031                if (!(16 & this._registeredNodeEventTypeMask)) {
29032                  this._registerOnChildAdded();
29033                  this._registeredNodeEventTypeMask |= 16;
29034                }
29035                break;
29036
29037               case ny.SIBLING_ORDER_CHANGED:
29038                if (!(32 & this._registeredNodeEventTypeMask)) {
29039                  this._registerOnSiblingOrderChanged();
29040                  this._registeredNodeEventTypeMask |= 32;
29041                }
29042              }
29043              this._eventProcessor.on(t, e, i, s);
29044            };
29045            my.off = function(t, e, i, s = !1) {
29046              this._eventProcessor.off(t, e, i, s);
29047              if (!this._eventProcessor.hasEventListener(t) && t === ny.TRANSFORM_CHANGED) this._eventMask &= ~fy;
29048            };
29049            my.once = function(t, e, i, s) {
29050              this._eventProcessor.once(t, e, i, s);
29051            };
29052            my.emit = function(t, e, i, s, n, r) {
29053              this._eventProcessor.emit(t, e, i, s, n, r);
29054            };
29055            my.dispatchEvent = function(t) {
29056              this._eventProcessor.dispatchEvent(t);
29057            };
29058            my.hasEventListener = function(t, e, i) {
29059              return this._eventProcessor.hasEventListener(t, e, i);
29060            };
29061            my.targetOff = function(t) {
29062              this._eventMask & fy && !this._eventProcessor.hasEventListener(ny.TRANSFORM_CHANGED) && (this._eventMask &= ~fy);
29063            };
29064            my._removeComponent = function(t) {
29065              if (t) {
29066                if (!(this._objFlags & gy)) {
29067                  const e = this._components.indexOf(t);
29068                  if (-1 !== e) {
29069                    this._components.splice(e, 1);
29070                    this.emit(ny.COMPONENT_REMOVED, t);
29071                  } else t.node !== this && F(3815);
29072                }
29073              } else F(3814);
29074            };
29075            my._registerIfAttached = void 0;
29076            my._onTransformChanged = function(t) {
29077              this.emit(ny.TRANSFORM_CHANGED, t);
29078            };
29079            my._onParentChanged = function(t) {
29080              this.emit(ny.PARENT_CHANGED, t);
29081            };
29082            my._onReAttach = function() {
29083              this._eventProcessor.reattach();
29084            };
29085            my._onEditorAttached = function(t) {};
29086            my._onRemovePersistRootNode = function() {
29087              m.game.removePersistRootNode(this);
29088            };
29089            my._onDestroyComponents = function() {
29090              this._eventProcessor.destroy();
29091              const t = this._components;
29092              for (let e = 0; e < t.length; ++e) t[e]._destroyImmediate();
29093            };
29094            my._onLayerChanged = function(t) {
29095              this.emit(ny.LAYER_CHANGED, t);
29096            };
29097            my._onChildRemoved = function(t) {
29098              this.emit(ny.CHILD_REMOVED, t);
29099            };
29100            my._onChildAdded = function(t) {
29101              this.emit(ny.CHILD_ADDED, t);
29102            };
29103            my._onNodeDestroyed = function() {
29104              this.emit(ny.NODE_DESTROYED, this);
29105              const t = this._children;
29106              for (let e = 0; e < t.length; ++e) t[e]._destroyImmediate();
29107            };
29108            const by = my._onPreDestroy;
29109            my._onPreDestroy = function() {
29110              const t = by.call(this);
29111              this.emit(ny.NODE_DESTROYED, this);
29112              this._eventProcessor.destroy();
29113              const e = this._children;
29114              for (let t = 0; t < e.length; ++t) e[t]._destroyImmediate();
29115              const i = this._components;
29116              for (let t = 0; t < i.length; ++t) i[t]._destroyImmediate();
29117              return t;
29118            };
29119            my.destroyAllChildren = function() {
29120              const t = this._children;
29121              for (let e = 0, i = t.length; e < i; ++e) t[e].destroy();
29122            };
29123            my._onSiblingOrderChanged = function() {
29124              this.emit(ny.SIBLING_ORDER_CHANGED);
29125            };
29126            my._onActivateNode = function(t) {
29127              m.director._nodeActivator.activateNode(this, t);
29128            };
29129            my._onPostActivated = function(t) {
29130              if (t) {
29131                this._eventProcessor.setEnabled(!0);
29132                this.invalidateChildren(ay.TRS);
29133                if (this._uiProps && this._uiProps.uiComp) {
29134                  this._uiProps.uiComp.setNodeDirty();
29135                  this._uiProps.uiComp.setTextureDirty();
29136                  this._uiProps.uiComp.markForUpdateRenderData();
29137                }
29138              } else this._eventProcessor.setEnabled(!1);
29139            };
29140            dy._findComponent = function(t, e) {
29141              const i = e;
29142              const s = t._components;
29143              if (i._sealed) for (let t = 0; t < s.length; ++t) {
29144                const i = s[t];
29145                if (i.constructor === e) return i;
29146              } else for (let t = 0; t < s.length; ++t) {
29147                const i = s[t];
29148                if (i instanceof e) return i;
29149              }
29150              return null;
29151            };
29152            dy._findComponents = function(t, e, i) {
29153              const s = e;
29154              const n = t._components;
29155              if (s._sealed) for (let t = 0; t < n.length; ++t) {
29156                const s = n[t];
29157                s.constructor === e && i.push(s);
29158              } else for (let t = 0; t < n.length; ++t) {
29159                const s = n[t];
29160                s instanceof e && i.push(s);
29161              }
29162            };
29163            dy._findChildComponent = function(t, e) {
29164              for (let i = 0; i < t.length; ++i) {
29165                const s = t[i];
29166                let n = dy._findComponent(s, e);
29167                if (n) return n;
29168                const r = s.children;
29169                if (r.length > 0) {
29170                  n = dy._findChildComponent(r, e);
29171                  if (n) return n;
29172                }
29173              }
29174              return null;
29175            };
29176            dy._findChildComponents = function(t, e, i) {
29177              for (let s = 0; s < t.length; ++s) {
29178                const n = t[s];
29179                dy._findComponents(n, e, i);
29180                const r = n.children;
29181                r.length > 0 && dy._findChildComponents(r, e, i);
29182              }
29183            };
29184            dy.isNode = function(t) {
29185              return t instanceof jsb.Node && (t.constructor === jsb.Node || !(t instanceof m.Scene));
29186            };
29187            let Sy = new Ui;
29188            my.setRTS = function(t, e, i) {
29189              if (t) {
29190                let e = Sy;
29191                t instanceof Ui ? e = t : Ui.fromEuler(e, t.x, t.y, t.z);
29192                ly[0] = 4;
29193                ly[1] = e.x;
29194                ly[2] = e.y;
29195                ly[3] = e.z;
29196                ly[4] = e.w;
29197                this._lrot.set(e.x, e.y, e.z, e.w);
29198              } else ly[0] = 0;
29199              if (e) {
29200                ly[5] = 3;
29201                ly[6] = e.x;
29202                ly[7] = e.y;
29203                ly[8] = e.z;
29204                this._lpos.set(e.x, e.y, e.z);
29205              } else ly[5] = 0;
29206              if (i) {
29207                ly[9] = 3;
29208                ly[10] = i.x;
29209                ly[11] = i.y;
29210                ly[12] = i.z;
29211                this._lscale.set(i.x, i.y, i.z);
29212              } else ly[9] = 0;
29213              this._setRTS();
29214            };
29215            my.getPosition = function(t) {
29216              return t ? Pi.set(t, this._lpos.x, this._lpos.y, this._lpos.z) : Pi.copy(new Pi, this._lpos);
29217            };
29218            my.setPosition = function(t, e, i) {
29219              if (void 0 === e && void 0 === i) {
29220                ly[0] = 3;
29221                const e = t;
29222                this._lpos.x = ly[1] = e.x;
29223                this._lpos.y = ly[2] = e.y;
29224                this._lpos.z = ly[3] = e.z;
29225              } else if (void 0 === i) {
29226                ly[0] = 2;
29227                this._lpos.x = ly[1] = t;
29228                this._lpos.y = ly[2] = e;
29229              } else {
29230                ly[0] = 3;
29231                this._lpos.x = ly[1] = t;
29232                this._lpos.y = ly[2] = e;
29233                this._lpos.z = ly[3] = i;
29234              }
29235              this._setPosition();
29236            };
29237            my.getRotation = function(t) {
29238              const e = this._lrot;
29239              return t ? Ui.set(t, e.x, e.y, e.z, e.w) : Ui.copy(new Ui, e);
29240            };
29241            my.setRotation = function(t, e, i, s) {
29242              if (void 0 === e || void 0 === i || void 0 === s) {
29243                const e = t;
29244                this._lrot.x = ly[0] = e.x;
29245                this._lrot.y = ly[1] = e.y;
29246                this._lrot.z = ly[2] = e.z;
29247                this._lrot.w = ly[3] = e.w;
29248              } else {
29249                this._lrot.x = ly[0] = t;
29250                this._lrot.y = ly[1] = e;
29251                this._lrot.z = ly[2] = i;
29252                this._lrot.w = ly[3] = s;
29253              }
29254              this._setRotation();
29255            };
29256            my.setRotationFromEuler = function(t, e, i) {
29257              const s = void 0 === i ? this._euler.z : i;
29258              if (void 0 === e) {
29259                const e = t;
29260                this._euler.x = ly[0] = e.x;
29261                this._euler.y = ly[1] = e.y;
29262                this._euler.z = ly[2] = e.z;
29263              } else {
29264                this._euler.x = ly[0] = t;
29265                this._euler.y = ly[1] = e;
29266                this._euler.z = ly[2] = s;
29267              }
29268              this._setRotationFromEuler();
29269            };
29270            my.getScale = function(t) {
29271              return t ? Pi.set(t, this._lscale.x, this._lscale.y, this._lscale.z) : Pi.copy(new Pi, this._lscale);
29272            };
29273            my.setScale = function(t, e, i) {
29274              if (void 0 === e && void 0 === i) {
29275                ly[0] = 3;
29276                const e = t;
29277                this._lscale.x = ly[1] = e.x;
29278                this._lscale.y = ly[2] = e.y;
29279                this._lscale.z = ly[3] = e.z;
29280              } else if (void 0 === i) {
29281                ly[0] = 2;
29282                this._lscale.x = ly[1] = t;
29283                this._lscale.y = ly[2] = e;
29284              } else {
29285                ly[0] = 3;
29286                this._lscale.x = ly[1] = t;
29287                this._lscale.y = ly[2] = e;
29288                this._lscale.z = ly[3] = i;
29289              }
29290              this._setScale();
29291            };
29292            my.getWorldPosition = function(t) {
29293              this._getWorldPosition();
29294              return (t = t || new Pi).set(ly[0], ly[1], ly[2]);
29295            };
29296            my.getWorldRotation = function(t) {
29297              this._getWorldRotation();
29298              return (t = t || new Ui).set(ly[0], ly[1], ly[2], ly[3]);
29299            };
29300            my.getWorldScale = function(t) {
29301              this._getWorldScale();
29302              return (t = t || new Pi).set(ly[0], ly[1], ly[2]);
29303            };
29304            my.getWorldMatrix = function(t) {
29305              this._getWorldMatrix();
29306              t = t || new qi;
29307              hy(t);
29308              return t;
29309            };
29310            my.getEulerAngles = function(t) {
29311              this._getEulerAngles();
29312              return (t = t || new Pi).set(ly[0], ly[1], ly[2]);
29313            };
29314            my.getForward = function(t) {
29315              this._getForward();
29316              return (t = t || new Pi).set(ly[0], ly[1], ly[2]);
29317            };
29318            my.getUp = function(t) {
29319              this._getUp();
29320              return (t = t || new Pi).set(ly[0], ly[1], ly[2]);
29321            };
29322            my.getRight = function(t) {
29323              this._getRight();
29324              return (t = t || new Pi).set(ly[0], ly[1], ly[2]);
29325            };
29326            my.inverseTransformPoint = function(t, e) {
29327              ly[0] = e.x;
29328              ly[1] = e.y;
29329              ly[2] = e.z;
29330              this._inverseTransformPoint();
29331              t.x = ly[0];
29332              t.y = ly[1];
29333              t.z = ly[2];
29334              return t;
29335            };
29336            my.getWorldRT = function(t) {
29337              t = t || new qi;
29338              this._getWorldRT();
29339              hy(t);
29340              return t;
29341            };
29342            my.getWorldRS = function(t) {
29343              t = t || new qi;
29344              this._getWorldRS();
29345              hy(t);
29346              return t;
29347            };
29348            Object.defineProperty(my, "position", {
29349              configurable: !0,
29350              enumerable: !0,
29351              get() {
29352                return this._lpos;
29353              },
29354              set(t) {
29355                this.setPosition(t);
29356              }
29357            });
29358            Object.defineProperty(my, "rotation", {
29359              configurable: !0,
29360              enumerable: !0,
29361              get() {
29362                return this._lrot;
29363              },
29364              set(t) {
29365                this.setRotation(t);
29366              }
29367            });
29368            Object.defineProperty(my, "scale", {
29369              configurable: !0,
29370              enumerable: !0,
29371              get() {
29372                return this._lscale;
29373              },
29374              set(t) {
29375                this.setScale(t);
29376              }
29377            });
29378            Object.defineProperty(my, "worldPosition", {
29379              configurable: !0,
29380              enumerable: !0,
29381              get() {
29382                return this.getWorldPosition();
29383              },
29384              set(t) {
29385                this.setWorldPosition(t);
29386              }
29387            });
29388            Object.defineProperty(my, "worldRotation", {
29389              configurable: !0,
29390              enumerable: !0,
29391              get() {
29392                return this.getWorldRotation();
29393              },
29394              set(t) {
29395                this.setWorldRotation(t);
29396              }
29397            });
29398            Object.defineProperty(my, "worldScale", {
29399              configurable: !0,
29400              enumerable: !0,
29401              get() {
29402                return this.getWorldScale();
29403              },
29404              set(t) {
29405                this.setWorldScale(t);
29406              }
29407            });
29408            Object.defineProperty(my, "_pos", {
29409              configurable: !0,
29410              enumerable: !0,
29411              get() {
29412                return this.getWorldPosition();
29413              }
29414            });
29415            Object.defineProperty(my, "_rot", {
29416              configurable: !0,
29417              enumerable: !0,
29418              get() {
29419                return this.getWorldRotation();
29420              }
29421            });
29422            Object.defineProperty(my, "_scale", {
29423              configurable: !0,
29424              enumerable: !0,
29425              get() {
29426                return this.getWorldScale();
29427              }
29428            });
29429            Object.defineProperty(my, "eulerAngles", {
29430              configurable: !0,
29431              enumerable: !0,
29432              get() {
29433                return this.getEulerAngles();
29434              },
29435              set(t) {
29436                this.setRotationFromEuler(t.x, t.y, t.z);
29437              }
29438            });
29439            Object.defineProperty(my, "worldMatrix", {
29440              configurable: !0,
29441              enumerable: !0,
29442              get() {
29443                return this.getWorldMatrix();
29444              }
29445            });
29446            Object.defineProperty(my, "_mat", {
29447              configurable: !0,
29448              enumerable: !0,
29449              get() {
29450                return this.getWorldMatrix();
29451              }
29452            });
29453            Object.defineProperty(my, "activeInHierarchy", {
29454              configurable: !0,
29455              enumerable: !0,
29456              get() {
29457                return 0 != this._sharedUint8Arr[0];
29458              },
29459              set(t) {
29460                this._sharedUint8Arr[0] = t ? 1 : 0;
29461              }
29462            });
29463            Object.defineProperty(my, "_activeInHierarchy", {
29464              configurable: !0,
29465              enumerable: !0,
29466              get() {
29467                return 0 != this._sharedUint8Arr[0];
29468              },
29469              set(t) {
29470                this._sharedUint8Arr[0] = t ? 1 : 0;
29471              }
29472            });
29473            Object.defineProperty(my, "layer", {
29474              configurable: !0,
29475              enumerable: !0,
29476              get() {
29477                return this._sharedUint32Arr[1];
29478              },
29479              set(t) {
29480                this._sharedUint32Arr[1] = t;
29481                if (this._uiProps && this._uiProps.uiComp) {
29482                  this._uiProps.uiComp.setNodeDirty();
29483                  this._uiProps.uiComp.markForUpdateRenderData();
29484                }
29485                this.emit(ny.LAYER_CHANGED, t);
29486              }
29487            });
29488            Object.defineProperty(my, "_layer", {
29489              configurable: !0,
29490              enumerable: !0,
29491              get() {
29492                return this._sharedUint32Arr[1];
29493              },
29494              set(t) {
29495                this._sharedUint32Arr[1] = t;
29496              }
29497            });
29498            Object.defineProperty(my, "_eventMask", {
29499              configurable: !0,
29500              enumerable: !0,
29501              get() {
29502                return this._sharedUint32Arr[0];
29503              },
29504              set(t) {
29505                this._sharedUint32Arr[0] = t;
29506              }
29507            });
29508            Object.defineProperty(my, "_siblingIndex", {
29509              configurable: !0,
29510              enumerable: !0,
29511              get() {
29512                return this._sharedInt32Arr[0];
29513              },
29514              set(t) {
29515                this._sharedInt32Arr[0] = t;
29516              }
29517            });
29518            my.getSiblingIndex = function() {
29519              return this._sharedInt32Arr[0];
29520            };
29521            Object.defineProperty(my, "_dirtyFlags", {
29522              configurable: !0,
29523              enumerable: !0,
29524              get() {
29525                return this._sharedUint32Arr[2];
29526              },
29527              set(t) {
29528                this._sharedUint32Arr[2] = t;
29529              }
29530            });
29531            Object.defineProperty(my, "_active", {
29532              configurable: !0,
29533              enumerable: !0,
29534              get() {
29535                return 0 != this._sharedUint8Arr[1];
29536              },
29537              set(t) {
29538                this._sharedUint8Arr[1] = t ? 1 : 0;
29539              }
29540            });
29541            Object.defineProperty(my, "active", {
29542              configurable: !0,
29543              enumerable: !0,
29544              get() {
29545                return 0 != this._sharedUint8Arr[1];
29546              },
29547              set(t) {
29548                this.setActive(!!t);
29549              }
29550            });
29551            Object.defineProperty(my, "_static", {
29552              configurable: !0,
29553              enumerable: !0,
29554              get() {
29555                return 0 != this._sharedUint8Arr[2];
29556              },
29557              set(t) {
29558                this._sharedUint8Arr[2] = t ? 1 : 0;
29559              }
29560            });
29561            Object.defineProperty(my, "forward", {
29562              configurable: !0,
29563              enumerable: !0,
29564              get() {
29565                return this.getForward();
29566              },
29567              set(t) {
29568                this.setForward(t);
29569              }
29570            });
29571            Object.defineProperty(my, "up", {
29572              configurable: !0,
29573              enumerable: !0,
29574              get() {
29575                return this.getUp();
29576              }
29577            });
29578            Object.defineProperty(my, "right", {
29579              configurable: !0,
29580              enumerable: !0,
29581              get() {
29582                return this.getRight();
29583              }
29584            });
29585            Object.defineProperty(my, "eventProcessor", {
29586              configurable: !0,
29587              enumerable: !0,
29588              get() {
29589                return this._eventProcessor;
29590              }
29591            });
29592            Object.defineProperty(my, "components", {
29593              configurable: !0,
29594              enumerable: !0,
29595              get() {
29596                return this._components;
29597              }
29598            });
29599            Object.defineProperty(my, "_parent", {
29600              configurable: !0,
29601              enumerable: !0,
29602              get() {
29603                this._parentRef = this._parentInternal;
29604                return this._parentRef;
29605              },
29606              set(t) {
29607                this._parentRef = this._parentInternal = t;
29608              }
29609            });
29610            Object.defineProperty(my, "parent", {
29611              configurable: !0,
29612              enumerable: !0,
29613              get() {
29614                this._parentRef = this.getParent();
29615                return this._parentRef;
29616              },
29617              set(t) {
29618                this._parentRef = t;
29619                this.setParent(t);
29620              }
29621            });
29622            Object.defineProperty(my, "children", {
29623              configurable: !0,
29624              enumerable: !0,
29625              get() {
29626                return this._children;
29627              },
29628              set(t) {
29629                this._children = t;
29630              }
29631            });
29632            Object.defineProperty(my, "scene", {
29633              configurable: !0,
29634              enumerable: !0,
29635              get() {
29636                return this._scene;
29637              }
29638            });
29639            my.rotate = function(t, e) {
29640              ly[1] = t.x;
29641              ly[2] = t.y;
29642              ly[3] = t.z;
29643              ly[4] = t.w;
29644              if (e) {
29645                ly[5] = e;
29646                ly[0] = 5;
29647              } else ly[0] = 4;
29648              this._rotateForJS();
29649              const i = this._lrot;
29650              i.x = ly[0];
29651              i.y = ly[1];
29652              i.z = ly[2];
29653              i.w = ly[3];
29654            };
29655            my.addChild = function(t) {
29656              t.setParent(this);
29657            };
29658            my.insertChild = function(t, e) {
29659              t.parent = this;
29660              t.setSiblingIndex(e);
29661            };
29662            my[nu] = function(t, e) {
29663              t.writeThis();
29664              const i = () => {
29665                var t;
29666                return !!(null === (t = this[io]) || void 0 === t ? void 0 : t.mountedRoot);
29667              };
29668              const s = () => {
29669                var t, e, s, n;
29670                return (null === (t = this._prefab) || void 0 === t || null === (e = t.root) || void 0 === e || null === (s = e._prefab) || void 0 === s ? void 0 : s.instance) && ((null == this || null === (n = this._prefab) || void 0 === n ? void 0 : n.instance) || !i());
29671              };
29672              if ((() => !(e.customArguments[uy] || !s() || e.root === this))()) {
29673                var n;
29674                if ((null === (n = this._prefab) || void 0 === n ? void 0 : n.root) === this) {
29675                  t.writeProperty("_objFlags", this._objFlags);
29676                  t.writeProperty("_parent", this._parent);
29677                  t.writeProperty("_prefab", this._prefab);
29678                  e.customArguments.keepNodeUuid && t.writeProperty("_id", this._id);
29679                  t.writeProperty(io, this[io]);
29680                }
29681              } else t.writeThis();
29682            };
29683            my._onActiveNode = function(t) {
29684              m.director._nodeActivator.activateNode(this, t);
29685            };
29686            my._onBatchCreated = function(t) {
29687              this.hasChangedFlags = py;
29688              this._dirtyFlags |= py;
29689              const e = this._children;
29690              const i = e.length;
29691              let s;
29692              for (let n = 0; n < i; ++n) {
29693                s = e[n];
29694                s._siblingIndex = n;
29695                s._onBatchCreated(t);
29696              }
29697              !function(t) {
29698                const e = t._lpos;
29699                t.setPositionForJS(e.x, e.y, e.z);
29700                const i = t._lscale;
29701                t.setScaleForJS(i.x, i.y, i.z);
29702                const s = t._lrot;
29703                t.setRotationForJS(s.x, s.y, s.z, s.w);
29704                const n = t._euler;
29705                t.setRotationFromEulerForJS(n.x, n.y, n.z);
29706              }(this);
29707            };
29708            my._onSceneUpdated = function(t) {
29709              this._scene = t;
29710            };
29711            my._onLocalPositionUpdated = function(t, e, i) {
29712              const s = this._lpos;
29713              s.x = t;
29714              s.y = e;
29715              s.z = i;
29716            };
29717            my._onLocalRotationUpdated = function(t, e, i, s) {
29718              const n = this._lrot;
29719              n.x = t;
29720              n.y = e;
29721              n.z = i;
29722              n.w = s;
29723            };
29724            my._onLocalScaleUpdated = function(t, e, i) {
29725              const s = this._lscale;
29726              s.x = t;
29727              s.y = e;
29728              s.z = i;
29729            };
29730            my._onLocalPositionRotationScaleUpdated = function(t, e, i, s, n, r, o, a, l, h) {
29731              const c = this._lpos;
29732              c.x = t;
29733              c.y = e;
29734              c.z = i;
29735              const u = this._lrot;
29736              u.x = s;
29737              u.y = n;
29738              u.z = r;
29739              u.w = o;
29740              const _ = this._lscale;
29741              _.x = a;
29742              _.y = l;
29743              _.z = h;
29744            };
29745            my._instantiate = function(t, e) {
29746              t || (t = m.instantiate._clone(this, this));
29747              t._prefab;
29748              t._parent = null;
29749              t._onBatchCreated(e);
29750              return t;
29751            };
29752            my._ctor = function(t) {
29753              this.__nativeRefs = {};
29754              this._parentRef = null;
29755              this.__jsb_ref_id = void 0;
29756              this._iN$t = null;
29757              this.__editorExtras__ = {
29758                editorOnly: !0
29759              };
29760              this._components = [];
29761              this._eventProcessor = new m.NodeEventProcessor(this);
29762              this._uiProps = new ry(this);
29763              const e = this._getSharedArrayBufferObject();
29764              this._sharedUint32Arr = new Uint32Array(e, 0, 3);
29765              this._sharedInt32Arr = new Int32Array(e, 12, 1);
29766              this._sharedUint8Arr = new Uint8Array(e, 16, 3);
29767              this._sharedUint32Arr[1] = mm.Enum.DEFAULT;
29768              this._scene = null;
29769              this._prefab = null;
29770              this._originalSceneId = "";
29771              this._registerListeners();
29772              this._children = [];
29773              this._lpos = new Pi;
29774              this._lrot = new Ui;
29775              this._lscale = new Pi(1, 1, 1);
29776              this._euler = new Pi;
29777              this._registeredNodeEventTypeMask = 0;
29778              this.on(ny.CHILD_ADDED, (t => {
29779                this._children.push(t);
29780              }));
29781              this.on(ny.CHILD_REMOVED, (t => {
29782                const e = this._children.indexOf(t);
29783                e < 0 ? F(1633) : this._children.splice(e, 1);
29784              }));
29785              this._onSiblingIndexChanged = function(t) {
29786                const e = this._parent._children;
29787                t = -1 !== t ? t : e.length - 1;
29788                const i = e.indexOf(this);
29789                if (t !== i) {
29790                  e.splice(i, 1);
29791                  t < e.length ? e.splice(t, 0, this) : e.push(this);
29792                }
29793              };
29794            };
29795            const Ay = _y.prototype;
29796            jl(Ay, "_persistNode", Object.getOwnPropertyDescriptor(Ay, "_persistNode"));
29797            Yl(Ay, "_parent");
29798            Yl(Ay, "_children");
29799            Yl(Ay, "_active");
29800            Yl(Ay, "_components");
29801            Yl(Ay, "_prefab");
29802            Yl(Ay, "_lpos");
29803            Yl(Ay, "_lrot");
29804            Yl(Ay, "_lscale");
29805            Yl(Ay, "_layer");
29806            Yl(Ay, "_euler");
29807            const Ty = Object.getOwnPropertyDescriptor(Ay, "eulerAngles");
29808            Th(Pi)(Ay, "eulerAngles", Ty);
29809            Ul("cc.Node")(_y);
29810            si.Attr.setClassAttr(Vc, "target", "type", "Object");
29811            si.Attr.setClassAttr(Vc, "target", "ctor", _y);
29812            let vy;
29813            !function(t) {
29814              t[t.VERTICAL = 0] = "VERTICAL";
29815              t[t.HORIZONTAL = 1] = "HORIZONTAL";
29816            }(vy || (vy = {}));
29817            let Ey;
29818            !function(t) {
29819              t[t.ORTHO = 0] = "ORTHO";
29820              t[t.PERSPECTIVE = 1] = "PERSPECTIVE";
29821            }(Ey || (Ey = {}));
29822            let Cy;
29823            !function(t) {
29824              t[t.F1_8 = 0] = "F1_8";
29825              t[t.F2_0 = 1] = "F2_0";
29826              t[t.F2_2 = 2] = "F2_2";
29827              t[t.F2_5 = 3] = "F2_5";
29828              t[t.F2_8 = 4] = "F2_8";
29829              t[t.F3_2 = 5] = "F3_2";
29830              t[t.F3_5 = 6] = "F3_5";
29831              t[t.F4_0 = 7] = "F4_0";
29832              t[t.F4_5 = 8] = "F4_5";
29833              t[t.F5_0 = 9] = "F5_0";
29834              t[t.F5_6 = 10] = "F5_6";
29835              t[t.F6_3 = 11] = "F6_3";
29836              t[t.F7_1 = 12] = "F7_1";
29837              t[t.F8_0 = 13] = "F8_0";
29838              t[t.F9_0 = 14] = "F9_0";
29839              t[t.F10_0 = 15] = "F10_0";
29840              t[t.F11_0 = 16] = "F11_0";
29841              t[t.F13_0 = 17] = "F13_0";
29842              t[t.F14_0 = 18] = "F14_0";
29843              t[t.F16_0 = 19] = "F16_0";
29844              t[t.F18_0 = 20] = "F18_0";
29845              t[t.F20_0 = 21] = "F20_0";
29846              t[t.F22_0 = 22] = "F22_0";
29847            }(Cy || (Cy = {}));
29848            let xy;
29849            !function(t) {
29850              t[t.ISO100 = 0] = "ISO100";
29851              t[t.ISO200 = 1] = "ISO200";
29852              t[t.ISO400 = 2] = "ISO400";
29853              t[t.ISO800 = 3] = "ISO800";
29854            }(xy || (xy = {}));
29855            let wy;
29856            !function(t) {
29857              t[t.D1 = 0] = "D1";
29858              t[t.D2 = 1] = "D2";
29859              t[t.D4 = 2] = "D4";
29860              t[t.D8 = 3] = "D8";
29861              t[t.D15 = 4] = "D15";
29862              t[t.D30 = 5] = "D30";
29863              t[t.D60 = 6] = "D60";
29864              t[t.D125 = 7] = "D125";
29865              t[t.D250 = 8] = "D250";
29866              t[t.D500 = 9] = "D500";
29867              t[t.D1000 = 10] = "D1000";
29868              t[t.D2000 = 11] = "D2000";
29869              t[t.D4000 = 12] = "D4000";
29870            }(wy || (wy = {}));
29871            let Ry;
29872            !function(t) {
29873              t[t.DEFAULT = -1] = "DEFAULT";
29874              t[t.LEFT_EYE = 0] = "LEFT_EYE";
29875              t[t.RIGHT_EYE = 1] = "RIGHT_EYE";
29876              t[t.MAIN = 2] = "MAIN";
29877            }(Ry || (Ry = {}));
29878            let Iy;
29879            !function(t) {
29880              t[t.NO_TRACKING = 0] = "NO_TRACKING";
29881              t[t.POSITION_AND_ROTATION = 1] = "POSITION_AND_ROTATION";
29882              t[t.POSITION = 2] = "POSITION";
29883              t[t.ROTATION = 3] = "ROTATION";
29884            }(Iy || (Iy = {}));
29885            const My = en.STENCIL << 1;
29886            const By = jsb.Camera;
29887            const Dy = jsb.Camera.prototype;
29888            Object.defineProperty(By, "standardExposureValue", {
29889              configurable: !0,
29890              enumerable: !0,
29891              get: () => By.getStandardExposureValue()
29892            });
29893            Object.defineProperty(By, "standardLightMeterScale", {
29894              configurable: !0,
29895              enumerable: !0,
29896              get: () => By.getStandardLightMeterScale()
29897            });
29898            Object.defineProperty(Dy, "matView", {
29899              configurable: !0,
29900              enumerable: !0,
29901              get() {
29902                this.getMatView();
29903                hy(this._matView);
29904                return this._matView;
29905              }
29906            });
29907            Object.defineProperty(Dy, "matProj", {
29908              configurable: !0,
29909              enumerable: !0,
29910              get() {
29911                this.getMatProj();
29912                hy(this._matProj);
29913                return this._matProj;
29914              }
29915            });
29916            Object.defineProperty(Dy, "matProjInv", {
29917              configurable: !0,
29918              enumerable: !0,
29919              get() {
29920                this.getMatProjInv();
29921                hy(this._matProjInv);
29922                return this._matProjInv;
29923              }
29924            });
29925            Object.defineProperty(Dy, "matViewProj", {
29926              configurable: !0,
29927              enumerable: !0,
29928              get() {
29929                this.getMatViewProj();
29930                hy(this._matViewProj);
29931                return this._matViewProj;
29932              }
29933            });
29934            Object.defineProperty(Dy, "matViewProjInv", {
29935              configurable: !0,
29936              enumerable: !0,
29937              get() {
29938                this.getMatViewProjInv();
29939                hy(this._matViewProjInv);
29940                return this._matViewProjInv;
29941              }
29942            });
29943            const Py = Dy.initialize;
29944            Dy.initialize = function() {
29945              Py.apply(this, arguments);
29946              this._matView = new qi;
29947              this._matProj = new qi;
29948              this._matProjInv = new qi;
29949              this._matViewProj = new qi;
29950              this._matViewProjInv = new qi;
29951            };
29952            const Oy = Dy.screenPointToRay;
29953            const Ny = Dy.screenToWorld;
29954            const Ly = Dy.worldToScreen;
29955            const Fy = Dy.worldMatrixToScreen;
29956            Dy.screenPointToRay = function(t, e, i) {
29957              ly[0] = e;
29958              ly[1] = i;
29959              Oy.call(this);
29960              t.o.x = ly[0];
29961              t.o.y = ly[1];
29962              t.o.z = ly[2];
29963              t.d.x = ly[3];
29964              t.d.y = ly[4];
29965              t.d.z = ly[5];
29966              return t;
29967            };
29968            Dy.screenToWorld = function(t, e) {
29969              ly[0] = e.x;
29970              ly[1] = e.y;
29971              ly[2] = e.z;
29972              Ny.call(this);
29973              Pi.set(t, ly[0], ly[1], ly[2]);
29974              return t;
29975            };
29976            Dy.worldToScreen = function(t, e) {
29977              ly[0] = e.x;
29978              ly[1] = e.y;
29979              ly[2] = e.z;
29980              Ly.call(this);
29981              Pi.set(t, ly[0], ly[1], ly[2]);
29982              return t;
29983            };
29984            Dy.worldMatrixToScreen = function(t, e, i, s) {
29985              ly[0] = e.m00;
29986              ly[1] = e.m01;
29987              ly[2] = e.m02;
29988              ly[3] = e.m03;
29989              ly[4] = e.m04;
29990              ly[5] = e.m05;
29991              ly[6] = e.m06;
29992              ly[7] = e.m07;
29993              ly[8] = e.m08;
29994              ly[9] = e.m09;
29995              ly[10] = e.m10;
29996              ly[11] = e.m11;
29997              ly[12] = e.m12;
29998              ly[13] = e.m13;
29999              ly[14] = e.m14;
30000              ly[15] = e.m15;
30001              ly[16] = i;
30002              ly[17] = s;
30003              Fy.call(this);
30004              hy(t);
30005              return t;
30006            };
30007            var Vy, ky, Uy, Gy, zy, Hy, jy, Xy, Wy, Yy, qy, Ky, Jy, Zy, Qy, $y, tb, eb, ib, sb, nb, rb, ob, ab, lb, hb, cb, ub, _b, db, pb, mb, fb, gb, yb, bb, Sb, Ab, Tb, vb, Eb, Cb, xb, wb, Rb, Ib, Mb, Bb, Db, Pb, Ob, Nb, Lb, Fb, Vb, kb, Ub, Gb, zb, Hb, jb, Xb, Wb, Yb, qb, Kb, Jb, Zb, Qb, $b, tS, eS;
30008            const iS = new Pi;
30009            const sS = oe(Ey);
30010            const nS = oe(vy);
30011            const rS = oe(Cy);
30012            const oS = oe(wy);
30013            const aS = oe(xy);
30014            const lS = oe({
30015              SKYBOX: My | en.DEPTH_STENCIL,
30016              SOLID_COLOR: en.ALL,
30017              DEPTH_ONLY: en.DEPTH_STENCIL,
30018              DONT_CLEAR: en.NONE
30019            });
30020            let hS = (cS = (Vy = Ul("cc.Camera"), ky = sh(), Uy = $l(), Gy = ph(), zy = lh(),
30021            Hy = Th(mm.BitMask), jy = ph(), Xy = lh(), Wy = Th(lS), Yy = ph(), qy = lh(), Ky = ph(),
30022            Jy = lh(), Zy = ph(), Qy = lh(), $y = ph(), tb = lh(), eb = Th(sS), ib = ph(), sb = lh(),
30023            nb = Th(nS), rb = ph(), ob = rh(), ab = lh(), lb = ph(), hb = rh(), cb = lh(), ub = ph(),
30024            _b = rh(), db = lh(), pb = ph(), mb = lh(), fb = ph(), gb = lh(), yb = Th(rS), bb = ph(),
30025            Sb = lh(), Ab = Th(oS), Tb = ph(), vb = lh(), Eb = Th(aS), Cb = ph(), xb = lh(),
30026            wb = ph(), Rb = lh(), Ib = Th(Vg), Mb = ph(), Bb = lh(), Vy(Db = ky(Db = Uy(Db = Ql(Db = (Pb = (eS = tS = class t extends Qc {
30027              constructor(...t) {
30028                super(...t);
30029                Ml(this, "_projection", Ob, this);
30030                Ml(this, "_priority", Nb, this);
30031                Ml(this, "_fov", Lb, this);
30032                Ml(this, "_fovAxis", Fb, this);
30033                Ml(this, "_orthoHeight", Vb, this);
30034                Ml(this, "_near", kb, this);
30035                Ml(this, "_far", Ub, this);
30036                Ml(this, "_color", Gb, this);
30037                Ml(this, "_depth", zb, this);
30038                Ml(this, "_stencil", Hb, this);
30039                Ml(this, "_clearFlags", jb, this);
30040                Ml(this, "_rect", Xb, this);
30041                Ml(this, "_aperture", Wb, this);
30042                Ml(this, "_shutter", Yb, this);
30043                Ml(this, "_iso", qb, this);
30044                Ml(this, "_screenScale", Kb, this);
30045                Ml(this, "_visibility", Jb, this);
30046                Ml(this, "_targetTexture", Zb, this);
30047                this._camera = null;
30048                this._inEditorMode = !1;
30049                this._flows = void 0;
30050                Ml(this, "_cameraType", Qb, this);
30051                Ml(this, "_trackingType", $b, this);
30052              }
30053              get camera() {
30054                return this._camera;
30055              }
30056              get priority() {
30057                return this._priority;
30058              }
30059              set priority(t) {
30060                this._priority = t;
30061                this._camera && (this._camera.priority = t);
30062              }
30063              get visibility() {
30064                return this._visibility;
30065              }
30066              set visibility(t) {
30067                this._visibility = t;
30068                this._camera && (this._camera.visibility = t);
30069              }
30070              get clearFlags() {
30071                return this._clearFlags;
30072              }
30073              set clearFlags(t) {
30074                this._clearFlags = t;
30075                this._camera && (this._camera.clearFlag = t);
30076              }
30077              get clearColor() {
30078                return this._color;
30079              }
30080              set clearColor(t) {
30081                this._color.set(t);
30082                this._camera && (this._camera.clearColor = this._color);
30083              }
30084              get clearDepth() {
30085                return this._depth;
30086              }
30087              set clearDepth(t) {
30088                this._depth = t;
30089                this._camera && (this._camera.clearDepth = t);
30090              }
30091              get clearStencil() {
30092                return this._stencil;
30093              }
30094              set clearStencil(t) {
30095                this._stencil = t;
30096                this._camera && (this._camera.clearStencil = t);
30097              }
30098              get projection() {
30099                return this._projection;
30100              }
30101              set projection(t) {
30102                this._projection = t;
30103                this._camera && (this._camera.projectionType = t);
30104              }
30105              get fovAxis() {
30106                return this._fovAxis;
30107              }
30108              set fovAxis(t) {
30109                if (t !== this._fovAxis) {
30110                  this._fovAxis = t;
30111                  if (this._camera) {
30112                    this._camera.fovAxis = t;
30113                    t === vy.VERTICAL ? this.fov = this._fov * this._camera.aspect : this.fov = this._fov / this._camera.aspect;
30114                  }
30115                }
30116              }
30117              get fov() {
30118                return this._fov;
30119              }
30120              set fov(t) {
30121                this._fov = t;
30122                this._camera && (this._camera.fov = mi(t));
30123              }
30124              get orthoHeight() {
30125                return this._orthoHeight;
30126              }
30127              set orthoHeight(t) {
30128                this._orthoHeight = t;
30129                this._camera && (this._camera.orthoHeight = t);
30130              }
30131              get near() {
30132                return this._near;
30133              }
30134              set near(t) {
30135                this._near = t;
30136                this._camera && (this._camera.nearClip = t);
30137              }
30138              get far() {
30139                return this._far;
30140              }
30141              set far(t) {
30142                this._far = t;
30143                this._camera && (this._camera.farClip = t);
30144              }
30145              get aperture() {
30146                return this._aperture;
30147              }
30148              set aperture(t) {
30149                this._aperture = t;
30150                this._camera && (this._camera.aperture = t);
30151              }
30152              get shutter() {
30153                return this._shutter;
30154              }
30155              set shutter(t) {
30156                this._shutter = t;
30157                this._camera && (this._camera.shutter = t);
30158              }
30159              get iso() {
30160                return this._iso;
30161              }
30162              set iso(t) {
30163                this._iso = t;
30164                this._camera && (this._camera.iso = t);
30165              }
30166              get rect() {
30167                return this._rect;
30168              }
30169              set rect(t) {
30170                this._rect = t;
30171                this._camera && this._camera.setViewportInOrientedSpace(t);
30172              }
30173              get targetTexture() {
30174                return this._targetTexture;
30175              }
30176              set targetTexture(e) {
30177                if (this._targetTexture === e) return;
30178                const i = this._targetTexture;
30179                this._targetTexture = e;
30180                this._checkTargetTextureEvent(i);
30181                this._updateTargetTexture();
30182                if (!e && this._camera) {
30183                  this._camera.changeTargetWindow(null);
30184                  this._camera.isWindowSize = !0;
30185                }
30186                this.node.emit(t.TARGET_TEXTURE_CHANGE, this);
30187              }
30188              get screenScale() {
30189                return this._screenScale;
30190              }
30191              set screenScale(t) {
30192                this._screenScale = t;
30193                this._camera && (this._camera.screenScale = t);
30194              }
30195              get inEditorMode() {
30196                return this._inEditorMode;
30197              }
30198              set inEditorMode(t) {
30199                this._inEditorMode = t;
30200                this._camera && this._camera.changeTargetWindow(t ? m.director.root && m.director.root.mainWindow : m.director.root && m.director.root.tempWindow);
30201              }
30202              get cameraType() {
30203                return this._cameraType;
30204              }
30205              set cameraType(t) {
30206                if (this._cameraType !== t) {
30207                  this._cameraType = t;
30208                  this.camera && (this.camera.cameraType = t);
30209                }
30210              }
30211              get trackingType() {
30212                return this._trackingType;
30213              }
30214              set trackingType(t) {
30215                if (this._trackingType !== t) {
30216                  this._trackingType = t;
30217                  this.camera && (this.camera.trackingType = t);
30218                }
30219              }
30220              onLoad() {
30221                this._createCamera();
30222              }
30223              onEnable() {
30224                this.node.hasChangedFlags |= ay.POSITION;
30225                this._camera && this._attachToScene();
30226              }
30227              onDisable() {
30228                this._camera && this._detachFromScene();
30229              }
30230              onDestroy() {
30231                if (this._camera) {
30232                  this._camera.destroy();
30233                  this._camera = null;
30234                }
30235                this._targetTexture && this._targetTexture.off("resize");
30236              }
30237              screenPointToRay(t, e, i) {
30238                i || (i = ra.create());
30239                this._camera && this._camera.screenPointToRay(i, t, e);
30240                return i;
30241              }
30242              worldToScreen(t, e) {
30243                e || (e = new Pi);
30244                this._camera && this._camera.worldToScreen(e, t);
30245                return e;
30246              }
30247              screenToWorld(t, e) {
30248                e || (e = this.node.getWorldPosition());
30249                this._camera && this._camera.screenToWorld(e, t);
30250                return e;
30251              }
30252              convertToUINode(t, e, i) {
30253                i || (i = new Pi);
30254                if (!this._camera) return i;
30255                this.worldToScreen(t, iS);
30256                const s = e.getComponent("cc.UITransform");
30257                const n = m.view.getVisibleSize();
30258                const r = iS.x - .5 * this._camera.width;
30259                const o = iS.y - .5 * this._camera.height;
30260                iS.x = r / m.view.getScaleX() + .5 * n.width;
30261                iS.y = o / m.view.getScaleY() + .5 * n.height;
30262                s && s.convertToNodeSpaceAR(iS, i);
30263                return i;
30264              }
30265              _createCamera() {
30266                if (!this._camera) {
30267                  this._camera = m.director.root.createCamera();
30268                  this._camera.initialize({
30269                    name: this.node.name,
30270                    node: this.node,
30271                    projection: this._projection,
30272                    window: this._inEditorMode ? m.director.root && m.director.root.mainWindow : m.director.root && m.director.root.tempWindow,
30273                    priority: this._priority,
30274                    cameraType: this.cameraType,
30275                    trackingType: this.trackingType
30276                  });
30277                  this._camera.setViewportInOrientedSpace(this._rect);
30278                  this._camera.fovAxis = this._fovAxis;
30279                  this._camera.fov = mi(this._fov);
30280                  this._camera.orthoHeight = this._orthoHeight;
30281                  this._camera.nearClip = this._near;
30282                  this._camera.farClip = this._far;
30283                  this._camera.clearColor = this._color;
30284                  this._camera.clearDepth = this._depth;
30285                  this._camera.clearStencil = this._stencil;
30286                  this._camera.clearFlag = this._clearFlags;
30287                  this._camera.visibility = this._visibility;
30288                  this._camera.aperture = this._aperture;
30289                  this._camera.shutter = this._shutter;
30290                  this._camera.iso = this._iso;
30291                }
30292                this._updateTargetTexture();
30293              }
30294              _attachToScene() {
30295                if (this.node.scene && this._camera) {
30296                  this._camera && this._camera.scene && this._camera.scene.removeCamera(this._camera);
30297                  this._getRenderScene().addCamera(this._camera);
30298                }
30299              }
30300              _detachFromScene() {
30301                this._camera && this._camera.scene && this._camera.scene.removeCamera(this._camera);
30302              }
30303              _checkTargetTextureEvent(t) {
30304                t && t.off("resize");
30305                this._targetTexture && this._targetTexture.on("resize", (t => {
30306                  this._camera && this._camera.setFixedSize(t.width, t.height);
30307                }), this);
30308              }
30309              _updateTargetTexture() {
30310                if (this._camera && this._targetTexture) {
30311                  const t = this._targetTexture.window;
30312                  this._camera.changeTargetWindow(t);
30313                  this._camera.setFixedSize(t.width, t.height);
30314                }
30315              }
30316            }, tS.ProjectionType = sS, tS.FOVAxis = nS, tS.ClearFlag = lS, tS.Aperture = rS,
30317            tS.Shutter = oS, tS.ISO = aS, tS.TARGET_TEXTURE_CHANGE = "tex-change", eS), Ob = Bl(Pb.prototype, "_projection", [ Yl ], {
30318              configurable: !0,
30319              enumerable: !0,
30320              writable: !0,
30321              initializer: function() {
30322                return sS.PERSPECTIVE;
30323              }
30324            }), Nb = Bl(Pb.prototype, "_priority", [ Yl ], {
30325              configurable: !0,
30326              enumerable: !0,
30327              writable: !0,
30328              initializer: function() {
30329                return 0;
30330              }
30331            }), Lb = Bl(Pb.prototype, "_fov", [ Yl ], {
30332              configurable: !0,
30333              enumerable: !0,
30334              writable: !0,
30335              initializer: function() {
30336                return 45;
30337              }
30338            }), Fb = Bl(Pb.prototype, "_fovAxis", [ Yl ], {
30339              configurable: !0,
30340              enumerable: !0,
30341              writable: !0,
30342              initializer: function() {
30343                return nS.VERTICAL;
30344              }
30345            }), Vb = Bl(Pb.prototype, "_orthoHeight", [ Yl ], {
30346              configurable: !0,
30347              enumerable: !0,
30348              writable: !0,
30349              initializer: function() {
30350                return 10;
30351              }
30352            }), kb = Bl(Pb.prototype, "_near", [ Yl ], {
30353              configurable: !0,
30354              enumerable: !0,
30355              writable: !0,
30356              initializer: function() {
30357                return 1;
30358              }
30359            }), Ub = Bl(Pb.prototype, "_far", [ Yl ], {
30360              configurable: !0,
30361              enumerable: !0,
30362              writable: !0,
30363              initializer: function() {
30364                return 1e3;
30365              }
30366            }), Gb = Bl(Pb.prototype, "_color", [ Yl ], {
30367              configurable: !0,
30368              enumerable: !0,
30369              writable: !0,
30370              initializer: function() {
30371                return new Bi("#333333");
30372              }
30373            }), zb = Bl(Pb.prototype, "_depth", [ Yl ], {
30374              configurable: !0,
30375              enumerable: !0,
30376              writable: !0,
30377              initializer: function() {
30378                return 1;
30379              }
30380            }), Hb = Bl(Pb.prototype, "_stencil", [ Yl ], {
30381              configurable: !0,
30382              enumerable: !0,
30383              writable: !0,
30384              initializer: function() {
30385                return 0;
30386              }
30387            }), jb = Bl(Pb.prototype, "_clearFlags", [ Yl ], {
30388              configurable: !0,
30389              enumerable: !0,
30390              writable: !0,
30391              initializer: function() {
30392                return lS.SOLID_COLOR;
30393              }
30394            }), Xb = Bl(Pb.prototype, "_rect", [ Yl ], {
30395              configurable: !0,
30396              enumerable: !0,
30397              writable: !0,
30398              initializer: function() {
30399                return new as(0, 0, 1, 1);
30400              }
30401            }), Wb = Bl(Pb.prototype, "_aperture", [ Yl ], {
30402              configurable: !0,
30403              enumerable: !0,
30404              writable: !0,
30405              initializer: function() {
30406                return rS.F16_0;
30407              }
30408            }), Yb = Bl(Pb.prototype, "_shutter", [ Yl ], {
30409              configurable: !0,
30410              enumerable: !0,
30411              writable: !0,
30412              initializer: function() {
30413                return oS.D125;
30414              }
30415            }), qb = Bl(Pb.prototype, "_iso", [ Yl ], {
30416              configurable: !0,
30417              enumerable: !0,
30418              writable: !0,
30419              initializer: function() {
30420                return aS.ISO100;
30421              }
30422            }), Kb = Bl(Pb.prototype, "_screenScale", [ Yl ], {
30423              configurable: !0,
30424              enumerable: !0,
30425              writable: !0,
30426              initializer: function() {
30427                return 1;
30428              }
30429            }), Jb = Bl(Pb.prototype, "_visibility", [ Yl ], {
30430              configurable: !0,
30431              enumerable: !0,
30432              writable: !0,
30433              initializer: function() {
30434                return zf;
30435              }
30436            }), Zb = Bl(Pb.prototype, "_targetTexture", [ Yl ], {
30437              configurable: !0,
30438              enumerable: !0,
30439              writable: !0,
30440              initializer: function() {
30441                return null;
30442              }
30443            }), Qb = Bl(Pb.prototype, "_cameraType", [ Yl ], {
30444              configurable: !0,
30445              enumerable: !0,
30446              writable: !0,
30447              initializer: function() {
30448                return Ry.DEFAULT;
30449              }
30450            }), $b = Bl(Pb.prototype, "_trackingType", [ Yl ], {
30451              configurable: !0,
30452              enumerable: !0,
30453              writable: !0,
30454              initializer: function() {
30455                return Iy.NO_TRACKING;
30456              }
30457            }), Bl(Pb.prototype, "priority", [ Gy, zy ], Object.getOwnPropertyDescriptor(Pb.prototype, "priority"), Pb.prototype),
30458            Bl(Pb.prototype, "visibility", [ Hy, jy, Xy ], Object.getOwnPropertyDescriptor(Pb.prototype, "visibility"), Pb.prototype),
30459            Bl(Pb.prototype, "clearFlags", [ Wy, Yy, qy ], Object.getOwnPropertyDescriptor(Pb.prototype, "clearFlags"), Pb.prototype),
30460            Bl(Pb.prototype, "clearColor", [ Ky, Jy ], Object.getOwnPropertyDescriptor(Pb.prototype, "clearColor"), Pb.prototype),
30461            Bl(Pb.prototype, "clearDepth", [ Zy, Qy ], Object.getOwnPropertyDescriptor(Pb.prototype, "clearDepth"), Pb.prototype),
30462            Bl(Pb.prototype, "clearStencil", [ $y, tb ], Object.getOwnPropertyDescriptor(Pb.prototype, "clearStencil"), Pb.prototype),
30463            Bl(Pb.prototype, "projection", [ eb, ib, sb ], Object.getOwnPropertyDescriptor(Pb.prototype, "projection"), Pb.prototype),
30464            Bl(Pb.prototype, "fovAxis", [ nb, rb, ob, ab ], Object.getOwnPropertyDescriptor(Pb.prototype, "fovAxis"), Pb.prototype),
30465            Bl(Pb.prototype, "fov", [ lb, hb, cb ], Object.getOwnPropertyDescriptor(Pb.prototype, "fov"), Pb.prototype),
30466            Bl(Pb.prototype, "orthoHeight", [ ub, _b, db ], Object.getOwnPropertyDescriptor(Pb.prototype, "orthoHeight"), Pb.prototype),
30467            Bl(Pb.prototype, "near", [ pb, mb ], Object.getOwnPropertyDescriptor(Pb.prototype, "near"), Pb.prototype),
30468            Bl(Pb.prototype, "far", [ fb, gb ], Object.getOwnPropertyDescriptor(Pb.prototype, "far"), Pb.prototype),
30469            Bl(Pb.prototype, "aperture", [ yb, bb, Sb ], Object.getOwnPropertyDescriptor(Pb.prototype, "aperture"), Pb.prototype),
30470            Bl(Pb.prototype, "shutter", [ Ab, Tb, vb ], Object.getOwnPropertyDescriptor(Pb.prototype, "shutter"), Pb.prototype),
30471            Bl(Pb.prototype, "iso", [ Eb, Cb, xb ], Object.getOwnPropertyDescriptor(Pb.prototype, "iso"), Pb.prototype),
30472            Bl(Pb.prototype, "rect", [ wb, Rb ], Object.getOwnPropertyDescriptor(Pb.prototype, "rect"), Pb.prototype),
30473            Bl(Pb.prototype, "targetTexture", [ Ib, Mb, Bb ], Object.getOwnPropertyDescriptor(Pb.prototype, "targetTexture"), Pb.prototype),
30474            Pb)) || Db) || Db) || Db) || Db), t({
30475              Camera: cS,
30476              CameraComponent: cS
30477            }), cS);
30478            var cS;
30479            m.Camera = hS;
30480            const uS = jsb.MaterialInstance;
30481            const _S = jsb.MaterialInstance.prototype;
30482            Object.defineProperty(_S, "parent", {
30483              configurable: !0,
30484              enumerable: !0,
30485              get() {
30486                return this._parent;
30487              }
30488            });
30489            Object.defineProperty(_S, "owner", {
30490              configurable: !0,
30491              enumerable: !0,
30492              get() {
30493                return this._owner;
30494              }
30495            });
30496            _S._ctor = function(t) {
30497              jsb.Material.prototype._ctor.apply(this, arguments);
30498              this._registerListeners();
30499              this._parent = t.parent;
30500              this._owner = t.owner || null;
30501              this._subModelIdx = t.subModelIdx || 0;
30502              this._passes = this.getPasses();
30503            };
30504            _S._onRebuildPSO = function() {
30505              this._owner && this._owner._onRebuildPSO(this._subModelIdx, this);
30506            };
30507            var dS, pS, mS, fS, gS, yS, bS, SS, AS;
30508            const TS = {
30509              parent: null,
30510              owner: null,
30511              subModelIdx: 0
30512            };
30513            let vS = t("Renderer", (dS = Ul("cc.Renderer"), pS = Th(hm), mS = ph(), fS = ah(),
30514            gS = Th([ hm ]), dS(yS = Hl(yS = (bS = (AS = class extends Qc {
30515              constructor(...t) {
30516                super(...t);
30517                Ml(this, "_materials", SS, this);
30518                this._materialInstances = [];
30519              }
30520              get sharedMaterial() {
30521                return this.getMaterial(0);
30522              }
30523              get sharedMaterials() {
30524                return this._materials;
30525              }
30526              set sharedMaterials(t) {
30527                for (let e = 0; e < t.length; e++) t[e] !== this._materials[e] && this.setMaterial(t[e], e);
30528                if (t.length < this._materials.length) {
30529                  for (let e = t.length; e < this._materials.length; e++) this.setMaterial(null, e);
30530                  this._materials.splice(t.length);
30531                }
30532              }
30533              get material() {
30534                return this.getMaterialInstance(0);
30535              }
30536              set material(t) {
30537                (1 !== this._materials.length || this._materialInstances[0] || this._materials[0] !== t) && this.setMaterialInstance(t, 0);
30538              }
30539              get materials() {
30540                for (let t = 0; t < this._materials.length; t++) this._materialInstances[t] = this.getMaterialInstance(t);
30541                return this._materialInstances;
30542              }
30543              set materials(t) {
30544                const e = t.length;
30545                const i = this._materials.length;
30546                for (let t = e; t < i; t++) this.setMaterialInstance(null, t);
30547                this._materials.length = e;
30548                this._materialInstances.length = e;
30549                for (let i = 0; i < e; i++) this._materialInstances[i] != t[i] && this.setMaterialInstance(t[i], i);
30550              }
30551              getMaterial(t) {
30552                return t < 0 || t >= this._materials.length ? null : this._materials[t];
30553              }
30554              setMaterial(t, e) {
30555                t && t instanceof uS && console.error("Can't set a material instance to a sharedMaterial slot");
30556                this._materials[e] = t;
30557                const i = this._materialInstances[e];
30558                if (i) {
30559                  i.destroy();
30560                  this._materialInstances[e] = null;
30561                }
30562                this._onMaterialModified(e, this._materials[e]);
30563              }
30564              getMaterialInstance(t) {
30565                if (!this._materials[t]) return null;
30566                if (!this._materialInstances[t]) {
30567                  TS.parent = this._materials[t];
30568                  TS.owner = this;
30569                  TS.subModelIdx = t;
30570                  const e = new uS(TS);
30571                  TS.parent = null;
30572                  TS.owner = null;
30573                  TS.subModelIdx = 0;
30574                  this.setMaterialInstance(e, t);
30575                }
30576                return this._materialInstances[t];
30577              }
30578              setMaterialInstance(t, e) {
30579                if ("number" == typeof t) {
30580                  N(12007);
30581                  const i = t;
30582                  t = e;
30583                  e = i;
30584                }
30585                const i = this._materialInstances[e];
30586                if (t && t.parent) {
30587                  if (t !== i) {
30588                    this._materialInstances[e] = t;
30589                    this._onMaterialModified(e, t);
30590                  }
30591                } else (t !== this._materials[e] || i) && this.setMaterial(t, e);
30592              }
30593              getRenderMaterial(t) {
30594                return this._materialInstances[t] || this._materials[t];
30595              }
30596              _onMaterialModified(t, e) {}
30597              _onRebuildPSO(t, e) {}
30598              _clearMaterials() {}
30599            }, AS), Bl(bS.prototype, "sharedMaterials", [ pS, mS, fS ], Object.getOwnPropertyDescriptor(bS.prototype, "sharedMaterials"), bS.prototype),
30600            SS = Bl(bS.prototype, "_materials", [ gS ], {
30601              configurable: !0,
30602              enumerable: !0,
30603              writable: !0,
30604              initializer: function() {
30605                return [];
30606              }
30607            }), bS)) || yS) || yS));
30608            var ES, CS, xS;
30609            let wS = function(e) {
30610              return t({
30611                ModelRenderer: e,
30612                RenderableComponent: e
30613              }), e;
30614            }(Ul("cc.ModelRenderer")(ES = (CS = class extends vS {
30615              constructor(...t) {
30616                super(...t);
30617                Ml(this, "_visFlags", xS, this);
30618                this._models = [];
30619                this._priority = 0;
30620              }
30621              get visibility() {
30622                return this._visFlags;
30623              }
30624              set visibility(t) {
30625                this._visFlags = t;
30626                this._onVisibilityChange(t);
30627              }
30628              get priority() {
30629                return this._priority;
30630              }
30631              set priority(t) {
30632                if (t !== this._priority) {
30633                  this._priority = t;
30634                  this._updatePriority();
30635                }
30636              }
30637              _collectModels() {
30638                return this._models;
30639              }
30640              onEnable() {
30641                this._updatePriority();
30642              }
30643              _attachToScene() {}
30644              _detachFromScene() {}
30645              _onVisibilityChange(t) {}
30646              _updatePriority() {
30647                if (this._models.length > 0) for (let t = 0; t < this._models.length; t++) this._models[t].priority = this._priority;
30648              }
30649            }, xS = Bl(CS.prototype, "_visFlags", [ Yl ], {
30650              configurable: !0,
30651              enumerable: !0,
30652              writable: !0,
30653              initializer: function() {
30654                return mm.Enum.NONE;
30655              }
30656            }), CS)) || ES);
30657            W(hS, "Camera", [ {
30658              name: "CameraClearFlag",
30659              newName: "ClearFlag"
30660            } ]);
30661            W(hS.prototype, "Camera.prototype", [ {
30662              name: "color",
30663              newName: "clearColor"
30664            }, {
30665              name: "depth",
30666              newName: "clearDepth"
30667            }, {
30668              name: "stencil",
30669              newName: "clearStencil"
30670            } ]);
30671            m.CameraComponent = hS;
30672            ee.setClassAlias(hS, "cc.CameraComponent");
30673            m.RenderableComponent = wS;
30674            ee.setClassAlias(wS, "cc.RenderableComponent");
30675            class RS {
30676              constructor(t, e) {
30677                this.type = void 0;
30678                this.bubbles = void 0;
30679                this.target = null;
30680                this.currentTarget = null;
30681                this.eventPhase = 0;
30682                this.propagationStopped = !1;
30683                this.propagationImmediateStopped = !1;
30684                this.type = t;
30685                this.bubbles = !!e;
30686              }
30687              unuse() {
30688                this.type = RS.NO_TYPE;
30689                this.target = null;
30690                this.currentTarget = null;
30691                this.eventPhase = RS.NONE;
30692                this.propagationStopped = !1;
30693                this.propagationImmediateStopped = !1;
30694              }
30695              reuse(t, e) {
30696                this.type = t;
30697                this.bubbles = e || !1;
30698              }
30699              isStopped() {
30700                return this.propagationStopped || this.propagationImmediateStopped;
30701              }
30702              getCurrentTarget() {
30703                return this.currentTarget;
30704              }
30705              getType() {
30706                return this.type;
30707              }
30708            }
30709            t("Event", RS);
30710            RS.NO_TYPE = "no_type";
30711            RS.TOUCH = "touch";
30712            RS.MOUSE = "mouse";
30713            RS.KEYBOARD = "keyboard";
30714            RS.ACCELERATION = "acceleration";
30715            RS.NONE = 0;
30716            RS.CAPTURING_PHASE = 1;
30717            RS.AT_TARGET = 2;
30718            RS.BUBBLING_PHASE = 3;
30719            m.Event = RS;
30720            let IS;
30721            !function(t) {
30722              t.TOUCH_START = "touch-start";
30723              t.TOUCH_MOVE = "touch-move";
30724              t.TOUCH_END = "touch-end";
30725              t.TOUCH_CANCEL = "touch-cancel";
30726              t.MOUSE_DOWN = "mouse-down";
30727              t.MOUSE_MOVE = "mouse-move";
30728              t.MOUSE_UP = "mouse-up";
30729              t.MOUSE_WHEEL = "mouse-wheel";
30730              t.MOUSE_ENTER = "mouse-enter";
30731              t.MOUSE_LEAVE = "mouse-leave";
30732              t.KEY_DOWN = "keydown";
30733              t.KEY_UP = "keyup";
30734              t.DEVICEMOTION = "devicemotion";
30735              t.TRANSFORM_CHANGED = "transform-changed";
30736              t.SCENE_CHANGED_FOR_PERSISTS = "scene-changed-for-persists";
30737              t.SIZE_CHANGED = "size-changed";
30738              t.ANCHOR_CHANGED = "anchor-changed";
30739              t.COLOR_CHANGED = "color-changed";
30740              t.CHILD_ADDED = "child-added";
30741              t.CHILD_REMOVED = "child-removed";
30742              t.PARENT_CHANGED = "parent-changed";
30743              t.NODE_DESTROYED = "node-destroyed";
30744              t.LAYER_CHANGED = "layer-changed";
30745              t.SIBLING_ORDER_CHANGED = "sibling-order-changed";
30746            }(IS || (IS = t("SystemEventType", {})));
30747            let MS;
30748            !function(t) {
30749              t.TOUCH_START = "touch-start";
30750              t.TOUCH_MOVE = "touch-move";
30751              t.TOUCH_END = "touch-end";
30752              t.TOUCH_CANCEL = "touch-cancel";
30753              t.MOUSE_DOWN = "mouse-down";
30754              t.MOUSE_MOVE = "mouse-move";
30755              t.MOUSE_UP = "mouse-up";
30756              t.MOUSE_WHEEL = "mouse-wheel";
30757              t.KEY_DOWN = "keydown";
30758              t.KEY_PRESSING = "key-pressing";
30759              t.KEY_UP = "keyup";
30760              t.DEVICEMOTION = "devicemotion";
30761              t.GAMEPAD_INPUT = "gamepad-input";
30762              t.GAMEPAD_CHANGE = "gamepad-change";
30763              t.HANDLE_INPUT = "handle-input";
30764              t.HANDLE_POSE_INPUT = "handle-pose-input";
30765              t.HMD_POSE_INPUT = "hmd-pose-input";
30766            }(MS || (MS = {}));
30767            m.SystemEventType = IS;
30768            class BS extends RS {
30769              constructor(t, e) {
30770                super(IS.DEVICEMOTION, e);
30771                this.acc = void 0;
30772                this.acc = t;
30773              }
30774            }
30775            t("EventAcceleration", BS);
30776            RS.EventAcceleration = BS;
30777            class DS extends RS {
30778              get isPressed() {
30779                return this._isPressed;
30780              }
30781              constructor(t, e, i) {
30782                if ("boolean" == typeof e) {
30783                  e = e ? IS.KEY_DOWN : IS.KEY_UP;
30784                }
30785                super(e, i);
30786                this.keyCode = void 0;
30787                this.rawEvent = void 0;
30788                this._isPressed = void 0;
30789                this._isPressed = e !== IS.KEY_UP;
30790                if ("number" == typeof t) this.keyCode = t; else {
30791                  this.keyCode = t.keyCode;
30792                  this.rawEvent = t;
30793                }
30794              }
30795            }
30796            t("EventKeyboard", DS);
30797            RS.EventKeyboard = DS;
30798            class PS extends RS {
30799              get eventType() {
30800                return this._eventType;
30801              }
30802              constructor(t, e, i) {
30803                super(t, e);
30804                this.movementX = 0;
30805                this.movementY = 0;
30806                this.preventSwallow = !1;
30807                this._eventType = void 0;
30808                this._button = PS.BUTTON_MISSING;
30809                this._x = 0;
30810                this._y = 0;
30811                this._prevX = 0;
30812                this._prevY = 0;
30813                this._scrollX = 0;
30814                this._scrollY = 0;
30815                this._eventType = t;
30816                if (i) {
30817                  this._prevX = i.x;
30818                  this._prevY = i.y;
30819                }
30820              }
30821              setScrollData(t, e) {
30822                this._scrollX = t;
30823                this._scrollY = e;
30824              }
30825              getScrollX() {
30826                return this._scrollX;
30827              }
30828              getScrollY() {
30829                return this._scrollY;
30830              }
30831              setLocation(t, e) {
30832                this._x = t;
30833                this._y = e;
30834              }
30835              getLocation(t) {
30836                t || (t = new Qi);
30837                Qi.set(t, this._x, this._y);
30838                return t;
30839              }
30840              getLocationInView(t) {
30841                t || (t = new Qi);
30842                Qi.set(t, this._x, m.view._designResolutionSize.height - this._y);
30843                return t;
30844              }
30845              getUILocation(t) {
30846                t || (t = new Qi);
30847                Qi.set(t, this._x, this._y);
30848                m.view._convertToUISpace(t);
30849                return t;
30850              }
30851              getPreviousLocation(t) {
30852                t || (t = new Qi);
30853                Qi.set(t, this._prevX, this._prevY);
30854                return t;
30855              }
30856              getUIPreviousLocation(t) {
30857                t || (t = new Qi);
30858                Qi.set(t, this._prevX, this._prevY);
30859                m.view._convertToUISpace(t);
30860                return t;
30861              }
30862              getDelta(t) {
30863                t || (t = new Qi);
30864                Qi.set(t, this._x - this._prevX, this._y - this._prevY);
30865                return t;
30866              }
30867              getDeltaX() {
30868                return this._x - this._prevX;
30869              }
30870              getDeltaY() {
30871                return this._y - this._prevY;
30872              }
30873              getUIDelta(t) {
30874                t || (t = new Qi);
30875                Qi.set(t, (this._x - this._prevX) / m.view.getScaleX(), (this._y - this._prevY) / m.view.getScaleY());
30876                return t;
30877              }
30878              getUIDeltaX() {
30879                return (this._x - this._prevX) / m.view.getScaleX();
30880              }
30881              getUIDeltaY() {
30882                return (this._y - this._prevY) / m.view.getScaleY();
30883              }
30884              setButton(t) {
30885                this._button = t;
30886              }
30887              getButton() {
30888                return this._button;
30889              }
30890              getLocationX() {
30891                return this._x;
30892              }
30893              getLocationY() {
30894                return this._y;
30895              }
30896              getUILocationX() {
30897                const t = m.view.getViewportRect();
30898                return (this._x - t.x) / m.view.getScaleX();
30899              }
30900              getUILocationY() {
30901                const t = m.view.getViewportRect();
30902                return (this._y - t.y) / m.view.getScaleY();
30903              }
30904            }
30905            t("EventMouse", PS);
30906            PS.BUTTON_MISSING = -1;
30907            PS.BUTTON_LEFT = 0;
30908            PS.BUTTON_RIGHT = 2;
30909            PS.BUTTON_MIDDLE = 1;
30910            PS.BUTTON_4 = 3;
30911            PS.BUTTON_5 = 4;
30912            PS.BUTTON_6 = 5;
30913            PS.BUTTON_7 = 6;
30914            PS.BUTTON_8 = 7;
30915            RS.EventMouse = PS;
30916            const OS = new Qi;
30917            class NS extends RS {
30918              constructor(t, e, i, s = []) {
30919                super(i, e);
30920                this.touch = null;
30921                this.simulate = !1;
30922                this.preventSwallow = !1;
30923                this._eventCode = void 0;
30924                this._touches = void 0;
30925                this._allTouches = void 0;
30926                this._eventCode = i;
30927                this._touches = t || [];
30928                this._allTouches = s;
30929              }
30930              getEventCode() {
30931                return this._eventCode;
30932              }
30933              getTouches() {
30934                return this._touches;
30935              }
30936              getAllTouches() {
30937                return this._allTouches;
30938              }
30939              setLocation(t, e) {
30940                this.touch && this.touch.setTouchInfo(this.touch.getID(), t, e);
30941              }
30942              getLocation(t) {
30943                return this.touch ? this.touch.getLocation(t) : new Qi;
30944              }
30945              getUILocation(t) {
30946                return this.touch ? this.touch.getUILocation(t) : new Qi;
30947              }
30948              getLocationInView(t) {
30949                return this.touch ? this.touch.getLocationInView(t) : new Qi;
30950              }
30951              getPreviousLocation(t) {
30952                return this.touch ? this.touch.getPreviousLocation(t) : new Qi;
30953              }
30954              getStartLocation(t) {
30955                return this.touch ? this.touch.getStartLocation(t) : new Qi;
30956              }
30957              getUIStartLocation(t) {
30958                return this.touch ? this.touch.getUIStartLocation(t) : new Qi;
30959              }
30960              getID() {
30961                return this.touch ? this.touch.getID() : null;
30962              }
30963              getDelta(t) {
30964                return this.touch ? this.touch.getDelta(t) : new Qi;
30965              }
30966              getUIDelta(t) {
30967                return this.touch ? this.touch.getUIDelta(t) : new Qi;
30968              }
30969              getDeltaX() {
30970                return this.touch ? this.touch.getDelta(OS).x : 0;
30971              }
30972              getDeltaY() {
30973                return this.touch ? this.touch.getDelta(OS).y : 0;
30974              }
30975              getLocationX() {
30976                return this.touch ? this.touch.getLocationX() : 0;
30977              }
30978              getLocationY() {
30979                return this.touch ? this.touch.getLocationY() : 0;
30980              }
30981            }
30982            t("EventTouch", NS);
30983            NS.MAX_TOUCHES = 5;
30984            RS.EventTouch = NS;
30985            class LS extends RS {
30986              constructor(t, e) {
30987                super(t, !1);
30988                this.gamepad = void 0;
30989                this.gamepad = e;
30990              }
30991            }
30992            t("EventGamepad", LS);
30993            class FS extends RS {
30994              constructor(t, e) {
30995                super(t, !1);
30996                this.handleInputDevice = void 0;
30997                this.handleInputDevice = e;
30998              }
30999            }
31000            t("EventHandle", FS);
31001            class VS extends RS {
31002              constructor(t, e) {
31003                super(t, !1);
31004                this.hmdInputDevice = void 0;
31005                this.hmdInputDevice = e;
31006              }
31007            }
31008            t("EventHMD", VS);
31009            class kS {
31010              constructor(t = 0, e = 0, i = 0, s = 0) {
31011                this.x = void 0;
31012                this.y = void 0;
31013                this.z = void 0;
31014                this.timestamp = void 0;
31015                this.x = t;
31016                this.y = e;
31017                this.z = i;
31018                this.timestamp = s;
31019              }
31020            }
31021            t("Acceleration", kS);
31022            let US;
31023            !function(t) {
31024              t[t.NONE = 0] = "NONE";
31025              t[t.MOBILE_BACK = 6] = "MOBILE_BACK";
31026              t[t.BACKSPACE = 8] = "BACKSPACE";
31027              t[t.TAB = 9] = "TAB";
31028              t[t.ENTER = 13] = "ENTER";
31029              t[t.SHIFT_LEFT = 16] = "SHIFT_LEFT";
31030              t[t.CTRL_LEFT = 17] = "CTRL_LEFT";
31031              t[t.ALT_LEFT = 18] = "ALT_LEFT";
31032              t[t.PAUSE = 19] = "PAUSE";
31033              t[t.CAPS_LOCK = 20] = "CAPS_LOCK";
31034              t[t.ESCAPE = 27] = "ESCAPE";
31035              t[t.SPACE = 32] = "SPACE";
31036              t[t.PAGE_UP = 33] = "PAGE_UP";
31037              t[t.PAGE_DOWN = 34] = "PAGE_DOWN";
31038              t[t.END = 35] = "END";
31039              t[t.HOME = 36] = "HOME";
31040              t[t.ARROW_LEFT = 37] = "ARROW_LEFT";
31041              t[t.ARROW_UP = 38] = "ARROW_UP";
31042              t[t.ARROW_RIGHT = 39] = "ARROW_RIGHT";
31043              t[t.ARROW_DOWN = 40] = "ARROW_DOWN";
31044              t[t.INSERT = 45] = "INSERT";
31045              t[t.DELETE = 46] = "DELETE";
31046              t[t.DIGIT_0 = 48] = "DIGIT_0";
31047              t[t.DIGIT_1 = 49] = "DIGIT_1";
31048              t[t.DIGIT_2 = 50] = "DIGIT_2";
31049              t[t.DIGIT_3 = 51] = "DIGIT_3";
31050              t[t.DIGIT_4 = 52] = "DIGIT_4";
31051              t[t.DIGIT_5 = 53] = "DIGIT_5";
31052              t[t.DIGIT_6 = 54] = "DIGIT_6";
31053              t[t.DIGIT_7 = 55] = "DIGIT_7";
31054              t[t.DIGIT_8 = 56] = "DIGIT_8";
31055              t[t.DIGIT_9 = 57] = "DIGIT_9";
31056              t[t.KEY_A = 65] = "KEY_A";
31057              t[t.KEY_B = 66] = "KEY_B";
31058              t[t.KEY_C = 67] = "KEY_C";
31059              t[t.KEY_D = 68] = "KEY_D";
31060              t[t.KEY_E = 69] = "KEY_E";
31061              t[t.KEY_F = 70] = "KEY_F";
31062              t[t.KEY_G = 71] = "KEY_G";
31063              t[t.KEY_H = 72] = "KEY_H";
31064              t[t.KEY_I = 73] = "KEY_I";
31065              t[t.KEY_J = 74] = "KEY_J";
31066              t[t.KEY_K = 75] = "KEY_K";
31067              t[t.KEY_L = 76] = "KEY_L";
31068              t[t.KEY_M = 77] = "KEY_M";
31069              t[t.KEY_N = 78] = "KEY_N";
31070              t[t.KEY_O = 79] = "KEY_O";
31071              t[t.KEY_P = 80] = "KEY_P";
31072              t[t.KEY_Q = 81] = "KEY_Q";
31073              t[t.KEY_R = 82] = "KEY_R";
31074              t[t.KEY_S = 83] = "KEY_S";
31075              t[t.KEY_T = 84] = "KEY_T";
31076              t[t.KEY_U = 85] = "KEY_U";
31077              t[t.KEY_V = 86] = "KEY_V";
31078              t[t.KEY_W = 87] = "KEY_W";
31079              t[t.KEY_X = 88] = "KEY_X";
31080              t[t.KEY_Y = 89] = "KEY_Y";
31081              t[t.KEY_Z = 90] = "KEY_Z";
31082              t[t.NUM_0 = 96] = "NUM_0";
31083              t[t.NUM_1 = 97] = "NUM_1";
31084              t[t.NUM_2 = 98] = "NUM_2";
31085              t[t.NUM_3 = 99] = "NUM_3";
31086              t[t.NUM_4 = 100] = "NUM_4";
31087              t[t.NUM_5 = 101] = "NUM_5";
31088              t[t.NUM_6 = 102] = "NUM_6";
31089              t[t.NUM_7 = 103] = "NUM_7";
31090              t[t.NUM_8 = 104] = "NUM_8";
31091              t[t.NUM_9 = 105] = "NUM_9";
31092              t[t.NUM_MULTIPLY = 106] = "NUM_MULTIPLY";
31093              t[t.NUM_PLUS = 107] = "NUM_PLUS";
31094              t[t.NUM_SUBTRACT = 109] = "NUM_SUBTRACT";
31095              t[t.NUM_DECIMAL = 110] = "NUM_DECIMAL";
31096              t[t.NUM_DIVIDE = 111] = "NUM_DIVIDE";
31097              t[t.F1 = 112] = "F1";
31098              t[t.F2 = 113] = "F2";
31099              t[t.F3 = 114] = "F3";
31100              t[t.F4 = 115] = "F4";
31101              t[t.F5 = 116] = "F5";
31102              t[t.F6 = 117] = "F6";
31103              t[t.F7 = 118] = "F7";
31104              t[t.F8 = 119] = "F8";
31105              t[t.F9 = 120] = "F9";
31106              t[t.F10 = 121] = "F10";
31107              t[t.F11 = 122] = "F11";
31108              t[t.F12 = 123] = "F12";
31109              t[t.NUM_LOCK = 144] = "NUM_LOCK";
31110              t[t.SCROLL_LOCK = 145] = "SCROLL_LOCK";
31111              t[t.SEMICOLON = 186] = "SEMICOLON";
31112              t[t.EQUAL = 187] = "EQUAL";
31113              t[t.COMMA = 188] = "COMMA";
31114              t[t.DASH = 189] = "DASH";
31115              t[t.PERIOD = 190] = "PERIOD";
31116              t[t.SLASH = 191] = "SLASH";
31117              t[t.BACK_QUOTE = 192] = "BACK_QUOTE";
31118              t[t.BRACKET_LEFT = 219] = "BRACKET_LEFT";
31119              t[t.BACKSLASH = 220] = "BACKSLASH";
31120              t[t.BRACKET_RIGHT = 221] = "BRACKET_RIGHT";
31121              t[t.QUOTE = 222] = "QUOTE";
31122              t[t.SHIFT_RIGHT = 2e3] = "SHIFT_RIGHT";
31123              t[t.CTRL_RIGHT = 2001] = "CTRL_RIGHT";
31124              t[t.ALT_RIGHT = 2002] = "ALT_RIGHT";
31125              t[t.NUM_ENTER = 2003] = "NUM_ENTER";
31126            }(US || (US = t("KeyCode", {})));
31127            const GS = new Qi;
31128            class zS {
31129              get lastModified() {
31130                return this._lastModified;
31131              }
31132              constructor(t, e, i = 0) {
31133                this._point = new Qi;
31134                this._prevPoint = new Qi;
31135                this._lastModified = 0;
31136                this._id = 0;
31137                this._startPoint = new Qi;
31138                this._startPointCaptured = !1;
31139                this.setTouchInfo(i, t, e);
31140              }
31141              getLocation(t) {
31142                t || (t = new Qi);
31143                t.set(this._point.x, this._point.y);
31144                return t;
31145              }
31146              getLocationX() {
31147                return this._point.x;
31148              }
31149              getLocationY() {
31150                return this._point.y;
31151              }
31152              getUILocation(t) {
31153                t || (t = new Qi);
31154                t.set(this._point.x, this._point.y);
31155                m.view._convertToUISpace(t);
31156                return t;
31157              }
31158              getUILocationX() {
31159                const t = m.view.getViewportRect();
31160                return (this._point.x - t.x) / m.view.getScaleX();
31161              }
31162              getUILocationY() {
31163                const t = m.view.getViewportRect();
31164                return (this._point.y - t.y) / m.view.getScaleY();
31165              }
31166              getPreviousLocation(t) {
31167                t || (t = new Qi);
31168                t.set(this._prevPoint.x, this._prevPoint.y);
31169                return t;
31170              }
31171              getUIPreviousLocation(t) {
31172                t || (t = new Qi);
31173                t.set(this._prevPoint.x, this._prevPoint.y);
31174                m.view._convertToUISpace(t);
31175                return t;
31176              }
31177              getStartLocation(t) {
31178                t || (t = new Qi);
31179                t.set(this._startPoint.x, this._startPoint.y);
31180                return t;
31181              }
31182              getUIStartLocation(t) {
31183                t || (t = new Qi);
31184                t.set(this._startPoint.x, this._startPoint.y);
31185                m.view._convertToUISpace(t);
31186                return t;
31187              }
31188              getDelta(t) {
31189                t || (t = new Qi);
31190                t.set(this._point);
31191                t.subtract(this._prevPoint);
31192                return t;
31193              }
31194              getUIDelta(t) {
31195                t || (t = new Qi);
31196                GS.set(this._point);
31197                GS.subtract(this._prevPoint);
31198                t.set(m.view.getScaleX(), m.view.getScaleY());
31199                Qi.divide(t, GS, t);
31200                return t;
31201              }
31202              getLocationInView(t) {
31203                t || (t = new Qi);
31204                t.set(this._point.x, m.view._designResolutionSize.height - this._point.y);
31205                return t;
31206              }
31207              getPreviousLocationInView(t) {
31208                t || (t = new Qi);
31209                t.set(this._prevPoint.x, m.view._designResolutionSize.height - this._prevPoint.y);
31210                return t;
31211              }
31212              getStartLocationInView(t) {
31213                t || (t = new Qi);
31214                t.set(this._startPoint.x, m.view._designResolutionSize.height - this._startPoint.y);
31215                return t;
31216              }
31217              getID() {
31218                return this._id;
31219              }
31220              setTouchInfo(t = 0, e, i) {
31221                this._prevPoint = this._point;
31222                this._point = new Qi(e || 0, i || 0);
31223                this._id = t;
31224                if (!this._startPointCaptured) {
31225                  this._startPoint = new Qi(this._point);
31226                  this._startPointCaptured = !0;
31227                }
31228              }
31229              setPoint(t, e) {
31230                if ("object" == typeof t) {
31231                  this._point.x = t.x;
31232                  this._point.y = t.y;
31233                } else {
31234                  this._point.x = t || 0;
31235                  this._point.y = e || 0;
31236                }
31237                this._lastModified = m.game.frameStartTime;
31238              }
31239              setPrevPoint(t, e) {
31240                this._prevPoint = "object" == typeof t ? new Qi(t.x, t.y) : new Qi(t || 0, e || 0);
31241                this._lastModified = m.game.frameStartTime;
31242              }
31243            }
31244            t("Touch", zS);
31245            m.Touch = zS;
31246            const HS = new Array(16);
31247            let jS = null;
31248            const XS = new Qi;
31249            const WS = [ ny.TOUCH_START, ny.TOUCH_MOVE, ny.TOUCH_END, ny.TOUCH_CANCEL ];
31250            const YS = [ ny.MOUSE_DOWN, ny.MOUSE_ENTER, ny.MOUSE_MOVE, ny.MOUSE_LEAVE, ny.MOUSE_UP, ny.MOUSE_WHEEL ];
31251            let qS;
31252            !function(t) {
31253              t[t.ADD_POINTER_EVENT_PROCESSOR = 0] = "ADD_POINTER_EVENT_PROCESSOR";
31254              t[t.REMOVE_POINTER_EVENT_PROCESSOR = 1] = "REMOVE_POINTER_EVENT_PROCESSOR";
31255              t[t.MARK_LIST_DIRTY = 2] = "MARK_LIST_DIRTY";
31256            }(qS || (qS = {}));
31257            class KS {
31258              get isEnabled() {
31259                return this._isEnabled;
31260              }
31261              get node() {
31262                return this._node;
31263              }
31264              constructor(t) {
31265                this.claimedTouchIdList = [];
31266                this.maskList = null;
31267                this.cachedCameraPriority = 0;
31268                this.previousMouseIn = !1;
31269                this.bubblingTarget = null;
31270                this.capturingTarget = null;
31271                this.shouldHandleEventMouse = !1;
31272                this.shouldHandleEventTouch = !1;
31273                this._dispatchingTouch = null;
31274                this._isEnabled = !1;
31275                this._node = void 0;
31276                this._node = t;
31277              }
31278              setEnabled(t, e = !1) {
31279                if (this._isEnabled === t) return;
31280                this._isEnabled = t;
31281                const i = this.node.children;
31282                t && this._attachMask();
31283                KS.callbacksInvoker.emit(qS.MARK_LIST_DIRTY);
31284                if (e && i.length > 0) for (let e = 0; e < i.length; ++e) {
31285                  i[e]._eventProcessor.setEnabled(t, !0);
31286                }
31287              }
31288              reattach() {
31289                let t;
31290                this.node.walk((e => {
31291                  t || (t = this._searchComponentsInParent(KS._maskComp));
31292                  e.eventProcessor.maskList = t;
31293                }));
31294              }
31295              destroy() {
31296                jS === this._node && (jS = null);
31297                this.capturingTarget && this.capturingTarget.clear();
31298                this.bubblingTarget && this.bubblingTarget.clear();
31299                KS.callbacksInvoker.emit(qS.REMOVE_POINTER_EVENT_PROCESSOR, this);
31300                if (this._dispatchingTouch) {
31301                  const t = new NS([ this._dispatchingTouch ], !0, MS.TOUCH_CANCEL);
31302                  t.touch = this._dispatchingTouch;
31303                  this.dispatchEvent(t);
31304                  this._dispatchingTouch = null;
31305                }
31306              }
31307              on(t, e, i, s) {
31308                this._tryEmittingAddEvent(t);
31309                let n;
31310                if (s = !!s) {
31311                  var r;
31312                  n = null !== (r = this.capturingTarget) && void 0 !== r ? r : this.capturingTarget = this._newCallbacksInvoker();
31313                } else {
31314                  var o;
31315                  n = null !== (o = this.bubblingTarget) && void 0 !== o ? o : this.bubblingTarget = this._newCallbacksInvoker();
31316                }
31317                n.on(t, e, i);
31318                return e;
31319              }
31320              once(t, e, i, s) {
31321                this._tryEmittingAddEvent(t);
31322                let n;
31323                if (s = !!s) {
31324                  var r;
31325                  n = null !== (r = this.capturingTarget) && void 0 !== r ? r : this.capturingTarget = this._newCallbacksInvoker();
31326                } else {
31327                  var o;
31328                  n = null !== (o = this.bubblingTarget) && void 0 !== o ? o : this.bubblingTarget = this._newCallbacksInvoker();
31329                }
31330                n.on(t, e, i, !0);
31331                return e;
31332              }
31333              off(t, e, i, s) {
31334                var n;
31335                let r;
31336                r = (s = !!s) ? this.capturingTarget : this.bubblingTarget;
31337                null === (n = r) || void 0 === n || n.off(t, e, i);
31338              }
31339              targetOff(t) {
31340                var e, i;
31341                null === (e = this.capturingTarget) || void 0 === e || e.removeAll(t);
31342                null === (i = this.bubblingTarget) || void 0 === i || i.removeAll(t);
31343                this.shouldHandleEventTouch && !this._hasTouchListeners() && (this.shouldHandleEventTouch = !1);
31344                this.shouldHandleEventMouse && !this._hasMouseListeners() && (this.shouldHandleEventMouse = !1);
31345                this._hasPointerListeners() || KS.callbacksInvoker.emit(qS.REMOVE_POINTER_EVENT_PROCESSOR, this);
31346              }
31347              emit(t, e, i, s, n, r) {
31348                var o;
31349                null === (o = this.bubblingTarget) || void 0 === o || o.emit(t, e, i, s, n, r);
31350              }
31351              dispatchEvent(t) {
31352                const e = this.node;
31353                let i;
31354                let s = 0;
31355                t.target = e;
31356                HS.length = 0;
31357                this.getCapturingTargets(t.type, HS);
31358                t.eventPhase = 1;
31359                for (s = HS.length - 1; s >= 0; --s) {
31360                  i = HS[s];
31361                  if (i.eventProcessor.capturingTarget) {
31362                    t.currentTarget = i;
31363                    i.eventProcessor.capturingTarget.emit(t.type, t, HS);
31364                    if (t.propagationStopped) {
31365                      HS.length = 0;
31366                      return;
31367                    }
31368                  }
31369                }
31370                HS.length = 0;
31371                t.eventPhase = 2;
31372                t.currentTarget = e;
31373                this.capturingTarget && this.capturingTarget.emit(t.type, t);
31374                !t.propagationImmediateStopped && this.bubblingTarget && this.bubblingTarget.emit(t.type, t);
31375                if (!t.propagationStopped && t.bubbles) {
31376                  this.getBubblingTargets(t.type, HS);
31377                  t.eventPhase = 3;
31378                  for (s = 0; s < HS.length; ++s) {
31379                    i = HS[s];
31380                    if (i.eventProcessor.bubblingTarget) {
31381                      t.currentTarget = i;
31382                      i.eventProcessor.bubblingTarget.emit(t.type, t);
31383                      if (t.propagationStopped) {
31384                        HS.length = 0;
31385                        return;
31386                      }
31387                    }
31388                  }
31389                }
31390                HS.length = 0;
31391              }
31392              hasEventListener(t, e, i) {
31393                let s = !1;
31394                this.bubblingTarget && (s = this.bubblingTarget.hasEventListener(t, e, i));
31395                !s && this.capturingTarget && (s = this.capturingTarget.hasEventListener(t, e, i));
31396                return s;
31397              }
31398              getCapturingTargets(t, e) {
31399                let i = this._node.parent;
31400                for (;i; ) {
31401                  var s;
31402                  (null === (s = i.eventProcessor.capturingTarget) || void 0 === s ? void 0 : s.hasEventListener(t)) && e.push(i);
31403                  i = i.parent;
31404                }
31405              }
31406              getBubblingTargets(t, e) {
31407                let i = this._node.parent;
31408                for (;i; ) {
31409                  var s;
31410                  (null === (s = i.eventProcessor.bubblingTarget) || void 0 === s ? void 0 : s.hasEventListener(t)) && e.push(i);
31411                  i = i.parent;
31412                }
31413              }
31414              _searchComponentsInParent(t) {
31415                const e = this.node;
31416                if (t) {
31417                  let i = 0;
31418                  let s = [];
31419                  for (let n = e; n && _y.isNode(n); n = n.parent, ++i) {
31420                    const e = n.getComponent(t);
31421                    if (e) {
31422                      const t = {
31423                        index: i,
31424                        comp: e
31425                      };
31426                      s ? s.push(t) : s = [ t ];
31427                    }
31428                  }
31429                  return s.length > 0 ? s : null;
31430                }
31431                return null;
31432              }
31433              _attachMask() {
31434                this.maskList = this._searchComponentsInParent(KS._maskComp);
31435              }
31436              _isTouchEvent(t) {
31437                return -1 !== WS.indexOf(t);
31438              }
31439              _isMouseEvent(t) {
31440                return -1 !== YS.indexOf(t);
31441              }
31442              _hasTouchListeners() {
31443                for (let t = 0; t < WS.length; ++t) {
31444                  const e = WS[t];
31445                  if (this.hasEventListener(e)) return !0;
31446                }
31447                return !1;
31448              }
31449              _hasMouseListeners() {
31450                for (let t = 0; t < YS.length; ++t) {
31451                  const e = YS[t];
31452                  if (this.hasEventListener(e)) return !0;
31453                }
31454                return !1;
31455              }
31456              _hasPointerListeners() {
31457                return !!this._hasTouchListeners() || this._hasMouseListeners();
31458              }
31459              _tryEmittingAddEvent(t) {
31460                const e = this._isTouchEvent(t);
31461                const i = this._isMouseEvent(t);
31462                e ? this.shouldHandleEventTouch = !0 : i && (this.shouldHandleEventMouse = !0);
31463                !e && !i || this._hasPointerListeners() || KS.callbacksInvoker.emit(qS.ADD_POINTER_EVENT_PROCESSOR, this);
31464              }
31465              _newCallbacksInvoker() {
31466                const t = new Ao;
31467                t._registerOffCallback((() => {
31468                  this.shouldHandleEventTouch && !this._hasTouchListeners() && (this.shouldHandleEventTouch = !1);
31469                  this.shouldHandleEventMouse && !this._hasMouseListeners() && (this.shouldHandleEventMouse = !1);
31470                  this._hasPointerListeners() || KS.callbacksInvoker.emit(qS.REMOVE_POINTER_EVENT_PROCESSOR, this);
31471                }));
31472                return t;
31473              }
31474              _handleEventMouse(t) {
31475                switch (t.type) {
31476                 case MS.MOUSE_DOWN:
31477                  return this._handleMouseDown(t);
31478
31479                 case MS.MOUSE_MOVE:
31480                  return this._handleMouseMove(t);
31481
31482                 case MS.MOUSE_UP:
31483                  return this._handleMouseUp(t);
31484
31485                 case MS.MOUSE_WHEEL:
31486                  return this._handleMouseWheel(t);
31487
31488                 default:
31489                  return !1;
31490                }
31491              }
31492              _handleMouseDown(t) {
31493                const e = this._node;
31494                if (!e || !e._uiProps.uiTransformComp) return !1;
31495                t.getLocation(XS);
31496                if (e._uiProps.uiTransformComp.hitTest(XS)) {
31497                  t.type = ny.MOUSE_DOWN;
31498                  t.bubbles = !0;
31499                  e.dispatchEvent(t);
31500                  t.propagationStopped = !0;
31501                  return !0;
31502                }
31503                return !1;
31504              }
31505              _handleMouseMove(t) {
31506                const e = this._node;
31507                if (!e || !e._uiProps.uiTransformComp) return !1;
31508                t.getLocation(XS);
31509                if (e._uiProps.uiTransformComp.hitTest(XS)) {
31510                  if (!this.previousMouseIn) {
31511                    if (jS && jS !== e) {
31512                      t.type = ny.MOUSE_LEAVE;
31513                      jS.dispatchEvent(t);
31514                      jS.eventProcessor.previousMouseIn = !1;
31515                    }
31516                    jS = e;
31517                    t.type = ny.MOUSE_ENTER;
31518                    e.dispatchEvent(t);
31519                    this.previousMouseIn = !0;
31520                  }
31521                  t.type = ny.MOUSE_MOVE;
31522                  t.bubbles = !0;
31523                  e.dispatchEvent(t);
31524                  t.propagationStopped = !0;
31525                  return !0;
31526                }
31527                if (this.previousMouseIn) {
31528                  t.type = ny.MOUSE_LEAVE;
31529                  e.dispatchEvent(t);
31530                  this.previousMouseIn = !1;
31531                  jS = null;
31532                }
31533                return !1;
31534              }
31535              _handleMouseUp(t) {
31536                const e = this._node;
31537                if (!e || !e._uiProps.uiTransformComp) return !1;
31538                t.getLocation(XS);
31539                if (e._uiProps.uiTransformComp.hitTest(XS)) {
31540                  t.type = ny.MOUSE_UP;
31541                  t.bubbles = !0;
31542                  e.dispatchEvent(t);
31543                  t.propagationStopped = !0;
31544                  return !0;
31545                }
31546                return !1;
31547              }
31548              _handleMouseWheel(t) {
31549                const e = this._node;
31550                if (!e || !e._uiProps.uiTransformComp) return !1;
31551                t.getLocation(XS);
31552                if (e._uiProps.uiTransformComp.hitTest(XS)) {
31553                  t.type = ny.MOUSE_WHEEL;
31554                  t.bubbles = !0;
31555                  e.dispatchEvent(t);
31556                  t.propagationStopped = !0;
31557                  return !0;
31558                }
31559                return !1;
31560              }
31561              _handleEventTouch(t) {
31562                switch (t.type) {
31563                 case MS.TOUCH_START:
31564                  return this._handleTouchStart(t);
31565
31566                 case MS.TOUCH_MOVE:
31567                  return this._handleTouchMove(t);
31568
31569                 case MS.TOUCH_END:
31570                  return this._handleTouchEnd(t);
31571
31572                 case MS.TOUCH_CANCEL:
31573                  return this._handleTouchCancel(t);
31574
31575                 default:
31576                  return !1;
31577                }
31578              }
31579              _handleTouchStart(t) {
31580                const e = this.node;
31581                if (!e || !e._uiProps.uiTransformComp) return !1;
31582                t.getLocation(XS);
31583                if (e._uiProps.uiTransformComp.hitTest(XS)) {
31584                  t.type = ny.TOUCH_START;
31585                  t.bubbles = !0;
31586                  this._dispatchingTouch = t.touch;
31587                  e.dispatchEvent(t);
31588                  return !0;
31589                }
31590                return !1;
31591              }
31592              _handleTouchMove(t) {
31593                const e = this.node;
31594                if (!e || !e._uiProps.uiTransformComp) return !1;
31595                t.type = ny.TOUCH_MOVE;
31596                t.bubbles = !0;
31597                this._dispatchingTouch = t.touch;
31598                e.dispatchEvent(t);
31599                return !0;
31600              }
31601              _handleTouchEnd(t) {
31602                const e = this.node;
31603                if (e && e._uiProps.uiTransformComp) {
31604                  t.getLocation(XS);
31605                  e._uiProps.uiTransformComp.hitTest(XS) ? t.type = ny.TOUCH_END : t.type = ny.TOUCH_CANCEL;
31606                  t.bubbles = !0;
31607                  e.dispatchEvent(t);
31608                  this._dispatchingTouch = null;
31609                }
31610              }
31611              _handleTouchCancel(t) {
31612                const e = this.node;
31613                if (e && e._uiProps.uiTransformComp) {
31614                  t.type = ny.TOUCH_CANCEL;
31615                  t.bubbles = !0;
31616                  e.dispatchEvent(t);
31617                }
31618              }
31619            }
31620            KS._maskComp = null;
31621            KS.callbacksInvoker = new Ao;
31622            m.NodeEventProcessor = KS;
31623            function JS(t) {
31624              const e = t._prefab;
31625              if (!e) return;
31626              if (!e.instance) return;
31627              if (!e.asset) {
31628                F(3701, t.name);
31629                e.instance = void 0;
31630                return;
31631              }
31632              const i = t._objFlags;
31633              const s = t._parent;
31634              const n = t._id;
31635              const r = t._prefab;
31636              t[io];
31637              m.game._isCloning = !0;
31638              {
31639                const i = e.asset.data;
31640                i._iN$t = t;
31641                m.instantiate._clone(i, i);
31642              }
31643              m.game._isCloning = !1;
31644              t._objFlags = i;
31645              t._parent = s;
31646              t._id = n;
31647              t._prefab && (t._prefab.instance = null == r ? void 0 : r.instance);
31648            }
31649            function ZS(t, e, i) {
31650              var s;
31651              if (!e) return;
31652              if (!t) return;
31653              let n = e;
31654              const r = null === (s = t._prefab) || void 0 === s ? void 0 : s.instance;
31655              if (!i && r) {
31656                e[r.fileId] = {};
31657                n = e[r.fileId];
31658              }
31659              const o = t._prefab;
31660              o && (n[o.fileId] = t);
31661              const a = t.components;
31662              for (let t = 0; t < a.length; t++) {
31663                const e = a[t];
31664                e.__prefab && (n[e.__prefab.fileId] = e);
31665              }
31666              for (let e = 0; e < t.children.length; e++) {
31667                ZS(t.children[e], n, !1);
31668              }
31669            }
31670            function QS(t, e) {
31671              if (!t) return null;
31672              let i = null;
31673              let s = e;
31674              for (let e = 0; e < t.length; e++) {
31675                if (!s) return null;
31676                s = s[t[e]];
31677              }
31678              i = s;
31679              return i;
31680            }
31681            function $S(t, e, i) {
31682              if (e) for (let t = 0; t < e.length; t++) {
31683                const s = e[t];
31684                if (s && s.targetInfo) {
31685                  const t = QS(s.targetInfo.localID, i);
31686                  if (!t) continue;
31687                  let e = i;
31688                  const n = s.targetInfo.localID;
31689                  if (n.length > 0) for (let t = 0; t < n.length - 1; t++) e = e[n[t]];
31690                  if (s.nodes) for (let i = 0; i < s.nodes.length; i++) {
31691                    const n = s.nodes[i];
31692                    if (n && !t._children.includes(n)) {
31693                      t._children.push(n);
31694                      n._parent = t;
31695                      ZS(n, e, !1);
31696                      n._siblingIndex = t._children.length - 1;
31697                      nA(n, !0);
31698                    }
31699                  }
31700                }
31701              }
31702            }
31703            function tA(t, e, i) {
31704              if (e) for (let t = 0; t < e.length; t++) {
31705                const s = e[t];
31706                if (s && s.targetInfo) {
31707                  const t = QS(s.targetInfo.localID, i);
31708                  if (!t) continue;
31709                  if (s.components) for (let e = 0; e < s.components.length; e++) {
31710                    const i = s.components[e];
31711                    if (i) {
31712                      i.node = t;
31713                      t._components.push(i);
31714                    }
31715                  }
31716                }
31717              }
31718            }
31719            function eA(t, e, i) {
31720              if (e) for (let t = 0; t < e.length; t++) {
31721                const s = e[t];
31722                if (s) {
31723                  const t = QS(s.localID, i);
31724                  if (!t || !t.node) continue;
31725                  const e = t.node.components.indexOf(t);
31726                  e >= 0 && t.node._components.splice(e, 1);
31727                }
31728              }
31729            }
31730            function iA(t, e, i) {
31731              if (e.length <= 0) return;
31732              let s = null;
31733              for (let t = 0; t < e.length; t++) {
31734                const n = e[t];
31735                if (n && n.targetInfo) {
31736                  s = QS(n.targetInfo.localID, i);
31737                  if (!s) continue;
31738                  let t = s;
31739                  const e = n.propertyPath.slice();
31740                  if (e.length > 0) {
31741                    const i = e.pop();
31742                    if (!i) continue;
31743                    for (let i = 0; i < e.length; i++) {
31744                      t = t[e[i]];
31745                      if (!t) break;
31746                    }
31747                    if (!t) continue;
31748                    if (Array.isArray(t)) if ("length" === i) t[i] = n.value; else {
31749                      const e = Number.parseInt(i);
31750                      Number.isInteger(e) && e < t.length && (t[i] = n.value);
31751                    } else t[i] instanceof ce ? t[i].set(n.value) : t[i] = n.value;
31752                  }
31753                }
31754              }
31755            }
31756            function sA(t) {
31757              var e;
31758              const i = null === (e = t._prefab) || void 0 === e ? void 0 : e.targetOverrides;
31759              if (i) for (let t = 0; t < i.length; t++) {
31760                var s, n;
31761                const e = i[t];
31762                let a = e.source;
31763                const l = e.sourceInfo;
31764                if (l) {
31765                  var r, o;
31766                  const t = null === (r = e.source) || void 0 === r || null === (o = r._prefab) || void 0 === o ? void 0 : o.instance;
31767                  t && t.targetMap && (a = QS(l.localID, t.targetMap));
31768                }
31769                if (!a) continue;
31770                let h = null;
31771                const c = e.targetInfo;
31772                if (!c) continue;
31773                const u = null === (s = e.target) || void 0 === s || null === (n = s._prefab) || void 0 === n ? void 0 : n.instance;
31774                if (!u || !u.targetMap) continue;
31775                h = QS(c.localID, u.targetMap);
31776                if (!h) continue;
31777                const _ = e.propertyPath.slice();
31778                let d = a;
31779                if (_.length > 0) {
31780                  const t = _.pop();
31781                  if (!t) return;
31782                  for (let t = 0; t < _.length; t++) {
31783                    d = d[_[t]];
31784                    if (!d) break;
31785                  }
31786                  if (!d) continue;
31787                  d[t] = h;
31788                }
31789              }
31790            }
31791            function nA(t, e = !1) {
31792              const i = t._prefab;
31793              const s = null == i ? void 0 : i.instance;
31794              if (s && !s.expanded) {
31795                JS(t);
31796                e && t && t.children && t.children.forEach((t => {
31797                  nA(t, !0);
31798                }));
31799                const i = {};
31800                s.targetMap = i;
31801                ZS(t, i, !0);
31802                $S(0, s.mountedChildren, i);
31803                eA(0, s.removedComponents, i);
31804                tA(0, s.mountedComponents, i);
31805                iA(0, s.propertyOverrides, i);
31806                s.expanded = !0;
31807              } else e && t && t.children && t.children.forEach((t => {
31808                nA(t, !0);
31809              }));
31810            }
31811            function rA(t) {
31812              const e = t._prefab;
31813              e && e.nestedPrefabInstanceRoots && e.nestedPrefabInstanceRoots.forEach((t => {
31814                nA(t);
31815              }));
31816            }
31817            const oA = t("Scene", jsb.Scene);
31818            m.Scene = oA;
31819            const aA = oA.prototype;
31820            Object.defineProperty(aA, "_globals", {
31821              enumerable: !0,
31822              configurable: !0,
31823              get() {
31824                return this.getSceneGlobals();
31825              },
31826              set(t) {
31827                this._globalRef = t;
31828                this.setSceneGlobals(t);
31829              }
31830            });
31831            Object.defineProperty(aA, "globals", {
31832              enumerable: !0,
31833              configurable: !0,
31834              get() {
31835                return this.getSceneGlobals();
31836              }
31837            });
31838            Object.defineProperty(aA, "_renderScene", {
31839              enumerable: !0,
31840              configurable: !0,
31841              get() {
31842                this._renderSceneInternal || (this._renderSceneInternal = this.getRenderScene());
31843                return this._renderSceneInternal;
31844              }
31845            });
31846            Object.defineProperty(aA, "renderScene", {
31847              enumerable: !0,
31848              configurable: !0,
31849              get() {
31850                this._renderSceneInternal || (this._renderSceneInternal = this.getRenderScene());
31851                return this._renderSceneInternal;
31852              }
31853            });
31854            aA._ctor = function() {
31855              _y.prototype._ctor.apply(this, arguments);
31856              this._inited = !1;
31857              this._renderSceneInternal = null;
31858              this._globalRef = null;
31859              this._prefabSyncedInLiveReload = !1;
31860            };
31861            aA._onBatchCreated = function(t) {
31862              this._parent && (this._siblingIndex = this._parent.children.indexOf(this));
31863              const e = this._children.length;
31864              for (let i = 0; i < e; ++i) {
31865                this.children[i]._siblingIndex = i;
31866                this._children[i]._onBatchCreated(t);
31867              }
31868            };
31869            const lA = aA._load;
31870            aA._load = function() {
31871              this._scene = this;
31872              if (!this._inited) {
31873                rA(this);
31874                sA(this);
31875                this._onBatchCreated(_);
31876                this._inited = !0;
31877              }
31878              dc(this);
31879              lA.call(this);
31880            };
31881            aA._activate = function(t) {
31882              t = !1 !== t;
31883              m.director._nodeActivator.activateNode(this, t);
31884              this._globals.activate();
31885              this._renderScene && this._renderScene.activate();
31886            };
31887            const hA = oA.prototype;
31888            Yl(hA, "autoReleaseAssets");
31889            Yl(hA, "_globals");
31890            Ul("cc.Scene")(oA);
31891            const cA = new WeakMap;
31892            const uA = new WeakSet;
31893            const _A = new WeakSet;
31894            function dA(t, e) {
31895              let i;
31896              i = su.safeFindClass;
31897              const s = qu.pool.get();
31898              let n;
31899              try {
31900                n = o_(t, s, {
31901                  classFinder: i,
31902                  customEnv: e
31903                });
31904              } catch (t) {
31905                x(t);
31906                qu.pool.put(s);
31907                throw t;
31908              }
31909              n._uuid = e.__uuid__ || "";
31910              const r = s.uuidList;
31911              const o = s.uuidObjList;
31912              const a = s.uuidPropList;
31913              const l = s.uuidTypeList || [];
31914              const h = [];
31915              for (let t = 0; t < r.length; t++) {
31916                const e = r[t];
31917                h[t] = {
31918                  uuid: Wh(e),
31919                  owner: o[t],
31920                  prop: a[t],
31921                  type: ee.getClassById(l[t])
31922                };
31923              }
31924              cA.set(n, h);
31925              n._native && uA.add(n);
31926              qu.pool.put(s);
31927              return n;
31928            }
31929            var pA = new class {
31930              constructor() {
31931                this._depends = new Rh;
31932              }
31933              init() {
31934                this._depends.clear();
31935              }
31936              getNativeDep(t) {
31937                const e = this._depends.get(t);
31938                return e && e.nativeDep ? {
31939                  ...e.nativeDep
31940                } : null;
31941              }
31942              getDeps(t) {
31943                return this._depends.has(t) ? this._depends.get(t).deps : [];
31944              }
31945              getDepsRecursively(t) {
31946                const e = Object.create(null);
31947                const i = [];
31948                this._descend(t, e, i);
31949                return i;
31950              }
31951              remove(t) {
31952                this._depends.remove(t);
31953              }
31954              parse(t, e) {
31955                let i = null;
31956                if (Array.isArray(e) || e.__type__ || e instanceof ou) {
31957                  if (this._depends.has(t)) return this._depends.get(t);
31958                  if (Array.isArray(e) && !function(t) {
31959                    const e = t[Gu];
31960                    const i = e[e.length - 1];
31961                    return "number" == typeof i && i < 0;
31962                  }(e)) i = {
31963                    deps: this._parseDepsFromJson(e)
31964                  }; else try {
31965                    const s = dA(e, {
31966                      __uuid__: t
31967                    });
31968                    i = this._parseDepsFromAsset(s);
31969                    i.nativeDep && (i.nativeDep.uuid = t);
31970                    Dh.add(`${t}@import`, s);
31971                  } catch (e) {
31972                    Bh.remove(`${t}@import`);
31973                    i = {
31974                      deps: []
31975                    };
31976                  }
31977                } else {
31978                  if (this._depends.has(t)) {
31979                    i = this._depends.get(t);
31980                    if (i.parsedFromExistAsset) return i;
31981                  }
31982                  i = this._parseDepsFromAsset(e);
31983                }
31984                this._depends.add(t, i);
31985                return i;
31986              }
31987              _parseDepsFromAsset(t) {
31988                const e = {
31989                  deps: [],
31990                  parsedFromExistAsset: !0
31991                };
31992                const i = cA.get(t);
31993                se(i);
31994                for (let t = 0, s = i.length; t < s; t++) e.deps.push(i[t].uuid);
31995                uA.has(t) && (e.nativeDep = t._nativeDep);
31996                return e;
31997              }
31998              _parseDepsFromJson(t) {
31999                const e = h_(t);
32000                e.forEach(((t, i) => e[i] = Wh(t)));
32001                return e;
32002              }
32003              _descend(t, e, i) {
32004                const s = this.getDeps(t);
32005                for (let t = 0; t < s.length; t++) {
32006                  const n = s[t];
32007                  if (!e[n]) {
32008                    e[n] = !0;
32009                    i.push(n);
32010                    this._descend(n, e, i);
32011                  }
32012                }
32013              }
32014            };
32015            const mA = jsb.SimpleTexture;
32016            mA.Filter = Qp;
32017            mA.PixelFormat = Jp;
32018            mA.WrapMode = Zp;
32019            const fA = jsb.SimpleTexture.prototype;
32020            const gA = fA.uploadData;
32021            fA.uploadData = function(t, e = 0, i = 0) {
32022              let s;
32023              t instanceof HTMLCanvasElement ? s = t.data : t instanceof HTMLImageElement ? s = t._data : ArrayBuffer.isView(t) && (s = t.buffer);
32024              gA.call(this, s, e, i);
32025            };
32026            const yA = Ul("cc.SimpleTexture");
32027            fA._ctor = function() {
32028              jsb.TextureBase.prototype._ctor.apply(this, arguments);
32029              this._gfxTexture = null;
32030              this._registerListeners();
32031            };
32032            const bA = fA.getGFXTexture;
32033            fA.getGFXTexture = function() {
32034              this._gfxTexture || (this._gfxTexture = bA.call(this));
32035              return this._gfxTexture;
32036            };
32037            fA._onGFXTextureUpdated = function(t) {
32038              this._gfxTexture = t;
32039            };
32040            fA._onAfterAssignImage = function(t) {
32041              if (pe.CLEANUP_IMAGE_CACHE) {
32042                const e = pA.getDeps(this._uuid);
32043                const i = e.indexOf(t._uuid);
32044                if (-1 !== i) {
32045                  ot(e, i);
32046                  t.decRef();
32047                }
32048              }
32049            };
32050            yA(mA);
32051            m.SimpleTexture = jsb.SimpleTexture;
32052            const SA = jsb.TextureCube.prototype;
32053            var AA;
32054            !function(t) {
32055              t[t.right = 0] = "right";
32056              t[t.left = 1] = "left";
32057              t[t.top = 2] = "top";
32058              t[t.bottom = 3] = "bottom";
32059              t[t.front = 4] = "front";
32060              t[t.back = 5] = "back";
32061            }(AA || (AA = {}));
32062            var TA;
32063            !function(t) {
32064              t[t.NONE = 0] = "NONE";
32065              t[t.AUTO = 1] = "AUTO";
32066              t[t.BAKED_CONVOLUTION_MAP = 2] = "BAKED_CONVOLUTION_MAP";
32067            }(TA || (TA = {}));
32068            SA.createNode = null;
32069            const vA = t("TextureCube", jsb.TextureCube);
32070            vA.Filter = Qp;
32071            vA.PixelFormat = Jp;
32072            vA.WrapMode = Zp;
32073            SA._ctor = function() {
32074              jsb.SimpleTexture.prototype._ctor.apply(this, arguments);
32075              this._mipmaps = null;
32076              this._mipmapAtlas = null;
32077            };
32078            Object.defineProperty(SA, "mipmaps", {
32079              get() {
32080                return this._mipmaps;
32081              },
32082              set(t) {
32083                this._mipmaps = t;
32084                this.setMipmaps(t);
32085              }
32086            });
32087            Object.defineProperty(SA, "image", {
32088              get() {
32089                return 0 === this._mipmaps.length ? null : this._mipmaps[0];
32090              },
32091              set(t) {
32092                this.mipmaps = t ? [ t ] : [];
32093              }
32094            });
32095            const EA = SA.onLoaded;
32096            SA.onLoaded = function() {
32097              this._mipmapMode === TA.BAKED_CONVOLUTION_MAP ? this.setMipmapAtlasForJS(this._mipmapAtlas) : this.setMipmapsForJS(this._mipmaps);
32098              EA.apply(this);
32099            };
32100            SA._serialize = function(t) {
32101              return null;
32102            };
32103            SA._deserialize = function(t, e) {
32104              const i = t;
32105              jsb.TextureBase.prototype._deserialize.call(this, i.base, e);
32106              this.isRGBE = i.rgbe;
32107              null != i.mipmapMode && (this._mipmapMode = i.mipmapMode);
32108              if (this._mipmapMode === TA.BAKED_CONVOLUTION_MAP) {
32109                const t = i.mipmapAtlas;
32110                const s = i.mipmapLayout;
32111                this._mipmapAtlas = {
32112                  atlas: {},
32113                  layout: s
32114                };
32115                this._mipmapAtlas.atlas = {
32116                  front: new jsb.ImageAsset,
32117                  back: new jsb.ImageAsset,
32118                  left: new jsb.ImageAsset,
32119                  right: new jsb.ImageAsset,
32120                  top: new jsb.ImageAsset,
32121                  bottom: new jsb.ImageAsset
32122                };
32123                if (t) {
32124                  const i = ee.getClassId(jsb.ImageAsset);
32125                  e.result.push(this._mipmapAtlas.atlas, "front", t.front, i);
32126                  e.result.push(this._mipmapAtlas.atlas, "back", t.back, i);
32127                  e.result.push(this._mipmapAtlas.atlas, "left", t.left, i);
32128                  e.result.push(this._mipmapAtlas.atlas, "right", t.right, i);
32129                  e.result.push(this._mipmapAtlas.atlas, "top", t.top, i);
32130                  e.result.push(this._mipmapAtlas.atlas, "bottom", t.bottom, i);
32131                }
32132              } else {
32133                this._mipmaps = new Array(i.mipmaps.length);
32134                for (let t = 0; t < i.mipmaps.length; ++t) {
32135                  this._mipmaps[t] = {
32136                    front: new jsb.ImageAsset,
32137                    back: new jsb.ImageAsset,
32138                    left: new jsb.ImageAsset,
32139                    right: new jsb.ImageAsset,
32140                    top: new jsb.ImageAsset,
32141                    bottom: new jsb.ImageAsset
32142                  };
32143                  const s = i.mipmaps[t];
32144                  const n = ee.getClassId(jsb.ImageAsset);
32145                  e.result.push(this._mipmaps[t], "front", s.front, n);
32146                  e.result.push(this._mipmaps[t], "back", s.back, n);
32147                  e.result.push(this._mipmaps[t], "left", s.left, n);
32148                  e.result.push(this._mipmaps[t], "right", s.right, n);
32149                  e.result.push(this._mipmaps[t], "top", s.top, n);
32150                  e.result.push(this._mipmaps[t], "bottom", s.bottom, n);
32151                }
32152              }
32153            };
32154            m.TextureCube = jsb.TextureCube;
32155            const CA = vA.prototype;
32156            Yl(CA, "isRGBE");
32157            Yl(CA, "_mipmaps");
32158            Yl(CA, "_mipmapMode");
32159            Yl(CA, "_mipmapAtlas");
32160            Ul("cc.TextureCube")(vA);
32161            let xA;
32162            !function(t) {
32163              t[t.DEFAULT = 0] = "DEFAULT";
32164              t[t.SKINNING = 1] = "SKINNING";
32165              t[t.BAKED_SKINNING = 2] = "BAKED_SKINNING";
32166              t[t.BATCH_2D = 3] = "BATCH_2D";
32167              t[t.PARTICLE_BATCH = 4] = "PARTICLE_BATCH";
32168              t[t.LINE = 5] = "LINE";
32169            }(xA || (xA = {}));
32170            const wA = jsb.Model;
32171            const RA = wA.prototype;
32172            RA._ctor = function() {
32173              this._device = zo.gfxDevice;
32174            };
32175            const IA = RA.createBoundingShape;
32176            RA.createBoundingShape = function(t, e) {
32177              t && e && IA.call(this, t, e);
32178            };
32179            const MA = jsb.Ambient;
32180            m.Ambient = MA;
32181            let BA;
32182            !function(t) {
32183              t[t.DIRECTIONAL = 0] = "DIRECTIONAL";
32184              t[t.SPHERE = 1] = "SPHERE";
32185              t[t.SPOT = 2] = "SPOT";
32186              t[t.UNKNOWN = 3] = "UNKNOWN";
32187            }(BA || (BA = {}));
32188            const DA = t => 4 * Math.PI * Math.PI * t * t;
32189            const PA = jsb.Light;
32190            m.Light = jsb.Light;
32191            const OA = jsb.DirectionalLight;
32192            m.DirectionalLight = jsb.DirectionalLight;
32193            const NA = jsb.SpotLight;
32194            m.SpotLight = jsb.SpotLight;
32195            const LA = jsb.SphereLight;
32196            m.SphereLight = jsb.SphereLight;
32197            const FA = oe({
32198              LINEAR: 0,
32199              EXP: 1,
32200              EXP_SQUARED: 2,
32201              LAYERED: 3
32202            });
32203            const VA = jsb.FogInfo;
32204            const kA = jsb.Fog;
32205            m.Fog = kA;
32206            const UA = oe({
32207              Low_256x256: 256,
32208              Medium_512x512: 512,
32209              High_1024x1024: 1024,
32210              Ultra_2048x2048: 2048
32211            });
32212            const GA = oe({
32213              Planar: 0,
32214              ShadowMap: 1
32215            });
32216            const zA = oe({
32217              HARD: 0,
32218              SOFT: 1,
32219              SOFT_2X: 2
32220            });
32221            const HA = oe({
32222              LEVEL_1: 1,
32223              LEVEL_2: 2,
32224              LEVEL_3: 3,
32225              LEVEL_4: 4
32226            });
32227            const jA = oe({
32228              NONE: 1,
32229              RemoveDuplicates: 2,
32230              DisableRotaitonFix: 3
32231            });
32232            const XA = oe({
32233              HEMISPHERE_DIFFUSE: 0,
32234              AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION: 1,
32235              DIFFUSEMAP_WITH_REFLECTION: 2
32236            });
32237            const WA = jsb.ShadowsInfo;
32238            const YA = jsb.Shadow;
32239            m.Shadows = YA;
32240            const qA = jsb.Skybox;
32241            m.Skybox = qA;
32242            var KA = Object.freeze({
32243              __proto__: null,
32244              get ModelType() {
32245                return xA;
32246              },
32247              Model: wA,
32248              SubModel: Ig,
32249              get CameraFOVAxis() {
32250                return vy;
32251              },
32252              get CameraProjection() {
32253                return Ey;
32254              },
32255              get CameraAperture() {
32256                return Cy;
32257              },
32258              get CameraISO() {
32259                return xy;
32260              },
32261              get CameraShutter() {
32262                return wy;
32263              },
32264              get CameraType() {
32265                return Ry;
32266              },
32267              get TrackingType() {
32268                return Iy;
32269              },
32270              SKYBOX_FLAG: My,
32271              Camera: By,
32272              Ambient: MA,
32273              ColorTemperatureToRGB: function(t, e) {
32274                e < 1e3 ? e = 1e3 : e > 15e3 && (e = 15e3);
32275                const i = e * e;
32276                const s = (.860117757 + .000154118254 * e + 1.28641212e-7 * i) / (1 + .000842420235 * e + 7.08145163e-7 * i);
32277                const n = (.317398726 + 422806245e-13 * e + 4.20481691e-8 * i) / (1 - 289741816e-13 * e + 1.61456053e-7 * i);
32278                const r = 2 * s - 8 * n + 4;
32279                const o = 3 * s / r;
32280                const a = 2 * n / r;
32281                const l = 1 / a * o;
32282                const h = 1 / a * (1 - o - a);
32283                t.x = 3.2404542 * l - 1.5371385 + -.4985314 * h;
32284                t.y = -.969266 * l + 1.8760108 + .041556 * h;
32285                t.z = .0556434 * l - .2040259 + 1.0572252 * h;
32286              },
32287              get LightType() {
32288                return BA;
32289              },
32290              nt2lm: DA,
32291              Light: PA,
32292              DirectionalLight: OA,
32293              SpotLight: NA,
32294              SphereLight: LA,
32295              FogType: FA,
32296              FogInfo: VA,
32297              Fog: kA,
32298              ShadowSize: UA,
32299              ShadowType: GA,
32300              PCFType: zA,
32301              CSMLevel: HA,
32302              CSMOptimizationMode: jA,
32303              EnvironmentLightingType: XA,
32304              ShadowsInfo: WA,
32305              Shadows: YA,
32306              Skybox: qA
32307            });
32308            const JA = t("FogType", oe({
32309              LINEAR: 0,
32310              EXP: 1,
32311              EXP_SQUARED: 2,
32312              LAYERED: 3
32313            }));
32314            const ZA = t("ShadowSize", oe({
32315              Low_256x256: 256,
32316              Medium_512x512: 512,
32317              High_1024x1024: 1024,
32318              Ultra_2048x2048: 2048
32319            }));
32320            const QA = t("ShadowType", oe({
32321              Planar: 0,
32322              ShadowMap: 1
32323            }));
32324            const $A = t("AmbientInfo", jsb.AmbientInfo);
32325            m.AmbientInfo = $A;
32326            const tT = t("SkyboxInfo", jsb.SkyboxInfo);
32327            m.SkyboxInfo = tT;
32328            const eT = t("FogInfo", jsb.FogInfo);
32329            m.FogInfo = eT;
32330            eT.FogType = JA;
32331            const iT = t("ShadowsInfo", jsb.ShadowsInfo);
32332            m.ShadowsInfo = iT;
32333            const sT = t("OctreeInfo", jsb.OctreeInfo);
32334            m.OctreeInfo = sT;
32335            const nT = t("SceneGlobals", jsb.SceneGlobals);
32336            m.SceneGlobals = nT;
32337            !function() {
32338              const t = nT.prototype;
32339              t._ctor = function() {
32340                this._ambientRef = null;
32341                this._shadowsRef = null;
32342                this._skyboxRef = null;
32343                this._fogRef = null;
32344                this._octreeRef = null;
32345              };
32346              Object.defineProperty(t, "ambient", {
32347                enumerable: !0,
32348                configurable: !0,
32349                get() {
32350                  return this._ambientRef;
32351                },
32352                set(t) {
32353                  this._ambientRef = t;
32354                  this.setAmbientInfo(t);
32355                }
32356              });
32357              Object.defineProperty(t, "shadows", {
32358                enumerable: !0,
32359                configurable: !0,
32360                get() {
32361                  return this._shadowsRef;
32362                },
32363                set(t) {
32364                  this._shadowsRef = t;
32365                  this.setShadowsInfo(t);
32366                }
32367              });
32368              Object.defineProperty(t, "_skybox", {
32369                enumerable: !0,
32370                configurable: !0,
32371                get() {
32372                  return this._skyboxRef;
32373                },
32374                set(t) {
32375                  this._skyboxRef = t;
32376                  this.setSkyboxInfo(t);
32377                }
32378              });
32379              Object.defineProperty(t, "skybox", {
32380                enumerable: !0,
32381                configurable: !0,
32382                get() {
32383                  return this._skyboxRef;
32384                },
32385                set(t) {
32386                  this._skyboxRef = t;
32387                  this.setSkyboxInfo(t);
32388                }
32389              });
32390              Object.defineProperty(t, "fog", {
32391                enumerable: !0,
32392                configurable: !0,
32393                get() {
32394                  return this._fogRef;
32395                },
32396                set(t) {
32397                  this._fogRef = t;
32398                  this.setFogInfo(t);
32399                }
32400              });
32401              Object.defineProperty(t, "octree", {
32402                enumerable: !0,
32403                configurable: !0,
32404                get() {
32405                  return this._octreeRef;
32406                },
32407                set(t) {
32408                  this._octreeRef = t;
32409                  this.setOctreeInfo(t);
32410                }
32411              });
32412            }();
32413            const rT = nT.prototype;
32414            Yl(rT, "ambient");
32415            Yl(rT, "shadows");
32416            Yl(rT, "_skybox");
32417            Yl(rT, "fog");
32418            const oT = Object.getOwnPropertyDescriptor(rT, "skybox");
32419            Th(tT)(rT, "skybox", oT);
32420            Yl(rT, "octree");
32421            Ul("cc.SceneGlobals")(nT);
32422            const aT = sT.prototype;
32423            Yl(aT, "_enabled");
32424            Yl(aT, "_minPos");
32425            Yl(aT, "_maxPos");
32426            Yl(aT, "_depth");
32427            const lT = Object.getOwnPropertyDescriptor(aT, "depth");
32428            Th(Oe)(aT, "depth", lT);
32429            Ul("cc.OctreeInfo")(sT);
32430            const hT = iT.prototype;
32431            Yl(hT, "_enabled");
32432            Yl(hT, "_type");
32433            Yl(hT, "_normal");
32434            Yl(hT, "_distance");
32435            Yl(hT, "_shadowColor");
32436            Yl(hT, "_maxReceived");
32437            Yl(hT, "_size");
32438            const cT = Object.getOwnPropertyDescriptor(hT, "type");
32439            Th(QA)(hT, "type", cT);
32440            const uT = Object.getOwnPropertyDescriptor(hT, "planeHeight");
32441            Th(Ne)(hT, "planeHeight", uT);
32442            const _T = Object.getOwnPropertyDescriptor(hT, "maxReceived");
32443            Th(Oe)(hT, "maxReceived", _T);
32444            const dT = Object.getOwnPropertyDescriptor(hT, "shadowMapSize");
32445            Th(ZA)(hT, "shadowMapSize", dT);
32446            Ul("cc.ShadowsInfo")(iT);
32447            const pT = eT.prototype;
32448            Yl(pT, "_type");
32449            Yl(pT, "_fogColor");
32450            Yl(pT, "_enabled");
32451            Yl(pT, "_fogDensity");
32452            Yl(pT, "_fogStart");
32453            Yl(pT, "_fogEnd");
32454            Yl(pT, "_fogAtten");
32455            Yl(pT, "_fogTop");
32456            Yl(pT, "_fogRange");
32457            Yl(pT, "_accurate");
32458            const mT = Object.getOwnPropertyDescriptor(pT, "type");
32459            Th(JA)(pT, "type", mT);
32460            const fT = Object.getOwnPropertyDescriptor(pT, "fogDensity");
32461            Th(Ne)(pT, "fogDensity", fT);
32462            const gT = Object.getOwnPropertyDescriptor(pT, "fogStart");
32463            Th(Ne)(pT, "fogStart", gT);
32464            const yT = Object.getOwnPropertyDescriptor(pT, "fogEnd");
32465            Th(Ne)(pT, "fogEnd", yT);
32466            const bT = Object.getOwnPropertyDescriptor(pT, "fogAtten");
32467            Th(Ne)(pT, "fogAtten", bT);
32468            const ST = Object.getOwnPropertyDescriptor(pT, "fogTop");
32469            Th(Ne)(pT, "fogTop", ST);
32470            const AT = Object.getOwnPropertyDescriptor(pT, "fogRange");
32471            Th(Ne)(pT, "fogRange", AT);
32472            Ul("cc.FogInfo")(eT);
32473            const TT = tT.prototype;
32474            Yl(TT, "_envLightingType");
32475            ql("_envmap")(TT, "_envmapHDR");
32476            Th(vA)(TT, "_envmapHDR");
32477            Yl(TT, "_envmapHDR");
32478            Th(vA)(TT, "_envmapLDR");
32479            Yl(TT, "_envmapLDR");
32480            Th(vA)(TT, "_diffuseMapHDR");
32481            Yl(TT, "_diffuseMapHDR");
32482            Th(vA)(TT, "_diffuseMapLDR");
32483            Yl(TT, "_diffuseMapLDR");
32484            Yl(TT, "_enabled");
32485            Yl(TT, "_useHDR");
32486            Th(hm)(TT, "_editableMaterial");
32487            Yl(TT, "_editableMaterial");
32488            Th(vA)(TT, "_reflectionHDR");
32489            Yl(TT, "_reflectionHDR");
32490            Th(vA)(TT, "_reflectionLDR");
32491            Yl(TT, "_reflectionLDR");
32492            const vT = Object.getOwnPropertyDescriptor(TT, "envLightingType");
32493            Th(XA)(TT, "envLightingType", vT);
32494            const ET = Object.getOwnPropertyDescriptor(TT, "envmap");
32495            Th(vA)(TT, "envmap", ET);
32496            const CT = Object.getOwnPropertyDescriptor(TT, "diffuseMap");
32497            Th(vA)(TT, "diffuseMap", CT);
32498            const xT = Object.getOwnPropertyDescriptor(TT, "skyboxMaterial");
32499            Th(hm)(TT, "skyboxMaterial", xT);
32500            Ul("cc.SkyboxInfo")(tT);
32501            const wT = $A.prototype;
32502            ql("_skyColor")(wT, "_skyColorHDR");
32503            Yl(wT, "_skyColorHDR");
32504            ql("_skyIllum")(wT, "_skyIllumHDR");
32505            Yl(wT, "_skyIllumHDR");
32506            ql("_groundAlbedo")(wT, "_groundAlbedoHDR");
32507            Yl(wT, "_groundAlbedoHDR");
32508            Yl(wT, "_skyColorLDR");
32509            Yl(wT, "_skyIllumLDR");
32510            Yl(wT, "_groundAlbedoLDR");
32511            const RT = Object.getOwnPropertyDescriptor(wT, "skyIllum");
32512            Th(Ne)(wT, "skyIllum", RT);
32513            Ul("cc.AmbientInfo")($A);
32514            et({
32515              SystemEventType: {
32516                newName: "Input.EventType",
32517                since: "3.3.0",
32518                removed: !1
32519              }
32520            });
32521            et({
32522              SystemEvent: {
32523                newName: "Input",
32524                since: "3.4.0",
32525                removed: !1
32526              },
32527              systemEvent: {
32528                newName: "input",
32529                since: "3.4.0",
32530                removed: !1
32531              }
32532            });
32533            class IT {
32534              constructor() {
32535                this._intervalInSeconds = .2;
32536                this._intervalId = void 0;
32537                this._isEnabled = !1;
32538                this._eventTarget = new vo;
32539                this._didAccelerateFunc = void 0;
32540                this._didAccelerateFunc = this._didAccelerate.bind(this);
32541              }
32542              _didAccelerate() {
32543                const t = jsb.device.getDeviceMotionValue();
32544                let e = .1 * t[3];
32545                let i = .1 * t[4];
32546                const s = .1 * t[5];
32547                const n = Lo.orientation;
32548                const r = e;
32549                if (n === Oo.LANDSCAPE_RIGHT) {
32550                  e = -i;
32551                  i = r;
32552                } else if (n === Oo.LANDSCAPE_LEFT) {
32553                  e = i;
32554                  i = -r;
32555                } else if (n === Oo.PORTRAIT_UPSIDE_DOWN) {
32556                  e = -e;
32557                  i = -i;
32558                }
32559                if (Po.os === Ro.ABC || Po.os === Ro.OHOS) {
32560                  e = -e;
32561                  i = -i;
32562                }
32563                const o = performance.now();
32564                const a = new kS(e, i, s, o);
32565                const l = new BS(a);
32566                this._eventTarget.emit(MS.DEVICEMOTION, l);
32567              }
32568              start() {
32569                this._intervalId && clearInterval(this._intervalId);
32570                this._intervalId = setInterval(this._didAccelerateFunc, 1e3 * this._intervalInSeconds);
32571                jsb.device.setAccelerometerInterval(this._intervalInSeconds);
32572                jsb.device.setAccelerometerEnabled(!0);
32573                this._isEnabled = !0;
32574              }
32575              stop() {
32576                if (this._intervalId) {
32577                  clearInterval(this._intervalId);
32578                  this._intervalId = void 0;
32579                }
32580                jsb.device.setAccelerometerEnabled(!1);
32581                this._isEnabled = !1;
32582              }
32583              setInterval(t) {
32584                this._intervalInSeconds = t / 1e3;
32585                jsb.device.setAccelerometerInterval(this._intervalInSeconds);
32586                if (this._isEnabled) {
32587                  jsb.device.setAccelerometerEnabled(!1);
32588                  jsb.device.setAccelerometerEnabled(!0);
32589                }
32590              }
32591              on(t, e, i) {
32592                this._eventTarget.on(t, e, i);
32593              }
32594            }
32595            class MT {}
32596            class BT extends MT {
32597              getValue() {
32598                throw new Error("Method not implemented.");
32599              }
32600            }
32601            class DT extends MT {
32602              getValue() {
32603                throw new Error("Method not implemented.");
32604              }
32605            }
32606            class PT extends MT {
32607              getValue() {
32608                throw new Error("Method not implemented.");
32609              }
32610            }
32611            class OT extends MT {
32612              getValue() {
32613                throw new Error("Method not implemented.");
32614              }
32615            }
32616            class NT extends BT {
32617              constructor(t) {
32618                super();
32619                this.positive = void 0;
32620                this.negative = void 0;
32621                this.positive = t.positive;
32622                this.negative = t.negative;
32623              }
32624              getValue() {
32625                const t = this.positive.getValue();
32626                const e = this.negative.getValue();
32627                return Math.abs(t) > Math.abs(e) ? t : -e;
32628              }
32629            }
32630            class LT extends DT {
32631              constructor(t) {
32632                super();
32633                this.up = void 0;
32634                this.down = void 0;
32635                this.left = void 0;
32636                this.right = void 0;
32637                this.xAxis = void 0;
32638                this.yAxis = void 0;
32639                this.up = t.up;
32640                this.down = t.down;
32641                this.left = t.left;
32642                this.right = t.right;
32643                this.xAxis = new NT({
32644                  positive: this.right,
32645                  negative: this.left
32646                });
32647                this.yAxis = new NT({
32648                  positive: this.up,
32649                  negative: this.down
32650                });
32651              }
32652              getValue() {
32653                return new Qi(this.xAxis.getValue(), this.yAxis.getValue());
32654              }
32655            }
32656            class FT extends BT {
32657              getValue() {
32658                return super.getValue();
32659              }
32660            }
32661            class VT extends LT {}
32662            class kT extends LT {}
32663            class UT extends OT {
32664              getValue() {
32665                return super.getValue();
32666              }
32667            }
32668            class GT extends PT {
32669              getValue() {
32670                return super.getValue();
32671              }
32672            }
32673            var zT;
32674            !function(t) {
32675              t[t.BUTTON_SOUTH = 0] = "BUTTON_SOUTH";
32676              t[t.BUTTON_EAST = 1] = "BUTTON_EAST";
32677              t[t.BUTTON_WEST = 2] = "BUTTON_WEST";
32678              t[t.BUTTON_NORTH = 3] = "BUTTON_NORTH";
32679              t[t.NS_MINUS = 4] = "NS_MINUS";
32680              t[t.NS_PLUS = 5] = "NS_PLUS";
32681              t[t.BUTTON_L1 = 6] = "BUTTON_L1";
32682              t[t.BUTTON_L2 = 7] = "BUTTON_L2";
32683              t[t.BUTTON_L3 = 8] = "BUTTON_L3";
32684              t[t.BUTTON_R1 = 9] = "BUTTON_R1";
32685              t[t.BUTTON_R2 = 10] = "BUTTON_R2";
32686              t[t.BUTTON_R3 = 11] = "BUTTON_R3";
32687              t[t.DPAD_UP = 12] = "DPAD_UP";
32688              t[t.DPAD_DOWN = 13] = "DPAD_DOWN";
32689              t[t.DPAD_LEFT = 14] = "DPAD_LEFT";
32690              t[t.DPAD_RIGHT = 15] = "DPAD_RIGHT";
32691              t[t.LEFT_STICK_UP = 16] = "LEFT_STICK_UP";
32692              t[t.LEFT_STICK_DOWN = 17] = "LEFT_STICK_DOWN";
32693              t[t.LEFT_STICK_LEFT = 18] = "LEFT_STICK_LEFT";
32694              t[t.LEFT_STICK_RIGHT = 19] = "LEFT_STICK_RIGHT";
32695              t[t.RIGHT_STICK_UP = 20] = "RIGHT_STICK_UP";
32696              t[t.RIGHT_STICK_DOWN = 21] = "RIGHT_STICK_DOWN";
32697              t[t.RIGHT_STICK_LEFT = 22] = "RIGHT_STICK_LEFT";
32698              t[t.RIGHT_STICK_RIGHT = 23] = "RIGHT_STICK_RIGHT";
32699              t[t.ROKID_MENU = 24] = "ROKID_MENU";
32700              t[t.ROKID_START = 25] = "ROKID_START";
32701            }(zT || (zT = {}));
32702            const HT = {
32703              1: zT.BUTTON_EAST,
32704              2: zT.BUTTON_SOUTH,
32705              3: zT.BUTTON_NORTH,
32706              4: zT.BUTTON_WEST,
32707              5: zT.BUTTON_L1,
32708              6: zT.BUTTON_R1,
32709              7: zT.NS_MINUS,
32710              8: zT.NS_PLUS,
32711              9: zT.BUTTON_L3,
32712              10: zT.BUTTON_R3,
32713              11: zT.ROKID_MENU,
32714              12: zT.ROKID_START
32715            };
32716            class jT {
32717              get buttonNorth() {
32718                return this._buttonNorth;
32719              }
32720              get buttonEast() {
32721                return this._buttonEast;
32722              }
32723              get buttonWest() {
32724                return this._buttonWest;
32725              }
32726              get buttonSouth() {
32727                return this._buttonSouth;
32728              }
32729              get buttonL1() {
32730                return this._buttonL1;
32731              }
32732              get buttonL2() {
32733                return this._buttonL2;
32734              }
32735              get buttonL3() {
32736                return this._buttonL3;
32737              }
32738              get buttonR1() {
32739                return this._buttonR1;
32740              }
32741              get buttonR2() {
32742                return this._buttonR2;
32743              }
32744              get buttonR3() {
32745                return this._buttonR3;
32746              }
32747              get buttonShare() {
32748                return this._buttonShare;
32749              }
32750              get buttonOptions() {
32751                return this._buttonOptions;
32752              }
32753              get dpad() {
32754                return this._dpad;
32755              }
32756              get leftStick() {
32757                return this._leftStick;
32758              }
32759              get rightStick() {
32760                return this._rightStick;
32761              }
32762              get buttonStart() {
32763                return this._buttonStart;
32764              }
32765              get deviceId() {
32766                return this._deviceId;
32767              }
32768              get connected() {
32769                return this._connected;
32770              }
32771              constructor(t) {
32772                this._deviceId = -1;
32773                this._connected = !1;
32774                this._nativeButtonState = {
32775                  [zT.BUTTON_SOUTH]: 0,
32776                  [zT.BUTTON_EAST]: 0,
32777                  [zT.BUTTON_WEST]: 0,
32778                  [zT.BUTTON_NORTH]: 0,
32779                  [zT.NS_MINUS]: 0,
32780                  [zT.NS_PLUS]: 0,
32781                  [zT.BUTTON_L1]: 0,
32782                  [zT.BUTTON_L2]: 0,
32783                  [zT.BUTTON_L3]: 0,
32784                  [zT.BUTTON_R1]: 0,
32785                  [zT.BUTTON_R2]: 0,
32786                  [zT.BUTTON_R3]: 0,
32787                  [zT.DPAD_UP]: 0,
32788                  [zT.DPAD_DOWN]: 0,
32789                  [zT.DPAD_LEFT]: 0,
32790                  [zT.DPAD_RIGHT]: 0,
32791                  [zT.LEFT_STICK_UP]: 0,
32792                  [zT.LEFT_STICK_DOWN]: 0,
32793                  [zT.LEFT_STICK_LEFT]: 0,
32794                  [zT.LEFT_STICK_RIGHT]: 0,
32795                  [zT.RIGHT_STICK_UP]: 0,
32796                  [zT.RIGHT_STICK_DOWN]: 0,
32797                  [zT.RIGHT_STICK_LEFT]: 0,
32798                  [zT.RIGHT_STICK_RIGHT]: 0,
32799                  [zT.ROKID_MENU]: 0,
32800                  [zT.ROKID_START]: 0
32801                };
32802                this._deviceId = t;
32803                this._initInputSource();
32804              }
32805              static _init() {
32806                Po.hasFeature(Mo.EVENT_GAMEPAD) && jT._registerEvent();
32807              }
32808              static _on(t, e, i) {
32809                jT._eventTarget.on(t, e, i);
32810              }
32811              static _removeInputDevice(t) {
32812                const e = jT.all.findIndex((e => e.deviceId === t));
32813                -1 !== e && ot(jT.all, e);
32814              }
32815              static _getInputDevice(t) {
32816                return jT.all.find((e => e.deviceId === t));
32817              }
32818              static _createInputDevice(t, e) {
32819                const i = new jT(t);
32820                i._connected = e;
32821                jT.all.push(i);
32822                return i;
32823              }
32824              static _getOrCreateInputDevice(t, e) {
32825                let i = jT._getInputDevice(t);
32826                i || (i = jT._createInputDevice(t, e));
32827                i._connected = e;
32828                return i;
32829              }
32830              static _registerEvent() {
32831                jsb.onControllerInput = t => {
32832                  for (let e = 0; e < t.length; ++e) {
32833                    const i = t[e];
32834                    const s = jT._getOrCreateInputDevice(i.id, !0);
32835                    s._updateNativeButtonState(i);
32836                    jT._eventTarget.emit(MS.GAMEPAD_INPUT, new LS(MS.GAMEPAD_INPUT, s));
32837                  }
32838                };
32839                jsb.onControllerChange = t => {
32840                  for (let e = 0; e < t.length; ++e) {
32841                    const i = t[e];
32842                    let s = jT._getInputDevice(i);
32843                    if (!s) {
32844                      s = jT._createInputDevice(i, !0);
32845                      jT._eventTarget.emit(MS.GAMEPAD_CHANGE, new LS(MS.GAMEPAD_CHANGE, s));
32846                    }
32847                  }
32848                  const e = jT.all;
32849                  for (let i = 0; i < e.length; ++i) {
32850                    const s = e[i];
32851                    if (!t.includes(s.deviceId)) {
32852                      jT._removeInputDevice(s.deviceId);
32853                      s._connected = !1;
32854                      jT._eventTarget.emit(MS.GAMEPAD_CHANGE, new LS(MS.GAMEPAD_CHANGE, s));
32855                    }
32856                  }
32857                };
32858              }
32859              _axisToButtons(t) {
32860                const e = Math.abs(t);
32861                return t > 0 ? {
32862                  negative: 0,
32863                  positive: e
32864                } : t < 0 ? {
32865                  negative: e,
32866                  positive: 0
32867                } : {
32868                  negative: 0,
32869                  positive: 0
32870                };
32871              }
32872              _updateNativeButtonState(t) {
32873                const {buttonInfoList: e, axisInfoList: i} = t;
32874                for (let t = 0; t < e.length; ++t) {
32875                  const i = e[t];
32876                  const s = HT[i.code];
32877                  this._nativeButtonState[s] = i.isPressed ? 1 : 0;
32878                }
32879                for (let t = 0; t < i.length; ++t) {
32880                  const e = i[t];
32881                  const {code: s, value: n} = e;
32882                  let r;
32883                  let o;
32884                  let a;
32885                  switch (s) {
32886                   case 1:
32887                    r = zT.DPAD_LEFT;
32888                    o = zT.DPAD_RIGHT;
32889                    a = this._axisToButtons(n);
32890                    break;
32891
32892                   case 2:
32893                    r = zT.DPAD_DOWN;
32894                    o = zT.DPAD_UP;
32895                    a = this._axisToButtons(n);
32896                    break;
32897
32898                   case 3:
32899                    r = zT.LEFT_STICK_LEFT;
32900                    o = zT.LEFT_STICK_RIGHT;
32901                    a = this._axisToButtons(n);
32902                    break;
32903
32904                   case 4:
32905                    r = zT.LEFT_STICK_DOWN;
32906                    o = zT.LEFT_STICK_UP;
32907                    a = this._axisToButtons(n);
32908                    break;
32909
32910                   case 5:
32911                    r = zT.RIGHT_STICK_LEFT;
32912                    o = zT.RIGHT_STICK_RIGHT;
32913                    a = this._axisToButtons(n);
32914                    break;
32915
32916                   case 6:
32917                    r = zT.RIGHT_STICK_DOWN;
32918                    o = zT.RIGHT_STICK_UP;
32919                    a = this._axisToButtons(n);
32920                    break;
32921
32922                   default:
32923                    7 === s ? this._nativeButtonState[zT.BUTTON_L2] = n : 8 === s && (this._nativeButtonState[zT.BUTTON_R2] = n);
32924                  }
32925                  if (r && o && a) {
32926                    this._nativeButtonState[r] = a.negative;
32927                    this._nativeButtonState[o] = a.positive;
32928                  }
32929                }
32930              }
32931              _initInputSource() {
32932                this._buttonNorth = new FT;
32933                this._buttonNorth.getValue = () => this._nativeButtonState[zT.BUTTON_NORTH];
32934                this._buttonEast = new FT;
32935                this._buttonEast.getValue = () => this._nativeButtonState[zT.BUTTON_EAST];
32936                this._buttonWest = new FT;
32937                this._buttonWest.getValue = () => this._nativeButtonState[zT.BUTTON_WEST];
32938                this._buttonSouth = new FT;
32939                this._buttonSouth.getValue = () => this._nativeButtonState[zT.BUTTON_SOUTH];
32940                this._buttonL1 = new FT;
32941                this._buttonL1.getValue = () => this._nativeButtonState[zT.BUTTON_L1];
32942                this._buttonL2 = new FT;
32943                this._buttonL2.getValue = () => this._nativeButtonState[zT.BUTTON_L2];
32944                this._buttonL3 = new FT;
32945                this._buttonL3.getValue = () => this._nativeButtonState[zT.BUTTON_L3];
32946                this._buttonR1 = new FT;
32947                this._buttonR1.getValue = () => this._nativeButtonState[zT.BUTTON_R1];
32948                this._buttonR2 = new FT;
32949                this._buttonR2.getValue = () => this._nativeButtonState[zT.BUTTON_R2];
32950                this._buttonR3 = new FT;
32951                this._buttonR3.getValue = () => this._nativeButtonState[zT.BUTTON_R3];
32952                this._buttonShare = new FT;
32953                this._buttonShare.getValue = () => this._nativeButtonState[zT.NS_MINUS];
32954                this._buttonOptions = new FT;
32955                this._buttonOptions.getValue = () => this._nativeButtonState[zT.NS_PLUS] || this._nativeButtonState[zT.ROKID_MENU];
32956                const t = new FT;
32957                t.getValue = () => this._nativeButtonState[zT.DPAD_UP];
32958                const e = new FT;
32959                e.getValue = () => this._nativeButtonState[zT.DPAD_DOWN];
32960                const i = new FT;
32961                i.getValue = () => this._nativeButtonState[zT.DPAD_LEFT];
32962                const s = new FT;
32963                s.getValue = () => this._nativeButtonState[zT.DPAD_RIGHT];
32964                this._dpad = new VT({
32965                  up: t,
32966                  down: e,
32967                  left: i,
32968                  right: s
32969                });
32970                const n = new FT;
32971                n.getValue = () => this._nativeButtonState[zT.LEFT_STICK_UP];
32972                const r = new FT;
32973                r.getValue = () => this._nativeButtonState[zT.LEFT_STICK_DOWN];
32974                const o = new FT;
32975                o.getValue = () => this._nativeButtonState[zT.LEFT_STICK_LEFT];
32976                const a = new FT;
32977                a.getValue = () => this._nativeButtonState[zT.LEFT_STICK_RIGHT];
32978                this._leftStick = new kT({
32979                  up: n,
32980                  down: r,
32981                  left: o,
32982                  right: a
32983                });
32984                const l = new FT;
32985                l.getValue = () => this._nativeButtonState[zT.RIGHT_STICK_UP];
32986                const h = new FT;
32987                h.getValue = () => this._nativeButtonState[zT.RIGHT_STICK_DOWN];
32988                const c = new FT;
32989                c.getValue = () => this._nativeButtonState[zT.RIGHT_STICK_LEFT];
32990                const u = new FT;
32991                u.getValue = () => this._nativeButtonState[zT.RIGHT_STICK_RIGHT];
32992                this._rightStick = new kT({
32993                  up: l,
32994                  down: h,
32995                  left: c,
32996                  right: u
32997                });
32998                this._buttonStart = new FT;
32999                this._buttonStart.getValue = () => this._nativeButtonState[zT.ROKID_START];
33000              }
33001            }
33002            jT.all = [];
33003            jT._eventTarget = new vo;
33004            var XT;
33005            !function(t) {
33006              t[t.BUTTON_EAST = 0] = "BUTTON_EAST";
33007              t[t.BUTTON_SOUTH = 1] = "BUTTON_SOUTH";
33008              t[t.BUTTON_WEST = 2] = "BUTTON_WEST";
33009              t[t.BUTTON_NORTH = 3] = "BUTTON_NORTH";
33010              t[t.BUTTON_TRIGGER_LEFT = 4] = "BUTTON_TRIGGER_LEFT";
33011              t[t.BUTTON_TRIGGER_RIGHT = 5] = "BUTTON_TRIGGER_RIGHT";
33012              t[t.TRIGGER_LEFT = 6] = "TRIGGER_LEFT";
33013              t[t.TRIGGER_RIGHT = 7] = "TRIGGER_RIGHT";
33014              t[t.GRIP_LEFT = 8] = "GRIP_LEFT";
33015              t[t.GRIP_RIGHT = 9] = "GRIP_RIGHT";
33016              t[t.BUTTON_LEFT_STICK = 10] = "BUTTON_LEFT_STICK";
33017              t[t.LEFT_STICK_UP = 11] = "LEFT_STICK_UP";
33018              t[t.LEFT_STICK_DOWN = 12] = "LEFT_STICK_DOWN";
33019              t[t.LEFT_STICK_LEFT = 13] = "LEFT_STICK_LEFT";
33020              t[t.LEFT_STICK_RIGHT = 14] = "LEFT_STICK_RIGHT";
33021              t[t.BUTTON_RIGHT_STICK = 15] = "BUTTON_RIGHT_STICK";
33022              t[t.RIGHT_STICK_UP = 16] = "RIGHT_STICK_UP";
33023              t[t.RIGHT_STICK_DOWN = 17] = "RIGHT_STICK_DOWN";
33024              t[t.RIGHT_STICK_LEFT = 18] = "RIGHT_STICK_LEFT";
33025              t[t.RIGHT_STICK_RIGHT = 19] = "RIGHT_STICK_RIGHT";
33026            }(XT || (XT = {}));
33027            var WT;
33028            !function(t) {
33029              t[t.HAND_LEFT = 0] = "HAND_LEFT";
33030              t[t.HAND_RIGHT = 1] = "HAND_RIGHT";
33031              t[t.AIM_LEFT = 2] = "AIM_LEFT";
33032              t[t.AIM_RIGHT = 3] = "AIM_RIGHT";
33033            }(WT || (WT = {}));
33034            const YT = {
33035              1: XT.BUTTON_EAST,
33036              2: XT.BUTTON_SOUTH,
33037              3: XT.BUTTON_NORTH,
33038              4: XT.BUTTON_WEST,
33039              9: XT.BUTTON_LEFT_STICK,
33040              10: XT.BUTTON_RIGHT_STICK,
33041              13: XT.BUTTON_TRIGGER_LEFT,
33042              14: XT.BUTTON_TRIGGER_RIGHT
33043            };
33044            class qT {
33045              get buttonNorth() {
33046                return this._buttonNorth;
33047              }
33048              get buttonEast() {
33049                return this._buttonEast;
33050              }
33051              get buttonWest() {
33052                return this._buttonWest;
33053              }
33054              get buttonSouth() {
33055                return this._buttonSouth;
33056              }
33057              get buttonTriggerLeft() {
33058                return this._buttonTriggerLeft;
33059              }
33060              get buttonTriggerRight() {
33061                return this._buttonTriggerRight;
33062              }
33063              get triggerLeft() {
33064                return this._triggerLeft;
33065              }
33066              get triggerRight() {
33067                return this._triggerRight;
33068              }
33069              get gripLeft() {
33070                return this._gripLeft;
33071              }
33072              get gripRight() {
33073                return this._gripRight;
33074              }
33075              get leftStick() {
33076                return this._leftStick;
33077              }
33078              get rightStick() {
33079                return this._rightStick;
33080              }
33081              get buttonLeftStick() {
33082                return this._buttonLeftStick;
33083              }
33084              get buttonRightStick() {
33085                return this._buttonRightStick;
33086              }
33087              get handLeftPosition() {
33088                return this._handLeftPosition;
33089              }
33090              get handLeftOrientation() {
33091                return this._handLeftOrientation;
33092              }
33093              get handRightPosition() {
33094                return this._handRightPosition;
33095              }
33096              get handRightOrientation() {
33097                return this._handRightOrientation;
33098              }
33099              get aimLeftPosition() {
33100                return this._aimLeftPosition;
33101              }
33102              get aimLeftOrientation() {
33103                return this._aimLeftOrientation;
33104              }
33105              get aimRightPosition() {
33106                return this._aimRightPosition;
33107              }
33108              get aimRightOrientation() {
33109                return this._aimRightOrientation;
33110              }
33111              constructor() {
33112                this._eventTarget = new vo;
33113                this._nativeButtonState = {
33114                  [XT.BUTTON_SOUTH]: 0,
33115                  [XT.BUTTON_EAST]: 0,
33116                  [XT.BUTTON_WEST]: 0,
33117                  [XT.BUTTON_NORTH]: 0,
33118                  [XT.BUTTON_TRIGGER_LEFT]: 0,
33119                  [XT.BUTTON_TRIGGER_RIGHT]: 0,
33120                  [XT.TRIGGER_LEFT]: 0,
33121                  [XT.TRIGGER_RIGHT]: 0,
33122                  [XT.GRIP_LEFT]: 0,
33123                  [XT.GRIP_RIGHT]: 0,
33124                  [XT.LEFT_STICK_UP]: 0,
33125                  [XT.LEFT_STICK_DOWN]: 0,
33126                  [XT.LEFT_STICK_LEFT]: 0,
33127                  [XT.LEFT_STICK_RIGHT]: 0,
33128                  [XT.RIGHT_STICK_UP]: 0,
33129                  [XT.RIGHT_STICK_DOWN]: 0,
33130                  [XT.RIGHT_STICK_LEFT]: 0,
33131                  [XT.RIGHT_STICK_RIGHT]: 0,
33132                  [XT.BUTTON_LEFT_STICK]: 0,
33133                  [XT.BUTTON_RIGHT_STICK]: 0
33134                };
33135                this._nativePoseState = {
33136                  [WT.HAND_LEFT]: {
33137                    position: Pi.ZERO,
33138                    orientation: Ui.IDENTITY
33139                  },
33140                  [WT.HAND_RIGHT]: {
33141                    position: Pi.ZERO,
33142                    orientation: Ui.IDENTITY
33143                  },
33144                  [WT.AIM_LEFT]: {
33145                    position: Pi.ZERO,
33146                    orientation: Ui.IDENTITY
33147                  },
33148                  [WT.AIM_RIGHT]: {
33149                    position: Pi.ZERO,
33150                    orientation: Ui.IDENTITY
33151                  }
33152                };
33153                this._initInputSource();
33154                this._registerEvent();
33155              }
33156              _registerEvent() {
33157                jsb.onHandleInput = t => {
33158                  for (let e = 0; e < t.length; ++e) {
33159                    const i = t[e];
33160                    this._updateNativeButtonState(i);
33161                    this._eventTarget.emit(MS.HANDLE_INPUT, new FS(MS.HANDLE_INPUT, this));
33162                  }
33163                };
33164                jsb.onHandlePoseInput = t => {
33165                  for (let e = 0; e < t.length; ++e) {
33166                    const i = t[e];
33167                    this._updateNativePoseState(i);
33168                  }
33169                  this._eventTarget.emit(MS.HANDLE_POSE_INPUT, new FS(MS.HANDLE_POSE_INPUT, this));
33170                };
33171              }
33172              _on(t, e, i) {
33173                this._eventTarget.on(t, e, i);
33174              }
33175              _axisToButtons(t) {
33176                const e = Math.abs(t);
33177                return t > 0 ? {
33178                  negative: 0,
33179                  positive: e
33180                } : t < 0 ? {
33181                  negative: e,
33182                  positive: 0
33183                } : {
33184                  negative: 0,
33185                  positive: 0
33186                };
33187              }
33188              _updateNativeButtonState(t) {
33189                const {buttonInfoList: e, axisInfoList: i} = t;
33190                for (let t = 0; t < e.length; ++t) {
33191                  const i = e[t];
33192                  const s = YT[i.code];
33193                  this._nativeButtonState[s] = i.isPressed ? 1 : 0;
33194                }
33195                for (let t = 0; t < i.length; ++t) {
33196                  const e = i[t];
33197                  const {code: s, value: n} = e;
33198                  let r;
33199                  let o;
33200                  let a;
33201                  switch (s) {
33202                   case 3:
33203                    r = XT.LEFT_STICK_LEFT;
33204                    o = XT.LEFT_STICK_RIGHT;
33205                    a = this._axisToButtons(n);
33206                    break;
33207
33208                   case 4:
33209                    r = XT.LEFT_STICK_DOWN;
33210                    o = XT.LEFT_STICK_UP;
33211                    a = this._axisToButtons(n);
33212                    break;
33213
33214                   case 5:
33215                    r = XT.RIGHT_STICK_LEFT;
33216                    o = XT.RIGHT_STICK_RIGHT;
33217                    a = this._axisToButtons(n);
33218                    break;
33219
33220                   case 6:
33221                    r = XT.RIGHT_STICK_DOWN;
33222                    o = XT.RIGHT_STICK_UP;
33223                    a = this._axisToButtons(n);
33224                    break;
33225
33226                   default:
33227                    7 === s ? this._nativeButtonState[XT.TRIGGER_LEFT] = n : 8 === s ? this._nativeButtonState[XT.TRIGGER_RIGHT] = n : 9 === s ? this._nativeButtonState[XT.GRIP_LEFT] = n : 10 === s && (this._nativeButtonState[XT.GRIP_RIGHT] = n);
33228                  }
33229                  if (r && o && a) {
33230                    this._nativeButtonState[r] = a.negative;
33231                    this._nativeButtonState[o] = a.positive;
33232                  }
33233                }
33234              }
33235              _updateNativePoseState(t) {
33236                switch (t.code) {
33237                 case 1:
33238                  this._nativePoseState[WT.HAND_LEFT] = {
33239                    position: new Pi(t.x, t.y, t.z),
33240                    orientation: new Ui(t.quaternionX, t.quaternionY, t.quaternionZ, t.quaternionW)
33241                  };
33242                  break;
33243
33244                 case 2:
33245                  this._nativePoseState[WT.AIM_LEFT] = {
33246                    position: new Pi(t.x, t.y, t.z),
33247                    orientation: new Ui(t.quaternionX, t.quaternionY, t.quaternionZ, t.quaternionW)
33248                  };
33249                  break;
33250
33251                 case 4:
33252                  this._nativePoseState[WT.HAND_RIGHT] = {
33253                    position: new Pi(t.x, t.y, t.z),
33254                    orientation: new Ui(t.quaternionX, t.quaternionY, t.quaternionZ, t.quaternionW)
33255                  };
33256                  break;
33257
33258                 case 5:
33259                  this._nativePoseState[WT.AIM_RIGHT] = {
33260                    position: new Pi(t.x, t.y, t.z),
33261                    orientation: new Ui(t.quaternionX, t.quaternionY, t.quaternionZ, t.quaternionW)
33262                  };
33263                }
33264              }
33265              _initInputSource() {
33266                this._buttonNorth = new FT;
33267                this._buttonNorth.getValue = () => this._nativeButtonState[XT.BUTTON_NORTH];
33268                this._buttonEast = new FT;
33269                this._buttonEast.getValue = () => this._nativeButtonState[XT.BUTTON_EAST];
33270                this._buttonWest = new FT;
33271                this._buttonWest.getValue = () => this._nativeButtonState[XT.BUTTON_WEST];
33272                this._buttonSouth = new FT;
33273                this._buttonSouth.getValue = () => this._nativeButtonState[XT.BUTTON_SOUTH];
33274                this._buttonTriggerLeft = new FT;
33275                this._buttonTriggerLeft.getValue = () => this._nativeButtonState[XT.BUTTON_TRIGGER_LEFT];
33276                this._buttonTriggerRight = new FT;
33277                this._buttonTriggerRight.getValue = () => this._nativeButtonState[XT.BUTTON_TRIGGER_RIGHT];
33278                this._triggerLeft = new FT;
33279                this._triggerLeft.getValue = () => this._nativeButtonState[XT.TRIGGER_LEFT];
33280                this._triggerRight = new FT;
33281                this._triggerRight.getValue = () => this._nativeButtonState[XT.TRIGGER_RIGHT];
33282                this._gripLeft = new FT;
33283                this._gripLeft.getValue = () => this._nativeButtonState[XT.GRIP_LEFT];
33284                this._gripRight = new FT;
33285                this._gripRight.getValue = () => this._nativeButtonState[XT.GRIP_RIGHT];
33286                this._buttonLeftStick = new FT;
33287                this._buttonLeftStick.getValue = () => this._nativeButtonState[XT.BUTTON_LEFT_STICK];
33288                const t = new FT;
33289                t.getValue = () => this._nativeButtonState[XT.LEFT_STICK_UP];
33290                const e = new FT;
33291                e.getValue = () => this._nativeButtonState[XT.LEFT_STICK_DOWN];
33292                const i = new FT;
33293                i.getValue = () => this._nativeButtonState[XT.LEFT_STICK_LEFT];
33294                const s = new FT;
33295                s.getValue = () => this._nativeButtonState[XT.LEFT_STICK_RIGHT];
33296                this._leftStick = new kT({
33297                  up: t,
33298                  down: e,
33299                  left: i,
33300                  right: s
33301                });
33302                this._buttonRightStick = new FT;
33303                this._buttonRightStick.getValue = () => this._nativeButtonState[XT.BUTTON_RIGHT_STICK];
33304                const n = new FT;
33305                n.getValue = () => this._nativeButtonState[XT.RIGHT_STICK_UP];
33306                const r = new FT;
33307                r.getValue = () => this._nativeButtonState[XT.RIGHT_STICK_DOWN];
33308                const o = new FT;
33309                o.getValue = () => this._nativeButtonState[XT.RIGHT_STICK_LEFT];
33310                const a = new FT;
33311                a.getValue = () => this._nativeButtonState[XT.RIGHT_STICK_RIGHT];
33312                this._rightStick = new kT({
33313                  up: n,
33314                  down: r,
33315                  left: o,
33316                  right: a
33317                });
33318                this._handLeftPosition = new GT;
33319                this._handLeftPosition.getValue = () => this._nativePoseState[WT.HAND_LEFT].position;
33320                this._handLeftOrientation = new UT;
33321                this._handLeftOrientation.getValue = () => this._nativePoseState[WT.HAND_LEFT].orientation;
33322                this._handRightPosition = new GT;
33323                this._handRightPosition.getValue = () => this._nativePoseState[WT.HAND_RIGHT].position;
33324                this._handRightOrientation = new UT;
33325                this._handRightOrientation.getValue = () => this._nativePoseState[WT.HAND_RIGHT].orientation;
33326                this._aimLeftPosition = new GT;
33327                this._aimLeftPosition.getValue = () => this._nativePoseState[WT.AIM_LEFT].position;
33328                this._aimLeftOrientation = new UT;
33329                this._aimLeftOrientation.getValue = () => this._nativePoseState[WT.AIM_LEFT].orientation;
33330                this._aimRightPosition = new GT;
33331                this._aimRightPosition.getValue = () => this._nativePoseState[WT.AIM_RIGHT].position;
33332                this._aimRightOrientation = new UT;
33333                this._aimRightOrientation.getValue = () => this._nativePoseState[WT.AIM_RIGHT].orientation;
33334              }
33335            }
33336            var KT;
33337            !function(t) {
33338              t[t.VIEW_LEFT = 0] = "VIEW_LEFT";
33339              t[t.VIEW_RIGHT = 1] = "VIEW_RIGHT";
33340              t[t.HEAD_MIDDLE = 2] = "HEAD_MIDDLE";
33341            }(KT || (KT = {}));
33342            class JT {
33343              get viewLeftPosition() {
33344                return this._viewLeftPosition;
33345              }
33346              get viewLeftOrientation() {
33347                return this._viewLeftOrientation;
33348              }
33349              get viewRightPosition() {
33350                return this._viewRightPosition;
33351              }
33352              get viewRightOrientation() {
33353                return this._viewRightOrientation;
33354              }
33355              get headMiddlePosition() {
33356                return this._headMiddlePosition;
33357              }
33358              get headMiddleOrientation() {
33359                return this._headMiddleOrientation;
33360              }
33361              constructor() {
33362                this._eventTarget = new vo;
33363                this._nativePoseState = {
33364                  [KT.VIEW_LEFT]: {
33365                    position: Pi.ZERO,
33366                    orientation: Ui.IDENTITY
33367                  },
33368                  [KT.VIEW_RIGHT]: {
33369                    position: Pi.ZERO,
33370                    orientation: Ui.IDENTITY
33371                  },
33372                  [KT.HEAD_MIDDLE]: {
33373                    position: Pi.ZERO,
33374                    orientation: Ui.IDENTITY
33375                  }
33376                };
33377                this._initInputSource();
33378                this._registerEvent();
33379              }
33380              _registerEvent() {
33381                jsb.onHMDPoseInput = t => {
33382                  for (let e = 0; e < t.length; ++e) {
33383                    const i = t[e];
33384                    this._updateNativePoseState(i);
33385                  }
33386                  this._eventTarget.emit(MS.HMD_POSE_INPUT, new VS(MS.HMD_POSE_INPUT, this));
33387                };
33388              }
33389              _on(t, e, i) {
33390                this._eventTarget.on(t, e, i);
33391              }
33392              _updateNativePoseState(t) {
33393                switch (t.code) {
33394                 case 0:
33395                  this._nativePoseState[KT.VIEW_LEFT] = {
33396                    position: new Pi(t.x, t.y, t.z),
33397                    orientation: new Ui(t.quaternionX, t.quaternionY, t.quaternionZ, t.quaternionW)
33398                  };
33399                  break;
33400
33401                 case 3:
33402                  this._nativePoseState[KT.VIEW_RIGHT] = {
33403                    position: new Pi(t.x, t.y, t.z),
33404                    orientation: new Ui(t.quaternionX, t.quaternionY, t.quaternionZ, t.quaternionW)
33405                  };
33406                  break;
33407
33408                 case 6:
33409                  this._nativePoseState[KT.HEAD_MIDDLE] = {
33410                    position: new Pi(t.x, t.y, t.z),
33411                    orientation: new Ui(t.quaternionX, t.quaternionY, t.quaternionZ, t.quaternionW)
33412                  };
33413                }
33414              }
33415              _initInputSource() {
33416                this._viewLeftPosition = new GT;
33417                this._viewLeftPosition.getValue = () => this._nativePoseState[KT.VIEW_LEFT].position;
33418                this._viewLeftOrientation = new UT;
33419                this._viewLeftOrientation.getValue = () => this._nativePoseState[KT.VIEW_LEFT].orientation;
33420                this._viewRightPosition = new GT;
33421                this._viewRightPosition.getValue = () => this._nativePoseState[KT.VIEW_RIGHT].position;
33422                this._viewRightOrientation = new UT;
33423                this._viewRightOrientation.getValue = () => this._nativePoseState[KT.VIEW_RIGHT].orientation;
33424                this._headMiddlePosition = new GT;
33425                this._headMiddlePosition.getValue = () => this._nativePoseState[KT.HEAD_MIDDLE].position;
33426                this._headMiddleOrientation = new UT;
33427                this._headMiddleOrientation.getValue = () => this._nativePoseState[KT.HEAD_MIDDLE].orientation;
33428              }
33429            }
33430            const ZT = {
33431              12: US.NUM_LOCK,
33432              10048: US.NUM_0,
33433              10049: US.NUM_1,
33434              10050: US.NUM_2,
33435              10051: US.NUM_3,
33436              10052: US.NUM_4,
33437              10053: US.NUM_5,
33438              10054: US.NUM_6,
33439              10055: US.NUM_7,
33440              10056: US.NUM_8,
33441              10057: US.NUM_9,
33442              20013: US.NUM_ENTER,
33443              20016: US.SHIFT_RIGHT,
33444              20017: US.CTRL_RIGHT,
33445              20018: US.ALT_RIGHT
33446            };
33447            function QT(t) {
33448              return ZT[t] || t;
33449            }
33450            class $T {
33451              constructor() {
33452                this._eventTarget = new vo;
33453                this._keyStateMap = {};
33454                this._registerEvent();
33455              }
33456              _registerEvent() {
33457                jsb.onKeyDown = t => {
33458                  const e = QT(t.keyCode);
33459                  if (this._keyStateMap[e]) {
33460                    const e = this._getInputEvent(t, MS.KEY_PRESSING);
33461                    this._eventTarget.emit(MS.KEY_PRESSING, e);
33462                  } else {
33463                    const e = this._getInputEvent(t, MS.KEY_DOWN);
33464                    this._eventTarget.emit(MS.KEY_DOWN, e);
33465                  }
33466                  this._keyStateMap[e] = !0;
33467                };
33468                jsb.onKeyUp = t => {
33469                  const e = QT(t.keyCode);
33470                  const i = this._getInputEvent(t, MS.KEY_UP);
33471                  this._keyStateMap[e] = !1;
33472                  this._eventTarget.emit(MS.KEY_UP, i);
33473                };
33474              }
33475              _getInputEvent(t, e) {
33476                const i = QT(t.keyCode);
33477                return new DS(i, e);
33478              }
33479              on(t, e, i) {
33480                this._eventTarget.on(t, e, i);
33481              }
33482            }
33483            class tv {
33484              constructor() {
33485                this._eventTarget = new vo;
33486                this._preMousePos = new Qi;
33487                this._isPressed = !1;
33488                this._registerEvent();
33489              }
33490              _getLocation(t) {
33491                const e = Lo.windowSize;
33492                const i = Lo.devicePixelRatio;
33493                const s = t.x * i;
33494                const n = e.height - t.y * i;
33495                return new Qi(s, n);
33496              }
33497              _registerEvent() {
33498                jsb.onMouseDown = this._createCallback(MS.MOUSE_DOWN);
33499                jsb.onMouseMove = this._createCallback(MS.MOUSE_MOVE);
33500                jsb.onMouseUp = this._createCallback(MS.MOUSE_UP);
33501                jsb.onMouseWheel = this._handleMouseWheel.bind(this);
33502              }
33503              _createCallback(t) {
33504                return e => {
33505                  const i = this._getLocation(e);
33506                  let s = e.button;
33507                  switch (t) {
33508                   case MS.MOUSE_DOWN:
33509                    this._isPressed = !0;
33510                    break;
33511
33512                   case MS.MOUSE_UP:
33513                    this._isPressed = !1;
33514                    break;
33515
33516                   case MS.MOUSE_MOVE:
33517                    this._isPressed || (s = PS.BUTTON_MISSING);
33518                  }
33519                  const n = new PS(t, !1, this._preMousePos);
33520                  n.setLocation(i.x, i.y);
33521                  n.setButton(s);
33522                  n.movementX = i.x - this._preMousePos.x;
33523                  n.movementY = this._preMousePos.y - i.y;
33524                  this._preMousePos.set(i.x, i.y);
33525                  this._eventTarget.emit(t, n);
33526                };
33527              }
33528              _handleMouseWheel(t) {
33529                const e = MS.MOUSE_WHEEL;
33530                const i = this._getLocation(t);
33531                const s = t.button;
33532                const n = new PS(e, !1, this._preMousePos);
33533                n.setLocation(i.x, i.y);
33534                n.setButton(s);
33535                n.movementX = i.x - this._preMousePos.x;
33536                n.movementY = this._preMousePos.y - i.y;
33537                n.setScrollData(120 * t.wheelDeltaX, 120 * t.wheelDeltaY);
33538                this._preMousePos.set(i.x, i.y);
33539                this._eventTarget.emit(e, n);
33540              }
33541              on(t, e, i) {
33542                this._eventTarget.on(t, e, i);
33543              }
33544            }
33545            const ev = new Qi;
33546            const iv = new class {
33547              constructor() {
33548                this._touchMap = void 0;
33549                this._maxTouches = 8;
33550                this._touchMap = new Map;
33551              }
33552              _cloneTouch(t) {
33553                const e = t.getID();
33554                t.getStartLocation(ev);
33555                const i = new zS(ev.x, ev.y, e);
33556                t.getLocation(ev);
33557                i.setPoint(ev.x, ev.y);
33558                t.getPreviousLocation(ev);
33559                i.setPrevPoint(ev);
33560                return i;
33561              }
33562              _createTouch(t, e, i) {
33563                if (this._touchMap.has(t)) {
33564                  console.log("Cannot create the same touch object.");
33565                  return;
33566                }
33567                if (this._checkTouchMapSizeMoreThanMax(t)) {
33568                  console.log("The touches is more than MAX_TOUCHES.");
33569                  return;
33570                }
33571                const s = new zS(e, i, t);
33572                this._touchMap.set(t, s);
33573                this._updateTouch(s, e, i);
33574                return this._cloneTouch(s);
33575              }
33576              releaseTouch(t) {
33577                this._touchMap.has(t) && this._touchMap.delete(t);
33578              }
33579              getTouch(t, e, i) {
33580                let s = this._touchMap.get(t);
33581                s ? this._updateTouch(s, e, i) : s = this._createTouch(t, e, i);
33582                return s ? this._cloneTouch(s) : void 0;
33583              }
33584              getAllTouches() {
33585                const t = [];
33586                this._touchMap.forEach((e => {
33587                  if (e) {
33588                    const i = this._cloneTouch(e);
33589                    t.push(i);
33590                  }
33591                }));
33592                return t;
33593              }
33594              _updateTouch(t, e, i) {
33595                t.getLocation(ev);
33596                t.setPrevPoint(ev);
33597                t.setPoint(e, i);
33598              }
33599              _checkTouchMapSizeMoreThanMax(t) {
33600                if (this._touchMap.has(t)) return !1;
33601                const e = pe.ENABLE_MULTI_TOUCH ? this._maxTouches : 1;
33602                if (this._touchMap.size < e) return !1;
33603                const i = performance.now();
33604                this._touchMap.forEach((t => {
33605                  if (i - t.lastModified > pe.TOUCH_TIMEOUT) {
33606                    console.log(`The touches is more than MAX_TOUCHES, release touch id ${t.getID()}.`);
33607                    this.releaseTouch(t.getID());
33608                  }
33609                }));
33610                return e >= this._touchMap.size;
33611              }
33612            };
33613            class sv {
33614              constructor() {
33615                this._eventTarget = new vo;
33616                this._registerEvent();
33617              }
33618              _registerEvent() {
33619                jsb.onTouchStart = this._createCallback(MS.TOUCH_START);
33620                jsb.onTouchMove = this._createCallback(MS.TOUCH_MOVE);
33621                jsb.onTouchEnd = this._createCallback(MS.TOUCH_END);
33622                jsb.onTouchCancel = this._createCallback(MS.TOUCH_CANCEL);
33623              }
33624              _createCallback(t) {
33625                return e => {
33626                  const i = [];
33627                  const s = e.length;
33628                  const n = Lo.windowSize;
33629                  for (let r = 0; r < s; ++r) {
33630                    const s = e[r];
33631                    const o = s.identifier;
33632                    if (null === o) continue;
33633                    const a = this._getLocation(s, n);
33634                    const l = iv.getTouch(o, a.x, a.y);
33635                    if (l) {
33636                      t !== MS.TOUCH_END && t !== MS.TOUCH_CANCEL || iv.releaseTouch(o);
33637                      i.push(l);
33638                    }
33639                  }
33640                  if (i.length > 0) {
33641                    const e = new NS(i, !1, t, pe.ENABLE_MULTI_TOUCH ? iv.getAllTouches() : i);
33642                    this._eventTarget.emit(t, e);
33643                  }
33644                };
33645              }
33646              _getLocation(t, e) {
33647                const i = Lo.devicePixelRatio;
33648                const s = t.clientX * i;
33649                const n = e.height - t.clientY * i;
33650                return new Qi(s, n);
33651              }
33652              on(t, e, i) {
33653                this._eventTarget.on(t, e, i);
33654              }
33655            }
33656            let nv;
33657            !function(t) {
33658              t[t.GLOBAL = 0] = "GLOBAL";
33659              t[t.UI = 1] = "UI";
33660            }(nv || (nv = {}));
33661            class rv {
33662              constructor(t) {
33663                this.priority = nv.GLOBAL;
33664                this._inputEventTarget = void 0;
33665                this._inputEventTarget = t;
33666              }
33667              dispatchEvent(t) {
33668                this._inputEventTarget.emit(t.type, t);
33669                return !0;
33670              }
33671            }
33672            const ov = {
33673              [MS.MOUSE_DOWN]: MS.TOUCH_START,
33674              [MS.MOUSE_MOVE]: MS.TOUCH_MOVE,
33675              [MS.MOUSE_UP]: MS.TOUCH_END
33676            };
33677            class av {
33678              constructor() {
33679                this._dispatchImmediately = !1;
33680                this._eventTarget = new vo;
33681                this._touchInput = new sv;
33682                this._mouseInput = new tv;
33683                this._keyboardInput = new $T;
33684                this._accelerometerInput = new IT;
33685                this._handleInput = new qT;
33686                this._hmdInput = new JT;
33687                this._eventTouchList = [];
33688                this._eventMouseList = [];
33689                this._eventKeyboardList = [];
33690                this._eventAccelerationList = [];
33691                this._eventGamepadList = [];
33692                this._eventHandleList = [];
33693                this._eventHMDList = [];
33694                this._needSimulateTouchMoveEvent = !1;
33695                this._inputEventDispatcher = void 0;
33696                this._eventDispatcherList = [];
33697                this._registerEvent();
33698                this._inputEventDispatcher = new rv(this._eventTarget);
33699                this._registerEventDispatcher(this._inputEventDispatcher);
33700                jT._init();
33701              }
33702              _dispatchMouseDownEvent(t) {
33703                var e, i;
33704                null === (e = (i = this._mouseInput).dispatchMouseDownEvent) || void 0 === e || e.call(i, t);
33705              }
33706              _dispatchMouseMoveEvent(t) {
33707                var e, i;
33708                null === (e = (i = this._mouseInput).dispatchMouseMoveEvent) || void 0 === e || e.call(i, t);
33709              }
33710              _dispatchMouseUpEvent(t) {
33711                var e, i;
33712                null === (e = (i = this._mouseInput).dispatchMouseUpEvent) || void 0 === e || e.call(i, t);
33713              }
33714              _dispatchMouseScrollEvent(t) {
33715                var e, i;
33716                null === (e = (i = this._mouseInput).dispatchScrollEvent) || void 0 === e || e.call(i, t);
33717              }
33718              _dispatchKeyboardDownEvent(t) {
33719                var e, i;
33720                null === (e = (i = this._keyboardInput).dispatchKeyboardDownEvent) || void 0 === e || e.call(i, t);
33721              }
33722              _dispatchKeyboardUpEvent(t) {
33723                var e, i;
33724                null === (e = (i = this._keyboardInput).dispatchKeyboardUpEvent) || void 0 === e || e.call(i, t);
33725              }
33726              on(t, e, i) {
33727                this._eventTarget.on(t, e, i);
33728                return e;
33729              }
33730              once(t, e, i) {
33731                this._eventTarget.once(t, e, i);
33732                return e;
33733              }
33734              off(t, e, i) {
33735                this._eventTarget.off(t, e, i);
33736              }
33737              setAccelerometerEnabled(t) {
33738                t ? this._accelerometerInput.start() : this._accelerometerInput.stop();
33739              }
33740              setAccelerometerInterval(t) {
33741                this._accelerometerInput.setInterval(t);
33742              }
33743              _simulateEventTouch(t) {
33744                const e = ov[t.type];
33745                const i = iv.getTouch(0, t.getLocationX(), t.getLocationY());
33746                if (!i) return;
33747                const s = [ i ];
33748                const n = new NS(s, !1, e, e === MS.TOUCH_END ? [] : s);
33749                e === MS.TOUCH_END && iv.releaseTouch(0);
33750                this._dispatchOrPushEventTouch(n, this._eventTouchList);
33751              }
33752              _registerEventDispatcher(t) {
33753                this._eventDispatcherList.push(t);
33754                this._eventDispatcherList.sort(((t, e) => e.priority - t.priority));
33755              }
33756              _emitEvent(t) {
33757                const e = this._eventDispatcherList.length;
33758                for (let i = 0; i < e; ++i) {
33759                  if (!this._eventDispatcherList[i].dispatchEvent(t)) break;
33760                }
33761              }
33762              _registerEvent() {
33763                if (Vo.hasFeature(Vo.Feature.INPUT_TOUCH)) {
33764                  const t = this._eventTouchList;
33765                  this._touchInput.on(MS.TOUCH_START, (e => {
33766                    this._dispatchOrPushEventTouch(e, t);
33767                  }));
33768                  this._touchInput.on(MS.TOUCH_MOVE, (e => {
33769                    this._dispatchOrPushEventTouch(e, t);
33770                  }));
33771                  this._touchInput.on(MS.TOUCH_END, (e => {
33772                    this._dispatchOrPushEventTouch(e, t);
33773                  }));
33774                  this._touchInput.on(MS.TOUCH_CANCEL, (e => {
33775                    this._dispatchOrPushEventTouch(e, t);
33776                  }));
33777                }
33778                if (Vo.hasFeature(Vo.Feature.EVENT_MOUSE)) {
33779                  const t = this._eventMouseList;
33780                  this._mouseInput.on(MS.MOUSE_DOWN, (e => {
33781                    this._needSimulateTouchMoveEvent = !0;
33782                    this._simulateEventTouch(e);
33783                    this._dispatchOrPushEvent(e, t);
33784                  }));
33785                  this._mouseInput.on(MS.MOUSE_MOVE, (e => {
33786                    this._needSimulateTouchMoveEvent && this._simulateEventTouch(e);
33787                    this._dispatchOrPushEvent(e, t);
33788                  }));
33789                  this._mouseInput.on(MS.MOUSE_UP, (e => {
33790                    this._needSimulateTouchMoveEvent = !1;
33791                    this._simulateEventTouch(e);
33792                    this._dispatchOrPushEvent(e, t);
33793                  }));
33794                  this._mouseInput.on(MS.MOUSE_WHEEL, (e => {
33795                    this._dispatchOrPushEvent(e, t);
33796                  }));
33797                }
33798                if (Vo.hasFeature(Vo.Feature.EVENT_KEYBOARD)) {
33799                  const t = this._eventKeyboardList;
33800                  this._keyboardInput.on(MS.KEY_DOWN, (e => {
33801                    this._dispatchOrPushEvent(e, t);
33802                  }));
33803                  this._keyboardInput.on(MS.KEY_PRESSING, (e => {
33804                    this._dispatchOrPushEvent(e, t);
33805                  }));
33806                  this._keyboardInput.on(MS.KEY_UP, (e => {
33807                    this._dispatchOrPushEvent(e, t);
33808                  }));
33809                }
33810                if (Vo.hasFeature(Vo.Feature.EVENT_ACCELEROMETER)) {
33811                  const t = this._eventAccelerationList;
33812                  this._accelerometerInput.on(MS.DEVICEMOTION, (e => {
33813                    this._dispatchOrPushEvent(e, t);
33814                  }));
33815                }
33816                if (Vo.hasFeature(Vo.Feature.EVENT_GAMEPAD)) {
33817                  const t = this._eventGamepadList;
33818                  jT._on(MS.GAMEPAD_CHANGE, (e => {
33819                    this._dispatchOrPushEvent(e, t);
33820                  }));
33821                  jT._on(MS.GAMEPAD_INPUT, (e => {
33822                    this._dispatchOrPushEvent(e, t);
33823                  }));
33824                }
33825                if (Vo.hasFeature(Vo.Feature.EVENT_HANDLE)) {
33826                  const t = this._eventHandleList;
33827                  this._handleInput._on(MS.HANDLE_INPUT, (e => {
33828                    this._dispatchOrPushEvent(e, t);
33829                  }));
33830                  this._handleInput._on(MS.HANDLE_POSE_INPUT, (e => {
33831                    this._dispatchOrPushEvent(e, t);
33832                  }));
33833                }
33834                if (Vo.hasFeature(Vo.Feature.EVENT_HMD)) {
33835                  const t = this._eventHMDList;
33836                  this._hmdInput._on(MS.HMD_POSE_INPUT, (e => {
33837                    this._dispatchOrPushEvent(e, t);
33838                  }));
33839                }
33840              }
33841              _clearEvents() {
33842                this._eventMouseList.length = 0;
33843                this._eventTouchList.length = 0;
33844                this._eventKeyboardList.length = 0;
33845                this._eventAccelerationList.length = 0;
33846                this._eventGamepadList.length = 0;
33847                this._eventHandleList.length = 0;
33848                this._eventHMDList.length = 0;
33849              }
33850              _dispatchOrPushEvent(t, e) {
33851                this._dispatchImmediately ? this._emitEvent(t) : e.push(t);
33852              }
33853              _dispatchOrPushEventTouch(t, e) {
33854                if (this._dispatchImmediately) {
33855                  const e = t.getTouches();
33856                  const i = e.length;
33857                  for (let s = 0; s < i; ++s) {
33858                    t.touch = e[s];
33859                    t.propagationStopped = t.propagationImmediateStopped = !1;
33860                    this._emitEvent(t);
33861                  }
33862                } else e.push(t);
33863              }
33864              _frameDispatchEvents() {
33865                const t = this._eventMouseList;
33866                for (let e = 0, i = t.length; e < i; ++e) {
33867                  const i = t[e];
33868                  this._emitEvent(i);
33869                }
33870                const e = this._eventTouchList;
33871                for (let t = 0, i = e.length; t < i; ++t) {
33872                  const i = e[t];
33873                  const s = i.getTouches();
33874                  const n = s.length;
33875                  for (let t = 0; t < n; ++t) {
33876                    i.touch = s[t];
33877                    i.propagationStopped = i.propagationImmediateStopped = !1;
33878                    this._emitEvent(i);
33879                  }
33880                }
33881                const i = this._eventKeyboardList;
33882                for (let t = 0, e = i.length; t < e; ++t) {
33883                  const e = i[t];
33884                  this._emitEvent(e);
33885                }
33886                const s = this._eventAccelerationList;
33887                for (let t = 0, e = s.length; t < e; ++t) {
33888                  const e = s[t];
33889                  this._emitEvent(e);
33890                }
33891                const n = this._eventGamepadList;
33892                for (let t = 0, e = n.length; t < e; ++t) {
33893                  const e = n[t];
33894                  this._emitEvent(e);
33895                }
33896                const r = this._eventHandleList;
33897                for (let t = 0, e = r.length; t < e; ++t) {
33898                  const e = r[t];
33899                  this._emitEvent(e);
33900                }
33901                const o = this._eventHMDList;
33902                for (let t = 0, e = o.length; t < e; ++t) {
33903                  const e = o[t];
33904                  this._emitEvent(e);
33905                }
33906                this._clearEvents();
33907              }
33908            }
33909            t("Input", av);
33910            av.EventType = MS;
33911            const lv = t("input", new av);
33912            class hv extends vo {
33913              constructor() {
33914                super();
33915                lv.on(MS.MOUSE_DOWN, (t => {
33916                  this.emit(IS.MOUSE_DOWN, t);
33917                }));
33918                lv.on(MS.MOUSE_MOVE, (t => {
33919                  this.emit(IS.MOUSE_MOVE, t);
33920                }));
33921                lv.on(MS.MOUSE_UP, (t => {
33922                  this.emit(IS.MOUSE_UP, t);
33923                }));
33924                lv.on(MS.MOUSE_WHEEL, (t => {
33925                  this.emit(IS.MOUSE_WHEEL, t);
33926                }));
33927                lv.on(MS.TOUCH_START, (t => {
33928                  this.emit(IS.TOUCH_START, t.touch, t);
33929                }));
33930                lv.on(MS.TOUCH_MOVE, (t => {
33931                  this.emit(IS.TOUCH_MOVE, t.touch, t);
33932                }));
33933                lv.on(MS.TOUCH_END, (t => {
33934                  this.emit(IS.TOUCH_END, t.touch, t);
33935                }));
33936                lv.on(MS.TOUCH_CANCEL, (t => {
33937                  this.emit(IS.TOUCH_CANCEL, t.touch, t);
33938                }));
33939                lv.on(MS.KEY_DOWN, (t => {
33940                  this.emit(IS.KEY_DOWN, t);
33941                }));
33942                lv.on(MS.KEY_PRESSING, (t => {
33943                  this.emit(IS.KEY_DOWN, t);
33944                }));
33945                lv.on(MS.KEY_UP, (t => {
33946                  this.emit(IS.KEY_UP, t);
33947                }));
33948                lv.on(MS.DEVICEMOTION, (t => {
33949                  this.emit(IS.DEVICEMOTION, t);
33950                }));
33951              }
33952              setAccelerometerEnabled(t) {
33953                lv.setAccelerometerEnabled(t);
33954              }
33955              setAccelerometerInterval(t) {
33956                lv.setAccelerometerInterval(t);
33957              }
33958              on(t, e, i, s) {
33959                super.on(t, e, i, s);
33960                return e;
33961              }
33962              off(t, e, i) {
33963                super.off(t, e, i);
33964              }
33965            }
33966            t("SystemEvent", hv);
33967            hv.EventType = IS;
33968            m.SystemEvent = hv;
33969            const cv = t("systemEvent", new hv);
33970            m.systemEvent = cv;
33971            W(IS, "Node.EventType", [ {
33972              name: "POSITION_PART",
33973              newName: "TRANSFORM_CHANGED"
33974            }, {
33975              name: "ROTATION_PART",
33976              newName: "TRANSFORM_CHANGED"
33977            }, {
33978              name: "SCALE_PART",
33979              newName: "TRANSFORM_CHANGED"
33980            } ]);
33981            W(RS, "Event", [ {
33982              name: "ACCELERATION",
33983              newName: "DEVICEMOTION",
33984              target: hv.EventType,
33985              targetName: "SystemEvent.EventType"
33986            } ]);
33987            q(RS, "Event", [ {
33988              name: "TOUCH",
33989              suggest: "please use SystemEvent.EventType.TOUCH_START, SystemEvent.EventType.TOUCH_MOVE, SystemEvent.EventType.TOUCH_END and SystemEvent.EventType.TOUCH_CANCEL instead"
33990            }, {
33991              name: "MOUSE",
33992              suggest: "please use SystemEvent.EventType.MOUSE_DOWN, SystemEvent.EventType.MOUSE_MOVE, SystemEvent.EventType.MOUSE_UP, SystemEvent.EventType.MOUSE_WHEEL, Node.EventType.MOUSE_ENTER and Node.EventType.MOUSE_LEAVE instead"
33993            }, {
33994              name: "KEYBOARD",
33995              suggest: "please use SystemEvent.EventType.KEY_DOWN and SystemEvent.EventType.KEY_UP instead"
33996            } ]);
33997            W(PS, "EventMouse", [ "DOWN", "UP", "MOVE" ].map((t => ({
33998              name: t,
33999              newName: `MOUSE_${t}`,
34000              target: hv.EventType,
34001              targetName: "SystemEvent.EventType"
34002            }))));
34003            W(PS, "EventMouse", [ {
34004              name: "SCROLL",
34005              newName: "MOUSE_WHEEL",
34006              target: hv.EventType,
34007              targetName: "SystemEvent.EventType"
34008            } ]);
34009            q(PS.prototype, "EventMouse.prototype", [ {
34010              name: "eventType",
34011              suggest: "please use EventMouse.prototype.type instead"
34012            } ]);
34013            W(NS, "EventTouch", [ {
34014              name: "BEGAN",
34015              newName: "TOUCH_START",
34016              target: hv.EventType,
34017              targetName: "SystemEvent.EventType"
34018            } ]);
34019            W(NS, "EventTouch", [ {
34020              name: "MOVED",
34021              newName: "TOUCH_MOVE",
34022              target: hv.EventType,
34023              targetName: "SystemEvent.EventType"
34024            } ]);
34025            W(NS, "EventTouch", [ {
34026              name: "ENDED",
34027              newName: "TOUCH_END",
34028              target: hv.EventType,
34029              targetName: "SystemEvent.EventType"
34030            } ]);
34031            W(NS, "EventTouch", [ {
34032              name: "CANCELLED",
34033              newName: "TOUCH_CANCEL",
34034              target: hv.EventType,
34035              targetName: "SystemEvent.EventType"
34036            } ]);
34037            q(NS.prototype, "EventTouch.prototype", [ {
34038              name: "getEventCode",
34039              suggest: "please use EventTouch.prototype.type instead"
34040            } ]);
34041            W(NS.prototype, "EventTouch.prototype", [ {
34042              name: "getUILocationInView",
34043              newName: "getLocationInView",
34044              target: NS,
34045              targetName: "EventTouch"
34046            } ]);
34047            q(pe.KEY, "macro.KEY", [ "back", "menu", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "*", "+", "-", "/", ";", "=", ",", ".", "[", "]", "dpadLeft", "dpadRight", "dpadUp", "dpadDown", "dpadCenter" ].map((t => ({
34048              name: t
34049            }))));
34050            q(pe.KEY, "macro.KEY", [ {
34051              name: "shift",
34052              suggest: "please use KeyCode.SHIFT_LEFT instead"
34053            } ]);
34054            q(pe.KEY, "macro.KEY", [ {
34055              name: "ctrl",
34056              suggest: "please use KeyCode.CTRL_LEFT instead"
34057            } ]);
34058            q(pe.KEY, "macro.KEY", [ {
34059              name: "alt",
34060              suggest: "please use KeyCode.ALT_LEFT instead"
34061            } ]);
34062            q(pe, "macro", [ {
34063              name: "KEY",
34064              suggest: "please use KeyCode instead"
34065            } ]);
34066            var uv;
34067            W(_y.prototype, "Node", [ {
34068              name: "childrenCount",
34069              newName: "children.length",
34070              customGetter() {
34071                return this.children.length;
34072              }
34073            } ]);
34074            W(_y.prototype, "Node", [ {
34075              name: "width",
34076              targetName: "node.getComponent(UITransform)",
34077              customGetter() {
34078                return this._uiProps.uiTransformComp.width;
34079              },
34080              customSetter(t) {
34081                this._uiProps.uiTransformComp.width = t;
34082              }
34083            }, {
34084              name: "height",
34085              targetName: "node.getComponent(UITransform)",
34086              customGetter() {
34087                return this._uiProps.uiTransformComp.height;
34088              },
34089              customSetter(t) {
34090                this._uiProps.uiTransformComp.height = t;
34091              }
34092            }, {
34093              name: "anchorX",
34094              targetName: "node.getComponent(UITransform)",
34095              customGetter() {
34096                return this._uiProps.uiTransformComp.anchorX;
34097              },
34098              customSetter(t) {
34099                this._uiProps.uiTransformComp.anchorX = t;
34100              }
34101            }, {
34102              name: "anchorY",
34103              targetName: "node.getComponent(UITransform)",
34104              customGetter() {
34105                return this._uiProps.uiTransformComp.anchorY;
34106              },
34107              customSetter(t) {
34108                this._uiProps.uiTransformComp.anchorY = t;
34109              }
34110            }, {
34111              name: "getAnchorPoint",
34112              targetName: "node.getComponent(UITransform)",
34113              customFunction(t) {
34114                t || (t = new Qi);
34115                t.set(this._uiProps.uiTransformComp.anchorPoint);
34116                return t;
34117              }
34118            }, {
34119              name: "setAnchorPoint",
34120              targetName: "node.getComponent(UITransform)",
34121              customFunction(t, e) {
34122                this._uiProps.uiTransformComp.setAnchorPoint(t, e);
34123              }
34124            }, {
34125              name: "getContentSize",
34126              targetName: "node.getComponent(UITransform)",
34127              customFunction(t) {
34128                t || (t = new rs);
34129                t.set(this._uiProps.uiTransformComp.contentSize);
34130                return t;
34131              }
34132            }, {
34133              name: "setContentSize",
34134              targetName: "node.getComponent(UITransform)",
34135              customFunction(t, e) {
34136                "number" == typeof t ? this._uiProps.uiTransformComp.setContentSize(t, e) : this._uiProps.uiTransformComp.setContentSize(t);
34137              }
34138            } ]);
34139            Y(nT.prototype, "SceneGlobals.prototype", [ {
34140              name: "aspect"
34141            }, {
34142              name: "selfShadow"
34143            }, {
34144              name: "linear"
34145            }, {
34146              name: "packing"
34147            }, {
34148              name: "autoAdapt"
34149            }, {
34150              name: "fixedArea"
34151            }, {
34152              name: "pcf"
34153            }, {
34154              name: "bias"
34155            }, {
34156              name: "normalBias"
34157            }, {
34158              name: "near"
34159            }, {
34160              name: "far"
34161            }, {
34162              name: "shadowDistance"
34163            }, {
34164              name: "invisibleOcclusionRange"
34165            }, {
34166              name: "orthoSize"
34167            }, {
34168              name: "saturation"
34169            } ]);
34170            W(nT.prototype, "SceneGlobals.prototype", [ {
34171              name: "distance",
34172              newName: "planeHeight"
34173            }, {
34174              name: "normal",
34175              newName: "planeDirection"
34176            }, {
34177              name: "size",
34178              newName: "shadowMapSize"
34179            } ]);
34180            Y(_y.prototype, "Node.prototype", [ {
34181              name: "addLayer"
34182            }, {
34183              name: "removeLayer"
34184            } ]);
34185            W(ry.prototype, "NodeUIProperties", [ {
34186              name: "opacityDirty",
34187              newName: "colorDirty"
34188            } ]);
34189            Y(mm, "Layers", [ {
34190              name: "All"
34191            }, {
34192              name: "RaycastMask"
34193            }, {
34194              name: "check"
34195            } ]);
34196            W(mm, "Layers", [ {
34197              name: "Default",
34198              newName: "DEFAULT",
34199              target: mm.Enum,
34200              targetName: "Layers.Enum"
34201            }, {
34202              name: "Always",
34203              newName: "ALWAYS",
34204              target: mm.Enum,
34205              targetName: "Layers.Enum"
34206            }, {
34207              name: "IgnoreRaycast",
34208              newName: "IGNORE_RAYCAST",
34209              target: mm.Enum,
34210              targetName: "Layers.Enum"
34211            }, {
34212              name: "Gizmos",
34213              newName: "GIZMOS",
34214              target: mm.Enum,
34215              targetName: "Layers.Enum"
34216            }, {
34217              name: "Editor",
34218              newName: "EDITOR",
34219              target: mm.Enum,
34220              targetName: "Layers.Enum"
34221            }, {
34222              name: "UI",
34223              newName: "UI_3D",
34224              target: mm.Enum,
34225              targetName: "Layers.Enum"
34226            }, {
34227              name: "UI2D",
34228              newName: "UI_2D",
34229              target: mm.Enum,
34230              targetName: "Layers.Enum"
34231            }, {
34232              name: "SceneGizmo",
34233              newName: "SCENE_GIZMO",
34234              target: mm.Enum,
34235              targetName: "Layers.Enum"
34236            }, {
34237              name: "makeInclusiveMask",
34238              newName: "makeMaskInclude",
34239              target: mm,
34240              targetName: "Layers"
34241            }, {
34242              name: "makeExclusiveMask",
34243              newName: "makeMaskExclude",
34244              target: mm,
34245              targetName: "Layers"
34246            } ]);
34247            Y(mm.Enum, "Layers.Enum", [ {
34248              name: "ALWAYS"
34249            } ]);
34250            Y(mm.BitMask, "Layers.BitMask", [ {
34251              name: "ALWAYS"
34252            } ]);
34253            const _v = co.Flags.HideInHierarchy;
34254            const dv = co.Flags.DontSave;
34255            let pv = t("PrivateNode", Ul("cc.PrivateNode")(uv = class extends _y {
34256              constructor(t) {
34257                super(t);
34258                N(12003, this.name);
34259                this.hideFlags |= dv | _v;
34260              }
34261            }) || uv);
34262            W(IS, "SystemEventType", [ "MOUSE_ENTER", "MOUSE_LEAVE", "TRANSFORM_CHANGED", "SCENE_CHANGED_FOR_PERSISTS", "SIZE_CHANGED", "ANCHOR_CHANGED", "COLOR_CHANGED", "CHILD_ADDED", "CHILD_REMOVED", "PARENT_CHANGED", "NODE_DESTROYED", "LAYER_CHANGED", "SIBLING_ORDER_CHANGED" ].map((t => ({
34263              name: t,
34264              target: _y.EventType,
34265              targetName: "Node.EventType"
34266            }))));
34267            W(_y.EventType, "Node.EventType", [ {
34268              name: "DEVICEMOTION",
34269              target: hv.EventType,
34270              targetName: "SystemEvent.EventType"
34271            }, {
34272              name: "KEY_DOWN",
34273              target: hv.EventType,
34274              targetName: "SystemEvent.EventType"
34275            }, {
34276              name: "KEY_UP",
34277              target: hv.EventType,
34278              targetName: "SystemEvent.EventType"
34279            } ]);
34280            m.PrivateNode = pv;
34281            function mv(t, e) {
34282              if (!e) {
34283                const t = m.director.getScene();
34284                if (!t) return null;
34285                e = t;
34286              }
34287              return e.getChildByPath(t);
34288            }
34289            m.find = mv;
34290            const fv = te.fastRemoveAt;
34291            const gv = co.Flags.IsStartCalled;
34292            const yv = co.Flags.IsOnEnableCalled;
34293            co.Flags.IsEditorOnEnableCalled;
34294            function bv(t, e) {
34295              const i = e.constructor._executionOrder;
34296              const s = e._id;
34297              let n = 0;
34298              for (let e = t.length - 1, r = e >>> 1; n <= e; r = n + e >>> 1) {
34299                const o = t[r];
34300                const a = o.constructor._executionOrder;
34301                if (a > i) e = r - 1; else if (a < i) n = r + 1; else {
34302                  const t = o._id;
34303                  if (t > s) e = r - 1; else {
34304                    if (!(t < s)) return r;
34305                    n = r + 1;
34306                  }
34307                }
34308              }
34309              return ~n;
34310            }
34311            function Sv(t, e) {
34312              const i = t.array;
34313              let s = t.i + 1;
34314              for (;s < i.length; ) {
34315                const n = i[s];
34316                if (n.node._activeInHierarchy) ++s; else {
34317                  t.removeAt(s);
34318                  e && (n._objFlags &= ~e);
34319                }
34320              }
34321            }
34322            class Av {
34323              constructor(t) {
34324                this._zero = void 0;
34325                this._neg = void 0;
34326                this._pos = void 0;
34327                this._invoke = void 0;
34328                const e = nt;
34329                this._zero = new e([]);
34330                this._neg = new e([]);
34331                this._pos = new e([]);
34332                this._invoke = t;
34333              }
34334            }
34335            Av.stableRemoveInactive = Sv;
34336            function Tv(t, e) {
34337              return t.constructor._executionOrder - e.constructor._executionOrder;
34338            }
34339            class vv extends Av {
34340              add(t) {
34341                const e = t.constructor._executionOrder;
34342                (0 === e ? this._zero : e < 0 ? this._neg : this._pos).array.push(t);
34343              }
34344              remove(t) {
34345                const e = t.constructor._executionOrder;
34346                (0 === e ? this._zero : e < 0 ? this._neg : this._pos).fastRemove(t);
34347              }
34348              cancelInactive(t) {
34349                Sv(this._zero, t);
34350                Sv(this._neg, t);
34351                Sv(this._pos, t);
34352              }
34353              invoke() {
34354                const t = this._neg;
34355                if (t.array.length > 0) {
34356                  t.array.sort(Tv);
34357                  this._invoke(t);
34358                  t.array.length = 0;
34359                }
34360                this._invoke(this._zero);
34361                this._zero.array.length = 0;
34362                const e = this._pos;
34363                if (e.array.length > 0) {
34364                  e.array.sort(Tv);
34365                  this._invoke(e);
34366                  e.array.length = 0;
34367                }
34368              }
34369            }
34370            class Ev extends Av {
34371              add(t) {
34372                const e = t.constructor._executionOrder;
34373                if (0 === e) this._zero.array.push(t); else {
34374                  const i = e < 0 ? this._neg.array : this._pos.array;
34375                  const s = bv(i, t);
34376                  s < 0 && i.splice(~s, 0, t);
34377                }
34378              }
34379              remove(t) {
34380                const e = t.constructor._executionOrder;
34381                if (0 === e) this._zero.fastRemove(t); else {
34382                  const i = e < 0 ? this._neg : this._pos;
34383                  const s = bv(i.array, t);
34384                  s >= 0 && i.removeAt(s);
34385                }
34386              }
34387              invoke(t) {
34388                this._neg.array.length > 0 && this._invoke(this._neg, t);
34389                this._invoke(this._zero, t);
34390                this._pos.array.length > 0 && this._invoke(this._pos, t);
34391              }
34392            }
34393            function Cv(t, e, i) {
34394              return (s, n) => {
34395                try {
34396                  e(s, n);
34397                } catch (e) {
34398                  m._throw(e);
34399                  const r = s.array;
34400                  i && (r[s.i]._objFlags |= i);
34401                  ++s.i;
34402                  for (;s.i < r.length; ++s.i) try {
34403                    t(r[s.i], n);
34404                  } catch (t) {
34405                    m._throw(t);
34406                    i && (r[s.i]._objFlags |= i);
34407                  }
34408                }
34409              };
34410            }
34411            const xv = Cv((t => {
34412              t.start();
34413              t._objFlags |= gv;
34414            }), (t => {
34415              const e = t.array;
34416              for (t.i = 0; t.i < e.length; ++t.i) {
34417                const i = e[t.i];
34418                i.start();
34419                i._objFlags |= gv;
34420              }
34421            }), gv);
34422            const wv = Cv(((t, e) => {
34423              t.update(e);
34424            }), ((t, e) => {
34425              const i = t.array;
34426              for (t.i = 0; t.i < i.length; ++t.i) i[t.i].update(e);
34427            }));
34428            const Rv = Cv(((t, e) => {
34429              t.lateUpdate(e);
34430            }), ((t, e) => {
34431              const i = t.array;
34432              for (t.i = 0; t.i < i.length; ++t.i) i[t.i].lateUpdate(e);
34433            }));
34434            const Iv = t => {
34435              const e = m.director._compScheduler;
34436              const i = t.array;
34437              for (t.i = 0; t.i < i.length; ++t.i) {
34438                const s = i[t.i];
34439                if (s._enabled) {
34440                  s.onEnable();
34441                  !s.node._activeInHierarchy || e._onEnabled(s);
34442                }
34443              }
34444            };
34445            class Mv {
34446              constructor() {
34447                this._deferredComps = [];
34448                this.unscheduleAll();
34449              }
34450              unscheduleAll() {
34451                this.startInvoker = new vv(xv);
34452                this.updateInvoker = new Ev(wv);
34453                this.lateUpdateInvoker = new Ev(Rv);
34454                this._updating = !1;
34455              }
34456              _onEnabled(t) {
34457                m.director.getScheduler().resumeTarget(t);
34458                t._objFlags |= yv;
34459                this._updating ? this._deferredComps.push(t) : this._scheduleImmediate(t);
34460              }
34461              _onDisabled(t) {
34462                m.director.getScheduler().pauseTarget(t);
34463                t._objFlags &= ~yv;
34464                const e = this._deferredComps.indexOf(t);
34465                if (e >= 0) fv(this._deferredComps, e); else {
34466                  !t.start || t._objFlags & gv || this.startInvoker.remove(t);
34467                  t.update && this.updateInvoker.remove(t);
34468                  t.lateUpdate && this.lateUpdateInvoker.remove(t);
34469                }
34470              }
34471              enableComp(t, e) {
34472                if (!(t._objFlags & yv)) {
34473                  if (t.onEnable) {
34474                    if (e) {
34475                      e.add(t);
34476                      return;
34477                    }
34478                    t.onEnable();
34479                    if (!t.node._activeInHierarchy) return;
34480                  }
34481                  this._onEnabled(t);
34482                }
34483              }
34484              disableComp(t) {
34485                if (t._objFlags & yv) {
34486                  t.onDisable && t.onDisable();
34487                  this._onDisabled(t);
34488                }
34489              }
34490              startPhase() {
34491                this._updating = !0;
34492                this.startInvoker.invoke();
34493                this._startForNewComps();
34494              }
34495              updatePhase(t) {
34496                this.updateInvoker.invoke(t);
34497              }
34498              lateUpdatePhase(t) {
34499                this.lateUpdateInvoker.invoke(t);
34500                this._updating = !1;
34501                this._startForNewComps();
34502              }
34503              _startForNewComps() {
34504                if (this._deferredComps.length > 0) {
34505                  this._deferredSchedule();
34506                  this.startInvoker.invoke();
34507                }
34508              }
34509              _scheduleImmediate(t) {
34510                "function" != typeof t.start || t._objFlags & gv || this.startInvoker.add(t);
34511                "function" == typeof t.update && this.updateInvoker.add(t);
34512                "function" == typeof t.lateUpdate && this.lateUpdateInvoker.add(t);
34513              }
34514              _deferredSchedule() {
34515                const t = this._deferredComps;
34516                for (let e = 0, i = t.length; e < i; e++) this._scheduleImmediate(t[e]);
34517                t.length = 0;
34518              }
34519            }
34520            const Bv = co.Flags.IsPreloadStarted;
34521            const Dv = co.Flags.IsOnLoadStarted;
34522            const Pv = co.Flags.IsOnLoadCalled;
34523            const Ov = co.Flags.Deactivating;
34524            class Nv extends Av {
34525              add(t) {
34526                this._zero.array.push(t);
34527              }
34528              remove(t) {
34529                this._zero.fastRemove(t);
34530              }
34531              cancelInactive(t) {
34532                Av.stableRemoveInactive(this._zero, t);
34533              }
34534              invoke() {
34535                this._invoke(this._zero);
34536                this._zero.array.length = 0;
34537              }
34538            }
34539            const Lv = Cv((t => {
34540              t.__preload();
34541            }), (t => {
34542              const e = t.array;
34543              for (t.i = 0; t.i < e.length; ++t.i) e[t.i].__preload();
34544            }));
34545            const Fv = Cv((t => {
34546              t.onLoad();
34547              t._objFlags |= Pv;
34548            }), (t => {
34549              const e = t.array;
34550              for (t.i = 0; t.i < e.length; ++t.i) {
34551                const i = e[t.i];
34552                i.onLoad();
34553                i._objFlags |= Pv;
34554              }
34555            }), Pv);
34556            const Vv = new $t(4);
34557            Vv.get = function() {
34558              const t = this._get() || {
34559                preload: new Nv(Lv),
34560                onLoad: new vv(Fv),
34561                onEnable: new vv(Iv)
34562              };
34563              t.preload._zero.i = -1;
34564              let e = t.onLoad;
34565              e._zero.i = -1;
34566              e._neg.i = -1;
34567              e._pos.i = -1;
34568              e = t.onEnable;
34569              e._zero.i = -1;
34570              e._neg.i = -1;
34571              e._pos.i = -1;
34572              return t;
34573            };
34574            function kv(t, e, i) {
34575              F(3817, t.name, i);
34576              console.log("Corrupted component value:", e);
34577              e ? t._removeComponent(e) : te.removeAt(t._components, i);
34578            }
34579            class Uv {
34580              constructor() {
34581                this.resetComp = void 0;
34582                this.reset();
34583              }
34584              reset() {
34585                this._activatingStack = [];
34586              }
34587              activateNode(t, e) {
34588                if (e) {
34589                  const e = Vv.get();
34590                  this._activatingStack.push(e);
34591                  this._activateNodeRecursively(t, e.preload, e.onLoad, e.onEnable);
34592                  e.preload.invoke();
34593                  e.onLoad.invoke();
34594                  e.onEnable.invoke();
34595                  this._activatingStack.pop();
34596                  Vv.put(e);
34597                } else {
34598                  this._deactivateNodeRecursively(t);
34599                  const e = this._activatingStack;
34600                  for (const t of e) {
34601                    t.preload.cancelInactive(Bv);
34602                    t.onLoad.cancelInactive(Dv);
34603                    t.onEnable.cancelInactive();
34604                  }
34605                }
34606                t.emit(ny.ACTIVE_IN_HIERARCHY_CHANGED, t);
34607              }
34608              activateComp(t, e, i, s) {
34609                if (po(t, !0)) {
34610                  if (!(t._objFlags & Bv)) {
34611                    t._objFlags |= Bv;
34612                    t.__preload && (e ? e.add(t) : t.__preload());
34613                  }
34614                  if (!(t._objFlags & Dv)) {
34615                    t._objFlags |= Dv;
34616                    if (t.onLoad) if (i) i.add(t); else {
34617                      t.onLoad();
34618                      t._objFlags |= Pv;
34619                    } else t._objFlags |= Pv;
34620                  }
34621                  if (t._enabled) {
34622                    ne(t.node, G(3823, t.uuid, t.name));
34623                    if (!t.node._activeInHierarchy) return;
34624                    m.director._compScheduler.enableComp(t, s);
34625                  }
34626                }
34627              }
34628              destroyComp(t) {
34629                m.director._compScheduler.disableComp(t);
34630                t.onDestroy && t._objFlags & Pv && t.onDestroy();
34631              }
34632              _activateNodeRecursively(t, e, i, s) {
34633                if (t._objFlags & Ov) {
34634                  F(3816, t.name);
34635                  return;
34636                }
34637                t._activeInHierarchy = !0;
34638                let n = t._components.length;
34639                for (let r = 0; r < n; ++r) {
34640                  const o = t._components[r];
34641                  if (o instanceof m.Component) this.activateComp(o, e, i, s); else {
34642                    kv(t, o, r);
34643                    --r;
34644                    --n;
34645                  }
34646                }
34647                for (let n = 0, r = t._children.length; n < r; ++n) {
34648                  const r = t._children[n];
34649                  r._active && this._activateNodeRecursively(r, e, i, s);
34650                }
34651                t._onPostActivated(!0);
34652              }
34653              _deactivateNodeRecursively(t) {
34654                t._objFlags |= Ov;
34655                t._activeInHierarchy = !1;
34656                const e = t._components.length;
34657                for (let i = 0; i < e; ++i) {
34658                  const e = t._components[i];
34659                  if (e._enabled) {
34660                    m.director._compScheduler.disableComp(e);
34661                    if (t._activeInHierarchy) {
34662                      t._objFlags &= ~Ov;
34663                      return;
34664                    }
34665                  }
34666                }
34667                for (let e = 0, i = t._children.length; e < i; ++e) {
34668                  const i = t._children[e];
34669                  if (i._activeInHierarchy) {
34670                    this._deactivateNodeRecursively(i);
34671                    if (t._activeInHierarchy) {
34672                      t._objFlags &= ~Ov;
34673                      return;
34674                    }
34675                  }
34676                }
34677                t._onPostActivated(!1);
34678                t._objFlags &= ~Ov;
34679              }
34680            }
34681            t("NodeActivator", Uv);
34682            var Gv, zv, Hv, jv, Xv, Wv, Yv, qv, Kv, Jv, Zv, Qv, $v, tE, eE, iE, sE, nE, rE, oE, aE, lE, hE, cE, uE, _E, dE, pE, mE, fE, gE, yE, bE, SE, AE, TE, vE, EE, CE, xE, wE, RE, IE, ME, BE, DE, PE, OE, NE, LE, FE, VE, kE, UE, GE, zE, HE, jE, XE, WE, YE, qE, KE, JE, ZE;
34683            let QE = Ul("cc.TargetInfo")(Gv = (zv = class {
34684              constructor() {
34685                Ml(this, "localID", Hv, this);
34686              }
34687            }, Hv = Bl(zv.prototype, "localID", [ Yl ], {
34688              configurable: !0,
34689              enumerable: !0,
34690              writable: !0,
34691              initializer: function() {
34692                return [];
34693              }
34694            }), zv)) || Gv;
34695            let $E = (jv = Ul("cc.TargetOverrideInfo"), Xv = Th(co), Wv = Th(QE), Yv = Th(_y),
34696            qv = Th(QE), jv(Kv = (Jv = class {
34697              constructor() {
34698                Ml(this, "source", Zv, this);
34699                Ml(this, "sourceInfo", Qv, this);
34700                Ml(this, "propertyPath", $v, this);
34701                Ml(this, "target", tE, this);
34702                Ml(this, "targetInfo", eE, this);
34703              }
34704            }, Zv = Bl(Jv.prototype, "source", [ Yl, Xv ], {
34705              configurable: !0,
34706              enumerable: !0,
34707              writable: !0,
34708              initializer: function() {
34709                return null;
34710              }
34711            }), Qv = Bl(Jv.prototype, "sourceInfo", [ Yl, Wv ], {
34712              configurable: !0,
34713              enumerable: !0,
34714              writable: !0,
34715              initializer: function() {
34716                return null;
34717              }
34718            }), $v = Bl(Jv.prototype, "propertyPath", [ Yl ], {
34719              configurable: !0,
34720              enumerable: !0,
34721              writable: !0,
34722              initializer: function() {
34723                return [];
34724              }
34725            }), tE = Bl(Jv.prototype, "target", [ Yl, Yv ], {
34726              configurable: !0,
34727              enumerable: !0,
34728              writable: !0,
34729              initializer: function() {
34730                return null;
34731              }
34732            }), eE = Bl(Jv.prototype, "targetInfo", [ Yl, qv ], {
34733              configurable: !0,
34734              enumerable: !0,
34735              writable: !0,
34736              initializer: function() {
34737                return null;
34738              }
34739            }), Jv)) || Kv);
34740            let tC = Ul("cc.CompPrefabInfo")(iE = (sE = class {
34741              constructor() {
34742                Ml(this, "fileId", nE, this);
34743              }
34744            }, nE = Bl(sE.prototype, "fileId", [ Yl, nh ], {
34745              configurable: !0,
34746              enumerable: !0,
34747              writable: !0,
34748              initializer: function() {
34749                return "";
34750              }
34751            }), sE)) || iE;
34752            let eC = (rE = Ul("CCPropertyOverrideInfo"), oE = Th(QE), rE(aE = (lE = class {
34753              constructor() {
34754                Ml(this, "targetInfo", hE, this);
34755                Ml(this, "propertyPath", cE, this);
34756                Ml(this, "value", uE, this);
34757              }
34758              isTarget(t, e) {}
34759            }, hE = Bl(lE.prototype, "targetInfo", [ Yl, oE ], {
34760              configurable: !0,
34761              enumerable: !0,
34762              writable: !0,
34763              initializer: function() {
34764                return null;
34765              }
34766            }), cE = Bl(lE.prototype, "propertyPath", [ Yl ], {
34767              configurable: !0,
34768              enumerable: !0,
34769              writable: !0,
34770              initializer: function() {
34771                return [];
34772              }
34773            }), uE = Bl(lE.prototype, "value", [ Yl ], {
34774              configurable: !0,
34775              enumerable: !0,
34776              writable: !0,
34777              initializer: null
34778            }), lE)) || aE);
34779            let iC = (_E = Ul("cc.MountedChildrenInfo"), dE = Th(QE), pE = Th([ _y ]), _E(mE = (fE = class {
34780              constructor() {
34781                Ml(this, "targetInfo", gE, this);
34782                Ml(this, "nodes", yE, this);
34783              }
34784              isTarget(t) {}
34785            }, gE = Bl(fE.prototype, "targetInfo", [ Yl, dE ], {
34786              configurable: !0,
34787              enumerable: !0,
34788              writable: !0,
34789              initializer: function() {
34790                return null;
34791              }
34792            }), yE = Bl(fE.prototype, "nodes", [ Yl, pE ], {
34793              configurable: !0,
34794              enumerable: !0,
34795              writable: !0,
34796              initializer: function() {
34797                return [];
34798              }
34799            }), fE)) || mE);
34800            let sC = (bE = Ul("cc.MountedComponentsInfo"), SE = Th(QE), AE = Th([ Qc ]), bE(TE = (vE = class {
34801              constructor() {
34802                Ml(this, "targetInfo", EE, this);
34803                Ml(this, "components", CE, this);
34804              }
34805              isTarget(t) {}
34806            }, EE = Bl(vE.prototype, "targetInfo", [ Yl, SE ], {
34807              configurable: !0,
34808              enumerable: !0,
34809              writable: !0,
34810              initializer: function() {
34811                return null;
34812              }
34813            }), CE = Bl(vE.prototype, "components", [ Yl, AE ], {
34814              configurable: !0,
34815              enumerable: !0,
34816              writable: !0,
34817              initializer: function() {
34818                return [];
34819              }
34820            }), vE)) || TE);
34821            let nC = (xE = Ul("cc.PrefabInstance"), wE = Th(_y), RE = Th([ iC ]), IE = Th([ sC ]),
34822            ME = Th([ eC ]), BE = Th([ QE ]), xE(DE = (PE = class {
34823              constructor() {
34824                Ml(this, "fileId", OE, this);
34825                Ml(this, "prefabRootNode", NE, this);
34826                Ml(this, "mountedChildren", LE, this);
34827                Ml(this, "mountedComponents", FE, this);
34828                Ml(this, "propertyOverrides", VE, this);
34829                Ml(this, "removedComponents", kE, this);
34830                this.targetMap = {};
34831                this.expanded = !1;
34832              }
34833              findPropertyOverride(t, e) {}
34834              removePropertyOverride(t, e) {}
34835            }, OE = Bl(PE.prototype, "fileId", [ Yl ], {
34836              configurable: !0,
34837              enumerable: !0,
34838              writable: !0,
34839              initializer: function() {
34840                return "";
34841              }
34842            }), NE = Bl(PE.prototype, "prefabRootNode", [ Yl, wE ], {
34843              configurable: !0,
34844              enumerable: !0,
34845              writable: !0,
34846              initializer: null
34847            }), LE = Bl(PE.prototype, "mountedChildren", [ Yl, RE ], {
34848              configurable: !0,
34849              enumerable: !0,
34850              writable: !0,
34851              initializer: function() {
34852                return [];
34853              }
34854            }), FE = Bl(PE.prototype, "mountedComponents", [ Yl, IE ], {
34855              configurable: !0,
34856              enumerable: !0,
34857              writable: !0,
34858              initializer: function() {
34859                return [];
34860              }
34861            }), VE = Bl(PE.prototype, "propertyOverrides", [ Yl, ME ], {
34862              configurable: !0,
34863              enumerable: !0,
34864              writable: !0,
34865              initializer: function() {
34866                return [];
34867              }
34868            }), kE = Bl(PE.prototype, "removedComponents", [ Yl, BE ], {
34869              configurable: !0,
34870              enumerable: !0,
34871              writable: !0,
34872              initializer: function() {
34873                return [];
34874              }
34875            }), PE)) || DE);
34876            let rC = (UE = Ul("cc.PrefabInfo"), GE = Th(_y), zE = Th(nC), HE = Th([ $E ]), UE(jE = (XE = class {
34877              constructor() {
34878                Ml(this, "root", WE, this);
34879                Ml(this, "asset", YE, this);
34880                Ml(this, "fileId", qE, this);
34881                Ml(this, "instance", KE, this);
34882                Ml(this, "targetOverrides", JE, this);
34883                Ml(this, "nestedPrefabInstanceRoots", ZE, this);
34884              }
34885            }, WE = Bl(XE.prototype, "root", [ Yl, GE ], {
34886              configurable: !0,
34887              enumerable: !0,
34888              writable: !0,
34889              initializer: null
34890            }), YE = Bl(XE.prototype, "asset", [ Yl ], {
34891              configurable: !0,
34892              enumerable: !0,
34893              writable: !0,
34894              initializer: null
34895            }), qE = Bl(XE.prototype, "fileId", [ Yl, nh ], {
34896              configurable: !0,
34897              enumerable: !0,
34898              writable: !0,
34899              initializer: function() {
34900                return "";
34901              }
34902            }), KE = Bl(XE.prototype, "instance", [ Yl, zE ], {
34903              configurable: !0,
34904              enumerable: !0,
34905              writable: !0,
34906              initializer: null
34907            }), JE = Bl(XE.prototype, "targetOverrides", [ Yl, HE ], {
34908              configurable: !0,
34909              enumerable: !0,
34910              writable: !0,
34911              initializer: null
34912            }), ZE = Bl(XE.prototype, "nestedPrefabInstanceRoots", [ Yl ], {
34913              configurable: !0,
34914              enumerable: !0,
34915              writable: !0,
34916              initializer: null
34917            }), XE)) || jE);
34918            m._PrefabInfo = rC;
34919            var oC = Object.freeze({
34920              __proto__: null,
34921              TargetInfo: QE,
34922              TargetOverrideInfo: $E,
34923              CompPrefabInfo: tC,
34924              PropertyOverrideInfo: eC,
34925              MountedChildrenInfo: iC,
34926              MountedComponentsInfo: sC,
34927              PrefabInstance: nC,
34928              PrefabInfo: rC,
34929              createNodeWithPrefab: JS,
34930              generateTargetMap: ZS,
34931              getTarget: QS,
34932              applyMountedChildren: $S,
34933              applyMountedComponents: tA,
34934              applyRemovedComponents: eA,
34935              applyPropertyOverrides: iA,
34936              applyTargetOverrides: sA,
34937              expandPrefabInstanceNode: nA,
34938              expandNestedPrefabInstanceNode: rA,
34939              applyNodeAndComponentId: function t(e, i) {
34940                const {components: s, children: n} = e;
34941                for (let t = 0; t < s.length; t++) {
34942                  var r;
34943                  const e = s[t];
34944                  e._id = `${i}${null === (r = e.__prefab) || void 0 === r ? void 0 : r.fileId}`;
34945                }
34946                for (let e = 0; e < n.length; e++) {
34947                  var o;
34948                  const s = n[e];
34949                  s._id = `${i}${null === (o = s._prefab) || void 0 === o ? void 0 : o.fileId}`;
34950                  t(s, i);
34951                }
34952              }
34953            });
34954            var aC, lC, hC, cC, uC, _C, dC;
34955            const pC = oe({
34956              AUTO: 0,
34957              SINGLE_INSTANCE: 1,
34958              MULTI_INSTANCE: 2
34959            });
34960            let mC = t("Prefab", Ul("cc.Prefab")(aC = (lC = (dC = _C = class extends gc {
34961              constructor() {
34962                super();
34963                Ml(this, "data", hC, this);
34964                Ml(this, "optimizationPolicy", cC, this);
34965                Ml(this, "persistent", uC, this);
34966                this._createFunction = void 0;
34967                this._instantiatedTimes = void 0;
34968                this._createFunction = null;
34969                this._instantiatedTimes = 0;
34970              }
34971              createNode(t) {
34972                const e = m.instantiate(this);
34973                e.name = this.name;
34974                t(null, e);
34975              }
34976              compileCreateFunction() {
34977                this._createFunction = function(t) {
34978                  const e = t instanceof m._BaseNode && t;
34979                  return new iy(t, e).result;
34980                }(this.data);
34981              }
34982              _doInstantiate(t) {
34983                this.data._prefab || N(3700);
34984                this._createFunction || this.compileCreateFunction();
34985                return this._createFunction(t);
34986              }
34987              _instantiate() {
34988                let t;
34989                t = this.data._instantiate();
34990                ++this._instantiatedTimes;
34991                return t;
34992              }
34993              initDefault(t) {
34994                super.initDefault(t);
34995                this.data = new _y;
34996                this.data.name = "(Missing Node)";
34997                const e = new m._PrefabInfo;
34998                e.asset = this;
34999                e.root = this.data;
35000                this.data._prefab = e;
35001              }
35002              validate() {
35003                return !!this.data;
35004              }
35005              onLoaded() {
35006                const t = this.data;
35007                rA(t);
35008                sA(t);
35009              }
35010            }, _C.OptimizationPolicy = pC, _C.OptimizationPolicyThreshold = 3, dC), hC = Bl(lC.prototype, "data", [ Yl, nh ], {
35011              configurable: !0,
35012              enumerable: !0,
35013              writable: !0,
35014              initializer: function() {
35015                return null;
35016              }
35017            }), cC = Bl(lC.prototype, "optimizationPolicy", [ Yl, nh ], {
35018              configurable: !0,
35019              enumerable: !0,
35020              writable: !0,
35021              initializer: function() {
35022                return pC.AUTO;
35023              }
35024            }), uC = Bl(lC.prototype, "persistent", [ Yl, nh ], {
35025              configurable: !0,
35026              enumerable: !0,
35027              writable: !0,
35028              initializer: function() {
35029                return !1;
35030              }
35031            }), lC)) || aC);
35032            ee.value(mC, "_utils", oC);
35033            m.Prefab = mC;
35034            Ct(m, "cc._Prefab", "Prefab");
35035            const fC = t("RenderingSubMesh", jsb.RenderingSubMesh);
35036            const gC = fC.prototype;
35037            gC._ctor = function(t, e, i, s = null, n = null) {
35038              jsb.Asset.prototype._ctor.apply(this, arguments);
35039              this._attributes = e;
35040              this._vertexBuffers = t;
35041              this._indexBuffer = s;
35042              this._indirectBuffer = n;
35043            };
35044            Object.defineProperty(gC, "geometricInfo", {
35045              configurable: !0,
35046              enumerable: !0,
35047              get() {
35048                let t = this.getGeometricInfo();
35049                if (!t.positions && !t.indices) {
35050                  t.positions = new Float32Array;
35051                  t.indices = new Uint8Array;
35052                }
35053                return t;
35054              }
35055            });
35056            Object.defineProperty(gC, "attributes", {
35057              configurable: !0,
35058              enumerable: !0,
35059              get() {
35060                this._attributes || (this._attributes = this.getAttributes());
35061                return this._attributes;
35062              }
35063            });
35064            Object.defineProperty(gC, "vertexBuffers", {
35065              configurable: !0,
35066              enumerable: !0,
35067              get() {
35068                this._vertexBuffers || (this._vertexBuffers = this.getVertexBuffers());
35069                return this._vertexBuffers;
35070              }
35071            });
35072            Object.defineProperty(gC, "indexBuffer", {
35073              configurable: !0,
35074              enumerable: !0,
35075              get() {
35076                this._indexBuffer || (this._indexBuffer = this.getIndexBuffer());
35077                return this._indexBuffer;
35078              }
35079            });
35080            Object.defineProperty(gC, "indirectBuffer", {
35081              configurable: !0,
35082              enumerable: !0,
35083              get() {
35084                this._indirectBuffer || (this._indirectBuffer = this.getIndexBuffer());
35085                return this._indirectBuffer;
35086              }
35087            });
35088            const yC = t("SceneAsset", jsb.SceneAsset);
35089            m.SceneAsset = yC;
35090            const bC = yC.prototype;
35091            Object.defineProperty(bC, "scene", {
35092              enumerable: !0,
35093              configurable: !0,
35094              get() {
35095                this._scene || (this._scene = this.getScene());
35096                return this._scene;
35097              },
35098              set(t) {
35099                this._scene = t;
35100                this.setScene(t);
35101              }
35102            });
35103            bC._ctor = function() {
35104              jsb.Asset.prototype._ctor.apply(this, arguments);
35105              this._scene = null;
35106            };
35107            const SC = yC.prototype;
35108            Yl(SC, "scene");
35109            Ul("cc.SceneAsset")(yC);
35110            var AC, TC, vC;
35111            let EC = t("TextAsset", Ul("cc.TextAsset")(AC = (TC = class extends gc {
35112              constructor(...t) {
35113                super(...t);
35114                Ml(this, "text", vC, this);
35115              }
35116              toString() {
35117                return this.text;
35118              }
35119            }, vC = Bl(TC.prototype, "text", [ Yl, nh ], {
35120              configurable: !0,
35121              enumerable: !0,
35122              writable: !0,
35123              initializer: function() {
35124                return "";
35125              }
35126            }), TC)) || AC);
35127            m.TextAsset = EC;
35128            var CC, xC, wC;
35129            let RC = t("JsonAsset", Ul("cc.JsonAsset")(CC = (xC = class extends gc {
35130              constructor(...t) {
35131                super(...t);
35132                Ml(this, "json", wC, this);
35133              }
35134            }, wC = Bl(xC.prototype, "json", [ Yl, nh ], {
35135              configurable: !0,
35136              enumerable: !0,
35137              writable: !0,
35138              initializer: function() {
35139                return null;
35140              }
35141            }), xC)) || CC);
35142            m.JsonAsset = RC;
35143            const IC = t("ImageAsset", jsb.ImageAsset);
35144            const MC = [ ".png", ".jpg", ".jpeg", ".bmp", ".webp", ".pvr", ".pkm", ".astc" ];
35145            function BC(t) {
35146              return !!(Vo.hasFeature(Vo.Feature.IMAGE_BITMAP) && t instanceof ImageBitmap);
35147            }
35148            const DC = IC.prototype;
35149            DC._ctor = function(t) {
35150              jsb.Asset.prototype._ctor.apply(this, arguments);
35151              this._width = 0;
35152              this._height = 0;
35153              this._nativeData = {
35154                _data: null,
35155                width: 0,
35156                height: 0,
35157                format: 0,
35158                _compressed: !1
35159              };
35160              void 0 !== t && this.reset(t);
35161            };
35162            Object.defineProperty(DC, "_nativeAsset", {
35163              configurable: !0,
35164              enumerable: !0,
35165              get() {
35166                return this._nativeData;
35167              },
35168              set(t) {
35169                t instanceof HTMLElement || BC(t) || (t.format = t.format || this.format);
35170                this.reset(t);
35171              }
35172            });
35173            Object.defineProperty(DC, "data", {
35174              configurable: !0,
35175              enumerable: !0,
35176              get() {
35177                return this._nativeData && (!0 !== (t = this._nativeData)._compressed && (t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || BC(t))) ? this._nativeData : this._nativeData && this._nativeData._data;
35178                var t;
35179              }
35180            });
35181            DC._setRawAsset = function(t, e = !0) {
35182              this._native = !1 !== e ? t || "" : `/${t}`;
35183            };
35184            DC.reset = function(t) {
35185              this._nativeData = t;
35186              t instanceof HTMLElement || (this.format = t.format);
35187              this._syncDataToNative();
35188            };
35189            const PC = jsb.Asset.prototype.destroy;
35190            DC.destroy = function() {
35191              if (this.data && this.data instanceof HTMLImageElement) {
35192                this.data.src = "";
35193                this._setRawAsset("");
35194                this.data.destroy();
35195              } else BC(this.data) && this.data.close && this.data.close();
35196              return PC.call(this);
35197            };
35198            Object.defineProperty(DC, "width", {
35199              configurable: !0,
35200              enumerable: !0,
35201              get() {
35202                return this._nativeData.width || this._width;
35203              }
35204            });
35205            Object.defineProperty(DC, "height", {
35206              configurable: !0,
35207              enumerable: !0,
35208              get() {
35209                return this._nativeData.height || this._height;
35210              }
35211            });
35212            DC._syncDataToNative = function() {
35213              const t = this._nativeData;
35214              this._width = t.width;
35215              this._height = t.height;
35216              this.setWidth(this._width);
35217              this.setHeight(this._height);
35218              this.url = this.nativeUrl;
35219              t instanceof HTMLCanvasElement ? this.setData(t._data.data) : t instanceof HTMLImageElement ? this.setData(t._data) : this.setData(this._nativeData._data);
35220            };
35221            DC._serialize = function() {
35222              if (EDITOR) {
35223                let t;
35224                this._native && (t = [ this._native ]);
35225                if (!t) return "";
35226                const e = [];
35227                for (const i of t) {
35228                  const t = i.split("@");
35229                  const s = MC.indexOf(t[0]);
35230                  let n = s < 0 ? i : `${s}`;
35231                  t[1] && (n += `@${t[1]}`);
35232                  e.push(n);
35233                }
35234                return {
35235                  fmt: e.join("_"),
35236                  w: this.width,
35237                  h: this.height
35238                };
35239              }
35240            };
35241            DC._deserialize = function(t) {
35242              let e = "";
35243              if ("string" == typeof t) e = t; else {
35244                this._width = t.w;
35245                this._height = t.h;
35246                e = t.fmt;
35247              }
35248              const i = zo.gfxDevice;
35249              const s = e.split("_");
35250              let n = Number.MAX_VALUE;
35251              let r = this.format;
35252              let o = "";
35253              const a = pe.SUPPORT_TEXTURE_FORMATS;
35254              for (const t of s) {
35255                const e = t.split("@");
35256                const s = parseInt(e[0], void 0);
35257                const l = MC[s] || e[0];
35258                const h = a.indexOf(l);
35259                if (-1 !== h && h < n) {
35260                  const t = e[1] ? parseInt(e[1]) : this.format;
35261                  if (!(".astc" !== l || i && i.getFormatFeatures(bs.ASTC_RGBA_4X4) & Is.SAMPLED_TEXTURE)) continue;
35262                  if (!(".pvr" !== l || i && i.getFormatFeatures(bs.PVRTC_RGBA4) & Is.SAMPLED_TEXTURE)) continue;
35263                  if (!(t !== Jp.RGB_ETC1 && t !== Jp.RGBA_ETC1 || i && i.getFormatFeatures(bs.ETC_RGB8) & Is.SAMPLED_TEXTURE)) continue;
35264                  if (!(t !== Jp.RGB_ETC2 && t !== Jp.RGBA_ETC2 || i && i.getFormatFeatures(bs.ETC2_RGB8) & Is.SAMPLED_TEXTURE)) continue;
35265                  if (".webp" === l && !Vo.hasFeature(Vo.Feature.WEBP)) continue;
35266                  n = h;
35267                  o = l;
35268                  r = t;
35269                }
35270              }
35271              if (o) {
35272                this._setRawAsset(o);
35273                this.format = r;
35274              } else N(3121);
35275            };
35276            m.ImageAsset = jsb.ImageAsset;
35277            const OC = IC.prototype;
35278            vh(OC, "_nativeAsset", Object.getOwnPropertyDescriptor(OC, "_nativeAsset"));
35279            Ul("cc.ImageAsset")(IC);
35280            const NC = jsb.Texture2D.prototype;
35281            NC.createNode = null;
35282            const LC = t("Texture2D", jsb.Texture2D);
35283            LC.Filter = Qp;
35284            LC.PixelFormat = Jp;
35285            LC.WrapMode = Zp;
35286            NC._ctor = function() {
35287              mA.prototype._ctor.apply(this, arguments);
35288              this._mipmaps = [];
35289            };
35290            NC._serialize = function(t) {
35291              return EDITOR || TEST ? {
35292                base: tm.prototype._serialize(t),
35293                mipmaps: this._mipmaps.map((e => e && e._uuid ? t && t._compressUuid ? EditorExtends.UuidUtils.compressUuid(e._uuid, !0) : e._uuid : null))
35294              } : null;
35295            };
35296            NC._deserialize = function(t, e) {
35297              const i = t;
35298              tm.prototype._deserialize.call(this, i.base);
35299              this._mipmaps = new Array(i.mipmaps.length);
35300              for (let t = 0; t < i.mipmaps.length; ++t) {
35301                this._mipmaps[t] = new IC;
35302                if (!i.mipmaps[t]) continue;
35303                const s = i.mipmaps[t];
35304                e.result.push(this._mipmaps, `${t}`, s, ee.getClassId(IC));
35305              }
35306            };
35307            const FC = NC.onLoaded;
35308            NC.onLoaded = function() {
35309              this.syncMipmapsForJS(this._mipmaps);
35310              FC.call(this);
35311            };
35312            Object.defineProperty(NC, "image", {
35313              configurable: !0,
35314              enumerable: !0,
35315              get() {
35316                return 0 === this._mipmaps.length ? null : this._mipmaps[0];
35317              },
35318              set(t) {
35319                this.mipmaps = t ? [ t ] : [];
35320              }
35321            });
35322            Object.defineProperty(NC, "mipmaps", {
35323              configurable: !0,
35324              enumerable: !0,
35325              get() {
35326                return this._mipmaps;
35327              },
35328              set(t) {
35329                for (let e = 0, i = t.length; e < i; ++e) t[e]._syncDataToNative();
35330                this._mipmaps = t;
35331                this.setMipmaps(t);
35332              }
35333            });
35334            m.Texture2D = jsb.Texture2D;
35335            const VC = LC.prototype;
35336            Th([ IC ])(VC, "_mipmaps");
35337            Ul("cc.Texture2D")(LC);
35338            let kC, UC, GC;
35339            const zC = 2;
35340            const HC = 1;
35341            const jC = 1, XC = 2, WC = 4, YC = 8;
35342            class qC {
35343              constructor(t, e) {
35344                this.source = void 0;
35345                this.target = void 0;
35346                this.source = t;
35347                this.target = e;
35348              }
35349              equals(t) {
35350                return this.source === t.source && this.target === t.target;
35351              }
35352            }
35353            class KC {
35354              constructor(t) {
35355                this.target = void 0;
35356                this.target = t;
35357              }
35358              equals(t) {
35359                return this.target === t.target;
35360              }
35361            }
35362            kC = Symbol.iterator;
35363            class JC {
35364              constructor(t, e) {
35365                this.iterator = void 0;
35366                this.source = void 0;
35367                this.iterator = t;
35368                this.source = e;
35369              }
35370              [kC]() {
35371                return this;
35372              }
35373              next() {
35374                const t = this.iterator.next();
35375                return t.done ? {
35376                  value: void 0,
35377                  done: !0
35378                } : {
35379                  value: new qC(this.source, t.value.target),
35380                  done: !1
35381                };
35382              }
35383            }
35384            UC = Symbol.iterator;
35385            class ZC {
35386              constructor(t, e) {
35387                this.iterator = void 0;
35388                this.source = void 0;
35389                this.iterator = t;
35390                this.source = e;
35391              }
35392              [UC]() {
35393                return this;
35394              }
35395              next() {
35396                const t = this.iterator.next();
35397                return t.done ? {
35398                  value: void 0,
35399                  done: !0
35400                } : {
35401                  value: new qC(t.value.target, this.source),
35402                  done: !1
35403                };
35404              }
35405            }
35406            GC = Symbol.iterator;
35407            class QC {
35408              constructor(t, e) {
35409                this.graph = void 0;
35410                this.iterator = void 0;
35411                this.graph = t;
35412                this.iterator = e;
35413              }
35414              [GC]() {
35415                return this;
35416              }
35417              next() {
35418                const t = this.iterator.next();
35419                return t.done ? {
35420                  value: void 0,
35421                  done: !0
35422                } : {
35423                  value: this.graph.target(t.value),
35424                  done: !1
35425                };
35426              }
35427            }
35428            function $C(t, e) {
35429              for (const i of t) i.target > e && --i.target;
35430            }
35431            function tx(t, e, i) {
35432              const s = t.nullVertex();
35433              const n = i.split("/");
35434              if (0 === n.length) return e;
35435              let r = e;
35436              let o = 0;
35437              if ("" === n[0]) {
35438                r = s;
35439                ++o;
35440              }
35441              for (let e = o; e !== n.length; ++e) {
35442                const i = n[e];
35443                if ("" !== i && "." !== i) if (".." !== i) {
35444                  r = t.locateChild(r, i);
35445                  if (r === s) return s;
35446                } else {
35447                  if (r === s) return s;
35448                  r = t.getParent(r);
35449                }
35450              }
35451              return r;
35452            }
35453            class ex {
35454              terminate(t, e) {
35455                return !1;
35456              }
35457            }
35458            function ix(t) {
35459              const e = t.vertices().next();
35460              return e.done ? t.nullVertex() : e.value;
35461            }
35462            let sx;
35463            !function(t) {
35464              t[t.WHITE = 0] = "WHITE";
35465              t[t.GRAY = 1] = "GRAY";
35466              t[t.GREEN = 2] = "GREEN";
35467              t[t.RED = 3] = "RED";
35468              t[t.BLACK = 4] = "BLACK";
35469            }(sx || (sx = {}));
35470            class nx {
35471              constructor(t, e, i) {
35472                this.v = void 0;
35473                this.e = void 0;
35474                this.iter = void 0;
35475                this.v = t;
35476                this.e = e;
35477                this.iter = i;
35478              }
35479            }
35480            function rx(t, e, i, s, n) {
35481              let r = null;
35482              let o = null;
35483              const a = new Array;
35484              s.put(e, sx.GRAY);
35485              i.discoverVertex(e, t);
35486              o = t.outEdges(e);
35487              n.terminate(e, t) ? a.push(new nx(e, null, null)) : a.push(new nx(e, null, o));
35488              for (;a.length; ) {
35489                const l = a.pop();
35490                e = l.v;
35491                r = l.e;
35492                o = l.iter;
35493                null !== r && i.finishEdge(r, t);
35494                if (o) for (let l = o.next(); !l.done; l = o.next()) {
35495                  const h = l.value;
35496                  const c = h.target;
35497                  i.examineEdge(h, t);
35498                  const u = s.get(c);
35499                  if (u === sx.WHITE) {
35500                    i.treeEdge(h, t);
35501                    r = h;
35502                    a.push(new nx(e, r, o));
35503                    e = c;
35504                    s.put(e, sx.GRAY);
35505                    i.discoverVertex(e, t);
35506                    o = t.outEdges(e);
35507                    if (n.terminate(e, t)) break;
35508                  } else {
35509                    u === sx.GRAY ? i.backEdge(h, t) : i.forwardOrCrossEdge(h, t);
35510                    i.finishEdge(h, t);
35511                  }
35512                }
35513                s.put(e, sx.BLACK);
35514                i.finishVertex(e, t);
35515              }
35516            }
35517            const ox = 0, ax = 1, lx = 2, hx = 3;
35518            const cx = 0, ux = 4;
35519            const _x = 0;
35520            const dx = 0, px = 1, mx = 3;
35521            const fx = 0, gx = 1, yx = 2, bx = 4, Sx = 8, Ax = 16, Tx = 32, vx = 64, Ex = 256, Cx = 512, xx = 1024;
35522            const wx = 0, Rx = 1;
35523            const Ix = 0, Mx = 2;
35524            class Bx {
35525              constructor(t = "", e = Mx, i = wx, s = Us.LOAD, n = Gs.STORE, r = en.ALL, o = new gn) {
35526                this.slotName = void 0;
35527                this.accessType = void 0;
35528                this.attachmentType = void 0;
35529                this.loadOp = void 0;
35530                this.storeOp = void 0;
35531                this.clearFlags = void 0;
35532                this.clearColor = void 0;
35533                this.slotName = t;
35534                this.accessType = e;
35535                this.attachmentType = i;
35536                this.loadOp = s;
35537                this.storeOp = n;
35538                this.clearFlags = r;
35539                this.clearColor = o;
35540              }
35541            }
35542            const Dx = 0;
35543            class Px {
35544              constructor() {
35545                this.name = "";
35546                this.accessType = Ix;
35547                this.clearFlags = en.NONE;
35548                this.clearColor = new gn;
35549                this.clearValueType = Dx;
35550              }
35551            }
35552            class Ox {
35553              constructor(t = null, e = 0) {
35554                this.light = void 0;
35555                this.level = void 0;
35556                this.light = t;
35557                this.level = e;
35558              }
35559            }
35560            const Nx = 0, Lx = 1, Fx = 2, Vx = 3, kx = 4, Ux = 5, Gx = 7, zx = 8;
35561            class Hx {
35562              constructor(t = As.UNKNOWN) {
35563                this.type = void 0;
35564                this.count = 1;
35565                this.type = t;
35566              }
35567            }
35568            class jx {
35569              constructor() {
35570                this.descriptors = new Map;
35571                this.uniformBlocks = new Map;
35572                this.capacity = 0;
35573                this.count = 0;
35574              }
35575            }
35576            class Xx {
35577              constructor() {
35578                this.descriptorNames = [];
35579                this.uniformBlockNames = [];
35580                this.descriptors = [];
35581                this.uniformBlocks = [];
35582                this.capacity = 0;
35583                this.count = 0;
35584              }
35585            }
35586            class Wx {
35587              constructor(t = ox, e = cx, i = Nx, s = ks.NONE) {
35588                this.updateFrequency = void 0;
35589                this.parameterType = void 0;
35590                this.descriptorType = void 0;
35591                this.visibility = void 0;
35592                this.updateFrequency = t;
35593                this.parameterType = e;
35594                this.descriptorType = i;
35595                this.visibility = s;
35596              }
35597            }
35598            class Yx {
35599              constructor() {
35600                this.blocks = new Map;
35601              }
35602            }
35603            class qx {
35604              constructor() {
35605                this.shaders = new Set;
35606              }
35607            }
35608            const Kx = 0, Jx = 1;
35609            class Zx {
35610              constructor(t, e) {
35611                this._outEdges = [];
35612                this._inEdges = [];
35613                this._id = void 0;
35614                this._object = void 0;
35615                this.id = t;
35616                this.object = e;
35617                this._id = t;
35618                this._object = e;
35619              }
35620            }
35621            class Qx {
35622              constructor(t) {
35623                this._names = void 0;
35624                this.names = t;
35625                this._names = t;
35626              }
35627              get(t) {
35628                return this._names[t];
35629              }
35630            }
35631            class $x {
35632              constructor(t) {
35633                this._descriptors = void 0;
35634                this.descriptors = t;
35635                this._descriptors = t;
35636              }
35637              get(t) {
35638                return this._descriptors[t];
35639              }
35640            }
35641            const tw = 0, ew = 1;
35642            class iw {
35643              constructor() {
35644                this.directed_category = zC;
35645                this.edge_parallel_category = HC;
35646                this.traversal_category = jC | XC | WC | YC;
35647                this.components = [ "Name", "Descriptors" ];
35648                this._vertices = [];
35649                this._names = [];
35650                this._descriptors = [];
35651              }
35652              nullVertex() {
35653                return 4294967295;
35654              }
35655              edge(t, e) {
35656                for (const i of this._vertices[t]._outEdges) if (e === i.target) return !0;
35657                return !1;
35658              }
35659              source(t) {
35660                return t.source;
35661              }
35662              target(t) {
35663                return t.target;
35664              }
35665              outEdges(t) {
35666                return new JC(this._vertices[t]._outEdges.values(), t);
35667              }
35668              outDegree(t) {
35669                return this._vertices[t]._outEdges.length;
35670              }
35671              inEdges(t) {
35672                return new ZC(this._vertices[t]._inEdges.values(), t);
35673              }
35674              inDegree(t) {
35675                return this._vertices[t]._inEdges.length;
35676              }
35677              degree(t) {
35678                return this.outDegree(t) + this.inDegree(t);
35679              }
35680              adjacentVertices(t) {
35681                return new QC(this, this.outEdges(t));
35682              }
35683              vertices() {
35684                return this._vertices.keys();
35685              }
35686              numVertices() {
35687                return this._vertices.length;
35688              }
35689              clear() {
35690                this._names.length = 0;
35691                this._descriptors.length = 0;
35692                this._vertices.length = 0;
35693              }
35694              addVertex(t, e, i, s, n = 4294967295) {
35695                const r = new Zx(t, e);
35696                const o = this._vertices.length;
35697                this._vertices.push(r);
35698                this._names.push(i);
35699                this._descriptors.push(s);
35700                4294967295 !== n && this.addEdge(n, o);
35701                return o;
35702              }
35703              clearVertex(t) {
35704                const e = this._vertices[t];
35705                for (const i of e._outEdges) {
35706                  const e = this._vertices[i.target];
35707                  for (let i = 0; i !== e._inEdges.length; ) e._inEdges[i].target === t ? e._inEdges.splice(i, 1) : ++i;
35708                }
35709                e._outEdges.length = 0;
35710                for (const i of e._inEdges) {
35711                  const e = this._vertices[i.target];
35712                  for (let i = 0; i !== e._outEdges.length; ) e._outEdges[i].target === t ? e._outEdges.splice(i, 1) : ++i;
35713                }
35714                e._inEdges.length = 0;
35715              }
35716              removeVertex(t) {
35717                this._vertices.splice(t, 1);
35718                this._names.splice(t, 1);
35719                this._descriptors.splice(t, 1);
35720                const e = this._vertices.length;
35721                if (t !== e) for (let i = 0; i !== e; ++i) {
35722                  const e = this._vertices[i];
35723                  $C(e._outEdges, t);
35724                  $C(e._inEdges, t);
35725                }
35726              }
35727              addEdge(t, e) {
35728                this._vertices[t]._outEdges.push(new KC(e));
35729                this._vertices[e]._inEdges.push(new KC(t));
35730                return new qC(t, e);
35731              }
35732              removeEdges(t, e) {
35733                const i = this._vertices[t];
35734                for (let t = 0; t !== i._outEdges.length; ) i._outEdges[t].target === e ? i._outEdges.splice(t, 1) : ++t;
35735                const s = this._vertices[e];
35736                for (let e = 0; e !== s._inEdges.length; ) s._inEdges[e].target === t ? s._inEdges.splice(e, 1) : ++e;
35737              }
35738              removeEdge(t) {
35739                const e = t.source;
35740                const i = t.target;
35741                const s = this._vertices[e];
35742                for (let t = 0; t !== s._outEdges.length; ) {
35743                  if (s._outEdges[t].target === i) {
35744                    s._outEdges.splice(t, 1);
35745                    break;
35746                  }
35747                  ++t;
35748                }
35749                const n = this._vertices[i];
35750                for (let t = 0; t !== n._inEdges.length; ) {
35751                  if (n._inEdges[t].target === e) {
35752                    n._inEdges.splice(t, 1);
35753                    break;
35754                  }
35755                  ++t;
35756                }
35757              }
35758              vertexName(t) {
35759                return this._names[t];
35760              }
35761              vertexNameMap() {
35762                return new Qx(this._names);
35763              }
35764              get(t) {
35765                switch (t) {
35766                 case "Name":
35767                  return new Qx(this._names);
35768
35769                 case "Descriptors":
35770                  return new $x(this._descriptors);
35771
35772                 default:
35773                  throw Error("property map not found");
35774                }
35775              }
35776              component(t, e) {
35777                switch (t) {
35778                 case tw:
35779                  return this._names[e];
35780
35781                 case ew:
35782                  return this._descriptors[e];
35783
35784                 default:
35785                  throw Error("component not found");
35786                }
35787              }
35788              componentMap(t) {
35789                switch (t) {
35790                 case tw:
35791                  return new Qx(this._names);
35792
35793                 case ew:
35794                  return new $x(this._descriptors);
35795
35796                 default:
35797                  throw Error("component map not found");
35798                }
35799              }
35800              getName(t) {
35801                return this._names[t];
35802              }
35803              getDescriptors(t) {
35804                return this._descriptors[t];
35805              }
35806              holds(t, e) {
35807                return this._vertices[e]._id === t;
35808              }
35809              id(t) {
35810                return this._vertices[t]._id;
35811              }
35812              object(t) {
35813                return this._vertices[t]._object;
35814              }
35815              value(t, e) {
35816                if (this._vertices[e]._id === t) return this._vertices[e]._object;
35817                throw Error("value id not match");
35818              }
35819              tryValue(t, e) {
35820                return this._vertices[e]._id === t ? this._vertices[e]._object : null;
35821              }
35822              visitVertex(t, e) {
35823                const i = this._vertices[e];
35824                switch (i._id) {
35825                 case Kx:
35826                  return t.renderStage(i._object);
35827
35828                 case Jx:
35829                  return t.renderPhase(i._object);
35830
35831                 default:
35832                  throw Error("polymorphic type not found");
35833                }
35834              }
35835              getRenderStage(t) {
35836                if (this._vertices[t]._id === Kx) return this._vertices[t]._object;
35837                throw Error("value id not match");
35838              }
35839              getRenderPhase(t) {
35840                if (this._vertices[t]._id === Jx) return this._vertices[t]._object;
35841                throw Error("value id not match");
35842              }
35843              tryGetRenderStage(t) {
35844                return this._vertices[t]._id === Kx ? this._vertices[t]._object : null;
35845              }
35846              tryGetRenderPhase(t) {
35847                return this._vertices[t]._id === Jx ? this._vertices[t]._object : null;
35848              }
35849              reference(t, e) {
35850                for (const i of this._vertices[t]._outEdges) if (e === i.target) return !0;
35851                return !1;
35852              }
35853              parent(t) {
35854                return t.source;
35855              }
35856              child(t) {
35857                return t.target;
35858              }
35859              parents(t) {
35860                return new ZC(this._vertices[t]._inEdges.values(), t);
35861              }
35862              children(t) {
35863                return new JC(this._vertices[t]._outEdges.values(), t);
35864              }
35865              numParents(t) {
35866                return this._vertices[t]._inEdges.length;
35867              }
35868              numChildren(t) {
35869                return this._vertices[t]._outEdges.length;
35870              }
35871              getParent(t) {
35872                if (4294967295 === t) return 4294967295;
35873                const e = this._vertices[t]._inEdges;
35874                return 0 === e.length ? 4294967295 : e[0].target;
35875              }
35876              isAncestor(t, e) {
35877                const i = 4294967295;
35878                if (t === e) return !1;
35879                if (t === i) return !0;
35880                if (e === i) return !1;
35881                for (let s = this.getParent(e); s !== i; ) {
35882                  if (t === s) return !0;
35883                  s = this.getParent(s);
35884                }
35885                return !1;
35886              }
35887              addReference(t, e) {
35888                return this.addEdge(t, e);
35889              }
35890              removeReference(t) {
35891                return this.removeEdge(t);
35892              }
35893              removeReferences(t, e) {
35894                return this.removeEdges(t, e);
35895              }
35896              locateChild(t, e) {
35897                if (4294967295 === t) {
35898                  for (const t of this._vertices.keys()) {
35899                    if (0 === this._vertices[t]._inEdges.length && this._names[t] === e) return t;
35900                  }
35901                  return 4294967295;
35902                }
35903                for (const i of this._vertices[t]._outEdges) {
35904                  const t = i.target;
35905                  if (e === this._names[t]) return t;
35906                }
35907                return 4294967295;
35908              }
35909              addressable(t) {
35910                return 4294967295 !== tx(this, 4294967295, t);
35911              }
35912              locate(t) {
35913                return tx(this, 4294967295, t);
35914              }
35915              locateRelative(t, e = 4294967295) {
35916                return tx(this, e, t);
35917              }
35918              path(t) {
35919                return function(t, e) {
35920                  if (e === t.nullVertex()) return "";
35921                  const i = [];
35922                  for (;e !== t.nullVertex(); e = t.getParent(e)) i.push(t.vertexName(e));
35923                  let s = "";
35924                  for (let t = i.length; t-- > 0; ) {
35925                    s += "/";
35926                    s += i[t];
35927                  }
35928                  return s;
35929                }(this, t);
35930              }
35931            }
35932            class sw {
35933              constructor() {
35934                this.uniformBlockIndex = void 0;
35935                this.blockMerged = void 0;
35936                this.dbsToMerge = void 0;
35937                this._layoutGraph = void 0;
35938                this._layoutGraph = new iw;
35939                this.uniformBlockIndex = new Map;
35940                this.blockMerged = new Map;
35941                this.dbsToMerge = new Map;
35942              }
35943              getLayoutBlock(t, e, i, s, n) {
35944                const r = new Wx(t, e, i, s);
35945                const o = JSON.stringify(r);
35946                if (void 0 === n.blocks.get(o)) {
35947                  const t = new jx;
35948                  n.blocks.set(o, t);
35949                  this.uniformBlockIndex.set(t, r);
35950                }
35951                return n.blocks.get(o);
35952              }
35953              getLayoutBlockByKey(t, e) {
35954                if (void 0 === e.blocks.get(t)) {
35955                  const i = new jx;
35956                  e.blocks.set(t, i);
35957                  const s = JSON.parse(t);
35958                  this.uniformBlockIndex.set(i, s);
35959                }
35960                return e.blocks.get(t);
35961              }
35962              getUniformBlock(t, e, i, s) {
35963                if (void 0 === s.uniformBlocks.get(i)) {
35964                  const n = new Mn(t, e, i, [], 1);
35965                  s.uniformBlocks.set(i, n);
35966                }
35967                return s.uniformBlocks.get(i);
35968              }
35969              setUniform(t, e, i, s) {
35970                const n = new In(e, i, s);
35971                t.members.push(n);
35972              }
35973              setDescriptor(t, e, i) {
35974                const s = new Hx(i);
35975                t.descriptors.set(e, s);
35976              }
35977              merge(t) {
35978                for (const i of t.blocks) {
35979                  const t = i[1];
35980                  const s = new Map;
35981                  for (const e of t.descriptors) {
35982                    const i = e[1].type;
35983                    if (void 0 === s.get(i)) s.set(i, 1); else {
35984                      const t = s.get(i);
35985                      s.set(i, t + 1);
35986                    }
35987                    t.capacity++;
35988                  }
35989                  for (const i of s) {
35990                    const s = i[0];
35991                    const n = i[1];
35992                    if (n > 0) {
35993                      var e;
35994                      const i = new Hx(s);
35995                      i.count = n;
35996                      let r;
35997                      if (void 0 === this.blockMerged.get(t)) {
35998                        r = new Map;
35999                        this.blockMerged.set(t, r);
36000                      }
36001                      null === (e = this.blockMerged.get(t)) || void 0 === e || e.set(s, i);
36002                    }
36003                  }
36004                }
36005              }
36006              mergeDBs(t, e) {
36007                for (let i = 0; i < t.length; ++i) {
36008                  const s = t[i];
36009                  for (const t of s.blocks) {
36010                    const i = t[0];
36011                    const s = t[1];
36012                    let n;
36013                    if (void 0 === this.blockMerged.get(s)) {
36014                      n = new Map;
36015                      this.blockMerged.set(s, n);
36016                    } else n = this.blockMerged.get(s);
36017                    if (n.size > 0) {
36018                      const t = this.getLayoutBlockByKey(i, e);
36019                      let r;
36020                      if (void 0 === this.blockMerged.get(t)) {
36021                        r = new Map;
36022                        this.blockMerged.set(t, r);
36023                      } else r = this.blockMerged.get(t);
36024                      for (const t of n) {
36025                        const e = t[0];
36026                        const i = t[1];
36027                        if (r.has(e)) {
36028                          const t = r.get(e);
36029                          void 0 !== t && (t.count = t.count > i.count ? t.count : i.count);
36030                        } else {
36031                          const t = new Hx(i.type);
36032                          t.count = i.count;
36033                          r.set(e, t);
36034                        }
36035                      }
36036                      t.capacity = s.capacity > t.capacity ? s.capacity : t.capacity;
36037                    }
36038                  }
36039                }
36040              }
36041              sort(t) {
36042                const e = new Map(Array.from(t.blocks).sort(((t, e) => String(t[0]).localeCompare(e[0]))));
36043                t.blocks.clear();
36044                for (const i of e) t.blocks.set(i[0], i[1]);
36045              }
36046              addEffect(t, e) {
36047                const i = t.shaders.length;
36048                for (let n = 0; n !== i; ++n) {
36049                  var s;
36050                  const i = t.shaders[n];
36051                  const r = new Yx;
36052                  for (let t = 0; t < i.blocks.length; ++t) {
36053                    const e = i.blocks[t];
36054                    const s = this.getLayoutBlock(ox, ux, Nx, e.stageFlags, r);
36055                    const n = this.getUniformBlock(wm.MATERIAL, e.binding, e.name, s);
36056                    for (let t = 0; t < e.members.length; ++t) {
36057                      const i = e.members[t];
36058                      n.members.push(i);
36059                    }
36060                  }
36061                  for (let t = 0; t < i.buffers.length; ++t) {
36062                    const e = i.buffers[t];
36063                    const s = this.getLayoutBlock(ax, ux, Ux, e.stageFlags, r);
36064                    this.setDescriptor(s, e.name, As.UNKNOWN);
36065                  }
36066                  for (let t = 0; t < i.images.length; ++t) {
36067                    const e = i.images[t];
36068                    const s = this.getLayoutBlock(ax, ux, Gx, e.stageFlags, r);
36069                    this.setDescriptor(s, e.name, e.type);
36070                  }
36071                  for (let t = 0; t < i.samplerTextures.length; ++t) {
36072                    const e = i.samplerTextures[t];
36073                    const s = this.getLayoutBlock(ax, ux, Fx, e.stageFlags, r);
36074                    this.setDescriptor(s, e.name, e.type);
36075                  }
36076                  for (let t = 0; t < i.samplers.length; ++t) {
36077                    const e = i.samplers[t];
36078                    const s = this.getLayoutBlock(ax, ux, Vx, e.stageFlags, r);
36079                    this.setDescriptor(s, e.name, As.SAMPLER);
36080                  }
36081                  for (let t = 0; t < i.textures.length; ++t) {
36082                    const e = i.textures[t];
36083                    const s = this.getLayoutBlock(ax, ux, kx, e.stageFlags, r);
36084                    this.setDescriptor(s, e.name, e.type);
36085                  }
36086                  for (let t = 0; t < i.subpassInputs.length; ++t) {
36087                    const e = i.subpassInputs[t];
36088                    const s = this.getLayoutBlock(ax, ux, zx, e.stageFlags, r);
36089                    this.setDescriptor(s, e.name, As.SUBPASS_INPUT);
36090                  }
36091                  const o = this.getLayoutBlock(ox, ux, Nx, ks.VERTEX, r);
36092                  const a = this.getLayoutBlock(ax, ux, Lx, ks.FRAGMENT, r);
36093                  const l = this.getLayoutBlock(ox, ux, Lx, ks.VERTEX, r);
36094                  const h = this.getLayoutBlock(ox, ux, Nx, ks.VERTEX | ks.COMPUTE, r);
36095                  const c = this.getLayoutBlock(ax, ux, Fx, ks.VERTEX, r);
36096                  const u = this.getLayoutBlock(ax, ux, Fx, ks.FRAGMENT, r);
36097                  const _ = this.getLayoutBlock(ax, ux, Fx, ks.COMPUTE, r);
36098                  for (let t = 0; t < i.builtins.locals.blocks.length; ++t) {
36099                    const e = i.builtins.locals.blocks[t].name;
36100                    if ("CCMorph" === e) {
36101                      const t = this.getUniformBlock(wm.LOCAL, nf.BINDING, "CCMorph", o);
36102                      this.setUniform(t, "cc_displacementWeights", As.FLOAT4, nf.MAX_MORPH_TARGET_COUNT / 4);
36103                      this.setUniform(t, "cc_displacementTextureInfo", As.FLOAT4, 1);
36104                    } else if ("CCSkinningTexture" === e) {
36105                      const t = this.getUniformBlock(wm.LOCAL, tf.BINDING, "CCSkinningTexture", o);
36106                      this.setUniform(t, "cc_jointTextureInfo", As.FLOAT4, 1);
36107                    } else if ("CCSkinningAnimation" === e) {
36108                      const t = this.getUniformBlock(wm.LOCAL, ef.BINDING, "CCSkinningAnimation", o);
36109                      this.setUniform(t, "cc_jointAnimInfo", As.FLOAT4, 1);
36110                    } else if ("CCSkinning" === e) {
36111                      const t = this.getUniformBlock(wm.LOCAL, sf.BINDING, "CCSkinning", o);
36112                      this.setUniform(t, "cc_joints", As.FLOAT4, 90);
36113                    } else if ("CCUILocal" === e) {
36114                      const t = this.getUniformBlock(wm.LOCAL, rf.BINDING, "CCUILocal", l);
36115                      this.setUniform(t, "cc_local_data", As.FLOAT4, 1);
36116                    } else if ("CCForwardLight" === e) {
36117                      const t = this.getUniformBlock(wm.LOCAL, Qm.BINDING, "CCForwardLight", a);
36118                      this.setUniform(t, "cc_lightPos", As.FLOAT4, Qm.LIGHTS_PER_PASS);
36119                      this.setUniform(t, "cc_lightColor", As.FLOAT4, Qm.LIGHTS_PER_PASS);
36120                      this.setUniform(t, "cc_lightSizeRangeAngle", As.FLOAT4, Qm.LIGHTS_PER_PASS);
36121                      this.setUniform(t, "cc_lightDir", As.FLOAT4, Qm.LIGHTS_PER_PASS);
36122                    } else if ("CCLocal" === e) {
36123                      const t = this.getUniformBlock(wm.LOCAL, Km.BINDING, "CCLocal", h);
36124                      this.setUniform(t, "cc_matWorld", As.MAT4, 1);
36125                      this.setUniform(t, "cc_matWorldIT", As.MAT4, 1);
36126                      this.setUniform(t, "cc_lightingMapUVParam", As.FLOAT4, 1);
36127                    } else if ("CCLocalBatched" === e) {
36128                      const t = this.getUniformBlock(wm.LOCAL, Zm.BINDING, "CCLocalBatched", h);
36129                      this.setUniform(t, "cc_matWorlds", As.MAT4, Zm.BATCHING_COUNT);
36130                    } else if ("CCWorldBound" === e) {
36131                      const t = this.getUniformBlock(wm.LOCAL, Jm.BINDING, "CCWorldBound", h);
36132                      this.setUniform(t, "cc_worldBoundCenter", As.FLOAT4, 1);
36133                      this.setUniform(t, "cc_worldBoundHalfExtents", As.FLOAT4, 1);
36134                    }
36135                  }
36136                  for (let t = 0; t < i.builtins.locals.samplerTextures.length; ++t) {
36137                    const e = i.builtins.locals.samplerTextures[t].name;
36138                    "cc_jointTexture" === e ? this.setDescriptor(c, "cc_jointTexture", As.SAMPLER2D) : "cc_PositionDisplacements" === e ? this.setDescriptor(c, "cc_PositionDisplacements", As.SAMPLER2D) : "cc_NormalDisplacements" === e ? this.setDescriptor(c, "cc_NormalDisplacements", As.SAMPLER2D) : "cc_TangentDisplacements" === e ? this.setDescriptor(c, "cc_TangentDisplacements", As.SAMPLER2D) : "cc_lightingMap" === e ? this.setDescriptor(u, "cc_lightingMap", As.SAMPLER2D) : "cc_spriteTexture" === e ? this.setDescriptor(u, "cc_spriteTexture", As.SAMPLER2D) : "cc_reflectionTexture" === e && this.setDescriptor(u, "cc_reflectionTexture", As.SAMPLER2D);
36139                  }
36140                  for (let t = 0; t < i.builtins.locals.images.length; ++t) {
36141                    "cc_reflectionStorage" === i.builtins.locals.images[t].name && this.setDescriptor(_, "cc_reflectionStorage", As.IMAGE2D);
36142                  }
36143                  const d = new qx;
36144                  d.shaders.add(i.name);
36145                  this._layoutGraph.addVertex(Jx, d, i.name, r, e);
36146                  this.merge(r);
36147                  this.sort(r);
36148                  const p = this._layoutGraph.getDescriptors(e);
36149                  void 0 === this.dbsToMerge.get(p) && this.dbsToMerge.set(p, []);
36150                  null === (s = this.dbsToMerge.get(p)) || void 0 === s || s.push(r);
36151                }
36152              }
36153              addGlobal(t, e, i, s, n, r, o, a) {
36154                const l = new Yx;
36155                const h = this.getLayoutBlock(hx, ux, Nx, ks.ALL, l);
36156                const c = this.getLayoutBlock(hx, ux, Fx, ks.FRAGMENT, l);
36157                if (e) {
36158                  const t = this.getUniformBlock(wm.GLOBAL, Im.BINDING, "CCGlobal", h);
36159                  this.setUniform(t, "cc_time", As.FLOAT4, 1);
36160                  this.setUniform(t, "cc_screenSize", As.FLOAT4, 1);
36161                  this.setUniform(t, "cc_nativeSize", As.FLOAT4, 1);
36162                  this.setDescriptor(h, "CCGlobal", As.UNKNOWN);
36163                }
36164                if (i) {
36165                  const t = this.getUniformBlock(wm.GLOBAL, Mm.BINDING, "CCCamera", h);
36166                  this.setUniform(t, "cc_matView", As.MAT4, 1);
36167                  this.setUniform(t, "cc_matViewInv", As.MAT4, 1);
36168                  this.setUniform(t, "cc_matProj", As.MAT4, 1);
36169                  this.setUniform(t, "cc_matProjInv", As.MAT4, 1);
36170                  this.setUniform(t, "cc_matViewProj", As.MAT4, 1);
36171                  this.setUniform(t, "cc_matViewProjInv", As.MAT4, 1);
36172                  this.setUniform(t, "cc_cameraPos", As.FLOAT4, 1);
36173                  this.setUniform(t, "cc_surfaceTransform", As.FLOAT4, 1);
36174                  this.setUniform(t, "cc_screenScale", As.FLOAT4, 1);
36175                  this.setUniform(t, "cc_exposure", As.FLOAT4, 1);
36176                  this.setUniform(t, "cc_mainLitDir", As.FLOAT4, 1);
36177                  this.setUniform(t, "cc_mainLitColor", As.FLOAT4, 1);
36178                  this.setUniform(t, "cc_ambientSky", As.FLOAT4, 1);
36179                  this.setUniform(t, "cc_ambientGround", As.FLOAT4, 1);
36180                  this.setUniform(t, "cc_fogColor", As.FLOAT4, 1);
36181                  this.setUniform(t, "cc_fogBase", As.FLOAT4, 1);
36182                  this.setUniform(t, "cc_fogAdd", As.FLOAT4, 1);
36183                  this.setUniform(t, "cc_nearFar", As.FLOAT4, 1);
36184                  this.setUniform(t, "cc_viewPort", As.FLOAT4, 1);
36185                  this.setDescriptor(h, "CCCamera", As.UNKNOWN);
36186                }
36187                if (s) {
36188                  const t = this.getUniformBlock(wm.GLOBAL, Bm.BINDING, "CCShadow", h);
36189                  this.setUniform(t, "cc_matLightView", As.MAT4, 1);
36190                  this.setUniform(t, "cc_matLightViewProj", As.MAT4, 1);
36191                  this.setUniform(t, "cc_shadowInvProjDepthInfo", As.FLOAT4, 1);
36192                  this.setUniform(t, "cc_shadowProjDepthInfo", As.FLOAT4, 1);
36193                  this.setUniform(t, "cc_shadowProjInfo", As.FLOAT4, 1);
36194                  this.setUniform(t, "cc_shadowNFLSInfo", As.FLOAT4, 1);
36195                  this.setUniform(t, "cc_shadowWHPBInfo", As.FLOAT4, 1);
36196                  this.setUniform(t, "cc_shadowLPNNInfo", As.FLOAT4, 1);
36197                  this.setUniform(t, "cc_shadowColor", As.FLOAT4, 1);
36198                  this.setUniform(t, "cc_planarNDInfo", As.FLOAT4, 1);
36199                  this.setDescriptor(h, "CCShadow", As.UNKNOWN);
36200                }
36201                n && this.setDescriptor(c, "cc_shadowMap", As.SAMPLER2D);
36202                r && this.setDescriptor(c, "cc_environment", As.SAMPLER_CUBE);
36203                o && this.setDescriptor(c, "cc_diffuseMap", As.SAMPLER_CUBE);
36204                a && this.setDescriptor(c, "cc_spotShadowMap", As.SAMPLER2D);
36205                this.merge(l);
36206                return this._layoutGraph.addVertex(Kx, fm.DEFAULT, t, l);
36207              }
36208              mergeDescriptors(t) {
36209                const e = this._layoutGraph.getDescriptors(t);
36210                const i = this.dbsToMerge.get(e);
36211                if (void 0 !== i) {
36212                  this.mergeDBs(i, e);
36213                  this.sort(e);
36214                }
36215              }
36216              addRenderStage(t, e) {
36217                const i = new Yx;
36218                return this._layoutGraph.addVertex(Kx, e, t, i);
36219              }
36220              addRenderPhase(t, e) {
36221                const i = new Yx;
36222                return this._layoutGraph.addVertex(Jx, new qx, t, i, e);
36223              }
36224              get layoutGraph() {
36225                return this._layoutGraph;
36226              }
36227            }
36228            class nw extends class {
36229              initializeVertex(t, e) {}
36230              startVertex(t, e) {}
36231              discoverVertex(t, e) {}
36232              examineEdge(t, e) {}
36233              treeEdge(t, e) {}
36234              backEdge(t, e) {}
36235              forwardOrCrossEdge(t, e) {}
36236              finishEdge(t, e) {}
36237              finishVertex(t, e) {}
36238            } {
36239              constructor(...t) {
36240                super(...t);
36241                this._error = "";
36242              }
36243              getFrequency(t, e) {
36244                let i;
36245                i = t.holds(Kx, e) ? hx : lx;
36246                return i;
36247              }
36248              mergeDescriptors(t, e) {
36249                for (const [n, r] of t.descriptors) {
36250                  const t = e.descriptors.get(n);
36251                  if (void 0 !== t) {
36252                    if (!(i = r, s = t, i.type === s.type && i.count === s.count)) return `Descriptor ${n} is inconsistent`;
36253                  } else e.descriptors.set(n, r);
36254                }
36255                var i, s;
36256                return "";
36257              }
36258              mergeParent(t, e, i) {
36259                for (const [s, n] of e.blocks) {
36260                  let e = i.blocks.get(s);
36261                  if (void 0 === e) {
36262                    e = new jx;
36263                    i.blocks.set(s, e);
36264                  }
36265                  if (JSON.parse(s).updateFrequency > t) {
36266                    const t = this.mergeDescriptors(n, e);
36267                    if (t) return t;
36268                  }
36269                }
36270                return "";
36271              }
36272              updateInfo(t, e) {
36273                e.blocks.forEach(((e, i) => {
36274                  if (JSON.parse(i).updateFrequency >= t) {
36275                    e.count = function(t) {
36276                      let e = 0;
36277                      for (const [, i] of t.descriptors) e += i.count;
36278                      return e;
36279                    }(e);
36280                    e.capacity = e.count;
36281                  }
36282                }));
36283              }
36284              backEdge(t, e) {
36285                this._error = "Cycle detected in graph";
36286              }
36287              finishEdge(t, e) {
36288                if ("" !== this._error) return;
36289                const i = e.source(t);
36290                const s = e.target(t);
36291                const n = e.getDescriptors(i);
36292                const r = e.getDescriptors(s);
36293                const o = this.getFrequency(e, s);
36294                this.mergeParent(o, r, n);
36295              }
36296              finishVertex(t, e) {
36297                if ("" !== this._error) return;
36298                const i = this.getFrequency(e, t);
36299                const s = e.getDescriptors(t);
36300                this.updateInfo(i, s);
36301              }
36302              get error() {
36303                return this._error;
36304              }
36305            }
36306            function rw(t, e) {
36307              t.descriptors.forEach(((t, i) => {
36308                const s = i;
36309                const n = t;
36310                e.descriptorNames.push(s);
36311                e.descriptors.push(n);
36312              }));
36313              t.uniformBlocks.forEach(((t, i) => {
36314                const s = i;
36315                const n = t;
36316                e.uniformBlockNames.push(s);
36317                e.uniformBlocks.push(n);
36318              }));
36319              e.count = t.count;
36320              e.capacity = t.capacity;
36321            }
36322            function ow(t, e) {
36323              for (const i of t.vertices()) {
36324                const s = t.getDescriptors(i);
36325                let n = 0;
36326                t.id(i) === Kx && (n = e.addRenderStage(t.getName(i)));
36327                if (t.id(i) === Jx) {
36328                  n = e.addRenderPhase(t.getName(i), t.getParent(i));
36329                  const s = t.getRenderPhase(n);
36330                  for (const t of s.shaders) e.addShader(t, n);
36331                }
36332                s.blocks.forEach(((t, i) => {
36333                  const s = JSON.parse(i);
36334                  const r = t;
36335                  const o = new Xx;
36336                  rw(r, o);
36337                  r.capacity > 0 && e.addDescriptorBlock(n, s, o);
36338                  for (let t = 0; t < o.uniformBlockNames.length; ++t) e.addUniformBlock(n, s, o.uniformBlockNames[t], o.uniformBlocks[t]);
36339                }));
36340              }
36341            }
36342            var aw;
36343            !function(t) {
36344              t[t.GEOMETRY = 0] = "GEOMETRY";
36345              t[t.LIGHTING = 1] = "LIGHTING";
36346              t[t.POST = 2] = "POST";
36347            }(aw || (aw = {}));
36348            class lw {
36349              constructor(t) {
36350                this.colors = void 0;
36351                this.colors = new Array(t);
36352              }
36353              get(t) {
36354                return this.colors[t];
36355              }
36356              put(t, e) {
36357                this.colors[t] = e;
36358              }
36359            }
36360            function hw(t) {
36361              const e = new sw;
36362              const i = e.addGlobal("default", !0, !0, !0, !0, !0, !0, !0);
36363              e.mergeDescriptors(i);
36364              const s = e.addRenderStage("Geometry", aw.GEOMETRY);
36365              const n = e.addRenderStage("Lighting", aw.LIGHTING);
36366              const r = e.addRenderStage("Postprocess", aw.POST);
36367              e.addRenderPhase("Queue", s);
36368              const o = e.addRenderPhase("Queue", n);
36369              e.addRenderPhase("Queue", r);
36370              const a = e.layoutGraph.getDescriptors(o);
36371              const l = e.getLayoutBlock(hx, ux, Fx, ks.FRAGMENT, a);
36372              e.setDescriptor(l, "gbuffer_albedoMap", As.FLOAT4);
36373              e.setDescriptor(l, "gbuffer_normalMap", As.FLOAT4);
36374              e.setDescriptor(l, "gbuffer_emissiveMap", As.FLOAT4);
36375              e.setDescriptor(l, "depth_stencil", As.FLOAT4);
36376              const h = new nw;
36377              const c = new lw(e.layoutGraph.numVertices());
36378              !function(t, e, i, s = null) {
36379                if (null === (s = s || ix(t)) || 0 === t.numVertices()) return;
36380                for (const s of t.vertices()) {
36381                  i.put(s, sx.WHITE);
36382                  e.initializeVertex(s, t);
36383                }
36384                const n = new ex;
36385                if (s !== ix(t)) {
36386                  e.startVertex(s, t);
36387                  rx(t, s, e, i, n);
36388                }
36389                for (const s of t.vertices()) if (i.get(s) === sx.WHITE) {
36390                  e.startVertex(s, t);
36391                  rx(t, s, e, i, n);
36392                }
36393              }(e.layoutGraph, h, c);
36394              e.mergeDescriptors(n);
36395              const u = e.layoutGraph.getDescriptors(r);
36396              const _ = e.getLayoutBlock(hx, ux, Fx, ks.FRAGMENT, u);
36397              e.setDescriptor(_, "outputResultMap", As.FLOAT4);
36398              e.merge(u);
36399              e.mergeDescriptors(r);
36400              h.error && console.log(h.error);
36401              const d = t.layoutGraphBuilder;
36402              d.clear();
36403              ow(e.layoutGraph, d);
36404            }
36405            const cw = t("Root", jsb.Root);
36406            var uw;
36407            !function(t) {
36408              t[t.DIRECTIONAL = 0] = "DIRECTIONAL";
36409              t[t.SPHERE = 1] = "SPHERE";
36410              t[t.SPOT = 2] = "SPOT";
36411              t[t.UNKNOWN = 3] = "UNKNOWN";
36412            }(uw || (uw = {}));
36413            const _w = cw.prototype;
36414            _w._createBatcher2D = function() {
36415              if (!this._batcher && m.internal.Batcher2D) {
36416                this._batcher = new m.internal.Batcher2D(this);
36417                if (!this._batcher.initialize()) {
36418                  this._batcher = null;
36419                  this.destroy();
36420                  return;
36421                }
36422                this._batcher._nativeObj = this.getBatcher2D();
36423              }
36424            };
36425            Object.defineProperty(_w, "batcher2D", {
36426              configurable: !0,
36427              enumerable: !0,
36428              get() {
36429                return this._batcher;
36430              }
36431            });
36432            Object.defineProperty(_w, "dataPoolManager", {
36433              configurable: !0,
36434              enumerable: !0,
36435              get() {
36436                return this._dataPoolMgr;
36437              }
36438            });
36439            Object.defineProperty(_w, "pipelineEvent", {
36440              configurable: !0,
36441              enumerable: !0,
36442              get() {
36443                return this._pipelineEvent;
36444              }
36445            });
36446            Object.defineProperty(_w, "debugView", {
36447              configurable: !0,
36448              enumerable: !0,
36449              get() {
36450                return this._debugView;
36451              }
36452            });
36453            class dw {
36454              on(t, e, i, s) {}
36455              once(t, e, i) {}
36456              off(t, e, i) {}
36457              emit(t, e, i, s, n, r) {}
36458              targetOff(t) {}
36459              removeAll(t) {}
36460              hasEventListener(t, e, i) {
36461                return !1;
36462              }
36463            }
36464            _w._ctor = function(t) {
36465              this._device = t;
36466              this._dataPoolMgr = m.internal.DataPoolManager && new m.internal.DataPoolManager(t);
36467              this._modelPools = new Map;
36468              this._lightPools = new Map;
36469              this._batcher = null;
36470              this._pipelineEvent = new dw;
36471              this._debugView = new Ng;
36472              this.setDebugViewConfig(this._debugView._nativeConfig);
36473              this._registerListeners();
36474            };
36475            _w.initialize = function(t) {
36476              var e;
36477              this._initialize(zo.swapchain);
36478              const i = de.querySettings(_e.Category.ANIMATION, "customJointTextureLayouts") || [];
36479              null === (e = this._dataPoolMgr) || void 0 === e || e.jointTexturePool.registerCustomTextureLayouts(i);
36480            };
36481            _w.createModel = function(t) {
36482              let e = this._modelPools.get(t);
36483              if (!e) {
36484                this._modelPools.set(t, new $r((() => new t), 10, (t => t.destroy())));
36485                e = this._modelPools.get(t);
36486              }
36487              const i = e.alloc();
36488              i.initialize();
36489              return i;
36490            };
36491            _w.removeModel = function(t) {
36492              const e = this._modelPools.get(t.constructor);
36493              if (e) {
36494                e.free(t);
36495                t.destroy();
36496                t.scene && t.scene.removeModel(t);
36497              } else N(1300, t.constructor.name);
36498            };
36499            _w.createLight = function(t) {
36500              let e = this._lightPools.get(t);
36501              if (!e) {
36502                this._lightPools.set(t, new $r((() => new t), 4, (t => t.destroy())));
36503                e = this._lightPools.get(t);
36504              }
36505              const i = e.alloc();
36506              i.initialize();
36507              return i;
36508            };
36509            _w.destroyLight = function(t) {
36510              if (t.scene) switch (t.type) {
36511               case uw.DIRECTIONAL:
36512                t.scene.removeDirectionalLight(t);
36513                break;
36514
36515               case uw.SPHERE:
36516                t.scene.removeSphereLight(t);
36517                break;
36518
36519               case uw.SPOT:
36520                t.scene.removeSpotLight(t);
36521              }
36522              t.destroy();
36523            };
36524            _w.recycleLight = function(t) {
36525              const e = this._lightPools.get(t.constructor);
36526              if (e) {
36527                e.free(t);
36528                if (t.scene) switch (t.type) {
36529                 case uw.DIRECTIONAL:
36530                  t.scene.removeDirectionalLight(t);
36531                  break;
36532
36533                 case uw.SPHERE:
36534                  t.scene.removeSphereLight(t);
36535                  break;
36536
36537                 case uw.SPOT:
36538                  t.scene.removeSpotLight(t);
36539                }
36540              }
36541            };
36542            _w._onDirectorBeforeCommit = function() {
36543              m.director.emit(m.Director.EVENT_BEFORE_COMMIT);
36544            };
36545            const pw = _w.frameMove;
36546            _w.frameMove = function(t) {
36547              pw.call(this, t, m.director.getTotalFrames());
36548            };
36549            const mw = _w.setRenderPipeline;
36550            _w.setRenderPipeline = function(t) {
36551              let e;
36552              if (this.usesCustomPipeline) {
36553                const t = mw.call(this, null);
36554                const e = this.customPipeline;
36555                this.useDeferredPipeline ? hw(e) : function(t) {
36556                  const e = new sw;
36557                  {
36558                    const t = e.addGlobal("default", !0, !0, !0, !0, !0, !0, !0);
36559                    e.mergeDescriptors(t);
36560                  }
36561                  const i = t.layoutGraphBuilder;
36562                  i.clear();
36563                  ow(e.layoutGraph, i);
36564                }(e);
36565                e.layoutGraphBuilder.compile();
36566                return t;
36567              }
36568              t || (t = new nr.ForwardPipeline).init();
36569              e = mw.call(this, t);
36570              this._createBatcher2D();
36571              return e;
36572            };
36573            _w.addBatch = function(t) {
36574              console.error("The Draw Batch class is implemented differently in the native platform and does not support this interface.");
36575            };
36576            _w.removeBatch = function(t) {
36577              console.error("The Draw Batch class is implemented differently in the native platform and does not support this interface.");
36578            };
36579            _w.removeBatches = function() {
36580              console.error("The Draw Batch class is implemented differently in the native platform and does not support this interface.");
36581            };
36582            class fw {
36583              constructor() {
36584                this._rafHandle = 0;
36585                this._onTick = null;
36586                this._targetFrameRate = 60;
36587                this._isPlaying = !1;
36588                this._updateCallback = void 0;
36589                this._updateCallback = () => {
36590                  this._isPlaying && (this._rafHandle = requestAnimationFrame(this._updateCallback));
36591                  this._onTick && this._onTick();
36592                };
36593              }
36594              get targetFrameRate() {
36595                return this._targetFrameRate;
36596              }
36597              set targetFrameRate(t) {
36598                if (this._targetFrameRate !== t) {
36599                  ne(t > 0);
36600                  this._targetFrameRate = t;
36601                  jsb.setPreferredFramesPerSecond(this._targetFrameRate);
36602                  if (this._isPlaying) {
36603                    this.stop();
36604                    this.start();
36605                  }
36606                }
36607              }
36608              set onTick(t) {
36609                this._onTick = t;
36610              }
36611              get onTick() {
36612                return this._onTick;
36613              }
36614              start() {
36615                if (!this._isPlaying) {
36616                  this._rafHandle = requestAnimationFrame(this._updateCallback);
36617                  this._isPlaying = !0;
36618                }
36619              }
36620              stop() {
36621                if (this._isPlaying) {
36622                  cancelAnimationFrame(this._rafHandle);
36623                  this._rafHandle = 0;
36624                  this._isPlaying = !1;
36625                }
36626              }
36627            }
36628            class gw {
36629              constructor() {
36630                this.name = "";
36631                this.base = "";
36632                this.importBase = "";
36633                this.nativeBase = "";
36634                this.deps = null;
36635                this.assetInfos = new Rh;
36636                this.scenes = new Rh;
36637                this.paths = new Rh;
36638              }
36639              init(t) {
36640                (t => {
36641                  let e = t.uuids;
36642                  const i = t.paths;
36643                  const s = t.types;
36644                  const n = t.deps;
36645                  const r = t.paths = Object.create(null);
36646                  if (!1 === t.debug) {
36647                    for (let t = 0, i = e.length; t < i; t++) e[t] = Wh(e[t]);
36648                    for (const t in i) {
36649                      const e = i[t];
36650                      const n = e[1];
36651                      e[1] = s[n];
36652                    }
36653                  } else {
36654                    const t = Object.create(null);
36655                    for (let i = 0, s = e.length; i < s; i++) {
36656                      const s = e[i];
36657                      e[i] = t[s] = Wh(s);
36658                    }
36659                    e = t;
36660                  }
36661                  for (const t in i) {
36662                    const s = i[t];
36663                    r[e[t]] = s;
36664                  }
36665                  const o = t.scenes;
36666                  for (const t in o) {
36667                    const i = o[t];
36668                    o[t] = e[i];
36669                  }
36670                  const a = t.packs;
36671                  for (const t in a) {
36672                    const i = a[t];
36673                    for (let t = 0; t < i.length; ++t) i[t] = e[i[t]];
36674                  }
36675                  const l = t.versions;
36676                  if (l) for (const t in l) {
36677                    const i = l[t];
36678                    for (let t = 0; t < i.length; t += 2) {
36679                      const s = i[t];
36680                      i[t] = e[s] || s;
36681                    }
36682                  }
36683                  const h = t.redirect;
36684                  if (h) for (let t = 0; t < h.length; t += 2) {
36685                    h[t] = e[h[t]];
36686                    h[t + 1] = n[h[t + 1]];
36687                  }
36688                  if (t.extensionMap) for (const i in t.extensionMap) Object.prototype.hasOwnProperty.call(t.extensionMap, i) && t.extensionMap[i].forEach(((s, n) => {
36689                    t.extensionMap[i][n] = e[s] || s;
36690                  }));
36691                })(t);
36692                this.importBase = t.importBase || "";
36693                this.nativeBase = t.nativeBase || "";
36694                this.base = t.base || "";
36695                this.name = t.name || "";
36696                this.deps = t.deps || [];
36697                this._initUuid(t.uuids);
36698                this._initPath(t.paths);
36699                this._initScene(t.scenes);
36700                this._initPackage(t.packs);
36701                this._initVersion(t.versions);
36702                this._initRedirect(t.redirect);
36703                for (const e in t.extensionMap) Object.prototype.hasOwnProperty.call(t.extensionMap, e) && t.extensionMap[e].forEach((t => {
36704                  const i = this.assetInfos.get(t);
36705                  i && (i.extension = e);
36706                }));
36707              }
36708              getInfoWithPath(t, e) {
36709                if (!t) return null;
36710                t = Zh(t);
36711                const i = this.paths.get(t);
36712                if (i) {
36713                  if (!e) return i[0];
36714                  for (let t = 0, s = i.length; t < s; t++) {
36715                    const s = i[t];
36716                    if (ee.isChildClassOf(s.ctor, e)) return s;
36717                  }
36718                }
36719                return null;
36720              }
36721              getDirWithPath(t, e, i) {
36722                "/" === (t = Zh(t))[t.length - 1] && (t = t.slice(0, -1));
36723                const s = i || [];
36724                this.paths.forEach(((i, n) => {
36725                  if (n.startsWith(t) && ((t, e) => {
36726                    if (t.length > e.length) return 47 === t.charCodeAt(e.length);
36727                    return !0;
36728                  })(n, t) || !t) for (let t = 0, n = i.length; t < n; t++) {
36729                    const n = i[t];
36730                    e && !ee.isChildClassOf(n.ctor, e) || s.push(n);
36731                  }
36732                }));
36733                return s;
36734              }
36735              getAssetInfo(t) {
36736                return this.assetInfos.get(t) || null;
36737              }
36738              getSceneInfo(t) {
36739                t.endsWith(".scene") || (t += ".scene");
36740                "/" === t[0] || t.startsWith("db://") || (t = `/${t}`);
36741                const e = this.scenes.find(((e, i) => i.endsWith(t)));
36742                return e;
36743              }
36744              destroy() {
36745                this.paths.destroy();
36746                this.scenes.destroy();
36747                this.assetInfos.destroy();
36748              }
36749              _initUuid(t) {
36750                if (t) {
36751                  this.assetInfos.clear();
36752                  for (let e = 0, i = t.length; e < i; e++) {
36753                    const i = t[e];
36754                    this.assetInfos.add(i, {
36755                      uuid: i
36756                    });
36757                  }
36758                }
36759              }
36760              _initPath(t) {
36761                if (!t) return;
36762                const e = this.paths;
36763                e.clear();
36764                for (const i in t) {
36765                  const s = t[i];
36766                  const n = s[0];
36767                  const r = s[1];
36768                  const o = 3 === s.length;
36769                  const a = this.assetInfos.get(i);
36770                  a.path = n;
36771                  a.ctor = ee.getClassById(r);
36772                  e.has(n) ? o ? e.get(n).push(a) : e.get(n).unshift(a) : e.add(n, [ a ]);
36773                }
36774              }
36775              _initScene(t) {
36776                if (!t) return;
36777                const e = this.scenes;
36778                e.clear();
36779                const i = this.assetInfos;
36780                for (const s in t) {
36781                  const n = t[s];
36782                  const r = i.get(n);
36783                  r.url = s;
36784                  e.add(s, r);
36785                }
36786              }
36787              _initPackage(t) {
36788                if (!t) return;
36789                const e = this.assetInfos;
36790                for (const i in t) {
36791                  const s = t[i];
36792                  const n = {
36793                    uuid: i,
36794                    packedUuids: s,
36795                    ext: ".json"
36796                  };
36797                  e.add(i, n);
36798                  for (let t = 0, i = s.length; t < i; t++) {
36799                    const r = s[t];
36800                    const o = e.get(r);
36801                    const a = o.packs;
36802                    a ? 1 === i ? a.unshift(n) : a.push(n) : o.packs = [ n ];
36803                  }
36804                }
36805              }
36806              _initVersion(t) {
36807                if (!t) return;
36808                const e = this.assetInfos;
36809                let i = t.import;
36810                if (i) for (let t = 0, s = i.length; t < s; t += 2) {
36811                  const s = i[t];
36812                  e.get(s).ver = i[t + 1];
36813                }
36814                i = t.native;
36815                if (i) for (let t = 0, s = i.length; t < s; t += 2) {
36816                  const s = i[t];
36817                  e.get(s).nativeVer = i[t + 1];
36818                }
36819              }
36820              _initRedirect(t) {
36821                if (!t) return;
36822                const e = this.assetInfos;
36823                for (let i = 0, s = t.length; i < s; i += 2) {
36824                  const s = t[i];
36825                  e.get(s).redirect = t[i + 1];
36826                }
36827              }
36828            }
36829            function yw(t, e) {
36830              t._uuid && e.push(t._uuid);
36831            }
36832            function bw(t, e) {
36833              const i = Object.getOwnPropertyNames(t);
36834              for (let s = 0; s < i.length; s++) {
36835                const n = i[s];
36836                if ("node" === n || "__eventTargets" === n) continue;
36837                const r = t[n];
36838                if ("object" == typeof r && r) if (Array.isArray(r)) for (let t = 0; t < r.length; t++) {
36839                  const i = r[t];
36840                  i instanceof gc && yw(i, e);
36841                } else if (r.constructor && r.constructor !== Object) r instanceof gc && yw(r, e); else {
36842                  const t = Object.getOwnPropertyNames(r);
36843                  for (let i = 0; i < t.length; i++) {
36844                    const s = r[t[i]];
36845                    s instanceof gc && yw(s, e);
36846                  }
36847                }
36848              }
36849            }
36850            function Sw(t, e) {
36851              for (let i = 0; i < t._components.length; i++) bw(t._components[i], e);
36852              for (let i = 0; i < t._children.length; i++) Sw(t._children[i], e);
36853            }
36854            function Aw(t, e, i, s) {
36855              i.push(t._uuid);
36856              const n = pA.getDeps(t._uuid);
36857              for (let t = 0, r = n.length; t < r; t++) {
36858                const r = Mh.get(n[t]);
36859                if (!r) continue;
36860                const o = r._uuid;
36861                o in e ? e[o] += s : e[o] = r.refCount + s;
36862                i.includes(o) || Aw(r, e, i, s);
36863              }
36864            }
36865            const Tw = [];
36866            var vw = new class {
36867              constructor() {
36868                this._persistNodeDeps = new Rh;
36869                this._toDelete = new Rh;
36870                this._eventListener = !1;
36871                this._dontDestroyAssets = [];
36872              }
36873              addIgnoredAsset(t) {
36874                this._dontDestroyAssets.push(t._uuid);
36875              }
36876              init() {
36877                this._persistNodeDeps.clear();
36878                this._toDelete.clear();
36879              }
36880              _addPersistNodeRef(t) {
36881                const e = [];
36882                Sw(t, e);
36883                for (let t = 0, i = e.length; t < i; t++) {
36884                  const i = Mh.get(e[t]);
36885                  i && i.addRef();
36886                }
36887                this._persistNodeDeps.add(t.uuid, e);
36888              }
36889              _removePersistNodeRef(t) {
36890                if (!this._persistNodeDeps.has(t.uuid)) return;
36891                const e = this._persistNodeDeps.get(t.uuid);
36892                for (let t = 0, i = e.length; t < i; t++) {
36893                  const i = Mh.get(e[t]);
36894                  i && i.decRef();
36895                }
36896                this._persistNodeDeps.remove(t.uuid);
36897              }
36898              _autoRelease(t, e, i) {
36899                if (t) {
36900                  const i = pA.getDeps(t.uuid);
36901                  for (let e = 0, s = i.length; e < s; e++) {
36902                    const s = Mh.get(i[e]);
36903                    s && s.decRef(t.autoReleaseAssets);
36904                  }
36905                  const s = pA._depends.get(t.uuid);
36906                  if (s && s.persistDeps) {
36907                    const e = s.persistDeps;
36908                    for (let i = 0, s = e.length; i < s; i++) {
36909                      const s = Mh.get(e[i]);
36910                      s && s.decRef(t.autoReleaseAssets);
36911                    }
36912                  }
36913                  t.uuid !== e.uuid && pA.remove(t.uuid);
36914                }
36915                const s = pA._depends.get(e.uuid);
36916                s && (s.persistDeps = []);
36917                for (const t in i) {
36918                  const e = i[t];
36919                  const n = this._persistNodeDeps.get(e.uuid);
36920                  for (const t of n) {
36921                    const e = Mh.get(t);
36922                    e && e.addRef();
36923                  }
36924                  s && s.persistDeps.push(...n);
36925                }
36926              }
36927              tryRelease(t, e = !1) {
36928                if (t instanceof gc) if (e) this._free(t, e); else {
36929                  this._toDelete.add(t._uuid, t);
36930                  if (!this._eventListener) {
36931                    this._eventListener = !0;
36932                    Te(this._freeAssets.bind(this));
36933                  }
36934                }
36935              }
36936              _freeAssets() {
36937                this._eventListener = !1;
36938                this._toDelete.forEach((t => {
36939                  this._free(t);
36940                }));
36941                this._toDelete.clear();
36942              }
36943              _free(t, e = !1) {
36944                const i = t._uuid;
36945                this._toDelete.remove(i);
36946                if (!po(t, !0) || -1 !== this._dontDestroyAssets.indexOf(i)) return;
36947                if (!e && t.refCount > 0 && function(t) {
36948                  const e = Object.create(null);
36949                  e[t._uuid] = t.refCount;
36950                  Aw(t, e, Tw, -1);
36951                  Tw.length = 0;
36952                  if (0 !== e[t._uuid]) return e[t._uuid];
36953                  for (const t in e) 0 !== e[t] && Aw(Mh.get(t), e, Tw, 1);
36954                  Tw.length = 0;
36955                  return e[t._uuid];
36956                }(t) > 0) return;
36957                Mh.remove(i);
36958                const s = pA.getDeps(i);
36959                for (let t = 0, e = s.length; t < e; t++) {
36960                  const e = Mh.get(s[t]);
36961                  if (e) {
36962                    e.decRef(!1);
36963                    this._free(e, !1);
36964                  }
36965                }
36966                t.destroy();
36967                pA.remove(i);
36968              }
36969            };
36970            let Ew = null;
36971            function Cw(t, e) {
36972              for (let i = 0, s = t.input.length; i < s; i++) {
36973                const s = t.input[i];
36974                e && !s.isNative && s.content instanceof gc && s.content.decRef(!1);
36975                s.recycle();
36976              }
36977              t.input = null;
36978            }
36979            function xw(t, e) {
36980              return e ? /\?/.test(t) ? `${t}&_t=${Date.now()}` : `${t}?_t=${Date.now()}` : t;
36981            }
36982            function ww(t, e, i, s, n = 0) {
36983              t(n, ((r, o) => {
36984                n++;
36985                !r || n > e ? s && s(r, o) : setTimeout((() => {
36986                  ww(t, e, i, s, n);
36987                }), i);
36988              }));
36989            }
36990            function Rw(t, e, i, s, n) {
36991              try {
36992                const r = pA.parse(t, e);
36993                for (let t = 0, e = r.deps.length; t < e; t++) {
36994                  const e = r.deps[t];
36995                  if (!(e in i)) {
36996                    i[e] = !0;
36997                    s.push({
36998                      uuid: e,
36999                      bundle: n && n.name
37000                    });
37001                  }
37002                }
37003                if (r.nativeDep) {
37004                  n && (r.nativeDep.bundle = n.name);
37005                  s.push({
37006                    ...r.nativeDep
37007                  });
37008                }
37009              } catch (t) {
37010                x(t.message, t.stack);
37011              }
37012            }
37013            function Iw(t, e, i) {
37014              if (e) {
37015                i = void 0 !== i ? i : m.assetManager.cacheAsset;
37016                Jh(e) || !i || e.isDefault || Mh.add(t, e);
37017              }
37018            }
37019            function Mw(t, e, i) {
37020              let s = 0;
37021              const n = [];
37022              const r = t.length;
37023              0 === r && i && i(n);
37024              const o = t => {
37025                t && n.push(t);
37026                s++;
37027                s === r && i && i(n);
37028              };
37029              for (let i = 0; i < r; i++) e(t[i], o);
37030            }
37031            function Bw(t, e, i) {
37032              let s = t;
37033              let n = e;
37034              let r = i;
37035              if (void 0 === i) {
37036                const i = "function" == typeof t;
37037                if (e) {
37038                  r = e;
37039                  i || (n = null);
37040                } else if (void 0 === e && i) {
37041                  r = t;
37042                  s = null;
37043                  n = null;
37044                }
37045                if (void 0 !== e && i) {
37046                  n = t;
37047                  s = null;
37048                }
37049              }
37050              return {
37051                options: s || Object.create(null),
37052                onProgress: n,
37053                onComplete: r
37054              };
37055            }
37056            function Dw(t, e, i) {
37057              let s = t;
37058              let n = e;
37059              let r = i;
37060              if (void 0 === i) {
37061                const i = ee.isChildClassOf(t, gc);
37062                if (e) {
37063                  r = e;
37064                  i && (n = null);
37065                } else if (void 0 === e && !i) {
37066                  r = t;
37067                  n = null;
37068                  s = null;
37069                }
37070                if (void 0 !== e && !i) {
37071                  n = t;
37072                  s = null;
37073                }
37074              }
37075              return {
37076                type: s,
37077                onProgress: n || Ew,
37078                onComplete: r
37079              };
37080            }
37081            function Pw(t, e, i, s = {}) {
37082              if (!i[e] || s[e]) return !1;
37083              s[e] = !0;
37084              let n = !1;
37085              const r = pA.getDeps(e);
37086              if (r) for (let e = 0, o = r.length; e < o; e++) {
37087                const o = r[e];
37088                if (o === t || Pw(t, o, i, s)) {
37089                  n = !0;
37090                  break;
37091                }
37092              }
37093              return n;
37094            }
37095            function Ow(t) {
37096              return (e, i) => {
37097                if (!t) return;
37098                const s = [];
37099                Array.isArray(i) ? i.forEach((t => t instanceof gc && s.push(t.addRef()))) : i instanceof gc && s.push(i.addRef());
37100                Te((() => {
37101                  s.forEach((t => t.decRef(!1)));
37102                  t(e, i);
37103                }));
37104              };
37105            }
37106            class Nw {
37107              constructor() {
37108                this._config = new gw;
37109              }
37110              get config() {
37111                return this._config;
37112              }
37113              get name() {
37114                return this._config.name;
37115              }
37116              get deps() {
37117                return this._config.deps;
37118              }
37119              get base() {
37120                return this._config.base;
37121              }
37122              getInfoWithPath(t, e) {
37123                return this._config.getInfoWithPath(t, e);
37124              }
37125              getDirWithPath(t, e, i) {
37126                return this._config.getDirWithPath(t, e, i);
37127              }
37128              getAssetInfo(t) {
37129                return this._config.getAssetInfo(t);
37130              }
37131              getSceneInfo(t) {
37132                return this._config.getSceneInfo(t);
37133              }
37134              init(t) {
37135                this._config.init(t);
37136                Ph.add(t.name, this);
37137              }
37138              load(t, e, i, s) {
37139                const {type: n, onProgress: r, onComplete: o} = Dw(e, i, s);
37140                const a = {
37141                  __requestType__: Vh.PATH,
37142                  type: n,
37143                  bundle: this.name,
37144                  __outputAsArray__: Array.isArray(t)
37145                };
37146                m.assetManager.loadAny(t, a, r, o);
37147              }
37148              preload(t, e, i, s) {
37149                const {type: n, onProgress: r, onComplete: o} = Dw(e, i, s);
37150                m.assetManager.preloadAny(t, {
37151                  __requestType__: Vh.PATH,
37152                  type: n,
37153                  bundle: this.name
37154                }, r, o);
37155              }
37156              loadDir(t, e, i, s) {
37157                const {type: n, onProgress: r, onComplete: o} = Dw(e, i, s);
37158                m.assetManager.loadAny(t, {
37159                  __requestType__: Vh.DIR,
37160                  type: n,
37161                  bundle: this.name,
37162                  __outputAsArray__: !0
37163                }, r, o);
37164              }
37165              preloadDir(t, e, i, s) {
37166                const {type: n, onProgress: r, onComplete: o} = Dw(e, i, s);
37167                m.assetManager.preloadAny(t, {
37168                  __requestType__: Vh.DIR,
37169                  type: n,
37170                  bundle: this.name
37171                }, r, o);
37172              }
37173              loadScene(t, e, i, s) {
37174                const {options: n, onProgress: r, onComplete: o} = Bw(e, i, s);
37175                n.preset = n.preset || "scene";
37176                n.bundle = this.name;
37177                m.assetManager.loadAny({
37178                  scene: t
37179                }, n, r, ((t, e) => {
37180                  if (t) x(t.message, t.stack); else if (e.scene) {
37181                    const t = e.scene;
37182                    t._id = e._uuid;
37183                    t.name = e.name;
37184                  } else t = new Error(`The asset ${e._uuid} is not a scene`);
37185                  o && o(t, e);
37186                }));
37187              }
37188              preloadScene(t, e, i, s) {
37189                const {options: n, onProgress: r, onComplete: o} = Bw(e, i, s);
37190                n.bundle = this.name;
37191                m.assetManager.preloadAny({
37192                  scene: t
37193                }, n, r, (e => {
37194                  e && F(1210, t, e.message);
37195                  o && o(e);
37196                }));
37197              }
37198              get(t, e) {
37199                const i = this.getInfoWithPath(t, e);
37200                return i && Mh.get(i.uuid) || null;
37201              }
37202              release(t, e) {
37203                const i = this.get(t, e);
37204                i && vw.tryRelease(i, !0);
37205              }
37206              releaseUnusedAssets() {
37207                Mh.forEach((t => {
37208                  const e = this.getAssetInfo(t._uuid);
37209                  e && !e.redirect && vw.tryRelease(t);
37210                }));
37211              }
37212              releaseAll() {
37213                Mh.forEach((t => {
37214                  const e = this.getAssetInfo(t._uuid);
37215                  e && !e.redirect && vw.tryRelease(t, !0);
37216                }));
37217              }
37218              _destroy() {
37219                this._config.destroy();
37220              }
37221            }
37222            const Lw = t("resources", new Nw);
37223            m.resources = Lw;
37224            function Fw(t, e, i) {
37225              const s = new Image;
37226              "file:" !== window.location.protocol && (s.crossOrigin = "anonymous");
37227              function n() {
37228                s.removeEventListener("load", n);
37229                s.removeEventListener("error", r);
37230                i && i(null, s);
37231              }
37232              function r() {
37233                s.removeEventListener("load", n);
37234                s.removeEventListener("error", r);
37235                i && i(new Error(G(4930, t)));
37236              }
37237              s.addEventListener("load", n);
37238              s.addEventListener("error", r);
37239              s.src = t;
37240              return s;
37241            }
37242            function Vw(t, e, i, s) {
37243              const n = new XMLHttpRequest;
37244              const r = `download failed: ${t}, status: `;
37245              n.open("GET", t, !0);
37246              void 0 !== e.xhrResponseType && (n.responseType = e.xhrResponseType);
37247              void 0 !== e.xhrWithCredentials && (n.withCredentials = e.xhrWithCredentials);
37248              void 0 !== e.xhrMimeType && n.overrideMimeType && n.overrideMimeType(e.xhrMimeType);
37249              void 0 !== e.xhrTimeout && (n.timeout = e.xhrTimeout);
37250              if (e.xhrHeader) for (const t in e.xhrHeader) n.setRequestHeader(t, e.xhrHeader[t]);
37251              n.onload = () => {
37252                200 === n.status || 0 === n.status ? s && s(null, n.response) : s && s(new Error(`${r}${n.status}(no response)`));
37253              };
37254              i && (n.onprogress = t => {
37255                t.lengthComputable && i(t.loaded, t.total);
37256              });
37257              n.onerror = () => {
37258                s && s(new Error(`${r}${n.status}(error)`));
37259              };
37260              n.ontimeout = () => {
37261                s && s(new Error(`${r}${n.status}(time out)`));
37262              };
37263              n.onabort = () => {
37264                s && s(new Error(`${r}${n.status}(abort)`));
37265              };
37266              n.send(null);
37267              return n;
37268            }
37269            const kw = {};
37270            function Uw(t, e, i) {
37271              if (kw[t]) {
37272                i && i(null);
37273                return null;
37274              }
37275              const s = document.createElement("script");
37276              "file:" !== window.location.protocol && (s.crossOrigin = "anonymous");
37277              s.async = e.scriptAsyncLoading || !1;
37278              s.src = t;
37279              function n() {
37280                s.parentNode.removeChild(s);
37281                s.removeEventListener("load", n, !1);
37282                s.removeEventListener("error", r, !1);
37283                kw[t] = !0;
37284                i && i(null);
37285              }
37286              function r() {
37287                s.parentNode.removeChild(s);
37288                s.removeEventListener("load", n, !1);
37289                s.removeEventListener("error", r, !1);
37290                i && i(new Error(G(4928, t)));
37291              }
37292              s.addEventListener("load", n, !1);
37293              s.addEventListener("error", r, !1);
37294              document.body.appendChild(s);
37295              return s;
37296            }
37297            const Gw = /^(?:\w+:\/\/|\.+\/).+/;
37298            const zw = (t, e, i) => {
37299              (Vo.hasFeature(Vo.Feature.IMAGE_BITMAP) && m.assetManager.allowImageBitmap ? Hw : Fw)(t, e, i);
37300            };
37301            const Hw = (t, e, i) => {
37302              e.xhrResponseType = "blob";
37303              Vw(t, e, e.onFileProgress, i);
37304            };
37305            const jw = (t, e, i) => {
37306              e.xhrResponseType = "json";
37307              Vw(t, e, e.onFileProgress, i);
37308            };
37309            const Xw = (t, e, i) => {
37310              e.xhrResponseType = "arraybuffer";
37311              Vw(t, e, e.onFileProgress, i);
37312            };
37313            const Ww = (t, e, i) => {
37314              jw(t, e, ((e, s) => {
37315                if (e) {
37316                  i(e);
37317                  return;
37318                }
37319                const n = au(s);
37320                Promise.all(n.chunks.map((i => new Promise(((s, n) => {
37321                  Xw(`${rc(t)}${i}`, {}, ((t, i) => {
37322                    e ? n(e) : s(new Uint8Array(i));
37323                  }));
37324                }))))).then((t => {
37325                  const e = new ou(n.document, t);
37326                  i(null, e);
37327                })).catch((t => {
37328                  i(t);
37329                }));
37330              }));
37331            };
37332            const Yw = (t, e, i) => {
37333              Xw(t, e, ((t, e) => {
37334                if (t) i(t); else try {
37335                  const t = lu(new Uint8Array(e));
37336                  i(null, t);
37337                } catch (t) {
37338                  i(t);
37339                }
37340              }));
37341            };
37342            const qw = (t, e, i) => {
37343              e.xhrResponseType = "text";
37344              Vw(t, e, e.onFileProgress, i);
37345            };
37346            const Kw = (t, e, i) => {
37347              const s = oc(t);
37348              let n = t;
37349              Gw.test(n) || (n = -1 !== Jw.remoteBundles.indexOf(s) ? `${Jw.remoteServerAddress}remote/${s}` : `assets/${s}`);
37350              const r = e.version || Jw.bundleVers[s];
37351              let o = 0;
37352              let a = null;
37353              let l = null;
37354              jw(`${n}/config.${r ? `${r}.` : ""}json`, e, ((t, e) => {
37355                l = t;
37356                a = e;
37357                a && (a.base = `${n}/`);
37358                2 == ++o && i(l, a);
37359              }));
37360              Uw(`${n}/index.${r ? `${r}.` : ""}js`, e, (t => {
37361                l = t;
37362                2 == ++o && i(t, a);
37363              }));
37364            };
37365            const Jw = new class {
37366              constructor() {
37367                this.maxConcurrency = 6;
37368                this.maxRequestsPerFrame = 6;
37369                this.maxRetryCount = 3;
37370                this.appendTimeStamp = !1;
37371                this.limited = !0;
37372                this.retryInterval = 2e3;
37373                this.bundleVers = null;
37374                this.remoteBundles = [];
37375                this.downloadDomImage = Fw;
37376                this.downloadDomAudio = null;
37377                this.downloadFile = Vw;
37378                this.downloadScript = Uw;
37379                this._downloaders = {
37380                  ".png": zw,
37381                  ".jpg": zw,
37382                  ".bmp": zw,
37383                  ".jpeg": zw,
37384                  ".gif": zw,
37385                  ".ico": zw,
37386                  ".tiff": zw,
37387                  ".webp": zw,
37388                  ".image": zw,
37389                  ".pvr": Xw,
37390                  ".pkm": Xw,
37391                  ".astc": Xw,
37392                  ".txt": qw,
37393                  ".xml": qw,
37394                  ".vsh": qw,
37395                  ".fsh": qw,
37396                  ".atlas": qw,
37397                  ".tmx": qw,
37398                  ".tsx": qw,
37399                  ".json": jw,
37400                  ".ExportJson": jw,
37401                  ".plist": qw,
37402                  ".ccon": Ww,
37403                  ".cconb": Yw,
37404                  ".fnt": qw,
37405                  ".binary": Xw,
37406                  ".bin": Xw,
37407                  ".dbbin": Xw,
37408                  ".skel": Xw,
37409                  ".js": Uw,
37410                  bundle: Kw,
37411                  default: qw
37412                };
37413                this._downloading = new Rh;
37414                this._queue = [];
37415                this._queueDirty = !1;
37416                this._totalNum = 0;
37417                this._totalNumThisPeriod = 0;
37418                this._lastDate = -1;
37419                this._checkNextPeriod = !1;
37420                this._remoteServerAddress = "";
37421                this._maxInterval = 1 / 30;
37422              }
37423              get remoteServerAddress() {
37424                return this._remoteServerAddress;
37425              }
37426              init(t = "", e = {}, i = []) {
37427                this._downloading.clear();
37428                this._queue.length = 0;
37429                this._remoteServerAddress = t;
37430                this.bundleVers = e;
37431                this.remoteBundles = i;
37432              }
37433              register(t, e) {
37434                "object" == typeof t ? ee.mixin(this._downloaders, t) : this._downloaders[t] = e;
37435              }
37436              download(t, e, i, s, n) {
37437                const r = Bh.get(t);
37438                if (r) {
37439                  n(null, r);
37440                  return;
37441                }
37442                const o = this._downloading.get(t);
37443                if (o) {
37444                  o.push(n);
37445                  const e = this._queue.find((e => e.id === t));
37446                  if (!e) return;
37447                  const i = s.priority || 0;
37448                  if (e.priority < i) {
37449                    e.priority = i;
37450                    this._queueDirty = !0;
37451                  }
37452                  return;
37453                }
37454                const a = void 0 !== s.maxRetryCount ? s.maxRetryCount : this.maxRetryCount;
37455                const l = void 0 !== s.maxConcurrency ? s.maxConcurrency : this.maxConcurrency;
37456                const h = void 0 !== s.maxRequestsPerFrame ? s.maxRequestsPerFrame : this.maxRequestsPerFrame;
37457                const c = this._downloaders[i] || this._downloaders.default;
37458                ww(((i, r) => {
37459                  0 === i && this._downloading.add(t, [ n ]);
37460                  if (!this.limited) {
37461                    c(xw(e, this.appendTimeStamp), s, r);
37462                    return;
37463                  }
37464                  this._updateTime();
37465                  const o = (t, e) => {
37466                    this._totalNum--;
37467                    this._handleQueueInNextFrame(l, h);
37468                    r(t, e);
37469                  };
37470                  if (this._totalNum < l && this._totalNumThisPeriod < h) {
37471                    c(xw(e, this.appendTimeStamp), s, o);
37472                    this._totalNum++;
37473                    this._totalNumThisPeriod++;
37474                  } else {
37475                    this._queue.push({
37476                      id: t,
37477                      priority: s.priority || 0,
37478                      url: e,
37479                      options: s,
37480                      done: o,
37481                      handler: c
37482                    });
37483                    this._queueDirty = !0;
37484                    this._totalNum < l && this._handleQueueInNextFrame(l, h);
37485                  }
37486                }), a, this.retryInterval, ((e, i) => {
37487                  e || Bh.add(t, i);
37488                  const s = this._downloading.remove(t);
37489                  for (let t = 0, n = s.length; t < n; t++) s[t](e, i);
37490                }));
37491              }
37492              loadSubpackage(t, e) {
37493                m.assetManager.loadBundle(t, null, e);
37494              }
37495              _updateTime() {
37496                const t = performance.now();
37497                const e = m.game.deltaTime;
37498                const i = e > this._maxInterval ? this._maxInterval : e;
37499                if (t - this._lastDate > 1e3 * i) {
37500                  this._totalNumThisPeriod = 0;
37501                  this._lastDate = t;
37502                }
37503              }
37504              _handleQueue(t, e) {
37505                this._checkNextPeriod = !1;
37506                this._updateTime();
37507                for (;this._queue.length > 0 && this._totalNum < t && this._totalNumThisPeriod < e; ) {
37508                  if (this._queueDirty) {
37509                    this._queue.sort(((t, e) => t.priority - e.priority));
37510                    this._queueDirty = !1;
37511                  }
37512                  const t = this._queue.pop();
37513                  if (!t) break;
37514                  this._totalNum++;
37515                  this._totalNumThisPeriod++;
37516                  t.handler(xw(t.url, this.appendTimeStamp), t.options, t.done);
37517                }
37518                this._handleQueueInNextFrame(t, e);
37519              }
37520              _handleQueueInNextFrame(t, e) {
37521                if (!this._checkNextPeriod && this._queue.length > 0) {
37522                  Te(this._handleQueue.bind(this), t, e);
37523                  this._checkNextPeriod = !0;
37524                }
37525              }
37526            };
37527            function Zw(t, e, i, s) {
37528              let n = null;
37529              let r = null;
37530              try {
37531                n = new IC;
37532                n._nativeUrl = t;
37533                n._nativeAsset = e;
37534              } catch (t) {
37535                r = t;
37536              }
37537              s(r, n);
37538            }
37539            function Qw(t, e, i, s) {
37540              const n = new RC;
37541              n.json = e;
37542              s(null, n);
37543            }
37544            function $w(t, e, i, s) {
37545              const n = new EC;
37546              n.text = e;
37547              s(null, n);
37548            }
37549            function tR(t, e, i, s) {
37550              const n = new Ug;
37551              n._nativeUrl = t;
37552              n._nativeAsset = e;
37553              s(null, n);
37554            }
37555            function eR(t, e, i, s) {
37556              const n = new gc;
37557              n._nativeUrl = t;
37558              n._nativeAsset = e;
37559              s(null, n);
37560            }
37561            function iR(t, i, s, n) {
37562              let r = Ph.get(i.name);
37563              if (!r) {
37564                r = i.name === Uh.RESOURCES ? Lw : new Nw;
37565                i.base = i.base || `${t}/`;
37566                r.init(i);
37567              }
37568              e.import(`virtual:///prerequisite-imports/${r.name}`).then((() => {
37569                n(null, r);
37570              })).catch(n);
37571            }
37572            var sR = new class {
37573              constructor() {
37574                this._creating = new Rh;
37575                this._producers = {
37576                  ".png": Zw,
37577                  ".jpg": Zw,
37578                  ".bmp": Zw,
37579                  ".jpeg": Zw,
37580                  ".gif": Zw,
37581                  ".ico": Zw,
37582                  ".tiff": Zw,
37583                  ".webp": Zw,
37584                  ".image": Zw,
37585                  ".pvr": Zw,
37586                  ".pkm": Zw,
37587                  ".txt": $w,
37588                  ".xml": $w,
37589                  ".vsh": $w,
37590                  ".fsh": $w,
37591                  ".atlas": $w,
37592                  ".tmx": $w,
37593                  ".tsx": $w,
37594                  ".fnt": $w,
37595                  ".json": Qw,
37596                  ".ExportJson": Qw,
37597                  ".binary": tR,
37598                  ".bin": tR,
37599                  ".dbbin": tR,
37600                  ".skel": tR,
37601                  bundle: iR,
37602                  default: eR
37603                };
37604              }
37605              register(t, e) {
37606                "object" == typeof t ? ee.mixin(this._producers, t) : this._producers[t] = e;
37607              }
37608              create(t, e, i, s, n) {
37609                const r = this._producers[i] || this._producers.default;
37610                const o = Mh.get(t);
37611                if (!s.reloadAsset && o) {
37612                  n(null, o);
37613                  return;
37614                }
37615                const a = this._creating.get(t);
37616                if (a) a.push(n); else {
37617                  this._creating.add(t, [ n ]);
37618                  r(t, e, s, ((e, i) => {
37619                    if (!e && i instanceof gc) {
37620                      i._uuid = t;
37621                      Iw(t, i, s.cacheAsset);
37622                    }
37623                    const n = this._creating.remove(t);
37624                    for (let t = 0, s = n.length; t < s; t++) n[t](e, i);
37625                  }));
37626                }
37627              }
37628            };
37629            var nR = new class {
37630              constructor() {
37631                this._loading = new Rh;
37632                this._unpackers = {
37633                  ".json": this.unpackJson
37634                };
37635              }
37636              unpackJson(t, e, i, s) {
37637                let n = ee.createMap(!0);
37638                let r = null;
37639                if (Array.isArray(e)) {
37640                  e = function(t, e, i) {
37641                    if (t[Nu] < 1) throw new Error(G(5304, t[Nu]));
37642                    n_(t, !0, e, null != i ? i : o_.reportMissingClass);
37643                    r_(t);
37644                    const s = new a_(t[Nu]);
37645                    const n = t[Fu];
37646                    const r = t[Vu];
37647                    const o = t[ku];
37648                    const a = t[Uu];
37649                    const l = t[Yu];
37650                    for (let t = 0; t < l.length; ++t) l[t].unshift(s, n, r, o, a);
37651                    return l;
37652                  }(e);
37653                  e.length !== t.length && F(4915);
37654                  for (let i = 0; i < t.length; i++) n[`${t[i]}@import`] = e[i];
37655                } else {
37656                  const i = ee.getClassId(LC);
37657                  const s = ee.getClassId(IC);
37658                  if (e.type === i && e.data) {
37659                    const s = e.data;
37660                    s.length !== t.length && F(4915);
37661                    for (let e = 0; e < t.length; e++) n[`${t[e]}@import`] = l_(i, {
37662                      base: s[e][0],
37663                      mipmaps: s[e][1]
37664                    });
37665                  } else if (e.type === s && e.data) {
37666                    const i = e.data;
37667                    i.length !== t.length && F(4915);
37668                    for (let e = 0; e < t.length; e++) n[`${t[e]}@import`] = i[e];
37669                  } else {
37670                    r = new Error("unmatched type pack!");
37671                    n = null;
37672                  }
37673                }
37674                s(r, n);
37675              }
37676              init() {
37677                this._loading.clear();
37678              }
37679              register(t, e) {
37680                "object" == typeof t ? ee.mixin(this._unpackers, t) : this._unpackers[t] = e;
37681              }
37682              unpack(t, e, i, s, n) {
37683                if (!e) {
37684                  n(new Error("package data is wrong!"));
37685                  return;
37686                }
37687                (0, this._unpackers[i])(t, e, s, n);
37688              }
37689              load(t, e, i) {
37690                if (t.isNative || !t.info || !t.info.packs) {
37691                  Jw.download(t.id, t.url, t.ext, t.options, i);
37692                  return;
37693                }
37694                if (Bh.has(t.id)) {
37695                  i(null, Bh.get(t.id));
37696                  return;
37697                }
37698                const s = t.info.packs;
37699                let n = s.find((t => this._loading.has(t.uuid)));
37700                if (n) {
37701                  this._loading.get(n.uuid).push({
37702                    onComplete: i,
37703                    id: t.id
37704                  });
37705                  return;
37706                }
37707                n = s[0];
37708                this._loading.add(n.uuid, [ {
37709                  onComplete: i,
37710                  id: t.id
37711                } ]);
37712                const r = Qh(n.uuid, {
37713                  ext: n.ext,
37714                  bundle: t.config.name
37715                });
37716                Jw.download(n.uuid, r, n.ext, t.options, ((e, i) => {
37717                  Bh.remove(n.uuid);
37718                  e && x(e.message, e.stack);
37719                  this.unpack(n.packedUuids, i, n.ext, t.options, ((t, i) => {
37720                    if (!t) for (const t in i) Bh.add(t, i[t]);
37721                    const s = this._loading.remove(n.uuid);
37722                    for (let n = 0, r = s.length; n < r; n++) {
37723                      const r = s[n];
37724                      if (e || t) {
37725                        r.onComplete(e || t);
37726                        continue;
37727                      }
37728                      const o = i[r.id];
37729                      o ? r.onComplete(null, o) : r.onComplete(new Error("can not retrieve data from package"));
37730                    }
37731                  }));
37732                }));
37733              }
37734            };
37735            function rR(t, e) {
37736              let i = !1;
37737              if (!t.progress) {
37738                t.progress = {
37739                  finish: 0,
37740                  total: t.input.length,
37741                  canInvoke: !0
37742                };
37743                i = !0;
37744              }
37745              const {options: s, progress: n} = t;
37746              const r = [];
37747              const o = n.total;
37748              const a = s.__exclude__ = s.__exclude__ || Object.create(null);
37749              t.output = [];
37750              Mw(t.input, ((s, l) => {
37751                if (s.isNative || !Mh.has(s.uuid)) nR.load(s, t.options, ((h, c) => {
37752                  if (h) {
37753                    if (!t.isFinish) if (!m.assetManager.force || i) {
37754                      x(h.message, h.stack);
37755                      n.canInvoke = !1;
37756                      e(h);
37757                    } else {
37758                      t.output.push(s);
37759                      n.canInvoke && t.dispatch("progress", ++n.finish, n.total, s);
37760                    }
37761                  } else if (!t.isFinish) {
37762                    s.file = c;
37763                    t.output.push(s);
37764                    if (!s.isNative) {
37765                      a[s.uuid] = !0;
37766                      Rw(s.uuid, c, a, r, s.config);
37767                      n.total = o + r.length;
37768                    }
37769                    n.canInvoke && t.dispatch("progress", ++n.finish, n.total, s);
37770                  }
37771                  l();
37772                })); else {
37773                  const e = Mh.get(s.uuid);
37774                  s.content = e.addRef();
37775                  t.output.push(s);
37776                  n.canInvoke && t.dispatch("progress", ++n.finish, n.total, s);
37777                  l();
37778                }
37779              }), (() => {
37780                if (t.isFinish) {
37781                  Cw(t, !0);
37782                  t.dispatch("error");
37783                } else if (r.length > 0) {
37784                  const o = Gh.create({
37785                    input: r,
37786                    progress: n,
37787                    options: s,
37788                    onProgress: t.onProgress,
37789                    onError: Gh.prototype.recycle,
37790                    onComplete: s => {
37791                      if (!s) {
37792                        t.output.push(...o.output);
37793                        o.recycle();
37794                      }
37795                      i && oR(t);
37796                      e(s);
37797                    }
37798                  });
37799                  Nh.async(o);
37800                } else {
37801                  i && oR(t);
37802                  e();
37803                }
37804              }));
37805            }
37806            function oR(t) {
37807              const e = t.output;
37808              for (let t = 0, i = e.length; t < i; t++) e[t].content && e[t].content.decRef(!1);
37809            }
37810            class aR {
37811              constructor() {
37812                this._parser = null;
37813                window.DOMParser && (this._parser = new DOMParser);
37814              }
37815              parse(t) {
37816                return this._parseXML(t);
37817              }
37818              _parseXML(t) {
37819                if (this._parser) return this._parser.parseFromString(t, "text/xml");
37820                throw new Error("Dom parser is not supported in this platform!");
37821              }
37822            }
37823            const lR = new class extends aR {
37824              parse(t) {
37825                const e = this._parseXML(t).documentElement;
37826                if ("plist" !== e.tagName) {
37827                  N(5100);
37828                  return {};
37829                }
37830                let i = null;
37831                for (let t = 0, s = e.childNodes.length; t < s; t++) {
37832                  i = e.childNodes[t];
37833                  if (1 === i.nodeType) break;
37834                }
37835                return this._parseNode(i);
37836              }
37837              _parseNode(t) {
37838                let e = null;
37839                const i = t.tagName;
37840                if ("dict" === i) e = this._parseDict(t); else if ("array" === i) e = this._parseArray(t); else if ("string" === i) if (1 === t.childNodes.length) e = t.firstChild.nodeValue; else {
37841                  e = "";
37842                  for (let i = 0; i < t.childNodes.length; i++) e += t.childNodes[i].nodeValue;
37843                } else "false" === i ? e = !1 : "true" === i ? e = !0 : "real" === i ? e = parseFloat(t.firstChild.nodeValue) : "integer" === i && (e = parseInt(t.firstChild.nodeValue, 10));
37844                return e;
37845              }
37846              _parseArray(t) {
37847                const e = [];
37848                for (let i = 0, s = t.childNodes.length; i < s; i++) {
37849                  const s = t.childNodes[i];
37850                  1 === s.nodeType && e.push(this._parseNode(s));
37851                }
37852                return e;
37853              }
37854              _parseDict(t) {
37855                const e = {};
37856                let i = "";
37857                for (let s = 0, n = t.childNodes.length; s < n; s++) {
37858                  const n = t.childNodes[s];
37859                  1 === n.nodeType && ("key" === n.tagName ? i = n.firstChild.nodeValue : e[i] = this._parseNode(n));
37860                }
37861                return e;
37862              }
37863            };
37864            function hR(t, e) {
37865              return t[e] << 8 | t[e + 1];
37866            }
37867            var cR = new class {
37868              constructor() {
37869                this._parsing = new Rh;
37870                this._parsers = {
37871                  ".png": this.parseImage,
37872                  ".jpg": this.parseImage,
37873                  ".bmp": this.parseImage,
37874                  ".jpeg": this.parseImage,
37875                  ".gif": this.parseImage,
37876                  ".ico": this.parseImage,
37877                  ".tiff": this.parseImage,
37878                  ".webp": this.parseImage,
37879                  ".image": this.parseImage,
37880                  ".pvr": this.parsePVRTex,
37881                  ".pkm": this.parsePKMTex,
37882                  ".astc": this.parseASTCTex,
37883                  ".plist": this.parsePlist,
37884                  import: this.parseImport,
37885                  ".ccon": this.parseImport,
37886                  ".cconb": this.parseImport
37887                };
37888              }
37889              parseImage(t, e, i) {
37890                t instanceof HTMLImageElement ? i(null, t) : createImageBitmap(t, {
37891                  premultiplyAlpha: "none"
37892                }).then((t => {
37893                  i(null, t);
37894                }), (t => {
37895                  i(t, null);
37896                }));
37897              }
37898              parsePVRTex(t, e, i) {
37899                let s = null;
37900                let n = null;
37901                try {
37902                  const e = t instanceof ArrayBuffer ? t : t.buffer;
37903                  const i = new Int32Array(e, 0, 13);
37904                  if (55727696 === i[0]) {
37905                    const t = i[7];
37906                    const s = i[6];
37907                    const r = i[12] + 52;
37908                    n = {
37909                      _data: new Uint8Array(e, r),
37910                      _compressed: !0,
37911                      width: t,
37912                      height: s,
37913                      format: 0
37914                    };
37915                  } else {
37916                    if (559044176 !== i[11]) throw new Error("Invalid magic number in PVR header");
37917                    {
37918                      const t = i[0];
37919                      const s = i[1];
37920                      const r = i[2];
37921                      n = {
37922                        _data: new Uint8Array(e, t),
37923                        _compressed: !0,
37924                        width: r,
37925                        height: s,
37926                        format: 0
37927                      };
37928                    }
37929                  }
37930                } catch (t) {
37931                  s = t;
37932                }
37933                i(s, n);
37934              }
37935              parsePKMTex(t, e, i) {
37936                let s = null;
37937                let n = null;
37938                try {
37939                  const e = t instanceof ArrayBuffer ? t : t.buffer;
37940                  const i = new Uint8Array(e);
37941                  const s = hR(i, 6);
37942                  if (0 !== s && 1 !== s && 3 !== s) throw new Error("Invalid magic number in ETC header");
37943                  const r = hR(i, 12);
37944                  const o = hR(i, 14);
37945                  hR(i, 8);
37946                  hR(i, 10);
37947                  n = {
37948                    _data: new Uint8Array(e, 16),
37949                    _compressed: !0,
37950                    width: r,
37951                    height: o,
37952                    format: 0
37953                  };
37954                } catch (t) {
37955                  s = t;
37956                }
37957                i(s, n);
37958              }
37959              parseASTCTex(t, e, i) {
37960                let s = null;
37961                let n = null;
37962                try {
37963                  const e = t instanceof ArrayBuffer ? t : t.buffer;
37964                  const i = new Uint8Array(e);
37965                  if (1554098963 !== i[0] + (i[1] << 8) + (i[2] << 16) + (i[3] << 24)) throw new Error("Invalid magic number in ASTC header");
37966                  const s = i[4];
37967                  const r = i[5];
37968                  const o = i[6];
37969                  if ((s < 3 || s > 6 || r < 3 || r > 6 || o < 3 || o > 6) && (s < 4 || 7 === s || 9 === s || 11 === s || s > 12 || r < 4 || 7 === r || 9 === r || 11 === r || r > 12 || 1 !== o)) throw new Error("Invalid block number in ASTC header");
37970                  const a = function(t, e) {
37971                    return 4 === t ? Jp.RGBA_ASTC_4x4 : 5 === t ? 4 === e ? Jp.RGBA_ASTC_5x4 : Jp.RGBA_ASTC_5x5 : 6 === t ? 5 === e ? Jp.RGBA_ASTC_6x5 : Jp.RGBA_ASTC_6x6 : 8 === t ? 5 === e ? Jp.RGBA_ASTC_8x5 : 6 === e ? Jp.RGBA_ASTC_8x6 : Jp.RGBA_ASTC_8x8 : 10 === t ? 5 === e ? Jp.RGBA_ASTC_10x5 : 6 === e ? Jp.RGBA_ASTC_10x6 : 8 === e ? Jp.RGBA_ASTC_10x8 : Jp.RGBA_ASTC_10x10 : 10 === e ? Jp.RGBA_ASTC_12x10 : Jp.RGBA_ASTC_12x12;
37972                  }(s, r);
37973                  const l = i[7] + (i[8] << 8) + (i[9] << 16);
37974                  const h = i[10] + (i[11] << 8) + (i[12] << 16);
37975                  i[13], i[14], i[15];
37976                  n = {
37977                    _data: new Uint8Array(e, 16),
37978                    _compressed: !0,
37979                    width: l,
37980                    height: h,
37981                    format: a
37982                  };
37983                } catch (t) {
37984                  s = t;
37985                }
37986                i(s, n);
37987              }
37988              parsePlist(t, e, i) {
37989                let s = null;
37990                const n = lR.parse(t);
37991                n || (s = new Error("parse failed"));
37992                i(s, n);
37993              }
37994              parseImport(t, e, i) {
37995                if (!t) {
37996                  i(new Error(`The json file of asset ${e.__uuid__} is empty or missing`));
37997                  return;
37998                }
37999                let s = null;
38000                let n = null;
38001                try {
38002                  s = dA(t, e);
38003                } catch (t) {
38004                  n = t;
38005                }
38006                i(n, s);
38007              }
38008              init() {
38009                this._parsing.clear();
38010              }
38011              register(t, e) {
38012                "object" == typeof t ? ee.mixin(this._parsers, t) : this._parsers[t] = e;
38013              }
38014              parse(t, e, i, s, n) {
38015                const r = Dh.get(t);
38016                if (r) {
38017                  n(null, r);
38018                  return;
38019                }
38020                const o = this._parsing.get(t);
38021                if (o) {
38022                  o.push(n);
38023                  return;
38024                }
38025                const a = this._parsers[i];
38026                if (a) {
38027                  this._parsing.add(t, [ n ]);
38028                  a(e, s, ((e, i) => {
38029                    e ? Bh.remove(t) : Jh(i) || Dh.add(t, i);
38030                    const s = this._parsing.remove(t);
38031                    for (let t = 0, n = s.length; t < n; t++) s[t](e, i);
38032                  }));
38033                } else n(null, e);
38034              }
38035            };
38036            function uR(t, e) {
38037              let i = !1;
38038              if (!t.progress) {
38039                t.progress = {
38040                  finish: 0,
38041                  total: t.input.length,
38042                  canInvoke: !0
38043                };
38044                i = !0;
38045              }
38046              const {options: s, progress: n} = t;
38047              s.__exclude__ = s.__exclude__ || Object.create(null);
38048              t.output = [];
38049              Mw(t.input, ((r, o) => {
38050                const a = Gh.create({
38051                  input: r,
38052                  onProgress: t.onProgress,
38053                  options: s,
38054                  progress: n,
38055                  onComplete: (s, l) => {
38056                    if (s && !t.isFinish) if (!m.assetManager.force || i) {
38057                      x(s.message, s.stack);
38058                      n.canInvoke = !1;
38059                      e(s);
38060                    } else n.canInvoke && t.dispatch("progress", ++n.finish, n.total, r);
38061                    t.output.push(l);
38062                    a.recycle();
38063                    o(null);
38064                  }
38065                });
38066                _R.async(a);
38067              }), (() => {
38068                s.__exclude__ = null;
38069                if (t.isFinish) {
38070                  Cw(t, !0);
38071                  t.dispatch("error");
38072                } else {
38073                  !function(t) {
38074                    const e = t.source;
38075                    if (t.options.__outputAsArray__ || 1 !== e.length) {
38076                      const i = t.output = [];
38077                      for (let t = 0, s = e.length; t < s; t++) i.push(e[t].content);
38078                    } else t.output = e[0].content;
38079                  }(t);
38080                  Cw(t, !0);
38081                  e();
38082                }
38083              }));
38084            }
38085            const _R = new Ih("loadOneAsset", [ function(t, e) {
38086              const i = t.output = t.input;
38087              const {options: s, isNative: n, uuid: r, file: o} = i;
38088              const {reloadAsset: a} = s;
38089              o || !a && !n && Mh.has(r) ? e() : nR.load(i, t.options, ((t, s) => {
38090                i.file = s;
38091                e(t);
38092              }));
38093            }, function(t, e) {
38094              const i = t.output = t.input;
38095              const s = t.progress;
38096              const n = t.options.__exclude__;
38097              const {id: r, file: o, options: a} = i;
38098              if (i.isNative) cR.parse(r, o, i.ext, a, ((n, o) => {
38099                if (n) e(n); else {
38100                  i.content = o;
38101                  s.canInvoke && t.dispatch("progress", ++s.finish, s.total, i);
38102                  Bh.remove(r);
38103                  Dh.remove(r);
38104                  e();
38105                }
38106              })); else {
38107                const {uuid: l} = i;
38108                if (l in n) {
38109                  const {finish: r, content: o, err: a, callbacks: h} = n[l];
38110                  s.canInvoke && t.dispatch("progress", ++s.finish, s.total, i);
38111                  if (r || Pw(l, l, n)) {
38112                    o && o.addRef();
38113                    i.content = o;
38114                    e(a);
38115                  } else h.push({
38116                    done: e,
38117                    item: i
38118                  });
38119                } else if (!a.reloadAsset && Mh.has(l)) {
38120                  const n = Mh.get(l);
38121                  i.content = n.addRef();
38122                  s.canInvoke && t.dispatch("progress", ++s.finish, s.total, i);
38123                  e();
38124                } else {
38125                  a.__uuid__ = l;
38126                  cR.parse(r, o, "import", a, ((i, s) => {
38127                    i ? e(i) : function(t, e, i) {
38128                      const {input: s, progress: n} = t;
38129                      const {uuid: r, id: o, options: a, config: l} = s;
38130                      const {cacheAsset: h} = a;
38131                      const c = [];
38132                      e.addRef && e.addRef();
38133                      Rw(r, e, Object.create(null), c, l);
38134                      n.canInvoke && t.dispatch("progress", ++n.finish, n.total += c.length, s);
38135                      const u = t.options.__exclude__[r] = {
38136                        content: e,
38137                        finish: !1,
38138                        callbacks: [ {
38139                          done: i,
38140                          item: s
38141                        } ]
38142                      };
38143                      const _ = Gh.create({
38144                        input: c,
38145                        options: t.options,
38146                        onProgress: t.onProgress,
38147                        onError: Gh.prototype.recycle,
38148                        progress: n,
38149                        onComplete: t => {
38150                          e.decRef && e.decRef(!1);
38151                          u.finish = !0;
38152                          u.err = t;
38153                          if (!t) {
38154                            const t = Array.isArray(_.output) ? _.output : [ _.output ];
38155                            const i = Object.create(null);
38156                            for (const e of t) e && (i[e instanceof gc ? `${e._uuid}@import` : `${r}@native`] = e);
38157                            !function(t, e, i) {
38158                              let s = !1;
38159                              const n = cA.get(e);
38160                              if (n) {
38161                                for (let t = 0, e = n.length; t < e; t++) {
38162                                  const e = n[t];
38163                                  const r = i[`${e.uuid}@import`];
38164                                  if (r) e.owner[e.prop] = r.addRef(); else {
38165                                    x(`The asset ${e.uuid} is missing!`);
38166                                    if (e.type && e.type !== gc) {
38167                                      const t = new e.type;
38168                                      t.initDefault(e.uuid);
38169                                      e.owner[e.prop] = t;
38170                                    }
38171                                    s = !0;
38172                                  }
38173                                }
38174                                cA.delete(e);
38175                              }
38176                              if (uA.has(e)) {
38177                                if (i[`${t}@native`]) e._nativeAsset = i[`${t}@native`]; else {
38178                                  s = !0;
38179                                  console.error(`the native asset of ${t} is missing!`);
38180                                }
38181                                uA.delete(e);
38182                              }
38183                            }(r, e, i);
38184                            try {
38185                              if ("function" == typeof e.onLoaded && !_A.has(e) && !uA.has(e)) {
38186                                e.onLoaded();
38187                                _A.add(e);
38188                              }
38189                            } catch (t) {
38190                              x(`The asset ${r} is invalid for some reason, detail message: ${t.message}, stack: ${t.stack}`);
38191                            }
38192                            Bh.remove(o);
38193                            Dh.remove(o);
38194                            Iw(r, e, h);
38195                            _.recycle();
38196                          }
38197                          const i = u.callbacks;
38198                          for (let s = 0, n = i.length; s < n; s++) {
38199                            const n = i[s];
38200                            e.addRef && e.addRef();
38201                            n.item.content = e;
38202                            n.done(t);
38203                          }
38204                          i.length = 0;
38205                        }
38206                      });
38207                      Oh.async(_);
38208                    }(t, s, e);
38209                  }));
38210                }
38211              }
38212            } ]);
38213            function dR(t, e) {
38214              const i = t.options;
38215              const s = Object.create(null);
38216              const n = Object.create(null);
38217              for (const t in i) switch (t) {
38218               case Vh.PATH:
38219               case Vh.UUID:
38220               case Vh.DIR:
38221               case Vh.SCENE:
38222               case Vh.URL:
38223                break;
38224
38225               case "__requestType__":
38226               case "__isNative__":
38227               case "ext":
38228               case "type":
38229               case "__nativeName__":
38230               case "audioLoadMode":
38231               case "bundle":
38232                s[t] = i[t];
38233                break;
38234
38235               case "__exclude__":
38236               case "__outputAsArray__":
38237                n[t] = i[t];
38238                break;
38239
38240               default:
38241                s[t] = i[t];
38242                n[t] = i[t];
38243              }
38244              t.options = n;
38245              const r = Gh.create({
38246                input: t.input,
38247                options: s
38248              });
38249              let o = null;
38250              try {
38251                t.output = t.source = Lh.sync(r);
38252              } catch (t) {
38253                o = t;
38254                for (let t = 0, e = r.output.length; t < e; t++) r.output[t].recycle();
38255              }
38256              r.recycle();
38257              e(o);
38258            }
38259            class pR {
38260              constructor() {
38261                this.uuid = "";
38262                this.overrideUuid = "";
38263                this.url = "";
38264                this.ext = ".json";
38265                this.content = null;
38266                this.file = null;
38267                this.info = null;
38268                this.config = null;
38269                this.isNative = !1;
38270                this.options = Object.create(null);
38271                this._id = "";
38272              }
38273              get id() {
38274                this._id || (this._id = `${this.overrideUuid || this.uuid}@${this.isNative ? "native" : "import"}`);
38275                return this._id;
38276              }
38277              static create() {
38278                let t;
38279                t = 0 !== pR._deadPool.length ? pR._deadPool.pop() : new pR;
38280                return t;
38281              }
38282              recycle() {
38283                if (pR._deadPool.length !== pR.MAX_DEAD_NUM) {
38284                  this._id = "";
38285                  this.uuid = "";
38286                  this.overrideUuid = "";
38287                  this.url = "";
38288                  this.ext = ".json";
38289                  this.content = null;
38290                  this.file = null;
38291                  this.info = null;
38292                  this.config = null;
38293                  this.isNative = !1;
38294                  this.options = Object.create(null);
38295                  pR._deadPool.push(this);
38296                }
38297              }
38298            }
38299            pR.MAX_DEAD_NUM = 500;
38300            pR._deadPool = [];
38301            const mR = [];
38302            function fR(t) {
38303              var e;
38304              const i = t.options;
38305              const s = Array.isArray(t.input) ? t.input : [ t.input ];
38306              t.output = [];
38307              for (let r = 0; r < s.length; r++) {
38308                let o = s[r];
38309                let a = pR.create();
38310                let l = null;
38311                let h = null;
38312                if ("string" == typeof o) {
38313                  o = Object.create(null);
38314                  o[i.__requestType__ || Vh.UUID] = s[r];
38315                }
38316                if ("object" == typeof o) {
38317                  ee.addon(o, i);
38318                  o.preset && ee.addon(o, kh[o.preset]);
38319                  const t = Object.keys(o);
38320                  for (let i = 0; i < t.length; ++i) {
38321                    const r = t[i];
38322                    switch (r) {
38323                     case Vh.UUID:
38324                      {
38325                        var n;
38326                        const t = a.uuid = Wh(o.uuid);
38327                        if (!o.bundle) {
38328                          const e = Ph.find((e => !!e.getAssetInfo(t)));
38329                          o.bundle = e && e.name;
38330                        }
38331                        if (Ph.has(o.bundle)) {
38332                          l = Ph.get(o.bundle).config;
38333                          h = l.getAssetInfo(t);
38334                          if (h && h.redirect) {
38335                            if (!Ph.has(h.redirect)) throw new Error(`Please load bundle ${h.redirect} first`);
38336                            l = Ph.get(h.redirect).config;
38337                            h = l.getAssetInfo(t);
38338                          }
38339                          a.config = l;
38340                          a.info = h;
38341                        }
38342                        a.ext = o.ext || (null === (n = h) || void 0 === n ? void 0 : n.extension) || ".json";
38343                        break;
38344                      }
38345
38346                     case "__requestType__":
38347                     case "ext":
38348                     case "bundle":
38349                     case "preset":
38350                     case "type":
38351                      break;
38352
38353                     case Vh.DIR:
38354                      if (Ph.has(o.bundle)) {
38355                        Ph.get(o.bundle).config.getDirWithPath(o.dir, o.type, mR);
38356                        for (const t of mR) s.push({
38357                          uuid: t.uuid,
38358                          __isNative__: !1,
38359                          ext: t.extension || ".json",
38360                          bundle: o.bundle
38361                        });
38362                        mR.length = 0;
38363                      }
38364                      a.recycle();
38365                      a = null;
38366                      break;
38367
38368                     case Vh.PATH:
38369                      if (Ph.has(o.bundle)) {
38370                        l = Ph.get(o.bundle).config;
38371                        h = l.getInfoWithPath(o.path, o.type);
38372                        if (h && h.redirect) {
38373                          if (!Ph.has(h.redirect)) throw new Error(`you need to load bundle ${h.redirect} first`);
38374                          l = Ph.get(h.redirect).config;
38375                          h = l.getAssetInfo(h.uuid);
38376                        }
38377                        if (!h) {
38378                          a.recycle();
38379                          throw new Error(`Bundle ${o.bundle} doesn't contain ${o.path}`);
38380                        }
38381                        a.config = l;
38382                        a.uuid = h.uuid;
38383                        a.info = h;
38384                      }
38385                      a.ext = o.ext || (null === (e = h) || void 0 === e ? void 0 : e.extension) || ".json";
38386                      break;
38387
38388                     case Vh.SCENE:
38389                      if (!o.bundle) {
38390                        const t = Ph.find((t => !!t.getSceneInfo(o.scene)));
38391                        o.bundle = t && t.name;
38392                      }
38393                      if (Ph.has(o.bundle)) {
38394                        l = Ph.get(o.bundle).config;
38395                        h = l.getSceneInfo(o.scene);
38396                        if (h && h.redirect) {
38397                          if (!Ph.has(h.redirect)) throw new Error(`you need to load bundle ${h.redirect} first`);
38398                          l = Ph.get(h.redirect).config;
38399                          h = l.getAssetInfo(h.uuid);
38400                        }
38401                        if (!h) {
38402                          a.recycle();
38403                          throw new Error(`Bundle ${l.name} doesn't contain scene ${o.scene}`);
38404                        }
38405                        a.config = l;
38406                        a.uuid = h.uuid;
38407                        a.info = h;
38408                      }
38409                      break;
38410
38411                     case "__isNative__":
38412                      a.isNative = o.__isNative__;
38413                      break;
38414
38415                     case Vh.URL:
38416                      a.url = o.url;
38417                      a.uuid = o.uuid || o.url;
38418                      a.ext = o.ext || nc(o.url);
38419                      a.isNative = void 0 === o.__isNative__ || o.__isNative__;
38420                      break;
38421
38422                     default:
38423                      a.options[r] = o[r];
38424                    }
38425                    if (!a) break;
38426                  }
38427                }
38428                if (a) {
38429                  t.output.push(a);
38430                  if (!a.uuid && !a.url) throw new Error(`Can not parse this input:${JSON.stringify(o)}`);
38431                }
38432              }
38433              return null;
38434            }
38435            function gR(t) {
38436              const e = t.output = t.input;
38437              for (let t = 0; t < e.length; t++) {
38438                const s = e[t];
38439                if (Fh.has(s.uuid)) {
38440                  const t = Fh.get(s.uuid);
38441                  const e = Ph.find((e => !!e.getAssetInfo(t)));
38442                  if (e) {
38443                    var i;
38444                    s.overrideUuid = t;
38445                    let n = e.config;
38446                    let r = n.getAssetInfo(t);
38447                    if (r && r.redirect) {
38448                      if (!Ph.has(r.redirect)) throw new Error(`Please load bundle ${r.redirect} first`);
38449                      n = Ph.get(r.redirect).config;
38450                      r = n.getAssetInfo(t);
38451                    }
38452                    s.config = n;
38453                    s.info = r;
38454                    s.ext = s.isNative ? s.ext : (null === (i = r) || void 0 === i ? void 0 : i.extension) || ".json";
38455                  } else N(16201, t, s.uuid);
38456                }
38457              }
38458            }
38459            function yR(t) {
38460              const e = t.output = t.input;
38461              for (let t = 0; t < e.length; t++) {
38462                const i = e[t];
38463                if (i.url) continue;
38464                let s = "";
38465                let n = "";
38466                const r = i.config;
38467                n = i.isNative ? r && r.nativeBase ? r.base + r.nativeBase : m.assetManager.generalNativeBase : r && r.importBase ? r.base + r.importBase : m.assetManager.generalImportBase;
38468                const o = i.overrideUuid || i.uuid;
38469                let a = "";
38470                i.info && (a = i.isNative ? i.info.nativeVer ? `.${i.info.nativeVer}` : "" : i.info.ver ? `.${i.info.ver}` : "");
38471                s = ".ttf" === i.ext ? `${n}/${o.slice(0, 2)}/${o}${a}/${i.options.__nativeName__}` : `${n}/${o.slice(0, 2)}/${o}${a}${i.ext}`;
38472                i.url = s;
38473              }
38474              return null;
38475            }
38476            class bR {
38477              constructor() {
38478                this.pipeline = Oh.append(dR).append(uR);
38479                this.fetchPipeline = Nh.append(dR).append(rR);
38480                this.transformPipeline = Lh.append(fR).append(gR).append(yR);
38481                this.bundles = Ph;
38482                this.assets = Mh;
38483                this.assetsOverrideMap = Fh;
38484                this.generalImportBase = "";
38485                this.generalNativeBase = "";
38486                this.dependUtil = pA;
38487                this.force = false;
38488                this.allowImageBitmap = !Vo.isMobile;
38489                this.utils = $h;
38490                this.downloader = Jw;
38491                this.parser = cR;
38492                this.packManager = nR;
38493                this.cacheAsset = !0;
38494                this.cacheManager = null;
38495                this.presets = kh;
38496                this.factory = sR;
38497                this.preprocessPipe = dR;
38498                this.fetchPipe = rR;
38499                this.loadPipe = uR;
38500                this.references = null;
38501                this._releaseManager = vw;
38502                this._files = Bh;
38503                this._parsed = Dh;
38504                this._parsePipeline = null;
38505                this._projectBundles = [];
38506              }
38507              get main() {
38508                return Ph.get(Uh.MAIN) || null;
38509              }
38510              get resources() {
38511                return Ph.get(Uh.RESOURCES) || null;
38512              }
38513              init(t = {}) {
38514                const e = t.server || de.querySettings(_e.Category.ASSETS, "server") || "";
38515                const i = t.bundleVers || de.querySettings(_e.Category.ASSETS, "bundleVers") || {};
38516                const s = t.remoteBundles || de.querySettings(_e.Category.ASSETS, "remoteBundles") || [];
38517                this._files.clear();
38518                this._parsed.clear();
38519                this._releaseManager.init();
38520                this.assets.clear();
38521                this.bundles.clear();
38522                this.packManager.init();
38523                this.downloader.init(e, i, s);
38524                this.parser.init();
38525                this.dependUtil.init();
38526                let n = t.importBase || de.querySettings(_e.Category.ASSETS, "importBase") || "";
38527                n && n.endsWith("/") && (n = n.substr(0, n.length - 1));
38528                let r = t.nativeBase || de.querySettings(_e.Category.ASSETS, "nativeBase") || "";
38529                r && r.endsWith("/") && (r = r.substr(0, r.length - 1));
38530                this.generalImportBase = n;
38531                this.generalNativeBase = r;
38532                this._projectBundles = de.querySettings(_e.Category.ASSETS, "projectBundles") || [];
38533                const o = de.querySettings(_e.Category.ASSETS, "assetsOverrides") || {};
38534                for (const t in o) this.assetsOverrideMap.set(t, o[t]);
38535              }
38536              getBundle(t) {
38537                return Ph.get(t) || null;
38538              }
38539              removeBundle(t) {
38540                t._destroy();
38541                Ph.remove(t.name);
38542              }
38543              loadAny(t, e, i, s) {
38544                const {options: n, onProgress: r, onComplete: o} = Bw(e, i, s);
38545                n.preset = n.preset || "default";
38546                t = Array.isArray(t) ? t.slice() : t;
38547                const a = Gh.create({
38548                  input: t,
38549                  onProgress: r,
38550                  onComplete: Ow(o),
38551                  options: n
38552                });
38553                Oh.async(a);
38554              }
38555              preloadAny(t, e, i, s) {
38556                const {options: n, onProgress: r, onComplete: o} = Bw(e, i, s);
38557                n.preset = n.preset || "preload";
38558                t = Array.isArray(t) ? t.slice() : t;
38559                const a = Gh.create({
38560                  input: t,
38561                  onProgress: r,
38562                  onComplete: Ow(o),
38563                  options: n
38564                });
38565                Nh.async(a);
38566              }
38567              loadRemote(t, e, i) {
38568                const {options: s, onComplete: n} = Bw(e, void 0, i);
38569                if (s.reloadAsset || !this.assets.has(t)) {
38570                  s.__isNative__ = !0;
38571                  s.preset = s.preset || "remote";
38572                  this.loadAny({
38573                    url: t
38574                  }, s, null, ((e, i) => {
38575                    if (e) {
38576                      x(e.message, e.stack);
38577                      n && n(e, i);
38578                    } else sR.create(t, i, s.ext || nc(t), s, ((t, e) => {
38579                      n && n(t, e);
38580                    }));
38581                  }));
38582                } else Ow(n)(null, this.assets.get(t));
38583              }
38584              loadBundle(t, e, i) {
38585                const {options: s, onComplete: n} = Bw(e, void 0, i);
38586                const r = oc(t);
38587                if (this.bundles.has(r)) Ow(n)(null, this.getBundle(r)); else {
38588                  s.preset = s.preset || "bundle";
38589                  s.ext = "bundle";
38590                  s.__isNative__ = !0;
38591                  this.loadAny({
38592                    url: t
38593                  }, s, null, ((e, i) => {
38594                    if (e) {
38595                      x(e.message, e.stack);
38596                      n && n(e, i);
38597                    } else sR.create(t, i, "bundle", s, ((t, e) => {
38598                      n && n(t, e);
38599                    }));
38600                  }));
38601                }
38602              }
38603              releaseAsset(t) {
38604                vw.tryRelease(t, !0);
38605              }
38606              releaseUnusedAssets() {
38607                Mh.forEach((t => {
38608                  vw.tryRelease(t);
38609                }));
38610              }
38611              releaseAll() {
38612                Mh.forEach((t => {
38613                  vw.tryRelease(t, !0);
38614                }));
38615              }
38616              loadWithJson(t, e, i, s) {
38617                throw new Error("Only valid in Editor");
38618              }
38619            }
38620            t("AssetManager", bR);
38621            bR.Pipeline = Ih;
38622            bR.Task = Gh;
38623            bR.Cache = Rh;
38624            bR.RequestItem = pR;
38625            bR.Bundle = Nw;
38626            bR.BuiltinBundleName = Uh;
38627            var SR = t("assetManager", m.assetManager = new bR);
38628            m.AssetManager = bR;
38629            const AR = nr.RenderPipeline;
38630            m.RenderPipeline = AR;
38631            const TR = jsb.Texture2D;
38632            const vR = jsb.ImageAsset;
38633            const ER = jsb.BuiltinResMgr;
38634            const CR = ER.prototype;
38635            CR.init = function() {
38636              this._resources = {};
38637              this._materialsToBeCompiled = [];
38638              const t = this._resources;
38639              const e = new Uint8Array(16);
38640              for (let t = 0; t < 4; t++) {
38641                e[0] = 0;
38642                e[1] = 0;
38643                e[2] = 0;
38644                e[3] = 255;
38645              }
38646              const i = {
38647                width: 2,
38648                height: 2,
38649                _data: e,
38650                _compressed: !1,
38651                format: TR.PixelFormat.RGBA8888
38652              };
38653              const s = new vR(i);
38654              const n = new TR;
38655              n._uuid = "black-texture";
38656              n.image = s;
38657              t[n._uuid] = n;
38658              if (m.SpriteFrame) {
38659                const e = new m.SpriteFrame;
38660                const i = s;
38661                const n = new TR;
38662                n.image = i;
38663                e.texture = n;
38664                e._uuid = "default-spriteframe";
38665                t[e._uuid] = e;
38666              }
38667              this.initBuiltinRes();
38668            };
38669            CR.get = function(t) {
38670              return this._resources[t] || this.getAsset(t);
38671            };
38672            CR.compileBuiltinMaterial = function() {
38673              for (let t = 0; t < this._materialsToBeCompiled.length; ++t) {
38674                const e = this._materialsToBeCompiled[t];
38675                for (let t = 0; t < e.passes.length; ++t) e.passes[t].tryCompile();
38676              }
38677              this._materialsToBeCompiled.length = 0;
38678            };
38679            CR.loadBuiltinAssets = function() {
38680              const t = de.querySettings(_e.Category.ENGINE, "builtinAssets");
38681              if (!t) return Promise.resolve();
38682              const e = this._resources;
38683              return new Promise(((i, s) => {
38684                SR.loadBundle(Uh.INTERNAL, ((n, r) => {
38685                  n ? s(n) : SR.loadAny(t, ((t, n) => {
38686                    if (t) s(t); else {
38687                      n.forEach((t => {
38688                        e[t.name] = t;
38689                        t.nativeUrl;
38690                        vw.addIgnoredAsset(t);
38691                        this.addAsset(t.name, t);
38692                        t instanceof m.Material && this._materialsToBeCompiled.push(t);
38693                      }));
38694                      i();
38695                    }
38696                  }));
38697                }));
38698              }));
38699            };
38700            const xR = t("builtinResMgr", m.builtinResMgr = ER.getInstance());
38701            const wR = new class {
38702              constructor() {
38703                this._allRenderers = [];
38704                this._dirtyRenderers = [];
38705                this._dirtyVersion = 0;
38706              }
38707              addRenderer(t) {
38708                if (-1 === t._internalId) {
38709                  t._internalId = this._allRenderers.length;
38710                  this._allRenderers.push(t);
38711                }
38712              }
38713              removeRenderer(t) {
38714                if (-1 !== t._internalId) {
38715                  w(this._allRenderers[t._internalId] === t);
38716                  const e = t._internalId;
38717                  this._allRenderers[this._allRenderers.length - 1]._internalId = e;
38718                  ee.array.fastRemoveAt(this._allRenderers, e);
38719                  t._internalId = -1;
38720                  if (t._dirtyVersion === this._dirtyVersion) {
38721                    ee.array.fastRemove(this._dirtyRenderers, t);
38722                    t._dirtyVersion = -1;
38723                  }
38724                }
38725              }
38726              markDirtyRenderer(t) {
38727                if (t._dirtyVersion !== this._dirtyVersion && -1 !== t._internalId) {
38728                  this._dirtyRenderers.push(t);
38729                  t._dirtyVersion = this._dirtyVersion;
38730                }
38731              }
38732              updateAllDirtyRenderers() {
38733                const t = this._dirtyRenderers.length;
38734                const e = this._dirtyRenderers;
38735                for (let i = 0; i < t; i++) {
38736                  w(-1 !== e[i]._internalId);
38737                  e[i].updateRenderer();
38738                }
38739                this._dirtyRenderers.length = 0;
38740                this._dirtyVersion++;
38741              }
38742            };
38743            class RR extends vo {
38744              constructor() {
38745                super();
38746                this._compScheduler = void 0;
38747                this._nodeActivator = void 0;
38748                this._invalid = void 0;
38749                this._paused = void 0;
38750                this._root = void 0;
38751                this._loadingScene = void 0;
38752                this._scene = void 0;
38753                this._totalFrames = void 0;
38754                this._scheduler = void 0;
38755                this._systems = void 0;
38756                this._persistRootNodes = {};
38757                this._invalid = !1;
38758                this._paused = !1;
38759                this._root = null;
38760                this._loadingScene = "";
38761                this._scene = null;
38762                this._totalFrames = 0;
38763                this._scheduler = new Rg;
38764                this._compScheduler = new Mv;
38765                this._nodeActivator = new Uv;
38766                this._systems = [];
38767              }
38768              calculateDeltaTime(t) {}
38769              end() {
38770                this.once(RR.EVENT_END_FRAME, (() => {
38771                  this.purgeDirector();
38772                }));
38773              }
38774              pause() {
38775                this._paused || (this._paused = !0);
38776              }
38777              purgeDirector() {
38778                this._scheduler.unscheduleAll();
38779                this._compScheduler.unscheduleAll();
38780                this._nodeActivator.reset();
38781                m.isValid(this._scene) && this._scene.destroy();
38782                this._scene = null;
38783                this.stopAnimation();
38784                m.assetManager.releaseAll();
38785              }
38786              reset() {
38787                var t;
38788                this.purgeDirector();
38789                for (const t in this._persistRootNodes) this.removePersistRootNode(this._persistRootNodes[t]);
38790                null === (t = this.getScene()) || void 0 === t || t.destroy();
38791                this.emit(RR.EVENT_RESET);
38792                this.startAnimation();
38793              }
38794              runSceneImmediate(t, e, i) {
38795                t instanceof yC && (t = t.scene);
38796                k(t instanceof oA, 1216);
38797                console.time("InitScene");
38798                t._load();
38799                console.timeEnd("InitScene");
38800                console.time("AttachPersist");
38801                const s = Object.keys(this._persistRootNodes).map((t => this._persistRootNodes[t]));
38802                for (let e = 0; e < s.length; e++) {
38803                  const i = s[e];
38804                  i.emit(_y.EventType.SCENE_CHANGED_FOR_PERSISTS, t.renderScene);
38805                  const n = t.uuid === i._originalSceneId && t.getChildByUuid(i.uuid);
38806                  if (n) {
38807                    const e = n.getSiblingIndex();
38808                    i.hideFlags &= ~co.Flags.DontSave;
38809                    i.hideFlags |= co.Flags.DontSave & n.hideFlags;
38810                    n._destroyImmediate();
38811                    t.insertChild(i, e);
38812                  } else {
38813                    i.hideFlags |= co.Flags.DontSave;
38814                    i.parent = t;
38815                  }
38816                }
38817                console.timeEnd("AttachPersist");
38818                const n = this._scene;
38819                console.time("Destroy");
38820                m.isValid(n) && n.destroy();
38821                console.time("AutoRelease");
38822                m.assetManager._releaseManager._autoRelease(n, t, this._persistRootNodes);
38823                console.timeEnd("AutoRelease");
38824                this._scene = null;
38825                co._deferredDestroy();
38826                console.timeEnd("Destroy");
38827                e && e();
38828                this.emit(RR.EVENT_BEFORE_SCENE_LAUNCH, t);
38829                this._scene = t;
38830                console.time("Activate");
38831                t._activate();
38832                console.timeEnd("Activate");
38833                this._root && this._root.resetCumulativeTime();
38834                this.startAnimation();
38835                i && i(null, t);
38836                this.emit(RR.EVENT_AFTER_SCENE_LAUNCH, t);
38837              }
38838              runScene(t, e, i) {
38839                t instanceof yC && (t = t.scene);
38840                k(t, 1205);
38841                k(t instanceof oA, 1216);
38842                t._load();
38843                this.once(RR.EVENT_END_FRAME, (() => {
38844                  this.runSceneImmediate(t, e, i);
38845                }));
38846              }
38847              loadScene(t, e, i) {
38848                if (this._loadingScene) {
38849                  N(1208, t, this._loadingScene);
38850                  return !1;
38851                }
38852                const s = m.assetManager.bundles.find((e => !!e.getSceneInfo(t)));
38853                if (s) {
38854                  this.emit(RR.EVENT_BEFORE_SCENE_LOADING, t);
38855                  this._loadingScene = t;
38856                  console.time(`LoadScene ${t}`);
38857                  s.loadScene(t, ((s, n) => {
38858                    console.timeEnd(`LoadScene ${t}`);
38859                    this._loadingScene = "";
38860                    if (s) {
38861                      x(s);
38862                      e && e(s);
38863                    } else this.runSceneImmediate(n, i, e);
38864                  }));
38865                  return !0;
38866                }
38867                F(1209, t);
38868                return !1;
38869              }
38870              preloadScene(t, e, i) {
38871                const s = m.assetManager.bundles.find((e => !!e.getSceneInfo(t)));
38872                if (s) s.preloadScene(t, null, e, i); else {
38873                  const e = `Can not preload the scene "${t}" because it is not in the build settings.`;
38874                  i && i(new Error(e));
38875                  x(`preloadScene: ${e}`);
38876                }
38877              }
38878              resume() {
38879                this._paused && (this._paused = !1);
38880              }
38881              get root() {
38882                return this._root;
38883              }
38884              getScene() {
38885                return this._scene;
38886              }
38887              getDeltaTime() {
38888                return m.game.deltaTime;
38889              }
38890              getTotalTime() {
38891                return m.game.totalTime;
38892              }
38893              getCurrentTime() {
38894                return m.game.frameStartTime;
38895              }
38896              getTotalFrames() {
38897                return this._totalFrames;
38898              }
38899              isPaused() {
38900                return this._paused;
38901              }
38902              getScheduler() {
38903                return this._scheduler;
38904              }
38905              setScheduler(t) {
38906                if (this._scheduler !== t) {
38907                  this.unregisterSystem(this._scheduler);
38908                  this._scheduler = t;
38909                  this.registerSystem(Rg.ID, t, 200);
38910                }
38911              }
38912              registerSystem(t, e, i) {
38913                e.id = t;
38914                e.priority = i;
38915                this._systems.push(e);
38916                this._systems.sort(Tg.sortByPriority);
38917              }
38918              unregisterSystem(t) {
38919                ee.array.fastRemove(this._systems, t);
38920                this._systems.sort(Tg.sortByPriority);
38921              }
38922              getSystem(t) {
38923                return this._systems.find((e => e.id === t));
38924              }
38925              getAnimationManager() {
38926                return this.getSystem(m.AnimationManager.ID);
38927              }
38928              startAnimation() {
38929                this._invalid = !1;
38930              }
38931              stopAnimation() {
38932                this._invalid = !0;
38933              }
38934              mainLoop(t) {
38935                let e;
38936                e = m.game._calculateDT(t);
38937                this.tick(e);
38938              }
38939              tick(t) {
38940                if (!this._invalid) {
38941                  this.emit(RR.EVENT_BEGIN_FRAME);
38942                  lv._frameDispatchEvents();
38943                  if (!this._paused) {
38944                    this.emit(RR.EVENT_BEFORE_UPDATE);
38945                    this._compScheduler.startPhase();
38946                    this._compScheduler.updatePhase(t);
38947                    for (let e = 0; e < this._systems.length; ++e) this._systems[e].update(t);
38948                    this._compScheduler.lateUpdatePhase(t);
38949                    this.emit(RR.EVENT_AFTER_UPDATE);
38950                    co._deferredDestroy();
38951                    for (let e = 0; e < this._systems.length; ++e) this._systems[e].postUpdate(t);
38952                  }
38953                  this.emit(RR.EVENT_BEFORE_DRAW);
38954                  wR.updateAllDirtyRenderers();
38955                  this._root.frameMove(t);
38956                  this.emit(RR.EVENT_AFTER_DRAW);
38957                  _y.resetHasChangedFlags();
38958                  _y.clearNodeArray();
38959                  Zr.update(t);
38960                  this.emit(RR.EVENT_END_FRAME);
38961                  this._totalFrames++;
38962                }
38963              }
38964              init() {
38965                this._totalFrames = 0;
38966                this._paused = !1;
38967                this.registerSystem(Rg.ID, this._scheduler, 200);
38968                this._root = new cw(zo.gfxDevice);
38969                this._root.initialize({});
38970                for (let t = 0; t < this._systems.length; t++) this._systems[t].init();
38971                this.emit(RR.EVENT_INIT);
38972              }
38973              addPersistRootNode(t) {
38974                if (!m.Node.isNode(t) || !t.uuid) {
38975                  N(3800);
38976                  return;
38977                }
38978                const e = t.uuid;
38979                if (!this._persistRootNodes[e]) {
38980                  const i = this._scene;
38981                  if (m.isValid(i)) if (t.parent) {
38982                    if (!(t.parent instanceof oA)) {
38983                      N(3801);
38984                      return;
38985                    }
38986                    if (t.parent !== i) {
38987                      N(3802);
38988                      return;
38989                    }
38990                    t._originalSceneId = i.uuid;
38991                  } else {
38992                    t.parent = i;
38993                    t._originalSceneId = i.uuid;
38994                  }
38995                  this._persistRootNodes[e] = t;
38996                  t._persistNode = !0;
38997                  m.assetManager._releaseManager._addPersistNodeRef(t);
38998                }
38999              }
39000              removePersistRootNode(t) {
39001                const e = t.uuid || "";
39002                if (t === this._persistRootNodes[e]) {
39003                  delete this._persistRootNodes[e];
39004                  t._persistNode = !1;
39005                  t._originalSceneId = "";
39006                  m.assetManager._releaseManager._removePersistNodeRef(t);
39007                }
39008              }
39009              isPersistRootNode(t) {
39010                return !!t._persistNode;
39011              }
39012            }
39013            t("Director", RR);
39014            RR.EVENT_INIT = "director_init";
39015            RR.EVENT_RESET = "director_reset";
39016            RR.EVENT_BEFORE_SCENE_LOADING = "director_before_scene_loading";
39017            RR.EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch";
39018            RR.EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch";
39019            RR.EVENT_BEFORE_UPDATE = "director_before_update";
39020            RR.EVENT_AFTER_UPDATE = "director_after_update";
39021            RR.EVENT_BEFORE_DRAW = "director_before_draw";
39022            RR.EVENT_AFTER_DRAW = "director_after_draw";
39023            RR.EVENT_BEFORE_COMMIT = "director_before_commit";
39024            RR.EVENT_BEFORE_PHYSICS = "director_before_physics";
39025            RR.EVENT_AFTER_PHYSICS = "director_after_physics";
39026            RR.EVENT_BEGIN_FRAME = "director_begin_frame";
39027            RR.EVENT_END_FRAME = "director_end_frame";
39028            RR.instance = void 0;
39029            m.Director = RR;
39030            const IR = t("director", RR.instance = m.director = new RR);
39031            class MR extends vo {
39032              constructor(...t) {
39033                super(...t);
39034                this.frame = null;
39035                this.container = null;
39036                this.canvas = null;
39037                this.renderType = -1;
39038                this.eventTargetOn = super.on;
39039                this.eventTargetOnce = super.once;
39040                this.config = {};
39041                this.onStart = null;
39042                this.frameTime = 1e3 / 60;
39043                this._isCloning = !1;
39044                this._inited = !1;
39045                this._engineInited = !1;
39046                this._rendererInitialized = !1;
39047                this._paused = !0;
39048                this._frameRate = 60;
39049                this._pacer = null;
39050                this._initTime = 0;
39051                this._startTime = 0;
39052                this._deltaTime = 0;
39053                this._shouldLoadLaunchScene = !0;
39054                this.onPreBaseInitDelegate = new Eo;
39055                this.onPostBaseInitDelegate = new Eo;
39056                this.onPreInfrastructureInitDelegate = new Eo;
39057                this.onPostInfrastructureInitDelegate = new Eo;
39058                this.onPreSubsystemInitDelegate = new Eo;
39059                this.onPostSubsystemInitDelegate = new Eo;
39060                this.onPreProjectInitDelegate = new Eo;
39061                this.onPostProjectInitDelegate = new Eo;
39062              }
39063              get inited() {
39064                return this._inited;
39065              }
39066              get frameRate() {
39067                return this._frameRate;
39068              }
39069              set frameRate(t) {
39070                if ("number" != typeof t) {
39071                  t = parseInt(t, 10);
39072                  Number.isNaN(t) && (t = 60);
39073                }
39074                this._frameRate = t;
39075                this.frameTime = 1e3 / t;
39076                this._pacer && (this._pacer.targetFrameRate = this._frameRate);
39077              }
39078              get deltaTime() {
39079                return this._deltaTime;
39080              }
39081              get totalTime() {
39082                return performance.now() - this._initTime;
39083              }
39084              get frameStartTime() {
39085                return this._startTime;
39086              }
39087              setFrameRate(t) {
39088                this.frameRate = t;
39089              }
39090              getFrameRate() {
39091                return this.frameRate;
39092              }
39093              step() {
39094                IR.tick(this.frameTime / 1e3);
39095              }
39096              pause() {
39097                var t;
39098                if (!this._paused) {
39099                  this._paused = !0;
39100                  null === (t = this._pacer) || void 0 === t || t.stop();
39101                }
39102              }
39103              resume() {
39104                var t;
39105                if (this._paused) {
39106                  lv._clearEvents();
39107                  this._paused = !1;
39108                  null === (t = this._pacer) || void 0 === t || t.start();
39109                }
39110              }
39111              isPaused() {
39112                return this._paused;
39113              }
39114              restart() {
39115                return new Promise((t => {
39116                  IR.once(RR.EVENT_END_FRAME, (() => t()));
39117                })).then((() => {
39118                  IR.reset();
39119                  m.Object._deferredDestroy();
39120                  this.pause();
39121                  this.resume();
39122                  this._shouldLoadLaunchScene = !0;
39123                  Ag.instance.curTime = 0;
39124                  this._safeEmit(MR.EVENT_RESTART);
39125                }));
39126              }
39127              end() {
39128                Po.close();
39129              }
39130              on(t, e, i, s) {
39131                (this._engineInited && t === MR.EVENT_ENGINE_INITED || this._inited && t === MR.EVENT_GAME_INITED || this._rendererInitialized && t === MR.EVENT_RENDERER_INITED) && e.call(i);
39132                return this.eventTargetOn(t, e, i, s);
39133              }
39134              once(t, e, i) {
39135                return this._engineInited && t === MR.EVENT_ENGINE_INITED ? e.call(i) : this.eventTargetOnce(t, e, i);
39136              }
39137              init(t) {
39138                this._compatibleWithOldParams(t);
39139                return Promise.resolve().then((() => {
39140                  this.emit(MR.EVENT_PRE_BASE_INIT);
39141                  return this.onPreBaseInitDelegate.dispatch();
39142                })).then((() => {
39143                  console.time("Init Base");
39144                  I(t.debugMode || U.NONE);
39145                  Vo.init();
39146                  this._initEvents();
39147                })).then((() => de.init(t.settingsPath, t.overrideSettings))).then((() => {
39148                  console.timeEnd("Init Base");
39149                  if (Vo.isXR) {
39150                    var t, e;
39151                    xr.entry = xr.XrEntry.getInstance();
39152                    const i = null !== (t = de.querySettings(_e.Category.RENDERING, "msaa")) && void 0 !== t ? t : 1;
39153                    const s = null !== (e = de.querySettings(_e.Category.RENDERING, "renderingScale")) && void 0 !== e ? e : 1;
39154                    xr.entry.setMultisamplesRTT(i);
39155                    xr.entry.setRenderingScale(s);
39156                  }
39157                  this.emit(MR.EVENT_POST_BASE_INIT);
39158                  return this.onPostBaseInitDelegate.dispatch();
39159                })).then((() => {
39160                  this.emit(MR.EVENT_PRE_INFRASTRUCTURE_INIT);
39161                  return this.onPreInfrastructureInitDelegate.dispatch();
39162                })).then((() => {
39163                  console.time("Init Infrastructure");
39164                  pe.init();
39165                  const t = function() {
39166                    const t = document.createElement("div");
39167                    return {
39168                      frame: document.documentElement,
39169                      canvas: window.__canvas,
39170                      container: t
39171                    };
39172                  }();
39173                  if (t) {
39174                    this.canvas = t.canvas;
39175                    this.frame = t.frame;
39176                    this.container = t.container;
39177                  }
39178                  Fo.init();
39179                  _s.init();
39180                  zo.init(this.canvas, Rm);
39181                  SR.init();
39182                  xR.init();
39183                  mm.init();
39184                  this.initPacer();
39185                  console.timeEnd("Init Infrastructure");
39186                })).then((() => {
39187                  this.emit(MR.EVENT_POST_INFRASTRUCTURE_INIT);
39188                  return this.onPostInfrastructureInitDelegate.dispatch();
39189                })).then((() => {
39190                  this.emit(MR.EVENT_PRE_SUBSYSTEM_INIT);
39191                  return this.onPreSubsystemInitDelegate.dispatch();
39192                })).then((() => {
39193                  console.time("Init SubSystem");
39194                  IR.init();
39195                  return xR.loadBuiltinAssets();
39196                })).then((() => {
39197                  console.timeEnd("Init SubSystem");
39198                  this.emit(MR.EVENT_POST_SUBSYSTEM_INIT);
39199                  return this.onPostSubsystemInitDelegate.dispatch();
39200                })).then((() => {
39201                  E(`Cocos Creator v${f}`);
39202                  this.emit(MR.EVENT_ENGINE_INITED);
39203                  this._engineInited = !0;
39204                })).then((() => {
39205                  this.emit(MR.EVENT_PRE_PROJECT_INIT);
39206                  return this.onPreProjectInitDelegate.dispatch();
39207                })).then((() => {
39208                  console.time("Init Project");
39209                  const t = de.querySettings(_e.Category.PLUGINS, "jsList");
39210                  let e = Promise.resolve();
39211                  if (t) {
39212                    de.querySettings(_e.Category.PATH, "projectPath");
39213                    t.forEach((t => {
39214                      e = e.then((() => function(t) {
39215                        if (window.oh) {
39216                          window.oh.loadModule(t);
39217                          return Promise.resolve();
39218                        }
39219                        return i(260)(t);
39220                      }(`src/${t}`)));
39221                    }));
39222                  }
39223                  return e;
39224                })).then((() => {
39225                  const t = de.querySettings(_e.Category.SCRIPTING, "scriptPackages");
39226                  return t ? Promise.all(t.map((t => e.import(t)))) : Promise.resolve([]);
39227                })).then((() => this._loadProjectBundles())).then((() => this._setupRenderPipeline())).then((() => this._loadPreloadAssets())).then((() => {
39228                  xR.compileBuiltinMaterial();
39229                  return Ag.instance.init();
39230                })).then((() => {
39231                  console.timeEnd("Init Project");
39232                  this.emit(MR.EVENT_POST_PROJECT_INIT);
39233                  return this.onPostProjectInitDelegate.dispatch();
39234                })).then((() => {
39235                  this._inited = !0;
39236                  this._safeEmit(MR.EVENT_GAME_INITED);
39237                }));
39238              }
39239              _compatibleWithOldParams(t) {
39240                const e = t.overrideSettings = t.overrideSettings || {};
39241                if ("showFPS" in t) {
39242                  e.profiling = e.profiling || {};
39243                  e.profiling.showFPS = t.showFPS;
39244                }
39245                if ("frameRate" in t) {
39246                  e.screen = e.screen || {};
39247                  e.screen.frameRate = t.frameRate;
39248                }
39249                if ("renderMode" in t) {
39250                  e.rendering = e.rendering || {};
39251                  e.rendering.renderMode = t.renderMode;
39252                }
39253                if ("renderPipeline" in t) {
39254                  e.rendering = e.rendering || {};
39255                  e.rendering.renderPipeline = t.renderPipeline;
39256                }
39257                if ("assetOptions" in t) {
39258                  e.assets = e.assets || {};
39259                  Object.assign(e.assets, t.assetOptions);
39260                }
39261                if ("customJointTextureLayouts" in t) {
39262                  e.animation = e.animation || {};
39263                  e.animation.customJointTextureLayouts = t.customJointTextureLayouts;
39264                }
39265                if ("physics" in t) {
39266                  e.physics = e.physics || {};
39267                  Object.assign(e.physics, t.physics);
39268                }
39269                if ("orientation" in t) {
39270                  e.screen = e.screen || {};
39271                  e.screen.orientation = t.orientation;
39272                }
39273                if ("exactFitScreen" in t) {
39274                  e.screen = e.screen || {};
39275                  e.screen.exactFitScreen = t.exactFitScreen;
39276                }
39277              }
39278              _loadPreloadAssets() {
39279                const t = de.querySettings(_e.Category.ASSETS, "preloadAssets");
39280                return t ? Promise.all(t.map((t => new Promise(((e, i) => {
39281                  SR.loadAny(t, (t => {
39282                    t ? i(t) : e();
39283                  }));
39284                }))))) : Promise.resolve([]);
39285              }
39286              _loadProjectBundles() {
39287                const t = de.querySettings(_e.Category.ASSETS, "preloadBundles");
39288                return t ? Promise.all(t.map((({bundle: t, version: e}) => new Promise(((i, s) => {
39289                  const n = {};
39290                  e && (n.version = e);
39291                  SR.loadBundle(t, n, (t => {
39292                    t ? s(t) : i();
39293                  }));
39294                }))))) : Promise.resolve([]);
39295              }
39296              run(t) {
39297                t && (this.onStart = t);
39298                this._inited && this.resume();
39299              }
39300              _calculateDT() {
39301                const t = performance.now();
39302                this._deltaTime = t > this._startTime ? (t - this._startTime) / 1e3 : 0;
39303                this._deltaTime > MR.DEBUG_DT_THRESHOLD && (this._deltaTime = this.frameTime / 1e3);
39304                this._startTime = t;
39305                return this._deltaTime;
39306              }
39307              _updateCallback() {
39308                if (this._inited) if (Ag.instance.isFinished) if (this._shouldLoadLaunchScene) {
39309                  this._shouldLoadLaunchScene = !1;
39310                  const e = de.querySettings(_e.Category.LAUNCH, "launchScene");
39311                  if (e) IR.loadScene(e, (() => {
39312                    var t;
39313                    console.log(`Success to load scene: ${e}`);
39314                    this._initTime = performance.now();
39315                    IR.startAnimation();
39316                    null === (t = this.onStart) || void 0 === t || t.call(this);
39317                  })); else {
39318                    var t;
39319                    this._initTime = performance.now();
39320                    IR.startAnimation();
39321                    null === (t = this.onStart) || void 0 === t || t.call(this);
39322                  }
39323                } else IR.tick(this._calculateDT()); else Ag.instance.update(this._calculateDT());
39324              }
39325              initPacer() {
39326                var t;
39327                const e = null !== (t = de.querySettings(_e.Category.SCREEN, "frameRate")) && void 0 !== t ? t : 60;
39328                w("number" == typeof e);
39329                this._pacer = new fw;
39330                this._pacer.onTick = this._updateCallback.bind(this);
39331                this.frameRate = e;
39332              }
39333              _initEvents() {
39334                Po.on("show", this._onShow, this);
39335                Po.on("hide", this._onHide, this);
39336              }
39337              _onHide() {
39338                this.emit(MR.EVENT_HIDE);
39339                this.pause();
39340              }
39341              _onShow() {
39342                this.emit(MR.EVENT_SHOW);
39343                this.resume();
39344              }
39345              addPersistRootNode(t) {
39346                IR.addPersistRootNode(t);
39347              }
39348              removePersistRootNode(t) {
39349                IR.removePersistRootNode(t);
39350              }
39351              isPersistRootNode(t) {
39352                return IR.isPersistRootNode(t);
39353              }
39354              _setupRenderPipeline() {
39355                const t = de.querySettings(_e.Category.RENDERING, "renderPipeline");
39356                return t ? new Promise(((e, i) => {
39357                  SR.loadAny(t, ((t, s) => !t && s instanceof AR ? e(s) : i(t)));
39358                })).then((t => {
39359                  this._setRenderPipeline(t);
39360                })).catch((e => {
39361                  C(e);
39362                  C(`Failed load render pipeline: ${t}, engine failed to initialize, will fallback to default pipeline`);
39363                  this._setRenderPipeline();
39364                })) : this._setRenderPipeline();
39365              }
39366              _setRenderPipeline(t) {
39367                IR.root.setRenderPipeline(t) || this._setRenderPipeline();
39368                this._rendererInitialized = !0;
39369                this._safeEmit(MR.EVENT_RENDERER_INITED);
39370              }
39371              _safeEmit(t) {
39372                this.emit(t);
39373              }
39374            }
39375            t("Game", MR);
39376            MR.EVENT_HIDE = "game_on_hide";
39377            MR.EVENT_SHOW = "game_on_show";
39378            MR.EVENT_LOW_MEMORY = "game_on_low_memory";
39379            MR.EVENT_GAME_INITED = "game_inited";
39380            MR.EVENT_ENGINE_INITED = "engine_inited";
39381            MR.EVENT_RENDERER_INITED = "renderer_inited";
39382            MR.EVENT_PRE_BASE_INIT = "pre_base_init";
39383            MR.EVENT_POST_BASE_INIT = "post_base_init";
39384            MR.EVENT_PRE_INFRASTRUCTURE_INIT = "pre_infrastructure_init";
39385            MR.EVENT_POST_INFRASTRUCTURE_INIT = "post_infrastructure_init";
39386            MR.EVENT_PRE_SUBSYSTEM_INIT = "pre_subsystem_init";
39387            MR.EVENT_POST_SUBSYSTEM_INIT = "post_subsystem_init";
39388            MR.EVENT_PRE_PROJECT_INIT = "pre_project_init";
39389            MR.EVENT_POST_PROJECT_INIT = "post_project_init";
39390            MR.EVENT_RESTART = "game_on_restart";
39391            MR.RENDER_TYPE_CANVAS = 0;
39392            MR.RENDER_TYPE_WEBGL = 1;
39393            MR.RENDER_TYPE_OPENGL = 2;
39394            MR.RENDER_TYPE_HEADLESS = 3;
39395            MR.DEBUG_DT_THRESHOLD = 1;
39396            m.Game = MR;
39397            const BR = t("game", m.game = new MR);
39398            const DR = {};
39399            W(DR, "vmath", [ {
39400              name: "vec2",
39401              newName: "Vec2",
39402              target: us,
39403              targetName: "math"
39404            }, {
39405              name: "vec3",
39406              newName: "Vec3",
39407              target: us,
39408              targetName: "math"
39409            }, {
39410              name: "vec4",
39411              newName: "Vec4",
39412              target: us,
39413              targetName: "math"
39414            }, {
39415              name: "quat",
39416              newName: "Quat",
39417              target: us,
39418              targetName: "math"
39419            }, {
39420              name: "mat3",
39421              newName: "Mat3",
39422              target: us,
39423              targetName: "math"
39424            }, {
39425              name: "mat4",
39426              newName: "Mat4",
39427              target: us,
39428              targetName: "math"
39429            }, {
39430              name: "color4",
39431              newName: "Color",
39432              target: us,
39433              targetName: "math"
39434            }, {
39435              name: "rect",
39436              newName: "Rect",
39437              target: us,
39438              targetName: "math"
39439            }, {
39440              name: "approx",
39441              newName: "approx",
39442              target: us,
39443              targetName: "math"
39444            }, {
39445              name: "EPSILON",
39446              newName: "EPSILON",
39447              target: us,
39448              targetName: "math"
39449            }, {
39450              name: "equals",
39451              newName: "equals",
39452              target: us,
39453              targetName: "math"
39454            }, {
39455              name: "clamp",
39456              newName: "clamp",
39457              target: us,
39458              targetName: "math"
39459            }, {
39460              name: "clamp01",
39461              newName: "clamp01",
39462              target: us,
39463              targetName: "math"
39464            }, {
39465              name: "lerp",
39466              newName: "lerp",
39467              target: us,
39468              targetName: "math"
39469            }, {
39470              name: "toRadian",
39471              newName: "toRadian",
39472              target: us,
39473              targetName: "math"
39474            }, {
39475              name: "toDegree",
39476              newName: "toDegree",
39477              target: us,
39478              targetName: "math"
39479            }, {
39480              name: "random",
39481              newName: "random",
39482              target: us,
39483              targetName: "math"
39484            }, {
39485              name: "randomRange",
39486              newName: "randomRange",
39487              target: us,
39488              targetName: "math"
39489            }, {
39490              name: "randomRangeInt",
39491              newName: "randomRangeInt",
39492              target: us,
39493              targetName: "math"
39494            }, {
39495              name: "pseudoRandom",
39496              newName: "pseudoRandom",
39497              target: us,
39498              targetName: "math"
39499            }, {
39500              name: "pseudoRandomRangeInt",
39501              newName: "pseudoRandomRangeInt",
39502              target: us,
39503              targetName: "math"
39504            }, {
39505              name: "nextPow2",
39506              newName: "nextPow2",
39507              target: us,
39508              targetName: "math"
39509            }, {
39510              name: "repeat",
39511              newName: "repeat",
39512              target: us,
39513              targetName: "math"
39514            }, {
39515              name: "pingPong",
39516              newName: "pingPong",
39517              target: us,
39518              targetName: "math"
39519            }, {
39520              name: "inverseLerp",
39521              newName: "inverseLerp",
39522              target: us,
39523              targetName: "math"
39524            } ]);
39525            m.vmath = DR;
39526            W(Rg.prototype, "Scheduler.prototype", [ {
39527              name: "enableForTarget",
39528              newName: "enableForTarget",
39529              target: Rg,
39530              targetName: "Scheduler"
39531            } ]);
39532            W(Rg, "Scheduler", [ {
39533              name: "PRIORITY_SYSTEM",
39534              newName: "System.Priority.SCHEDULER",
39535              customGetter: () => Tg.Priority.SCHEDULER
39536            } ]);
39537            Y(Rg, "Scheduler", [ {
39538              name: "PRIORITY_NON_SYSTEM",
39539              suggest: "Use enum` System.Priority` instead"
39540            } ]);
39541            W(Ig.prototype, "SubModel.prototype", [ {
39542              name: "subMeshData",
39543              newName: "subMesh"
39544            } ]);
39545            Y(Ig.prototype, "SubModel.prototype", [ {
39546              name: "getSubModel",
39547              suggest: "Use `subModels[i]` instead"
39548            }, {
39549              name: "subModelNum",
39550              suggest: "Use `subModels.length` instead"
39551            } ]);
39552            W(cw.prototype, "Root.prototype", [ {
39553              name: "ui",
39554              newName: "batcher2D"
39555            } ]);
39556            q(BR, "game", [ {
39557              name: "collisionMatrix"
39558            }, {
39559              name: "groupList"
39560            } ]);
39561            q(RR.prototype, "director", [ {
39562              name: "calculateDeltaTime"
39563            }, {
39564              name: "getDeltaTime",
39565              suggest: "Use game.deltaTime instead"
39566            }, {
39567              name: "getTotalTime",
39568              suggest: "Use game.totalTime instead"
39569            }, {
39570              name: "getCurrentTime",
39571              suggest: "Use game.frameStartTime instead"
39572            } ]);
39573            Y(RR.prototype, "director", [ {
39574              name: "setAnimationInterval",
39575              suggest: "please use game.frameRate instead"
39576            }, {
39577              name: "getAnimationInterval",
39578              suggest: "please use game.frameRate instead"
39579            }, {
39580              name: "getRunningScene",
39581              suggest: "please use getScene instead"
39582            }, {
39583              name: "setDepthTest",
39584              suggest: "please use camera API instead"
39585            }, {
39586              name: "setClearColor",
39587              suggest: "please use camera API instead"
39588            }, {
39589              name: "getWinSize",
39590              suggest: "please use view.getVisibleSize instead"
39591            }, {
39592              name: "getWinSizeInPixels"
39593            }, {
39594              name: "purgeCachedData",
39595              suggest: "please use assetManager.releaseAll instead"
39596            }, {
39597              name: "convertToGL"
39598            }, {
39599              name: "convertToUI"
39600            } ]);
39601            et({
39602              replaceProperty: {
39603                since: "3.6.0",
39604                removed: !1
39605              },
39606              removeProperty: {
39607                since: "3.6.0",
39608                removed: !1
39609              },
39610              markAsWarning: {
39611                since: "3.6.0",
39612                removed: !1
39613              },
39614              setDefaultLogTimes: {
39615                since: "3.6.0",
39616                removed: !1
39617              }
39618            });
39619            var PR, OR, NR, LR, FR, VR;
39620            t("PrefabLink", (PR = Ul("cc.PrefabLink"), OR = Th(mC), NR = rh(), PR(LR = (FR = class extends Qc {
39621              constructor(...t) {
39622                super(...t);
39623                Ml(this, "prefab", VR, this);
39624              }
39625            }, VR = Bl(FR.prototype, "prefab", [ OR, Yl, NR ], {
39626              configurable: !0,
39627              enumerable: !0,
39628              writable: !0,
39629              initializer: function() {
39630                return null;
39631              }
39632            }), FR)) || LR));
39633            const kR = new Pi;
39634            function UR(t, e, i, s) {
39635              s || (s = new Pi);
39636              t.convertToUINode(e, i, s);
39637              const n = i.position;
39638              s.add(n);
39639              return s;
39640            }
39641            function GR(t, e, i) {
39642              i || (i = new Pi);
39643              t.worldToScreen(e, i);
39644              i.x /= m.view.getScaleX();
39645              i.y /= m.view.getScaleY();
39646              return i;
39647            }
39648            const zR = t("convertUtils", {
39649              WorldNode3DToLocalNodeUI: UR,
39650              WorldNode3DToWorldNodeUI: GR
39651            });
39652            m.pipelineUtils = zR;
39653            W(m.pipelineUtils, "cc.pipelineUtils", [ {
39654              name: "WorldNode3DToLocalNodeUI",
39655              newName: "convertToUINode",
39656              targetName: "cc.Camera.prototype",
39657              customFunction(...t) {
39658                const e = t[0];
39659                const i = t[3] || kR;
39660                e.convertToUINode(t[1], t[2], i);
39661                i.add(t[2].position);
39662                return t[3] || i.clone();
39663              }
39664            } ]);
39665            const HR = {
39666              topLeft: m.v2(0, 0),
39667              topRight: m.v2(0, 0),
39668              top: m.v2(0, 0),
39669              bottomLeft: m.v2(0, 0),
39670              bottomRight: m.v2(0, 0),
39671              bottom: m.v2(0, 0),
39672              center: m.v2(0, 0),
39673              left: m.v2(0, 0),
39674              right: m.v2(0, 0),
39675              width: 0,
39676              height: 0,
39677              init(t) {
39678                const e = this.width = t.width;
39679                const i = this.height = t.height;
39680                const s = t.x;
39681                const n = t.y;
39682                const r = n + i;
39683                const o = s + e;
39684                this.topLeft.x = s;
39685                this.topLeft.y = r;
39686                this.topRight.x = o;
39687                this.topRight.y = r;
39688                this.top.x = s + e / 2;
39689                this.top.y = r;
39690                this.bottomLeft.x = s;
39691                this.bottomLeft.y = n;
39692                this.bottomRight.x = o;
39693                this.bottomRight.y = n;
39694                this.bottom.x = s + e / 2;
39695                this.bottom.y = n;
39696                this.center.x = s + e / 2;
39697                this.center.y = n + i / 2;
39698                this.left.x = s;
39699                this.left.y = n + i / 2;
39700                this.right.x = o;
39701                this.right.y = n + i / 2;
39702              }
39703            };
39704            m.visibleRect = HR;
39705            const jR = new rs;
39706            const XR = {
39707              [pe.ORIENTATION_AUTO]: Oo.AUTO,
39708              [pe.ORIENTATION_LANDSCAPE]: Oo.LANDSCAPE,
39709              [pe.ORIENTATION_PORTRAIT]: Oo.PORTRAIT
39710            };
39711            class WR extends(To(Tg)){
39712              constructor() {
39713                super();
39714                this._designResolutionSize = void 0;
39715                this._scaleX = void 0;
39716                this._scaleY = void 0;
39717                this._viewportRect = void 0;
39718                this._visibleRect = void 0;
39719                this._autoFullScreen = void 0;
39720                this._retinaEnabled = void 0;
39721                this._resizeCallback = void 0;
39722                this._resolutionPolicy = void 0;
39723                this._rpExactFit = void 0;
39724                this._rpShowAll = void 0;
39725                this._rpNoBorder = void 0;
39726                this._rpFixedHeight = void 0;
39727                this._rpFixedWidth = void 0;
39728                const t = YR;
39729                const e = qR;
39730                this._designResolutionSize = new rs(0, 0);
39731                this._scaleX = 1;
39732                this._scaleY = 1;
39733                this._viewportRect = new as(0, 0, 0, 0);
39734                this._visibleRect = new as(0, 0, 0, 0);
39735                this._autoFullScreen = !1;
39736                this._retinaEnabled = !1;
39737                this._resizeCallback = null;
39738                this._rpExactFit = new KR(t.EQUAL_TO_FRAME, e.EXACT_FIT);
39739                this._rpShowAll = new KR(t.EQUAL_TO_FRAME, e.SHOW_ALL);
39740                this._rpNoBorder = new KR(t.EQUAL_TO_FRAME, e.NO_BORDER);
39741                this._rpFixedHeight = new KR(t.EQUAL_TO_FRAME, e.FIXED_HEIGHT);
39742                this._rpFixedWidth = new KR(t.EQUAL_TO_FRAME, e.FIXED_WIDTH);
39743                this._resolutionPolicy = this._rpShowAll;
39744              }
39745              init() {
39746                const t = Fo.windowSize;
39747                const e = t.width;
39748                const i = t.height;
39749                this._designResolutionSize.width = e;
39750                this._designResolutionSize.height = i;
39751                this._viewportRect.width = e;
39752                this._viewportRect.height = i;
39753                this._visibleRect.width = e;
39754                this._visibleRect.height = i;
39755                jR.width = this._visibleRect.width;
39756                jR.height = this._visibleRect.height;
39757                HR && HR.init(this._visibleRect);
39758                {
39759                  this.resizeWithBrowserSize(!0);
39760                  const t = de.querySettings(_e.Category.SCREEN, "designResolution");
39761                  t && this.setDesignResolutionSize(Number(t.width), Number(t.height), t.policy || KR.FIXED_HEIGHT);
39762                }
39763                Lo.on("window-resize", this._updateAdaptResult, this);
39764                Lo.on("orientation-change", this._updateAdaptResult, this);
39765                Lo.on("fullscreen-change", this._updateAdaptResult, this);
39766              }
39767              resizeWithBrowserSize(t) {
39768                Lo.handleResizeEvent = t;
39769              }
39770              setResizeCallback(t) {
39771                "function" != typeof t && null != t || (this._resizeCallback = t);
39772              }
39773              setOrientation(t) {
39774                Lo.orientation = XR[t];
39775              }
39776              adjustViewportMeta(t) {}
39777              enableRetina(t) {
39778                this._retinaEnabled = !!t;
39779              }
39780              isRetinaEnabled() {
39781                return this._retinaEnabled;
39782              }
39783              enableAutoFullScreen(t) {
39784                if (t !== this._autoFullScreen) {
39785                  this._autoFullScreen = t;
39786                  t && Fo.requestFullScreen().catch((t => {}));
39787                }
39788              }
39789              isAutoFullScreenEnabled() {
39790                return this._autoFullScreen;
39791              }
39792              setCanvasSize(t, e) {
39793                Lo.resolutionScale = 1;
39794                const i = Lo.devicePixelRatio;
39795                const s = new rs(t * i, e * i);
39796                Fo.windowSize = s;
39797              }
39798              getCanvasSize() {
39799                return Fo.windowSize;
39800              }
39801              getFrameSize() {
39802                const t = Lo.devicePixelRatio;
39803                const e = Fo.windowSize;
39804                e.width /= t;
39805                e.height /= t;
39806                return e;
39807              }
39808              setFrameSize(t, e) {
39809                const i = Lo.devicePixelRatio;
39810                Fo.windowSize = new rs(t * i, e * i);
39811              }
39812              getVisibleSize() {
39813                return new rs(this._visibleRect.width, this._visibleRect.height);
39814              }
39815              getVisibleSizeInPixel() {
39816                return new rs(this._visibleRect.width * this._scaleX, this._visibleRect.height * this._scaleY);
39817              }
39818              getVisibleOrigin() {
39819                return new Qi(this._visibleRect.x, this._visibleRect.y);
39820              }
39821              getVisibleOriginInPixel() {
39822                return new Qi(this._visibleRect.x * this._scaleX, this._visibleRect.y * this._scaleY);
39823              }
39824              getResolutionPolicy() {
39825                return this._resolutionPolicy;
39826              }
39827              _updateResolutionPolicy(t) {
39828                if (t instanceof KR) this._resolutionPolicy = t; else {
39829                  const e = KR;
39830                  t === e.EXACT_FIT && (this._resolutionPolicy = this._rpExactFit);
39831                  t === e.SHOW_ALL && (this._resolutionPolicy = this._rpShowAll);
39832                  t === e.NO_BORDER && (this._resolutionPolicy = this._rpNoBorder);
39833                  t === e.FIXED_HEIGHT && (this._resolutionPolicy = this._rpFixedHeight);
39834                  t === e.FIXED_WIDTH && (this._resolutionPolicy = this._rpFixedWidth);
39835                }
39836              }
39837              setResolutionPolicy(t) {
39838                this._updateResolutionPolicy(t);
39839                const e = JR.getDesignResolutionSize();
39840                JR.setDesignResolutionSize(e.width, e.height, t);
39841              }
39842              setDesignResolutionSize(t, e, i) {
39843                if (!(t > 0 && e > 0)) {
39844                  F(2200);
39845                  return;
39846                }
39847                this._updateResolutionPolicy(i);
39848                const s = this._resolutionPolicy;
39849                s && s.preApply(this);
39850                this._designResolutionSize.width = t;
39851                this._designResolutionSize.height = e;
39852                const n = s.apply(this, this._designResolutionSize);
39853                if (n.scale && 2 === n.scale.length) {
39854                  this._scaleX = n.scale[0];
39855                  this._scaleY = n.scale[1];
39856                }
39857                if (n.viewport) {
39858                  const t = this._viewportRect;
39859                  const e = this._visibleRect;
39860                  const i = n.viewport;
39861                  t.x = i.x;
39862                  t.y = i.y;
39863                  t.width = i.width;
39864                  t.height = i.height;
39865                  e.x = 0;
39866                  e.y = 0;
39867                  e.width = i.width / this._scaleX;
39868                  e.height = i.height / this._scaleY;
39869                }
39870                s.postApply(this);
39871                jR.width = this._visibleRect.width;
39872                jR.height = this._visibleRect.height;
39873                HR && HR.init(this._visibleRect);
39874                this.emit("design-resolution-changed");
39875              }
39876              getDesignResolutionSize() {
39877                return new rs(this._designResolutionSize.width, this._designResolutionSize.height);
39878              }
39879              setRealPixelResolution(t, e, i) {
39880                this.setDesignResolutionSize(t, e, i);
39881              }
39882              getViewportRect() {
39883                return this._viewportRect;
39884              }
39885              getScaleX() {
39886                return this._scaleX;
39887              }
39888              getScaleY() {
39889                return this._scaleY;
39890              }
39891              getDevicePixelRatio() {
39892                return Lo.devicePixelRatio;
39893              }
39894              convertToLocationInView(t, e, i, s = new Qi) {
39895                const n = Lo.devicePixelRatio * (t - i.left);
39896                const r = Lo.devicePixelRatio * (i.top + i.height - e);
39897                if (Lo.isFrameRotated) {
39898                  s.x = Fo.windowSize.width - r;
39899                  s.y = n;
39900                } else {
39901                  s.x = n;
39902                  s.y = r;
39903                }
39904                return s;
39905              }
39906              _convertToUISpace(t) {
39907                const e = this._viewportRect;
39908                t.x = (t.x - e.x) / this._scaleX;
39909                t.y = (t.y - e.y) / this._scaleY;
39910              }
39911              _updateAdaptResult() {
39912                var t;
39913                m.director.root.resize(Fo.windowSize.width, Fo.windowSize.height);
39914                const e = this._designResolutionSize.width;
39915                const i = this._designResolutionSize.height;
39916                e > 0 && this.setDesignResolutionSize(e, i, this._resolutionPolicy);
39917                this.emit("canvas-resize");
39918                null === (t = this._resizeCallback) || void 0 === t || t.call(this);
39919              }
39920            }
39921            t("View", WR);
39922            WR.instance = void 0;
39923            class YR {
39924              constructor() {
39925                this.name = "ContainerStrategy";
39926              }
39927              preApply(t) {}
39928              apply(t, e) {}
39929              postApply(t) {}
39930              _setupCanvas() {
39931                const t = m.game.canvas;
39932                if (t) {
39933                  const e = Fo.windowSize;
39934                  t.width = e.width;
39935                  t.height = e.height;
39936                }
39937              }
39938            }
39939            YR.EQUAL_TO_FRAME = void 0;
39940            YR.PROPORTION_TO_FRAME = void 0;
39941            class qR {
39942              constructor() {
39943                this.name = "ContentStrategy";
39944                this._result = void 0;
39945                this._result = {
39946                  scale: [ 1, 1 ],
39947                  viewport: null
39948                };
39949              }
39950              preApply(t) {}
39951              apply(t, e) {
39952                return {
39953                  scale: [ 1, 1 ]
39954                };
39955              }
39956              postApply(t) {}
39957              _buildResult(t, e, i, s, n, r) {
39958                Math.abs(t - i) < 2 && (i = t);
39959                Math.abs(e - s) < 2 && (s = e);
39960                const o = new as(Math.round((t - i) / 2), Math.round((e - s) / 2), i, s);
39961                this._result.scale = [ n, r ];
39962                this._result.viewport = o;
39963                return this._result;
39964              }
39965            }
39966            qR.EXACT_FIT = void 0;
39967            qR.SHOW_ALL = void 0;
39968            qR.NO_BORDER = void 0;
39969            qR.FIXED_HEIGHT = void 0;
39970            qR.FIXED_WIDTH = void 0;
39971            (() => {
39972              YR.EQUAL_TO_FRAME = new class extends YR {
39973                constructor(...t) {
39974                  super(...t);
39975                  this.name = "EqualToFrame";
39976                }
39977                apply(t, e) {
39978                  Lo.isProportionalToFrame = !1;
39979                  this._setupCanvas();
39980                }
39981              };
39982              YR.PROPORTION_TO_FRAME = new class extends YR {
39983                constructor(...t) {
39984                  super(...t);
39985                  this.name = "ProportionalToFrame";
39986                }
39987                apply(t, e) {
39988                  Lo.isProportionalToFrame = !0;
39989                  this._setupCanvas();
39990                }
39991              };
39992              qR.EXACT_FIT = new class extends qR {
39993                constructor(...t) {
39994                  super(...t);
39995                  this.name = "ExactFit";
39996                }
39997                apply(t, e) {
39998                  const i = Fo.windowSize;
39999                  const s = i.width;
40000                  const n = i.height;
40001                  const r = s / e.width;
40002                  const o = n / e.height;
40003                  return this._buildResult(s, n, s, n, r, o);
40004                }
40005              };
40006              qR.SHOW_ALL = new class extends qR {
40007                constructor(...t) {
40008                  super(...t);
40009                  this.name = "ShowAll";
40010                }
40011                apply(t, e) {
40012                  const i = Fo.windowSize;
40013                  const s = i.width;
40014                  const n = i.height;
40015                  const r = e.width;
40016                  const o = e.height;
40017                  const a = s / r;
40018                  const l = n / o;
40019                  let h = 0;
40020                  let c;
40021                  let u;
40022                  if (a < l) {
40023                    h = a;
40024                    c = s;
40025                    u = o * h;
40026                  } else {
40027                    h = l;
40028                    c = r * h;
40029                    u = n;
40030                  }
40031                  return this._buildResult(s, n, c, u, h, h);
40032                }
40033              };
40034              qR.NO_BORDER = new class extends qR {
40035                constructor(...t) {
40036                  super(...t);
40037                  this.name = "NoBorder";
40038                }
40039                apply(t, e) {
40040                  const i = Fo.windowSize;
40041                  const s = i.width;
40042                  const n = i.height;
40043                  const r = e.width;
40044                  const o = e.height;
40045                  const a = s / r;
40046                  const l = n / o;
40047                  let h;
40048                  let c;
40049                  let u;
40050                  if (a < l) {
40051                    h = l;
40052                    c = r * h;
40053                    u = n;
40054                  } else {
40055                    h = a;
40056                    c = s;
40057                    u = o * h;
40058                  }
40059                  return this._buildResult(s, n, c, u, h, h);
40060                }
40061              };
40062              qR.FIXED_HEIGHT = new class extends qR {
40063                constructor(...t) {
40064                  super(...t);
40065                  this.name = "FixedHeight";
40066                }
40067                apply(t, e) {
40068                  const i = Fo.windowSize;
40069                  const s = i.width;
40070                  const n = i.height;
40071                  const r = n / e.height;
40072                  const o = s;
40073                  const a = n;
40074                  return this._buildResult(s, n, o, a, r, r);
40075                }
40076              };
40077              qR.FIXED_WIDTH = new class extends qR {
40078                constructor(...t) {
40079                  super(...t);
40080                  this.name = "FixedWidth";
40081                }
40082                apply(t, e) {
40083                  const i = Fo.windowSize;
40084                  const s = i.width;
40085                  const n = i.height;
40086                  const r = s / e.width;
40087                  const o = s;
40088                  const a = n;
40089                  return this._buildResult(s, n, o, a, r, r);
40090                }
40091              };
40092            })();
40093            class KR {
40094              constructor(t, e) {
40095                this.name = "ResolutionPolicy";
40096                this._containerStrategy = void 0;
40097                this._contentStrategy = void 0;
40098                this._containerStrategy = null;
40099                this._contentStrategy = null;
40100                this.setContainerStrategy(t);
40101                this.setContentStrategy(e);
40102              }
40103              get canvasSize() {
40104                return Fo.windowSize;
40105              }
40106              preApply(t) {
40107                this._contentStrategy.preApply(t);
40108              }
40109              apply(t, e) {
40110                this._containerStrategy.apply(t, e);
40111                return this._contentStrategy.apply(t, e);
40112              }
40113              postApply(t) {
40114                this._contentStrategy.postApply(t);
40115              }
40116              setContainerStrategy(t) {
40117                t instanceof YR && (this._containerStrategy = t);
40118              }
40119              setContentStrategy(t) {
40120                t instanceof qR && (this._contentStrategy = t);
40121              }
40122            }
40123            t("ResolutionPolicy", KR);
40124            KR.EXACT_FIT = 0;
40125            KR.NO_BORDER = 1;
40126            KR.SHOW_ALL = 2;
40127            KR.FIXED_HEIGHT = 3;
40128            KR.FIXED_WIDTH = 4;
40129            KR.UNKNOWN = 5;
40130            KR.ContainerStrategy = YR;
40131            KR.ContentStrategy = qR;
40132            m.ResolutionPolicy = KR;
40133            const JR = t("view", WR.instance = m.view = new WR);
40134            IR.registerSystem("view", JR, 0);
40135            m.winSize = jR;
40136            Y(WR.prototype, "View.prototype", [ {
40137              name: "isAntiAliasEnabled",
40138              suggest: "The API of Texture2d have been largely modified, no alternative"
40139            }, {
40140              name: "enableAntiAlias",
40141              suggest: "The API of Texture2d have been largely modified, no alternative"
40142            } ]);
40143            q(WR.prototype, "View.prototype", [ {
40144              name: "adjustViewportMeta"
40145            }, {
40146              name: "enableAutoFullScreen",
40147              suggest: "use screen.requestFullScreen() instead."
40148            }, {
40149              name: "isAutoFullScreenEnabled"
40150            }, {
40151              name: "setCanvasSize",
40152              suggest: "setting size in CSS pixels is not recommended, please use screen.windowSize instead."
40153            }, {
40154              name: "getCanvasSize",
40155              suggest: "please use screen.windowSize instead."
40156            }, {
40157              name: "getFrameSize",
40158              suggest: "getting size in CSS pixels is not recommended, please use screen.windowSize instead."
40159            }, {
40160              name: "setFrameSize",
40161              suggest: "setting size in CSS pixels is not recommended, please use screen.windowSize instead."
40162            }, {
40163              name: "getDevicePixelRatio",
40164              suggest: "use screen.devicePixelRatio instead."
40165            }, {
40166              name: "convertToLocationInView"
40167            }, {
40168              name: "enableRetina"
40169            }, {
40170              name: "isRetinaEnabled"
40171            }, {
40172              name: "setRealPixelResolution"
40173            } ]);
40174            q(m, "cc", [ {
40175              name: "winSize",
40176              suggest: "please use view.getVisibleSize() instead."
40177            } ]);
40178            q(Vo, "sys", [ {
40179              name: "capabilities",
40180              suggest: "please use sys.hasFeature() method instead."
40181            } ]);
40182            W(Vo, "sys", [ "UNKNOWN", "ENGLISH", "CHINESE", "FRENCH", "ITALIAN", "GERMAN", "SPANISH", "DUTCH", "RUSSIAN", "KOREAN", "JAPANESE", "HUNGARIAN", "PORTUGUESE", "ARABIC", "NORWEGIAN", "POLISH", "TURKISH", "UKRAINIAN", "ROMANIAN", "BULGARIAN" ].map((t => ({
40183              name: `LANGUAGE_${t}`,
40184              newName: t,
40185              target: Vo.Language,
40186              targetName: "sys.Language"
40187            }))));
40188            W(Vo, "sys", [ "UNKNOWN", "IOS", "ABC", "WINDOWS", "LINUX", "OSX" ].map((t => ({
40189              name: `OS_${t}`,
40190              newName: t,
40191              target: Vo.OS,
40192              targetName: "sys.OS"
40193            }))));
40194            W(Vo, "sys", [ "UNKNOWN", "WECHAT", "ABC", "IE", "EDGE", "QQ", "MOBILE_QQ", "UC", "UCBS", "BAIDU_APP", "BAIDU", "MAXTHON", "OPERA", "OUPENG", "MIUI", "FIREFOX", "SAFARI", "CDE", "LIEBAO", "QZONE", "SOUGOU", "HIJ" ].map((t => ({
40195              name: `BROWSER_TYPE_${t}`,
40196              newName: t,
40197              target: Vo.BrowserType,
40198              targetName: "sys.BrowserType"
40199            }))));
40200            W(Vo, "sys", [ {
40201              name: "BROWSER_TYPE_360",
40202              newName: "BROWSER_360",
40203              target: Vo.BrowserType,
40204              targetName: "sys.BrowserType"
40205            } ]);
40206            W(Vo, "sys", [ "UNKNOWN", "EDITOR_PAGE", "EDITOR_CORE", "MOBILE_BROWSER", "DESKTOP_BROWSER", "WIN32", "MACOS", "IOS", "ABC", "OHOS", "WECHAT_GAME", "BAIDU_MINI_GAME", "XIAOMI_QUICK_GAME", "ALIPAY_MINI_GAME", "BYTEDANCE_MINI_GAME", "OPPO_MINI_GAME", "VIVO_MINI_GAME", "HIJ_QUICK_GAME", "COCOSPLAY", "LINKSURE_MINI_GAME", "QTT_MINI_GAME" ].map((t => ({
40207              name: t,
40208              target: Vo.Platform,
40209              targetName: "sys.Platform"
40210            }))));
40211            W(Vo, "sys", [ {
40212              name: "IPHONE",
40213              newName: "IOS",
40214              target: Vo.Platform,
40215              targetName: "sys.Platform"
40216            }, {
40217              name: "IPAD",
40218              newName: "IOS",
40219              target: Vo.Platform,
40220              targetName: "sys.Platform"
40221            } ]);
40222            Y(Vo, "sys", [ "LINUX", "BLACKBERRY", "NACL", "EMSCRIPTEN", "TIZEN", "WINRT", "WP8", "QQ_PLAY", "FB_PLAYABLE_ADS" ].map((t => ({
40223              name: t
40224            }))));
40225            W(Vo, "sys", [ {
40226              name: "windowPixelResolution",
40227              target: Fo,
40228              targetName: "screen",
40229              newName: "windowSize"
40230            } ]);
40231            q(Fo, "screen", [ {
40232              name: "autoFullScreen",
40233              suggest: "please use screen.requestFullScreen() instead."
40234            }, {
40235              name: "disableAutoFullScreen"
40236            } ]);
40237            const ZR = [ ".png", ".jpg", ".bmp", ".jpeg", ".gif", ".ico", ".tiff", ".webp", ".image", ".pvr", ".pkm", ".astc" ];
40238            const QR = [ ".mp3", ".ogg", ".wav", ".m4a" ];
40239            function $R() {
40240              return !0;
40241            }
40242            const tI = {
40243              transformURL(t) {
40244                const e = qh(t);
40245                if (!e) return t;
40246                const i = Ph.find((t => !!t.getAssetInfo(e)));
40247                if (!i) return t;
40248                let s = "";
40249                const n = i.getAssetInfo(e);
40250                s = t.startsWith(i.base + i.config.nativeBase) ? n.nativeVer || "" : n.ver || "";
40251                if (!s || -1 !== t.indexOf(s)) return t;
40252                let r = !1;
40253                ".ttf" === nc(t) && (r = !0);
40254                if (r) {
40255                  const e = ac(t);
40256                  const i = oc(t);
40257                  t = `${e}.${s}/${i}`;
40258                } else t = t.replace(/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,})/, ((t, e) => `${t}.${s}`));
40259                return t;
40260              }
40261            };
40262            class eI {
40263              constructor() {
40264                this._autoReleaseSetting = Object.create(null);
40265                this._parseLoadResArgs = Dw;
40266              }
40267              set onProgress(t) {
40268                Ew = t;
40269              }
40270              get _cache() {
40271                if (Mh instanceof Rh) return Mh._map;
40272                {
40273                  const t = {};
40274                  Mh.forEach(((e, i) => {
40275                    t[i] = e;
40276                  }));
40277                  return t;
40278                }
40279              }
40280              load(t, e, i) {
40281                if (void 0 === i && void 0 !== e) {
40282                  i = e;
40283                  e = null;
40284                }
40285                const s = Array.isArray(t) ? t : [ t ];
40286                for (let t = 0; t < s.length; t++) {
40287                  const e = s[t];
40288                  if ("string" == typeof e) s[t] = {
40289                    url: e,
40290                    __isNative__: !0
40291                  }; else {
40292                    if (e.type) {
40293                      e.ext = `.${e.type}`;
40294                      e.type = void 0;
40295                    }
40296                    e.url && (e.__isNative__ = !0);
40297                  }
40298                }
40299                const n = [];
40300                const r = [];
40301                SR.loadAny(s, null, ((t, i, s) => {
40302                  s.content && (ZR.includes(s.ext) ? n.push(s.content) : QR.includes(s.ext) && r.push(s.content));
40303                  e && e(t, i, s);
40304                }), ((t, e) => {
40305                  let o = null;
40306                  if (!t) {
40307                    e = Array.isArray(e) ? e : [ e ];
40308                    for (let t = 0; t < e.length; t++) {
40309                      const i = e[t];
40310                      if (!(i instanceof gc)) {
40311                        let o = i;
40312                        const a = s[t].url;
40313                        n.includes(o) ? sR.create(a, i, ".png", {}, ((i, s) => {
40314                          o = e[t] = s;
40315                        })) : r.includes(o) && sR.create(a, i, ".mp3", {}, ((i, s) => {
40316                          o = e[t] = s;
40317                        }));
40318                        Mh.add(a, o);
40319                      }
40320                    }
40321                    if (e.length > 1) {
40322                      const t = Object.create(null);
40323                      e.forEach((e => {
40324                        t[e._uuid] = e;
40325                      }));
40326                      o = {
40327                        isCompleted: $R,
40328                        _map: t
40329                      };
40330                    } else o = e[0];
40331                  }
40332                  i && i(t, o);
40333                }));
40334              }
40335              getXMLHttpRequest() {
40336                return new XMLHttpRequest;
40337              }
40338              getItem(t) {
40339                return SR.assets.has(t) ? {
40340                  content: SR.assets.get(t)
40341                } : null;
40342              }
40343              loadRes(t, e, i, s) {
40344                const {type: n, onProgress: r, onComplete: o} = this._parseLoadResArgs(e, i, s);
40345                const a = nc(t);
40346                a && !Lw.getInfoWithPath(t, n) && (t = t.slice(0, -a.length));
40347                Lw.load(t, n, r, o);
40348              }
40349              loadResArray(t, e, i, s) {
40350                const {type: n, onProgress: r, onComplete: o} = this._parseLoadResArgs(e, i, s);
40351                t.forEach(((e, i) => {
40352                  const s = nc(e);
40353                  s && !Lw.getInfoWithPath(e, n) && (t[i] = e.slice(0, -s.length));
40354                }));
40355                Lw.load(t, n, r, o);
40356              }
40357              loadResDir(t, e, i, s) {
40358                const {type: n, onProgress: r, onComplete: o} = this._parseLoadResArgs(e, i, s);
40359                Lw.loadDir(t, n, r, ((e, i) => {
40360                  let s = [];
40361                  if (!e) {
40362                    s = Lw.getDirWithPath(t, n).map((t => t.path));
40363                  }
40364                  o && o(e, i, s);
40365                }));
40366              }
40367              getRes(t, e) {
40368                return Mh.has(t) ? Mh.get(t) : Lw.get(t, e);
40369              }
40370              getResCount() {
40371                return Mh.count;
40372              }
40373              getDependsRecursively(t) {
40374                if (!t) return [];
40375                const e = "string" == typeof t ? t : t._uuid;
40376                return pA.getDepsRecursively(e).concat([ e ]);
40377              }
40378              get md5Pipe() {
40379                return tI;
40380              }
40381              get downloader() {
40382                return Jw;
40383              }
40384              get loader() {
40385                return SR.parser;
40386              }
40387              addDownloadHandlers(t) {
40388                const e = Object.create(null);
40389                for (const i in t) {
40390                  const s = t[i];
40391                  e[`.${i}`] = (t, e, i) => {
40392                    s({
40393                      url: t
40394                    }, i);
40395                  };
40396                }
40397                Jw.register(e);
40398              }
40399              addLoadHandlers(t) {
40400                const e = Object.create(null);
40401                for (const i in t) {
40402                  const s = t[i];
40403                  e[`.${i}`] = (t, e, i) => {
40404                    s({
40405                      content: t
40406                    }, i);
40407                  };
40408                }
40409                cR.register(e);
40410              }
40411              release(t) {
40412                if (Array.isArray(t)) for (let e = 0; e < t.length; e++) {
40413                  let i = t[e];
40414                  "string" == typeof i && (i = Mh.get(i));
40415                  SR.releaseAsset(i);
40416                } else if (t) {
40417                  "string" == typeof t && (t = Mh.get(t));
40418                  SR.releaseAsset(t);
40419                }
40420              }
40421              releaseAsset(t) {
40422                SR.releaseAsset(t);
40423              }
40424              releaseRes(t, e) {
40425                Lw.release(t, e);
40426              }
40427              releaseAll() {
40428                SR.releaseAll();
40429                Mh.clear();
40430              }
40431              removeItem(t) {
40432                return !!Mh.remove(t);
40433              }
40434              setAutoRelease(t, e) {
40435                "object" == typeof t && (t = t._uuid);
40436                this._autoReleaseSetting[t] = !!e;
40437              }
40438              setAutoReleaseRecursively(t, e) {
40439                "object" == typeof t && (t = t._uuid);
40440                e = !!e;
40441                this._autoReleaseSetting[t] = e;
40442                const i = pA.getDepsRecursively(t);
40443                for (let t = 0; t < i.length; t++) this._autoReleaseSetting[i[t]] = e;
40444              }
40445              isAutoRelease(t) {
40446                "object" == typeof t && (t = t._uuid);
40447                return !!this._autoReleaseSetting[t];
40448              }
40449            }
40450            t("CCLoader", eI);
40451            const iI = t("loader", new eI);
40452            const sI = t("AssetLibrary", {
40453              init(t) {
40454                t.importBase = t.libraryPath;
40455                t.nativeBase = t.rawAssetsBase;
40456                SR.init(t);
40457                t.rawAssets && Lw.init({
40458                  base: "",
40459                  deps: [],
40460                  scenes: {},
40461                  redirect: [],
40462                  debug: !0,
40463                  packs: {},
40464                  types: [],
40465                  versions: {
40466                    import: [],
40467                    native: []
40468                  },
40469                  name: Uh.RESOURCES,
40470                  importBase: t.importBase,
40471                  nativeBase: t.nativeBase,
40472                  paths: t.rawAssets.assets,
40473                  uuids: Object.keys(t.rawAssets.assets),
40474                  extensionMap: {}
40475                });
40476              },
40477              loadAsset(t, e, i) {
40478                SR.loadAny(t, e);
40479              }
40480            });
40481            const nI = t("url", {});
40482            W(nI, "url", [ {
40483              name: "normalize",
40484              target: SR.utils,
40485              targetName: "assetManager.utils",
40486              newName: "normalize"
40487            }, {
40488              name: "raw",
40489              targetName: "Asset.prototype",
40490              newName: "nativeUrl",
40491              customFunction: t => t.startsWith("resources/") ? Qh({
40492                path: lc(t.substr(10)),
40493                bundle: Uh.RESOURCES,
40494                __isNative__: !0,
40495                ext: nc(t)
40496              }) : ""
40497            } ]);
40498            Y(sI, "AssetLibrary", [ {
40499              name: "getLibUrlNoExt",
40500              suggest: "AssetLibrary.getLibUrlNoExt was removed, if you want to transform url, please use assetManager.utils.getUrlWithUuid instead"
40501            }, {
40502              name: "queryAssetInfo",
40503              suggest: "AssetLibrary.queryAssetInfo was removed"
40504            } ]);
40505            Y(iI, "loader", [ {
40506              name: "releaseResDir",
40507              suggest: "loader.releaseResDir was removed, please use assetManager.releaseAsset instead"
40508            }, {
40509              name: "flowInDeps",
40510              suggest: "loader.flowInDeps was removed"
40511            }, {
40512              name: "assetLoader",
40513              suggest: "loader.assetLoader was removed, assetLoader and md5Pipe were merged into assetManager.transformPipeline"
40514            } ]);
40515            W(m, "cc", [ {
40516              name: "loader",
40517              newName: "assetManager",
40518              logTimes: 1,
40519              customGetter: () => iI
40520            }, {
40521              name: "AssetLibrary",
40522              newName: "assetManager",
40523              logTimes: 1,
40524              customGetter: () => sI
40525            }, {
40526              name: "Pipeline",
40527              target: bR,
40528              targetName: "AssetManager",
40529              newName: "Pipeline",
40530              logTimes: 1
40531            }, {
40532              name: "url",
40533              targetName: "assetManager",
40534              newName: "utils",
40535              logTimes: 1,
40536              customGetter: () => nI
40537            } ]);
40538            Y(m, "cc", [ {
40539              name: "LoadingItems",
40540              suggest: G(1400, "LoadingItems", "AssetManager.Task")
40541            } ]);
40542            W(pe, "macro", [ {
40543              name: "DOWNLOAD_MAX_CONCURRENT",
40544              target: Jw,
40545              targetName: "assetManager.downloader",
40546              newName: "maxConcurrency"
40547            } ]);
40548            W(IR, "director", [ {
40549              name: "_getSceneUuid",
40550              targetName: "assetManager.main",
40551              newName: "getSceneInfo",
40552              customFunction: t => {
40553                if (SR.main) {
40554                  var e;
40555                  return null === (e = SR.main.getSceneInfo(t)) || void 0 === e ? void 0 : e.uuid;
40556                }
40557                return "";
40558              }
40559            } ]);
40560            W(BR, "game", [ {
40561              name: "_sceneInfos",
40562              targetName: "assetManager.main",
40563              newName: "getSceneInfo",
40564              customGetter: () => {
40565                const t = [];
40566                SR.main && SR.main.config.scenes.forEach((e => {
40567                  t.push(e);
40568                }));
40569                return t;
40570              }
40571            } ]);
40572            const rI = vw._autoRelease;
40573            vw._autoRelease = function(t, e, i) {
40574              rI.call(vw, t, e, i);
40575              const s = iI._autoReleaseSetting;
40576              const n = Object.keys(s);
40577              for (let t = 0; t < n.length; t++) {
40578                const e = n[t];
40579                if (!0 === s[e]) {
40580                  const t = Mh.get(e);
40581                  t && vw.tryRelease(t);
40582                }
40583              }
40584            };
40585            function oI(t, e) {
40586              t.x = e.x * e.x;
40587              t.y = e.y * e.y;
40588              t.z = e.z * e.z;
40589            }
40590            class aI {}
40591            function lI(t, e, i, s = null, n = 0) {
40592              const r = new hn;
40593              const o = t.viewport;
40594              const a = e;
40595              const l = i;
40596              r.x = o.x * a;
40597              r.y = o.y * l;
40598              r.width = o.width * a;
40599              r.height = o.height * l;
40600              if (s) switch (s.type) {
40601               case BA.DIRECTIONAL:
40602                {
40603                  const t = s;
40604                  if (t.shadowFixedArea || t.csmLevel === HA.LEVEL_1) {
40605                    r.x = 0;
40606                    r.y = 0;
40607                    r.width = a;
40608                    r.height = l;
40609                  } else {
40610                    r.x = n % 2 * .5 * a;
40611                    r.y = .5 * (1 - Math.floor(n / 2)) * l;
40612                    r.width = .5 * a;
40613                    r.height = .5 * l;
40614                  }
40615                  break;
40616                }
40617
40618               case BA.SPOT:
40619                r.x = 0;
40620                r.y = 0;
40621                r.width = a;
40622                r.height = l;
40623              }
40624              return r;
40625            }
40626            function hI(t, e, i, s, n, r, o) {
40627              const a = e.device;
40628              const l = t;
40629              if (!e.containsResource(l)) {
40630                const t = Xf(a) ? bs.R32F : bs.RGBA8;
40631                e.addRenderTarget(l, t, r, o, _x);
40632                e.addDepthStencil(`${l}Depth`, bs.DEPTH_STENCIL, r, o, _x);
40633              }
40634              const h = e.addRasterPass(r, o, "default", t);
40635              h.addRasterView(l, new Bx("_", Mx, wx, Us.CLEAR, Gs.STORE, en.COLOR, new gn(1, 1, 1, i.clearColor.w)));
40636              h.addRasterView(`${l}Depth`, new Bx("_", Mx, Rx, Us.CLEAR, Gs.DISCARD, en.DEPTH_STENCIL, new gn(i.clearDepth, i.clearStencil, 0, 0)));
40637              const c = lI(i, r, o, s, n);
40638              h.setViewport(new fn(c.x, c.y, c.width, c.height));
40639              h.addQueue(px).addSceneOfCamera(i, new Ox(s, n), Sx);
40640            }
40641            class cI {
40642              constructor() {
40643                this.shadowEnabled = !1;
40644                this.mainLightShadowNames = new Array;
40645                this.spotLightShadowNames = new Array;
40646              }
40647            }
40648            function uI(t, e, i) {
40649              const s = i;
40650              const n = s.pipelineSceneData.shadows;
40651              const r = i.pipelineSceneData.validPunctualLights;
40652              const o = new cI;
40653              const a = i.pipelineSceneData.shadows;
40654              if (!n.enabled || n.type !== GA.ShadowMap) return o;
40655              o.shadowEnabled = !0;
40656              const l = [];
40657              let h = 0;
40658              let c = 0;
40659              for (;h < n.maxReceived && c < r.length; ) {
40660                const t = r[c];
40661                if (t.type === BA.SPOT) {
40662                  if (t.shadowEnabled) {
40663                    l.push(t);
40664                    h++;
40665                  }
40666                }
40667                c++;
40668              }
40669              const {mainLight: u} = e.scene;
40670              const _ = a.size.x;
40671              const d = a.size.y;
40672              if (u && u.shadowEnabled) {
40673                o.mainLightShadowNames[0] = `MainLightShadow${t}`;
40674                if (u.shadowFixedArea) hI(o.mainLightShadowNames[0], i, e, u, 0, _, d); else {
40675                  const n = s.pipelineSceneData.csmSupported ? u.csmLevel : 1;
40676                  for (let s = 0; s < n; s++) {
40677                    o.mainLightShadowNames[s] = `MainLightShadow${t}`;
40678                    hI(o.mainLightShadowNames[s], i, e, u, s, _, d);
40679                  }
40680                }
40681              }
40682              for (let s = 0; s < l.length; s++) {
40683                const n = l[s];
40684                const r = `SpotLightShadow${s.toString()}${t}`;
40685                o.spotLightShadowNames[s] = r;
40686                hI(r, i, e, n, 0, _, d);
40687              }
40688              return o;
40689            }
40690            const _I = [];
40691            function dI(t) {
40692              _I.includes(t) || _I.push(t);
40693              return _I.indexOf(t);
40694            }
40695            function pI(t, e) {
40696              let i = Us.CLEAR;
40697              t & en.COLOR || e !== wx || (i = t & My ? Us.DISCARD : Us.LOAD);
40698              if ((t & en.DEPTH_STENCIL) !== en.DEPTH_STENCIL && e === Rx) {
40699                t & en.DEPTH || (i = Us.LOAD);
40700                t & en.STENCIL || (i = Us.LOAD);
40701              }
40702              return i;
40703            }
40704            t("ForwardPipelineBuilder", class extends aI {
40705              setup(t, e) {
40706                for (let i = 0; i < t.length; i++) {
40707                  const s = t[i];
40708                  if (null === s.scene) continue;
40709                  gI(e, s);
40710                  const n = dI(s);
40711                  const r = `Camera${n}`;
40712                  const o = uI(r, s, e);
40713                  const a = s.window.width;
40714                  const l = s.window.height;
40715                  const h = `dsForwardPassColor${r}`;
40716                  const c = `dsForwardPassDS${r}`;
40717                  if (!e.containsResource(h)) {
40718                    e.addRenderTexture(h, bs.RGBA8, a, l, s.window);
40719                    e.addDepthStencil(c, bs.DEPTH_STENCIL, a, l, _x);
40720                  }
40721                  const u = e.addRasterPass(a, l, "default", `CameraForwardPass${n}`);
40722                  for (const t of o.mainLightShadowNames) if (e.containsResource(t)) {
40723                    const e = new Px;
40724                    u.addComputeView(t, e);
40725                  }
40726                  for (const t of o.spotLightShadowNames) if (e.containsResource(t)) {
40727                    const e = new Px;
40728                    u.addComputeView(t, e);
40729                  }
40730                  const _ = new Bx("_", Mx, wx, pI(s.clearFlag, wx), Gs.STORE, s.clearFlag, new gn(s.clearColor.x, s.clearColor.y, s.clearColor.z, s.clearColor.w));
40731                  const d = new Bx("_", Mx, Rx, pI(s.clearFlag, Rx), Gs.STORE, s.clearFlag, new gn(s.clearDepth, s.clearStencil, 0, 0));
40732                  u.addRasterView(h, _);
40733                  u.addRasterView(c, d);
40734                  u.addQueue(px).addSceneOfCamera(s, new Ox, gx | Ex | yx | Ex | Tx);
40735                  u.addQueue(mx).addSceneOfCamera(s, new Ox, bx | Ax | Cx | xx);
40736                }
40737              }
40738            });
40739            let mI;
40740            !function(t) {
40741              t[t.NONE = 0] = "NONE";
40742              t[t.FXAA = 1] = "FXAA";
40743            }(mI || (mI = t("AntiAliasing", {})));
40744            class fI {
40745              constructor() {
40746                this._deferredLightingMaterial = void 0;
40747                this._deferredPostMaterial = void 0;
40748                this._antiAliasing = mI.NONE;
40749                this._deferredLightingMaterial = new hm;
40750                this._deferredLightingMaterial.name = "builtin-deferred-material";
40751                this._deferredLightingMaterial.initialize({
40752                  effectName: "pipeline/deferred-lighting",
40753                  defines: {
40754                    CC_RECEIVE_SHADOW: 1
40755                  }
40756                });
40757                for (let t = 0; t < this._deferredLightingMaterial.passes.length; ++t) this._deferredLightingMaterial.passes[t].tryCompile();
40758                this._deferredPostMaterial = new hm;
40759                this._deferredPostMaterial.name = "builtin-post-process-material";
40760                pe.ENABLE_ANTIALIAS_FXAA && (this._antiAliasing = mI.FXAA);
40761                this._deferredPostMaterial.initialize({
40762                  effectName: "pipeline/post-process",
40763                  defines: {
40764                    ANTIALIAS_TYPE: this._antiAliasing
40765                  }
40766                });
40767                for (let t = 0; t < this._deferredPostMaterial.passes.length; ++t) this._deferredPostMaterial.passes[t].tryCompile();
40768              }
40769            }
40770            function gI(t, e) {
40771              const i = t.pipelineSceneData.validPunctualLights;
40772              i.length = 0;
40773              const s = ua.create(0, 0, 0, 1);
40774              const {spotLights: n} = e.scene;
40775              for (let t = 0; t < n.length; t++) {
40776                const r = n[t];
40777                if (!r.baked) {
40778                  ua.set(s, r.position.x, r.position.y, r.position.z, r.range);
40779                  Za.sphereFrustum(s, e.frustum) && i.push(r);
40780                }
40781              }
40782              const {sphereLights: r} = e.scene;
40783              for (let t = 0; t < r.length; t++) {
40784                const n = r[t];
40785                if (!n.baked) {
40786                  ua.set(s, n.position.x, n.position.y, n.position.z, n.range);
40787                  Za.sphereFrustum(s, e.frustum) && i.push(n);
40788                }
40789              }
40790            }
40791            t("DeferredPipelineBuilder", class extends aI {
40792              constructor(...t) {
40793                super(...t);
40794                this._deferredData = new fI;
40795              }
40796              setup(t, e) {
40797                for (let i = 0; i < t.length; ++i) {
40798                  const s = t[i];
40799                  if (!s.scene) continue;
40800                  gI(e, s);
40801                  const n = dI(s);
40802                  const r = uI(`Camera${n}`, s, e);
40803                  const o = s.window.width;
40804                  const a = s.window.height;
40805                  const l = "dsDeferredPassColorCamera";
40806                  const h = "deferredGbufferPassNormal";
40807                  const c = "deferredGbufferPassEmissive";
40808                  const u = "dsDeferredPassDSCamera";
40809                  if (!e.containsResource(l)) {
40810                    const t = bs.RGBA16F;
40811                    e.addRenderTarget(l, t, o, a, _x);
40812                    e.addRenderTarget(h, t, o, a, _x);
40813                    e.addRenderTarget(c, t, o, a, _x);
40814                    e.addDepthStencil(u, bs.DEPTH_STENCIL, o, a, _x);
40815                  }
40816                  const _ = e.addRasterPass(o, a, "Geometry", `CameraGbufferPass${n}`);
40817                  const d = new gn(0, 0, 0, 0);
40818                  if (s.clearFlag & en.COLOR) if (e.pipelineSceneData.isHDR) oI(d, s.clearColor); else {
40819                    d.x = s.clearColor.x;
40820                    d.y = s.clearColor.y;
40821                    d.z = s.clearColor.z;
40822                  }
40823                  const p = new Bx("_", Mx, wx, Us.CLEAR, Gs.STORE, s.clearFlag, d);
40824                  const m = new Bx("_", Mx, wx, Us.CLEAR, Gs.STORE, s.clearFlag, new gn(0, 0, 0, 0));
40825                  const f = new Bx("_", Mx, wx, Us.CLEAR, Gs.STORE, s.clearFlag, new gn(0, 0, 0, 0));
40826                  const g = new Bx("_", Mx, Rx, Us.CLEAR, Gs.STORE, s.clearFlag, new gn(s.clearDepth, s.clearStencil, 0, 0));
40827                  _.addRasterView(l, p);
40828                  _.addRasterView(h, m);
40829                  _.addRasterView(c, f);
40830                  _.addRasterView(u, g);
40831                  _.addQueue(px).addSceneOfCamera(s, new Ox, gx | yx);
40832                  const y = "deferredLightingPassRTName";
40833                  const b = "deferredLightingPassDS";
40834                  if (!e.containsResource(y)) {
40835                    e.addRenderTarget(y, bs.RGBA8, o, a, _x);
40836                    e.addDepthStencil(b, bs.DEPTH_STENCIL, o, a, _x);
40837                  }
40838                  const S = e.addRasterPass(o, a, "Lighting", `CameraLightingPass${n}`);
40839                  for (const t of r.mainLightShadowNames) if (e.containsResource(t)) {
40840                    const e = new Px;
40841                    S.addComputeView(t, e);
40842                  }
40843                  for (const t of r.spotLightShadowNames) if (e.containsResource(t)) {
40844                    const e = new Px;
40845                    S.addComputeView(t, e);
40846                  }
40847                  if (e.containsResource(l)) {
40848                    const t = new Px;
40849                    t.name = "gbuffer_albedoMap";
40850                    S.addComputeView(l, t);
40851                    const e = new Px;
40852                    e.name = "gbuffer_normalMap";
40853                    S.addComputeView(h, e);
40854                    const i = new Px;
40855                    i.name = "gbuffer_emissiveMap";
40856                    S.addComputeView(c, i);
40857                    const s = new Px;
40858                    s.name = "depth_stencil";
40859                    S.addComputeView(u, s);
40860                  }
40861                  const A = new gn(0, 0, 0, 0);
40862                  if (s.clearFlag & en.COLOR) {
40863                    A.x = s.clearColor.x;
40864                    A.y = s.clearColor.y;
40865                    A.z = s.clearColor.z;
40866                  }
40867                  A.w = 0;
40868                  const T = new Bx("_", Mx, wx, Us.CLEAR, Gs.STORE, s.clearFlag, A);
40869                  S.addRasterView(y, T);
40870                  S.addQueue(mx).addCameraQuad(s, this._deferredData._deferredLightingMaterial, vx);
40871                  S.addQueue(mx).addSceneOfCamera(s, new Ox, bx | Ex | Cx);
40872                  const v = `postprocessPassRTName${n}`;
40873                  const E = `postprocessPassDS${n}`;
40874                  if (!e.containsResource(v)) {
40875                    e.addRenderTexture(v, bs.RGBA8, o, a, s.window);
40876                    e.addDepthStencil(E, bs.DEPTH_STENCIL, o, a, _x);
40877                  }
40878                  const C = e.addRasterPass(o, a, "Postprocess", `CameraPostprocessPass${n}`);
40879                  if (e.containsResource(y)) {
40880                    const t = new Px;
40881                    t.name = "outputResultMap";
40882                    C.addComputeView(y, t);
40883                  }
40884                  const x = new gn(0, 0, 0, s.clearColor.w);
40885                  if (s.clearFlag & en.COLOR) {
40886                    x.x = s.clearColor.x;
40887                    x.y = s.clearColor.y;
40888                    x.z = s.clearColor.z;
40889                  }
40890                  const w = new Bx("_", Mx, wx, pI(s.clearFlag, wx), Gs.STORE, s.clearFlag, x);
40891                  const R = new Bx("_", Mx, Rx, pI(s.clearFlag, Rx), Gs.STORE, s.clearFlag, new gn(s.clearDepth, s.clearStencil, 0, 0));
40892                  C.addRasterView(v, w);
40893                  C.addRasterView(E, R);
40894                  C.addQueue(dx).addFullscreenQuad(this._deferredData._deferredPostMaterial, fx);
40895                  C.addQueue(mx).addSceneOfCamera(s, new Ox, Ax | xx);
40896                }
40897              }
40898            });
40899            m.math = us;
40900            m.geometry = Wp;
40901            const yI = new qi;
40902            function bI(t, e, i, s) {
40903              const n = i.chunk;
40904              const r = i.data;
40905              const o = n.vb;
40906              const a = i.vertexCount;
40907              t.getWorldMatrix(yI);
40908              let l = 0;
40909              for (let t = 0; t < a; t++) {
40910                const e = r[t];
40911                const i = e.x;
40912                const n = e.y;
40913                let a = yI.m03 * i + yI.m07 * n + yI.m15;
40914                a = a ? Math.abs(1 / a) : 1;
40915                o[l + 0] = (yI.m00 * i + yI.m04 * n + yI.m12) * a;
40916                o[l + 1] = (yI.m01 * i + yI.m05 * n + yI.m13) * a;
40917                o[l + 2] = (yI.m02 * i + yI.m06 * n + yI.m14) * a;
40918                Bi.toArray(o, s, l + 5);
40919                l += 9;
40920              }
40921              n.bufferId;
40922              const h = n.vertexOffset;
40923              const c = n.meshBuffer;
40924              const u = n.meshBuffer.iData;
40925              let _ = c.indexOffset;
40926              for (let t = 0, e = a / 4; t < e; t++) {
40927                const e = h + 4 * t;
40928                u[_++] = e;
40929                u[_++] = e + 1;
40930                u[_++] = e + 2;
40931                u[_++] = e + 1;
40932                u[_++] = e + 3;
40933                u[_++] = e + 2;
40934              }
40935              c.indexOffset += i.indexCount;
40936              c.setDirty();
40937            }
40938            const SI = {};
40939            class AI {
40940              constructor(t, e) {
40941                this._texture = void 0;
40942                this._width = void 0;
40943                this._height = void 0;
40944                this._x = void 0;
40945                this._y = void 0;
40946                this._nexty = void 0;
40947                this._innerTextureInfos = {};
40948                this._innerSpriteFrames = void 0;
40949                this._count = void 0;
40950                const i = new TI;
40951                i.initWithSize(t, e);
40952                this._texture = i;
40953                this._width = t;
40954                this._height = e;
40955                this._x = 2;
40956                this._y = 2;
40957                this._nexty = 2;
40958                this._innerTextureInfos = {};
40959                this._innerSpriteFrames = [];
40960                this._count = 0;
40961              }
40962              insertSpriteFrame(t) {
40963                const e = t.rect;
40964                const i = t.texture;
40965                const s = this._innerTextureInfos[i.getId()];
40966                let n = e.x;
40967                let r = e.y;
40968                if (s) {
40969                  n += s.x;
40970                  r += s.y;
40971                } else {
40972                  const t = i.width;
40973                  const e = i.height;
40974                  if (this._x + t + 2 > this._width) {
40975                    this._x = 2;
40976                    this._y = this._nexty;
40977                  }
40978                  this._y + e + 2 > this._nexty && (this._nexty = this._y + e + 2);
40979                  if (this._nexty > this._height) return null;
40980                  if (m.internal.dynamicAtlasManager.textureBleeding) {
40981                    if (t <= 8 || e <= 8) {
40982                      this._texture.drawTextureAt(i.image, this._x - 1, this._y - 1);
40983                      this._texture.drawTextureAt(i.image, this._x - 1, this._y + 1);
40984                      this._texture.drawTextureAt(i.image, this._x + 1, this._y - 1);
40985                      this._texture.drawTextureAt(i.image, this._x + 1, this._y + 1);
40986                    }
40987                    this._texture.drawTextureAt(i.image, this._x - 1, this._y);
40988                    this._texture.drawTextureAt(i.image, this._x + 1, this._y);
40989                    this._texture.drawTextureAt(i.image, this._x, this._y - 1);
40990                    this._texture.drawTextureAt(i.image, this._x, this._y + 1);
40991                  }
40992                  this._texture.drawTextureAt(i.image, this._x, this._y);
40993                  this._innerTextureInfos[i.getId()] = {
40994                    x: this._x,
40995                    y: this._y,
40996                    texture: i
40997                  };
40998                  this._count++;
40999                  n += this._x;
41000                  r += this._y;
41001                  this._x += t + 2;
41002                }
41003                const o = {
41004                  x: n,
41005                  y: r,
41006                  texture: this._texture
41007                };
41008                this._innerSpriteFrames.push(t);
41009                return o;
41010              }
41011              deleteInnerTexture(t) {
41012                if (t && this._innerTextureInfos[t.getId()]) {
41013                  delete this._innerTextureInfos[t.getId()];
41014                  this._count--;
41015                }
41016              }
41017              isEmpty() {
41018                return this._count <= 0;
41019              }
41020              reset() {
41021                this._x = 2;
41022                this._y = 2;
41023                this._nexty = 2;
41024                const t = this._innerSpriteFrames;
41025                for (let e = 0, i = t.length; e < i; e++) {
41026                  const i = t[e];
41027                  i.isValid && i._resetDynamicAtlasFrame();
41028                }
41029                this._innerSpriteFrames.length = 0;
41030                this._innerTextureInfos = {};
41031              }
41032              destroy() {
41033                this.reset();
41034                this._texture.destroy();
41035              }
41036            }
41037            class TI extends LC {
41038              initWithSize(t, e, i = Jp.RGBA8888) {
41039                this.reset({
41040                  width: t,
41041                  height: e,
41042                  format: i
41043                });
41044              }
41045              drawTextureAt(t, e, i) {
41046                const s = this.getGFXTexture();
41047                if (!t || !s) return;
41048                const n = this._getGFXDevice();
41049                if (!n) {
41050                  console.warn("Unable to get device");
41051                  return;
41052                }
41053                const r = new mn;
41054                r.texOffset.x = e;
41055                r.texOffset.y = i;
41056                r.texExtent.width = t.width;
41057                r.texExtent.height = t.height;
41058                n.copyTexImagesToTexture([ t.data ], s, [ r ]);
41059              }
41060            }
41061            class vI extends Tg {
41062              constructor(...t) {
41063                super(...t);
41064                this._atlases = [];
41065                this._atlasIndex = -1;
41066                this._maxAtlasCount = 5;
41067                this._textureSize = 2048;
41068                this._maxFrameSize = 512;
41069                this._textureBleeding = !0;
41070                this._enabled = !1;
41071              }
41072              get enabled() {
41073                return this._enabled;
41074              }
41075              set enabled(t) {
41076                if (this._enabled !== t) {
41077                  if (t) {
41078                    this.reset();
41079                    m.director.on(m.Director.EVENT_BEFORE_SCENE_LAUNCH, this.beforeSceneLoad, this);
41080                  } else {
41081                    this.reset();
41082                    m.director.off(m.Director.EVENT_BEFORE_SCENE_LAUNCH, this.beforeSceneLoad, this);
41083                  }
41084                  this._enabled = t;
41085                }
41086              }
41087              get maxAtlasCount() {
41088                return this._maxAtlasCount;
41089              }
41090              set maxAtlasCount(t) {
41091                this._maxAtlasCount = t;
41092              }
41093              get atlasCount() {
41094                return this._atlases.length;
41095              }
41096              get textureBleeding() {
41097                return this._textureBleeding;
41098              }
41099              set textureBleeding(t) {
41100                this._textureBleeding = t;
41101              }
41102              get textureSize() {
41103                return this._textureSize;
41104              }
41105              set textureSize(t) {
41106                this._textureSize = t;
41107              }
41108              get maxFrameSize() {
41109                return this._maxFrameSize;
41110              }
41111              set maxFrameSize(t) {
41112                this._maxFrameSize = t;
41113              }
41114              newAtlas() {
41115                let t = this._atlases[++this._atlasIndex];
41116                if (!t) {
41117                  t = new AI(this._textureSize, this._textureSize);
41118                  this._atlases.push(t);
41119                }
41120                return t;
41121              }
41122              beforeSceneLoad() {
41123                this.reset();
41124              }
41125              init() {
41126                this.enabled = !pe.CLEANUP_IMAGE_CACHE;
41127              }
41128              insertSpriteFrame(t) {
41129                if (!this._enabled || this._atlasIndex === this._maxAtlasCount || !t || t._original) return null;
41130                if (!t.packable) return null;
41131                const e = t.texture.getSamplerInfo();
41132                if (e.minFilter !== Qp.LINEAR || e.magFilter !== Qp.LINEAR || e.mipFilter !== Qp.NONE) return null;
41133                let i = this._atlases[this._atlasIndex];
41134                i || (i = this.newAtlas());
41135                const s = i.insertSpriteFrame(t);
41136                if (!s && this._atlasIndex !== this._maxAtlasCount) {
41137                  i = this.newAtlas();
41138                  return i.insertSpriteFrame(t);
41139                }
41140                return s;
41141              }
41142              reset() {
41143                for (let t = 0, e = this._atlases.length; t < e; t++) this._atlases[t].destroy();
41144                this._atlases.length = 0;
41145                this._atlasIndex = -1;
41146              }
41147              deleteAtlasSpriteFrame(t) {
41148                if (!t._original) return;
41149                let e;
41150                for (let i = this._atlases.length - 1; i >= 0; i--) {
41151                  e = this._atlases[i];
41152                  ee.array.fastRemove(e._innerSpriteFrames, t);
41153                }
41154                const i = t._original._texture;
41155                this.deleteAtlasTexture(i);
41156              }
41157              deleteAtlasTexture(t) {
41158                if (t) for (let e = this._atlases.length - 1; e >= 0; e--) {
41159                  this._atlases[e].deleteInnerTexture(t);
41160                  if (this._atlases[e].isEmpty()) {
41161                    this._atlases[e].destroy();
41162                    this._atlases.splice(e, 1);
41163                    this._atlasIndex--;
41164                  }
41165                }
41166              }
41167              packToDynamicAtlas(t, e) {
41168                if (this._enabled && e && !e._original && e.packable && e.texture && e.texture.width > 0 && e.texture.height > 0) {
41169                  const t = this.insertSpriteFrame(e);
41170                  t && e._setDynamicAtlasFrame(t);
41171                }
41172              }
41173            }
41174            vI.instance = void 0;
41175            const EI = t("dynamicAtlasManager", vI.instance = new vI);
41176            IR.registerSystem("dynamicAtlasManager", EI, 0);
41177            m.internal.dynamicAtlasManager = EI;
41178            const CI = {
41179              [Ss.UNORM]: "Uint",
41180              [Ss.SNORM]: "Int",
41181              [Ss.UINT]: "Uint",
41182              [Ss.INT]: "Int",
41183              [Ss.UFLOAT]: "Float",
41184              [Ss.FLOAT]: "Float",
41185              default: "Uint"
41186            };
41187            function xI(t) {
41188              return `${CI[t.type] || CI.default}${t.size / t.count * 8}`;
41189            }
41190            function wI(t, e, i = bs.R32F, s = 0, n = 0) {
41191              const r = ur[i];
41192              n || (n = r.size);
41193              const o = `set${xI(r)}`;
41194              const a = r.size / r.count;
41195              const l = Math.floor(e.length / r.count);
41196              const h = Vo.isLittleEndian;
41197              for (let i = 0; i < l; ++i) {
41198                const l = s + n * i;
41199                for (let s = 0; s < r.count; ++s) {
41200                  const n = l + a * s;
41201                  t[o](n, e[r.count * i + s], h);
41202                }
41203              }
41204            }
41205            function RI(t, e = bs.R32F, i = 0, s = t.byteLength - i, n = 0, r = []) {
41206              const o = ur[e];
41207              n || (n = o.size);
41208              const a = `get${xI(o)}`;
41209              const l = o.size / o.count;
41210              const h = Math.floor(s / n);
41211              const c = Vo.isLittleEndian;
41212              for (let e = 0; e < h; ++e) {
41213                const s = i + n * e;
41214                for (let i = 0; i < o.count; ++i) {
41215                  const n = s + l * i;
41216                  r[o.count * e + i] = t[a](n, c);
41217                }
41218              }
41219              return r;
41220            }
41221            function II(t, e, i = bs.R32F, s = 0, n = t.byteLength - s, r = 0, o) {
41222              o || (o = new DataView(t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength)));
41223              const a = ur[i];
41224              r || (r = a.size);
41225              const l = `set${xI(a)}`;
41226              const h = `get${xI(a)}`;
41227              const c = a.size / a.count;
41228              const u = Math.floor(n / r);
41229              const _ = Vo.isLittleEndian;
41230              for (let i = 0; i < u; ++i) {
41231                const n = s + r * i;
41232                for (let i = 0; i < a.count; ++i) {
41233                  const s = n + c * i;
41234                  const r = t[h](s, _);
41235                  o[l](s, e(r, i, t), _);
41236                }
41237              }
41238              return o;
41239            }
41240            var MI;
41241            !function(t) {
41242              t[t.positions = cr.ATTR_POSITION] = "positions";
41243              t[t.normals = cr.ATTR_NORMAL] = "normals";
41244              t[t.uvs = cr.ATTR_TEX_COORD] = "uvs";
41245              t[t.colors = cr.ATTR_COLOR] = "colors";
41246            }(MI || (MI = {}));
41247            const BI = jsb.MeshUtils;
41248            const DI = BI.createMesh;
41249            BI.createDynamicMesh;
41250            m.MeshUtils = jsb.MeshUtils;
41251            var PI = Object.freeze({
41252              __proto__: null,
41253              find: mv,
41254              toPPM: function(t, e, i) {
41255                return `P3 ${e} ${i} 255\n${t.filter(((t, e) => e % 4 < 3)).toString()}\n`;
41256              },
41257              readMesh: function(t, e = 0) {
41258                const i = {
41259                  positions: []
41260                };
41261                const s = new DataView(t.data.buffer, t.data.byteOffset, t.data.byteLength);
41262                const n = t.struct;
41263                const r = n.primitives[e];
41264                for (const t of r.vertexBundelIndices) {
41265                  const e = n.vertexBundles[t];
41266                  let r = e.view.offset;
41267                  const {length: o, stride: a} = e.view;
41268                  for (const t of e.attributes) {
41269                    const e = MI[t.name];
41270                    e && (i[e] = (i[e] || []).concat(RI(s, t.format, r, o, a)));
41271                    r += ur[t.format].size;
41272                  }
41273                }
41274                const o = r.indexView;
41275                i.indices = RI(s, bs[`R${8 * o.stride}UI`], o.offset, o.length);
41276                return i;
41277              },
41278              createMesh: DI,
41279              MeshUtils: BI,
41280              readBuffer: RI,
41281              writeBuffer: wI,
41282              mapBuffer: II
41283            });
41284            t("utils", PI);
41285            var OI, NI, LI;
41286            const FI = new Pi;
41287            const VI = new qi;
41288            var kI;
41289            !function(t) {
41290              t[t.RECT = 0] = "RECT";
41291              t[t.POLYGON = 1] = "POLYGON";
41292            }(kI || (kI = {}));
41293            const UI = [ {
41294              u: 0,
41295              v: 0
41296            }, {
41297              u: 0,
41298              v: 0
41299            }, {
41300              u: 0,
41301              v: 0
41302            }, {
41303              u: 0,
41304              v: 0
41305            } ];
41306            let GI = t("SpriteFrame", Ul("cc.SpriteFrame")(OI = (LI = NI = class t extends gc {
41307              static createWithImage(e) {
41308                const i = e instanceof IC ? e : new IC(e);
41309                const s = new LC;
41310                s.image = i;
41311                const n = new t;
41312                n.texture = s;
41313                return n;
41314              }
41315              get insetTop() {
41316                return this._capInsets[1];
41317              }
41318              set insetTop(t) {
41319                if (this._capInsets[1] !== t) {
41320                  this._capInsets[1] = t;
41321                  this._texture && this._calculateSlicedUV();
41322                }
41323              }
41324              get insetBottom() {
41325                return this._capInsets[3];
41326              }
41327              set insetBottom(t) {
41328                if (this._capInsets[3] !== t) {
41329                  this._capInsets[3] = t;
41330                  this._texture && this._calculateSlicedUV();
41331                }
41332              }
41333              get insetLeft() {
41334                return this._capInsets[0];
41335              }
41336              set insetLeft(t) {
41337                if (this._capInsets[0] !== t) {
41338                  this._capInsets[0] = t;
41339                  this._texture && this._calculateSlicedUV();
41340                }
41341              }
41342              get insetRight() {
41343                return this._capInsets[2];
41344              }
41345              set insetRight(t) {
41346                if (this._capInsets[2] !== t) {
41347                  this._capInsets[2] = t;
41348                  this._texture && this._calculateSlicedUV();
41349                }
41350              }
41351              get rect() {
41352                return this._rect;
41353              }
41354              set rect(t) {
41355                if (!this._rect.equals(t)) {
41356                  this._rect.set(t);
41357                  this._texture && this._calculateUV();
41358                  this._calcTrimmedBorder();
41359                }
41360              }
41361              get originalSize() {
41362                return this._originalSize;
41363              }
41364              set originalSize(t) {
41365                if (!this._originalSize.equals(t)) {
41366                  this._originalSize.set(t);
41367                  this._texture && this._calculateUV();
41368                  this._calcTrimmedBorder();
41369                }
41370              }
41371              get offset() {
41372                return this._offset;
41373              }
41374              set offset(t) {
41375                this._offset.set(t);
41376                this._calcTrimmedBorder();
41377              }
41378              get rotated() {
41379                return this._rotated;
41380              }
41381              set rotated(t) {
41382                if (this._rotated !== t) {
41383                  this._rotated = t;
41384                  this._texture && this._calculateUV();
41385                }
41386              }
41387              get texture() {
41388                return this._texture;
41389              }
41390              set texture(t) {
41391                t ? t !== this._texture && this.reset({
41392                  texture: t
41393                }, !0) : N(3122, this.name);
41394              }
41395              get atlasUuid() {
41396                return this._atlasUuid;
41397              }
41398              set atlasUuid(t) {
41399                this._atlasUuid = t;
41400              }
41401              get width() {
41402                return this._texture.width;
41403              }
41404              get height() {
41405                return this._texture.height;
41406              }
41407              set _textureSource(t) {
41408                if (window.Build) this._texture = t; else if (t) {
41409                  this._refreshTexture(t);
41410                  this._calculateUV();
41411                }
41412              }
41413              get flipUVX() {
41414                return this._isFlipUVX;
41415              }
41416              set flipUVX(t) {
41417                this._isFlipUVX = t;
41418                this._calculateUV();
41419              }
41420              get flipUVY() {
41421                return this._isFlipUVY;
41422              }
41423              set flipUVY(t) {
41424                this._isFlipUVY = t;
41425                this._calculateUV();
41426              }
41427              get packable() {
41428                return this._packable;
41429              }
41430              set packable(t) {
41431                this._packable = t;
41432              }
41433              get original() {
41434                return this._original;
41435              }
41436              get pixelsToUnit() {
41437                return this._pixelsToUnit;
41438              }
41439              get pivot() {
41440                return this._pivot;
41441              }
41442              get mesh() {
41443                return this._mesh;
41444              }
41445              get trimmedBorder() {
41446                return this._trimmedBorder;
41447              }
41448              constructor() {
41449                super();
41450                this.vertices = null;
41451                this.uv = [];
41452                this.unbiasUV = [];
41453                this.uvSliced = [];
41454                this._rect = new as;
41455                this._trimmedBorder = new is;
41456                this._offset = new Qi;
41457                this._originalSize = new rs;
41458                this._rotated = !1;
41459                this._capInsets = [ 0, 0, 0, 0 ];
41460                this._atlasUuid = "";
41461                this._texture = void 0;
41462                this._isFlipUVY = !1;
41463                this._isFlipUVX = !1;
41464                this._original = null;
41465                this._packable = !0;
41466                this._pixelsToUnit = 100;
41467                this._pivot = new Qi(.5, .5);
41468                this._meshType = kI.RECT;
41469                this._extrude = 0;
41470                this._customOutLine = [];
41471                this._minPos = new Pi;
41472                this._maxPos = new Pi;
41473              }
41474              textureLoaded() {
41475                return !!this.texture;
41476              }
41477              isRotated() {
41478                return this._rotated;
41479              }
41480              setRotated(t) {
41481                this.rotated = t;
41482              }
41483              getRect(t) {
41484                if (t) {
41485                  t.set(this._rect);
41486                  return t;
41487                }
41488                return this._rect.clone();
41489              }
41490              setRect(t) {
41491                this.rect = t;
41492              }
41493              getOriginalSize(t) {
41494                if (t) {
41495                  t.set(this._originalSize);
41496                  return t;
41497                }
41498                return this._originalSize.clone();
41499              }
41500              setOriginalSize(t) {
41501                this.originalSize = t;
41502              }
41503              getOffset(t) {
41504                if (t) {
41505                  t.set(this._offset);
41506                  return t;
41507                }
41508                return this._offset.clone();
41509              }
41510              setOffset(t) {
41511                this.offset = t;
41512              }
41513              getGFXTexture() {
41514                return this._texture.getGFXTexture();
41515              }
41516              getGFXSampler() {
41517                return this._texture.getGFXSampler();
41518              }
41519              getHash() {
41520                return this._texture.getHash();
41521              }
41522              getSamplerInfo() {
41523                return this._texture.getSamplerInfo();
41524              }
41525              reset(t, e = !1) {
41526                let i = !1;
41527                if (e) {
41528                  this._originalSize.set(0, 0);
41529                  this._rect.set(0, 0, 0, 0);
41530                  this._offset.set(0, 0);
41531                  this._capInsets = [ 0, 0, 0, 0 ];
41532                  this._rotated = !1;
41533                  i = !0;
41534                }
41535                if (t) {
41536                  if (t.texture) {
41537                    this._rect.x = this._rect.y = 0;
41538                    this._rect.width = t.texture.width;
41539                    this._rect.height = t.texture.height;
41540                    this._refreshTexture(t.texture);
41541                    this.checkRect(this._texture);
41542                  }
41543                  t.originalSize && this._originalSize.set(t.originalSize);
41544                  t.rect && this._rect.set(t.rect);
41545                  t.offset && this._offset.set(t.offset);
41546                  void 0 !== t.borderTop && (this._capInsets[1] = t.borderTop);
41547                  void 0 !== t.borderBottom && (this._capInsets[3] = t.borderBottom);
41548                  void 0 !== t.borderLeft && (this._capInsets[0] = t.borderLeft);
41549                  void 0 !== t.borderRight && (this._capInsets[2] = t.borderRight);
41550                  void 0 !== t.isRotate && (this._rotated = !!t.isRotate);
41551                  void 0 !== t.isFlipUv && (this._isFlipUVY = !!t.isFlipUv);
41552                  i = !0;
41553                }
41554                i && this.texture && this._calculateUV();
41555                this._calcTrimmedBorder();
41556              }
41557              checkRect(t) {
41558                const e = this._rect;
41559                let i = e.x;
41560                let s = e.y;
41561                if (this._rotated) {
41562                  i += e.height;
41563                  s += e.width;
41564                } else {
41565                  i += e.width;
41566                  s += e.height;
41567                }
41568                if (i > t.width) {
41569                  F(3300, `${this.name}/${t.name}`, i, t.width);
41570                  return !1;
41571                }
41572                if (s > t.height) {
41573                  F(3301, `${this.name}/${t.name}`, s, t.height);
41574                  return !1;
41575                }
41576                return !0;
41577              }
41578              _calcTrimmedBorder() {
41579                const t = this._originalSize.width;
41580                const e = this._originalSize.height;
41581                const i = .5 * (t - this._rect.width);
41582                const s = .5 * (e - this._rect.height);
41583                this._trimmedBorder.x = this._offset.x + i;
41584                this._trimmedBorder.y = this._offset.x - i;
41585                this._trimmedBorder.z = this._offset.y + s;
41586                this._trimmedBorder.w = this._offset.y - s;
41587              }
41588              ensureMeshData() {
41589                if (!this._mesh) {
41590                  this._initVertices();
41591                  this._createMesh();
41592                }
41593              }
41594              destroy() {
41595                this._packable && EI && EI.deleteAtlasSpriteFrame(this);
41596                return super.destroy();
41597              }
41598              _calculateSlicedUV() {
41599                const e = this._rect;
41600                const i = this.texture;
41601                const s = i.width;
41602                const n = i.height;
41603                const r = this._capInsets[0];
41604                const o = this._capInsets[2];
41605                const a = e.width - r - o;
41606                const l = this._capInsets[1];
41607                const h = this._capInsets[3];
41608                const c = e.height - l - h;
41609                const u = this.uvSliced;
41610                u.length = 0;
41611                if (this._rotated) {
41612                  UI[0].u = e.x / s;
41613                  UI[1].u = (e.x + h) / s;
41614                  UI[2].u = (e.x + h + c) / s;
41615                  UI[3].u = (e.x + e.height) / s;
41616                  UI[3].v = e.y / n;
41617                  UI[2].v = (e.y + r) / n;
41618                  UI[1].v = (e.y + r + a) / n;
41619                  UI[0].v = (e.y + e.width) / n;
41620                  for (let t = 0; t < 4; ++t) {
41621                    const e = UI[t];
41622                    for (let t = 0; t < 4; ++t) {
41623                      const i = UI[3 - t];
41624                      u.push({
41625                        u: e.u,
41626                        v: i.v
41627                      });
41628                    }
41629                  }
41630                } else {
41631                  UI[0].u = e.x / s;
41632                  UI[1].u = (e.x + r) / s;
41633                  UI[2].u = (e.x + r + a) / s;
41634                  UI[3].u = (e.x + e.width) / s;
41635                  UI[3].v = e.y / n;
41636                  UI[2].v = (e.y + l) / n;
41637                  UI[1].v = (e.y + l + c) / n;
41638                  UI[0].v = (e.y + e.height) / n;
41639                  for (let t = 0; t < 4; ++t) {
41640                    const e = UI[t];
41641                    for (let t = 0; t < 4; ++t) {
41642                      const i = UI[t];
41643                      u.push({
41644                        u: i.u,
41645                        v: e.v
41646                      });
41647                    }
41648                  }
41649                }
41650                this.emit(t.EVENT_UV_UPDATED, this);
41651              }
41652              _calculateUV() {
41653                const t = this._rect;
41654                const e = this.uv;
41655                const i = this.unbiasUV;
41656                const s = this.texture;
41657                const n = s.width;
41658                const r = s.height;
41659                if (this._rotated) {
41660                  const s = 0 === n ? 0 : t.x / n;
41661                  const o = 0 === n ? 1 : (t.x + t.height) / n;
41662                  const a = 0 === r ? 0 : t.y / r;
41663                  const l = 0 === r ? 1 : (t.y + t.width) / r;
41664                  if (this._isFlipUVX && this._isFlipUVY) {
41665                    e[0] = o;
41666                    e[1] = l;
41667                    e[2] = o;
41668                    e[3] = a;
41669                    e[4] = s;
41670                    e[5] = l;
41671                    e[6] = s;
41672                    e[7] = a;
41673                  } else if (this._isFlipUVX) {
41674                    e[0] = o;
41675                    e[1] = a;
41676                    e[2] = o;
41677                    e[3] = l;
41678                    e[4] = s;
41679                    e[5] = a;
41680                    e[6] = s;
41681                    e[7] = l;
41682                  } else if (this._isFlipUVY) {
41683                    e[0] = s;
41684                    e[1] = l;
41685                    e[2] = s;
41686                    e[3] = a;
41687                    e[4] = o;
41688                    e[5] = l;
41689                    e[6] = o;
41690                    e[7] = a;
41691                  } else {
41692                    e[0] = s;
41693                    e[1] = a;
41694                    e[2] = s;
41695                    e[3] = l;
41696                    e[4] = o;
41697                    e[5] = a;
41698                    e[6] = o;
41699                    e[7] = l;
41700                  }
41701                  const h = 0 === n ? 0 : t.x / n;
41702                  const c = 0 === n ? 1 : (t.x + t.height) / n;
41703                  const u = 0 === r ? 0 : t.y / r;
41704                  const _ = 0 === r ? 1 : (t.y + t.width) / r;
41705                  if (this._isFlipUVX && this._isFlipUVY) {
41706                    i[0] = c;
41707                    i[1] = _;
41708                    i[2] = c;
41709                    i[3] = u;
41710                    i[4] = h;
41711                    i[5] = _;
41712                    i[6] = h;
41713                    i[7] = u;
41714                  } else if (this._isFlipUVX) {
41715                    i[0] = c;
41716                    i[1] = u;
41717                    i[2] = c;
41718                    i[3] = _;
41719                    i[4] = h;
41720                    i[5] = u;
41721                    i[6] = h;
41722                    i[7] = _;
41723                  } else if (this._isFlipUVY) {
41724                    i[0] = h;
41725                    i[1] = _;
41726                    i[2] = h;
41727                    i[3] = u;
41728                    i[4] = c;
41729                    i[5] = _;
41730                    i[6] = c;
41731                    i[7] = u;
41732                  } else {
41733                    i[0] = h;
41734                    i[1] = u;
41735                    i[2] = h;
41736                    i[3] = _;
41737                    i[4] = c;
41738                    i[5] = u;
41739                    i[6] = c;
41740                    i[7] = _;
41741                  }
41742                } else {
41743                  const s = 0 === n ? 0 : t.x / n;
41744                  const o = 0 === n ? 1 : (t.x + t.width) / n;
41745                  const a = 0 === r ? 1 : (t.y + t.height) / r;
41746                  const l = 0 === r ? 0 : t.y / r;
41747                  if (this._isFlipUVX && this._isFlipUVY) {
41748                    e[0] = o;
41749                    e[1] = l;
41750                    e[2] = s;
41751                    e[3] = l;
41752                    e[4] = o;
41753                    e[5] = a;
41754                    e[6] = s;
41755                    e[7] = a;
41756                  } else if (this._isFlipUVX) {
41757                    e[0] = o;
41758                    e[1] = a;
41759                    e[2] = s;
41760                    e[3] = a;
41761                    e[4] = o;
41762                    e[5] = l;
41763                    e[6] = s;
41764                    e[7] = l;
41765                  } else if (this._isFlipUVY) {
41766                    e[0] = s;
41767                    e[1] = l;
41768                    e[2] = o;
41769                    e[3] = l;
41770                    e[4] = s;
41771                    e[5] = a;
41772                    e[6] = o;
41773                    e[7] = a;
41774                  } else {
41775                    e[0] = s;
41776                    e[1] = a;
41777                    e[2] = o;
41778                    e[3] = a;
41779                    e[4] = s;
41780                    e[5] = l;
41781                    e[6] = o;
41782                    e[7] = l;
41783                  }
41784                  const h = 0 === n ? 0 : t.x / n;
41785                  const c = 0 === n ? 1 : (t.x + t.width) / n;
41786                  const u = 0 === r ? 1 : (t.y + t.height) / r;
41787                  const _ = 0 === r ? 0 : t.y / r;
41788                  if (this._isFlipUVX && this._isFlipUVY) {
41789                    i[0] = c;
41790                    i[1] = _;
41791                    i[2] = h;
41792                    i[3] = _;
41793                    i[4] = c;
41794                    i[5] = u;
41795                    i[6] = h;
41796                    i[7] = u;
41797                  } else if (this._isFlipUVX) {
41798                    i[0] = c;
41799                    i[1] = u;
41800                    i[2] = h;
41801                    i[3] = u;
41802                    i[4] = c;
41803                    i[5] = _;
41804                    i[6] = h;
41805                    i[7] = _;
41806                  } else if (this._isFlipUVY) {
41807                    i[0] = h;
41808                    i[1] = _;
41809                    i[2] = c;
41810                    i[3] = _;
41811                    i[4] = h;
41812                    i[5] = u;
41813                    i[6] = c;
41814                    i[7] = u;
41815                  } else {
41816                    i[0] = h;
41817                    i[1] = u;
41818                    i[2] = c;
41819                    i[3] = u;
41820                    i[4] = h;
41821                    i[5] = _;
41822                    i[6] = c;
41823                    i[7] = _;
41824                  }
41825                }
41826                this._calculateSlicedUV();
41827              }
41828              _setDynamicAtlasFrame(t) {
41829                if (t) {
41830                  this._original = {
41831                    _texture: this._texture,
41832                    _x: this._rect.x,
41833                    _y: this._rect.y
41834                  };
41835                  this._texture = t.texture;
41836                  this._rect.x = t.x;
41837                  this._rect.y = t.y;
41838                  this._calculateUV();
41839                }
41840              }
41841              _resetDynamicAtlasFrame() {
41842                if (this._original) {
41843                  this._rect.x = this._original._x;
41844                  this._rect.y = this._original._y;
41845                  this._texture = this._original._texture;
41846                  this._original = null;
41847                  this._calculateUV();
41848                }
41849              }
41850              _checkPackable() {
41851                const t = EI;
41852                if (!t) return;
41853                const e = this._texture;
41854                if (!(e instanceof LC) || e.isCompressed) {
41855                  this._packable = !1;
41856                  return;
41857                }
41858                const i = this.width;
41859                const s = this.height;
41860                !e.image || i > t.maxFrameSize || s > t.maxFrameSize ? this._packable = !1 : e.image && e.image instanceof HTMLCanvasElement && (this._packable = !0);
41861              }
41862              _serialize(t) {
41863                return null;
41864              }
41865              _deserialize(t, e) {
41866                const i = t;
41867                const s = i.rect;
41868                s && (this._rect = new as(s.x, s.y, s.width, s.height));
41869                const n = i.offset;
41870                i.offset && (this._offset = new Qi(n.x, n.y));
41871                const r = i.originalSize;
41872                i.originalSize && (this._originalSize = new rs(r.width, r.height));
41873                this._rotated = !!i.rotated;
41874                this._name = i.name;
41875                this._packable = !!i.packable;
41876                this._pixelsToUnit = i.pixelsToUnit;
41877                const o = i.pivot;
41878                o && (this._pivot = new Qi(o.x, o.y));
41879                this._meshType = i.meshType;
41880                const a = i.capInsets;
41881                if (a) {
41882                  this._capInsets[0] = a[0];
41883                  this._capInsets[1] = a[1];
41884                  this._capInsets[2] = a[2];
41885                  this._capInsets[3] = a[3];
41886                }
41887                const l = i.vertices;
41888                if (l) {
41889                  this.vertices || (this.vertices = {
41890                    rawPosition: [],
41891                    positions: [],
41892                    indexes: l.indexes,
41893                    uv: l.uv,
41894                    nuv: l.nuv,
41895                    minPos: new Pi(l.minPos.x, l.minPos.y, l.minPos.z),
41896                    maxPos: new Pi(l.maxPos.x, l.maxPos.y, l.maxPos.z)
41897                  });
41898                  this.vertices.rawPosition.length = 0;
41899                  const t = l.rawPosition;
41900                  for (let e = 0; e < t.length; e += 3) this.vertices.rawPosition.push(new Pi(t[e], t[e + 1], t[e + 2]));
41901                  this._updateMeshVertices();
41902                }
41903              }
41904              clone() {
41905                const e = new t;
41906                const i = this.vertices;
41907                e.vertices = i ? {
41908                  rawPosition: i.rawPosition.slice(0),
41909                  positions: i.positions.slice(0),
41910                  indexes: i.indexes.slice(0),
41911                  uv: i.uv.slice(0),
41912                  nuv: i.nuv.slice(0),
41913                  minPos: i.minPos.clone(),
41914                  maxPos: i.minPos.clone()
41915                } : null;
41916                e.uv.splice(0, e.uv.length, ...this.uv);
41917                e.unbiasUV.splice(0, e.unbiasUV.length, ...this.unbiasUV);
41918                e.uvSliced.splice(0, e.uvSliced.length, ...this.uvSliced);
41919                e._rect.set(this._rect);
41920                e._offset.set(this._offset);
41921                e._originalSize.set(this._originalSize);
41922                e._rotated = this._rotated;
41923                e._capInsets.splice(0, e._capInsets.length, ...this._capInsets);
41924                e._atlasUuid = this._atlasUuid;
41925                e._texture = this._texture;
41926                e._isFlipUVX = this._isFlipUVX;
41927                e._isFlipUVY = this._isFlipUVY;
41928                e._pixelsToUnit = this._pixelsToUnit;
41929                e._pivot.set(this._pivot);
41930                e._meshType = this._meshType;
41931                return e;
41932              }
41933              _refreshTexture(t) {
41934                this._texture = t;
41935                const e = this._texture;
41936                const i = {};
41937                let s = !1;
41938                if (0 === this._rect.width || 0 === this._rect.height || !this.checkRect(e)) {
41939                  i.rect = new as(0, 0, e.width, e.height);
41940                  s = !0;
41941                }
41942                if (0 === this._originalSize.width || 0 === this._originalSize.height || s) {
41943                  i.originalSize = new rs(e.width, e.height);
41944                  s = !0;
41945                }
41946                s && this.reset(i);
41947                this._checkPackable();
41948                this._mesh && this._updateMesh();
41949              }
41950              onLoaded() {
41951                this._calcTrimmedBorder();
41952              }
41953              initDefault(t) {
41954                super.initDefault(t);
41955                const e = new LC;
41956                e.initDefault();
41957                this._refreshTexture(e);
41958                this._calculateUV();
41959              }
41960              validate() {
41961                return this._texture && this._rect && 0 !== this._rect.width && 0 !== this._rect.height;
41962              }
41963              _initVertices() {
41964                if (this.vertices) {
41965                  this.vertices.rawPosition.length = 0;
41966                  this.vertices.positions.length = 0;
41967                  this.vertices.indexes.length = 0;
41968                  this.vertices.uv.length = 0;
41969                  this.vertices.nuv.length = 0;
41970                  this.vertices.minPos.set(0, 0, 0);
41971                  this.vertices.maxPos.set(0, 0, 0);
41972                } else this.vertices = {
41973                  rawPosition: [],
41974                  positions: [],
41975                  indexes: [],
41976                  uv: [],
41977                  nuv: [],
41978                  minPos: new Pi,
41979                  maxPos: new Pi
41980                };
41981                if (this._meshType === kI.POLYGON) ; else {
41982                  const t = this.texture;
41983                  const e = t.width;
41984                  const i = t.height;
41985                  const s = this.rect;
41986                  const n = s.width;
41987                  const r = s.height;
41988                  const o = s.x;
41989                  const a = i - s.y - r;
41990                  const l = n / 2;
41991                  const h = r / 2;
41992                  const c = 0 === e ? 0 : o / e;
41993                  const u = 0 === e ? 1 : (o + n) / e;
41994                  const _ = 0 === i ? 1 : (a + r) / i;
41995                  const d = 0 === i ? 0 : s.y / i;
41996                  FI.set(-l, -h, 0);
41997                  this.vertices.rawPosition.push(FI.clone());
41998                  this.vertices.uv.push(o);
41999                  this.vertices.uv.push(a + r);
42000                  this.vertices.nuv.push(c);
42001                  this.vertices.nuv.push(d);
42002                  this.vertices.minPos.set(FI);
42003                  FI.set(l, -h, 0);
42004                  this.vertices.rawPosition.push(FI.clone());
42005                  this.vertices.uv.push(o + n);
42006                  this.vertices.uv.push(a + r);
42007                  this.vertices.nuv.push(u);
42008                  this.vertices.nuv.push(d);
42009                  FI.set(-l, h, 0);
42010                  this.vertices.rawPosition.push(FI.clone());
42011                  this.vertices.uv.push(o);
42012                  this.vertices.uv.push(a);
42013                  this.vertices.nuv.push(c);
42014                  this.vertices.nuv.push(_);
42015                  FI.set(l, h, 0);
42016                  this.vertices.rawPosition.push(FI.clone());
42017                  this.vertices.uv.push(o + n);
42018                  this.vertices.uv.push(a);
42019                  this.vertices.nuv.push(u);
42020                  this.vertices.nuv.push(_);
42021                  this.vertices.maxPos.set(FI);
42022                  this.vertices.indexes.push(0);
42023                  this.vertices.indexes.push(1);
42024                  this.vertices.indexes.push(2);
42025                  this.vertices.indexes.push(2);
42026                  this.vertices.indexes.push(1);
42027                  this.vertices.indexes.push(3);
42028                }
42029                this._updateMeshVertices();
42030              }
42031              _updateMeshVertices() {
42032                VI.identity();
42033                const t = 1 / this._pixelsToUnit;
42034                const e = new Pi(t, t, 1);
42035                VI.scale(e);
42036                const i = -(this._pivot.x - .5) * this.rect.width * t;
42037                const s = -(this._pivot.y - .5) * this.rect.height * t;
42038                e.set(i, s, 0);
42039                VI.translate(e);
42040                const n = this.vertices;
42041                for (let t = 0; t < n.rawPosition.length; t++) {
42042                  const i = n.rawPosition[t];
42043                  Pi.transformMat4(e, i, VI);
42044                  Pi.toArray(n.positions, e, 3 * t);
42045                }
42046                Pi.transformMat4(this._minPos, n.minPos, VI);
42047                Pi.transformMat4(this._maxPos, n.maxPos, VI);
42048              }
42049              _createMesh() {
42050                this._mesh = DI({
42051                  primitiveMode: Xs.TRIANGLE_LIST,
42052                  positions: this.vertices.positions,
42053                  uvs: this.vertices.nuv,
42054                  indices: this.vertices.indexes,
42055                  minPos: this._minPos,
42056                  maxPos: this._maxPos,
42057                  attributes: [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RG32F) ]
42058                });
42059              }
42060              _updateMesh() {
42061                this._mesh && this._mesh.destroy();
42062                this._initVertices();
42063                this._createMesh();
42064              }
42065            }, NI.EVENT_UV_UPDATED = "uv_updated", NI.MeshType = kI, LI)) || OI);
42066            m.SpriteFrame = GI;
42067            var zI, HI, jI, XI;
42068            let WI = t("SpriteAtlas", Ul("cc.SpriteAtlas")(zI = (HI = (XI = class extends gc {
42069              constructor(...t) {
42070                super(...t);
42071                Ml(this, "spriteFrames", jI, this);
42072              }
42073              getTexture() {
42074                const t = Object.keys(this.spriteFrames);
42075                if (t.length > 0) {
42076                  const e = this.spriteFrames[t[0]];
42077                  return e && e.texture;
42078                }
42079                return null;
42080              }
42081              getSpriteFrame(t) {
42082                const e = this.spriteFrames[t];
42083                if (!e) return null;
42084                e.name || (e.name = t);
42085                return e;
42086              }
42087              getSpriteFrames() {
42088                const t = [];
42089                const e = this.spriteFrames;
42090                for (const i of Object.keys(e)) t.push(e[i]);
42091                return t;
42092              }
42093              _serialize(t) {}
42094              _deserialize(t, e) {
42095                const i = t;
42096                this._name = i.name;
42097                const s = i.spriteFrames;
42098                this.spriteFrames = vt();
42099                for (let t = 0; t < s.length; t += 2) e.result.push(this.spriteFrames, s[t], s[t + 1], Qt(GI));
42100              }
42101            }, XI), jI = Bl(HI.prototype, "spriteFrames", [ Yl, nh ], {
42102              configurable: !0,
42103              enumerable: !0,
42104              writable: !0,
42105              initializer: function() {
42106                return vt();
42107              }
42108            }), HI)) || zI);
42109            m.SpriteAtlas = WI;
42110            var YI;
42111            let qI = t("Font", Ul("cc.Font")(YI = class extends gc {}) || YI);
42112            m.Font = qI;
42113            var KI, JI, ZI, QI;
42114            let $I = t("TTFFont", Ul("cc.TTFFont")(KI = (JI = (QI = class extends qI {
42115              constructor(...t) {
42116                super(...t);
42117                Ml(this, "_fontFamily", ZI, this);
42118              }
42119              get _nativeAsset() {
42120                return this._fontFamily;
42121              }
42122              set _nativeAsset(t) {
42123                this._fontFamily = t || "Arial";
42124              }
42125              get _nativeDep() {
42126                return {
42127                  uuid: this._uuid,
42128                  __nativeName__: this._native,
42129                  ext: nc(this._native),
42130                  __isNative__: !0
42131                };
42132              }
42133              initDefault(t) {
42134                this._fontFamily = "Arial";
42135                super.initDefault(t);
42136              }
42137            }, QI), ZI = Bl(JI.prototype, "_fontFamily", [ Yl ], {
42138              configurable: !0,
42139              enumerable: !0,
42140              writable: !0,
42141              initializer: function() {
42142                return null;
42143              }
42144            }), Bl(JI.prototype, "_nativeAsset", [ vh, Ah ], Object.getOwnPropertyDescriptor(JI.prototype, "_nativeAsset"), JI.prototype),
42145            Bl(JI.prototype, "_nativeDep", [ vh ], Object.getOwnPropertyDescriptor(JI.prototype, "_nativeDep"), JI.prototype),
42146            JI)) || KI);
42147            m.TTFFont = $I;
42148            var tM, eM, iM, sM, nM, rM, oM, aM, lM;
42149            class hM {
42150              constructor() {
42151                this.u = 0;
42152                this.v = 0;
42153                this.w = 0;
42154                this.h = 0;
42155                this.offsetX = 0;
42156                this.offsetY = 0;
42157                this.textureID = 0;
42158                this.valid = !1;
42159                this.xAdvance = 0;
42160              }
42161            }
42162            class cM {
42163              constructor(t) {
42164                this.letterDefinitions = {};
42165                this.texture = t;
42166              }
42167              addLetterDefinitions(t, e) {
42168                this.letterDefinitions[t] = e;
42169              }
42170              cloneLetterDefinition() {
42171                const t = {};
42172                for (const e of Object.keys(this.letterDefinitions)) {
42173                  const i = new hM;
42174                  Nt(i, this.letterDefinitions[e]);
42175                  t[e] = i;
42176                }
42177                return t;
42178              }
42179              getTexture() {
42180                return this.texture;
42181              }
42182              getLetter(t) {
42183                return this.letterDefinitions[t];
42184              }
42185              getLetterDefinitionForChar(t, e) {
42186                const i = t.charCodeAt(0);
42187                let s;
42188                s = this.letterDefinitions.hasOwnProperty(i) ? this.letterDefinitions[i] : null;
42189                return s;
42190              }
42191              clear() {
42192                this.letterDefinitions = {};
42193              }
42194            }
42195            let uM = t("BitmapFont", (tM = Ul("cc.BitmapFont"), eM = Th(GI), tM(iM = (sM = (lM = class extends qI {
42196              constructor(...t) {
42197                super(...t);
42198                Ml(this, "fntDataStr", nM, this);
42199                Ml(this, "spriteFrame", rM, this);
42200                Ml(this, "fontSize", oM, this);
42201                Ml(this, "fntConfig", aM, this);
42202              }
42203              onLoaded() {
42204                const t = this.spriteFrame;
42205                !this.fontDefDictionary && t && (this.fontDefDictionary = new cM(t.texture));
42206                const e = this.fntConfig;
42207                if (!e) {
42208                  C("The fnt config is not exists!");
42209                  return;
42210                }
42211                const i = e.fontDefDictionary;
42212                for (const t in i) {
42213                  const e = new hM;
42214                  const s = i[t].rect;
42215                  e.offsetX = i[t].xOffset;
42216                  e.offsetY = i[t].yOffset;
42217                  e.w = s.width;
42218                  e.h = s.height;
42219                  e.u = s.x;
42220                  e.v = s.y;
42221                  e.textureID = 0;
42222                  e.valid = !0;
42223                  e.xAdvance = i[t].xAdvance;
42224                  this.fontDefDictionary.addLetterDefinitions(t, e);
42225                }
42226              }
42227            }, lM), nM = Bl(sM.prototype, "fntDataStr", [ Yl, nh ], {
42228              configurable: !0,
42229              enumerable: !0,
42230              writable: !0,
42231              initializer: function() {
42232                return "";
42233              }
42234            }), rM = Bl(sM.prototype, "spriteFrame", [ eM ], {
42235              configurable: !0,
42236              enumerable: !0,
42237              writable: !0,
42238              initializer: function() {
42239                return null;
42240              }
42241            }), oM = Bl(sM.prototype, "fontSize", [ Yl, nh ], {
42242              configurable: !0,
42243              enumerable: !0,
42244              writable: !0,
42245              initializer: function() {
42246                return -1;
42247              }
42248            }), aM = Bl(sM.prototype, "fntConfig", [ Yl, nh ], {
42249              configurable: !0,
42250              enumerable: !0,
42251              writable: !0,
42252              initializer: function() {
42253                return null;
42254              }
42255            }), sM)) || iM));
42256            m.BitmapFont = uM;
42257            var _M;
42258            let dM = t("LabelAtlas", Ul("cc.LabelAtlas")(_M = class extends uM {}) || _M);
42259            m.LabelAtlas = dM;
42260            const pM = t("BASELINE_RATIO", .26);
42261            const mM = t("MIDDLE_RATIO", (pM + 1) / 2 - pM);
42262            function fM() {
42263              return 0;
42264            }
42265            const gM = new $t(2);
42266            gM.get = function() {
42267              return this._get() || {
42268                key: "",
42269                value: 0,
42270                prev: null,
42271                next: null
42272              };
42273            };
42274            const yM = new class {
42275              constructor(t) {
42276                this.count = 0;
42277                this.limit = 0;
42278                this.datas = {};
42279                this.limit = t;
42280              }
42281              moveToHead(t) {
42282                t.next = this.head;
42283                t.prev = null;
42284                this.head && (this.head.prev = t);
42285                this.head = t;
42286                this.tail || (this.tail = t);
42287                this.count++;
42288                this.datas[t.key] = t;
42289              }
42290              put(t, e) {
42291                const i = gM.get();
42292                i.key = t;
42293                i.value = e;
42294                if (this.count >= this.limit) {
42295                  const t = this.tail;
42296                  delete this.datas[t.key];
42297                  this.count--;
42298                  this.tail = t.prev;
42299                  this.tail.next = null;
42300                  t.prev = null;
42301                  t.next = null;
42302                  gM.put(t);
42303                }
42304                this.moveToHead(i);
42305              }
42306              remove(t) {
42307                t.prev ? t.prev.next = t.next : this.head = t.next;
42308                t.next ? t.next.prev = t.prev : this.tail = t.prev;
42309                delete this.datas[t.key];
42310                this.count--;
42311              }
42312              get(t) {
42313                const e = this.datas[t];
42314                if (e) {
42315                  this.remove(e);
42316                  this.moveToHead(e);
42317                  return e.value;
42318                }
42319                return null;
42320              }
42321              clear() {
42322                this.count = 0;
42323                this.datas = {};
42324                this.head = null;
42325                this.tail = null;
42326              }
42327              has(t) {
42328                return !!this.datas[t];
42329              }
42330              delete(t) {
42331                const e = this.datas[t];
42332                this.remove(e);
42333              }
42334            }(100);
42335            const bM = /([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/;
42336            const SM = /^[!,.:;'}\]%\?>、‘“》?。,!]/;
42337            const AM = /([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/;
42338            const TM = /[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/;
42339            const vM = /^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;
42340            function EM(t) {
42341              return /^[\u4E00-\u9FFF\u3400-\u4DFF]+$/.test(t) || /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g.test(t) || /^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/.test(t);
42342            }
42343            function CM(t) {
42344              const e = t.charCodeAt(0);
42345              return e >= 9 && e <= 13 || 32 === e || 133 === e || 160 === e || 5760 === e || e >= 8192 && e <= 8202 || 8232 === e || 8233 === e || 8239 === e || 8287 === e || 12288 === e;
42346            }
42347            function xM(t, e, i) {
42348              const s = `${i || t.font}�${e}`;
42349              const n = yM.get(s);
42350              if (null !== n) return n;
42351              const r = t.measureText(e);
42352              const o = r && r.width || 0;
42353              yM.put(s, o);
42354              return o;
42355            }
42356            function wM(t, e, i) {
42357              let s = e;
42358              let n = i;
42359              const r = t[e];
42360              r >= "\udc00" && r <= "\udfff" && s--;
42361              if (void 0 !== i) if (i - 1 !== e) {
42362                const e = t[i - 1];
42363                e >= "\ud800" && e <= "\udbff" && n--;
42364              } else r >= "\ud800" && r <= "\udbff" && n++;
42365              return t.substring(s, n);
42366            }
42367            function RM(t) {
42368              return vM.exec(t);
42369            }
42370            function IM(t) {
42371              return TM.exec(t);
42372            }
42373            function MM(t, e, i, s) {
42374              const n = [];
42375              if (0 === t.length || i < 0) {
42376                n.push("");
42377                return n;
42378              }
42379              let r = t;
42380              for (;e > i && r.length > 1; ) {
42381                let t = r.length * (i / e) | 0;
42382                let o = wM(r, t);
42383                let a = e - s(o);
42384                let l = o;
42385                let h = 0;
42386                let c = 0;
42387                const u = 100;
42388                for (;a > i && c++ < u; ) {
42389                  t *= i / a;
42390                  t |= 0;
42391                  o = wM(r, t);
42392                  a = e - s(o);
42393                }
42394                c = 0;
42395                for (;o && a <= i && c++ < u; ) {
42396                  const i = bM.exec(o);
42397                  h = i ? i[0].length : 1;
42398                  l = o;
42399                  t += h;
42400                  o = wM(r, t);
42401                  a = e - s(o);
42402                }
42403                t -= h;
42404                if (0 === t) {
42405                  t = 1;
42406                  l = wM(r, 1);
42407                } else if (1 === t && r[0] >= "\ud800" && r[0] <= "\udbff") {
42408                  t = 2;
42409                  l = wM(r, 2);
42410                }
42411                let _ = wM(r, 0, t);
42412                let d;
42413                if (SM.test(l || o)) {
42414                  d = AM.exec(_);
42415                  t -= d ? d[0].length : 0;
42416                  0 === t && (t = 1);
42417                  l = wM(r, t);
42418                  _ = wM(r, 0, t);
42419                }
42420                if (vM.test(l)) {
42421                  d = TM.exec(_);
42422                  if (d && _ !== d[0]) {
42423                    t -= d[0].length;
42424                    l = wM(r, t);
42425                    _ = wM(r, 0, t);
42426                  }
42427                }
42428                if (0 === n.length) n.push(_); else {
42429                  _ = _.trim();
42430                  _.length > 0 && n.push(_);
42431                }
42432                r = l || o;
42433                e = s(r);
42434              }
42435              if (0 === n.length) n.push(r); else {
42436                r = r.trim();
42437                r.length > 0 && n.push(r);
42438              }
42439              return n;
42440            }
42441            let BM;
42442            class DM {
42443              constructor() {
42444                this.pool = [];
42445              }
42446              static getInstance() {
42447                BM || (BM = new DM);
42448                return BM;
42449              }
42450              get() {
42451                let t = this.pool.pop();
42452                if (!t) {
42453                  const e = document.createElement("canvas");
42454                  const i = e.getContext("2d");
42455                  t = {
42456                    canvas: e,
42457                    context: i
42458                  };
42459                }
42460                return t;
42461              }
42462              put(t) {
42463                this.pool.length >= pe.MAX_LABEL_CANVAS_POOL_SIZE || this.pool.push(t);
42464              }
42465            }
42466            t("CanvasPool", DM);
42467            const PM = Bi.WHITE.clone();
42468            class OM {
42469              constructor() {
42470                this.u = 0;
42471                this.v = 0;
42472                this.w = 0;
42473                this.h = 0;
42474                this.texture = null;
42475                this.offsetX = 0;
42476                this.offsetY = 0;
42477                this.valid = !1;
42478                this.xAdvance = 0;
42479              }
42480            }
42481            const NM = `rgba(255, 255, 255, ${(1 / 255).toFixed(3)})`;
42482            class LM {
42483              constructor(t, e) {
42484                this.image = null;
42485                this.labelInfo = void 0;
42486                this.char = void 0;
42487                this.data = null;
42488                this.canvas = null;
42489                this.context = null;
42490                this.width = 0;
42491                this.height = 0;
42492                this.offsetY = 0;
42493                this.hash = void 0;
42494                this.char = t;
42495                this.labelInfo = e;
42496                this.hash = t.charCodeAt(0) + e.hash;
42497              }
42498              updateRenderData() {
42499                this._updateProperties();
42500                this._updateTexture();
42501              }
42502              destroy() {
42503                this.image = null;
42504                DM.getInstance().put(this.data);
42505              }
42506              _updateProperties() {
42507                this.data = DM.getInstance().get();
42508                this.canvas = this.data.canvas;
42509                this.context = this.data.context;
42510                if (this.context) {
42511                  this.context.font = this.labelInfo.fontDesc;
42512                  const t = xM(this.context, this.char, this.labelInfo.fontDesc);
42513                  const e = 2 * this.labelInfo.margin + 2;
42514                  this.width = parseFloat(t.toFixed(2)) + e;
42515                  this.height = (1 + pM) * this.labelInfo.fontSize + e;
42516                  this.offsetY = -this.labelInfo.fontSize * pM / 2;
42517                }
42518                this.canvas.width !== this.width && (this.canvas.width = this.width);
42519                this.canvas.height !== this.height && (this.canvas.height = this.height);
42520                this.image || (this.image = new IC);
42521                this.image.reset(this.canvas);
42522              }
42523              _updateTexture() {
42524                if (!this.context || !this.canvas) return;
42525                const t = this.context;
42526                const e = this.labelInfo;
42527                const i = this.canvas.width;
42528                const s = this.canvas.height;
42529                t.textAlign = "center";
42530                t.textBaseline = "alphabetic";
42531                t.clearRect(0, 0, i, s);
42532                t.fillStyle = NM;
42533                t.fillRect(0, 0, i, s);
42534                t.font = e.fontDesc;
42535                const n = e.fontSize;
42536                const r = i / 2;
42537                const o = s / 2 + n * mM + 0 * n;
42538                const a = e.color;
42539                t.lineJoin = "round";
42540                t.fillStyle = `rgba(${a.r}, ${a.g}, ${a.b}, 1)`;
42541                if (e.isOutlined) {
42542                  const i = e.out || PM;
42543                  t.strokeStyle = `rgba(${i.r}, ${i.g}, ${i.b}, ${i.a / 255})`;
42544                  t.lineWidth = 2 * e.margin;
42545                  t.strokeText(this.char, r, o);
42546                }
42547                t.fillText(this.char, r, o);
42548              }
42549            }
42550            class FM extends LC {
42551              initWithSize(t, e, i = Jp.RGBA8888) {
42552                this.reset({
42553                  width: t,
42554                  height: e,
42555                  format: i
42556                });
42557              }
42558              drawTextureAt(t, e, i) {
42559                const s = this.getGFXTexture();
42560                if (!t || !s) return;
42561                const n = this._getGFXDevice();
42562                if (!n) {
42563                  console.warn("Unable to get device");
42564                  return;
42565                }
42566                const r = new mn;
42567                r.texOffset.x = e;
42568                r.texOffset.y = i;
42569                r.texExtent.width = t.width;
42570                r.texExtent.height = t.height;
42571                n.copyTexImagesToTexture([ t.data ], s, [ r ]);
42572              }
42573            }
42574            class VM {
42575              get width() {
42576                return this._width;
42577              }
42578              get height() {
42579                return this._height;
42580              }
42581              constructor(t, e) {
42582                this._x = 0;
42583                this._y = 0;
42584                this._nextY = 0;
42585                this._width = 0;
42586                this._height = 0;
42587                this._halfBleed = 0;
42588                this._dirty = !1;
42589                const i = new FM;
42590                i.initWithSize(t, e);
42591                this.fontDefDictionary = new cM(i);
42592                this._halfBleed = 1;
42593                this._width = t;
42594                this._height = e;
42595                IR.on(RR.EVENT_BEFORE_SCENE_LAUNCH, this.beforeSceneLoad, this);
42596              }
42597              insertLetterTexture(t) {
42598                const e = t.image;
42599                const i = IR.root.device;
42600                if (!e || !this.fontDefDictionary || !i) return null;
42601                const s = e.width;
42602                const n = e.height;
42603                if (this._x + s + 0 > this._width) {
42604                  this._x = 0;
42605                  this._y = this._nextY;
42606                }
42607                this._y + n > this._nextY && (this._nextY = this._y + n + 0);
42608                if (this._nextY > this._height) {
42609                  N(12100);
42610                  return null;
42611                }
42612                this.fontDefDictionary.texture.drawTextureAt(e, this._x, this._y);
42613                this._dirty = !0;
42614                const r = new OM;
42615                r.u = this._x + this._halfBleed;
42616                r.v = this._y + this._halfBleed;
42617                r.texture = this.fontDefDictionary.texture;
42618                r.valid = !0;
42619                r.w = t.width - 2;
42620                r.h = t.height - 2;
42621                r.xAdvance = r.w;
42622                r.offsetY = t.offsetY;
42623                this._x += s + 0;
42624                this.fontDefDictionary.addLetterDefinitions(t.hash, r);
42625                return r;
42626              }
42627              update() {
42628                this._dirty && (this._dirty = !1);
42629              }
42630              reset() {
42631                this._x = 0;
42632                this._y = 0;
42633                this._nextY = 0;
42634                this.fontDefDictionary.clear();
42635              }
42636              destroy() {
42637                this.reset();
42638                if (this.fontDefDictionary) {
42639                  this.fontDefDictionary.texture.destroy();
42640                  this.fontDefDictionary.texture = null;
42641                }
42642              }
42643              getTexture() {
42644                return this.fontDefDictionary.getTexture();
42645              }
42646              beforeSceneLoad() {
42647                this.clearAllCache();
42648              }
42649              clearAllCache() {
42650                this.destroy();
42651                const t = new FM;
42652                t.initWithSize(this._width, this._height);
42653                this.fontDefDictionary.texture = t;
42654              }
42655              getLetter(t) {
42656                return this.fontDefDictionary.letterDefinitions[t];
42657              }
42658              getLetterDefinitionForChar(t, e) {
42659                const i = t.charCodeAt(0) + e.hash;
42660                let s = this.fontDefDictionary.letterDefinitions[i];
42661                if (!s) {
42662                  const i = new LM(t, e);
42663                  i.updateRenderData();
42664                  s = this.insertLetterTexture(i);
42665                  i.destroy();
42666                }
42667                return s;
42668              }
42669            }
42670            const kM = {
42671              fontAtlas: null,
42672              fontSize: 0,
42673              lineHeight: 0,
42674              hAlign: 0,
42675              vAlign: 0,
42676              hash: "",
42677              fontFamily: "",
42678              fontDesc: "Arial",
42679              color: Bi.WHITE.clone(),
42680              isOutlined: !1,
42681              out: Bi.WHITE.clone(),
42682              margin: 0
42683            };
42684            const UM = [ new Vn(cr.ATTR_POSITION, bs.RGB32F) ];
42685            const GM = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_COLOR, bs.RGBA32F) ];
42686            const zM = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RG32F), new Vn(cr.ATTR_COLOR, bs.RGBA32F) ];
42687            const HM = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RG32F), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0) ];
42688            const jM = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RG32F), new Vn(cr.ATTR_COLOR, bs.RGBA32F), new Vn(cr.ATTR_COLOR2, bs.RGBA32F) ];
42689            const XM = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RG32F), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0), new Vn(cr.ATTR_COLOR2, bs.RGBA8, !0) ];
42690            function WM(t) {
42691              let e = 0;
42692              for (let i = 0; i < t.length; i++) {
42693                const s = t[i];
42694                e += ur[s.format].count;
42695              }
42696              return e;
42697            }
42698            function YM(t) {
42699              let e = 0;
42700              for (let i = 0; i < t.length; i++) {
42701                const s = t[i];
42702                e += ur[s.format].size;
42703              }
42704              return e;
42705            }
42706            m.internal.vfmtPosUvColor = zM;
42707            m.internal.vfmtPosUvTwoColor = jM;
42708            m.internal.vfmtPosUvColor4B = HM;
42709            m.internal.vfmtPosUvTwoColor4B = XM;
42710            t("UIVertexFormat", Object.freeze({
42711              __proto__: null,
42712              vfmt: UM,
42713              vfmtPosColor: GM,
42714              vfmtPosUvColor: zM,
42715              vfmtPosUvColor4B: HM,
42716              vfmtPosUvTwoColor: jM,
42717              vfmtPosUvTwoColor4B: XM,
42718              getComponentPerVertex: WM,
42719              getAttributeStride: YM
42720            }));
42721            const qM = n2d.RenderDrawInfo;
42722            n2d.Batcher2d;
42723            const KM = n2d.UIMeshBuffer;
42724            const JM = n2d.RenderEntity;
42725            const ZM = n2d.UIModelProxy;
42726            n2d.StencilManager;
42727            let QM;
42728            !function(t) {
42729              t[t.byteOffset = 0] = "byteOffset";
42730              t[t.vertexOffset = 1] = "vertexOffset";
42731              t[t.indexOffset = 2] = "indexOffset";
42732              t[t.dirty = 3] = "dirty";
42733              t[t.count = 4] = "count";
42734            }(QM || (QM = {}));
42735            class $M {
42736              get attributes() {
42737                return this._attributes;
42738              }
42739              get vertexFormatBytes() {
42740                return this._vertexFormatBytes;
42741              }
42742              get byteOffset() {
42743                return this._byteOffset;
42744              }
42745              set byteOffset(t) {
42746                this._byteOffset = t;
42747                this._sharedBuffer[QM.byteOffset] = t;
42748              }
42749              get vertexOffset() {
42750                return this._vertexOffset;
42751              }
42752              set vertexOffset(t) {
42753                this._vertexOffset = t;
42754                this._sharedBuffer[QM.vertexOffset] = t;
42755              }
42756              get indexOffset() {
42757                return this._indexOffset;
42758              }
42759              set indexOffset(t) {
42760                this._indexOffset = t;
42761                this._sharedBuffer[QM.indexOffset] = t;
42762              }
42763              get dirty() {
42764                return this._dirty;
42765              }
42766              set dirty(t) {
42767                this._dirty = t;
42768                this._sharedBuffer[QM.dirty] = t ? 1 : 0;
42769              }
42770              get floatsPerVertex() {
42771                return this._floatsPerVertex;
42772              }
42773              set floatsPerVertex(t) {
42774                this._floatsPerVertex = t;
42775              }
42776              get vData() {
42777                return this._vData;
42778              }
42779              set vData(t) {
42780                this._vData = t;
42781                this._nativeObj.vData = t;
42782              }
42783              get iData() {
42784                return this._iData;
42785              }
42786              set iData(t) {
42787                this._iData = t;
42788                this._nativeObj.iData = t;
42789              }
42790              get useLinkedData() {
42791                return this._useLinkedData;
42792              }
42793              set useLinkedData(t) {
42794                this._useLinkedData !== t && (this._nativeObj.useLinkData = t);
42795                this._useLinkedData = t;
42796              }
42797              get nativeObj() {
42798                return this._nativeObj;
42799              }
42800              get sharedBuffer() {
42801                return this._sharedBuffer;
42802              }
42803              initSharedBuffer() {
42804                this._sharedBuffer = new Uint32Array(QM.count);
42805              }
42806              syncSharedBufferToNative() {
42807                this._nativeObj.syncSharedBufferToNative(this._sharedBuffer);
42808              }
42809              constructor() {
42810                this._byteOffset = 0;
42811                this._vertexOffset = 0;
42812                this._indexOffset = 0;
42813                this._dirty = !1;
42814                this._floatsPerVertex = 0;
42815                this._vData = null;
42816                this._iData = null;
42817                this._useLinkedData = !1;
42818                this._vertexFormatBytes = 0;
42819                this._initVDataCount = 0;
42820                this._initIDataCount = 0;
42821                this._attributes = null;
42822                this._iaPool = [];
42823                this._iaInfo = null;
42824                this._nextFreeIAHandle = 0;
42825                this._nativeObj = new KM;
42826                this.initSharedBuffer();
42827                this.syncSharedBufferToNative();
42828              }
42829              initialize(t, e, i, s) {
42830                this._initVDataCount = i;
42831                this._initIDataCount = s;
42832                this._attributes = e;
42833                this.floatsPerVertex = YM(e) >> 2;
42834                ne(this._initVDataCount / this._floatsPerVertex < 65536, G(9005));
42835                if (!this.vData || !this.iData) {
42836                  this.vData = new Float32Array(this._initVDataCount);
42837                  this.iData = new Uint16Array(this._initIDataCount);
42838                }
42839                this._iaPool.push(this.createNewIA(t));
42840                this._nativeObj.initialize(t, e, i, s);
42841              }
42842              reset() {
42843                this._nextFreeIAHandle = 0;
42844                this.dirty = !1;
42845              }
42846              destroy() {
42847                this.reset();
42848                this._attributes = null;
42849                this._iaInfo = null;
42850                this.vData = null;
42851                this.iData = null;
42852                for (let t = 0; t < this._iaPool.length; ++t) {
42853                  const e = this._iaPool[t];
42854                  e.vertexBuffers[0] && e.vertexBuffers[0].destroy();
42855                  e.indexBuffer && e.indexBuffer.destroy();
42856                  e.ia.destroy();
42857                }
42858                this._iaPool.length = 0;
42859              }
42860              setDirty() {
42861                this.dirty = !0;
42862              }
42863              request(t, e) {
42864                N(9002);
42865                return !1;
42866              }
42867              requireFreeIA(t) {
42868                this._iaPool.length <= this._nextFreeIAHandle && this._iaPool.push(this.createNewIA(t));
42869                return this._iaPool[this._nextFreeIAHandle++].ia;
42870              }
42871              recycleIA(t) {
42872                const e = this._iaPool;
42873                for (let i = 0; i < this._nextFreeIAHandle; ++i) if (t === e[i].ia) {
42874                  const t = e[i];
42875                  e[i] = e[--this._nextFreeIAHandle];
42876                  e[this._nextFreeIAHandle] = t;
42877                  return;
42878                }
42879              }
42880              checkCapacity(t, e) {
42881                const i = (this.vertexOffset + t) * this._floatsPerVertex;
42882                const s = this.indexOffset + e;
42883                return !(i > this._initVDataCount || s > this._initIDataCount);
42884              }
42885              uploadBuffers() {
42886                if (0 === this.byteOffset || !this._dirty) return;
42887                const t = Vo.__isWebIOS14OrIPadOS14Env ? this._nextFreeIAHandle : 1;
42888                const e = this.byteOffset;
42889                const i = this.indexOffset;
42890                for (let s = 0; s < t; ++s) {
42891                  const t = this._iaPool[s];
42892                  const n = new Float32Array(this.vData.buffer, 0, e >> 2);
42893                  const r = new Uint16Array(this.iData.buffer, 0, i);
42894                  const o = t.vertexBuffers[0];
42895                  e > o.size && o.resize(e);
42896                  o.update(n);
42897                  2 * i > t.indexBuffer.size && t.indexBuffer.resize(2 * i);
42898                  t.indexBuffer.update(r);
42899                }
42900                this.dirty = !1;
42901              }
42902              createNewIA(t) {
42903                let e;
42904                let i;
42905                let s;
42906                if (Vo.__isWebIOS14OrIPadOS14Env || !this._iaPool[0]) {
42907                  const n = this._vertexFormatBytes = this._floatsPerVertex * Float32Array.BYTES_PER_ELEMENT;
42908                  const r = Uint16Array.BYTES_PER_ELEMENT;
42909                  const o = t.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.HOST | Cs.DEVICE, n, n));
42910                  s = t.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.HOST | Cs.DEVICE, r, r));
42911                  i = [ o ];
42912                  this._iaInfo = new Un(this._attributes, i, s);
42913                  e = t.createInputAssembler(this._iaInfo);
42914                } else {
42915                  e = t.createInputAssembler(this._iaInfo);
42916                  i = this._iaInfo.vertexBuffers;
42917                  s = this._iaInfo.indexBuffer;
42918                }
42919                return {
42920                  ia: e,
42921                  vertexBuffers: i,
42922                  indexBuffer: s
42923                };
42924              }
42925            }
42926            t("MeshBuffer", $M);
42927            const tB = new $r((() => ({
42928              offset: 0,
42929              length: 0
42930            })), 32);
42931            class eB {
42932              get ib() {
42933                return this._ib;
42934              }
42935              constructor(t, e, i, s, n, r) {
42936                this._ib = void 0;
42937                this.vertexAccessor = t;
42938                this.bufferId = e;
42939                this.meshBuffer = i;
42940                this.vertexOffset = s;
42941                this.vb = n;
42942                this.indexCount = r;
42943                this._ib = new Uint16Array(r);
42944                ne(i === t.getMeshBuffer(e));
42945              }
42946              setIndexBuffer(t) {
42947                ne(t.length === this.ib.length);
42948                for (let e = 0; e < t.length; ++e) {
42949                  const i = t[e];
42950                  this._ib[e] = this.vertexOffset + i;
42951                }
42952              }
42953            }
42954            class iB extends class {
42955              get attributes() {
42956                return this._attributes;
42957              }
42958              get vertexFormatBytes() {
42959                return this._vertexFormatBytes;
42960              }
42961              get floatsPerVertex() {
42962                return this._floatsPerVertex;
42963              }
42964              constructor(t, e) {
42965                this._device = null;
42966                this._attributes = null;
42967                this._vertexFormatBytes = void 0;
42968                this._floatsPerVertex = void 0;
42969                this._buffers = [];
42970                this._device = t;
42971                this._attributes = e;
42972                this._floatsPerVertex = YM(e) >> 2;
42973                this._vertexFormatBytes = this._floatsPerVertex * Float32Array.BYTES_PER_ELEMENT;
42974              }
42975              initialize() {}
42976              reset() {}
42977              request(t = 4, e = 6) {}
42978              appendBuffers(t, e) {}
42979              uploadBuffers() {}
42980              destroy() {
42981                this._attributes.length = 0;
42982              }
42983            } {
42984              get id() {
42985                return this._id;
42986              }
42987              constructor(t, e, i, s) {
42988                super(t, e);
42989                this._freeLists = [];
42990                this._vCount = 0;
42991                this._iCount = 0;
42992                this._id = 0;
42993                this._vCount = i || Math.floor(1024 * pe.BATCHER2D_MEM_INCREMENT / this._vertexFormatBytes);
42994                this._iCount = s || this._vCount * iB.IB_SCALE;
42995                this._id = iB.generateID();
42996                this._allocateBuffer();
42997              }
42998              destroy() {
42999                for (let t = 0; t < this._buffers.length; ++t) {
43000                  this._buffers[t].destroy();
43001                  const e = this._freeLists[t];
43002                  for (let t = 0; t < e.length; ++t) tB.free(e[t]);
43003                }
43004                this._buffers.length = 0;
43005                this._freeLists.length = 0;
43006                super.destroy();
43007              }
43008              reset() {
43009                for (let t = 0; t < this._buffers.length; ++t) {
43010                  const e = this._buffers[t];
43011                  e.indexOffset = 0;
43012                  e.reset();
43013                }
43014              }
43015              getVertexBuffer(t) {
43016                return this._buffers[t].vData;
43017              }
43018              getIndexBuffer(t) {
43019                return this._buffers[t].iData;
43020              }
43021              getMeshBuffer(t) {
43022                return this._buffers[t];
43023              }
43024              uploadBuffers() {
43025                for (let t = 0; t < this._buffers.length; ++t) {
43026                  const e = this._freeLists[t][0];
43027                  const i = this._buffers[t];
43028                  (!e || e.length < i.vData.byteLength) && i.uploadBuffers();
43029                }
43030              }
43031              appendIndices(t, e) {
43032                const i = this._buffers[t];
43033                if (e.length) {
43034                  i.iData.set(e, i.indexOffset);
43035                  i.indexOffset += e.length;
43036                }
43037              }
43038              allocateChunk(t, e) {
43039                const i = t * this.vertexFormatBytes;
43040                let s = null;
43041                let n;
43042                let r = 0;
43043                let o = -1;
43044                let a = null;
43045                for (let t = 0; t < this._buffers.length; ++t) {
43046                  s = this._buffers[t];
43047                  n = this._freeLists[t];
43048                  for (let e = 0; e < n.length; ++e) if (n[e].length >= i) {
43049                    a = n[e];
43050                    r = t;
43051                    o = e;
43052                    break;
43053                  }
43054                  if (a) break;
43055                }
43056                if (!a) {
43057                  r = this._allocateBuffer();
43058                  s = this._buffers[r];
43059                  if (s && s.checkCapacity(t, e)) {
43060                    o = 0;
43061                    a = this._freeLists[r][o];
43062                  }
43063                }
43064                if (a) {
43065                  const t = a.offset / this.vertexFormatBytes;
43066                  ne(Number.isInteger(t));
43067                  const n = new Float32Array(s.vData.buffer, a.offset, i >> 2).fill(0);
43068                  this._allocateChunkFromEntry(r, o, a, i);
43069                  return new eB(this, r, s, t, n, e);
43070                }
43071                F(9004, i);
43072                return null;
43073              }
43074              recycleChunk(t) {
43075                const e = this._freeLists[t.bufferId];
43076                const i = this._buffers[t.bufferId];
43077                let s = t.vertexOffset * this.vertexFormatBytes;
43078                let n = t.vb.byteLength;
43079                if (0 === n) return;
43080                let r = !1;
43081                let o = 0;
43082                let a = null;
43083                let l = e[o];
43084                for (;l && l.offset < s; ) {
43085                  a = l;
43086                  l = e[++o];
43087                }
43088                if (a) {
43089                  const t = s - (a.offset + a.length);
43090                  ne(t >= 0);
43091                  if (0 === t) {
43092                    a.length += n;
43093                    s = a.offset;
43094                    n = a.length;
43095                    if (l && l.offset - (s + n) == 0) {
43096                      a.length += l.length;
43097                      e.splice(o, 1);
43098                      tB.free(l);
43099                      l = null;
43100                    }
43101                    r = !0;
43102                  }
43103                }
43104                if (!r && l) {
43105                  const t = l.offset - (s + n);
43106                  ne(t >= 0);
43107                  if (0 === t) {
43108                    l.offset = s;
43109                    l.length += n;
43110                  } else {
43111                    const t = tB.alloc();
43112                    t.offset = s;
43113                    t.length = n;
43114                    e.splice(o, 0, t);
43115                  }
43116                  r = !0;
43117                }
43118                if (r) s + n === i.byteOffset && (i.byteOffset = s); else {
43119                  const t = tB.alloc();
43120                  t.offset = s;
43121                  t.length = n;
43122                  e.push(t);
43123                }
43124              }
43125              _allocateChunkFromEntry(t, e, i, s) {
43126                const n = i.length - s;
43127                const r = i.offset + s;
43128                const o = this._buffers[t];
43129                o.byteOffset < r && (o.byteOffset = r);
43130                k(n >= 0, 9004, t, i.offset, i.length);
43131                if (0 === n) {
43132                  this._freeLists[t].splice(e, 1);
43133                  tB.free(i);
43134                } else {
43135                  i.offset += s;
43136                  i.length = n;
43137                }
43138              }
43139              _allocateBuffer() {
43140                k(this._buffers.length === this._freeLists.length, 9003);
43141                const t = new $M;
43142                const e = this._vCount * this._floatsPerVertex;
43143                t.initialize(this._device, this._attributes, e, this._iCount);
43144                this._buffers.push(t);
43145                const i = tB.alloc();
43146                i.offset = 0;
43147                i.length = t.vData.byteLength;
43148                const s = [ i ];
43149                this._freeLists.push(s);
43150                IR.root.batcher2D.syncMeshBuffersToNative(this.id, this._buffers);
43151                return this._buffers.length - 1;
43152              }
43153              static generateID() {
43154                return iB.ID_COUNT++;
43155              }
43156            }
43157            iB.IB_SCALE = 4;
43158            iB.ID_COUNT = 0;
43159            let sB;
43160            !function(t) {
43161              t[t.DrawInfoType = 0] = "DrawInfoType";
43162              t[t.VertDirty = 1] = "VertDirty";
43163              t[t.IsMeshBuffer = 2] = "IsMeshBuffer";
43164              t[t.Stride = 3] = "Stride";
43165              t[t.Count = 4] = "Count";
43166            }(sB || (sB = {}));
43167            let nB;
43168            !function(t) {
43169              t[t.BufferID = 0] = "BufferID";
43170              t[t.AccessorID = 1] = "AccessorID";
43171              t[t.Count = 2] = "Count";
43172            }(nB || (nB = {}));
43173            let rB;
43174            !function(t) {
43175              t[t.VertexOffset = 0] = "VertexOffset";
43176              t[t.IndexOffset = 1] = "IndexOffset";
43177              t[t.VBCount = 2] = "VBCount";
43178              t[t.IBCount = 3] = "IBCount";
43179              t[t.DataHash = 4] = "DataHash";
43180              t[t.Count = 5] = "Count";
43181            }(rB || (rB = {}));
43182            let oB;
43183            !function(t) {
43184              t[t.COMP = 0] = "COMP";
43185              t[t.MODEL = 1] = "MODEL";
43186              t[t.IA = 2] = "IA";
43187              t[t.SUB_NODE = 3] = "SUB_NODE";
43188            }(oB || (oB = {}));
43189            class aB {
43190              constructor(t) {
43191                this._accId = -1;
43192                this._bufferId = -1;
43193                this._vertexOffset = 0;
43194                this._indexOffset = 0;
43195                this._vb = null;
43196                this._ib = null;
43197                this._vData = null;
43198                this._iData = null;
43199                this._vertDirty = !1;
43200                this._vbCount = 0;
43201                this._ibCount = 0;
43202                this._dataHash = 0;
43203                this._isMeshBuffer = !1;
43204                this._material = null;
43205                this._texture = null;
43206                this._sampler = null;
43207                this._stride = 0;
43208                this._useLocal = !1;
43209                this._model = null;
43210                this._drawInfoType = oB.COMP;
43211                this._subNode = null;
43212                this._uint8SharedBuffer = void 0;
43213                this._uint16SharedBuffer = void 0;
43214                this._uint32SharedBuffer = void 0;
43215                this.init(t);
43216                const e = this._nativeObj.getAttrSharedBufferForJS();
43217                let i = 0;
43218                this._uint8SharedBuffer = new Uint8Array(e, i, sB.Count);
43219                i += sB.Count * Uint8Array.BYTES_PER_ELEMENT;
43220                this._uint16SharedBuffer = new Uint16Array(e, i, nB.Count);
43221                i += nB.Count * Uint16Array.BYTES_PER_ELEMENT;
43222                this._uint32SharedBuffer = new Uint32Array(e, i, rB.Count);
43223              }
43224              get nativeObj() {
43225                return this._nativeObj;
43226              }
43227              get render2dBuffer() {
43228                return this._render2dBuffer;
43229              }
43230              init(t) {
43231                t && (this._nativeObj = t);
43232                this._nativeObj || (this._nativeObj = new qM);
43233              }
43234              clear() {
43235                this._bufferId = 0;
43236                this._vertexOffset = 0;
43237                this._indexOffset = 0;
43238                this._vertDirty = !1;
43239              }
43240              setAccId(t) {
43241                this._accId !== t && (this._uint16SharedBuffer[nB.AccessorID] = t);
43242                this._accId = t;
43243              }
43244              setBufferId(t) {
43245                if (this._bufferId !== t) {
43246                  this._uint16SharedBuffer[nB.BufferID] = t;
43247                  this._nativeObj.changeMeshBuffer();
43248                }
43249                this._bufferId = t;
43250              }
43251              setAccAndBuffer(t, e) {
43252                if (this._accId !== t || this._bufferId !== e) {
43253                  this._uint16SharedBuffer[nB.AccessorID] = t;
43254                  this._uint16SharedBuffer[nB.BufferID] = e;
43255                  this._nativeObj.changeMeshBuffer();
43256                }
43257                this._bufferId = e;
43258                this._accId = t;
43259              }
43260              setVertexOffset(t) {
43261                this._vertexOffset = t;
43262                this._uint32SharedBuffer[rB.VertexOffset] = t;
43263              }
43264              setIndexOffset(t) {
43265                this._indexOffset = t;
43266                this._uint32SharedBuffer[rB.IndexOffset] = t;
43267              }
43268              setVB(t) {
43269                this._nativeObj.vbBuffer = t;
43270              }
43271              setIB(t) {
43272                this._nativeObj.ibBuffer = t;
43273              }
43274              setVData(t) {
43275                this._nativeObj.vDataBuffer = t;
43276              }
43277              setIData(t) {
43278                this._nativeObj.iDataBuffer = t;
43279              }
43280              setVBCount(t) {
43281                this._uint32SharedBuffer[rB.VBCount] = t;
43282                this._vbCount = t;
43283              }
43284              setIBCount(t) {
43285                this._uint32SharedBuffer[rB.IBCount] = t;
43286              }
43287              setVertDirty(t) {
43288                this._uint8SharedBuffer[sB.VertDirty] = t ? 1 : 0;
43289                this._vertDirty = t;
43290              }
43291              setDataHash(t) {
43292                this._uint32SharedBuffer[rB.DataHash] = t;
43293                this._dataHash = t;
43294              }
43295              setIsMeshBuffer(t) {
43296                this._uint8SharedBuffer[sB.IsMeshBuffer] = t ? 1 : 0;
43297                this._isMeshBuffer = t;
43298              }
43299              setMaterial(t) {
43300                this._material !== t && (this._nativeObj.material = t);
43301                this._material = t;
43302              }
43303              setTexture(t) {
43304                this._texture !== t && (this._nativeObj.texture = t);
43305                this._texture = t;
43306              }
43307              setSampler(t) {
43308                this._sampler !== t && (this._nativeObj.sampler = t);
43309                this._sampler = t;
43310              }
43311              setModel(t) {
43312                this._model !== t && (this._nativeObj.model = t);
43313              }
43314              setDrawInfoType(t) {
43315                this._drawInfoType !== t && (this._uint8SharedBuffer[sB.DrawInfoType] = t);
43316                this._drawInfoType = t;
43317              }
43318              setSubNode(t) {
43319                this._subNode !== t && (this._nativeObj.subNode = t);
43320                this._subNode = t;
43321              }
43322              setStride(t) {
43323                this._uint8SharedBuffer[sB.Stride] = t;
43324                this._stride = t;
43325              }
43326              initRender2dBuffer() {
43327                this._render2dBuffer = new Float32Array(this._vbCount * this._stride);
43328                this._nativeObj.setRender2dBufferToNative(this._render2dBuffer);
43329              }
43330              fillRender2dBuffer(t) {
43331                {
43332                  const e = Math.min(this._vbCount, t.length);
43333                  let i = 0;
43334                  for (let s = 0; s < e; s++) {
43335                    const e = t[s];
43336                    this._render2dBuffer[i] = e.x;
43337                    this._render2dBuffer[i + 1] = e.y;
43338                    this._render2dBuffer[i + 2] = e.z;
43339                    i += this._stride;
43340                  }
43341                }
43342              }
43343            }
43344            let lB;
43345            !function(t) {
43346              t[t.DISABLED = 0] = "DISABLED";
43347              t[t.CLEAR = 1] = "CLEAR";
43348              t[t.ENTER_LEVEL = 2] = "ENTER_LEVEL";
43349              t[t.ENABLED = 3] = "ENABLED";
43350              t[t.EXIT_LEVEL = 4] = "EXIT_LEVEL";
43351              t[t.CLEAR_INVERTED = 5] = "CLEAR_INVERTED";
43352              t[t.ENTER_LEVEL_INVERTED = 6] = "ENTER_LEVEL_INVERTED";
43353            }(lB || (lB = {}));
43354            let hB;
43355            !function(t) {
43356              t[t.stencilTest = 0] = "stencilTest";
43357              t[t.func = 1] = "func";
43358              t[t.stencilMask = 2] = "stencilMask";
43359              t[t.writeMask = 3] = "writeMask";
43360              t[t.failOp = 4] = "failOp";
43361              t[t.zFailOp = 5] = "zFailOp";
43362              t[t.passOp = 6] = "passOp";
43363              t[t.ref = 7] = "ref";
43364              t[t.count = 8] = "count";
43365            }(hB || (hB = {}));
43366            class cB {
43367              constructor() {
43368                this._maskStack = [];
43369                this._stencilPattern = {
43370                  stencilTest: !0,
43371                  func: Os.ALWAYS,
43372                  stencilMask: 65535,
43373                  writeMask: 65535,
43374                  failOp: Ns.KEEP,
43375                  zFailOp: Ns.KEEP,
43376                  passOp: Ns.KEEP,
43377                  ref: 1
43378                };
43379                this._stage = lB.DISABLED;
43380                this.stencilStateMap = new Map;
43381                this.stencilStateMapWithDepth = new Map;
43382              }
43383              get stage() {
43384                return this._stage;
43385              }
43386              set stage(t) {
43387                this._stage = t;
43388              }
43389              get pattern() {
43390                return this._stencilPattern;
43391              }
43392              pushMask(t) {
43393                this._maskStack.push(t);
43394              }
43395              clear(t) {
43396                return t.stencilStage !== lB.ENTER_LEVEL ? lB.CLEAR_INVERTED : lB.CLEAR;
43397              }
43398              enableMask() {
43399                this.stage = lB.ENABLED;
43400              }
43401              exitMask() {
43402                if (0 !== this._maskStack.length) {
43403                  this._maskStack.pop();
43404                  0 === this._maskStack.length ? this.stage = lB.DISABLED : this.stage = lB.ENABLED;
43405                }
43406              }
43407              getWriteMask() {
43408                return 1 << this._maskStack.length - 1;
43409              }
43410              getExitWriteMask() {
43411                return 1 << this._maskStack.length;
43412              }
43413              getStencilRef() {
43414                let t = 0;
43415                for (let e = 0; e < this._maskStack.length; ++e) t += 1 << e;
43416                return t;
43417              }
43418              getMaskStackSize() {
43419                return this._maskStack.length;
43420              }
43421              reset() {
43422                this._maskStack.length = 0;
43423                this.stage = lB.DISABLED;
43424              }
43425              destroy() {
43426                this.stencilStateMap.forEach(((t, e) => {
43427                  t.destroy();
43428                }));
43429                this.stencilStateMap.clear();
43430              }
43431              getStencilStage(t, e) {
43432                let i = 0;
43433                let s = !1;
43434                let n = !1;
43435                let r = Os.LESS;
43436                let o = this.stencilStateMap;
43437                if (e && e.passes[0]) {
43438                  const a = e.passes[0].depthStencilState;
43439                  let l = 0;
43440                  let h = 0;
43441                  a.depthTest && (l = 1);
43442                  a.depthWrite && (h = 1);
43443                  i = l | h << 1 | a.depthFunc << 2 | t << 6 | this._maskStack.length << 9;
43444                  s = a.depthTest;
43445                  n = a.depthWrite;
43446                  r = a.depthFunc;
43447                  o = this.stencilStateMapWithDepth;
43448                } else i = t << 16 | this._maskStack.length;
43449                if (o && o.has(i)) return o.get(i);
43450                this.setStateFromStage(t);
43451                const a = new wr(s, n, r, this._stencilPattern.stencilTest, this._stencilPattern.func, this._stencilPattern.stencilMask, this._stencilPattern.writeMask, this._stencilPattern.failOp, this._stencilPattern.zFailOp, this._stencilPattern.passOp, this._stencilPattern.ref, this._stencilPattern.stencilTest, this._stencilPattern.func, this._stencilPattern.stencilMask, this._stencilPattern.writeMask, this._stencilPattern.failOp, this._stencilPattern.zFailOp, this._stencilPattern.passOp, this._stencilPattern.ref);
43452                o.set(i, a);
43453                return a;
43454              }
43455              getStencilHash(t) {
43456                return t << 8 | this._maskStack.length;
43457              }
43458              setStateFromStage(t) {
43459                const e = this._stencilPattern;
43460                if (t === lB.DISABLED) {
43461                  e.stencilTest = !1;
43462                  e.func = Os.ALWAYS;
43463                  e.failOp = Ns.KEEP;
43464                  e.stencilMask = e.writeMask = 65535;
43465                  e.ref = 1;
43466                } else {
43467                  e.stencilTest = !0;
43468                  if (t === lB.ENABLED) {
43469                    e.func = Os.EQUAL;
43470                    e.failOp = Ns.KEEP;
43471                    e.stencilMask = e.ref = this.getStencilRef();
43472                    e.writeMask = this.getWriteMask();
43473                  } else if (t === lB.CLEAR) {
43474                    e.func = Os.NEVER;
43475                    e.failOp = Ns.ZERO;
43476                    e.writeMask = e.stencilMask = e.ref = this.getWriteMask();
43477                  } else if (t === lB.CLEAR_INVERTED) {
43478                    e.func = Os.NEVER;
43479                    e.failOp = Ns.REPLACE;
43480                    e.writeMask = e.stencilMask = e.ref = this.getWriteMask();
43481                  } else if (t === lB.ENTER_LEVEL) {
43482                    e.func = Os.NEVER;
43483                    e.failOp = Ns.REPLACE;
43484                    e.writeMask = e.stencilMask = e.ref = this.getWriteMask();
43485                  } else if (t === lB.ENTER_LEVEL_INVERTED) {
43486                    e.func = Os.NEVER;
43487                    e.failOp = Ns.ZERO;
43488                    e.writeMask = e.stencilMask = e.ref = this.getWriteMask();
43489                  }
43490                }
43491              }
43492            }
43493            t("StencilManager", cB);
43494            cB.sharedManager = null;
43495            cB.sharedManager = new cB;
43496            let uB;
43497            !function(t) {
43498              t[t.STATIC = 0] = "STATIC";
43499              t[t.DYNAMIC = 1] = "DYNAMIC";
43500              t[t.CROSSED = 2] = "CROSSED";
43501            }(uB || (uB = {}));
43502            let _B;
43503            !function(t) {
43504              t[t.localOpacity = 0] = "localOpacity";
43505              t[t.count = 1] = "count";
43506            }(_B || (_B = {}));
43507            let dB;
43508            !function(t) {
43509              t[t.colorR = 0] = "colorR";
43510              t[t.colorG = 1] = "colorG";
43511              t[t.colorB = 2] = "colorB";
43512              t[t.colorA = 3] = "colorA";
43513              t[t.maskMode = 4] = "maskMode";
43514              t[t.count = 5] = "count";
43515            }(dB || (dB = {}));
43516            let pB;
43517            !function(t) {
43518              t[t.colorDirty = 0] = "colorDirty";
43519              t[t.enabled = 1] = "enabled";
43520              t[t.useLocal = 2] = "useLocal";
43521              t[t.count = 3] = "count";
43522            }(pB || (pB = {}));
43523            let mB;
43524            !function(t) {
43525              t[t.NONE = 0] = "NONE";
43526              t[t.MASK = 1] = "MASK";
43527              t[t.MASK_INVERTED = 2] = "MASK_INVERTED";
43528              t[t.MASK_NODE = 3] = "MASK_NODE";
43529              t[t.MASK_NODE_INVERTED = 4] = "MASK_NODE_INVERTED";
43530            }(mB || (mB = {}));
43531            class fB {
43532              get nativeObj() {
43533                return this._nativeObj;
43534              }
43535              get renderDrawInfoArr() {
43536                return this._dynamicDrawInfoArr;
43537              }
43538              get renderEntityType() {
43539                return this._renderEntityType;
43540              }
43541              get color() {
43542                return this._color;
43543              }
43544              set color(t) {
43545                this._color = t;
43546                this._uint8SharedBuffer[dB.colorR] = t.r;
43547                this._uint8SharedBuffer[dB.colorG] = t.g;
43548                this._uint8SharedBuffer[dB.colorB] = t.b;
43549                this._uint8SharedBuffer[dB.colorA] = t.a;
43550              }
43551              get localOpacity() {
43552                return this._localOpacity;
43553              }
43554              set localOpacity(t) {
43555                this._localOpacity = t;
43556                this._floatSharedBuffer[_B.localOpacity] = t;
43557              }
43558              get colorDirty() {
43559                return this._colorDirty;
43560              }
43561              set colorDirty(t) {
43562                this._colorDirty = t;
43563                this._boolSharedBuffer[pB.colorDirty] = t ? 1 : 0;
43564              }
43565              get enabled() {
43566                return this._enabled;
43567              }
43568              set enabled(t) {
43569                this._enabled = t;
43570                this._boolSharedBuffer[pB.enabled] = t ? 1 : 0;
43571              }
43572              constructor(t) {
43573                this._renderEntityType = uB.STATIC;
43574                this._dynamicDrawInfoArr = [];
43575                this._node = null;
43576                this._renderTransform = null;
43577                this._stencilStage = lB.DISABLED;
43578                this._useLocal = !1;
43579                this._maskMode = mB.NONE;
43580                this._color = Bi.WHITE;
43581                this._localOpacity = 255;
43582                this._colorDirty = !0;
43583                this._enabled = !1;
43584                this._nativeObj || (this._nativeObj = new JM(t));
43585                this._renderEntityType = t;
43586                this.initSharedBuffer();
43587              }
43588              addDynamicRenderDrawInfo(t) {
43589                if (t) {
43590                  this._dynamicDrawInfoArr.push(t);
43591                  this._nativeObj.addDynamicRenderDrawInfo(t.nativeObj);
43592                }
43593              }
43594              removeDynamicRenderDrawInfo() {
43595                this._dynamicDrawInfoArr.pop();
43596                this._nativeObj.removeDynamicRenderDrawInfo();
43597              }
43598              clearDynamicRenderDrawInfos() {
43599                this._dynamicDrawInfoArr.length = 0;
43600                this._nativeObj.clearDynamicRenderDrawInfos();
43601              }
43602              clearStaticRenderDrawInfos() {
43603                this._nativeObj.clearStaticRenderDrawInfos();
43604              }
43605              setDynamicRenderDrawInfo(t, e) {
43606                if (t) if (this._dynamicDrawInfoArr.length < e + 1) {
43607                  this._dynamicDrawInfoArr.push(t);
43608                  this._nativeObj.addDynamicRenderDrawInfo(t.nativeObj);
43609                } else {
43610                  this._dynamicDrawInfoArr[e] = t;
43611                  this._nativeObj.setDynamicRenderDrawInfo(t.nativeObj, e);
43612                }
43613              }
43614              setMaskMode(t) {
43615                this._uint8SharedBuffer[dB.maskMode] = t;
43616                this._maskMode = t;
43617              }
43618              getStaticRenderDrawInfo() {
43619                {
43620                  const t = this._nativeObj.getStaticRenderDrawInfo(this._nativeObj.staticDrawInfoSize++);
43621                  return new aB(t);
43622                }
43623              }
43624              setNode(t) {
43625                this._node !== t && (this._nativeObj.node = t);
43626                this._node = t;
43627              }
43628              setRenderTransform(t) {
43629                this._renderTransform !== t && (this._nativeObj.renderTransform = t);
43630                this._renderTransform = t;
43631              }
43632              setStencilStage(t) {
43633                this._stencilStage !== t && (this._nativeObj.stencilStage = t);
43634                this._stencilStage = t;
43635              }
43636              setUseLocal(t) {
43637                this._boolSharedBuffer[pB.useLocal] = t ? 1 : 0;
43638                this._useLocal = t;
43639              }
43640              initSharedBuffer() {
43641                {
43642                  const t = this._nativeObj.getEntitySharedBufferForJS();
43643                  let e = 0;
43644                  this._floatSharedBuffer = new Float32Array(t, e, _B.count);
43645                  e += 4 * _B.count;
43646                  this._uint8SharedBuffer = new Uint8Array(t, e, dB.count);
43647                  e += 1 * dB.count;
43648                  this._boolSharedBuffer = new Uint8Array(t, e, pB.count);
43649                }
43650              }
43651            }
43652            const gB = YM(zM) >> 2;
43653            const yB = new $r((() => ({
43654              x: 0,
43655              y: 0,
43656              z: 0,
43657              u: 0,
43658              v: 0,
43659              color: Bi.WHITE.clone()
43660            })), 128);
43661            class bB {
43662              get vertexCount() {
43663                return this._vc;
43664              }
43665              get indexCount() {
43666                return this._ic;
43667              }
43668              get stride() {
43669                return this._floatStride << 2;
43670              }
43671              get floatStride() {
43672                return this._floatStride;
43673              }
43674              get vertexFormat() {
43675                return this._vertexFormat;
43676              }
43677              get drawInfoType() {
43678                return this._drawInfoType;
43679              }
43680              set drawInfoType(t) {
43681                this._drawInfoType = t;
43682                this._renderDrawInfo && this._renderDrawInfo.setDrawInfoType(t);
43683              }
43684              get renderDrawInfo() {
43685                return this._renderDrawInfo;
43686              }
43687              get material() {
43688                return this._material;
43689              }
43690              set material(t) {
43691                this._material = t;
43692                this._renderDrawInfo && this._renderDrawInfo.setMaterial(t);
43693              }
43694              get dataHash() {
43695                return this._dataHash;
43696              }
43697              set dataHash(t) {
43698                this._dataHash = t;
43699                this._renderDrawInfo && this._renderDrawInfo.setDataHash(t);
43700              }
43701              get multiOwner() {
43702                return this._multiOwner;
43703              }
43704              set multiOwner(t) {
43705                this._multiOwner = t;
43706              }
43707              get batcher() {
43708                this._batcher || (this._batcher = IR.root.batcher2D);
43709                return this._batcher;
43710              }
43711              constructor(t = zM) {
43712                this.chunk = null;
43713                this._renderDrawInfo = null;
43714                this._material = null;
43715                this._dataHash = 0;
43716                this._isMeshBuffer = !1;
43717                this._vc = 0;
43718                this._ic = 0;
43719                this._floatStride = 0;
43720                this._vertexFormat = zM;
43721                this._drawInfoType = oB.COMP;
43722                this._multiOwner = !1;
43723                this._batcher = null;
43724                this._floatStride = t === zM ? gB : YM(t) >> 2;
43725                this._vertexFormat = t;
43726              }
43727              isValid() {
43728                return this._ic > 0 && this.chunk.vertexAccessor;
43729              }
43730              initRenderDrawInfo(t, e = oB.COMP) {
43731                {
43732                  const i = t.renderEntity;
43733                  if (i.renderEntityType === uB.STATIC) {
43734                    if (!this._renderDrawInfo) {
43735                      const t = i.getStaticRenderDrawInfo();
43736                      t && (this._renderDrawInfo = t);
43737                    }
43738                  } else if (!1 === this.multiOwner && !this._renderDrawInfo) {
43739                    this._renderDrawInfo = new aB;
43740                    i.addDynamicRenderDrawInfo(this._renderDrawInfo);
43741                  }
43742                  this.drawInfoType = e;
43743                  this.setRenderDrawInfoAttributes();
43744                }
43745              }
43746              removeRenderDrawInfo(t) {
43747                {
43748                  const e = t.renderEntity;
43749                  e.renderEntityType === uB.DYNAMIC ? e.removeDynamicRenderDrawInfo() : e.renderEntityType === uB.STATIC && e.clearStaticRenderDrawInfos();
43750                }
43751              }
43752              setRenderDrawInfoAttributes() {
43753                if (this._renderDrawInfo) {
43754                  if (this.chunk) {
43755                    this._renderDrawInfo.setBufferId(this.chunk.bufferId);
43756                    this._renderDrawInfo.setVertexOffset(this.chunk.vertexOffset);
43757                    this._renderDrawInfo.setVB(this.chunk.vb);
43758                    this._renderDrawInfo.setIB(this.chunk.ib);
43759                    if (this.chunk.meshBuffer) {
43760                      this._renderDrawInfo.setIndexOffset(this.chunk.meshBuffer.indexOffset);
43761                      this._renderDrawInfo.setVData(this.chunk.meshBuffer.vData.buffer);
43762                      this._renderDrawInfo.setIData(this.chunk.meshBuffer.iData.buffer);
43763                    }
43764                  }
43765                  this._renderDrawInfo.setVBCount(this._vc);
43766                  this._renderDrawInfo.setIBCount(this._ic);
43767                  this._renderDrawInfo.setDataHash(this.dataHash);
43768                  this._renderDrawInfo.setIsMeshBuffer(this._isMeshBuffer);
43769                  this._renderDrawInfo.setMaterial(this.material);
43770                  this._renderDrawInfo.setDrawInfoType(this._drawInfoType);
43771                }
43772              }
43773            }
43774            t("BaseRenderData", bB);
43775            class SB extends bB {
43776              static add(t = zM, e) {
43777                const i = new SB(t, e);
43778                if (!e) {
43779                  e = IR.root.batcher2D.switchBufferAccessor(i._vertexFormat);
43780                }
43781                i._accessor = e;
43782                return i;
43783              }
43784              static remove(t) {
43785                t.clear();
43786                t._accessor = null;
43787              }
43788              get dataLength() {
43789                return this._data.length;
43790              }
43791              set dataLength(t) {
43792                const e = this._data;
43793                if (e.length !== t) {
43794                  const i = e.length;
43795                  let s = 0;
43796                  for (s = t; s < i; s++) yB.free(e[s]);
43797                  for (s = i; s < t; s++) e[s] = yB.alloc();
43798                  e.length = t;
43799                }
43800                this.syncRender2dBuffer();
43801              }
43802              get data() {
43803                return this._data;
43804              }
43805              get vertDirty() {
43806                return this._vertDirty;
43807              }
43808              set vertDirty(t) {
43809                this._vertDirty = t;
43810                this._renderDrawInfo && t && this._renderDrawInfo.setVertDirty(t);
43811              }
43812              get textureHash() {
43813                return this._textureHash;
43814              }
43815              set textureHash(t) {
43816                this._textureHash = t;
43817              }
43818              set frame(t) {
43819                this._frame = t;
43820                if (this._renderDrawInfo) if (this._frame) {
43821                  this._renderDrawInfo.setTexture(this._frame.getGFXTexture());
43822                  this._renderDrawInfo.setSampler(this._frame.getGFXSampler());
43823                } else {
43824                  this._renderDrawInfo.setTexture(null);
43825                  this._renderDrawInfo.setSampler(null);
43826                }
43827              }
43828              get frame() {
43829                return this._frame;
43830              }
43831              get accessor() {
43832                return this._accessor;
43833              }
43834              constructor(t = zM, e) {
43835                super(t);
43836                this._vertDirty = !0;
43837                this._textureHash = 0;
43838                this.indices = null;
43839                this.layer = 0;
43840                this.nodeDirty = !0;
43841                this.passDirty = !0;
43842                this.textureDirty = !0;
43843                this.hashDirty = !0;
43844                this._data = [];
43845                this._pivotX = 0;
43846                this._pivotY = 0;
43847                this._width = 0;
43848                this._height = 0;
43849                this._frame = null;
43850                this._accessor = null;
43851                this.vertexRow = 1;
43852                this.vertexCol = 1;
43853                e || (e = this.batcher.switchBufferAccessor(this._vertexFormat));
43854                this._accessor = e;
43855              }
43856              resize(t, e) {
43857                if (t !== this._vc || e !== this._ic || !this.chunk) {
43858                  this._vc = t;
43859                  this._ic = e;
43860                  if (this.chunk) {
43861                    this._accessor.recycleChunk(this.chunk);
43862                    this.chunk = null;
43863                  }
43864                  this.chunk = this._accessor.allocateChunk(t, e);
43865                  this.updateHash();
43866                  if (!1 === this.multiOwner && this._renderDrawInfo) {
43867                    this._renderDrawInfo.setDrawInfoType(this._drawInfoType);
43868                    this._renderDrawInfo.setBufferId(this.chunk.bufferId);
43869                    this._renderDrawInfo.setVertexOffset(this.chunk.vertexOffset);
43870                    this._renderDrawInfo.setIndexOffset(this.chunk.meshBuffer.indexOffset);
43871                    this._renderDrawInfo.setVB(this.chunk.vb);
43872                    this._renderDrawInfo.setIB(this.chunk.ib);
43873                    this._renderDrawInfo.setVData(this.chunk.meshBuffer.vData.buffer);
43874                    this._renderDrawInfo.setIData(this.chunk.meshBuffer.iData.buffer);
43875                    this._renderDrawInfo.setVBCount(this._vc);
43876                    this._renderDrawInfo.setIBCount(this._ic);
43877                  }
43878                }
43879              }
43880              setRenderDrawInfoAttributes() {
43881                if (this._renderDrawInfo) {
43882                  this._renderDrawInfo.setAccId(this._accessor.id);
43883                  super.setRenderDrawInfoAttributes();
43884                  this._renderDrawInfo.setTexture(this.frame ? this.frame.getGFXTexture() : null);
43885                  this._renderDrawInfo.setSampler(this.frame ? this.frame.getGFXSampler() : null);
43886                }
43887              }
43888              fillDrawInfoAttributes(t) {
43889                if (t) {
43890                  t.setDrawInfoType(this._drawInfoType);
43891                  t.setAccAndBuffer(this._accessor.id, this.chunk.bufferId);
43892                  t.setVertexOffset(this.chunk.vertexOffset);
43893                  t.setIndexOffset(this.chunk.meshBuffer.indexOffset);
43894                  t.setVB(this.chunk.vb);
43895                  t.setIB(this.chunk.ib);
43896                  t.setVData(this.chunk.meshBuffer.vData.buffer);
43897                  t.setIData(this.chunk.meshBuffer.iData.buffer);
43898                  t.setVBCount(this._vc);
43899                  t.setIBCount(this._ic);
43900                  t.setDataHash(this.dataHash);
43901                  t.setIsMeshBuffer(this._isMeshBuffer);
43902                }
43903              }
43904              syncRender2dBuffer() {
43905                if (!1 === this.multiOwner) {
43906                  if (!this._renderDrawInfo) return;
43907                  this.renderDrawInfo.setStride(this.floatStride);
43908                  this.renderDrawInfo.setVBCount(this.dataLength);
43909                  this.renderDrawInfo.initRender2dBuffer();
43910                }
43911              }
43912              resizeAndCopy(t, e) {
43913                if (t === this._vc && e === this._ic && this.chunk) return;
43914                this._vc = t;
43915                this._ic = e;
43916                const i = this.chunk;
43917                this.chunk = this._accessor.allocateChunk(t, e);
43918                if (i) {
43919                  this.chunk.vb.set(i.vb);
43920                  this._accessor.recycleChunk(i);
43921                }
43922                this.updateHash();
43923              }
43924              getMeshBuffer() {
43925                return this.chunk && this._accessor ? this._accessor.getMeshBuffer(this.chunk.bufferId) : null;
43926              }
43927              updateNode(t) {
43928                this.layer = t.node.layer;
43929                this.nodeDirty = !1;
43930                this.hashDirty = !0;
43931              }
43932              updatePass(t) {
43933                this.material = t.getRenderMaterial(0);
43934                this.passDirty = !1;
43935                this.hashDirty = !0;
43936              }
43937              updateTexture(t) {
43938                this.frame = t;
43939                this.textureHash = t.getHash();
43940                this.textureDirty = !1;
43941                this.hashDirty = !0;
43942              }
43943              updateHash() {
43944                const t = `${this.chunk ? this.chunk.bufferId : -1}${this.layer} ${this.textureHash}`;
43945                this.dataHash = Ur(t, 666);
43946                this.hashDirty = !1;
43947              }
43948              updateRenderData(t, e) {
43949                if (this.passDirty) {
43950                  this.material = t.getRenderMaterial(0);
43951                  this.passDirty = !1;
43952                  this.hashDirty = !0;
43953                  this._renderDrawInfo && this._renderDrawInfo.setMaterial(this.material);
43954                }
43955                if (this.nodeDirty) {
43956                  const e = t.node.scene ? t._getRenderScene() : null;
43957                  this.layer = t.node.layer;
43958                  null !== e && (this.nodeDirty = !1);
43959                  this.hashDirty = !0;
43960                }
43961                if (this.textureDirty) {
43962                  this.frame = e;
43963                  this.textureHash = e.getHash();
43964                  this.textureDirty = !1;
43965                  this.hashDirty = !0;
43966                  if (this._renderDrawInfo) {
43967                    this._renderDrawInfo.setTexture(this.frame ? this.frame.getGFXTexture() : null);
43968                    this._renderDrawInfo.setSampler(this.frame ? this.frame.getGFXSampler() : null);
43969                  }
43970                }
43971                if (this.hashDirty) {
43972                  this.updateHash();
43973                  this._renderDrawInfo && this._renderDrawInfo.setDataHash(this.dataHash);
43974                }
43975                if (!1 === this.multiOwner) {
43976                  w(this._renderDrawInfo.render2dBuffer.length === this._floatStride * this._data.length, "Vertex count doesn't match.");
43977                  this._renderDrawInfo.fillRender2dBuffer(this._data);
43978                }
43979              }
43980              updateSizeNPivot(t, e, i, s) {
43981                if (t !== this._width || e !== this._height || i !== this._pivotX || s !== this._pivotY) {
43982                  this._width = t;
43983                  this._height = e;
43984                  this._pivotX = i;
43985                  this._pivotY = s;
43986                  this.vertDirty = !0;
43987                }
43988              }
43989              clear() {
43990                this.resize(0, 0);
43991                this._data.length = 0;
43992                this._pivotX = 0;
43993                this._pivotY = 0;
43994                this._width = 0;
43995                this._height = 0;
43996                this.indices = null;
43997                this.vertDirty = !0;
43998                this.material = null;
43999                this.nodeDirty = !0;
44000                this.passDirty = !0;
44001                this.textureDirty = !0;
44002                this.hashDirty = !0;
44003                this.layer = 0;
44004                this.frame = null;
44005                this.textureHash = 0;
44006                this.dataHash = 0;
44007                this._renderDrawInfo && this._renderDrawInfo.clear();
44008              }
44009              static createStaticVBAccessor(t, e, i) {
44010                const s = IR.root.device;
44011                return new iB(s, t, e, i);
44012              }
44013            }
44014            t("RenderData", SB);
44015            class AB extends bB {
44016              static add(t = zM) {
44017                const e = new AB;
44018                e._floatStride = t === zM ? gB : YM(t) >> 2;
44019                e._vertexFormat = t;
44020                return e;
44021              }
44022              static remove(t) {
44023                t.clear();
44024              }
44025              set formatByte(t) {}
44026              get formatByte() {
44027                return this.stride;
44028              }
44029              get floatStride() {
44030                return this._floatStride;
44031              }
44032              get vDataOffset() {
44033                return this._byteLength >>> 2;
44034              }
44035              constructor(t = zM) {
44036                super(t);
44037                this._isMeshBuffer = !0;
44038                this.vData = void 0;
44039                this.iData = void 0;
44040                this.vertexStart = 0;
44041                this.vertexRange = 0;
44042                this.indexStart = 0;
44043                this.indexRange = 0;
44044                this.lastFilledIndex = 0;
44045                this.lastFilledVertex = 0;
44046                this.frame = void 0;
44047                this._byteLength = 0;
44048                this._vertexBuffers = [];
44049                this._indexBuffer = null;
44050                this._iaPool = null;
44051                this._iaInfo = null;
44052                this.vData = new Float32Array(256 * this.stride);
44053                this.iData = new Uint16Array(1536);
44054              }
44055              request(t, e) {
44056                const i = this._byteLength + t * this.stride;
44057                if (!this.reserve(t, e)) return !1;
44058                this._vc += t;
44059                this._ic += e;
44060                this._byteLength = i;
44061                this.vertexRange = this._vc;
44062                this.indexRange = this._ic;
44063                return !0;
44064              }
44065              reserve(t, e) {
44066                const i = this._byteLength + t * this.stride;
44067                const s = this.indexCount + e;
44068                if (t + this.vertexCount > 65535) return !1;
44069                let n = this.vData.byteLength;
44070                let r = this.iData.length;
44071                let o = this.vData.length;
44072                let a = this.iData.length;
44073                if (i > n || s > r) {
44074                  for (;n < i || r < s; ) {
44075                    o *= 2;
44076                    a *= 2;
44077                    n = 4 * o;
44078                    r = a;
44079                  }
44080                  this._reallocBuffer(o, a);
44081                }
44082                return !0;
44083              }
44084              resize(t, e) {
44085                const i = t * this.stride;
44086                ne(t >= 0 && e >= 0 && i <= this.vData.byteLength && e <= this.iData.length);
44087                this._vc = t;
44088                this._ic = e;
44089                this._byteLength = i;
44090                this.updateRange(0, t, 0, e);
44091              }
44092              updateRange(t, e, i, s) {
44093                ne(e >= 0 && s >= 0 && e <= this._vc && s <= this._ic);
44094                this.vertexStart = t;
44095                this.indexStart = i;
44096                this.vertexRange = e;
44097                this.indexRange = s;
44098              }
44099              requestIA(t) {
44100                this._initIAInfo(t);
44101                const e = this._iaPool.add();
44102                e.firstIndex = this.indexStart;
44103                e.indexCount = this.indexRange;
44104                return e;
44105              }
44106              uploadBuffers() {
44107                if (0 === this._byteLength || !this._vertexBuffers[0] || !this._indexBuffer) return;
44108                const t = this._ic;
44109                const e = new Float32Array(this.vData.buffer, 0, this._byteLength >> 2);
44110                const i = new Uint16Array(this.iData.buffer, 0, t);
44111                const s = this._vertexBuffers[0];
44112                this._byteLength > s.size && s.resize(this._byteLength);
44113                s.update(e);
44114                const n = t << 1;
44115                n > this._indexBuffer.size && this._indexBuffer.resize(n);
44116                this._indexBuffer.update(i);
44117              }
44118              freeIAPool() {
44119                this._iaPool && this._iaPool.reset();
44120              }
44121              reset() {
44122                this._vc = 0;
44123                this._ic = 0;
44124                this._byteLength = 0;
44125                this.vertexStart = 0;
44126                this.vertexRange = 0;
44127                this.indexStart = 0;
44128                this.indexRange = 0;
44129                this.lastFilledIndex = 0;
44130                this.lastFilledVertex = 0;
44131                this.material = null;
44132                this.freeIAPool();
44133              }
44134              clear() {
44135                this.reset();
44136                this._iaPool && this._iaPool.destroy();
44137                if (this._vertexBuffers[0]) {
44138                  this._vertexBuffers[0].destroy();
44139                  this._vertexBuffers = [];
44140                }
44141                this._iaInfo = null;
44142                this.vData = new Float32Array(256 * this.stride);
44143                this.iData = new Uint16Array(1536);
44144              }
44145              _initIAInfo(t) {
44146                if (!this._iaInfo) {
44147                  const e = this.stride;
44148                  const i = this._vertexBuffers;
44149                  i.length || i.push(t.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.DEVICE, e, e)));
44150                  const s = Uint16Array.BYTES_PER_ELEMENT;
44151                  this._indexBuffer || (this._indexBuffer = t.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, s, s)));
44152                  this._iaInfo = new Un(this._vertexFormat, i, this._indexBuffer);
44153                  this._iaPool = new to((() => t.createInputAssembler(this._iaInfo)), 1, (t => {
44154                    t.destroy();
44155                  }));
44156                }
44157              }
44158              _reallocBuffer(t, e) {
44159                const i = this.vData;
44160                this.vData = new Float32Array(t);
44161                i && this.vData.set(i, 0);
44162                const s = this.iData;
44163                this.iData = new Uint16Array(e);
44164                s && this.iData.set(s, 0);
44165              }
44166              setRenderDrawInfoAttributes() {
44167                var t, e;
44168                if (this._renderDrawInfo) {
44169                  this._renderDrawInfo.setVData(this.vData.buffer);
44170                  this._renderDrawInfo.setIData(this.iData.buffer);
44171                  this._renderDrawInfo.setVBCount(this._vc);
44172                  this._renderDrawInfo.setIBCount(this._ic);
44173                  this._renderDrawInfo.setVertexOffset(this.vertexStart);
44174                  this._renderDrawInfo.setIndexOffset(this.indexStart);
44175                  this._renderDrawInfo.setIsMeshBuffer(this._isMeshBuffer);
44176                  this._renderDrawInfo.setMaterial(this.material);
44177                  this._renderDrawInfo.setTexture(null === (t = this.frame) || void 0 === t ? void 0 : t.getGFXTexture());
44178                  this._renderDrawInfo.setSampler(null === (e = this.frame) || void 0 === e ? void 0 : e.getGFXSampler());
44179                }
44180              }
44181              particleInitRenderDrawInfo(t) {
44182                if (t.renderEntityType === uB.STATIC && !this._renderDrawInfo) {
44183                  const e = t.getStaticRenderDrawInfo();
44184                  e && (this._renderDrawInfo = e);
44185                }
44186              }
44187            }
44188            t("MeshRenderData", AB);
44189            new to((() => new AB), 32);
44190            var TB, vB, EB, CB, xB, wB, RB, IB, MB, BB, DB, PB, OB, NB;
44191            const LB = new Qi;
44192            const FB = new Qi;
44193            const VB = new Pi;
44194            const kB = new qi;
44195            const UB = new qi;
44196            const GB = new qi;
44197            const zB = new qi(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
44198            const HB = new as;
44199            let jB = function(e) {
44200              return t({
44201                UITransform: e,
44202                UITransformComponent: e
44203              }), e;
44204            }((TB = Ul("cc.UITransform"), vB = sh(), EB = zl(110), CB = $l(), xB = ph(), wB = lh(),
44205            RB = ph(), IB = lh(), TB(MB = vB(MB = EB(MB = CB(MB = Hl(MB = Ql(MB = (BB = (NB = OB = class t extends Qc {
44206              constructor(...t) {
44207                super(...t);
44208                this._priority = 0;
44209                Ml(this, "_contentSize", DB, this);
44210                Ml(this, "_anchorPoint", PB, this);
44211              }
44212              get contentSize() {
44213                return this._contentSize;
44214              }
44215              set contentSize(t) {
44216                if (!this._contentSize.equals(t)) {
44217                  this._contentSize.set(t);
44218                  this.node.emit(ny.SIZE_CHANGED);
44219                  this._markRenderDataDirty();
44220                }
44221              }
44222              get width() {
44223                return this._contentSize.width;
44224              }
44225              set width(t) {
44226                if (this._contentSize.width !== t) {
44227                  this._contentSize.width = t;
44228                  this.node.emit(ny.SIZE_CHANGED);
44229                  this._markRenderDataDirty();
44230                }
44231              }
44232              get height() {
44233                return this._contentSize.height;
44234              }
44235              set height(t) {
44236                if (this.contentSize.height !== t) {
44237                  this._contentSize.height = t;
44238                  this.node.emit(ny.SIZE_CHANGED);
44239                  this._markRenderDataDirty();
44240                }
44241              }
44242              get anchorPoint() {
44243                return this._anchorPoint;
44244              }
44245              set anchorPoint(t) {
44246                if (!this._anchorPoint.equals(t)) {
44247                  this._anchorPoint.set(t);
44248                  this.node.emit(ny.ANCHOR_CHANGED, this._anchorPoint);
44249                  this._markRenderDataDirty();
44250                }
44251              }
44252              get anchorX() {
44253                return this._anchorPoint.x;
44254              }
44255              set anchorX(t) {
44256                if (this._anchorPoint.x !== t) {
44257                  this._anchorPoint.x = t;
44258                  this.node.emit(ny.ANCHOR_CHANGED, this._anchorPoint);
44259                  this._markRenderDataDirty();
44260                }
44261              }
44262              get anchorY() {
44263                return this._anchorPoint.y;
44264              }
44265              set anchorY(t) {
44266                if (this._anchorPoint.y !== t) {
44267                  this._anchorPoint.y = t;
44268                  this.node.emit(ny.ANCHOR_CHANGED, this._anchorPoint);
44269                  this._markRenderDataDirty();
44270                }
44271              }
44272              get priority() {
44273                return this._priority;
44274              }
44275              set priority(e) {
44276                if (this._priority !== e) if (this.node.getComponent("cc.RenderRoot2D")) N(6706); else {
44277                  this._priority = e;
44278                  this.node.parent && t.insertChangeMap(this.node.parent);
44279                }
44280              }
44281              get visibility() {
44282                const t = IR.root.batcher2D.getFirstRenderCamera(this.node);
44283                return t ? t.visibility : 0;
44284              }
44285              get cameraPriority() {
44286                const t = IR.root.batcher2D.getFirstRenderCamera(this.node);
44287                return t ? t.priority : 0;
44288              }
44289              __preload() {
44290                this.node._uiProps.uiTransformComp = this;
44291              }
44292              onLoad() {
44293                this.node.parent && t.insertChangeMap(this.node.parent);
44294              }
44295              onEnable() {
44296                this.node.on(ny.PARENT_CHANGED, this._parentChanged, this);
44297                this._markRenderDataDirty();
44298              }
44299              onDisable() {
44300                this.node.off(ny.PARENT_CHANGED, this._parentChanged, this);
44301              }
44302              onDestroy() {
44303                this.node._uiProps.uiTransformComp = null;
44304              }
44305              setContentSize(t, e) {
44306                const i = this._contentSize;
44307                if (void 0 === e) {
44308                  if (ui(t.width, i.width, hi) && ui(t.height, i.height, hi)) return;
44309                  i.width = t.width;
44310                  i.height = t.height;
44311                } else {
44312                  if (ui(t, i.width, hi) && ui(e, i.height, hi)) return;
44313                  i.width = t;
44314                  i.height = e;
44315                }
44316                this.node.emit(ny.SIZE_CHANGED);
44317                this._markRenderDataDirty();
44318              }
44319              setAnchorPoint(t, e) {
44320                const i = this._anchorPoint;
44321                if (void 0 === e) {
44322                  if (t.x === i.x && t.y === i.y) return;
44323                  i.x = t.x;
44324                  i.y = t.y;
44325                } else {
44326                  if (t === i.x && e === i.y) return;
44327                  i.x = t;
44328                  i.y = e;
44329                }
44330                this.node.emit(ny.ANCHOR_CHANGED, this._anchorPoint);
44331                this._markRenderDataDirty();
44332              }
44333              isHit(t) {
44334                const e = this._contentSize.width;
44335                const i = this._contentSize.height;
44336                const s = LB;
44337                const n = FB;
44338                const r = this._getRenderScene().cameras;
44339                for (let o = 0; o < r.length; o++) {
44340                  const a = r[o];
44341                  if (!(a.visibility & this.node.layer)) continue;
44342                  a.node.getWorldRT(kB);
44343                  const l = kB.m12;
44344                  const h = kB.m13;
44345                  const c = HR.center;
44346                  kB.m12 = c.x - (kB.m00 * l + kB.m04 * h);
44347                  kB.m13 = c.y - (kB.m01 * l + kB.m05 * h);
44348                  qi.invert(kB, kB);
44349                  Qi.transformMat4(s, t, kB);
44350                  this.node.getWorldMatrix(GB);
44351                  qi.invert(kB, GB);
44352                  if (qi.strictEquals(kB, zB)) continue;
44353                  Qi.transformMat4(n, s, kB);
44354                  n.x += this._anchorPoint.x * e;
44355                  n.y += this._anchorPoint.y * i;
44356                  let u = !1;
44357                  n.x >= 0 && n.y >= 0 && n.x <= e && n.y <= i && (u = this._maskTest(s));
44358                  if (u) return !0;
44359                }
44360                return !1;
44361              }
44362              hitTest(t) {
44363                const e = this._contentSize.width;
44364                const i = this._contentSize.height;
44365                const s = VB;
44366                const n = LB;
44367                const r = FB;
44368                const o = this._getRenderScene().cameras;
44369                for (let a = 0; a < o.length; a++) {
44370                  const l = o[a];
44371                  if (!(l.visibility & this.node.layer) || l.window && !l.window.swapchain) continue;
44372                  Pi.set(s, t.x, t.y, 0);
44373                  l.screenToWorld(s, s);
44374                  Qi.set(n, s.x, s.y);
44375                  this.node.getWorldMatrix(GB);
44376                  qi.invert(kB, GB);
44377                  if (qi.strictEquals(kB, zB)) continue;
44378                  Qi.transformMat4(r, n, kB);
44379                  r.x += this._anchorPoint.x * e;
44380                  r.y += this._anchorPoint.y * i;
44381                  let h = !1;
44382                  r.x >= 0 && r.y >= 0 && r.x <= e && r.y <= i && (h = this._maskTest(n));
44383                  if (h) return !0;
44384                }
44385                return !1;
44386              }
44387              _maskTest(t) {
44388                var e, i;
44389                const s = null === (e = this.node) || void 0 === e || null === (i = e.eventProcessor) || void 0 === i ? void 0 : i.maskList;
44390                if (s) {
44391                  let e = this.node;
44392                  const i = s.length;
44393                  for (let n = 0, r = 0; e && r < i; ++n, e = e.parent) {
44394                    const i = s[r];
44395                    if (n === i.index) {
44396                      if (e !== i.comp.node) {
44397                        s.length = r;
44398                        break;
44399                      }
44400                      {
44401                        const e = i.comp;
44402                        if (e && e._enabled && !e.isHit(t)) return !1;
44403                        r++;
44404                      }
44405                    } else if (n > i.index) {
44406                      s.length = r;
44407                      break;
44408                    }
44409                  }
44410                }
44411                return !0;
44412              }
44413              convertToNodeSpaceAR(t, e) {
44414                this.node.getWorldMatrix(GB);
44415                qi.invert(kB, GB);
44416                e || (e = new Pi);
44417                return Pi.transformMat4(e, t, kB);
44418              }
44419              convertToWorldSpaceAR(t, e) {
44420                this.node.getWorldMatrix(GB);
44421                e || (e = new Pi);
44422                return Pi.transformMat4(e, t, GB);
44423              }
44424              getBoundingBox() {
44425                qi.fromRTS(UB, this.node.getRotation(), this.node.getPosition(), this.node.getScale());
44426                const t = this._contentSize.width;
44427                const e = this._contentSize.height;
44428                const i = new as(-this._anchorPoint.x * t, -this._anchorPoint.y * e, t, e);
44429                i.transformMat4(UB);
44430                return i;
44431              }
44432              getBoundingBoxToWorld() {
44433                if (this.node.parent) {
44434                  this.node.parent.getWorldMatrix(GB);
44435                  return this.getBoundingBoxTo(GB);
44436                }
44437                return this.getBoundingBox();
44438              }
44439              getBoundingBoxTo(e) {
44440                qi.fromRTS(UB, this.node.getRotation(), this.node.getPosition(), this.node.getScale());
44441                const i = this._contentSize.width;
44442                const s = this._contentSize.height;
44443                const n = new as(-this._anchorPoint.x * i, -this._anchorPoint.y * s, i, s);
44444                qi.multiply(GB, e, UB);
44445                n.transformMat4(GB);
44446                if (!this.node.children) return n;
44447                const r = this.node.children;
44448                for (const i of r) if (i && i.active) {
44449                  const s = i.getComponent(t);
44450                  if (s) {
44451                    const t = s.getBoundingBoxTo(e);
44452                    t && as.union(n, n, t);
44453                  }
44454                }
44455                return n;
44456              }
44457              getComputeAABB(t) {
44458                const e = this._contentSize.width;
44459                const i = this._contentSize.height;
44460                HB.set(-this._anchorPoint.x * e, -this._anchorPoint.y * i, e, i);
44461                HB.transformMat4(this.node.worldMatrix);
44462                const s = HB.x + .5 * HB.width;
44463                const n = HB.y + .5 * HB.height;
44464                const r = this.node.worldPosition.z;
44465                const o = HB.width / 2;
44466                const a = HB.height / 2;
44467                if (null != t) {
44468                  hl.set(t, s, n, r, o, a, .001);
44469                  return t;
44470                }
44471                return new hl(s, n, r, o, a, .001);
44472              }
44473              _parentChanged(e) {
44474                this.node.getComponent("cc.RenderRoot2D") || this.node.parent && t.insertChangeMap(this.node.parent);
44475              }
44476              _markRenderDataDirty() {
44477                const t = this.node._uiProps.uiComp;
44478                t && t.markForUpdateRenderData();
44479              }
44480              static insertChangeMap(e) {
44481                const i = e.uuid;
44482                t.priorityChangeNodeMap.has(i) || t.priorityChangeNodeMap.set(i, e);
44483              }
44484              static _sortChildrenSibling(t) {
44485                const e = t.children;
44486                e && e.sort(((t, e) => {
44487                  const i = t._uiProps.uiTransformComp;
44488                  const s = e._uiProps.uiTransformComp;
44489                  const n = (i ? i._priority : 0) - (s ? s._priority : 0);
44490                  return 0 === n ? t.getSiblingIndex() - e.getSiblingIndex() : n;
44491                }));
44492              }
44493              static _sortSiblings() {
44494                t.priorityChangeNodeMap.forEach(((e, i) => {
44495                  t._sortChildrenSibling(e);
44496                  e._updateSiblingIndex();
44497                  e.emit("childrenSiblingOrderChanged");
44498                }));
44499                t.priorityChangeNodeMap.clear();
44500              }
44501              static _cleanChangeMap() {
44502                t.priorityChangeNodeMap.clear();
44503              }
44504            }, OB.EventType = ny, OB.priorityChangeNodeMap = new Map, NB), Bl(BB.prototype, "contentSize", [ xB, wB ], Object.getOwnPropertyDescriptor(BB.prototype, "contentSize"), BB.prototype),
44505            Bl(BB.prototype, "anchorPoint", [ RB, IB ], Object.getOwnPropertyDescriptor(BB.prototype, "anchorPoint"), BB.prototype),
44506            DB = Bl(BB.prototype, "_contentSize", [ Yl ], {
44507              configurable: !0,
44508              enumerable: !0,
44509              writable: !0,
44510              initializer: function() {
44511                return new rs(100, 100);
44512              }
44513            }), PB = Bl(BB.prototype, "_anchorPoint", [ Yl ], {
44514              configurable: !0,
44515              enumerable: !0,
44516              writable: !0,
44517              initializer: function() {
44518                return new Qi(.5, .5);
44519              }
44520            }), BB)) || MB) || MB) || MB) || MB) || MB) || MB));
44521            IR.on(RR.EVENT_AFTER_UPDATE, jB._sortSiblings);
44522            IR.on(RR.EVENT_BEFORE_SCENE_LAUNCH, jB._cleanChangeMap);
44523            var XB, WB, YB, qB, KB, JB, ZB, QB, $B, tD, eD, iD, sD, nD, rD, oD, aD, lD, hD;
44524            he(Ls);
44525            let cD;
44526            !function(t) {
44527              t[t.ADD_COLOR = 0] = "ADD_COLOR";
44528              t[t.ADD_COLOR_AND_TEXTURE = 1] = "ADD_COLOR_AND_TEXTURE";
44529              t[t.GRAYSCALE = 2] = "GRAYSCALE";
44530              t[t.USE_ALPHA_SEPARATED = 3] = "USE_ALPHA_SEPARATED";
44531              t[t.USE_ALPHA_SEPARATED_AND_GRAY = 4] = "USE_ALPHA_SEPARATED_AND_GRAY";
44532            }(cD || (cD = t("InstanceMaterialType", {})));
44533            let uD = function(e) {
44534              return t({
44535                UIRenderer: e,
44536                RenderComponent: e,
44537                UIRenderable: e,
44538                Renderable2D: e
44539              }), e;
44540            }((XB = Ul("cc.UIRenderer"), WB = Gl(jB), YB = rh(), qB = Th(hm), KB = ph(), JB = lh(),
44541            ZB = ah(), QB = ph(), $B = lh(), tD = Th(hm), XB(eD = WB(eD = Ql(eD = (iD = (hD = lD = class t extends vS {
44542              constructor() {
44543                super();
44544                this._renderData = null;
44545                Ml(this, "_materials", sD, this);
44546                Ml(this, "_customMaterial", nD, this);
44547                Ml(this, "_srcBlendFactor", rD, this);
44548                Ml(this, "_dstBlendFactor", oD, this);
44549                Ml(this, "_color", aD, this);
44550                this._stencilStage = lB.DISABLED;
44551                this._assembler = null;
44552                this._postAssembler = null;
44553                this._renderDataFlag = !0;
44554                this._renderFlag = !0;
44555                this._renderEntity = void 0;
44556                this._instanceMaterialType = -1;
44557                this._srcBlendFactorCache = Ls.SRC_ALPHA;
44558                this._dstBlendFactorCache = Ls.ONE_MINUS_SRC_ALPHA;
44559                this._dirtyVersion = -1;
44560                this._internalId = -1;
44561                this._useVertexOpacity = !1;
44562                this._lastParent = null;
44563                this._renderEntity = this.createRenderEntity();
44564              }
44565              get sharedMaterials() {
44566                return this._materials;
44567              }
44568              set sharedMaterials(t) {
44569                for (let e = 0; e < t.length; e++) t[e] !== this._materials[e] && this.setMaterial(t[e], e);
44570                if (t.length < this._materials.length) {
44571                  for (let e = t.length; e < this._materials.length; e++) this.setMaterial(null, e);
44572                  this._materials.splice(t.length);
44573                }
44574              }
44575              get customMaterial() {
44576                return this._customMaterial;
44577              }
44578              set customMaterial(t) {
44579                this._customMaterial = t;
44580                this.updateMaterial();
44581              }
44582              get color() {
44583                return this._color;
44584              }
44585              set color(t) {
44586                if (!this._color.equals(t)) {
44587                  this._color.set(t);
44588                  this._updateColor();
44589                }
44590              }
44591              get renderData() {
44592                return this._renderData;
44593              }
44594              get useVertexOpacity() {
44595                return this._useVertexOpacity;
44596              }
44597              get stencilStage() {
44598                return this._stencilStage;
44599              }
44600              set stencilStage(t) {
44601                this._stencilStage = t;
44602                this._renderEntity.setStencilStage(t);
44603              }
44604              get batcher() {
44605                return IR.root.batcher2D;
44606              }
44607              get renderEntity() {
44608                w(this._renderEntity, "this._renderEntity should not be invalid");
44609                return this._renderEntity;
44610              }
44611              onLoad() {
44612                this._renderEntity.setNode(this.node);
44613              }
44614              __preload() {
44615                this.node._uiProps.uiComp = this;
44616                this._flushAssembler && this._flushAssembler();
44617              }
44618              onEnable() {
44619                this.node.on(ny.ANCHOR_CHANGED, this._nodeStateChange, this);
44620                this.node.on(ny.SIZE_CHANGED, this._nodeStateChange, this);
44621                this.node.on(ny.PARENT_CHANGED, this._colorDirty, this);
44622                this.updateMaterial();
44623                this._colorDirty();
44624                wR.addRenderer(this);
44625                this.markForUpdateRenderData();
44626              }
44627              onRestore() {
44628                this.updateMaterial();
44629                this.markForUpdateRenderData();
44630              }
44631              onDisable() {
44632                this.node.off(ny.ANCHOR_CHANGED, this._nodeStateChange, this);
44633                this.node.off(ny.SIZE_CHANGED, this._nodeStateChange, this);
44634                this.node.off(ny.PARENT_CHANGED, this._colorDirty, this);
44635                wR.removeRenderer(this);
44636                this._renderFlag = !1;
44637                this._renderEntity.enabled = !1;
44638              }
44639              onDestroy() {
44640                this._renderEntity.setNode(null);
44641                this.node._uiProps.uiComp === this && (this.node._uiProps.uiComp = null);
44642                this.destroyRenderData();
44643                if (this._materialInstances) for (let t = 0; t < this._materialInstances.length; t++) {
44644                  const e = this._materialInstances[t];
44645                  e && e.destroy();
44646                }
44647              }
44648              markForUpdateRenderData(t = !0) {
44649                if (t) {
44650                  const t = this.renderData;
44651                  t && (t.vertDirty = !0);
44652                  wR.markDirtyRenderer(this);
44653                }
44654              }
44655              requestRenderData(t = oB.COMP) {
44656                const e = SB.add();
44657                e.initRenderDrawInfo(this, t);
44658                this._renderData = e;
44659                return e;
44660              }
44661              destroyRenderData() {
44662                if (this.renderData) {
44663                  this.renderData.removeRenderDrawInfo(this);
44664                  SB.remove(this.renderData);
44665                  this._renderData = null;
44666                }
44667              }
44668              updateRenderer() {
44669                this._assembler && this._assembler.updateRenderData(this);
44670                this._renderFlag = this._canRender();
44671                this._renderEntity.enabled = this._renderFlag;
44672              }
44673              fillBuffers(t) {
44674                this._renderFlag && this._render(t);
44675              }
44676              postUpdateAssembler(t) {
44677                this._postAssembler && this._renderFlag && this._postRender(t);
44678              }
44679              _render(t) {}
44680              _postRender(t) {}
44681              _canRender() {
44682                w(this.isValid, "this component should not be invalid!");
44683                return null !== this.getMaterial(0) && this._enabled && this._color.a > 0;
44684              }
44685              _postCanRender() {}
44686              updateMaterial() {
44687                if (this._customMaterial) {
44688                  this.setMaterial(this._customMaterial, 0);
44689                  return;
44690                }
44691                const t = this._updateBuiltinMaterial();
44692                this.setMaterial(t, 0);
44693                this.stencilStage !== lB.ENTER_LEVEL && this.stencilStage !== lB.ENTER_LEVEL_INVERTED || this.getMaterialInstance(0).recompileShaders({
44694                  USE_ALPHA_TEST: !0
44695                });
44696                this._updateBlendFunc();
44697              }
44698              _updateColor() {
44699                this.node._uiProps.colorDirty = !0;
44700                this.setEntityColorDirty(!0);
44701                this.setEntityColor(this._color);
44702                this.setEntityOpacity(this.node._uiProps.localOpacity);
44703                if (this._assembler) {
44704                  this._assembler.updateColor(this);
44705                  this._renderFlag = this._canRender();
44706                  this.setEntityEnabled(this._renderFlag);
44707                }
44708              }
44709              static setEntityColorDirtyRecursively(e, i) {
44710                const s = e._uiProps.uiComp;
44711                s && s.color && (s._renderEntity.colorDirty = i);
44712                for (let s = 0; s < e.children.length; s++) t.setEntityColorDirtyRecursively(e.children[s], i);
44713              }
44714              setEntityColorDirty(e) {
44715                t.setEntityColorDirtyRecursively(this.node, e);
44716              }
44717              setEntityColor(t) {
44718                this._renderEntity.color = t;
44719              }
44720              setEntityOpacity(t) {
44721                this._renderEntity.localOpacity = t;
44722              }
44723              setEntityEnabled(t) {
44724                this._renderEntity.enabled = t;
44725              }
44726              _updateBlendFunc() {
44727                let t = this.getRenderMaterial(0).passes[0].blendState.targets[0];
44728                this._dstBlendFactorCache = t.blendDst;
44729                this._srcBlendFactorCache = t.blendSrc;
44730                if (this._dstBlendFactorCache !== this._dstBlendFactor || this._srcBlendFactorCache !== this._srcBlendFactor) {
44731                  t = this.getMaterialInstance(0).passes[0].blendState.targets[0];
44732                  t.blend = !0;
44733                  t.blendDstAlpha = Ls.ONE_MINUS_SRC_ALPHA;
44734                  t.blendDst = this._dstBlendFactor;
44735                  t.blendSrc = this._srcBlendFactor;
44736                  const e = this.getMaterialInstance(0).passes[0];
44737                  e.blendState.setTarget(0, t);
44738                  e._updatePassHash();
44739                  this._dstBlendFactorCache = this._dstBlendFactor;
44740                  this._srcBlendFactorCache = this._srcBlendFactor;
44741                }
44742              }
44743              _nodeStateChange(e) {
44744                this.renderData && this.markForUpdateRenderData();
44745                for (let e = 0; e < this.node.children.length; ++e) {
44746                  const i = this.node.children[e].getComponent(t);
44747                  i && i.markForUpdateRenderData();
44748                }
44749              }
44750              _colorDirty() {
44751                this.node._uiProps.colorDirty = !0;
44752                this.setEntityColorDirty(!0);
44753              }
44754              _onMaterialModified(t, e) {
44755                if (this.renderData) {
44756                  this.markForUpdateRenderData();
44757                  this.renderData.passDirty = !0;
44758                }
44759                super._onMaterialModified(t, e);
44760              }
44761              _updateBuiltinMaterial() {
44762                let t;
44763                switch (this._instanceMaterialType) {
44764                 case cD.ADD_COLOR:
44765                  t = xR.get("ui-base-material");
44766                  break;
44767
44768                 case cD.GRAYSCALE:
44769                  t = xR.get("ui-sprite-gray-material");
44770                  break;
44771
44772                 case cD.USE_ALPHA_SEPARATED:
44773                  t = xR.get("ui-sprite-alpha-sep-material");
44774                  break;
44775
44776                 case cD.USE_ALPHA_SEPARATED_AND_GRAY:
44777                  t = xR.get("ui-sprite-gray-alpha-sep-material");
44778                  break;
44779
44780                 default:
44781                  t = xR.get("ui-sprite-material");
44782                }
44783                return t;
44784              }
44785              setNodeDirty() {
44786                this.renderData && (this.renderData.nodeDirty = !0);
44787              }
44788              setTextureDirty() {
44789                this.renderData && (this.renderData.textureDirty = !0);
44790              }
44791              createRenderEntity() {
44792                return new fB(uB.STATIC);
44793              }
44794            }, lD.BlendState = Ls, lD.Assembler = null, lD.PostAssembler = null, hD), Bl(iD.prototype, "sharedMaterials", [ vh, YB ], Object.getOwnPropertyDescriptor(iD.prototype, "sharedMaterials"), iD.prototype),
44795            Bl(iD.prototype, "customMaterial", [ qB, KB, JB, ZB, gh ], Object.getOwnPropertyDescriptor(iD.prototype, "customMaterial"), iD.prototype),
44796            Bl(iD.prototype, "color", [ QB, $B ], Object.getOwnPropertyDescriptor(iD.prototype, "color"), iD.prototype),
44797            sD = Bl(iD.prototype, "_materials", [ vh ], {
44798              configurable: !0,
44799              enumerable: !0,
44800              writable: !0,
44801              initializer: function() {
44802                return [];
44803              }
44804            }), nD = Bl(iD.prototype, "_customMaterial", [ tD ], {
44805              configurable: !0,
44806              enumerable: !0,
44807              writable: !0,
44808              initializer: function() {
44809                return null;
44810              }
44811            }), rD = Bl(iD.prototype, "_srcBlendFactor", [ Yl ], {
44812              configurable: !0,
44813              enumerable: !0,
44814              writable: !0,
44815              initializer: function() {
44816                return Ls.SRC_ALPHA;
44817              }
44818            }), oD = Bl(iD.prototype, "_dstBlendFactor", [ Yl ], {
44819              configurable: !0,
44820              enumerable: !0,
44821              writable: !0,
44822              initializer: function() {
44823                return Ls.ONE_MINUS_SRC_ALPHA;
44824              }
44825            }), aD = Bl(iD.prototype, "_color", [ Yl ], {
44826              configurable: !0,
44827              enumerable: !0,
44828              writable: !0,
44829              initializer: function() {
44830                return Bi.WHITE.clone();
44831              }
44832            }), iD)) || eD) || eD) || eD));
44833            m.internal.UIRenderer = uD;
44834            var _D, dD, pD, mD, fD, gD, yD, bD, SD, AD, TD, vD, ED, CD, xD, wD, RD, ID, MD, BD, DD, PD, OD, ND, LD, FD, VD, kD, UD, GD, zD, HD, jD, XD, WD, YD, qD, KD, JD, ZD, QD, $D, tP, eP, iP, sP, nP, rP, oP, aP, lP, hP, cP, uP, _P, dP, pP, mP, fP, gP, yP, bP, SP, AP, TP, vP;
44835            const EP = Bi.WHITE.clone();
44836            let CP;
44837            !function(t) {
44838              t[t.LEFT = 0] = "LEFT";
44839              t[t.CENTER = 1] = "CENTER";
44840              t[t.RIGHT = 2] = "RIGHT";
44841            }(CP || (CP = t("HorizontalTextAlignment", {})));
44842            he(CP);
44843            let xP;
44844            !function(t) {
44845              t[t.TOP = 0] = "TOP";
44846              t[t.CENTER = 1] = "CENTER";
44847              t[t.BOTTOM = 2] = "BOTTOM";
44848            }(xP || (xP = t("VerticalTextAlignment", {})));
44849            he(xP);
44850            let wP;
44851            !function(t) {
44852              t[t.NONE = 0] = "NONE";
44853              t[t.CLAMP = 1] = "CLAMP";
44854              t[t.SHRINK = 2] = "SHRINK";
44855              t[t.RESIZE_HEIGHT = 3] = "RESIZE_HEIGHT";
44856            }(wP || (wP = t("Overflow", {})));
44857            he(wP);
44858            let RP;
44859            !function(t) {
44860              t[t.NONE = 0] = "NONE";
44861              t[t.BITMAP = 1] = "BITMAP";
44862              t[t.CHAR = 2] = "CHAR";
44863            }(RP || (RP = t("CacheMode", {})));
44864            he(RP);
44865            let IP = function(e) {
44866              return t({
44867                Label: e,
44868                LabelComponent: e
44869              }), e;
44870            }((_D = Ul("cc.Label"), dD = sh(), pD = zl(110), mD = $l(), fD = ph(), gD = lh(),
44871            yD = Th(CP), bD = ph(), SD = lh(), AD = Th(xP), TD = ph(), vD = lh(), ED = ph(),
44872            CD = lh(), xD = ph(), wD = rh(), RD = lh(), ID = ph(), MD = lh(), BD = rh(), DD = ph(),
44873            PD = lh(), OD = Th(wP), ND = ph(), LD = lh(), FD = ph(), VD = lh(), kD = Th(qI),
44874            UD = ph(), GD = rh(), zD = lh(), HD = ph(), jD = lh(), XD = Th(RP), WD = ph(), YD = lh(),
44875            qD = ph(), KD = lh(), JD = ph(), ZD = lh(), QD = ph(), $D = lh(), tP = rh(), eP = ph(),
44876            iP = lh(), _D(sP = dD(sP = pD(sP = mD(sP = (nP = (vP = TP = class t extends uD {
44877              get string() {
44878                return this._string;
44879              }
44880              set string(t) {
44881                t = null == t ? "" : t.toString();
44882                if (this._string !== t) {
44883                  this._string = t;
44884                  this.markForUpdateRenderData();
44885                }
44886              }
44887              get horizontalAlign() {
44888                return this._horizontalAlign;
44889              }
44890              set horizontalAlign(t) {
44891                if (this._horizontalAlign !== t) {
44892                  this._horizontalAlign = t;
44893                  this.markForUpdateRenderData();
44894                }
44895              }
44896              get verticalAlign() {
44897                return this._verticalAlign;
44898              }
44899              set verticalAlign(t) {
44900                if (this._verticalAlign !== t) {
44901                  this._verticalAlign = t;
44902                  this.markForUpdateRenderData();
44903                }
44904              }
44905              get actualFontSize() {
44906                return this._actualFontSize;
44907              }
44908              set actualFontSize(t) {
44909                this._actualFontSize = t;
44910              }
44911              get fontSize() {
44912                return this._fontSize;
44913              }
44914              set fontSize(t) {
44915                if (this._fontSize !== t) {
44916                  this._fontSize = t;
44917                  this.markForUpdateRenderData();
44918                }
44919              }
44920              get fontFamily() {
44921                return this._fontFamily;
44922              }
44923              set fontFamily(t) {
44924                if (this._fontFamily !== t) {
44925                  this._fontFamily = t;
44926                  this.markForUpdateRenderData();
44927                }
44928              }
44929              get lineHeight() {
44930                return this._lineHeight;
44931              }
44932              set lineHeight(t) {
44933                if (this._lineHeight !== t) {
44934                  this._lineHeight = t;
44935                  this.markForUpdateRenderData();
44936                }
44937              }
44938              get spacingX() {
44939                return this._spacingX;
44940              }
44941              set spacingX(t) {
44942                if (this._spacingX !== t) {
44943                  this._spacingX = t;
44944                  this.markForUpdateRenderData();
44945                }
44946              }
44947              get overflow() {
44948                return this._overflow;
44949              }
44950              set overflow(t) {
44951                if (this._overflow !== t) {
44952                  this._overflow = t;
44953                  this.markForUpdateRenderData();
44954                }
44955              }
44956              get enableWrapText() {
44957                return this._enableWrapText;
44958              }
44959              set enableWrapText(t) {
44960                if (this._enableWrapText !== t) {
44961                  this._enableWrapText = t;
44962                  this.markForUpdateRenderData();
44963                }
44964              }
44965              get font() {
44966                return this._font;
44967              }
44968              set font(t) {
44969                if (this._font !== t) {
44970                  this._isSystemFontUsed = !t;
44971                  this._font = t;
44972                  this.destroyRenderData();
44973                  this._fontAtlas = null;
44974                  this.updateRenderData(!0);
44975                }
44976              }
44977              get useSystemFont() {
44978                return this._isSystemFontUsed;
44979              }
44980              set useSystemFont(t) {
44981                if (this._isSystemFontUsed !== t) {
44982                  this.destroyRenderData();
44983                  this._isSystemFontUsed = !!t;
44984                  t && (this.font = null);
44985                  this._flushAssembler();
44986                  this.markForUpdateRenderData();
44987                }
44988              }
44989              get cacheMode() {
44990                return this._cacheMode;
44991              }
44992              set cacheMode(t) {
44993                if (this._cacheMode !== t) {
44994                  this._cacheMode !== RP.BITMAP || this._font instanceof uM || !this._ttfSpriteFrame || this._ttfSpriteFrame._resetDynamicAtlasFrame();
44995                  this._cacheMode === RP.CHAR && (this._ttfSpriteFrame = null);
44996                  this._cacheMode = t;
44997                  this.updateRenderData(!0);
44998                }
44999              }
45000              get isBold() {
45001                return this._isBold;
45002              }
45003              set isBold(t) {
45004                if (this._isBold !== t) {
45005                  this._isBold = t;
45006                  this.markForUpdateRenderData();
45007                }
45008              }
45009              get isItalic() {
45010                return this._isItalic;
45011              }
45012              set isItalic(t) {
45013                if (this._isItalic !== t) {
45014                  this._isItalic = t;
45015                  this.markForUpdateRenderData();
45016                }
45017              }
45018              get isUnderline() {
45019                return this._isUnderline;
45020              }
45021              set isUnderline(t) {
45022                if (this._isUnderline !== t) {
45023                  this._isUnderline = t;
45024                  this.markForUpdateRenderData();
45025                }
45026              }
45027              get underlineHeight() {
45028                return this._underlineHeight;
45029              }
45030              set underlineHeight(t) {
45031                if (this._underlineHeight !== t) {
45032                  this._underlineHeight = t;
45033                  this.markForUpdateRenderData();
45034                }
45035              }
45036              get spriteFrame() {
45037                return this._texture;
45038              }
45039              get ttfSpriteFrame() {
45040                return this._ttfSpriteFrame;
45041              }
45042              get assemblerData() {
45043                return this._assemblerData;
45044              }
45045              get fontAtlas() {
45046                return this._fontAtlas;
45047              }
45048              set fontAtlas(t) {
45049                this._fontAtlas = t;
45050              }
45051              get _bmFontOriginalSize() {
45052                return this._font instanceof uM ? this._font.fontSize : -1;
45053              }
45054              get contentWidth() {
45055                return this._contentWidth;
45056              }
45057              set contentWidth(t) {
45058                this._contentWidth = t;
45059              }
45060              constructor() {
45061                super();
45062                Ml(this, "_string", rP, this);
45063                Ml(this, "_horizontalAlign", oP, this);
45064                Ml(this, "_verticalAlign", aP, this);
45065                Ml(this, "_actualFontSize", lP, this);
45066                Ml(this, "_fontSize", hP, this);
45067                Ml(this, "_fontFamily", cP, this);
45068                Ml(this, "_lineHeight", uP, this);
45069                Ml(this, "_overflow", _P, this);
45070                Ml(this, "_enableWrapText", dP, this);
45071                Ml(this, "_font", pP, this);
45072                Ml(this, "_isSystemFontUsed", mP, this);
45073                Ml(this, "_spacingX", fP, this);
45074                Ml(this, "_isItalic", gP, this);
45075                Ml(this, "_isBold", yP, this);
45076                Ml(this, "_isUnderline", bP, this);
45077                Ml(this, "_underlineHeight", SP, this);
45078                Ml(this, "_cacheMode", AP, this);
45079                this._N$file = null;
45080                this._texture = null;
45081                this._ttfSpriteFrame = null;
45082                this._userDefinedFont = null;
45083                this._assemblerData = null;
45084                this._fontAtlas = null;
45085                this._letterTexture = null;
45086                this._contentWidth = 0;
45087                this._ttfSpriteFrame = null;
45088              }
45089              onEnable() {
45090                super.onEnable();
45091                this._font || this._isSystemFontUsed || (this.useSystemFont = !0);
45092                this._isSystemFontUsed && !this._fontFamily && (this.fontFamily = "Arial");
45093                this._applyFontTexture();
45094              }
45095              onDestroy() {
45096                this._assembler && this._assembler.resetAssemblerData && this._assembler.resetAssemblerData(this._assemblerData);
45097                this._assemblerData = null;
45098                if (this._ttfSpriteFrame) {
45099                  this._ttfSpriteFrame._resetDynamicAtlasFrame();
45100                  const t = this._ttfSpriteFrame.texture;
45101                  this._ttfSpriteFrame.destroy();
45102                  if (t) {
45103                    const e = t;
45104                    e.image && e.image.destroy();
45105                    t.destroy();
45106                  }
45107                  this._ttfSpriteFrame = null;
45108                }
45109                this._letterTexture = null;
45110                super.onDestroy();
45111              }
45112              updateRenderData(t = !1) {
45113                if (t) {
45114                  this._flushAssembler();
45115                  this.renderData && (this.renderData.vertDirty = !0);
45116                  this._applyFontTexture();
45117                }
45118                this._assembler && this._assembler.updateRenderData(this);
45119              }
45120              _render(t) {
45121                t.commitComp(this, this.renderData, this._texture, this._assembler, null);
45122              }
45123              _updateColor() {
45124                super._updateColor();
45125                this.markForUpdateRenderData();
45126              }
45127              setEntityColor(t) {
45128                if (this._font instanceof uM) this._renderEntity.color = t; else {
45129                  EP.set(255, 255, 255, t.a);
45130                  this._renderEntity.color = EP;
45131                }
45132              }
45133              _canRender() {
45134                if (!super._canRender() || !this._string) return !1;
45135                const t = this._font;
45136                if (t && t instanceof uM) {
45137                  const e = t.spriteFrame;
45138                  if (!e || !e.texture) return !1;
45139                }
45140                return !0;
45141              }
45142              _flushAssembler() {
45143                const e = t.Assembler.getAssembler(this);
45144                if (this._assembler !== e) {
45145                  this.destroyRenderData();
45146                  this._assembler = e;
45147                }
45148                if (!this.renderData && this._assembler && this._assembler.createData) {
45149                  this._renderData = this._assembler.createData(this);
45150                  this.renderData.material = this.material;
45151                  this._updateColor();
45152                }
45153              }
45154              _applyFontTexture() {
45155                this.markForUpdateRenderData();
45156                const t = this._font;
45157                if (t instanceof uM) {
45158                  const e = t.spriteFrame;
45159                  if (e && e.texture) {
45160                    this._texture = e;
45161                    this.renderData && (this.renderData.textureDirty = !0);
45162                    this.changeMaterialForDefine();
45163                    this._assembler && this._assembler.updateRenderData(this);
45164                  }
45165                } else {
45166                  if (this.cacheMode === RP.CHAR) {
45167                    this._letterTexture = this._assembler.getAssemblerData();
45168                    this._texture = this._letterTexture;
45169                  } else if (!this._ttfSpriteFrame) {
45170                    this._ttfSpriteFrame = new GI;
45171                    this._assemblerData = this._assembler.getAssemblerData();
45172                    const t = new IC(this._assemblerData.canvas);
45173                    const e = new LC;
45174                    e.image = t;
45175                    this._ttfSpriteFrame.texture = e;
45176                  }
45177                  this.cacheMode !== RP.CHAR && (this._texture = this._ttfSpriteFrame);
45178                  this.changeMaterialForDefine();
45179                }
45180              }
45181              changeMaterialForDefine() {
45182                if (!this._texture) return;
45183                let t = !1;
45184                if (this.cacheMode !== RP.CHAR) {
45185                  const e = this._texture.texture;
45186                  if (e instanceof tm) {
45187                    const i = e.getPixelFormat();
45188                    t = i === Jp.RGBA_ETC1 || i === Jp.RGB_A_PVRTC_4BPPV1 || i === Jp.RGB_A_PVRTC_2BPPV1;
45189                  }
45190                }
45191                this._instanceMaterialType = t ? cD.USE_ALPHA_SEPARATED : cD.ADD_COLOR_AND_TEXTURE;
45192                this.updateMaterial();
45193              }
45194              _updateBlendFunc() {
45195                super._updateBlendFunc();
45196              }
45197            }, TP.HorizontalAlign = CP, TP.VerticalAlign = xP, TP.Overflow = wP, TP.CacheMode = RP,
45198            TP._canvasPool = DM.getInstance(), vP), Bl(nP.prototype, "string", [ fD, gD, fh ], Object.getOwnPropertyDescriptor(nP.prototype, "string"), nP.prototype),
45199            Bl(nP.prototype, "horizontalAlign", [ yD, bD, SD ], Object.getOwnPropertyDescriptor(nP.prototype, "horizontalAlign"), nP.prototype),
45200            Bl(nP.prototype, "verticalAlign", [ AD, TD, vD ], Object.getOwnPropertyDescriptor(nP.prototype, "verticalAlign"), nP.prototype),
45201            Bl(nP.prototype, "fontSize", [ ED, CD ], Object.getOwnPropertyDescriptor(nP.prototype, "fontSize"), nP.prototype),
45202            Bl(nP.prototype, "fontFamily", [ xD, wD, RD ], Object.getOwnPropertyDescriptor(nP.prototype, "fontFamily"), nP.prototype),
45203            Bl(nP.prototype, "lineHeight", [ ID, MD ], Object.getOwnPropertyDescriptor(nP.prototype, "lineHeight"), nP.prototype),
45204            Bl(nP.prototype, "spacingX", [ BD, DD, PD ], Object.getOwnPropertyDescriptor(nP.prototype, "spacingX"), nP.prototype),
45205            Bl(nP.prototype, "overflow", [ OD, ND, LD ], Object.getOwnPropertyDescriptor(nP.prototype, "overflow"), nP.prototype),
45206            Bl(nP.prototype, "enableWrapText", [ FD, VD ], Object.getOwnPropertyDescriptor(nP.prototype, "enableWrapText"), nP.prototype),
45207            Bl(nP.prototype, "font", [ kD, UD, GD, zD ], Object.getOwnPropertyDescriptor(nP.prototype, "font"), nP.prototype),
45208            Bl(nP.prototype, "useSystemFont", [ HD, jD ], Object.getOwnPropertyDescriptor(nP.prototype, "useSystemFont"), nP.prototype),
45209            Bl(nP.prototype, "cacheMode", [ XD, WD, YD ], Object.getOwnPropertyDescriptor(nP.prototype, "cacheMode"), nP.prototype),
45210            Bl(nP.prototype, "isBold", [ qD, KD ], Object.getOwnPropertyDescriptor(nP.prototype, "isBold"), nP.prototype),
45211            Bl(nP.prototype, "isItalic", [ JD, ZD ], Object.getOwnPropertyDescriptor(nP.prototype, "isItalic"), nP.prototype),
45212            Bl(nP.prototype, "isUnderline", [ QD, $D ], Object.getOwnPropertyDescriptor(nP.prototype, "isUnderline"), nP.prototype),
45213            Bl(nP.prototype, "underlineHeight", [ tP, nh, eP, iP ], Object.getOwnPropertyDescriptor(nP.prototype, "underlineHeight"), nP.prototype),
45214            rP = Bl(nP.prototype, "_string", [ Yl ], {
45215              configurable: !0,
45216              enumerable: !0,
45217              writable: !0,
45218              initializer: function() {
45219                return "label";
45220              }
45221            }), oP = Bl(nP.prototype, "_horizontalAlign", [ Yl ], {
45222              configurable: !0,
45223              enumerable: !0,
45224              writable: !0,
45225              initializer: function() {
45226                return CP.CENTER;
45227              }
45228            }), aP = Bl(nP.prototype, "_verticalAlign", [ Yl ], {
45229              configurable: !0,
45230              enumerable: !0,
45231              writable: !0,
45232              initializer: function() {
45233                return xP.CENTER;
45234              }
45235            }), lP = Bl(nP.prototype, "_actualFontSize", [ Yl ], {
45236              configurable: !0,
45237              enumerable: !0,
45238              writable: !0,
45239              initializer: function() {
45240                return 0;
45241              }
45242            }), hP = Bl(nP.prototype, "_fontSize", [ Yl ], {
45243              configurable: !0,
45244              enumerable: !0,
45245              writable: !0,
45246              initializer: function() {
45247                return 40;
45248              }
45249            }), cP = Bl(nP.prototype, "_fontFamily", [ Yl ], {
45250              configurable: !0,
45251              enumerable: !0,
45252              writable: !0,
45253              initializer: function() {
45254                return "Arial";
45255              }
45256            }), uP = Bl(nP.prototype, "_lineHeight", [ Yl ], {
45257              configurable: !0,
45258              enumerable: !0,
45259              writable: !0,
45260              initializer: function() {
45261                return 40;
45262              }
45263            }), _P = Bl(nP.prototype, "_overflow", [ Yl ], {
45264              configurable: !0,
45265              enumerable: !0,
45266              writable: !0,
45267              initializer: function() {
45268                return wP.NONE;
45269              }
45270            }), dP = Bl(nP.prototype, "_enableWrapText", [ Yl ], {
45271              configurable: !0,
45272              enumerable: !0,
45273              writable: !0,
45274              initializer: function() {
45275                return !0;
45276              }
45277            }), pP = Bl(nP.prototype, "_font", [ Yl ], {
45278              configurable: !0,
45279              enumerable: !0,
45280              writable: !0,
45281              initializer: function() {
45282                return null;
45283              }
45284            }), mP = Bl(nP.prototype, "_isSystemFontUsed", [ Yl ], {
45285              configurable: !0,
45286              enumerable: !0,
45287              writable: !0,
45288              initializer: function() {
45289                return !0;
45290              }
45291            }), fP = Bl(nP.prototype, "_spacingX", [ Yl ], {
45292              configurable: !0,
45293              enumerable: !0,
45294              writable: !0,
45295              initializer: function() {
45296                return 0;
45297              }
45298            }), gP = Bl(nP.prototype, "_isItalic", [ Yl ], {
45299              configurable: !0,
45300              enumerable: !0,
45301              writable: !0,
45302              initializer: function() {
45303                return !1;
45304              }
45305            }), yP = Bl(nP.prototype, "_isBold", [ Yl ], {
45306              configurable: !0,
45307              enumerable: !0,
45308              writable: !0,
45309              initializer: function() {
45310                return !1;
45311              }
45312            }), bP = Bl(nP.prototype, "_isUnderline", [ Yl ], {
45313              configurable: !0,
45314              enumerable: !0,
45315              writable: !0,
45316              initializer: function() {
45317                return !1;
45318              }
45319            }), SP = Bl(nP.prototype, "_underlineHeight", [ Yl ], {
45320              configurable: !0,
45321              enumerable: !0,
45322              writable: !0,
45323              initializer: function() {
45324                return 2;
45325              }
45326            }), AP = Bl(nP.prototype, "_cacheMode", [ Yl ], {
45327              configurable: !0,
45328              enumerable: !0,
45329              writable: !0,
45330              initializer: function() {
45331                return RP.NONE;
45332              }
45333            }), nP)) || sP) || sP) || sP) || sP));
45334            m.Label = IP;
45335            let MP = 0;
45336            const BP = {};
45337            var DP = {
45338              addStage(t) {
45339                if (void 0 !== BP[t]) return;
45340                const e = 1 << MP;
45341                BP[t] = e;
45342                MP += 1;
45343              },
45344              stageID(t) {
45345                const e = BP[t];
45346                return void 0 === e ? -1 : e;
45347              },
45348              stageIDs(t) {
45349                let e = 0;
45350                for (const i of t) {
45351                  const t = BP[i];
45352                  void 0 !== t && (e |= t);
45353                }
45354                return e;
45355              }
45356            };
45357            let PP;
45358            !function(t) {
45359              t[t.OPAQUE = 0] = "OPAQUE";
45360              t[t.TRANSPARENT = 1] = "TRANSPARENT";
45361              t[t.OVERLAY = 2] = "OVERLAY";
45362            }(PP || (PP = {}));
45363            let OP;
45364            !function(t) {
45365              t[t.DEFAULT = 1] = "DEFAULT";
45366              t[t.FORWARD = 2] = "FORWARD";
45367              t[t.SHADOWCAST = 4] = "SHADOWCAST";
45368            }(OP || (OP = {}));
45369            const NP = 4227858432;
45370            const LP = 66060288;
45371            const FP = 1044480;
45372            const VP = {
45373              [As.UNKNOWN]: (t, e, i = 0) => console.warn("illegal uniform handle"),
45374              [As.INT]: (t, e, i = 0) => t[i],
45375              [As.INT2]: (t, e, i = 0) => Qi.fromArray(e, t, i),
45376              [As.INT3]: (t, e, i = 0) => Pi.fromArray(e, t, i),
45377              [As.INT4]: (t, e, i = 0) => is.fromArray(e, t, i),
45378              [As.FLOAT]: (t, e, i = 0) => t[i],
45379              [As.FLOAT2]: (t, e, i = 0) => Qi.fromArray(e, t, i),
45380              [As.FLOAT3]: (t, e, i = 0) => Pi.fromArray(e, t, i),
45381              [As.FLOAT4]: (t, e, i = 0) => is.fromArray(e, t, i),
45382              [As.MAT3]: (t, e, i = 0) => Fi.fromArray(e, t, i),
45383              [As.MAT4]: (t, e, i = 0) => qi.fromArray(e, t, i)
45384            };
45385            const kP = {
45386              [As.UNKNOWN]: (t, e, i = 0) => console.warn("illegal uniform handle"),
45387              [As.INT]: (t, e, i = 0) => t[i] = e,
45388              [As.INT2]: (t, e, i = 0) => Qi.toArray(t, e, i),
45389              [As.INT3]: (t, e, i = 0) => Pi.toArray(t, e, i),
45390              [As.INT4]: (t, e, i = 0) => is.toArray(t, e, i),
45391              [As.FLOAT]: (t, e, i = 0) => t[i] = e,
45392              [As.FLOAT2]: (t, e, i = 0) => Qi.toArray(t, e, i),
45393              [As.FLOAT3]: (t, e, i = 0) => Pi.toArray(t, e, i),
45394              [As.FLOAT4]: (t, e, i = 0) => is.toArray(t, e, i),
45395              [As.MAT3]: (t, e, i = 0) => Fi.toArray(t, e, i),
45396              [As.MAT4]: (t, e, i = 0) => qi.toArray(t, e, i)
45397            };
45398            const UP = [ Object.freeze([ 0 ]), Object.freeze([ 0, 0 ]), Object.freeze([ 0, 0, 0, 0 ]), Object.freeze([ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]) ];
45399            function GP(t) {
45400              switch (t) {
45401               case As.BOOL:
45402               case As.INT:
45403               case As.UINT:
45404               case As.FLOAT:
45405                return UP[0];
45406
45407               case As.BOOL2:
45408               case As.INT2:
45409               case As.UINT2:
45410               case As.FLOAT2:
45411                return UP[1];
45412
45413               case As.BOOL4:
45414               case As.INT4:
45415               case As.UINT4:
45416               case As.FLOAT4:
45417                return UP[2];
45418
45419               case As.MAT4:
45420                return UP[3];
45421
45422               case As.SAMPLER2D:
45423                return "default-texture";
45424
45425               case As.SAMPLER_CUBE:
45426                return "default-cube-texture";
45427
45428               case As.SAMPLER2D_ARRAY:
45429                return "default-array-texture";
45430
45431               case As.SAMPLER3D:
45432                return "default-3d-texture";
45433              }
45434              return UP[0];
45435            }
45436            function zP(t) {
45437              switch (t) {
45438               case As.SAMPLER2D:
45439                return "-texture";
45440
45441               case As.SAMPLER_CUBE:
45442                return "-cube-texture";
45443
45444               case As.SAMPLER2D_ARRAY:
45445                return "-array-texture";
45446
45447               case As.SAMPLER3D:
45448                return "-3d-texture";
45449
45450               default:
45451                return "-unknown";
45452              }
45453            }
45454            function HP(t, e) {
45455              const i = Object.entries(e);
45456              let s = !1;
45457              for (let e = 0; e < i.length; e++) if (t[i[e][0]] !== i[e][1]) {
45458                t[i[e][0]] = i[e][1];
45459                s = !0;
45460              }
45461              return s;
45462            }
45463            let jP;
45464            !function(t) {
45465              t[t.NONE = 0] = "NONE";
45466              t[t.INSTANCING = 1] = "INSTANCING";
45467              t[t.VB_MERGING = 2] = "VB_MERGING";
45468            }(jP || (jP = {}));
45469            const XP = jsb.Pass;
45470            const WP = jsb.ProgramLib.getInstance();
45471            m.programLib = WP;
45472            function YP(t) {
45473              --t;
45474              t |= t >> 16;
45475              t |= t >> 8;
45476              t |= t >> 4;
45477              t |= t >> 2;
45478              t |= t >> 1;
45479              return ++t;
45480            }
45481            function qP(t, e) {
45482              return Math.ceil(t / e) * e;
45483            }
45484            class KP {
45485              constructor(t) {
45486                this._device = void 0;
45487                this._format = bs.UNKNOWN;
45488                this._formatSize = 0;
45489                this._chunks = [];
45490                this._chunkCount = 0;
45491                this._handles = [];
45492                this._region0 = new mn;
45493                this._region1 = new mn;
45494                this._region2 = new mn;
45495                this._roundUpFn = null;
45496                this._bufferViewCtor = Uint8Array;
45497                this._channels = 4;
45498                this._alignment = 1;
45499                this._device = t;
45500              }
45501              initialize(t) {
45502                const e = ur[t.format];
45503                this._format = t.format;
45504                this._formatSize = e.size;
45505                this._channels = e.count;
45506                this._bufferViewCtor = Ar(e);
45507                this._roundUpFn = t.roundUpFn || null;
45508                this._alignment = t.alignment || 1;
45509                t.inOrderFree && (this.alloc = this._McDonaldAlloc);
45510              }
45511              destroy() {
45512                for (let t = 0; t < this._chunkCount; ++t) {
45513                  this._chunks[t].texture.destroy();
45514                }
45515                this._chunks.length = 0;
45516                this._handles.length = 0;
45517              }
45518              alloc(t, e) {
45519                t = qP(t, this._alignment);
45520                let i = -1;
45521                let s = -1;
45522                if (void 0 !== e) {
45523                  i = e;
45524                  s = this._findAvailableSpace(t, i);
45525                }
45526                if (s < 0) for (let e = 0; e < this._chunkCount; ++e) {
45527                  i = e;
45528                  s = this._findAvailableSpace(t, i);
45529                  if (s >= 0) break;
45530                }
45531                if (s >= 0) {
45532                  const e = this._chunks[i];
45533                  e.start += t;
45534                  const n = {
45535                    chunkIdx: i,
45536                    start: s,
45537                    end: s + t,
45538                    texture: e.texture
45539                  };
45540                  this._handles.push(n);
45541                  return n;
45542                }
45543                const n = Math.sqrt(t / this._formatSize);
45544                const r = this._roundUpFn && this._roundUpFn(n, this._formatSize) || Math.max(1024, YP(n));
45545                const o = this._chunks[this.createChunk(r)];
45546                o.start += t;
45547                const a = {
45548                  chunkIdx: this._chunkCount - 1,
45549                  start: 0,
45550                  end: t,
45551                  texture: o.texture
45552                };
45553                this._handles.push(a);
45554                return a;
45555              }
45556              free(t) {
45557                for (let e = 0; e < this._handles.length; ++e) if (this._handles[e] === t) {
45558                  this._chunks[t.chunkIdx].end = t.end;
45559                  this._handles.splice(e, 1);
45560                  return;
45561                }
45562              }
45563              createChunk(t) {
45564                const e = t * t * this._formatSize;
45565                R(`TextureBufferPool: Allocate chunk ${this._chunkCount}, size: ${e}, format: ${this._format}`);
45566                const i = {
45567                  texture: this._device.createTexture(new xn(xs.TEX2D, ws.SAMPLED | ws.TRANSFER_DST, this._format, t, t)),
45568                  size: e,
45569                  start: 0,
45570                  end: e
45571                };
45572                this._chunks[this._chunkCount] = i;
45573                return this._chunkCount++;
45574              }
45575              update(t, e) {
45576                const i = [];
45577                const s = [];
45578                const n = t.start / this._formatSize;
45579                let r = e.byteLength / this._formatSize;
45580                let o = n % t.texture.width;
45581                let a = Math.floor(n / t.texture.width);
45582                let l = Math.min(t.texture.width - o, r);
45583                let h = 0;
45584                if (o > 0) {
45585                  this._region0.texOffset.x = o;
45586                  this._region0.texOffset.y = a;
45587                  this._region0.texExtent.width = l;
45588                  this._region0.texExtent.height = 1;
45589                  i.push(new this._bufferViewCtor(e, h * this._formatSize, l * this._channels));
45590                  s.push(this._region0);
45591                  o = 0;
45592                  a += 1;
45593                  r -= l;
45594                  h += l;
45595                }
45596                if (r > 0) {
45597                  this._region1.texOffset.x = o;
45598                  this._region1.texOffset.y = a;
45599                  if (r > t.texture.width) {
45600                    this._region1.texExtent.width = t.texture.width;
45601                    this._region1.texExtent.height = Math.floor(r / t.texture.width);
45602                    l = this._region1.texExtent.width * this._region1.texExtent.height;
45603                  } else {
45604                    l = r;
45605                    this._region1.texExtent.width = l;
45606                    this._region1.texExtent.height = 1;
45607                  }
45608                  i.push(new this._bufferViewCtor(e, h * this._formatSize, l * this._channels));
45609                  s.push(this._region1);
45610                  o = 0;
45611                  a += this._region1.texExtent.height;
45612                  r -= l;
45613                  h += l;
45614                }
45615                if (r > 0) {
45616                  this._region2.texOffset.x = o;
45617                  this._region2.texOffset.y = a;
45618                  this._region2.texExtent.width = r;
45619                  this._region2.texExtent.height = 1;
45620                  i.push(new this._bufferViewCtor(e, h * this._formatSize, r * this._channels));
45621                  s.push(this._region2);
45622                }
45623                this._device.copyBuffersToTexture(i, t.texture, s);
45624              }
45625              _findAvailableSpace(t, e) {
45626                const i = this._chunks[e];
45627                let s = !1;
45628                let n = i.start;
45629                if (n + t <= i.size) s = !0; else {
45630                  n = 0;
45631                  const r = this._handles.filter((t => t.chunkIdx === e)).sort(((t, e) => t.start - e.start));
45632                  for (let e = 0; e < r.length; e++) {
45633                    const i = r[e];
45634                    if (n + t <= i.start) {
45635                      s = !0;
45636                      break;
45637                    }
45638                    n = i.end;
45639                  }
45640                  !s && n + t <= i.size && (s = !0);
45641                }
45642                return s ? n : -1;
45643              }
45644              _McDonaldAlloc(t) {
45645                t = qP(t, this._alignment);
45646                for (let e = 0; e < this._chunkCount; ++e) {
45647                  const i = this._chunks[e];
45648                  let s = !1;
45649                  let n = i.start;
45650                  if (n + t <= i.end) s = !0; else if (n > i.end) {
45651                    if (n + t <= i.size) s = !0; else if (t <= i.end) {
45652                      i.start = n = 0;
45653                      s = !0;
45654                    }
45655                  } else if (n === i.end) {
45656                    i.start = n = 0;
45657                    i.end = i.size;
45658                    t <= i.end && (s = !0);
45659                  }
45660                  if (s) {
45661                    i.start += t;
45662                    const s = {
45663                      chunkIdx: e,
45664                      start: n,
45665                      end: n + t,
45666                      texture: i.texture
45667                    };
45668                    this._handles.push(s);
45669                    return s;
45670                  }
45671                }
45672                const e = Math.sqrt(t / this._formatSize);
45673                const i = this._roundUpFn && this._roundUpFn(e, this._formatSize) || Math.max(1024, YP(e));
45674                const s = this._chunks[this.createChunk(i)];
45675                s.start += t;
45676                const n = {
45677                  chunkIdx: this._chunkCount,
45678                  start: 0,
45679                  end: t,
45680                  texture: s.texture
45681                };
45682                this._handles.push(n);
45683                return n;
45684              }
45685            }
45686            const JP = jsb.NativeBufferPool;
45687            jsb.NativeObjectPool;
45688            jsb.NativeBufferAllocator;
45689            const ZP = (t, e) => {
45690              for (let i = 0; i < t.length; ++i) if (t[i] === e) return !0;
45691              return !1;
45692            };
45693            var QP;
45694            !function(t) {
45695              t[t.UINT32 = 0] = "UINT32";
45696              t[t.FLOAT32 = 1] = "FLOAT32";
45697              t[t.NEVER = 2] = "NEVER";
45698            }(QP || (QP = {}));
45699            class $P {
45700              constructor(t, e, i, s, n = 8) {
45701                this._dataType = void 0;
45702                this._dataMembers = void 0;
45703                this._elementCount = void 0;
45704                this._entryBits = void 0;
45705                this._stride = void 0;
45706                this._entriesPerChunk = void 0;
45707                this._entryMask = void 0;
45708                this._chunkMask = void 0;
45709                this._poolFlag = void 0;
45710                this._arrayBuffers = [];
45711                this._freeLists = [];
45712                this._uint32BufferViews = [];
45713                this._float32BufferViews = [];
45714                this._hasUint32 = !1;
45715                this._hasFloat32 = !1;
45716                this._nativePool = void 0;
45717                this._elementCount = s.COUNT;
45718                this._entryBits = n;
45719                this._dataType = e;
45720                this._dataMembers = i;
45721                this._stride = 4 * this._elementCount;
45722                this._entriesPerChunk = 1 << n;
45723                this._entryMask = this._entriesPerChunk - 1;
45724                this._poolFlag = 1 << 30;
45725                this._chunkMask = ~(this._entryMask | this._poolFlag);
45726                this._nativePool = new JP(t, n, this._stride);
45727                let r = QP.NEVER;
45728                let o = !1;
45729                let a = !1;
45730                for (const t in e) {
45731                  o = this._hasFloat32;
45732                  a = this._hasUint32;
45733                  if (a && o) break;
45734                  r = e[t];
45735                  o || r !== QP.FLOAT32 ? a || r !== QP.UINT32 || (this._hasUint32 = !0) : this._hasFloat32 = !0;
45736                }
45737              }
45738              alloc() {
45739                let t = 0;
45740                for (;t < this._freeLists.length; t++) {
45741                  const e = this._freeLists[t];
45742                  if (e.length) {
45743                    const i = e[e.length - 1];
45744                    e.length--;
45745                    return (t << this._entryBits) + i + this._poolFlag;
45746                  }
45747                }
45748                const e = this._nativePool.allocateNewChunk();
45749                const i = [];
45750                const s = [];
45751                const n = [];
45752                const r = this._hasFloat32;
45753                const o = this._hasUint32;
45754                for (let t = 0; t < this._entriesPerChunk; t++) {
45755                  r && i.push(new Float32Array(e, this._stride * t, this._elementCount));
45756                  o && s.push(new Uint32Array(e, this._stride * t, this._elementCount));
45757                  t && n.push(t);
45758                }
45759                o && this._uint32BufferViews.push(s);
45760                r && this._float32BufferViews.push(i);
45761                this._freeLists.push(n);
45762                this._arrayBuffers.push(e);
45763                return (t << this._entryBits) + this._poolFlag;
45764              }
45765              getBuffer(t) {
45766                const e = (this._chunkMask & t) >> this._entryBits;
45767                const i = this._entryMask & t;
45768                const s = this._hasFloat32 ? this._float32BufferViews : this._uint32BufferViews;
45769                if (!t || e < 0 || e >= s.length || i < 0 || i >= this._entriesPerChunk || ZP(this._freeLists[e], i)) {
45770                  console.warn("invalid buffer pool handle");
45771                  return [];
45772                }
45773                return s[e][i];
45774              }
45775              getTypedArray(t, e) {
45776                const i = (this._chunkMask & t) >> this._entryBits;
45777                const s = this._entryMask & t;
45778                const n = this._dataType[e] === QP.UINT32 ? this._uint32BufferViews : this._float32BufferViews;
45779                if (!t || i < 0 || i >= n.length || s < 0 || s >= this._entriesPerChunk || ZP(this._freeLists[i], s)) {
45780                  console.warn("invalid buffer pool handle");
45781                  return [];
45782                }
45783                const r = e;
45784                const o = n[i][s];
45785                const a = this._dataMembers[e];
45786                return o.subarray(r, r + a);
45787              }
45788              free(t) {
45789                const e = (this._chunkMask & t) >> this._entryBits;
45790                const i = this._entryMask & t;
45791                if (!t || e < 0 || e >= this._freeLists.length || i < 0 || i >= this._entriesPerChunk || ZP(this._freeLists[e], i)) {
45792                  console.warn("invalid buffer pool handle");
45793                  return;
45794                }
45795                (this._hasUint32 ? this._uint32BufferViews : this._float32BufferViews)[e][i].fill(0);
45796                this._freeLists[e].push(i);
45797              }
45798            }
45799            let tO;
45800            !function(t) {
45801              t[t.NODE = 0] = "NODE";
45802              t[t.PASS = 1] = "PASS";
45803              t[t.AABB = 2] = "AABB";
45804              t[t.RENDER2D = 3] = "RENDER2D";
45805            }(tO || (tO = {}));
45806            let eO;
45807            !function(t) {
45808              t[t.POSITION = 0] = "POSITION";
45809              t[t.UV = 3] = "UV";
45810              t[t.COLOR = 5] = "COLOR";
45811              t[t.COUNT = 9] = "COUNT";
45812            }(eO || (eO = {}));
45813            const iO = {
45814              [eO.POSITION]: QP.FLOAT32,
45815              [eO.UV]: QP.FLOAT32,
45816              [eO.COLOR]: QP.UINT32,
45817              [eO.COUNT]: QP.NEVER
45818            };
45819            const sO = {
45820              [eO.POSITION]: eO.UV - eO.POSITION,
45821              [eO.UV]: eO.COLOR - eO.UV,
45822              [eO.COLOR]: eO.COUNT - eO.COLOR,
45823              [eO.COUNT]: 1
45824            };
45825            const nO = new $P(tO.RENDER2D, iO, sO, eO);
45826            let rO;
45827            !function(t) {
45828              t[t.DIRTY_FLAG = 0] = "DIRTY_FLAG";
45829              t[t.LAYER = 1] = "LAYER";
45830              t[t.WORLD_SCALE = 2] = "WORLD_SCALE";
45831              t[t.WORLD_POSITION = 5] = "WORLD_POSITION";
45832              t[t.WORLD_ROTATION = 8] = "WORLD_ROTATION";
45833              t[t.WORLD_MATRIX = 12] = "WORLD_MATRIX";
45834              t[t.LOCAL_SCALE = 28] = "LOCAL_SCALE";
45835              t[t.LOCAL_POSITION = 31] = "LOCAL_POSITION";
45836              t[t.LOCAL_ROTATION = 34] = "LOCAL_ROTATION";
45837              t[t.COUNT = 38] = "COUNT";
45838            }(rO || (rO = {}));
45839            const oO = {
45840              [rO.DIRTY_FLAG]: QP.UINT32,
45841              [rO.LAYER]: QP.UINT32,
45842              [rO.WORLD_SCALE]: QP.FLOAT32,
45843              [rO.WORLD_POSITION]: QP.FLOAT32,
45844              [rO.WORLD_ROTATION]: QP.FLOAT32,
45845              [rO.WORLD_MATRIX]: QP.FLOAT32,
45846              [rO.LOCAL_SCALE]: QP.FLOAT32,
45847              [rO.LOCAL_POSITION]: QP.FLOAT32,
45848              [rO.LOCAL_ROTATION]: QP.FLOAT32,
45849              [rO.COUNT]: QP.NEVER
45850            };
45851            const aO = {
45852              [rO.DIRTY_FLAG]: rO.LAYER - rO.DIRTY_FLAG,
45853              [rO.LAYER]: rO.WORLD_SCALE - rO.LAYER,
45854              [rO.WORLD_SCALE]: rO.WORLD_POSITION - rO.WORLD_SCALE,
45855              [rO.WORLD_POSITION]: rO.WORLD_ROTATION - rO.WORLD_POSITION,
45856              [rO.WORLD_ROTATION]: rO.WORLD_MATRIX - rO.WORLD_ROTATION,
45857              [rO.WORLD_MATRIX]: rO.LOCAL_SCALE - rO.WORLD_MATRIX,
45858              [rO.LOCAL_SCALE]: rO.LOCAL_POSITION - rO.LOCAL_SCALE,
45859              [rO.LOCAL_POSITION]: rO.LOCAL_ROTATION - rO.LOCAL_POSITION,
45860              [rO.LOCAL_ROTATION]: rO.COUNT - rO.LOCAL_ROTATION,
45861              [rO.COUNT]: 1
45862            };
45863            const lO = new $P(tO.NODE, oO, aO, rO);
45864            let hO;
45865            !function(t) {
45866              t[t.PRIORITY = 0] = "PRIORITY";
45867              t[t.STAGE = 1] = "STAGE";
45868              t[t.PHASE = 2] = "PHASE";
45869              t[t.PRIMITIVE = 3] = "PRIMITIVE";
45870              t[t.BATCHING_SCHEME = 4] = "BATCHING_SCHEME";
45871              t[t.DYNAMIC_STATE = 5] = "DYNAMIC_STATE";
45872              t[t.HASH = 6] = "HASH";
45873              t[t.COUNT = 7] = "COUNT";
45874            }(hO || (hO = {}));
45875            const cO = {
45876              [hO.PRIORITY]: QP.UINT32,
45877              [hO.STAGE]: QP.UINT32,
45878              [hO.PHASE]: QP.UINT32,
45879              [hO.PRIMITIVE]: QP.UINT32,
45880              [hO.BATCHING_SCHEME]: QP.UINT32,
45881              [hO.DYNAMIC_STATE]: QP.UINT32,
45882              [hO.HASH]: QP.UINT32,
45883              [hO.COUNT]: QP.NEVER
45884            };
45885            const uO = {
45886              [hO.PRIORITY]: hO.STAGE - hO.PRIORITY,
45887              [hO.STAGE]: hO.PHASE - hO.STAGE,
45888              [hO.PHASE]: hO.PRIMITIVE - hO.PHASE,
45889              [hO.PRIMITIVE]: hO.BATCHING_SCHEME - hO.PRIMITIVE,
45890              [hO.BATCHING_SCHEME]: hO.DYNAMIC_STATE - hO.BATCHING_SCHEME,
45891              [hO.DYNAMIC_STATE]: hO.HASH - hO.DYNAMIC_STATE,
45892              [hO.HASH]: hO.COUNT - hO.HASH,
45893              [hO.COUNT]: 1
45894            };
45895            const _O = new $P(tO.PASS, cO, uO, hO);
45896            let dO;
45897            !function(t) {
45898              t[t.CENTER = 0] = "CENTER";
45899              t[t.HALFEXTENTS = 3] = "HALFEXTENTS";
45900              t[t.COUNT = 6] = "COUNT";
45901            }(dO || (dO = {}));
45902            const pO = {
45903              [dO.CENTER]: QP.FLOAT32,
45904              [dO.HALFEXTENTS]: QP.FLOAT32,
45905              [dO.COUNT]: QP.NEVER
45906            };
45907            const mO = {
45908              [dO.CENTER]: dO.HALFEXTENTS - dO.CENTER,
45909              [dO.HALFEXTENTS]: dO.COUNT - dO.HALFEXTENTS,
45910              [dO.COUNT]: 1
45911            };
45912            const fO = new $P(tO.AABB, pO, mO, dO);
45913            const gO = jsb.RenderScene;
45914            oe({
45915              Low_256x256: 256,
45916              Medium_512x512: 512,
45917              High_1024x1024: 1024,
45918              Ultra_2048x2048: 2048
45919            });
45920            const yO = oe({
45921              Planar: 0,
45922              ShadowMap: 1
45923            });
45924            oe({
45925              HARD: 0,
45926              SOFT: 1,
45927              SOFT_2X: 2,
45928              SOFT_4X: 3
45929            });
45930            oe({
45931              LEVEL_1: 1,
45932              LEVEL_2: 2,
45933              LEVEL_3: 3,
45934              LEVEL_4: 4
45935            });
45936            oe({
45937              NONE: 1,
45938              RemoveDuplicates: 2,
45939              DisableRotationFix: 3
45940            });
45941            const bO = yO.ShadowMap + 1;
45942            class SO {
45943              constructor() {
45944                this.fixedSphere = new ua(0, 0, 0, .01);
45945                this.maxReceived = 4;
45946                this._matLight = new qi;
45947                this._material = null;
45948                this._instancingMaterial = null;
45949                this._enabled = !1;
45950                this._type = bO;
45951                this._distance = 0;
45952                this._normal = new Pi(0, 1, 0);
45953                this._shadowColor = new Bi(0, 0, 0, 76);
45954                this._size = new Qi(1024, 1024);
45955                this._shadowMapDirty = !1;
45956              }
45957              get enabled() {
45958                return this._enabled;
45959              }
45960              set enabled(t) {
45961                this._enabled = t;
45962                this.activate();
45963              }
45964              get type() {
45965                return this._type;
45966              }
45967              set type(t) {
45968                this._type = this.enabled ? t : bO;
45969                this.activate();
45970              }
45971              get normal() {
45972                return this._normal;
45973              }
45974              set normal(t) {
45975                Pi.copy(this._normal, t);
45976              }
45977              get distance() {
45978                return this._distance;
45979              }
45980              set distance(t) {
45981                this._distance = t;
45982              }
45983              get shadowColor() {
45984                return this._shadowColor;
45985              }
45986              set shadowColor(t) {
45987                this._shadowColor = t;
45988              }
45989              get size() {
45990                return this._size;
45991              }
45992              set size(t) {
45993                this._size.set(t);
45994              }
45995              get shadowMapDirty() {
45996                return this._shadowMapDirty;
45997              }
45998              set shadowMapDirty(t) {
45999                this._shadowMapDirty = t;
46000              }
46001              get matLight() {
46002                return this._matLight;
46003              }
46004              get material() {
46005                return this._material;
46006              }
46007              get instancingMaterial() {
46008                return this._instancingMaterial;
46009              }
46010              getPlanarShader(t) {
46011                if (!this._material) {
46012                  this._material = new hm;
46013                  this._material.initialize({
46014                    effectName: "pipeline/planar-shadow"
46015                  });
46016                }
46017                const e = this._material.passes;
46018                w(e.length > 0, "passes should not be empty!");
46019                return e.length > 0 ? e[0].getShaderVariant(t) : null;
46020              }
46021              getPlanarInstanceShader(t) {
46022                if (!this._instancingMaterial) {
46023                  this._instancingMaterial = new hm;
46024                  this._instancingMaterial.initialize({
46025                    effectName: "pipeline/planar-shadow",
46026                    defines: {
46027                      USE_INSTANCING: !0
46028                    }
46029                  });
46030                }
46031                const e = this._instancingMaterial.passes;
46032                w(e.length > 0, "passes should not be empty!");
46033                return e.length > 0 ? e[0].getShaderVariant(t) : null;
46034              }
46035              initialize(t) {
46036                this._enabled = t.enabled;
46037                this._type = this.enabled ? t.type : bO;
46038                this.normal = t.planeDirection;
46039                this.distance = t.planeHeight;
46040                this.shadowColor = t.shadowColor;
46041                this.maxReceived = t.maxReceived;
46042                if (t.shadowMapSize !== this._size.x) {
46043                  this.size.set(t.shadowMapSize, t.shadowMapSize);
46044                  this._shadowMapDirty = !0;
46045                }
46046              }
46047              activate() {
46048                if (this._enabled) if (this.type === yO.Planar) this._updatePlanarInfo(); else {
46049                  const t = m.director.root;
46050                  t.pipeline.macros.CC_SHADOW_TYPE = 2;
46051                  t.onGlobalPipelineStateChanged();
46052                } else {
46053                  const t = m.director.root;
46054                  t.pipeline.macros.CC_SHADOW_TYPE = 0;
46055                  t.onGlobalPipelineStateChanged();
46056                }
46057              }
46058              _updatePlanarInfo() {
46059                if (!this._material) {
46060                  this._material = new hm;
46061                  this._material.initialize({
46062                    effectName: "pipeline/planar-shadow"
46063                  });
46064                }
46065                if (!this._instancingMaterial) {
46066                  this._instancingMaterial = new hm;
46067                  this._instancingMaterial.initialize({
46068                    effectName: "pipeline/planar-shadow",
46069                    defines: {
46070                      USE_INSTANCING: !0
46071                    }
46072                  });
46073                }
46074                const t = m.director.root;
46075                t.pipeline.macros.CC_SHADOW_TYPE = 1;
46076                t.onGlobalPipelineStateChanged();
46077              }
46078              destroy() {
46079                this._material && this._material.destroy();
46080                this._instancingMaterial && this._instancingMaterial.destroy();
46081                this.fixedSphere.destroy();
46082              }
46083            }
46084            SO.MAX_FAR = 2e3;
46085            SO.COEFFICIENT_OF_EXPANSION = 2 * Math.sqrt(3);
46086            m.Shadows = SO;
46087            Y(gO.prototype, "RenderScene.prototype", [ {
46088              name: "raycastUI2DNode"
46089            }, {
46090              name: "raycastUINode"
46091            } ]);
46092            Y(gO.prototype, "RenderScene.prototype", [ {
46093              name: "raycastAll",
46094              suggest: "using intersect.rayModel in geometry"
46095            }, {
46096              name: "raycastAllModels",
46097              suggest: "using intersect.rayModel in geometry"
46098            }, {
46099              name: "raycastSingleModel",
46100              suggest: "using intersect.rayModel in geometry"
46101            }, {
46102              name: "raycastAllCanvas",
46103              suggest: "using intersect.rayAABB in geometry"
46104            }, {
46105              name: "rayResultCanvas"
46106            }, {
46107              name: "rayResultModels"
46108            }, {
46109              name: "rayResultAll"
46110            }, {
46111              name: "rayResultSingleModel"
46112            } ]);
46113            const AO = {};
46114            Y(AO, "CameraVisFlags", [ {
46115              name: "GENERAL"
46116            } ]);
46117            W(AO, "CameraVisFlags", [ {
46118              name: "PROFILER",
46119              newName: "PROFILER",
46120              target: mm.BitMask,
46121              targetName: "PROFILER"
46122            }, {
46123              name: "GIZMOS",
46124              newName: "GIZMOS",
46125              target: mm.BitMask,
46126              targetName: "GIZMOS"
46127            }, {
46128              name: "EDITOR",
46129              newName: "EDITOR",
46130              target: mm.BitMask,
46131              targetName: "EDITOR"
46132            }, {
46133              name: "UI",
46134              newName: "UI",
46135              target: mm.BitMask,
46136              targetName: "UI_3D"
46137            }, {
46138              name: "UI2D",
46139              newName: "UI2D",
46140              target: mm.BitMask,
46141              targetName: "UI_2D"
46142            } ]);
46143            m.CameraVisFlags = AO;
46144            const TO = {};
46145            Y(TO, "VisibilityFlags", [ {
46146              name: "GENERAL"
46147            } ]);
46148            W(TO, "VisibilityFlags", [ {
46149              name: "ALWALS",
46150              newName: "ALWALS",
46151              target: mm.Enum,
46152              targetName: "ALWALS"
46153            }, {
46154              name: "PROFILER",
46155              newName: "PROFILER",
46156              target: mm.Enum,
46157              targetName: "PROFILER"
46158            }, {
46159              name: "GIZMOS",
46160              newName: "GIZMOS",
46161              target: mm.Enum,
46162              targetName: "GIZMOS"
46163            }, {
46164              name: "EDITOR",
46165              newName: "EDITOR",
46166              target: mm.Enum,
46167              targetName: "EDITOR"
46168            }, {
46169              name: "UI",
46170              newName: "UI",
46171              target: mm.Enum,
46172              targetName: "UI_3D"
46173            }, {
46174              name: "UI2D",
46175              newName: "UI2D",
46176              target: mm.Enum,
46177              targetName: "UI_2D"
46178            } ]);
46179            m.VisibilityFlags = TO;
46180            W(XP.prototype, "Pass.prototype", [ {
46181              name: "getBindingTypeFromHandle",
46182              newName: "getDescriptorTypeFromHandle"
46183            } ]);
46184            Y(By.prototype, "Camera.prototype", [ {
46185              name: "getSplitFrustum"
46186            }, {
46187              name: "setMatView"
46188            }, {
46189              name: "setMatViewInv"
46190            }, {
46191              name: "setMatProjInv"
46192            }, {
46193              name: "setMatViewProjInv"
46194            }, {
46195              name: "setMatProj"
46196            }, {
46197              name: "setMatViewProj"
46198            }, {
46199              name: "getMatViewInv"
46200            } ]);
46201            Y(SO.prototype, "Shadows.prototype", [ {
46202              name: "aspect"
46203            }, {
46204              name: "selfShadow"
46205            }, {
46206              name: "linear"
46207            }, {
46208              name: "packing"
46209            }, {
46210              name: "autoAdapt"
46211            }, {
46212              name: "fixedArea"
46213            }, {
46214              name: "pcf"
46215            }, {
46216              name: "bias"
46217            }, {
46218              name: "normalBias"
46219            }, {
46220              name: "near"
46221            }, {
46222              name: "far"
46223            }, {
46224              name: "shadowDistance"
46225            }, {
46226              name: "invisibleOcclusionRange"
46227            }, {
46228              name: "orthoSize"
46229            }, {
46230              name: "saturation"
46231            } ]);
46232            Y(NA.prototype, "SpotLight.prototype", [ {
46233              name: "aspect"
46234            } ]);
46235            const vO = DP.addStage;
46236            var EO = Object.freeze({
46237              __proto__: null,
46238              addStage: vO,
46239              scene: KA,
46240              createIA: function(t, e) {
46241                if (!e.positions) {
46242                  console.error("The data must have positions field");
46243                  return null;
46244                }
46245                const i = [];
46246                const s = e.positions.length / 3;
46247                for (let t = 0; t < s; ++t) {
46248                  i.push(e.positions[3 * t], e.positions[3 * t + 1], e.positions[3 * t + 2]);
46249                  e.normals && i.push(e.normals[3 * t], e.normals[3 * t + 1], e.normals[3 * t + 2]);
46250                  e.uvs && i.push(e.uvs[2 * t], e.uvs[2 * t + 1]);
46251                  e.colors && i.push(e.colors[3 * t], e.colors[3 * t + 1], e.colors[3 * t + 2]);
46252                }
46253                const n = [];
46254                n.push(new Vn(cr.ATTR_POSITION, bs.RGB32F));
46255                e.normals && n.push(new Vn(cr.ATTR_NORMAL, bs.RGB32F));
46256                e.uvs && n.push(new Vn(cr.ATTR_TEX_COORD, bs.RG32F));
46257                e.colors && n.push(new Vn(cr.ATTR_COLOR, bs.RGB32F));
46258                const r = t.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.DEVICE, 4 * i.length, 4 * i.length / s));
46259                r.update(new Float32Array(i));
46260                let o = null;
46261                if (e.indices) {
46262                  o = t.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, 2 * e.indices.length, 2));
46263                  o.update(new Uint16Array(e.indices));
46264                }
46265                return t.createInputAssembler(new Un(n, [ r ], o));
46266              },
46267              get RenderQueue() {
46268                return PP;
46269              },
46270              get PassStage() {
46271                return OP;
46272              },
46273              genHandle: (t, e, i, s = 0) => e << 26 & NP | t << 20 & LP | i << 12 & FP | 4095 & s,
46274              getTypeFromHandle: t => (t & NP) >>> 26,
46275              getBindingFromHandle: t => (t & LP) >>> 20,
46276              getCountFromHandle: t => (t & FP) >>> 12,
46277              getOffsetFromHandle: t => 4095 & t,
46278              customizeType: (t, e) => 67108863 & t | e << 26 & NP,
46279              type2reader: VP,
46280              type2writer: kP,
46281              getDefaultFromType: GP,
46282              getStringFromType: zP,
46283              overrideMacros: HP,
46284              get BatchingSchemes() {
46285                return jP;
46286              },
46287              Pass: XP,
46288              getDeviceShaderVersion: function(t) {
46289                switch (t.gfxAPI) {
46290                 case fs.GLES2:
46291                 case fs.WEBGL:
46292                  return "glsl1";
46293
46294                 case fs.GLES3:
46295                 case fs.WEBGL2:
46296                  return "glsl3";
46297
46298                 default:
46299                  return "glsl4";
46300                }
46301              },
46302              programLib: WP,
46303              nearestPOT: YP,
46304              TextureBufferPool: KP,
46305              MaterialInstance: uS,
46306              PassInstance: class extends XP {
46307                get parent() {
46308                  return this._parent;
46309                }
46310                constructor(t, e) {
46311                  super(t.root);
46312                  this._parent = void 0;
46313                  this._owner = void 0;
46314                  this._dontNotify = !1;
46315                  this._parent = t;
46316                  this._owner = e;
46317                  this._doInit(this._parent, !0);
46318                  for (let t = 0; t < this._shaderInfo.blocks.length; t++) {
46319                    const e = this._shaderInfo.blocks[t];
46320                    const i = this._blocks[e.binding];
46321                    const s = this._parent.blocks[e.binding];
46322                    i.set(s);
46323                  }
46324                  this._rootBufferDirty = !0;
46325                  const i = this._parent;
46326                  for (let t = 0; t < this._shaderInfo.samplerTextures.length; t++) {
46327                    const e = this._shaderInfo.samplerTextures[t];
46328                    for (let t = 0; t < e.count; t++) {
46329                      const s = i._descriptorSet.getSampler(e.binding, t);
46330                      const n = i._descriptorSet.getTexture(e.binding, t);
46331                      this._descriptorSet.bindSampler(e.binding, s, t);
46332                      this._descriptorSet.bindTexture(e.binding, n, t);
46333                    }
46334                  }
46335                  super.tryCompile();
46336                }
46337                overridePipelineStates(t, e) {
46338                  this._bs.reset();
46339                  this._rs.reset();
46340                  this._dss.reset();
46341                  XP.fillPipelineInfo(this, t);
46342                  XP.fillPipelineInfo(this, e);
46343                  this._onStateChange();
46344                }
46345                tryCompile(t) {
46346                  if (t && !HP(this._defines, t)) return !1;
46347                  const e = super.tryCompile();
46348                  this._onStateChange();
46349                  return e;
46350                }
46351                beginChangeStatesSilently() {
46352                  this._dontNotify = !0;
46353                }
46354                endChangeStatesSilently() {
46355                  this._dontNotify = !1;
46356                }
46357                _syncBatchingScheme() {
46358                  this._defines.USE_BATCHING = this._defines.USE_INSTANCING = !1;
46359                  this._batchingScheme = jP.NONE;
46360                }
46361                _onStateChange() {
46362                  this._hash = XP.getPassHash(this);
46363                  this._owner.onPassStateChange(this._dontNotify);
46364                }
46365              },
46366              get PoolType() {
46367                return tO;
46368              },
46369              NULL_HANDLE: 0,
46370              get Render2dView() {
46371                return eO;
46372              },
46373              Render2dPool: nO,
46374              get NodeView() {
46375                return rO;
46376              },
46377              NodePool: lO,
46378              get PassView() {
46379                return hO;
46380              },
46381              PassPool: _O,
46382              get AABBView() {
46383                return dO;
46384              },
46385              AABBPool: fO,
46386              RenderScene: gO,
46387              CameraVisFlags: AO,
46388              VisibilityFlags: TO
46389            });
46390            t("renderer", EO);
46391            let CO;
46392            !function(t) {
46393              t[t.BUTT = 0] = "BUTT";
46394              t[t.ROUND = 1] = "ROUND";
46395              t[t.SQUARE = 2] = "SQUARE";
46396            }(CO || (CO = {}));
46397            he(CO);
46398            let xO;
46399            !function(t) {
46400              t[t.BEVEL = 0] = "BEVEL";
46401              t[t.ROUND = 1] = "ROUND";
46402              t[t.MITER = 2] = "MITER";
46403            }(xO || (xO = {}));
46404            he(xO);
46405            let wO;
46406            !function(t) {
46407              t[t.PT_CORNER = 1] = "PT_CORNER";
46408              t[t.PT_LEFT = 2] = "PT_LEFT";
46409              t[t.PT_BEVEL = 4] = "PT_BEVEL";
46410              t[t.PT_INNERBEVEL = 8] = "PT_INNERBEVEL";
46411            }(wO || (wO = {}));
46412            he(wO);
46413            const RO = Math.PI;
46414            const IO = Math.min;
46415            const MO = Math.max;
46416            const BO = Math.cos;
46417            const DO = Math.sin;
46418            const PO = Math.abs;
46419            const OO = Math.sign;
46420            const NO = .5522847493;
46421            function LO(t, e, i, s, n) {
46422              t.moveTo(e - s, i);
46423              t.bezierCurveTo(e - s, i + n * NO, e - s * NO, i + n, e, i + n);
46424              t.bezierCurveTo(e + s * NO, i + n, e + s, i + n * NO, e + s, i);
46425              t.bezierCurveTo(e + s, i - n * NO, e + s * NO, i - n, e, i - n);
46426              t.bezierCurveTo(e - s * NO, i - n, e - s, i - n * NO, e - s, i);
46427              t.close();
46428            }
46429            function FO(t, e, i, s, n, r, o, a, l, h, c) {
46430              let u = 0;
46431              let _ = 0;
46432              let d = 0;
46433              let p = 0;
46434              let m = 0;
46435              let f = 0;
46436              let g = 0;
46437              let y = 0;
46438              let b = 0;
46439              let S = 0;
46440              let A = 0;
46441              let T = 0;
46442              let v = 0;
46443              let E = 0;
46444              let C = 0;
46445              let x = 0;
46446              if (!(h > 10)) {
46447                u = .5 * (e + s);
46448                _ = .5 * (i + n);
46449                d = .5 * (s + r);
46450                p = .5 * (n + o);
46451                m = .5 * (r + a);
46452                f = .5 * (o + l);
46453                g = .5 * (u + d);
46454                y = .5 * (_ + p);
46455                v = a - e;
46456                E = l - i;
46457                C = PO((s - a) * E - (n - l) * v);
46458                x = PO((r - a) * E - (o - l) * v);
46459                if ((C + x) * (C + x) < t.tessTol * (v * v + E * E)) t.addPoint(a, l, 0 === c ? c | wO.PT_BEVEL : c); else {
46460                  b = .5 * (d + m);
46461                  S = .5 * (p + f);
46462                  A = .5 * (g + b);
46463                  T = .5 * (y + S);
46464                  FO(t, e, i, u, _, g, y, A, T, h + 1, 0);
46465                  FO(t, A, T, b, S, m, f, a, l, h + 1, c);
46466                }
46467              }
46468            }
46469            class VO extends Qi {
46470              constructor(t, e) {
46471                super(t, e);
46472                this.dx = 0;
46473                this.dy = 0;
46474                this.dmx = 0;
46475                this.dmy = 0;
46476                this.flags = 0;
46477                this.len = 0;
46478                this.reset();
46479              }
46480              reset() {
46481                this.dx = 0;
46482                this.dy = 0;
46483                this.dmx = 0;
46484                this.dmy = 0;
46485                this.flags = 0;
46486                this.len = 0;
46487              }
46488            }
46489            class kO {
46490              constructor() {
46491                this.closed = !1;
46492                this.bevel = 0;
46493                this.complex = !0;
46494                this.points = [];
46495                this.reset();
46496              }
46497              reset() {
46498                this.closed = !1;
46499                this.bevel = 0;
46500                this.complex = !0;
46501                this.points ? this.points.length = 0 : this.points = [];
46502              }
46503            }
46504            class UO {
46505              constructor(t) {
46506                this.dataOffset = 0;
46507                this.updatePathOffset = !1;
46508                this.pathLength = 0;
46509                this.pathOffset = 0;
46510                this.paths = [];
46511                this.tessTol = .25;
46512                this.distTol = .01;
46513                this.fillColor = Bi.WHITE.clone();
46514                this.lineCap = CO.BUTT;
46515                this.strokeColor = Bi.BLACK.clone();
46516                this.lineJoin = xO.MITER;
46517                this.lineWidth = 0;
46518                this.pointsOffset = 0;
46519                this._commandX = 0;
46520                this._commandY = 0;
46521                this._points = [];
46522                this._renderDataList = [];
46523                this._curPath = null;
46524                this._comp = void 0;
46525                this._comp = t;
46526              }
46527              moveTo(t, e) {
46528                if (this.updatePathOffset) {
46529                  this.pathOffset = this.pathLength;
46530                  this.updatePathOffset = !1;
46531                }
46532                this._addPath();
46533                this.addPoint(t, e, wO.PT_CORNER);
46534                this._commandX = t;
46535                this._commandY = e;
46536              }
46537              lineTo(t, e) {
46538                this.addPoint(t, e, wO.PT_CORNER);
46539                this._commandX = t;
46540                this._commandY = e;
46541              }
46542              bezierCurveTo(t, e, i, s, n, r) {
46543                const o = this._curPath;
46544                const a = o.points[o.points.length - 1];
46545                if (a) if (a.x !== t || a.y !== e || i !== n || s !== r) {
46546                  FO(this, a.x, a.y, t, e, i, s, n, r, 0, wO.PT_CORNER);
46547                  this._commandX = n;
46548                  this._commandY = r;
46549                } else this.lineTo(n, r);
46550              }
46551              quadraticCurveTo(t, e, i, s) {
46552                const n = this._commandX;
46553                const r = this._commandY;
46554                this.bezierCurveTo(n + 2 / 3 * (t - n), r + 2 / 3 * (e - r), i + 2 / 3 * (t - i), s + 2 / 3 * (e - s), i, s);
46555              }
46556              arc(t, e, i, s, n, r) {
46557                !function(t, e, i, s, n, r, o) {
46558                  let a = 0;
46559                  let l = 0;
46560                  let h = 0;
46561                  let c = 0;
46562                  let u = 0;
46563                  let _ = 0;
46564                  let d = 0;
46565                  let p = 0;
46566                  let m = 0;
46567                  let f = 0;
46568                  let g = 0;
46569                  let y = 0;
46570                  let b = 0;
46571                  let S = 0;
46572                  let A = 0;
46573                  let T = 0;
46574                  l = r - n;
46575                  if (o = o || !1) if (PO(l) >= 2 * RO) l = 2 * RO; else for (;l < 0; ) l += 2 * RO; else if (PO(l) >= 2 * RO) l = 2 * -RO; else for (;l > 0; ) l -= 2 * RO;
46576                  T = 0 | MO(1, IO(PO(l) / (.5 * RO) + .5, 5));
46577                  h = l / T / 2;
46578                  c = PO(4 / 3 * (1 - BO(h)) / DO(h));
46579                  o || (c = -c);
46580                  for (A = 0; A <= T; A++) {
46581                    a = n + l * (A / T);
46582                    u = BO(a);
46583                    _ = DO(a);
46584                    d = e + u * s;
46585                    p = i + _ * s;
46586                    m = -_ * s * c;
46587                    f = u * s * c;
46588                    0 === A ? t.moveTo(d, p) : t.bezierCurveTo(g + b, y + S, d - m, p - f, d, p);
46589                    g = d;
46590                    y = p;
46591                    b = m;
46592                    S = f;
46593                  }
46594                }(this, t, e, i, s, n, r);
46595              }
46596              ellipse(t, e, i, s) {
46597                LO(this, t, e, i, s);
46598                this._curPath.complex = !1;
46599              }
46600              circle(t, e, i) {
46601                LO(this, t, e, i, i);
46602                this._curPath.complex = !1;
46603              }
46604              rect(t, e, i, s) {
46605                this.moveTo(t, e);
46606                this.lineTo(t + i, e);
46607                this.lineTo(t + i, e + s);
46608                this.lineTo(t, e + s);
46609                this.close();
46610                this._curPath.complex = !1;
46611              }
46612              roundRect(t, e, i, s, n) {
46613                !function(t, e, i, s, n, r) {
46614                  if (r < .1) t.rect(e, i, s, n); else {
46615                    const o = IO(r, .5 * PO(s)) * OO(s);
46616                    const a = IO(r, .5 * PO(n)) * OO(n);
46617                    t.moveTo(e, i + a);
46618                    t.lineTo(e, i + n - a);
46619                    t.bezierCurveTo(e, i + n - a * (1 - NO), e + o * (1 - NO), i + n, e + o, i + n);
46620                    t.lineTo(e + s - o, i + n);
46621                    t.bezierCurveTo(e + s - o * (1 - NO), i + n, e + s, i + n - a * (1 - NO), e + s, i + n - a);
46622                    t.lineTo(e + s, i + a);
46623                    t.bezierCurveTo(e + s, i + a * (1 - NO), e + s - o * (1 - NO), i, e + s - o, i);
46624                    t.lineTo(e + o, i);
46625                    t.bezierCurveTo(e + o * (1 - NO), i, e, i + a * (1 - NO), e, i + a);
46626                    t.close();
46627                  }
46628                }(this, t, e, i, s, n);
46629                this._curPath.complex = !1;
46630              }
46631              clear() {
46632                this.pathLength = 0;
46633                this.pathOffset = 0;
46634                this.pointsOffset = 0;
46635                this.dataOffset = 0;
46636                this._curPath = null;
46637                this.paths.length = 0;
46638                this._points.length = 0;
46639                const t = this._renderDataList;
46640                for (let e = 0, i = t.length; e < i; e++) {
46641                  const i = t[e];
46642                  if (i) {
46643                    AB.remove(i);
46644                    i.removeRenderDrawInfo(this._comp);
46645                  }
46646                }
46647                this._renderDataList.length = 0;
46648              }
46649              close() {
46650                this._curPath.closed = !0;
46651              }
46652              requestRenderData() {
46653                const t = AB.add();
46654                this._renderDataList.push(t);
46655                t.initRenderDrawInfo(this._comp, oB.MODEL);
46656                this._comp._renderData = t;
46657                this._comp._renderData.material = this._comp.getMaterialInstance(0);
46658                return t;
46659              }
46660              getRenderDataList() {
46661                0 === this._renderDataList.length && this.requestRenderData();
46662                return this._renderDataList;
46663              }
46664              addPoint(t, e, i) {
46665                const s = this._curPath;
46666                if (!s) return;
46667                const n = this._points;
46668                const r = s.points;
46669                let o = n[this.pointsOffset++];
46670                if (o) {
46671                  o.x = t;
46672                  o.y = e;
46673                } else {
46674                  o = new VO(t, e);
46675                  n.push(o);
46676                }
46677                o.flags = i;
46678                r.push(o);
46679              }
46680              _addPath() {
46681                const t = this.pathLength;
46682                let e = this.paths[t];
46683                if (e) e.reset(); else {
46684                  e = new kO;
46685                  this.paths.push(e);
46686                }
46687                this.pathLength++;
46688                this._curPath = e;
46689                return e;
46690              }
46691            }
46692            var GO, zO, HO, jO, XO, WO, YO, qO, KO, JO, ZO, QO, $O, tN, eN, iN, sN, nN, rN, oN, aN, lN, hN;
46693            const cN = GM.concat([ new Vn("a_dist", bs.R32F) ]);
46694            const uN = WM(cN);
46695            const _N = YM(cN);
46696            let dN = function(e) {
46697              return t({
46698                Graphics: e,
46699                GraphicsComponent: e
46700              }), e;
46701            }((GO = Ul("cc.Graphics"), zO = sh(), HO = zl(110), jO = $l(), XO = lh(), WO = Th(xO),
46702            YO = lh(), qO = Th(CO), KO = lh(), JO = lh(), ZO = lh(), QO = lh(), $O = rh(), GO(tN = zO(tN = HO(tN = jO(tN = (eN = (hN = lN = class t extends uD {
46703              get lineWidth() {
46704                return this._lineWidth;
46705              }
46706              set lineWidth(t) {
46707                this._lineWidth = t;
46708                this.impl && (this.impl.lineWidth = t);
46709              }
46710              get lineJoin() {
46711                return this._lineJoin;
46712              }
46713              set lineJoin(t) {
46714                this._lineJoin = t;
46715                this.impl && (this.impl.lineJoin = t);
46716              }
46717              get lineCap() {
46718                return this._lineCap;
46719              }
46720              set lineCap(t) {
46721                this._lineCap = t;
46722                this.impl && (this.impl.lineCap = t);
46723              }
46724              get strokeColor() {
46725                return this._strokeColor;
46726              }
46727              set strokeColor(t) {
46728                if (this.impl) {
46729                  this._strokeColor.set(t);
46730                  this.impl.strokeColor = this._strokeColor;
46731                }
46732              }
46733              get fillColor() {
46734                return this._fillColor;
46735              }
46736              set fillColor(t) {
46737                if (this.impl) {
46738                  this._fillColor.set(t);
46739                  this.impl.fillColor = this._fillColor;
46740                }
46741              }
46742              get miterLimit() {
46743                return this._miterLimit;
46744              }
46745              set miterLimit(t) {
46746                this._miterLimit = t;
46747              }
46748              get color() {
46749                return this._color;
46750              }
46751              set color(t) {
46752                this._color !== t && this._color.set(t);
46753              }
46754              get srcBlendFactor() {
46755                return this._srcBlendFactor;
46756              }
46757              set srcBlendFactor(t) {}
46758              get dstBlendFactor() {
46759                return this._dstBlendFactor;
46760              }
46761              set dstBlendFactor(t) {}
46762              get graphicsNativeProxy() {
46763                return this._graphicsNativeProxy;
46764              }
46765              constructor() {
46766                super();
46767                this.impl = null;
46768                this.model = null;
46769                Ml(this, "_lineWidth", iN, this);
46770                Ml(this, "_strokeColor", sN, this);
46771                Ml(this, "_lineJoin", nN, this);
46772                Ml(this, "_lineCap", rN, this);
46773                Ml(this, "_fillColor", oN, this);
46774                Ml(this, "_miterLimit", aN, this);
46775                this._isDrawing = !1;
46776                this._isNeedUploadData = !0;
46777                this._graphicsUseSubMeshes = [];
46778                this._instanceMaterialType = cD.ADD_COLOR;
46779                this.impl = new UO(this);
46780                this._graphicsNativeProxy = new ZM;
46781              }
46782              onRestore() {
46783                this.impl || this._flushAssembler();
46784              }
46785              onLoad() {
46786                super.onLoad();
46787                this._graphicsNativeProxy.initModel(this.node);
46788                this.model = this._graphicsNativeProxy.getModel();
46789                this._flushAssembler();
46790              }
46791              onEnable() {
46792                super.onEnable();
46793                this._updateMtlForGraphics();
46794              }
46795              onDestroy() {
46796                this._sceneGetter = null;
46797                this.graphicsNativeProxy.destroy();
46798                this.model = null;
46799                if (this.impl) {
46800                  this._isDrawing = !1;
46801                  this.impl.clear();
46802                  this.impl = null;
46803                }
46804                super.onDestroy();
46805              }
46806              moveTo(t, e) {
46807                this.impl && this.impl.moveTo(t, e);
46808              }
46809              lineTo(t, e) {
46810                this.impl && this.impl.lineTo(t, e);
46811              }
46812              bezierCurveTo(t, e, i, s, n, r) {
46813                this.impl && this.impl.bezierCurveTo(t, e, i, s, n, r);
46814              }
46815              quadraticCurveTo(t, e, i, s) {
46816                this.impl && this.impl.quadraticCurveTo(t, e, i, s);
46817              }
46818              arc(t, e, i, s, n, r) {
46819                this.impl && this.impl.arc(t, e, i, s, n, r);
46820              }
46821              ellipse(t, e, i, s) {
46822                this.impl && this.impl.ellipse(t, e, i, s);
46823              }
46824              circle(t, e, i) {
46825                this.impl && this.impl.circle(t, e, i);
46826              }
46827              rect(t, e, i, s) {
46828                this.impl && this.impl.rect(t, e, i, s);
46829              }
46830              roundRect(t, e, i, s, n) {
46831                this.impl && this.impl.roundRect(t, e, i, s, n);
46832              }
46833              fillRect(t, e, i, s) {
46834                this.rect(t, e, i, s);
46835                this.fill();
46836              }
46837              clear() {
46838                if (this.impl) {
46839                  this.impl.clear();
46840                  this._isDrawing = !1;
46841                  this._graphicsNativeProxy.clear();
46842                  this.markForUpdateRenderData();
46843                }
46844              }
46845              close() {
46846                this.impl && this.impl.close();
46847              }
46848              stroke() {
46849                this._assembler || this._flushAssembler();
46850                this._isDrawing = !0;
46851                this._isNeedUploadData = !0;
46852                this._assembler.stroke(this);
46853              }
46854              fill() {
46855                this._assembler || this._flushAssembler();
46856                this._isDrawing = !0;
46857                this._isNeedUploadData = !0;
46858                this._assembler.fill(this);
46859              }
46860              _updateMtlForGraphics() {
46861                let t;
46862                if (this._customMaterial) t = this.getMaterialInstance(0); else {
46863                  t = xR.get("ui-graphics-material");
46864                  this.setMaterial(t, 0);
46865                  t = this.getMaterialInstance(0);
46866                  t.recompileShaders({
46867                    USE_LOCAL: !0
46868                  });
46869                }
46870              }
46871              activeSubModel(t) {
46872                if (this.model) {
46873                  if (this.model.subModels.length <= t) {
46874                    const e = zo.gfxDevice;
46875                    const i = e.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.DEVICE, 65535 * _N, _N));
46876                    const s = e.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, 65535 * Uint16Array.BYTES_PER_ELEMENT * 2, Uint16Array.BYTES_PER_ELEMENT));
46877                    const n = new fC([ i ], cN, Xs.TRIANGLE_LIST, s);
46878                    n.subMeshIdx = 0;
46879                    this.model.initSubModel(t, n, this.getMaterialInstance(0));
46880                    this._graphicsUseSubMeshes.push(n);
46881                  }
46882                } else N(4500, this.node.name);
46883              }
46884              _uploadData() {
46885                const t = this.impl;
46886                if (!t) return;
46887                const e = t && t.getRenderDataList();
46888                if (e.length <= 0 || !this.model) return;
46889                const i = this.model.subModels;
46890                for (let t = 0; t < e.length; t++) {
46891                  const s = e[t];
46892                  const n = i[t].inputAssembler;
46893                  if (s.lastFilledVertex === s.vertexStart) continue;
46894                  const r = new Float32Array(s.vData.buffer, 0, s.vertexStart * uN);
46895                  n.vertexBuffers[0].update(r);
46896                  n.vertexCount = s.vertexStart;
46897                  const o = new Uint16Array(s.iData.buffer, 0, s.indexStart);
46898                  n.indexBuffer.update(o);
46899                  n.indexCount = s.indexStart;
46900                  s.lastFilledVertex = s.vertexStart;
46901                  s.lastFilledIndex = s.indexStart;
46902                }
46903                this._isNeedUploadData = !1;
46904              }
46905              _render(t) {
46906                if (this._isNeedUploadData) {
46907                  if (this.impl) {
46908                    const t = this.impl.getRenderDataList();
46909                    const e = this.model.subModels.length;
46910                    if (t.length > e) for (let i = e; i < t.length; i++) this.activeSubModel(i);
46911                  }
46912                  this._uploadData();
46913                }
46914                t.commitModel(this, this.model, this.getMaterialInstance(0));
46915              }
46916              _flushAssembler() {
46917                const e = t.Assembler.getAssembler(this);
46918                this._assembler !== e && (this._assembler = e);
46919              }
46920              _canRender() {
46921                return !!super._canRender() && this._isDrawing;
46922              }
46923              updateRenderer() {
46924                super.updateRenderer();
46925                if (this._isNeedUploadData) {
46926                  if (this.impl) {
46927                    const t = this.impl.getRenderDataList();
46928                    for (let e = 0; e < t.length; e++) t[e].setRenderDrawInfoAttributes();
46929                    this._graphicsNativeProxy.activeSubModels();
46930                  }
46931                  this._graphicsNativeProxy.uploadData();
46932                  this._isNeedUploadData = !1;
46933                }
46934              }
46935              createRenderEntity() {
46936                return new fB(uB.DYNAMIC);
46937              }
46938            }, lN.LineJoin = xO, lN.LineCap = CO, hN), Bl(eN.prototype, "lineWidth", [ nh, XO ], Object.getOwnPropertyDescriptor(eN.prototype, "lineWidth"), eN.prototype),
46939            Bl(eN.prototype, "lineJoin", [ WO, YO ], Object.getOwnPropertyDescriptor(eN.prototype, "lineJoin"), eN.prototype),
46940            Bl(eN.prototype, "lineCap", [ qO, KO ], Object.getOwnPropertyDescriptor(eN.prototype, "lineCap"), eN.prototype),
46941            Bl(eN.prototype, "strokeColor", [ JO ], Object.getOwnPropertyDescriptor(eN.prototype, "strokeColor"), eN.prototype),
46942            Bl(eN.prototype, "fillColor", [ ZO ], Object.getOwnPropertyDescriptor(eN.prototype, "fillColor"), eN.prototype),
46943            Bl(eN.prototype, "miterLimit", [ QO ], Object.getOwnPropertyDescriptor(eN.prototype, "miterLimit"), eN.prototype),
46944            Bl(eN.prototype, "color", [ vh, $O ], Object.getOwnPropertyDescriptor(eN.prototype, "color"), eN.prototype),
46945            iN = Bl(eN.prototype, "_lineWidth", [ Yl ], {
46946              configurable: !0,
46947              enumerable: !0,
46948              writable: !0,
46949              initializer: function() {
46950                return 1;
46951              }
46952            }), sN = Bl(eN.prototype, "_strokeColor", [ Yl ], {
46953              configurable: !0,
46954              enumerable: !0,
46955              writable: !0,
46956              initializer: function() {
46957                return Bi.BLACK.clone();
46958              }
46959            }), nN = Bl(eN.prototype, "_lineJoin", [ Yl ], {
46960              configurable: !0,
46961              enumerable: !0,
46962              writable: !0,
46963              initializer: function() {
46964                return xO.MITER;
46965              }
46966            }), rN = Bl(eN.prototype, "_lineCap", [ Yl ], {
46967              configurable: !0,
46968              enumerable: !0,
46969              writable: !0,
46970              initializer: function() {
46971                return CO.BUTT;
46972              }
46973            }), oN = Bl(eN.prototype, "_fillColor", [ Yl ], {
46974              configurable: !0,
46975              enumerable: !0,
46976              writable: !0,
46977              initializer: function() {
46978                return Bi.WHITE.clone();
46979              }
46980            }), aN = Bl(eN.prototype, "_miterLimit", [ Yl ], {
46981              configurable: !0,
46982              enumerable: !0,
46983              writable: !0,
46984              initializer: function() {
46985                return 10;
46986              }
46987            }), eN)) || tN) || tN) || tN) || tN));
46988            m.Graphics = dN;
46989            var pN, mN, fN, gN, yN, bN, SN, AN, TN, vN, EN, CN, xN, wN, RN, IN, MN, BN, DN, PN, ON, NN, LN, FN, VN, kN, UN, GN, zN, HN, jN, XN, WN, YN, qN, KN, JN, ZN, QN, $N, tL, eL, iL, sL, nL, rL;
46990            let oL;
46991            !function(t) {
46992              t[t.SIMPLE = 0] = "SIMPLE";
46993              t[t.SLICED = 1] = "SLICED";
46994              t[t.TILED = 2] = "TILED";
46995              t[t.FILLED = 3] = "FILLED";
46996            }(oL || (oL = {}));
46997            he(oL);
46998            var aL;
46999            !function(t) {
47000              t[t.HORIZONTAL = 0] = "HORIZONTAL";
47001              t[t.VERTICAL = 1] = "VERTICAL";
47002              t[t.RADIAL = 2] = "RADIAL";
47003            }(aL || (aL = {}));
47004            he(aL);
47005            var lL;
47006            !function(t) {
47007              t[t.CUSTOM = 0] = "CUSTOM";
47008              t[t.TRIMMED = 1] = "TRIMMED";
47009              t[t.RAW = 2] = "RAW";
47010            }(lL || (lL = {}));
47011            he(lL);
47012            var hL;
47013            !function(t) {
47014              t.SPRITE_FRAME_CHANGED = "spriteframe-changed";
47015            }(hL || (hL = {}));
47016            let cL = function(e) {
47017              return t({
47018                Sprite: e,
47019                SpriteComponent: e
47020              }), e;
47021            }((pN = Ul("cc.Sprite"), mN = sh(), fN = zl(110), gN = $l(), yN = Th(WI), bN = ph(),
47022            SN = lh(), AN = Th(GI), TN = ph(), vN = lh(), EN = Th(oL), CN = ph(), xN = lh(),
47023            wN = Th(aL), RN = ph(), IN = lh(), MN = ph(), BN = lh(), DN = hh(), PN = ph(), ON = lh(),
47024            NN = hh(), LN = ph(), FN = lh(), VN = rh(), kN = ph(), UN = lh(), GN = ph(), zN = lh(),
47025            HN = Th(lL), jN = ph(), XN = lh(), pN(WN = mN(WN = fN(WN = gN(WN = (YN = (rL = nL = class t extends uD {
47026              constructor(...t) {
47027                super(...t);
47028                Ml(this, "_spriteFrame", qN, this);
47029                Ml(this, "_type", KN, this);
47030                Ml(this, "_fillType", JN, this);
47031                Ml(this, "_sizeMode", ZN, this);
47032                Ml(this, "_fillCenter", QN, this);
47033                Ml(this, "_fillStart", $N, this);
47034                Ml(this, "_fillRange", tL, this);
47035                Ml(this, "_isTrimmedMode", eL, this);
47036                Ml(this, "_useGrayscale", iL, this);
47037                Ml(this, "_atlas", sL, this);
47038              }
47039              get spriteAtlas() {
47040                return this._atlas;
47041              }
47042              set spriteAtlas(t) {
47043                this._atlas !== t && (this._atlas = t);
47044              }
47045              get spriteFrame() {
47046                return this._spriteFrame;
47047              }
47048              set spriteFrame(t) {
47049                if (this._spriteFrame === t) return;
47050                const e = this._spriteFrame;
47051                this._spriteFrame = t;
47052                this.markForUpdateRenderData();
47053                this._applySpriteFrame(e);
47054              }
47055              get type() {
47056                return this._type;
47057              }
47058              set type(t) {
47059                if (this._type !== t) {
47060                  this._type = t;
47061                  this._flushAssembler();
47062                }
47063              }
47064              get fillType() {
47065                return this._fillType;
47066              }
47067              set fillType(t) {
47068                this._fillType !== t && (t === aL.RADIAL || this._fillType === aL.RADIAL ? this.destroyRenderData() : this.renderData && this.markForUpdateRenderData(!0));
47069                this._fillType = t;
47070                this._flushAssembler();
47071              }
47072              get fillCenter() {
47073                return this._fillCenter;
47074              }
47075              set fillCenter(t) {
47076                this._fillCenter.x = t.x;
47077                this._fillCenter.y = t.y;
47078                this._type === oL.FILLED && this.renderData && this.markForUpdateRenderData();
47079              }
47080              get fillStart() {
47081                return this._fillStart;
47082              }
47083              set fillStart(t) {
47084                this._fillStart = _i(t, 0, 1);
47085                if (this._type === oL.FILLED && this.renderData) {
47086                  this.markForUpdateRenderData();
47087                  this._updateUVs();
47088                }
47089              }
47090              get fillRange() {
47091                return this._fillRange;
47092              }
47093              set fillRange(t) {
47094                this._fillRange = _i(t, -1, 1);
47095                if (this._type === oL.FILLED && this.renderData) {
47096                  this.markForUpdateRenderData();
47097                  this._updateUVs();
47098                }
47099              }
47100              get trim() {
47101                return this._isTrimmedMode;
47102              }
47103              set trim(t) {
47104                if (this._isTrimmedMode !== t) {
47105                  this._isTrimmedMode = t;
47106                  this._type === oL.SIMPLE && this.renderData && this.markForUpdateRenderData(!0);
47107                }
47108              }
47109              get grayscale() {
47110                return this._useGrayscale;
47111              }
47112              set grayscale(t) {
47113                if (this._useGrayscale !== t) {
47114                  this._useGrayscale = t;
47115                  this.changeMaterialForDefine();
47116                  this.updateMaterial();
47117                }
47118              }
47119              get sizeMode() {
47120                return this._sizeMode;
47121              }
47122              set sizeMode(t) {
47123                if (this._sizeMode !== t) {
47124                  this._sizeMode = t;
47125                  t !== lL.CUSTOM && this._applySpriteSize();
47126                }
47127              }
47128              __preload() {
47129                this.changeMaterialForDefine();
47130                super.__preload();
47131              }
47132              onEnable() {
47133                super.onEnable();
47134                this._activateMaterial();
47135                const t = this._spriteFrame;
47136                if (t) {
47137                  this._updateUVs();
47138                  this._type === oL.SLICED && t.on(GI.EVENT_UV_UPDATED, this._updateUVs, this);
47139                }
47140              }
47141              onDisable() {
47142                super.onDisable();
47143                this._spriteFrame && this._type === oL.SLICED && this._spriteFrame.off(GI.EVENT_UV_UPDATED, this._updateUVs, this);
47144              }
47145              onDestroy() {
47146                super.onDestroy();
47147              }
47148              changeSpriteFrameFromAtlas(t) {
47149                if (!this._atlas) {
47150                  console.warn("SpriteAtlas is null.");
47151                  return;
47152                }
47153                const e = this._atlas.getSpriteFrame(t);
47154                this.spriteFrame = e;
47155              }
47156              changeMaterialForDefine() {
47157                let t;
47158                const e = this._instanceMaterialType;
47159                this._spriteFrame && (t = this._spriteFrame.texture);
47160                let i = !1;
47161                if (t instanceof tm) {
47162                  const e = t.getPixelFormat();
47163                  i = e === Jp.RGBA_ETC1 || e === Jp.RGB_A_PVRTC_4BPPV1 || e === Jp.RGB_A_PVRTC_2BPPV1;
47164                }
47165                i && this.grayscale ? this._instanceMaterialType = cD.USE_ALPHA_SEPARATED_AND_GRAY : i ? this._instanceMaterialType = cD.USE_ALPHA_SEPARATED : this.grayscale ? this._instanceMaterialType = cD.GRAYSCALE : this._instanceMaterialType = cD.ADD_COLOR_AND_TEXTURE;
47166                e !== this._instanceMaterialType && this.updateMaterial();
47167              }
47168              _updateBuiltinMaterial() {
47169                let t = super._updateBuiltinMaterial();
47170                if (this.spriteFrame && this.spriteFrame.texture instanceof Vg) {
47171                  const e = {
47172                    SAMPLE_FROM_RT: !0,
47173                    ...t.passes[0].defines
47174                  };
47175                  const i = new hm;
47176                  i.initialize({
47177                    effectAsset: t.effectAsset,
47178                    defines: e
47179                  });
47180                  t = i;
47181                }
47182                return t;
47183              }
47184              _render(t) {
47185                t.commitComp(this, this.renderData, this._spriteFrame, this._assembler, null);
47186              }
47187              _canRender() {
47188                if (!super._canRender()) return !1;
47189                const t = this._spriteFrame;
47190                return !(!t || !t.texture);
47191              }
47192              _flushAssembler() {
47193                const e = t.Assembler.getAssembler(this);
47194                if (this._assembler !== e) {
47195                  this.destroyRenderData();
47196                  this._assembler = e;
47197                }
47198                if (!this.renderData && this._assembler && this._assembler.createData) {
47199                  this._renderData = this._assembler.createData(this);
47200                  this.renderData.material = this.getRenderMaterial(0);
47201                  this.markForUpdateRenderData();
47202                  this.spriteFrame && this._assembler.updateUVs(this);
47203                  this._updateColor();
47204                }
47205                this._spriteFrame && (this._type === oL.SLICED ? this._spriteFrame.on(GI.EVENT_UV_UPDATED, this._updateUVs, this) : this._spriteFrame.off(GI.EVENT_UV_UPDATED, this._updateUVs, this));
47206              }
47207              _applySpriteSize() {
47208                if (this._spriteFrame) if (lL.RAW === this._sizeMode) {
47209                  const t = this._spriteFrame.originalSize;
47210                  this.node._uiProps.uiTransformComp.setContentSize(t);
47211                } else if (lL.TRIMMED === this._sizeMode) {
47212                  const t = this._spriteFrame.rect;
47213                  this.node._uiProps.uiTransformComp.setContentSize(t.width, t.height);
47214                }
47215              }
47216              _resized() {}
47217              _activateMaterial() {
47218                const t = this._spriteFrame;
47219                const e = this.getRenderMaterial(0);
47220                t && e && this.markForUpdateRenderData();
47221                this.renderData && (this.renderData.material = e);
47222              }
47223              _updateUVs() {
47224                this._assembler && this._assembler.updateUVs(this);
47225              }
47226              _applySpriteFrame(t) {
47227                const e = this._spriteFrame;
47228                t && this._type === oL.SLICED && t.off(GI.EVENT_UV_UPDATED, this._updateUVs, this);
47229                let i = !1;
47230                if (e) {
47231                  t && t.texture === e.texture || (i = !0);
47232                  if (i) {
47233                    this.renderData && (this.renderData.textureDirty = !0);
47234                    this.changeMaterialForDefine();
47235                  }
47236                  this._applySpriteSize();
47237                  this._type === oL.SLICED && e.on(GI.EVENT_UV_UPDATED, this._updateUVs, this);
47238                }
47239              }
47240            }, nL.FillType = aL, nL.Type = oL, nL.SizeMode = lL, nL.EventType = hL, rL), Bl(YN.prototype, "spriteAtlas", [ yN, bN, SN ], Object.getOwnPropertyDescriptor(YN.prototype, "spriteAtlas"), YN.prototype),
47241            Bl(YN.prototype, "spriteFrame", [ AN, TN, vN ], Object.getOwnPropertyDescriptor(YN.prototype, "spriteFrame"), YN.prototype),
47242            Bl(YN.prototype, "type", [ EN, CN, xN ], Object.getOwnPropertyDescriptor(YN.prototype, "type"), YN.prototype),
47243            Bl(YN.prototype, "fillType", [ wN, RN, IN ], Object.getOwnPropertyDescriptor(YN.prototype, "fillType"), YN.prototype),
47244            Bl(YN.prototype, "fillCenter", [ MN, BN ], Object.getOwnPropertyDescriptor(YN.prototype, "fillCenter"), YN.prototype),
47245            Bl(YN.prototype, "fillStart", [ DN, PN, ON ], Object.getOwnPropertyDescriptor(YN.prototype, "fillStart"), YN.prototype),
47246            Bl(YN.prototype, "fillRange", [ NN, LN, FN ], Object.getOwnPropertyDescriptor(YN.prototype, "fillRange"), YN.prototype),
47247            Bl(YN.prototype, "trim", [ VN, kN, UN ], Object.getOwnPropertyDescriptor(YN.prototype, "trim"), YN.prototype),
47248            Bl(YN.prototype, "grayscale", [ nh, GN, zN ], Object.getOwnPropertyDescriptor(YN.prototype, "grayscale"), YN.prototype),
47249            Bl(YN.prototype, "sizeMode", [ HN, jN, XN ], Object.getOwnPropertyDescriptor(YN.prototype, "sizeMode"), YN.prototype),
47250            qN = Bl(YN.prototype, "_spriteFrame", [ Yl ], {
47251              configurable: !0,
47252              enumerable: !0,
47253              writable: !0,
47254              initializer: function() {
47255                return null;
47256              }
47257            }), KN = Bl(YN.prototype, "_type", [ Yl ], {
47258              configurable: !0,
47259              enumerable: !0,
47260              writable: !0,
47261              initializer: function() {
47262                return oL.SIMPLE;
47263              }
47264            }), JN = Bl(YN.prototype, "_fillType", [ Yl ], {
47265              configurable: !0,
47266              enumerable: !0,
47267              writable: !0,
47268              initializer: function() {
47269                return aL.HORIZONTAL;
47270              }
47271            }), ZN = Bl(YN.prototype, "_sizeMode", [ Yl ], {
47272              configurable: !0,
47273              enumerable: !0,
47274              writable: !0,
47275              initializer: function() {
47276                return lL.TRIMMED;
47277              }
47278            }), QN = Bl(YN.prototype, "_fillCenter", [ Yl ], {
47279              configurable: !0,
47280              enumerable: !0,
47281              writable: !0,
47282              initializer: function() {
47283                return new Qi(0, 0);
47284              }
47285            }), $N = Bl(YN.prototype, "_fillStart", [ Yl ], {
47286              configurable: !0,
47287              enumerable: !0,
47288              writable: !0,
47289              initializer: function() {
47290                return 0;
47291              }
47292            }), tL = Bl(YN.prototype, "_fillRange", [ Yl ], {
47293              configurable: !0,
47294              enumerable: !0,
47295              writable: !0,
47296              initializer: function() {
47297                return 0;
47298              }
47299            }), eL = Bl(YN.prototype, "_isTrimmedMode", [ Yl ], {
47300              configurable: !0,
47301              enumerable: !0,
47302              writable: !0,
47303              initializer: function() {
47304                return !0;
47305              }
47306            }), iL = Bl(YN.prototype, "_useGrayscale", [ Yl ], {
47307              configurable: !0,
47308              enumerable: !0,
47309              writable: !0,
47310              initializer: function() {
47311                return !1;
47312              }
47313            }), sL = Bl(YN.prototype, "_atlas", [ Yl ], {
47314              configurable: !0,
47315              enumerable: !0,
47316              writable: !0,
47317              initializer: function() {
47318                return null;
47319              }
47320            }), YN)) || WN) || WN) || WN) || WN));
47321            m.Sprite = cL;
47322            var uL, _L, dL, pL, mL, fL, gL, yL, bL, SL, AL, TL, vL, EL, CL, xL, wL, RL, IL;
47323            const ML = new qi;
47324            const BL = new Qi;
47325            const DL = new qi;
47326            const PL = [];
47327            let OL;
47328            !function(t) {
47329              t[t.GRAPHICS_RECT = 0] = "GRAPHICS_RECT";
47330              t[t.GRAPHICS_ELLIPSE = 1] = "GRAPHICS_ELLIPSE";
47331              t[t.GRAPHICS_STENCIL = 2] = "GRAPHICS_STENCIL";
47332              t[t.SPRITE_STENCIL = 3] = "SPRITE_STENCIL";
47333            }(OL || (OL = {}));
47334            he(OL);
47335            let NL = function(e) {
47336              return t({
47337                Mask: e,
47338                MaskComponent: e
47339              }), e;
47340            }((uL = Ul("cc.Mask"), _L = sh(), dL = zl(110), pL = $l(), mL = Th(OL), fL = lh(),
47341            gL = ph(), yL = lh(), bL = rh(), SL = rh(), AL = hh(), uL(TL = _L(TL = dL(TL = pL(TL = Ql(TL = (vL = (IL = RL = class extends Qc {
47342              constructor(...t) {
47343                super(...t);
47344                Ml(this, "_type", EL, this);
47345                Ml(this, "_inverted", CL, this);
47346                Ml(this, "_segments", xL, this);
47347                Ml(this, "_alphaThreshold", wL, this);
47348                this._sprite = null;
47349                this._graphics = null;
47350                this._stencilStage = lB.DISABLED;
47351              }
47352              get type() {
47353                return this._type;
47354              }
47355              set type(t) {
47356                if (this._type !== t) {
47357                  this._type = t;
47358                  if (this._type !== OL.SPRITE_STENCIL) {
47359                    if (this._sprite) {
47360                      this.node.removeComponent(cL);
47361                      this._sprite._destroyImmediate();
47362                      this._sprite = null;
47363                    }
47364                    this._changeRenderType();
47365                    this._updateGraphics();
47366                    this.subComp.renderEntity.setMaskMode(this._inverted ? mB.MASK_INVERTED : mB.MASK);
47367                  } else {
47368                    if (this._graphics) {
47369                      this._graphics.clear();
47370                      this.node.removeComponent(dN);
47371                      this._graphics._destroyImmediate();
47372                      this._graphics = null;
47373                    }
47374                    this._changeRenderType();
47375                    this.subComp.renderEntity.setMaskMode(this._inverted ? mB.MASK_INVERTED : mB.MASK);
47376                  }
47377                }
47378              }
47379              get inverted() {
47380                return this._inverted;
47381              }
47382              set inverted(t) {
47383                this._inverted = t;
47384                this.subComp.stencilStage = this.inverted ? lB.ENTER_LEVEL_INVERTED : lB.ENTER_LEVEL;
47385                this.subComp.renderEntity.setMaskMode(this._inverted ? mB.MASK_INVERTED : mB.MASK);
47386              }
47387              get segments() {
47388                return this._segments;
47389              }
47390              set segments(t) {
47391                if (this._segments !== t) {
47392                  this._segments = _i(t, 3, 1e4);
47393                  this._updateGraphics();
47394                }
47395              }
47396              get spriteFrame() {
47397                return this._sprite ? this._sprite.spriteFrame : null;
47398              }
47399              set spriteFrame(t) {
47400                this._sprite ? this._sprite.spriteFrame = t : console.error("please change type to sprite_stencil first");
47401              }
47402              get alphaThreshold() {
47403                return this._alphaThreshold;
47404              }
47405              set alphaThreshold(t) {
47406                if (this._alphaThreshold !== t) {
47407                  this._alphaThreshold = t;
47408                  if (this.type === OL.SPRITE_STENCIL && this._sprite) {
47409                    this._sprite.getMaterialInstance(0).setProperty("alphaThreshold", this._alphaThreshold);
47410                  }
47411                }
47412              }
47413              get subComp() {
47414                return this._graphics || this._sprite;
47415              }
47416              onLoad() {
47417                this._changeRenderType();
47418                this.subComp && this.subComp.renderEntity.setMaskMode(this._inverted ? mB.MASK_INVERTED : mB.MASK);
47419              }
47420              onEnable() {
47421                this._changeRenderType();
47422                this._updateGraphics();
47423                this._enableRender();
47424                this.node.on(ny.ANCHOR_CHANGED, this._nodeStateChange, this);
47425                this.node.on(ny.SIZE_CHANGED, this._nodeStateChange, this);
47426              }
47427              onRestore() {
47428                this._changeRenderType();
47429                this._updateGraphics();
47430              }
47431              onDisable() {
47432                this._disableRender();
47433                this.node.off(ny.ANCHOR_CHANGED, this._nodeStateChange, this);
47434                this.node.off(ny.SIZE_CHANGED, this._nodeStateChange, this);
47435              }
47436              onDestroy() {
47437                this._removeMaskNode();
47438              }
47439              isHit(t) {
47440                const e = this.node._uiProps.uiTransformComp;
47441                const i = e.contentSize;
47442                const s = i.width;
47443                const n = i.height;
47444                const r = BL;
47445                this.node.getWorldMatrix(ML);
47446                qi.invert(DL, ML);
47447                Qi.transformMat4(r, t, DL);
47448                const o = e.anchorPoint;
47449                r.x += o.x * s;
47450                r.y += o.y * n;
47451                let a = !1;
47452                if (this.type === OL.GRAPHICS_RECT || this.type === OL.GRAPHICS_STENCIL || this.type === OL.SPRITE_STENCIL) a = r.x >= 0 && r.y >= 0 && r.x <= s && r.y <= n; else if (this.type === OL.GRAPHICS_ELLIPSE) {
47453                  const t = s / 2;
47454                  const e = n / 2;
47455                  const i = r.x - .5 * s;
47456                  const o = r.y - .5 * n;
47457                  a = i * i / (t * t) + o * o / (e * e) < 1;
47458                }
47459                this._inverted && (a = !a);
47460                return a;
47461              }
47462              _nodeStateChange(t) {
47463                this._updateGraphics();
47464              }
47465              _changeRenderType() {
47466                this._type !== OL.SPRITE_STENCIL ? this._createGraphics() : this._createSprite();
47467              }
47468              _createSprite() {
47469                if (!this._sprite) {
47470                  let t = this._sprite = this.node.getComponent(cL);
47471                  if (!t) {
47472                    const e = this.node;
47473                    t = this._sprite = e.addComponent(cL);
47474                  }
47475                  t.color = Bi.WHITE.clone();
47476                  t.sizeMode = 0;
47477                }
47478                this._sprite.stencilStage = this.inverted ? lB.ENTER_LEVEL_INVERTED : lB.ENTER_LEVEL;
47479                this._sprite.updateMaterial();
47480              }
47481              _createGraphics() {
47482                if (!this._graphics) {
47483                  let t = this._graphics = this.node.getComponent(dN);
47484                  if (!t) {
47485                    const e = this.node;
47486                    t = this._graphics = e.addComponent(dN);
47487                  }
47488                  t.lineWidth = 1;
47489                  const e = Bi.WHITE.clone();
47490                  e.a = 0;
47491                  t.fillColor = e;
47492                }
47493                this._graphics.stencilStage = this.inverted ? lB.ENTER_LEVEL_INVERTED : lB.ENTER_LEVEL;
47494              }
47495              _updateGraphics() {
47496                if (!this._graphics || this._type !== OL.GRAPHICS_RECT && this._type !== OL.GRAPHICS_ELLIPSE) return;
47497                const t = this.node._uiProps.uiTransformComp;
47498                const e = this._graphics;
47499                e.clear();
47500                const i = t.contentSize;
47501                const s = i.width;
47502                const n = i.height;
47503                const r = t.anchorPoint;
47504                const o = -s * r.x;
47505                const a = -n * r.y;
47506                if (this._type === OL.GRAPHICS_RECT) e.rect(o, a, s, n); else if (this._type === OL.GRAPHICS_ELLIPSE) {
47507                  const t = function(t, e, i) {
47508                    PL.length = 0;
47509                    const s = 2 * Math.PI / i;
47510                    for (let n = 0; n < i; ++n) PL.push(new Pi(e.x * Math.cos(s * n) + t.x, e.y * Math.sin(s * n) + t.y, 0));
47511                    return PL;
47512                  }(new Pi(o + s / 2, a + n / 2, 0), new Pi(s / 2, n / 2, 0), this._segments);
47513                  for (let i = 0; i < t.length; ++i) {
47514                    const s = t[i];
47515                    0 === i ? e.moveTo(s.x, s.y) : e.lineTo(s.x, s.y);
47516                  }
47517                  e.close();
47518                }
47519                e.fill();
47520              }
47521              _enableRender() {
47522                this.subComp && (this.subComp.enabled = !0);
47523              }
47524              _disableRender() {
47525                if (this.subComp) {
47526                  this.subComp.stencilStage = lB.DISABLED;
47527                  this.subComp.updateMaterial();
47528                  this.node.activeInHierarchy && (this.subComp.enabled = !1);
47529                }
47530              }
47531              _removeMaskNode() {
47532                if (this._sprite) {
47533                  this._sprite.destroy();
47534                  this._sprite = null;
47535                }
47536                if (this._graphics) {
47537                  this._graphics.destroy();
47538                  this._graphics = null;
47539                }
47540              }
47541              get customMaterial() {
47542                N(9007);
47543                return this.subComp ? this.subComp.customMaterial : null;
47544              }
47545              set customMaterial(t) {
47546                N(9007);
47547                this.subComp && (this.subComp.customMaterial = t);
47548              }
47549              get color() {
47550                N(9007);
47551                return this.subComp ? this.subComp.color : null;
47552              }
47553              set color(t) {
47554                N(9007);
47555                this.subComp && t && (this.subComp.color = t);
47556              }
47557              markForUpdateRenderData(t = !0) {
47558                N(9007);
47559                this.subComp && this.subComp.markForUpdateRenderData(t);
47560              }
47561              requestRenderData(t) {
47562                N(9007);
47563              }
47564              destroyRenderData() {
47565                N(9007);
47566              }
47567              updateRenderer() {
47568                N(9007);
47569                this.subComp && this.subComp.updateRenderer();
47570              }
47571              fillBuffers(t) {
47572                N(9007);
47573              }
47574              postUpdateAssembler(t) {
47575                N(9007);
47576              }
47577              setNodeDirty() {
47578                N(9007);
47579                this.subComp && this.subComp.setNodeDirty();
47580              }
47581              setTextureDirty() {
47582                N(9007);
47583                this.subComp && this.subComp.setTextureDirty();
47584              }
47585              get sharedMaterial() {
47586                N(9007);
47587                return this.subComp ? this.subComp.sharedMaterial : null;
47588              }
47589              get sharedMaterials() {
47590                N(9007);
47591                return this.subComp ? this.subComp.sharedMaterials : null;
47592              }
47593              set sharedMaterials(t) {
47594                N(9007);
47595                this.subComp && t && (this.subComp.sharedMaterials = t);
47596              }
47597              get material() {
47598                N(9007);
47599                return this.subComp ? this.subComp.material : null;
47600              }
47601              set material(t) {
47602                N(9007);
47603                this.subComp && (this.subComp.material = t);
47604              }
47605              get materials() {
47606                N(9007);
47607                return this.subComp ? this.subComp.materials : [ null ];
47608              }
47609              set materials(t) {
47610                N(9007);
47611                this.subComp && (this.subComp.materials = t);
47612              }
47613              getMaterial(t) {
47614                N(9007);
47615                return this.subComp ? this.subComp.getMaterial(t) : null;
47616              }
47617              setMaterial(t, e) {
47618                N(9007);
47619                this.subComp && this.subComp.setMaterial(t, e);
47620              }
47621              getMaterialInstance(t) {
47622                N(9007);
47623                return this.subComp ? this.subComp.getMaterialInstance(t) : null;
47624              }
47625              setMaterialInstance(t, e) {
47626                N(9007);
47627                this.subComp && this.subComp.setMaterialInstance(t, e);
47628              }
47629              getRenderMaterial(t) {
47630                N(9007);
47631                return this.subComp ? this.subComp.getRenderMaterial(t) : null;
47632              }
47633            }, RL.Type = OL, IL), Bl(vL.prototype, "type", [ mL, fL ], Object.getOwnPropertyDescriptor(vL.prototype, "type"), vL.prototype),
47634            Bl(vL.prototype, "inverted", [ gL, yL ], Object.getOwnPropertyDescriptor(vL.prototype, "inverted"), vL.prototype),
47635            Bl(vL.prototype, "segments", [ bL ], Object.getOwnPropertyDescriptor(vL.prototype, "segments"), vL.prototype),
47636            Bl(vL.prototype, "alphaThreshold", [ SL, AL, dh ], Object.getOwnPropertyDescriptor(vL.prototype, "alphaThreshold"), vL.prototype),
47637            EL = Bl(vL.prototype, "_type", [ Yl ], {
47638              configurable: !0,
47639              enumerable: !0,
47640              writable: !0,
47641              initializer: function() {
47642                return OL.GRAPHICS_RECT;
47643              }
47644            }), CL = Bl(vL.prototype, "_inverted", [ Yl ], {
47645              configurable: !0,
47646              enumerable: !0,
47647              writable: !0,
47648              initializer: function() {
47649                return !1;
47650              }
47651            }), xL = Bl(vL.prototype, "_segments", [ Yl ], {
47652              configurable: !0,
47653              enumerable: !0,
47654              writable: !0,
47655              initializer: function() {
47656                return 64;
47657              }
47658            }), wL = Bl(vL.prototype, "_alphaThreshold", [ Yl ], {
47659              configurable: !0,
47660              enumerable: !0,
47661              writable: !0,
47662              initializer: function() {
47663                return .1;
47664              }
47665            }), vL)) || TL) || TL) || TL) || TL) || TL));
47666            KS._maskComp = NL;
47667            m.Mask = NL;
47668            const LL = /^(click)(\s)*=|(param)(\s)*=/;
47669            const FL = /(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;
47670            class VL {
47671              constructor() {
47672                this._specialSymbolArray = [];
47673                this._stack = [];
47674                this._resultObjectArray = [];
47675                this._specialSymbolArray.push([ /&lt;/g, "<" ]);
47676                this._specialSymbolArray.push([ /&gt;/g, ">" ]);
47677                this._specialSymbolArray.push([ /&amp;/g, "&" ]);
47678                this._specialSymbolArray.push([ /&quot;/g, '"' ]);
47679                this._specialSymbolArray.push([ /&apos;/g, "'" ]);
47680              }
47681              parse(t) {
47682                this._resultObjectArray.length = 0;
47683                this._stack.length = 0;
47684                let e = 0;
47685                const i = t.length;
47686                for (;e < i; ) {
47687                  let s = t.indexOf(">", e);
47688                  let n = -1;
47689                  if (s >= 0) {
47690                    n = t.lastIndexOf("<", s);
47691                    if (n < e - 1) {
47692                      n = t.indexOf("<", s + 1);
47693                      s = t.indexOf(">", n + 1);
47694                    }
47695                  }
47696                  if (n < 0) {
47697                    this._stack.pop();
47698                    this._processResult(t.substring(e));
47699                    e = i;
47700                  } else {
47701                    let i = t.substring(e, n);
47702                    const r = t.substring(n + 1, s);
47703                    "" === r && (i = t.substring(e, s + 1));
47704                    this._processResult(i);
47705                    -1 === s ? s = n : "/" === t.charAt(n + 1) ? this._stack.pop() : this._addToStack(r);
47706                    e = s + 1;
47707                  }
47708                }
47709                return this._resultObjectArray;
47710              }
47711              _attributeToObject(t) {
47712                t = t.trim();
47713                const e = {};
47714                let i = /^(color|size)(\s)*=/.exec(t);
47715                let s = "";
47716                let n = 0;
47717                let r = "";
47718                if (i) {
47719                  s = i[0];
47720                  if ("" === (t = t.substring(s.length).trim())) return e;
47721                  n = t.indexOf(" ");
47722                  switch (s[0]) {
47723                   case "c":
47724                    e.color = n > -1 ? t.substring(0, n).trim() : t;
47725                    break;
47726
47727                   case "s":
47728                    e.size = parseInt(t);
47729                  }
47730                  if (n > -1) {
47731                    r = t.substring(n + 1).trim();
47732                    e.event = this._processEventHandler(r);
47733                  }
47734                  return e;
47735                }
47736                i = /^(br(\s)*\/)/.exec(t);
47737                if (i && i[0].length > 0) {
47738                  s = i[0].trim();
47739                  if (s.startsWith("br") && "/" === s[s.length - 1]) {
47740                    e.isNewLine = !0;
47741                    this._resultObjectArray.push({
47742                      text: "",
47743                      style: {
47744                        isNewLine: !0
47745                      }
47746                    });
47747                    return e;
47748                  }
47749                }
47750                i = /^(img(\s)*src(\s)*=[^>]+\/)/.exec(t);
47751                let o = "";
47752                let a = -1;
47753                if (i && i[0].length > 0) {
47754                  s = i[0].trim();
47755                  if (s.startsWith("img") && "/" === s[s.length - 1]) {
47756                    i = FL.exec(t);
47757                    let r;
47758                    let l = !1;
47759                    for (;i; ) {
47760                      s = (t = t.substring(t.indexOf(i[0]))).substr(0, i[0].length);
47761                      const h = s.length;
47762                      s = s.replace(/[^a-zA-Z]/g, "").trim();
47763                      s = s.toLowerCase();
47764                      o = t.substring(h).trim();
47765                      a = "src" === s ? this.getRightQuotationIndex(o) : -1;
47766                      n = o.indexOf(" ", a + 1 >= o.length ? -1 : a + 1);
47767                      r = n > -1 ? o.substr(0, n) : o;
47768                      t = o.substring(n).trim();
47769                      r.endsWith("/") && (r = r.slice(0, -1));
47770                      if ("src" === s) {
47771                        switch (r.charCodeAt(0)) {
47772                         case 34:
47773                         case 39:
47774                          l = !0;
47775                          r = r.slice(1, -1);
47776                        }
47777                        e.isImage = !0;
47778                        e.src = r;
47779                      } else if ("height" === s) e.imageHeight = parseInt(r); else if ("width" === s) e.imageWidth = parseInt(r); else if ("align" === s) {
47780                        switch (r.charCodeAt(0)) {
47781                         case 34:
47782                         case 39:
47783                          r = r.slice(1, -1);
47784                        }
47785                        e.imageAlign = r.toLowerCase();
47786                      } else "offset" === s ? e.imageOffset = r : "click" === s && (e.event = this._processEventHandler(`${s}=${r}`));
47787                      e.event && "param" === s && (e.event[s] = r.replace(/^"|"$/g, ""));
47788                      i = FL.exec(t);
47789                    }
47790                    l && e.isImage && this._resultObjectArray.push({
47791                      text: "",
47792                      style: e
47793                    });
47794                    return {};
47795                  }
47796                }
47797                i = /^(outline(\s)*[^>]*)/.exec(t);
47798                if (i) {
47799                  const r = {
47800                    color: "#ffffff",
47801                    width: 1
47802                  };
47803                  if (t = i[0].substring("outline".length).trim()) {
47804                    const a = /(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;
47805                    i = a.exec(t);
47806                    let l;
47807                    for (;i; ) {
47808                      s = (t = t.substring(t.indexOf(i[0]))).substr(0, i[0].length);
47809                      o = t.substring(s.length).trim();
47810                      n = o.indexOf(" ");
47811                      l = n > -1 ? o.substr(0, n) : o;
47812                      s = s.replace(/[^a-zA-Z]/g, "").trim();
47813                      s = s.toLowerCase();
47814                      t = o.substring(n).trim();
47815                      "click" === s ? e.event = this._processEventHandler(`${s}=${l}`) : "color" === s ? r.color = l : "width" === s && (r.width = parseInt(l));
47816                      e.event && "param" === s && (e.event[s] = l.replace(/^"|"$/g, ""));
47817                      i = a.exec(t);
47818                    }
47819                  }
47820                  e.outline = r;
47821                }
47822                i = /^(on|u|b|i)(\s)*/.exec(t);
47823                if (i && i[0].length > 0) {
47824                  s = i[0];
47825                  t = t.substring(s.length).trim();
47826                  switch (s[0]) {
47827                   case "u":
47828                    e.underline = !0;
47829                    break;
47830
47831                   case "i":
47832                    e.italic = !0;
47833                    break;
47834
47835                   case "b":
47836                    e.bold = !0;
47837                  }
47838                  if ("" === t) return e;
47839                  e.event = this._processEventHandler(t);
47840                }
47841                return e;
47842              }
47843              getRightQuotationIndex(t) {
47844                let e = -1;
47845                let i = -1;
47846                const s = t.indexOf("'");
47847                const n = t.indexOf('"');
47848                const r = n > -1 && (n < s || -1 === s);
47849                if (s > -1 && (s < n || -1 === n)) {
47850                  e = s;
47851                  i = t.indexOf("'", e + 1 >= t.length ? -1 : e + 1);
47852                } else if (r) {
47853                  e = n;
47854                  i = t.indexOf('"', e + 1 >= t.length ? -1 : e + 1);
47855                }
47856                return i;
47857              }
47858              _processEventHandler(t) {
47859                const e = {};
47860                let i = 0;
47861                let s = !1;
47862                let n = LL.exec(t);
47863                for (;n; ) {
47864                  let r = n[0];
47865                  let o = "";
47866                  s = !1;
47867                  if ('"' === (t = t.substring(r.length).trim()).charAt(0)) {
47868                    i = t.indexOf('"', 1);
47869                    if (i > -1) {
47870                      o = t.substring(1, i).trim();
47871                      s = !0;
47872                    }
47873                    i++;
47874                  } else if ("'" === t.charAt(0)) {
47875                    i = t.indexOf("'", 1);
47876                    if (i > -1) {
47877                      o = t.substring(1, i).trim();
47878                      s = !0;
47879                    }
47880                    i++;
47881                  } else {
47882                    const e = /(\S)+/.exec(t);
47883                    o = e ? e[0] : "";
47884                    i = o.length;
47885                  }
47886                  if (s) {
47887                    r = r.substring(0, r.length - 1).trim();
47888                    e[r] = o;
47889                  }
47890                  t = t.substring(i).trim();
47891                  n = LL.exec(t);
47892                }
47893                return e;
47894              }
47895              _addToStack(t) {
47896                const e = this._attributeToObject(t);
47897                if (0 === this._stack.length) this._stack.push(e); else {
47898                  if (e.isNewLine || e.isImage) return;
47899                  const t = this._stack[this._stack.length - 1];
47900                  for (const i in t) e[i] || (e[i] = t[i]);
47901                  this._stack.push(e);
47902                }
47903              }
47904              _processResult(t) {
47905                if (0 !== t.length) {
47906                  t = this._escapeSpecialSymbol(t);
47907                  this._stack.length > 0 ? this._resultObjectArray.push({
47908                    text: t,
47909                    style: this._stack[this._stack.length - 1]
47910                  }) : this._resultObjectArray.push({
47911                    text: t
47912                  });
47913                }
47914              }
47915              _escapeSpecialSymbol(t) {
47916                for (const e of this._specialSymbolArray) {
47917                  const i = e[0];
47918                  const s = e[1];
47919                  t = t.replace(i, s);
47920                }
47921                return t;
47922              }
47923            }
47924            t("HtmlTextParser", VL);
47925            var kL, UL, GL, zL, HL, jL, XL, WL, YL, qL, KL, JL;
47926            let ZL = function(e) {
47927              return t({
47928                LabelOutline: e,
47929                LabelOutlineComponent: e
47930              }), e;
47931            }((kL = Ul("cc.LabelOutline"), UL = sh(), GL = zl(110), zL = $l(), HL = Gl(IP),
47932            jL = lh(), XL = lh(), kL(WL = UL(WL = GL(WL = zL(WL = HL(WL = Ql(WL = (YL = (JL = class extends Qc {
47933              constructor(...t) {
47934                super(...t);
47935                Ml(this, "_color", qL, this);
47936                Ml(this, "_width", KL, this);
47937              }
47938              get color() {
47939                return this._color;
47940              }
47941              set color(t) {
47942                if (this._color !== t) {
47943                  this._color.set(t);
47944                  this._updateRenderData();
47945                }
47946              }
47947              get width() {
47948                return this._width;
47949              }
47950              set width(t) {
47951                if (this._width !== t) {
47952                  this._width = t;
47953                  this._updateRenderData();
47954                }
47955              }
47956              onEnable() {
47957                this._updateRenderData();
47958              }
47959              onDisable() {
47960                this._updateRenderData();
47961              }
47962              _updateRenderData() {
47963                const t = this.node.getComponent(IP);
47964                t && t.updateRenderData(!0);
47965              }
47966            }, JL), qL = Bl(YL.prototype, "_color", [ Yl ], {
47967              configurable: !0,
47968              enumerable: !0,
47969              writable: !0,
47970              initializer: function() {
47971                return new Bi(0, 0, 0, 255);
47972              }
47973            }), KL = Bl(YL.prototype, "_width", [ Yl ], {
47974              configurable: !0,
47975              enumerable: !0,
47976              writable: !0,
47977              initializer: function() {
47978                return 2;
47979              }
47980            }), Bl(YL.prototype, "color", [ jL ], Object.getOwnPropertyDescriptor(YL.prototype, "color"), YL.prototype),
47981            Bl(YL.prototype, "width", [ XL ], Object.getOwnPropertyDescriptor(YL.prototype, "width"), YL.prototype),
47982            YL)) || WL) || WL) || WL) || WL) || WL) || WL));
47983            m.LabelOutline = ZL;
47984            et({
47985              RenderComponent: {
47986                newName: "UIRenderer",
47987                since: "1.2.0",
47988                removed: !0
47989              },
47990              UITransformComponent: {
47991                newName: "UITransform",
47992                since: "1.2.0",
47993                removed: !1
47994              },
47995              CanvasComponent: {
47996                newName: "Canvas",
47997                since: "1.2.0",
47998                removed: !1
47999              }
48000            });
48001            et({
48002              UIRenderable: {
48003                newName: "UIRenderer",
48004                since: "3.0.0",
48005                removed: !0
48006              }
48007            });
48008            et({
48009              Renderable2D: {
48010                newName: "UIRenderer",
48011                since: "3.6.0",
48012                removed: !0
48013              }
48014            });
48015            var QL;
48016            let $L = t("RenderRoot2D", Ul("cc.RenderRoot2D")(QL = zl(100)(QL = $l()(QL = Gl(jB)(QL = Hl(QL = Ql(QL = class extends Qc {
48017              onEnable() {
48018                m.director.root.batcher2D.addScreen(this);
48019              }
48020              onDisable() {
48021                m.director.root.batcher2D.removeScreen(this);
48022              }
48023              onDestroy() {
48024                m.director.root.batcher2D.removeScreen(this);
48025              }
48026            }) || QL) || QL) || QL) || QL) || QL) || QL);
48027            var tF, eF, iF, sF, nF, rF, oF, aF, lF, hF, cF, uF, _F;
48028            const dF = new Pi;
48029            const pF = oe({
48030              OVERLAY: 0,
48031              INTERSPERSE: 1
48032            });
48033            let mF = function(e) {
48034              return t({
48035                Canvas: e,
48036                CanvasComponent: e
48037              }), e;
48038            }((tF = Ul("cc.Canvas"), eF = sh(), iF = zl(100), sF = $l(), nF = Th(hS), rF = lh(),
48039            oF = lh(), aF = Th(hS), tF(lF = eF(lF = iF(lF = sF(lF = Ql(lF = Hl(lF = (hF = (_F = class extends $L {
48040              get renderMode() {
48041                return this._renderMode;
48042              }
48043              set renderMode(t) {
48044                this._renderMode = t;
48045                this._cameraComponent && (this._cameraComponent.priority = this._getViewPriority());
48046              }
48047              get cameraComponent() {
48048                return this._cameraComponent;
48049              }
48050              set cameraComponent(t) {
48051                if (this._cameraComponent !== t) {
48052                  this._cameraComponent = t;
48053                  this._onResizeCamera();
48054                }
48055              }
48056              get alignCanvasWithScreen() {
48057                return this._alignCanvasWithScreen;
48058              }
48059              set alignCanvasWithScreen(t) {
48060                this._alignCanvasWithScreen = t;
48061                this._onResizeCamera();
48062              }
48063              constructor() {
48064                super();
48065                Ml(this, "_cameraComponent", cF, this);
48066                Ml(this, "_alignCanvasWithScreen", uF, this);
48067                this._thisOnCameraResized = void 0;
48068                this._fitDesignResolution = void 0;
48069                this._pos = new Pi;
48070                this._renderMode = pF.OVERLAY;
48071                this._thisOnCameraResized = this._onResizeCamera.bind(this);
48072              }
48073              __preload() {
48074                const t = this.getComponent("cc.Widget");
48075                t && t.updateAlignment();
48076                if (this._cameraComponent) {
48077                  this._cameraComponent._createCamera();
48078                  this._cameraComponent.node.on(hS.TARGET_TEXTURE_CHANGE, this._thisOnCameraResized);
48079                }
48080                this._onResizeCamera();
48081                this.node.on(ny.TRANSFORM_CHANGED, this._thisOnCameraResized);
48082              }
48083              onEnable() {
48084                super.onEnable();
48085                this._cameraComponent && this._cameraComponent.node.on(hS.TARGET_TEXTURE_CHANGE, this._thisOnCameraResized);
48086              }
48087              onDisable() {
48088                super.onDisable();
48089                this._cameraComponent && this._cameraComponent.node.off(hS.TARGET_TEXTURE_CHANGE, this._thisOnCameraResized);
48090              }
48091              onDestroy() {
48092                super.onDestroy();
48093                this.node.off(ny.TRANSFORM_CHANGED, this._thisOnCameraResized);
48094              }
48095              _onResizeCamera() {
48096                if (this._cameraComponent && this._alignCanvasWithScreen) {
48097                  if (this._cameraComponent.targetTexture) this._cameraComponent.orthoHeight = HR.height / 2; else {
48098                    const t = Fo.windowSize;
48099                    this._cameraComponent.orthoHeight = t.height / JR.getScaleY() / 2;
48100                  }
48101                  this.node.getWorldPosition(dF);
48102                  this._cameraComponent.node.setWorldPosition(dF.x, dF.y, 1e3);
48103                }
48104              }
48105              _getViewPriority() {
48106                if (this._cameraComponent) {
48107                  var t;
48108                  let e = null === (t = this.cameraComponent) || void 0 === t ? void 0 : t.priority;
48109                  e = this._renderMode === pF.OVERLAY ? e | 1 << 30 : e & ~(1 << 30);
48110                  return e;
48111                }
48112                return 0;
48113              }
48114            }, _F), Bl(hF.prototype, "cameraComponent", [ nF, rF ], Object.getOwnPropertyDescriptor(hF.prototype, "cameraComponent"), hF.prototype),
48115            Bl(hF.prototype, "alignCanvasWithScreen", [ oF ], Object.getOwnPropertyDescriptor(hF.prototype, "alignCanvasWithScreen"), hF.prototype),
48116            cF = Bl(hF.prototype, "_cameraComponent", [ aF ], {
48117              configurable: !0,
48118              enumerable: !0,
48119              writable: !0,
48120              initializer: function() {
48121                return null;
48122              }
48123            }), uF = Bl(hF.prototype, "_alignCanvasWithScreen", [ Yl ], {
48124              configurable: !0,
48125              enumerable: !0,
48126              writable: !0,
48127              initializer: function() {
48128                return !0;
48129              }
48130            }), hF)) || lF) || lF) || lF) || lF) || lF) || lF));
48131            m.Canvas = mF;
48132            var fF;
48133            Y(t("UIComponent", Ul("cc.UIComponent")(fF = Gl(jB)(fF = zl(110)(fF = Hl(fF = Ql(fF = class extends Qc {
48134              constructor(...t) {
48135                super(...t);
48136                this._lastParent = null;
48137                this.stencilStage = lB.DISABLED;
48138              }
48139              __preload() {
48140                this.node._uiProps.uiComp = this;
48141              }
48142              onEnable() {}
48143              onDisable() {}
48144              onDestroy() {
48145                this.node._uiProps.uiComp === this && (this.node._uiProps.uiComp = null);
48146              }
48147              postUpdateAssembler(t) {}
48148              markForUpdateRenderData(t = !0) {}
48149              setNodeDirty() {}
48150              setTextureDirty() {}
48151            }) || fF) || fF) || fF) || fF) || fF).prototype, "UIComponent", [ {
48152              name: "_visibility"
48153            }, {
48154              name: "setVisibility"
48155            } ]);
48156            Y(uD.prototype, "Renderable2D.prototype", [ {
48157              name: "srcBlendFactor"
48158            }, {
48159              name: "dstBlendFactor"
48160            } ]);
48161            W(mF.prototype, "Canvas.prototype", [ {
48162              name: "camera",
48163              newName: "cameraComponent.camera",
48164              customGetter() {
48165                return this._cameraComponent.camera;
48166              }
48167            }, {
48168              name: "clearFlag",
48169              newName: "cameraComponent.clearFlags",
48170              customGetter() {
48171                return this._cameraComponent ? this._cameraComponent.clearFlags : 0;
48172              },
48173              customSetter(t) {
48174                this._cameraComponent && (this._cameraComponent.clearFlags = t);
48175              }
48176            }, {
48177              name: "color",
48178              newName: "cameraComponent.clearColor",
48179              customGetter() {
48180                return this._cameraComponent ? this._cameraComponent.clearColor : Bi.BLACK;
48181              },
48182              customSetter(t) {
48183                this._cameraComponent && (this._cameraComponent.clearColor = t);
48184              }
48185            }, {
48186              name: "priority",
48187              newName: "cameraComponent.priority",
48188              customGetter() {
48189                return this._cameraComponent ? this._cameraComponent.priority : 0;
48190              },
48191              customSetter(t) {
48192                this._cameraComponent && (this._cameraComponent.priority = t);
48193              }
48194            }, {
48195              name: "targetTexture",
48196              newName: "cameraComponent.targetTexture",
48197              customGetter() {
48198                return this._cameraComponent ? this._cameraComponent.targetTexture : null;
48199              },
48200              customSetter(t) {
48201                this._cameraComponent && (this._cameraComponent.targetTexture = t);
48202              }
48203            }, {
48204              name: "visibility",
48205              newName: "cameraComponent.visibility",
48206              customGetter() {
48207                return this._cameraComponent ? this._cameraComponent.visibility : 0;
48208              }
48209            } ]);
48210            q(jB.prototype, "UITransform.prototype", [ {
48211              name: "priority",
48212              suggest: "Please use setSiblingIndex to change index of the current node in its parent's children array."
48213            } ]);
48214            m.UITransformComponent = jB;
48215            ee.setClassAlias(jB, "cc.UITransformComponent");
48216            ee.setClassAlias(uD, "cc.RenderComponent");
48217            m.CanvasComponent = mF;
48218            ee.setClassAlias(mF, "cc.CanvasComponent");
48219            m.internal.Renderable2D = uD;
48220            ee.setClassAlias(uD, "cc.Renderable2D");
48221            var gF, yF, bF, SF, AF, TF, vF, EF, CF, xF, wF, RF, IF, MF, BF;
48222            var DF;
48223            !function(t) {
48224              t[t.SIMPLE = 0] = "SIMPLE";
48225              t[t.SLICED = 1] = "SLICED";
48226              t[t.TILED = 2] = "TILED";
48227            }(DF || (DF = {}));
48228            t("SpriteRenderer", (gF = Ul("cc.SpriteRenderer"), yF = sh(), bF = zl(100), SF = $l(),
48229            AF = Th(GI), TF = rh(), gF(vF = yF(vF = bF(vF = SF(vF = Ql(vF = (EF = (BF = class extends wS {
48230              constructor(...t) {
48231                super(...t);
48232                Ml(this, "_spriteFrame", CF, this);
48233                Ml(this, "_mode", xF, this);
48234                Ml(this, "_color", wF, this);
48235                Ml(this, "_flipX", RF, this);
48236                Ml(this, "_flipY", IF, this);
48237                Ml(this, "_size", MF, this);
48238                this._model = null;
48239              }
48240              get spriteFrame() {
48241                return this._spriteFrame;
48242              }
48243              set spriteFrame(t) {
48244                if (this._spriteFrame === t) return;
48245                this._spriteFrame;
48246                this._spriteFrame = t;
48247                if (this._spriteFrame) {
48248                  this._spriteFrame.ensureMeshData();
48249                  this._spriteFrame.mesh.initialize();
48250                }
48251                this._updateModels();
48252                this.enabledInHierarchy && this._attachToScene();
48253              }
48254              get model() {
48255                return this._model;
48256              }
48257              onLoad() {
48258                if (this._spriteFrame) {
48259                  this._spriteFrame.mesh || this._spriteFrame.ensureMeshData();
48260                  this._spriteFrame.mesh.initialize();
48261                }
48262                this._updateModels();
48263              }
48264              onRestore() {
48265                this._updateModels();
48266                this.enabledInHierarchy && this._attachToScene();
48267              }
48268              onEnable() {
48269                this._model || this._updateModels();
48270                this._attachToScene();
48271              }
48272              onDisable() {
48273                this._model && this._detachFromScene();
48274              }
48275              onDestroy() {
48276                if (this._model) {
48277                  m.director.root.destroyModel(this._model);
48278                  this._model = null;
48279                  this._models.length = 0;
48280                }
48281              }
48282              _updateModels() {
48283                if (!this._spriteFrame) return;
48284                const t = this._model;
48285                if (t) {
48286                  t.destroy();
48287                  t.initialize();
48288                  t.node = t.transform = this.node;
48289                } else this._createModel();
48290                if (this._model) {
48291                  const t = this._spriteFrame.mesh;
48292                  this._model.createBoundingShape(t.struct.minPosition, t.struct.maxPosition);
48293                  this._updateModelParams();
48294                  this._onUpdateLocalDescriptorSet();
48295                }
48296              }
48297              _createModel() {
48298                const t = this._model = m.director.root.createModel(wA);
48299                t.visFlags = this.visibility;
48300                t.node = t.transform = this.node;
48301                this._models.length = 0;
48302                this._models.push(this._model);
48303              }
48304              _updateModelParams() {
48305                if (!this._spriteFrame || !this._model) return;
48306                this._spriteFrame.ensureMeshData();
48307                const t = this._spriteFrame.mesh;
48308                this.node.hasChangedFlags |= ay.POSITION;
48309                this._model.transform.hasChangedFlags |= ay.POSITION;
48310                const e = t ? t.renderingSubMeshes.length : 0;
48311                const i = t.renderingSubMeshes;
48312                if (i) for (let t = 0; t < e; ++t) {
48313                  let e = this.getRenderMaterial(t);
48314                  e && !e.isValid && (e = null);
48315                  const s = i[t];
48316                  s && this._model.initSubModel(t, s, e || this._getBuiltinMaterial());
48317                }
48318                this._model.enabled = !0;
48319              }
48320              _getBuiltinMaterial() {
48321                return xR.get("missing-material");
48322              }
48323              _onMaterialModified(t, e) {
48324                super._onMaterialModified(t, e);
48325                this._spriteFrame && this._model && this._model.inited && this._onRebuildPSO(t, e || this._getBuiltinMaterial());
48326              }
48327              _onRebuildPSO(t, e) {
48328                if (this._model && this._model.inited) {
48329                  this._model.setSubModelMaterial(t, e);
48330                  this._onUpdateLocalDescriptorSet();
48331                }
48332              }
48333              _onUpdateLocalDescriptorSet() {
48334                if (!this._spriteFrame || !this._model || !this._model.inited) return;
48335                const t = this._spriteFrame.getGFXTexture();
48336                const e = this._spriteFrame.getGFXSampler();
48337                const i = this._model.subModels;
48338                const s = vm.SAMPLER_SPRITE;
48339                for (let n = 0; n < i.length; n++) {
48340                  const {descriptorSet: r} = i[n];
48341                  r.bindTexture(s, t);
48342                  r.bindSampler(s, e);
48343                  r.update();
48344                }
48345              }
48346              _attachToScene() {
48347                if (!this.node.scene || !this._model) return;
48348                const t = this._getRenderScene();
48349                null !== this._model.scene && this._detachFromScene();
48350                t.addModel(this._model);
48351              }
48352              _detachFromScene() {
48353                this._model && this._model.scene && this._model.scene.removeModel(this._model);
48354              }
48355            }, BF), Bl(EF.prototype, "spriteFrame", [ AF ], Object.getOwnPropertyDescriptor(EF.prototype, "spriteFrame"), EF.prototype),
48356            CF = Bl(EF.prototype, "_spriteFrame", [ Yl ], {
48357              configurable: !0,
48358              enumerable: !0,
48359              writable: !0,
48360              initializer: function() {
48361                return null;
48362              }
48363            }), xF = Bl(EF.prototype, "_mode", [ Yl ], {
48364              configurable: !0,
48365              enumerable: !0,
48366              writable: !0,
48367              initializer: function() {
48368                return DF.SIMPLE;
48369              }
48370            }), wF = Bl(EF.prototype, "_color", [ Yl ], {
48371              configurable: !0,
48372              enumerable: !0,
48373              writable: !0,
48374              initializer: function() {
48375                return Bi.WHITE.clone();
48376              }
48377            }), RF = Bl(EF.prototype, "_flipX", [ Yl ], {
48378              configurable: !0,
48379              enumerable: !0,
48380              writable: !0,
48381              initializer: function() {
48382                return !1;
48383              }
48384            }), IF = Bl(EF.prototype, "_flipY", [ Yl ], {
48385              configurable: !0,
48386              enumerable: !0,
48387              writable: !0,
48388              initializer: function() {
48389                return !1;
48390              }
48391            }), MF = Bl(EF.prototype, "_size", [ TF, Yl ], {
48392              configurable: !0,
48393              enumerable: !0,
48394              writable: !0,
48395              initializer: function() {
48396                return new Qi;
48397              }
48398            }), EF)) || vF) || vF) || vF) || vF) || vF));
48399            var PF, OF, NF, LF, FF, VF, kF, UF, GF, zF, HF, jF, XF, WF, YF, qF, KF, JF, ZF, QF, $F, tV, eV, iV, sV, nV, rV, oV, aV, lV, hV, cV, uV, _V, dV, pV, mV, fV, gV;
48400            const yV = new VL;
48401            const bV = "RICHTEXT_CHILD";
48402            const SV = "RICHTEXT_Image_CHILD";
48403            const AV = new $t((t => {
48404              if (!m.isValid(t.node)) return !1;
48405              {
48406                const e = t.node.getComponent(ZL);
48407                e && (e.width = 0);
48408              }
48409              return !0;
48410            }), 20);
48411            const TV = new $t((t => m.isValid(t.node)), 10);
48412            function vV(t) {
48413              return {
48414                node: new _y(t),
48415                comp: null,
48416                lineCount: 0,
48417                styleIndex: 0,
48418                imageOffset: "",
48419                clickParam: "",
48420                clickHandler: "",
48421                type: t
48422              };
48423            }
48424            function EV(t, e) {
48425              let i;
48426              t === bV ? i = AV._get() : t === SV && (i = TV._get());
48427              i = i || vV(t);
48428              let s = i.node;
48429              s || (s = new _y(t));
48430              s.hideFlags |= co.Flags.DontSave | co.Flags.HideInHierarchy;
48431              if (t === SV) {
48432                i.comp = s.getComponent(cL) || s.addComponent(cL);
48433                i.comp.spriteFrame = e;
48434                i.comp.type = cL.Type.SLICED;
48435                i.comp.sizeMode = cL.SizeMode.CUSTOM;
48436              } else {
48437                i.comp = s.getComponent(IP) || s.addComponent(IP);
48438                i.comp.string = e;
48439                i.comp.horizontalAlign = CP.LEFT;
48440                i.comp.verticalAlign = xP.TOP;
48441                i.comp.underlineHeight = 2;
48442              }
48443              s.setPosition(0, 0, 0);
48444              s._uiProps.uiTransformComp.setAnchorPoint(.5, .5);
48445              i.node = s;
48446              i.lineCount = 0;
48447              i.styleIndex = 0;
48448              i.imageOffset = "";
48449              i.clickParam = "";
48450              i.clickHandler = "";
48451              return i;
48452            }
48453            let CV = function(e) {
48454              return t({
48455                RichText: e,
48456                RichTextComponent: e
48457              }), e;
48458            }((PF = Ul("cc.RichText"), OF = sh(), NF = zl(110), LF = $l(), FF = lh(), VF = Th(CP),
48459            kF = lh(), UF = Th(xP), GF = lh(), zF = lh(), HF = lh(), jF = Th(qI), XF = lh(),
48460            WF = lh(), YF = ph(), qF = Th(RP), KF = lh(), JF = lh(), ZF = lh(), QF = Th(WI),
48461            $F = lh(), tV = lh(), PF(eV = OF(eV = NF(eV = LF(eV = Ql(eV = (iV = (gV = fV = class extends Qc {
48462              get string() {
48463                return this._string;
48464              }
48465              set string(t) {
48466                if (this._string !== t) {
48467                  this._string = t;
48468                  this._updateRichTextStatus();
48469                }
48470              }
48471              get horizontalAlign() {
48472                return this._horizontalAlign;
48473              }
48474              set horizontalAlign(t) {
48475                if (this.horizontalAlign !== t) {
48476                  this._horizontalAlign = t;
48477                  this._layoutDirty = !0;
48478                  this._updateRichTextStatus();
48479                }
48480              }
48481              get verticalAlign() {
48482                return this._verticalAlign;
48483              }
48484              set verticalAlign(t) {
48485                if (this._verticalAlign !== t) {
48486                  this._verticalAlign = t;
48487                  this._layoutDirty = !0;
48488                  this._updateRichTextStatus();
48489                }
48490              }
48491              get fontSize() {
48492                return this._fontSize;
48493              }
48494              set fontSize(t) {
48495                if (this._fontSize !== t) {
48496                  this._fontSize = t;
48497                  this._layoutDirty = !0;
48498                  this._updateRichTextStatus();
48499                }
48500              }
48501              get fontFamily() {
48502                return this._fontFamily;
48503              }
48504              set fontFamily(t) {
48505                if (this._fontFamily !== t) {
48506                  this._fontFamily = t;
48507                  this._layoutDirty = !0;
48508                  this._updateRichTextStatus();
48509                }
48510              }
48511              get font() {
48512                return this._font;
48513              }
48514              set font(t) {
48515                if (this._font !== t) {
48516                  this._font = t;
48517                  this._layoutDirty = !0;
48518                  if (this._font) {
48519                    this.useSystemFont = !1;
48520                    this._onTTFLoaded();
48521                  } else this.useSystemFont = !0;
48522                  this._updateRichTextStatus();
48523                }
48524              }
48525              get useSystemFont() {
48526                return this._isSystemFontUsed;
48527              }
48528              set useSystemFont(t) {
48529                if (this._isSystemFontUsed !== t) {
48530                  this._isSystemFontUsed = t;
48531                  this._layoutDirty = !0;
48532                  this._updateRichTextStatus();
48533                }
48534              }
48535              get cacheMode() {
48536                return this._cacheMode;
48537              }
48538              set cacheMode(t) {
48539                if (this._cacheMode !== t) {
48540                  this._cacheMode = t;
48541                  this._updateRichTextStatus();
48542                }
48543              }
48544              get maxWidth() {
48545                return this._maxWidth;
48546              }
48547              set maxWidth(t) {
48548                if (this._maxWidth !== t) {
48549                  this._maxWidth = t;
48550                  this._layoutDirty = !0;
48551                  this._updateRichTextStatus();
48552                }
48553              }
48554              get lineHeight() {
48555                return this._lineHeight;
48556              }
48557              set lineHeight(t) {
48558                if (this._lineHeight !== t) {
48559                  this._lineHeight = t;
48560                  this._layoutDirty = !0;
48561                  this._updateRichTextStatus();
48562                }
48563              }
48564              get imageAtlas() {
48565                return this._imageAtlas;
48566              }
48567              set imageAtlas(t) {
48568                if (this._imageAtlas !== t) {
48569                  this._imageAtlas = t;
48570                  this._layoutDirty = !0;
48571                  this._updateRichTextStatus();
48572                }
48573              }
48574              get handleTouchEvent() {
48575                return this._handleTouchEvent;
48576              }
48577              set handleTouchEvent(t) {
48578                if (this._handleTouchEvent !== t) {
48579                  this._handleTouchEvent = t;
48580                  this.enabledInHierarchy && (this.handleTouchEvent ? this._addEventListeners() : this._removeEventListeners());
48581                }
48582              }
48583              constructor() {
48584                super();
48585                Ml(this, "_lineHeight", sV, this);
48586                Ml(this, "_string", nV, this);
48587                Ml(this, "_horizontalAlign", rV, this);
48588                Ml(this, "_verticalAlign", oV, this);
48589                Ml(this, "_fontSize", aV, this);
48590                Ml(this, "_maxWidth", lV, this);
48591                Ml(this, "_fontFamily", hV, this);
48592                Ml(this, "_font", cV, this);
48593                Ml(this, "_isSystemFontUsed", uV, this);
48594                Ml(this, "_userDefinedFont", _V, this);
48595                Ml(this, "_cacheMode", dV, this);
48596                Ml(this, "_imageAtlas", pV, this);
48597                Ml(this, "_handleTouchEvent", mV, this);
48598                this._textArray = [];
48599                this._segments = [];
48600                this._labelSegmentsCache = [];
48601                this._linesWidth = [];
48602                this._lineCount = 1;
48603                this._labelWidth = 0;
48604                this._labelHeight = 0;
48605                this._layoutDirty = !0;
48606                this._lineOffsetX = 0;
48607                this._updateRichTextStatus = void 0;
48608                this._labelChildrenNum = 0;
48609                this._updateRichTextStatus = this._updateRichText;
48610              }
48611              onLoad() {
48612                this.node.on(ny.LAYER_CHANGED, this._applyLayer, this);
48613              }
48614              onEnable() {
48615                this.handleTouchEvent && this._addEventListeners();
48616                this._updateRichText();
48617                this._activateChildren(!0);
48618              }
48619              onDisable() {
48620                this.handleTouchEvent && this._removeEventListeners();
48621                this._activateChildren(!1);
48622              }
48623              start() {
48624                this._onTTFLoaded();
48625                this.node.on(ny.ANCHOR_CHANGED, this._updateRichTextPosition, this);
48626              }
48627              onRestore() {}
48628              onDestroy() {
48629                for (const t of this._segments) {
48630                  t.node.removeFromParent();
48631                  t.type === bV ? AV.put(t) : t.type === SV && TV.put(t);
48632                }
48633                this.node.off(ny.ANCHOR_CHANGED, this._updateRichTextPosition, this);
48634                this.node.off(ny.LAYER_CHANGED, this._applyLayer, this);
48635              }
48636              _addEventListeners() {
48637                this.node.on(ny.TOUCH_END, this._onTouchEnded, this);
48638              }
48639              _removeEventListeners() {
48640                this.node.off(ny.TOUCH_END, this._onTouchEnded, this);
48641              }
48642              _updateLabelSegmentTextAttributes() {
48643                this._segments.forEach((t => {
48644                  this._applyTextAttribute(t);
48645                }));
48646              }
48647              _createFontLabel(t) {
48648                return EV(bV, t);
48649              }
48650              _createImage(t) {
48651                return EV(SV, t);
48652              }
48653              _onTTFLoaded() {
48654                if (this._font instanceof $I) {
48655                  this._layoutDirty = !0;
48656                  this._updateRichText();
48657                } else {
48658                  this._layoutDirty = !0;
48659                  this._updateRichText();
48660                }
48661              }
48662              SplitLongStringApproximatelyIn2048(t, e) {
48663                const i = [];
48664                if (this._calculateSize(e, t).x < 2048) i.push(t); else {
48665                  const s = t.split("\n");
48666                  for (let t = 0; t < s.length; t++) {
48667                    if (this._calculateSize(e, s[t]).x < 2048) i.push(s[t]); else {
48668                      const n = this.splitLongStringOver2048(s[t], e);
48669                      i.push(...n);
48670                    }
48671                  }
48672                }
48673                return i;
48674              }
48675              splitLongStringOver2048(t, e) {
48676                const i = [];
48677                const s = t;
48678                let n = 0;
48679                let r = s.length / 2;
48680                let o = s.substring(n, r);
48681                let a = s.substring(r);
48682                let l = this._calculateSize(e, o);
48683                let h = this._calculateSize(e, a);
48684                const c = 1 * this.maxWidth;
48685                for (;l.x > c; ) {
48686                  r /= 2;
48687                  if (r < 1) {
48688                    r *= 2;
48689                    break;
48690                  }
48691                  o = o.substring(n, r);
48692                  a = s.substring(r);
48693                  l = this._calculateSize(e, o);
48694                }
48695                let u = 1e3;
48696                let _ = 1;
48697                for (;u && n < t.length; ) {
48698                  for (;u && l.x < c; ) {
48699                    const t = RM(a);
48700                    t && t.length > 0 && (_ = t[0].length);
48701                    r += _;
48702                    o = s.substring(n, r);
48703                    a = s.substring(r);
48704                    l = this._calculateSize(e, o);
48705                    u--;
48706                  }
48707                  for (;u && o.length >= 2 && l.x > c; ) {
48708                    r -= _;
48709                    o = s.substring(n, r);
48710                    l = this._calculateSize(e, o);
48711                    _ = 1;
48712                    u--;
48713                  }
48714                  if (o.length >= 2) {
48715                    const t = IM(o);
48716                    if (t && t.length > 0 && o !== t[0]) {
48717                      r -= t[0].length;
48718                      o = s.substring(n, r);
48719                    }
48720                  }
48721                  i.push(o);
48722                  n = r;
48723                  r += o.length;
48724                  o = s.substring(n, r);
48725                  a = s.substring(r);
48726                  h = this._calculateSize(e, a);
48727                  u--;
48728                  if (h.x < 2048) {
48729                    n = t.length;
48730                    r = t.length;
48731                    o = a;
48732                    i.push(o);
48733                    break;
48734                  }
48735                  l = this._calculateSize(e, o);
48736                }
48737                return i;
48738              }
48739              _measureText(t, e) {
48740                const i = e => this._calculateSize(t, e).width;
48741                return e ? i(e) : i;
48742              }
48743              _calculateSize(t, e) {
48744                let i;
48745                if (0 === this._labelSegmentsCache.length) {
48746                  i = this._createFontLabel(e);
48747                  this._labelSegmentsCache.push(i);
48748                } else {
48749                  i = this._labelSegmentsCache[0];
48750                  i.node.getComponent(IP).string = e;
48751                }
48752                i.styleIndex = t;
48753                this._applyTextAttribute(i);
48754                return i.node._uiProps.uiTransformComp.contentSize;
48755              }
48756              _onTouchEnded(t) {
48757                const e = this.node.getComponents(Qc);
48758                for (const i of this._segments) {
48759                  const s = i.clickHandler;
48760                  const n = i.clickParam;
48761                  if (s && this._containsTouchLocation(i, t.touch.getUILocation())) {
48762                    e.forEach((e => {
48763                      const i = e[s];
48764                      e.enabledInHierarchy && i && i.call(e, t, n);
48765                    }));
48766                    t.propagationStopped = !0;
48767                  }
48768                }
48769              }
48770              _containsTouchLocation(t, e) {
48771                const i = t.node.getComponent(jB);
48772                if (!i) return !1;
48773                return i.getBoundingBoxToWorld().contains(e);
48774              }
48775              _resetState() {
48776                const t = this.node.children;
48777                for (let e = t.length - 1; e >= 0; e--) {
48778                  const i = t[e];
48779                  if (i.name === bV || i.name === SV) {
48780                    w(i.parent === this.node);
48781                    i.parent = null;
48782                    const t = vV(i.name);
48783                    t.node = i;
48784                    if (i.name === bV) {
48785                      t.comp = i.getComponent(IP);
48786                      AV.put(t);
48787                    } else {
48788                      t.comp = i.getComponent(cL);
48789                      TV.put(t);
48790                    }
48791                    this._labelChildrenNum--;
48792                  }
48793                }
48794                this._segments.length = 0;
48795                this._labelSegmentsCache.length = 0;
48796                this._linesWidth.length = 0;
48797                this._lineOffsetX = 0;
48798                this._lineCount = 1;
48799                this._labelWidth = 0;
48800                this._labelHeight = 0;
48801                this._layoutDirty = !0;
48802              }
48803              _activateChildren(t) {
48804                for (let e = this.node.children.length - 1; e >= 0; e--) {
48805                  const i = this.node.children[e];
48806                  i.name !== bV && i.name !== SV || (i.active = t);
48807                }
48808              }
48809              _addLabelSegment(t, e) {
48810                let i;
48811                if (0 === this._labelSegmentsCache.length) i = this._createFontLabel(t); else {
48812                  i = this._labelSegmentsCache.pop();
48813                  const e = i.node.getComponent(IP);
48814                  e && (e.string = t);
48815                }
48816                const s = i.comp;
48817                s.verticalAlign !== this._verticalAlign && (s.verticalAlign = this._verticalAlign);
48818                i.styleIndex = e;
48819                i.lineCount = this._lineCount;
48820                i.node._uiProps.uiTransformComp.setAnchorPoint(0, 0);
48821                i.node.layer = this.node.layer;
48822                this.node.insertChild(i.node, this._labelChildrenNum++);
48823                this._applyTextAttribute(i);
48824                this._segments.push(i);
48825                return i;
48826              }
48827              _updateRichTextWithMaxWidth(t, e, i) {
48828                let s = e;
48829                let n;
48830                if (this._lineOffsetX > 0 && s + this._lineOffsetX > this._maxWidth) {
48831                  let e = 0;
48832                  for (;this._lineOffsetX <= this._maxWidth; ) {
48833                    const n = this._getFirstWordLen(t, e, t.length);
48834                    const r = t.substr(e, n);
48835                    const o = this._measureText(i, r);
48836                    if (!(this._lineOffsetX + o <= this._maxWidth)) {
48837                      if (e > 0) {
48838                        const n = t.substr(0, e);
48839                        this._addLabelSegment(n, i);
48840                        t = t.substr(e, t.length);
48841                        s = this._measureText(i, t);
48842                      }
48843                      this._updateLineInfo();
48844                      break;
48845                    }
48846                    this._lineOffsetX += o;
48847                    e += n;
48848                  }
48849                }
48850                if (s > this._maxWidth) {
48851                  const e = MM(t, s, this._maxWidth, this._measureText(i));
48852                  for (let t = 0; t < e.length; ++t) {
48853                    const s = e[t];
48854                    n = this._addLabelSegment(s, i);
48855                    const r = n.node._uiProps.uiTransformComp.contentSize;
48856                    this._lineOffsetX += r.width;
48857                    e.length > 1 && t < e.length - 1 && this._updateLineInfo();
48858                  }
48859                } else {
48860                  this._lineOffsetX += s;
48861                  this._addLabelSegment(t, i);
48862                }
48863              }
48864              _isLastComponentCR(t) {
48865                return t.length - 1 === t.lastIndexOf("\n");
48866              }
48867              _updateLineInfo() {
48868                this._linesWidth.push(this._lineOffsetX);
48869                this._lineOffsetX = 0;
48870                this._lineCount++;
48871              }
48872              _needsUpdateTextLayout(t) {
48873                if (this._layoutDirty || !this._textArray || !t) return !0;
48874                if (this._textArray.length !== t.length) return !0;
48875                for (let e = 0; e < this._textArray.length; e++) {
48876                  const i = this._textArray[e];
48877                  const s = t[e];
48878                  if (i.text !== s.text) return !0;
48879                  {
48880                    const t = i.style;
48881                    const e = s.style;
48882                    if (t) {
48883                      if (e) {
48884                        if (!!e.outline != !!t.outline) return !0;
48885                        if (t.size !== e.size || t.italic !== e.italic || t.isImage !== e.isImage) return !0;
48886                        if (t.src !== e.src || t.imageAlign !== e.imageAlign || t.imageHeight !== e.imageHeight || t.imageWidth !== e.imageWidth || t.imageOffset !== e.imageOffset) return !0;
48887                      } else if (t.size || t.italic || t.isImage || t.outline) return !0;
48888                    } else if (e && (e.size || e.italic || e.isImage || e.outline)) return !0;
48889                  }
48890                }
48891                return !1;
48892              }
48893              _addRichTextImageElement(t) {
48894                if (!t.style) return;
48895                const e = t.style;
48896                const i = e.src;
48897                const s = this._imageAtlas && i && this._imageAtlas.getSpriteFrame(i);
48898                if (s) {
48899                  const t = this._createImage(s);
48900                  t.comp;
48901                  switch (e.imageAlign) {
48902                   case "top":
48903                    t.node._uiProps.uiTransformComp.setAnchorPoint(0, 1);
48904                    break;
48905
48906                   case "center":
48907                    t.node._uiProps.uiTransformComp.setAnchorPoint(0, .5);
48908                    break;
48909
48910                   default:
48911                    t.node._uiProps.uiTransformComp.setAnchorPoint(0, 0);
48912                  }
48913                  e.imageOffset && (t.imageOffset = e.imageOffset);
48914                  t.node.layer = this.node.layer;
48915                  this.node.insertChild(t.node, this._labelChildrenNum++);
48916                  this._segments.push(t);
48917                  const i = s.rect.clone();
48918                  let n = 1;
48919                  let r = i.width;
48920                  let o = i.height;
48921                  const a = e.imageWidth || 0;
48922                  const l = e.imageHeight || 0;
48923                  if (l > 0) {
48924                    n = l / o;
48925                    r *= n;
48926                    o *= n;
48927                  } else {
48928                    n = this._lineHeight / o;
48929                    r *= n;
48930                    o *= n;
48931                  }
48932                  a > 0 && (r = a);
48933                  if (this._maxWidth > 0) {
48934                    this._lineOffsetX + r > this._maxWidth && this._updateLineInfo();
48935                    this._lineOffsetX += r;
48936                  } else {
48937                    this._lineOffsetX += r;
48938                    this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX);
48939                  }
48940                  t.node._uiProps.uiTransformComp.setContentSize(r, o);
48941                  t.lineCount = this._lineCount;
48942                  t.clickHandler = "";
48943                  t.clickParam = "";
48944                  const h = e.event;
48945                  if (h) {
48946                    t.clickHandler = h.click;
48947                    t.clickParam = h.param;
48948                  }
48949                } else N(4400);
48950              }
48951              _updateRichText() {
48952                if (!this.enabledInHierarchy) return;
48953                const t = yV.parse(this._string);
48954                if (!this._needsUpdateTextLayout(t)) {
48955                  this._textArray = t.slice();
48956                  this._updateLabelSegmentTextAttributes();
48957                  return;
48958                }
48959                this._textArray = t.slice();
48960                this._resetState();
48961                let e = !1;
48962                let i;
48963                for (let t = 0; t < this._textArray.length; ++t) {
48964                  const s = this._textArray[t];
48965                  let n = s.text;
48966                  if (void 0 === n) continue;
48967                  if ("" === n) {
48968                    if (s.style && s.style.isNewLine) {
48969                      this._updateLineInfo();
48970                      continue;
48971                    }
48972                    if (s.style && s.style.isImage && this._imageAtlas) {
48973                      this._addRichTextImageElement(s);
48974                      continue;
48975                    }
48976                  }
48977                  n = this.SplitLongStringApproximatelyIn2048(n, t).join("\n");
48978                  const r = n.split("\n");
48979                  for (let s = 0; s < r.length; ++s) {
48980                    const o = r[s];
48981                    if ("" !== o) {
48982                      e = !1;
48983                      if (this._maxWidth > 0) {
48984                        const e = this._measureText(t, o);
48985                        this._updateRichTextWithMaxWidth(o, e, t);
48986                        r.length > 1 && s < r.length - 1 && this._updateLineInfo();
48987                      } else {
48988                        i = this._addLabelSegment(o, t);
48989                        this._lineOffsetX += i.node._uiProps.uiTransformComp.width;
48990                        this._lineOffsetX > this._labelWidth && (this._labelWidth = this._lineOffsetX);
48991                        r.length > 1 && s < r.length - 1 && this._updateLineInfo();
48992                      }
48993                    } else {
48994                      if (this._isLastComponentCR(n) && s === r.length - 1) continue;
48995                      this._updateLineInfo();
48996                      e = !0;
48997                    }
48998                  }
48999                }
49000                e || this._linesWidth.push(this._lineOffsetX);
49001                this._maxWidth > 0 && (this._labelWidth = this._maxWidth);
49002                this._labelHeight = (this._lineCount + pM) * this._lineHeight;
49003                this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth, this._labelHeight);
49004                this._updateRichTextPosition();
49005                this._layoutDirty = !1;
49006              }
49007              _getFirstWordLen(t, e, i) {
49008                let s = t.charAt(e);
49009                if (EM(s) || CM(s)) return 1;
49010                let n = 1;
49011                for (let r = e + 1; r < i; ++r) {
49012                  s = t.charAt(r);
49013                  if (CM(s) || EM(s)) break;
49014                  n++;
49015                }
49016                return n;
49017              }
49018              _updateRichTextPosition() {
49019                let t = 0;
49020                let e = 1;
49021                const i = this._lineCount;
49022                const s = this.node._uiProps.uiTransformComp;
49023                const n = s.anchorX;
49024                const r = s.anchorY;
49025                for (let s = 0; s < this._segments.length; ++s) {
49026                  const o = this._segments[s];
49027                  const a = o.lineCount;
49028                  if (a > e) {
49029                    t = 0;
49030                    e = a;
49031                  }
49032                  let l = this._labelWidth * (.5 * this._horizontalAlign - n);
49033                  switch (this._horizontalAlign) {
49034                   case CP.LEFT:
49035                    break;
49036
49037                   case CP.CENTER:
49038                    l -= this._linesWidth[a - 1] / 2;
49039                    break;
49040
49041                   case CP.RIGHT:
49042                    l -= this._linesWidth[a - 1];
49043                  }
49044                  const h = o.node.position;
49045                  o.node.setPosition(t + l, this._lineHeight * (i - a) - this._labelHeight * r, h.z);
49046                  a === e && (t += o.node._uiProps.uiTransformComp.width);
49047                  if (o.node.getComponent(cL)) {
49048                    const t = o.node.position.clone();
49049                    const e = this._lineHeight;
49050                    const i = this._lineHeight * (1 + pM);
49051                    switch (o.node._uiProps.uiTransformComp.anchorY) {
49052                     case 1:
49053                      t.y += e + (i - e) / 2;
49054                      break;
49055
49056                     case .5:
49057                      t.y += i / 2;
49058                      break;
49059
49060                     default:
49061                      t.y += (i - e) / 2;
49062                    }
49063                    if (o.imageOffset) {
49064                      const e = o.imageOffset.split(",");
49065                      if (1 === e.length && e[0]) {
49066                        const i = parseFloat(e[0]);
49067                        Number.isInteger(i) && (t.y += i);
49068                      } else if (2 === e.length) {
49069                        const i = parseFloat(e[0]);
49070                        const s = parseFloat(e[1]);
49071                        Number.isInteger(i) && (t.x += i);
49072                        Number.isInteger(s) && (t.y += s);
49073                      }
49074                    }
49075                    o.node.position = t;
49076                  }
49077                  const c = o.node.getComponent(ZL);
49078                  if (c) {
49079                    const t = o.node.position.clone();
49080                    t.y -= c.width;
49081                    o.node.position = t;
49082                  }
49083                }
49084              }
49085              _convertLiteralColorValue(t) {
49086                const e = t.toUpperCase();
49087                if (Bi[e]) {
49088                  return Bi[e];
49089                }
49090                return (new Bi).fromHEX(t);
49091              }
49092              _applyTextAttribute(t) {
49093                const e = t.node.getComponent(IP);
49094                if (!e) return;
49095                this._resetLabelState(e);
49096                const i = t.styleIndex;
49097                let s;
49098                this._textArray[i] && (s = this._textArray[i].style);
49099                if (s) {
49100                  e.color = this._convertLiteralColorValue(s.color || "white");
49101                  e.isBold = !!s.bold;
49102                  e.isItalic = !!s.italic;
49103                  e.isUnderline = !!s.underline;
49104                  if (s.outline) {
49105                    let e = t.node.getComponent(ZL);
49106                    e || (e = t.node.addComponent(ZL));
49107                    e.color = this._convertLiteralColorValue(s.outline.color);
49108                    e.width = s.outline.width;
49109                  }
49110                  e.fontSize = s.size || this._fontSize;
49111                  t.clickHandler = "";
49112                  t.clickParam = "";
49113                  const i = s.event;
49114                  if (i) {
49115                    t.clickHandler = i.click || "";
49116                    t.clickParam = i.param || "";
49117                  }
49118                }
49119                e.cacheMode = this._cacheMode;
49120                this._font instanceof qI && !this._isSystemFontUsed ? e.font = this._font : e.fontFamily = this._fontFamily;
49121                e.useSystemFont = this._isSystemFontUsed;
49122                e.lineHeight = this._lineHeight;
49123                e.updateRenderData(!0);
49124                const n = e._assembler;
49125                n && n.updateRenderData(e);
49126              }
49127              _applyLayer() {
49128                for (const t of this._segments) t.node.layer = this.node.layer;
49129              }
49130              _resetLabelState(t) {
49131                t.fontSize = this._fontSize;
49132                t.color = Bi.WHITE;
49133                t.isBold = !1;
49134                t.isItalic = !1;
49135                t.isUnderline = !1;
49136              }
49137            }, fV.HorizontalAlign = CP, fV.VerticalAlign = xP, gV), Bl(iV.prototype, "string", [ fh, FF ], Object.getOwnPropertyDescriptor(iV.prototype, "string"), iV.prototype),
49138            Bl(iV.prototype, "horizontalAlign", [ VF, kF ], Object.getOwnPropertyDescriptor(iV.prototype, "horizontalAlign"), iV.prototype),
49139            Bl(iV.prototype, "verticalAlign", [ UF, GF ], Object.getOwnPropertyDescriptor(iV.prototype, "verticalAlign"), iV.prototype),
49140            Bl(iV.prototype, "fontSize", [ zF ], Object.getOwnPropertyDescriptor(iV.prototype, "fontSize"), iV.prototype),
49141            Bl(iV.prototype, "fontFamily", [ HF ], Object.getOwnPropertyDescriptor(iV.prototype, "fontFamily"), iV.prototype),
49142            Bl(iV.prototype, "font", [ jF, XF ], Object.getOwnPropertyDescriptor(iV.prototype, "font"), iV.prototype),
49143            Bl(iV.prototype, "useSystemFont", [ WF, YF ], Object.getOwnPropertyDescriptor(iV.prototype, "useSystemFont"), iV.prototype),
49144            Bl(iV.prototype, "cacheMode", [ qF, KF ], Object.getOwnPropertyDescriptor(iV.prototype, "cacheMode"), iV.prototype),
49145            Bl(iV.prototype, "maxWidth", [ JF ], Object.getOwnPropertyDescriptor(iV.prototype, "maxWidth"), iV.prototype),
49146            Bl(iV.prototype, "lineHeight", [ ZF ], Object.getOwnPropertyDescriptor(iV.prototype, "lineHeight"), iV.prototype),
49147            Bl(iV.prototype, "imageAtlas", [ QF, $F ], Object.getOwnPropertyDescriptor(iV.prototype, "imageAtlas"), iV.prototype),
49148            Bl(iV.prototype, "handleTouchEvent", [ tV ], Object.getOwnPropertyDescriptor(iV.prototype, "handleTouchEvent"), iV.prototype),
49149            sV = Bl(iV.prototype, "_lineHeight", [ Yl ], {
49150              configurable: !0,
49151              enumerable: !0,
49152              writable: !0,
49153              initializer: function() {
49154                return 40;
49155              }
49156            }), nV = Bl(iV.prototype, "_string", [ Yl ], {
49157              configurable: !0,
49158              enumerable: !0,
49159              writable: !0,
49160              initializer: function() {
49161                return "<color=#00ff00>Rich</color><color=#0fffff>Text</color>";
49162              }
49163            }), rV = Bl(iV.prototype, "_horizontalAlign", [ Yl ], {
49164              configurable: !0,
49165              enumerable: !0,
49166              writable: !0,
49167              initializer: function() {
49168                return CP.LEFT;
49169              }
49170            }), oV = Bl(iV.prototype, "_verticalAlign", [ Yl ], {
49171              configurable: !0,
49172              enumerable: !0,
49173              writable: !0,
49174              initializer: function() {
49175                return xP.TOP;
49176              }
49177            }), aV = Bl(iV.prototype, "_fontSize", [ Yl ], {
49178              configurable: !0,
49179              enumerable: !0,
49180              writable: !0,
49181              initializer: function() {
49182                return 40;
49183              }
49184            }), lV = Bl(iV.prototype, "_maxWidth", [ Yl ], {
49185              configurable: !0,
49186              enumerable: !0,
49187              writable: !0,
49188              initializer: function() {
49189                return 0;
49190              }
49191            }), hV = Bl(iV.prototype, "_fontFamily", [ Yl ], {
49192              configurable: !0,
49193              enumerable: !0,
49194              writable: !0,
49195              initializer: function() {
49196                return "Arial";
49197              }
49198            }), cV = Bl(iV.prototype, "_font", [ Yl ], {
49199              configurable: !0,
49200              enumerable: !0,
49201              writable: !0,
49202              initializer: function() {
49203                return null;
49204              }
49205            }), uV = Bl(iV.prototype, "_isSystemFontUsed", [ Yl ], {
49206              configurable: !0,
49207              enumerable: !0,
49208              writable: !0,
49209              initializer: function() {
49210                return !0;
49211              }
49212            }), _V = Bl(iV.prototype, "_userDefinedFont", [ Yl ], {
49213              configurable: !0,
49214              enumerable: !0,
49215              writable: !0,
49216              initializer: function() {
49217                return null;
49218              }
49219            }), dV = Bl(iV.prototype, "_cacheMode", [ Yl ], {
49220              configurable: !0,
49221              enumerable: !0,
49222              writable: !0,
49223              initializer: function() {
49224                return RP.NONE;
49225              }
49226            }), pV = Bl(iV.prototype, "_imageAtlas", [ Yl ], {
49227              configurable: !0,
49228              enumerable: !0,
49229              writable: !0,
49230              initializer: function() {
49231                return null;
49232              }
49233            }), mV = Bl(iV.prototype, "_handleTouchEvent", [ Yl ], {
49234              configurable: !0,
49235              enumerable: !0,
49236              writable: !0,
49237              initializer: function() {
49238                return !0;
49239              }
49240            }), iV)) || eV) || eV) || eV) || eV) || eV));
49241            m.RichText = CV;
49242            var xV, wV;
49243            let RV = function(e) {
49244              return t({
49245                UIMeshRenderer: e,
49246                UIModelComponent: e
49247              }), e;
49248            }(Ul("cc.UIMeshRenderer")(xV = sh()(xV = zl(110)(xV = $l()(xV = Ql(xV = (wV = class extends Qc {
49249              constructor() {
49250                super();
49251                this._modelComponent = null;
49252                this.modelCount = 0;
49253                this._dirtyVersion = -1;
49254                this._internalId = -1;
49255                this.stencilStage = lB.DISABLED;
49256                this._renderData = null;
49257                this._renderEntity = new fB(uB.DYNAMIC);
49258                this._UIModelNativeProxy = new ZM;
49259              }
49260              get modelComponent() {
49261                return this._modelComponent;
49262              }
49263              __preload() {
49264                this.node._uiProps.uiComp = this;
49265              }
49266              onEnable() {
49267                wR.addRenderer(this);
49268                this.markForUpdateRenderData();
49269              }
49270              onDisable() {
49271                wR.removeRenderer(this);
49272                this.renderEntity.enabled = this._canRender();
49273              }
49274              onLoad() {
49275                this.node._uiProps.uiTransformComp || this.node.addComponent("cc.UITransform");
49276                this._modelComponent = this.getComponent("cc.ModelRenderer");
49277                if (this._modelComponent) {
49278                  this._UIModelNativeProxy.attachNode(this.node);
49279                  this.renderEntity.setNode(this.node);
49280                } else console.warn(`node '${this.node && this.node.name}' doesn't have any renderable component`);
49281              }
49282              onDestroy() {
49283                this.renderEntity.setNode(null);
49284                this.node._uiProps.uiComp === this && (this.node._uiProps.uiComp = null);
49285                this._modelComponent = this.getComponent("cc.ModelRenderer");
49286                this._modelComponent && (this._modelComponent._sceneGetter = null);
49287              }
49288              _render(t) {
49289                if (this._modelComponent) {
49290                  const e = this._modelComponent._collectModels();
49291                  this._modelComponent._detachFromScene();
49292                  for (let i = 0; i < e.length; i++) e[i].enabled && t.commitModel(this, e[i], this._modelComponent.material);
49293                  return !0;
49294                }
49295                return !1;
49296              }
49297              fillBuffers(t) {
49298                this.enabled && this._render(t);
49299              }
49300              updateRenderer() {
49301                this.renderEntity.enabled = this._canRender();
49302                if (this._modelComponent) {
49303                  const t = this._modelComponent._collectModels();
49304                  this._modelComponent._detachFromScene();
49305                  if (t.length !== this.modelCount) for (let e = this.modelCount; e < t.length; e++) {
49306                    this._uploadRenderData(e);
49307                    this._UIModelNativeProxy.updateModels(t[e]);
49308                  }
49309                  this.modelCount = t.length;
49310                  this._UIModelNativeProxy.attachDrawInfo();
49311                }
49312              }
49313              _uploadRenderData(t) {
49314                {
49315                  const e = AB.add();
49316                  e.initRenderDrawInfo(this, oB.MODEL);
49317                  this._renderData = e;
49318                  this._renderData.material = this._modelComponent.getMaterialInstance(t);
49319                }
49320              }
49321              postUpdateAssembler(t) {}
49322              update() {
49323                if (this._modelComponent) {
49324                  this._modelComponent._collectModels().length !== this.modelCount && this.markForUpdateRenderData();
49325                }
49326                this._fitUIRenderQueue();
49327              }
49328              _fitUIRenderQueue() {
49329                if (!this._modelComponent) return;
49330                const t = this._modelComponent.sharedMaterials.length;
49331                for (let e = 0; e < t; e++) {
49332                  const t = this._modelComponent.getMaterialInstance(e);
49333                  if (null == t) continue;
49334                  const i = t.passes;
49335                  const s = i.length;
49336                  for (let e = 0; e < s; e++) {
49337                    i[e]._priority = gm.MAX - 11;
49338                    t.recompileShaders({
49339                      CC_FORCE_FORWARD_SHADING: !0
49340                    }, e);
49341                  }
49342                }
49343              }
49344              markForUpdateRenderData(t = !0) {
49345                wR.markDirtyRenderer(this);
49346              }
49347              setNodeDirty() {}
49348              setTextureDirty() {}
49349              _canRender() {
49350                return this.enabled && null !== this._modelComponent;
49351              }
49352              get renderEntity() {
49353                w(this._renderEntity, "this._renderEntity should not be invalid");
49354                return this._renderEntity;
49355              }
49356              get renderData() {
49357                return this._renderData;
49358              }
49359            }, wV)) || xV) || xV) || xV) || xV) || xV);
49360            m.UIMeshRenderer = RV;
49361            const IV = mm.Enum.NONE | mm.Enum.UI_3D;
49362            class MV {
49363              constructor() {
49364                this.model = null;
49365                this.texture = null;
49366                this.sampler = null;
49367                this.useLocalData = null;
49368                this.isStatic = !1;
49369                this.textureHash = 0;
49370                this.samplerHash = 0;
49371                this._passes = [];
49372                this._shaders = [];
49373                this._visFlags = IV;
49374                this._inputAssembler = null;
49375                this._descriptorSet = null;
49376              }
49377              get inputAssembler() {
49378                return this._inputAssembler;
49379              }
49380              set inputAssembler(t) {
49381                this._inputAssembler = t;
49382              }
49383              get descriptorSet() {
49384                return this._descriptorSet;
49385              }
49386              set descriptorSet(t) {
49387                this._descriptorSet = t;
49388              }
49389              get visFlags() {
49390                return this._visFlags;
49391              }
49392              set visFlags(t) {
49393                this._visFlags = t;
49394              }
49395              get passes() {
49396                return this._passes;
49397              }
49398              get shaders() {
49399                return this._shaders;
49400              }
49401              destroy(t) {
49402                this._passes = [];
49403              }
49404              clear() {
49405                this._inputAssembler = null;
49406                this._descriptorSet = null;
49407                this.texture = null;
49408                this.sampler = null;
49409                this.textureHash = 0;
49410                this.samplerHash = 0;
49411                this.model = null;
49412                this.isStatic = !1;
49413                this.useLocalData = null;
49414                this.visFlags = IV;
49415              }
49416              fillPasses(t, e, i, s) {
49417                if (t) {
49418                  const n = t.passes;
49419                  if (!n) return;
49420                  this._shaders.length = n.length;
49421                  for (let t = 0; t < n.length; t++) {
49422                    this._passes[t] || (this._passes[t] = new XP(m.director.root));
49423                    const r = n[t];
49424                    const o = this._passes[t];
49425                    r.update();
49426                    if (!e) {
49427                      e = r.depthStencilState;
49428                      i = 0;
49429                    }
49430                    o._initPassFromTarget(r, e, i);
49431                    this._shaders[t] = o.getShaderVariant(s);
49432                  }
49433                }
49434              }
49435            }
49436            var BV, DV, PV, OV, NV, LV, FV, VV;
49437            let kV = function(e) {
49438              return t({
49439                UIStaticBatch: e,
49440                UIStaticBatchComponent: e
49441              }), e;
49442            }((BV = Ul("cc.UIStaticBatch"), DV = sh(), PV = $l(), OV = zl(110), NV = rh(), BV(LV = DV(LV = PV(LV = OV(LV = (FV = (VV = class extends uD {
49443              constructor(...t) {
49444                super(...t);
49445                this._init = !1;
49446                this._bufferAccessor = null;
49447                this._dirty = !0;
49448                this._uiDrawBatchList = [];
49449              }
49450              get color() {
49451                return this._color;
49452              }
49453              set color(t) {
49454                this._color !== t && this._color.set(t);
49455              }
49456              get drawBatchList() {
49457                return this._uiDrawBatchList;
49458              }
49459              postUpdateAssembler(t) {}
49460              markAsDirty() {}
49461              _requireDrawBatch() {
49462                const t = new MV;
49463                t.isStatic = !0;
49464                this._uiDrawBatchList.push(t);
49465                return t;
49466              }
49467              _clearData() {
49468                if (this._bufferAccessor) {
49469                  this._bufferAccessor.reset();
49470                  const t = this._getBatcher();
49471                  for (let e = 0; e < this._uiDrawBatchList.length; e++) {
49472                    this._uiDrawBatchList[e].destroy(t);
49473                  }
49474                }
49475                this._uiDrawBatchList.length = 0;
49476                this._init = !1;
49477              }
49478              _getBatcher() {
49479                if (IR.root && IR.root.batcher2D) return IR.root.batcher2D;
49480                N(9301);
49481                return null;
49482              }
49483            }, VV), Bl(FV.prototype, "color", [ vh, NV ], Object.getOwnPropertyDescriptor(FV.prototype, "color"), FV.prototype),
49484            FV)) || LV) || LV) || LV) || LV));
49485            var UV, GV, zV, HV, jV, XV, WV, YV, qV, KV, JV, ZV, QV, $V;
49486            let tk = t("LabelShadow", (UV = Ul("cc.LabelShadow"), GV = sh(), zV = zl(110), HV = $l(),
49487            jV = Gl(IP), XV = lh(), WV = lh(), YV = lh(), UV(qV = GV(qV = zV(qV = HV(qV = jV(qV = Ql(qV = (KV = ($V = class extends Qc {
49488              constructor(...t) {
49489                super(...t);
49490                Ml(this, "_color", JV, this);
49491                Ml(this, "_offset", ZV, this);
49492                Ml(this, "_blur", QV, this);
49493              }
49494              get color() {
49495                return this._color;
49496              }
49497              set color(t) {
49498                if (this._color !== t) {
49499                  this._color.set(t);
49500                  this._updateRenderData();
49501                }
49502              }
49503              get offset() {
49504                return this._offset;
49505              }
49506              set offset(t) {
49507                this._offset = t;
49508                this._updateRenderData();
49509              }
49510              get blur() {
49511                return this._blur;
49512              }
49513              set blur(t) {
49514                this._blur = t;
49515                this._updateRenderData();
49516              }
49517              onEnable() {
49518                this._updateRenderData();
49519              }
49520              onDisable() {
49521                this._updateRenderData();
49522              }
49523              _updateRenderData() {
49524                const t = this.node.getComponent(IP);
49525                t && t.updateRenderData(!0);
49526              }
49527            }, $V), JV = Bl(KV.prototype, "_color", [ Yl ], {
49528              configurable: !0,
49529              enumerable: !0,
49530              writable: !0,
49531              initializer: function() {
49532                return new Bi(0, 0, 0, 255);
49533              }
49534            }), ZV = Bl(KV.prototype, "_offset", [ Yl ], {
49535              configurable: !0,
49536              enumerable: !0,
49537              writable: !0,
49538              initializer: function() {
49539                return new Qi(2, 2);
49540              }
49541            }), QV = Bl(KV.prototype, "_blur", [ Yl ], {
49542              configurable: !0,
49543              enumerable: !0,
49544              writable: !0,
49545              initializer: function() {
49546                return 2;
49547              }
49548            }), Bl(KV.prototype, "color", [ XV ], Object.getOwnPropertyDescriptor(KV.prototype, "color"), KV.prototype),
49549            Bl(KV.prototype, "offset", [ WV ], Object.getOwnPropertyDescriptor(KV.prototype, "offset"), KV.prototype),
49550            Bl(KV.prototype, "blur", [ YV ], Object.getOwnPropertyDescriptor(KV.prototype, "blur"), KV.prototype),
49551            KV)) || qV) || qV) || qV) || qV) || qV) || qV));
49552            var ek, ik, sk, nk, rk, ok, ak, lk, hk;
49553            let ck = function(e) {
49554              return t({
49555                UIOpacity: e,
49556                UIOpacityComponent: e
49557              }), e;
49558            }((ek = Ul("cc.UIOpacity"), ik = sh(), sk = zl(110), nk = $l(), rk = lh(), ek(ok = ik(ok = sk(ok = nk(ok = Ql(ok = Hl(ok = (ak = (hk = class t extends Qc {
49559              constructor(...t) {
49560                super(...t);
49561                Ml(this, "_opacity", lk, this);
49562              }
49563              get opacity() {
49564                return this._opacity;
49565              }
49566              set opacity(t) {
49567                if (this._opacity !== t) {
49568                  t = Ee(t, 0, 255);
49569                  this._opacity = t;
49570                  this.node._uiProps.localOpacity = t / 255;
49571                  this.setEntityLocalOpacityDirtyRecursively(!0);
49572                }
49573              }
49574              setEntityLocalOpacityDirtyRecursively(e) {
49575                t.setEntityLocalOpacityDirtyRecursively(this.node, e, 1);
49576              }
49577              static setEntityLocalOpacityDirtyRecursively(e, i, s) {
49578                if (!e.isValid) return;
49579                const n = e._uiProps.uiComp;
49580                const r = e.getComponent(t);
49581                let o = s;
49582                if (n && n.color) {
49583                  n.renderEntity.colorDirty = i;
49584                  n.renderEntity.localOpacity = r ? o * r.opacity / 255 : o;
49585                  o = 1;
49586                } else r && (o = o * r.opacity / 255);
49587                for (let s = 0; s < e.children.length; s++) t.setEntityLocalOpacityDirtyRecursively(e.children[s], i || o < 1, o);
49588              }
49589              onEnable() {
49590                this.node._uiProps.localOpacity = this._opacity / 255;
49591                this.setEntityLocalOpacityDirtyRecursively(!0);
49592              }
49593              onDisable() {
49594                this.node._uiProps.localOpacity = 1;
49595                this.setEntityLocalOpacityDirtyRecursively(!0);
49596              }
49597            }, hk), Bl(ak.prototype, "opacity", [ nh, rk ], Object.getOwnPropertyDescriptor(ak.prototype, "opacity"), ak.prototype),
49598            lk = Bl(ak.prototype, "_opacity", [ Yl ], {
49599              configurable: !0,
49600              enumerable: !0,
49601              writable: !0,
49602              initializer: function() {
49603                return 255;
49604              }
49605            }), ak)) || ok) || ok) || ok) || ok) || ok) || ok));
49606            m.MaskComponent = NL;
49607            ee.setClassAlias(NL, "cc.MaskComponent");
49608            m.LabelComponent = IP;
49609            ee.setClassAlias(IP, "cc.LabelComponent");
49610            m.LabelOutlineComponent = ZL;
49611            ee.setClassAlias(ZL, "cc.LabelOutlineComponent");
49612            m.RichTextComponent = CV;
49613            ee.setClassAlias(CV, "cc.RichTextComponent");
49614            m.SpriteComponent = cL;
49615            ee.setClassAlias(cL, "cc.SpriteComponent");
49616            m.UIModelComponent = RV;
49617            ee.setClassAlias(RV, "cc.UIModelComponent");
49618            m.GraphicsComponent = dN;
49619            ee.setClassAlias(dN, "cc.GraphicsComponent");
49620            ee.setClassAlias(kV, "cc.UIStaticBatchComponent");
49621            ee.setClassAlias(ck, "cc.UIOpacityComponent");
49622            W(NL.prototype, "Mask", [ {
49623              name: "graphics",
49624              newName: "subComp",
49625              target: NL.prototype,
49626              targetName: "Mask"
49627            } ]);
49628            W(OL, "MaskType", [ {
49629              name: "RECT",
49630              newName: "GRAPHICS_RECT",
49631              target: OL,
49632              targetName: "MaskType"
49633            }, {
49634              name: "ELLIPSE",
49635              newName: "GRAPHICS_ELLIPSE",
49636              target: OL,
49637              targetName: "MaskType"
49638            }, {
49639              name: "IMAGE_STENCIL",
49640              newName: "SPRITE_STENCIL",
49641              target: OL,
49642              targetName: "MaskType"
49643            } ]);
49644            class uk {
49645              constructor(t, e, i) {
49646                this.i = void 0;
49647                this.x = void 0;
49648                this.y = void 0;
49649                this.prev = null;
49650                this.next = null;
49651                this.z = 0;
49652                this.prevZ = null;
49653                this.nextZ = null;
49654                this.steiner = !1;
49655                this.i = t;
49656                this.x = e;
49657                this.y = i;
49658              }
49659            }
49660            function _k(t, e, i, s, n) {
49661              let r = 0;
49662              let o = null;
49663              if (n === function(t, e, i, s) {
49664                let n = 0;
49665                for (let r = e, o = i - s; r < i; r += s) {
49666                  n += (t[o] - t[r]) * (t[r + 1] + t[o + 1]);
49667                  o = r;
49668                }
49669                return n;
49670              }(t, e, i, s) > 0) for (r = e; r < i; r += s) o = Mk(r, t[r], t[r + 1], o); else for (r = i - s; r >= e; r -= s) o = Mk(r, t[r], t[r + 1], o);
49671              if (o && xk(o, o.next)) {
49672                Bk(o);
49673                o = o.next;
49674              }
49675              return o;
49676            }
49677            function dk(t, e = null) {
49678              if (!t) return t;
49679              e || (e = t);
49680              let i = t;
49681              let s = !1;
49682              do {
49683                s = !1;
49684                if (i.steiner || !xk(i, i.next) && 0 !== Ck(i.prev, i, i.next)) i = i.next; else {
49685                  Bk(i);
49686                  i = e = i.prev;
49687                  if (i === i.next) return null;
49688                  s = !0;
49689                }
49690              } while (s || i !== e);
49691              return e;
49692            }
49693            function pk(t, e, i, s, n, r, o = 0) {
49694              if (!t) return;
49695              !o && r && function(t, e, i, s) {
49696                let n = t;
49697                do {
49698                  null === n.z && (n.z = Ak(n.x, n.y, e, i, s));
49699                  n.prevZ = n.prev;
49700                  n.nextZ = n.next;
49701                  n = n.next;
49702                } while (n !== t);
49703                n.prevZ.nextZ = null;
49704                n.prevZ = null;
49705                !function(t) {
49706                  let e = 0;
49707                  let i = null;
49708                  let s = null;
49709                  let n = null;
49710                  let r = null;
49711                  let o = 0;
49712                  let a = 0;
49713                  let l = 0;
49714                  let h = 1;
49715                  do {
49716                    i = t;
49717                    t = null;
49718                    r = null;
49719                    o = 0;
49720                    for (;i; ) {
49721                      o++;
49722                      s = i;
49723                      a = 0;
49724                      for (e = 0; e < h; e++) {
49725                        a++;
49726                        s = s.nextZ;
49727                        if (!s) break;
49728                      }
49729                      l = h;
49730                      for (;a > 0 || l > 0 && s; ) {
49731                        if (0 === a) {
49732                          n = s;
49733                          s = s.nextZ;
49734                          l--;
49735                        } else if (0 !== l && s) if (i.z <= s.z) {
49736                          n = i;
49737                          i = i.nextZ;
49738                          a--;
49739                        } else {
49740                          n = s;
49741                          s = s.nextZ;
49742                          l--;
49743                        } else {
49744                          n = i;
49745                          i = i.nextZ;
49746                          a--;
49747                        }
49748                        r ? r.nextZ = n : t = n;
49749                        n.prevZ = r;
49750                        r = n;
49751                      }
49752                      i = s;
49753                    }
49754                    r.nextZ = null;
49755                    h *= 2;
49756                  } while (o > 1);
49757                }(n);
49758              }(t, s, n, r);
49759              let a = t;
49760              let l = null;
49761              let h = null;
49762              for (;t.prev !== t.next; ) {
49763                l = t.prev;
49764                h = t.next;
49765                if (r ? fk(t, s, n, r) : mk(t)) {
49766                  e.push(l.i / i);
49767                  e.push(t.i / i);
49768                  e.push(h.i / i);
49769                  Bk(t);
49770                  t = h.next;
49771                  a = h.next;
49772                } else if ((t = h) === a) {
49773                  o ? 1 === o ? pk(t = gk(t, e, i), e, i, s, n, r, 2) : 2 === o && yk(t, e, i, s, n, r) : pk(dk(t), e, i, s, n, r, 1);
49774                  break;
49775                }
49776              }
49777            }
49778            function mk(t) {
49779              const e = t.prev;
49780              const i = t;
49781              const s = t.next;
49782              if (Ck(e, i, s) >= 0) return !1;
49783              let n = t.next.next;
49784              for (;n !== t.prev; ) {
49785                if (vk(e.x, e.y, i.x, i.y, s.x, s.y, n.x, n.y) && Ck(n.prev, n, n.next) >= 0) return !1;
49786                n = n.next;
49787              }
49788              return !0;
49789            }
49790            function fk(t, e, i, s) {
49791              const n = t.prev;
49792              const r = t;
49793              const o = t.next;
49794              if (Ck(n, r, o) >= 0) return !1;
49795              const a = n.x < r.x ? n.x < o.x ? n.x : o.x : r.x < o.x ? r.x : o.x;
49796              const l = n.y < r.y ? n.y < o.y ? n.y : o.y : r.y < o.y ? r.y : o.y;
49797              const h = n.x > r.x ? n.x > o.x ? n.x : o.x : r.x > o.x ? r.x : o.x;
49798              const c = n.y > r.y ? n.y > o.y ? n.y : o.y : r.y > o.y ? r.y : o.y;
49799              const u = Ak(a, l, e, i, s);
49800              const _ = Ak(h, c, e, i, s);
49801              let d = t.nextZ;
49802              for (;d && d.z <= _; ) {
49803                if (d !== t.prev && d !== t.next && vk(n.x, n.y, r.x, r.y, o.x, o.y, d.x, d.y) && Ck(d.prev, d, d.next) >= 0) return !1;
49804                d = d.nextZ;
49805              }
49806              d = t.prevZ;
49807              for (;d && d.z >= u; ) {
49808                if (d !== t.prev && d !== t.next && vk(n.x, n.y, r.x, r.y, o.x, o.y, d.x, d.y) && Ck(d.prev, d, d.next) >= 0) return !1;
49809                d = d.prevZ;
49810              }
49811              return !0;
49812            }
49813            function gk(t, e, i) {
49814              let s = t;
49815              do {
49816                const n = s.prev;
49817                const r = s.next.next;
49818                if (!xk(n, r) && wk(n, s, s.next, r) && Rk(n, r) && Rk(r, n)) {
49819                  e.push(n.i / i);
49820                  e.push(s.i / i);
49821                  e.push(r.i / i);
49822                  Bk(s);
49823                  Bk(s.next);
49824                  s = t = r;
49825                }
49826                s = s.next;
49827              } while (s !== t);
49828              return s;
49829            }
49830            function yk(t, e, i, s, n, r) {
49831              let o = t;
49832              do {
49833                let t = o.next.next;
49834                for (;t !== o.prev; ) {
49835                  if (o.i !== t.i && Ek(o, t)) {
49836                    let a = Ik(o, t);
49837                    o = dk(o, o.next);
49838                    a = dk(a, a.next);
49839                    pk(o, e, i, s, n, r);
49840                    pk(a, e, i, s, n, r);
49841                    return;
49842                  }
49843                  t = t.next;
49844                }
49845                o = o.next;
49846              } while (o !== t);
49847            }
49848            function bk(t, e) {
49849              return t.x - e.x;
49850            }
49851            function Sk(t, e) {
49852              e = function(t, e) {
49853                let i = e;
49854                const s = t.x;
49855                const n = t.y;
49856                let r = -1 / 0;
49857                let o = null;
49858                do {
49859                  if (n <= i.y && n >= i.next.y) {
49860                    const t = i.x + (n - i.y) * (i.next.x - i.x) / (i.next.y - i.y);
49861                    if (t <= s && t > r) {
49862                      r = t;
49863                      if (t === s) {
49864                        if (n === i.y) return i;
49865                        if (n === i.next.y) return i.next;
49866                      }
49867                      o = i.x < i.next.x ? i : i.next;
49868                    }
49869                  }
49870                  i = i.next;
49871                } while (i !== e);
49872                if (!o) return null;
49873                if (s === r) return o.prev;
49874                const a = o;
49875                const l = o.x;
49876                const h = o.y;
49877                let c = 1 / 0;
49878                let u;
49879                i = o.next;
49880                for (;i !== a; ) {
49881                  if (s >= i.x && i.x >= l && vk(n < h ? s : r, n, l, h, n < h ? r : s, n, i.x, i.y)) {
49882                    u = Math.abs(n - i.y) / (s - i.x);
49883                    if ((u < c || u === c && i.x > o.x) && Rk(i, t)) {
49884                      o = i;
49885                      c = u;
49886                    }
49887                  }
49888                  i = i.next;
49889                }
49890                return o;
49891              }(t, e);
49892              if (e) {
49893                const i = Ik(e, t);
49894                dk(i, i.next);
49895              }
49896            }
49897            function Ak(t, e, i, s, n) {
49898              return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - i) / n) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - s) / n) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1;
49899            }
49900            function Tk(t) {
49901              let e = t;
49902              let i = t;
49903              do {
49904                e.x < i.x && (i = e);
49905                e = e.next;
49906              } while (e !== t);
49907              return i;
49908            }
49909            function vk(t, e, i, s, n, r, o, a) {
49910              return (n - o) * (e - a) - (t - o) * (r - a) >= 0 && (t - o) * (s - a) - (i - o) * (e - a) >= 0 && (i - o) * (r - a) - (n - o) * (s - a) >= 0;
49911            }
49912            function Ek(t, e) {
49913              return t.next.i !== e.i && t.prev.i !== e.i && !function(t, e) {
49914                let i = t;
49915                do {
49916                  if (i.i !== t.i && i.next.i !== t.i && i.i !== e.i && i.next.i !== e.i && wk(i, i.next, t, e)) return !0;
49917                  i = i.next;
49918                } while (i !== t);
49919                return !1;
49920              }(t, e) && Rk(t, e) && Rk(e, t) && function(t, e) {
49921                let i = t;
49922                let s = !1;
49923                const n = (t.x + e.x) / 2;
49924                const r = (t.y + e.y) / 2;
49925                do {
49926                  i.y > r != i.next.y > r && n < (i.next.x - i.x) * (r - i.y) / (i.next.y - i.y) + i.x && (s = !s);
49927                  i = i.next;
49928                } while (i !== t);
49929                return s;
49930              }(t, e);
49931            }
49932            function Ck(t, e, i) {
49933              return (e.y - t.y) * (i.x - e.x) - (e.x - t.x) * (i.y - e.y);
49934            }
49935            function xk(t, e) {
49936              return t.x === e.x && t.y === e.y;
49937            }
49938            function wk(t, e, i, s) {
49939              return !!(xk(t, e) && xk(i, s) || xk(t, s) && xk(i, e)) || Ck(t, e, i) > 0 != Ck(t, e, s) > 0 && Ck(i, s, t) > 0 != Ck(i, s, e) > 0;
49940            }
49941            function Rk(t, e) {
49942              return Ck(t.prev, t, t.next) < 0 ? Ck(t, e, t.next) >= 0 && Ck(t, t.prev, e) >= 0 : Ck(t, e, t.prev) < 0 || Ck(t, t.next, e) < 0;
49943            }
49944            function Ik(t, e) {
49945              const i = new uk(t.i, t.x, t.y);
49946              const s = new uk(e.i, e.x, e.y);
49947              const n = t.next;
49948              const r = e.prev;
49949              t.next = e;
49950              e.prev = t;
49951              i.next = n;
49952              n.prev = i;
49953              s.next = i;
49954              i.prev = s;
49955              r.next = s;
49956              s.prev = r;
49957              return s;
49958            }
49959            function Mk(t, e, i, s) {
49960              const n = new uk(t, e, i);
49961              if (s) {
49962                n.next = s.next;
49963                n.prev = s;
49964                s.next.prev = n;
49965                s.next = n;
49966              } else {
49967                n.prev = n;
49968                n.next = n;
49969              }
49970              return n;
49971            }
49972            function Bk(t) {
49973              t.next.prev = t.prev;
49974              t.prev.next = t.next;
49975              t.prevZ && (t.prevZ.nextZ = t.nextZ);
49976              t.nextZ && (t.nextZ.prevZ = t.prevZ);
49977            }
49978            function Dk(t, e, i) {
49979              i = i || 3;
49980              const s = e ? e.length : 0;
49981              const n = s ? e[0] * i : t.length;
49982              let r = _k(t, 0, n, i, !0);
49983              const o = [];
49984              if (!r) return o;
49985              let a = 0;
49986              let l = 0;
49987              let h = 0;
49988              let c = 0;
49989              let u = 0;
49990              let _ = 0;
49991              let d = 0;
49992              s && (r = function(t, e, i, s) {
49993                const n = [];
49994                let r = 0;
49995                let o = 0;
49996                let a = 0;
49997                let l = 0;
49998                let h = null;
49999                for (r = 0, o = e.length; r < o; r++) {
50000                  a = e[r] * s;
50001                  l = r < o - 1 ? e[r + 1] * s : t.length;
50002                  h = _k(t, a, l, s, !1);
50003                  if (h) {
50004                    h === h.next && (h.steiner = !0);
50005                    n.push(Tk(h));
50006                  }
50007                }
50008                n.sort(bk);
50009                if (!i) return i;
50010                for (r = 0; r < n.length; r++) {
50011                  Sk(n[r], i);
50012                  i = dk(i, i.next);
50013                }
50014                return i;
50015              }(t, e, r, i));
50016              if (t.length > 80 * i) {
50017                a = h = t[0];
50018                l = c = t[1];
50019                for (let e = i; e < n; e += i) {
50020                  u = t[e];
50021                  _ = t[e + 1];
50022                  u < a && (a = u);
50023                  _ < l && (l = _);
50024                  u > h && (h = u);
50025                  _ > c && (c = _);
50026                }
50027                d = Math.max(h - a, c - l);
50028              }
50029              pk(r, o, i, a, l, d);
50030              return o;
50031            }
50032            const Pk = Math.PI;
50033            const Ok = Math.min;
50034            const Nk = Math.max;
50035            const Lk = Math.ceil;
50036            const Fk = Math.acos;
50037            const Vk = Math.cos;
50038            const kk = Math.sin;
50039            const Uk = Math.atan2;
50040            let Gk = null;
50041            let zk = null;
50042            const Hk = new Bi;
50043            const jk = [];
50044            for (let t = 0; t < 4; t++) jk.push(new Pi);
50045            function Xk(t, e, i) {
50046              return t < e ? e : t > i ? i : t;
50047            }
50048            const Wk = {
50049              useModel: !0,
50050              updateRenderData(t) {
50051                t.renderData && (t.renderData.material = t.getMaterialInstance(0));
50052              },
50053              fillBuffers(t, e) {},
50054              renderIA(t, e) {},
50055              getRenderData(t, e) {
50056                if (!zk) return null;
50057                const i = zk.getRenderDataList();
50058                let s = i[zk.dataOffset];
50059                if (!s) return null;
50060                let n = s;
50061                const r = n ? n.vertexStart + e : 0;
50062                if (r > 65535 || 3 * r > 131070) {
50063                  ++zk.dataOffset;
50064                  if (zk.dataOffset < i.length) s = i[zk.dataOffset]; else {
50065                    s = zk.requestRenderData();
50066                    i[zk.dataOffset] = s;
50067                  }
50068                  n = s;
50069                }
50070                n && n.vertexCount < r && n.request(e, 3 * e);
50071                return s;
50072              },
50073              stroke(t) {
50074                Bi.copy(Hk, t.strokeColor);
50075                if (t.impl) {
50076                  this._flattenPaths(t.impl);
50077                  this._expandStroke(t);
50078                  t.impl.updatePathOffset = !0;
50079                  this.end(t);
50080                }
50081              },
50082              fill(t) {
50083                Bi.copy(Hk, t.fillColor);
50084                this._expandFill(t);
50085                t.impl && (t.impl.updatePathOffset = !0);
50086                this.end(t);
50087              },
50088              end(t) {
50089                t.markForUpdateRenderData();
50090              },
50091              _expandStroke(t) {
50092                const e = .5 * t.lineWidth;
50093                const i = t.lineCap;
50094                const s = t.lineJoin;
50095                const n = t.miterLimit;
50096                zk = t.impl;
50097                if (!zk) return;
50098                const r = function(t, e, i) {
50099                  const s = 2 * Fk(t / (t + i));
50100                  return Nk(2, Lk(e / s));
50101                }(e, Pk, zk.tessTol);
50102                this._calculateJoins(zk, e, s, n);
50103                const o = zk.paths;
50104                let a = 0;
50105                for (let t = zk.pathOffset, e = zk.pathLength; t < e; t++) {
50106                  const e = o[t];
50107                  const n = e.points.length;
50108                  s === xO.ROUND ? a += 2 * (n + e.bevel * (r + 2) + 1) : a += 2 * (n + 5 * e.bevel + 1);
50109                  e.closed || (i === CO.ROUND ? a += 2 * (2 * r + 2) : a += 12);
50110                }
50111                const l = Gk = this.getRenderData(t, a);
50112                if (!l) return;
50113                const h = l.vData;
50114                const c = l.iData;
50115                for (let t = zk.pathOffset, n = zk.pathLength; t < n; t++) {
50116                  const n = o[t];
50117                  const a = n.points;
50118                  const u = a.length;
50119                  const _ = l.vertexStart;
50120                  let d;
50121                  let p;
50122                  let m = 0;
50123                  let f = 0;
50124                  const g = n.closed;
50125                  if (g) {
50126                    d = a[u - 1];
50127                    p = a[0];
50128                    m = 0;
50129                    f = u;
50130                  } else {
50131                    d = a[0];
50132                    p = a[1];
50133                    m = 1;
50134                    f = u - 1;
50135                  }
50136                  p = p || d;
50137                  if (!g) {
50138                    const t = new VO(p.x, p.y);
50139                    t.subtract(d);
50140                    t.normalize();
50141                    const s = t.x;
50142                    const n = t.y;
50143                    i === CO.BUTT ? this._buttCapStart(d, s, n, e, 0) : i === CO.SQUARE ? this._buttCapStart(d, s, n, e, e) : i === CO.ROUND && this._roundCapStart(d, s, n, e, r);
50144                  }
50145                  for (let t = m; t < f; ++t) {
50146                    if (s === xO.ROUND) this._roundJoin(d, p, e, e, r); else if (0 != (p.flags & (wO.PT_BEVEL | wO.PT_INNERBEVEL))) this._bevelJoin(d, p, e, e); else {
50147                      this._vSet(p.x + p.dmx * e, p.y + p.dmy * e, 1);
50148                      this._vSet(p.x - p.dmx * e, p.y - p.dmy * e, -1);
50149                    }
50150                    d = p;
50151                    p = a[t + 1];
50152                  }
50153                  if (g) {
50154                    const t = 8 * _;
50155                    this._vSet(h[t], h[t + 1], 1);
50156                    this._vSet(h[t + 8], h[t + 8 + 1], -1);
50157                  } else {
50158                    const t = new VO(p.x, p.y);
50159                    t.subtract(d);
50160                    t.normalize();
50161                    const s = t.x;
50162                    const n = t.y;
50163                    i === CO.BUTT ? this._buttCapEnd(p, s, n, e, 0) : i === CO.SQUARE ? this._buttCapEnd(p, s, n, e, e) : i === CO.ROUND && this._roundCapEnd(p, s, n, e, r);
50164                  }
50165                  let y = l.indexStart;
50166                  for (let t = _ + 2, e = l.vertexStart; t < e; t++) {
50167                    c[y++] = t - 2;
50168                    c[y++] = t - 1;
50169                    c[y++] = t;
50170                  }
50171                  l.indexStart = y;
50172                }
50173                Gk = null;
50174                zk = null;
50175              },
50176              _expandFill(t) {
50177                zk = t.impl;
50178                if (!zk) return;
50179                const e = zk.paths;
50180                let i = 0;
50181                for (let t = zk.pathOffset, s = zk.pathLength; t < s; t++) {
50182                  i += e[t].points.length;
50183                }
50184                const s = Gk = this.getRenderData(t, i);
50185                if (!s) return;
50186                const n = s;
50187                const r = n.vData;
50188                const o = n.iData;
50189                for (let t = zk.pathOffset, i = zk.pathLength; t < i; t++) {
50190                  const i = e[t];
50191                  const a = i.points;
50192                  const l = a.length;
50193                  if (0 === l) continue;
50194                  const h = s.vertexStart;
50195                  for (let t = 0; t < l; ++t) this._vSet(a[t].x, a[t].y);
50196                  let c = s.indexStart;
50197                  if (i.complex) {
50198                    const t = [];
50199                    for (let e = h, i = s.vertexStart; e < i; e++) {
50200                      let i = 8 * e;
50201                      t.push(r[i++]);
50202                      t.push(r[i++]);
50203                      t.push(r[i++]);
50204                    }
50205                    const e = Dk(t, null, 3);
50206                    if (!e || 0 === e.length) continue;
50207                    for (let t = 0, i = e.length; t < i; t++) o[c++] = e[t] + h;
50208                  } else {
50209                    const t = h;
50210                    for (let e = h + 2, i = n.vertexStart; e < i; e++) {
50211                      o[c++] = t;
50212                      o[c++] = e - 1;
50213                      o[c++] = e;
50214                    }
50215                  }
50216                  n.indexStart = c;
50217                }
50218                Gk = null;
50219                zk = null;
50220              },
50221              _calculateJoins(t, e, i, s) {
50222                let n = 0;
50223                e > 0 && (n = 1 / e);
50224                const r = t.paths;
50225                for (let e = t.pathOffset, o = t.pathLength; e < o; e++) {
50226                  const t = r[e];
50227                  const o = t.points;
50228                  const a = o.length;
50229                  let l = o[a - 1];
50230                  let h = o[0];
50231                  t.bevel = 0;
50232                  for (let e = 0; e < a; e++) {
50233                    let r = 0;
50234                    let a = 0;
50235                    let c = 0;
50236                    const u = l.dy;
50237                    const _ = -l.dx;
50238                    const d = h.dy;
50239                    const p = -h.dx;
50240                    h.dmx = .5 * (u + d);
50241                    h.dmy = .5 * (_ + p);
50242                    r = h.dmx * h.dmx + h.dmy * h.dmy;
50243                    if (r > 1e-6) {
50244                      let t = 1 / r;
50245                      t > 600 && (t = 600);
50246                      h.dmx *= t;
50247                      h.dmy *= t;
50248                    }
50249                    a = h.dx * l.dy - l.dx * h.dy;
50250                    a > 0 && (h.flags |= wO.PT_LEFT);
50251                    c = Nk(11, Ok(l.len, h.len) * n);
50252                    r * c * c < 1 && (h.flags |= wO.PT_INNERBEVEL);
50253                    h.flags & wO.PT_CORNER && (r * s * s < 1 || i === xO.BEVEL || i === xO.ROUND) && (h.flags |= wO.PT_BEVEL);
50254                    0 != (h.flags & (wO.PT_BEVEL | wO.PT_INNERBEVEL)) && t.bevel++;
50255                    l = h;
50256                    h = o[e + 1];
50257                  }
50258                }
50259              },
50260              _flattenPaths(t) {
50261                const e = t.paths;
50262                for (let i = t.pathOffset, s = t.pathLength; i < s; i++) {
50263                  const t = e[i];
50264                  const s = t.points;
50265                  let n = s[s.length - 1];
50266                  let r = s[0];
50267                  if (s.length > 2 && n.equals(r)) {
50268                    t.closed = !0;
50269                    s.pop();
50270                    n = s[s.length - 1];
50271                  }
50272                  for (let t = 0, e = s.length; t < e; t++) {
50273                    const e = new VO(r.x, r.y);
50274                    e.subtract(n);
50275                    n.len = e.length();
50276                    (e.x || e.y) && e.normalize();
50277                    n.dx = e.x;
50278                    n.dy = e.y;
50279                    n = r;
50280                    r = s[t + 1];
50281                  }
50282                }
50283              },
50284              _chooseBevel(t, e, i, s) {
50285                const n = i.x;
50286                const r = i.y;
50287                let o = 0;
50288                let a = 0;
50289                let l = 0;
50290                let h = 0;
50291                if (0 !== t) {
50292                  o = n + e.dy * s;
50293                  a = r - e.dx * s;
50294                  l = n + i.dy * s;
50295                  h = r - i.dx * s;
50296                } else {
50297                  o = l = n + i.dmx * s;
50298                  a = h = r + i.dmy * s;
50299                }
50300                return [ o, a, l, h ];
50301              },
50302              _buttCapStart(t, e, i, s, n) {
50303                const r = t.x - e * n;
50304                const o = t.y - i * n;
50305                const a = i;
50306                const l = -e;
50307                this._vSet(r + a * s, o + l * s, 1);
50308                this._vSet(r - a * s, o - l * s, -1);
50309              },
50310              _buttCapEnd(t, e, i, s, n) {
50311                const r = t.x + e * n;
50312                const o = t.y + i * n;
50313                const a = i;
50314                const l = -e;
50315                this._vSet(r + a * s, o + l * s, 1);
50316                this._vSet(r - a * s, o - l * s, -1);
50317              },
50318              _roundCapStart(t, e, i, s, n) {
50319                const r = t.x;
50320                const o = t.y;
50321                const a = i;
50322                const l = -e;
50323                for (let t = 0; t < n; t++) {
50324                  const h = t / (n - 1) * Pk;
50325                  const c = Vk(h) * s;
50326                  const u = kk(h) * s;
50327                  this._vSet(r - a * c - e * u, o - l * c - i * u, 1);
50328                  this._vSet(r, o, 0);
50329                }
50330                this._vSet(r + a * s, o + l * s, 1);
50331                this._vSet(r - a * s, o - l * s, -1);
50332              },
50333              _roundCapEnd(t, e, i, s, n) {
50334                const r = t.x;
50335                const o = t.y;
50336                const a = i;
50337                const l = -e;
50338                this._vSet(r + a * s, o + l * s, 1);
50339                this._vSet(r - a * s, o - l * s, -1);
50340                for (let t = 0; t < n; t++) {
50341                  const h = t / (n - 1) * Pk;
50342                  const c = Vk(h) * s;
50343                  const u = kk(h) * s;
50344                  this._vSet(r, o, 0);
50345                  this._vSet(r - a * c + e * u, o - l * c + i * u, 1);
50346                }
50347              },
50348              _roundJoin(t, e, i, s, n) {
50349                const r = t.dy;
50350                const o = -t.dx;
50351                const a = e.dy;
50352                const l = -e.dx;
50353                const h = e.x;
50354                const c = e.y;
50355                if (0 != (e.flags & wO.PT_LEFT)) {
50356                  const u = this._chooseBevel(e.flags & wO.PT_INNERBEVEL, t, e, i);
50357                  const _ = u[0];
50358                  const d = u[1];
50359                  const p = u[2];
50360                  const m = u[3];
50361                  const f = Uk(-o, -r);
50362                  let g = Uk(-l, -a);
50363                  g > f && (g -= 2 * Pk);
50364                  this._vSet(_, d, 1);
50365                  this._vSet(h - r * s, e.y - o * s, -1);
50366                  const y = Xk(Lk((f - g) / Pk) * n, 2, n);
50367                  for (let t = 0; t < y; t++) {
50368                    const e = f + t / (y - 1) * (g - f);
50369                    const i = h + Vk(e) * s;
50370                    const n = c + kk(e) * s;
50371                    this._vSet(h, c, 0);
50372                    this._vSet(i, n, -1);
50373                  }
50374                  this._vSet(p, m, 1);
50375                  this._vSet(h - a * s, c - l * s, -1);
50376                } else {
50377                  const u = this._chooseBevel(e.flags & wO.PT_INNERBEVEL, t, e, -s);
50378                  const _ = u[0];
50379                  const d = u[1];
50380                  const p = u[2];
50381                  const m = u[3];
50382                  const f = Uk(o, r);
50383                  let g = Uk(l, a);
50384                  g < f && (g += 2 * Pk);
50385                  this._vSet(h + r * s, c + o * s, 1);
50386                  this._vSet(_, d, -1);
50387                  const y = Xk(Lk((g - f) / Pk) * n, 2, n);
50388                  for (let t = 0; t < y; t++) {
50389                    const e = f + t / (y - 1) * (g - f);
50390                    const s = h + Vk(e) * i;
50391                    const n = c + kk(e) * i;
50392                    this._vSet(s, n, 1);
50393                    this._vSet(h, c, 0);
50394                  }
50395                  this._vSet(h + a * s, c + l * s, 1);
50396                  this._vSet(p, m, -1);
50397                }
50398              },
50399              _bevelJoin(t, e, i, s) {
50400                let n = 0;
50401                let r = 0;
50402                let o = 0;
50403                let a = 0;
50404                let l = 0;
50405                let h = 0;
50406                let c = 0;
50407                let u = 0;
50408                const _ = t.dy;
50409                const d = -t.dx;
50410                const p = e.dy;
50411                const m = -e.dx;
50412                if (e.flags & wO.PT_LEFT) {
50413                  const n = this._chooseBevel(e.flags & wO.PT_INNERBEVEL, t, e, i);
50414                  l = n[0];
50415                  h = n[1];
50416                  c = n[2];
50417                  u = n[3];
50418                  this._vSet(l, h, 1);
50419                  this._vSet(e.x - _ * s, e.y - d * s, -1);
50420                  this._vSet(c, u, 1);
50421                  this._vSet(e.x - p * s, e.y - m * s, -1);
50422                } else {
50423                  const l = this._chooseBevel(e.flags & wO.PT_INNERBEVEL, t, e, -s);
50424                  n = l[0];
50425                  r = l[1];
50426                  o = l[2];
50427                  a = l[3];
50428                  this._vSet(e.x + _ * i, e.y + d * i, 1);
50429                  this._vSet(n, r, -1);
50430                  this._vSet(e.x + p * i, e.y + m * i, 1);
50431                  this._vSet(o, a, -1);
50432                }
50433              },
50434              _vSet(t, e, i = 0) {
50435                if (!Gk) return;
50436                const s = Gk;
50437                let n = 8 * s.vertexStart;
50438                const r = s.vData;
50439                r[n++] = t;
50440                r[n++] = e;
50441                r[n++] = 0;
50442                Bi.toArray(r, Hk, n);
50443                n += 4;
50444                r[n++] = i;
50445                s.vertexStart++;
50446              }
50447            };
50448            const Yk = t("graphicsAssembler", {
50449              getAssembler: t => Wk
50450            });
50451            dN.Assembler = Yk;
50452            class qk {
50453              constructor() {
50454                this.char = "";
50455                this.valid = !0;
50456                this.x = 0;
50457                this.y = 0;
50458                this.line = 0;
50459                this.hash = "";
50460              }
50461            }
50462            const Kk = new as;
50463            const Jk = new VM(64, 64);
50464            const Zk = new cM(null);
50465            let Qk = null;
50466            let $k = null;
50467            const tU = [];
50468            const eU = [];
50469            const iU = [];
50470            const sU = [];
50471            const nU = new rs;
50472            const rU = new rs;
50473            const oU = new Qi;
50474            let aU = null;
50475            let lU = 0;
50476            let hU = 0;
50477            let cU = 0;
50478            let uU = 0;
50479            let _U = 0;
50480            let dU = 1;
50481            let pU = null;
50482            let mU = "";
50483            let fU = 0;
50484            let gU = 0;
50485            let yU = 0;
50486            let bU = 0;
50487            let SU = 0;
50488            let AU = 0;
50489            let TU = 0;
50490            let vU = !1;
50491            let EU = 0;
50492            let CU = 0;
50493            let xU = 0;
50494            let wU;
50495            const RU = {
50496              updateRenderData(t) {
50497                if (t.renderData && Qk !== t) {
50498                  if (t.renderData.vertDirty) {
50499                    Qk = t;
50500                    $k = Qk.node._uiProps.uiTransformComp;
50501                    this._updateFontFamily(t);
50502                    this._updateProperties(t);
50503                    this._updateLabelInfo(t);
50504                    this._updateContent();
50505                    Qk.actualFontSize = fU;
50506                    $k.setContentSize(rU);
50507                    this.updateUVs(t);
50508                    this.updateColor(t);
50509                    Qk.renderData.vertDirty = !1;
50510                    Qk = null;
50511                    this._resetProperties();
50512                  }
50513                  if (t.spriteFrame) {
50514                    t.renderData.updateRenderData(t, t.spriteFrame);
50515                  }
50516                }
50517              },
50518              updateUVs(t) {
50519                const e = t.renderData;
50520                const i = e.chunk.vb;
50521                const s = e.vertexCount;
50522                const n = e.data;
50523                let r = 3;
50524                for (let t = 0; t < s; t++) {
50525                  const e = n[t];
50526                  i[r] = e.u;
50527                  i[r + 1] = e.v;
50528                  r += 9;
50529                }
50530              },
50531              updateColor(t) {
50532                {
50533                  const e = t.renderData;
50534                  const i = e.vertexCount;
50535                  if (0 === i) return;
50536                  const s = e.chunk.vb;
50537                  const n = e.floatStride;
50538                  let r = 5;
50539                  const o = t.color;
50540                  const a = o.r / 255;
50541                  const l = o.g / 255;
50542                  const h = o.b / 255;
50543                  const c = o.a / 255;
50544                  for (let t = 0; t < i; t++) {
50545                    s[r] = a;
50546                    s[r + 1] = l;
50547                    s[r + 2] = h;
50548                    s[r + 3] = c;
50549                    r += n;
50550                  }
50551                }
50552              },
50553              _updateFontScale() {
50554                dU = fU / gU;
50555              },
50556              _updateFontFamily(t) {
50557                const e = t.font;
50558                pU = e.spriteFrame;
50559                aU = e.fntConfig;
50560                kM.fontAtlas = e.fontDefDictionary;
50561                kM.fontAtlas || (t.cacheMode === RP.CHAR ? kM.fontAtlas = Jk : kM.fontAtlas = Zk);
50562                EI.packToDynamicAtlas(t, pU);
50563              },
50564              _updateLabelInfo(t) {
50565                kM.hash = "";
50566                kM.margin = 0;
50567              },
50568              _updateProperties(t) {
50569                mU = t.string.toString();
50570                fU = t.fontSize;
50571                gU = aU ? aU.fontSize : t.fontSize;
50572                yU = t.horizontalAlign;
50573                bU = t.verticalAlign;
50574                SU = t.spacingX;
50575                TU = t.overflow;
50576                AU = t._lineHeight;
50577                const e = $k.contentSize;
50578                rU.width = e.width;
50579                rU.height = e.height;
50580                if (TU === wP.NONE) {
50581                  vU = !1;
50582                  rU.width += 2 * kM.margin;
50583                  rU.height += 2 * kM.margin;
50584                } else if (TU === wP.RESIZE_HEIGHT) {
50585                  vU = !0;
50586                  rU.height += 2 * kM.margin;
50587                } else vU = t.enableWrapText;
50588                kM.lineHeight = AU;
50589                kM.fontSize = fU;
50590                this._setupBMFontOverflowMetrics();
50591              },
50592              _resetProperties() {
50593                aU = null;
50594                pU = null;
50595                kM.hash = "";
50596                kM.margin = 0;
50597              },
50598              _updateContent() {
50599                this._updateFontScale();
50600                this._computeHorizontalKerningForText();
50601                this._alignText();
50602              },
50603              _computeHorizontalKerningForText() {
50604                const t = mU;
50605                const e = t.length;
50606                const i = aU.kerningDict;
50607                const s = tU;
50608                if (!i) return;
50609                let n = -1;
50610                for (let r = 0; r < e; ++r) {
50611                  const o = t.charCodeAt(r);
50612                  const a = i[n << 16 | 65535 & o] || 0;
50613                  s[r] = r < e - 1 ? a : 0;
50614                  n = o;
50615                }
50616              },
50617              _multilineTextWrap(t) {
50618                const e = mU.length;
50619                let i = 0;
50620                let s = 0;
50621                let n = 0;
50622                let r = 0;
50623                let o = 0;
50624                let a = 0;
50625                let l = 0;
50626                let h = null;
50627                for (let c = 0; c < e; ) {
50628                  let u = mU.charAt(c);
50629                  if ("\n" === u) {
50630                    iU.push(o);
50631                    o = 0;
50632                    i++;
50633                    s = 0;
50634                    n -= AU * this._getFontScale() + 0;
50635                    this._recordPlaceholderInfo(c, u);
50636                    c++;
50637                    continue;
50638                  }
50639                  const _ = t(mU, c, e);
50640                  let d = a;
50641                  let p = l;
50642                  let m = o;
50643                  let f = s;
50644                  let g = !1;
50645                  for (let t = 0; t < _; ++t) {
50646                    const r = c + t;
50647                    u = mU.charAt(r);
50648                    if ("\r" === u) {
50649                      this._recordPlaceholderInfo(r, u);
50650                      continue;
50651                    }
50652                    h = kM.fontAtlas.getLetterDefinitionForChar(u, kM);
50653                    if (!h) {
50654                      this._recordPlaceholderInfo(r, u);
50655                      console.log(`Can't find letter definition in texture atlas ${aU.atlasName} for letter:${u}`);
50656                      continue;
50657                    }
50658                    const a = f + h.offsetX * dU - kM.margin;
50659                    if (vU && xU > 0 && s > 0 && a + h.w * dU > xU && !CM(u)) {
50660                      iU.push(o);
50661                      o = 0;
50662                      i++;
50663                      s = 0;
50664                      n -= AU * this._getFontScale() + 0;
50665                      g = !0;
50666                      break;
50667                    }
50668                    oU.x = a;
50669                    oU.y = n - h.offsetY * dU;
50670                    this._recordLetterInfo(oU, u, r, i);
50671                    r + 1 < tU.length && r < e - 1 && (f += tU[r + 1]);
50672                    f += h.xAdvance * dU + SU;
50673                    m = oU.x + h.w * dU;
50674                    d < oU.y && (d = oU.y);
50675                    p > oU.y - h.h * dU && (p = oU.y - h.h * dU);
50676                  }
50677                  if (!g) {
50678                    s = f;
50679                    o = m;
50680                    a < d && (a = d);
50681                    l > p && (l = p);
50682                    r < o && (r = o);
50683                    c += _;
50684                  }
50685                }
50686                iU.push(o);
50687                lU = i + 1;
50688                hU = lU * AU * this._getFontScale();
50689                lU > 1 && (hU += 0 * (lU - 1));
50690                rU.width = EU;
50691                rU.height = CU;
50692                EU <= 0 && (rU.width = parseFloat(r.toFixed(2)) + 2 * kM.margin);
50693                CU <= 0 && (rU.height = parseFloat(hU.toFixed(2)) + 2 * kM.margin);
50694                uU = rU.height;
50695                _U = 0;
50696                a > 0 && (uU = rU.height + a);
50697                l < -hU && (_U = hU + l);
50698                return !0;
50699              },
50700              _getFirstCharLen: () => 1,
50701              _getFontScale: () => TU === wP.SHRINK ? dU : 1,
50702              _getFirstWordLen(t, e, i) {
50703                let s = t.charAt(e);
50704                if (EM(s) || "\n" === s || CM(s)) return 1;
50705                let n = 1;
50706                let r = kM.fontAtlas.getLetterDefinitionForChar(s, kM);
50707                if (!r) return n;
50708                let o = r.xAdvance * dU + SU;
50709                let a = 0;
50710                for (let l = e + 1; l < i; ++l) {
50711                  s = t.charAt(l);
50712                  r = kM.fontAtlas.getLetterDefinitionForChar(s, kM);
50713                  if (!r) break;
50714                  a = o + r.offsetX * dU;
50715                  if (a + r.w * dU > xU && !CM(s) && xU > 0) return n;
50716                  o += r.xAdvance * dU + SU;
50717                  if ("\n" === s || CM(s) || EM(s)) break;
50718                  n++;
50719                }
50720                return n;
50721              },
50722              _multilineTextWrapByWord() {
50723                return this._multilineTextWrap(this._getFirstWordLen);
50724              },
50725              _multilineTextWrapByChar() {
50726                return this._multilineTextWrap(this._getFirstCharLen);
50727              },
50728              _recordPlaceholderInfo(t, e) {
50729                if (t >= eU.length) {
50730                  const t = new qk;
50731                  eU.push(t);
50732                }
50733                eU[t].char = e;
50734                eU[t].hash = `${e.charCodeAt(0)}${kM.hash}`;
50735                eU[t].valid = !1;
50736              },
50737              _recordLetterInfo(t, e, i, s) {
50738                if (i >= eU.length) {
50739                  const t = new qk;
50740                  eU.push(t);
50741                }
50742                const n = `${e.charCodeAt(0)}${kM.hash}`;
50743                eU[i].line = s;
50744                eU[i].char = e;
50745                eU[i].hash = n;
50746                eU[i].valid = kM.fontAtlas.getLetter(n).valid;
50747                eU[i].x = t.x;
50748                eU[i].y = t.y;
50749              },
50750              _alignText() {
50751                hU = 0;
50752                iU.length = 0;
50753                this._multilineTextWrapByWord();
50754                this._computeAlignmentOffset();
50755                TU === wP.SHRINK && fU > 0 && this._isVerticalClamp() && this._shrinkLabelToContentSize(this._isVerticalClamp);
50756                this._updateQuads() || TU === wP.SHRINK && this._shrinkLabelToContentSize(this._isHorizontalClamp);
50757              },
50758              _scaleFontSizeDown(t) {
50759                let e = !0;
50760                if (!t) {
50761                  t = .1;
50762                  e = !1;
50763                }
50764                fU = t;
50765                e && this._updateContent();
50766              },
50767              _shrinkLabelToContentSize(t) {
50768                let e = 0;
50769                let i = 0 | fU;
50770                let s = 0;
50771                for (;e < i; ) {
50772                  s = e + i + 1 >> 1;
50773                  const n = s;
50774                  if (n <= 0) break;
50775                  dU = n / gU;
50776                  this._multilineTextWrapByWord();
50777                  this._computeAlignmentOffset();
50778                  t() ? i = s - 1 : e = s;
50779                }
50780                e >= 0 && this._scaleFontSizeDown(e);
50781              },
50782              _isVerticalClamp: () => hU > rU.height,
50783              _isHorizontalClamp() {
50784                let t = !1;
50785                for (let e = 0, i = mU.length; e < i; ++e) {
50786                  const i = eU[e];
50787                  if (i.valid) {
50788                    const e = kM.fontAtlas.getLetterDefinitionForChar(i.char, kM);
50789                    if (!e) continue;
50790                    const s = i.x + e.w * dU;
50791                    const n = i.line;
50792                    if (EU > 0) if (vU) {
50793                      if (iU[n] > rU.width && (s > rU.width || s < 0)) {
50794                        t = !0;
50795                        break;
50796                      }
50797                    } else if (s > rU.width) {
50798                      t = !0;
50799                      break;
50800                    }
50801                  }
50802                }
50803                return t;
50804              },
50805              _isHorizontalClamped(t, e) {
50806                const i = iU[e];
50807                const s = t > rU.width || t < 0;
50808                return vU ? i > rU.width && s : s;
50809              },
50810              _updateQuads() {
50811                if (!Qk) return !1;
50812                const t = pU ? pU.texture : kM.fontAtlas.getTexture();
50813                const e = Qk.renderData;
50814                e.dataLength = 0;
50815                e.resize(0, 0);
50816                const i = $k.anchorPoint;
50817                const s = rU;
50818                const n = i.x * s.width;
50819                const r = i.y * s.height;
50820                let o = !0;
50821                for (let e = 0, i = mU.length; e < i; ++e) {
50822                  const i = eU[e];
50823                  if (!i.valid) continue;
50824                  const s = kM.fontAtlas.getLetter(i.hash);
50825                  if (!s) {
50826                    console.warn("Can't find letter in this bitmap-font");
50827                    continue;
50828                  }
50829                  Kk.height = s.h;
50830                  Kk.width = s.w;
50831                  Kk.x = s.u;
50832                  Kk.y = s.v;
50833                  let a = i.y + cU;
50834                  if (CU > 0) {
50835                    if (a > uU) {
50836                      const t = a - uU;
50837                      Kk.y += t;
50838                      Kk.height -= t;
50839                      a -= t;
50840                    }
50841                    a - Kk.height * dU < _U && TU === wP.CLAMP && (Kk.height = a < _U ? 0 : (a - _U) / dU);
50842                  }
50843                  const l = i.line;
50844                  const h = i.x + s.w / 2 * dU + sU[l];
50845                  if (EU > 0 && this._isHorizontalClamped(h, l)) if (TU === wP.CLAMP) Kk.width = 0; else if (TU === wP.SHRINK) {
50846                    if (rU.width > s.w) {
50847                      o = !1;
50848                      break;
50849                    }
50850                    Kk.width = 0;
50851                  }
50852                  if (Kk.height > 0 && Kk.width > 0) {
50853                    const e = this._determineRect();
50854                    const s = i.x + sU[i.line];
50855                    this.appendQuad(Qk, t, Kk, e, s - n, a - r, dU);
50856                  }
50857                }
50858                const a = e.indexCount;
50859                this.createQuadIndices(a);
50860                e.chunk.setIndexBuffer(wU);
50861                return o;
50862              },
50863              createQuadIndices(t) {
50864                if (t % 6 != 0) {
50865                  console.error("illegal index count!");
50866                  return;
50867                }
50868                const e = t / 6;
50869                wU = null;
50870                wU = new Uint16Array(t);
50871                let i = 0;
50872                for (let t = 0; t < e; t++) {
50873                  wU[i++] = 0 + 4 * t;
50874                  wU[i++] = 1 + 4 * t;
50875                  wU[i++] = 2 + 4 * t;
50876                  wU[i++] = 1 + 4 * t;
50877                  wU[i++] = 3 + 4 * t;
50878                  wU[i++] = 2 + 4 * t;
50879                }
50880              },
50881              appendQuad(t, e, i, s, n, r, o) {},
50882              _determineRect() {
50883                const t = pU.isRotated();
50884                const e = pU.getOriginalSize();
50885                const i = pU.getRect();
50886                const s = pU.getOffset();
50887                const n = s.x + (e.width - i.width) / 2;
50888                const r = s.y - (e.height - i.height) / 2;
50889                if (t) {
50890                  const t = Kk.x;
50891                  Kk.x = i.x + i.height - Kk.y - Kk.height - r;
50892                  Kk.y = t + i.y - n;
50893                  Kk.y < 0 && (Kk.height += r);
50894                } else {
50895                  Kk.x += i.x - n;
50896                  Kk.y += i.y + r;
50897                }
50898                return t;
50899              },
50900              _computeAlignmentOffset() {
50901                sU.length = 0;
50902                switch (yU) {
50903                 case CP.LEFT:
50904                  for (let t = 0; t < lU; ++t) sU.push(0);
50905                  break;
50906
50907                 case CP.CENTER:
50908                  for (let t = 0, e = iU.length; t < e; t++) sU.push((rU.width - iU[t]) / 2);
50909                  break;
50910
50911                 case CP.RIGHT:
50912                  for (let t = 0, e = iU.length; t < e; t++) sU.push(rU.width - iU[t]);
50913                }
50914                cU = rU.height;
50915                if (bU !== xP.TOP) {
50916                  const t = rU.height - hU + AU * this._getFontScale() - gU * dU;
50917                  bU === xP.BOTTOM ? cU -= t : cU -= t / 2;
50918                }
50919              },
50920              _setupBMFontOverflowMetrics() {
50921                let t = rU.width;
50922                let e = rU.height;
50923                TU === wP.RESIZE_HEIGHT && (e = 0);
50924                if (TU === wP.NONE) {
50925                  t = 0;
50926                  e = 0;
50927                }
50928                EU = t;
50929                CU = e;
50930                nU.width = t;
50931                nU.height = e;
50932                xU = t;
50933              }
50934            };
50935            const IU = new Bi(255, 255, 255, 255);
50936            const MU = {
50937              createData: t => t.requestRenderData(),
50938              fillBuffers(t, e) {
50939                const i = t.node;
50940                IU.set(t.color);
50941                IU.a = 255 * i._uiProps.opacity;
50942                bI(i, 0, t.renderData, IU);
50943              },
50944              appendQuad(t, e, i, s, n, r, o) {
50945                const a = t.renderData;
50946                if (!a) return;
50947                const l = a.dataLength;
50948                a.dataLength += 4;
50949                a.resize(a.dataLength, a.dataLength / 2 * 3);
50950                const h = a.data;
50951                const c = e.width;
50952                const u = e.height;
50953                const _ = i.width;
50954                const d = i.height;
50955                let p = 0;
50956                let m = 0;
50957                let f = 0;
50958                let g = 0;
50959                if (s) {
50960                  p = i.x / c;
50961                  g = (i.x + d) / c;
50962                  m = (i.y + _) / u;
50963                  f = i.y / u;
50964                  h[l].u = p;
50965                  h[l].v = f;
50966                  h[l + 1].u = p;
50967                  h[l + 1].v = m;
50968                  h[l + 2].u = g;
50969                  h[l + 2].v = f;
50970                  h[l + 3].u = g;
50971                  h[l + 3].v = m;
50972                } else {
50973                  p = i.x / c;
50974                  g = (i.x + _) / c;
50975                  m = (i.y + d) / u;
50976                  f = i.y / u;
50977                  h[l].u = p;
50978                  h[l].v = m;
50979                  h[l + 1].u = g;
50980                  h[l + 1].v = m;
50981                  h[l + 2].u = p;
50982                  h[l + 2].v = f;
50983                  h[l + 3].u = g;
50984                  h[l + 3].v = f;
50985                }
50986                h[l].x = n;
50987                h[l].y = r - d * o;
50988                h[l + 1].x = n + _ * o;
50989                h[l + 1].y = r - d * o;
50990                h[l + 2].x = n;
50991                h[l + 2].y = r;
50992                h[l + 3].x = n + _ * o;
50993                h[l + 3].y = r;
50994              }
50995            };
50996            Ot(MU, RU);
50997            let BU = null;
50998            const DU = Nt(RU, {
50999              getAssemblerData() {
51000                BU || (BU = new VM(1024, 1024));
51001                return BU.getTexture();
51002              },
51003              _updateFontFamily(t) {
51004                kM.fontAtlas = BU;
51005                kM.fontFamily = this._getFontFamily(t);
51006                const e = t.getComponent(ZL);
51007                if (e && e.enabled) {
51008                  kM.isOutlined = !0;
51009                  kM.margin = e.width;
51010                  kM.out = e.color.clone();
51011                  kM.out.a = e.color.a * t.color.a / 255;
51012                } else {
51013                  kM.isOutlined = !1;
51014                  kM.margin = 0;
51015                }
51016              },
51017              _getFontFamily(t) {
51018                let e = "Arial";
51019                t.useSystemFont ? e = t.fontFamily || "Arial" : t.font && (e = t.font._nativeAsset || "Arial");
51020                return e;
51021              },
51022              _updateLabelInfo(t) {
51023                kM.fontDesc = this._getFontDesc();
51024                kM.color = t.color;
51025                kM.hash = function(t) {
51026                  const e = t.color.toHEX();
51027                  let i = "";
51028                  t.isOutlined && t.margin > 0 && (i = i + t.margin + t.out.toHEX());
51029                  return "" + t.fontSize + t.fontFamily + e + i;
51030                }(kM);
51031              },
51032              _getFontDesc() {
51033                let t = `${kM.fontSize.toString()}px `;
51034                t += kM.fontFamily;
51035                return t;
51036              },
51037              _computeHorizontalKerningForText() {},
51038              _determineRect: t => !1
51039            });
51040            const PU = new Bi(255, 255, 255, 255);
51041            const OU = {
51042              createData: t => t.requestRenderData(),
51043              fillBuffers(t, e) {
51044                if (!t.renderData) return;
51045                const i = t.node;
51046                PU.a = 255 * i._uiProps.opacity;
51047                bI(i, 0, t.renderData, PU);
51048              },
51049              appendQuad: MU.appendQuad
51050            };
51051            Ot(OU, DU);
51052            const NU = IP.Overflow;
51053            const LU = (1 / 255).toFixed(3);
51054            let FU = null;
51055            let VU = null;
51056            let kU = null;
51057            let UU = "";
51058            let GU = "";
51059            let zU = 0;
51060            let HU = 0;
51061            let jU = [];
51062            const XU = new rs;
51063            let WU = 0;
51064            let YU = 0;
51065            let qU = 0;
51066            let KU = new Bi;
51067            let JU = 1;
51068            let ZU = "";
51069            let QU = NU.NONE;
51070            let $U = !1;
51071            let tG = null;
51072            const eG = Bi.BLACK.clone();
51073            let iG = null;
51074            const sG = Bi.BLACK.clone();
51075            const nG = new as;
51076            const rG = rs.ZERO.clone();
51077            const oG = rs.ZERO.clone();
51078            const aG = Qi.ZERO.clone();
51079            const lG = Qi.ZERO.clone();
51080            let hG = 0;
51081            let cG = 0;
51082            let uG = !1;
51083            let _G = !1;
51084            let dG = !1;
51085            const pG = [ "left", "center", "right" ];
51086            const mG = {
51087              getAssemblerData: () => IP._canvasPool.get(),
51088              resetAssemblerData(t) {
51089                t && IP._canvasPool.put(t);
51090              },
51091              updateRenderData(t) {
51092                if (t.renderData) {
51093                  if (t.renderData.vertDirty) {
51094                    const e = t.node._uiProps.uiTransformComp;
51095                    this._updateFontFamily(t);
51096                    this._updateProperties(t, e);
51097                    this._calculateLabelFont();
51098                    this._updateLabelDimensions();
51099                    this._updateTexture(t);
51100                    this._calDynamicAtlas(t);
51101                    t.actualFontSize = zU;
51102                    e.setContentSize(XU);
51103                    this.updateVertexData(t);
51104                    this.updateUVs(t);
51105                    t.renderData.vertDirty = !1;
51106                    t.contentWidth = oG.width;
51107                    FU = null;
51108                    VU = null;
51109                    kU = null;
51110                  }
51111                  if (t.spriteFrame) {
51112                    t.renderData.updateRenderData(t, t.spriteFrame);
51113                  }
51114                }
51115              },
51116              updateVertexData(t) {},
51117              updateUVs(t) {},
51118              _updateFontFamily(t) {
51119                ZU = t.useSystemFont ? t.fontFamily || "Arial" : t.font && t.font._nativeAsset || "Arial";
51120              },
51121              _updateProperties(t, e) {
51122                const i = t.assemblerData;
51123                if (i) {
51124                  FU = i.context;
51125                  VU = i.canvas;
51126                  kU = t.spriteFrame;
51127                  GU = t.string.toString();
51128                  zU = t.fontSize;
51129                  HU = zU;
51130                  QU = t.overflow;
51131                  oG.width = XU.width = e.width;
51132                  oG.height = XU.height = e.height;
51133                  cG = t.underlineHeight;
51134                  WU = t.lineHeight;
51135                  YU = t.horizontalAlign;
51136                  qU = t.verticalAlign;
51137                  KU = t.color;
51138                  JU = t.node._uiProps.opacity;
51139                  uG = t.isBold;
51140                  _G = t.isItalic;
51141                  dG = t.isUnderline;
51142                  $U = QU !== NU.NONE && (QU === NU.RESIZE_HEIGHT || t.enableWrapText);
51143                  tG = ZL && t.getComponent(ZL);
51144                  tG = tG && tG.enabled && tG.width > 0 ? tG : null;
51145                  tG && eG.set(tG.color);
51146                  iG = tk && t.getComponent(tk);
51147                  iG = iG && iG.enabled ? iG : null;
51148                  iG && sG.set(iG.color);
51149                  this._updatePaddingRect();
51150                }
51151              },
51152              _updatePaddingRect() {
51153                let t = 0;
51154                let e = 0;
51155                let i = 0;
51156                let s = 0;
51157                let n = 0;
51158                rG.width = rG.height = 0;
51159                if (tG) {
51160                  n = tG.width;
51161                  t = e = i = s = n;
51162                  rG.width = rG.height = 2 * n;
51163                }
51164                if (iG) {
51165                  const r = iG.blur + n;
51166                  const o = iG.offset.x;
51167                  const a = iG.offset.y;
51168                  i = Math.max(i, -o + r);
51169                  s = Math.max(s, o + r);
51170                  t = Math.max(t, a + r);
51171                  e = Math.max(e, -a + r);
51172                }
51173                if (_G) {
51174                  const t = HU * Math.tan(.20943951);
51175                  s += t;
51176                  rG.width += t;
51177                }
51178                nG.x = i;
51179                nG.y = t;
51180                nG.width = i + s;
51181                nG.height = t + e;
51182              },
51183              _calculateFillTextStartPosition() {
51184                let t = 0;
51185                YU === CP.RIGHT ? t = XU.width - nG.width : YU === CP.CENTER && (t = (XU.width - nG.width) / 2);
51186                const e = this._getLineHeight() * (jU.length - 1);
51187                let i = zU * (1 - pM / 2);
51188                if (qU !== xP.TOP) {
51189                  let t = e + nG.height + zU - XU.height;
51190                  if (qU === xP.BOTTOM) {
51191                    t += pM / 2 * zU;
51192                    i -= t;
51193                  } else i -= t / 2;
51194                }
51195                i += 0 * zU;
51196                aG.set(t + nG.x, i + nG.y);
51197              },
51198              _updateTexture(t) {
51199                if (!FU || !VU) return;
51200                FU.clearRect(0, 0, VU.width, VU.height);
51201                FU.font = UU;
51202                this._calculateFillTextStartPosition();
51203                const e = this._getLineHeight();
51204                FU.lineJoin = "round";
51205                if (tG) {
51206                  FU.fillStyle = `rgba(${eG.r}, ${eG.g}, ${eG.b}, ${LU})`;
51207                  FU.fillRect(0, 0, VU.width, VU.height);
51208                } else if (t._srcBlendFactor === Ls.SRC_ALPHA) {
51209                  FU.fillStyle = `rgba(${KU.r}, ${KU.g}, ${KU.b}, ${LU})`;
51210                  FU.fillRect(0, 0, VU.width, VU.height);
51211                }
51212                FU.fillStyle = `rgb(${KU.r}, ${KU.g}, ${KU.b})`;
51213                const i = aG.x;
51214                let s = 0;
51215                this._drawTextEffect(aG, e);
51216                for (let t = 0; t < jU.length; ++t) {
51217                  s = aG.y + t * e;
51218                  tG && FU.strokeText(jU[t], i, s);
51219                  FU.fillText(jU[t], i, s);
51220                }
51221                iG && (FU.shadowColor = "transparent");
51222                this._uploadTexture(t);
51223              },
51224              _uploadTexture(t) {
51225                if (t.cacheMode === IP.CacheMode.BITMAP) {
51226                  const e = t.ttfSpriteFrame;
51227                  EI.deleteAtlasSpriteFrame(e);
51228                  e._resetDynamicAtlasFrame();
51229                }
51230                if (kU && VU) {
51231                  let e;
51232                  e = kU instanceof GI ? kU.texture : kU;
51233                  if (0 !== VU.width && 0 !== VU.height) {
51234                    e.reset({
51235                      width: VU.width,
51236                      height: VU.height,
51237                      mipmapLevel: 1
51238                    });
51239                    e.uploadData(VU);
51240                    e.setWrapMode(Zp.CLAMP_TO_EDGE, Zp.CLAMP_TO_EDGE);
51241                    if (kU instanceof GI) {
51242                      kU.rect = new as(0, 0, VU.width, VU.height);
51243                      kU._calculateUV();
51244                    }
51245                    t.renderData && (t.renderData.textureDirty = !0);
51246                    m.director.root && m.director.root.batcher2D && m.director.root.batcher2D._releaseDescriptorSetCache(e.getGFXTexture(), e.getGFXSampler());
51247                  }
51248                }
51249              },
51250              _calDynamicAtlas(t) {
51251                if (t.cacheMode !== IP.CacheMode.BITMAP || !VU || VU.width <= 0 || VU.height <= 0) return;
51252                const e = t.ttfSpriteFrame;
51253                EI.packToDynamicAtlas(t, e);
51254              },
51255              _setupOutline() {
51256                FU.strokeStyle = `rgba(${eG.r}, ${eG.g}, ${eG.b}, ${eG.a / 255})`;
51257                FU.lineWidth = 2 * tG.width;
51258              },
51259              _setupShadow() {
51260                FU.shadowColor = `rgba(${sG.r}, ${sG.g}, ${sG.b}, ${sG.a / 255})`;
51261                FU.shadowBlur = iG.blur;
51262                FU.shadowOffsetX = iG.offset.x;
51263                FU.shadowOffsetY = -iG.offset.y;
51264              },
51265              _drawTextEffect(t, e) {
51266                if (!iG && !tG && !dG) return;
51267                const i = jU.length > 1 && iG;
51268                const s = this._measureText(FU, UU);
51269                let n = 0;
51270                let r = 0;
51271                iG && this._setupShadow();
51272                tG && this._setupOutline();
51273                for (let o = 0; o < jU.length; ++o) {
51274                  n = t.x;
51275                  r = t.y + o * e;
51276                  if (i) {
51277                    tG && FU.strokeText(jU[o], n, r);
51278                    FU.fillText(jU[o], n, r);
51279                  }
51280                  if (dG) {
51281                    hG = s(jU[o]);
51282                    YU === CP.RIGHT ? lG.x = t.x - hG : YU === CP.CENTER ? lG.x = t.x - hG / 2 : lG.x = t.x;
51283                    lG.y = r + HU / 8;
51284                    FU.fillRect(lG.x, lG.y, hG, cG);
51285                  }
51286                }
51287                i && (FU.shadowColor = "transparent");
51288              },
51289              _updateLabelDimensions() {
51290                XU.width = Math.min(XU.width, 2048);
51291                XU.height = Math.min(XU.height, 2048);
51292                let t = !1;
51293                if (VU.width !== XU.width) {
51294                  VU.width = XU.width;
51295                  t = !0;
51296                }
51297                if (VU.height !== XU.height) {
51298                  VU.height = XU.height;
51299                  t = !0;
51300                }
51301                t && (FU.font = UU);
51302                FU.textAlign = pG[YU];
51303                FU.textBaseline = "alphabetic";
51304              },
51305              _getFontDesc() {
51306                let t = `${zU.toString()}px `;
51307                t += ZU;
51308                uG && (t = `bold ${t}`);
51309                _G && (t = `italic ${t}`);
51310                return t;
51311              },
51312              _getLineHeight() {
51313                let t = WU;
51314                t = 0 === t ? zU : t * zU / HU;
51315                return 0 | t;
51316              },
51317              _calculateParagraphLength(t, e) {
51318                const i = [];
51319                for (const s of t) {
51320                  const t = xM(e, s, UU);
51321                  i.push(t);
51322                }
51323                return i;
51324              },
51325              _measureText: (t, e) => i => xM(t, i, e),
51326              _calculateShrinkFont(t) {
51327                if (!FU) return;
51328                const e = this._calculateParagraphLength(t, FU);
51329                let i = 0;
51330                let s = 0;
51331                let n = 0;
51332                if ($U) {
51333                  const e = oG.width;
51334                  const n = oG.height;
51335                  if (e < 0 || n < 0) return;
51336                  s = n + 1;
51337                  let r = [];
51338                  let o = 0;
51339                  let a = 0 | zU + 1;
51340                  let l = 0;
51341                  for (;o < a; ) {
51342                    l = o + a + 1 >> 1;
51343                    if (l <= 0) {
51344                      P(4003);
51345                      break;
51346                    }
51347                    zU = l;
51348                    UU = this._getFontDesc();
51349                    FU.font = UU;
51350                    const h = this._getLineHeight();
51351                    s = 0;
51352                    for (i = 0; i < t.length; ++i) {
51353                      const n = xM(FU, t[i], UU);
51354                      r = MM(t[i], n, e, this._measureText(FU, UU));
51355                      s += r.length * h;
51356                    }
51357                    s > n ? a = l - 1 : o = l;
51358                  }
51359                  if (0 === o) P(4003); else {
51360                    zU = o;
51361                    UU = this._getFontDesc();
51362                    FU.font = UU;
51363                  }
51364                } else {
51365                  s = t.length * this._getLineHeight();
51366                  for (i = 0; i < t.length; ++i) n < e[i] && (n = e[i]);
51367                  const r = (XU.width - nG.width) / n;
51368                  const o = XU.height / s;
51369                  zU = HU * Math.min(1, r, o) | 0;
51370                  UU = this._getFontDesc();
51371                  FU.font = UU;
51372                }
51373              },
51374              _calculateWrapText(t) {
51375                if (!$U || !FU) return;
51376                jU = [];
51377                const e = oG.width;
51378                for (let i = 0; i < t.length; ++i) {
51379                  const s = xM(FU, t[i], UU);
51380                  const n = MM(t[i], s, e, this._measureText(FU, UU));
51381                  jU = jU.concat(n);
51382                }
51383              },
51384              _calculateLabelFont() {
51385                if (!FU) return;
51386                const t = GU.split("\n");
51387                jU = t;
51388                UU = this._getFontDesc();
51389                FU.font = UU;
51390                switch (QU) {
51391                 case NU.NONE:
51392                  {
51393                    let e = 0;
51394                    let i = 0;
51395                    for (let i = 0; i < t.length; ++i) {
51396                      const s = xM(FU, t[i], UU);
51397                      e = e > s ? e : s;
51398                    }
51399                    i = (jU.length + pM) * this._getLineHeight();
51400                    const s = parseFloat(e.toFixed(2));
51401                    const n = parseFloat(i.toFixed(2));
51402                    XU.width = s + nG.width;
51403                    XU.height = n + nG.height;
51404                    oG.width = s + rG.width;
51405                    oG.height = n + rG.height;
51406                    break;
51407                  }
51408
51409                 case NU.SHRINK:
51410                  this._calculateShrinkFont(t);
51411                  this._calculateWrapText(t);
51412                  break;
51413
51414                 case NU.CLAMP:
51415                  this._calculateWrapText(t);
51416                  break;
51417
51418                 case NU.RESIZE_HEIGHT:
51419                  {
51420                    this._calculateWrapText(t);
51421                    const e = (jU.length + pM) * this._getLineHeight();
51422                    XU.height = e + nG.height;
51423                    oG.height = e + rG.height;
51424                    break;
51425                  }
51426                }
51427              }
51428            };
51429            const fG = Bi.WHITE.clone();
51430            const gG = Uint16Array.from([ 0, 1, 2, 1, 3, 2 ]);
51431            const yG = {
51432              createData(t) {
51433                const e = t.requestRenderData();
51434                e.dataLength = 4;
51435                e.resize(4, 6);
51436                const i = e.chunk.vb;
51437                i[3] = i[21] = i[22] = i[31] = 0;
51438                i[4] = i[12] = i[13] = i[30] = 1;
51439                let s = 5;
51440                for (let t = 0; t < 4; t++) {
51441                  Bi.toArray(i, fG, s);
51442                  s += 9;
51443                }
51444                e.vertexRow = 2;
51445                e.vertexCol = 2;
51446                e.chunk.setIndexBuffer(gG);
51447                return e;
51448              },
51449              fillBuffers(t, e) {
51450                const i = t.renderData;
51451                const s = i.chunk;
51452                const n = i.data;
51453                const r = t.node;
51454                const o = s.vb;
51455                const a = r.worldMatrix;
51456                const l = i.floatStride;
51457                let h = 0;
51458                const c = n.length;
51459                for (let t = 0; t < c; t++) {
51460                  const e = n[t];
51461                  const i = e.x;
51462                  const s = e.y;
51463                  let r = a.m03 * i + a.m07 * s + a.m15;
51464                  r = r ? Math.abs(1 / r) : 1;
51465                  h = t * l;
51466                  o[h + 0] = (a.m00 * i + a.m04 * s + a.m12) * r;
51467                  o[h + 1] = (a.m01 * i + a.m05 * s + a.m13) * r;
51468                  o[h + 2] = (a.m02 * i + a.m06 * s + a.m14) * r;
51469                }
51470                const u = s.vertexOffset;
51471                const _ = s.meshBuffer;
51472                const d = s.meshBuffer.iData;
51473                let p = _.indexOffset;
51474                d[p++] = u;
51475                d[p++] = u + 1;
51476                d[p++] = u + 2;
51477                d[p++] = u + 2;
51478                d[p++] = u + 1;
51479                d[p++] = u + 3;
51480                _.indexOffset += 6;
51481              },
51482              updateVertexData(t) {
51483                const e = t.renderData;
51484                if (!e) return;
51485                const i = t.node._uiProps.uiTransformComp;
51486                const s = i.width;
51487                const n = i.height;
51488                const r = i.anchorX * s;
51489                const o = i.anchorY * n;
51490                const a = e.data;
51491                a[0].x = -r;
51492                a[0].y = -o;
51493                a[1].x = s - r;
51494                a[1].y = -o;
51495                a[2].x = -r;
51496                a[2].y = n - o;
51497                a[3].x = s - r;
51498                a[3].y = n - o;
51499              },
51500              updateUVs(t) {
51501                const e = t.renderData;
51502                if (!e || !t.ttfSpriteFrame) return;
51503                const i = e.chunk.vb;
51504                const s = t.ttfSpriteFrame.uv;
51505                i[3] = s[0];
51506                i[4] = s[1];
51507                i[12] = s[2];
51508                i[13] = s[3];
51509                i[21] = s[4];
51510                i[22] = s[5];
51511                i[30] = s[6];
51512                i[31] = s[7];
51513              },
51514              updateColor(t) {}
51515            };
51516            Ot(yG, mG);
51517            const bG = t("labelAssembler", {
51518              getAssembler(t) {
51519                let e = yG;
51520                t.font instanceof uM ? e = MU : t.cacheMode === IP.CacheMode.CHAR && (e = OU);
51521                return e;
51522              }
51523            });
51524            IP.Assembler = bG;
51525            const SG = cL.FillType;
51526            const AG = new qi;
51527            const TG = Uint16Array.from([ 0, 1, 2, 1, 3, 2 ]);
51528            const vG = {
51529              updateRenderData(t) {
51530                const e = t.spriteFrame;
51531                EI.packToDynamicAtlas(t, e);
51532                const i = t.renderData;
51533                if (i && e) {
51534                  if (!i.vertDirty) return;
51535                  let s = t.fillStart;
51536                  let n = t.fillRange;
51537                  if (n < 0) {
51538                    s += n;
51539                    n = -n;
51540                  }
51541                  n = s + n;
51542                  s = s > 1 ? 1 : s;
51543                  s = s < 0 ? 0 : s;
51544                  n = n > 1 ? 1 : n;
51545                  n = n < 0 ? 0 : n;
51546                  n -= s;
51547                  n = n < 0 ? 0 : n;
51548                  let r = s + n;
51549                  r = r > 1 ? 1 : r;
51550                  this.updateUVs(t, s, r);
51551                  this.updateVertexData(t, s, r);
51552                  i.updateRenderData(t, e);
51553                }
51554              },
51555              updateUVs(t, e, i) {
51556                const s = t.spriteFrame;
51557                const n = t.renderData.chunk.vb;
51558                const r = s.width;
51559                const o = s.height;
51560                const a = s.rect;
51561                let l = 0;
51562                let h = 0;
51563                let c = 0;
51564                let u = 0;
51565                let _ = 0;
51566                let d = 0;
51567                let p = 0;
51568                let m = 0;
51569                let f = 0;
51570                let g = 0;
51571                let y = 0;
51572                let b = 0;
51573                if (s.isRotated()) {
51574                  l = a.x / r;
51575                  h = (a.y + a.width) / o;
51576                  c = (a.x + a.height) / r;
51577                  u = a.y / o;
51578                  _ = p = l;
51579                  f = y = c;
51580                  m = b = h;
51581                  d = g = u;
51582                } else {
51583                  l = a.x / r;
51584                  h = (a.y + a.height) / o;
51585                  c = (a.x + a.width) / r;
51586                  u = a.y / o;
51587                  _ = f = l;
51588                  p = y = c;
51589                  d = m = h;
51590                  g = b = u;
51591                }
51592                switch (t.fillType) {
51593                 case SG.HORIZONTAL:
51594                  n[3] = _ + (p - _) * e;
51595                  n[4] = d + (m - d) * e;
51596                  n[12] = _ + (p - _) * i;
51597                  n[13] = d + (m - d) * i;
51598                  n[21] = f + (y - f) * e;
51599                  n[22] = g + (b - g) * e;
51600                  n[30] = f + (y - f) * i;
51601                  n[31] = g + (b - g) * i;
51602                  break;
51603
51604                 case SG.VERTICAL:
51605                  n[3] = _ + (f - _) * e;
51606                  n[4] = d + (g - d) * e;
51607                  n[12] = p + (y - p) * e;
51608                  n[13] = m + (b - m) * e;
51609                  n[21] = _ + (f - _) * i;
51610                  n[22] = d + (g - d) * i;
51611                  n[30] = p + (y - p) * i;
51612                  n[31] = m + (b - m) * i;
51613                  break;
51614
51615                 default:
51616                  F(2626);
51617                }
51618              },
51619              updateVertexData(t, e, i) {
51620                const s = t.renderData.data;
51621                const n = t.node._uiProps.uiTransformComp;
51622                const r = n.width;
51623                const o = n.height;
51624                const a = n.anchorX * r;
51625                const l = n.anchorY * o;
51626                let h = -a;
51627                let c = -l;
51628                let u = r - a;
51629                let _ = o - l;
51630                let d = 0;
51631                let p = 0;
51632                switch (t.fillType) {
51633                 case SG.HORIZONTAL:
51634                  d = h + (u - h) * e;
51635                  p = h + (u - h) * i;
51636                  h = d;
51637                  u = p;
51638                  break;
51639
51640                 case SG.VERTICAL:
51641                  d = c + (_ - c) * e;
51642                  p = c + (_ - c) * i;
51643                  c = d;
51644                  _ = p;
51645                  break;
51646
51647                 default:
51648                  F(2626);
51649                }
51650                s[0].x = h;
51651                s[0].y = c;
51652                s[1].x = u;
51653                s[1].y = c;
51654                s[2].x = h;
51655                s[2].y = _;
51656                s[3].x = u;
51657                s[3].y = _;
51658              },
51659              createData(t) {
51660                const e = t.requestRenderData();
51661                e.dataLength = 4;
51662                e.resize(4, 6);
51663                e.vertexRow = 2;
51664                e.vertexCol = 2;
51665                e.chunk.setIndexBuffer(TG);
51666                const i = e.data;
51667                for (const t of i) t.z = 0;
51668                return e;
51669              },
51670              updateWorldVertexData(t, e) {
51671                t.node.getWorldMatrix(AG);
51672                const i = t.renderData.floatStride;
51673                const s = t.renderData.data;
51674                const n = e.vb;
51675                let r = 0;
51676                for (let t = 0; t < 4; t++) {
51677                  const e = s[t];
51678                  const o = e.x;
51679                  const a = e.y;
51680                  let l = AG.m03 * o + AG.m07 * a + AG.m15;
51681                  l = l ? Math.abs(1 / l) : 1;
51682                  r = t * i;
51683                  n[r] = (AG.m00 * o + AG.m04 * a + AG.m12) * l;
51684                  n[r + 1] = (AG.m01 * o + AG.m05 * a + AG.m13) * l;
51685                  n[r + 2] = (AG.m02 * o + AG.m06 * a + AG.m14) * l;
51686                }
51687              },
51688              fillBuffers(t, e) {
51689                const i = t.renderData;
51690                const s = i.chunk;
51691                if (t.node.hasChangedFlags || i.vertDirty) {
51692                  this.updateWorldVertexData(t, s);
51693                  i.vertDirty = !1;
51694                }
51695                s.bufferId;
51696                const n = s.vertexOffset;
51697                const r = s.meshBuffer;
51698                const o = s.meshBuffer.iData;
51699                let a = r.indexOffset;
51700                o[a++] = n;
51701                o[a++] = n + 1;
51702                o[a++] = n + 2;
51703                o[a++] = n + 2;
51704                o[a++] = n + 1;
51705                o[a++] = n + 3;
51706                r.indexOffset += 6;
51707              },
51708              updateColor(t) {
51709                const e = t.renderData;
51710                const i = e.chunk.vb;
51711                const s = e.floatStride;
51712                let n = 5;
51713                const r = t.color;
51714                const o = r.r / 255;
51715                const a = r.g / 255;
51716                const l = r.b / 255;
51717                const h = t.node._uiProps.opacity;
51718                for (let t = 0; t < 4; t++) {
51719                  i[n] = o;
51720                  i[n + 1] = a;
51721                  i[n + 2] = l;
51722                  i[n + 3] = h;
51723                  n += s;
51724                }
51725              }
51726            };
51727            const EG = 2 * Math.PI;
51728            const CG = 1e-6;
51729            const xG = new qi;
51730            const wG = [ new Qi, new Qi, new Qi, new Qi ];
51731            const RG = new Array(4);
51732            const IG = new Array(8);
51733            const MG = [ new Qi, new Qi, new Qi, new Qi ];
51734            const BG = [ new Qi, new Qi, new Qi, new Qi ];
51735            const DG = new Qi;
51736            const PG = [ new Qi, new Qi, new Qi, new Qi ];
51737            let OG;
51738            function NG(t, e, i, s, n, r, o) {
51739              let a = Math.sin(r);
51740              a = Math.abs(a) > CG ? a : 0;
51741              let l = Math.cos(r);
51742              l = Math.abs(l) > CG ? l : 0;
51743              let h = 0;
51744              let c = 0;
51745              if (0 !== l) {
51746                h = a / l;
51747                if ((t - n.x) * l > 0) {
51748                  const e = n.y + h * (t - n.x);
51749                  o[0].x = t;
51750                  o[0].y = e;
51751                }
51752                if ((e - n.x) * l > 0) {
51753                  const t = n.y + h * (e - n.x);
51754                  o[2].x = e;
51755                  o[2].y = t;
51756                }
51757              }
51758              if (0 !== a) {
51759                c = l / a;
51760                if ((s - n.y) * a > 0) {
51761                  const t = n.x + c * (s - n.y);
51762                  o[3].x = t;
51763                  o[3].y = s;
51764                }
51765                if ((i - n.y) * a > 0) {
51766                  const t = n.x + c * (i - n.y);
51767                  o[1].x = t;
51768                  o[1].y = i;
51769                }
51770              }
51771            }
51772            function LG(t, e) {
51773              const i = e.x - t.x;
51774              const s = e.y - t.y;
51775              if (0 === i && 0 === s) return 0;
51776              if (0 === i) return s > 0 ? .5 * Math.PI : 1.5 * Math.PI;
51777              {
51778                let t = Math.atan(s / i);
51779                i < 0 && (t += Math.PI);
51780                return t;
51781              }
51782            }
51783            function FG(t, e, i, s, n) {
51784              const r = RG;
51785              const o = r[0];
51786              const a = r[1];
51787              const l = r[2];
51788              const h = r[3];
51789              t[e].x = i.x;
51790              t[e].y = i.y;
51791              t[e + 1].x = s.x;
51792              t[e + 1].y = s.y;
51793              t[e + 2].x = n.x;
51794              t[e + 2].y = n.y;
51795              let c = 0;
51796              let u = 0;
51797              c = (i.x - o) / (l - o);
51798              u = (i.y - a) / (h - a);
51799              VG(c, u, t, e);
51800              c = (s.x - o) / (l - o);
51801              u = (s.y - a) / (h - a);
51802              VG(c, u, t, e + 1);
51803              c = (n.x - o) / (l - o);
51804              u = (n.y - a) / (h - a);
51805              VG(c, u, t, e + 2);
51806            }
51807            function VG(t, e, i, s) {
51808              const n = IG;
51809              const r = n[0] + (n[2] - n[0]) * t;
51810              const o = n[4] + (n[6] - n[4]) * t;
51811              const a = n[1] + (n[3] - n[1]) * t;
51812              const l = n[5] + (n[7] - n[5]) * t;
51813              const h = i[s];
51814              h.u = r + (o - r) * e;
51815              h.v = a + (l - a) * e;
51816            }
51817            const kG = {
51818              useModel: !1,
51819              createData: t => t.requestRenderData(),
51820              updateRenderData(t) {
51821                const e = t.spriteFrame;
51822                EI.packToDynamicAtlas(t, e);
51823                this.updateUVs(t);
51824                const i = t.renderData;
51825                if (i && e) {
51826                  if (!i.vertDirty) return;
51827                  const s = i.data;
51828                  let n = t.fillStart;
51829                  let r = t.fillRange;
51830                  if (r < 0) {
51831                    n += r;
51832                    r = -r;
51833                  }
51834                  for (;n >= 1; ) n -= 1;
51835                  for (;n < 0; ) n += 1;
51836                  n *= EG;
51837                  r *= EG;
51838                  const o = n + r;
51839                  !function(t) {
51840                    const e = t.node._uiProps.uiTransformComp;
51841                    const i = e.width;
51842                    const s = e.height;
51843                    const n = e.anchorX * i;
51844                    const r = e.anchorY * s;
51845                    const o = -n;
51846                    const a = -r;
51847                    const l = i - n;
51848                    const h = s - r;
51849                    const c = RG;
51850                    c[0] = o;
51851                    c[1] = a;
51852                    c[2] = l;
51853                    c[3] = h;
51854                    const u = t.fillCenter;
51855                    const _ = DG.x = Math.min(Math.max(0, u.x), 1) * (l - o) + o;
51856                    const d = DG.y = Math.min(Math.max(0, u.y), 1) * (h - a) + a;
51857                    wG[0].x = wG[3].x = o;
51858                    wG[1].x = wG[2].x = l;
51859                    wG[0].y = wG[1].y = a;
51860                    wG[2].y = wG[3].y = h;
51861                    for (const t of PG) Qi.set(t, 0, 0);
51862                    _ !== c[0] && Qi.set(PG[0], 3, 0);
51863                    _ !== c[2] && Qi.set(PG[2], 1, 2);
51864                    d !== c[1] && Qi.set(PG[1], 0, 1);
51865                    d !== c[3] && Qi.set(PG[3], 2, 3);
51866                  }(t);
51867                  !function(t) {
51868                    const e = t.width;
51869                    const i = t.height;
51870                    const s = t.getRect();
51871                    let n = 0;
51872                    let r = 0;
51873                    let o = 0;
51874                    let a = 0;
51875                    const l = IG;
51876                    if (t.isRotated()) {
51877                      n = s.x / e;
51878                      r = (s.x + s.height) / e;
51879                      o = s.y / i;
51880                      a = (s.y + s.width) / i;
51881                      l[0] = l[2] = n;
51882                      l[4] = l[6] = r;
51883                      l[3] = l[7] = a;
51884                      l[1] = l[5] = o;
51885                    } else {
51886                      n = s.x / e;
51887                      r = (s.x + s.width) / e;
51888                      o = s.y / i;
51889                      a = (s.y + s.height) / i;
51890                      l[0] = l[4] = n;
51891                      l[2] = l[6] = r;
51892                      l[1] = l[3] = a;
51893                      l[5] = l[7] = o;
51894                    }
51895                  }(e);
51896                  NG(RG[0], RG[2], RG[1], RG[3], DG, n, MG);
51897                  NG(RG[0], RG[2], RG[1], RG[3], DG, n + r, BG);
51898                  let a = 0;
51899                  for (let t = 0; t < 4; ++t) {
51900                    const e = PG[t];
51901                    if (!e) continue;
51902                    if (r >= EG) {
51903                      i.dataLength = a + 3;
51904                      FG(s, a, DG, wG[e.x], wG[e.y]);
51905                      a += 3;
51906                      continue;
51907                    }
51908                    let l = LG(DG, wG[e.x]);
51909                    let h = LG(DG, wG[e.y]);
51910                    h < l && (h += EG);
51911                    l -= EG;
51912                    h -= EG;
51913                    for (let r = 0; r < 3; ++r) {
51914                      if (l >= o) ; else if (l >= n) {
51915                        i.dataLength = a + 3;
51916                        FG(s, a, DG, wG[e.x], h >= o ? BG[t] : wG[e.y]);
51917                        a += 3;
51918                      } else if (h > n) if (h <= o) {
51919                        i.dataLength = a + 3;
51920                        FG(s, a, DG, MG[t], wG[e.y]);
51921                        a += 3;
51922                      } else {
51923                        i.dataLength = a + 3;
51924                        FG(s, a, DG, MG[t], BG[t]);
51925                        a += 3;
51926                      }
51927                      l += EG;
51928                      h += EG;
51929                    }
51930                  }
51931                  0 === a && (i.dataLength = 0);
51932                  i.resize(a, a);
51933                  {
51934                    const e = i.indexCount;
51935                    this.createQuadIndices(e);
51936                    i.chunk.setIndexBuffer(OG);
51937                    this.updateWorldUVData(t);
51938                    t.renderEntity.colorDirty = !0;
51939                  }
51940                  i.updateRenderData(t, e);
51941                }
51942              },
51943              createQuadIndices(t) {
51944                OG = null;
51945                OG = new Uint16Array(t);
51946                let e = 0;
51947                for (let i = 0; i < t; i++) OG[e++] = i;
51948              },
51949              fillBuffers(t, e) {
51950                const i = t.node;
51951                const s = t.renderData;
51952                const n = s.chunk;
51953                if (i.hasChangedFlags || s.vertDirty) {
51954                  this.updateWorldVertexAndUVData(t, n);
51955                  s.vertDirty = !1;
51956                }
51957                this.updateColorLate(t);
51958                n.bufferId;
51959                const r = n.vertexOffset;
51960                const o = n.meshBuffer;
51961                const a = n.meshBuffer.iData;
51962                const l = o.indexOffset;
51963                for (let t = 0; t < s.indexCount; t++) a[l + t] = r + t;
51964                o.indexOffset += s.indexCount;
51965                o.setDirty();
51966              },
51967              updateWorldUVData(t, e) {
51968                const i = t.renderData;
51969                const s = i.floatStride;
51970                const n = i.data;
51971                const r = i.chunk.vb;
51972                for (let t = 0; t < n.length; t++) {
51973                  const e = t * s;
51974                  r[e + 3] = n[t].u;
51975                  r[e + 4] = n[t].v;
51976                }
51977              },
51978              updateWorldVertexAndUVData(t, e) {
51979                t.node.getWorldMatrix(xG);
51980                const i = t.renderData;
51981                const s = i.floatStride;
51982                const n = t.renderData.data;
51983                const r = e.vb;
51984                const o = i.vertexCount;
51985                let a = 0;
51986                for (let t = 0; t < o; t++) {
51987                  const e = n[t];
51988                  const i = e.x;
51989                  const o = e.y;
51990                  let l = xG.m03 * i + xG.m07 * o + xG.m15;
51991                  l = l ? Math.abs(1 / l) : 1;
51992                  r[a + 0] = (xG.m00 * i + xG.m04 * o + xG.m12) * l;
51993                  r[a + 1] = (xG.m01 * i + xG.m05 * o + xG.m13) * l;
51994                  r[a + 2] = (xG.m02 * i + xG.m06 * o + xG.m14) * l;
51995                  r[a + 3] = e.u;
51996                  r[a + 4] = e.v;
51997                  a += s;
51998                }
51999              },
52000              updateUVs(t) {
52001                t.renderData.vertDirty = !0;
52002                t.markForUpdateRenderData();
52003              },
52004              updateColorLate(t) {
52005                const e = t.renderData;
52006                const i = e.chunk.vb;
52007                const s = e.floatStride;
52008                const n = e.vertexCount;
52009                let r = 5;
52010                const o = t.color;
52011                const a = o.r / 255;
52012                const l = o.g / 255;
52013                const h = o.b / 255;
52014                const c = t.node._uiProps.opacity;
52015                for (let t = 0; t < n; t++) {
52016                  i[r] = a;
52017                  i[r + 1] = l;
52018                  i[r + 2] = h;
52019                  i[r + 3] = c;
52020                  r += s;
52021                }
52022              },
52023              updateColor(t) {}
52024            };
52025            const UG = Uint16Array.from([ 0, 1, 2, 1, 3, 2 ]);
52026            const GG = {
52027              createData(t) {
52028                const e = t.requestRenderData();
52029                e.dataLength = 4;
52030                e.resize(4, 6);
52031                e.vertexRow = 2;
52032                e.vertexCol = 2;
52033                e.chunk.setIndexBuffer(UG);
52034                return e;
52035              },
52036              updateRenderData(t) {
52037                const e = t.spriteFrame;
52038                EI.packToDynamicAtlas(t, e);
52039                this.updateUVs(t);
52040                const i = t.renderData;
52041                if (i && e) {
52042                  i.vertDirty && this.updateVertexData(t);
52043                  i.updateRenderData(t, e);
52044                }
52045              },
52046              updateWorldVerts(t, e) {
52047                const i = t.renderData;
52048                const s = e.vb;
52049                const n = i.data;
52050                const r = t.node.worldMatrix;
52051                const o = i.floatStride;
52052                let a = 0;
52053                const l = n.length;
52054                for (let t = 0; t < l; t++) {
52055                  const e = n[t];
52056                  const i = e.x;
52057                  const l = e.y;
52058                  let h = r.m03 * i + r.m07 * l + r.m15;
52059                  h = h ? Math.abs(1 / h) : 1;
52060                  a = t * o;
52061                  s[a + 0] = (r.m00 * i + r.m04 * l + r.m12) * h;
52062                  s[a + 1] = (r.m01 * i + r.m05 * l + r.m13) * h;
52063                  s[a + 2] = (r.m02 * i + r.m06 * l + r.m14) * h;
52064                }
52065              },
52066              fillBuffers(t, e) {
52067                if (null === t) return;
52068                const i = t.renderData;
52069                const s = i.chunk;
52070                if (t.node.hasChangedFlags || i.vertDirty) {
52071                  this.updateWorldVerts(t, s);
52072                  i.vertDirty = !1;
52073                }
52074                s.bufferId;
52075                const n = s.vertexOffset;
52076                const r = s.meshBuffer;
52077                const o = s.meshBuffer.iData;
52078                let a = r.indexOffset;
52079                for (let t = 0; t < i.vertexRow - 1; t++) for (let e = 0; e < i.vertexCol - 1; e++) {
52080                  const s = n + t * i.vertexCol + e;
52081                  o[a++] = s;
52082                  o[a++] = s + 1;
52083                  o[a++] = s + i.vertexCol;
52084                  o[a++] = s + 1;
52085                  o[a++] = s + 1 + i.vertexCol;
52086                  o[a++] = s + i.vertexCol;
52087                  r.indexOffset += 6;
52088                }
52089              },
52090              updateVertexData(t) {
52091                const e = t.renderData;
52092                if (!e) return;
52093                const i = t.node._uiProps.uiTransformComp;
52094                const s = e.data;
52095                const n = i.width;
52096                const r = i.height;
52097                const o = i.anchorX * n;
52098                const a = i.anchorY * r;
52099                let l = 0;
52100                let h = 0;
52101                let c = 0;
52102                let u = 0;
52103                if (t.trim) {
52104                  l = -o;
52105                  h = -a;
52106                  c = n - o;
52107                  u = r - a;
52108                } else {
52109                  const e = t.spriteFrame;
52110                  const i = e.originalSize;
52111                  const s = n / i.width;
52112                  const _ = r / i.height;
52113                  const d = e.trimmedBorder;
52114                  l = d.x * s - o;
52115                  h = d.z * _ - a;
52116                  c = n + d.y * s - o;
52117                  u = r + d.w * _ - a;
52118                }
52119                s[0].x = l;
52120                s[0].y = h;
52121                s[1].x = c;
52122                s[1].y = h;
52123                s[2].x = l;
52124                s[2].y = u;
52125                s[3].x = c;
52126                s[3].y = u;
52127                e.vertDirty = !0;
52128              },
52129              updateUVs(t) {
52130                if (!t.spriteFrame) return;
52131                const e = t.renderData.chunk.vb;
52132                const i = t.spriteFrame.uv;
52133                e[3] = i[0];
52134                e[4] = i[1];
52135                e[12] = i[2];
52136                e[13] = i[3];
52137                e[21] = i[4];
52138                e[22] = i[5];
52139                e[30] = i[6];
52140                e[31] = i[7];
52141              },
52142              updateColor(t) {
52143                const e = t.renderData;
52144                const i = e.chunk.vb;
52145                let s = 5;
52146                const n = t.color;
52147                const r = n.r / 255;
52148                const o = n.g / 255;
52149                const a = n.b / 255;
52150                const l = n.a / 255;
52151                for (let t = 0; t < 4; t++, s += e.floatStride) {
52152                  i[s] = r;
52153                  i[s + 1] = o;
52154                  i[s + 2] = a;
52155                  i[s + 3] = l;
52156                }
52157              }
52158            };
52159            const zG = new qi;
52160            const HG = [];
52161            for (let t = 0; t < 4; t++) HG.push({
52162              x: 0,
52163              y: 0,
52164              z: 0,
52165              u: 0,
52166              v: 0,
52167              color: new Bi
52168            });
52169            const jG = {
52170              createData(t) {
52171                const e = t.requestRenderData();
52172                e.dataLength = 16;
52173                e.resize(16, 54);
52174                e.vertexRow = 4;
52175                e.vertexCol = 4;
52176                this.QUAD_INDICES = new Uint16Array(54);
52177                this.createQuadIndices(4, 4);
52178                e.chunk.setIndexBuffer(this.QUAD_INDICES);
52179                return e;
52180              },
52181              createQuadIndices(t, e) {
52182                let i = 0;
52183                for (let s = 0; s < t - 1; s++) for (let t = 0; t < e - 1; t++) {
52184                  const n = s * e + t;
52185                  this.QUAD_INDICES[i++] = n;
52186                  this.QUAD_INDICES[i++] = n + 1;
52187                  this.QUAD_INDICES[i++] = n + e;
52188                  this.QUAD_INDICES[i++] = n + 1;
52189                  this.QUAD_INDICES[i++] = n + 1 + e;
52190                  this.QUAD_INDICES[i++] = n + e;
52191                }
52192              },
52193              updateRenderData(t) {
52194                const e = t.spriteFrame;
52195                EI.packToDynamicAtlas(t, e);
52196                this.updateUVs(t);
52197                const i = t.renderData;
52198                if (i && e) {
52199                  i.vertDirty && this.updateVertexData(t);
52200                  i.updateRenderData(t, e);
52201                }
52202              },
52203              updateVertexData(t) {
52204                const e = t.renderData;
52205                const i = e.data;
52206                const s = t.node._uiProps.uiTransformComp;
52207                const n = s.width;
52208                const r = s.height;
52209                const o = s.anchorX * n;
52210                const a = s.anchorY * r;
52211                const l = t.spriteFrame;
52212                const h = l.insetLeft;
52213                const c = l.insetRight;
52214                const u = l.insetTop;
52215                const _ = l.insetBottom;
52216                let d = n - h - c;
52217                let p = r - u - _;
52218                let m = n / (h + c);
52219                let f = r / (u + _);
52220                m = Number.isNaN(m) || m > 1 ? 1 : m;
52221                f = Number.isNaN(f) || f > 1 ? 1 : f;
52222                d = d < 0 ? 0 : d;
52223                p = p < 0 ? 0 : p;
52224                HG[0].x = -o;
52225                HG[0].y = -a;
52226                HG[1].x = h * m - o;
52227                HG[1].y = _ * f - a;
52228                HG[2].x = HG[1].x + d;
52229                HG[2].y = HG[1].y + p;
52230                HG[3].x = n - o;
52231                HG[3].y = r - a;
52232                for (let t = 0; t < e.vertexRow; t++) for (let s = 0; s < e.vertexCol; s++) {
52233                  const n = t * e.vertexCol + s;
52234                  if (n < e.dataLength && t < HG.length && s < HG.length) {
52235                    i[n].x = HG[s].x;
52236                    i[n].y = HG[t].y;
52237                  }
52238                }
52239              },
52240              fillBuffers(t, e) {
52241                const i = t.renderData;
52242                const s = i.chunk;
52243                if (t.node.hasChangedFlags || i.vertDirty) {
52244                  this.updateWorldVertexData(t, s);
52245                  i.vertDirty = !1;
52246                }
52247                s.bufferId;
52248                const n = s.vertexOffset;
52249                const r = s.meshBuffer;
52250                const o = s.meshBuffer.iData;
52251                let a = r.indexOffset;
52252                for (let t = 0; t < 3; ++t) for (let e = 0; e < 3; ++e) {
52253                  const i = n + 4 * t + e;
52254                  o[a++] = i;
52255                  o[a++] = i + 1;
52256                  o[a++] = i + 4;
52257                  o[a++] = i + 1;
52258                  o[a++] = i + 5;
52259                  o[a++] = i + 4;
52260                }
52261                r.indexOffset = a;
52262              },
52263              updateWorldVertexData(t, e) {
52264                t.node.getWorldMatrix(zG);
52265                const i = t.renderData;
52266                const s = i.floatStride;
52267                const n = i.data;
52268                const r = e.vb;
52269                let o = 0;
52270                for (let t = 0; t < 4; ++t) {
52271                  const e = n[4 * t];
52272                  for (let i = 0; i < 4; ++i) {
52273                    const a = n[i].x;
52274                    const l = e.y;
52275                    let h = zG.m03 * a + zG.m07 * l + zG.m15;
52276                    h = h ? Math.abs(1 / h) : 1;
52277                    o = (4 * t + i) * s;
52278                    r[o + 0] = (zG.m00 * a + zG.m04 * l + zG.m12) * h;
52279                    r[o + 1] = (zG.m01 * a + zG.m05 * l + zG.m13) * h;
52280                    r[o + 2] = (zG.m02 * a + zG.m06 * l + zG.m14) * h;
52281                  }
52282                }
52283              },
52284              updateUVs(t) {
52285                if (!t.spriteFrame) return;
52286                const e = t.renderData;
52287                const i = e.chunk.vb;
52288                const s = e.floatStride;
52289                const n = t.spriteFrame.uvSliced;
52290                let r = 3;
52291                for (let t = 0; t < 16; t++) {
52292                  i[r] = n[t].u;
52293                  i[r + 1] = n[t].v;
52294                  r += s;
52295                }
52296              },
52297              updateColor(t) {
52298                const e = t.renderData;
52299                const i = e.chunk.vb;
52300                const s = e.floatStride;
52301                let n = 5;
52302                const r = t.color;
52303                const o = r.r / 255;
52304                const a = r.g / 255;
52305                const l = r.b / 255;
52306                const h = t.node._uiProps.opacity;
52307                for (let t = 0; t < 16; t++) {
52308                  i[n] = o;
52309                  i[n + 1] = a;
52310                  i[n + 2] = l;
52311                  i[n + 3] = h;
52312                  n += s;
52313                }
52314              }
52315            };
52316            const XG = new qi;
52317            let WG;
52318            let YG;
52319            let qG;
52320            let KG;
52321            let JG;
52322            let ZG;
52323            let QG;
52324            let $G = 0;
52325            const tz = [];
52326            let ez;
52327            function iz(t) {
52328              return t && (t.insetTop > 0 || t.insetBottom > 0 || t.insetLeft > 0 || t.insetRight > 0) ? 2 : 0;
52329            }
52330            const sz = {
52331              createData: t => t.requestRenderData(),
52332              updateRenderData(t) {
52333                const e = t.renderData;
52334                const i = t.spriteFrame;
52335                if (!i || !e) return;
52336                if (!e.vertDirty) return;
52337                const s = t.node._uiProps.uiTransformComp;
52338                const n = Math.abs(s.width);
52339                const r = Math.abs(s.height);
52340                const o = i.getRect();
52341                const a = i.insetLeft;
52342                const l = i.insetRight;
52343                const h = o.width - a - l;
52344                const c = i.insetTop;
52345                const u = i.insetBottom;
52346                const _ = o.height - c - u;
52347                let d = n - a - l;
52348                let p = r - c - u;
52349                d = d > 0 ? d : 0;
52350                p = p > 0 ? p : 0;
52351                const m = 0 === h ? d : d / h;
52352                const f = 0 === _ ? p : p / _;
52353                const g = iz(i);
52354                const y = Math.ceil(f + g);
52355                const b = Math.ceil(m + g);
52356                e.dataLength = 2 * y * (2 * b);
52357                this.updateVerts(t, d, p, y, b);
52358                e.vertexCount !== y * b * 4 && (t.renderEntity.colorDirty = !0);
52359                e.resize(y * b * 4, y * b * 6);
52360                {
52361                  const i = e.indexCount;
52362                  this.createQuadIndices(i);
52363                  e.chunk.setIndexBuffer(ez);
52364                  this.updateWorldUVData(t);
52365                }
52366                e.updateRenderData(t, i);
52367              },
52368              createQuadIndices(t) {
52369                if (t % 6 != 0) {
52370                  console.error("illegal index count!");
52371                  return;
52372                }
52373                const e = t / 6;
52374                ez = null;
52375                ez = new Uint16Array(t);
52376                let i = 0;
52377                for (let t = 0; t < e; t++) {
52378                  ez[i++] = 0 + 4 * t;
52379                  ez[i++] = 1 + 4 * t;
52380                  ez[i++] = 2 + 4 * t;
52381                  ez[i++] = 1 + 4 * t;
52382                  ez[i++] = 3 + 4 * t;
52383                  ez[i++] = 2 + 4 * t;
52384                }
52385              },
52386              updateUVs(t) {
52387                t.renderData.vertDirty = !0;
52388                t.markForUpdateRenderData();
52389              },
52390              fillBuffers(t, e) {
52391                const i = t.node;
52392                const s = t.renderData;
52393                const n = s.chunk;
52394                if (i.hasChangedFlags || s.vertDirty) {
52395                  this.updateWorldVertexAndUVData(t, n);
52396                  s.vertDirty = !1;
52397                }
52398                this.updateColorLate(t);
52399                n.bufferId;
52400                let r = n.vertexOffset;
52401                const o = n.meshBuffer;
52402                const a = n.meshBuffer.iData;
52403                let l = o.indexOffset;
52404                for (let t = 0; t < s.indexCount; t += 6) {
52405                  a[l++] = r;
52406                  a[l++] = r + 1;
52407                  a[l++] = r + 2;
52408                  a[l++] = r + 1;
52409                  a[l++] = r + 3;
52410                  a[l++] = r + 2;
52411                  r += 4;
52412                  o.indexOffset += 6;
52413                }
52414                o.setDirty();
52415              },
52416              updateWorldUVData(t) {
52417                const e = t.renderData;
52418                const i = e.floatStride;
52419                const s = e.data;
52420                const n = e.chunk.vb;
52421                for (let t = 0; t < s.length; t++) {
52422                  const e = t * i;
52423                  n[e + 3] = s[t].u;
52424                  n[e + 4] = s[t].v;
52425                }
52426              },
52427              updateWorldVertexAndUVData(t, e) {
52428                t.node.getWorldMatrix(XG);
52429                const i = t.renderData;
52430                const s = i.floatStride;
52431                const n = i.data;
52432                const r = e.vb;
52433                const o = n.length;
52434                for (let t = 0; t < o; t++) {
52435                  const e = n[t].x;
52436                  const i = n[t].y;
52437                  const o = n[t].z;
52438                  let a = XG.m03 * e + XG.m07 * i + XG.m11 * o + XG.m15;
52439                  a = a ? Math.abs(1 / a) : 1;
52440                  const l = t * s;
52441                  r[l] = (XG.m00 * e + XG.m04 * i + XG.m08 * o + XG.m12) * a;
52442                  r[l + 1] = (XG.m01 * e + XG.m05 * i + XG.m09 * o + XG.m13) * a;
52443                  r[l + 2] = (XG.m02 * e + XG.m06 * i + XG.m10 * o + XG.m14) * a;
52444                }
52445                this.updateWorldUVData(t);
52446              },
52447              updateVerts(t, e, i, s, n) {
52448                const r = t.node._uiProps.uiTransformComp;
52449                const o = t.renderData.data;
52450                const a = t.spriteFrame;
52451                const l = a.rect;
52452                const h = Math.abs(r.width);
52453                const c = Math.abs(r.height);
52454                const u = r.anchorX * h;
52455                const _ = r.anchorY * c;
52456                const d = a.insetLeft;
52457                const p = a.insetRight;
52458                const m = l.width - d - p;
52459                const f = a.insetTop;
52460                const g = a.insetBottom;
52461                const y = l.height - f - g;
52462                const b = r.width / (d + p) > 1 ? 1 : r.width / (d + p);
52463                const S = r.height / (f + g) > 1 ? 1 : r.height / (f + g);
52464                let A = 0;
52465                let T = 0;
52466                A = m > 0 ? Math.floor(1e3 * e) / 1e3 % m == 0 ? m : e % m : e;
52467                T = y > 0 ? Math.floor(1e3 * i) / 1e3 % y == 0 ? y : i % y : i;
52468                $G = Math.max(s + 1, n + 1);
52469                for (let t = 0; t < $G; t++) tz.push({
52470                  x: 0,
52471                  y: 0,
52472                  z: 0,
52473                  u: 0,
52474                  v: 0,
52475                  color: new Bi
52476                });
52477                const v = iz(a);
52478                if (0 === v) for (let t = 0; t < $G; t++) {
52479                  tz[t].x = t >= n ? h - u : t * m - u;
52480                  tz[t].y = t >= s ? c - _ : t * y - _;
52481                } else for (let t = 0; t < $G; t++) {
52482                  0 === t ? tz[t].x = -u : 1 === t ? tz[t].x = d * b - u : t > 1 && t < n - 1 ? tz[t].x = m > 0 ? d * b - u + m * (t - 1) : d + e - u : t === n - 1 ? tz[t].x = d * b - u + A + m * (t - 2) : t >= n && (tz[t].x = Math.min(d + e + p, h) - u);
52483                  0 === t ? tz[t].y = -_ : 1 === t ? tz[t].y = g * S - _ : t > 1 && t < s - 1 ? tz[t].y = y > 0 ? g * S - _ + y * (t - 1) : g + i - _ : t === s - 1 ? tz[t].y = g * S - _ + T + y * (t - 2) : t >= s && (tz[t].y = Math.min(g + i + f, c) - _);
52484                }
52485                let E = 0;
52486                let C = 0;
52487                let x = 0;
52488                let w = 0;
52489                for (let t = 0; t < s; ++t) {
52490                  x = tz[t].y;
52491                  w = tz[t + 1].y;
52492                  for (let e = 0; e < n; ++e) {
52493                    E = tz[e].x;
52494                    C = tz[e + 1].x;
52495                    const i = 4 * (t * n + e);
52496                    o[i].x = E;
52497                    o[i].y = x;
52498                    o[i + 1].x = C;
52499                    o[i + 1].y = x;
52500                    o[i + 2].x = E;
52501                    o[i + 2].y = w;
52502                    o[i + 3].x = C;
52503                    o[i + 3].y = w;
52504                  }
52505                }
52506                const R = a.rotated;
52507                a.uv;
52508                const I = a.uvSliced;
52509                WG = I[0];
52510                YG = I[1];
52511                qG = I[2];
52512                KG = I[3];
52513                JG = I[4];
52514                ZG = I[8];
52515                QG = I[12];
52516                let M = 0;
52517                let B = 0;
52518                const D = 0 === m ? e : e / m;
52519                const P = 0 === y ? i : i / y;
52520                const O = [];
52521                const N = [];
52522                for (let t = 0; t < s; ++t) {
52523                  if (i > y) {
52524                    B = i >= (v > 0 ? t : t + 1) * y ? 1 : P % 1;
52525                  } else B = P;
52526                  for (let i = 0; i < n; ++i) {
52527                    if (e > m) {
52528                      M = e >= (v > 0 ? i : i + 1) * m ? 1 : D % 1;
52529                    } else M = D;
52530                    if (R) {
52531                      if (0 === v) {
52532                        O[0] = JG.u;
52533                        O[1] = JG.u;
52534                        O[2] = JG.u + (ZG.u - JG.u) * B;
52535                        N[0] = YG.v;
52536                        N[1] = YG.v + (qG.v - YG.v) * M;
52537                        N[2] = YG.v;
52538                      } else {
52539                        if (0 === t) {
52540                          O[0] = WG.u;
52541                          O[1] = WG.u;
52542                          O[2] = JG.u;
52543                        } else if (t < s - 1) {
52544                          O[0] = JG.u;
52545                          O[1] = JG.u;
52546                          O[2] = JG.u + (ZG.u - JG.u) * B;
52547                        } else if (t === s - 1) {
52548                          O[0] = ZG.u;
52549                          O[1] = ZG.u;
52550                          O[2] = QG.u;
52551                        }
52552                        if (0 === i) {
52553                          N[0] = WG.v;
52554                          N[1] = YG.v;
52555                          N[2] = WG.v;
52556                        } else if (i < n - 1) {
52557                          N[0] = YG.v;
52558                          N[1] = YG.v + (qG.v - YG.v) * M;
52559                          N[2] = YG.v;
52560                        } else if (i === n - 1) {
52561                          N[0] = qG.v;
52562                          N[1] = KG.v;
52563                          N[2] = qG.v;
52564                        }
52565                      }
52566                      O[3] = O[2];
52567                      N[3] = N[1];
52568                    } else {
52569                      if (0 === v) {
52570                        O[0] = YG.u;
52571                        O[1] = YG.u + (qG.u - YG.u) * M;
52572                        O[2] = YG.u;
52573                        N[0] = JG.v;
52574                        N[1] = JG.v;
52575                        N[2] = JG.v + (ZG.v - JG.v) * B;
52576                      } else {
52577                        if (0 === i) {
52578                          O[0] = WG.u;
52579                          O[1] = YG.u;
52580                          O[2] = WG.u;
52581                        } else if (i < n - 1) {
52582                          O[0] = YG.u;
52583                          O[1] = YG.u + (qG.u - YG.u) * M;
52584                          O[2] = YG.u;
52585                        } else if (i === n - 1) {
52586                          O[0] = qG.u;
52587                          O[1] = KG.u;
52588                          O[2] = qG.u;
52589                        }
52590                        if (0 === t) {
52591                          N[0] = WG.v;
52592                          N[1] = WG.v;
52593                          N[2] = JG.v;
52594                        } else if (t < s - 1) {
52595                          N[0] = JG.v;
52596                          N[1] = JG.v;
52597                          N[2] = JG.v + (ZG.v - JG.v) * B;
52598                        } else if (t === s - 1) {
52599                          N[0] = ZG.v;
52600                          N[1] = ZG.v;
52601                          N[2] = QG.v;
52602                        }
52603                      }
52604                      O[3] = O[1];
52605                      N[3] = N[2];
52606                    }
52607                    const r = 4 * (t * n + i);
52608                    o[r].u = O[0];
52609                    o[r].v = N[0];
52610                    o[r + 1].u = O[1];
52611                    o[r + 1].v = N[1];
52612                    o[r + 2].u = O[2];
52613                    o[r + 2].v = N[2];
52614                    o[r + 3].u = O[3];
52615                    o[r + 3].v = N[3];
52616                  }
52617                }
52618              },
52619              updateColorLate(t) {
52620                const e = t.renderData;
52621                const i = e.chunk.vb;
52622                const s = e.floatStride;
52623                const n = e.vertexCount;
52624                let r = 5;
52625                const o = t.color;
52626                const a = o.r / 255;
52627                const l = o.g / 255;
52628                const h = o.b / 255;
52629                const c = t.node._uiProps.opacity;
52630                for (let t = 0; t < n; t++) {
52631                  i[r] = a;
52632                  i[r + 1] = l;
52633                  i[r + 2] = h;
52634                  i[r + 3] = c;
52635                  r += s;
52636                }
52637              },
52638              updateColor(t) {}
52639            };
52640            const nz = cL.Type;
52641            const rz = cL.FillType;
52642            const oz = t("spriteAssembler", {
52643              getAssembler(t) {
52644                let e = GG;
52645                const i = t;
52646                switch (i.type) {
52647                 case nz.SLICED:
52648                  e = jG;
52649                  break;
52650
52651                 case nz.TILED:
52652                  e = sz;
52653                  break;
52654
52655                 case nz.FILLED:
52656                  e = i.fillType === rz.RADIAL ? kG : vG;
52657                }
52658                return e;
52659              }
52660            });
52661            cL.Assembler = oz;
52662            const az = [ av.EventType.MOUSE_DOWN, av.EventType.MOUSE_MOVE, av.EventType.MOUSE_UP, av.EventType.MOUSE_WHEEL ];
52663            const lz = [ av.EventType.TOUCH_START, av.EventType.TOUCH_MOVE, av.EventType.TOUCH_END, av.EventType.TOUCH_CANCEL ];
52664            new class {
52665              constructor() {
52666                this.priority = nv.UI;
52667                this._isListDirty = !1;
52668                this._inDispatchCount = 0;
52669                this._pointerEventProcessorList = [];
52670                this._processorListToAdd = [];
52671                this._processorListToRemove = [];
52672                lv._registerEventDispatcher(this);
52673                KS.callbacksInvoker.on(qS.ADD_POINTER_EVENT_PROCESSOR, this.addPointerEventProcessor, this);
52674                KS.callbacksInvoker.on(qS.REMOVE_POINTER_EVENT_PROCESSOR, this.removePointerEventProcessor, this);
52675                KS.callbacksInvoker.on(qS.MARK_LIST_DIRTY, this._markListDirty, this);
52676              }
52677              dispatchEvent(t) {
52678                const e = t.type;
52679                return lz.includes(e) ? this.dispatchEventTouch(t) : !az.includes(e) || this.dispatchEventMouse(t);
52680              }
52681              addPointerEventProcessor(t) {
52682                if (0 === this._inDispatchCount) {
52683                  if (!this._pointerEventProcessorList.includes(t)) {
52684                    this._pointerEventProcessorList.push(t);
52685                    this._isListDirty = !0;
52686                  }
52687                } else this._processorListToAdd.includes(t) || this._processorListToAdd.push(t);
52688                ee.array.remove(this._processorListToRemove, t);
52689              }
52690              removePointerEventProcessor(t) {
52691                if (0 === this._inDispatchCount) {
52692                  ee.array.remove(this._pointerEventProcessorList, t);
52693                  this._isListDirty = !0;
52694                } else this._processorListToRemove.includes(t) || this._processorListToRemove.push(t);
52695                ee.array.remove(this._processorListToAdd, t);
52696              }
52697              dispatchEventMouse(t) {
52698                this._inDispatchCount++;
52699                this._sortPointerEventProcessorList();
52700                const e = this._pointerEventProcessorList;
52701                const i = e.length;
52702                let s = !0;
52703                for (let n = 0; n < i; ++n) {
52704                  const i = e[n];
52705                  if (i.isEnabled && i.shouldHandleEventMouse && i._handleEventMouse(t)) {
52706                    s = !1;
52707                    if (!t.preventSwallow) break;
52708                    t.preventSwallow = !1;
52709                  }
52710                }
52711                --this._inDispatchCount <= 0 && this._updatePointerEventProcessorList();
52712                return s;
52713              }
52714              dispatchEventTouch(t) {
52715                this._inDispatchCount++;
52716                this._sortPointerEventProcessorList();
52717                const e = this._pointerEventProcessorList;
52718                const i = e.length;
52719                const s = t.touch;
52720                let n = !0;
52721                for (let r = 0; r < i; ++r) {
52722                  const i = e[r];
52723                  if (i.isEnabled && i.shouldHandleEventTouch) if (t.type === MS.TOUCH_START) {
52724                    if (i._handleEventTouch(t)) {
52725                      i.claimedTouchIdList.push(s.getID());
52726                      n = !1;
52727                      if (!t.preventSwallow) break;
52728                      t.preventSwallow = !1;
52729                    }
52730                  } else if (i.claimedTouchIdList.length > 0) {
52731                    const e = i.claimedTouchIdList.indexOf(s.getID());
52732                    if (-1 !== e) {
52733                      i._handleEventTouch(t);
52734                      t.type !== MS.TOUCH_END && t.type !== MS.TOUCH_CANCEL || ee.array.removeAt(i.claimedTouchIdList, e);
52735                      n = !1;
52736                      if (!t.preventSwallow) break;
52737                      t.preventSwallow = !1;
52738                    }
52739                  }
52740                }
52741                --this._inDispatchCount <= 0 && this._updatePointerEventProcessorList();
52742                return n;
52743              }
52744              _updatePointerEventProcessorList() {
52745                const t = this._processorListToAdd;
52746                const e = t.length;
52747                for (let i = 0; i < e; ++i) this.addPointerEventProcessor(t[i]);
52748                t.length = 0;
52749                const i = this._processorListToRemove;
52750                const s = i.length;
52751                for (let t = 0; t < s; ++t) this.removePointerEventProcessor(i[t]);
52752                i.length = 0;
52753              }
52754              _sortPointerEventProcessorList() {
52755                if (!this._isListDirty) return;
52756                const t = this._pointerEventProcessorList;
52757                const e = t.length;
52758                for (let i = 0; i < e; ++i) {
52759                  const e = t[i];
52760                  const s = e.node;
52761                  if (s._uiProps) {
52762                    const t = s._uiProps.uiTransformComp;
52763                    e.cachedCameraPriority = t.cameraPriority;
52764                  }
52765                }
52766                t.sort(this._sortByPriority);
52767                this._isListDirty = !1;
52768              }
52769              _sortByPriority(t, e) {
52770                const i = t.node;
52771                const s = e.node;
52772                if (!(e && s && s.activeInHierarchy && s._uiProps.uiTransformComp)) return -1;
52773                if (!(t && i && i.activeInHierarchy && i._uiProps.uiTransformComp)) return 1;
52774                if (t.cachedCameraPriority !== e.cachedCameraPriority) return e.cachedCameraPriority - t.cachedCameraPriority;
52775                let n = i;
52776                let r = s;
52777                let o = !1;
52778                for (;(null === (a = n.parent) || void 0 === a ? void 0 : a._id) !== (null === (l = r.parent) || void 0 === l ? void 0 : l._id); ) {
52779                  var a, l, h, c, u, _;
52780                  n = null === (null === (h = n) || void 0 === h || null === (c = h.parent) || void 0 === c ? void 0 : c.parent) ? (o = !0) && s : n && n.parent;
52781                  r = null === (null === (u = r) || void 0 === u || null === (_ = u.parent) || void 0 === _ ? void 0 : _.parent) ? (o = !0) && i : r && r.parent;
52782                }
52783                if (n._id === r._id) {
52784                  if (n._id === s._id) return -1;
52785                  if (n._id === i._id) return 1;
52786                }
52787                const d = n ? n.getSiblingIndex() : 0;
52788                const p = r ? r.getSiblingIndex() : 0;
52789                return o ? d - p : p - d;
52790              }
52791              _markListDirty() {
52792                this._isListDirty = !0;
52793              }
52794            };
52795            const hz = new Qn(null);
52796            const cz = new qi;
52797            class uz {
52798              get nativeObj() {
52799                return this._nativeObj;
52800              }
52801              get currBufferAccessor() {
52802                if (this._staticVBBuffer) return this._staticVBBuffer;
52803                this._staticVBBuffer = this.switchBufferAccessor();
52804                return this._staticVBBuffer;
52805              }
52806              get batches() {
52807                return this._batches;
52808              }
52809              set currStaticRoot(t) {
52810                this._currStaticRoot = t;
52811              }
52812              set currIsStatic(t) {
52813                this._currIsStatic = t;
52814              }
52815              constructor(t) {
52816                this.device = void 0;
52817                this._screens = [];
52818                this._staticVBBuffer = null;
52819                this._bufferAccessors = new Map;
52820                this._drawBatchPool = void 0;
52821                this._batches = void 0;
52822                this._currBID = -1;
52823                this._indexStart = 0;
52824                this._emptyMaterial = new hm;
52825                this._currRenderData = null;
52826                this._currMaterial = this._emptyMaterial;
52827                this._currTexture = null;
52828                this._currSampler = null;
52829                this._currStaticRoot = null;
52830                this._currComponent = null;
52831                this._currTransform = null;
52832                this._currTextureHash = 0;
52833                this._currSamplerHash = 0;
52834                this._currLayer = 0;
52835                this._currDepthStencilStateStage = null;
52836                this._currIsStatic = !1;
52837                this._currHash = 0;
52838                this._pOpacity = 1;
52839                this._opacityDirty = 0;
52840                this._descriptorSetCache = new dz;
52841                this._meshDataArray = [];
52842                this._maskClearModel = null;
52843                this._maskClearMtl = null;
52844                this._maskModelMesh = null;
52845                this._root = t;
52846                this.device = t.device;
52847                this._batches = new eo(64);
52848                this._drawBatchPool = new $r((() => new MV), 128, (t => t.destroy(this)));
52849              }
52850              initialize() {
52851                return !0;
52852              }
52853              destroy() {
52854                for (let t = 0; t < this._batches.length; t++) this._batches.array[t] && this._batches.array[t].destroy(this);
52855                this._batches.destroy();
52856                this._bufferAccessors.forEach((t => {
52857                  t.destroy();
52858                }));
52859                this._bufferAccessors.clear();
52860                this._drawBatchPool && this._drawBatchPool.destroy();
52861                this._descriptorSetCache.destroy();
52862                cB.sharedManager.destroy();
52863                if (this._maskClearModel && this._maskModelMesh) {
52864                  m.director.root.destroyModel(this._maskClearModel);
52865                  this._maskModelMesh.destroy();
52866                }
52867                this._maskClearMtl && this._maskClearMtl.destroy();
52868              }
52869              syncRootNodesToNative() {
52870                {
52871                  const t = [];
52872                  for (const e of this._screens) t.push(e.node);
52873                  this._nativeObj.syncRootNodesToNative(t);
52874                }
52875              }
52876              addScreen(t) {
52877                this._screens.push(t);
52878                this._screens.sort(this._screenSort);
52879                this.syncRootNodesToNative();
52880              }
52881              removeScreen(t) {
52882                const e = this._screens.indexOf(t);
52883                if (-1 !== e) {
52884                  this._screens.splice(e, 1);
52885                  this.syncRootNodesToNative();
52886                }
52887              }
52888              sortScreens() {
52889                this._screens.sort(this._screenSort);
52890                this.syncRootNodesToNative();
52891              }
52892              getFirstRenderCamera(t) {
52893                if (t.scene && t.scene.renderScene) {
52894                  const e = t.scene.renderScene.cameras;
52895                  for (let i = 0; i < e.length; i++) {
52896                    const s = e[i];
52897                    if (s.visibility & t.layer) return s;
52898                  }
52899                }
52900                return null;
52901              }
52902              update() {}
52903              uploadBuffers() {
52904                this._nativeObj.uploadBuffers();
52905              }
52906              reset() {
52907                this._nativeObj.reset();
52908              }
52909              switchBufferAccessor(t = zM) {
52910                const e = t === zM ? 36 : YM(t);
52911                if (!this._staticVBBuffer || this._staticVBBuffer.vertexFormatBytes !== e) {
52912                  let i = this._bufferAccessors.get(e);
52913                  if (!i) {
52914                    i = new iB(this.device, t);
52915                    this._bufferAccessors.set(e, i);
52916                  }
52917                  this._staticVBBuffer = i;
52918                  this._currBID = -1;
52919                }
52920                return this._staticVBBuffer;
52921              }
52922              registerBufferAccessor(t, e) {
52923                this._bufferAccessors.set(t, e);
52924              }
52925              updateBuffer(t, e) {
52926                const i = this.switchBufferAccessor(t);
52927                if (this._currBID !== e) {
52928                  this._currBID = e;
52929                  this._indexStart = i.getMeshBuffer(e).indexOffset;
52930                }
52931              }
52932              commitComp(t, e, i, s, n) {
52933                let r = 0;
52934                let o;
52935                let a = -1;
52936                if (e && e.chunk) {
52937                  if (!e.isValid()) return;
52938                  r = e.dataHash;
52939                  o = e.material;
52940                  a = e.chunk.bufferId;
52941                }
52942                t.stencilStage === lB.ENTER_LEVEL || t.stencilStage === lB.ENTER_LEVEL_INVERTED ? this._insertMaskBatch(t) : t.stencilStage = cB.sharedManager.stage;
52943                const l = t.stencilStage;
52944                if (this._currHash !== r || 0 === r || this._currMaterial !== o || this._currDepthStencilStateStage !== l) {
52945                  this.autoMergeBatches(this._currComponent);
52946                  e && !e._isMeshBuffer && this.updateBuffer(e.vertexFormat, a);
52947                  this._currRenderData = e;
52948                  this._currHash = e ? e.dataHash : 0;
52949                  this._currComponent = t;
52950                  this._currTransform = n;
52951                  this._currMaterial = t.getRenderMaterial(0);
52952                  this._currDepthStencilStateStage = l;
52953                  this._currLayer = t.node.layer;
52954                  if (i) {
52955                    this._currTexture = i.getGFXTexture();
52956                    this._currSampler = i.getGFXSampler();
52957                    this._currTextureHash = i.getHash();
52958                    this._currSamplerHash = this._currSampler.hash;
52959                  } else {
52960                    this._currTexture = null;
52961                    this._currSampler = null;
52962                    this._currTextureHash = 0;
52963                    this._currSamplerHash = 0;
52964                  }
52965                }
52966                s.fillBuffers(t, this);
52967              }
52968              commitIA(t, e, i, s, n) {
52969                if (this._currMaterial !== this._emptyMaterial) {
52970                  this.autoMergeBatches(this._currComponent);
52971                  this.resetRenderStates();
52972                }
52973                let r;
52974                let o = 0;
52975                if (t) {
52976                  t.stencilStage = cB.sharedManager.stage;
52977                  r = null !== t.customMaterial ? cB.sharedManager.getStencilStage(t.stencilStage, s) : cB.sharedManager.getStencilStage(t.stencilStage);
52978                  o = cB.sharedManager.getStencilHash(t.stencilStage);
52979                }
52980                const a = this._currStaticRoot ? this._currStaticRoot._requireDrawBatch() : this._drawBatchPool.alloc();
52981                a.visFlags = t.node.layer;
52982                a.inputAssembler = e;
52983                a.useLocalData = n || null;
52984                if (i) {
52985                  a.texture = i.getGFXTexture();
52986                  a.sampler = i.getGFXSampler();
52987                  a.textureHash = i.getHash();
52988                  a.samplerHash = a.sampler.hash;
52989                }
52990                a.fillPasses(s || null, r, o, null);
52991                this._batches.push(a);
52992              }
52993              commitModel(t, e, i) {
52994                if (this._currMaterial !== this._emptyMaterial) {
52995                  this.autoMergeBatches(this._currComponent);
52996                  this.resetRenderStates();
52997                }
52998                let s;
52999                let n = 0;
53000                if (i) {
53001                  t.stencilStage === lB.ENTER_LEVEL || t.stencilStage === lB.ENTER_LEVEL_INVERTED ? this._insertMaskBatch(t) : t.stencilStage = cB.sharedManager.stage;
53002                  s = cB.sharedManager.getStencilStage(t.stencilStage, i);
53003                  n = cB.sharedManager.getStencilHash(t.stencilStage);
53004                }
53005                const r = m.director.getTotalFrames();
53006                if (e) {
53007                  e.updateTransform(r);
53008                  e.updateUBOs(r);
53009                }
53010                for (let r = 0; r < e.subModels.length; r++) {
53011                  const o = this._drawBatchPool.alloc();
53012                  const a = e.subModels[r];
53013                  o.visFlags = t.node.layer;
53014                  o.model = e;
53015                  o.texture = null;
53016                  o.sampler = null;
53017                  o.useLocalData = null;
53018                  s || (s = null);
53019                  o.fillPasses(i, s, n, a.patches);
53020                  o.inputAssembler = a.inputAssembler;
53021                  o.model.visFlags = o.visFlags;
53022                  o.descriptorSet = a.descriptorSet;
53023                  this._batches.push(o);
53024                }
53025              }
53026              setupStaticBatch(t, e) {
53027                this.finishMergeBatches();
53028                this._staticVBBuffer = e;
53029                this.currStaticRoot = t;
53030              }
53031              endStaticBatch() {
53032                this.finishMergeBatches();
53033                this.currStaticRoot = null;
53034                this._staticVBBuffer = null;
53035                this.switchBufferAccessor();
53036              }
53037              commitStaticBatch(t) {
53038                this._batches.concat(t.drawBatchList);
53039                this.finishMergeBatches();
53040              }
53041              autoMergeBatches(t) {
53042                const e = this._currMaterial;
53043                if (!e) return;
53044                let i;
53045                const s = this._currRenderData;
53046                const n = this._staticVBBuffer;
53047                if (s && s._isMeshBuffer) {
53048                  i = s.requestIA(this.device);
53049                  -1 === this._meshDataArray.indexOf(s) && this._meshDataArray.push(s);
53050                } else if (n) {
53051                  const t = this._currBID;
53052                  const e = n.getMeshBuffer(t);
53053                  if (!e) return;
53054                  const s = e.indexOffset - this._indexStart;
53055                  if (s <= 0) return;
53056                  ne(this._indexStart < e.indexOffset);
53057                  e.setDirty();
53058                  i = e.requireFreeIA(this.device);
53059                  i.firstIndex = this._indexStart;
53060                  i.indexCount = s;
53061                  this._indexStart = e.indexOffset;
53062                }
53063                this._currBID = -1;
53064                if (!i) return;
53065                let r;
53066                let o = 0;
53067                if (t) {
53068                  r = null !== t.customMaterial ? cB.sharedManager.getStencilStage(t.stencilStage, e) : cB.sharedManager.getStencilStage(t.stencilStage);
53069                  o = cB.sharedManager.getStencilHash(t.stencilStage);
53070                }
53071                const a = this._currStaticRoot ? this._currStaticRoot._requireDrawBatch() : this._drawBatchPool.alloc();
53072                a.visFlags = this._currLayer;
53073                a.texture = this._currTexture;
53074                a.sampler = this._currSampler;
53075                a.inputAssembler = i;
53076                a.useLocalData = this._currTransform;
53077                a.textureHash = this._currTextureHash;
53078                a.samplerHash = this._currSamplerHash;
53079                a.fillPasses(e, r, o, null);
53080                this._batches.push(a);
53081              }
53082              forceMergeBatches(t, e, i) {
53083                this._currMaterial = t;
53084                if (e) {
53085                  this._currTexture = e.getGFXTexture();
53086                  this._currSampler = e.getGFXSampler();
53087                  this._currTextureHash = e.getHash();
53088                  this._currSamplerHash = this._currSampler.hash;
53089                } else {
53090                  this._currTexture = this._currSampler = null;
53091                  this._currTextureHash = this._currSamplerHash = 0;
53092                }
53093                this._currLayer = i.node.layer;
53094                this.autoMergeBatches(i);
53095              }
53096              resetRenderStates() {
53097                this._currMaterial = this._emptyMaterial;
53098                this._currRenderData = null;
53099                this._currTexture = null;
53100                this._currComponent = null;
53101                this._currTransform = null;
53102                this._currTextureHash = 0;
53103                this._currSamplerHash = 0;
53104                this._currLayer = 0;
53105              }
53106              finishMergeBatches() {
53107                this.autoMergeBatches();
53108                this.resetRenderStates();
53109              }
53110              flushMaterial(t) {
53111                this._currMaterial = t;
53112              }
53113              walk(t, e = 0) {
53114                if (!t.activeInHierarchy) return;
53115                const i = t.children;
53116                const s = t._uiProps;
53117                const n = s.uiComp;
53118                const r = this._pOpacity;
53119                let o = r;
53120                const a = n && n.color ? n.color.a / 255 : 1;
53121                this._pOpacity = o *= a * s.localOpacity;
53122                s._opacity = o;
53123                s.colorDirty && this._opacityDirty++;
53124                n && n.enabledInHierarchy && n.fillBuffers(this);
53125                if (this._opacityDirty && n && !n.useVertexOpacity && n.renderData && n.renderData.vertexCount > 0) {
53126                  !function(t, e) {
53127                    const i = t.vertexFormat;
53128                    const s = t.chunk.vb;
53129                    let n;
53130                    let r;
53131                    let o;
53132                    let a = 0;
53133                    for (let l = 0; l < i.length; ++l) {
53134                      n = i[l];
53135                      r = ur[n.format];
53136                      if (r.hasAlpha) {
53137                        o = t.floatStride;
53138                        if (r.size / r.count == 1) {
53139                          const t = ~~_i(Math.round(255 * e), 0, 255);
53140                          for (let e = a; e < s.length; e += o) s[e] = (4294967040 & s[e] | t) >>> 0;
53141                        } else if (r.size / r.count == 4) for (let t = a + 3; t < s.length; t += o) s[t] = e;
53142                      }
53143                      a += r.size >> 2;
53144                    }
53145                  }(n.renderData, o);
53146                  const t = n.renderData.getMeshBuffer();
53147                  t && t.setDirty();
53148                }
53149                if (i.length > 0 && !t._static) for (let t = 0; t < i.length; ++t) {
53150                  const s = i[t];
53151                  this.walk(s, e);
53152                }
53153                if (s.colorDirty) {
53154                  this._opacityDirty--;
53155                  s.colorDirty = !1;
53156                }
53157                this._pOpacity = r;
53158                if (n && n.enabledInHierarchy) {
53159                  n.postUpdateAssembler(this);
53160                  if ((n.stencilStage === lB.ENTER_LEVEL || n.stencilStage === lB.ENTER_LEVEL_INVERTED) && cB.sharedManager.getMaskStackSize() > 0) {
53161                    this.autoMergeBatches(this._currComponent);
53162                    this.resetRenderStates();
53163                    cB.sharedManager.exitMask();
53164                  }
53165                }
53166                e += 1;
53167              }
53168              _screenSort(t, e) {
53169                return t.node.getSiblingIndex() - e.node.getSiblingIndex();
53170              }
53171              _releaseDescriptorSetCache(t, e = null) {
53172                this._nativeObj.releaseDescriptorSetCache(t, e);
53173              }
53174              _createClearModel() {
53175                if (!this._maskClearModel) {
53176                  this._maskClearMtl = xR.get("default-clear-stencil");
53177                  this._maskClearModel = m.director.root.createModel(wA);
53178                  const t = YM(UM);
53179                  const e = zo.gfxDevice;
53180                  const i = e.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.DEVICE, 4 * t, t));
53181                  const s = new Float32Array([ -1, -1, 0, 1, -1, 0, -1, 1, 0, 1, 1, 0 ]);
53182                  i.update(s);
53183                  const n = e.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, 6 * Uint16Array.BYTES_PER_ELEMENT, Uint16Array.BYTES_PER_ELEMENT));
53184                  const r = new Uint16Array([ 0, 1, 2, 2, 1, 3 ]);
53185                  n.update(r);
53186                  this._maskModelMesh = new fC([ i ], UM, Xs.TRIANGLE_LIST, n);
53187                  this._maskModelMesh.subMeshIdx = 0;
53188                  this._maskClearModel.initSubModel(0, this._maskModelMesh, this._maskClearMtl);
53189                }
53190              }
53191              _insertMaskBatch(t) {
53192                this.autoMergeBatches(this._currComponent);
53193                this.resetRenderStates();
53194                this._createClearModel();
53195                this._maskClearModel.node = this._maskClearModel.transform = t.node;
53196                const e = cB.sharedManager;
53197                e.pushMask(1);
53198                const i = e.clear(t);
53199                let s;
53200                let n = 0;
53201                const r = this._maskClearMtl;
53202                if (r) {
53203                  s = e.getStencilStage(i, r);
53204                  n = e.getStencilHash(i);
53205                }
53206                const o = this._maskClearModel;
53207                const a = m.director.getTotalFrames();
53208                if (o) {
53209                  o.updateTransform(a);
53210                  o.updateUBOs(a);
53211                }
53212                for (let e = 0; e < o.subModels.length; e++) {
53213                  const i = this._drawBatchPool.alloc();
53214                  const a = o.subModels[e];
53215                  i.visFlags = t.node.layer;
53216                  i.model = o;
53217                  i.texture = null;
53218                  i.sampler = null;
53219                  i.useLocalData = null;
53220                  s || (s = null);
53221                  i.fillPasses(r, s, n, a.patches);
53222                  i.inputAssembler = a.inputAssembler;
53223                  i.model.visFlags = i.visFlags;
53224                  i.descriptorSet = a.descriptorSet;
53225                  this._batches.push(i);
53226                }
53227                e.enableMask();
53228              }
53229              syncMeshBuffersToNative(t, e) {
53230                {
53231                  const i = [];
53232                  e.forEach((t => {
53233                    i.push(t.nativeObj);
53234                  }));
53235                  this._nativeObj.syncMeshBuffersToNative(t, i);
53236                }
53237              }
53238            }
53239            t("UI", uz);
53240            class _z {
53241              get descriptorSet() {
53242                return this._descriptorSet;
53243              }
53244              constructor() {
53245                this._descriptorSet = null;
53246                this._transform = null;
53247                this._textureHash = 0;
53248                this._samplerHash = 0;
53249                this._localBuffer = null;
53250                this._transformUpdate = !0;
53251                const t = zo.gfxDevice;
53252                this._localData = new Float32Array(Km.COUNT);
53253                this._localBuffer = t.createBuffer(new An(Ts.UNIFORM | Ts.TRANSFER_DST, Cs.HOST | Cs.DEVICE, Km.SIZE, Km.SIZE));
53254              }
53255              initialize(t) {
53256                const e = zo.gfxDevice;
53257                this._transform = t.useLocalData;
53258                this._textureHash = t.textureHash;
53259                this._samplerHash = t.samplerHash;
53260                hz.layout = t.passes[0].localSetLayout;
53261                this._descriptorSet = e.createDescriptorSet(hz);
53262                this._descriptorSet.bindBuffer(Km.BINDING, this._localBuffer);
53263                const i = vm.SAMPLER_SPRITE;
53264                this._descriptorSet.bindTexture(i, t.texture);
53265                this._descriptorSet.bindSampler(i, t.sampler);
53266                this._descriptorSet.update();
53267                this._transformUpdate = !0;
53268              }
53269              updateTransform(t) {
53270                if (t !== this._transform) {
53271                  this._transform = t;
53272                  this._transformUpdate = !0;
53273                  this.uploadLocalData();
53274                }
53275              }
53276              equals(t, e, i) {
53277                return this._transform === t && this._textureHash === e && this._samplerHash === i;
53278              }
53279              reset() {
53280                this._transform = null;
53281                this._textureHash = 0;
53282                this._samplerHash = 0;
53283              }
53284              destroy() {
53285                if (this._localBuffer) {
53286                  this._localBuffer.destroy();
53287                  this._localBuffer = null;
53288                }
53289                if (this._descriptorSet) {
53290                  this._descriptorSet.destroy();
53291                  this._descriptorSet = null;
53292                }
53293                this._localData = null;
53294              }
53295              isValid() {
53296                return this._transform && this._transform.isValid;
53297              }
53298              uploadLocalData() {
53299                const t = this._transform;
53300                if (t.hasChangedFlags || t._dirtyFlags) {
53301                  t.updateWorldTransform();
53302                  this._transformUpdate = !0;
53303                }
53304                if (this._transformUpdate) {
53305                  const e = t.worldMatrix;
53306                  qi.toArray(this._localData, e, Km.MAT_WORLD_OFFSET);
53307                  qi.inverseTranspose(cz, e);
53308                  qi.toArray(this._localData, cz, Km.MAT_WORLD_IT_OFFSET);
53309                  this._localBuffer.update(this._localData);
53310                  this._transformUpdate = !1;
53311                }
53312              }
53313            }
53314            class dz {
53315              constructor() {
53316                this._descriptorSetCache = new Map;
53317                this._dsCacheHashByTexture = new Map;
53318                this._localDescriptorSetCache = [];
53319                this._localCachePool = void 0;
53320                this._localCachePool = new $r((() => new _z), 16, (t => t.destroy()));
53321              }
53322              getDescriptorSet(t) {
53323                m.director.root;
53324                let e;
53325                if (t.useLocalData) {
53326                  const e = this._localDescriptorSetCache;
53327                  for (let i = 0, s = e.length; i < s; i++) {
53328                    const s = e[i];
53329                    if (s.equals(t.useLocalData, t.textureHash, t.samplerHash)) return s.descriptorSet;
53330                  }
53331                  const i = this._localCachePool.alloc();
53332                  i.initialize(t);
53333                  this._localDescriptorSetCache.push(i);
53334                  return i.descriptorSet;
53335                }
53336                e = t.textureHash ^ t.samplerHash;
53337                if (this._descriptorSetCache.has(e)) return this._descriptorSetCache.get(e);
53338                {
53339                  hz.layout = t.passes[0].localSetLayout;
53340                  const i = zo.gfxDevice.createDescriptorSet(hz);
53341                  const s = vm.SAMPLER_SPRITE;
53342                  i.bindTexture(s, t.texture);
53343                  i.bindSampler(s, t.sampler);
53344                  i.update();
53345                  this._descriptorSetCache.set(e, i);
53346                  this._dsCacheHashByTexture.set(t.textureHash, e);
53347                  return i;
53348                }
53349              }
53350              update() {
53351                const t = this._localDescriptorSetCache;
53352                const e = [];
53353                t.forEach((i => {
53354                  if (i.isValid()) i.uploadLocalData(); else {
53355                    i.reset();
53356                    const s = t.indexOf(i);
53357                    e.push(s);
53358                  }
53359                }));
53360                for (let i = e.length - 1; i >= 0; i--) t.splice(e[i], 1);
53361              }
53362              reset() {
53363                this._localDescriptorSetCache.forEach((t => {
53364                  this._localCachePool.free(t);
53365                }));
53366                this._localDescriptorSetCache.length = 0;
53367              }
53368              releaseDescriptorSetCache(t) {
53369                const e = this._dsCacheHashByTexture.get(t);
53370                if (e && this._descriptorSetCache.has(e)) {
53371                  this._descriptorSetCache.get(e).destroy();
53372                  this._descriptorSetCache.delete(e);
53373                  this._dsCacheHashByTexture.delete(t);
53374                }
53375              }
53376              destroy() {
53377                this._descriptorSetCache.forEach(((t, e, i) => {
53378                  t.destroy();
53379                }));
53380                this._descriptorSetCache.clear();
53381                this._dsCacheHashByTexture.clear();
53382                this._localDescriptorSetCache.length = 0;
53383                this._localCachePool.destroy();
53384              }
53385            }
53386            m.internal.Batcher2D = uz;
53387            t("UIDrawBatch", class extends MV {});
53388            q($M.prototype, "MeshBuffer", [ "byteStart", "vertexStart", "indicesStart", "request" ].map((t => ({
53389              name: t,
53390              suggest: `please use meshBuffer.accessor.${t} instead`
53391            }))));
53392            W($M.prototype, "MeshBuffer", [ {
53393              name: "indicesOffset",
53394              newName: "indexOffset"
53395            } ]);
53396            Y($M.prototype, "MeshBuffer", [ {
53397              name: "vertexBuffers"
53398            }, {
53399              name: "indexBuffer"
53400            } ]);
53401            W(uz.prototype, "Batcher2D", [ {
53402              name: "currBufferBatch",
53403              newName: "currBufferAccessor"
53404            }, {
53405              name: "acquireBufferBatch",
53406              newName: "switchBufferAccessor"
53407            } ]);
53408            Y(AB.prototype, "MeshRenderData", [ {
53409              name: "formatByte"
53410            }, {
53411              name: "byteStart"
53412            }, {
53413              name: "byteCount"
53414            } ]);
53415            W(AB.prototype, "MeshRenderData", [ {
53416              name: "indicesStart",
53417              newName: "indexStart"
53418            } ]);
53419            t("QuadRenderData", class extends AB {
53420              constructor(t) {
53421                super(t);
53422                N(9006);
53423              }
53424            });
53425            let pz = null;
53426            let mz = -1;
53427            const fz = "BES bswy:->@123丁ぁᄁ";
53428            const gz = Object.create(null);
53429            const yz = [];
53430            const bz = 3e3;
53431            const Sz = (() => {
53432              let t;
53433              return () => {
53434                if (void 0 === t) if ("FontFace" in window) {
53435                  const e = /Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent);
53436                  const i = /OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent) && /Apple/.exec(window.navigator.vendor);
53437                  t = e ? parseInt(e[1], 10) > 42 : !i;
53438                } else t = !1;
53439                return t;
53440              };
53441            })();
53442            function Az() {
53443              let t = !0;
53444              const e = Date.now();
53445              for (let i = yz.length - 1; i >= 0; i--) {
53446                const s = yz[i];
53447                const n = s.fontFamilyName;
53448                if (e - s.startTime > bz) {
53449                  N(4933, n);
53450                  s.onComplete(null, n);
53451                  yz.splice(i, 1);
53452                  continue;
53453                }
53454                const r = s.refWidth;
53455                const o = `40px ${n}`;
53456                pz.font = o;
53457                if (r !== xM(pz, fz, o)) {
53458                  yz.splice(i, 1);
53459                  s.onComplete(null, n);
53460                } else t = !1;
53461              }
53462              if (t) {
53463                clearInterval(mz);
53464                mz = -1;
53465              }
53466            }
53467            function Tz(t, e, i) {
53468              const s = function(t) {
53469                const e = t.lastIndexOf(".ttf");
53470                if (-1 === e) return t;
53471                const i = t.lastIndexOf("/");
53472                let s;
53473                s = -1 === i ? `${t.substring(0, e)}_LABEL` : `${t.substring(i + 1, e)}_LABEL`;
53474                -1 !== s.indexOf(" ") && (s = `"${s}"`);
53475                return s;
53476              }(t);
53477              if (gz[s]) {
53478                i(null, s);
53479                return;
53480              }
53481              if (!pz) {
53482                const t = document.createElement("canvas");
53483                t.width = 100;
53484                t.height = 100;
53485                pz = t.getContext("2d");
53486              }
53487              const n = xM(pz, fz, `40px ${s}`);
53488              const r = document.createElement("style");
53489              r.type = "text/css";
53490              let o = "";
53491              Number.isNaN(s) ? o += `@font-face { font-family:${s}; src:` : o += `@font-face { font-family:"${s}"; src:`;
53492              o += `url("${t}");`;
53493              r.textContent = `${o}}`;
53494              document.body.appendChild(r);
53495              const a = document.createElement("div");
53496              const l = a.style;
53497              l.fontFamily = s;
53498              a.innerHTML = ".";
53499              l.position = "absolute";
53500              l.left = "-100px";
53501              l.top = "-100px";
53502              document.body.appendChild(a);
53503              if (Sz()) !function(t, e, i) {
53504                const s = new Promise(((i, s) => {
53505                  const n = () => {
53506                    Date.now() - t >= bz ? s() : document.fonts.load(`40px ${e}`).then((t => {
53507                      t.length >= 1 ? i() : setTimeout(n, 100);
53508                    }), (() => {
53509                      s();
53510                    }));
53511                  };
53512                  n();
53513                }));
53514                let n = null;
53515                const r = new Promise(((t, e) => {
53516                  n = setTimeout(e, bz);
53517                }));
53518                Promise.race([ r, s ]).then((() => {
53519                  if (n) {
53520                    clearTimeout(n);
53521                    n = null;
53522                  }
53523                  i(null, e);
53524                }), (() => {
53525                  N(4933, e);
53526                  i(null, e);
53527                }));
53528              }(Date.now(), s, i); else {
53529                const t = {
53530                  fontFamilyName: s,
53531                  refWidth: n,
53532                  onComplete: i,
53533                  startTime: Date.now()
53534                };
53535                yz.push(t);
53536                -1 === mz && (mz = setInterval(Az, 100));
53537              }
53538              gz[s] = r;
53539            }
53540            function vz(t, e, i, s) {
53541              const n = new $I;
53542              n._nativeUrl = t;
53543              n._nativeAsset = e;
53544              s(null, n);
53545            }
53546            Jw.register({
53547              ".font": Tz,
53548              ".eot": Tz,
53549              ".ttf": Tz,
53550              ".woff": Tz,
53551              ".svg": Tz,
53552              ".ttc": Tz
53553            });
53554            sR.register({
53555              ".font": vz,
53556              ".eot": vz,
53557              ".ttf": vz,
53558              ".woff": vz,
53559              ".svg": vz,
53560              ".ttc": vz
53561            });
53562            m.UI = {
53563              MeshBuffer: $M,
53564              spriteAssembler: oz,
53565              graphicsAssembler: Yk,
53566              labelAssembler: bG,
53567              RenderData: SB,
53568              MeshRenderData: AB
53569            };
53570            const Ez = t("Mesh", jsb.Mesh);
53571            const Cz = jsb.Mesh.IStruct.prototype;
53572            Object.defineProperty(Cz, "minPosition", {
53573              configurable: !0,
53574              enumerable: !0,
53575              get() {
53576                const t = this.getMinPosition();
53577                t ? this._minPositionCache ? this._minPositionCache.set(t.x, t.y, t.z) : this._minPositionCache = new Pi(t.x, t.y, t.z) : this._minPositionCache = void 0;
53578                return this._minPositionCache;
53579              },
53580              set(t) {
53581                this.setMinPosition(t);
53582              }
53583            });
53584            Object.defineProperty(Cz, "maxPosition", {
53585              configurable: !0,
53586              enumerable: !0,
53587              get() {
53588                const t = this.getMaxPosition();
53589                t ? this._maxPositionCache ? this._maxPositionCache.set(t.x, t.y, t.z) : this._maxPositionCache = new Pi(t.x, t.y, t.z) : this._maxPositionCache = void 0;
53590                return this._maxPositionCache;
53591              },
53592              set(t) {
53593                this.setMaxPosition(t);
53594              }
53595            });
53596            const xz = jsb.Mesh.prototype;
53597            xz.createNode = null;
53598            const wz = xz.onLoaded;
53599            xz._ctor = function() {
53600              jsb.Asset.prototype._ctor.apply(this, arguments);
53601              this._struct = {
53602                vertexBundles: [],
53603                primitives: []
53604              };
53605              this._minPosition = void 0;
53606              this._maxPosition = void 0;
53607            };
53608            Object.defineProperty(xz, "struct", {
53609              configurable: !0,
53610              enumerable: !0,
53611              get() {
53612                return this.getStruct();
53613              }
53614            });
53615            Object.defineProperty(xz, "minPosition", {
53616              configurable: !0,
53617              enumerable: !0,
53618              get() {
53619                const t = this.getMinPosition();
53620                t ? this._minPosition ? this._minPosition.set(t.x, t.y, t.z) : this._minPosition = new Pi(t.x, t.y, t.z) : this._minPosition = void 0;
53621                return this._minPosition;
53622              }
53623            });
53624            Object.defineProperty(xz, "maxPosition", {
53625              configurable: !0,
53626              enumerable: !0,
53627              get() {
53628                const t = this.getMaxPosition();
53629                t ? this._maxPosition ? this._maxPosition.set(t.x, t.y, t.z) : this._maxPosition = new Pi(t.x, t.y, t.z) : this._maxPosition = void 0;
53630                return this._maxPosition;
53631              }
53632            });
53633            xz.onLoaded = function() {
53634              null != this._struct && this.setStruct(this._struct);
53635              this._struct = null;
53636              wz.apply(this);
53637            };
53638            m.Mesh = jsb.Mesh;
53639            const Rz = Ez.prototype;
53640            Yl(Rz, "_struct");
53641            Yl(Rz, "_hash");
53642            Yl(Rz, "_allowDataAccess");
53643            Ul("cc.Mesh")(Ez);
53644            const Iz = jsb.MorphModel;
53645            m.MorphModel = jsb.MorphModel;
53646            var Mz, Bz, Dz, Pz, Oz, Nz, Lz, Fz, Vz, kz, Uz, Gz, zz, Hz, jz, Xz, Wz, Yz, qz, Kz, Jz, Zz, Qz, $z, tH, eH, iH, sH, nH, rH, oH, aH, lH, hH, cH, uH, _H, dH, pH, mH;
53647            const fH = oe({
53648              OFF: 0,
53649              ON: 1
53650            });
53651            const gH = oe({
53652              OFF: 0,
53653              ON: 1
53654            });
53655            let yH = (Mz = Ul("cc.ModelLightmapSettings"), Bz = ql("_recieveShadow"), Mz(Dz = (Pz = class {
53656              constructor() {
53657                Ml(this, "texture", Oz, this);
53658                Ml(this, "uvParam", Nz, this);
53659                Ml(this, "_bakeable", Lz, this);
53660                Ml(this, "_castShadow", Fz, this);
53661                Ml(this, "_receiveShadow", Vz, this);
53662                Ml(this, "_lightmapSize", kz, this);
53663              }
53664              get bakeable() {
53665                return this._bakeable;
53666              }
53667              set bakeable(t) {
53668                this._bakeable = t;
53669              }
53670              get castShadow() {
53671                return this._castShadow;
53672              }
53673              set castShadow(t) {
53674                this._castShadow = t;
53675              }
53676              get receiveShadow() {
53677                return this._receiveShadow;
53678              }
53679              set receiveShadow(t) {
53680                this._receiveShadow = t;
53681              }
53682              get lightmapSize() {
53683                return this._lightmapSize;
53684              }
53685              set lightmapSize(t) {
53686                this._lightmapSize = t;
53687              }
53688            }, Oz = Bl(Pz.prototype, "texture", [ Yl ], {
53689              configurable: !0,
53690              enumerable: !0,
53691              writable: !0,
53692              initializer: function() {
53693                return null;
53694              }
53695            }), Nz = Bl(Pz.prototype, "uvParam", [ Yl ], {
53696              configurable: !0,
53697              enumerable: !0,
53698              writable: !0,
53699              initializer: function() {
53700                return new is;
53701              }
53702            }), Lz = Bl(Pz.prototype, "_bakeable", [ Yl ], {
53703              configurable: !0,
53704              enumerable: !0,
53705              writable: !0,
53706              initializer: function() {
53707                return !1;
53708              }
53709            }), Fz = Bl(Pz.prototype, "_castShadow", [ Yl ], {
53710              configurable: !0,
53711              enumerable: !0,
53712              writable: !0,
53713              initializer: function() {
53714                return !1;
53715              }
53716            }), Vz = Bl(Pz.prototype, "_receiveShadow", [ Bz ], {
53717              configurable: !0,
53718              enumerable: !0,
53719              writable: !0,
53720              initializer: function() {
53721                return !1;
53722              }
53723            }), kz = Bl(Pz.prototype, "_lightmapSize", [ Yl ], {
53724              configurable: !0,
53725              enumerable: !0,
53726              writable: !0,
53727              initializer: function() {
53728                return 64;
53729              }
53730            }), Bl(Pz.prototype, "bakeable", [ nh ], Object.getOwnPropertyDescriptor(Pz.prototype, "bakeable"), Pz.prototype),
53731            Bl(Pz.prototype, "castShadow", [ nh ], Object.getOwnPropertyDescriptor(Pz.prototype, "castShadow"), Pz.prototype),
53732            Bl(Pz.prototype, "receiveShadow", [ nh ], Object.getOwnPropertyDescriptor(Pz.prototype, "receiveShadow"), Pz.prototype),
53733            Bl(Pz.prototype, "lightmapSize", [ nh ], Object.getOwnPropertyDescriptor(Pz.prototype, "lightmapSize"), Pz.prototype),
53734            Pz)) || Dz);
53735            let bH = function(e) {
53736              return t({
53737                MeshRenderer: e,
53738                ModelComponent: e
53739              }), e;
53740            }((Uz = Ul("cc.MeshRenderer"), Gz = sh(), zz = zl(100), Hz = $l(), jz = Th(Ne),
53741            Xz = lh(), Wz = jl({
53742              group: {
53743                name: "DynamicShadowSettings",
53744                displayOrder: 0
53745              }
53746            }), Yz = Th(Ne), qz = lh(), Kz = jl({
53747              group: {
53748                name: "DynamicShadowSettings",
53749                displayOrder: 1
53750              }
53751            }), Jz = Th(fH), Zz = lh(), Qz = jl({
53752              group: {
53753                name: "DynamicShadowSettings",
53754                displayOrder: 2
53755              }
53756            }), $z = Th(gH), tH = lh(), eH = jl({
53757              group: {
53758                name: "DynamicShadowSettings",
53759                displayOrder: 3
53760              }
53761            }), iH = Th(Ez), sH = lh(), nH = rh(), Uz(rH = Gz(rH = zz(rH = Hz(rH = Ql(rH = (oH = (mH = pH = class extends wS {
53762              get shadowBias() {
53763                return this._shadowBias;
53764              }
53765              set shadowBias(t) {
53766                this._shadowBias = t;
53767                this._updateShadowBias();
53768                this._onUpdateLocalShadowBias();
53769              }
53770              get shadowNormalBias() {
53771                return this._shadowNormalBias;
53772              }
53773              set shadowNormalBias(t) {
53774                this._shadowNormalBias = t;
53775                this._updateShadowNormalBias();
53776                this._onUpdateLocalShadowBias();
53777              }
53778              get shadowCastingMode() {
53779                return this._shadowCastingMode;
53780              }
53781              set shadowCastingMode(t) {
53782                this._shadowCastingMode = t;
53783                this._updateCastShadow();
53784              }
53785              get receiveShadow() {
53786                return this._shadowReceivingMode;
53787              }
53788              set receiveShadow(t) {
53789                this._shadowReceivingMode = t;
53790                this._updateReceiveShadow();
53791              }
53792              get mesh() {
53793                return this._mesh;
53794              }
53795              set mesh(t) {
53796                const e = this._mesh;
53797                const i = this._mesh = t;
53798                null == i || i.initialize();
53799                this._initSubMeshShapesWeights();
53800                this._watchMorphInMesh();
53801                this._onMeshChanged(e);
53802                this._updateModels();
53803                this.enabledInHierarchy && this._attachToScene();
53804                this._updateCastShadow();
53805                this._updateReceiveShadow();
53806              }
53807              get model() {
53808                return this._model;
53809              }
53810              get enableMorph() {
53811                return this._enableMorph;
53812              }
53813              set enableMorph(t) {
53814                this._enableMorph = t;
53815              }
53816              constructor() {
53817                super();
53818                Ml(this, "lightmapSettings", aH, this);
53819                Ml(this, "_mesh", lH, this);
53820                Ml(this, "_shadowCastingMode", hH, this);
53821                Ml(this, "_shadowReceivingMode", cH, this);
53822                Ml(this, "_shadowBias", uH, this);
53823                Ml(this, "_shadowNormalBias", _H, this);
53824                this._subMeshShapesWeights = [];
53825                this._modelType = void 0;
53826                this._model = null;
53827                this._morphInstance = null;
53828                Ml(this, "_enableMorph", dH, this);
53829                this._modelType = wA;
53830              }
53831              onLoad() {
53832                this._mesh && this._mesh.initialize();
53833                this._validateShapeWeights() || this._initSubMeshShapesWeights();
53834                this._watchMorphInMesh();
53835                this._updateModels();
53836                this._updateCastShadow();
53837                this._updateReceiveShadow();
53838                this._updateShadowBias();
53839                this._updateShadowNormalBias();
53840              }
53841              onRestore() {
53842                this._updateModels();
53843                this.enabledInHierarchy && this._attachToScene();
53844                this._updateCastShadow();
53845                this._updateReceiveShadow();
53846                this._updateShadowBias();
53847                this._updateShadowNormalBias();
53848              }
53849              onEnable() {
53850                super.onEnable();
53851                this._model || this._updateModels();
53852                this._updateCastShadow();
53853                this._updateReceiveShadow();
53854                this._updateShadowBias();
53855                this._updateShadowNormalBias();
53856                this._onUpdateLocalShadowBias();
53857                this._attachToScene();
53858              }
53859              onDisable() {
53860                this._model && this._detachFromScene();
53861              }
53862              onDestroy() {
53863                if (this._model) {
53864                  m.director.root.destroyModel(this._model);
53865                  this._model = null;
53866                  this._models.length = 0;
53867                }
53868                this._morphInstance && this._morphInstance.destroy();
53869              }
53870              onGeometryChanged() {
53871                if (this._model && this._mesh) {
53872                  const t = this._mesh.struct;
53873                  this._model.createBoundingShape(t.minPosition, t.maxPosition);
53874                  this._model.updateWorldBound();
53875                  this._model.onGeometryChanged();
53876                }
53877              }
53878              getWeight(t, e) {
53879                const {_subMeshShapesWeights: i} = this;
53880                ne(t < i.length);
53881                const s = this._subMeshShapesWeights[t];
53882                ne(e < s.length);
53883                return s[e];
53884              }
53885              setWeights(t, e) {
53886                const {_subMeshShapesWeights: i} = this;
53887                if (e >= i.length) return;
53888                if (i[e].length === t.length) {
53889                  i[e] = t.slice(0);
53890                  this._uploadSubMeshShapesWeights(e);
53891                }
53892              }
53893              setWeight(t, e, i) {
53894                const {_subMeshShapesWeights: s} = this;
53895                if (e >= s.length) return;
53896                const n = s[e];
53897                if (!(i >= n.length)) {
53898                  n[i] = t;
53899                  this._uploadSubMeshShapesWeights(e);
53900                }
53901              }
53902              setInstancedAttribute(t, e) {
53903                this.model && this.model._setInstancedAttribute(t, e);
53904              }
53905              _updateLightmap(t, e, i, s, n) {
53906                this.lightmapSettings.texture = t;
53907                this.lightmapSettings.uvParam.x = e;
53908                this.lightmapSettings.uvParam.y = i;
53909                this.lightmapSettings.uvParam.z = s;
53910                this.lightmapSettings.uvParam.w = n;
53911                this._onUpdateLightingmap();
53912              }
53913              _updateModels() {
53914                if (!this.enabledInHierarchy) return;
53915                const t = this._model;
53916                if (t) {
53917                  t.destroy();
53918                  t.initialize();
53919                  t.node = t.transform = this.node;
53920                } else this._createModel();
53921                if (this._model) {
53922                  if (this._mesh) {
53923                    const t = this._mesh.struct;
53924                    this._model.createBoundingShape(t.minPosition, t.maxPosition);
53925                  }
53926                  this._model.initLightingmap(this.lightmapSettings.texture, this.lightmapSettings.uvParam);
53927                  this._updateModelParams();
53928                  this._onUpdateLightingmap();
53929                  this._onUpdateLocalShadowBias();
53930                }
53931              }
53932              _createModel() {
53933                const t = !!this._morphInstance && this._modelType === wA ? Iz : this._modelType;
53934                const e = this._model = m.director.root.createModel(t);
53935                e.visFlags = this.visibility;
53936                e.node = e.transform = this.node;
53937                this._models.length = 0;
53938                this._models.push(this._model);
53939                this._morphInstance && e instanceof Iz && e.setMorphRendering(this._morphInstance);
53940              }
53941              _attachToScene() {
53942                if (!this.node.scene || !this._model) return;
53943                const t = this._getRenderScene();
53944                null !== this._model.scene && this._detachFromScene();
53945                t.addModel(this._model);
53946              }
53947              _detachFromScene() {
53948                this._model && this._model.scene && this._model.scene.removeModel(this._model);
53949              }
53950              _updateModelParams() {
53951                if (!this._mesh || !this._model) return;
53952                this.node.hasChangedFlags |= ay.POSITION;
53953                this._model.transform.hasChangedFlags |= ay.POSITION;
53954                this._model.isDynamicBatching = this._isBatchingEnabled();
53955                const t = this._mesh ? this._mesh.renderingSubMeshes.length : 0;
53956                const e = this._mesh.renderingSubMeshes;
53957                if (e) for (let i = 0; i < t; ++i) {
53958                  let t = this.getRenderMaterial(i);
53959                  t && !t.isValid && (t = null);
53960                  const s = e[i];
53961                  s && this._model.initSubModel(i, s, t || this._getBuiltinMaterial());
53962                }
53963                this._model.enabled = !0;
53964              }
53965              _onUpdateLightingmap() {
53966                null !== this.model && this.model.updateLightingmap(this.lightmapSettings.texture, this.lightmapSettings.uvParam);
53967                this.setInstancedAttribute("a_lightingMapUVParam", [ this.lightmapSettings.uvParam.x, this.lightmapSettings.uvParam.y, this.lightmapSettings.uvParam.z, this.lightmapSettings.uvParam.w ]);
53968              }
53969              _onUpdateLocalShadowBias() {
53970                null !== this.model && this.model.updateLocalShadowBias();
53971                this.setInstancedAttribute("a_localShadowBias", [ this._shadowBias, this._shadowNormalBias ]);
53972              }
53973              _onMaterialModified(t, e) {
53974                this._model && this._model.inited && this._onRebuildPSO(t, e || this._getBuiltinMaterial());
53975              }
53976              _onRebuildPSO(t, e) {
53977                if (this._model && this._model.inited) {
53978                  this._model.isDynamicBatching = this._isBatchingEnabled();
53979                  this._model.setSubModelMaterial(t, e);
53980                  this._onUpdateLightingmap();
53981                  this._onUpdateLocalShadowBias();
53982                }
53983              }
53984              _onMeshChanged(t) {}
53985              _clearMaterials() {
53986                if (!this._model) return;
53987                const t = this._model.subModels;
53988                for (let e = 0; e < t.length; ++e) this._onMaterialModified(e, null);
53989              }
53990              _getBuiltinMaterial() {
53991                return xR.get("missing-material");
53992              }
53993              _onVisibilityChange(t) {
53994                this._model && (this._model.visFlags = t);
53995              }
53996              _updateShadowBias() {
53997                this._model && (this._model.shadowBias = this._shadowBias);
53998              }
53999              _updateShadowNormalBias() {
54000                this._model && (this._model.shadowNormalBias = this._shadowNormalBias);
54001              }
54002              _updateCastShadow() {
54003                if (this._model) if (this._shadowCastingMode === fH.OFF) this._model.castShadow = !1; else {
54004                  ne(this._shadowCastingMode === fH.ON, `ShadowCastingMode ${this._shadowCastingMode} is not supported.`);
54005                  this._model.castShadow = !0;
54006                }
54007              }
54008              _updateReceiveShadow() {
54009                this._model && (this._shadowReceivingMode === gH.OFF ? this._model.receiveShadow = !1 : this._model.receiveShadow = !0);
54010              }
54011              _isBatchingEnabled() {
54012                for (let t = 0; t < this._materials.length; ++t) {
54013                  const e = this._materials[t];
54014                  if (e) for (let t = 0; t < e.passes.length; ++t) {
54015                    if (e.passes[t].batchingScheme) return !0;
54016                  }
54017                }
54018                return !1;
54019              }
54020              _watchMorphInMesh() {
54021                if (this._morphInstance) {
54022                  this._morphInstance.destroy();
54023                  this._morphInstance = null;
54024                }
54025                if (!this._enableMorph) return;
54026                if (!this._mesh || !this._mesh.struct.morph || !this._mesh.morphRendering) return;
54027                this._morphInstance = this._mesh.morphRendering.createInstance();
54028                const t = this._mesh.struct.primitives.length;
54029                for (let e = 0; e < t; ++e) this._uploadSubMeshShapesWeights(e);
54030                this._model && this._model instanceof Iz && this._model.setMorphRendering(this._morphInstance);
54031              }
54032              _initSubMeshShapesWeights() {
54033                const {_mesh: t} = this;
54034                this._subMeshShapesWeights.length = 0;
54035                if (!t) return;
54036                const e = t.struct.morph;
54037                if (!e) return;
54038                const i = e.weights;
54039                this._subMeshShapesWeights = e.subMeshMorphs.map((t => {
54040                  if (t) {
54041                    if (t.weights) return t.weights.slice(0);
54042                    if (i) {
54043                      ne(i.length === t.targets.length);
54044                      return i.slice(0);
54045                    }
54046                    return new Array(t.targets.length).fill(0);
54047                  }
54048                  return [];
54049                }));
54050              }
54051              _validateShapeWeights() {
54052                const {_mesh: t, _subMeshShapesWeights: e} = this;
54053                if (!t || !t.struct.morph) return 0 === e.length;
54054                const {morph: i} = t.struct;
54055                return i.subMeshMorphs.length === e.length && e.every((({length: t}, e) => {
54056                  var s, n;
54057                  return (null !== (s = null === (n = i.subMeshMorphs[e]) || void 0 === n ? void 0 : n.targets.length) && void 0 !== s ? s : 0) === t;
54058                }));
54059              }
54060              _uploadSubMeshShapesWeights(t) {
54061                var e;
54062                null === (e = this._morphInstance) || void 0 === e || e.setWeights(t, this._subMeshShapesWeights[t]);
54063              }
54064            }, pH.ShadowCastingMode = fH, pH.ShadowReceivingMode = gH, mH), aH = Bl(oH.prototype, "lightmapSettings", [ Yl, nh, gh ], {
54065              configurable: !0,
54066              enumerable: !0,
54067              writable: !0,
54068              initializer: function() {
54069                return new yH;
54070              }
54071            }), lH = Bl(oH.prototype, "_mesh", [ Yl ], {
54072              configurable: !0,
54073              enumerable: !0,
54074              writable: !0,
54075              initializer: function() {
54076                return null;
54077              }
54078            }), hH = Bl(oH.prototype, "_shadowCastingMode", [ Yl ], {
54079              configurable: !0,
54080              enumerable: !0,
54081              writable: !0,
54082              initializer: function() {
54083                return fH.OFF;
54084              }
54085            }), cH = Bl(oH.prototype, "_shadowReceivingMode", [ Yl ], {
54086              configurable: !0,
54087              enumerable: !0,
54088              writable: !0,
54089              initializer: function() {
54090                return gH.ON;
54091              }
54092            }), uH = Bl(oH.prototype, "_shadowBias", [ Yl ], {
54093              configurable: !0,
54094              enumerable: !0,
54095              writable: !0,
54096              initializer: function() {
54097                return 0;
54098              }
54099            }), _H = Bl(oH.prototype, "_shadowNormalBias", [ Yl ], {
54100              configurable: !0,
54101              enumerable: !0,
54102              writable: !0,
54103              initializer: function() {
54104                return 0;
54105              }
54106            }), Bl(oH.prototype, "shadowBias", [ jz, Xz, Wz, gh ], Object.getOwnPropertyDescriptor(oH.prototype, "shadowBias"), oH.prototype),
54107            Bl(oH.prototype, "shadowNormalBias", [ Yz, qz, Kz, gh ], Object.getOwnPropertyDescriptor(oH.prototype, "shadowNormalBias"), oH.prototype),
54108            Bl(oH.prototype, "shadowCastingMode", [ Jz, Zz, Qz, gh ], Object.getOwnPropertyDescriptor(oH.prototype, "shadowCastingMode"), oH.prototype),
54109            Bl(oH.prototype, "receiveShadow", [ $z, tH, eH, gh ], Object.getOwnPropertyDescriptor(oH.prototype, "receiveShadow"), oH.prototype),
54110            Bl(oH.prototype, "mesh", [ iH, sH ], Object.getOwnPropertyDescriptor(oH.prototype, "mesh"), oH.prototype),
54111            Bl(oH.prototype, "enableMorph", [ nH, gh ], Object.getOwnPropertyDescriptor(oH.prototype, "enableMorph"), oH.prototype),
54112            dH = Bl(oH.prototype, "_enableMorph", [ Yl ], {
54113              configurable: !0,
54114              enumerable: !0,
54115              writable: !0,
54116              initializer: function() {
54117                return !0;
54118              }
54119            }), oH)) || rH) || rH) || rH) || rH) || rH));
54120            function SH(t, e) {
54121              const i = t.sharedMaterials.length;
54122              if (i !== e.sharedMaterials.length) return !1;
54123              for (let s = 0; s < i; s++) if (t.getRenderMaterial(s) !== e.getRenderMaterial(s)) return !1;
54124              return !0;
54125            }
54126            t("BatchingUtility", class {
54127              static batchStaticModel(t, e) {
54128                const i = t.getComponentsInChildren(bH);
54129                if (i.length < 2) {
54130                  console.error("the number of static models to batch is less than 2,it needn't batch.");
54131                  return !1;
54132                }
54133                for (let t = 1; t < i.length; t++) {
54134                  if (!i[0].mesh.validateMergingMesh(i[t].mesh)) {
54135                    console.error(`the meshes of ${i[0].node.name} and ${i[t].node.name} can't be merged`);
54136                    return !1;
54137                  }
54138                  if (!SH(i[0], i[t])) {
54139                    console.error(`the materials of ${i[0].node.name} and ${i[t].node.name} can't be merged`);
54140                    return !1;
54141                  }
54142                }
54143                const s = new Ez;
54144                const n = new qi;
54145                const r = new qi;
54146                t.getWorldMatrix(r);
54147                qi.invert(r, r);
54148                for (let t = 0; t < i.length; t++) {
54149                  const e = i[t];
54150                  e.node.getWorldMatrix(n);
54151                  qi.multiply(n, r, n);
54152                  s.merge(i[t].mesh, n);
54153                  e.enabled = !1;
54154                }
54155                const o = e.addComponent(bH);
54156                o.mesh = s;
54157                o.sharedMaterials = i[0].sharedMaterials;
54158                return !0;
54159              }
54160              static unbatchStaticModel(t, e) {
54161                const i = t.getComponentsInChildren(bH);
54162                for (let t = 0; t < i.length; t++) {
54163                  i[t].enabled = !0;
54164                }
54165                const s = e.getComponent(bH);
54166                if (s) {
54167                  s.mesh && s.mesh.destroyRenderingMesh();
54168                  s.destroy();
54169                }
54170                return !0;
54171              }
54172            });
54173            W(Ez.prototype, "Mesh.prototype", [ {
54174              name: "renderingMesh",
54175              newName: "renderingSubMeshes"
54176            } ]);
54177            Y(Ez.prototype, "Mesh.prototype", [ {
54178              name: "hasFlatBuffers"
54179            }, {
54180              name: "destroyFlatBuffers"
54181            } ]);
54182            const AH = t("Skeleton", jsb.Skeleton);
54183            m.Skeleton = AH;
54184            const TH = AH.prototype;
54185            Object.defineProperty(TH, "bindposes", {
54186              enumerable: !0,
54187              configurable: !0,
54188              get() {
54189                return this._bindposes;
54190              },
54191              set(t) {
54192                this._bindposes = t;
54193                this._setBindposes(t);
54194              }
54195            });
54196            TH._ctor = function() {
54197              jsb.Asset.prototype._ctor.apply(this, arguments);
54198              this._bindposes = [];
54199            };
54200            TH.destroy = function() {
54201              var t, e;
54202              null === (t = null === (e = m.director.root) || void 0 === e ? void 0 : e.dataPoolManager) || void 0 === t || t.releaseSkeleton(this);
54203              return gc.prototype.destroy.call(this);
54204            };
54205            const vH = TH.onLoaded;
54206            TH.onLoaded = function() {
54207              this._setBindposes(this._bindposes);
54208              vH.call(this);
54209            };
54210            const EH = AH.prototype;
54211            Th([ Fe ])(EH, "_joints");
54212            Th([ qi ])(EH, "_bindposes");
54213            Yl(EH, "_hash");
54214            Ul("cc.Skeleton")(AH);
54215            Y(bH.prototype, "MeshRenderer.prototype", [ {
54216              name: "enableDynamicBatching"
54217            }, {
54218              name: "recieveShadows"
54219            } ]);
54220            m.ModelComponent = bH;
54221            ee.setClassAlias(bH, "cc.ModelComponent");
54222            var CH, xH, wH, RH, IH, MH, BH, DH, PH, OH, NH, LH, FH, VH, kH, UH, GH, zH, HH, jH, XH;
54223            const WH = new Pi;
54224            const YH = oe({
54225              LUMINOUS_FLUX: 0,
54226              LUMINANCE: 1
54227            });
54228            let qH = Ul("cc.StaticLightSettings")(CH = (xH = class {
54229              constructor() {
54230                Ml(this, "_baked", wH, this);
54231                Ml(this, "_editorOnly", RH, this);
54232                Ml(this, "_bakeable", IH, this);
54233                Ml(this, "_castShadow", MH, this);
54234              }
54235              get editorOnly() {
54236                return this._editorOnly;
54237              }
54238              set editorOnly(t) {
54239                this._editorOnly = t;
54240              }
54241              get baked() {
54242                return this._baked;
54243              }
54244              set baked(t) {
54245                this._baked = t;
54246              }
54247              get bakeable() {
54248                return this._bakeable;
54249              }
54250              set bakeable(t) {
54251                this._bakeable = t;
54252              }
54253              get castShadow() {
54254                return this._castShadow;
54255              }
54256              set castShadow(t) {
54257                this._castShadow = t;
54258              }
54259            }, wH = Bl(xH.prototype, "_baked", [ Yl ], {
54260              configurable: !0,
54261              enumerable: !0,
54262              writable: !0,
54263              initializer: function() {
54264                return !1;
54265              }
54266            }), RH = Bl(xH.prototype, "_editorOnly", [ Yl ], {
54267              configurable: !0,
54268              enumerable: !0,
54269              writable: !0,
54270              initializer: function() {
54271                return !1;
54272              }
54273            }), IH = Bl(xH.prototype, "_bakeable", [ Yl ], {
54274              configurable: !0,
54275              enumerable: !0,
54276              writable: !0,
54277              initializer: function() {
54278                return !1;
54279              }
54280            }), MH = Bl(xH.prototype, "_castShadow", [ Yl ], {
54281              configurable: !0,
54282              enumerable: !0,
54283              writable: !0,
54284              initializer: function() {
54285                return !1;
54286              }
54287            }), Bl(xH.prototype, "editorOnly", [ nh ], Object.getOwnPropertyDescriptor(xH.prototype, "editorOnly"), xH.prototype),
54288            Bl(xH.prototype, "bakeable", [ nh ], Object.getOwnPropertyDescriptor(xH.prototype, "bakeable"), xH.prototype),
54289            Bl(xH.prototype, "castShadow", [ nh ], Object.getOwnPropertyDescriptor(xH.prototype, "castShadow"), xH.prototype),
54290            xH)) || CH;
54291            let KH = function(e) {
54292              return t({
54293                Light: e,
54294                LightComponent: e
54295              }), e;
54296            }((BH = Ul("cc.Light"), DH = lh(), PH = lh(), OH = hh(), NH = lh(), LH = Th(qH),
54297            FH = ph(), BH(VH = (kH = (XH = jH = class extends Qc {
54298              get color() {
54299                return this._color;
54300              }
54301              set color(t) {
54302                this._color = t;
54303                if (this._light) {
54304                  WH.x = t.r / 255;
54305                  WH.y = t.g / 255;
54306                  WH.z = t.b / 255;
54307                  this._light.color = WH;
54308                }
54309              }
54310              get useColorTemperature() {
54311                return this._useColorTemperature;
54312              }
54313              set useColorTemperature(t) {
54314                this._useColorTemperature = t;
54315                this._light && (this._light.useColorTemperature = t);
54316              }
54317              get colorTemperature() {
54318                return this._colorTemperature;
54319              }
54320              set colorTemperature(t) {
54321                this._colorTemperature = t;
54322                this._light && (this._light.colorTemperature = t);
54323              }
54324              get staticSettings() {
54325                return this._staticSettings;
54326              }
54327              set staticSettings(t) {
54328                this._staticSettings = t;
54329              }
54330              get type() {
54331                return this._type;
54332              }
54333              get baked() {
54334                return this.staticSettings.baked;
54335              }
54336              set baked(t) {
54337                this.staticSettings.baked = t;
54338                null !== this._light && (this._light.baked = t);
54339              }
54340              constructor() {
54341                super();
54342                Ml(this, "_color", UH, this);
54343                Ml(this, "_useColorTemperature", GH, this);
54344                Ml(this, "_colorTemperature", zH, this);
54345                Ml(this, "_staticSettings", HH, this);
54346                this._type = BA.UNKNOWN;
54347                this._lightType = void 0;
54348                this._light = null;
54349                this._lightType = PA;
54350              }
54351              onLoad() {
54352                this._createLight();
54353              }
54354              onEnable() {
54355                this._attachToScene();
54356              }
54357              onDisable() {
54358                this._detachFromScene();
54359              }
54360              onDestroy() {
54361                this._destroyLight();
54362              }
54363              _createLight() {
54364                this._light || (this._light = m.director.root.createLight(this._lightType));
54365                this.color = this._color;
54366                this.useColorTemperature = this._useColorTemperature;
54367                this.colorTemperature = this._colorTemperature;
54368                this._light.node = this.node;
54369                this._light.baked = this.baked;
54370              }
54371              _destroyLight() {
54372                if (this._light) {
54373                  m.director.root.recycleLight(this._light);
54374                  this._light = null;
54375                }
54376              }
54377              _attachToScene() {
54378                this._detachFromScene();
54379                if (this._light && !this._light.scene && this.node.scene) {
54380                  const t = this._getRenderScene();
54381                  switch (this._type) {
54382                   case BA.DIRECTIONAL:
54383                    t.addDirectionalLight(this._light);
54384                    t.setMainLight(this._light);
54385                    break;
54386
54387                   case BA.SPHERE:
54388                    t.addSphereLight(this._light);
54389                    break;
54390
54391                   case BA.SPOT:
54392                    t.addSpotLight(this._light);
54393                  }
54394                }
54395              }
54396              _detachFromScene() {
54397                if (this._light && this._light.scene) {
54398                  const t = this._light.scene;
54399                  switch (this._type) {
54400                   case BA.DIRECTIONAL:
54401                    t.removeDirectionalLight(this._light);
54402                    t.unsetMainLight(this._light);
54403                    break;
54404
54405                   case BA.SPHERE:
54406                    t.removeSphereLight(this._light);
54407                    break;
54408
54409                   case BA.SPOT:
54410                    t.removeSpotLight(this._light);
54411                  }
54412                }
54413              }
54414            }, jH.Type = BA, jH.PhotometricTerm = YH, XH), UH = Bl(kH.prototype, "_color", [ Yl ], {
54415              configurable: !0,
54416              enumerable: !0,
54417              writable: !0,
54418              initializer: function() {
54419                return Bi.WHITE.clone();
54420              }
54421            }), GH = Bl(kH.prototype, "_useColorTemperature", [ Yl ], {
54422              configurable: !0,
54423              enumerable: !0,
54424              writable: !0,
54425              initializer: function() {
54426                return !1;
54427              }
54428            }), zH = Bl(kH.prototype, "_colorTemperature", [ Yl ], {
54429              configurable: !0,
54430              enumerable: !0,
54431              writable: !0,
54432              initializer: function() {
54433                return 6550;
54434              }
54435            }), HH = Bl(kH.prototype, "_staticSettings", [ Yl ], {
54436              configurable: !0,
54437              enumerable: !0,
54438              writable: !0,
54439              initializer: function() {
54440                return new qH;
54441              }
54442            }), Bl(kH.prototype, "color", [ DH ], Object.getOwnPropertyDescriptor(kH.prototype, "color"), kH.prototype),
54443            Bl(kH.prototype, "useColorTemperature", [ PH ], Object.getOwnPropertyDescriptor(kH.prototype, "useColorTemperature"), kH.prototype),
54444            Bl(kH.prototype, "colorTemperature", [ dh, OH, NH ], Object.getOwnPropertyDescriptor(kH.prototype, "colorTemperature"), kH.prototype),
54445            Bl(kH.prototype, "staticSettings", [ LH, FH ], Object.getOwnPropertyDescriptor(kH.prototype, "staticSettings"), kH.prototype),
54446            kH)) || VH));
54447            var JH, ZH, QH, $H, tj, ej, ij, sj, nj, rj, oj, aj, lj, hj, cj, uj, _j, dj, pj, mj, fj, gj, yj, bj, Sj, Aj, Tj, vj, Ej, Cj, xj, wj, Rj, Ij, Mj, Bj, Dj, Pj, Oj, Nj, Lj, Fj, Vj, kj, Uj, Gj, zj, Hj, jj, Xj, Wj, Yj, qj, Kj, Jj, Zj, Qj, $j, tX, eX, iX, sX, nX, rX, oX, aX, lX, hX, cX, uX, _X, dX, pX, mX, fX, gX, yX, bX;
54448            let SX = function(e) {
54449              return t({
54450                DirectionalLight: e,
54451                DirectionalLightComponent: e
54452              }), e;
54453            }((JH = Ul("cc.DirectionalLight"), ZH = sh(), QH = $l(), $H = ql("_illuminance"),
54454            tj = lh(), ej = rh(), ij = jl({
54455              group: {
54456                name: "DynamicShadowSettings",
54457                displayOrder: 1
54458              }
54459            }), sj = Th(Le), nj = rh(), rj = jl({
54460              group: {
54461                name: "DynamicShadowSettings",
54462                displayOrder: 5
54463              }
54464            }), oj = Th(zA), aj = rh(), lj = jl({
54465              group: {
54466                name: "DynamicShadowSettings",
54467                displayOrder: 6
54468              }
54469            }), hj = Th(Ne), cj = rh(), uj = jl({
54470              group: {
54471                name: "DynamicShadowSettings",
54472                displayOrder: 7
54473              }
54474            }), _j = Th(Ne), dj = rh(), pj = jl({
54475              group: {
54476                name: "DynamicShadowSettings",
54477                displayOrder: 8
54478              }
54479            }), mj = hh(), fj = Th(Ne), gj = rh(), yj = jl({
54480              group: {
54481                name: "DynamicShadowSettings",
54482                displayOrder: 9
54483              }
54484            }), bj = lh(), Sj = hh(), Aj = Th(Ne), Tj = rh(), vj = jl({
54485              group: {
54486                name: "DynamicShadowSettings",
54487                displayOrder: 10
54488              }
54489            }), Ej = lh(), Cj = hh(), xj = Th(Ne), wj = rh(), Rj = jl({
54490              group: {
54491                name: "DynamicShadowSettings",
54492                displayOrder: 11
54493              }
54494            }), Ij = lh(), Mj = Th(HA), Bj = rh(), Dj = jl({
54495              group: {
54496                name: "DynamicShadowSettings",
54497                displayOrder: 12
54498              }
54499            }), Pj = lh(), Oj = Th(Le), Nj = rh(), Lj = jl({
54500              group: {
54501                name: "DynamicShadowSettings",
54502                displayOrder: 13
54503              }
54504            }), Fj = lh(), Vj = hh(), kj = Th(Ne), Uj = rh(), Gj = jl({
54505              group: {
54506                name: "DynamicShadowSettings",
54507                displayOrder: 14
54508              }
54509            }), zj = lh(), Hj = Th(jA), jj = rh(), Xj = jl({
54510              group: {
54511                name: "DynamicShadowSettings",
54512                displayOrder: 15
54513              }
54514            }), Wj = Th(Le), Yj = rh(), qj = jl({
54515              group: {
54516                name: "DynamicShadowSettings",
54517                displayOrder: 16
54518              }
54519            }), Kj = Th(Ne), Jj = rh(), Zj = jl({
54520              group: {
54521                name: "DynamicShadowSettings",
54522                displayOrder: 17
54523              }
54524            }), Qj = Th(Ne), $j = rh(), tX = jl({
54525              group: {
54526                name: "DynamicShadowSettings",
54527                displayOrder: 18
54528              }
54529            }), eX = Th(Ne), JH(iX = ZH(iX = QH(iX = Ql(iX = (sX = class extends KH {
54530              get illuminance() {
54531                return m.director.root.pipeline.pipelineSceneData.isHDR ? this._illuminanceHDR : this._illuminanceLDR;
54532              }
54533              set illuminance(t) {
54534                if (m.director.root.pipeline.pipelineSceneData.isHDR) {
54535                  this._illuminanceHDR = t;
54536                  this._light && (this._light.illuminanceHDR = this._illuminanceHDR);
54537                } else {
54538                  this._illuminanceLDR = t;
54539                  this._light && (this._light.illuminanceLDR = this._illuminanceLDR);
54540                }
54541              }
54542              get shadowEnabled() {
54543                return this._shadowEnabled;
54544              }
54545              set shadowEnabled(t) {
54546                this._shadowEnabled = t;
54547                this._light && (this._light.shadowEnabled = this._shadowEnabled);
54548              }
54549              get shadowPcf() {
54550                return this._shadowPcf;
54551              }
54552              set shadowPcf(t) {
54553                this._shadowPcf = t;
54554                this._light && (this._light.shadowPcf = this._shadowPcf);
54555              }
54556              get shadowBias() {
54557                return this._shadowBias;
54558              }
54559              set shadowBias(t) {
54560                this._shadowBias = t;
54561                this._light && (this._light.shadowBias = this._shadowBias);
54562              }
54563              get shadowNormalBias() {
54564                return this._shadowNormalBias;
54565              }
54566              set shadowNormalBias(t) {
54567                this._shadowNormalBias = t;
54568                this._light && (this._light.shadowNormalBias = this._shadowNormalBias);
54569              }
54570              get shadowSaturation() {
54571                return this._shadowSaturation;
54572              }
54573              set shadowSaturation(t) {
54574                this._shadowSaturation = _i(t, 0, 1);
54575                this._light && (this._light.shadowSaturation = this._shadowSaturation);
54576              }
54577              get shadowDistance() {
54578                return this._shadowDistance;
54579              }
54580              set shadowDistance(t) {
54581                this._shadowDistance = Math.min(t, YA.MAX_FAR);
54582                this._shadowDistance / .1 < 10 && N(15003, this._shadowDistance);
54583                if (this._light) {
54584                  this._light.shadowDistance = this._shadowDistance;
54585                  this._light.csmNeedUpdate = !0;
54586                }
54587              }
54588              get shadowInvisibleOcclusionRange() {
54589                return this._shadowInvisibleOcclusionRange;
54590              }
54591              set shadowInvisibleOcclusionRange(t) {
54592                this._shadowInvisibleOcclusionRange = Math.min(t, YA.MAX_FAR);
54593                this._light && (this._light.shadowInvisibleOcclusionRange = this._shadowInvisibleOcclusionRange);
54594              }
54595              get csmLevel() {
54596                return this._csmLevel;
54597              }
54598              set csmLevel(t) {
54599                this._csmLevel = t;
54600                if (this._light) {
54601                  this._light.csmLevel = this._csmLevel;
54602                  this._light.csmNeedUpdate = !0;
54603                }
54604              }
54605              get enableCSM() {
54606                return this._csmLevel > HA.LEVEL_1;
54607              }
54608              set enableCSM(t) {
54609                this._csmLevel = t ? HA.LEVEL_4 : HA.LEVEL_1;
54610                if (this._light) {
54611                  this._light.csmLevel = this._csmLevel;
54612                  this._light.csmNeedUpdate = !0;
54613                }
54614              }
54615              get csmLayerLambda() {
54616                return this._csmLayerLambda;
54617              }
54618              set csmLayerLambda(t) {
54619                this._csmLayerLambda = t;
54620                if (this._light) {
54621                  this._light.csmLayerLambda = this._csmLayerLambda;
54622                  this._light.csmNeedUpdate = !0;
54623                }
54624              }
54625              get csmOptimizationMode() {
54626                return this._csmOptimizationMode;
54627              }
54628              set csmOptimizationMode(t) {
54629                this._csmOptimizationMode = t;
54630                this._light && (this._light.csmOptimizationMode = this._csmOptimizationMode);
54631              }
54632              get shadowFixedArea() {
54633                return this._shadowFixedArea;
54634              }
54635              set shadowFixedArea(t) {
54636                this._shadowFixedArea = t;
54637                this._light && (this._light.shadowFixedArea = this._shadowFixedArea);
54638              }
54639              get shadowNear() {
54640                return this._shadowNear;
54641              }
54642              set shadowNear(t) {
54643                this._shadowNear = t;
54644                this._light && (this._light.shadowNear = this._shadowNear);
54645              }
54646              get shadowFar() {
54647                return this._shadowFar;
54648              }
54649              set shadowFar(t) {
54650                this._shadowFar = Math.min(t, YA.MAX_FAR);
54651                this._light && (this._light.shadowFar = this._shadowFar);
54652              }
54653              get shadowOrthoSize() {
54654                return this._shadowOrthoSize;
54655              }
54656              set shadowOrthoSize(t) {
54657                this._shadowOrthoSize = t;
54658                this._light && (this._light.shadowOrthoSize = this._shadowOrthoSize);
54659              }
54660              constructor() {
54661                super();
54662                Ml(this, "_illuminanceHDR", nX, this);
54663                Ml(this, "_illuminanceLDR", rX, this);
54664                Ml(this, "_shadowEnabled", oX, this);
54665                Ml(this, "_shadowPcf", aX, this);
54666                Ml(this, "_shadowBias", lX, this);
54667                Ml(this, "_shadowNormalBias", hX, this);
54668                Ml(this, "_shadowSaturation", cX, this);
54669                Ml(this, "_shadowDistance", uX, this);
54670                Ml(this, "_shadowInvisibleOcclusionRange", _X, this);
54671                Ml(this, "_csmLevel", dX, this);
54672                Ml(this, "_csmLayerLambda", pX, this);
54673                Ml(this, "_csmOptimizationMode", mX, this);
54674                Ml(this, "_shadowFixedArea", fX, this);
54675                Ml(this, "_shadowNear", gX, this);
54676                Ml(this, "_shadowFar", yX, this);
54677                Ml(this, "_shadowOrthoSize", bX, this);
54678                this._type = BA.DIRECTIONAL;
54679                this._light = null;
54680                this._lightType = OA;
54681              }
54682              _createLight() {
54683                super._createLight();
54684                if (this._light) {
54685                  this._light.illuminanceHDR = this._illuminanceHDR;
54686                  this._light.illuminanceLDR = this._illuminanceLDR;
54687                  this._light.shadowEnabled = this._shadowEnabled;
54688                  this._light.shadowPcf = this._shadowPcf;
54689                  this._light.shadowBias = this._shadowBias;
54690                  this._light.shadowNormalBias = this._shadowNormalBias;
54691                  this._light.shadowSaturation = this._shadowSaturation;
54692                  this._light.shadowDistance = this._shadowDistance;
54693                  this._light.shadowInvisibleOcclusionRange = this._shadowInvisibleOcclusionRange;
54694                  this._light.shadowFixedArea = this._shadowFixedArea;
54695                  this._light.shadowNear = this._shadowNear;
54696                  this._light.shadowFar = this._shadowFar;
54697                  this._light.shadowOrthoSize = this._shadowOrthoSize;
54698                  this._light.csmLevel = this._csmLevel;
54699                  this._light.csmLayerLambda = this._csmLayerLambda;
54700                  this._light.csmOptimizationMode = this._csmOptimizationMode;
54701                }
54702              }
54703            }, nX = Bl(sX.prototype, "_illuminanceHDR", [ jl, $H ], {
54704              configurable: !0,
54705              enumerable: !0,
54706              writable: !0,
54707              initializer: function() {
54708                return 65e3;
54709              }
54710            }), rX = Bl(sX.prototype, "_illuminanceLDR", [ Yl ], {
54711              configurable: !0,
54712              enumerable: !0,
54713              writable: !0,
54714              initializer: function() {
54715                return 65e3 * By.standardExposureValue;
54716              }
54717            }), oX = Bl(sX.prototype, "_shadowEnabled", [ Yl ], {
54718              configurable: !0,
54719              enumerable: !0,
54720              writable: !0,
54721              initializer: function() {
54722                return !1;
54723              }
54724            }), aX = Bl(sX.prototype, "_shadowPcf", [ Yl ], {
54725              configurable: !0,
54726              enumerable: !0,
54727              writable: !0,
54728              initializer: function() {
54729                return zA.HARD;
54730              }
54731            }), lX = Bl(sX.prototype, "_shadowBias", [ Yl ], {
54732              configurable: !0,
54733              enumerable: !0,
54734              writable: !0,
54735              initializer: function() {
54736                return 1e-5;
54737              }
54738            }), hX = Bl(sX.prototype, "_shadowNormalBias", [ Yl ], {
54739              configurable: !0,
54740              enumerable: !0,
54741              writable: !0,
54742              initializer: function() {
54743                return 0;
54744              }
54745            }), cX = Bl(sX.prototype, "_shadowSaturation", [ Yl ], {
54746              configurable: !0,
54747              enumerable: !0,
54748              writable: !0,
54749              initializer: function() {
54750                return 1;
54751              }
54752            }), uX = Bl(sX.prototype, "_shadowDistance", [ Yl ], {
54753              configurable: !0,
54754              enumerable: !0,
54755              writable: !0,
54756              initializer: function() {
54757                return 50;
54758              }
54759            }), _X = Bl(sX.prototype, "_shadowInvisibleOcclusionRange", [ Yl ], {
54760              configurable: !0,
54761              enumerable: !0,
54762              writable: !0,
54763              initializer: function() {
54764                return 200;
54765              }
54766            }), dX = Bl(sX.prototype, "_csmLevel", [ Yl ], {
54767              configurable: !0,
54768              enumerable: !0,
54769              writable: !0,
54770              initializer: function() {
54771                return HA.LEVEL_4;
54772              }
54773            }), pX = Bl(sX.prototype, "_csmLayerLambda", [ Yl ], {
54774              configurable: !0,
54775              enumerable: !0,
54776              writable: !0,
54777              initializer: function() {
54778                return .75;
54779              }
54780            }), mX = Bl(sX.prototype, "_csmOptimizationMode", [ Yl ], {
54781              configurable: !0,
54782              enumerable: !0,
54783              writable: !0,
54784              initializer: function() {
54785                return jA.RemoveDuplicates;
54786              }
54787            }), fX = Bl(sX.prototype, "_shadowFixedArea", [ Yl ], {
54788              configurable: !0,
54789              enumerable: !0,
54790              writable: !0,
54791              initializer: function() {
54792                return !1;
54793              }
54794            }), gX = Bl(sX.prototype, "_shadowNear", [ Yl ], {
54795              configurable: !0,
54796              enumerable: !0,
54797              writable: !0,
54798              initializer: function() {
54799                return .1;
54800              }
54801            }), yX = Bl(sX.prototype, "_shadowFar", [ Yl ], {
54802              configurable: !0,
54803              enumerable: !0,
54804              writable: !0,
54805              initializer: function() {
54806                return 10;
54807              }
54808            }), bX = Bl(sX.prototype, "_shadowOrthoSize", [ Yl ], {
54809              configurable: !0,
54810              enumerable: !0,
54811              writable: !0,
54812              initializer: function() {
54813                return 5;
54814              }
54815            }), Bl(sX.prototype, "illuminance", [ tj ], Object.getOwnPropertyDescriptor(sX.prototype, "illuminance"), sX.prototype),
54816            Bl(sX.prototype, "shadowEnabled", [ ej, ij, nh, sj ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowEnabled"), sX.prototype),
54817            Bl(sX.prototype, "shadowPcf", [ nj, rj, nh, oj ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowPcf"), sX.prototype),
54818            Bl(sX.prototype, "shadowBias", [ aj, lj, nh, hj ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowBias"), sX.prototype),
54819            Bl(sX.prototype, "shadowNormalBias", [ cj, uj, nh, _j ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowNormalBias"), sX.prototype),
54820            Bl(sX.prototype, "shadowSaturation", [ dj, pj, nh, mj, dh, fj ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowSaturation"), sX.prototype),
54821            Bl(sX.prototype, "shadowDistance", [ gj, yj, nh, bj, Sj, dh, Aj ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowDistance"), sX.prototype),
54822            Bl(sX.prototype, "shadowInvisibleOcclusionRange", [ Tj, vj, nh, Ej, Cj, dh, xj ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowInvisibleOcclusionRange"), sX.prototype),
54823            Bl(sX.prototype, "csmLevel", [ wj, Rj, nh, Ij, dh, Mj ], Object.getOwnPropertyDescriptor(sX.prototype, "csmLevel"), sX.prototype),
54824            Bl(sX.prototype, "enableCSM", [ Bj, Dj, nh, Pj, dh, Oj ], Object.getOwnPropertyDescriptor(sX.prototype, "enableCSM"), sX.prototype),
54825            Bl(sX.prototype, "csmLayerLambda", [ Nj, Lj, nh, Fj, Vj, dh, kj ], Object.getOwnPropertyDescriptor(sX.prototype, "csmLayerLambda"), sX.prototype),
54826            Bl(sX.prototype, "csmOptimizationMode", [ Uj, Gj, nh, zj, dh, Hj ], Object.getOwnPropertyDescriptor(sX.prototype, "csmOptimizationMode"), sX.prototype),
54827            Bl(sX.prototype, "shadowFixedArea", [ jj, Xj, nh, Wj ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowFixedArea"), sX.prototype),
54828            Bl(sX.prototype, "shadowNear", [ Yj, qj, nh, Kj ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowNear"), sX.prototype),
54829            Bl(sX.prototype, "shadowFar", [ Jj, Zj, nh, Qj ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowFar"), sX.prototype),
54830            Bl(sX.prototype, "shadowOrthoSize", [ $j, tX, eX ], Object.getOwnPropertyDescriptor(sX.prototype, "shadowOrthoSize"), sX.prototype),
54831            sX)) || iX) || iX) || iX) || iX));
54832            var AX, TX, vX, EX, CX, xX, wX, RX, IX, MX, BX, DX, PX, OX, NX, LX, FX, VX, kX, UX;
54833            let GX = function(e) {
54834              return t({
54835                SphereLight: e,
54836                SphereLightComponent: e
54837              }), e;
54838            }((AX = Ul("cc.SphereLight"), TX = sh(), vX = $l(), EX = ql("_luminance"), CX = ph(),
54839            xX = lh(), wX = ph(), RX = lh(), IX = Th(YH), MX = ph(), BX = lh(), DX = lh(), PX = lh(),
54840            AX(OX = TX(OX = vX(OX = Ql(OX = (NX = class extends KH {
54841              get luminousFlux() {
54842                return m.director.root.pipeline.pipelineSceneData.isHDR ? this._luminanceHDR * DA(this._size) : this._luminanceLDR;
54843              }
54844              set luminousFlux(t) {
54845                let e = 0;
54846                if (m.director.root.pipeline.pipelineSceneData.isHDR) {
54847                  this._luminanceHDR = t / DA(this._size);
54848                  e = this._luminanceHDR;
54849                } else {
54850                  this._luminanceLDR = t;
54851                  e = this._luminanceLDR;
54852                }
54853                this._light && (this._light.luminance = e);
54854              }
54855              get luminance() {
54856                return m.director.root.pipeline.pipelineSceneData.isHDR ? this._luminanceHDR : this._luminanceLDR;
54857              }
54858              set luminance(t) {
54859                if (m.director.root.pipeline.pipelineSceneData.isHDR) {
54860                  this._luminanceHDR = t;
54861                  this._light && (this._light.luminanceHDR = this._luminanceHDR);
54862                } else {
54863                  this._luminanceLDR = t;
54864                  this._light && (this._light.luminanceLDR = this._luminanceLDR);
54865                }
54866              }
54867              get term() {
54868                return this._term;
54869              }
54870              set term(t) {
54871                this._term = t;
54872              }
54873              get size() {
54874                return this._size;
54875              }
54876              set size(t) {
54877                this._size = t;
54878                this._light && (this._light.size = t);
54879              }
54880              get range() {
54881                return this._range;
54882              }
54883              set range(t) {
54884                this._range = t;
54885                this._light && (this._light.range = t);
54886              }
54887              constructor() {
54888                super();
54889                Ml(this, "_size", LX, this);
54890                Ml(this, "_luminanceHDR", FX, this);
54891                Ml(this, "_luminanceLDR", VX, this);
54892                Ml(this, "_term", kX, this);
54893                Ml(this, "_range", UX, this);
54894                this._type = BA.SPHERE;
54895                this._light = null;
54896                this._lightType = LA;
54897              }
54898              _createLight() {
54899                super._createLight();
54900                this.size = this._size;
54901                this.range = this._range;
54902                if (this._light) {
54903                  this._light.luminanceHDR = this._luminanceHDR;
54904                  this._light.luminanceLDR = this._luminanceLDR;
54905                }
54906              }
54907            }, LX = Bl(NX.prototype, "_size", [ Yl ], {
54908              configurable: !0,
54909              enumerable: !0,
54910              writable: !0,
54911              initializer: function() {
54912                return .15;
54913              }
54914            }), FX = Bl(NX.prototype, "_luminanceHDR", [ Yl, EX ], {
54915              configurable: !0,
54916              enumerable: !0,
54917              writable: !0,
54918              initializer: function() {
54919                return 1700 / DA(.15);
54920              }
54921            }), VX = Bl(NX.prototype, "_luminanceLDR", [ Yl ], {
54922              configurable: !0,
54923              enumerable: !0,
54924              writable: !0,
54925              initializer: function() {
54926                return 1700 / DA(.15) * By.standardExposureValue * By.standardLightMeterScale;
54927              }
54928            }), kX = Bl(NX.prototype, "_term", [ Yl ], {
54929              configurable: !0,
54930              enumerable: !0,
54931              writable: !0,
54932              initializer: function() {
54933                return YH.LUMINOUS_FLUX;
54934              }
54935            }), UX = Bl(NX.prototype, "_range", [ Yl ], {
54936              configurable: !0,
54937              enumerable: !0,
54938              writable: !0,
54939              initializer: function() {
54940                return 1;
54941              }
54942            }), Bl(NX.prototype, "luminousFlux", [ CX, xX ], Object.getOwnPropertyDescriptor(NX.prototype, "luminousFlux"), NX.prototype),
54943            Bl(NX.prototype, "luminance", [ wX, RX ], Object.getOwnPropertyDescriptor(NX.prototype, "luminance"), NX.prototype),
54944            Bl(NX.prototype, "term", [ IX, MX, BX ], Object.getOwnPropertyDescriptor(NX.prototype, "term"), NX.prototype),
54945            Bl(NX.prototype, "size", [ DX ], Object.getOwnPropertyDescriptor(NX.prototype, "size"), NX.prototype),
54946            Bl(NX.prototype, "range", [ PX ], Object.getOwnPropertyDescriptor(NX.prototype, "range"), NX.prototype),
54947            NX)) || OX) || OX) || OX) || OX));
54948            var zX, HX, jX, XX, WX, YX, qX, KX, JX, ZX, QX, $X, tW, eW, iW, sW, nW, rW, oW, aW, lW, hW, cW, uW, _W, dW, pW, mW, fW, gW, yW, bW, SW, AW, TW, vW, EW, CW, xW;
54949            let wW = function(e) {
54950              return t({
54951                SpotLight: e,
54952                SpotLightComponent: e
54953              }), e;
54954            }((zX = Ul("cc.SpotLight"), HX = sh(), jX = $l(), XX = ql("_luminance"), WX = lh(),
54955            YX = ph(), qX = lh(), KX = ph(), JX = Th(YH), ZX = ph(), QX = lh(), $X = lh(), tW = lh(),
54956            eW = hh(), iW = lh(), sW = rh(), nW = jl({
54957              group: {
54958                name: "DynamicShadowSettings",
54959                displayOrder: 1
54960              }
54961            }), rW = Th(Le), oW = rh(), aW = jl({
54962              group: {
54963                name: "DynamicShadowSettings",
54964                displayOrder: 2
54965              }
54966            }), lW = Th(zA), hW = rh(), cW = jl({
54967              group: {
54968                name: "DynamicShadowSettings",
54969                displayOrder: 3
54970              }
54971            }), uW = Th(Ne), _W = rh(), dW = jl({
54972              group: {
54973                name: "DynamicShadowSettings",
54974                displayOrder: 4
54975              }
54976            }), pW = Th(Ne), zX(mW = HX(mW = jX(mW = Ql(mW = (fW = class extends KH {
54977              get luminousFlux() {
54978                return m.director.root.pipeline.pipelineSceneData.isHDR ? this._luminanceHDR * DA(this._size) : this._luminanceLDR;
54979              }
54980              set luminousFlux(t) {
54981                let e = 0;
54982                if (m.director.root.pipeline.pipelineSceneData.isHDR) {
54983                  this._luminanceHDR = t / DA(this._size);
54984                  e = this._luminanceHDR;
54985                } else {
54986                  this._luminanceLDR = t;
54987                  e = this._luminanceLDR;
54988                }
54989                this._light && (this._light.luminance = e);
54990              }
54991              get luminance() {
54992                return m.director.root.pipeline.pipelineSceneData.isHDR ? this._luminanceHDR : this._luminanceLDR;
54993              }
54994              set luminance(t) {
54995                if (m.director.root.pipeline.pipelineSceneData.isHDR) {
54996                  this._luminanceHDR = t;
54997                  this._light && (this._light.luminanceHDR = this._luminanceHDR);
54998                } else {
54999                  this._luminanceLDR = t;
55000                  this._light && (this._light.luminanceLDR = this._luminanceLDR);
55001                }
55002              }
55003              get term() {
55004                return this._term;
55005              }
55006              set term(t) {
55007                this._term = t;
55008              }
55009              get size() {
55010                return this._size;
55011              }
55012              set size(t) {
55013                this._size = t;
55014                this._light && (this._light.size = t);
55015              }
55016              get range() {
55017                return this._range;
55018              }
55019              set range(t) {
55020                this._range = t;
55021                this._light && (this._light.range = t);
55022              }
55023              get spotAngle() {
55024                return this._spotAngle;
55025              }
55026              set spotAngle(t) {
55027                this._spotAngle = t;
55028                this._light && (this._light.spotAngle = mi(t));
55029              }
55030              get shadowEnabled() {
55031                return this._shadowEnabled;
55032              }
55033              set shadowEnabled(t) {
55034                this._shadowEnabled = t;
55035                this._light && (this._light.shadowEnabled = t);
55036              }
55037              get shadowPcf() {
55038                return this._shadowPcf;
55039              }
55040              set shadowPcf(t) {
55041                this._shadowPcf = t;
55042                this._light && (this._light.shadowPcf = t);
55043              }
55044              get shadowBias() {
55045                return this._shadowBias;
55046              }
55047              set shadowBias(t) {
55048                this._shadowBias = t;
55049                this._light && (this._light.shadowBias = t);
55050              }
55051              get shadowNormalBias() {
55052                return this._shadowNormalBias;
55053              }
55054              set shadowNormalBias(t) {
55055                this._shadowNormalBias = t;
55056                this._light && (this._light.shadowNormalBias = t);
55057              }
55058              constructor() {
55059                super();
55060                Ml(this, "_size", gW, this);
55061                Ml(this, "_luminanceHDR", yW, this);
55062                Ml(this, "_luminanceLDR", bW, this);
55063                Ml(this, "_term", SW, this);
55064                Ml(this, "_range", AW, this);
55065                Ml(this, "_spotAngle", TW, this);
55066                Ml(this, "_shadowEnabled", vW, this);
55067                Ml(this, "_shadowPcf", EW, this);
55068                Ml(this, "_shadowBias", CW, this);
55069                Ml(this, "_shadowNormalBias", xW, this);
55070                this._type = BA.SPOT;
55071                this._light = null;
55072                this._lightType = NA;
55073              }
55074              _createLight() {
55075                super._createLight();
55076                this.size = this._size;
55077                this.range = this._range;
55078                this.spotAngle = this._spotAngle;
55079                if (this._light) {
55080                  this._light.luminanceHDR = this._luminanceHDR;
55081                  this._light.luminanceLDR = this._luminanceLDR;
55082                  this._light.shadowEnabled = this._shadowEnabled;
55083                  this._light.shadowPcf = this._shadowPcf;
55084                  this._light.shadowBias = this._shadowBias;
55085                  this._light.shadowNormalBias = this._shadowNormalBias;
55086                }
55087              }
55088            }, gW = Bl(fW.prototype, "_size", [ Yl ], {
55089              configurable: !0,
55090              enumerable: !0,
55091              writable: !0,
55092              initializer: function() {
55093                return .15;
55094              }
55095            }), yW = Bl(fW.prototype, "_luminanceHDR", [ Yl, XX ], {
55096              configurable: !0,
55097              enumerable: !0,
55098              writable: !0,
55099              initializer: function() {
55100                return 1700 / DA(.15);
55101              }
55102            }), bW = Bl(fW.prototype, "_luminanceLDR", [ Yl ], {
55103              configurable: !0,
55104              enumerable: !0,
55105              writable: !0,
55106              initializer: function() {
55107                return 1700 / DA(.15) * By.standardExposureValue * By.standardLightMeterScale;
55108              }
55109            }), SW = Bl(fW.prototype, "_term", [ Yl ], {
55110              configurable: !0,
55111              enumerable: !0,
55112              writable: !0,
55113              initializer: function() {
55114                return YH.LUMINOUS_FLUX;
55115              }
55116            }), AW = Bl(fW.prototype, "_range", [ Yl ], {
55117              configurable: !0,
55118              enumerable: !0,
55119              writable: !0,
55120              initializer: function() {
55121                return 1;
55122              }
55123            }), TW = Bl(fW.prototype, "_spotAngle", [ Yl ], {
55124              configurable: !0,
55125              enumerable: !0,
55126              writable: !0,
55127              initializer: function() {
55128                return 60;
55129              }
55130            }), vW = Bl(fW.prototype, "_shadowEnabled", [ Yl ], {
55131              configurable: !0,
55132              enumerable: !0,
55133              writable: !0,
55134              initializer: function() {
55135                return !1;
55136              }
55137            }), EW = Bl(fW.prototype, "_shadowPcf", [ Yl ], {
55138              configurable: !0,
55139              enumerable: !0,
55140              writable: !0,
55141              initializer: function() {
55142                return zA.HARD;
55143              }
55144            }), CW = Bl(fW.prototype, "_shadowBias", [ Yl ], {
55145              configurable: !0,
55146              enumerable: !0,
55147              writable: !0,
55148              initializer: function() {
55149                return 1e-5;
55150              }
55151            }), xW = Bl(fW.prototype, "_shadowNormalBias", [ Yl ], {
55152              configurable: !0,
55153              enumerable: !0,
55154              writable: !0,
55155              initializer: function() {
55156                return 0;
55157              }
55158            }), Bl(fW.prototype, "luminousFlux", [ WX, YX ], Object.getOwnPropertyDescriptor(fW.prototype, "luminousFlux"), fW.prototype),
55159            Bl(fW.prototype, "luminance", [ qX, KX ], Object.getOwnPropertyDescriptor(fW.prototype, "luminance"), fW.prototype),
55160            Bl(fW.prototype, "term", [ JX, ZX, QX ], Object.getOwnPropertyDescriptor(fW.prototype, "term"), fW.prototype),
55161            Bl(fW.prototype, "size", [ $X ], Object.getOwnPropertyDescriptor(fW.prototype, "size"), fW.prototype),
55162            Bl(fW.prototype, "range", [ tW ], Object.getOwnPropertyDescriptor(fW.prototype, "range"), fW.prototype),
55163            Bl(fW.prototype, "spotAngle", [ dh, eW, iW ], Object.getOwnPropertyDescriptor(fW.prototype, "spotAngle"), fW.prototype),
55164            Bl(fW.prototype, "shadowEnabled", [ sW, nW, nh, rW ], Object.getOwnPropertyDescriptor(fW.prototype, "shadowEnabled"), fW.prototype),
55165            Bl(fW.prototype, "shadowPcf", [ oW, aW, nh, lW ], Object.getOwnPropertyDescriptor(fW.prototype, "shadowPcf"), fW.prototype),
55166            Bl(fW.prototype, "shadowBias", [ hW, cW, nh, uW ], Object.getOwnPropertyDescriptor(fW.prototype, "shadowBias"), fW.prototype),
55167            Bl(fW.prototype, "shadowNormalBias", [ _W, dW, nh, pW ], Object.getOwnPropertyDescriptor(fW.prototype, "shadowNormalBias"), fW.prototype),
55168            fW)) || mW) || mW) || mW) || mW));
55169            m.LightComponent = KH;
55170            ee.setClassAlias(KH, "cc.LightComponent");
55171            m.DirectionalLightComponent = SX;
55172            ee.setClassAlias(SX, "cc.DirectionalLightComponent");
55173            m.SphereLightComponent = GX;
55174            ee.setClassAlias(GX, "cc.SphereLightComponent");
55175            m.SpotLightComponent = wW;
55176            ee.setClassAlias(wW, "cc.SpotLightComponent");
55177            W(wW.prototype, "SpotLight.prototype", [ {
55178              name: "luminousPower",
55179              newName: "luminousFlux",
55180              customGetter() {
55181                return this.luminousFlux;
55182              },
55183              customSetter(t) {
55184                this.luminousFlux = t;
55185              }
55186            } ]);
55187            W(GX.prototype, "SphereLight.prototype", [ {
55188              name: "luminousPower",
55189              newName: "luminousFlux",
55190              customGetter() {
55191                return this.luminousFlux;
55192              },
55193              customSetter(t) {
55194                this.luminousFlux = t;
55195              }
55196            } ]);
55197            W(KH.PhotometricTerm, "Light.PhotometricTerm", [ {
55198              name: "LUMINOUS_POWER",
55199              newName: "LUMINOUS_FLUX"
55200            } ]);
55201            const RW = jsb.SkinningModel;
55202            m.SkinningModel = jsb.SkinningModel;
55203            const IW = jsb.BakedSkinningModel;
55204            m.BakedSkinningModel = jsb.BakedSkinningModel;
55205            jsb.MorphModel;
55206            const MW = IW.prototype;
55207            MW._ctor = function() {
55208              jsb.Model.prototype._ctor.call(this);
55209              this.uploadedAnim = void 0;
55210              this._dataPoolManager = m.director.root.dataPoolManager;
55211              const t = new Float32Array(4);
55212              const e = this._dataPoolManager.jointAnimationInfo.getData();
55213              this._jointsMedium = {
55214                buffer: null,
55215                jointTextureInfo: t,
55216                animInfo: e,
55217                texture: null,
55218                boundsInfo: null
55219              };
55220              this._skeleton = null;
55221              this._mesh = null;
55222            };
55223            const BW = MW.destroy;
55224            MW.destroy = function() {
55225              this.uploadedAnim = void 0;
55226              this._jointsMedium.boundsInfo = null;
55227              this._applyJointTexture();
55228              BW.call(this);
55229            };
55230            const DW = MW.bindSkeleton;
55231            MW.bindSkeleton = function(t = null, e = null, i = null) {
55232              this._skeleton = t;
55233              this._mesh = i;
55234              if (!t || !e || !i) return;
55235              this.transform = e;
55236              const s = this._dataPoolManager;
55237              this._jointsMedium.animInfo = s.jointAnimationInfo.getData(e.uuid);
55238              const n = this._jointsMedium.animInfo;
55239              this.syncAnimInfoForJS(n.buffer, n.data, n.dirtyForJSB);
55240              DW.apply(this, arguments);
55241            };
55242            MW.uploadAnimation = function(t) {
55243              var e;
55244              if (!this._skeleton || !this._mesh || this.uploadedAnim === t) return;
55245              this.uploadedAnim = t;
55246              this.setUploadedAnimForJS(!!t);
55247              const i = this._dataPoolManager;
55248              let s = null;
55249              let n = null;
55250              if (t) {
55251                s = i.jointTexturePool.getSequencePoseTexture(this._skeleton, t, this._mesh, this.transform);
55252                this._jointsMedium.boundsInfo = s && s.bounds.get(this._mesh.hash);
55253                n = null;
55254              } else {
55255                s = i.jointTexturePool.getDefaultPoseTexture(this._skeleton, this._mesh, this.transform);
55256                this._jointsMedium.boundsInfo = null;
55257                n = s && s.bounds.get(this._mesh.hash)[0];
55258              }
55259              this._applyJointTexture(s);
55260              const {jointTextureInfo: r} = this._jointsMedium;
55261              const o = null === (e = s) || void 0 === e ? void 0 : e.handle.texture;
55262              this.syncDataForJS(this._jointsMedium.boundsInfo, n, r[0], r[1], r[2], r[3], o, this._jointsMedium.animInfo.data);
55263            };
55264            MW._applyJointTexture = function(t = null) {
55265              const e = this._jointsMedium.texture;
55266              e && e !== t && this._dataPoolManager.jointTexturePool.releaseHandle(e);
55267              this._jointsMedium.texture = t;
55268              if (!t) return;
55269              const {jointTextureInfo: i} = this._jointsMedium;
55270              i[0] = t.handle.texture.width;
55271              i[1] = this._skeleton.joints.length;
55272              i[2] = t.pixelOffset + .1;
55273              i[3] = 1 / i[0];
55274            };
55275            var PW, OW, NW, LW, FW, VW, kW, UW, GW, zW, HW, jW, XW, WW;
55276            let YW = function(e) {
55277              return t({
55278                SkinnedMeshRenderer: e,
55279                SkinningModelComponent: e
55280              }), e;
55281            }((PW = Ul("cc.SkinnedMeshRenderer"), OW = sh(), NW = zl(100), LW = $l(), FW = Th(AH),
55282            VW = Th(_y), kW = Th(AH), UW = Th(_y), GW = lh(), PW(zW = OW(zW = NW(zW = Ql(zW = LW(zW = (HW = (WW = class extends bH {
55283              get skeleton() {
55284                return this._skeleton;
55285              }
55286              set skeleton(t) {
55287                if (t !== this._skeleton) {
55288                  this._skeleton = t;
55289                  this._update();
55290                }
55291              }
55292              get skinningRoot() {
55293                return this._skinningRoot;
55294              }
55295              set skinningRoot(t) {
55296                this._skinningRoot = t;
55297                this._tryBindAnimation();
55298                t !== this._skinningRoot && this._update();
55299              }
55300              get model() {
55301                return this._model;
55302              }
55303              constructor() {
55304                super();
55305                Ml(this, "_skeleton", jW, this);
55306                Ml(this, "_skinningRoot", XW, this);
55307                this._clip = null;
55308                this.associatedAnimation = null;
55309                this._modelType = IW;
55310              }
55311              onLoad() {
55312                super.onLoad();
55313                this._tryBindAnimation();
55314              }
55315              onDestroy() {
55316                if (this.associatedAnimation) {
55317                  this.associatedAnimation.notifySkinnedMeshRemoved(this);
55318                  ne(null === this.associatedAnimation);
55319                }
55320                super.onDestroy();
55321              }
55322              uploadAnimation(t) {
55323                this._clip = t;
55324                this.model && this.model.uploadAnimation && this.model.uploadAnimation(t);
55325              }
55326              setUseBakedAnimation(t = !0, e = !1) {
55327                const i = t ? IW : RW;
55328                if (e || this._modelType !== i) {
55329                  this._modelType = i;
55330                  if (this._model) {
55331                    m.director.root.destroyModel(this._model);
55332                    this._model = null;
55333                    this._models.length = 0;
55334                    this._updateModels();
55335                    this._updateCastShadow();
55336                    this._updateReceiveShadow();
55337                    this.enabledInHierarchy && this._attachToScene();
55338                  }
55339                }
55340              }
55341              setMaterial(t, e) {
55342                super.setMaterial(t, e);
55343                this._modelType === RW && this.getMaterialInstance(e);
55344              }
55345              _updateModelParams() {
55346                this._update();
55347                super._updateModelParams();
55348              }
55349              _tryBindAnimation() {
55350                const {_skinningRoot: t} = this;
55351                if (!t) return;
55352                let e = !1;
55353                for (let i = this.node; i; i = i.parent) if (i === t) {
55354                  e = !0;
55355                  break;
55356                }
55357                if (!e) return;
55358                const i = t.getComponent("cc.SkeletalAnimation");
55359                i ? i.notifySkinnedMeshAdded(this) : this.setUseBakedAnimation(!1);
55360              }
55361              _update() {
55362                if (this.model) {
55363                  this.model.bindSkeleton(this._skeleton, this._skinningRoot, this._mesh);
55364                  this.model.uploadAnimation && this.model.uploadAnimation(this._clip);
55365                }
55366              }
55367            }, WW), jW = Bl(HW.prototype, "_skeleton", [ FW ], {
55368              configurable: !0,
55369              enumerable: !0,
55370              writable: !0,
55371              initializer: function() {
55372                return null;
55373              }
55374            }), XW = Bl(HW.prototype, "_skinningRoot", [ VW ], {
55375              configurable: !0,
55376              enumerable: !0,
55377              writable: !0,
55378              initializer: function() {
55379                return null;
55380              }
55381            }), Bl(HW.prototype, "skeleton", [ kW ], Object.getOwnPropertyDescriptor(HW.prototype, "skeleton"), HW.prototype),
55382            Bl(HW.prototype, "skinningRoot", [ UW, GW ], Object.getOwnPropertyDescriptor(HW.prototype, "skinningRoot"), HW.prototype),
55383            HW)) || zW) || zW) || zW) || zW) || zW));
55384            const qW = new qi;
55385            function KW(t, e, i) {
55386              qi.identity(i);
55387              for (;t !== e; ) {
55388                qi.fromRTS(qW, t.rotation, t.position, t.scale);
55389                qi.multiply(i, qW, i);
55390                t = t.parent;
55391              }
55392              return i;
55393            }
55394            var JW, ZW, QW, $W, tY, eY, iY, sY, nY, rY, oY, aY, lY, hY, cY, uY, _Y, dY, pY, mY, fY, gY, yY, bY, SY, AY, TY, vY, EY, CY, xY;
55395            const wY = new Vn(cr.ATTR_BATCH_ID, bs.R32F);
55396            const RY = new Vn(cr.ATTR_BATCH_UV, bs.RG32F);
55397            const IY = ur[wY.format].size + ur[RY.format].size;
55398            let MY = function(e) {
55399              return t({
55400                SkinnedMeshUnit: e,
55401                SkinningModelUnit: e
55402              }), e;
55403            }((JW = Ul("cc.SkinnedMeshUnit"), ZW = Th(Ez), QW = Th(AH), $W = Th(hm), tY = Th(YW),
55404            JW(eY = (iY = (hY = class {
55405              constructor() {
55406                Ml(this, "mesh", sY, this);
55407                Ml(this, "skeleton", nY, this);
55408                Ml(this, "material", rY, this);
55409                Ml(this, "_localTransform", oY, this);
55410                Ml(this, "_offset", aY, this);
55411                Ml(this, "_size", lY, this);
55412              }
55413              set offset(t) {
55414                Qi.copy(this._offset, t);
55415              }
55416              get offset() {
55417                return this._offset;
55418              }
55419              set size(t) {
55420                Qi.copy(this._size, t);
55421              }
55422              get size() {
55423                return this._size;
55424              }
55425              set copyFrom(t) {
55426                if (t) {
55427                  this.mesh = t.mesh;
55428                  this.skeleton = t.skeleton;
55429                  this.material = t.getMaterial(0);
55430                  t.skinningRoot && KW(t.node, t.skinningRoot, this._localTransform);
55431                }
55432              }
55433              get copyFrom() {
55434                return null;
55435              }
55436            }, hY), sY = Bl(iY.prototype, "mesh", [ ZW ], {
55437              configurable: !0,
55438              enumerable: !0,
55439              writable: !0,
55440              initializer: function() {
55441                return null;
55442              }
55443            }), nY = Bl(iY.prototype, "skeleton", [ QW ], {
55444              configurable: !0,
55445              enumerable: !0,
55446              writable: !0,
55447              initializer: function() {
55448                return null;
55449              }
55450            }), rY = Bl(iY.prototype, "material", [ $W ], {
55451              configurable: !0,
55452              enumerable: !0,
55453              writable: !0,
55454              initializer: function() {
55455                return null;
55456              }
55457            }), oY = Bl(iY.prototype, "_localTransform", [ Yl ], {
55458              configurable: !0,
55459              enumerable: !0,
55460              writable: !0,
55461              initializer: function() {
55462                return new qi;
55463              }
55464            }), aY = Bl(iY.prototype, "_offset", [ Yl ], {
55465              configurable: !0,
55466              enumerable: !0,
55467              writable: !0,
55468              initializer: function() {
55469                return new Qi(0, 0);
55470              }
55471            }), lY = Bl(iY.prototype, "_size", [ Yl ], {
55472              configurable: !0,
55473              enumerable: !0,
55474              writable: !0,
55475              initializer: function() {
55476                return new Qi(1, 1);
55477              }
55478            }), Bl(iY.prototype, "offset", [ nh ], Object.getOwnPropertyDescriptor(iY.prototype, "offset"), iY.prototype),
55479            Bl(iY.prototype, "size", [ nh ], Object.getOwnPropertyDescriptor(iY.prototype, "size"), iY.prototype),
55480            Bl(iY.prototype, "copyFrom", [ tY ], Object.getOwnPropertyDescriptor(iY.prototype, "copyFrom"), iY.prototype),
55481            iY)) || eY));
55482            const BY = new qi;
55483            new qi;
55484            const DY = new Pi;
55485            let PY = function(e) {
55486              return t({
55487                SkinnedMeshBatchRenderer: e,
55488                BatchedSkinningModelComponent: e
55489              }), e;
55490            }((cY = Ul("cc.SkinnedMeshBatchRenderer"), uY = sh(), _Y = zl(100), dY = $l(), pY = lh(),
55491            mY = Th([ Fe ]), fY = lh(), gY = Th([ MY ]), yY = lh(), bY = rh(), SY = rh(), cY(AY = uY(AY = _Y(AY = Ql(AY = dY(AY = (TY = (xY = class extends YW {
55492              constructor(...t) {
55493                super(...t);
55494                Ml(this, "atlasSize", vY, this);
55495                Ml(this, "batchableTextureNames", EY, this);
55496                Ml(this, "units", CY, this);
55497                this._textures = {};
55498                this._batchMaterial = null;
55499              }
55500              get mesh() {
55501                return super.mesh;
55502              }
55503              set mesh(t) {
55504                super.mesh = t;
55505              }
55506              get skeleton() {
55507                return super.skeleton;
55508              }
55509              set skeleton(t) {
55510                super.skeleton = t;
55511              }
55512              onLoad() {
55513                super.onLoad();
55514                this.cook();
55515              }
55516              onDestroy() {
55517                for (const t in this._textures) this._textures[t].destroy();
55518                this._textures = {};
55519                if (this._mesh) {
55520                  this._mesh.destroy();
55521                  this._mesh = null;
55522                }
55523                super.onDestroy();
55524              }
55525              _onMaterialModified(t, e) {
55526                this.cookMaterials();
55527                super._onMaterialModified(t, this.getMaterialInstance(t));
55528              }
55529              cook() {
55530                this.cookMaterials();
55531                this.cookSkeletons();
55532                this.cookMeshes();
55533              }
55534              cookMaterials() {
55535                this._batchMaterial || (this._batchMaterial = this.getMaterial(0));
55536                const t = this.getMaterialInstance(0);
55537                if (!t || !this._batchMaterial || !this._batchMaterial.effectAsset) {
55538                  console.warn("incomplete batch material!");
55539                  return;
55540                }
55541                t.copy(this._batchMaterial);
55542                this.resizeAtlases();
55543                const e = t.effectAsset.techniques[t.technique];
55544                for (let i = 0; i < e.passes.length; i++) {
55545                  const s = e.passes[i];
55546                  if (s.properties) for (const e in s.properties) if (s.properties[e].type >= As.SAMPLER1D) {
55547                    let s = null;
55548                    if (this.batchableTextureNames.find((t => t === e))) {
55549                      s = this._textures[e];
55550                      s || (s = this.createTexture(e));
55551                      this.cookTextures(s, e, i);
55552                    } else this.units.some((t => s = t.material && t.material.getProperty(e, i)));
55553                    s && t.setProperty(e, s, i);
55554                  } else {
55555                    const s = [];
55556                    for (let t = 0; t < this.units.length; t++) {
55557                      const n = this.units[t];
55558                      n.material && s.push(n.material.getProperty(e.slice(0, -3), i));
55559                    }
55560                    t.setProperty(e, s, i);
55561                  }
55562                }
55563              }
55564              cookSkeletons() {
55565                if (!this._skinningRoot) {
55566                  console.warn("no skinning root specified!");
55567                  return;
55568                }
55569                const t = [];
55570                const e = [];
55571                for (let i = 0; i < this.units.length; i++) {
55572                  const s = this.units[i];
55573                  if (!s || !s.skeleton) continue;
55574                  const n = s.skeleton;
55575                  qi.invert(BY, s._localTransform);
55576                  for (let i = 0; i < n.joints.length; i++) {
55577                    const s = n.joints[i];
55578                    if (!(t.findIndex((t => t === s)) >= 0)) {
55579                      t.push(s);
55580                      e.push(qi.multiply(new qi, n.bindposes[i] || qi.IDENTITY, BY));
55581                    }
55582                  }
55583                }
55584                const i = Array.from(Array(t.length).keys()).sort(((e, i) => t[e] > t[i] ? 1 : t[e] < t[i] ? -1 : 0));
55585                const s = new AH;
55586                s.joints = t.map(((t, e, s) => s[i[e]]));
55587                s.bindposes = e.map(((t, e, s) => s[i[e]]));
55588                this._skeleton && this._skeleton.destroy();
55589                this.skeleton = s;
55590              }
55591              cookMeshes() {
55592                let t = !1;
55593                for (let e = 0; e < this.units.length; e++) {
55594                  if (this.units[e].mesh) {
55595                    t = !0;
55596                    break;
55597                  }
55598                }
55599                if (!t || !this._skinningRoot) return;
55600                this._mesh ? this._mesh.destroyRenderingMesh() : this._mesh = new Ez;
55601                let e = 0;
55602                let i = bs.UNKNOWN;
55603                let s = 0;
55604                let n = bs.UNKNOWN;
55605                let r = 0;
55606                let o = bs.UNKNOWN;
55607                let a = 0;
55608                let l = bs.UNKNOWN;
55609                let h = 0;
55610                let c = bs.UNKNOWN;
55611                const u = new Array(this.units.length);
55612                const _ = this.units.length;
55613                for (let t = 0; t < _; t++) {
55614                  const e = this.units[t];
55615                  e && e.skeleton && (u[t] = e.skeleton.joints.map((t => this._skeleton.joints.findIndex((e => t === e)))));
55616                }
55617                for (let t = 0; t < _; t++) {
55618                  const _ = this.units[t];
55619                  if (!_ || !_.mesh || !_.mesh.data) continue;
55620                  const d = this._createUnitMesh(t, _.mesh);
55621                  const p = new DataView(d.data.buffer);
55622                  qi.inverseTranspose(BY, _._localTransform);
55623                  const {offset: m} = _;
55624                  const {size: f} = _;
55625                  for (let g = 0; g < d.struct.vertexBundles.length; g++) {
55626                    const y = d.struct.vertexBundles[g];
55627                    e = y.view.offset;
55628                    i = bs.UNKNOWN;
55629                    for (let t = 0; t < y.attributes.length; t++) {
55630                      const s = y.attributes[t];
55631                      if (s.name === cr.ATTR_POSITION) {
55632                        i = s.format;
55633                        break;
55634                      }
55635                      e += ur[s.format].size;
55636                    }
55637                    if (i) {
55638                      const t = RI(p, i, e, y.view.length, y.view.stride);
55639                      for (let e = 0; e < t.length; e += 3) {
55640                        Pi.fromArray(DY, t, e);
55641                        Pi.transformMat4(DY, DY, _._localTransform);
55642                        Pi.toArray(t, DY, e);
55643                      }
55644                      wI(p, t, i, e, y.view.stride);
55645                    }
55646                    s = y.view.offset;
55647                    n = bs.UNKNOWN;
55648                    for (let t = 0; t < y.attributes.length; t++) {
55649                      const e = y.attributes[t];
55650                      if (e.name === cr.ATTR_NORMAL) {
55651                        n = e.format;
55652                        break;
55653                      }
55654                      s += ur[e.format].size;
55655                    }
55656                    if (n) {
55657                      const t = RI(p, n, s, y.view.length, y.view.stride);
55658                      for (let e = 0; e < t.length; e += 3) {
55659                        Pi.fromArray(DY, t, e);
55660                        Pi.transformMat4Normal(DY, DY, BY);
55661                        Pi.toArray(t, DY, e);
55662                      }
55663                      wI(p, t, n, s, y.view.stride);
55664                    }
55665                    r = y.view.offset;
55666                    o = bs.UNKNOWN;
55667                    for (let t = 0; t < y.attributes.length; t++) {
55668                      const e = y.attributes[t];
55669                      if (e.name === cr.ATTR_TANGENT) {
55670                        o = e.format;
55671                        break;
55672                      }
55673                      r += ur[e.format].size;
55674                    }
55675                    if (o) {
55676                      const t = RI(p, o, r, y.view.length, y.view.stride);
55677                      for (let e = 0; e < t.length; e += 3) {
55678                        Pi.fromArray(DY, t, e);
55679                        Pi.transformMat4Normal(DY, DY, BY);
55680                        Pi.toArray(t, DY, e);
55681                      }
55682                      wI(p, t, o, r, y.view.stride);
55683                    }
55684                    a = y.view.offset;
55685                    l = bs.UNKNOWN;
55686                    for (let t = 0; t < y.attributes.length; t++) {
55687                      const e = y.attributes[t];
55688                      if (e.name === cr.ATTR_BATCH_UV) {
55689                        l = e.format;
55690                        break;
55691                      }
55692                      a += ur[e.format].size;
55693                    }
55694                    l && II(p, ((t, e) => {
55695                      var i;
55696                      const s = 0 === e ? "x" : "y";
55697                      return (t = (i = t) - Math.floor(i)) * f[s] + m[s];
55698                    }), l, a, y.view.length, y.view.stride, p);
55699                    const b = u[t];
55700                    if (b) {
55701                      h = y.view.offset;
55702                      c = bs.UNKNOWN;
55703                      for (let t = 0; t < y.attributes.length; t++) {
55704                        const e = y.attributes[t];
55705                        if (e.name === cr.ATTR_JOINTS) {
55706                          c = e.format;
55707                          break;
55708                        }
55709                        h += ur[e.format].size;
55710                      }
55711                      c && II(p, (t => b[t]), c, h, y.view.length, y.view.stride, p);
55712                    }
55713                  }
55714                  this._mesh.merge(d);
55715                }
55716                this._onMeshChanged(this._mesh);
55717                this._updateModels();
55718              }
55719              cookTextures(t, e, i) {
55720                const s = [];
55721                const n = [];
55722                const r = [];
55723                const o = [];
55724                for (let t = 0; t < this.units.length; t++) {
55725                  const a = this.units[t];
55726                  if (!a.material) continue;
55727                  const l = a.material.getProperty(e, i);
55728                  if (l && l.image && l.image.data) {
55729                    const t = new mn;
55730                    t.texOffset.x = a.offset.x * this.atlasSize;
55731                    t.texOffset.y = a.offset.y * this.atlasSize;
55732                    t.texExtent.width = a.size.x * this.atlasSize;
55733                    t.texExtent.height = a.size.y * this.atlasSize;
55734                    const {data: e} = l.image;
55735                    if (ArrayBuffer.isView(e)) {
55736                      r.push(e);
55737                      o.push(t);
55738                    } else {
55739                      s.push(e);
55740                      n.push(t);
55741                    }
55742                  }
55743                }
55744                const a = t.getGFXTexture();
55745                const {device: l} = m.director.root;
55746                r.length > 0 && l.copyBuffersToTexture(r, a, o);
55747                s.length > 0 && l.copyTexImagesToTexture(s, a, n);
55748              }
55749              createTexture(t) {
55750                const e = new LC;
55751                e.setFilters(Qp.LINEAR, Qp.LINEAR);
55752                e.setMipFilter(Qp.NEAREST);
55753                e.reset({
55754                  width: this.atlasSize,
55755                  height: this.atlasSize,
55756                  format: Jp.RGBA8888
55757                });
55758                this._textures[t] = e;
55759                return e;
55760              }
55761              resizeAtlases() {
55762                for (const t in this._textures) {
55763                  this._textures[t].reset({
55764                    width: this.atlasSize,
55765                    height: this.atlasSize,
55766                    format: Jp.RGBA8888
55767                  });
55768                }
55769              }
55770              _createUnitMesh(t, e) {
55771                const i = JSON.parse(JSON.stringify(e.struct));
55772                const s = {};
55773                for (let t = 0; t < e.struct.primitives.length; t++) {
55774                  const n = e.struct.primitives[t];
55775                  let r = 0;
55776                  let o = bs.UNKNOWN;
55777                  let a = 0;
55778                  for (;a < n.vertexBundelIndices.length; a++) {
55779                    const t = e.struct.vertexBundles[n.vertexBundelIndices[a]];
55780                    r = t.view.offset;
55781                    o = bs.UNKNOWN;
55782                    for (let e = 0; e < t.attributes.length; e++) {
55783                      const i = t.attributes[e];
55784                      if (i.name === cr.ATTR_TEX_COORD) {
55785                        o = i.format;
55786                        break;
55787                      }
55788                      r += ur[i.format].size;
55789                    }
55790                    if (o) break;
55791                  }
55792                  if (void 0 !== s[a]) continue;
55793                  s[a] = [ o, r ];
55794                  const l = i.vertexBundles[a];
55795                  l.attributes.push(wY);
55796                  l.attributes.push(RY);
55797                  l.view.offset = 0;
55798                  l.view.length += l.view.count * IY;
55799                  l.view.stride += IY;
55800                }
55801                let n = 0;
55802                for (let t = 0; t < i.vertexBundles.length; t++) n += i.vertexBundles[t].view.length;
55803                for (let t = 0; t < i.primitives.length; t++) {
55804                  const e = i.primitives[t];
55805                  if (e.indexView) {
55806                    e.indexView.offset = n;
55807                    n += e.indexView.length;
55808                  }
55809                }
55810                const r = new Uint8Array(n);
55811                const o = e.data;
55812                const a = new DataView(r.buffer);
55813                const l = new DataView(o.buffer);
55814                const {isLittleEndian: h} = m.sys;
55815                for (const n in s) {
55816                  const c = i.vertexBundles[n];
55817                  const u = e.struct.vertexBundles[n];
55818                  const [_, d] = s[n];
55819                  const p = RI(l, _, d, u.view.length, u.view.stride);
55820                  const m = u.view;
55821                  const f = c.view;
55822                  const g = m.stride;
55823                  const y = f.stride;
55824                  let b = m.offset;
55825                  let S = f.offset;
55826                  for (let e = 0; e < f.count; e++) {
55827                    const i = o.subarray(b, b + g);
55828                    r.set(i, S);
55829                    a.setFloat32(S + g, t);
55830                    a.setFloat32(S + g + 4, p[2 * e], h);
55831                    a.setFloat32(S + g + 8, p[2 * e + 1], h);
55832                    S += y;
55833                    b += g;
55834                  }
55835                }
55836                for (let t = 0; t < i.primitives.length; t++) {
55837                  const s = e.struct.primitives[t];
55838                  const n = i.primitives[t];
55839                  if (s.indexView && n.indexView) {
55840                    const t = s.indexView.stride;
55841                    const e = n.indexView.stride;
55842                    let i = s.indexView.offset;
55843                    let a = n.indexView.offset;
55844                    for (let s = 0; s < n.indexView.count; s++) {
55845                      const s = o.subarray(i, i + t);
55846                      r.set(s, a);
55847                      a += e;
55848                      i += t;
55849                    }
55850                  }
55851                }
55852                const c = new Ez;
55853                c.reset({
55854                  struct: i,
55855                  data: r
55856                });
55857                return c;
55858              }
55859            }, xY), vY = Bl(TY.prototype, "atlasSize", [ Yl, pY ], {
55860              configurable: !0,
55861              enumerable: !0,
55862              writable: !0,
55863              initializer: function() {
55864                return 1024;
55865              }
55866            }), EY = Bl(TY.prototype, "batchableTextureNames", [ mY, Yl, fY ], {
55867              configurable: !0,
55868              enumerable: !0,
55869              writable: !0,
55870              initializer: function() {
55871                return [];
55872              }
55873            }), CY = Bl(TY.prototype, "units", [ gY, Yl, yY ], {
55874              configurable: !0,
55875              enumerable: !0,
55876              writable: !0,
55877              initializer: function() {
55878                return [];
55879              }
55880            }), Bl(TY.prototype, "mesh", [ vh, bY ], Object.getOwnPropertyDescriptor(TY.prototype, "mesh"), TY.prototype),
55881            Bl(TY.prototype, "skeleton", [ vh, SY ], Object.getOwnPropertyDescriptor(TY.prototype, "skeleton"), TY.prototype),
55882            TY)) || AY) || AY) || AY) || AY) || AY));
55883            m.SkinningModelComponent = YW;
55884            ee.setClassAlias(YW, "cc.SkinningModelComponent");
55885            m.SkinningModelUnit = MY;
55886            ee.setClassAlias(MY, "cc.SkinningModelUnit");
55887            m.BatchedSkinningModelComponent = PY;
55888            ee.setClassAlias(PY, "cc.BatchedSkinningModelComponent");
55889            m.utils = PI;
55890            const OY = Symbol("CreateEval");
55891            var NY, LY, FY, VY, kY, UY;
55892            Ul("cc.animation.EmbeddedPlayer")(NY = (LY = class extends Ch {
55893              constructor(...t) {
55894                super(...t);
55895                Ml(this, "begin", FY, this);
55896                Ml(this, "end", VY, this);
55897                Ml(this, "reconciledSpeed", kY, this);
55898                Ml(this, "playable", UY, this);
55899              }
55900            }, FY = Bl(LY.prototype, "begin", [ Yl ], {
55901              configurable: !0,
55902              enumerable: !0,
55903              writable: !0,
55904              initializer: function() {
55905                return 0;
55906              }
55907            }), VY = Bl(LY.prototype, "end", [ Yl ], {
55908              configurable: !0,
55909              enumerable: !0,
55910              writable: !0,
55911              initializer: function() {
55912                return 0;
55913              }
55914            }), kY = Bl(LY.prototype, "reconciledSpeed", [ Yl ], {
55915              configurable: !0,
55916              enumerable: !0,
55917              writable: !0,
55918              initializer: function() {
55919                return !1;
55920              }
55921            }), UY = Bl(LY.prototype, "playable", [ Yl ], {
55922              configurable: !0,
55923              enumerable: !0,
55924              writable: !0,
55925              initializer: function() {
55926                return null;
55927              }
55928            }), LY));
55929            class GY {}
55930            class zY {
55931              constructor(t) {
55932                this._randomAccess = t;
55933              }
55934              get randomAccess() {
55935                return this._randomAccess;
55936              }
55937              setTime(t) {}
55938            }
55939            class HY {
55940              constructor() {
55941                this._isPlaying = !1;
55942                this._isPaused = !1;
55943                this._stepOnce = !1;
55944              }
55945              get isPlaying() {
55946                return this._isPlaying;
55947              }
55948              get isPaused() {
55949                return this._isPaused;
55950              }
55951              get isMotionless() {
55952                return !this.isPlaying || this.isPaused;
55953              }
55954              play() {
55955                if (this._isPlaying) if (this._isPaused) {
55956                  this._isPaused = !1;
55957                  this.onResume();
55958                } else this.onError(G(3912)); else {
55959                  this._isPlaying = !0;
55960                  this.onPlay();
55961                }
55962              }
55963              stop() {
55964                if (this._isPlaying) {
55965                  this._isPlaying = !1;
55966                  this.onStop();
55967                  this._isPaused = !1;
55968                }
55969              }
55970              pause() {
55971                if (this._isPlaying && !this._isPaused) {
55972                  this._isPaused = !0;
55973                  this.onPause();
55974                }
55975              }
55976              resume() {
55977                if (this._isPlaying && this._isPaused) {
55978                  this._isPaused = !1;
55979                  this.onResume();
55980                }
55981              }
55982              step() {
55983                this.pause();
55984                this._stepOnce = !0;
55985                this._isPlaying || this.play();
55986              }
55987              update(t) {}
55988              onPlay() {}
55989              onPause() {}
55990              onResume() {}
55991              onStop() {}
55992              onError(t) {}
55993            }
55994            class jY {
55995              constructor(t) {
55996                this.weight = 0;
55997                this._pose = void 0;
55998                this._blendStateWriters = [];
55999                this._pose = t;
56000              }
56001              destroy() {
56002                for (let t = 0; t < this._blendStateWriters.length; ++t) this._pose.destroyWriter(this._blendStateWriters[t]);
56003                this._blendStateWriters.length = 0;
56004              }
56005              createPoseWriter(t, e, i) {
56006                const s = this._pose.createWriter(t, e, this, i);
56007                this._blendStateWriters.push(s);
56008                return s;
56009              }
56010            }
56011            function XY() {
56012              return m.director.getAnimationManager();
56013            }
56014            let WY;
56015            !function(t) {
56016              t.PLAY = "play";
56017              t.STOP = "stop";
56018              t.PAUSE = "pause";
56019              t.RESUME = "resume";
56020              t.LASTFRAME = "lastframe";
56021              t.FINISHED = "finished";
56022            }(WY || (WY = {}));
56023            he(WY);
56024            class YY extends HY {
56025              get clip() {
56026                return this._clip;
56027              }
56028              get name() {
56029                return this._name;
56030              }
56031              get length() {
56032                return this.duration;
56033              }
56034              get wrapMode() {
56035                return this._wrapMode;
56036              }
56037              set wrapMode(t) {
56038                var e;
56039                this._wrapMode = t;
56040                this.time = 0;
56041                t & Sl.Loop ? this.repeatCount = 1 / 0 : this.repeatCount = 1;
56042                null === (e = this._clipEventEval) || void 0 === e || e.setWrapMode(t);
56043              }
56044              get repeatCount() {
56045                return this._repeatCount;
56046              }
56047              set repeatCount(t) {
56048                this._repeatCount = t;
56049                const e = this._wrapMode & Sl.ShouldWrap;
56050                const i = (this.wrapMode & Sl.Reverse) === Sl.Reverse;
56051                this._useSimpleProcess = t === 1 / 0 && !e && !i;
56052              }
56053              get delay() {
56054                return this._delay;
56055              }
56056              set delay(t) {
56057                this._delayTime = this._delay = t;
56058              }
56059              get playbackRange() {
56060                return this._playbackRange;
56061              }
56062              set playbackRange(t) {
56063                ne(t.max > t.min);
56064                this._playbackRange.min = Math.max(t.min, 0);
56065                this._playbackRange.max = Math.min(t.max, this.duration);
56066                this._playbackDuration = this._playbackRange.max - this._playbackRange.min;
56067                this.setTime(0);
56068              }
56069              get speed() {
56070                return this._speed;
56071              }
56072              set speed(t) {
56073                var e;
56074                this._speed = t;
56075                null === (e = this._clipEmbeddedPlayerEval) || void 0 === e || e.notifyHostSpeedChanged(t);
56076              }
56077              get current() {
56078                return this.getWrappedInfo(this.time).time;
56079              }
56080              get ratio() {
56081                return 0 === this.duration ? 0 : this.current / this.duration;
56082              }
56083              get weight() {
56084                return this._weight;
56085              }
56086              set weight(t) {
56087                this._weight = t;
56088                this._poseOutput && (this._poseOutput.weight = t);
56089              }
56090              constructor(t, e = "") {
56091                super();
56092                this.duration = 1;
56093                this.time = 0;
56094                this.frameRate = 0;
56095                this._targetNode = null;
56096                this._curveLoaded = !1;
56097                this._clip = void 0;
56098                this._speed = 1;
56099                this._useSimpleProcess = !1;
56100                this._target = null;
56101                this._wrapMode = Al.Normal;
56102                this._repeatCount = 1;
56103                this._delay = 0;
56104                this._delayTime = 0;
56105                this._currentFramePlayed = !1;
56106                this._name = void 0;
56107                this._lastIterations = NaN;
56108                this._lastWrapInfo = null;
56109                this._wrappedInfo = new Tl;
56110                this._allowLastFrame = !1;
56111                this._blendStateWriterHost = {
56112                  weight: 0
56113                };
56114                this._playbackDuration = 0;
56115                this._invDuration = 1;
56116                this._poseOutput = null;
56117                this._weight = 1;
56118                this._clipEval = void 0;
56119                this._clipEventEval = void 0;
56120                this._clipEmbeddedPlayerEval = void 0;
56121                this._doNotCreateEval = !1;
56122                this._clip = t;
56123                this._name = e || t && t.name;
56124                this._playbackRange = {
56125                  min: 0,
56126                  max: t.duration
56127                };
56128                this._playbackDuration = t.duration;
56129                t.duration || R(`Clip ${t.name} has zero duration.`);
56130              }
56131              get curveLoaded() {
56132                return this._curveLoaded;
56133              }
56134              initialize(t, e, i) {
56135                if (this._curveLoaded) return;
56136                this._curveLoaded = !0;
56137                if (this._poseOutput) {
56138                  this._poseOutput.destroy();
56139                  this._poseOutput = null;
56140                }
56141                this._clipEval && (this._clipEval = void 0);
56142                this._clipEventEval && (this._clipEventEval = void 0);
56143                if (this._clipEmbeddedPlayerEval) {
56144                  this._clipEmbeddedPlayerEval.destroy();
56145                  this._clipEmbeddedPlayerEval = void 0;
56146                }
56147                this._targetNode = t;
56148                const s = this._clip;
56149                this.duration = s.duration;
56150                this._invDuration = 1 / this.duration;
56151                this._speed = s.speed;
56152                this.wrapMode = s.wrapMode;
56153                this.frameRate = s.sample;
56154                this._playbackRange.min = 0;
56155                this._playbackRange.max = s.duration;
56156                this._playbackDuration = s.duration;
56157                (this.wrapMode & Sl.Loop) === Sl.Loop ? this.repeatCount = 1 / 0 : this.repeatCount = 1;
56158                if (!this._doNotCreateEval) {
56159                  var n, r, o;
56160                  const a = null !== (n = null != e ? e : null === (r = XY()) || void 0 === r ? void 0 : r.blendState) && void 0 !== n ? n : null;
56161                  a && (this._poseOutput = new jY(a));
56162                  this._clipEval = s.createEvaluator({
56163                    target: t,
56164                    pose: null !== (o = this._poseOutput) && void 0 !== o ? o : void 0,
56165                    mask: i
56166                  });
56167                }
56168                s.containsAnyEvent() && (this._clipEventEval = s.createEventEvaluator(this._targetNode));
56169                if (s.containsAnyEmbeddedPlayer()) {
56170                  this._clipEmbeddedPlayerEval = s.createEmbeddedPlayerEvaluator(this._targetNode);
56171                  this._clipEmbeddedPlayerEval.notifyHostSpeedChanged(this._speed);
56172                }
56173              }
56174              destroy() {
56175                this.isMotionless || XY().removeAnimation(this);
56176                if (this._poseOutput) {
56177                  this._poseOutput.destroy();
56178                  this._poseOutput = null;
56179                }
56180                this._clipEval = void 0;
56181              }
56182              emit(...t) {
56183                XY().pushDelayEvent(this._emit, this, t);
56184              }
56185              on(t, e, i) {
56186                return this._target && this._target.isValid ? this._target.on(t, e, i) : null;
56187              }
56188              once(t, e, i) {
56189                return this._target && this._target.isValid ? this._target.once(t, e, i) : null;
56190              }
56191              off(t, e, i) {
56192                this._target && this._target.isValid && this._target.off(t, e, i);
56193              }
56194              allowLastFrameEvent(t) {
56195                this._allowLastFrame = t;
56196              }
56197              _setEventTarget(t) {
56198                this._target = t;
56199              }
56200              setTime(t) {
56201                this._currentFramePlayed = !1;
56202                this.time = t || 0;
56203                {
56204                  var e;
56205                  const i = this.getWrappedInfo(t, this._wrappedInfo);
56206                  null === (e = this._clipEventEval) || void 0 === e || e.ignore(i.ratio, i.direction);
56207                }
56208              }
56209              update(t) {
56210                if (this._delayTime > 0) {
56211                  this._delayTime -= t;
56212                  if (this._delayTime > 0) return;
56213                }
56214                this._currentFramePlayed ? this.time += t * this._speed : this._currentFramePlayed = !0;
56215                this._process();
56216              }
56217              sample() {
56218                const t = this.getWrappedInfo(this.time, this._wrappedInfo);
56219                this._sampleCurves(t.time);
56220                this._sampleEvents(t);
56221                this._sampleEmbeddedPlayers(t);
56222                return t;
56223              }
56224              onPlay() {
56225                var t;
56226                this.setTime(this._getPlaybackStart());
56227                this._delayTime = this._delay;
56228                this._onReplayOrResume();
56229                this.emit(WY.PLAY, this);
56230                null === (t = this._clipEmbeddedPlayerEval) || void 0 === t || t.notifyHostPlay(this.current);
56231              }
56232              onStop() {
56233                var t;
56234                this.isPaused || this._onPauseOrStop();
56235                this.emit(WY.STOP, this);
56236                null === (t = this._clipEmbeddedPlayerEval) || void 0 === t || t.notifyHostStop();
56237              }
56238              onResume() {
56239                var t;
56240                this._onReplayOrResume();
56241                this.emit(WY.RESUME, this);
56242                null === (t = this._clipEmbeddedPlayerEval) || void 0 === t || t.notifyHostPlay(this.current);
56243              }
56244              onPause() {
56245                var t;
56246                this._onPauseOrStop();
56247                this.emit(WY.PAUSE, this);
56248                null === (t = this._clipEmbeddedPlayerEval) || void 0 === t || t.notifyHostPause(this.current);
56249              }
56250              _sampleCurves(t) {
56251                const {_poseOutput: e, _clipEval: i} = this;
56252                e && (e.weight = this.weight);
56253                i && i.evaluate(t);
56254              }
56255              _process() {
56256                this._useSimpleProcess ? this.simpleProcess() : this.process();
56257              }
56258              process() {
56259                const t = this.sample();
56260                if (this._allowLastFrame) {
56261                  let e;
56262                  e = this._lastWrapInfo ? this._lastWrapInfo : this._lastWrapInfo = new Tl(t);
56263                  this.repeatCount > 1 && (0 | t.iterations) > (0 | e.iterations) && this.emit(WY.LASTFRAME, this);
56264                  e.set(t);
56265                }
56266                if (t.stopped) {
56267                  this.stop();
56268                  this.emit(WY.FINISHED, this);
56269                }
56270              }
56271              simpleProcess() {
56272                const t = this._playbackRange.min;
56273                const e = this._playbackDuration;
56274                let i = 0;
56275                let s = 0;
56276                if (0 !== e) {
56277                  i = this.time % e;
56278                  i < 0 && (i += e);
56279                  s = (t + i) * this._invDuration;
56280                }
56281                this._sampleCurves(t + i);
56282                if (this._clipEventEval || this._clipEmbeddedPlayerEval) {
56283                  const t = this.getWrappedInfo(this.time, this._wrappedInfo);
56284                  this._sampleEvents(t);
56285                  this._sampleEmbeddedPlayers(t);
56286                }
56287                if (this._allowLastFrame) {
56288                  Number.isNaN(this._lastIterations) && (this._lastIterations = s);
56289                  (this.time > 0 && this._lastIterations > s || this.time < 0 && this._lastIterations < s) && this.emit(WY.LASTFRAME, this);
56290                  this._lastIterations = s;
56291                }
56292              }
56293              _needReverse(t) {
56294                const e = this.wrapMode;
56295                let i = !1;
56296                if ((e & Sl.PingPong) === Sl.PingPong) {
56297                  t - (0 | t) == 0 && t > 0 && (t -= 1);
56298                  1 & t && (i = !i);
56299                }
56300                (e & Sl.Reverse) === Sl.Reverse && (i = !i);
56301                return i;
56302              }
56303              getWrappedInfo(t, e) {
56304                e = e || new Tl;
56305                const {_playbackRange: {min: i}, _playbackDuration: s} = this;
56306                const n = this.repeatCount;
56307                if (0 === s) {
56308                  e.time = 0;
56309                  e.ratio = 0;
56310                  e.direction = 1;
56311                  e.stopped = !!Number.isFinite(n);
56312                  e.iterations = 0;
56313                  return e;
56314                }
56315                let r = !1;
56316                let o = (t -= i) > 0 ? t / s : -t / s;
56317                if (o >= n) {
56318                  o = n;
56319                  r = !0;
56320                  let e = n - (0 | n);
56321                  0 === e && (e = 1);
56322                  t = e * s * (t > 0 ? 1 : -1);
56323                }
56324                if (t > s) {
56325                  const e = t % s;
56326                  t = 0 === e ? s : e;
56327                } else t < 0 && 0 !== (t %= s) && (t += s);
56328                let a = !1;
56329                const l = this._wrapMode & Sl.ShouldWrap;
56330                l && (a = this._needReverse(o));
56331                let h = a ? -1 : 1;
56332                this.speed < 0 && (h *= -1);
56333                l && a && (t = s - t);
56334                e.time = i + t;
56335                e.ratio = e.time / this.duration;
56336                e.direction = h;
56337                e.stopped = r;
56338                e.iterations = o;
56339                return e;
56340              }
56341              _getPlaybackStart() {
56342                return this._playbackRange.min;
56343              }
56344              _sampleEvents(t) {
56345                var e;
56346                null === (e = this._clipEventEval) || void 0 === e || e.sample(t.ratio, t.direction, t.iterations);
56347              }
56348              _sampleEmbeddedPlayers(t) {
56349                var e;
56350                null === (e = this._clipEmbeddedPlayerEval) || void 0 === e || e.evaluate(t.time, Math.trunc(t.iterations));
56351              }
56352              _emit(t, e) {
56353                this._target && this._target.isValid && this._target.emit(t, t, e);
56354              }
56355              _onReplayOrResume() {
56356                XY().addAnimation(this);
56357              }
56358              _onPauseOrStop() {
56359                XY().removeAnimation(this);
56360              }
56361            }
56362            t("AnimationState", YY);
56363            m.AnimationState = YY;
56364            var qY, KY, JY, ZY, QY;
56365            Ul("cc.animation.EmbeddedAnimationClipPlayable")(qY = (KY = (QY = class extends GY {
56366              constructor(...t) {
56367                super(...t);
56368                Ml(this, "path", JY, this);
56369                Ml(this, "clip", ZY, this);
56370              }
56371              instantiate(t) {
56372                const {clip: e, path: i} = this;
56373                if (!e) return null;
56374                const s = t.getChildByPath(i);
56375                if (!s) {
56376                  F(3938, i, t.getPathInHierarchy(), e.name);
56377                  return null;
56378                }
56379                const n = new YY(e);
56380                n.initialize(s);
56381                return new $Y(n);
56382              }
56383            }, QY), JY = Bl(KY.prototype, "path", [ Yl ], {
56384              configurable: !0,
56385              enumerable: !0,
56386              writable: !0,
56387              initializer: function() {
56388                return "";
56389              }
56390            }), ZY = Bl(KY.prototype, "clip", [ Yl ], {
56391              configurable: !0,
56392              enumerable: !0,
56393              writable: !0,
56394              initializer: function() {
56395                return null;
56396              }
56397            }), KY));
56398            class $Y extends zY {
56399              constructor(t) {
56400                super(!0);
56401                this._animationState = void 0;
56402                this._animationState = t;
56403              }
56404              destroy() {
56405                this._animationState.destroy();
56406              }
56407              play() {
56408                this._animationState.play();
56409              }
56410              pause() {
56411                this._animationState.pause();
56412              }
56413              stop() {
56414                this._animationState.stop();
56415              }
56416              setSpeed(t) {
56417                this._animationState.speed = t;
56418              }
56419              setTime(t) {
56420                this._animationState.time = t;
56421              }
56422            }
56423            var tq, eq, iq;
56424            Ul("cc.animation.EmbeddedParticleSystemPlayable")(tq = (eq = class extends GY {
56425              constructor(...t) {
56426                super(...t);
56427                Ml(this, "path", iq, this);
56428              }
56429              instantiate(t) {
56430                const e = t.getChildByPath(this.path);
56431                if (!e) {
56432                  C(`Hierarchy path ${this.path} does not exists.`);
56433                  return null;
56434                }
56435                const i = Jt("cc.ParticleSystem");
56436                if (!i) {
56437                  C("Particle system is required for embedded particle system player.");
56438                  return null;
56439                }
56440                const s = e.getComponent(i);
56441                if (!s) {
56442                  C(`${this.path} does not includes a particle system component.`);
56443                  return null;
56444                }
56445                return new sq(s);
56446              }
56447            }, iq = Bl(eq.prototype, "path", [ Yl ], {
56448              configurable: !0,
56449              enumerable: !0,
56450              writable: !0,
56451              initializer: function() {
56452                return "";
56453              }
56454            }), eq));
56455            class sq extends zY {
56456              constructor(t) {
56457                super(!1);
56458                this._particleSystem = void 0;
56459                this._particleSystem = t;
56460              }
56461              destroy() {}
56462              play() {
56463                this._particleSystem.play();
56464              }
56465              pause() {
56466                this._particleSystem.stopEmitting();
56467              }
56468              stop() {
56469                this._particleSystem.stopEmitting();
56470              }
56471              setSpeed(t) {
56472                this._particleSystem.simulationSpeed = t;
56473              }
56474            }
56475            var nq, rq, oq, aq, lq, hq, cq;
56476            function uq(t) {
56477              return "string" == typeof t || "number" == typeof t;
56478            }
56479            let _q = Ul("cc.animation.HierarchyPath")(nq = (rq = (aq = class {
56480              constructor(t) {
56481                Ml(this, "path", oq, this);
56482                this.path = t || "";
56483              }
56484              get(t) {
56485                if (!(t instanceof _y)) {
56486                  N(3925);
56487                  return null;
56488                }
56489                const e = t.getChildByPath(this.path);
56490                if (!e) {
56491                  N(3926, t.name, this.path);
56492                  return null;
56493                }
56494                return e;
56495              }
56496            }, aq), oq = Bl(rq.prototype, "path", [ Yl ], {
56497              configurable: !0,
56498              enumerable: !0,
56499              writable: !0,
56500              initializer: function() {
56501                return "";
56502              }
56503            }), rq)) || nq;
56504            let dq = Ul("cc.animation.ComponentPath")(lq = (hq = class {
56505              constructor(t) {
56506                Ml(this, "component", cq, this);
56507                this.component = t || "";
56508              }
56509              get(t) {
56510                if (!(t instanceof _y)) {
56511                  N(3927);
56512                  return null;
56513                }
56514                const e = t.getComponent(this.component);
56515                if (!e) {
56516                  N(3928, t.name, this.component);
56517                  return null;
56518                }
56519                return e;
56520              }
56521            }, cq = Bl(hq.prototype, "component", [ Yl ], {
56522              configurable: !0,
56523              enumerable: !0,
56524              writable: !0,
56525              initializer: function() {
56526                return "";
56527              }
56528            }), hq)) || lq;
56529            var pq, mq, fq, gq, yq, bq, Sq, Aq, Tq, vq, Eq, Cq, xq, wq, Rq, Iq, Mq, Bq, Dq, Pq;
56530            const Oq = Symbol("NormalizedFollow");
56531            const Nq = Symbol("ConvertAsTrsPath");
56532            const Lq = Symbol("TrackBinding");
56533            let Fq = Ul("cc.animation.TrackPath")(pq = (mq = (gq = class t {
56534              constructor() {
56535                Ml(this, "_paths", fq, this);
56536              }
56537              get length() {
56538                return this._paths.length;
56539              }
56540              toProperty(t) {
56541                this._paths.push(t);
56542                return this;
56543              }
56544              toElement(t) {
56545                this._paths.push(t);
56546                return this;
56547              }
56548              toHierarchy(t) {
56549                this._paths.push(new _q(t));
56550                return this;
56551              }
56552              toComponent(t) {
56553                const e = new dq("string" == typeof t ? t : ee.getClassName(t));
56554                this._paths.push(e);
56555                return this;
56556              }
56557              toCustomized(t) {
56558                this._paths.push(t);
56559                return this;
56560              }
56561              append(...t) {
56562                const e = this._paths.concat(...t.map((t => t._paths)));
56563                this._paths = e;
56564                return this;
56565              }
56566              isPropertyAt(t) {
56567                return "string" == typeof this._paths[t];
56568              }
56569              parsePropertyAt(t) {
56570                return this._paths[t];
56571              }
56572              isElementAt(t) {
56573                return "number" == typeof this._paths[t];
56574              }
56575              parseElementAt(t) {
56576                return this._paths[t];
56577              }
56578              isHierarchyAt(t) {
56579                return this._paths[t] instanceof _q;
56580              }
56581              parseHierarchyAt(t) {
56582                ne(this.isHierarchyAt(t));
56583                return this._paths[t].path;
56584              }
56585              isComponentAt(t) {
56586                return this._paths[t] instanceof dq;
56587              }
56588              parseComponentAt(t) {
56589                ne(this.isComponentAt(t));
56590                return this._paths[t].component;
56591              }
56592              slice(e, i) {
56593                const s = new t;
56594                s._paths = this._paths.slice(e, i);
56595                return s;
56596              }
56597              trace(t, e, i) {
56598                var s, n;
56599                null !== (s = e) && void 0 !== s || (e = 0);
56600                null !== (n = i) && void 0 !== n || (i = this._paths.length);
56601                return this[Oq](t, e, i);
56602              }
56603              [Nq]() {
56604                const {_paths: t} = this;
56605                const e = t.length;
56606                let i = 0;
56607                let s = "";
56608                for (;i < e; ++i) {
56609                  const e = t[i];
56610                  if (!(e instanceof _q)) break;
56611                  e.path && (s ? s += `/${e.path}` : s = e.path);
56612                }
56613                if (i === e) return null;
56614                let n;
56615                if (i !== e - 1) return null;
56616                switch (t[i]) {
56617                 case "position":
56618                 case "scale":
56619                 case "rotation":
56620                 case "eulerAngles":
56621                  n = t[i];
56622                  break;
56623
56624                 default:
56625                  return null;
56626                }
56627                return {
56628                  node: s,
56629                  property: n
56630                };
56631              }
56632              [Oq](t, e, i) {
56633                const {_paths: s} = this;
56634                let n = t;
56635                for (let t = e; t < i; ++t) {
56636                  const e = s[t];
56637                  if (uq(e)) {
56638                    if (!(e in n)) {
56639                      N(3929, e);
56640                      return null;
56641                    }
56642                    n = n[e];
56643                  } else n = e.get(n);
56644                  if (null === n) break;
56645                }
56646                return n;
56647              }
56648            }, gq), fq = Bl(mq.prototype, "_paths", [ Yl ], {
56649              configurable: !0,
56650              enumerable: !0,
56651              writable: !0,
56652              initializer: function() {
56653                return [];
56654              }
56655            }), mq)) || pq;
56656            let Vq = Ul("cc.animation.TrackBinding")(yq = Zl(yq = (bq = (vq = Tq = class {
56657              constructor() {
56658                Ml(this, "path", Sq, this);
56659                Ml(this, "proxy", Aq, this);
56660              }
56661              parseTrsPath() {
56662                return this.proxy ? null : this.path[Nq]();
56663              }
56664              createRuntimeBinding(t, e, i) {
56665                const {path: s, proxy: n} = this;
56666                const r = s.length;
56667                const o = r - 1;
56668                if (0 === r || !s.isPropertyAt(o) && !s.isElementAt(o) || n) {
56669                  if (n) {
56670                    const e = s[Oq](t, 0, r);
56671                    if (null === e) return null;
56672                    const i = n.forTarget(e);
56673                    const o = {
56674                      setValue: t => {
56675                        i.set(t);
56676                      }
56677                    };
56678                    const a = i.get;
56679                    a && (o.getValue = () => a.call(i));
56680                    return o;
56681                  }
56682                  F(3921);
56683                  return null;
56684                }
56685                {
56686                  const n = s.isPropertyAt(o) ? s.parsePropertyAt(o) : s.parseElementAt(o);
56687                  const l = s[Oq](t, 0, r - 1);
56688                  if (null === l) return null;
56689                  if (e && l instanceof _y && ("position" === (a = n) || "rotation" === a || "scale" === a || "eulerAngles" === a)) {
56690                    return e.createPoseWriter(l, n, i);
56691                  }
56692                  let h;
56693                  let c;
56694                  h = t => {
56695                    l[n] = t;
56696                  };
56697                  c = () => l[n];
56698                  return {
56699                    target: l,
56700                    setValue: h,
56701                    getValue: c
56702                  };
56703                }
56704                var a;
56705              }
56706              isMaskedOff(t) {
56707                const e = this.parseTrsPath();
56708                if (!e) return !1;
56709                const i = t.joints[Symbol.iterator]();
56710                for (let t = i.next(); !t.done; t = i.next()) {
56711                  const {value: i} = t;
56712                  if (i.path === e.node) return !i.enabled;
56713                }
56714                return !1;
56715              }
56716            }, Tq._animationFunctions = new WeakMap, vq), Sq = Bl(bq.prototype, "path", [ Yl ], {
56717              configurable: !0,
56718              enumerable: !0,
56719              writable: !0,
56720              initializer: function() {
56721                return new Fq;
56722              }
56723            }), Aq = Bl(bq.prototype, "proxy", [ Yl ], {
56724              configurable: !0,
56725              enumerable: !0,
56726              writable: !0,
56727              initializer: null
56728            }), bq)) || yq) || yq;
56729            let kq = Ul("cc.animation.Track")(Eq = (Cq = (wq = class {
56730              constructor() {
56731                Ml(this, "_binding", xq, this);
56732              }
56733              get path() {
56734                return this._binding.path;
56735              }
56736              set path(t) {
56737                this._binding.path = t;
56738              }
56739              get proxy() {
56740                return this._binding.proxy;
56741              }
56742              set proxy(t) {
56743                this._binding.proxy = t;
56744              }
56745              get [Lq]() {
56746                return this._binding;
56747              }
56748              channels() {
56749                return [];
56750              }
56751              range() {
56752                const t = {
56753                  min: 1 / 0,
56754                  max: -1 / 0
56755                };
56756                for (const e of this.channels()) {
56757                  t.min = Math.min(t.min, e.curve.rangeMin);
56758                  t.max = Math.max(t.max, e.curve.rangeMax);
56759                }
56760                return t;
56761              }
56762            }, wq), xq = Bl(Cq.prototype, "_binding", [ Yl ], {
56763              configurable: !0,
56764              enumerable: !0,
56765              writable: !0,
56766              initializer: function() {
56767                return new Vq;
56768              }
56769            }), Cq)) || Eq;
56770            let Uq = Ul("cc.animation.Channel")(Rq = (Iq = class {
56771              constructor(t) {
56772                this.name = "";
56773                Ml(this, "_curve", Mq, this);
56774                this._curve = t;
56775              }
56776              get curve() {
56777                return this._curve;
56778              }
56779            }, Mq = Bl(Iq.prototype, "_curve", [ Yl ], {
56780              configurable: !0,
56781              enumerable: !0,
56782              writable: !0,
56783              initializer: null
56784            }), Iq)) || Rq;
56785            let Gq = Ul("cc.animation.SingleChannelTrack")(Bq = (Dq = class extends kq {
56786              constructor() {
56787                super();
56788                Ml(this, "_channel", Pq, this);
56789                this._channel = new Uq(this.createCurve());
56790              }
56791              get channel() {
56792                return this._channel;
56793              }
56794              channels() {
56795                return [ this._channel ];
56796              }
56797              createCurve() {
56798                throw new Error("Not impl");
56799              }
56800              [OY](t) {
56801                const {curve: e} = this._channel;
56802                return new zq(e);
56803              }
56804            }, Pq = Bl(Dq.prototype, "_channel", [ Yl ], {
56805              configurable: !0,
56806              enumerable: !0,
56807              writable: !0,
56808              initializer: null
56809            }), Dq)) || Bq;
56810            class zq {
56811              constructor(t) {
56812                this._curve = t;
56813              }
56814              evaluate(t) {
56815                return this._curve.evaluate(t);
56816              }
56817            }
56818            var Hq, jq, Xq, Wq;
56819            Ul("cc.animation.RealArrayTrack")(Hq = (jq = (Wq = class extends kq {
56820              constructor(...t) {
56821                super(...t);
56822                Ml(this, "_channels", Xq, this);
56823              }
56824              get elementCount() {
56825                return this._channels.length;
56826              }
56827              set elementCount(t) {
56828                const {_channels: e} = this;
56829                const i = e.length;
56830                t < i ? this._channels.splice(t) : t > i && this._channels.push(...Array.from({
56831                  length: t - i
56832                }, (() => new Uq(new Od))));
56833              }
56834              channels() {
56835                return this._channels;
56836              }
56837              [OY]() {
56838                return new Yq(this._channels.map((({curve: t}) => t)));
56839              }
56840            }, Wq), Xq = Bl(jq.prototype, "_channels", [ Yl ], {
56841              configurable: !0,
56842              enumerable: !0,
56843              writable: !0,
56844              initializer: function() {
56845                return [];
56846              }
56847            }), jq));
56848            class Yq {
56849              constructor(t) {
56850                this._curves = t;
56851                this._result = new Array(t.length).fill(0);
56852              }
56853              evaluate(t, e) {
56854                const {_result: i} = this;
56855                const s = i.length;
56856                for (let e = 0; e < s; ++e) i[e] = this._curves[e].evaluate(t);
56857                return this._result;
56858              }
56859            }
56860            var qq, Kq, Jq, Zq, Qq, $q;
56861            let tK = Ul("cc.animation.UniformProxyFactory")(qq = (Kq = ($q = class {
56862              constructor(t, e) {
56863                Ml(this, "passIndex", Jq, this);
56864                Ml(this, "uniformName", Zq, this);
56865                Ml(this, "channelIndex", Qq, this);
56866                this.passIndex = e || 0;
56867                this.uniformName = t || "";
56868              }
56869              forTarget(t) {
56870                const e = t.passes[this.passIndex];
56871                const i = e.getHandle(this.uniformName);
56872                if (!i) throw new Error(`Material "${t.name}" has no uniform "${this.uniformName}"`);
56873                if (XP.getTypeFromHandle(i) < As.SAMPLER1D) {
56874                  const s = void 0 === this.channelIndex ? i : e.getHandle(this.uniformName, this.channelIndex, As.FLOAT);
56875                  if (!s) throw new Error(`Uniform "${this.uniformName} (in material ${t.name}) has no channel ${this.channelIndex}"`);
56876                  return function(t, e) {
56877                    for (const i of t.shaderInfo.blocks) for (const t of i.members) if (t.name === e) return t.count > 1;
56878                    return !1;
56879                  }(e, this.uniformName) ? {
56880                    set: t => {
56881                      e.setUniformArray(s, t);
56882                    }
56883                  } : {
56884                    set: t => {
56885                      e.setUniform(s, t);
56886                    }
56887                  };
56888                }
56889                {
56890                  const t = XP.getBindingFromHandle(i);
56891                  const s = e.properties[this.uniformName];
56892                  const n = s && s.value ? `${s.value}${zP(s.type)}` : GP(s.type);
56893                  let r = xR.get(n);
56894                  if (!r) {
56895                    C(`Illegal texture default value: ${n}.`);
56896                    r = xR.get("default-texture");
56897                  }
56898                  return {
56899                    set: i => {
56900                      i || (i = r);
56901                      const s = i.getGFXTexture();
56902                      if (s && s.width && s.height) {
56903                        e.bindTexture(t, s);
56904                        i instanceof tm && e.bindSampler(t, zo.gfxDevice.getSampler(i.getSamplerInfo()));
56905                      }
56906                    }
56907                  };
56908                }
56909              }
56910            }, $q), Jq = Bl(Kq.prototype, "passIndex", [ Yl ], {
56911              configurable: !0,
56912              enumerable: !0,
56913              writable: !0,
56914              initializer: function() {
56915                return 0;
56916              }
56917            }), Zq = Bl(Kq.prototype, "uniformName", [ Yl ], {
56918              configurable: !0,
56919              enumerable: !0,
56920              writable: !0,
56921              initializer: function() {
56922                return "";
56923              }
56924            }), Qq = Bl(Kq.prototype, "channelIndex", [ bh ], {
56925              configurable: !0,
56926              enumerable: !0,
56927              writable: !0,
56928              initializer: function() {}
56929            }), Kq)) || qq;
56930            var eK, iK, sK, nK, rK, oK, aK, lK, hK, cK;
56931            let uK = Ul("cc.animation.MorphWeightValueProxy")(eK = (iK = (rK = class {
56932              constructor() {
56933                Ml(this, "subMeshIndex", sK, this);
56934                Ml(this, "shapeIndex", nK, this);
56935              }
56936              forTarget(t) {
56937                return {
56938                  set: e => {
56939                    t.setWeight(e, this.subMeshIndex, this.shapeIndex);
56940                  }
56941                };
56942              }
56943            }, rK), sK = Bl(iK.prototype, "subMeshIndex", [ Yl ], {
56944              configurable: !0,
56945              enumerable: !0,
56946              writable: !0,
56947              initializer: function() {
56948                return 0;
56949              }
56950            }), nK = Bl(iK.prototype, "shapeIndex", [ Yl ], {
56951              configurable: !0,
56952              enumerable: !0,
56953              writable: !0,
56954              initializer: function() {
56955                return 0;
56956              }
56957            }), iK)) || eK;
56958            let _K = Ul("cc.animation.MorphWeightsValueProxy")(oK = (aK = (hK = class {
56959              constructor() {
56960                Ml(this, "subMeshIndex", lK, this);
56961              }
56962              forTarget(t) {
56963                return {
56964                  set: e => {
56965                    t.setWeights(e, this.subMeshIndex);
56966                  }
56967                };
56968              }
56969            }, hK), lK = Bl(aK.prototype, "subMeshIndex", [ Yl ], {
56970              configurable: !0,
56971              enumerable: !0,
56972              writable: !0,
56973              initializer: function() {
56974                return 0;
56975              }
56976            }), aK)) || oK;
56977            let dK = Ul("cc.animation.MorphWeightsAllValueProxy")(cK = class {
56978              forTarget(t) {
56979                return {
56980                  set: e => {
56981                    var i, s;
56982                    const n = null !== (i = null === (s = t.mesh) || void 0 === s ? void 0 : s.struct.primitives.length) && void 0 !== i ? i : 0;
56983                    for (let i = 0; i < n; ++i) t.setWeights(e, i);
56984                  }
56985                };
56986              }
56987            }) || cK;
56988            var pK, mK, fK, gK, yK;
56989            function bK(t, e, i, s) {
56990              var n, r, o, a, l;
56991              let h = new e;
56992              let c = new e;
56993              let u = new e;
56994              let _ = Ul(t)(n = (r = class {
56995                constructor(t, i, s) {
56996                  Ml(this, "dataPoint", o, this);
56997                  Ml(this, "inTangent", a, this);
56998                  Ml(this, "outTangent", l, this);
56999                  this.dataPoint = t || new e;
57000                  this.inTangent = i || new e;
57001                  this.outTangent = s || new e;
57002                }
57003                lerp(t, e, n) {
57004                  const r = this.dataPoint;
57005                  const o = t.dataPoint;
57006                  c = i(c, this.inTangent, n);
57007                  u = i(u, t.outTangent, n);
57008                  const a = e * e * e;
57009                  const l = e * e;
57010                  const _ = a - 2 * l + e;
57011                  const d = -2 * a + 3 * l;
57012                  const p = a - l;
57013                  h = i(h, r, 2 * a - 3 * l + 1);
57014                  h = s(h, h, c, _);
57015                  h = s(h, h, o, d);
57016                  h = s(h, h, u, p);
57017                  return h;
57018                }
57019                getNoLerp() {
57020                  return this.dataPoint;
57021                }
57022              }, o = Bl(r.prototype, "dataPoint", [ Yl ], {
57023                configurable: !0,
57024                enumerable: !0,
57025                writable: !0,
57026                initializer: function() {
57027                  return new e;
57028                }
57029              }), a = Bl(r.prototype, "inTangent", [ Yl ], {
57030                configurable: !0,
57031                enumerable: !0,
57032                writable: !0,
57033                initializer: function() {
57034                  return new e;
57035                }
57036              }), l = Bl(r.prototype, "outTangent", [ Yl ], {
57037                configurable: !0,
57038                enumerable: !0,
57039                writable: !0,
57040                initializer: function() {
57041                  return new e;
57042                }
57043              }), r)) || n;
57044              if (e === Ui) {
57045                const t = _.prototype.lerp;
57046                _.prototype.lerp = function(e, i, s) {
57047                  const n = t.call(this, e, i, s);
57048                  Ui.normalize(n, n);
57049                  return n;
57050                };
57051              }
57052              return _;
57053            }
57054            const SK = bK("cc.CubicSplineVec2Value", Qi, Qi.multiplyScalar, Qi.scaleAndAdd);
57055            const AK = bK("cc.CubicSplineVec3Value", Pi, Pi.multiplyScalar, Pi.scaleAndAdd);
57056            const TK = bK("cc.CubicSplineVec4Value", is, is.multiplyScalar, is.scaleAndAdd);
57057            const vK = bK("cc.CubicSplineQuatValue", Ui, Ui.multiplyScalar, Ui.scaleAndAdd);
57058            let EK = Ul("cc.CubicSplineNumberValue")(pK = (mK = class {
57059              constructor(t, e, i) {
57060                Ml(this, "dataPoint", fK, this);
57061                Ml(this, "inTangent", gK, this);
57062                Ml(this, "outTangent", yK, this);
57063                this.dataPoint = t;
57064                this.inTangent = e;
57065                this.outTangent = i;
57066              }
57067              lerp(t, e, i) {
57068                const s = this.dataPoint;
57069                const n = t.dataPoint;
57070                const r = e * e * e;
57071                const o = e * e;
57072                return s * (2 * r - 3 * o + 1) + this.outTangent * i * (r - 2 * o + e) + n * (-2 * r + 3 * o) + t.inTangent * i * (r - o);
57073              }
57074              getNoLerp() {
57075                return this.dataPoint;
57076              }
57077            }, fK = Bl(mK.prototype, "dataPoint", [ Yl ], {
57078              configurable: !0,
57079              enumerable: !0,
57080              writable: !0,
57081              initializer: function() {
57082                return 0;
57083              }
57084            }), gK = Bl(mK.prototype, "inTangent", [ Yl ], {
57085              configurable: !0,
57086              enumerable: !0,
57087              writable: !0,
57088              initializer: function() {
57089                return 0;
57090              }
57091            }), yK = Bl(mK.prototype, "outTangent", [ Yl ], {
57092              configurable: !0,
57093              enumerable: !0,
57094              writable: !0,
57095              initializer: function() {
57096                return 0;
57097              }
57098            }), mK)) || pK;
57099            var CK;
57100            let xK = Ul("cc.animation.RealTrack")(CK = class extends Gq {
57101              createCurve() {
57102                return new Od;
57103              }
57104            }) || CK;
57105            function wK(t) {
57106              return 0 === t.keyFramesCount ? void 0 : t;
57107            }
57108            var RK, IK, MK, BK, DK;
57109            const PK = [ "X", "Y", "Z", "W" ];
57110            let OK = Ul("cc.animation.VectorTrack")(RK = (IK = (DK = class extends kq {
57111              constructor() {
57112                super();
57113                Ml(this, "_channels", MK, this);
57114                Ml(this, "_nComponents", BK, this);
57115                this._channels = new Array(4);
57116                for (let t = 0; t < this._channels.length; ++t) {
57117                  const e = new Uq(new Od);
57118                  e.name = PK[t];
57119                  this._channels[t] = e;
57120                }
57121              }
57122              get componentsCount() {
57123                return this._nComponents;
57124              }
57125              set componentsCount(t) {
57126                this._nComponents = t;
57127              }
57128              channels() {
57129                return this._channels;
57130              }
57131              [OY]() {
57132                switch (this._nComponents) {
57133                 default:
57134                 case 2:
57135                  return new NK(wK(this._channels[0].curve), wK(this._channels[1].curve));
57136
57137                 case 3:
57138                  return new LK(wK(this._channels[0].curve), wK(this._channels[1].curve), wK(this._channels[2].curve));
57139
57140                 case 4:
57141                  return new FK(wK(this._channels[0].curve), wK(this._channels[1].curve), wK(this._channels[2].curve), wK(this._channels[3].curve));
57142                }
57143              }
57144            }, DK), MK = Bl(IK.prototype, "_channels", [ Yl ], {
57145              configurable: !0,
57146              enumerable: !0,
57147              writable: !0,
57148              initializer: null
57149            }), BK = Bl(IK.prototype, "_nComponents", [ Yl ], {
57150              configurable: !0,
57151              enumerable: !0,
57152              writable: !0,
57153              initializer: function() {
57154                return 4;
57155              }
57156            }), IK)) || RK;
57157            class NK {
57158              constructor(t, e) {
57159                this._result = new Qi;
57160                this._x = t;
57161                this._y = e;
57162              }
57163              evaluate(t, e) {
57164                this._x && this._y || !e.getValue || Qi.copy(this._result, e.getValue());
57165                this._x && (this._result.x = this._x.evaluate(t));
57166                this._y && (this._result.y = this._y.evaluate(t));
57167                return this._result;
57168              }
57169            }
57170            class LK {
57171              constructor(t, e, i) {
57172                this._result = new Pi;
57173                this._x = t;
57174                this._y = e;
57175                this._z = i;
57176              }
57177              evaluate(t, e) {
57178                this._x && this._y && this._z || !e.getValue || Pi.copy(this._result, e.getValue());
57179                this._x && (this._result.x = this._x.evaluate(t));
57180                this._y && (this._result.y = this._y.evaluate(t));
57181                this._z && (this._result.z = this._z.evaluate(t));
57182                return this._result;
57183              }
57184            }
57185            class FK {
57186              constructor(t, e, i, s) {
57187                this._result = new is;
57188                this._x = t;
57189                this._y = e;
57190                this._z = i;
57191                this._w = s;
57192              }
57193              evaluate(t, e) {
57194                this._x && this._y && this._z && this._w || !e.getValue || is.copy(this._result, e.getValue());
57195                this._x && (this._result.x = this._x.evaluate(t));
57196                this._y && (this._result.y = this._y.evaluate(t));
57197                this._z && (this._result.z = this._z.evaluate(t));
57198                this._w && (this._result.w = this._w.evaluate(t));
57199                return this._result;
57200              }
57201            }
57202            var VK;
57203            let kK = Ul("cc.animation.QuatTrack")(VK = class extends Gq {
57204              createCurve() {
57205                return new Sp;
57206              }
57207              [OY]() {
57208                return new UK(this.channels()[0].curve);
57209              }
57210            }) || VK;
57211            class UK {
57212              constructor(t) {
57213                this._result = new Ui;
57214                this._curve = t;
57215              }
57216              evaluate(t) {
57217                this._curve.evaluate(t, this._result);
57218                return this._result;
57219              }
57220            }
57221            var GK, zK, HK;
57222            const jK = [ "Red", "Green", "Blue", "Alpha" ];
57223            let XK = Ul("cc.animation.ColorTrack")(GK = (zK = class extends kq {
57224              constructor() {
57225                super();
57226                Ml(this, "_channels", HK, this);
57227                this._channels = new Array(4);
57228                for (let t = 0; t < this._channels.length; ++t) {
57229                  const e = new Uq(new Od);
57230                  e.name = jK[t];
57231                  this._channels[t] = e;
57232                }
57233              }
57234              channels() {
57235                return this._channels;
57236              }
57237              [OY]() {
57238                return new WK(wK(this._channels[0].curve), wK(this._channels[1].curve), wK(this._channels[2].curve), wK(this._channels[3].curve));
57239              }
57240            }, HK = Bl(zK.prototype, "_channels", [ Yl ], {
57241              configurable: !0,
57242              enumerable: !0,
57243              writable: !0,
57244              initializer: null
57245            }), zK)) || GK;
57246            class WK {
57247              constructor(t, e, i, s) {
57248                this._result = new Bi;
57249                this._x = t;
57250                this._y = e;
57251                this._z = i;
57252                this._w = s;
57253              }
57254              evaluate(t, e) {
57255                this._x && this._y && this._z && this._w || !e.getValue || Bi.copy(this._result, e.getValue());
57256                this._x && (this._result.r = this._x.evaluate(t));
57257                this._y && (this._result.g = this._y.evaluate(t));
57258                this._z && (this._result.b = this._z.evaluate(t));
57259                this._w && (this._result.a = this._w.evaluate(t));
57260                return this._result;
57261              }
57262            }
57263            var YK, qK, KK;
57264            const JK = [ "Width", "Height" ];
57265            let ZK = Ul("cc.animation.SizeTrack")(YK = (qK = class extends kq {
57266              constructor() {
57267                super();
57268                Ml(this, "_channels", KK, this);
57269                this._channels = new Array(2);
57270                for (let t = 0; t < this._channels.length; ++t) {
57271                  const e = new Uq(new Od);
57272                  e.name = JK[t];
57273                  this._channels[t] = e;
57274                }
57275              }
57276              channels() {
57277                return this._channels;
57278              }
57279              [OY]() {
57280                return new QK(wK(this._channels[0].curve), wK(this._channels[1].curve));
57281              }
57282            }, KK = Bl(qK.prototype, "_channels", [ Yl ], {
57283              configurable: !0,
57284              enumerable: !0,
57285              writable: !0,
57286              initializer: null
57287            }), qK)) || YK;
57288            class QK {
57289              constructor(t, e) {
57290                this._result = new rs;
57291                this._width = t;
57292                this._height = e;
57293              }
57294              evaluate(t, e) {
57295                if ((!this._width || !this._height) && e.getValue) {
57296                  const t = e.getValue();
57297                  this._result.x = t.x;
57298                  this._result.y = t.y;
57299                }
57300                this._width && (this._result.width = this._width.evaluate(t));
57301                this._height && (this._result.height = this._height.evaluate(t));
57302                return this._result;
57303              }
57304            }
57305            var $K;
57306            let tJ = Ul("cc.animation.ObjectTrack")($K = class extends Gq {
57307              createCurve() {
57308                return new Bp;
57309              }
57310            }) || $K;
57311            const eJ = Symbol("[[Owner]]");
57312            function iJ(t, e) {
57313              ne(t[eJ] === e);
57314            }
57315            function sJ(t, e) {
57316              t[eJ] = e;
57317            }
57318            function nJ(t) {
57319              t[eJ] = void 0;
57320            }
57321            let rJ;
57322            !function(t) {
57323              t[t.FLOAT = 0] = "FLOAT";
57324              t[t.BOOLEAN = 1] = "BOOLEAN";
57325              t[t.TRIGGER = 2] = "TRIGGER";
57326              t[t.INTEGER = 3] = "INTEGER";
57327            }(rJ || (rJ = {}));
57328            let oJ;
57329            !function(t) {
57330              t[t.AFTER_CONSUMED = 0] = "AFTER_CONSUMED";
57331              t[t.NEXT_FRAME_OR_AFTER_CONSUMED = 1] = "NEXT_FRAME_OR_AFTER_CONSUMED";
57332            }(oJ || (oJ = {}));
57333            class aJ {
57334              constructor(t, e) {
57335                this.type = void 0;
57336                this.resetMode = oJ.AFTER_CONSUMED;
57337                this._value = void 0;
57338                this._refs = [];
57339                this.type = t;
57340                this._value = e;
57341              }
57342              get value() {
57343                return this._value;
57344              }
57345              set value(t) {
57346                this._value = t;
57347                for (const {fn: e, thisArg: i, args: s} of this._refs) e.call(i, t, ...s);
57348              }
57349              bind(t, e, ...i) {
57350                this._refs.push({
57351                  fn: t,
57352                  thisArg: e,
57353                  args: i
57354                });
57355                return this._value;
57356              }
57357            }
57358            class lJ extends Error {
57359              constructor(t) {
57360                super(`${t} transition is invalid`);
57361                this.name = "TransitionRejectError";
57362              }
57363            }
57364            class hJ extends Error {
57365              constructor(t) {
57366                super(`Graph variable ${t} is not defined`);
57367              }
57368            }
57369            class cJ extends Error {
57370              constructor(t, e, i) {
57371                super(`Expect graph variable ${t} to have type '${e}' instead of received '${null != i ? i : typeof i}'`);
57372              }
57373            }
57374            const uJ = Symbol("[[createEval]]");
57375            var _J, dJ, pJ, mJ, fJ, gJ, yJ;
57376            const bJ = Symbol("[[Outgoing transitions]]");
57377            const SJ = Symbol("[[Incoming transitions]]");
57378            let AJ = Ul("cc.animation.State")(_J = (dJ = class extends Ch {
57379              constructor() {
57380                super();
57381                Ml(this, "name", pJ, this);
57382                this[bJ] = [];
57383                this[SJ] = [];
57384              }
57385            }, pJ = Bl(dJ.prototype, "name", [ Yl ], {
57386              configurable: !0,
57387              enumerable: !0,
57388              writable: !0,
57389              initializer: function() {
57390                return "";
57391              }
57392            }), dJ)) || _J;
57393            let TJ = Ul("cc.animation.InteractiveState")(mJ = (fJ = (yJ = class extends AJ {
57394              constructor(...t) {
57395                super(...t);
57396                Ml(this, "_components", gJ, this);
57397              }
57398              get components() {
57399                return this._components;
57400              }
57401              addComponent(t) {
57402                const e = new t;
57403                this._components.push(e);
57404                return e;
57405              }
57406              removeComponent(t) {
57407                at(this._components, t);
57408              }
57409              instantiateComponents() {
57410                return this._components.map((t => d_(t)));
57411              }
57412            }, yJ), gJ = Bl(fJ.prototype, "_components", [ Yl ], {
57413              configurable: !0,
57414              enumerable: !0,
57415              writable: !0,
57416              initializer: function() {
57417                return [];
57418              }
57419            }), fJ)) || mJ;
57420            var vJ, EJ, CJ, xJ, wJ, RJ, IJ;
57421            let MJ = Ul("cc.animation.Motion")(vJ = (EJ = (IJ = class t extends TJ {
57422              constructor(...t) {
57423                super(...t);
57424                Ml(this, "motion", CJ, this);
57425                Ml(this, "speed", xJ, this);
57426                Ml(this, "speedMultiplier", wJ, this);
57427                Ml(this, "speedMultiplierEnabled", RJ, this);
57428              }
57429              clone() {
57430                var e, i;
57431                const s = new t;
57432                s.motion = null !== (e = null === (i = this.motion) || void 0 === i ? void 0 : i.clone()) && void 0 !== e ? e : null;
57433                s.speed = this.speed;
57434                s.speedMultiplier = this.speedMultiplier;
57435                s.speedMultiplierEnabled = this.speedMultiplierEnabled;
57436                return s;
57437              }
57438            }, IJ), CJ = Bl(EJ.prototype, "motion", [ Yl ], {
57439              configurable: !0,
57440              enumerable: !0,
57441              writable: !0,
57442              initializer: function() {
57443                return null;
57444              }
57445            }), xJ = Bl(EJ.prototype, "speed", [ Yl ], {
57446              configurable: !0,
57447              enumerable: !0,
57448              writable: !0,
57449              initializer: function() {
57450                return 1;
57451              }
57452            }), wJ = Bl(EJ.prototype, "speedMultiplier", [ Yl ], {
57453              configurable: !0,
57454              enumerable: !0,
57455              writable: !0,
57456              initializer: function() {
57457                return "";
57458              }
57459            }), RJ = Bl(EJ.prototype, "speedMultiplierEnabled", [ Yl ], {
57460              configurable: !0,
57461              enumerable: !0,
57462              writable: !0,
57463              initializer: function() {
57464                return !1;
57465              }
57466            }), EJ)) || vJ;
57467            function BJ(t, e, i) {
57468              re(t, e);
57469              re(t, i);
57470              if (e === i) return t;
57471              const s = t[e];
57472              if (e < i) for (let s = e + 1; s <= i; ++s) t[s - 1] = t[s]; else for (let s = e; s !== i; --s) t[s] = t[s - 1];
57473              t[i] = s;
57474              return t;
57475            }
57476            const DJ = Symbol("[[OnAfterDeserialized]]");
57477            var PJ, OJ, NJ, LJ, FJ, VJ, kJ, UJ, GJ, zJ, HJ, jJ, XJ, WJ, YJ, qJ, KJ, JJ, ZJ, QJ, $J, tZ, eZ, iZ, sZ, nZ, rZ, oZ, aZ, lZ, hZ, cZ, uZ, _Z, dZ, pZ, mZ, fZ, gZ, yZ, bZ, SZ, AZ, TZ, vZ, EZ, CZ, xZ, wZ, RZ, IZ, MZ, BZ;
57478            let DZ = Ul("cc.animation.Transition")(PJ = (OJ = class extends Ch {
57479              constructor(t, e, i) {
57480                super();
57481                Ml(this, "from", NJ, this);
57482                Ml(this, "to", LJ, this);
57483                Ml(this, "conditions", FJ, this);
57484                this[eJ] = void 0;
57485                this.from = t;
57486                this.to = e;
57487                i && (this.conditions = i);
57488              }
57489            }, NJ = Bl(OJ.prototype, "from", [ Yl ], {
57490              configurable: !0,
57491              enumerable: !0,
57492              writable: !0,
57493              initializer: null
57494            }), LJ = Bl(OJ.prototype, "to", [ Yl ], {
57495              configurable: !0,
57496              enumerable: !0,
57497              writable: !0,
57498              initializer: null
57499            }), FJ = Bl(OJ.prototype, "conditions", [ Yl ], {
57500              configurable: !0,
57501              enumerable: !0,
57502              writable: !0,
57503              initializer: function() {
57504                return [];
57505              }
57506            }), OJ)) || PJ;
57507            let PZ;
57508            !function(t) {
57509              t[t.NONE = 0] = "NONE";
57510              t[t.CURRENT_STATE = 1] = "CURRENT_STATE";
57511              t[t.NEXT_STATE = 2] = "NEXT_STATE";
57512              t[t.CURRENT_STATE_THEN_NEXT_STATE = 3] = "CURRENT_STATE_THEN_NEXT_STATE";
57513              t[t.NEXT_STATE_THEN_CURRENT_STATE = 4] = "NEXT_STATE_THEN_CURRENT_STATE";
57514            }(PZ || (PZ = {}));
57515            let OZ = Ul("cc.animation.AnimationTransition")(VJ = (kJ = (YJ = class extends DZ {
57516              constructor(...t) {
57517                super(...t);
57518                Ml(this, "duration", UJ, this);
57519                Ml(this, "relativeDuration", GJ, this);
57520                Ml(this, "exitConditionEnabled", zJ, this);
57521                Ml(this, "destinationStart", HJ, this);
57522                Ml(this, "relativeDestinationStart", jJ, this);
57523                Ml(this, "interruptionSource", XJ, this);
57524                Ml(this, "_exitCondition", WJ, this);
57525              }
57526              get exitCondition() {
57527                return this._exitCondition;
57528              }
57529              set exitCondition(t) {
57530                ne(t >= 0);
57531                this._exitCondition = t;
57532              }
57533              get interruptible() {
57534                return this.interruptionSource !== PZ.NONE;
57535              }
57536              set interruptible(t) {
57537                this.interruptionSource = t ? PZ.CURRENT_STATE_THEN_NEXT_STATE : PZ.NONE;
57538              }
57539            }, YJ), UJ = Bl(kJ.prototype, "duration", [ Yl ], {
57540              configurable: !0,
57541              enumerable: !0,
57542              writable: !0,
57543              initializer: function() {
57544                return .3;
57545              }
57546            }), GJ = Bl(kJ.prototype, "relativeDuration", [ Yl ], {
57547              configurable: !0,
57548              enumerable: !0,
57549              writable: !0,
57550              initializer: function() {
57551                return !1;
57552              }
57553            }), zJ = Bl(kJ.prototype, "exitConditionEnabled", [ Yl ], {
57554              configurable: !0,
57555              enumerable: !0,
57556              writable: !0,
57557              initializer: function() {
57558                return !0;
57559              }
57560            }), HJ = Bl(kJ.prototype, "destinationStart", [ Yl ], {
57561              configurable: !0,
57562              enumerable: !0,
57563              writable: !0,
57564              initializer: function() {
57565                return 0;
57566              }
57567            }), jJ = Bl(kJ.prototype, "relativeDestinationStart", [ Yl ], {
57568              configurable: !0,
57569              enumerable: !0,
57570              writable: !0,
57571              initializer: function() {
57572                return !1;
57573              }
57574            }), XJ = Bl(kJ.prototype, "interruptionSource", [ Yl ], {
57575              configurable: !0,
57576              enumerable: !0,
57577              writable: !0,
57578              initializer: function() {
57579                return PZ.NONE;
57580              }
57581            }), WJ = Bl(kJ.prototype, "_exitCondition", [ Yl ], {
57582              configurable: !0,
57583              enumerable: !0,
57584              writable: !0,
57585              initializer: function() {
57586                return 1;
57587              }
57588            }), kJ)) || VJ;
57589            let NZ = Ul("cc.animation.EmptyState")(qJ = class extends AJ {}) || qJ;
57590            let LZ = Ul("cc.animation.EmptyStateTransition")(KJ = (JJ = class extends DZ {
57591              constructor(...t) {
57592                super(...t);
57593                Ml(this, "duration", ZJ, this);
57594                Ml(this, "destinationStart", QJ, this);
57595                Ml(this, "relativeDestinationStart", $J, this);
57596              }
57597            }, ZJ = Bl(JJ.prototype, "duration", [ Yl ], {
57598              configurable: !0,
57599              enumerable: !0,
57600              writable: !0,
57601              initializer: function() {
57602                return .3;
57603              }
57604            }), QJ = Bl(JJ.prototype, "destinationStart", [ Yl ], {
57605              configurable: !0,
57606              enumerable: !0,
57607              writable: !0,
57608              initializer: function() {
57609                return 0;
57610              }
57611            }), $J = Bl(JJ.prototype, "relativeDestinationStart", [ Yl ], {
57612              configurable: !0,
57613              enumerable: !0,
57614              writable: !0,
57615              initializer: function() {
57616                return !1;
57617              }
57618            }), JJ)) || KJ;
57619            let FZ = Ul("cc.animation.StateMachine")(tZ = (eZ = (aZ = class t extends Ch {
57620              __callOnAfterDeserializeRecursive() {
57621                this[DJ]();
57622                const t = this._states.length;
57623                for (let e = 0; e < t; ++e) {
57624                  const t = this._states[e];
57625                  t instanceof VZ && t.stateMachine.__callOnAfterDeserializeRecursive();
57626                }
57627              }
57628              constructor() {
57629                super();
57630                Ml(this, "_states", iZ, this);
57631                Ml(this, "_transitions", sZ, this);
57632                Ml(this, "_entryState", nZ, this);
57633                Ml(this, "_exitState", rZ, this);
57634                Ml(this, "_anyState", oZ, this);
57635                this._entryState = this._addState(new AJ);
57636                this._entryState.name = "Entry";
57637                this._exitState = this._addState(new AJ);
57638                this._exitState.name = "Exit";
57639                this._anyState = this._addState(new AJ);
57640                this._anyState.name = "Any";
57641              }
57642              [DJ]() {
57643                this._states.forEach((t => sJ(t, this)));
57644                this._transitions.forEach((t => {
57645                  t.from[bJ].push(t);
57646                  t.to[SJ].push(t);
57647                }));
57648              }
57649              [uJ](t) {
57650                throw new Error("Method not implemented.");
57651              }
57652              get entryState() {
57653                return this._entryState;
57654              }
57655              get exitState() {
57656                return this._exitState;
57657              }
57658              get anyState() {
57659                return this._anyState;
57660              }
57661              states() {
57662                return this._states;
57663              }
57664              transitions() {
57665                return this._transitions;
57666              }
57667              getTransitionsBetween(t, e) {
57668                iJ(t, this);
57669                iJ(e, this);
57670                return t[bJ].filter((t => t.to === e));
57671              }
57672              getOutgoings(t) {
57673                iJ(t, this);
57674                return t[bJ];
57675              }
57676              getIncomings(t) {
57677                iJ(t, this);
57678                return t[SJ];
57679              }
57680              addMotion() {
57681                return this._addState(new MJ);
57682              }
57683              addSubStateMachine() {
57684                return this._addState(new VZ);
57685              }
57686              addEmpty() {
57687                return this._addState(new NZ);
57688              }
57689              remove(t) {
57690                iJ(t, this);
57691                if (t !== this.entryState && t !== this.exitState && t !== this.anyState) {
57692                  this.eraseTransitionsIncludes(t);
57693                  at(this._states, t);
57694                  nJ(t);
57695                }
57696              }
57697              connect(t, e, i) {
57698                iJ(t, this);
57699                iJ(e, this);
57700                if (e === this.entryState) throw new lJ("to-entry");
57701                if (e === this.anyState) throw new lJ("to-any");
57702                if (t === this.exitState) throw new lJ("from-exit");
57703                const s = t instanceof MJ || t === this._anyState ? new OZ(t, e, i) : t instanceof NZ ? new LZ(t, e, i) : new DZ(t, e, i);
57704                sJ(s, this);
57705                this._transitions.push(s);
57706                t[bJ].push(s);
57707                e[SJ].push(s);
57708                return s;
57709              }
57710              disconnect(t, e) {
57711                iJ(t, this);
57712                iJ(e, this);
57713                const i = t[bJ];
57714                const s = e[SJ];
57715                const n = this._transitions;
57716                const r = i.filter((t => t.to === e));
57717                const o = r.length;
57718                for (let t = 0; t < o; ++t) {
57719                  const e = r[t];
57720                  at(i, e);
57721                  ne(at(n, e));
57722                  se(lt(s, (t => t === e)));
57723                  nJ(e);
57724                }
57725              }
57726              removeTransition(t) {
57727                ne(at(this._transitions, t));
57728                se(lt(t.from[bJ], (e => e === t)));
57729                se(lt(t.to[SJ], (e => e === t)));
57730                nJ(t);
57731              }
57732              eraseOutgoings(t) {
57733                iJ(t, this);
57734                const e = t[bJ];
57735                for (let t = 0; t < e.length; ++t) {
57736                  const i = e[t];
57737                  const s = i.to;
57738                  ne(at(this._transitions, i));
57739                  se(lt(s[SJ], (t => t === i)));
57740                  nJ(i);
57741                }
57742                e.length = 0;
57743              }
57744              eraseIncomings(t) {
57745                iJ(t, this);
57746                const e = t[SJ];
57747                for (let t = 0; t < e.length; ++t) {
57748                  const i = e[t];
57749                  const s = i.from;
57750                  ne(at(this._transitions, i));
57751                  se(lt(s[bJ], (t => t === i)));
57752                  nJ(i);
57753                }
57754                e.length = 0;
57755              }
57756              eraseTransitionsIncludes(t) {
57757                this.eraseIncomings(t);
57758                this.eraseOutgoings(t);
57759              }
57760              adjustTransitionPriority(t, e) {
57761                const {from: i} = t;
57762                if (0 === e) return;
57763                const s = i[bJ];
57764                const n = s.indexOf(t);
57765                ne(n >= 0);
57766                BJ(s, n, _i(n + e, 0, s.length - 1));
57767              }
57768              clone() {
57769                const e = new t;
57770                const i = new Map;
57771                for (const t of this._states) switch (t) {
57772                 case this._entryState:
57773                  i.set(t, e._entryState);
57774                  break;
57775
57776                 case this._exitState:
57777                  i.set(t, e._exitState);
57778                  break;
57779
57780                 case this._anyState:
57781                  i.set(t, e._anyState);
57782                  break;
57783
57784                 default:
57785                  if (t instanceof MJ || t instanceof VZ) {
57786                    const s = t.clone();
57787                    e._addState(s);
57788                    i.set(t, s);
57789                  } else ne(!1);
57790                }
57791                for (const t of this._transitions) {
57792                  const s = i.get(t.from);
57793                  const n = i.get(t.to);
57794                  ne(s && n);
57795                  const r = e.connect(s, n);
57796                  r.conditions = t.conditions.map((t => t.clone()));
57797                  if (r instanceof OZ) {
57798                    ne(t instanceof OZ);
57799                    r.duration = t.duration;
57800                    r.exitConditionEnabled = t.exitConditionEnabled;
57801                    r.exitCondition = t.exitCondition;
57802                  }
57803                }
57804                return e;
57805              }
57806              _addState(t) {
57807                sJ(t, this);
57808                this._states.push(t);
57809                return t;
57810              }
57811            }, aZ), iZ = Bl(eZ.prototype, "_states", [ Yl ], {
57812              configurable: !0,
57813              enumerable: !0,
57814              writable: !0,
57815              initializer: function() {
57816                return [];
57817              }
57818            }), sZ = Bl(eZ.prototype, "_transitions", [ Yl ], {
57819              configurable: !0,
57820              enumerable: !0,
57821              writable: !0,
57822              initializer: function() {
57823                return [];
57824              }
57825            }), nZ = Bl(eZ.prototype, "_entryState", [ Yl ], {
57826              configurable: !0,
57827              enumerable: !0,
57828              writable: !0,
57829              initializer: null
57830            }), rZ = Bl(eZ.prototype, "_exitState", [ Yl ], {
57831              configurable: !0,
57832              enumerable: !0,
57833              writable: !0,
57834              initializer: null
57835            }), oZ = Bl(eZ.prototype, "_anyState", [ Yl ], {
57836              configurable: !0,
57837              enumerable: !0,
57838              writable: !0,
57839              initializer: null
57840            }), eZ)) || tZ;
57841            let VZ = Ul("cc.animation.SubStateMachine")(lZ = (hZ = (uZ = class t extends TJ {
57842              constructor(...t) {
57843                super(...t);
57844                Ml(this, "_stateMachine", cZ, this);
57845              }
57846              get stateMachine() {
57847                return this._stateMachine;
57848              }
57849              clone() {
57850                const e = new t;
57851                e._stateMachine = this._stateMachine.clone();
57852                return e;
57853              }
57854            }, uZ), cZ = Bl(hZ.prototype, "_stateMachine", [ Yl ], {
57855              configurable: !0,
57856              enumerable: !0,
57857              writable: !0,
57858              initializer: function() {
57859                return new FZ;
57860              }
57861            }), hZ)) || lZ;
57862            let kZ = Ul("cc.animation.Layer")(_Z = (dZ = class {
57863              constructor() {
57864                this[eJ] = void 0;
57865                Ml(this, "_stateMachine", pZ, this);
57866                Ml(this, "name", mZ, this);
57867                Ml(this, "weight", fZ, this);
57868                Ml(this, "mask", gZ, this);
57869                this._stateMachine = new FZ;
57870              }
57871              get stateMachine() {
57872                return this._stateMachine;
57873              }
57874            }, pZ = Bl(dZ.prototype, "_stateMachine", [ Yl ], {
57875              configurable: !0,
57876              enumerable: !0,
57877              writable: !0,
57878              initializer: null
57879            }), mZ = Bl(dZ.prototype, "name", [ Yl ], {
57880              configurable: !0,
57881              enumerable: !0,
57882              writable: !0,
57883              initializer: function() {
57884                return "";
57885              }
57886            }), fZ = Bl(dZ.prototype, "weight", [ Yl ], {
57887              configurable: !0,
57888              enumerable: !0,
57889              writable: !0,
57890              initializer: function() {
57891                return 1;
57892              }
57893            }), gZ = Bl(dZ.prototype, "mask", [ Yl ], {
57894              configurable: !0,
57895              enumerable: !0,
57896              writable: !0,
57897              initializer: function() {
57898                return null;
57899              }
57900            }), dZ)) || _Z;
57901            let UZ;
57902            !function(t) {
57903              t[t.override = 0] = "override";
57904              t[t.additive = 1] = "additive";
57905            }(UZ || (UZ = {}));
57906            ne(0 == (0 | oJ.AFTER_CONSUMED << 1));
57907            let GZ = Ul("cc.animation.PlainVariable")(yZ = (bZ = (TZ = class {
57908              constructor(t) {
57909                Ml(this, "_type", SZ, this);
57910                Ml(this, "_value", AZ, this);
57911                if (void 0 !== t) {
57912                  this._type = t;
57913                  switch (t) {
57914                   default:
57915                    break;
57916
57917                   case rJ.FLOAT:
57918                   case rJ.INTEGER:
57919                    this._value = 0;
57920                    break;
57921
57922                   case rJ.BOOLEAN:
57923                    this._value = !1;
57924                  }
57925                }
57926              }
57927              get type() {
57928                return this._type;
57929              }
57930              get value() {
57931                return this._value;
57932              }
57933              set value(t) {
57934                switch (this._type) {
57935                 default:
57936                  break;
57937
57938                 case rJ.FLOAT:
57939                  ne("number" == typeof t);
57940                  break;
57941
57942                 case rJ.INTEGER:
57943                  ne(Number.isInteger(t));
57944                  break;
57945
57946                 case rJ.BOOLEAN:
57947                  ne("boolean" == typeof t);
57948                }
57949                this._value = t;
57950              }
57951            }, TZ), SZ = Bl(bZ.prototype, "_type", [ Yl ], {
57952              configurable: !0,
57953              enumerable: !0,
57954              writable: !0,
57955              initializer: function() {
57956                return rJ.FLOAT;
57957              }
57958            }), AZ = Bl(bZ.prototype, "_value", [ Yl ], {
57959              configurable: !0,
57960              enumerable: !0,
57961              writable: !0,
57962              initializer: function() {
57963                return 0;
57964              }
57965            }), bZ)) || yZ;
57966            let zZ = Ul("cc.animation.TriggerVariable")(vZ = (EZ = (xZ = class {
57967              constructor() {
57968                Ml(this, "_flags", CZ, this);
57969              }
57970              get type() {
57971                return rJ.TRIGGER;
57972              }
57973              get value() {
57974                return !!((1 & this._flags) >> 0);
57975              }
57976              set value(t) {
57977                t ? this._flags |= 1 : this._flags &= -2;
57978              }
57979              get resetMode() {
57980                return (6 & this._flags) >> 1;
57981              }
57982              set resetMode(t) {
57983                this._flags &= -7;
57984                this._flags |= t << 1;
57985              }
57986            }, xZ), CZ = Bl(EZ.prototype, "_flags", [ Yl ], {
57987              configurable: !0,
57988              enumerable: !0,
57989              writable: !0,
57990              initializer: function() {
57991                return 0;
57992              }
57993            }), EZ)) || vZ;
57994            let HZ = Ul("cc.animation.AnimationGraph")(wZ = (RZ = (BZ = class extends gc {
57995              constructor() {
57996                super();
57997                Ml(this, "_layers", IZ, this);
57998                Ml(this, "_variables", MZ, this);
57999              }
58000              onLoaded() {
58001                const {_layers: t} = this;
58002                const e = t.length;
58003                for (let i = 0; i < e; ++i) {
58004                  t[i].stateMachine.__callOnAfterDeserializeRecursive();
58005                }
58006              }
58007              get layers() {
58008                return this._layers;
58009              }
58010              get variables() {
58011                return Object.entries(this._variables);
58012              }
58013              addLayer() {
58014                const t = new kZ;
58015                this._layers.push(t);
58016                return t;
58017              }
58018              removeLayer(t) {
58019                te.removeAt(this._layers, t);
58020              }
58021              moveLayer(t, e) {
58022                BJ(this._layers, t, e);
58023              }
58024              addBoolean(t, e = !1) {
58025                const i = new GZ(rJ.BOOLEAN);
58026                i.value = e;
58027                this._variables[t] = i;
58028              }
58029              addFloat(t, e = 0) {
58030                const i = new GZ(rJ.FLOAT);
58031                i.value = e;
58032                this._variables[t] = i;
58033              }
58034              addInteger(t, e = 0) {
58035                const i = new GZ(rJ.INTEGER);
58036                i.value = e;
58037                this._variables[t] = i;
58038              }
58039              addTrigger(t, e = !1, i = oJ.AFTER_CONSUMED) {
58040                const s = new zZ;
58041                s.resetMode = i;
58042                s.value = e;
58043                this._variables[t] = s;
58044              }
58045              removeVariable(t) {
58046                delete this._variables[t];
58047              }
58048              getVariable(t) {
58049                return this._variables[t];
58050              }
58051              renameVariable(t, e) {
58052                const {_variables: i} = this;
58053                t in i && (e in i || (this._variables = Object.entries(i).reduce(((i, [s, n]) => {
58054                  i[s === t ? e : s] = n;
58055                  return i;
58056                }), {})));
58057              }
58058            }, BZ), IZ = Bl(RZ.prototype, "_layers", [ Yl ], {
58059              configurable: !0,
58060              enumerable: !0,
58061              writable: !0,
58062              initializer: function() {
58063                return [];
58064              }
58065            }), MZ = Bl(RZ.prototype, "_variables", [ Yl ], {
58066              configurable: !0,
58067              enumerable: !0,
58068              writable: !0,
58069              initializer: function() {
58070                return {};
58071              }
58072            }), RZ)) || wZ;
58073            const jZ = Symbol("BakeNodeCurves");
58074            class XZ {
58075              static getOrExtract(t) {
58076                let e = XZ.pool.get(t);
58077                if (!e || e.samples !== t.sample) {
58078                  e && m.director.root.dataPoolManager.releaseAnimationClip(t);
58079                  const i = Math.ceil(t.sample * t.duration) + 1;
58080                  const s = t.sample;
58081                  e = t[jZ](0, s, i);
58082                  XZ.pool.set(t, e);
58083                }
58084                return e;
58085              }
58086              static destroy(t) {
58087                XZ.pool.delete(t);
58088              }
58089            }
58090            t("SkelAnimDataHub", XZ);
58091            XZ.pool = new Map;
58092            class WZ {
58093              constructor(t) {
58094                this.ratios = void 0;
58095                this._findRatio = void 0;
58096                this.ratios = t;
58097                let e;
58098                let i;
58099                let s = !0;
58100                for (let n = 1, r = t.length; n < r; n++) {
58101                  e = t[n] - t[n - 1];
58102                  if (1 === n) i = e; else if (Math.abs(e - i) > 1e-6) {
58103                    s = !1;
58104                    break;
58105                  }
58106                }
58107                this._findRatio = s ? JZ : vl;
58108              }
58109              sample(t) {
58110                return this._findRatio(this.ratios, t);
58111              }
58112            }
58113            t("RatioSampler", WZ);
58114            m.RatioSampler = WZ;
58115            class YZ {
58116              static Bezier(t) {
58117                return t;
58118              }
58119              constructor(t, e) {
58120                this.types = void 0;
58121                this.type = null;
58122                this._values = [];
58123                this._lerp = void 0;
58124                this._duration = void 0;
58125                this._array = void 0;
58126                this._duration = e;
58127                this._values = t.values;
58128                const i = t => "string" == typeof t ? t : Array.isArray(t) ? t[0] === t[1] && t[2] === t[3] ? YZ.Linear : YZ.Bezier(t) : YZ.Linear;
58129                if (void 0 !== t.easingMethod) this.type = i(t.easingMethod); else if (Array.isArray(t.easingMethods)) this.types = t.easingMethods.map(i); else if (void 0 !== t.easingMethods) {
58130                  this.types = new Array(this._values.length).fill(null);
58131                  for (const e of Object.keys(t.easingMethods)) this.types[e] = i(t.easingMethods[e]);
58132                } else this.type = null;
58133                const s = t.values[0];
58134                (void 0 === t.interpolate || t.interpolate) && (this._lerp = ZZ(s));
58135                void 0 !== t._arrayLength && (this._array = new Array(t._arrayLength));
58136              }
58137              hasLerp() {
58138                return !!this._lerp;
58139              }
58140              valueAt(t) {
58141                if (void 0 === this._array) {
58142                  const e = this._values[t];
58143                  return e && e.getNoLerp ? e.getNoLerp() : e;
58144                }
58145                for (let e = 0; e < this._array.length; ++e) this._array[e] = this._values[this._array.length * t + e];
58146                return this._array;
58147              }
58148              valueBetween(t, e, i, s, n) {
58149                if (this._lerp) {
58150                  const r = this.types ? this.types[e] : this.type;
58151                  const o = n - i;
58152                  let a = (t - i) / o;
58153                  r && (a = KZ(a, r));
58154                  if (void 0 === this._array) {
58155                    const t = this._values[e];
58156                    const i = this._values[s];
58157                    return this._lerp(t, i, a, o * this._duration);
58158                  }
58159                  for (let t = 0; t < this._array.length; ++t) {
58160                    const i = this._values[this._array.length * e + t];
58161                    const n = this._values[this._array.length * s + t];
58162                    this._array[t] = this._lerp(i, n, a, o * this._duration);
58163                  }
58164                  return this._array;
58165                }
58166                if (void 0 === this._array) return this.valueAt(e);
58167                for (let t = 0; t < this._array.length; ++t) this._array[t] = this._values[this._array.length * e + t];
58168                return this._array;
58169              }
58170              empty() {
58171                return 0 === this._values.length;
58172              }
58173              constant() {
58174                return 1 === this._values.length;
58175              }
58176            }
58177            t("AnimCurve", YZ);
58178            YZ.Linear = null;
58179            m.AnimCurve = YZ;
58180            t("EventInfo", class {
58181              constructor() {
58182                this.events = [];
58183              }
58184              add(t, e) {
58185                this.events.push({
58186                  func: t || "",
58187                  params: e || []
58188                });
58189              }
58190            });
58191            function qZ(t, e, i) {
58192              let s = e.sample(i);
58193              if (s < 0) {
58194                s = ~s;
58195                if (s <= 0) s = 0; else {
58196                  if (!(s >= e.ratios.length)) return t.valueBetween(i, s - 1, e.ratios[s - 1], s, e.ratios[s]);
58197                  s = e.ratios.length - 1;
58198                }
58199              }
58200              return t.valueAt(s);
58201            }
58202            m.sampleAnimationCurve = qZ;
58203            function KZ(t, e) {
58204              if ("string" == typeof e) {
58205                const i = Td[e];
58206                i ? t = i(t) : F(3906, e);
58207              } else Array.isArray(e) && (t = rp(e, t));
58208              return t;
58209            }
58210            function JZ(t, e) {
58211              const i = t.length - 1;
58212              if (0 === i) return 0;
58213              const s = t[0];
58214              if (e < s) return 0;
58215              const n = t[i];
58216              if (e > n) return i;
58217              const r = (e = (e - s) / (n - s)) / (1 / i);
58218              const o = 0 | r;
58219              const a = 1e-6;
58220              return r - o < a ? o : o + 1 - r < a ? o + 1 : ~(o + 1);
58221            }
58222            const ZZ = (() => {
58223              function t(t, e, i, s) {
58224                return t.lerp(e, i, s);
58225              }
58226              return e => {
58227                if (null !== e) {
58228                  if ("number" == typeof e) return pi;
58229                  if ("object" == typeof e && e.constructor) {
58230                    if (e instanceof Ui) return function() {
58231                      const t = new Ui;
58232                      return (e, i, s, n) => Ui.slerp(t, e, i, s);
58233                    }();
58234                    if (e instanceof ce) return function(t) {
58235                      const e = new t;
58236                      return (i, s, n) => {
58237                        t.lerp(e, i, s, n);
58238                        return e;
58239                      };
58240                    }(e.constructor);
58241                    if (e.constructor === Number) return pi;
58242                    if ("function" == typeof e.lerp) return t;
58243                  }
58244                }
58245              };
58246            })();
58247            var QZ, $Z, tQ, eQ, iQ, sQ, nQ;
58248            let rQ = Ul("cc.animation.UntypedTrackChannel")(QZ = ($Z = class extends Uq {
58249              constructor() {
58250                super(new Od);
58251                Ml(this, "property", tQ, this);
58252              }
58253            }, tQ = Bl($Z.prototype, "property", [ Yl ], {
58254              configurable: !0,
58255              enumerable: !0,
58256              writable: !0,
58257              initializer: function() {
58258                return "";
58259              }
58260            }), $Z)) || QZ;
58261            let oQ = Ul("cc.animation.UntypedTrack")(eQ = (iQ = (nQ = class extends kq {
58262              constructor(...t) {
58263                super(...t);
58264                Ml(this, "_channels", sQ, this);
58265              }
58266              channels() {
58267                return this._channels;
58268              }
58269              [OY](t) {
58270                if (!t.getValue) throw new Error(G(3930));
58271                const e = t => {
58272                  var e;
58273                  return null === (e = this._channels.find((e => e.property === t))) || void 0 === e ? void 0 : e.curve;
58274                };
58275                const i = t.getValue();
58276                switch (!0) {
58277                 default:
58278                  throw new Error(G(3931));
58279
58280                 case i instanceof Qi:
58281                  return new NK(e("x"), e("y"));
58282
58283                 case i instanceof Pi:
58284                  return new LK(e("x"), e("y"), e("z"));
58285
58286                 case i instanceof is:
58287                  return new FK(e("x"), e("y"), e("z"), e("w"));
58288
58289                 case i instanceof Bi:
58290                  return new WK(e("r"), e("g"), e("b"), e("a"));
58291
58292                 case i instanceof rs:
58293                  return new QK(e("width"), e("height"));
58294                }
58295              }
58296              addChannel(t) {
58297                const e = new rQ;
58298                e.property = t;
58299                this._channels.push(e);
58300                return e;
58301              }
58302              upgrade(t) {
58303                const e = (t, e) => {
58304                  const i = this.channels().find((e => e.property === t));
58305                  if (i) {
58306                    e.name = i.name;
58307                    e.curve.assignSorted(Array.from(i.curve.times()), Array.from(i.curve.values()));
58308                  }
58309                };
58310                const i = t(this.path, this.proxy);
58311                switch (i) {
58312                 default:
58313                 case "size":
58314                  break;
58315
58316                 case "vec2":
58317                 case "vec3":
58318                 case "vec4":
58319                  {
58320                    const t = new OK;
58321                    t.path = this.path;
58322                    t.proxy = this.proxy;
58323                    t.componentsCount = "vec2" === i ? 2 : "vec3" === i ? 3 : 4;
58324                    const [s, n, r, o] = t.channels();
58325                    switch (i) {
58326                     case "vec4":
58327                      e("w", o);
58328
58329                     case "vec3":
58330                      e("z", r);
58331
58332                     default:
58333                      e("x", s);
58334                      e("y", n);
58335                    }
58336                    return t;
58337                  }
58338
58339                 case "color":
58340                  {
58341                    const t = new XK;
58342                    const [i, s, n, r] = t.channels();
58343                    e("r", i);
58344                    e("g", s);
58345                    e("b", n);
58346                    e("a", r);
58347                    e("x", i);
58348                    e("y", s);
58349                    e("z", n);
58350                    e("w", r);
58351                    return t;
58352                  }
58353                }
58354                return null;
58355              }
58356            }, nQ), sQ = Bl(iQ.prototype, "_channels", [ Yl ], {
58357              configurable: !0,
58358              enumerable: !0,
58359              writable: !0,
58360              initializer: function() {
58361                return [];
58362              }
58363            }), iQ)) || eQ;
58364            class aQ {
58365              constructor(t) {
58366                this._keys = [];
58367                this._curves = [];
58368                this._commonTargets = [];
58369                this._ratioSamplers = [];
58370                this._runtimeCurves = void 0;
58371                this._data = null;
58372                this._duration = void 0;
58373                this._duration = t;
58374              }
58375              get keys() {
58376                return this._keys;
58377              }
58378              set keys(t) {
58379                this._keys = t;
58380              }
58381              get curves() {
58382                return this._curves;
58383              }
58384              set curves(t) {
58385                this._curves = t;
58386                delete this._runtimeCurves;
58387              }
58388              get commonTargets() {
58389                return this._commonTargets;
58390              }
58391              set commonTargets(t) {
58392                this._commonTargets = t;
58393              }
58394              get data() {
58395                return this._data;
58396              }
58397              getPropertyCurves() {
58398                this._runtimeCurves || this._createPropertyCurves();
58399                return this._runtimeCurves;
58400              }
58401              toTracks() {
58402                const t = [];
58403                const {keys: e, curves: i, commonTargets: s} = this;
58404                const n = (t, e, i) => {
58405                  const s = new Fq;
58406                  for (const t of e) "string" == typeof t ? s.toProperty(t) : "number" == typeof t ? s.toElement(t) : t instanceof _q ? s.toHierarchy(t.path) : t instanceof dq ? s.toComponent(t.component) : s.toCustomized(t);
58407                  t.path = s;
58408                  t.proxy = i;
58409                };
58410                const r = s.map((e => {
58411                  const i = new oQ;
58412                  n(i, e.modifiers, e.valueAdapter);
58413                  t.push(i);
58414                  return i;
58415                }));
58416                for (const s of i) {
58417                  var o;
58418                  const i = s.data;
58419                  const a = i.values;
58420                  if (0 === a.length) continue;
58421                  const l = i.keys < 0 ? [ 0 ] : e[i.keys];
58422                  const h = a[0];
58423                  const c = null === (o = i.interpolate) || void 0 === o || o;
58424                  ne("number" != typeof i._arrayLength || "number" == typeof h);
58425                  const u = new hQ(i, l.length);
58426                  const _ = t => {
58427                    n(t, s.modifiers, s.valueAdapter);
58428                  };
58429                  let d;
58430                  if ("number" == typeof s.commonTarget) {
58431                    if (!a.every((t => "number" == typeof t))) {
58432                      N(3932);
58433                      continue;
58434                    }
58435                    if (s.valueAdapter || 1 !== s.modifiers.length || "string" != typeof s.modifiers[0]) {
58436                      N(3933);
58437                      continue;
58438                    }
58439                    const t = s.modifiers[0];
58440                    const e = r[s.commonTarget];
58441                    const {curve: i} = e.addChannel(t);
58442                    d = i;
58443                  }
58444                  const p = () => {
58445                    if ("number" == typeof h) {
58446                      if (!a.every((t => "number" == typeof t))) {
58447                        N(3934);
58448                        return;
58449                      }
58450                      let e;
58451                      if (d) e = d; else {
58452                        const i = new xK;
58453                        _(i);
58454                        t.push(i);
58455                        e = i.channel.curve;
58456                      }
58457                      const i = c ? xl.LINEAR : xl.CONSTANT;
58458                      e.assignSorted(l, a.map((t => ({
58459                        value: t,
58460                        interpolationMode: i
58461                      }))));
58462                      u.convert(e);
58463                      return;
58464                    }
58465                    if ("object" == typeof h) switch (!0) {
58466                     default:
58467                      break;
58468
58469                     case lQ(a, Qi):
58470                     case lQ(a, Pi):
58471                     case lQ(a, is):
58472                      {
58473                        const e = h instanceof Qi ? 2 : h instanceof Pi ? 3 : 4;
58474                        const i = new OK;
58475                        _(i);
58476                        i.componentsCount = e;
58477                        const [{curve: s}, {curve: n}, {curve: r}, {curve: o}] = i.channels();
58478                        const d = c ? xl.LINEAR : xl.CONSTANT;
58479                        const p = t => ({
58480                          value: t,
58481                          interpolationMode: d
58482                        });
58483                        switch (e) {
58484                         case 4:
58485                          o.assignSorted(l, a.map((t => p(t.w))));
58486                          u.convert(o);
58487
58488                         case 3:
58489                          r.assignSorted(l, a.map((t => p(t.z))));
58490                          u.convert(r);
58491
58492                         default:
58493                          s.assignSorted(l, a.map((t => p(t.x))));
58494                          u.convert(s);
58495                          n.assignSorted(l, a.map((t => p(t.y))));
58496                          u.convert(n);
58497                        }
58498                        t.push(i);
58499                        return;
58500                      }
58501
58502                     case lQ(a, Ui):
58503                      {
58504                        const e = new kK;
58505                        _(e);
58506                        const i = c ? gp.SLERP : gp.CONSTANT;
58507                        e.channel.curve.assignSorted(l, a.map((t => ({
58508                          value: Ui.clone(t),
58509                          interpolationMode: i
58510                        }))));
58511                        u.convertQuatCurve(e.channel.curve);
58512                        t.push(e);
58513                        return;
58514                      }
58515
58516                     case lQ(a, Bi):
58517                      {
58518                        const e = new XK;
58519                        _(e);
58520                        const [{curve: i}, {curve: s}, {curve: n}, {curve: r}] = e.channels();
58521                        const o = c ? xl.LINEAR : xl.CONSTANT;
58522                        const h = t => ({
58523                          value: t,
58524                          interpolationMode: o
58525                        });
58526                        i.assignSorted(l, a.map((t => h(t.r))));
58527                        u.convert(i);
58528                        s.assignSorted(l, a.map((t => h(t.g))));
58529                        u.convert(s);
58530                        n.assignSorted(l, a.map((t => h(t.b))));
58531                        u.convert(n);
58532                        r.assignSorted(l, a.map((t => h(t.a))));
58533                        u.convert(r);
58534                        t.push(e);
58535                        return;
58536                      }
58537
58538                     case lQ(a, rs):
58539                      {
58540                        const e = new ZK;
58541                        _(e);
58542                        const [{curve: i}, {curve: s}] = e.channels();
58543                        const n = c ? xl.LINEAR : xl.CONSTANT;
58544                        const r = t => ({
58545                          value: t,
58546                          interpolationMode: n
58547                        });
58548                        i.assignSorted(l, a.map((t => r(t.width))));
58549                        u.convert(i);
58550                        s.assignSorted(l, a.map((t => r(t.height))));
58551                        u.convert(s);
58552                        t.push(e);
58553                        return;
58554                      }
58555
58556                     case lQ(a, EK):
58557                      {
58558                        ne(u.nil);
58559                        const e = new xK;
58560                        _(e);
58561                        const i = c ? xl.CUBIC : xl.CONSTANT;
58562                        e.channel.curve.assignSorted(l, a.map((t => ({
58563                          value: t.dataPoint,
58564                          leftTangent: t.inTangent,
58565                          rightTangent: t.outTangent,
58566                          interpolationMode: i
58567                        }))));
58568                        t.push(e);
58569                        return;
58570                      }
58571
58572                     case lQ(a, SK):
58573                     case lQ(a, AK):
58574                     case lQ(a, TK):
58575                      {
58576                        ne(u.nil);
58577                        const e = h instanceof SK ? 2 : h instanceof AK ? 3 : 4;
58578                        const i = new OK;
58579                        _(i);
58580                        i.componentsCount = e;
58581                        const [s, n, r, o] = i.channels();
58582                        const d = c ? xl.LINEAR : xl.CONSTANT;
58583                        const p = (t, e, i) => ({
58584                          value: t,
58585                          leftTangent: e,
58586                          rightTangent: i,
58587                          interpolationMode: d
58588                        });
58589                        switch (e) {
58590                         case 4:
58591                          o.curve.assignSorted(l, a.map((t => p(t.dataPoint.w, t.inTangent.w, t.outTangent.w))));
58592
58593                         case 3:
58594                          r.curve.assignSorted(l, a.map((t => p(t.dataPoint.z, t.inTangent.z, t.outTangent.z))));
58595
58596                         default:
58597                          s.curve.assignSorted(l, a.map((t => p(t.dataPoint.y, t.inTangent.y, t.outTangent.y))));
58598                          n.curve.assignSorted(l, a.map((t => p(t.dataPoint.x, t.inTangent.x, t.outTangent.x))));
58599                        }
58600                        t.push(i);
58601                        return;
58602                      }
58603
58604                     case a.every((t => t instanceof vK)):
58605                      N(3935);
58606                    }
58607                    const e = new tJ;
58608                    _(e);
58609                    e.channel.curve.assignSorted(l, a);
58610                    t.push(e);
58611                  };
58612                  p();
58613                }
58614                return t;
58615              }
58616              _createPropertyCurves() {
58617                this._ratioSamplers = this._keys.map((t => new WZ(t.map((t => t / this._duration)))));
58618                this._runtimeCurves = this._curves.map((t => ({
58619                  curve: new YZ(t.data, this._duration),
58620                  modifiers: t.modifiers,
58621                  valueAdapter: t.valueAdapter,
58622                  sampler: this._ratioSamplers[t.data.keys],
58623                  commonTarget: t.commonTarget
58624                })));
58625              }
58626            }
58627            function lQ(t, e) {
58628              return t.every((t => t instanceof e));
58629            }
58630            class hQ {
58631              constructor(t, e) {
58632                this._easingMethods = void 0;
58633                const {easingMethods: i} = t;
58634                Array.isArray(i) ? 0 === i.length && 0 !== e ? this._easingMethods = new Array(e).fill(null) : this._easingMethods = i : this._easingMethods = void 0 === i ? new Array(e).fill(t.easingMethod) : Array.from({
58635                  length: e
58636                }, ((t, e) => {
58637                  var s;
58638                  return null !== (s = i[e]) && void 0 !== s ? s : null;
58639                }));
58640              }
58641              get nil() {
58642                return !this._easingMethods || this._easingMethods.every((t => null == t));
58643              }
58644              convert(t) {
58645                const {_easingMethods: e} = this;
58646                if (!e) return;
58647                const i = t.keyFramesCount;
58648                if (t.keyFramesCount < 2) return;
58649                Array.isArray(e) && ne(i === e.length);
58650                const s = i - 1;
58651                for (let i = 0; i < s; ++i) {
58652                  const s = e[i];
58653                  s && (Array.isArray(s) ? dQ(s, t.getKeyframeTime(i), t.getKeyframeValue(i), t.getKeyframeTime(i + 1), t.getKeyframeValue(i + 1)) : cQ(s, t, i));
58654                }
58655              }
58656              convertQuatCurve(t) {
58657                const {_easingMethods: e} = this;
58658                if (!e) return;
58659                const i = t.keyFramesCount;
58660                if (t.keyFramesCount < 2) return;
58661                Array.isArray(e) && ne(i === e.length);
58662                const s = i - 1;
58663                for (let i = 0; i < s; ++i) {
58664                  const s = e[i];
58665                  s && (Array.isArray(s) ? t.getKeyframeValue(i).easingMethod = s.slice() : uQ(s, t, i));
58666                }
58667              }
58668            }
58669            function cQ(t, e, i) {
58670              ne(i !== e.keyFramesCount - 1);
58671              ne(t in _Q);
58672              const s = e.getKeyframeValue(i);
58673              const n = _Q[t];
58674              if (n === vd.CONSTANT) s.interpolationMode = xl.CONSTANT; else {
58675                s.interpolationMode = xl.LINEAR;
58676                s.easingMethod = n;
58677              }
58678            }
58679            function uQ(t, e, i) {
58680              ne(i !== e.keyFramesCount - 1);
58681              ne(t in _Q);
58682              const s = e.getKeyframeValue(i);
58683              const n = _Q[t];
58684              s.easingMethod = n;
58685            }
58686            const _Q = {
58687              constant: vd.CONSTANT,
58688              linear: vd.LINEAR,
58689              quadIn: vd.QUAD_IN,
58690              quadOut: vd.QUAD_OUT,
58691              quadInOut: vd.QUAD_IN_OUT,
58692              quadOutIn: vd.QUAD_OUT_IN,
58693              cubicIn: vd.CUBIC_IN,
58694              cubicOut: vd.CUBIC_OUT,
58695              cubicInOut: vd.CUBIC_IN_OUT,
58696              cubicOutIn: vd.CUBIC_OUT_IN,
58697              quartIn: vd.QUART_IN,
58698              quartOut: vd.QUART_OUT,
58699              quartInOut: vd.QUART_IN_OUT,
58700              quartOutIn: vd.QUART_OUT_IN,
58701              quintIn: vd.QUINT_IN,
58702              quintOut: vd.QUINT_OUT,
58703              quintInOut: vd.QUINT_IN_OUT,
58704              quintOutIn: vd.QUINT_OUT_IN,
58705              sineIn: vd.SINE_IN,
58706              sineOut: vd.SINE_OUT,
58707              sineInOut: vd.SINE_IN_OUT,
58708              sineOutIn: vd.SINE_OUT_IN,
58709              expoIn: vd.EXPO_IN,
58710              expoOut: vd.EXPO_OUT,
58711              expoInOut: vd.EXPO_IN_OUT,
58712              expoOutIn: vd.EXPO_OUT_IN,
58713              circIn: vd.CIRC_IN,
58714              circOut: vd.CIRC_OUT,
58715              circInOut: vd.CIRC_IN_OUT,
58716              circOutIn: vd.CIRC_OUT_IN,
58717              elasticIn: vd.ELASTIC_IN,
58718              elasticOut: vd.ELASTIC_OUT,
58719              elasticInOut: vd.ELASTIC_IN_OUT,
58720              elasticOutIn: vd.ELASTIC_OUT_IN,
58721              backIn: vd.BACK_IN,
58722              backOut: vd.BACK_OUT,
58723              backInOut: vd.BACK_IN_OUT,
58724              backOutIn: vd.BACK_OUT_IN,
58725              bounceIn: vd.BOUNCE_IN,
58726              bounceOut: vd.BOUNCE_OUT,
58727              bounceInOut: vd.BOUNCE_IN_OUT,
58728              bounceOutIn: vd.BOUNCE_OUT_IN,
58729              smooth: vd.SMOOTH,
58730              fade: vd.FADE
58731            };
58732            function dQ(t, e, i, s, n) {
58733              const [r, o, a, l] = t;
58734              const {value: h} = i;
58735              const {value: c} = n;
58736              const u = 3 * (s - e);
58737              const _ = 3 * (c - h);
58738              const d = r * u;
58739              const p = o * _;
58740              const m = (1 - a) * u;
58741              const f = (1 - l) * _;
58742              const g = 1 / 3;
58743              const y = p / d;
58744              const b = Math.sqrt(d * d + p * p) * g;
58745              const S = f / m;
58746              const A = Math.sqrt(m * m + f * f) * g;
58747              i.interpolationMode = xl.CUBIC;
58748              i.tangentWeightMode = (T = i.tangentWeightMode) === Rl.NONE ? Rl.RIGHT : T === Rl.LEFT ? Rl.BOTH : T;
58749              var T;
58750              i.rightTangent = y;
58751              i.rightTangentWeight = b;
58752              n.tangentWeightMode = function(t) {
58753                return t === Rl.NONE ? Rl.LEFT : t === Rl.RIGHT ? Rl.BOTH : t;
58754              }(n.tangentWeightMode);
58755              n.leftTangent = S;
58756              n.leftTangentWeight = A;
58757            }
58758            var pQ, mQ, fQ, gQ, yQ, bQ, SQ, AQ, TQ, vQ, EQ, CQ, xQ, wQ, RQ, IQ, MQ, BQ, DQ, PQ, OQ, NQ, LQ, FQ, VQ, kQ, UQ, GQ, zQ, HQ;
58759            function jQ() {
58760              throw new Error("split() only valid in Editor.");
58761            }
58762            Ul("cc.animation.ExoticAnimation")(pQ = (mQ = (gQ = class {
58763              constructor() {
58764                Ml(this, "_nodeAnimations", fQ, this);
58765              }
58766              createEvaluator(t) {
58767                return new QQ(this._nodeAnimations, t);
58768              }
58769              addNodeAnimation(t) {
58770                const e = new XQ(t);
58771                this._nodeAnimations.push(e);
58772                return e;
58773              }
58774              collectAnimatedJoints() {
58775                return Array.from(new Set(this._nodeAnimations.map((({path: t}) => t))));
58776              }
58777              split(t, e) {
58778                return jQ();
58779              }
58780              toHashString() {
58781                return this._nodeAnimations.map((t => t.toHashString())).join("\n");
58782              }
58783            }, gQ), fQ = Bl(mQ.prototype, "_nodeAnimations", [ Yl ], {
58784              configurable: !0,
58785              enumerable: !0,
58786              writable: !0,
58787              initializer: function() {
58788                return [];
58789              }
58790            }), mQ));
58791            let XQ = Ul("cc.animation.ExoticNodeAnimation")(yQ = (bQ = (EQ = class {
58792              constructor(t) {
58793                Ml(this, "_path", SQ, this);
58794                Ml(this, "_position", AQ, this);
58795                Ml(this, "_rotation", TQ, this);
58796                Ml(this, "_scale", vQ, this);
58797                this._path = t;
58798              }
58799              createPosition(t, e) {
58800                this._position = new ZQ(t, new KQ(e));
58801              }
58802              createRotation(t, e) {
58803                this._rotation = new ZQ(t, new JQ(e));
58804              }
58805              createScale(t, e) {
58806                this._scale = new ZQ(t, new KQ(e));
58807              }
58808              createEvaluator(t) {
58809                return new $Q(this._path, this._position, this._rotation, this._scale, t);
58810              }
58811              split(t, e, i) {
58812                return jQ();
58813              }
58814              get path() {
58815                return this._path;
58816              }
58817              toHashString() {
58818                var t, e, i, s, n, r;
58819                return `${this._path}\n${null !== (t = null === (e = this._position) || void 0 === e ? void 0 : e.toHashString()) && void 0 !== t ? t : ""}${null !== (i = null === (s = this._scale) || void 0 === s ? void 0 : s.toHashString()) && void 0 !== i ? i : ""}${null !== (n = null === (r = this._rotation) || void 0 === r ? void 0 : r.toHashString()) && void 0 !== n ? n : ""}`;
58820              }
58821            }, EQ), SQ = Bl(bQ.prototype, "_path", [ Yl ], {
58822              configurable: !0,
58823              enumerable: !0,
58824              writable: !0,
58825              initializer: function() {
58826                return "";
58827              }
58828            }), AQ = Bl(bQ.prototype, "_position", [ Yl ], {
58829              configurable: !0,
58830              enumerable: !0,
58831              writable: !0,
58832              initializer: function() {
58833                return null;
58834              }
58835            }), TQ = Bl(bQ.prototype, "_rotation", [ Yl ], {
58836              configurable: !0,
58837              enumerable: !0,
58838              writable: !0,
58839              initializer: function() {
58840                return null;
58841              }
58842            }), vQ = Bl(bQ.prototype, "_scale", [ Yl ], {
58843              configurable: !0,
58844              enumerable: !0,
58845              writable: !0,
58846              initializer: function() {
58847                return null;
58848              }
58849            }), bQ)) || yQ;
58850            function WQ(t) {
58851              return t.toPrecision(2);
58852            }
58853            function YQ(t) {
58854              return t.map(WQ).join(" ");
58855            }
58856            let qQ = Ul("cc.animation.ExoticVectorLikeTrackValues")(CQ = (xQ = (IQ = class {
58857              constructor(t) {
58858                Ml(this, "_values", wQ, this);
58859                Ml(this, "_isQuantized", RQ, this);
58860                this._values = t;
58861                this._isQuantized = !1;
58862              }
58863              get precision() {
58864                return this._isQuantized ? this._values.originalPrecision : s$(this._values);
58865              }
58866              quantize(t) {
58867                ne(!this._isQuantized);
58868                this._values = function(t, e) {
58869                  const i = e$[e];
58870                  const s = 1 << i.BYTES_PER_ELEMENT;
58871                  let n = Number.POSITIVE_INFINITY;
58872                  let r = Number.NEGATIVE_INFINITY;
58873                  t.forEach((t => {
58874                    n = Math.min(t, n);
58875                    r = Math.max(t, r);
58876                  }));
58877                  const o = r - n;
58878                  const a = i.from(t, (t => (t - n) / o * s));
58879                  return new n$(s$(t), a, o, n);
58880                }(this._values, t);
58881                this._isQuantized = !0;
58882              }
58883              toHashString() {
58884                const {_isQuantized: t, _values: e} = this;
58885                return `${t} ${t ? e.toHashString() : YQ(e)}`;
58886              }
58887            }, IQ), wQ = Bl(xQ.prototype, "_values", [ Yl ], {
58888              configurable: !0,
58889              enumerable: !0,
58890              writable: !0,
58891              initializer: null
58892            }), RQ = Bl(xQ.prototype, "_isQuantized", [ Yl ], {
58893              configurable: !0,
58894              enumerable: !0,
58895              writable: !0,
58896              initializer: null
58897            }), xQ)) || CQ;
58898            let KQ = Ul("cc.animation.ExoticVec3TrackValues")(MQ = class t extends qQ {
58899              static imitate(e, i) {
58900                const s = new t(e);
58901                i._isQuantized && s.quantize(i._values.quantizationType);
58902                return s;
58903              }
58904              get(t, e) {
58905                const {_values: i, _isQuantized: s} = this;
58906                s ? a$(i, t, e) : Pi.fromArray(e, i, 3 * t);
58907              }
58908              lerp(t, e, i, s, n, r) {
58909                const {_values: o, _isQuantized: a} = this;
58910                if (a) {
58911                  a$(o, t, s);
58912                  a$(o, e, n);
58913                } else {
58914                  Pi.fromArray(s, o, 3 * t);
58915                  Pi.fromArray(n, o, 3 * e);
58916                }
58917                Pi.lerp(r, s, n, i);
58918              }
58919            }) || MQ;
58920            let JQ = Ul("cc.animation.ExoticQuatTrackValues")(BQ = class t extends qQ {
58921              static imitate(e, i) {
58922                const s = new t(e);
58923                i._isQuantized && s.quantize(i._values.quantizationType);
58924                return s;
58925              }
58926              get(t, e) {
58927                const {_values: i, _isQuantized: s} = this;
58928                s ? l$(i, t, e) : Ui.fromArray(e, i, 4 * t);
58929              }
58930              lerp(t, e, i, s, n, r) {
58931                const {_values: o, _isQuantized: a} = this;
58932                if (a) {
58933                  l$(o, t, s);
58934                  l$(o, e, n);
58935                } else {
58936                  Ui.fromArray(s, o, 4 * t);
58937                  Ui.fromArray(n, o, 4 * e);
58938                }
58939                Ui.slerp(r, s, n, i);
58940              }
58941            }) || BQ;
58942            let ZQ = Ul("cc.animation.ExoticTrack")(DQ = (PQ = (LQ = class {
58943              constructor(t, e) {
58944                Ml(this, "times", OQ, this);
58945                Ml(this, "values", NQ, this);
58946                this.times = t;
58947                this.values = e;
58948              }
58949              toHashString() {
58950                const {times: t, values: e} = this;
58951                return `times: ${YQ(t)}; values: ${e.toHashString()}`;
58952              }
58953            }, LQ), OQ = Bl(PQ.prototype, "times", [ Yl ], {
58954              configurable: !0,
58955              enumerable: !0,
58956              writable: !0,
58957              initializer: null
58958            }), NQ = Bl(PQ.prototype, "values", [ Yl ], {
58959              configurable: !0,
58960              enumerable: !0,
58961              writable: !0,
58962              initializer: null
58963            }), PQ)) || DQ;
58964            class QQ {
58965              constructor(t, e) {
58966                this._nodeEvaluations = void 0;
58967                this._nodeEvaluations = t.map((t => t.createEvaluator(e)));
58968              }
58969              evaluate(t) {
58970                this._nodeEvaluations.forEach((e => {
58971                  e.evaluate(t);
58972                }));
58973              }
58974            }
58975            class $Q {
58976              constructor(t, e, i, s, n) {
58977                this._position = null;
58978                this._rotation = null;
58979                this._scale = null;
58980                e && (this._position = o$(e.times, e.values, Pi, t, "position", n));
58981                i && (this._rotation = o$(i.times, i.values, Ui, t, "rotation", n));
58982                s && (this._scale = o$(s.times, s.values, Pi, t, "scale", n));
58983              }
58984              evaluate(t) {
58985                if (this._position) {
58986                  const e = this._position.evaluator.evaluate(t);
58987                  this._position.runtimeBinding.setValue(e);
58988                }
58989                if (this._rotation) {
58990                  const e = this._rotation.evaluator.evaluate(t);
58991                  this._rotation.runtimeBinding.setValue(e);
58992                }
58993                if (this._scale) {
58994                  const e = this._scale.evaluator.evaluate(t);
58995                  this._scale.runtimeBinding.setValue(e);
58996                }
58997              }
58998            }
58999            class t$ {
59000              constructor(t, e, i) {
59001                this._times = void 0;
59002                this._inputSampleResultCache = {
59003                  just: !1,
59004                  index: -1,
59005                  nextIndex: -1,
59006                  ratio: 0
59007                };
59008                this._values = void 0;
59009                this._prevValue = void 0;
59010                this._nextValue = void 0;
59011                this._resultValue = void 0;
59012                this._times = t;
59013                this._values = e;
59014                this._prevValue = new i;
59015                this._nextValue = new i;
59016                this._resultValue = new i;
59017              }
59018              evaluate(t) {
59019                const {_times: e, _values: i, _resultValue: s} = this;
59020                if (0 === e.length) return s;
59021                const n = function(t, e, i) {
59022                  const s = t.length;
59023                  ne(0 !== s);
59024                  const n = t[0];
59025                  const r = t[s - 1];
59026                  if (e < n) {
59027                    i.just = !0;
59028                    i.index = 0;
59029                  } else if (e > r) {
59030                    i.just = !0;
59031                    i.index = s - 1;
59032                  } else {
59033                    const n = vl(t, e);
59034                    if (n >= 0) {
59035                      i.just = !0;
59036                      i.index = n;
59037                    } else {
59038                      const r = ~n;
59039                      ne(0 !== r && r !== s && s > 1);
59040                      const o = r - 1;
59041                      const a = t[o];
59042                      const l = t[r];
59043                      const h = (e - t[o]) / (l - a);
59044                      i.just = !1;
59045                      i.index = o;
59046                      i.nextIndex = r;
59047                      i.ratio = h;
59048                    }
59049                  }
59050                  return i;
59051                }(e, t, this._inputSampleResultCache);
59052                n.just ? i.get(n.index, s) : i.lerp(n.index, n.nextIndex, n.ratio, this._prevValue, this._nextValue, s);
59053                return s;
59054              }
59055            }
59056            const e$ = {
59057              uint8: Uint8Array,
59058              uint16: Uint16Array
59059            };
59060            var i$;
59061            !function(t) {
59062              t[t.FLOAT_32 = 0] = "FLOAT_32";
59063              t[t.FLOAT_64 = 1] = "FLOAT_64";
59064            }(i$ || (i$ = {}));
59065            function s$(t) {
59066              switch (t.BYTES_PER_ELEMENT) {
59067               default:
59068                ne(!1);
59069
59070               case 4:
59071                return i$.FLOAT_32;
59072
59073               case 8:
59074                return i$.FLOAT_64;
59075              }
59076            }
59077            let n$ = Ul("cc.animation.QuantizedFloatArray")(FQ = (VQ = (HQ = class {
59078              get quantizationType() {
59079                switch (this.values.BYTES_PER_ELEMENT) {
59080                 default:
59081                 case 1:
59082                  return "uint8";
59083
59084                 case 2:
59085                  return "uint16";
59086                }
59087              }
59088              constructor(t, e, i, s = 0) {
59089                Ml(this, "originalPrecision", kQ, this);
59090                Ml(this, "min", UQ, this);
59091                Ml(this, "extent", GQ, this);
59092                Ml(this, "values", zQ, this);
59093                this.originalPrecision = t;
59094                this.values = e;
59095                this.extent = i;
59096                this.min = s;
59097              }
59098              toHashString() {
59099                const {originalPrecision: t, min: e, extent: i, values: s} = this;
59100                return `${t} ${WQ(e)} ${WQ(i)} ${s.join(" ")}`;
59101              }
59102            }, HQ), kQ = Bl(VQ.prototype, "originalPrecision", [ Yl ], {
59103              configurable: !0,
59104              enumerable: !0,
59105              writable: !0,
59106              initializer: null
59107            }), UQ = Bl(VQ.prototype, "min", [ Yl ], {
59108              configurable: !0,
59109              enumerable: !0,
59110              writable: !0,
59111              initializer: null
59112            }), GQ = Bl(VQ.prototype, "extent", [ Yl ], {
59113              configurable: !0,
59114              enumerable: !0,
59115              writable: !0,
59116              initializer: null
59117            }), zQ = Bl(VQ.prototype, "values", [ Yl ], {
59118              configurable: !0,
59119              enumerable: !0,
59120              writable: !0,
59121              initializer: null
59122            }), VQ)) || FQ;
59123            function r$(t, e) {
59124              return t.values[e] / (1 << t.values.BYTES_PER_ELEMENT) * t.extent + t.min;
59125            }
59126            function o$(t, e, i, s, n, r) {
59127              const o = new Vq;
59128              o.path = (new Fq).toHierarchy(s).toProperty(n);
59129              const a = r(o);
59130              if (!a) return null;
59131              return {
59132                runtimeBinding: a,
59133                evaluator: new t$(t, e, i)
59134              };
59135            }
59136            function a$(t, e, i) {
59137              Pi.set(i, r$(t, 3 * e + 0), r$(t, 3 * e + 1), r$(t, 3 * e + 2));
59138            }
59139            function l$(t, e, i) {
59140              Ui.set(i, r$(t, 4 * e + 0), r$(t, 4 * e + 1), r$(t, 4 * e + 2), r$(t, 4 * e + 3));
59141            }
59142            var h$, c$, u$, _$, d$, p$, m$, f$, g$, y$, b$, S$, A$, T$;
59143            const v$ = Symbol("SearchForRootBonePath");
59144            const E$ = Symbol("ExoticAnimation");
59145            const C$ = Symbol("[[EmbeddedPlayerCount]]");
59146            const x$ = Symbol("[[GetEmbeddedPlayers]]");
59147            const w$ = Symbol("[[AddEmbeddedPlayer]]");
59148            const R$ = Symbol("[[RemoveEmbeddedPlayer]]");
59149            const I$ = Symbol("[[ClearEmbeddedPlayers]]");
59150            let M$ = t("AnimationClip", Ul("cc.AnimationClip")(h$ = (c$ = (T$ = A$ = class t extends gc {
59151              constructor(...t) {
59152                super(...t);
59153                Ml(this, "sample", u$, this);
59154                Ml(this, "speed", _$, this);
59155                Ml(this, "wrapMode", d$, this);
59156                Ml(this, "enableTrsBlending", p$, this);
59157                Ml(this, "_duration", m$, this);
59158                Ml(this, "_hash", f$, this);
59159                this.frameRate = 0;
59160                Ml(this, "_tracks", g$, this);
59161                Ml(this, "_exoticAnimation", y$, this);
59162                this._legacyData = void 0;
59163                this._legacyDataDirty = !1;
59164                Ml(this, "_events", b$, this);
59165                Ml(this, "_embeddedPlayers", S$, this);
59166                this._runtimeEvents = {
59167                  ratios: [],
59168                  eventGroups: []
59169                };
59170              }
59171              static createWithSpriteFrames(e, i) {
59172                const s = new t;
59173                s.sample = i || s.sample;
59174                s.duration = e.length / s.sample;
59175                const n = 1 / s.sample;
59176                const r = new tJ;
59177                r.path = (new Fq).toComponent("cc.Sprite").toProperty("spriteFrame");
59178                r.channels()[0].curve.assignSorted(e.map(((t, e) => [ n * e, t ])));
59179                s.addTrack(r);
59180                return s;
59181              }
59182              get duration() {
59183                return this._duration;
59184              }
59185              set duration(t) {
59186                this._duration = t;
59187              }
59188              get tracksCount() {
59189                return this._tracks.length;
59190              }
59191              get tracks() {
59192                return this._tracks;
59193              }
59194              get hash() {
59195                var t, e;
59196                if (this._hash) return this._hash;
59197                const i = `Exotic:${null !== (t = null === (e = this._exoticAnimation) || void 0 === e ? void 0 : e.toHashString()) && void 0 !== t ? t : ""}`;
59198                return this._hash = Ur(i, 666);
59199              }
59200              get events() {
59201                return this._events;
59202              }
59203              set events(t) {
59204                this._events = t;
59205                const e = [];
59206                const i = [];
59207                const s = this.events.sort(((t, e) => t.frame - e.frame));
59208                const n = s.length;
59209                for (let t = 0; t < n; ++t) {
59210                  const n = s[t];
59211                  const r = n.frame / this._duration;
59212                  let o = e.findIndex((t => t === r));
59213                  if (o < 0) {
59214                    o = e.length;
59215                    e.push(r);
59216                    i.push({
59217                      events: []
59218                    });
59219                  }
59220                  i[o].events.push({
59221                    functionName: n.func,
59222                    parameters: n.params
59223                  });
59224                }
59225                this._runtimeEvents = {
59226                  ratios: e,
59227                  eventGroups: i
59228                };
59229              }
59230              get [E$]() {
59231                return this._exoticAnimation;
59232              }
59233              set [E$](t) {
59234                this._exoticAnimation = t;
59235              }
59236              onLoaded() {
59237                this.frameRate = this.sample;
59238                this.events = this._events;
59239              }
59240              range() {
59241                const t = {
59242                  min: 1 / 0,
59243                  max: -1 / 0
59244                };
59245                const {_tracks: e} = this;
59246                const i = e.length;
59247                for (let s = 0; s < i; ++s) {
59248                  const i = e[s].range();
59249                  t.min = Math.min(t.min, i.min);
59250                  t.max = Math.max(t.max, i.max);
59251                }
59252                return t;
59253              }
59254              getTrack(t) {
59255                return this._tracks[t];
59256              }
59257              addTrack(t) {
59258                const e = this._tracks.length;
59259                this._tracks.push(t);
59260                return e;
59261              }
59262              removeTrack(t) {
59263                this._tracks.splice(t, 1);
59264              }
59265              clearTracks() {
59266                this._tracks.length = 0;
59267              }
59268              containsAnyEvent() {
59269                return 0 !== this._events.length;
59270              }
59271              createEventEvaluator(t) {
59272                return new k$(t, this._runtimeEvents.ratios, this._runtimeEvents.eventGroups, this.wrapMode);
59273              }
59274              containsAnyEmbeddedPlayer() {
59275                return 0 !== this._embeddedPlayers.length;
59276              }
59277              createEmbeddedPlayerEvaluator(t) {
59278                return new B$(this._embeddedPlayers, t);
59279              }
59280              createEvaluator(t) {
59281                const {target: e} = t;
59282                return this._createEvalWithBinder(e, (i => {
59283                  if (t.mask && i.isMaskedOff(t.mask)) return;
59284                  const s = i.createRuntimeBinding(e, this.enableTrsBlending ? t.pose : void 0, !1);
59285                  s || N(3937, this.name, t.target instanceof _y ? t.target.name : t.target);
59286                  return null != s ? s : void 0;
59287                }), t.rootMotion);
59288              }
59289              destroy() {
59290                var t;
59291                (null === (t = m.director.root) || void 0 === t ? void 0 : t.dataPoolManager) && m.director.root.dataPoolManager.releaseAnimationClip(this);
59292                XZ.destroy(this);
59293                return super.destroy();
59294              }
59295              [jZ](t, e, i) {
59296                const s = 1 / e;
59297                const n = this._collectAnimatedJoints();
59298                const r = n.length;
59299                const o = {};
59300                for (let t = 0; t < r; ++t) {
59301                  o[n[t]] = {
59302                    transforms: Array.from({
59303                      length: i
59304                    }, (() => new qi))
59305                  };
59306                }
59307                const a = n.reduce(((t, e) => {
59308                  t[e] = new O$;
59309                  return t;
59310                }), {});
59311                for (const t in a) {
59312                  const e = a[t];
59313                  const i = t.lastIndexOf("/");
59314                  if (i >= 0) {
59315                    const s = t.substring(0, i);
59316                    const n = a[s];
59317                    n && (e.parent = n);
59318                  }
59319                }
59320                const l = this._createEvalWithBinder(void 0, (t => {
59321                  const e = t.parseTrsPath();
59322                  if (!e) return;
59323                  const i = a[e.node];
59324                  return i ? V$(i, e.property) : void 0;
59325                }), void 0);
59326                for (let e = 0; e < i; ++e) {
59327                  const i = t + s * e;
59328                  l.evaluate(i);
59329                  for (let t = 0; t < r; ++t) {
59330                    const i = n[t];
59331                    qi.copy(o[i].transforms[e], a[i].globalTransform);
59332                  }
59333                  for (let t = 0; t < r; ++t) {
59334                    const e = n[t];
59335                    a[e].invalidate();
59336                  }
59337                }
59338                return {
59339                  samples: e,
59340                  frames: i,
59341                  joints: o
59342                };
59343              }
59344              upgradeUntypedTracks(t) {
59345                const e = [];
59346                const i = [];
59347                const {_tracks: s} = this;
59348                const n = s.length;
59349                for (let r = 0; r < n; ++r) {
59350                  const n = s[r];
59351                  if (!(n instanceof oQ)) continue;
59352                  const o = n.upgrade(t);
59353                  if (o) {
59354                    e.push(o);
59355                    i.push(n);
59356                  }
59357                }
59358                const r = i.length;
59359                for (let t = 0; t < r; ++t) te.remove(s, i[t]);
59360                s.push(...e);
59361              }
59362              [v$]() {
59363                return this._searchForRootBonePath();
59364              }
59365              get keys() {
59366                return this._getLegacyData().keys;
59367              }
59368              set keys(t) {
59369                this._legacyDataDirty = !0;
59370                this._getLegacyData().keys = t;
59371              }
59372              get curves() {
59373                this._legacyDataDirty = !0;
59374                return this._getLegacyData().curves;
59375              }
59376              set curves(t) {
59377                this._getLegacyData().curves = t;
59378              }
59379              get commonTargets() {
59380                return this._getLegacyData().commonTargets;
59381              }
59382              set commonTargets(t) {
59383                this._legacyDataDirty = !0;
59384                this._getLegacyData().commonTargets = t;
59385              }
59386              get data() {
59387                return this._getLegacyData().data;
59388              }
59389              getPropertyCurves() {
59390                return this._getLegacyData().getPropertyCurves();
59391              }
59392              get eventGroups() {
59393                return this._runtimeEvents.eventGroups;
59394              }
59395              updateEventDatas() {
59396                this.events = this._events;
59397              }
59398              hasEvents() {
59399                return 0 !== this.events.length;
59400              }
59401              syncLegacyData() {
59402                if (this._legacyData) {
59403                  this._fromLegacy(this._legacyData);
59404                  this._legacyData = void 0;
59405                }
59406              }
59407              get [C$]() {
59408                return this._embeddedPlayers.length;
59409              }
59410              [x$]() {
59411                return this._embeddedPlayers;
59412              }
59413              [w$](t) {
59414                this._embeddedPlayers.push(t);
59415              }
59416              [R$](t) {
59417                const e = this._embeddedPlayers.indexOf(t);
59418                e >= 0 && this._embeddedPlayers.splice(e, 1);
59419              }
59420              [I$]() {
59421                this._embeddedPlayers.length = 0;
59422              }
59423              _createEvalWithBinder(t, e, i) {
59424                if (this._legacyDataDirty) {
59425                  this._legacyDataDirty = !1;
59426                  this.syncLegacyData();
59427                }
59428                const s = [];
59429                let n;
59430                i && (n = this._createRootMotionEvaluation(t, i, s));
59431                const r = [];
59432                let o;
59433                const {_tracks: a} = this;
59434                const l = a.length;
59435                for (let t = 0; t < l; ++t) {
59436                  const i = a[t];
59437                  if (s.includes(i)) continue;
59438                  if (Array.from(i.channels()).every((({curve: t}) => 0 === t.keyFramesCount))) continue;
59439                  const n = e(i[Lq]);
59440                  if (!n) continue;
59441                  const o = i[OY](n);
59442                  r.push({
59443                    binding: n,
59444                    trackEval: o
59445                  });
59446                }
59447                this._exoticAnimation && (o = this._exoticAnimation.createEvaluator(e));
59448                return new D$(r, o, n);
59449              }
59450              _createRootMotionEvaluation(t, e, i) {
59451                if (!(t instanceof _y)) {
59452                  F(3920);
59453                  return;
59454                }
59455                const s = this._searchForRootBonePath();
59456                if (!s) {
59457                  N(3923);
59458                  return;
59459                }
59460                const n = t.getChildByPath(s);
59461                if (!n) {
59462                  N(3924);
59463                  return;
59464                }
59465                const r = new P$;
59466                const o = [];
59467                const {_tracks: a} = this;
59468                const l = a.length;
59469                for (let t = 0; t < l; ++t) {
59470                  const e = a[t];
59471                  const {[Lq]: n} = e;
59472                  const l = n.parseTrsPath();
59473                  if (!l) continue;
59474                  if (l.node !== s) continue;
59475                  i.push(e);
59476                  const h = V$(r, l.property);
59477                  if (!h) continue;
59478                  const c = e[OY](h);
59479                  o.push({
59480                    binding: h,
59481                    trackEval: c
59482                  });
59483                }
59484                return new L$(n, this._duration, r, o);
59485              }
59486              _searchForRootBonePath() {
59487                const t = this._tracks.map((t => {
59488                  const e = t[Lq].parseTrsPath();
59489                  if (e) {
59490                    const t = e.node;
59491                    return {
59492                      path: t,
59493                      rank: t.split("/").length
59494                    };
59495                  }
59496                  return {
59497                    path: "",
59498                    rank: 0
59499                  };
59500                }));
59501                t.sort(((t, e) => t.rank - e.rank));
59502                const e = t.findIndex((t => 0 !== t.rank));
59503                if (e < 0) return "";
59504                const i = t.length;
59505                const s = t[e];
59506                let n = !0;
59507                for (let r = e + 1; r < i; ++r) {
59508                  const e = t[r];
59509                  if (e.rank !== s.rank) break;
59510                  if (e.path !== s.path) {
59511                    n = !1;
59512                    break;
59513                  }
59514                }
59515                return n ? s.path : "";
59516              }
59517              _getLegacyData() {
59518                this._legacyData || (this._legacyData = this._toLegacy());
59519                return this._legacyData;
59520              }
59521              _toLegacy() {
59522                const t = new aQ(this._duration);
59523                t.keys = [];
59524                t.curves = [];
59525                t.commonTargets = [];
59526                return t;
59527              }
59528              _fromLegacy(t) {
59529                const e = t.toTracks();
59530                const i = e.length;
59531                for (let t = 0; t < i; ++t) this.addTrack(e[t]);
59532              }
59533              _collectAnimatedJoints() {
59534                const t = new Set;
59535                const {_tracks: e} = this;
59536                const i = e.length;
59537                for (let s = 0; s < i; ++s) {
59538                  const i = e[s][Lq].parseTrsPath();
59539                  i && t.add(i.node);
59540                }
59541                if (this._exoticAnimation) {
59542                  const e = this._exoticAnimation.collectAnimatedJoints();
59543                  const i = e.length;
59544                  for (let s = 0; s < i; ++s) t.add(e[s]);
59545                }
59546                return Array.from(t);
59547              }
59548            }, A$.WrapMode = Al, T$), u$ = Bl(c$.prototype, "sample", [ Yl ], {
59549              configurable: !0,
59550              enumerable: !0,
59551              writable: !0,
59552              initializer: function() {
59553                return 60;
59554              }
59555            }), _$ = Bl(c$.prototype, "speed", [ Yl ], {
59556              configurable: !0,
59557              enumerable: !0,
59558              writable: !0,
59559              initializer: function() {
59560                return 1;
59561              }
59562            }), d$ = Bl(c$.prototype, "wrapMode", [ Yl ], {
59563              configurable: !0,
59564              enumerable: !0,
59565              writable: !0,
59566              initializer: function() {
59567                return Al.Normal;
59568              }
59569            }), p$ = Bl(c$.prototype, "enableTrsBlending", [ Yl ], {
59570              configurable: !0,
59571              enumerable: !0,
59572              writable: !0,
59573              initializer: function() {
59574                return !1;
59575              }
59576            }), m$ = Bl(c$.prototype, "_duration", [ Yl ], {
59577              configurable: !0,
59578              enumerable: !0,
59579              writable: !0,
59580              initializer: function() {
59581                return 0;
59582              }
59583            }), f$ = Bl(c$.prototype, "_hash", [ Yl ], {
59584              configurable: !0,
59585              enumerable: !0,
59586              writable: !0,
59587              initializer: function() {
59588                return 0;
59589              }
59590            }), g$ = Bl(c$.prototype, "_tracks", [ Yl ], {
59591              configurable: !0,
59592              enumerable: !0,
59593              writable: !0,
59594              initializer: function() {
59595                return [];
59596              }
59597            }), y$ = Bl(c$.prototype, "_exoticAnimation", [ Yl ], {
59598              configurable: !0,
59599              enumerable: !0,
59600              writable: !0,
59601              initializer: function() {
59602                return null;
59603              }
59604            }), b$ = Bl(c$.prototype, "_events", [ Yl ], {
59605              configurable: !0,
59606              enumerable: !0,
59607              writable: !0,
59608              initializer: function() {
59609                return [];
59610              }
59611            }), S$ = Bl(c$.prototype, "_embeddedPlayers", [ Yl ], {
59612              configurable: !0,
59613              enumerable: !0,
59614              writable: !0,
59615              initializer: function() {
59616                return [];
59617              }
59618            }), c$)) || h$);
59619            m.AnimationClip = M$;
59620            class B$ {
59621              constructor(t, e) {
59622                this._embeddedPlayers = t;
59623                this._embeddedPlayerEvaluationInfos = t.map((t => {
59624                  const {playable: i} = t;
59625                  if (!i) return null;
59626                  const s = i.instantiate(e);
59627                  return s ? {
59628                    instantiatedPlayer: s,
59629                    entered: !1,
59630                    hostPauseTime: 0,
59631                    lastIterations: 0
59632                  } : null;
59633                }));
59634              }
59635              destroy() {
59636                const {_embeddedPlayerEvaluationInfos: t} = this;
59637                const e = t.length;
59638                for (let s = 0; s < e; ++s) {
59639                  var i;
59640                  null === (i = t[s]) || void 0 === i || i.instantiatedPlayer.destroy();
59641                }
59642                this._embeddedPlayerEvaluationInfos.length = 0;
59643              }
59644              evaluate(t, e) {
59645                ne(Number.isInteger(e));
59646                const {_embeddedPlayers: i, _embeddedPlayerEvaluationInfos: s} = this;
59647                const n = i.length;
59648                for (let r = 0; r < n; ++r) {
59649                  const n = s[r];
59650                  if (!n) continue;
59651                  const {entered: o, instantiatedPlayer: a, lastIterations: l} = n;
59652                  const {begin: h, end: c} = i[r];
59653                  if (t >= h && t <= c) if (o) {
59654                    if (e !== l) {
59655                      a.stop();
59656                      a.play();
59657                      n.entered = !0;
59658                    }
59659                  } else {
59660                    a.play();
59661                    n.entered = !0;
59662                  } else if (o) {
59663                    a.stop();
59664                    n.entered = !1;
59665                  }
59666                  n.lastIterations = e;
59667                  if (n.entered) {
59668                    const e = t - h;
59669                    n.instantiatedPlayer.setTime(e);
59670                  }
59671                }
59672              }
59673              notifyHostSpeedChanged(t) {
59674                const {_embeddedPlayers: e, _embeddedPlayerEvaluationInfos: i} = this;
59675                const s = e.length;
59676                for (let n = 0; n < s; ++n) {
59677                  const s = i[n];
59678                  if (!s) continue;
59679                  const {instantiatedPlayer: r} = s;
59680                  const {reconciledSpeed: o} = e[n];
59681                  o && r.setSpeed(t);
59682                }
59683              }
59684              notifyHostPlay(t) {
59685                const {_embeddedPlayers: e, _embeddedPlayerEvaluationInfos: i} = this;
59686                const s = e.length;
59687                for (let n = 0; n < s; ++n) {
59688                  const s = i[n];
59689                  if (!s) continue;
59690                  const {begin: r, end: o} = e[n];
59691                  const {instantiatedPlayer: a, entered: l} = s;
59692                  if (l) {
59693                    const {hostPauseTime: e} = s;
59694                    if (a.randomAccess || ui(e, t, 1e-5)) {
59695                      const e = _i(t, r, o);
59696                      a.play();
59697                      a.setTime(e - r);
59698                    } else a.stop();
59699                  }
59700                }
59701              }
59702              notifyHostPause(t) {
59703                const {_embeddedPlayers: e, _embeddedPlayerEvaluationInfos: i} = this;
59704                const s = e.length;
59705                for (let e = 0; e < s; ++e) {
59706                  const s = i[e];
59707                  if (!s) continue;
59708                  const {instantiatedPlayer: n, entered: r} = s;
59709                  if (r) {
59710                    n.pause();
59711                    s.hostPauseTime = t;
59712                  }
59713                }
59714              }
59715              notifyHostStop() {
59716                const {_embeddedPlayers: t, _embeddedPlayerEvaluationInfos: e} = this;
59717                const i = t.length;
59718                for (let t = 0; t < i; ++t) {
59719                  const i = e[t];
59720                  if (!i) continue;
59721                  const {instantiatedPlayer: s, entered: n} = i;
59722                  if (n) {
59723                    i.entered = !1;
59724                    s.stop();
59725                  }
59726                }
59727              }
59728            }
59729            class D$ {
59730              constructor(t, e, i) {
59731                this._exoticAnimationEvaluator = void 0;
59732                this._trackEvalStatues = [];
59733                this._rootMotionEvaluation = void 0;
59734                this._trackEvalStatues = t;
59735                this._exoticAnimationEvaluator = e;
59736                this._rootMotionEvaluation = i;
59737              }
59738              evaluate(t) {
59739                const {_trackEvalStatues: e, _exoticAnimationEvaluator: i} = this;
59740                const s = e.length;
59741                for (let i = 0; i < s; ++i) {
59742                  const {trackEval: s, binding: n} = e[i];
59743                  const r = s.evaluate(t, n);
59744                  n.setValue(r);
59745                }
59746                i && i.evaluate(t);
59747              }
59748              evaluateRootMotion(t, e) {
59749                const {_rootMotionEvaluation: i} = this;
59750                i && i.evaluate(t, e);
59751              }
59752            }
59753            class P$ {
59754              constructor() {
59755                this.position = new Pi;
59756                this.scale = new Pi(1, 1, 1);
59757                this.rotation = new Ui;
59758                this.eulerAngles = new Pi;
59759              }
59760              getTransform(t) {
59761                qi.fromRTS(t, this.rotation, this.position, this.scale);
59762              }
59763            }
59764            class O$ extends P$ {
59765              constructor(...t) {
59766                super(...t);
59767                this.parent = null;
59768                this._dirty = !0;
59769                this._transform = new qi;
59770              }
59771              get globalTransform() {
59772                const t = this._transform;
59773                if (this._dirty) {
59774                  this._dirty = !1;
59775                  qi.fromRTS(t, this.rotation, this.position, this.scale);
59776                  this.parent && qi.multiply(t, this.parent.globalTransform, t);
59777                }
59778                return this._transform;
59779              }
59780              invalidate() {
59781                this._dirty = !0;
59782              }
59783            }
59784            const N$ = new qi;
59785            class L$ {
59786              constructor(t, e, i, s) {
59787                this._initialTransformCache = new qi;
59788                this._clipEndTransformCache = new qi;
59789                this._startTransformCache = new qi;
59790                this._endTransformCache = new qi;
59791                this._motionTransformCache = new qi;
59792                this._translationMotionCache = new Pi;
59793                this._rotationMotionCache = new Ui;
59794                this._scaleMotionCache = new Pi;
59795                this._rootBone = t;
59796                this._duration = e;
59797                this._boneTransform = i;
59798                this._trackEvalStatuses = s;
59799              }
59800              evaluate(t, e) {
59801                const i = this._calcMotionTransform(t, e, this._motionTransformCache);
59802                const {_translationMotionCache: s, _rotationMotionCache: n, _scaleMotionCache: r, _rootBone: o} = this;
59803                qi.toRTS(i, n, s, r);
59804                Pi.add(s, s, o.position);
59805                o.setPosition(s);
59806                Ui.multiply(n, n, o.rotation);
59807                o.setRotation(n);
59808                Pi.multiply(r, r, o.scale);
59809                o.setScale(r);
59810              }
59811              _calcMotionTransform(t, e, i) {
59812                const {_duration: s} = this;
59813                const n = s - t;
59814                ne(n >= 0);
59815                const r = this._evaluateAt(t, this._startTransformCache);
59816                if (e < n) {
59817                  const s = this._evaluateAt(t + e, this._endTransformCache);
59818                  F$(i, r, s);
59819                } else {
59820                  qi.identity(i);
59821                  const t = (t, e) => {
59822                    F$(N$, t, e);
59823                    qi.multiply(i, i, N$);
59824                  };
59825                  const o = e - n;
59826                  const a = Math.floor(o / s);
59827                  const l = o - a * s;
59828                  const h = this._evaluateAt(0, this._initialTransformCache);
59829                  const c = this._evaluateAt(s, this._clipEndTransformCache);
59830                  const u = this._evaluateAt(l, this._endTransformCache);
59831                  t(r, c);
59832                  F$(N$, h, c);
59833                  for (let t = 0; t < a; ++t) qi.multiply(i, i, N$);
59834                  t(h, u);
59835                }
59836                return i;
59837              }
59838              _evaluateAt(t, e) {
59839                const {_trackEvalStatuses: i} = this;
59840                const s = i.length;
59841                for (let e = 0; e < s; ++e) {
59842                  const {trackEval: s, binding: n} = i[e];
59843                  const r = s.evaluate(t, n);
59844                  n.setValue(r);
59845                }
59846                this._boneTransform.getTransform(e);
59847                return e;
59848              }
59849            }
59850            function F$(t, e, i) {
59851              qi.invert(t, e);
59852              qi.multiply(t, i, t);
59853            }
59854            function V$(t, e) {
59855              switch (e) {
59856               default:
59857                return;
59858
59859               case "position":
59860                return {
59861                  setValue(e) {
59862                    Pi.copy(t.position, e);
59863                  }
59864                };
59865
59866               case "rotation":
59867                return {
59868                  setValue(e) {
59869                    Ui.copy(t.rotation, e);
59870                  }
59871                };
59872
59873               case "scale":
59874                return {
59875                  setValue(e) {
59876                    Pi.copy(t.scale, e);
59877                  }
59878                };
59879
59880               case "eulerAngles":
59881                return {
59882                  setValue(e) {
59883                    Pi.copy(t.eulerAngles, e);
59884                  }
59885                };
59886              }
59887            }
59888            class k$ {
59889              constructor(t, e, i, s) {
59890                this._lastFrameIndex = -1;
59891                this._lastIterations = 0;
59892                this._lastDirection = 0;
59893                this._ignoreIndex = -1;
59894                this._sampled = !1;
59895                this._targetNode = t;
59896                this._ratios = e;
59897                this._eventGroups = i;
59898                this._wrapMode = s;
59899              }
59900              setWrapMode(t) {
59901                this._wrapMode = t;
59902              }
59903              ignore(t, e) {
59904                this._ignoreIndex = -1;
59905                this._sampled = !1;
59906                let i = G$(t, this._ratios);
59907                if (i < 0) {
59908                  i = ~i - 1;
59909                  e < 0 && (i += 1);
59910                  this._ignoreIndex = i;
59911                }
59912              }
59913              sample(t, e, i) {
59914                const s = this._eventGroups.length;
59915                let n = G$(t, this._ratios);
59916                if (n < 0) {
59917                  n = ~n - 1;
59918                  e < 0 && (n += 1);
59919                }
59920                this._ignoreIndex !== n && (this._ignoreIndex = -1);
59921                if (!this._sampled) {
59922                  this._sampled = !0;
59923                  this._doFire(n, !1);
59924                  this._lastFrameIndex = n;
59925                  this._lastIterations = i;
59926                  this._lastDirection = e;
59927                  return;
59928                }
59929                const r = this._wrapMode;
59930                const o = U$(i);
59931                let a = U$(this._lastIterations);
59932                let l = this._lastFrameIndex;
59933                const h = this._lastDirection;
59934                const c = -1 !== a && o !== a;
59935                if (l === n && c && 1 === s) this._doFire(0, !1); else if (l !== n || c) {
59936                  e = h;
59937                  do {
59938                    if (l !== n) {
59939                      if (-1 === e && 0 === l && n > 0) {
59940                        (r & Sl.PingPong) === Sl.PingPong ? e *= -1 : l = s;
59941                        a++;
59942                      } else if (1 === e && l === s - 1 && n < s - 1) {
59943                        (r & Sl.PingPong) === Sl.PingPong ? e *= -1 : l = -1;
59944                        a++;
59945                      }
59946                      if (l === n) break;
59947                      if (a > o) break;
59948                    }
59949                    l += e;
59950                    this._doFire(l, !0);
59951                  } while (l !== n && l > -1 && l < s);
59952                }
59953                this._lastFrameIndex = n;
59954                this._lastIterations = i;
59955                this._lastDirection = e;
59956              }
59957              _doFire(t, e) {
59958                e ? XY().pushDelayEvent(this._checkAndFire, this, [ t ]) : this._checkAndFire(t);
59959              }
59960              _checkAndFire(t) {
59961                if (!this._targetNode || !this._targetNode.isValid) return;
59962                const {_eventGroups: e} = this;
59963                if (t < 0 || t >= e.length || this._ignoreIndex === t) return;
59964                const i = e[t];
59965                const s = this._targetNode.components;
59966                const n = i.events.length;
59967                for (let t = 0; t < n; ++t) {
59968                  const e = i.events[t];
59969                  const {functionName: n} = e;
59970                  const r = s.length;
59971                  for (let t = 0; t < r; ++t) {
59972                    const i = s[t];
59973                    const r = i[n];
59974                    "function" == typeof r && r.apply(i, e.parameters);
59975                  }
59976                }
59977              }
59978            }
59979            function U$(t) {
59980              t - (0 | t) == 0 && (t -= 1);
59981              return 0 | t;
59982            }
59983            function G$(t, e) {
59984              return vl(e, t);
59985            }
59986            const z$ = j$;
59987            const H$ = j$;
59988            function j$(...t) {}
59989            var X$, W$, Y$, q$, K$, J$;
59990            X$ = Ul("cc.animation.ClipMotion"), W$ = Th(M$), X$(Y$ = (q$ = (J$ = class t extends Ch {
59991              constructor(...t) {
59992                super(...t);
59993                Ml(this, "clip", K$, this);
59994              }
59995              [uJ](t) {
59996                if (!this.clip) return null;
59997                return new Z$(t, this.clip);
59998              }
59999              clone() {
60000                const e = new t;
60001                e.clip = this.clip;
60002                return e;
60003              }
60004            }, J$), K$ = Bl(q$.prototype, "clip", [ W$ ], {
60005              configurable: !0,
60006              enumerable: !0,
60007              writable: !0,
60008              initializer: function() {
60009                return null;
60010              }
60011            }), q$));
60012            class Z$ {
60013              constructor(t, e) {
60014                this.duration = e.duration / e.speed;
60015                this._state = new YY(e);
60016                this._state.initialize(t.node, t.blendBuffer, t.mask);
60017              }
60018              getClipStatuses(t) {
60019                let e = !1;
60020                return {
60021                  next: () => {
60022                    if (e) return {
60023                      done: !0,
60024                      value: void 0
60025                    };
60026                    e = !0;
60027                    return {
60028                      done: !1,
60029                      value: {
60030                        __DEBUG_ID__: this.__DEBUG__ID__,
60031                        clip: this._state.clip,
60032                        weight: t
60033                      }
60034                    };
60035                  }
60036                };
60037              }
60038              get progress() {
60039                return this._state.time / this.duration;
60040              }
60041              sample(t, e) {
60042                if (0 === e) return;
60043                const i = this._state.duration * t;
60044                this._state.time = i;
60045                this._state.weight = e;
60046                this._state.sample();
60047                this._state.weight = 0;
60048              }
60049            }
60050            var Q$, $$, t0, e0, i0, s0, n0, r0, o0, a0;
60051            let l0 = Ul("cc.animation.BindableNumber")(Q$ = ($$ = (i0 = class t {
60052              constructor(t = 0) {
60053                Ml(this, "variable", t0, this);
60054                Ml(this, "value", e0, this);
60055                this.value = t;
60056              }
60057              clone() {
60058                const e = new t;
60059                e.value = this.value;
60060                e.variable = this.variable;
60061                return e;
60062              }
60063            }, i0), t0 = Bl($$.prototype, "variable", [ Yl ], {
60064              configurable: !0,
60065              enumerable: !0,
60066              writable: !0,
60067              initializer: function() {
60068                return "";
60069              }
60070            }), e0 = Bl($$.prototype, "value", [ Yl ], {
60071              configurable: !0,
60072              enumerable: !0,
60073              writable: !0,
60074              initializer: function() {
60075                return 0;
60076              }
60077            }), $$)) || Q$;
60078            let h0 = Ul("cc.animation.BindableBoolean")(s0 = (n0 = (a0 = class t {
60079              constructor(t = !1) {
60080                Ml(this, "variable", r0, this);
60081                Ml(this, "value", o0, this);
60082                this.value = t;
60083              }
60084              clone() {
60085                const e = new t;
60086                e.value = this.value;
60087                e.variable = this.variable;
60088                return e;
60089              }
60090            }, a0), r0 = Bl(n0.prototype, "variable", [ Yl ], {
60091              configurable: !0,
60092              enumerable: !0,
60093              writable: !0,
60094              initializer: function() {
60095                return "";
60096              }
60097            }), o0 = Bl(n0.prototype, "value", [ Yl ], {
60098              configurable: !0,
60099              enumerable: !0,
60100              writable: !0,
60101              initializer: function() {
60102                return !1;
60103              }
60104            }), n0)) || s0;
60105            function c0(t, e, i, s, n, ...r) {
60106              const {variable: o, value: a} = e;
60107              if (!o) return a;
60108              const l = t.getVar(o);
60109              if (!_0(l, o)) return a;
60110              if (l.type !== i) throw new cJ(o, "number");
60111              return l.bind(s, n, ...r);
60112            }
60113            function u0(t, e, i, s, n, ...r) {
60114              const {variable: o, value: a} = e;
60115              if (!o) return a;
60116              const l = t.getVar(o);
60117              if (!_0(l, o)) return a;
60118              if (i !== rJ.FLOAT && i !== rJ.INTEGER) throw new cJ(o, "number or integer");
60119              return l.bind(s, n, ...r);
60120            }
60121            function _0(t, e) {
60122              if (t) return !0;
60123              throw new hJ(e);
60124            }
60125            var d0, p0, m0, f0, g0, y0, b0;
60126            let S0 = Ul("cc.animation.AnimationBlendItem")(d0 = (p0 = (f0 = class t {
60127              constructor() {
60128                Ml(this, "motion", m0, this);
60129              }
60130              clone() {
60131                const e = new t;
60132                this._assign(e);
60133                return e;
60134              }
60135              _assign(t) {
60136                var e, i;
60137                t.motion = null !== (e = null === (i = this.motion) || void 0 === i ? void 0 : i.clone()) && void 0 !== e ? e : null;
60138                return t;
60139              }
60140            }, f0), m0 = Bl(p0.prototype, "motion", [ Yl ], {
60141              configurable: !0,
60142              enumerable: !0,
60143              writable: !0,
60144              initializer: function() {
60145                return null;
60146              }
60147            }), p0)) || d0;
60148            let A0 = Ul("cc.animation.AnimationBlend")(g0 = (y0 = class extends Ch {
60149              constructor(...t) {
60150                super(...t);
60151                Ml(this, "name", b0, this);
60152              }
60153            }, b0 = Bl(y0.prototype, "name", [ Yl ], {
60154              configurable: !0,
60155              enumerable: !0,
60156              writable: !0,
60157              initializer: function() {
60158                return "";
60159              }
60160            }), y0)) || g0;
60161            class T0 {
60162              constructor(t, e, i, s) {
60163                this._childEvaluators = i.map((e => {
60164                  var i, s;
60165                  return null !== (i = null === (s = e.motion) || void 0 === s ? void 0 : s[uJ](t)) && void 0 !== i ? i : null;
60166                }));
60167                this._weights = new Array(this._childEvaluators.length).fill(0);
60168                this._inputs = [ ...s ];
60169              }
60170              get childCount() {
60171                return this._weights.length;
60172              }
60173              getChildWeight(t) {
60174                return this._weights[t];
60175              }
60176              getChildMotionEval(t) {
60177                return this._childEvaluators[t];
60178              }
60179              get duration() {
60180                let t = 0;
60181                for (let s = 0; s < this._childEvaluators.length; ++s) {
60182                  var e, i;
60183                  t += (null !== (e = null === (i = this._childEvaluators[s]) || void 0 === i ? void 0 : i.duration) && void 0 !== e ? e : 0) * this._weights[s];
60184                }
60185                return t;
60186              }
60187              getClipStatuses(t) {
60188                const {_childEvaluators: e, _weights: i} = this;
60189                const s = e.length;
60190                let n = 0;
60191                let r;
60192                return {
60193                  next() {
60194                    for (;;) {
60195                      if (r) {
60196                        const t = r.next();
60197                        if (!t.done) return t;
60198                      }
60199                      if (n >= s) return {
60200                        done: !0,
60201                        value: void 0
60202                      };
60203                      {
60204                        const s = e[n];
60205                        r = null == s ? void 0 : s.getClipStatuses(t * i[n]);
60206                        ++n;
60207                      }
60208                    }
60209                  }
60210                };
60211              }
60212              sample(t, e) {
60213                for (let s = 0; s < this._childEvaluators.length; ++s) {
60214                  var i;
60215                  null === (i = this._childEvaluators[s]) || void 0 === i || i.sample(t, e * this._weights[s]);
60216                }
60217              }
60218              setInput(t, e) {
60219                this._inputs[e] = t;
60220                this.doEval();
60221              }
60222              doEval() {
60223                this.eval(this._weights, this._inputs);
60224              }
60225              eval(t, e) {}
60226            }
60227            var v0, E0, C0, x0, w0, R0, I0, M0, B0, D0;
60228            let P0 = Ul("cc.animation.AnimationBlend1DItem")(v0 = (E0 = (x0 = class t extends S0 {
60229              constructor(...t) {
60230                super(...t);
60231                Ml(this, "threshold", C0, this);
60232              }
60233              clone() {
60234                const e = new t;
60235                this._assign(e);
60236                return e;
60237              }
60238              _assign(t) {
60239                super._assign(t);
60240                t.threshold = this.threshold;
60241                return t;
60242              }
60243            }, x0), C0 = Bl(E0.prototype, "threshold", [ Yl ], {
60244              configurable: !0,
60245              enumerable: !0,
60246              writable: !0,
60247              initializer: function() {
60248                return 0;
60249              }
60250            }), E0)) || v0;
60251            Ul("cc.animation.AnimationBlend1D")(w0 = (R0 = (D0 = B0 = class t extends A0 {
60252              constructor(...t) {
60253                super(...t);
60254                Ml(this, "_items", I0, this);
60255                Ml(this, "param", M0, this);
60256              }
60257              get items() {
60258                return this._items;
60259              }
60260              set items(t) {
60261                this._items = Array.from(t).sort((({threshold: t}, {threshold: e}) => t - e));
60262              }
60263              clone() {
60264                const e = new t;
60265                e._items = this._items.map((t => t.clone()));
60266                e.param = this.param.clone();
60267                return e;
60268              }
60269              [uJ](t) {
60270                const e = new O0(t, this, this._items, this._items.map((({threshold: t}) => t)), 0);
60271                const i = c0(t, this.param, rJ.FLOAT, e.setInput, e, 0);
60272                e.setInput(i, 0);
60273                return e;
60274              }
60275            }, B0.Item = P0, D0), I0 = Bl(R0.prototype, "_items", [ Yl ], {
60276              configurable: !0,
60277              enumerable: !0,
60278              writable: !0,
60279              initializer: function() {
60280                return [];
60281              }
60282            }), M0 = Bl(R0.prototype, "param", [ Yl ], {
60283              configurable: !0,
60284              enumerable: !0,
60285              writable: !0,
60286              initializer: function() {
60287                return new l0;
60288              }
60289            }), R0));
60290            class O0 extends T0 {
60291              constructor(t, e, i, s, n) {
60292                super(t, e, i, [ n ]);
60293                this._thresholds = s;
60294                this.doEval();
60295              }
60296              eval(t, [e]) {
60297                !function(t, e, i) {
60298                  t.fill(0);
60299                  if (0 === e.length) ; else if (i <= e[0]) t[0] = 1; else if (i >= e[e.length - 1]) t[t.length - 1] = 1; else {
60300                    let s = 0;
60301                    for (let t = 1; t < e.length; ++t) if (e[t] > i) {
60302                      s = t;
60303                      break;
60304                    }
60305                    const n = e[s - 1];
60306                    const r = e[s];
60307                    const o = r - n;
60308                    t[s - 1] = (r - i) / o;
60309                    t[s] = (i - n) / o;
60310                  }
60311                }(t, this._thresholds, e);
60312              }
60313            }
60314            const N0 = (() => {
60315              const t = new Qi;
60316              const e = {
60317                wA: 0,
60318                wB: 0
60319              };
60320              return function(i, s, n) {
60321                ne(i.length === s.length);
60322                if (0 === s.length) return;
60323                if (1 === s.length) {
60324                  i[0] = 1;
60325                  return;
60326                }
60327                if (Qi.strictEquals(n, Qi.ZERO)) {
60328                  const t = s.findIndex((t => Qi.strictEquals(t, Qi.ZERO)));
60329                  t >= 0 ? i[t] = 1 : i.fill(1 / s.length);
60330                  return;
60331                }
60332                let r = -1;
60333                let o = -1;
60334                let a = -1;
60335                let l = Number.NEGATIVE_INFINITY;
60336                let h = Number.NEGATIVE_INFINITY;
60337                const {x: c, y: u} = n;
60338                for (let e = 0; e < s.length; ++e) {
60339                  const i = s[e];
60340                  if (Qi.equals(i, Qi.ZERO)) {
60341                    a = e;
60342                    continue;
60343                  }
60344                  const _ = Qi.normalize(t, i);
60345                  const d = Qi.dot(_, n);
60346                  if (_.x * u - _.y * c > 0) {
60347                    if (d >= h) {
60348                      h = d;
60349                      r = e;
60350                    }
60351                  } else if (d >= l) {
60352                    l = d;
60353                    o = e;
60354                  }
60355                }
60356                let _ = 0;
60357                if (r < 0 || o < 0) _ = 1; else {
60358                  const {wA: t, wB: a} = function(t, e, i, s) {
60359                    const n = Qi.cross(t, e);
60360                    if (n) {
60361                      s.wA = Qi.cross(i, e) / n;
60362                      s.wB = Qi.cross(i, t) / -n;
60363                    } else {
60364                      s.wA = 0;
60365                      s.wB = 0;
60366                    }
60367                    return s;
60368                  }(s[r], s[o], n, e);
60369                  let l = 0;
60370                  let h = 0;
60371                  const c = t + a;
60372                  if (c > 1) {
60373                    l = t / c;
60374                    h = a / c;
60375                  } else if (c < 0) {
60376                    l = 0;
60377                    h = 0;
60378                    _ = 1;
60379                  } else {
60380                    l = t;
60381                    h = a;
60382                    _ = 1 - c;
60383                  }
60384                  i[r] = l;
60385                  i[o] = h;
60386                }
60387                if (_ > 0) if (a >= 0) i[a] = _; else {
60388                  const t = _ / i.length;
60389                  for (let e = 0; e < i.length; ++e) i[e] += t;
60390                }
60391              };
60392            })();
60393            function L0(t, e, i, s) {
60394              t.fill(0);
60395              const n = new Qi(0, 0);
60396              const r = new Qi(0, 0);
60397              let o = 0;
60398              const a = e.length;
60399              for (let l = 0; l < a; ++l) {
60400                let h = Number.MAX_VALUE;
60401                let c = !1;
60402                for (let t = 0; t < a; ++t) {
60403                  if (l === t) continue;
60404                  s(e[l], e[t], i, n, r);
60405                  const o = 1 - Qi.dot(n, r) / Qi.lengthSqr(r);
60406                  if (o < 0) {
60407                    c = !0;
60408                    break;
60409                  }
60410                  h = Math.min(h, o);
60411                }
60412                if (!c) {
60413                  t[l] = h;
60414                  o += h;
60415                }
60416              }
60417              o > 0 && t.forEach(((e, i) => t[i] = e / o));
60418            }
60419            const F0 = (t, e, i, s, n) => {
60420              Qi.subtract(s, i, t);
60421              Qi.subtract(n, e, t);
60422            };
60423            const V0 = (() => {
60424              const t = new Pi(0, 0, 0);
60425              const e = new Pi(0, 0, 0);
60426              const i = new Pi(0, 0, 0);
60427              const s = new Pi(0, 0, 0);
60428              const n = new Pi(0, 0, 0);
60429              const r = new Pi(0, 0, 0);
60430              return (o, a, l, h, c) => {
60431                let u = 0;
60432                let _ = 0;
60433                let d = 2;
60434                Pi.set(i, l.x, l.y, 0);
60435                if (Qi.equals(o, Qi.ZERO)) {
60436                  u = Qi.angle(l, a);
60437                  _ = 0;
60438                  d = 1;
60439                } else if (Qi.equals(a, Qi.ZERO)) {
60440                  u = Qi.angle(l, o);
60441                  _ = u;
60442                  d = 1;
60443                } else {
60444                  u = Qi.angle(o, a);
60445                  if (u <= 0) _ = 0; else if (Qi.equals(l, Qi.ZERO)) _ = u; else {
60446                    Pi.set(s, o.x, o.y, 0);
60447                    Pi.set(n, a.x, a.y, 0);
60448                    Pi.set(r, l.x, l.y, 0);
60449                    Pi.cross(t, s, n);
60450                    Pi.projectOnPlane(i, r, t);
60451                    _ = Pi.angle(s, i);
60452                    u < .99 * Math.PI && Pi.dot(Pi.cross(e, s, i), t) < 0 && (_ = -_);
60453                  }
60454                }
60455                const p = Qi.len(o);
60456                const m = Qi.len(a);
60457                const f = (m + p) / 2;
60458                Qi.set(c, (m - p) / f, u * d);
60459                Qi.set(h, (Pi.len(i) - p) / f, _ * d);
60460              };
60461            })();
60462            var k0, U0, G0, z0, H0, j0, X0, W0, Y0, q0, K0, J0;
60463            var Z0;
60464            !function(t) {
60465              t[t.SIMPLE_DIRECTIONAL = 0] = "SIMPLE_DIRECTIONAL";
60466              t[t.FREEFORM_CARTESIAN = 1] = "FREEFORM_CARTESIAN";
60467              t[t.FREEFORM_DIRECTIONAL = 2] = "FREEFORM_DIRECTIONAL";
60468            }(Z0 || (Z0 = {}));
60469            he(Z0);
60470            let Q0 = Ul("cc.animation.AnimationBlend2DItem")(k0 = (U0 = (z0 = class t extends S0 {
60471              constructor(...t) {
60472                super(...t);
60473                Ml(this, "threshold", G0, this);
60474              }
60475              clone() {
60476                const e = new t;
60477                this._assign(e);
60478                return e;
60479              }
60480              _assign(t) {
60481                super._assign(t);
60482                Qi.copy(t.threshold, this.threshold);
60483                return t;
60484              }
60485            }, z0), G0 = Bl(U0.prototype, "threshold", [ Yl ], {
60486              configurable: !0,
60487              enumerable: !0,
60488              writable: !0,
60489              initializer: function() {
60490                return new Qi;
60491              }
60492            }), U0)) || k0;
60493            Ul("cc.animation.AnimationBlend2D")(H0 = (j0 = (J0 = K0 = class t extends A0 {
60494              constructor(...t) {
60495                super(...t);
60496                Ml(this, "algorithm", X0, this);
60497                Ml(this, "_items", W0, this);
60498                Ml(this, "paramX", Y0, this);
60499                Ml(this, "paramY", q0, this);
60500              }
60501              get items() {
60502                return this._items;
60503              }
60504              set items(t) {
60505                this._items = Array.from(t);
60506              }
60507              clone() {
60508                const e = new t;
60509                e._items = this._items.map((t => {
60510                  var e;
60511                  return null !== (e = null == t ? void 0 : t.clone()) && void 0 !== e ? e : null;
60512                }));
60513                e.paramX = this.paramX.clone();
60514                e.paramY = this.paramY.clone();
60515                return e;
60516              }
60517              [uJ](t) {
60518                const e = new $0(t, this, this._items, this._items.map((({threshold: t}) => t)), this.algorithm, [ 0, 0 ]);
60519                const i = c0(t, this.paramX, rJ.FLOAT, e.setInput, e, 0);
60520                const s = c0(t, this.paramY, rJ.FLOAT, e.setInput, e, 1);
60521                e.setInput(i, 0);
60522                e.setInput(s, 1);
60523                return e;
60524              }
60525            }, K0.Algorithm = Z0, K0.Item = Q0, J0), X0 = Bl(j0.prototype, "algorithm", [ Yl ], {
60526              configurable: !0,
60527              enumerable: !0,
60528              writable: !0,
60529              initializer: function() {
60530                return Z0.SIMPLE_DIRECTIONAL;
60531              }
60532            }), W0 = Bl(j0.prototype, "_items", [ Yl ], {
60533              configurable: !0,
60534              enumerable: !0,
60535              writable: !0,
60536              initializer: function() {
60537                return [];
60538              }
60539            }), Y0 = Bl(j0.prototype, "paramX", [ Yl ], {
60540              configurable: !0,
60541              enumerable: !0,
60542              writable: !0,
60543              initializer: function() {
60544                return new l0;
60545              }
60546            }), q0 = Bl(j0.prototype, "paramY", [ Yl ], {
60547              configurable: !0,
60548              enumerable: !0,
60549              writable: !0,
60550              initializer: function() {
60551                return new l0;
60552              }
60553            }), j0));
60554            class $0 extends T0 {
60555              constructor(t, e, i, s, n, r) {
60556                super(t, e, i, r);
60557                this._thresholds = void 0;
60558                this._algorithm = void 0;
60559                this._value = new Qi;
60560                this._thresholds = s;
60561                this._algorithm = n;
60562                this.doEval();
60563              }
60564              eval(t, [e, i]) {
60565                Qi.set(this._value, e, i);
60566                t.fill(0);
60567                switch (this._algorithm) {
60568                 case Z0.SIMPLE_DIRECTIONAL:
60569                  N0(t, this._thresholds, this._value);
60570                  break;
60571
60572                 case Z0.FREEFORM_CARTESIAN:
60573                  !function(t, e, i) {
60574                    L0(t, e, i, F0);
60575                  }(t, this._thresholds, this._value);
60576                  break;
60577
60578                 case Z0.FREEFORM_DIRECTIONAL:
60579                  !function(t, e, i) {
60580                    L0(t, e, i, V0);
60581                  }(t, this._thresholds, this._value);
60582                }
60583              }
60584            }
60585            var t1, e1, i1, s1, n1, r1, o1, a1, l1;
60586            let h1 = Ul("cc.animation.AnimationBlendDirectItem")(t1 = (e1 = (s1 = class t extends S0 {
60587              constructor(...t) {
60588                super(...t);
60589                Ml(this, "weight", i1, this);
60590              }
60591              clone() {
60592                const e = new t;
60593                this._assign(e);
60594                return e;
60595              }
60596              _assign(t) {
60597                super._assign(t);
60598                t.weight = this.weight;
60599                return t;
60600              }
60601            }, s1), i1 = Bl(e1.prototype, "weight", [ Yl ], {
60602              configurable: !0,
60603              enumerable: !0,
60604              writable: !0,
60605              initializer: function() {
60606                return 0;
60607              }
60608            }), e1)) || t1;
60609            Ul("cc.animation.AnimationBlendDirect")(n1 = (r1 = (l1 = a1 = class t extends A0 {
60610              constructor(...t) {
60611                super(...t);
60612                Ml(this, "_items", o1, this);
60613              }
60614              get items() {
60615                return this._items;
60616              }
60617              set items(t) {
60618                this._items = Array.from(t);
60619              }
60620              clone() {
60621                const e = new t;
60622                e._items = this._items.map((t => {
60623                  var e;
60624                  return null !== (e = null == t ? void 0 : t.clone()) && void 0 !== e ? e : null;
60625                }));
60626                return e;
60627              }
60628              [uJ](t) {
60629                return new c1(t, this, this._items, this._items.map((({weight: t}) => t)));
60630              }
60631            }, a1.Item = h1, l1), o1 = Bl(r1.prototype, "_items", [ Yl ], {
60632              configurable: !0,
60633              enumerable: !0,
60634              writable: !0,
60635              initializer: function() {
60636                return [];
60637              }
60638            }), r1));
60639            class c1 extends T0 {
60640              constructor(...t) {
60641                super(...t);
60642                this.doEval();
60643              }
60644              eval(t, e) {
60645                const i = t.length;
60646                for (let s = 0; s < i; ++s) t[s] = e[s];
60647              }
60648            }
60649            var u1, _1, d1, p1, m1, f1, g1, y1;
60650            Ul("cc.animation.AnimationMask")(u1 = (_1 = (p1 = class extends gc {
60651              constructor(...t) {
60652                super(...t);
60653                Ml(this, "_jointMasks", d1, this);
60654              }
60655              get joints() {
60656                return this._jointMasks;
60657              }
60658              set joints(t) {
60659                this.clear();
60660                for (const e of t) this.addJoint(e.path, e.enabled);
60661              }
60662              addJoint(t, e) {
60663                this.removeJoint(t);
60664                const i = new b1;
60665                i.path = t;
60666                i.enabled = e;
60667                this._jointMasks.push(i);
60668              }
60669              removeJoint(t) {
60670                lt(this._jointMasks, (({path: e}) => e === t));
60671              }
60672              clear() {
60673                this._jointMasks.length = 0;
60674              }
60675              filterDisabledNodes(t) {
60676                const {_jointMasks: e} = this;
60677                const i = e.length;
60678                const s = new Set;
60679                for (let n = 0; n < i; ++n) {
60680                  const {path: i, enabled: r} = e[n];
60681                  if (r) continue;
60682                  const o = t.getChildByPath(i);
60683                  o && s.add(o);
60684                }
60685                return s;
60686              }
60687            }, p1), d1 = Bl(_1.prototype, "_jointMasks", [ Yl ], {
60688              configurable: !0,
60689              enumerable: !0,
60690              writable: !0,
60691              initializer: function() {
60692                return [];
60693              }
60694            }), Bl(_1.prototype, "joints", [ nh ], Object.getOwnPropertyDescriptor(_1.prototype, "joints"), _1.prototype),
60695            _1));
60696            let b1 = Ul("cc.JointMask")(m1 = (f1 = class {
60697              constructor() {
60698                Ml(this, "path", g1, this);
60699                Ml(this, "enabled", y1, this);
60700              }
60701            }, g1 = Bl(f1.prototype, "path", [ Yl ], {
60702              configurable: !0,
60703              enumerable: !0,
60704              writable: !0,
60705              initializer: function() {
60706                return "";
60707              }
60708            }), y1 = Bl(f1.prototype, "enabled", [ Yl ], {
60709              configurable: !0,
60710              enumerable: !0,
60711              writable: !0,
60712              initializer: function() {
60713                return !0;
60714              }
60715            }), f1)) || m1;
60716            var S1, A1, T1, v1, E1, C1, x1, w1, R1, I1, M1, B1, D1, P1, O1, N1, L1;
60717            var F1;
60718            !function(t) {
60719              t[t.EQUAL_TO = 0] = "EQUAL_TO";
60720              t[t.NOT_EQUAL_TO = 1] = "NOT_EQUAL_TO";
60721              t[t.LESS_THAN = 2] = "LESS_THAN";
60722              t[t.LESS_THAN_OR_EQUAL_TO = 3] = "LESS_THAN_OR_EQUAL_TO";
60723              t[t.GREATER_THAN = 4] = "GREATER_THAN";
60724              t[t.GREATER_THAN_OR_EQUAL_TO = 5] = "GREATER_THAN_OR_EQUAL_TO";
60725            }(F1 || (F1 = {}));
60726            Ul("cc.animation.BinaryCondition")(S1 = (A1 = (x1 = C1 = class t {
60727              constructor() {
60728                Ml(this, "operator", T1, this);
60729                Ml(this, "lhs", v1, this);
60730                Ml(this, "rhs", E1, this);
60731              }
60732              clone() {
60733                const e = new t;
60734                e.operator = this.operator;
60735                e.lhs = this.lhs.clone();
60736                e.rhs = this.rhs.clone();
60737                return e;
60738              }
60739              [uJ](t) {
60740                const {operator: e, lhs: i, rhs: s} = this;
60741                const n = new V1(e, 0, 0);
60742                const r = u0(t, i, rJ.FLOAT, n.setLhs, n);
60743                const o = u0(t, s, rJ.FLOAT, n.setRhs, n);
60744                n.reset(r, o);
60745                return n;
60746              }
60747            }, C1.Operator = F1, x1), T1 = Bl(A1.prototype, "operator", [ Yl ], {
60748              configurable: !0,
60749              enumerable: !0,
60750              writable: !0,
60751              initializer: function() {
60752                return F1.EQUAL_TO;
60753              }
60754            }), v1 = Bl(A1.prototype, "lhs", [ Yl ], {
60755              configurable: !0,
60756              enumerable: !0,
60757              writable: !0,
60758              initializer: function() {
60759                return new l0;
60760              }
60761            }), E1 = Bl(A1.prototype, "rhs", [ Yl ], {
60762              configurable: !0,
60763              enumerable: !0,
60764              writable: !0,
60765              initializer: function() {
60766                return new l0;
60767              }
60768            }), A1));
60769            class V1 {
60770              constructor(t, e, i) {
60771                this._operator = t;
60772                this._lhs = e;
60773                this._rhs = i;
60774                this._eval();
60775              }
60776              reset(t, e) {
60777                this._lhs = t;
60778                this._rhs = e;
60779                this._eval();
60780              }
60781              setLhs(t) {
60782                this._lhs = t;
60783                this._eval();
60784              }
60785              setRhs(t) {
60786                this._rhs = t;
60787                this._eval();
60788              }
60789              eval() {
60790                return this._result;
60791              }
60792              _eval() {
60793                const {_lhs: t, _rhs: e} = this;
60794                switch (this._operator) {
60795                 default:
60796                 case F1.EQUAL_TO:
60797                  this._result = t === e;
60798                  break;
60799
60800                 case F1.NOT_EQUAL_TO:
60801                  this._result = t !== e;
60802                  break;
60803
60804                 case F1.LESS_THAN:
60805                  this._result = t < e;
60806                  break;
60807
60808                 case F1.LESS_THAN_OR_EQUAL_TO:
60809                  this._result = t <= e;
60810                  break;
60811
60812                 case F1.GREATER_THAN:
60813                  this._result = t > e;
60814                  break;
60815
60816                 case F1.GREATER_THAN_OR_EQUAL_TO:
60817                  this._result = t >= e;
60818                }
60819              }
60820            }
60821            var k1;
60822            !function(t) {
60823              t[t.TRUTHY = 0] = "TRUTHY";
60824              t[t.FALSY = 1] = "FALSY";
60825            }(k1 || (k1 = {}));
60826            Ul("cc.animation.UnaryCondition")(w1 = (R1 = (D1 = B1 = class t {
60827              constructor() {
60828                Ml(this, "operator", I1, this);
60829                Ml(this, "operand", M1, this);
60830              }
60831              clone() {
60832                const e = new t;
60833                e.operator = this.operator;
60834                e.operand = this.operand.clone();
60835                return e;
60836              }
60837              [uJ](t) {
60838                const {operator: e, operand: i} = this;
60839                const s = new U1(e, !1);
60840                const n = c0(t, i, rJ.BOOLEAN, s.setOperand, s);
60841                s.reset(n);
60842                return s;
60843              }
60844            }, B1.Operator = k1, D1), I1 = Bl(R1.prototype, "operator", [ Yl ], {
60845              configurable: !0,
60846              enumerable: !0,
60847              writable: !0,
60848              initializer: function() {
60849                return k1.TRUTHY;
60850              }
60851            }), M1 = Bl(R1.prototype, "operand", [ Yl ], {
60852              configurable: !0,
60853              enumerable: !0,
60854              writable: !0,
60855              initializer: function() {
60856                return new h0;
60857              }
60858            }), R1));
60859            class U1 {
60860              constructor(t, e) {
60861                this._operator = t;
60862                this._operand = e;
60863                this._eval();
60864              }
60865              reset(t) {
60866                this.setOperand(t);
60867              }
60868              setOperand(t) {
60869                this._operand = t;
60870                this._eval();
60871              }
60872              eval() {
60873                return this._result;
60874              }
60875              _eval() {
60876                const {_operand: t} = this;
60877                switch (this._operator) {
60878                 default:
60879                 case k1.TRUTHY:
60880                  this._result = !!t;
60881                  break;
60882
60883                 case k1.FALSY:
60884                  this._result = !t;
60885                }
60886              }
60887            }
60888            let G1 = Ul("cc.animation.TriggerCondition")(P1 = (O1 = (L1 = class t {
60889              constructor() {
60890                Ml(this, "trigger", N1, this);
60891              }
60892              clone() {
60893                const e = new t;
60894                e.trigger = this.trigger;
60895                return e;
60896              }
60897              [uJ](t) {
60898                const e = new z1(!1);
60899                const i = t.getVar(this.trigger);
60900                if (_0(i, this.trigger)) {
60901                  !function(t, e) {
60902                    if (t !== rJ.TRIGGER) throw new cJ(e, "trigger");
60903                  }(i.type, this.trigger);
60904                  e.setTrigger(i.bind(e.setTrigger, e));
60905                }
60906                return e;
60907              }
60908            }, L1), N1 = Bl(O1.prototype, "trigger", [ Yl ], {
60909              configurable: !0,
60910              enumerable: !0,
60911              writable: !0,
60912              initializer: function() {
60913                return "";
60914              }
60915            }), O1)) || P1;
60916            class z1 {
60917              constructor(t) {
60918                this._triggered = !1;
60919                this._triggered = t;
60920              }
60921              setTrigger(t) {
60922                this._triggered = t;
60923              }
60924              eval() {
60925                return this._triggered;
60926              }
60927            }
60928            class H1 {
60929              constructor() {
60930                this._nodeBlendStates = new Map;
60931              }
60932              createWriter(t, e, i, s) {
60933                const n = this.ref(t, e);
60934                return new j1(t, e, n, i, s);
60935              }
60936              destroyWriter(t) {
60937                const e = t;
60938                this.deRef(e.node, e.property);
60939              }
60940              ref(t, e) {
60941                let i = this._nodeBlendStates.get(t);
60942                if (!i) {
60943                  i = this.createNodeBlendState();
60944                  this._nodeBlendStates.set(t, i);
60945                }
60946                return i.refProperty(t, e);
60947              }
60948              deRef(t, e) {
60949                const i = this._nodeBlendStates.get(t);
60950                if (i) {
60951                  i.deRefProperty(e);
60952                  i.empty && this._nodeBlendStates.delete(t);
60953                }
60954              }
60955              apply() {
60956                this._nodeBlendStates.forEach(((t, e) => {
60957                  t.apply(e);
60958                }));
60959              }
60960            }
60961            class j1 {
60962              constructor(t, e, i, s, n) {
60963                this._node = t;
60964                this._property = e;
60965                this._propertyBlendState = i;
60966                this._host = s;
60967                this._constants = n;
60968              }
60969              get node() {
60970                return this._node;
60971              }
60972              get property() {
60973                return this._property;
60974              }
60975              getValue() {
60976                return this._node[this._property];
60977              }
60978              setValue(t) {
60979                const {_propertyBlendState: e, _host: i} = this;
60980                const s = i.weight;
60981                e.blend(t, s);
60982              }
60983            }
60984            var X1;
60985            !function(t) {
60986              t[t.POSITION = 1] = "POSITION";
60987              t[t.ROTATION = 2] = "ROTATION";
60988              t[t.SCALE = 4] = "SCALE";
60989              t[t.EULER_ANGLES = 8] = "EULER_ANGLES";
60990            }(X1 || (X1 = {}));
60991            const W1 = X1.POSITION | X1.ROTATION | X1.SCALE | X1.EULER_ANGLES;
60992            class Y1 {
60993              constructor() {
60994                this.refCount = 0;
60995                this.accumulatedWeight = 0;
60996                this.result = new Pi;
60997              }
60998              blend(t, e) {
60999                this.accumulatedWeight = s2(this.result, this.result, this.accumulatedWeight, t, e);
61000              }
61001              reset() {
61002                this.accumulatedWeight = 0;
61003                Pi.zero(this.result);
61004              }
61005            }
61006            class q1 {
61007              constructor() {
61008                this.refCount = 0;
61009                this.accumulatedWeight = 0;
61010                this.result = new Ui;
61011              }
61012              blend(t, e) {
61013                this.accumulatedWeight = n2(this.result, this.result, this.accumulatedWeight, t, e);
61014              }
61015              reset() {
61016                this.accumulatedWeight = 0;
61017                Ui.identity(this.result);
61018              }
61019            }
61020            class K1 {
61021              constructor() {
61022                this._transformApplyFlags = 0;
61023                this._properties = {};
61024              }
61025              get empty() {
61026                const {_properties: t} = this;
61027                return !(t.position || t.rotation || t.eulerAngles || t.scale);
61028              }
61029              refProperty(t, e) {
61030                var i, s;
61031                const {_properties: n} = this;
61032                let r;
61033                switch (e) {
61034                 default:
61035                 case "position":
61036                 case "scale":
61037                 case "eulerAngles":
61038                  r = null !== (i = n[e]) && void 0 !== i ? i : n[e] = this._createVec3BlendState(t[e]);
61039                  break;
61040
61041                 case "rotation":
61042                  r = null !== (s = n[e]) && void 0 !== s ? s : n[e] = this._createQuatBlendState(t.rotation);
61043                }
61044                ++r.refCount;
61045                return r;
61046              }
61047              deRefProperty(t) {
61048                const {_properties: e} = this;
61049                const i = e[t];
61050                if (i) {
61051                  --i.refCount;
61052                  i.refCount > 0 || delete e[t];
61053                }
61054              }
61055              apply(t) {
61056                const {_transformApplyFlags: e, _properties: {position: i, scale: s, rotation: n, eulerAngles: r}} = this;
61057                if (!e) return;
61058                let o;
61059                let a;
61060                let l;
61061                i && e & X1.POSITION && (o = i.result);
61062                s && e & X1.SCALE && (a = s.result);
61063                r && e & X1.EULER_ANGLES && (l = r.result);
61064                n && e & X1.ROTATION && (l = n.result);
61065                (l || o || a) && t.setRTS(l, o, a);
61066                this._transformApplyFlags = 0;
61067              }
61068            }
61069            class J1 extends K1 {
61070              apply(t) {
61071                const {_properties: {position: e, scale: i, rotation: s, eulerAngles: n}} = this;
61072                if (e && e.accumulatedWeight) {
61073                  this._transformApplyFlags |= X1.POSITION;
61074                  e.accumulatedWeight < 1 && e.blend(t.position, 1 - e.accumulatedWeight);
61075                }
61076                if (i && i.accumulatedWeight) {
61077                  this._transformApplyFlags |= X1.SCALE;
61078                  i.accumulatedWeight < 1 && i.blend(t.scale, 1 - i.accumulatedWeight);
61079                }
61080                if (n && n.accumulatedWeight) {
61081                  this._transformApplyFlags |= X1.EULER_ANGLES;
61082                  n.accumulatedWeight < 1 && n.blend(t.eulerAngles, 1 - n.accumulatedWeight);
61083                }
61084                if (s && s.accumulatedWeight) {
61085                  this._transformApplyFlags |= X1.ROTATION;
61086                  s.accumulatedWeight < 1 && s.blend(t.rotation, 1 - s.accumulatedWeight);
61087                }
61088                super.apply(t);
61089                null == e || e.reset();
61090                null == i || i.reset();
61091                null == s || s.reset();
61092                null == n || n.reset();
61093              }
61094              _createVec3BlendState(t) {
61095                return new Y1;
61096              }
61097              _createQuatBlendState(t) {
61098                return new q1;
61099              }
61100            }
61101            class Z1 extends H1 {
61102              createNodeBlendState() {
61103                return new J1;
61104              }
61105            }
61106            class Q1 {
61107              constructor(t) {
61108                this.refCount = 0;
61109                this.result = new Pi;
61110                this._defaultValue = new Pi;
61111                this._clipBlendResult = new Pi;
61112                this._accumulatedWeight = 0;
61113                Pi.copy(this._defaultValue, t);
61114                Pi.copy(this.result, t);
61115              }
61116              blend(t, e) {
61117                this._accumulatedWeight = s2(this._clipBlendResult, this._clipBlendResult, this._accumulatedWeight, t, e);
61118              }
61119              commitLayerChange(t) {
61120                const {result: e, _clipBlendResult: i, _accumulatedWeight: s} = this;
61121                s < 1 && this.blend(this._defaultValue, 1 - s);
61122                Pi.lerp(e, e, i, t);
61123                Pi.zero(this._clipBlendResult);
61124                this._accumulatedWeight = 0;
61125              }
61126              reset() {
61127                Pi.copy(this.result, this._defaultValue);
61128              }
61129            }
61130            class $1 {
61131              constructor(t) {
61132                this.refCount = 0;
61133                this.result = new Ui;
61134                this._defaultValue = new Ui;
61135                this._clipBlendResult = new Ui;
61136                this._accumulatedWeight = 0;
61137                Ui.copy(this._defaultValue, t);
61138                Ui.copy(this.result, t);
61139              }
61140              blend(t, e) {
61141                this._accumulatedWeight = n2(this._clipBlendResult, this._clipBlendResult, this._accumulatedWeight, t, e);
61142              }
61143              commitLayerChange(t) {
61144                const {result: e, _clipBlendResult: i, _accumulatedWeight: s} = this;
61145                s < 1 && this.blend(this._defaultValue, 1 - s);
61146                Ui.slerp(e, e, i, t);
61147                Ui.identity(this._clipBlendResult);
61148                this._accumulatedWeight = 0;
61149              }
61150              reset() {
61151                Ui.copy(this.result, this._defaultValue);
61152              }
61153            }
61154            class t2 extends K1 {
61155              constructor(...t) {
61156                super(...t);
61157                this._layerMask = -1 >>> 0;
61158              }
61159              setLayerMask(t) {
61160                this._layerMask &= ~(1 << t);
61161              }
61162              commitLayerChanges(t, e) {
61163                if (!(this._layerMask & 1 << t)) return;
61164                const {_properties: {position: i, scale: s, rotation: n, eulerAngles: r}} = this;
61165                i && i.commitLayerChange(e);
61166                s && s.commitLayerChange(e);
61167                n && n.commitLayerChange(e);
61168                r && r.commitLayerChange(e);
61169              }
61170              apply(t) {
61171                this._transformApplyFlags = W1;
61172                super.apply(t);
61173                const {_properties: {position: e, scale: i, rotation: s, eulerAngles: n}} = this;
61174                null == e || e.reset();
61175                null == i || i.reset();
61176                null == s || s.reset();
61177                null == n || n.reset();
61178              }
61179              _createVec3BlendState(t) {
61180                return new Q1(t);
61181              }
61182              _createQuatBlendState(t) {
61183                return new $1(t);
61184              }
61185            }
61186            class e2 extends H1 {
61187              setMask(t, e) {
61188                i2(t);
61189                this._nodeBlendStates.forEach(((i, s) => {
61190                  e.has(s) && i.setLayerMask(t);
61191                }));
61192              }
61193              commitLayerChanges(t, e) {
61194                i2(t);
61195                this._nodeBlendStates.forEach(((i, s) => {
61196                  i.commitLayerChanges(t, e);
61197                }));
61198              }
61199              createNodeBlendState() {
61200                return new t2;
61201              }
61202            }
61203            function i2(t) {
61204              ne(t < 32);
61205            }
61206            function s2(t, e, i, s, n) {
61207              const r = i + n;
61208              if (1 !== n || i) {
61209                if (r) {
61210                  const e = n / r;
61211                  Pi.lerp(t, t, s, e);
61212                }
61213              } else Pi.copy(t, s);
61214              return r;
61215            }
61216            function n2(t, e, i, s, n) {
61217              const r = i + n;
61218              if (1 !== n || i) {
61219                if (r) {
61220                  const i = n / r;
61221                  Ui.slerp(t, e, s, i);
61222                }
61223              } else Ui.copy(t, s);
61224              return r;
61225            }
61226            var r2;
61227            let o2 = Ul("cc.animation.StateMachineComponent")(r2 = class {
61228              onMotionStateEnter(t, e) {}
61229              onMotionStateExit(t, e) {}
61230              onMotionStateUpdate(t, e) {}
61231              onStateMachineEnter(t) {}
61232              onStateMachineExit(t) {}
61233            }) || r2;
61234            class a2 {
61235              constructor(t, e, i) {
61236                this._blendBuffer = new e2;
61237                this._currentTransitionCache = {
61238                  duration: 0,
61239                  time: 0
61240                };
61241                this._varInstances = {};
61242                this._hasAutoTrigger = !1;
61243                if (t.layers.length >= 32) throw new Error(`Max layer count exceeds. Allowed: 32, actual: ${t.layers.length}`);
61244                for (const [e, i] of t.variables) {
61245                  const t = this._varInstances[e] = new aJ(i.type, i.value);
61246                  if (i.type === rJ.TRIGGER) {
61247                    const {resetMode: e} = i;
61248                    t.resetMode = e;
61249                    e === oJ.NEXT_FRAME_OR_AFTER_CONSUMED && (this._hasAutoTrigger = !0);
61250                  }
61251                }
61252                const s = {
61253                  controller: i,
61254                  blendBuffer: this._blendBuffer,
61255                  node: e,
61256                  getVar: t => this._varInstances[t],
61257                  triggerResetFn: t => {
61258                    this.setValue(t, !1);
61259                  }
61260                };
61261                const n = (this._layerEvaluations = t.layers.map((t => {
61262                  var e;
61263                  return new l2(t, {
61264                    ...s,
61265                    mask: null !== (e = t.mask) && void 0 !== e ? e : void 0
61266                  });
61267                }))).length;
61268                for (let e = 0; e < n; ++e) {
61269                  const i = t.layers[e].mask;
61270                  if (i) {
61271                    const t = i.filterDisabledNodes(s.node);
61272                    this._blendBuffer.setMask(e, t);
61273                  }
61274                }
61275              }
61276              update(t) {
61277                const {_blendBuffer: e, _layerEvaluations: i} = this;
61278                const s = i.length;
61279                for (let n = 0; n < s; ++n) {
61280                  const s = i[n];
61281                  s.update(t);
61282                  e.commitLayerChanges(n, s.weight * s.passthroughWeight);
61283                }
61284                if (this._hasAutoTrigger) {
61285                  const {_varInstances: t} = this;
61286                  for (const e in t) {
61287                    const i = t[e];
61288                    i.type === rJ.TRIGGER && i.resetMode === oJ.NEXT_FRAME_OR_AFTER_CONSUMED && (i.value = !1);
61289                  }
61290                }
61291                this._blendBuffer.apply();
61292              }
61293              getVariables() {
61294                return Object.entries(this._varInstances);
61295              }
61296              getCurrentStateStatus(t) {
61297                return this._layerEvaluations[t].getCurrentStateStatus();
61298              }
61299              getCurrentClipStatuses(t) {
61300                return this._layerEvaluations[t].getCurrentClipStatuses();
61301              }
61302              getCurrentTransition(t) {
61303                const {_layerEvaluations: e, _currentTransitionCache: i} = this;
61304                return e[t].getCurrentTransition(i) ? i : null;
61305              }
61306              getNextStateStatus(t) {
61307                return this._layerEvaluations[t].getNextStateStatus();
61308              }
61309              getNextClipStatuses(t) {
61310                se(this.getCurrentTransition(t), "!!this.getCurrentTransition(layer)");
61311                return this._layerEvaluations[t].getNextClipStatuses();
61312              }
61313              getValue(t) {
61314                const e = this._varInstances[t];
61315                return e ? e.value : void 0;
61316              }
61317              setValue(t, e) {
61318                const i = this._varInstances[t];
61319                i && (i.value = e);
61320              }
61321              getLayerWeight(t) {
61322                return this._layerEvaluations[t].weight;
61323              }
61324              setLayerWeight(t, e) {
61325                this._layerEvaluations[t].weight = e;
61326              }
61327            }
61328            class l2 {
61329              constructor(t, e) {
61330                this.passthroughWeight = 1;
61331                this._nodes = [];
61332                this._topLevelEntry = void 0;
61333                this._topLevelExit = void 0;
61334                this._currentNode = void 0;
61335                this._currentTransitionToNode = null;
61336                this._currentTransitionPath = [];
61337                this._transitionProgress = 0;
61338                this._fromWeight = 0;
61339                this._toWeight = 0;
61340                this._fromUpdated = !1;
61341                this._toUpdated = !1;
61342                this._transitionSnapshot = new v2;
61343                this.name = t.name;
61344                this._controller = e.controller;
61345                this.weight = t.weight;
61346                const {entry: i, exit: s} = this._addStateMachine(t.stateMachine, null, {
61347                  ...e
61348                }, t.name);
61349                this._topLevelEntry = i;
61350                this._topLevelExit = s;
61351                this._currentNode = i;
61352                this._resetTrigger = e.triggerResetFn;
61353              }
61354              get exited() {
61355                return this._currentNode === this._topLevelExit;
61356              }
61357              update(t) {
61358                if (!this.exited) {
61359                  this._fromWeight = 1;
61360                  this._toWeight = 0;
61361                  this._eval(t);
61362                  this._sample();
61363                }
61364              }
61365              getCurrentStateStatus() {
61366                const {_currentNode: t} = this;
61367                return t.kind === p2.animation ? t.getFromPortStatus() : t.kind === p2.transitionSnapshot ? t.first.getFromPortStatus() : null;
61368              }
61369              getCurrentClipStatuses() {
61370                const {_currentNode: t} = this;
61371                return t.kind === p2.animation ? t.getClipStatuses(this._fromWeight) : t.kind === p2.transitionSnapshot ? t.first.getClipStatuses(this._fromWeight) : u2;
61372              }
61373              getCurrentTransition(t) {
61374                const {_currentTransitionPath: e} = this;
61375                if (0 !== e.length) {
61376                  if (e[e.length - 1].to.kind !== p2.animation) return !1;
61377                  const {duration: i, normalizedDuration: s} = e[0];
61378                  const n = t.duration = s ? i * (this._currentNode.kind === p2.animation ? this._currentNode.duration : this._currentNode.kind === p2.transitionSnapshot ? this._currentNode.first.duration : 0) : i;
61379                  t.time = this._transitionProgress * n;
61380                  return !0;
61381                }
61382                return !1;
61383              }
61384              getNextStateStatus() {
61385                ne(this._currentTransitionToNode && this._currentTransitionToNode.kind !== p2.empty, "There is no transition currently in layer.");
61386                return this._currentTransitionToNode.getToPortStatus();
61387              }
61388              getNextClipStatuses() {
61389                var t;
61390                const {_currentTransitionPath: e} = this;
61391                const i = e.length;
61392                ne(i > 0, "There is no transition currently in layer.");
61393                const s = e[i - 1].to;
61394                ne(s.kind === p2.animation);
61395                return null !== (t = s.getClipStatuses(this._toWeight)) && void 0 !== t ? t : u2;
61396              }
61397              _addStateMachine(t, e, i, s) {
61398                const n = Array.from(t.states());
61399                let r;
61400                let o;
61401                let a;
61402                const l = n.map((e => {
61403                  if (e instanceof MJ) return new g2(e, i);
61404                  if (e === t.entryState) return r = new S2(e, p2.entry, e.name);
61405                  if (e === t.exitState) return a = new S2(e, p2.exit, e.name);
61406                  if (e === t.anyState) return o = new S2(e, p2.any, e.name);
61407                  if (e instanceof NZ) return new A2(e);
61408                  ne(e instanceof VZ);
61409                  return null;
61410                }));
61411                se(r, "Entry node is missing");
61412                se(a, "Exit node is missing");
61413                se(o, "Any node is missing");
61414                const h = {
61415                  components: null,
61416                  parent: e,
61417                  entry: r,
61418                  exit: a,
61419                  any: o
61420                };
61421                for (let t = 0; t < n.length; ++t) {
61422                  const e = l[t];
61423                  e && (e.stateMachine = h);
61424                }
61425                const c = n.map((t => {
61426                  if (t instanceof VZ) {
61427                    const e = this._addStateMachine(t.stateMachine, h, i, `${s}/${t.name}`);
61428                    e.components = new f2(t);
61429                    return e;
61430                  }
61431                  return null;
61432                }));
61433                for (const t of l) t && (t.__DEBUG_ID__ = `${t.name}(from ${s})`);
61434                for (let e = 0; e < n.length; ++e) {
61435                  const s = n[e];
61436                  const r = t.getOutgoings(s);
61437                  const o = [];
61438                  let a;
61439                  if (s instanceof VZ) {
61440                    const t = c[e];
61441                    se(t);
61442                    a = t.exit;
61443                  } else {
61444                    const t = l[e];
61445                    se(t);
61446                    a = t;
61447                  }
61448                  for (const t of r) {
61449                    const e = t.to;
61450                    const s = n.findIndex((e => e === t.to));
61451                    s < 0 && ne(!1, "Bad animation data");
61452                    let r;
61453                    if (e instanceof VZ) {
61454                      const t = c[s];
61455                      se(t);
61456                      r = t.entry;
61457                    } else {
61458                      const t = l[s];
61459                      se(t);
61460                      r = t;
61461                    }
61462                    const a = {
61463                      conditions: t.conditions.map((t => t[uJ](i))),
61464                      to: r,
61465                      triggers: void 0,
61466                      duration: 0,
61467                      normalizedDuration: !1,
61468                      destinationStart: 0,
61469                      relativeDestinationStart: !1,
61470                      exitCondition: 0,
61471                      exitConditionEnabled: !1,
61472                      interruption: PZ.NONE
61473                    };
61474                    if (t instanceof OZ) {
61475                      a.duration = t.duration;
61476                      a.normalizedDuration = t.relativeDuration;
61477                      a.exitConditionEnabled = t.exitConditionEnabled;
61478                      a.exitCondition = t.exitCondition;
61479                      a.destinationStart = t.destinationStart;
61480                      a.relativeDestinationStart = t.relativeDestinationStart;
61481                      a.interruption = t.interruptionSource;
61482                    } else if (t instanceof LZ) {
61483                      a.duration = t.duration;
61484                      a.destinationStart = t.destinationStart;
61485                      a.relativeDestinationStart = t.relativeDestinationStart;
61486                    }
61487                    a.conditions.forEach(((e, i) => {
61488                      const s = t.conditions[i];
61489                      if (s instanceof G1 && s.trigger) {
61490                        var n;
61491                        (null !== (n = a.triggers) && void 0 !== n ? n : a.triggers = []).push(s.trigger);
61492                      }
61493                    }));
61494                    o.push(a);
61495                  }
61496                  a.outgoingTransitions = o;
61497                }
61498                return h;
61499              }
61500              _eval(t) {
61501                ne(!this.exited);
61502                H$(`[Layer ${this.name}]: UpdateStart ${t}s`);
61503                if (this._continueDanglingTransition()) return 0;
61504                let e = t;
61505                for (let t = !0, i = 0; t || e > 0; ) {
61506                  t = !1;
61507                  if (100 === i) {
61508                    N(14e3, 100);
61509                    break;
61510                  }
61511                  ++i;
61512                  if (this._currentTransitionPath.length > 0) {
61513                    const i = this._detectInterruption(e, d2);
61514                    if (i) {
61515                      e -= i.requires;
61516                      if (this._interrupt(i)) break;
61517                      t = !0;
61518                      continue;
61519                    }
61520                    e -= this._updateCurrentTransition(e);
61521                    if (this._currentNode.kind === p2.exit) break;
61522                    0 === this._currentTransitionPath.length && (t = !0);
61523                    continue;
61524                  }
61525                  const {_currentNode: s} = this;
61526                  const n = this._matchCurrentNodeTransition(e);
61527                  if (n) {
61528                    const {transition: i, requires: r} = n;
61529                    z$(`[SubStateMachine ${this.name}]: CurrentNodeUpdate: ${s.name}`);
61530                    e -= r;
61531                    if (s.kind === p2.animation) {
61532                      s.updateFromPort(r);
61533                      this._fromUpdated = !0;
61534                    }
61535                    if (this._switchTo(i)) break;
61536                    t = !0;
61537                  } else {
61538                    z$(`[SubStateMachine ${this.name}]: CurrentNodeUpdate: ${s.name}`);
61539                    if (s.kind === p2.animation) {
61540                      s.updateFromPort(e);
61541                      this._fromUpdated = !0;
61542                      e = 0;
61543                    } else e = 0;
61544                  }
61545                }
61546                z$(`[SubStateMachine ${this.name}]: UpdateEnd`);
61547                if (this._fromUpdated && this._currentNode.kind === p2.animation) {
61548                  this._fromUpdated = !1;
61549                  this._currentNode.triggerFromPortUpdate(this._controller);
61550                }
61551                if (this._currentTransitionToNode && this._toUpdated && this._currentTransitionToNode.kind === p2.animation) {
61552                  this._toUpdated = !1;
61553                  this._currentTransitionToNode.triggerToPortUpdate(this._controller);
61554                }
61555                return e;
61556              }
61557              _sample() {
61558                const {_currentNode: t, _currentTransitionToNode: e, _fromWeight: i, _toWeight: s} = this;
61559                if (t.kind === p2.empty) {
61560                  this.passthroughWeight = s;
61561                  e && e.kind === p2.animation && e.sampleToPort(1);
61562                } else if (e && e.kind === p2.empty) {
61563                  this.passthroughWeight = i;
61564                  this._sampleSource(1);
61565                } else {
61566                  this.passthroughWeight = 1;
61567                  this._sampleSource(i);
61568                  e && e.kind === p2.animation && e.sampleToPort(s);
61569                }
61570              }
61571              _sampleSource(t) {
61572                const {_currentNode: e} = this;
61573                e.kind === p2.animation ? e.sampleFromPort(t) : e.kind === p2.transitionSnapshot && e.sample(t);
61574              }
61575              _matchCurrentNodeTransition(t) {
61576                const e = this._currentNode;
61577                const i = _2.reset();
61578                this._matchTransition(e, e, t, null, i);
61579                if (i.hasZeroCost()) return i;
61580                if (e.kind === p2.animation) {
61581                  this._matchAnyScoped(e, t, i);
61582                  if (i.hasZeroCost()) return i;
61583                }
61584                return i.isValid() ? i : null;
61585              }
61586              _matchAnyScoped(t, e, i) {
61587                let s = !1;
61588                for (let n = t.stateMachine; null !== n; n = n.parent) {
61589                  this._matchTransition(n.any, t, e, null, i) && (s = !0);
61590                  if (i.hasZeroCost()) break;
61591                }
61592                return s;
61593              }
61594              _matchTransition(t, e, i, s, n) {
61595                ne(t === e || t.kind === p2.any);
61596                const {outgoingTransitions: r} = t;
61597                const o = r.length;
61598                let a = !1;
61599                for (let l = 0; l < o; ++l) {
61600                  const o = r[l];
61601                  if (o === s) continue;
61602                  const {conditions: h} = o;
61603                  const c = h.length;
61604                  if (0 === c) {
61605                    if (t.kind === p2.entry || t.kind === p2.exit) {
61606                      n.set(o, 0);
61607                      a = !0;
61608                      break;
61609                    }
61610                    if (!o.exitConditionEnabled) continue;
61611                  }
61612                  let u = 0;
61613                  if (e.kind === p2.animation && o.exitConditionEnabled) {
61614                    const t = e.duration * o.exitCondition;
61615                    u = Math.max(t - e.fromPortTime, 0);
61616                    if (u > i || u >= n.requires) continue;
61617                  }
61618                  let _ = !0;
61619                  for (let t = 0; t < c; ++t) {
61620                    if (!h[t].eval()) {
61621                      _ = !1;
61622                      break;
61623                    }
61624                  }
61625                  if (_) {
61626                    if (0 === u) {
61627                      n.set(o, 0);
61628                      a = !0;
61629                      break;
61630                    }
61631                    ne(u <= n.requires);
61632                    n.set(o, u);
61633                    a = !0;
61634                  }
61635                }
61636                return a;
61637              }
61638              _switchTo(t) {
61639                const {_currentTransitionPath: e} = this;
61640                this._consumeTransition(t);
61641                e.push(t);
61642                const i = this._matchTransitionPathUntilMotion();
61643                if (i) {
61644                  this._doTransitionToMotion(i);
61645                  return !1;
61646                }
61647                return !0;
61648              }
61649              _continueDanglingTransition() {
61650                const {_currentTransitionPath: t} = this;
61651                const e = t.length;
61652                if (0 === e) return !1;
61653                const i = t[e - 1].to;
61654                if (i.kind !== p2.animation && i.kind !== p2.empty) {
61655                  const t = this._matchTransitionPathUntilMotion();
61656                  if (t) {
61657                    this._doTransitionToMotion(t);
61658                    return !1;
61659                  }
61660                  return !0;
61661                }
61662                return !1;
61663              }
61664              _matchTransitionPathUntilMotion() {
61665                const {_currentTransitionPath: t} = this;
61666                const e = t.length;
61667                ne(0 !== e);
61668                let i = t[e - 1].to;
61669                for (;i.kind !== p2.animation && i.kind !== p2.empty; ) {
61670                  const e = _2.reset();
61671                  this._matchTransition(i, i, 0, null, e);
61672                  if (!e.transition) break;
61673                  const s = e.transition;
61674                  this._consumeTransition(s);
61675                  t.push(s);
61676                  i = s.to;
61677                }
61678                return i.kind === p2.animation || i.kind === p2.empty ? i : null;
61679              }
61680              _consumeTransition(t) {
61681                const {to: e} = t;
61682                e.kind === p2.entry && this._callEnterMethods(e);
61683              }
61684              _resetTriggersAlongThePath() {
61685                const {_currentTransitionPath: t} = this;
61686                const e = t.length;
61687                for (let i = 0; i < e; ++i) {
61688                  const e = t[i];
61689                  this._resetTriggersOnTransition(e);
61690                }
61691              }
61692              _doTransitionToMotion(t) {
61693                const {_currentTransitionPath: e} = this;
61694                ne(0 !== e.length);
61695                this._resetTriggersAlongThePath();
61696                this._transitionProgress = 0;
61697                this._currentTransitionToNode = t;
61698                this._toUpdated = !1;
61699                if (t.kind === p2.animation) {
61700                  const {destinationStart: i, relativeDestinationStart: s} = e[0];
61701                  const n = s ? i : 0 === t.duration ? 0 : i / t.duration;
61702                  t.resetToPort(n);
61703                }
61704                this._callEnterMethods(t);
61705              }
61706              _updateCurrentTransition(t) {
61707                var e;
61708                const {_currentTransitionPath: i, _currentTransitionToNode: s} = this;
61709                se(i.length > 0);
61710                se(s);
61711                const n = i[0];
61712                const {duration: r, normalizedDuration: o} = n;
61713                const a = this._currentNode;
61714                const l = s;
61715                let h = 0;
61716                let c = 0;
61717                if (r <= 0) {
61718                  h = 0;
61719                  c = 1;
61720                } else {
61721                  ne(a.kind === p2.animation || a.kind === p2.empty || a.kind === p2.transitionSnapshot);
61722                  const {_transitionProgress: e} = this;
61723                  const i = a.kind === p2.empty ? r : o ? r * (a.kind === p2.animation ? a.duration : a.first.duration) : r;
61724                  const s = e * i;
61725                  const n = i - s;
61726                  ne(n >= 0);
61727                  h = Math.min(n, t);
61728                  c = this._transitionProgress = (s + h) / i;
61729                  ne(c >= 0 && c <= 1);
61730                }
61731                const u = null !== (e = null == l ? void 0 : l.name) && void 0 !== e ? e : "<Empty>";
61732                this._fromWeight = 1 - c;
61733                this._toWeight = c;
61734                const _ = 0 !== h;
61735                const d = 1 === c;
61736                if (a.kind === p2.animation && _) {
61737                  H$(`Update ${a.name}`);
61738                  a.updateFromPort(h);
61739                  this._fromUpdated = !0;
61740                }
61741                if (l.kind === p2.animation && _) {
61742                  H$(`Update ${l.name}`);
61743                  l.updateToPort(h);
61744                  this._toUpdated = !0;
61745                }
61746                if (d) {
61747                  z$(`[SubStateMachine ${this.name}]: Transition finished:  ${a.name} -> ${u}.`);
61748                  this._finishCurrentTransition();
61749                }
61750                return h;
61751              }
61752              _finishCurrentTransition() {
61753                const {_currentTransitionPath: t, _currentTransitionToNode: e} = this;
61754                se(t.length > 0);
61755                se(e);
61756                const i = this._currentNode;
61757                const s = e;
61758                this._callExitMethods(i);
61759                const {_currentTransitionPath: n} = this;
61760                const r = n.length;
61761                for (let t = 0; t < r; ++t) {
61762                  const {to: e} = n[t];
61763                  e.kind === p2.exit && this._callExitMethods(e);
61764                }
61765                this._fromUpdated = this._toUpdated;
61766                this._toUpdated = !1;
61767                this._dropCurrentTransition();
61768                this._currentNode = s;
61769                i.kind === p2.transitionSnapshot && i.clear();
61770              }
61771              _dropCurrentTransition() {
61772                const {_currentTransitionToNode: t} = this;
61773                se(t);
61774                t.kind === p2.animation && t.finishTransition();
61775                this._currentTransitionToNode = null;
61776                this._currentTransitionPath.length = 0;
61777                this._fromWeight = 1;
61778                this._toWeight = 0;
61779              }
61780              _detectInterruption(t, e) {
61781                const {_currentTransitionPath: i, _currentNode: s, _currentTransitionToNode: n} = this;
61782                if (s.kind !== p2.animation && s.kind !== p2.transitionSnapshot) return null;
61783                if (!n || n.kind !== p2.animation) return null;
61784                ne(0 !== i.length);
61785                const r = i[0];
61786                const {interruption: o} = r;
61787                if (o === PZ.NONE) return null;
61788                const a = _2.reset();
61789                let l = null;
61790                const h = s.kind === p2.animation ? s : s.first;
61791                let c = this._matchAnyScoped(h, t, a);
61792                c && (l = h);
61793                a.hasZeroCost();
61794                const u = o === PZ.CURRENT_STATE || o === PZ.CURRENT_STATE_THEN_NEXT_STATE ? h2(s) : n;
61795                c = this._matchTransition(u, u, t, r, a);
61796                c && (l = u);
61797                a.hasZeroCost();
61798                const _ = o === PZ.NEXT_STATE_THEN_CURRENT_STATE ? h2(s) : o === PZ.CURRENT_STATE_THEN_NEXT_STATE ? n : null;
61799                if (_) {
61800                  c = this._matchTransition(_, _, t, r, a);
61801                  c && (l = _);
61802                  a.hasZeroCost();
61803                }
61804                if (_2.transition) {
61805                  se(l);
61806                  return e.set(l, _2.transition, _2.requires);
61807                }
61808                return null;
61809              }
61810              _interrupt({from: t, transition: e, requires: i}) {
61811                const {_currentNode: s} = this;
61812                ne(s.kind === p2.animation || s.kind === p2.transitionSnapshot);
61813                if (s.kind === p2.animation) {
61814                  s.updateFromPort(i);
61815                  this._fromUpdated = !0;
61816                  const {_transitionSnapshot: t} = this;
61817                  ne(t.empty);
61818                  t.enqueue(s, 1);
61819                }
61820                this._takeCurrentTransitionSnapshot(t);
61821                this._dropCurrentTransition();
61822                this._currentNode = this._transitionSnapshot;
61823                return this._switchTo(e);
61824              }
61825              _takeCurrentTransitionSnapshot(t) {
61826                const {_currentTransitionPath: e, _currentTransitionToNode: i, _transitionSnapshot: s} = this;
61827                ne(0 !== e.length);
61828                ne(i && i.kind === p2.animation);
61829                const n = e[0];
61830                const {duration: r, normalizedDuration: o} = n;
61831                const a = t;
61832                let l = 0;
61833                if (r <= 0) l = 1; else {
61834                  const {_transitionProgress: t} = this;
61835                  const e = o ? r * a.duration : r;
61836                  const i = t * e;
61837                  ne(e - i >= 0);
61838                  l = i / e;
61839                  ne(l >= 0 && l <= 1);
61840                }
61841                s.enqueue(i, l);
61842              }
61843              _resetTriggersOnTransition(t) {
61844                const {triggers: e} = t;
61845                if (e) {
61846                  const t = e.length;
61847                  for (let i = 0; i < t; ++i) {
61848                    const t = e[i];
61849                    this._resetTrigger(t);
61850                  }
61851                }
61852              }
61853              _resetTrigger(t) {
61854                const {_triggerReset: e} = this;
61855                e(t);
61856              }
61857              _callEnterMethods(t) {
61858                var e;
61859                const {_controller: i} = this;
61860                switch (t.kind) {
61861                 default:
61862                  break;
61863
61864                 case p2.animation:
61865                  t.components.callMotionStateEnterMethods(i, t.getToPortStatus());
61866                  break;
61867
61868                 case p2.entry:
61869                  null === (e = t.stateMachine.components) || void 0 === e || e.callStateMachineEnterMethods(i);
61870                }
61871              }
61872              _callExitMethods(t) {
61873                var e;
61874                const {_controller: i} = this;
61875                switch (t.kind) {
61876                 default:
61877                  break;
61878
61879                 case p2.animation:
61880                  t.components.callMotionStateExitMethods(i, t.getFromPortStatus());
61881                  break;
61882
61883                 case p2.exit:
61884                  null === (e = t.stateMachine.components) || void 0 === e || e.callStateMachineExitMethods(i);
61885                }
61886              }
61887            }
61888            function h2(t) {
61889              return t.kind === p2.animation ? t : t.first;
61890            }
61891            const c2 = Object.freeze({
61892              next: (...t) => ({
61893                done: !0,
61894                value: void 0
61895              })
61896            });
61897            const u2 = Object.freeze({
61898              [Symbol.iterator]: () => c2
61899            });
61900            const _2 = new class {
61901              constructor() {
61902                this.transition = null;
61903                this.requires = 1 / 0;
61904              }
61905              hasZeroCost() {
61906                return 0 === this.requires;
61907              }
61908              isValid() {
61909                return null !== this.transition;
61910              }
61911              set(t, e) {
61912                this.transition = t;
61913                this.requires = e;
61914                return this;
61915              }
61916              reset() {
61917                this.requires = 1 / 0;
61918                this.transition = null;
61919                return this;
61920              }
61921            };
61922            const d2 = new class {
61923              constructor() {
61924                this.transition = null;
61925                this.requires = 0;
61926                this.from = null;
61927              }
61928              set(t, e, i) {
61929                this.from = t;
61930                this.transition = e;
61931                this.requires = i;
61932                return this;
61933              }
61934            };
61935            var p2;
61936            !function(t) {
61937              t[t.entry = 0] = "entry";
61938              t[t.exit = 1] = "exit";
61939              t[t.any = 2] = "any";
61940              t[t.animation = 3] = "animation";
61941              t[t.empty = 4] = "empty";
61942              t[t.transitionSnapshot = 5] = "transitionSnapshot";
61943            }(p2 || (p2 = {}));
61944            class m2 {
61945              constructor(t) {
61946                this.name = void 0;
61947                this.outgoingTransitions = [];
61948                this.name = t.name;
61949              }
61950            }
61951            class f2 {
61952              constructor(t) {
61953                this._components = t.instantiateComponents();
61954              }
61955              callMotionStateEnterMethods(t, e) {
61956                this._callMotionStateCallbackIfNonDefault("onMotionStateEnter", t, e);
61957              }
61958              callMotionStateUpdateMethods(t, e) {
61959                this._callMotionStateCallbackIfNonDefault("onMotionStateUpdate", t, e);
61960              }
61961              callMotionStateExitMethods(t, e) {
61962                this._callMotionStateCallbackIfNonDefault("onMotionStateExit", t, e);
61963              }
61964              callStateMachineEnterMethods(t) {
61965                this._callStateMachineCallbackIfNonDefault("onStateMachineEnter", t);
61966              }
61967              callStateMachineExitMethods(t) {
61968                this._callStateMachineCallbackIfNonDefault("onStateMachineExit", t);
61969              }
61970              _callMotionStateCallbackIfNonDefault(t, e, i) {
61971                const {_components: s} = this;
61972                const n = s.length;
61973                for (let r = 0; r < n; ++r) {
61974                  const n = s[r];
61975                  n[t] !== o2.prototype[t] && n[t](e, i);
61976                }
61977              }
61978              _callStateMachineCallbackIfNonDefault(t, e) {
61979                const {_components: i} = this;
61980                const s = i.length;
61981                for (let n = 0; n < s; ++n) {
61982                  const s = i[n];
61983                  s[t] !== o2.prototype[t] && s[t](e);
61984                }
61985              }
61986            }
61987            class g2 extends m2 {
61988              constructor(t, e) {
61989                var i, s;
61990                super(t);
61991                this.kind = p2.animation;
61992                this._source = null;
61993                this._baseSpeed = 1;
61994                this._speed = 1;
61995                this._fromPort = {
61996                  progress: 0,
61997                  statusCache: {
61998                    progress: 0
61999                  }
62000                };
62001                this._toPort = {
62002                  progress: 0,
62003                  statusCache: {
62004                    progress: 0
62005                  }
62006                };
62007                this._baseSpeed = t.speed;
62008                this._setSpeedMultiplier(1);
62009                if (t.speedMultiplierEnabled && t.speedMultiplier) {
62010                  const i = t.speedMultiplier;
62011                  const s = e.getVar(i);
62012                  if (_0(s, i)) {
62013                    !function(t, e, i) {
62014                      if (t !== e) throw new cJ(i, "number");
62015                    }(s.type, rJ.FLOAT, i);
62016                    s.bind(this._setSpeedMultiplier, this);
62017                    const t = s.value;
62018                    this._setSpeedMultiplier(t);
62019                  }
62020                }
62021                const n = {
62022                  ...e
62023                };
62024                const r = null !== (i = null === (s = t.motion) || void 0 === s ? void 0 : s[uJ](n)) && void 0 !== i ? i : null;
62025                r && Object.defineProperty(r, "__DEBUG_ID__", {
62026                  value: this.name
62027                });
62028                this._source = r;
62029                this.components = new f2(t);
62030              }
62031              get duration() {
62032                var t, e;
62033                return null !== (t = null === (e = this._source) || void 0 === e ? void 0 : e.duration) && void 0 !== t ? t : 0;
62034              }
62035              get fromPortTime() {
62036                return this._fromPort.progress * this.duration;
62037              }
62038              updateFromPort(t) {
62039                this._fromPort.progress = y2(this._fromPort.progress, this.duration, t * this._speed);
62040              }
62041              updateToPort(t) {
62042                ne(!Number.isNaN(this._toPort.progress));
62043                this._toPort.progress = y2(this._toPort.progress, this.duration, t * this._speed);
62044              }
62045              triggerFromPortUpdate(t) {
62046                this.components.callMotionStateUpdateMethods(t, this.getFromPortStatus());
62047              }
62048              triggerToPortUpdate(t) {
62049                this.components.callMotionStateUpdateMethods(t, this.getToPortStatus());
62050              }
62051              getFromPortStatus() {
62052                const {statusCache: t} = this._fromPort;
62053                t.__DEBUG_ID__ = this.name;
62054                t.progress = b2(this._fromPort.progress);
62055                return t;
62056              }
62057              getToPortStatus() {
62058                ne(!Number.isNaN(this._toPort.progress));
62059                const {statusCache: t} = this._toPort;
62060                t.__DEBUG_ID__ = this.name;
62061                t.progress = b2(this._toPort.progress);
62062                return t;
62063              }
62064              resetToPort(t) {
62065                this._toPort.progress = t;
62066              }
62067              finishTransition() {
62068                this._fromPort.progress = this._toPort.progress;
62069                this._toPort.progress = Number.NaN;
62070              }
62071              sampleFromPort(t) {
62072                var e;
62073                null === (e = this._source) || void 0 === e || e.sample(this._fromPort.progress, t);
62074              }
62075              sampleToPort(t) {
62076                var e;
62077                ne(!Number.isNaN(this._toPort.progress));
62078                null === (e = this._source) || void 0 === e || e.sample(this._toPort.progress, t);
62079              }
62080              getClipStatuses(t) {
62081                const {_source: e} = this;
62082                return e ? {
62083                  [Symbol.iterator]: () => e.getClipStatuses(t)
62084                } : u2;
62085              }
62086              _setSpeedMultiplier(t) {
62087                this._speed = this._baseSpeed * t;
62088              }
62089            }
62090            function y2(t, e, i) {
62091              if (0 === e) return 0;
62092              return t + i / e;
62093            }
62094            function b2(t) {
62095              const e = t - Math.trunc(t);
62096              return e >= 0 ? e : 1 + e;
62097            }
62098            class S2 extends m2 {
62099              constructor(t, e, i) {
62100                super(t);
62101                this.kind = void 0;
62102                this.kind = e;
62103              }
62104            }
62105            class A2 extends m2 {
62106              constructor(t) {
62107                super(t);
62108                this.kind = p2.empty;
62109              }
62110            }
62111            class T2 {
62112              constructor(t, e) {
62113                this.motion = t;
62114                this.weight = e;
62115              }
62116            }
62117            class v2 extends m2 {
62118              constructor() {
62119                super({
62120                  name: "[[TransitionSnapshotEval]]"
62121                });
62122                this.kind = p2.transitionSnapshot;
62123                this._queue = [];
62124              }
62125              get empty() {
62126                return 0 === this._queue.length;
62127              }
62128              get first() {
62129                const {_queue: t} = this;
62130                ne(t.length > 0);
62131                return t[0].motion;
62132              }
62133              sample(t) {
62134                const {_queue: e} = this;
62135                const i = e.length;
62136                for (let s = 0; s < i; ++s) {
62137                  const {motion: i, weight: n} = e[s];
62138                  i.sampleFromPort(n * t);
62139                }
62140              }
62141              clear() {
62142                this._queue.length = 0;
62143              }
62144              enqueue(t, e) {
62145                const {_queue: i} = this;
62146                const s = i.length;
62147                const n = 1 - e;
62148                for (let t = 0; t < s; ++t) i[t].weight *= n;
62149                i.push(new T2(t, e));
62150              }
62151            }
62152            var E2, C2, x2, w2, R2, I2, M2;
62153            let B2 = (E2 = Ul("cc.animation.AnimationController"), C2 = $l(), x2 = jl(HZ), E2(w2 = C2(w2 = (R2 = (M2 = class extends Qc {
62154              constructor(...t) {
62155                super(...t);
62156                Ml(this, "graph", I2, this);
62157                this._graphEval = null;
62158              }
62159              __preload() {
62160                this.graph && (this._graphEval = new a2(this.graph, this.node, this));
62161              }
62162              update(t) {
62163                var e;
62164                null === (e = this._graphEval) || void 0 === e || e.update(t);
62165              }
62166              getVariables() {
62167                const {_graphEval: t} = this;
62168                se(t);
62169                return t.getVariables();
62170              }
62171              setValue(t, e) {
62172                const {_graphEval: i} = this;
62173                se(i);
62174                i.setValue(t, e);
62175              }
62176              getValue(t) {
62177                const {_graphEval: e} = this;
62178                se(e);
62179                return e.getValue(t);
62180              }
62181              getCurrentStateStatus(t) {
62182                const {_graphEval: e} = this;
62183                se(e);
62184                return e.getCurrentStateStatus(t);
62185              }
62186              getCurrentClipStatuses(t) {
62187                const {_graphEval: e} = this;
62188                se(e);
62189                return e.getCurrentClipStatuses(t);
62190              }
62191              getCurrentTransition(t) {
62192                const {_graphEval: e} = this;
62193                se(e);
62194                return e.getCurrentTransition(t);
62195              }
62196              getNextStateStatus(t) {
62197                const {_graphEval: e} = this;
62198                se(e);
62199                return e.getNextStateStatus(t);
62200              }
62201              getNextClipStatuses(t) {
62202                const {_graphEval: e} = this;
62203                se(e);
62204                return e.getNextClipStatuses(t);
62205              }
62206              getLayerWeight(t) {
62207                const {_graphEval: e} = this;
62208                se(e);
62209                return e.getLayerWeight(t);
62210              }
62211              setLayerWeight(t, e) {
62212                const {_graphEval: i} = this;
62213                se(i);
62214                return i.setLayerWeight(t, e);
62215              }
62216            }, M2), I2 = Bl(R2.prototype, "graph", [ x2 ], {
62217              configurable: !0,
62218              enumerable: !0,
62219              writable: !0,
62220              initializer: function() {
62221                return null;
62222              }
62223            }), R2)) || w2) || w2);
62224            var D2 = Object.freeze({
62225              __proto__: null,
62226              UniformProxyFactory: tK,
62227              MorphWeightValueProxy: uK,
62228              MorphWeightsValueProxy: _K,
62229              MorphWeightsAllValueProxy: dK,
62230              Track: kq,
62231              TrackPath: Fq,
62232              RealTrack: xK,
62233              VectorTrack: OK,
62234              QuatTrack: kK,
62235              ColorTrack: XK,
62236              SizeTrack: ZK,
62237              ObjectTrack: tJ,
62238              isPropertyPath: uq,
62239              isCustomPath: function(t, e) {
62240                return t instanceof e;
62241              },
62242              HierarchyPath: _q,
62243              ComponentPath: dq,
62244              CubicSplineVec2Value: SK,
62245              CubicSplineVec3Value: AK,
62246              CubicSplineVec4Value: TK,
62247              CubicSplineQuatValue: vK,
62248              CubicSplineNumberValue: EK,
62249              AnimationController: B2,
62250              get VariableType() {
62251                return rJ;
62252              },
62253              StateMachineComponent: o2
62254            });
62255            t("animation", D2);
62256            const P2 = [];
62257            const O2 = new Map;
62258            function N2(t, e) {
62259              let i = 0;
62260              let s = qi.IDENTITY;
62261              for (;t; ) {
62262                if (t.stamp === e || t.stamp + 1 === e && !t.node.hasChangedFlags) {
62263                  s = t.world;
62264                  t.stamp = e;
62265                  break;
62266                }
62267                t.stamp = e;
62268                P2[i++] = t;
62269                t = t.parent;
62270              }
62271              for (;i > 0; ) {
62272                t = P2[--i];
62273                P2[i] = null;
62274                const e = t.node;
62275                qi.fromRTS(t.local, e.rotation, e.position, e.scale);
62276                s = qi.multiply(t.world, s, t.local);
62277              }
62278              return s;
62279            }
62280            function L2(t, e) {
62281              let i = null;
62282              let s = 0;
62283              for (;t !== e; ) {
62284                const e = t.uuid;
62285                if (O2.has(e)) {
62286                  i = O2.get(e);
62287                  break;
62288                }
62289                i = {
62290                  node: t,
62291                  local: new qi,
62292                  world: new qi,
62293                  stamp: -1,
62294                  parent: null
62295                };
62296                O2.set(e, i);
62297                P2[s++] = i;
62298                t = t.parent;
62299                i = null;
62300              }
62301              let n;
62302              for (;s > 0; ) {
62303                n = P2[--s];
62304                P2[s] = null;
62305                n.parent = i;
62306                i = n;
62307              }
62308              return i;
62309            }
62310            function F2(t) {
62311              let e = O2.get(t.uuid) || null;
62312              for (;e; ) {
62313                O2.delete(e.node.uuid);
62314                e = e.parent;
62315              }
62316            }
62317            var V2, k2, U2;
62318            let G2 = t("AnimationManager", Ul(V2 = (U2 = k2 = class extends Tg {
62319              constructor(...t) {
62320                super(...t);
62321                this._anims = new nt([]);
62322                this._crossFades = new nt([]);
62323                this._delayEvents = [];
62324                this._blendStateBuffer = new Z1;
62325                this._sockets = [];
62326              }
62327              get blendState() {
62328                return this._blendStateBuffer;
62329              }
62330              addCrossFade(t) {
62331                -1 === this._crossFades.array.indexOf(t) && this._crossFades.push(t);
62332              }
62333              removeCrossFade(t) {
62334                const e = this._crossFades.array.indexOf(t);
62335                e >= 0 ? this._crossFades.fastRemoveAt(e) : F(3907);
62336              }
62337              update(t) {
62338                const {_delayEvents: e, _crossFades: i, _sockets: s} = this;
62339                {
62340                  const e = i.array;
62341                  for (i.i = 0; i.i < e.length; ++i.i) {
62342                    e[i.i].update(t);
62343                  }
62344                }
62345                const n = this._anims;
62346                const r = n.array;
62347                for (n.i = 0; n.i < r.length; ++n.i) {
62348                  const e = r[n.i];
62349                  e.isMotionless || e.update(t);
62350                }
62351                this._blendStateBuffer.apply();
62352                const o = m.director.getTotalFrames();
62353                for (let t = 0, e = s.length; t < e; t++) {
62354                  const {target: e, transform: i} = s[t];
62355                  e.matrix = N2(i, o);
62356                }
62357                for (let t = 0, i = e.length; t < i; t++) {
62358                  const i = e[t];
62359                  i.fn.apply(i.thisArg, i.args);
62360                }
62361                e.length = 0;
62362              }
62363              destruct() {}
62364              addAnimation(t) {
62365                -1 === this._anims.array.indexOf(t) && this._anims.push(t);
62366              }
62367              removeAnimation(t) {
62368                const e = this._anims.array.indexOf(t);
62369                e >= 0 ? this._anims.fastRemoveAt(e) : F(3907);
62370              }
62371              pushDelayEvent(t, e, i) {
62372                this._delayEvents.push({
62373                  fn: t,
62374                  thisArg: e,
62375                  args: i
62376                });
62377              }
62378              addSockets(t, e) {
62379                for (let i = 0; i < e.length; ++i) {
62380                  const s = e[i];
62381                  if (this._sockets.find((t => t.target === s.target))) continue;
62382                  const n = t.getChildByPath(s.path);
62383                  const r = s.target && n && L2(n, t);
62384                  r && this._sockets.push({
62385                    target: s.target,
62386                    transform: r
62387                  });
62388                }
62389              }
62390              removeSockets(t, e) {
62391                for (let t = 0; t < e.length; ++t) {
62392                  const i = e[t];
62393                  for (let t = 0; t < this._sockets.length; ++t) {
62394                    const e = this._sockets[t];
62395                    if (e.target === i.target) {
62396                      F2(e.transform.node);
62397                      this._sockets[t] = this._sockets[this._sockets.length - 1];
62398                      this._sockets.length--;
62399                      break;
62400                    }
62401                  }
62402                }
62403              }
62404            }, k2.ID = "animation", U2)) || V2);
62405            IR.on(RR.EVENT_INIT, (() => {
62406              const t = new G2;
62407              IR.registerSystem(G2.ID, t, Tg.Priority.HIGH);
62408            }));
62409            m.AnimationManager = G2;
62410            class z2 extends HY {
62411              constructor(t) {
62412                super();
62413                this._managedStates = [];
62414                this._fadings = [];
62415                this._scheduled = !1;
62416                this._scheduler = null != t ? t : XY();
62417              }
62418              update(t) {
62419                if (this.isMotionless) return;
62420                const e = this._managedStates;
62421                const i = this._fadings;
62422                if (1 === e.length && 1 === i.length) {
62423                  const t = e[0].state;
62424                  t && (t.weight = 1);
62425                } else this._calculateWeights(t);
62426                1 === e.length && 1 === i.length && this._unscheduleThis();
62427              }
62428              crossFade(t, e) {
62429                var i;
62430                0 === this._managedStates.length && (e = 0);
62431                0 === e && this.clear();
62432                let s = this._managedStates.find((e => e.state === t));
62433                if (s) (null === (i = s.state) || void 0 === i ? void 0 : i.isMotionless) && s.state.play(); else {
62434                  s = {
62435                    state: t,
62436                    reference: 0
62437                  };
62438                  t && t.play();
62439                  this._managedStates.push(s);
62440                }
62441                ++s.reference;
62442                this._fadings.unshift({
62443                  easeDuration: e,
62444                  easeTime: 0,
62445                  target: s
62446                });
62447                this.isMotionless || this._scheduleThis();
62448              }
62449              clear() {
62450                for (let t = 0; t < this._managedStates.length; ++t) {
62451                  const e = this._managedStates[t].state;
62452                  e && e.stop();
62453                }
62454                this._managedStates.length = 0;
62455                this._fadings.length = 0;
62456              }
62457              onPlay() {
62458                super.onPlay();
62459                this._scheduleThis();
62460              }
62461              onPause() {
62462                super.onPause();
62463                for (let t = 0; t < this._managedStates.length; ++t) {
62464                  const e = this._managedStates[t].state;
62465                  e && e.pause();
62466                }
62467                this._unscheduleThis();
62468              }
62469              onResume() {
62470                super.onResume();
62471                for (let t = 0; t < this._managedStates.length; ++t) {
62472                  const e = this._managedStates[t].state;
62473                  e && e.resume();
62474                }
62475                this._scheduleThis();
62476              }
62477              onStop() {
62478                super.onStop();
62479                this.clear();
62480              }
62481              _calculateWeights(t) {
62482                const e = this._managedStates;
62483                const i = this._fadings;
62484                for (let t = 0; t < e.length; ++t) {
62485                  const i = e[t].state;
62486                  i && (i.weight = 0);
62487                }
62488                let s = 1;
62489                let n = i.length;
62490                for (let e = 0; e < i.length; ++e) {
62491                  const r = i[e];
62492                  r.easeTime += t;
62493                  const o = 0 === r.easeDuration ? 1 : di(r.easeTime / r.easeDuration);
62494                  const a = o * s;
62495                  s *= 1 - o;
62496                  r.target.state && (r.target.state.weight += a);
62497                  if (r.easeTime >= r.easeDuration) {
62498                    n = e + 1;
62499                    r.easeTime = r.easeDuration;
62500                    break;
62501                  }
62502                }
62503                if (n !== i.length) {
62504                  for (let t = n; t < i.length; ++t) {
62505                    const e = i[t];
62506                    --e.target.reference;
62507                    if (e.target.reference <= 0) {
62508                      e.target.state && e.target.state.stop();
62509                      at(this._managedStates, e.target);
62510                    }
62511                  }
62512                  i.splice(n);
62513                }
62514              }
62515              _scheduleThis() {
62516                if (!this._scheduled) {
62517                  this._scheduler.addCrossFade(this);
62518                  this._scheduled = !0;
62519                }
62520              }
62521              _unscheduleThis() {
62522                if (this._scheduled) {
62523                  this._scheduler.removeCrossFade(this);
62524                  this._scheduled = !1;
62525                }
62526              }
62527            }
62528            var H2, j2, X2, W2, Y2, q2, K2, J2, Z2, Q2, $2, t3, e3, i3, s3, n3, r3;
62529            let o3 = function(e) {
62530              return t({
62531                Animation: e,
62532                AnimationComponent: e
62533              }), e;
62534            }((H2 = Ul("cc.Animation"), j2 = sh(), X2 = zl(99), W2 = $l(), Y2 = Th([ M$ ]),
62535            q2 = lh(), K2 = Th(M$), J2 = lh(), Z2 = lh(), Q2 = Th([ M$ ]), H2($2 = j2($2 = X2($2 = Ql($2 = W2($2 = (t3 = (r3 = n3 = class extends(To(Qc)){
62536              constructor(...t) {
62537                super(...t);
62538                Ml(this, "playOnLoad", e3, this);
62539                this._crossFade = new z2;
62540                this._nameToState = vt(!0);
62541                Ml(this, "_clips", i3, this);
62542                Ml(this, "_defaultClip", s3, this);
62543                this._hasBeenPlayed = !1;
62544              }
62545              get clips() {
62546                return this._clips;
62547              }
62548              set clips(t) {
62549                this._crossFade && this._crossFade.clear();
62550                for (const t of this._clips) t && this._removeStateOfAutomaticClip(t);
62551                for (const e of t) e && this.createState(e);
62552                const e = t.find((t => a3(t, this._defaultClip)));
62553                this._defaultClip = e || null;
62554                this._clips = t;
62555              }
62556              get defaultClip() {
62557                return this._defaultClip;
62558              }
62559              set defaultClip(t) {
62560                this._defaultClip = t;
62561                if (!t) return;
62562                if (!(this._clips.findIndex((e => a3(e, t))) >= 0)) {
62563                  this._clips.push(t);
62564                  this.createState(t);
62565                }
62566              }
62567              onLoad() {
62568                this.clips = this._clips;
62569                for (const t in this._nameToState) {
62570                  this._nameToState[t].initialize(this.node);
62571                }
62572              }
62573              start() {
62574                this.playOnLoad && !this._hasBeenPlayed && this._defaultClip && this.crossFade(this._defaultClip.name, 0);
62575              }
62576              onEnable() {
62577                this._crossFade.resume();
62578              }
62579              onDisable() {
62580                this._crossFade.pause();
62581              }
62582              onDestroy() {
62583                this._crossFade.stop();
62584                for (const t in this._nameToState) {
62585                  this._nameToState[t].destroy();
62586                }
62587                this._nameToState = vt(!0);
62588              }
62589              play(t) {
62590                this._hasBeenPlayed = !0;
62591                if (!t) {
62592                  if (!this._defaultClip) return;
62593                  t = this._defaultClip.name;
62594                }
62595                this.crossFade(t, 0);
62596              }
62597              crossFade(t, e = .3) {
62598                this._hasBeenPlayed = !0;
62599                const i = this._nameToState[t];
62600                i && this.doPlayOrCrossFade(i, e);
62601              }
62602              pause() {
62603                this._crossFade.pause();
62604              }
62605              resume() {
62606                this._crossFade.resume();
62607              }
62608              stop() {
62609                this._crossFade.stop();
62610              }
62611              getState(t) {
62612                const e = this._nameToState[t];
62613                e && !e.curveLoaded && e.initialize(this.node);
62614                return e || null;
62615              }
62616              createState(t, e) {
62617                e = e || t.name;
62618                this.removeState(e);
62619                return this._doCreateState(t, e);
62620              }
62621              removeState(t) {
62622                const e = this._nameToState[t];
62623                if (e) {
62624                  e.allowLastFrameEvent(!1);
62625                  e.stop();
62626                  delete this._nameToState[t];
62627                }
62628              }
62629              addClip(t, e) {
62630                ht(this._clips, t) || this._clips.push(t);
62631                return this.createState(t, e);
62632              }
62633              removeClip(t, e) {
62634                let i;
62635                for (const e in this._nameToState) {
62636                  const s = this._nameToState[e];
62637                  if (s.clip === t) {
62638                    i = s;
62639                    break;
62640                  }
62641                }
62642                if (t === this._defaultClip) {
62643                  if (!e) {
62644                    N(3902);
62645                    return;
62646                  }
62647                  this._defaultClip = null;
62648                }
62649                if (i && i.isPlaying) {
62650                  if (!e) {
62651                    N(3903);
62652                    return;
62653                  }
62654                  i.stop();
62655                }
62656                this._clips = this._clips.filter((e => e !== t));
62657                i && delete this._nameToState[i.name];
62658              }
62659              on(t, e, i, s) {
62660                const n = super.on(t, e, i, s);
62661                t === WY.LASTFRAME && this._syncAllowLastFrameEvent();
62662                return n;
62663              }
62664              once(t, e, i) {
62665                const s = super.once(t, e, i);
62666                t === WY.LASTFRAME && this._syncAllowLastFrameEvent();
62667                return s;
62668              }
62669              off(t, e, i) {
62670                super.off(t, e, i);
62671                t === WY.LASTFRAME && this._syncDisallowLastFrameEvent();
62672              }
62673              _createState(t, e) {
62674                return new YY(t, e);
62675              }
62676              _doCreateState(t, e) {
62677                const i = this._createState(t, e);
62678                i._setEventTarget(this);
62679                i.allowLastFrameEvent(this.hasEventListener(WY.LASTFRAME));
62680                this.node && i.initialize(this.node);
62681                this._nameToState[i.name] = i;
62682                return i;
62683              }
62684              doPlayOrCrossFade(t, e) {
62685                this._crossFade.play();
62686                this._crossFade.crossFade(t, e);
62687              }
62688              _removeStateOfAutomaticClip(t) {
62689                for (const e in this._nameToState) {
62690                  const i = this._nameToState[e];
62691                  if (a3(t, i.clip)) {
62692                    i.stop();
62693                    delete this._nameToState[e];
62694                  }
62695                }
62696              }
62697              _syncAllowLastFrameEvent() {
62698                if (this.hasEventListener(WY.LASTFRAME)) for (const t in this._nameToState) this._nameToState[t].allowLastFrameEvent(!0);
62699              }
62700              _syncDisallowLastFrameEvent() {
62701                if (!this.hasEventListener(WY.LASTFRAME)) for (const t in this._nameToState) this._nameToState[t].allowLastFrameEvent(!1);
62702              }
62703            }, n3.EventType = WY, r3), Bl(t3.prototype, "clips", [ Y2, q2 ], Object.getOwnPropertyDescriptor(t3.prototype, "clips"), t3.prototype),
62704            Bl(t3.prototype, "defaultClip", [ K2, J2 ], Object.getOwnPropertyDescriptor(t3.prototype, "defaultClip"), t3.prototype),
62705            e3 = Bl(t3.prototype, "playOnLoad", [ Yl, Z2 ], {
62706              configurable: !0,
62707              enumerable: !0,
62708              writable: !0,
62709              initializer: function() {
62710                return !1;
62711              }
62712            }), i3 = Bl(t3.prototype, "_clips", [ Q2 ], {
62713              configurable: !0,
62714              enumerable: !0,
62715              writable: !0,
62716              initializer: function() {
62717                return [];
62718              }
62719            }), s3 = Bl(t3.prototype, "_defaultClip", [ Yl ], {
62720              configurable: !0,
62721              enumerable: !0,
62722              writable: !0,
62723              initializer: function() {
62724                return null;
62725              }
62726            }), t3)) || $2) || $2) || $2) || $2) || $2));
62727            function a3(t, e) {
62728              return t === e || !!t && !!e && t._uuid === e._uuid && t._uuid;
62729            }
62730            m.Animation = o3;
62731            m.AnimationComponent = o3;
62732            ee.setClassAlias(o3, "cc.AnimationComponent");
62733            m.easing = Td;
62734            let l3;
62735            !function(t) {
62736              t.PLAYED = "play";
62737              t.PAUSED = "pause";
62738              t.STOPPED = "stop";
62739              t.SEEKED = "seeked";
62740              t.ENDED = "ended";
62741              t.INTERRUPTION_BEGIN = "interruptionBegin";
62742              t.INTERRUPTION_END = "interruptionEnd";
62743              t.USER_GESTURE = "on_gesture";
62744            }(l3 || (l3 = {}));
62745            let h3;
62746            !function(t) {
62747              t[t.DOM_AUDIO = 0] = "DOM_AUDIO";
62748              t[t.WEB_AUDIO = 1] = "WEB_AUDIO";
62749              t[t.MINIGAME_AUDIO = 2] = "MINIGAME_AUDIO";
62750              t[t.NATIVE_AUDIO = 3] = "NATIVE_AUDIO";
62751              t[t.UNKNOWN_AUDIO = 4] = "UNKNOWN_AUDIO";
62752            }(h3 || (h3 = {}));
62753            let c3;
62754            !function(t) {
62755              t[t.INIT = 0] = "INIT";
62756              t[t.PLAYING = 1] = "PLAYING";
62757              t[t.PAUSED = 2] = "PAUSED";
62758              t[t.STOPPED = 3] = "STOPPED";
62759              t[t.INTERRUPTED = 4] = "INTERRUPTED";
62760            }(c3 || (c3 = {}));
62761            class u3 {
62762              constructor(...t) {
62763                this._bufferView = void 0;
62764                this._normalizeFactor = 1;
62765                if (2 === t.length) {
62766                  this._bufferView = t[0];
62767                  this._normalizeFactor = t[1];
62768                } else {
62769                  const e = t[0];
62770                  const i = t[1];
62771                  const s = t[2];
62772                  this._bufferView = new i(e);
62773                  this._normalizeFactor = s;
62774                }
62775              }
62776              get length() {
62777                return this._bufferView.length;
62778              }
62779              getData(t) {
62780                return this._bufferView[t] * this._normalizeFactor;
62781              }
62782            }
62783            t("AudioPCMDataView", u3);
62784            let _3 = 0;
62785            function d3(t, e) {
62786              if (!e.invoking) {
62787                e.invoking = !0;
62788                e.func.call(t, ...e.args).then((() => {
62789                  e.invoking = !1;
62790                  t._operationQueue.shift();
62791                  t._eventTarget.emit(e.id.toString());
62792                  const i = t._operationQueue[0];
62793                  i && d3(t, i);
62794                })).catch((t => {}));
62795              }
62796            }
62797            function p3(t, e, i) {
62798              const s = i.value;
62799              i.value = function(...t) {
62800                return new Promise((e => {
62801                  const i = _3++;
62802                  const n = this;
62803                  n._operationQueue.push({
62804                    id: i,
62805                    func: s,
62806                    args: t,
62807                    invoking: !1
62808                  });
62809                  n._eventTarget.once(i.toString(), e);
62810                  d3(n, n._operationQueue[0]);
62811                }));
62812              };
62813            }
62814            var m3, f3, g3;
62815            const y3 = {};
62816            const b3 = jsb.AudioEngine;
62817            const S3 = -1;
62818            var A3;
62819            !function(t) {
62820              t[t.UNKNOWN = 0] = "UNKNOWN";
62821              t[t.SIGNED_8 = 1] = "SIGNED_8";
62822              t[t.UNSIGNED_8 = 2] = "UNSIGNED_8";
62823              t[t.SIGNED_16 = 3] = "SIGNED_16";
62824              t[t.UNSIGNED_16 = 4] = "UNSIGNED_16";
62825              t[t.SIGNED_32 = 5] = "SIGNED_32";
62826              t[t.UNSIGNED_32 = 6] = "UNSIGNED_32";
62827              t[t.FLOAT_32 = 7] = "FLOAT_32";
62828              t[t.FLOAT_64 = 8] = "FLOAT_64";
62829            }(A3 || (A3 = {}));
62830            const T3 = {
62831              [A3.UNKNOWN]: void 0,
62832              [A3.SIGNED_8]: {
62833                ctor: Int8Array,
62834                maxValue: 127
62835              },
62836              [A3.UNSIGNED_8]: {
62837                ctor: Uint8Array,
62838                maxValue: 255
62839              },
62840              [A3.SIGNED_16]: {
62841                ctor: Int16Array,
62842                maxValue: 32767
62843              },
62844              [A3.UNSIGNED_16]: {
62845                ctor: Uint16Array,
62846                maxValue: 65535
62847              },
62848              [A3.SIGNED_32]: {
62849                ctor: Int32Array,
62850                maxValue: 2147483647
62851              },
62852              [A3.UNSIGNED_32]: {
62853                ctor: Uint32Array,
62854                maxValue: 4294967295
62855              },
62856              [A3.FLOAT_32]: {
62857                ctor: Float32Array,
62858                maxValue: 1
62859              },
62860              [A3.FLOAT_64]: {
62861                ctor: Float64Array,
62862                maxValue: 1
62863              }
62864            };
62865            class v3 {
62866              get onPlay() {
62867                return this._onPlayCb;
62868              }
62869              set onPlay(t) {
62870                this._onPlayCb = t;
62871              }
62872              get onEnd() {
62873                return this._onEndCb;
62874              }
62875              set onEnd(t) {
62876                this._onEndCb = t;
62877              }
62878              constructor(t, e) {
62879                this._id = S3;
62880                this._url = void 0;
62881                this._volume = void 0;
62882                this._onPlayCb = void 0;
62883                this._onEndCb = void 0;
62884                this._url = t;
62885                this._volume = e;
62886              }
62887              play() {
62888                var t;
62889                this._id = jsb.AudioEngine.play2d(this._url, !1, this._volume);
62890                jsb.AudioEngine.setFinishCallback(this._id, (() => {
62891                  var t;
62892                  null === (t = this.onEnd) || void 0 === t || t.call(this);
62893                }));
62894                null === (t = this.onPlay) || void 0 === t || t.call(this);
62895              }
62896              stop() {
62897                this._id !== S3 && jsb.AudioEngine.stop(this._id);
62898              }
62899            }
62900            let E3 = (m3 = (g3 = f3 = class t {
62901              constructor(t) {
62902                this._url = void 0;
62903                this._id = S3;
62904                this._state = c3.INIT;
62905                this._pcmHeader = void 0;
62906                this._eventTarget = new vo;
62907                this._operationQueue = [];
62908                this._cachedState = {
62909                  duration: 1,
62910                  loop: !1,
62911                  currentTime: 0,
62912                  volume: 1
62913                };
62914                this._url = t;
62915                this._pcmHeader = null;
62916                Po.on("hide", this._onHide, this);
62917                Po.on("show", this._onShow, this);
62918              }
62919              destroy() {
62920                Po.on("hide", this._onHide, this);
62921                Po.on("show", this._onShow, this);
62922                --y3[this._url] <= 0 && b3.uncache(this._url);
62923              }
62924              _onHide() {
62925                this._state === c3.PLAYING && this.pause().then((() => {
62926                  this._state = c3.INTERRUPTED;
62927                  this._eventTarget.emit(l3.INTERRUPTION_BEGIN);
62928                })).catch((t => {}));
62929              }
62930              _onShow() {
62931                this._state === c3.INTERRUPTED && this.play().then((() => {
62932                  this._eventTarget.emit(l3.INTERRUPTION_END);
62933                })).catch((t => {}));
62934              }
62935              static load(e) {
62936                return new Promise(((i, s) => {
62937                  t.loadNative(e).then((e => {
62938                    i(new t(e));
62939                  })).catch((t => s(t)));
62940                }));
62941              }
62942              static loadNative(t) {
62943                return new Promise(((e, i) => {
62944                  if (Po.platform === Io.WIN32) {
62945                    b3.preload(t, (t => {
62946                      console.debug("somehow preload success on windows");
62947                    }));
62948                    e(t);
62949                  } else b3.preload(t, (s => {
62950                    s ? e(t) : i(new Error("load audio failed"));
62951                  }));
62952                }));
62953              }
62954              static loadOneShotAudio(e, i) {
62955                return new Promise(((s, n) => {
62956                  t.loadNative(e).then((t => {
62957                    s(new v3(t, i));
62958                  })).catch(n);
62959                }));
62960              }
62961              get _isValid() {
62962                return this._id !== S3;
62963              }
62964              get src() {
62965                return this._url;
62966              }
62967              get type() {
62968                return h3.NATIVE_AUDIO;
62969              }
62970              get state() {
62971                return this._state;
62972              }
62973              get loop() {
62974                return this._isValid ? b3.isLoop(this._id) : this._cachedState.loop;
62975              }
62976              set loop(t) {
62977                this._isValid && b3.setLoop(this._id, t);
62978                this._cachedState.loop = t;
62979              }
62980              get volume() {
62981                return this._isValid ? b3.getVolume(this._id) : this._cachedState.volume;
62982              }
62983              set volume(t) {
62984                t = di(t);
62985                this._isValid && b3.setVolume(this._id, t);
62986                this._cachedState.volume = t;
62987              }
62988              get duration() {
62989                return this._isValid ? b3.getDuration(this._id) : this._cachedState.duration;
62990              }
62991              get currentTime() {
62992                return this._isValid ? b3.getCurrentTime(this._id) : this._cachedState.currentTime;
62993              }
62994              get sampleRate() {
62995                null === this._pcmHeader && (this._pcmHeader = jsb.AudioEngine.getPCMHeader(this._url));
62996                return this._pcmHeader.sampleRate;
62997              }
62998              getPCMData(t) {
62999                const e = b3.getOriginalPCMBuffer(this._url, t);
63000                null === this._pcmHeader && (this._pcmHeader = jsb.AudioEngine.getPCMHeader(this._url));
63001                const i = T3[this._pcmHeader.audioFormat];
63002                if (e && i) return new u3(e, i.ctor, 1 / i.maxValue);
63003              }
63004              seek(t) {
63005                return new Promise((e => {
63006                  this._isValid && b3.setCurrentTime(this._id, t);
63007                  this._cachedState.currentTime = t;
63008                  return e();
63009                }));
63010              }
63011              play() {
63012                return new Promise((t => {
63013                  if (this._isValid) {
63014                    if (this._state === c3.PAUSED || this._state === c3.INTERRUPTED) b3.resume(this._id); else if (this._state === c3.PLAYING) {
63015                      b3.pause(this._id);
63016                      b3.setCurrentTime(this._id, 0);
63017                      b3.resume(this._id);
63018                    }
63019                  } else {
63020                    this._id = b3.play2d(this._url, this._cachedState.loop, this._cachedState.volume);
63021                    if (this._isValid) {
63022                      if (0 !== this._cachedState.currentTime) {
63023                        b3.setCurrentTime(this._id, this._cachedState.currentTime);
63024                        this._cachedState.currentTime = 0;
63025                      }
63026                      b3.setFinishCallback(this._id, (() => {
63027                        this._cachedState.currentTime = 0;
63028                        this._id = S3;
63029                        this._state = c3.INIT;
63030                        this._eventTarget.emit(l3.ENDED);
63031                      }));
63032                    }
63033                  }
63034                  this._state = c3.PLAYING;
63035                  t();
63036                }));
63037              }
63038              pause() {
63039                return new Promise((t => {
63040                  this._isValid && b3.pause(this._id);
63041                  this._state = c3.PAUSED;
63042                  t();
63043                }));
63044              }
63045              stop() {
63046                return new Promise((t => {
63047                  this._isValid && b3.stop(this._id);
63048                  this._state = c3.STOPPED;
63049                  this._id = S3;
63050                  this._cachedState.currentTime = 0;
63051                  t();
63052                }));
63053              }
63054              onInterruptionBegin(t) {
63055                this._eventTarget.on(l3.INTERRUPTION_BEGIN, t);
63056              }
63057              offInterruptionBegin(t) {
63058                this._eventTarget.off(l3.INTERRUPTION_BEGIN, t);
63059              }
63060              onInterruptionEnd(t) {
63061                this._eventTarget.on(l3.INTERRUPTION_END, t);
63062              }
63063              offInterruptionEnd(t) {
63064                this._eventTarget.off(l3.INTERRUPTION_END, t);
63065              }
63066              onEnded(t) {
63067                this._eventTarget.on(l3.ENDED, t);
63068              }
63069              offEnded(t) {
63070                this._eventTarget.off(l3.ENDED, t);
63071              }
63072            }, f3.maxAudioChannel = b3.getMaxAudioInstance(), g3), Bl(m3.prototype, "seek", [ p3 ], Object.getOwnPropertyDescriptor(m3.prototype, "seek"), m3.prototype),
63073            Bl(m3.prototype, "play", [ p3 ], Object.getOwnPropertyDescriptor(m3.prototype, "play"), m3.prototype),
63074            Bl(m3.prototype, "pause", [ p3 ], Object.getOwnPropertyDescriptor(m3.prototype, "pause"), m3.prototype),
63075            Bl(m3.prototype, "stop", [ p3 ], Object.getOwnPropertyDescriptor(m3.prototype, "stop"), m3.prototype),
63076            m3);
63077            m.AudioPlayer = E3;
63078            var C3, x3, w3, R3, I3;
63079            let M3 = t("AudioClip", Ul("cc.AudioClip")(C3 = (x3 = (I3 = R3 = class extends gc {
63080              constructor(...t) {
63081                super(...t);
63082                Ml(this, "_duration", w3, this);
63083                this._loadMode = h3.UNKNOWN_AUDIO;
63084                this._meta = null;
63085                this._player = null;
63086              }
63087              destroy() {
63088                var t;
63089                const e = super.destroy();
63090                null === (t = this._player) || void 0 === t || t.destroy();
63091                this._player = null;
63092                this._meta && (this._meta.player = null);
63093                return e;
63094              }
63095              set _nativeAsset(t) {
63096                this._meta = t;
63097                if (t) {
63098                  this._loadMode = t.type;
63099                  this._player = t.player;
63100                } else {
63101                  this._meta = null;
63102                  this._loadMode = h3.UNKNOWN_AUDIO;
63103                  this._duration = 0;
63104                }
63105              }
63106              get _nativeAsset() {
63107                return this._meta;
63108              }
63109              get _nativeDep() {
63110                return {
63111                  uuid: this._uuid,
63112                  audioLoadMode: this.loadMode,
63113                  ext: this._native,
63114                  __isNative__: !0
63115                };
63116              }
63117              get loadMode() {
63118                return this._loadMode;
63119              }
63120              validate() {
63121                return !!this._meta;
63122              }
63123              getDuration() {
63124                return this._duration ? this._duration : this._meta ? this._meta.duration : 0;
63125              }
63126              get state() {
63127                return this._player ? this._player.state : c3.INIT;
63128              }
63129              getCurrentTime() {
63130                return this._player ? this._player.currentTime : 0;
63131              }
63132              getVolume() {
63133                return this._player ? this._player.volume : 0;
63134              }
63135              getLoop() {
63136                return !!this._player && this._player.loop;
63137              }
63138              setCurrentTime(t) {
63139                var e;
63140                null === (e = this._player) || void 0 === e || e.seek(t).catch((t => {}));
63141              }
63142              setVolume(t) {
63143                this._player && (this._player.volume = t);
63144              }
63145              setLoop(t) {
63146                this._player && (this._player.loop = t);
63147              }
63148              play() {
63149                var t;
63150                null === (t = this._player) || void 0 === t || t.play().catch((t => {}));
63151              }
63152              pause() {
63153                var t;
63154                null === (t = this._player) || void 0 === t || t.pause().catch((t => {}));
63155              }
63156              stop() {
63157                var t;
63158                null === (t = this._player) || void 0 === t || t.stop().catch((t => {}));
63159              }
63160              playOneShot(t = 1) {
63161                this._nativeAsset && E3.loadOneShotAudio(this._nativeAsset.url, t).then((t => {
63162                  t.play();
63163                })).catch((t => {}));
63164              }
63165            }, R3.AudioType = h3, I3), w3 = Bl(x3.prototype, "_duration", [ Yl ], {
63166              configurable: !0,
63167              enumerable: !0,
63168              writable: !0,
63169              initializer: function() {
63170                return 0;
63171              }
63172            }), Bl(x3.prototype, "_nativeDep", [ vh ], Object.getOwnPropertyDescriptor(x3.prototype, "_nativeDep"), x3.prototype),
63173            x3)) || C3);
63174            m.AudioClip = M3;
63175            function B3(t, e, i) {
63176              E3.load(t, {
63177                audioLoadMode: e.audioLoadMode
63178              }).then((e => {
63179                const s = {
63180                  player: e,
63181                  url: t,
63182                  duration: e.duration,
63183                  type: e.type
63184                };
63185                i(null, s);
63186              })).catch((t => {
63187                i(t);
63188              }));
63189            }
63190            function D3(t, e, i, s) {
63191              const n = new M3;
63192              n._nativeUrl = t;
63193              n._nativeAsset = e;
63194              n._duration = e.duration;
63195              s(null, n);
63196            }
63197            Jw.register({
63198              ".mp3": B3,
63199              ".ogg": B3,
63200              ".wav": B3,
63201              ".m4a": B3
63202            });
63203            sR.register({
63204              ".mp3": D3,
63205              ".ogg": D3,
63206              ".wav": D3,
63207              ".m4a": D3
63208            });
63209            const P3 = new class {
63210              constructor() {
63211                this._oneShotAudioInfoList = [];
63212                this._audioPlayerInfoList = [];
63213              }
63214              _findIndex(t, e) {
63215                return t.findIndex((t => t.audio === e));
63216              }
63217              _tryAddPlaying(t, e) {
63218                const i = this._findIndex(t, e);
63219                if (i > -1) {
63220                  t[i].playTime = performance.now();
63221                  return !1;
63222                }
63223                t.push({
63224                  audio: e,
63225                  playTime: performance.now()
63226                });
63227                return !0;
63228              }
63229              addPlaying(t) {
63230                if (t instanceof E3) {
63231                  if (this._tryAddPlaying(this._audioPlayerInfoList, t)) return;
63232                } else this._tryAddPlaying(this._oneShotAudioInfoList, t);
63233              }
63234              _tryRemovePlaying(t, e) {
63235                const i = this._findIndex(t, e);
63236                if (-1 === i) return !1;
63237                ot(t, i);
63238                return !0;
63239              }
63240              removePlaying(t) {
63241                if (t instanceof E3) {
63242                  if (this._tryRemovePlaying(this._audioPlayerInfoList, t)) return;
63243                } else this._tryRemovePlaying(this._oneShotAudioInfoList, t);
63244              }
63245              discardOnePlayingIfNeeded() {
63246                if (this._audioPlayerInfoList.length + this._oneShotAudioInfoList.length < E3.maxAudioChannel) return;
63247                let t;
63248                this._oneShotAudioInfoList.length > 0 ? this._oneShotAudioInfoList.forEach((e => {
63249                  (!t || e.playTime < t.playTime) && (t = e);
63250                })) : this._audioPlayerInfoList.forEach((e => {
63251                  (!t || e.playTime < t.playTime) && (t = e);
63252                }));
63253                if (t) {
63254                  t.audio.stop();
63255                  this.removePlaying(t.audio);
63256                }
63257              }
63258            };
63259            var O3, N3, L3, F3, V3, k3, U3, G3, z3, H3, j3, X3, W3, Y3, q3, K3, J3, Z3;
63260            const Q3 = "audiosource-loaded";
63261            var $3;
63262            !function(t) {
63263              t.STARTED = "started";
63264              t.ENDED = "ended";
63265            }($3 || ($3 = {}));
63266            let t5 = function(e) {
63267              return t({
63268                AudioSource: e,
63269                AudioSourceComponent: e
63270              }), e;
63271            }((O3 = Ul("cc.AudioSource"), N3 = sh(), L3 = $l(), F3 = Th(M3), V3 = Th(M3), k3 = lh(),
63272            U3 = lh(), G3 = lh(), z3 = hh(), H3 = lh(), O3(j3 = N3(j3 = L3(j3 = (X3 = (Z3 = J3 = class t extends Qc {
63273              constructor(...t) {
63274                super(...t);
63275                Ml(this, "_clip", W3, this);
63276                this._player = null;
63277                Ml(this, "_loop", Y3, this);
63278                Ml(this, "_playOnAwake", q3, this);
63279                Ml(this, "_volume", K3, this);
63280                this._cachedCurrentTime = 0;
63281                this._operationsBeforeLoading = [];
63282                this._isLoaded = !1;
63283                this._lastSetClip = null;
63284              }
63285              static get maxAudioChannel() {
63286                return E3.maxAudioChannel;
63287              }
63288              set clip(t) {
63289                if (t !== this._clip) {
63290                  this._clip = t;
63291                  this._syncPlayer();
63292                }
63293              }
63294              get clip() {
63295                return this._clip;
63296              }
63297              _syncPlayer() {
63298                const t = this._clip;
63299                this._isLoaded = !1;
63300                if (this._lastSetClip !== t) if (t) if (t._nativeAsset) {
63301                  this._lastSetClip = t;
63302                  this._operationsBeforeLoading.length = 0;
63303                  E3.load(t._nativeAsset.url, {
63304                    audioLoadMode: t.loadMode
63305                  }).then((e => {
63306                    var i;
63307                    if (this._lastSetClip === t) {
63308                      this._isLoaded = !0;
63309                      if (this._player) {
63310                        P3.removePlaying(this._player);
63311                        this._player.offEnded();
63312                        this._player.offInterruptionBegin();
63313                        this._player.offInterruptionEnd();
63314                        this._player.destroy();
63315                      }
63316                      this._player = e;
63317                      e.onEnded((() => {
63318                        var t;
63319                        P3.removePlaying(e);
63320                        null === (t = this.node) || void 0 === t || t.emit($3.ENDED, this);
63321                      }));
63322                      e.onInterruptionBegin((() => {
63323                        P3.removePlaying(e);
63324                      }));
63325                      e.onInterruptionEnd((() => {
63326                        P3.addPlaying(e);
63327                      }));
63328                      this._syncStates();
63329                      null === (i = this.node) || void 0 === i || i.emit(Q3);
63330                    } else e.destroy();
63331                  })).catch((t => {}));
63332                } else console.error("Invalid audio clip"); else this._lastSetClip = null;
63333              }
63334              set loop(t) {
63335                this._loop = t;
63336                this._player && (this._player.loop = t);
63337              }
63338              get loop() {
63339                return this._loop;
63340              }
63341              set playOnAwake(t) {
63342                this._playOnAwake = t;
63343              }
63344              get playOnAwake() {
63345                return this._playOnAwake;
63346              }
63347              set volume(t) {
63348                if (Number.isNaN(t)) console.warn("illegal audio volume!"); else {
63349                  t = _i(t, 0, 1);
63350                  if (this._player) {
63351                    this._player.volume = t;
63352                    this._volume = this._player.volume;
63353                  } else this._volume = t;
63354                }
63355              }
63356              get volume() {
63357                return this._volume;
63358              }
63359              onLoad() {
63360                this._syncPlayer();
63361              }
63362              onEnable() {
63363                this._playOnAwake && !this.playing && this.play();
63364              }
63365              onDisable() {
63366                const t = this._getRootNode();
63367                (null == t ? void 0 : t._persistNode) || this.pause();
63368              }
63369              onDestroy() {
63370                var t;
63371                this.stop();
63372                null === (t = this._player) || void 0 === t || t.destroy();
63373                this._player = null;
63374              }
63375              getPCMData(t) {
63376                return new Promise((e => {
63377                  if (0 === t || 1 === t) if (this._player) e(this._player.getPCMData(t)); else {
63378                    var i;
63379                    null === (i = this.node) || void 0 === i || i.once(Q3, (() => {
63380                      var i;
63381                      e(null === (i = this._player) || void 0 === i ? void 0 : i.getPCMData(t));
63382                    }));
63383                  } else {
63384                    console.warn("Only support channel index 0 or 1 to get buffer");
63385                    e(void 0);
63386                  }
63387                }));
63388              }
63389              getSampleRate() {
63390                return new Promise((t => {
63391                  if (this._player) t(this._player.sampleRate); else {
63392                    var e;
63393                    null === (e = this.node) || void 0 === e || e.once(Q3, (() => {
63394                      t(this._player.sampleRate);
63395                    }));
63396                  }
63397                }));
63398              }
63399              _getRootNode() {
63400                var t, e;
63401                let i = this.node;
63402                let s = null === (t = i) || void 0 === t || null === (e = t.parent) || void 0 === e ? void 0 : e.parent;
63403                for (;s; ) {
63404                  var n, r, o;
63405                  i = null === (n = i) || void 0 === n ? void 0 : n.parent;
63406                  s = null === (r = i) || void 0 === r || null === (o = r.parent) || void 0 === o ? void 0 : o.parent;
63407                }
63408                return i;
63409              }
63410              play() {
63411                var t;
63412                if (!this._isLoaded && this.clip) {
63413                  this._operationsBeforeLoading.push("play");
63414                  return;
63415                }
63416                P3.discardOnePlayingIfNeeded();
63417                if (this.state === c3.PLAYING) {
63418                  var e;
63419                  null === (e = this._player) || void 0 === e || e.stop().catch((t => {}));
63420                }
63421                const i = this._player;
63422                null === (t = this._player) || void 0 === t || t.play().then((() => {
63423                  var t;
63424                  P3.addPlaying(i);
63425                  null === (t = this.node) || void 0 === t || t.emit($3.STARTED, this);
63426                })).catch((t => {}));
63427              }
63428              pause() {
63429                var t;
63430                if (!this._isLoaded && this.clip) {
63431                  this._operationsBeforeLoading.push("pause");
63432                  return;
63433                }
63434                const e = this._player;
63435                null === (t = this._player) || void 0 === t || t.pause().then((() => {
63436                  P3.removePlaying(e);
63437                })).catch((t => {}));
63438              }
63439              stop() {
63440                var t;
63441                if (!this._isLoaded && this.clip) {
63442                  this._operationsBeforeLoading.push("stop");
63443                  return;
63444                }
63445                const e = this._player;
63446                null === (t = this._player) || void 0 === t || t.stop().then((() => {
63447                  P3.removePlaying(e);
63448                })).catch((t => {}));
63449              }
63450              playOneShot(t, e = 1) {
63451                t._nativeAsset ? E3.loadOneShotAudio(t._nativeAsset.url, this._volume * e, {
63452                  audioLoadMode: t.loadMode
63453                }).then((t => {
63454                  P3.discardOnePlayingIfNeeded();
63455                  t.onPlay = () => {
63456                    P3.addPlaying(t);
63457                  };
63458                  t.onEnd = () => {
63459                    P3.removePlaying(t);
63460                  };
63461                  t.play();
63462                })).catch((t => {})) : console.error("Invalid audio clip");
63463              }
63464              _syncStates() {
63465                this._player && this._player.seek(this._cachedCurrentTime).then((() => {
63466                  if (this._player) {
63467                    this._player.loop = this._loop;
63468                    this._player.volume = this._volume;
63469                    this._operationsBeforeLoading.forEach((t => {
63470                      var e;
63471                      null === (e = this[t]) || void 0 === e || e.call(this);
63472                    }));
63473                    this._operationsBeforeLoading.length = 0;
63474                  }
63475                })).catch((t => {}));
63476              }
63477              set currentTime(t) {
63478                var e;
63479                if (Number.isNaN(t)) console.warn("illegal audio time!"); else {
63480                  t = _i(t, 0, this.duration);
63481                  this._cachedCurrentTime = t;
63482                  null === (e = this._player) || void 0 === e || e.seek(this._cachedCurrentTime).catch((t => {}));
63483                }
63484              }
63485              get currentTime() {
63486                return this._player ? this._player.currentTime : this._cachedCurrentTime;
63487              }
63488              get duration() {
63489                var t, e;
63490                return null !== (t = null === (e = this._clip) || void 0 === e ? void 0 : e.getDuration()) && void 0 !== t ? t : this._player ? this._player.duration : 0;
63491              }
63492              get state() {
63493                return this._player ? this._player.state : c3.INIT;
63494              }
63495              get playing() {
63496                return this.state === t.AudioState.PLAYING;
63497              }
63498            }, J3.AudioState = c3, J3.EventType = $3, Z3), W3 = Bl(X3.prototype, "_clip", [ F3 ], {
63499              configurable: !0,
63500              enumerable: !0,
63501              writable: !0,
63502              initializer: function() {
63503                return null;
63504              }
63505            }), Y3 = Bl(X3.prototype, "_loop", [ Yl ], {
63506              configurable: !0,
63507              enumerable: !0,
63508              writable: !0,
63509              initializer: function() {
63510                return !1;
63511              }
63512            }), q3 = Bl(X3.prototype, "_playOnAwake", [ Yl ], {
63513              configurable: !0,
63514              enumerable: !0,
63515              writable: !0,
63516              initializer: function() {
63517                return !0;
63518              }
63519            }), K3 = Bl(X3.prototype, "_volume", [ Yl ], {
63520              configurable: !0,
63521              enumerable: !0,
63522              writable: !0,
63523              initializer: function() {
63524                return 1;
63525              }
63526            }), Bl(X3.prototype, "clip", [ V3, k3 ], Object.getOwnPropertyDescriptor(X3.prototype, "clip"), X3.prototype),
63527            Bl(X3.prototype, "loop", [ U3 ], Object.getOwnPropertyDescriptor(X3.prototype, "loop"), X3.prototype),
63528            Bl(X3.prototype, "playOnAwake", [ G3 ], Object.getOwnPropertyDescriptor(X3.prototype, "playOnAwake"), X3.prototype),
63529            Bl(X3.prototype, "volume", [ z3, H3 ], Object.getOwnPropertyDescriptor(X3.prototype, "volume"), X3.prototype),
63530            X3)) || j3) || j3) || j3));
63531            W(M3, "AudioClip", [ {
63532              name: "PlayingState",
63533              newName: "AudioState",
63534              target: t5,
63535              targetName: "AudioSource"
63536            } ]);
63537            q(M3.prototype, "AudioClip.prototype", [ "state", "play", "pause", "stop", "playOneShot", "setCurrentTime", "setVolume", "setLoop", "getCurrentTime", "getVolume", "getLoop" ].map((t => ({
63538              name: t,
63539              suggest: `please use AudioSource.prototype.${t} instead`
63540            }))));
63541            m.AudioSourceComponent = t5;
63542            ee.setClassAlias(t5, "cc.AudioSourceComponent");
63543            m.log = E;
63544            m.warn = C;
63545            m.error = x;
63546            m.assert = w;
63547            m._throw = M;
63548            m.logID = P;
63549            m.warnID = N;
63550            m.errorID = F;
63551            m.assertID = k;
63552            m.debug = j;
63553            m.path = {
63554              join: sc,
63555              extname: nc,
63556              mainFileName: rc,
63557              basename: oc,
63558              dirname: ac,
63559              changeExtname: lc,
63560              changeBasename: hc,
63561              _normalize: cc,
63562              stripSep: uc,
63563              get sep() {
63564                return _c();
63565              }
63566            };
63567            class e5 {
63568              constructor(t) {
63569                this.poolHandlerComp = void 0;
63570                this._pool = void 0;
63571                this.poolHandlerComp = t;
63572                this._pool = [];
63573              }
63574              size() {
63575                return this._pool.length;
63576              }
63577              clear() {
63578                const t = this._pool.length;
63579                for (let e = 0; e < t; ++e) this._pool[e].destroy();
63580                this._pool.length = 0;
63581              }
63582              put(t) {
63583                if (t && -1 === this._pool.indexOf(t)) {
63584                  t.removeFromParent();
63585                  const e = this.poolHandlerComp ? t.getComponent(this.poolHandlerComp) : null;
63586                  e && e.unuse && e.unuse();
63587                  this._pool.push(t);
63588                }
63589              }
63590              get(...t) {
63591                const e = this._pool.length - 1;
63592                if (e < 0) return null;
63593                {
63594                  const t = this._pool[e];
63595                  this._pool.length = e;
63596                  const i = this.poolHandlerComp ? t.getComponent(this.poolHandlerComp) : null;
63597                  i && i.reuse && i.reuse(arguments);
63598                  return t;
63599                }
63600              }
63601            }
63602            t("NodePool", e5);
63603            m.NodePool = e5;
63604            var i5, s5;
63605            const n5 = null !== (i5 = globalThis.jsb) && void 0 !== i5 ? i5 : {};
63606            {
63607              Object.defineProperty(n5, "reflection", {
63608                get() {
63609                  if (void 0 !== n5.__bridge) return n5.__bridge;
63610                  !globalThis.JavascriptJavaBridge || Vo.os !== Vo.OS.ABC && Vo.os !== Vo.OS.OHOS ? !globalThis.JavaScriptObjCBridge || Vo.os !== Vo.OS.IOS && Vo.os !== Vo.OS.OSX ? n5.__bridge = null : n5.__bridge = new globalThis.JavaScriptObjCBridge : n5.__bridge = new globalThis.JavascriptJavaBridge;
63611                  return n5.__bridge;
63612                },
63613                enumerable: !0,
63614                configurable: !0,
63615                set(t) {
63616                  n5.__bridge = t;
63617                }
63618              });
63619              Object.defineProperty(n5, "bridge", {
63620                get() {
63621                  if (void 0 !== n5.__ccbridge) return n5.__ccbridge;
63622                  window.ScriptNativeBridge && Vo.os === Vo.OS.ABC || Vo.os === Vo.OS.IOS || Vo.os === Vo.OS.OSX || Vo.os === Vo.OS.OHOS ? n5.__ccbridge = new ScriptNativeBridge : n5.__ccbridge = null;
63623                  return n5.__ccbridge;
63624                },
63625                enumerable: !0,
63626                configurable: !0,
63627                set(t) {
63628                  n5.__ccbridge = t;
63629                }
63630              });
63631              const t = {
63632                eventMap: new Map,
63633                addNativeEventListener(t, e) {
63634                  this.eventMap.get(t) || this.eventMap.set(t, []);
63635                  const i = this.eventMap.get(t);
63636                  i.find(e) || i.push(e);
63637                },
63638                dispatchEventToNative(t, e) {
63639                  n5.bridge.sendToNative(t, e);
63640                },
63641                removeAllListenersForEvent(t) {
63642                  return this.eventMap.delete(t);
63643                },
63644                removeNativeEventListener(t, e) {
63645                  const i = this.eventMap.get(t);
63646                  if (!i) return !1;
63647                  for (let t = 0, s = i.length; t < s; t++) if (i[t] === e) {
63648                    i.splice(t, 1);
63649                    return !0;
63650                  }
63651                  return !0;
63652                },
63653                removeAllListeners() {
63654                  this.eventMap.clear();
63655                },
63656                triggerEvent(t, e) {
63657                  const i = this.eventMap.get(t);
63658                  i ? i.map((t => t.call(null, e))) : console.error(`${t} does not exist`);
63659                }
63660              };
63661              Object.defineProperty(n5, "jsbBridgeWrapper", {
63662                get() {
63663                  if (void 0 !== n5.__JsbBridgeWrapper) return n5.__JsbBridgeWrapper;
63664                  if (window.ScriptNativeBridge && Vo.os === Vo.OS.ABC || Vo.os === Vo.OS.IOS || Vo.os === Vo.OS.OSX || Vo.os === Vo.OS.OHOS) {
63665                    n5.__JsbBridgeWrapper = t;
63666                    n5.bridge.onNative = (t, e) => {
63667                      console.log(`Trigger event: ${t} with argeter: ${e}`);
63668                      n5.__JsbBridgeWrapper.triggerEvent(t, e);
63669                    };
63670                  } else n5.__JsbBridgeWrapper = null;
63671                  return n5.__JsbBridgeWrapper;
63672                },
63673                enumerable: !0,
63674                configurable: !0,
63675                set(t) {
63676                  n5.__JsbBridgeWrapper = t;
63677                }
63678              });
63679              const e = n5.saveImageData;
63680              n5.saveImageData = (t, i, s, n) => new Promise(((r, o) => {
63681                e(t, i, s, n, (t => {
63682                  t ? r() : o();
63683                }));
63684              }));
63685            }
63686            t("native", {
63687              DownloaderHints: n5.DownloaderHints,
63688              Downloader: n5.Downloader,
63689              zipUtils: n5.zipUtils,
63690              fileUtils: n5.fileUtils,
63691              DebugRenderer: n5.DebugRenderer,
63692              copyTextToClipboard: null === (s5 = n5.copyTextToClipboard) || void 0 === s5 ? void 0 : s5.bind(n5),
63693              garbageCollect: n5.garbageCollect,
63694              reflection: n5.reflection,
63695              bridge: n5.bridge,
63696              jsbBridgeWrapper: n5.jsbBridgeWrapper,
63697              AssetsManager: n5.AssetsManager,
63698              EventAssetsManager: n5.EventAssetsManager,
63699              Manifest: n5.Manifest,
63700              saveImageData: n5.saveImageData
63701            });
63702            m.renderer = EO;
63703            var r5 = o5 = Object.setPrototypeOf || {
63704              __proto__: []
63705            } instanceof Array && function(t, e) {
63706              t.__proto__ = e;
63707            } || function(t, e) {
63708              for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
63709            };
63710            var o5;
63711            let a5 = {};
63712            a5 || (a5 = {});
63713            !function(t) {
63714              var e = function() {
63715                function e(i) {
63716                  this._clock = new t.WorldClock;
63717                  this._events = [];
63718                  this._objects = [];
63719                  this._eventManager = null;
63720                  this._eventManager = i;
63721                  console.info("DragonBones: " + e.VERSION + "\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/");
63722                }
63723                e.prototype.advanceTime = function(e) {
63724                  if (this._objects.length > 0) {
63725                    for (var i = 0, s = this._objects; i < s.length; i++) {
63726                      s[i].returnToPool();
63727                    }
63728                    this._objects.length = 0;
63729                  }
63730                  this._clock.advanceTime(e);
63731                  if (this._events.length > 0) {
63732                    for (var n = 0; n < this._events.length; ++n) {
63733                      var r = this._events[n];
63734                      var o = r.armature;
63735                      if (null !== o._armatureData) {
63736                        o.eventDispatcher.dispatchDBEvent(r.type, r);
63737                        r.type === t.EventObject.SOUND_EVENT && this._eventManager.dispatchDBEvent(r.type, r);
63738                      }
63739                      this.bufferObject(r);
63740                    }
63741                    this._events.length = 0;
63742                  }
63743                };
63744                e.prototype.bufferEvent = function(t) {
63745                  this._events.indexOf(t) < 0 && this._events.push(t);
63746                };
63747                e.prototype.bufferObject = function(t) {
63748                  this._objects.indexOf(t) < 0 && this._objects.push(t);
63749                };
63750                Object.defineProperty(e.prototype, "clock", {
63751                  get: function() {
63752                    return this._clock;
63753                  },
63754                  enumerable: !0,
63755                  configurable: !0
63756                });
63757                Object.defineProperty(e.prototype, "eventManager", {
63758                  get: function() {
63759                    return this._eventManager;
63760                  },
63761                  enumerable: !0,
63762                  configurable: !0
63763                });
63764                e.VERSION = "5.6.300";
63765                e.yDown = !1;
63766                e.debug = !1;
63767                e.debugDraw = !1;
63768                e.webAssembly = !1;
63769                return e;
63770              }();
63771              t.DragonBones = e;
63772            }(a5 || (a5 = {}));
63773            console.warn || (console.warn = function() {});
63774            console.assert || (console.assert = function() {});
63775            Date.now || (Date.now = function() {
63776              return (new Date).getTime();
63777            });
63778            r5 = function(t, e) {
63779              function i() {
63780                this.constructor = t;
63781              }
63782              for (var s in e) e.hasOwnProperty(s) && (t[s] = e[s]);
63783              i.prototype = e.prototype, t.prototype = new i;
63784            };
63785            !function(t) {
63786              var e = function() {
63787                function t() {
63788                  this.hashCode = t._hashCode++;
63789                  this._isInPool = !1;
63790                }
63791                t._returnObject = function(e) {
63792                  var i = String(e.constructor);
63793                  var s = i in t._maxCountMap ? t._maxCountMap[i] : t._defaultMaxCount;
63794                  var n = t._poolsMap[i] = t._poolsMap[i] || [];
63795                  if (n.length < s) if (e._isInPool) console.warn("The object is already in the pool."); else {
63796                    e._isInPool = !0;
63797                    n.push(e);
63798                  }
63799                };
63800                t.toString = function() {
63801                  throw new Error;
63802                };
63803                t.setMaxCount = function(e, i) {
63804                  (i < 0 || i != i) && (i = 0);
63805                  if (null !== e) {
63806                    null !== (n = (s = String(e)) in t._poolsMap ? t._poolsMap[s] : null) && n.length > i && (n.length = i);
63807                    t._maxCountMap[s] = i;
63808                  } else {
63809                    t._defaultMaxCount = i;
63810                    for (var s in t._poolsMap) {
63811                      var n;
63812                      (n = t._poolsMap[s]).length > i && (n.length = i);
63813                      s in t._maxCountMap && (t._maxCountMap[s] = i);
63814                    }
63815                  }
63816                };
63817                t.clearPool = function(e) {
63818                  void 0 === e && (e = null);
63819                  if (null !== e) {
63820                    var i = String(e);
63821                    null !== (n = i in t._poolsMap ? t._poolsMap[i] : null) && n.length > 0 && (n.length = 0);
63822                  } else for (var s in t._poolsMap) {
63823                    var n;
63824                    (n = t._poolsMap[s]).length = 0;
63825                  }
63826                };
63827                t.borrowObject = function(e) {
63828                  var i = String(e);
63829                  var s = i in t._poolsMap ? t._poolsMap[i] : null;
63830                  if (null !== s && s.length > 0) {
63831                    var n = s.pop();
63832                    n._isInPool = !1;
63833                    return n;
63834                  }
63835                  var r = new e;
63836                  r._onClear();
63837                  return r;
63838                };
63839                t.prototype.returnToPool = function() {
63840                  this._onClear();
63841                  t._returnObject(this);
63842                };
63843                t._hashCode = 0;
63844                t._defaultMaxCount = 3e3;
63845                t._maxCountMap = {};
63846                t._poolsMap = {};
63847                return t;
63848              }();
63849              t.BaseObject = e;
63850            }(a5 || (a5 = {}));
63851            !function(t) {
63852              var e = function() {
63853                function t(t, e, i, s, n, r) {
63854                  void 0 === t && (t = 1);
63855                  void 0 === e && (e = 0);
63856                  void 0 === i && (i = 0);
63857                  void 0 === s && (s = 1);
63858                  void 0 === n && (n = 0);
63859                  void 0 === r && (r = 0);
63860                  this.a = t;
63861                  this.b = e;
63862                  this.c = i;
63863                  this.d = s;
63864                  this.tx = n;
63865                  this.ty = r;
63866                }
63867                t.prototype.toString = function() {
63868                  return "[object dragonBones.Matrix] a:" + this.a + " b:" + this.b + " c:" + this.c + " d:" + this.d + " tx:" + this.tx + " ty:" + this.ty;
63869                };
63870                t.prototype.copyFrom = function(t) {
63871                  this.a = t.a;
63872                  this.b = t.b;
63873                  this.c = t.c;
63874                  this.d = t.d;
63875                  this.tx = t.tx;
63876                  this.ty = t.ty;
63877                  return this;
63878                };
63879                t.prototype.copyFromArray = function(t, e) {
63880                  void 0 === e && (e = 0);
63881                  this.a = t[e];
63882                  this.b = t[e + 1];
63883                  this.c = t[e + 2];
63884                  this.d = t[e + 3];
63885                  this.tx = t[e + 4];
63886                  this.ty = t[e + 5];
63887                  return this;
63888                };
63889                t.prototype.identity = function() {
63890                  this.a = this.d = 1;
63891                  this.b = this.c = 0;
63892                  this.tx = this.ty = 0;
63893                  return this;
63894                };
63895                t.prototype.concat = function(t) {
63896                  var e = this.a * t.a;
63897                  var i = 0;
63898                  var s = 0;
63899                  var n = this.d * t.d;
63900                  var r = this.tx * t.a + t.tx;
63901                  var o = this.ty * t.d + t.ty;
63902                  if (0 !== this.b || 0 !== this.c) {
63903                    e += this.b * t.c;
63904                    i += this.b * t.d;
63905                    s += this.c * t.a;
63906                    n += this.c * t.b;
63907                  }
63908                  if (0 !== t.b || 0 !== t.c) {
63909                    i += this.a * t.b;
63910                    s += this.d * t.c;
63911                    r += this.ty * t.c;
63912                    o += this.tx * t.b;
63913                  }
63914                  this.a = e;
63915                  this.b = i;
63916                  this.c = s;
63917                  this.d = n;
63918                  this.tx = r;
63919                  this.ty = o;
63920                  return this;
63921                };
63922                t.prototype.invert = function() {
63923                  var t = this.a;
63924                  var e = this.b;
63925                  var i = this.c;
63926                  var s = this.d;
63927                  var n = this.tx;
63928                  var r = this.ty;
63929                  if (0 === e && 0 === i) {
63930                    this.b = this.c = 0;
63931                    if (0 === t || 0 === s) this.a = this.b = this.tx = this.ty = 0; else {
63932                      t = this.a = 1 / t;
63933                      s = this.d = 1 / s;
63934                      this.tx = -t * n;
63935                      this.ty = -s * r;
63936                    }
63937                    return this;
63938                  }
63939                  var o = t * s - e * i;
63940                  if (0 === o) {
63941                    this.a = this.d = 1;
63942                    this.b = this.c = 0;
63943                    this.tx = this.ty = 0;
63944                    return this;
63945                  }
63946                  o = 1 / o;
63947                  var a = this.a = s * o;
63948                  e = this.b = -e * o;
63949                  i = this.c = -i * o;
63950                  s = this.d = t * o;
63951                  this.tx = -(a * n + i * r);
63952                  this.ty = -(e * n + s * r);
63953                  return this;
63954                };
63955                t.prototype.transformPoint = function(t, e, i, s) {
63956                  void 0 === s && (s = !1);
63957                  i.x = this.a * t + this.c * e;
63958                  i.y = this.b * t + this.d * e;
63959                  if (!s) {
63960                    i.x += this.tx;
63961                    i.y += this.ty;
63962                  }
63963                };
63964                t.prototype.transformRectangle = function(t, e) {
63965                  void 0 === e && (e = !1);
63966                  var i = this.a;
63967                  var s = this.b;
63968                  var n = this.c;
63969                  var r = this.d;
63970                  var o = e ? 0 : this.tx;
63971                  var a = e ? 0 : this.ty;
63972                  var l = t.x;
63973                  var h = t.y;
63974                  var c = l + t.width;
63975                  var u = h + t.height;
63976                  var _ = i * l + n * h + o;
63977                  var d = s * l + r * h + a;
63978                  var p = i * c + n * h + o;
63979                  var m = s * c + r * h + a;
63980                  var f = i * c + n * u + o;
63981                  var g = s * c + r * u + a;
63982                  var y = i * l + n * u + o;
63983                  var b = s * l + r * u + a;
63984                  var S = 0;
63985                  if (_ > p) {
63986                    S = _;
63987                    _ = p;
63988                    p = S;
63989                  }
63990                  if (f > y) {
63991                    S = f;
63992                    f = y;
63993                    y = S;
63994                  }
63995                  t.x = Math.floor(_ < f ? _ : f);
63996                  t.width = Math.ceil((p > y ? p : y) - t.x);
63997                  if (d > m) {
63998                    S = d;
63999                    d = m;
64000                    m = S;
64001                  }
64002                  if (g > b) {
64003                    S = g;
64004                    g = b;
64005                    b = S;
64006                  }
64007                  t.y = Math.floor(d < g ? d : g);
64008                  t.height = Math.ceil((m > b ? m : b) - t.y);
64009                };
64010                return t;
64011              }();
64012              t.Matrix = e;
64013            }(a5 || (a5 = {}));
64014            !function(t) {
64015              var e = function() {
64016                function t(t, e, i, s, n, r) {
64017                  void 0 === t && (t = 0);
64018                  void 0 === e && (e = 0);
64019                  void 0 === i && (i = 0);
64020                  void 0 === s && (s = 0);
64021                  void 0 === n && (n = 1);
64022                  void 0 === r && (r = 1);
64023                  this.x = t;
64024                  this.y = e;
64025                  this.skew = i;
64026                  this.rotation = s;
64027                  this.scaleX = n;
64028                  this.scaleY = r;
64029                }
64030                t.normalizeRadian = function(t) {
64031                  t = (t + Math.PI) % (2 * Math.PI);
64032                  return t += t > 0 ? -Math.PI : Math.PI;
64033                };
64034                t.prototype.toString = function() {
64035                  return "[object dragonBones.Transform] x:" + this.x + " y:" + this.y + " skewX:" + 180 * this.skew / Math.PI + " skewY:" + 180 * this.rotation / Math.PI + " scaleX:" + this.scaleX + " scaleY:" + this.scaleY;
64036                };
64037                t.prototype.copyFrom = function(t) {
64038                  this.x = t.x;
64039                  this.y = t.y;
64040                  this.skew = t.skew;
64041                  this.rotation = t.rotation;
64042                  this.scaleX = t.scaleX;
64043                  this.scaleY = t.scaleY;
64044                  return this;
64045                };
64046                t.prototype.identity = function() {
64047                  this.x = this.y = 0;
64048                  this.skew = this.rotation = 0;
64049                  this.scaleX = this.scaleY = 1;
64050                  return this;
64051                };
64052                t.prototype.add = function(t) {
64053                  this.x += t.x;
64054                  this.y += t.y;
64055                  this.skew += t.skew;
64056                  this.rotation += t.rotation;
64057                  this.scaleX *= t.scaleX;
64058                  this.scaleY *= t.scaleY;
64059                  return this;
64060                };
64061                t.prototype.minus = function(t) {
64062                  this.x -= t.x;
64063                  this.y -= t.y;
64064                  this.skew -= t.skew;
64065                  this.rotation -= t.rotation;
64066                  this.scaleX /= t.scaleX;
64067                  this.scaleY /= t.scaleY;
64068                  return this;
64069                };
64070                t.prototype.fromMatrix = function(e) {
64071                  var i = this.scaleX, s = this.scaleY;
64072                  var n = t.PI_Q;
64073                  this.x = e.tx;
64074                  this.y = e.ty;
64075                  this.rotation = Math.atan(e.b / e.a);
64076                  var r = Math.atan(-e.c / e.d);
64077                  this.scaleX = this.rotation > -n && this.rotation < n ? e.a / Math.cos(this.rotation) : e.b / Math.sin(this.rotation);
64078                  this.scaleY = r > -n && r < n ? e.d / Math.cos(r) : -e.c / Math.sin(r);
64079                  if (i >= 0 && this.scaleX < 0) {
64080                    this.scaleX = -this.scaleX;
64081                    this.rotation = this.rotation - Math.PI;
64082                  }
64083                  if (s >= 0 && this.scaleY < 0) {
64084                    this.scaleY = -this.scaleY;
64085                    r -= Math.PI;
64086                  }
64087                  this.skew = r - this.rotation;
64088                  return this;
64089                };
64090                t.prototype.toMatrix = function(t) {
64091                  if (0 === this.rotation) {
64092                    t.a = 1;
64093                    t.b = 0;
64094                  } else {
64095                    t.a = Math.cos(this.rotation);
64096                    t.b = Math.sin(this.rotation);
64097                  }
64098                  if (0 === this.skew) {
64099                    t.c = -t.b;
64100                    t.d = t.a;
64101                  } else {
64102                    t.c = -Math.sin(this.skew + this.rotation);
64103                    t.d = Math.cos(this.skew + this.rotation);
64104                  }
64105                  if (1 !== this.scaleX) {
64106                    t.a *= this.scaleX;
64107                    t.b *= this.scaleX;
64108                  }
64109                  if (1 !== this.scaleY) {
64110                    t.c *= this.scaleY;
64111                    t.d *= this.scaleY;
64112                  }
64113                  t.tx = this.x;
64114                  t.ty = this.y;
64115                  return this;
64116                };
64117                t.PI = Math.PI;
64118                t.PI_D = 2 * Math.PI;
64119                t.PI_H = Math.PI / 2;
64120                t.PI_Q = Math.PI / 4;
64121                t.RAD_DEG = 180 / Math.PI;
64122                t.DEG_RAD = Math.PI / 180;
64123                return t;
64124              }();
64125              t.Transform = e;
64126            }(a5 || (a5 = {}));
64127            !function(t) {
64128              var e = function() {
64129                function t(t, e, i, s, n, r, o, a) {
64130                  void 0 === t && (t = 1);
64131                  void 0 === e && (e = 1);
64132                  void 0 === i && (i = 1);
64133                  void 0 === s && (s = 1);
64134                  void 0 === n && (n = 0);
64135                  void 0 === r && (r = 0);
64136                  void 0 === o && (o = 0);
64137                  void 0 === a && (a = 0);
64138                  this.alphaMultiplier = t;
64139                  this.redMultiplier = e;
64140                  this.greenMultiplier = i;
64141                  this.blueMultiplier = s;
64142                  this.alphaOffset = n;
64143                  this.redOffset = r;
64144                  this.greenOffset = o;
64145                  this.blueOffset = a;
64146                }
64147                t.prototype.copyFrom = function(t) {
64148                  this.alphaMultiplier = t.alphaMultiplier;
64149                  this.redMultiplier = t.redMultiplier;
64150                  this.greenMultiplier = t.greenMultiplier;
64151                  this.blueMultiplier = t.blueMultiplier;
64152                  this.alphaOffset = t.alphaOffset;
64153                  this.redOffset = t.redOffset;
64154                  this.greenOffset = t.greenOffset;
64155                  this.blueOffset = t.blueOffset;
64156                };
64157                t.prototype.identity = function() {
64158                  this.alphaMultiplier = this.redMultiplier = this.greenMultiplier = this.blueMultiplier = 1;
64159                  this.alphaOffset = this.redOffset = this.greenOffset = this.blueOffset = 0;
64160                };
64161                return t;
64162              }();
64163              t.ColorTransform = e;
64164            }(a5 || (a5 = {}));
64165            !function(t) {
64166              var e = function() {
64167                function t(t, e) {
64168                  void 0 === t && (t = 0);
64169                  void 0 === e && (e = 0);
64170                  this.x = t;
64171                  this.y = e;
64172                }
64173                t.prototype.copyFrom = function(t) {
64174                  this.x = t.x;
64175                  this.y = t.y;
64176                };
64177                t.prototype.clear = function() {
64178                  this.x = this.y = 0;
64179                };
64180                return t;
64181              }();
64182              t.Point = e;
64183            }(a5 || (a5 = {}));
64184            !function(t) {
64185              var e = function() {
64186                function t(t, e, i, s) {
64187                  void 0 === t && (t = 0);
64188                  void 0 === e && (e = 0);
64189                  void 0 === i && (i = 0);
64190                  void 0 === s && (s = 0);
64191                  this.x = t;
64192                  this.y = e;
64193                  this.width = i;
64194                  this.height = s;
64195                }
64196                t.prototype.copyFrom = function(t) {
64197                  this.x = t.x;
64198                  this.y = t.y;
64199                  this.width = t.width;
64200                  this.height = t.height;
64201                };
64202                t.prototype.clear = function() {
64203                  this.x = this.y = 0;
64204                  this.width = this.height = 0;
64205                };
64206                return t;
64207              }();
64208              t.Rectangle = e;
64209            }(a5 || (a5 = {}));
64210            !function(t) {
64211              var e = function(t) {
64212                r5(e, t);
64213                function e() {
64214                  var e = null !== t && t.apply(this, arguments) || this;
64215                  e.ints = [];
64216                  e.floats = [];
64217                  e.strings = [];
64218                  return e;
64219                }
64220                e.toString = function() {
64221                  return "[class dragonBones.UserData]";
64222                };
64223                e.prototype._onClear = function() {
64224                  this.ints.length = 0;
64225                  this.floats.length = 0;
64226                  this.strings.length = 0;
64227                };
64228                e.prototype.addInt = function(t) {
64229                  this.ints.push(t);
64230                };
64231                e.prototype.addFloat = function(t) {
64232                  this.floats.push(t);
64233                };
64234                e.prototype.addString = function(t) {
64235                  this.strings.push(t);
64236                };
64237                e.prototype.getInt = function(t) {
64238                  void 0 === t && (t = 0);
64239                  return t >= 0 && t < this.ints.length ? this.ints[t] : 0;
64240                };
64241                e.prototype.getFloat = function(t) {
64242                  void 0 === t && (t = 0);
64243                  return t >= 0 && t < this.floats.length ? this.floats[t] : 0;
64244                };
64245                e.prototype.getString = function(t) {
64246                  void 0 === t && (t = 0);
64247                  return t >= 0 && t < this.strings.length ? this.strings[t] : "";
64248                };
64249                return e;
64250              }(t.BaseObject);
64251              t.UserData = e;
64252              var i = function(t) {
64253                r5(e, t);
64254                function e() {
64255                  var e = null !== t && t.apply(this, arguments) || this;
64256                  e.data = null;
64257                  return e;
64258                }
64259                e.toString = function() {
64260                  return "[class dragonBones.ActionData]";
64261                };
64262                e.prototype._onClear = function() {
64263                  null !== this.data && this.data.returnToPool();
64264                  this.type = 0;
64265                  this.name = "";
64266                  this.bone = null;
64267                  this.slot = null;
64268                  this.data = null;
64269                };
64270                return e;
64271              }(t.BaseObject);
64272              t.ActionData = i;
64273            }(a5 || (a5 = {}));
64274            !function(t) {
64275              var e = function(t) {
64276                r5(e, t);
64277                function e() {
64278                  var e = null !== t && t.apply(this, arguments) || this;
64279                  e.frameIndices = [];
64280                  e.cachedFrames = [];
64281                  e.armatureNames = [];
64282                  e.armatures = {};
64283                  e.userData = null;
64284                  return e;
64285                }
64286                e.toString = function() {
64287                  return "[class dragonBones.DragonBonesData]";
64288                };
64289                e.prototype._onClear = function() {
64290                  for (var t in this.armatures) {
64291                    this.armatures[t].returnToPool();
64292                    delete this.armatures[t];
64293                  }
64294                  null !== this.userData && this.userData.returnToPool();
64295                  this.autoSearch = !1;
64296                  this.frameRate = 0;
64297                  this.version = "";
64298                  this.name = "";
64299                  this.stage = null;
64300                  this.frameIndices.length = 0;
64301                  this.cachedFrames.length = 0;
64302                  this.armatureNames.length = 0;
64303                  this.binary = null;
64304                  this.intArray = null;
64305                  this.floatArray = null;
64306                  this.frameIntArray = null;
64307                  this.frameFloatArray = null;
64308                  this.frameArray = null;
64309                  this.timelineArray = null;
64310                  this.userData = null;
64311                };
64312                e.prototype.addArmature = function(t) {
64313                  if (t.name in this.armatures) console.warn("Same armature: " + t.name); else {
64314                    t.parent = this;
64315                    this.armatures[t.name] = t;
64316                    this.armatureNames.push(t.name);
64317                  }
64318                };
64319                e.prototype.getArmature = function(t) {
64320                  return t in this.armatures ? this.armatures[t] : null;
64321                };
64322                e.prototype.dispose = function() {
64323                  console.warn("已废弃");
64324                  this.returnToPool();
64325                };
64326                return e;
64327              }(t.BaseObject);
64328              t.DragonBonesData = e;
64329            }(a5 || (a5 = {}));
64330            !function(t) {
64331              var e = function(e) {
64332                r5(i, e);
64333                function i() {
64334                  var i = null !== e && e.apply(this, arguments) || this;
64335                  i.aabb = new t.Rectangle;
64336                  i.animationNames = [];
64337                  i.sortedBones = [];
64338                  i.sortedSlots = [];
64339                  i.defaultActions = [];
64340                  i.actions = [];
64341                  i.bones = {};
64342                  i.slots = {};
64343                  i.constraints = {};
64344                  i.skins = {};
64345                  i.animations = {};
64346                  i.canvas = null;
64347                  i.userData = null;
64348                  return i;
64349                }
64350                i.toString = function() {
64351                  return "[class dragonBones.ArmatureData]";
64352                };
64353                i.prototype._onClear = function() {
64354                  for (var t = 0, e = this.defaultActions; t < e.length; t++) {
64355                    e[t].returnToPool();
64356                  }
64357                  for (var i = 0, s = this.actions; i < s.length; i++) {
64358                    s[i].returnToPool();
64359                  }
64360                  for (var n in this.bones) {
64361                    this.bones[n].returnToPool();
64362                    delete this.bones[n];
64363                  }
64364                  for (var n in this.slots) {
64365                    this.slots[n].returnToPool();
64366                    delete this.slots[n];
64367                  }
64368                  for (var n in this.constraints) {
64369                    this.constraints[n].returnToPool();
64370                    delete this.constraints[n];
64371                  }
64372                  for (var n in this.skins) {
64373                    this.skins[n].returnToPool();
64374                    delete this.skins[n];
64375                  }
64376                  for (var n in this.animations) {
64377                    this.animations[n].returnToPool();
64378                    delete this.animations[n];
64379                  }
64380                  null !== this.canvas && this.canvas.returnToPool();
64381                  null !== this.userData && this.userData.returnToPool();
64382                  this.type = 0;
64383                  this.frameRate = 0;
64384                  this.cacheFrameRate = 0;
64385                  this.scale = 1;
64386                  this.name = "";
64387                  this.aabb.clear();
64388                  this.animationNames.length = 0;
64389                  this.sortedBones.length = 0;
64390                  this.sortedSlots.length = 0;
64391                  this.defaultActions.length = 0;
64392                  this.actions.length = 0;
64393                  this.defaultSkin = null;
64394                  this.defaultAnimation = null;
64395                  this.canvas = null;
64396                  this.userData = null;
64397                  this.parent = null;
64398                };
64399                i.prototype.sortBones = function() {
64400                  var t = this.sortedBones.length;
64401                  if (!(t <= 0)) {
64402                    var e = this.sortedBones.concat();
64403                    var i = 0;
64404                    var s = 0;
64405                    this.sortedBones.length = 0;
64406                    for (;s < t; ) {
64407                      var n = e[i++];
64408                      i >= t && (i = 0);
64409                      if (!(this.sortedBones.indexOf(n) >= 0)) {
64410                        var r = !1;
64411                        for (var o in this.constraints) {
64412                          var a = this.constraints[o];
64413                          if (a.root === n && this.sortedBones.indexOf(a.target) < 0) {
64414                            r = !0;
64415                            break;
64416                          }
64417                        }
64418                        if (!(r || null !== n.parent && this.sortedBones.indexOf(n.parent) < 0)) {
64419                          this.sortedBones.push(n);
64420                          s++;
64421                        }
64422                      }
64423                    }
64424                  }
64425                };
64426                i.prototype.cacheFrames = function(t) {
64427                  if (!(this.cacheFrameRate > 0)) {
64428                    this.cacheFrameRate = t;
64429                    for (var e in this.animations) this.animations[e].cacheFrames(this.cacheFrameRate);
64430                  }
64431                };
64432                i.prototype.setCacheFrame = function(t, e) {
64433                  var i = this.parent.cachedFrames;
64434                  var s = i.length;
64435                  i.length += 10;
64436                  i[s] = t.a;
64437                  i[s + 1] = t.b;
64438                  i[s + 2] = t.c;
64439                  i[s + 3] = t.d;
64440                  i[s + 4] = t.tx;
64441                  i[s + 5] = t.ty;
64442                  i[s + 6] = e.rotation;
64443                  i[s + 7] = e.skew;
64444                  i[s + 8] = e.scaleX;
64445                  i[s + 9] = e.scaleY;
64446                  return s;
64447                };
64448                i.prototype.getCacheFrame = function(t, e, i) {
64449                  var s = this.parent.cachedFrames;
64450                  t.a = s[i];
64451                  t.b = s[i + 1];
64452                  t.c = s[i + 2];
64453                  t.d = s[i + 3];
64454                  t.tx = s[i + 4];
64455                  t.ty = s[i + 5];
64456                  e.rotation = s[i + 6];
64457                  e.skew = s[i + 7];
64458                  e.scaleX = s[i + 8];
64459                  e.scaleY = s[i + 9];
64460                  e.x = t.tx;
64461                  e.y = t.ty;
64462                };
64463                i.prototype.addBone = function(t) {
64464                  if (t.name in this.bones) console.warn("Same bone: " + t.name); else {
64465                    this.bones[t.name] = t;
64466                    this.sortedBones.push(t);
64467                  }
64468                };
64469                i.prototype.addSlot = function(t) {
64470                  if (t.name in this.slots) console.warn("Same slot: " + t.name); else {
64471                    this.slots[t.name] = t;
64472                    this.sortedSlots.push(t);
64473                  }
64474                };
64475                i.prototype.addConstraint = function(t) {
64476                  t.name in this.constraints ? console.warn("Same constraint: " + t.name) : this.constraints[t.name] = t;
64477                };
64478                i.prototype.addSkin = function(t) {
64479                  if (t.name in this.skins) console.warn("Same skin: " + t.name); else {
64480                    t.parent = this;
64481                    this.skins[t.name] = t;
64482                    null === this.defaultSkin && (this.defaultSkin = t);
64483                    "default" === t.name && (this.defaultSkin = t);
64484                  }
64485                };
64486                i.prototype.addAnimation = function(t) {
64487                  if (t.name in this.animations) console.warn("Same animation: " + t.name); else {
64488                    t.parent = this;
64489                    this.animations[t.name] = t;
64490                    this.animationNames.push(t.name);
64491                    null === this.defaultAnimation && (this.defaultAnimation = t);
64492                  }
64493                };
64494                i.prototype.addAction = function(t, e) {
64495                  e ? this.defaultActions.push(t) : this.actions.push(t);
64496                };
64497                i.prototype.getBone = function(t) {
64498                  return t in this.bones ? this.bones[t] : null;
64499                };
64500                i.prototype.getSlot = function(t) {
64501                  return t in this.slots ? this.slots[t] : null;
64502                };
64503                i.prototype.getConstraint = function(t) {
64504                  return t in this.constraints ? this.constraints[t] : null;
64505                };
64506                i.prototype.getSkin = function(t) {
64507                  return t in this.skins ? this.skins[t] : null;
64508                };
64509                i.prototype.getMesh = function(t, e, i) {
64510                  var s = this.getSkin(t);
64511                  return null === s ? null : s.getDisplay(e, i);
64512                };
64513                i.prototype.getAnimation = function(t) {
64514                  return t in this.animations ? this.animations[t] : null;
64515                };
64516                return i;
64517              }(t.BaseObject);
64518              t.ArmatureData = e;
64519              var i = function(e) {
64520                r5(i, e);
64521                function i() {
64522                  var i = null !== e && e.apply(this, arguments) || this;
64523                  i.transform = new t.Transform;
64524                  i.userData = null;
64525                  return i;
64526                }
64527                i.toString = function() {
64528                  return "[class dragonBones.BoneData]";
64529                };
64530                i.prototype._onClear = function() {
64531                  null !== this.userData && this.userData.returnToPool();
64532                  this.inheritTranslation = !1;
64533                  this.inheritRotation = !1;
64534                  this.inheritScale = !1;
64535                  this.inheritReflection = !1;
64536                  this.type = 0;
64537                  this.length = 0;
64538                  this.name = "";
64539                  this.transform.identity();
64540                  this.userData = null;
64541                  this.parent = null;
64542                };
64543                return i;
64544              }(t.BaseObject);
64545              t.BoneData = i;
64546              var s = function(t) {
64547                r5(e, t);
64548                function e() {
64549                  var e = null !== t && t.apply(this, arguments) || this;
64550                  e.vertices = [];
64551                  return e;
64552                }
64553                e.toString = function() {
64554                  return "[class dragonBones.SurfaceData]";
64555                };
64556                e.prototype._onClear = function() {
64557                  t.prototype._onClear.call(this);
64558                  this.type = 1;
64559                  this.segmentX = 0;
64560                  this.segmentY = 0;
64561                  this.vertices.length = 0;
64562                };
64563                return e;
64564              }(i);
64565              t.SurfaceData = s;
64566              var n = function(e) {
64567                r5(i, e);
64568                function i() {
64569                  var t = null !== e && e.apply(this, arguments) || this;
64570                  t.color = null;
64571                  t.userData = null;
64572                  return t;
64573                }
64574                i.createColor = function() {
64575                  return new t.ColorTransform;
64576                };
64577                i.toString = function() {
64578                  return "[class dragonBones.SlotData]";
64579                };
64580                i.prototype._onClear = function() {
64581                  null !== this.userData && this.userData.returnToPool();
64582                  this.blendMode = 0;
64583                  this.displayIndex = 0;
64584                  this.zOrder = 0;
64585                  this.name = "";
64586                  this.color = null;
64587                  this.userData = null;
64588                  this.parent = null;
64589                };
64590                i.DEFAULT_COLOR = new t.ColorTransform;
64591                return i;
64592              }(t.BaseObject);
64593              t.SlotData = n;
64594            }(a5 || (a5 = {}));
64595            !function(t) {
64596              var e = function(t) {
64597                r5(e, t);
64598                function e() {
64599                  return null !== t && t.apply(this, arguments) || this;
64600                }
64601                e.prototype._onClear = function() {
64602                  this.order = 0;
64603                  this.name = "";
64604                  this.type = 0;
64605                  this.target = null;
64606                  this.root = null;
64607                  this.bone = null;
64608                };
64609                return e;
64610              }(t.BaseObject);
64611              t.ConstraintData = e;
64612              var i = function(t) {
64613                r5(e, t);
64614                function e() {
64615                  return null !== t && t.apply(this, arguments) || this;
64616                }
64617                e.toString = function() {
64618                  return "[class dragonBones.IKConstraintData]";
64619                };
64620                e.prototype._onClear = function() {
64621                  t.prototype._onClear.call(this);
64622                  this.scaleEnabled = !1;
64623                  this.bendPositive = !1;
64624                  this.weight = 1;
64625                };
64626                return e;
64627              }(e);
64628              t.IKConstraintData = i;
64629              var s = function(t) {
64630                r5(e, t);
64631                function e() {
64632                  var e = null !== t && t.apply(this, arguments) || this;
64633                  e.bones = [];
64634                  return e;
64635                }
64636                e.toString = function() {
64637                  return "[class dragonBones.PathConstraintData]";
64638                };
64639                e.prototype._onClear = function() {
64640                  t.prototype._onClear.call(this);
64641                  this.pathSlot = null;
64642                  this.pathDisplayData = null;
64643                  this.bones.length = 0;
64644                  this.positionMode = 0;
64645                  this.spacingMode = 1;
64646                  this.rotateMode = 1;
64647                  this.position = 0;
64648                  this.spacing = 0;
64649                  this.rotateOffset = 0;
64650                  this.rotateMix = 0;
64651                  this.translateMix = 0;
64652                };
64653                e.prototype.AddBone = function(t) {
64654                  this.bones.push(t);
64655                };
64656                return e;
64657              }(e);
64658              t.PathConstraintData = s;
64659            }(a5 || (a5 = {}));
64660            !function(t) {
64661              var e = function(t) {
64662                r5(e, t);
64663                function e() {
64664                  return null !== t && t.apply(this, arguments) || this;
64665                }
64666                e.toString = function() {
64667                  return "[class dragonBones.CanvasData]";
64668                };
64669                e.prototype._onClear = function() {
64670                  this.hasBackground = !1;
64671                  this.color = 0;
64672                  this.x = 0;
64673                  this.y = 0;
64674                  this.width = 0;
64675                  this.height = 0;
64676                };
64677                return e;
64678              }(t.BaseObject);
64679              t.CanvasData = e;
64680            }(a5 || (a5 = {}));
64681            !function(t) {
64682              var e = function(t) {
64683                r5(e, t);
64684                function e() {
64685                  var e = null !== t && t.apply(this, arguments) || this;
64686                  e.displays = {};
64687                  return e;
64688                }
64689                e.toString = function() {
64690                  return "[class dragonBones.SkinData]";
64691                };
64692                e.prototype._onClear = function() {
64693                  for (var t in this.displays) {
64694                    for (var e = 0, i = this.displays[t]; e < i.length; e++) {
64695                      var s = i[e];
64696                      null !== s && s.returnToPool();
64697                    }
64698                    delete this.displays[t];
64699                  }
64700                  this.name = "";
64701                  this.parent = null;
64702                };
64703                e.prototype.addDisplay = function(t, e) {
64704                  t in this.displays || (this.displays[t] = []);
64705                  null !== e && (e.parent = this);
64706                  this.displays[t].push(e);
64707                };
64708                e.prototype.getDisplay = function(t, e) {
64709                  var i = this.getDisplays(t);
64710                  if (null !== i) for (var s = 0, n = i; s < n.length; s++) {
64711                    var r = n[s];
64712                    if (null !== r && r.name === e) return r;
64713                  }
64714                  return null;
64715                };
64716                e.prototype.getDisplays = function(t) {
64717                  return t in this.displays ? this.displays[t] : null;
64718                };
64719                return e;
64720              }(t.BaseObject);
64721              t.SkinData = e;
64722            }(a5 || (a5 = {}));
64723            !function(t) {
64724              var e = function() {
64725                function t() {
64726                  this.weight = null;
64727                }
64728                t.prototype.clear = function() {
64729                  this.isShared || null === this.weight || this.weight.returnToPool();
64730                  this.isShared = !1;
64731                  this.inheritDeform = !1;
64732                  this.offset = 0;
64733                  this.data = null;
64734                  this.weight = null;
64735                };
64736                t.prototype.shareFrom = function(t) {
64737                  this.isShared = !0;
64738                  this.offset = t.offset;
64739                  this.weight = t.weight;
64740                };
64741                return t;
64742              }();
64743              t.VerticesData = e;
64744              var i = function(e) {
64745                r5(i, e);
64746                function i() {
64747                  var i = null !== e && e.apply(this, arguments) || this;
64748                  i.transform = new t.Transform;
64749                  return i;
64750                }
64751                i.prototype._onClear = function() {
64752                  this.name = "";
64753                  this.path = "";
64754                  this.transform.identity();
64755                  this.parent = null;
64756                };
64757                return i;
64758              }(t.BaseObject);
64759              t.DisplayData = i;
64760              var s = function(e) {
64761                r5(i, e);
64762                function i() {
64763                  var i = null !== e && e.apply(this, arguments) || this;
64764                  i.pivot = new t.Point;
64765                  return i;
64766                }
64767                i.toString = function() {
64768                  return "[class dragonBones.ImageDisplayData]";
64769                };
64770                i.prototype._onClear = function() {
64771                  e.prototype._onClear.call(this);
64772                  this.type = 0;
64773                  this.pivot.clear();
64774                  this.texture = null;
64775                };
64776                return i;
64777              }(i);
64778              t.ImageDisplayData = s;
64779              var n = function(t) {
64780                r5(e, t);
64781                function e() {
64782                  var e = null !== t && t.apply(this, arguments) || this;
64783                  e.actions = [];
64784                  return e;
64785                }
64786                e.toString = function() {
64787                  return "[class dragonBones.ArmatureDisplayData]";
64788                };
64789                e.prototype._onClear = function() {
64790                  t.prototype._onClear.call(this);
64791                  for (var e = 0, i = this.actions; e < i.length; e++) {
64792                    i[e].returnToPool();
64793                  }
64794                  this.type = 1;
64795                  this.inheritAnimation = !1;
64796                  this.actions.length = 0;
64797                  this.armature = null;
64798                };
64799                e.prototype.addAction = function(t) {
64800                  this.actions.push(t);
64801                };
64802                return e;
64803              }(i);
64804              t.ArmatureDisplayData = n;
64805              var r = function(t) {
64806                r5(i, t);
64807                function i() {
64808                  var i = null !== t && t.apply(this, arguments) || this;
64809                  i.vertices = new e;
64810                  return i;
64811                }
64812                i.toString = function() {
64813                  return "[class dragonBones.MeshDisplayData]";
64814                };
64815                i.prototype._onClear = function() {
64816                  t.prototype._onClear.call(this);
64817                  this.type = 2;
64818                  this.vertices.clear();
64819                  this.texture = null;
64820                };
64821                return i;
64822              }(i);
64823              t.MeshDisplayData = r;
64824              var o = function(t) {
64825                r5(e, t);
64826                function e() {
64827                  var e = null !== t && t.apply(this, arguments) || this;
64828                  e.boundingBox = null;
64829                  return e;
64830                }
64831                e.toString = function() {
64832                  return "[class dragonBones.BoundingBoxDisplayData]";
64833                };
64834                e.prototype._onClear = function() {
64835                  t.prototype._onClear.call(this);
64836                  null !== this.boundingBox && this.boundingBox.returnToPool();
64837                  this.type = 3;
64838                  this.boundingBox = null;
64839                };
64840                return e;
64841              }(i);
64842              t.BoundingBoxDisplayData = o;
64843              var a = function(t) {
64844                r5(i, t);
64845                function i() {
64846                  var i = null !== t && t.apply(this, arguments) || this;
64847                  i.vertices = new e;
64848                  i.curveLengths = [];
64849                  return i;
64850                }
64851                i.toString = function() {
64852                  return "[class dragonBones.PathDisplayData]";
64853                };
64854                i.prototype._onClear = function() {
64855                  t.prototype._onClear.call(this);
64856                  this.type = 4;
64857                  this.closed = !1;
64858                  this.constantSpeed = !1;
64859                  this.vertices.clear();
64860                  this.curveLengths.length = 0;
64861                };
64862                return i;
64863              }(i);
64864              t.PathDisplayData = a;
64865              var l = function(t) {
64866                r5(e, t);
64867                function e() {
64868                  var e = null !== t && t.apply(this, arguments) || this;
64869                  e.bones = [];
64870                  return e;
64871                }
64872                e.toString = function() {
64873                  return "[class dragonBones.WeightData]";
64874                };
64875                e.prototype._onClear = function() {
64876                  this.count = 0;
64877                  this.offset = 0;
64878                  this.bones.length = 0;
64879                };
64880                e.prototype.addBone = function(t) {
64881                  this.bones.push(t);
64882                };
64883                return e;
64884              }(t.BaseObject);
64885              t.WeightData = l;
64886            }(a5 || (a5 = {}));
64887            !function(t) {
64888              var e = function(t) {
64889                r5(e, t);
64890                function e() {
64891                  return null !== t && t.apply(this, arguments) || this;
64892                }
64893                e.prototype._onClear = function() {
64894                  this.color = 0;
64895                  this.width = 0;
64896                  this.height = 0;
64897                };
64898                return e;
64899              }(t.BaseObject);
64900              t.BoundingBoxData = e;
64901              var i = function(t) {
64902                r5(e, t);
64903                function e() {
64904                  return null !== t && t.apply(this, arguments) || this;
64905                }
64906                e.toString = function() {
64907                  return "[class dragonBones.RectangleBoundingBoxData]";
64908                };
64909                e._computeOutCode = function(t, e, i, s, n, r) {
64910                  var o = 0;
64911                  t < i ? o |= 1 : t > n && (o |= 2);
64912                  e < s ? o |= 4 : e > r && (o |= 8);
64913                  return o;
64914                };
64915                e.rectangleIntersectsSegment = function(t, i, s, n, r, o, a, l, h, c, u) {
64916                  void 0 === h && (h = null);
64917                  void 0 === c && (c = null);
64918                  void 0 === u && (u = null);
64919                  var _ = t > r && t < a && i > o && i < l;
64920                  var d = s > r && s < a && n > o && n < l;
64921                  if (_ && d) return -1;
64922                  var p = 0;
64923                  var m = e._computeOutCode(t, i, r, o, a, l);
64924                  var f = e._computeOutCode(s, n, r, o, a, l);
64925                  for (;;) {
64926                    if (0 == (m | f)) {
64927                      p = 2;
64928                      break;
64929                    }
64930                    if (0 != (m & f)) break;
64931                    var g = 0;
64932                    var y = 0;
64933                    var b = 0;
64934                    var S = 0 !== m ? m : f;
64935                    if (0 != (4 & S)) {
64936                      g = t + (s - t) * (o - i) / (n - i);
64937                      y = o;
64938                      null !== u && (b = .5 * -Math.PI);
64939                    } else if (0 != (8 & S)) {
64940                      g = t + (s - t) * (l - i) / (n - i);
64941                      y = l;
64942                      null !== u && (b = .5 * Math.PI);
64943                    } else if (0 != (2 & S)) {
64944                      y = i + (n - i) * (a - t) / (s - t);
64945                      g = a;
64946                      null !== u && (b = 0);
64947                    } else if (0 != (1 & S)) {
64948                      y = i + (n - i) * (r - t) / (s - t);
64949                      g = r;
64950                      null !== u && (b = Math.PI);
64951                    }
64952                    if (S === m) {
64953                      t = g;
64954                      i = y;
64955                      m = e._computeOutCode(t, i, r, o, a, l);
64956                      null !== u && (u.x = b);
64957                    } else {
64958                      s = g;
64959                      n = y;
64960                      f = e._computeOutCode(s, n, r, o, a, l);
64961                      null !== u && (u.y = b);
64962                    }
64963                  }
64964                  if (p) if (_) {
64965                    p = 2;
64966                    if (null !== h) {
64967                      h.x = s;
64968                      h.y = n;
64969                    }
64970                    if (null !== c) {
64971                      c.x = s;
64972                      c.y = s;
64973                    }
64974                    null !== u && (u.x = u.y + Math.PI);
64975                  } else if (d) {
64976                    p = 1;
64977                    if (null !== h) {
64978                      h.x = t;
64979                      h.y = i;
64980                    }
64981                    if (null !== c) {
64982                      c.x = t;
64983                      c.y = i;
64984                    }
64985                    null !== u && (u.y = u.x + Math.PI);
64986                  } else {
64987                    p = 3;
64988                    if (null !== h) {
64989                      h.x = t;
64990                      h.y = i;
64991                    }
64992                    if (null !== c) {
64993                      c.x = s;
64994                      c.y = n;
64995                    }
64996                  }
64997                  return p;
64998                };
64999                e.prototype._onClear = function() {
65000                  t.prototype._onClear.call(this);
65001                  this.type = 0;
65002                };
65003                e.prototype.containsPoint = function(t, e) {
65004                  var i = .5 * this.width;
65005                  if (t >= -i && t <= i) {
65006                    var s = .5 * this.height;
65007                    if (e >= -s && e <= s) return !0;
65008                  }
65009                  return !1;
65010                };
65011                e.prototype.intersectsSegment = function(t, i, s, n, r, o, a) {
65012                  void 0 === r && (r = null);
65013                  void 0 === o && (o = null);
65014                  void 0 === a && (a = null);
65015                  var l = .5 * this.width;
65016                  var h = .5 * this.height;
65017                  return e.rectangleIntersectsSegment(t, i, s, n, -l, -h, l, h, r, o, a);
65018                };
65019                return e;
65020              }(e);
65021              t.RectangleBoundingBoxData = i;
65022              var s = function(t) {
65023                r5(e, t);
65024                function e() {
65025                  return null !== t && t.apply(this, arguments) || this;
65026                }
65027                e.toString = function() {
65028                  return "[class dragonBones.EllipseData]";
65029                };
65030                e.ellipseIntersectsSegment = function(t, e, i, s, n, r, o, a, l, h, c) {
65031                  void 0 === l && (l = null);
65032                  void 0 === h && (h = null);
65033                  void 0 === c && (c = null);
65034                  var u = o / a;
65035                  var _ = u * u;
65036                  var d = i - t;
65037                  var p = (s *= u) - (e *= u);
65038                  var m = Math.sqrt(d * d + p * p);
65039                  var f = d / m;
65040                  var g = p / m;
65041                  var y = (n - t) * f + (r - e) * g;
65042                  var b = o * o;
65043                  var S = b - (t * t + e * e) + y * y;
65044                  var A = 0;
65045                  if (S >= 0) {
65046                    var T = Math.sqrt(S);
65047                    var v = y - T;
65048                    var E = y + T;
65049                    var C = v < 0 ? -1 : v <= m ? 0 : 1;
65050                    var x = E < 0 ? -1 : E <= m ? 0 : 1;
65051                    var w = C * x;
65052                    if (w < 0) return -1;
65053                    if (0 === w) if (-1 === C) {
65054                      A = 2;
65055                      i = t + E * f;
65056                      s = (e + E * g) / u;
65057                      if (null !== l) {
65058                        l.x = i;
65059                        l.y = s;
65060                      }
65061                      if (null !== h) {
65062                        h.x = i;
65063                        h.y = s;
65064                      }
65065                      if (null !== c) {
65066                        c.x = Math.atan2(s / b * _, i / b);
65067                        c.y = c.x + Math.PI;
65068                      }
65069                    } else if (1 === x) {
65070                      A = 1;
65071                      t += v * f;
65072                      e = (e + v * g) / u;
65073                      if (null !== l) {
65074                        l.x = t;
65075                        l.y = e;
65076                      }
65077                      if (null !== h) {
65078                        h.x = t;
65079                        h.y = e;
65080                      }
65081                      if (null !== c) {
65082                        c.x = Math.atan2(e / b * _, t / b);
65083                        c.y = c.x + Math.PI;
65084                      }
65085                    } else {
65086                      A = 3;
65087                      if (null !== l) {
65088                        l.x = t + v * f;
65089                        l.y = (e + v * g) / u;
65090                        null !== c && (c.x = Math.atan2(l.y / b * _, l.x / b));
65091                      }
65092                      if (null !== h) {
65093                        h.x = t + E * f;
65094                        h.y = (e + E * g) / u;
65095                        null !== c && (c.y = Math.atan2(h.y / b * _, h.x / b));
65096                      }
65097                    }
65098                  }
65099                  return A;
65100                };
65101                e.prototype._onClear = function() {
65102                  t.prototype._onClear.call(this);
65103                  this.type = 1;
65104                };
65105                e.prototype.containsPoint = function(t, e) {
65106                  var i = .5 * this.width;
65107                  if (t >= -i && t <= i) {
65108                    var s = .5 * this.height;
65109                    if (e >= -s && e <= s) {
65110                      e *= i / s;
65111                      return Math.sqrt(t * t + e * e) <= i;
65112                    }
65113                  }
65114                  return !1;
65115                };
65116                e.prototype.intersectsSegment = function(t, i, s, n, r, o, a) {
65117                  void 0 === r && (r = null);
65118                  void 0 === o && (o = null);
65119                  void 0 === a && (a = null);
65120                  return e.ellipseIntersectsSegment(t, i, s, n, 0, 0, .5 * this.width, .5 * this.height, r, o, a);
65121                };
65122                return e;
65123              }(e);
65124              t.EllipseBoundingBoxData = s;
65125              var n = function(t) {
65126                r5(e, t);
65127                function e() {
65128                  var e = null !== t && t.apply(this, arguments) || this;
65129                  e.vertices = [];
65130                  return e;
65131                }
65132                e.toString = function() {
65133                  return "[class dragonBones.PolygonBoundingBoxData]";
65134                };
65135                e.polygonIntersectsSegment = function(t, e, i, s, n, r, o, a) {
65136                  void 0 === r && (r = null);
65137                  void 0 === o && (o = null);
65138                  void 0 === a && (a = null);
65139                  t === i && (t = i + 1e-6);
65140                  e === s && (e = s + 1e-6);
65141                  var l = n.length;
65142                  var h = t - i;
65143                  var c = e - s;
65144                  var u = t * s - e * i;
65145                  var _ = 0;
65146                  var d = n[l - 2];
65147                  var p = n[l - 1];
65148                  var m = 0;
65149                  var f = 0;
65150                  var g = 0;
65151                  var y = 0;
65152                  var b = 0;
65153                  var S = 0;
65154                  for (var A = 0; A < l; A += 2) {
65155                    var T = n[A];
65156                    var v = n[A + 1];
65157                    d === T && (d = T + 1e-4);
65158                    p === v && (p = v + 1e-4);
65159                    var E = d - T;
65160                    var C = p - v;
65161                    var x = d * v - p * T;
65162                    var w = h * C - c * E;
65163                    var R = (u * E - h * x) / w;
65164                    if ((R >= d && R <= T || R >= T && R <= d) && (0 === h || R >= t && R <= i || R >= i && R <= t)) {
65165                      var I = (u * C - c * x) / w;
65166                      if ((I >= p && I <= v || I >= v && I <= p) && (0 === c || I >= e && I <= s || I >= s && I <= e)) {
65167                        if (null === o) {
65168                          g = R;
65169                          y = I;
65170                          b = R;
65171                          S = I;
65172                          _++;
65173                          if (null !== a) {
65174                            a.x = Math.atan2(v - p, T - d) - .5 * Math.PI;
65175                            a.y = a.x;
65176                          }
65177                          break;
65178                        }
65179                        var M = R - t;
65180                        M < 0 && (M = -M);
65181                        if (0 === _) {
65182                          m = M;
65183                          f = M;
65184                          g = R;
65185                          y = I;
65186                          b = R;
65187                          S = I;
65188                          if (null !== a) {
65189                            a.x = Math.atan2(v - p, T - d) - .5 * Math.PI;
65190                            a.y = a.x;
65191                          }
65192                        } else {
65193                          if (M < m) {
65194                            m = M;
65195                            g = R;
65196                            y = I;
65197                            null !== a && (a.x = Math.atan2(v - p, T - d) - .5 * Math.PI);
65198                          }
65199                          if (M > f) {
65200                            f = M;
65201                            b = R;
65202                            S = I;
65203                            null !== a && (a.y = Math.atan2(v - p, T - d) - .5 * Math.PI);
65204                          }
65205                        }
65206                        _++;
65207                      }
65208                    }
65209                    d = T;
65210                    p = v;
65211                  }
65212                  if (1 === _) {
65213                    if (null !== r) {
65214                      r.x = g;
65215                      r.y = y;
65216                    }
65217                    if (null !== o) {
65218                      o.x = g;
65219                      o.y = y;
65220                    }
65221                    null !== a && (a.y = a.x + Math.PI);
65222                  } else if (_ > 1) {
65223                    _++;
65224                    if (null !== r) {
65225                      r.x = g;
65226                      r.y = y;
65227                    }
65228                    if (null !== o) {
65229                      o.x = b;
65230                      o.y = S;
65231                    }
65232                  }
65233                  return _;
65234                };
65235                e.prototype._onClear = function() {
65236                  t.prototype._onClear.call(this);
65237                  this.type = 2;
65238                  this.x = 0;
65239                  this.y = 0;
65240                  this.vertices.length = 0;
65241                };
65242                e.prototype.containsPoint = function(t, e) {
65243                  var i = !1;
65244                  if (t >= this.x && t <= this.width && e >= this.y && e <= this.height) for (var s = 0, n = this.vertices.length, r = n - 2; s < n; s += 2) {
65245                    var o = this.vertices[r + 1];
65246                    var a = this.vertices[s + 1];
65247                    if (a < e && o >= e || o < e && a >= e) {
65248                      var l = this.vertices[r];
65249                      var h = this.vertices[s];
65250                      (e - a) * (l - h) / (o - a) + h < t && (i = !i);
65251                    }
65252                    r = s;
65253                  }
65254                  return i;
65255                };
65256                e.prototype.intersectsSegment = function(t, s, n, r, o, a, l) {
65257                  void 0 === o && (o = null);
65258                  void 0 === a && (a = null);
65259                  void 0 === l && (l = null);
65260                  var h = 0;
65261                  0 !== i.rectangleIntersectsSegment(t, s, n, r, this.x, this.y, this.x + this.width, this.y + this.height, null, null, null) && (h = e.polygonIntersectsSegment(t, s, n, r, this.vertices, o, a, l));
65262                  return h;
65263                };
65264                return e;
65265              }(e);
65266              t.PolygonBoundingBoxData = n;
65267            }(a5 || (a5 = {}));
65268            !function(t) {
65269              var e = function(t) {
65270                r5(e, t);
65271                function e() {
65272                  var e = null !== t && t.apply(this, arguments) || this;
65273                  e.cachedFrames = [];
65274                  e.boneTimelines = {};
65275                  e.surfaceTimelines = {};
65276                  e.slotTimelines = {};
65277                  e.constraintTimelines = {};
65278                  e.animationTimelines = {};
65279                  e.boneCachedFrameIndices = {};
65280                  e.slotCachedFrameIndices = {};
65281                  e.actionTimeline = null;
65282                  e.zOrderTimeline = null;
65283                  return e;
65284                }
65285                e.toString = function() {
65286                  return "[class dragonBones.AnimationData]";
65287                };
65288                e.prototype._onClear = function() {
65289                  for (var t in this.boneTimelines) {
65290                    for (var e = 0, i = this.boneTimelines[t]; e < i.length; e++) {
65291                      i[e].returnToPool();
65292                    }
65293                    delete this.boneTimelines[t];
65294                  }
65295                  for (var t in this.surfaceTimelines) {
65296                    for (var s = 0, n = this.surfaceTimelines[t]; s < n.length; s++) {
65297                      n[s].returnToPool();
65298                    }
65299                    delete this.surfaceTimelines[t];
65300                  }
65301                  for (var t in this.slotTimelines) {
65302                    for (var r = 0, o = this.slotTimelines[t]; r < o.length; r++) {
65303                      o[r].returnToPool();
65304                    }
65305                    delete this.slotTimelines[t];
65306                  }
65307                  for (var t in this.constraintTimelines) {
65308                    for (var a = 0, l = this.constraintTimelines[t]; a < l.length; a++) {
65309                      l[a].returnToPool();
65310                    }
65311                    delete this.constraintTimelines[t];
65312                  }
65313                  for (var t in this.animationTimelines) {
65314                    for (var h = 0, c = this.animationTimelines[t]; h < c.length; h++) {
65315                      c[h].returnToPool();
65316                    }
65317                    delete this.animationTimelines[t];
65318                  }
65319                  for (var t in this.boneCachedFrameIndices) delete this.boneCachedFrameIndices[t];
65320                  for (var t in this.slotCachedFrameIndices) delete this.slotCachedFrameIndices[t];
65321                  null !== this.actionTimeline && this.actionTimeline.returnToPool();
65322                  null !== this.zOrderTimeline && this.zOrderTimeline.returnToPool();
65323                  this.frameIntOffset = 0;
65324                  this.frameFloatOffset = 0;
65325                  this.frameOffset = 0;
65326                  this.frameCount = 0;
65327                  this.playTimes = 0;
65328                  this.duration = 0;
65329                  this.scale = 1;
65330                  this.fadeInTime = 0;
65331                  this.cacheFrameRate = 0;
65332                  this.name = "";
65333                  this.cachedFrames.length = 0;
65334                  this.actionTimeline = null;
65335                  this.zOrderTimeline = null;
65336                  this.parent = null;
65337                };
65338                e.prototype.cacheFrames = function(t) {
65339                  if (!(this.cacheFrameRate > 0)) {
65340                    this.cacheFrameRate = Math.max(Math.ceil(t * this.scale), 1);
65341                    var e = Math.ceil(this.cacheFrameRate * this.duration) + 1;
65342                    this.cachedFrames.length = e;
65343                    for (var i = 0, s = this.cacheFrames.length; i < s; ++i) this.cachedFrames[i] = !1;
65344                    for (var n = 0, r = this.parent.sortedBones; n < r.length; n++) {
65345                      var o = r[n];
65346                      for (i = 0, s = (c = new Array(e)).length; i < s; ++i) c[i] = -1;
65347                      this.boneCachedFrameIndices[o.name] = c;
65348                    }
65349                    for (var a = 0, l = this.parent.sortedSlots; a < l.length; a++) {
65350                      var h = l[a];
65351                      var c;
65352                      for (i = 0, s = (c = new Array(e)).length; i < s; ++i) c[i] = -1;
65353                      this.slotCachedFrameIndices[h.name] = c;
65354                    }
65355                  }
65356                };
65357                e.prototype.addBoneTimeline = function(t, e) {
65358                  var i = t.name in this.boneTimelines ? this.boneTimelines[t.name] : this.boneTimelines[t.name] = [];
65359                  i.indexOf(e) < 0 && i.push(e);
65360                };
65361                e.prototype.addSurfaceTimeline = function(t, e) {
65362                  var i = t.name in this.surfaceTimelines ? this.surfaceTimelines[t.name] : this.surfaceTimelines[t.name] = [];
65363                  i.indexOf(e) < 0 && i.push(e);
65364                };
65365                e.prototype.addSlotTimeline = function(t, e) {
65366                  var i = t.name in this.slotTimelines ? this.slotTimelines[t.name] : this.slotTimelines[t.name] = [];
65367                  i.indexOf(e) < 0 && i.push(e);
65368                };
65369                e.prototype.addConstraintTimeline = function(t, e) {
65370                  var i = t.name in this.constraintTimelines ? this.constraintTimelines[t.name] : this.constraintTimelines[t.name] = [];
65371                  i.indexOf(e) < 0 && i.push(e);
65372                };
65373                e.prototype.addAnimationTimeline = function(t, e) {
65374                  var i = t in this.animationTimelines ? this.animationTimelines[t] : this.animationTimelines[t] = [];
65375                  i.indexOf(e) < 0 && i.push(e);
65376                };
65377                e.prototype.getBoneTimelines = function(t) {
65378                  return t in this.boneTimelines ? this.boneTimelines[t] : null;
65379                };
65380                e.prototype.getSurfaceTimelines = function(t) {
65381                  return t in this.surfaceTimelines ? this.surfaceTimelines[t] : null;
65382                };
65383                e.prototype.getSlotTimelines = function(t) {
65384                  return t in this.slotTimelines ? this.slotTimelines[t] : null;
65385                };
65386                e.prototype.getConstraintTimelines = function(t) {
65387                  return t in this.constraintTimelines ? this.constraintTimelines[t] : null;
65388                };
65389                e.prototype.getAnimationTimelines = function(t) {
65390                  return t in this.animationTimelines ? this.animationTimelines[t] : null;
65391                };
65392                e.prototype.getBoneCachedFrameIndices = function(t) {
65393                  return t in this.boneCachedFrameIndices ? this.boneCachedFrameIndices[t] : null;
65394                };
65395                e.prototype.getSlotCachedFrameIndices = function(t) {
65396                  return t in this.slotCachedFrameIndices ? this.slotCachedFrameIndices[t] : null;
65397                };
65398                return e;
65399              }(t.BaseObject);
65400              t.AnimationData = e;
65401              var i = function(t) {
65402                r5(e, t);
65403                function e() {
65404                  return null !== t && t.apply(this, arguments) || this;
65405                }
65406                e.toString = function() {
65407                  return "[class dragonBones.TimelineData]";
65408                };
65409                e.prototype._onClear = function() {
65410                  this.type = 10;
65411                  this.offset = 0;
65412                  this.frameIndicesOffset = -1;
65413                };
65414                return e;
65415              }(t.BaseObject);
65416              t.TimelineData = i;
65417            }(a5 || (a5 = {}));
65418            !function(t) {
65419              var e = function(t) {
65420                r5(e, t);
65421                function e() {
65422                  var e = null !== t && t.apply(this, arguments) || this;
65423                  e.boneMask = [];
65424                  return e;
65425                }
65426                e.toString = function() {
65427                  return "[class dragonBones.AnimationConfig]";
65428                };
65429                e.prototype._onClear = function() {
65430                  this.pauseFadeOut = !0;
65431                  this.fadeOutMode = 4;
65432                  this.fadeOutTweenType = 1;
65433                  this.fadeOutTime = -1;
65434                  this.actionEnabled = !0;
65435                  this.additiveBlending = !1;
65436                  this.displayControl = !0;
65437                  this.pauseFadeIn = !0;
65438                  this.resetToPose = !0;
65439                  this.fadeInTweenType = 1;
65440                  this.playTimes = -1;
65441                  this.layer = 0;
65442                  this.position = 0;
65443                  this.duration = -1;
65444                  this.timeScale = -100;
65445                  this.weight = 1;
65446                  this.fadeInTime = -1;
65447                  this.autoFadeOutTime = -1;
65448                  this.name = "";
65449                  this.animation = "";
65450                  this.group = "";
65451                  this.boneMask.length = 0;
65452                };
65453                e.prototype.clear = function() {
65454                  this._onClear();
65455                };
65456                e.prototype.copyFrom = function(t) {
65457                  this.pauseFadeOut = t.pauseFadeOut;
65458                  this.fadeOutMode = t.fadeOutMode;
65459                  this.autoFadeOutTime = t.autoFadeOutTime;
65460                  this.fadeOutTweenType = t.fadeOutTweenType;
65461                  this.actionEnabled = t.actionEnabled;
65462                  this.additiveBlending = t.additiveBlending;
65463                  this.displayControl = t.displayControl;
65464                  this.pauseFadeIn = t.pauseFadeIn;
65465                  this.resetToPose = t.resetToPose;
65466                  this.playTimes = t.playTimes;
65467                  this.layer = t.layer;
65468                  this.position = t.position;
65469                  this.duration = t.duration;
65470                  this.timeScale = t.timeScale;
65471                  this.fadeInTime = t.fadeInTime;
65472                  this.fadeOutTime = t.fadeOutTime;
65473                  this.fadeInTweenType = t.fadeInTweenType;
65474                  this.weight = t.weight;
65475                  this.name = t.name;
65476                  this.animation = t.animation;
65477                  this.group = t.group;
65478                  this.boneMask.length = t.boneMask.length;
65479                  for (var e = 0, i = this.boneMask.length; e < i; ++e) this.boneMask[e] = t.boneMask[e];
65480                };
65481                e.prototype.containsBoneMask = function(t) {
65482                  return 0 === this.boneMask.length || this.boneMask.indexOf(t) >= 0;
65483                };
65484                e.prototype.addBoneMask = function(t, e, i) {
65485                  void 0 === i && (i = !0);
65486                  var s = t.getBone(e);
65487                  if (null !== s) {
65488                    this.boneMask.indexOf(e) < 0 && this.boneMask.push(e);
65489                    if (i) for (var n = 0, r = t.getBones(); n < r.length; n++) {
65490                      var o = r[n];
65491                      this.boneMask.indexOf(o.name) < 0 && s.contains(o) && this.boneMask.push(o.name);
65492                    }
65493                  }
65494                };
65495                e.prototype.removeBoneMask = function(t, e, i) {
65496                  void 0 === i && (i = !0);
65497                  var s = this.boneMask.indexOf(e);
65498                  s >= 0 && this.boneMask.splice(s, 1);
65499                  if (i) {
65500                    var n = t.getBone(e);
65501                    if (null !== n) if (this.boneMask.length > 0) for (var r = 0, o = t.getBones(); r < o.length; r++) {
65502                      var a = o[r];
65503                      var l = this.boneMask.indexOf(a.name);
65504                      l >= 0 && n.contains(a) && this.boneMask.splice(l, 1);
65505                    } else for (var h = 0, c = t.getBones(); h < c.length; h++) {
65506                      (a = c[h]) !== n && (n.contains(a) || this.boneMask.push(a.name));
65507                    }
65508                  }
65509                };
65510                return e;
65511              }(t.BaseObject);
65512              t.AnimationConfig = e;
65513            }(a5 || (a5 = {}));
65514            !function(t) {
65515              var e = function(t) {
65516                r5(e, t);
65517                function e() {
65518                  var e = null !== t && t.apply(this, arguments) || this;
65519                  e.textures = {};
65520                  return e;
65521                }
65522                e.prototype._onClear = function() {
65523                  for (var t in this.textures) {
65524                    this.textures[t].returnToPool();
65525                    delete this.textures[t];
65526                  }
65527                  this.autoSearch = !1;
65528                  this.width = 0;
65529                  this.height = 0;
65530                  this.scale = 1;
65531                  this.name = "";
65532                  this.imagePath = "";
65533                };
65534                e.prototype.copyFrom = function(t) {
65535                  this.autoSearch = t.autoSearch;
65536                  this.scale = t.scale;
65537                  this.width = t.width;
65538                  this.height = t.height;
65539                  this.name = t.name;
65540                  this.imagePath = t.imagePath;
65541                  for (var e in this.textures) {
65542                    this.textures[e].returnToPool();
65543                    delete this.textures[e];
65544                  }
65545                  for (var e in t.textures) {
65546                    var i = this.createTexture();
65547                    i.copyFrom(t.textures[e]);
65548                    this.textures[e] = i;
65549                  }
65550                };
65551                e.prototype.addTexture = function(t) {
65552                  if (t.name in this.textures) console.warn("Same texture: " + t.name); else {
65553                    t.parent = this;
65554                    this.textures[t.name] = t;
65555                  }
65556                };
65557                e.prototype.getTexture = function(t) {
65558                  return t in this.textures ? this.textures[t] : null;
65559                };
65560                return e;
65561              }(t.BaseObject);
65562              t.TextureAtlasData = e;
65563              var i = function(e) {
65564                r5(i, e);
65565                function i() {
65566                  var i = null !== e && e.apply(this, arguments) || this;
65567                  i.region = new t.Rectangle;
65568                  i.frame = null;
65569                  return i;
65570                }
65571                i.createRectangle = function() {
65572                  return new t.Rectangle;
65573                };
65574                i.prototype._onClear = function() {
65575                  this.rotated = !1;
65576                  this.name = "";
65577                  this.region.clear();
65578                  this.parent = null;
65579                  this.frame = null;
65580                };
65581                i.prototype.copyFrom = function(t) {
65582                  this.rotated = t.rotated;
65583                  this.name = t.name;
65584                  this.region.copyFrom(t.region);
65585                  this.parent = t.parent;
65586                  null === this.frame && null !== t.frame ? this.frame = i.createRectangle() : null !== this.frame && null === t.frame && (this.frame = null);
65587                  null !== this.frame && null !== t.frame && this.frame.copyFrom(t.frame);
65588                };
65589                return i;
65590              }(t.BaseObject);
65591              t.TextureData = i;
65592            }(a5 || (a5 = {}));
65593            !function(t) {
65594              var e = function(t) {
65595                r5(e, t);
65596                function e() {
65597                  var e = null !== t && t.apply(this, arguments) || this;
65598                  e.vertices = [];
65599                  e.bones = [];
65600                  return e;
65601                }
65602                e.toString = function() {
65603                  return "[class dragonBones.DeformVertices]";
65604                };
65605                e.prototype._onClear = function() {
65606                  this.verticesDirty = !1;
65607                  this.vertices.length = 0;
65608                  this.bones.length = 0;
65609                  this.verticesData = null;
65610                };
65611                e.prototype.init = function(t, e) {
65612                  this.verticesData = t;
65613                  if (null !== this.verticesData) {
65614                    var i = 0;
65615                    i = null !== this.verticesData.weight ? 2 * this.verticesData.weight.count : 2 * this.verticesData.data.intArray[this.verticesData.offset + 0];
65616                    this.verticesDirty = !0;
65617                    this.vertices.length = i;
65618                    this.bones.length = 0;
65619                    for (var s = 0, n = this.vertices.length; s < n; ++s) this.vertices[s] = 0;
65620                    if (null !== this.verticesData.weight) for (s = 0, n = this.verticesData.weight.bones.length; s < n; ++s) {
65621                      var r = e.getBone(this.verticesData.weight.bones[s].name);
65622                      this.bones.push(r);
65623                    }
65624                  } else {
65625                    this.verticesDirty = !1;
65626                    this.vertices.length = 0;
65627                    this.bones.length = 0;
65628                    this.verticesData = null;
65629                  }
65630                };
65631                e.prototype.isBonesUpdate = function() {
65632                  for (var t = 0, e = this.bones; t < e.length; t++) {
65633                    var i = e[t];
65634                    if (null !== i && i._childrenTransformDirty) return !0;
65635                  }
65636                  return !1;
65637                };
65638                return e;
65639              }(t.BaseObject);
65640              t.DeformVertices = e;
65641            }(a5 || (a5 = {}));
65642            !function(t) {
65643              var e = function(e) {
65644                r5(i, e);
65645                function i() {
65646                  var t = null !== e && e.apply(this, arguments) || this;
65647                  t._bones = [];
65648                  t._slots = [];
65649                  t._constraints = [];
65650                  t._actions = [];
65651                  t._animation = null;
65652                  t._proxy = null;
65653                  t._replaceTextureAtlasData = null;
65654                  t._clock = null;
65655                  return t;
65656                }
65657                i.toString = function() {
65658                  return "[class dragonBones.Armature]";
65659                };
65660                i._onSortSlots = function(t, e) {
65661                  return t._zOrder > e._zOrder ? 1 : -1;
65662                };
65663                i.prototype._onClear = function() {
65664                  null !== this._clock && this._clock.remove(this);
65665                  for (var t = 0, e = this._bones; t < e.length; t++) {
65666                    e[t].returnToPool();
65667                  }
65668                  for (var i = 0, s = this._slots; i < s.length; i++) {
65669                    s[i].returnToPool();
65670                  }
65671                  for (var n = 0, r = this._constraints; n < r.length; n++) {
65672                    r[n].returnToPool();
65673                  }
65674                  for (var o = 0, a = this._actions; o < a.length; o++) {
65675                    a[o].returnToPool();
65676                  }
65677                  null !== this._animation && this._animation.returnToPool();
65678                  null !== this._proxy && this._proxy.dbClear();
65679                  null !== this._replaceTextureAtlasData && this._replaceTextureAtlasData.returnToPool();
65680                  this.inheritAnimation = !0;
65681                  this.userData = null;
65682                  this._lockUpdate = !1;
65683                  this._slotsDirty = !0;
65684                  this._zOrderDirty = !1;
65685                  this._flipX = !1;
65686                  this._flipY = !1;
65687                  this._cacheFrameIndex = -1;
65688                  this._bones.length = 0;
65689                  this._slots.length = 0;
65690                  this._constraints.length = 0;
65691                  this._actions.length = 0;
65692                  this._armatureData = null;
65693                  this._animation = null;
65694                  this._proxy = null;
65695                  this._display = null;
65696                  this._replaceTextureAtlasData = null;
65697                  this._replacedTexture = null;
65698                  this._dragonBones = null;
65699                  this._clock = null;
65700                  this._parent = null;
65701                };
65702                i.prototype._sortZOrder = function(t, e) {
65703                  var i = this._armatureData.sortedSlots;
65704                  var s = null === t;
65705                  if (this._zOrderDirty || !s) {
65706                    for (var n = 0, r = i.length; n < r; ++n) {
65707                      var o = s ? n : t[e + n];
65708                      if (!(o < 0 || o >= r)) {
65709                        var a = i[o];
65710                        var l = this.getSlot(a.name);
65711                        null !== l && l._setZorder(n);
65712                      }
65713                    }
65714                    this._slotsDirty = !0;
65715                    this._zOrderDirty = !s;
65716                  }
65717                };
65718                i.prototype._addBone = function(t) {
65719                  this._bones.indexOf(t) < 0 && this._bones.push(t);
65720                };
65721                i.prototype._addSlot = function(t) {
65722                  this._slots.indexOf(t) < 0 && this._slots.push(t);
65723                };
65724                i.prototype._addConstraint = function(t) {
65725                  this._constraints.indexOf(t) < 0 && this._constraints.push(t);
65726                };
65727                i.prototype._bufferAction = function(t, e) {
65728                  this._actions.indexOf(t) < 0 && (e ? this._actions.push(t) : this._actions.unshift(t));
65729                };
65730                i.prototype.dispose = function() {
65731                  if (null !== this._armatureData) {
65732                    this._lockUpdate = !0;
65733                    this._dragonBones.bufferObject(this);
65734                  }
65735                };
65736                i.prototype.init = function(e, i, s, n) {
65737                  if (null === this._armatureData) {
65738                    this._armatureData = e;
65739                    this._animation = t.BaseObject.borrowObject(t.Animation);
65740                    this._proxy = i;
65741                    this._display = s;
65742                    this._dragonBones = n;
65743                    this._proxy.dbInit(this);
65744                    this._animation.init(this);
65745                    this._animation.animations = this._armatureData.animations;
65746                  }
65747                };
65748                i.prototype.advanceTime = function(t) {
65749                  if (!this._lockUpdate) if (null !== this._armatureData) if (null !== this._armatureData.parent) {
65750                    var e = this._cacheFrameIndex;
65751                    this._animation.advanceTime(t);
65752                    if (this._slotsDirty) {
65753                      this._slotsDirty = !1;
65754                      this._slots.sort(i._onSortSlots);
65755                    }
65756                    if (this._cacheFrameIndex < 0 || this._cacheFrameIndex !== e) {
65757                      var s = 0, n = 0;
65758                      for (s = 0, n = this._bones.length; s < n; ++s) this._bones[s].update(this._cacheFrameIndex);
65759                      for (s = 0, n = this._slots.length; s < n; ++s) this._slots[s].update(this._cacheFrameIndex);
65760                    }
65761                    if (this._actions.length > 0) {
65762                      this._lockUpdate = !0;
65763                      for (var r = 0, o = this._actions; r < o.length; r++) {
65764                        var a = o[r];
65765                        var l = a.actionData;
65766                        if (null !== l && 0 === l.type) if (null !== a.slot) {
65767                          null !== (_ = a.slot.childArmature) && _.animation.fadeIn(l.name);
65768                        } else if (null !== a.bone) for (var h = 0, c = this.getSlots(); h < c.length; h++) {
65769                          var u = c[h];
65770                          if (u.parent === a.bone) {
65771                            var _;
65772                            null !== (_ = u.childArmature) && _.animation.fadeIn(l.name);
65773                          }
65774                        } else this._animation.fadeIn(l.name);
65775                        a.returnToPool();
65776                      }
65777                      this._actions.length = 0;
65778                      this._lockUpdate = !1;
65779                    }
65780                    this._proxy.dbUpdate();
65781                  } else console.warn("The armature data has been disposed.\nPlease make sure dispose armature before call factory.clear()."); else console.warn("The armature has been disposed.");
65782                };
65783                i.prototype.invalidUpdate = function(t, e) {
65784                  void 0 === t && (t = null);
65785                  void 0 === e && (e = !1);
65786                  if (null !== t && t.length > 0) {
65787                    if (null !== (o = this.getBone(t))) {
65788                      o.invalidUpdate();
65789                      if (e) for (var i = 0, s = this._slots; i < s.length; i++) {
65790                        (h = s[i]).parent === o && h.invalidUpdate();
65791                      }
65792                    }
65793                  } else {
65794                    for (var n = 0, r = this._bones; n < r.length; n++) {
65795                      var o;
65796                      (o = r[n]).invalidUpdate();
65797                    }
65798                    if (e) for (var a = 0, l = this._slots; a < l.length; a++) {
65799                      var h;
65800                      (h = l[a]).invalidUpdate();
65801                    }
65802                  }
65803                };
65804                i.prototype.containsPoint = function(t, e) {
65805                  for (var i = 0, s = this._slots; i < s.length; i++) {
65806                    var n = s[i];
65807                    if (n.containsPoint(t, e)) return n;
65808                  }
65809                  return null;
65810                };
65811                i.prototype.intersectsSegment = function(t, e, i, s, n, r, o) {
65812                  void 0 === n && (n = null);
65813                  void 0 === r && (r = null);
65814                  void 0 === o && (o = null);
65815                  var a = t === i;
65816                  var l = 0;
65817                  var h = 0;
65818                  var c = 0;
65819                  var u = 0;
65820                  var _ = 0;
65821                  var d = 0;
65822                  var p = 0;
65823                  var m = 0;
65824                  var f = null;
65825                  var g = null;
65826                  for (var y = 0, b = this._slots; y < b.length; y++) {
65827                    var S = b[y];
65828                    if (S.intersectsSegment(t, e, i, s, n, r, o) > 0) {
65829                      if (null === n && null === r) {
65830                        f = S;
65831                        break;
65832                      }
65833                      if (null !== n) {
65834                        (A = a ? n.y - e : n.x - t) < 0 && (A = -A);
65835                        if (null === f || A < l) {
65836                          l = A;
65837                          c = n.x;
65838                          u = n.y;
65839                          f = S;
65840                          o && (p = o.x);
65841                        }
65842                      }
65843                      if (null !== r) {
65844                        var A;
65845                        (A = r.x - t) < 0 && (A = -A);
65846                        if (null === g || A > h) {
65847                          h = A;
65848                          _ = r.x;
65849                          d = r.y;
65850                          g = S;
65851                          null !== o && (m = o.y);
65852                        }
65853                      }
65854                    }
65855                  }
65856                  if (null !== f && null !== n) {
65857                    n.x = c;
65858                    n.y = u;
65859                    null !== o && (o.x = p);
65860                  }
65861                  if (null !== g && null !== r) {
65862                    r.x = _;
65863                    r.y = d;
65864                    null !== o && (o.y = m);
65865                  }
65866                  return f;
65867                };
65868                i.prototype.getBone = function(t) {
65869                  for (var e = 0, i = this._bones; e < i.length; e++) {
65870                    var s = i[e];
65871                    if (s.name === t) return s;
65872                  }
65873                  return null;
65874                };
65875                i.prototype.getBoneByDisplay = function(t) {
65876                  var e = this.getSlotByDisplay(t);
65877                  return null !== e ? e.parent : null;
65878                };
65879                i.prototype.getSlot = function(t) {
65880                  for (var e = 0, i = this._slots; e < i.length; e++) {
65881                    var s = i[e];
65882                    if (s.name === t) return s;
65883                  }
65884                  return null;
65885                };
65886                i.prototype.getSlotByDisplay = function(t) {
65887                  if (null !== t) for (var e = 0, i = this._slots; e < i.length; e++) {
65888                    var s = i[e];
65889                    if (s.display === t) return s;
65890                  }
65891                  return null;
65892                };
65893                i.prototype.getBones = function() {
65894                  return this._bones;
65895                };
65896                i.prototype.getSlots = function() {
65897                  return this._slots;
65898                };
65899                Object.defineProperty(i.prototype, "flipX", {
65900                  get: function() {
65901                    return this._flipX;
65902                  },
65903                  set: function(t) {
65904                    if (this._flipX !== t) {
65905                      this._flipX = t;
65906                      this.invalidUpdate();
65907                    }
65908                  },
65909                  enumerable: !0,
65910                  configurable: !0
65911                });
65912                Object.defineProperty(i.prototype, "flipY", {
65913                  get: function() {
65914                    return this._flipY;
65915                  },
65916                  set: function(t) {
65917                    if (this._flipY !== t) {
65918                      this._flipY = t;
65919                      this.invalidUpdate();
65920                    }
65921                  },
65922                  enumerable: !0,
65923                  configurable: !0
65924                });
65925                Object.defineProperty(i.prototype, "cacheFrameRate", {
65926                  get: function() {
65927                    return this._armatureData.cacheFrameRate;
65928                  },
65929                  set: function(t) {
65930                    if (this._armatureData.cacheFrameRate !== t) {
65931                      this._armatureData.cacheFrames(t);
65932                      for (var e = 0, i = this._slots; e < i.length; e++) {
65933                        var s = i[e].childArmature;
65934                        null !== s && (s.cacheFrameRate = t);
65935                      }
65936                    }
65937                  },
65938                  enumerable: !0,
65939                  configurable: !0
65940                });
65941                Object.defineProperty(i.prototype, "name", {
65942                  get: function() {
65943                    return this._armatureData.name;
65944                  },
65945                  enumerable: !0,
65946                  configurable: !0
65947                });
65948                Object.defineProperty(i.prototype, "armatureData", {
65949                  get: function() {
65950                    return this._armatureData;
65951                  },
65952                  enumerable: !0,
65953                  configurable: !0
65954                });
65955                Object.defineProperty(i.prototype, "animation", {
65956                  get: function() {
65957                    return this._animation;
65958                  },
65959                  enumerable: !0,
65960                  configurable: !0
65961                });
65962                Object.defineProperty(i.prototype, "proxy", {
65963                  get: function() {
65964                    return this._proxy;
65965                  },
65966                  enumerable: !0,
65967                  configurable: !0
65968                });
65969                Object.defineProperty(i.prototype, "eventDispatcher", {
65970                  get: function() {
65971                    return this._proxy;
65972                  },
65973                  enumerable: !0,
65974                  configurable: !0
65975                });
65976                Object.defineProperty(i.prototype, "display", {
65977                  get: function() {
65978                    return this._display;
65979                  },
65980                  enumerable: !0,
65981                  configurable: !0
65982                });
65983                Object.defineProperty(i.prototype, "replacedTexture", {
65984                  get: function() {
65985                    return this._replacedTexture;
65986                  },
65987                  set: function(t) {
65988                    if (this._replacedTexture !== t) {
65989                      if (null !== this._replaceTextureAtlasData) {
65990                        this._replaceTextureAtlasData.returnToPool();
65991                        this._replaceTextureAtlasData = null;
65992                      }
65993                      this._replacedTexture = t;
65994                      for (var e = 0, i = this._slots; e < i.length; e++) {
65995                        var s = i[e];
65996                        s.invalidUpdate();
65997                        s.update(-1);
65998                      }
65999                    }
66000                  },
66001                  enumerable: !0,
66002                  configurable: !0
66003                });
66004                Object.defineProperty(i.prototype, "clock", {
66005                  get: function() {
66006                    return this._clock;
66007                  },
66008                  set: function(t) {
66009                    if (this._clock !== t) {
66010                      null !== this._clock && this._clock.remove(this);
66011                      this._clock = t;
66012                      this._clock && this._clock.add(this);
66013                      for (var e = 0, i = this._slots; e < i.length; e++) {
66014                        var s = i[e].childArmature;
66015                        null !== s && (s.clock = this._clock);
66016                      }
66017                    }
66018                  },
66019                  enumerable: !0,
66020                  configurable: !0
66021                });
66022                Object.defineProperty(i.prototype, "parent", {
66023                  get: function() {
66024                    return this._parent;
66025                  },
66026                  enumerable: !0,
66027                  configurable: !0
66028                });
66029                i.prototype.replaceTexture = function(t) {
66030                  this.replacedTexture = t;
66031                };
66032                i.prototype.hasEventListener = function(t) {
66033                  return this._proxy.hasDBEventListener(t);
66034                };
66035                i.prototype.addEventListener = function(t, e, i) {
66036                  this._proxy.addDBEventListener(t, e, i);
66037                };
66038                i.prototype.removeEventListener = function(t, e, i) {
66039                  this._proxy.removeDBEventListener(t, e, i);
66040                };
66041                i.prototype.enableAnimationCache = function(t) {
66042                  console.warn("Deprecated.");
66043                  this.cacheFrameRate = t;
66044                };
66045                i.prototype.getDisplay = function() {
66046                  return this._display;
66047                };
66048                return i;
66049              }(t.BaseObject);
66050              t.Armature = e;
66051            }(a5 || (a5 = {}));
66052            !function(t) {
66053              var e = function(e) {
66054                r5(i, e);
66055                function i() {
66056                  var i = null !== e && e.apply(this, arguments) || this;
66057                  i.globalTransformMatrix = new t.Matrix;
66058                  i.global = new t.Transform;
66059                  i.offset = new t.Transform;
66060                  return i;
66061                }
66062                i.prototype._onClear = function() {
66063                  this.globalTransformMatrix.identity();
66064                  this.global.identity();
66065                  this.offset.identity();
66066                  this.origin = null;
66067                  this.userData = null;
66068                  this._globalDirty = !1;
66069                  this._armature = null;
66070                };
66071                i.prototype.updateGlobalTransform = function() {
66072                  if (this._globalDirty) {
66073                    this._globalDirty = !1;
66074                    this.global.fromMatrix(this.globalTransformMatrix);
66075                  }
66076                };
66077                Object.defineProperty(i.prototype, "armature", {
66078                  get: function() {
66079                    return this._armature;
66080                  },
66081                  enumerable: !0,
66082                  configurable: !0
66083                });
66084                i._helpMatrix = new t.Matrix;
66085                i._helpTransform = new t.Transform;
66086                i._helpPoint = new t.Point;
66087                return i;
66088              }(t.BaseObject);
66089              t.TransformObject = e;
66090            }(a5 || (a5 = {}));
66091            !function(t) {
66092              var e = function(e) {
66093                r5(i, e);
66094                function i() {
66095                  var i = null !== e && e.apply(this, arguments) || this;
66096                  i.animationPose = new t.Transform;
66097                  i._blendState = new t.BlendState;
66098                  return i;
66099                }
66100                i.toString = function() {
66101                  return "[class dragonBones.Bone]";
66102                };
66103                i.prototype._onClear = function() {
66104                  e.prototype._onClear.call(this);
66105                  this.offsetMode = 1;
66106                  this.animationPose.identity();
66107                  this._transformDirty = !1;
66108                  this._childrenTransformDirty = !1;
66109                  this._localDirty = !0;
66110                  this._hasConstraint = !1;
66111                  this._visible = !0;
66112                  this._cachedFrameIndex = -1;
66113                  this._blendState.clear();
66114                  this._boneData = null;
66115                  this._parent = null;
66116                  this._cachedFrameIndices = null;
66117                };
66118                i.prototype._updateGlobalTransformMatrix = function(e) {
66119                  var i = this._boneData;
66120                  var s = this.global;
66121                  var n = this.globalTransformMatrix;
66122                  var r = this.origin;
66123                  var o = this.offset;
66124                  var a = this.animationPose;
66125                  var l = this._parent;
66126                  var h = this._armature.flipX;
66127                  var c = this._armature.flipY === t.DragonBones.yDown;
66128                  var u = null !== l;
66129                  var _ = 0;
66130                  if (1 === this.offsetMode) if (null !== r) {
66131                    s.x = r.x + o.x + a.x;
66132                    s.scaleX = r.scaleX * o.scaleX * a.scaleX;
66133                    s.scaleY = r.scaleY * o.scaleY * a.scaleY;
66134                    if (t.DragonBones.yDown) {
66135                      s.y = r.y + o.y + a.y;
66136                      s.skew = r.skew + o.skew + a.skew;
66137                      s.rotation = r.rotation + o.rotation + a.rotation;
66138                    } else {
66139                      s.y = r.y - o.y + a.y;
66140                      s.skew = r.skew - o.skew + a.skew;
66141                      s.rotation = r.rotation - o.rotation + a.rotation;
66142                    }
66143                  } else {
66144                    s.copyFrom(o);
66145                    if (!t.DragonBones.yDown) {
66146                      s.y = -s.y;
66147                      s.skew = -s.skew;
66148                      s.rotation = -s.rotation;
66149                    }
66150                    s.add(a);
66151                  } else if (0 === this.offsetMode) null !== r ? s.copyFrom(r).add(a) : s.copyFrom(a); else {
66152                    u = !1;
66153                    s.copyFrom(o);
66154                    if (!t.DragonBones.yDown) {
66155                      s.y = -s.y;
66156                      s.skew = -s.skew;
66157                      s.rotation = -s.rotation;
66158                    }
66159                  }
66160                  if (u) {
66161                    var d = 0 === l._boneData.type ? l.globalTransformMatrix : l._getGlobalTransformMatrix(s.x, s.y);
66162                    if (i.inheritScale) {
66163                      if (!i.inheritRotation) {
66164                        l.updateGlobalTransform();
66165                        _ = h && c ? s.rotation - (l.global.rotation + Math.PI) : h ? s.rotation + l.global.rotation + Math.PI : c ? s.rotation + l.global.rotation : s.rotation - l.global.rotation;
66166                        s.rotation = _;
66167                      }
66168                      s.toMatrix(n);
66169                      n.concat(d);
66170                      if (i.inheritTranslation) {
66171                        s.x = n.tx;
66172                        s.y = n.ty;
66173                      } else {
66174                        n.tx = s.x;
66175                        n.ty = s.y;
66176                      }
66177                      e ? s.fromMatrix(n) : this._globalDirty = !0;
66178                    } else {
66179                      if (i.inheritTranslation) {
66180                        var p = s.x;
66181                        var m = s.y;
66182                        s.x = d.a * p + d.c * m + d.tx;
66183                        s.y = d.b * p + d.d * m + d.ty;
66184                      } else {
66185                        h && (s.x = -s.x);
66186                        c && (s.y = -s.y);
66187                      }
66188                      if (i.inheritRotation) {
66189                        l.updateGlobalTransform();
66190                        _ = l.global.scaleX < 0 ? s.rotation + l.global.rotation + Math.PI : s.rotation + l.global.rotation;
66191                        if (d.a * d.d - d.b * d.c < 0) {
66192                          _ -= 2 * s.rotation;
66193                          (h !== c || i.inheritReflection) && (s.skew += Math.PI);
66194                          t.DragonBones.yDown || (s.skew = -s.skew);
66195                        }
66196                        s.rotation = _;
66197                      } else if (h || c) {
66198                        if (h && c) _ = s.rotation + Math.PI; else {
66199                          _ = h ? Math.PI - s.rotation : -s.rotation;
66200                          s.skew += Math.PI;
66201                        }
66202                        s.rotation = _;
66203                      }
66204                      s.toMatrix(n);
66205                    }
66206                  } else {
66207                    if (h || c) {
66208                      h && (s.x = -s.x);
66209                      c && (s.y = -s.y);
66210                      if (h && c) _ = s.rotation + Math.PI; else {
66211                        _ = h ? Math.PI - s.rotation : -s.rotation;
66212                        s.skew += Math.PI;
66213                      }
66214                      s.rotation = _;
66215                    }
66216                    s.toMatrix(n);
66217                  }
66218                };
66219                i.prototype.init = function(t, e) {
66220                  if (null === this._boneData) {
66221                    this._boneData = t;
66222                    this._armature = e;
66223                    null !== this._boneData.parent && (this._parent = this._armature.getBone(this._boneData.parent.name));
66224                    this._armature._addBone(this);
66225                    this.origin = this._boneData.transform;
66226                  }
66227                };
66228                i.prototype.update = function(t) {
66229                  this._blendState.dirty = !1;
66230                  if (t >= 0 && null !== this._cachedFrameIndices) {
66231                    var e = this._cachedFrameIndices[t];
66232                    if (e >= 0 && this._cachedFrameIndex === e) this._transformDirty = !1; else if (e >= 0) {
66233                      this._transformDirty = !0;
66234                      this._cachedFrameIndex = e;
66235                    } else {
66236                      if (this._hasConstraint) for (var i = 0, s = this._armature._constraints; i < s.length; i++) {
66237                        (o = s[i])._root === this && o.update();
66238                      }
66239                      if (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) {
66240                        this._transformDirty = !0;
66241                        this._cachedFrameIndex = -1;
66242                      } else if (this._cachedFrameIndex >= 0) {
66243                        this._transformDirty = !1;
66244                        this._cachedFrameIndices[t] = this._cachedFrameIndex;
66245                      } else {
66246                        this._transformDirty = !0;
66247                        this._cachedFrameIndex = -1;
66248                      }
66249                    }
66250                  } else {
66251                    if (this._hasConstraint) for (var n = 0, r = this._armature._constraints; n < r.length; n++) {
66252                      var o;
66253                      (o = r[n])._root === this && o.update();
66254                    }
66255                    if (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) {
66256                      t = -1;
66257                      this._transformDirty = !0;
66258                      this._cachedFrameIndex = -1;
66259                    }
66260                  }
66261                  if (this._transformDirty) {
66262                    this._transformDirty = !1;
66263                    this._childrenTransformDirty = !0;
66264                    if (this._cachedFrameIndex < 0) {
66265                      var a = t >= 0;
66266                      this._localDirty && this._updateGlobalTransformMatrix(a);
66267                      a && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global));
66268                    } else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex);
66269                  } else this._childrenTransformDirty && (this._childrenTransformDirty = !1);
66270                  this._localDirty = !0;
66271                };
66272                i.prototype.updateByConstraint = function() {
66273                  if (this._localDirty) {
66274                    this._localDirty = !1;
66275                    (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) && this._updateGlobalTransformMatrix(!0);
66276                    this._transformDirty = !0;
66277                  }
66278                };
66279                i.prototype.invalidUpdate = function() {
66280                  this._transformDirty = !0;
66281                };
66282                i.prototype.contains = function(t) {
66283                  if (t === this) return !1;
66284                  var e = t;
66285                  for (;e !== this && null !== e; ) e = e.parent;
66286                  return e === this;
66287                };
66288                Object.defineProperty(i.prototype, "boneData", {
66289                  get: function() {
66290                    return this._boneData;
66291                  },
66292                  enumerable: !0,
66293                  configurable: !0
66294                });
66295                Object.defineProperty(i.prototype, "visible", {
66296                  get: function() {
66297                    return this._visible;
66298                  },
66299                  set: function(t) {
66300                    if (this._visible !== t) {
66301                      this._visible = t;
66302                      for (var e = 0, i = this._armature.getSlots(); e < i.length; e++) {
66303                        var s = i[e];
66304                        s.parent === this && s._updateVisible();
66305                      }
66306                    }
66307                  },
66308                  enumerable: !0,
66309                  configurable: !0
66310                });
66311                Object.defineProperty(i.prototype, "name", {
66312                  get: function() {
66313                    return this._boneData.name;
66314                  },
66315                  enumerable: !0,
66316                  configurable: !0
66317                });
66318                Object.defineProperty(i.prototype, "parent", {
66319                  get: function() {
66320                    return this._parent;
66321                  },
66322                  enumerable: !0,
66323                  configurable: !0
66324                });
66325                i.prototype.getBones = function() {
66326                  console.warn("Deprecated.");
66327                  var t = new Array;
66328                  for (var e = 0, i = this._armature.getBones(); e < i.length; e++) {
66329                    var s = i[e];
66330                    s.parent === this && t.push(s);
66331                  }
66332                  return t;
66333                };
66334                i.prototype.getSlots = function() {
66335                  console.warn("Deprecated.");
66336                  var t = new Array;
66337                  for (var e = 0, i = this._armature.getSlots(); e < i.length; e++) {
66338                    var s = i[e];
66339                    s.parent === this && t.push(s);
66340                  }
66341                  return t;
66342                };
66343                Object.defineProperty(i.prototype, "slot", {
66344                  get: function() {
66345                    console.warn("Deprecated.");
66346                    for (var t = 0, e = this._armature.getSlots(); t < e.length; t++) {
66347                      var i = e[t];
66348                      if (i.parent === this) return i;
66349                    }
66350                    return null;
66351                  },
66352                  enumerable: !0,
66353                  configurable: !0
66354                });
66355                return i;
66356              }(t.TransformObject);
66357              t.Bone = e;
66358            }(a5 || (a5 = {}));
66359            !function(t) {
66360              var e = function(t) {
66361                r5(e, t);
66362                function e() {
66363                  var e = null !== t && t.apply(this, arguments) || this;
66364                  e._vertices = [];
66365                  e._deformVertices = [];
66366                  e._hullCache = [];
66367                  e._matrixCahce = [];
66368                  return e;
66369                }
66370                e.toString = function() {
66371                  return "[class dragonBones.Surface]";
66372                };
66373                e.prototype._onClear = function() {
66374                  t.prototype._onClear.call(this);
66375                  this._dX = 0;
66376                  this._dY = 0;
66377                  this._k = 0;
66378                  this._kX = 0;
66379                  this._kY = 0;
66380                  this._vertices.length = 0;
66381                  this._deformVertices.length = 0;
66382                  this._matrixCahce.length = 0;
66383                  this._hullCache.length = 0;
66384                };
66385                e.prototype._getAffineTransform = function(t, e, i, s, n, r, o, a, l, h, c, u, _) {
66386                  var d = o - n;
66387                  var p = a - r;
66388                  var m = l - n;
66389                  var f = h - r;
66390                  c.rotation = Math.atan2(p, d);
66391                  c.skew = Math.atan2(f, m) - .5 * Math.PI - c.rotation;
66392                  _ && (c.rotation += Math.PI);
66393                  c.scaleX = Math.sqrt(d * d + p * p) / i;
66394                  c.scaleY = Math.sqrt(m * m + f * f) / s;
66395                  c.toMatrix(u);
66396                  c.x = u.tx = n - (u.a * t + u.c * e);
66397                  c.y = u.ty = r - (u.b * t + u.d * e);
66398                };
66399                e.prototype._updateVertices = function() {
66400                  var t = this._boneData.vertices;
66401                  var e = this._vertices;
66402                  var i = this._deformVertices;
66403                  if (null !== this._parent) if (1 === this._parent._boneData.type) for (var s = 0, n = t.length; s < n; s += 2) {
66404                    var r = t[s] + i[s];
66405                    var o = t[s + 1] + i[s];
66406                    var a = this._parent._getGlobalTransformMatrix(r, o);
66407                    e[s] = a.a * r + a.c * o + a.tx;
66408                    e[s + 1] = a.b * r + a.d * o + a.ty;
66409                  } else {
66410                    var l = this._parent.globalTransformMatrix;
66411                    for (s = 0, n = t.length; s < n; s += 2) {
66412                      r = t[s] + i[s];
66413                      o = t[s + 1] + i[s + 1];
66414                      e[s] = l.a * r + l.c * o + l.tx;
66415                      e[s + 1] = l.b * r + l.d * o + l.ty;
66416                    }
66417                  } else for (s = 0, n = t.length; s < n; s += 2) {
66418                    e[s] = t[s] + i[s];
66419                    e[s + 1] = t[s + 1] + i[s + 1];
66420                  }
66421                };
66422                e.prototype._updateGlobalTransformMatrix = function(t) {
66423                  var e = 2 * this._boneData.segmentX;
66424                  var i = this._vertices.length - 2;
66425                  var s = this._vertices[0];
66426                  var n = this._vertices[1];
66427                  var r = this._vertices[e];
66428                  var o = this._vertices[e + 1];
66429                  var a = this._vertices[i];
66430                  var l = this._vertices[i + 1];
66431                  var h = this._vertices[i - e];
66432                  var c = this._vertices[i - e + 1];
66433                  var u = s + .5 * (a - s);
66434                  var _ = n + .5 * (l - n);
66435                  var d = u + .5 * (r + .5 * (h - r) - u);
66436                  var p = _ + .5 * (o + .5 * (c - o) - _);
66437                  var m = r + .5 * (a - r);
66438                  var f = o + .5 * (l - o);
66439                  var g = h + .5 * (a - h);
66440                  var y = c + .5 * (l - c);
66441                  this._globalDirty = !1;
66442                  this._getAffineTransform(0, 0, 200, 200, d, p, m, f, g, y, this.global, this.globalTransformMatrix, !1);
66443                };
66444                e.prototype._getGlobalTransformMatrix = function(t, i) {
66445                  var s = 1e3;
66446                  if (t < -s || s < t || i < -s || s < i) return this.globalTransformMatrix;
66447                  var n = !1;
66448                  var r = 200;
66449                  var o = this._boneData;
66450                  var a = o.segmentX;
66451                  var l = o.segmentY;
66452                  var h = 2 * o.segmentX;
66453                  var c = this._dX;
66454                  var u = this._dY;
66455                  var _ = Math.floor((t + r) / c);
66456                  var d = Math.floor((i + r) / u);
66457                  var p = 0;
66458                  var m = _ * c - r;
66459                  var f = d * u - r;
66460                  var g = this._matrixCahce;
66461                  var y = e._helpMatrix;
66462                  if (t < -r) {
66463                    if (i < -r || i >= r) return this.globalTransformMatrix;
66464                    p = 7 * (2 * (a * (l + 1) + 2 * a + l + d) + ((n = i > this._kX * (t + r) + f) ? 1 : 0));
66465                    if (this._matrixCahce[p] > 0) y.copyFromArray(g, p + 1); else {
66466                      var b = d * (h + 2);
66467                      var S = this._hullCache[4];
66468                      var A = this._hullCache[5];
66469                      var T = this._hullCache[2] - (l - d) * S;
66470                      var v = this._hullCache[3] - (l - d) * A;
66471                      var E = this._vertices;
66472                      n ? this._getAffineTransform(-r, f + u, 800, u, E[b + h + 2], E[b + h + 3], T + S, v + A, E[b], E[b + 1], e._helpTransform, y, !0) : this._getAffineTransform(-s, f, 800, u, T, v, E[b], E[b + 1], T + S, v + A, e._helpTransform, y, !1);
66473                      g[p] = 1;
66474                      g[p + 1] = y.a;
66475                      g[p + 2] = y.b;
66476                      g[p + 3] = y.c;
66477                      g[p + 4] = y.d;
66478                      g[p + 5] = y.tx;
66479                      g[p + 6] = y.ty;
66480                    }
66481                  } else if (t >= r) {
66482                    if (i < -r || i >= r) return this.globalTransformMatrix;
66483                    p = 7 * (2 * (a * (l + 1) + a + d) + ((n = i > this._kX * (t - s) + f) ? 1 : 0));
66484                    if (this._matrixCahce[p] > 0) y.copyFromArray(g, p + 1); else {
66485                      b = (d + 1) * (h + 2) - 2;
66486                      S = this._hullCache[4];
66487                      A = this._hullCache[5];
66488                      T = this._hullCache[0] + d * S;
66489                      v = this._hullCache[1] + d * A;
66490                      E = this._vertices;
66491                      n ? this._getAffineTransform(s, f + u, 800, u, T + S, v + A, E[b + h + 2], E[b + h + 3], T, v, e._helpTransform, y, !0) : this._getAffineTransform(r, f, 800, u, E[b], E[b + 1], T, v, E[b + h + 2], E[b + h + 3], e._helpTransform, y, !1);
66492                      g[p] = 1;
66493                      g[p + 1] = y.a;
66494                      g[p + 2] = y.b;
66495                      g[p + 3] = y.c;
66496                      g[p + 4] = y.d;
66497                      g[p + 5] = y.tx;
66498                      g[p + 6] = y.ty;
66499                    }
66500                  } else if (i < -r) {
66501                    if (t < -r || t >= r) return this.globalTransformMatrix;
66502                    p = 7 * (a * (l + 1) + 2 * _ + ((n = i > this._kY * (t - m - c) - s) ? 1 : 0));
66503                    if (this._matrixCahce[p] > 0) y.copyFromArray(g, p + 1); else {
66504                      b = 2 * _;
66505                      S = this._hullCache[10];
66506                      A = this._hullCache[11];
66507                      T = this._hullCache[8] + _ * S;
66508                      v = this._hullCache[9] + _ * A;
66509                      E = this._vertices;
66510                      n ? this._getAffineTransform(m + c, -r, c, 800, E[b + 2], E[b + 3], E[b], E[b + 1], T + S, v + A, e._helpTransform, y, !0) : this._getAffineTransform(m, -s, c, 800, T, v, T + S, v + A, E[b], E[b + 1], e._helpTransform, y, !1);
66511                      g[p] = 1;
66512                      g[p + 1] = y.a;
66513                      g[p + 2] = y.b;
66514                      g[p + 3] = y.c;
66515                      g[p + 4] = y.d;
66516                      g[p + 5] = y.tx;
66517                      g[p + 6] = y.ty;
66518                    }
66519                  } else if (i >= r) {
66520                    if (t < -r || t >= r) return this.globalTransformMatrix;
66521                    p = 7 * (2 * (a * (l + 1) + a + l + d) + ((n = i > this._kY * (t - m - c) + r) ? 1 : 0));
66522                    if (this._matrixCahce[p] > 0) y.copyFromArray(g, p + 1); else {
66523                      b = l * (h + 2) + 2 * _;
66524                      S = this._hullCache[10];
66525                      A = this._hullCache[11];
66526                      T = this._hullCache[6] - (a - _) * S;
66527                      v = this._hullCache[7] - (a - _) * A;
66528                      E = this._vertices;
66529                      n ? this._getAffineTransform(m + c, s, c, 800, T + S, v + A, T, v, E[b + 2], E[b + 3], e._helpTransform, y, !0) : this._getAffineTransform(m, r, c, 800, E[b], E[b + 1], E[b + 2], E[b + 3], T, v, e._helpTransform, y, !1);
66530                      g[p] = 1;
66531                      g[p + 1] = y.a;
66532                      g[p + 2] = y.b;
66533                      g[p + 3] = y.c;
66534                      g[p + 4] = y.d;
66535                      g[p + 5] = y.tx;
66536                      g[p + 6] = y.ty;
66537                    }
66538                  } else {
66539                    p = 7 * (2 * (a * d + _) + ((n = i > this._k * (t - m - c) + f) ? 1 : 0));
66540                    if (this._matrixCahce[p] > 0) y.copyFromArray(g, p + 1); else {
66541                      b = 2 * _ + d * (h + 2);
66542                      E = this._vertices;
66543                      n ? this._getAffineTransform(m + c, f + u, c, u, E[b + h + 4], E[b + h + 5], E[b + h + 2], E[b + h + 3], E[b + 2], E[b + 3], e._helpTransform, y, !0) : this._getAffineTransform(m, f, c, u, E[b], E[b + 1], E[b + 2], E[b + 3], E[b + h + 2], E[b + h + 3], e._helpTransform, y, !1);
66544                      g[p] = 1;
66545                      g[p + 1] = y.a;
66546                      g[p + 2] = y.b;
66547                      g[p + 3] = y.c;
66548                      g[p + 4] = y.d;
66549                      g[p + 5] = y.tx;
66550                      g[p + 6] = y.ty;
66551                    }
66552                  }
66553                  return y;
66554                };
66555                e.prototype.init = function(e, i) {
66556                  if (null === this._boneData) {
66557                    t.prototype.init.call(this, e, i);
66558                    var s = e.segmentX;
66559                    var n = e.segmentY;
66560                    var r = e.vertices.length;
66561                    this._dX = 400 / s;
66562                    this._dY = 400 / n;
66563                    this._k = -this._dY / this._dX;
66564                    this._kX = -this._dY / 800;
66565                    this._kY = -800 / this._dX;
66566                    this._vertices.length = r;
66567                    this._deformVertices.length = r;
66568                    this._matrixCahce.length = 2 * (s * n + 2 * s + 2 * n) * 7;
66569                    this._hullCache.length = 10;
66570                    for (var o = 0; o < r; ++o) this._deformVertices[o] = 0;
66571                  }
66572                };
66573                e.prototype.update = function(t) {
66574                  this._blendState.dirty = !1;
66575                  if (t >= 0 && null !== this._cachedFrameIndices) {
66576                    var i = this._cachedFrameIndices[t];
66577                    if (i >= 0 && this._cachedFrameIndex === i) this._transformDirty = !1; else if (i >= 0) {
66578                      this._transformDirty = !0;
66579                      this._cachedFrameIndex = i;
66580                    } else {
66581                      if (this._hasConstraint) for (var s = 0, n = this._armature._constraints; s < n.length; s++) {
66582                        (a = n[s])._root === this && a.update();
66583                      }
66584                      if (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) {
66585                        this._transformDirty = !0;
66586                        this._cachedFrameIndex = -1;
66587                      } else if (this._cachedFrameIndex >= 0) {
66588                        this._transformDirty = !1;
66589                        this._cachedFrameIndices[t] = this._cachedFrameIndex;
66590                      } else {
66591                        this._transformDirty = !0;
66592                        this._cachedFrameIndex = -1;
66593                      }
66594                    }
66595                  } else {
66596                    if (this._hasConstraint) for (var r = 0, o = this._armature._constraints; r < o.length; r++) {
66597                      var a;
66598                      (a = o[r])._root === this && a.update();
66599                    }
66600                    if (this._transformDirty || null !== this._parent && this._parent._childrenTransformDirty) {
66601                      t = -1;
66602                      this._transformDirty = !0;
66603                      this._cachedFrameIndex = -1;
66604                    }
66605                  }
66606                  if (this._transformDirty) {
66607                    this._transformDirty = !1;
66608                    this._childrenTransformDirty = !0;
66609                    for (var l = 0, h = this._matrixCahce.length; l < h; l += 7) this._matrixCahce[l] = -1;
66610                    this._updateVertices();
66611                    if (this._cachedFrameIndex < 0) {
66612                      var c = t >= 0;
66613                      this._localDirty && this._updateGlobalTransformMatrix(c);
66614                      c && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global));
66615                    } else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex);
66616                    var u = 2 * this.global.x;
66617                    var _ = 2 * this.global.y;
66618                    var d = e._helpPoint;
66619                    this.globalTransformMatrix.transformPoint(1e3, -200, d);
66620                    this._hullCache[0] = d.x;
66621                    this._hullCache[1] = d.y;
66622                    this._hullCache[2] = u - d.x;
66623                    this._hullCache[3] = _ - d.y;
66624                    this.globalTransformMatrix.transformPoint(0, this._dY, d, !0);
66625                    this._hullCache[4] = d.x;
66626                    this._hullCache[5] = d.y;
66627                    this.globalTransformMatrix.transformPoint(200, 1e3, d);
66628                    this._hullCache[6] = d.x;
66629                    this._hullCache[7] = d.y;
66630                    this._hullCache[8] = u - d.x;
66631                    this._hullCache[9] = _ - d.y;
66632                    this.globalTransformMatrix.transformPoint(this._dX, 0, d, !0);
66633                    this._hullCache[10] = d.x;
66634                    this._hullCache[11] = d.y;
66635                  } else this._childrenTransformDirty && (this._childrenTransformDirty = !1);
66636                  this._localDirty = !0;
66637                };
66638                return e;
66639              }(t.Bone);
66640              t.Surface = e;
66641            }(a5 || (a5 = {}));
66642            !function(t) {
66643              var e = function(e) {
66644                r5(i, e);
66645                function i() {
66646                  var i = null !== e && e.apply(this, arguments) || this;
66647                  i._localMatrix = new t.Matrix;
66648                  i._colorTransform = new t.ColorTransform;
66649                  i._displayDatas = [];
66650                  i._displayList = [];
66651                  i._deformVertices = null;
66652                  i._rawDisplay = null;
66653                  i._meshDisplay = null;
66654                  return i;
66655                }
66656                i.prototype._onClear = function() {
66657                  e.prototype._onClear.call(this);
66658                  var i = [];
66659                  for (var s = 0, n = this._displayList; s < n.length; s++) {
66660                    null !== (a = n[s]) && a !== this._rawDisplay && a !== this._meshDisplay && i.indexOf(a) < 0 && i.push(a);
66661                  }
66662                  for (var r = 0, o = i; r < o.length; r++) {
66663                    var a;
66664                    (a = o[r]) instanceof t.Armature ? a.dispose() : this._disposeDisplay(a, !0);
66665                  }
66666                  null !== this._deformVertices && this._deformVertices.returnToPool();
66667                  null !== this._meshDisplay && this._meshDisplay !== this._rawDisplay && this._disposeDisplay(this._meshDisplay, !1);
66668                  null !== this._rawDisplay && this._disposeDisplay(this._rawDisplay, !1);
66669                  this.displayController = null;
66670                  this._displayDirty = !1;
66671                  this._zOrderDirty = !1;
66672                  this._blendModeDirty = !1;
66673                  this._colorDirty = !1;
66674                  this._transformDirty = !1;
66675                  this._visible = !0;
66676                  this._blendMode = 0;
66677                  this._displayIndex = -1;
66678                  this._animationDisplayIndex = -1;
66679                  this._zOrder = 0;
66680                  this._cachedFrameIndex = -1;
66681                  this._pivotX = 0;
66682                  this._pivotY = 0;
66683                  this._localMatrix.identity();
66684                  this._colorTransform.identity();
66685                  this._displayList.length = 0;
66686                  this._displayDatas.length = 0;
66687                  this._slotData = null;
66688                  this._rawDisplayDatas = null;
66689                  this._displayData = null;
66690                  this._boundingBoxData = null;
66691                  this._textureData = null;
66692                  this._deformVertices = null;
66693                  this._rawDisplay = null;
66694                  this._meshDisplay = null;
66695                  this._display = null;
66696                  this._childArmature = null;
66697                  this._parent = null;
66698                  this._cachedFrameIndices = null;
66699                };
66700                i.prototype._getDefaultRawDisplayData = function(t) {
66701                  var e = this._armature._armatureData.defaultSkin;
66702                  if (null !== e) {
66703                    var i = e.getDisplays(this._slotData.name);
66704                    if (null !== i) return t < i.length ? i[t] : null;
66705                  }
66706                  return null;
66707                };
66708                i.prototype._updateDisplayData = function() {
66709                  var e = this._displayData;
66710                  var s = null !== this._deformVertices ? this._deformVertices.verticesData : null;
66711                  var n = this._textureData;
66712                  var r = null;
66713                  var o = null;
66714                  this._displayData = null;
66715                  this._boundingBoxData = null;
66716                  this._textureData = null;
66717                  if (this._displayIndex >= 0) {
66718                    null !== this._rawDisplayDatas && (r = this._displayIndex < this._rawDisplayDatas.length ? this._rawDisplayDatas[this._displayIndex] : null);
66719                    null === r && (r = this._getDefaultRawDisplayData(this._displayIndex));
66720                    this._displayIndex < this._displayDatas.length && (this._displayData = this._displayDatas[this._displayIndex]);
66721                  }
66722                  if (null !== this._displayData) {
66723                    2 === this._displayData.type || 4 === this._displayData.type ? o = this._displayData.vertices : null !== r && (2 === r.type || 4 === r.type) && (o = r.vertices);
66724                    3 === this._displayData.type ? this._boundingBoxData = this._displayData.boundingBox : null !== r && 3 === r.type && (this._boundingBoxData = r.boundingBox);
66725                    (0 === this._displayData.type || 2 === this._displayData.type) && (this._textureData = this._displayData.texture);
66726                  }
66727                  if (this._displayData !== e || o !== s || this._textureData !== n) {
66728                    if (null === o && null !== this._textureData) {
66729                      var a = this._displayData;
66730                      var l = this._textureData.parent.scale * this._armature._armatureData.scale;
66731                      var h = this._textureData.frame;
66732                      this._pivotX = a.pivot.x;
66733                      this._pivotY = a.pivot.y;
66734                      var c = null !== h ? h : this._textureData.region;
66735                      var u = c.width;
66736                      var _ = c.height;
66737                      if (this._textureData.rotated && null === h) {
66738                        u = c.height;
66739                        _ = c.width;
66740                      }
66741                      this._pivotX *= u * l;
66742                      this._pivotY *= _ * l;
66743                      if (null !== h) {
66744                        this._pivotX += h.x * l;
66745                        this._pivotY += h.y * l;
66746                      }
66747                      if (null !== this._displayData && null !== r && this._displayData !== r) {
66748                        r.transform.toMatrix(i._helpMatrix);
66749                        i._helpMatrix.invert();
66750                        i._helpMatrix.transformPoint(0, 0, i._helpPoint);
66751                        this._pivotX -= i._helpPoint.x;
66752                        this._pivotY -= i._helpPoint.y;
66753                        this._displayData.transform.toMatrix(i._helpMatrix);
66754                        i._helpMatrix.invert();
66755                        i._helpMatrix.transformPoint(0, 0, i._helpPoint);
66756                        this._pivotX += i._helpPoint.x;
66757                        this._pivotY += i._helpPoint.y;
66758                      }
66759                      t.DragonBones.yDown || (this._pivotY = (this._textureData.rotated ? this._textureData.region.width : this._textureData.region.height) * l - this._pivotY);
66760                    } else {
66761                      this._pivotX = 0;
66762                      this._pivotY = 0;
66763                    }
66764                    null !== r ? this.origin = r.transform : null !== this._displayData ? this.origin = this._displayData.transform : this.origin = null;
66765                    if (o !== s) {
66766                      null === this._deformVertices && (this._deformVertices = t.BaseObject.borrowObject(t.DeformVertices));
66767                      this._deformVertices.init(o, this._armature);
66768                    } else null !== this._deformVertices && this._textureData !== n && (this._deformVertices.verticesDirty = !0);
66769                    this._displayDirty = !0;
66770                    this._transformDirty = !0;
66771                  }
66772                };
66773                i.prototype._updateDisplay = function() {
66774                  var e = null !== this._display ? this._display : this._rawDisplay;
66775                  var i = this._childArmature;
66776                  if (this._displayIndex >= 0 && this._displayIndex < this._displayList.length) {
66777                    this._display = this._displayList[this._displayIndex];
66778                    if (null !== this._display && this._display instanceof t.Armature) {
66779                      this._childArmature = this._display;
66780                      this._display = this._childArmature.display;
66781                    } else this._childArmature = null;
66782                  } else {
66783                    this._display = null;
66784                    this._childArmature = null;
66785                  }
66786                  var s = null !== this._display ? this._display : this._rawDisplay;
66787                  if (s !== e) {
66788                    this._onUpdateDisplay();
66789                    this._replaceDisplay(e);
66790                    this._transformDirty = !0;
66791                    this._visibleDirty = !0;
66792                    this._blendModeDirty = !0;
66793                    this._colorDirty = !0;
66794                  }
66795                  s !== this._rawDisplay && s !== this._meshDisplay || this._updateFrame();
66796                  if (this._childArmature !== i) {
66797                    if (null !== i) {
66798                      i._parent = null;
66799                      i.clock = null;
66800                      i.inheritAnimation && i.animation.reset();
66801                    }
66802                    if (null !== this._childArmature) {
66803                      this._childArmature._parent = this;
66804                      this._childArmature.clock = this._armature.clock;
66805                      if (this._childArmature.inheritAnimation) {
66806                        if (0 === this._childArmature.cacheFrameRate) {
66807                          var n = this._armature.cacheFrameRate;
66808                          0 !== n && (this._childArmature.cacheFrameRate = n);
66809                        }
66810                        var r = null;
66811                        if (null !== this._displayData && 1 === this._displayData.type) r = this._displayData.actions; else if (this._displayIndex >= 0 && null !== this._rawDisplayDatas) {
66812                          var o = this._displayIndex < this._rawDisplayDatas.length ? this._rawDisplayDatas[this._displayIndex] : null;
66813                          null === o && (o = this._getDefaultRawDisplayData(this._displayIndex));
66814                          null !== o && 1 === o.type && (r = o.actions);
66815                        }
66816                        if (null !== r && r.length > 0) for (var a = 0, l = r; a < l.length; a++) {
66817                          var h = l[a];
66818                          var c = t.BaseObject.borrowObject(t.EventObject);
66819                          t.EventObject.actionDataToInstance(h, c, this._armature);
66820                          c.slot = this;
66821                          this._armature._bufferAction(c, !1);
66822                        } else this._childArmature.animation.play();
66823                      }
66824                    }
66825                  }
66826                };
66827                i.prototype._updateGlobalTransformMatrix = function(t) {
66828                  var e = 0 === this._parent._boneData.type ? this._parent.globalTransformMatrix : this._parent._getGlobalTransformMatrix(this.global.x, this.global.y);
66829                  this.globalTransformMatrix.copyFrom(this._localMatrix);
66830                  this.globalTransformMatrix.concat(e);
66831                  t ? this.global.fromMatrix(this.globalTransformMatrix) : this._globalDirty = !0;
66832                };
66833                i.prototype._setDisplayIndex = function(t, e) {
66834                  void 0 === e && (e = !1);
66835                  if (e) {
66836                    if (this._animationDisplayIndex === t) return !1;
66837                    this._animationDisplayIndex = t;
66838                  }
66839                  if (this._displayIndex === t) return !1;
66840                  this._displayIndex = t;
66841                  this._displayDirty = !0;
66842                  this._updateDisplayData();
66843                  return this._displayDirty;
66844                };
66845                i.prototype._setZorder = function(t) {
66846                  this._zOrder;
66847                  this._zOrder = t;
66848                  this._zOrderDirty = !0;
66849                  return this._zOrderDirty;
66850                };
66851                i.prototype._setColor = function(t) {
66852                  this._colorTransform.copyFrom(t);
66853                  this._colorDirty = !0;
66854                  return this._colorDirty;
66855                };
66856                i.prototype._setDisplayList = function(e) {
66857                  if (null !== e && e.length > 0) {
66858                    this._displayList.length !== e.length && (this._displayList.length = e.length);
66859                    for (var i = 0, s = e.length; i < s; ++i) {
66860                      var n = e[i];
66861                      null !== n && n !== this._rawDisplay && n !== this._meshDisplay && !(n instanceof t.Armature) && this._displayList.indexOf(n) < 0 && this._initDisplay(n, !0);
66862                      this._displayList[i] = n;
66863                    }
66864                  } else this._displayList.length > 0 && (this._displayList.length = 0);
66865                  this._displayIndex >= 0 && this._displayIndex < this._displayList.length ? this._displayDirty = this._display !== this._displayList[this._displayIndex] : this._displayDirty = null !== this._display;
66866                  this._updateDisplayData();
66867                  return this._displayDirty;
66868                };
66869                i.prototype.init = function(t, e, i, s) {
66870                  if (null === this._slotData) {
66871                    this._slotData = t;
66872                    this._isFromCache = !1;
66873                    this._visibleDirty = !0;
66874                    this._blendModeDirty = !0;
66875                    this._colorDirty = !0;
66876                    this._blendMode = this._slotData.blendMode;
66877                    this._zOrder = this._slotData.zOrder;
66878                    this._colorTransform.copyFrom(this._slotData.color);
66879                    this._rawDisplay = i;
66880                    this._meshDisplay = s;
66881                    this._armature = e;
66882                    var n = this._armature.getBone(this._slotData.parent.name);
66883                    null !== n && (this._parent = n);
66884                    this._armature._addSlot(this);
66885                    this._initDisplay(this._rawDisplay, !1);
66886                    this._rawDisplay !== this._meshDisplay && this._initDisplay(this._meshDisplay, !1);
66887                    this._onUpdateDisplay();
66888                    this._addDisplay();
66889                  }
66890                };
66891                i.prototype.update = function(t) {
66892                  this._isFromCache = !1;
66893                  if (this._displayDirty) {
66894                    this._displayDirty = !1;
66895                    this._updateDisplay();
66896                    this._transformDirty && (null !== this.origin ? this.global.copyFrom(this.origin).add(this.offset).toMatrix(this._localMatrix) : this.global.copyFrom(this.offset).toMatrix(this._localMatrix));
66897                  }
66898                  if (this._zOrderDirty) {
66899                    this._zOrderDirty = !1;
66900                    this._updateZOrder();
66901                  }
66902                  if (t >= 0 && null !== this._cachedFrameIndices) {
66903                    var e = this._cachedFrameIndices[t];
66904                    if (e >= 0 && this._cachedFrameIndex === e) this._transformDirty = !1; else if (e >= 0) {
66905                      this._transformDirty = !0;
66906                      this._cachedFrameIndex = e;
66907                    } else if (this._transformDirty || this._parent._childrenTransformDirty) {
66908                      this._transformDirty = !0;
66909                      this._cachedFrameIndex = -1;
66910                    } else if (this._cachedFrameIndex >= 0) {
66911                      this._transformDirty = !1;
66912                      this._cachedFrameIndices[t] = this._cachedFrameIndex;
66913                    } else {
66914                      this._transformDirty = !0;
66915                      this._cachedFrameIndex = -1;
66916                    }
66917                  } else if (this._transformDirty || this._parent._childrenTransformDirty) {
66918                    t = -1;
66919                    this._transformDirty = !0;
66920                    this._cachedFrameIndex = -1;
66921                  }
66922                  if (null !== this._display) {
66923                    if (this._visibleDirty) {
66924                      this._visibleDirty = !1;
66925                      this._updateVisible();
66926                    }
66927                    if (this._blendModeDirty) {
66928                      this._blendModeDirty = !1;
66929                      this._updateBlendMode();
66930                    }
66931                    if (this._colorDirty) {
66932                      this._colorDirty = !1;
66933                      this._updateColor();
66934                    }
66935                    if (null !== this._deformVertices && null !== this._deformVertices.verticesData && this._display === this._meshDisplay) {
66936                      var i = null !== this._deformVertices.verticesData.weight;
66937                      var s = 0 !== this._parent._boneData.type;
66938                      if (this._deformVertices.verticesDirty || i && this._deformVertices.isBonesUpdate() || s && this._parent._childrenTransformDirty) {
66939                        this._deformVertices.verticesDirty = !1;
66940                        this._updateMesh();
66941                      }
66942                      if (i || s) return;
66943                    }
66944                    if (this._transformDirty) {
66945                      this._transformDirty = !1;
66946                      if (this._cachedFrameIndex < 0) {
66947                        var n = t >= 0;
66948                        this._updateGlobalTransformMatrix(n);
66949                        n && null !== this._cachedFrameIndices && (this._cachedFrameIndex = this._cachedFrameIndices[t] = this._armature._armatureData.setCacheFrame(this.globalTransformMatrix, this.global));
66950                      } else {
66951                        this._isFromCache = !0;
66952                        this._armature._armatureData.getCacheFrame(this.globalTransformMatrix, this.global, this._cachedFrameIndex);
66953                      }
66954                      this._updateTransform();
66955                    }
66956                  }
66957                };
66958                i.prototype.updateTransformAndMatrix = function() {
66959                  if (this._transformDirty) {
66960                    this._transformDirty = !1;
66961                    this._updateGlobalTransformMatrix(!1);
66962                  }
66963                };
66964                i.prototype.replaceDisplayData = function(t, e) {
66965                  void 0 === e && (e = -1);
66966                  e < 0 && (e = this._displayIndex < 0 ? 0 : this._displayIndex);
66967                  if (this._displayDatas.length <= e) {
66968                    this._displayDatas.length = e + 1;
66969                    for (var i = 0, s = this._displayDatas.length; i < s; ++i) this._displayDatas[i] || (this._displayDatas[i] = null);
66970                  }
66971                  this._displayDatas[e] = t;
66972                };
66973                i.prototype.containsPoint = function(t, e) {
66974                  if (null === this._boundingBoxData) return !1;
66975                  this.updateTransformAndMatrix();
66976                  i._helpMatrix.copyFrom(this.globalTransformMatrix);
66977                  i._helpMatrix.invert();
66978                  i._helpMatrix.transformPoint(t, e, i._helpPoint);
66979                  return this._boundingBoxData.containsPoint(i._helpPoint.x, i._helpPoint.y);
66980                };
66981                i.prototype.intersectsSegment = function(t, e, s, n, r, o, a) {
66982                  void 0 === r && (r = null);
66983                  void 0 === o && (o = null);
66984                  void 0 === a && (a = null);
66985                  if (null === this._boundingBoxData) return 0;
66986                  this.updateTransformAndMatrix();
66987                  i._helpMatrix.copyFrom(this.globalTransformMatrix);
66988                  i._helpMatrix.invert();
66989                  i._helpMatrix.transformPoint(t, e, i._helpPoint);
66990                  t = i._helpPoint.x;
66991                  e = i._helpPoint.y;
66992                  i._helpMatrix.transformPoint(s, n, i._helpPoint);
66993                  s = i._helpPoint.x;
66994                  n = i._helpPoint.y;
66995                  var l = this._boundingBoxData.intersectsSegment(t, e, s, n, r, o, a);
66996                  if (l > 0) {
66997                    if (1 === l || 2 === l) if (null !== r) {
66998                      this.globalTransformMatrix.transformPoint(r.x, r.y, r);
66999                      if (null !== o) {
67000                        o.x = r.x;
67001                        o.y = r.y;
67002                      }
67003                    } else null !== o && this.globalTransformMatrix.transformPoint(o.x, o.y, o); else {
67004                      null !== r && this.globalTransformMatrix.transformPoint(r.x, r.y, r);
67005                      null !== o && this.globalTransformMatrix.transformPoint(o.x, o.y, o);
67006                    }
67007                    if (null !== a) {
67008                      this.globalTransformMatrix.transformPoint(Math.cos(a.x), Math.sin(a.x), i._helpPoint, !0);
67009                      a.x = Math.atan2(i._helpPoint.y, i._helpPoint.x);
67010                      this.globalTransformMatrix.transformPoint(Math.cos(a.y), Math.sin(a.y), i._helpPoint, !0);
67011                      a.y = Math.atan2(i._helpPoint.y, i._helpPoint.x);
67012                    }
67013                  }
67014                  return l;
67015                };
67016                i.prototype.invalidUpdate = function() {
67017                  this._displayDirty = !0;
67018                  this._transformDirty = !0;
67019                };
67020                Object.defineProperty(i.prototype, "visible", {
67021                  get: function() {
67022                    return this._visible;
67023                  },
67024                  set: function(t) {
67025                    if (this._visible !== t) {
67026                      this._visible = t;
67027                      this._updateVisible();
67028                    }
67029                  },
67030                  enumerable: !0,
67031                  configurable: !0
67032                });
67033                Object.defineProperty(i.prototype, "displayIndex", {
67034                  get: function() {
67035                    return this._displayIndex;
67036                  },
67037                  set: function(t) {
67038                    this._setDisplayIndex(t) && this.update(-1);
67039                  },
67040                  enumerable: !0,
67041                  configurable: !0
67042                });
67043                Object.defineProperty(i.prototype, "name", {
67044                  get: function() {
67045                    return this._slotData.name;
67046                  },
67047                  enumerable: !0,
67048                  configurable: !0
67049                });
67050                Object.defineProperty(i.prototype, "displayList", {
67051                  get: function() {
67052                    return this._displayList.concat();
67053                  },
67054                  set: function(e) {
67055                    var i = this._displayList.concat();
67056                    var s = new Array;
67057                    this._setDisplayList(e) && this.update(-1);
67058                    for (var n = 0, r = i; n < r.length; n++) {
67059                      null !== (l = r[n]) && l !== this._rawDisplay && l !== this._meshDisplay && this._displayList.indexOf(l) < 0 && s.indexOf(l) < 0 && s.push(l);
67060                    }
67061                    for (var o = 0, a = s; o < a.length; o++) {
67062                      var l;
67063                      (l = a[o]) instanceof t.Armature || this._disposeDisplay(l, !0);
67064                    }
67065                  },
67066                  enumerable: !0,
67067                  configurable: !0
67068                });
67069                Object.defineProperty(i.prototype, "slotData", {
67070                  get: function() {
67071                    return this._slotData;
67072                  },
67073                  enumerable: !0,
67074                  configurable: !0
67075                });
67076                Object.defineProperty(i.prototype, "rawDisplayDatas", {
67077                  get: function() {
67078                    return this._rawDisplayDatas;
67079                  },
67080                  set: function(t) {
67081                    if (this._rawDisplayDatas !== t) {
67082                      this._displayDirty = !0;
67083                      this._rawDisplayDatas = t;
67084                      if (null !== this._rawDisplayDatas) {
67085                        this._displayDatas.length = this._rawDisplayDatas.length;
67086                        for (var e = 0, i = this._displayDatas.length; e < i; ++e) {
67087                          var s = this._rawDisplayDatas[e];
67088                          null === s && (s = this._getDefaultRawDisplayData(e));
67089                          this._displayDatas[e] = s;
67090                        }
67091                      } else this._displayDatas.length = 0;
67092                    }
67093                  },
67094                  enumerable: !0,
67095                  configurable: !0
67096                });
67097                Object.defineProperty(i.prototype, "displayData", {
67098                  get: function() {
67099                    return this._displayData;
67100                  },
67101                  enumerable: !0,
67102                  configurable: !0
67103                });
67104                Object.defineProperty(i.prototype, "boundingBoxData", {
67105                  get: function() {
67106                    return this._boundingBoxData;
67107                  },
67108                  enumerable: !0,
67109                  configurable: !0
67110                });
67111                Object.defineProperty(i.prototype, "rawDisplay", {
67112                  get: function() {
67113                    return this._rawDisplay;
67114                  },
67115                  enumerable: !0,
67116                  configurable: !0
67117                });
67118                Object.defineProperty(i.prototype, "meshDisplay", {
67119                  get: function() {
67120                    return this._meshDisplay;
67121                  },
67122                  enumerable: !0,
67123                  configurable: !0
67124                });
67125                Object.defineProperty(i.prototype, "display", {
67126                  get: function() {
67127                    return this._display;
67128                  },
67129                  set: function(t) {
67130                    if (this._display !== t) {
67131                      var e = this._displayList.length;
67132                      this._displayIndex < 0 && 0 === e && (this._displayIndex = 0);
67133                      if (!(this._displayIndex < 0)) {
67134                        var i = this.displayList;
67135                        e <= this._displayIndex && (i.length = this._displayIndex + 1);
67136                        i[this._displayIndex] = t;
67137                        this.displayList = i;
67138                      }
67139                    }
67140                  },
67141                  enumerable: !0,
67142                  configurable: !0
67143                });
67144                Object.defineProperty(i.prototype, "childArmature", {
67145                  get: function() {
67146                    return this._childArmature;
67147                  },
67148                  set: function(t) {
67149                    this._childArmature !== t && (this.display = t);
67150                  },
67151                  enumerable: !0,
67152                  configurable: !0
67153                });
67154                Object.defineProperty(i.prototype, "parent", {
67155                  get: function() {
67156                    return this._parent;
67157                  },
67158                  enumerable: !0,
67159                  configurable: !0
67160                });
67161                i.prototype.getDisplay = function() {
67162                  return this._display;
67163                };
67164                i.prototype.setDisplay = function(t) {
67165                  this.display = t;
67166                };
67167                return i;
67168              }(t.TransformObject);
67169              t.Slot = e;
67170            }(a5 || (a5 = {}));
67171            !function(t) {
67172              var e = function(e) {
67173                r5(i, e);
67174                function i() {
67175                  return null !== e && e.apply(this, arguments) || this;
67176                }
67177                i.prototype._onClear = function() {
67178                  this._armature = null;
67179                  this._target = null;
67180                  this._root = null;
67181                  this._bone = null;
67182                };
67183                Object.defineProperty(i.prototype, "name", {
67184                  get: function() {
67185                    return this._constraintData.name;
67186                  },
67187                  enumerable: !0,
67188                  configurable: !0
67189                });
67190                i._helpMatrix = new t.Matrix;
67191                i._helpTransform = new t.Transform;
67192                i._helpPoint = new t.Point;
67193                return i;
67194              }(t.BaseObject);
67195              t.Constraint = e;
67196              var i = function(e) {
67197                r5(i, e);
67198                function i() {
67199                  return null !== e && e.apply(this, arguments) || this;
67200                }
67201                i.toString = function() {
67202                  return "[class dragonBones.IKConstraint]";
67203                };
67204                i.prototype._onClear = function() {
67205                  e.prototype._onClear.call(this);
67206                  this._scaleEnabled = !1;
67207                  this._bendPositive = !1;
67208                  this._weight = 1;
67209                  this._constraintData = null;
67210                };
67211                i.prototype._computeA = function() {
67212                  var e = this._target.global;
67213                  var i = this._root.global;
67214                  var s = this._root.globalTransformMatrix;
67215                  var n = Math.atan2(e.y - i.y, e.x - i.x);
67216                  i.scaleX < 0 && (n += Math.PI);
67217                  i.rotation += t.Transform.normalizeRadian(n - i.rotation) * this._weight;
67218                  i.toMatrix(s);
67219                };
67220                i.prototype._computeB = function() {
67221                  var e = this._bone._boneData.length;
67222                  var i = this._root;
67223                  var s = this._target.global;
67224                  var n = i.global;
67225                  var r = this._bone.global;
67226                  var o = this._bone.globalTransformMatrix;
67227                  var a = o.a * e;
67228                  var l = o.b * e;
67229                  var h = a * a + l * l;
67230                  var c = Math.sqrt(h);
67231                  var u = r.x - n.x;
67232                  var _ = r.y - n.y;
67233                  var d = u * u + _ * _;
67234                  var p = Math.sqrt(d);
67235                  var m = r.rotation;
67236                  var f = n.rotation;
67237                  var g = Math.atan2(_, u);
67238                  var y = (u = s.x - n.x) * u + (_ = s.y - n.y) * _;
67239                  var b = Math.sqrt(y);
67240                  var S = 0;
67241                  if (c + p <= b || b + c <= p || b + p <= c) {
67242                    S = Math.atan2(s.y - n.y, s.x - n.x);
67243                    c + p <= b || p < c && (S += Math.PI);
67244                  } else {
67245                    var A = (d - h + y) / (2 * y);
67246                    var T = Math.sqrt(d - A * A * y) / b;
67247                    var v = n.x + u * A;
67248                    var E = n.y + _ * A;
67249                    var C = -_ * T;
67250                    var x = u * T;
67251                    var w = !1;
67252                    var R = i.parent;
67253                    if (null !== R) {
67254                      var I = R.globalTransformMatrix;
67255                      w = I.a * I.d - I.b * I.c < 0;
67256                    }
67257                    if (w !== this._bendPositive) {
67258                      r.x = v - C;
67259                      r.y = E - x;
67260                    } else {
67261                      r.x = v + C;
67262                      r.y = E + x;
67263                    }
67264                    S = Math.atan2(r.y - n.y, r.x - n.x);
67265                  }
67266                  var M = t.Transform.normalizeRadian(S - g);
67267                  n.rotation = f + M * this._weight;
67268                  n.toMatrix(i.globalTransformMatrix);
67269                  var B = g + M * this._weight;
67270                  r.x = n.x + Math.cos(B) * p;
67271                  r.y = n.y + Math.sin(B) * p;
67272                  var D = Math.atan2(s.y - r.y, s.x - r.x);
67273                  r.scaleX < 0 && (D += Math.PI);
67274                  r.rotation = n.rotation + m - f + t.Transform.normalizeRadian(D - M - m) * this._weight;
67275                  r.toMatrix(o);
67276                };
67277                i.prototype.init = function(t, e) {
67278                  if (null === this._constraintData) {
67279                    this._constraintData = t;
67280                    this._armature = e;
67281                    this._target = this._armature.getBone(this._constraintData.target.name);
67282                    this._root = this._armature.getBone(this._constraintData.root.name);
67283                    this._bone = null !== this._constraintData.bone ? this._armature.getBone(this._constraintData.bone.name) : null;
67284                    var i = this._constraintData;
67285                    this._scaleEnabled = i.scaleEnabled;
67286                    this._bendPositive = i.bendPositive;
67287                    this._weight = i.weight;
67288                    this._root._hasConstraint = !0;
67289                  }
67290                };
67291                i.prototype.update = function() {
67292                  this._root.updateByConstraint();
67293                  if (null !== this._bone) {
67294                    this._bone.updateByConstraint();
67295                    this._computeB();
67296                  } else this._computeA();
67297                };
67298                i.prototype.invalidUpdate = function() {
67299                  this._root.invalidUpdate();
67300                  null !== this._bone && this._bone.invalidUpdate();
67301                };
67302                return i;
67303              }(e);
67304              t.IKConstraint = i;
67305              var s = function(e) {
67306                r5(i, e);
67307                function i() {
67308                  var t = null !== e && e.apply(this, arguments) || this;
67309                  t._bones = [];
67310                  t._spaces = [];
67311                  t._positions = [];
67312                  t._curves = [];
67313                  t._boneLengths = [];
67314                  t._pathGlobalVertices = [];
67315                  t._segments = [ 10 ];
67316                  return t;
67317                }
67318                i.toString = function() {
67319                  return "[class dragonBones.PathConstraint]";
67320                };
67321                i.prototype._onClear = function() {
67322                  e.prototype._onClear.call(this);
67323                  this.dirty = !1;
67324                  this.pathOffset = 0;
67325                  this.position = 0;
67326                  this.spacing = 0;
67327                  this.rotateOffset = 0;
67328                  this.rotateMix = 1;
67329                  this.translateMix = 1;
67330                  this._pathSlot = null;
67331                  this._bones.length = 0;
67332                  this._spaces.length = 0;
67333                  this._positions.length = 0;
67334                  this._curves.length = 0;
67335                  this._boneLengths.length = 0;
67336                  this._pathGlobalVertices.length = 0;
67337                };
67338                i.prototype._updatePathVertices = function(t) {
67339                  var e = this._armature;
67340                  var i = e.armatureData.parent;
67341                  var s = e.armatureData.scale;
67342                  var n = i.intArray;
67343                  var r = i.floatArray;
67344                  var o = t.offset;
67345                  var a = n[o + 0];
67346                  var l = n[o + 2];
67347                  this._pathGlobalVertices.length = 2 * a;
67348                  var h = t.weight;
67349                  if (null !== h) {
67350                    var c = this._pathSlot._deformVertices.bones;
67351                    var u = h.bones.length;
67352                    var _ = h.offset;
67353                    var d = n[_ + 1];
67354                    var p = _ + 2 + u;
67355                    E = 0;
67356                    for (var m = 0; E < a; E++) {
67357                      var f = 0, g = 0;
67358                      for (var y = 0, b = n[p++]; y < b; y++) {
67359                        var S = c[n[p++]];
67360                        if (null !== S) {
67361                          S.updateByConstraint();
67362                          v = S.globalTransformMatrix;
67363                          var A = r[d++];
67364                          x = r[d++] * s;
67365                          w = r[d++] * s;
67366                          f += (v.a * x + v.c * w + v.tx) * A;
67367                          g += (v.b * x + v.d * w + v.ty) * A;
67368                        }
67369                      }
67370                      this._pathGlobalVertices[m++] = f;
67371                      this._pathGlobalVertices[m++] = g;
67372                    }
67373                  } else {
67374                    var T = this._pathSlot.parent;
67375                    T.updateByConstraint();
67376                    var v = T.globalTransformMatrix;
67377                    for (var E = 0, C = l; E < a; E += 2) {
67378                      var x = r[C++] * s;
67379                      var w = r[C++] * s;
67380                      var R = v.a * x + v.c * w + v.tx;
67381                      var I = v.b * x + v.d * w + v.ty;
67382                      this._pathGlobalVertices[E] = R;
67383                      this._pathGlobalVertices[E + 1] = I;
67384                    }
67385                  }
67386                };
67387                i.prototype._computeVertices = function(t, e, i, s) {
67388                  for (var n = i, r = t; n < e; n += 2) {
67389                    s[n] = this._pathGlobalVertices[r++];
67390                    s[n + 1] = this._pathGlobalVertices[r++];
67391                  }
67392                };
67393                i.prototype._computeBezierCurve = function(t, e, i, s, n) {
67394                  var r = this._armature.armatureData.parent.intArray[t.vertices.offset + 0];
67395                  var o = this._positions;
67396                  var a = this._spaces;
67397                  var l = t.closed;
67398                  var h = Array();
67399                  var c = 2 * r;
67400                  var u = c / 6;
67401                  var _ = -1;
67402                  var d = this.position;
67403                  o.length = 3 * e + 2;
67404                  var p = 0;
67405                  if (t.constantSpeed) {
67406                    if (l) {
67407                      c += 2;
67408                      h.length = r;
67409                      this._computeVertices(2, c - 4, 0, h);
67410                      this._computeVertices(0, 2, c - 4, h);
67411                      h[c - 2] = h[0];
67412                      h[c - 1] = h[1];
67413                    } else {
67414                      u--;
67415                      c -= 4;
67416                      h.length = c;
67417                      this._computeVertices(2, c, 0, h);
67418                    }
67419                    var m = new Array(u);
67420                    p = 0;
67421                    var f = h[0], g = h[1], y = 0, b = 0, S = 0, A = 0, T = 0, v = 0;
67422                    var E, C, x, w, R, I, M, B;
67423                    z = 0;
67424                    for (var D = 2; z < u; z++, D += 6) {
67425                      y = h[D];
67426                      b = h[D + 1];
67427                      S = h[D + 2];
67428                      A = h[D + 3];
67429                      R = 2 * (E = .1875 * (f - 2 * y + S)) + (x = .09375 * (3 * (y - S) - f + (T = h[D + 4])));
67430                      I = 2 * (C = .1875 * (g - 2 * b + A)) + (w = .09375 * (3 * (b - A) - g + (v = h[D + 5])));
67431                      M = .75 * (y - f) + E + .16666667 * x;
67432                      B = .75 * (b - g) + C + .16666667 * w;
67433                      p += Math.sqrt(M * M + B * B);
67434                      M += R;
67435                      B += I;
67436                      R += x;
67437                      I += w;
67438                      p += Math.sqrt(M * M + B * B);
67439                      M += R;
67440                      B += I;
67441                      p += Math.sqrt(M * M + B * B);
67442                      M += R + x;
67443                      B += I + w;
67444                      p += Math.sqrt(M * M + B * B);
67445                      m[z] = p;
67446                      f = T;
67447                      g = v;
67448                    }
67449                    s && (d *= p);
67450                    if (n) for (z = 0; z < e; z++) a[z] *= p;
67451                    var P = this._segments;
67452                    var O = 0;
67453                    z = 0, H = 0, j = 0;
67454                    for (var N = 0; z < e; z++, H += 3) {
67455                      var L = d += a[z];
67456                      if (l) {
67457                        (L %= p) < 0 && (L += p);
67458                        j = 0;
67459                      } else {
67460                        if (L < 0) continue;
67461                        if (L > p) continue;
67462                      }
67463                      for (;;j++) {
67464                        var F = m[j];
67465                        if (!(L > F)) {
67466                          if (0 === j) L /= F; else {
67467                            L = (L - (U = m[j - 1])) / (F - U);
67468                          }
67469                          break;
67470                        }
67471                      }
67472                      if (j !== _) {
67473                        _ = j;
67474                        var V = 6 * j;
67475                        f = h[V];
67476                        g = h[V + 1];
67477                        y = h[V + 2];
67478                        b = h[V + 3];
67479                        S = h[V + 4];
67480                        A = h[V + 5];
67481                        R = 2 * (E = .03 * (f - 2 * y + S)) + (x = .006 * (3 * (y - S) - f + (T = h[V + 6])));
67482                        I = 2 * (C = .03 * (g - 2 * b + A)) + (w = .006 * (3 * (b - A) - g + (v = h[V + 7])));
67483                        M = .3 * (y - f) + E + .16666667 * x;
67484                        B = .3 * (b - g) + C + .16666667 * w;
67485                        O = Math.sqrt(M * M + B * B);
67486                        P[0] = O;
67487                        for (V = 1; V < 8; V++) {
67488                          M += R;
67489                          B += I;
67490                          R += x;
67491                          I += w;
67492                          O += Math.sqrt(M * M + B * B);
67493                          P[V] = O;
67494                        }
67495                        M += R;
67496                        B += I;
67497                        O += Math.sqrt(M * M + B * B);
67498                        P[8] = O;
67499                        M += R + x;
67500                        B += I + w;
67501                        O += Math.sqrt(M * M + B * B);
67502                        P[9] = O;
67503                        N = 0;
67504                      }
67505                      L *= O;
67506                      for (;;N++) {
67507                        var k = P[N];
67508                        if (!(L > k)) {
67509                          if (0 === N) L /= k; else {
67510                            var U;
67511                            L = N + (L - (U = P[N - 1])) / (k - U);
67512                          }
67513                          break;
67514                        }
67515                      }
67516                      this.addCurvePosition(.1 * L, f, g, y, b, S, A, T, v, o, H, i);
67517                    }
67518                  } else {
67519                    var G = t.curveLengths;
67520                    p = G[u -= l ? 1 : 2];
67521                    s && (d *= p);
67522                    if (n) for (var z = 0; z < e; z++) a[z] *= p;
67523                    h.length = 8;
67524                    for (var z = 0, H = 0, j = 0; z < e; z++, H += 3) {
67525                      d += a[z];
67526                      if (l) {
67527                        (d %= p) < 0 && (d += p);
67528                        j = 0;
67529                      } else {
67530                        if (d < 0) continue;
67531                        if (d > p) continue;
67532                      }
67533                      var X = 0;
67534                      for (;;j++) {
67535                        var W = G[j];
67536                        if (!(d > W)) {
67537                          if (0 === j) X = d / W; else {
67538                            var Y = G[j - 1];
67539                            X = (d - Y) / (W - Y);
67540                          }
67541                          break;
67542                        }
67543                      }
67544                      if (j !== _) {
67545                        _ = j;
67546                        if (l && j === u) {
67547                          this._computeVertices(c - 4, 4, 0, h);
67548                          this._computeVertices(0, 4, 4, h);
67549                        } else this._computeVertices(6 * j + 2, 8, 0, h);
67550                      }
67551                      this.addCurvePosition(X, h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7], o, H, i);
67552                    }
67553                  }
67554                };
67555                i.prototype.addCurvePosition = function(t, e, i, s, n, r, o, a, l, h, c, u) {
67556                  if (0 !== t) if (1 !== t) {
67557                    var _ = 1 - t;
67558                    var d = _ * _;
67559                    var p = t * t;
67560                    var m = d * _;
67561                    var f = d * t * 3;
67562                    var g = _ * p * 3;
67563                    var y = t * p;
67564                    var b = m * e + f * s + g * r + y * a;
67565                    var S = m * i + f * n + g * o + y * l;
67566                    h[c] = b;
67567                    h[c + 1] = S;
67568                    h[c + 2] = u ? Math.atan2(S - (m * i + f * n + g * o), b - (m * e + f * s + g * r)) : 0;
67569                  } else {
67570                    h[c] = a;
67571                    h[c + 1] = l;
67572                    h[c + 2] = 0;
67573                  } else {
67574                    h[c] = e;
67575                    h[c + 1] = i;
67576                    h[c + 2] = 0;
67577                  }
67578                };
67579                i.prototype.init = function(t, e) {
67580                  this._constraintData = t;
67581                  this._armature = e;
67582                  var i = t;
67583                  this.pathOffset = i.pathDisplayData.vertices.offset;
67584                  this.position = i.position;
67585                  this.spacing = i.spacing;
67586                  this.rotateOffset = i.rotateOffset;
67587                  this.rotateMix = i.rotateMix;
67588                  this.translateMix = i.translateMix;
67589                  this._root = this._armature.getBone(i.root.name);
67590                  this._target = this._armature.getBone(i.target.name);
67591                  this._pathSlot = this._armature.getSlot(i.pathSlot.name);
67592                  for (var s = 0, n = i.bones.length; s < n; s++) {
67593                    var r = this._armature.getBone(i.bones[s].name);
67594                    null !== r && this._bones.push(r);
67595                  }
67596                  2 === i.rotateMode && (this._boneLengths.length = this._bones.length);
67597                  this._root._hasConstraint = !0;
67598                };
67599                i.prototype.update = function() {
67600                  var e = this._pathSlot;
67601                  if (null !== e._deformVertices && null !== e._deformVertices.verticesData && e._deformVertices.verticesData.offset === this.pathOffset) {
67602                    var i = this._constraintData;
67603                    var s = e._displayData;
67604                    var n = !1;
67605                    var r = e._deformVertices;
67606                    if (this._root._childrenTransformDirty) {
67607                      this._updatePathVertices(s.vertices);
67608                      n = !0;
67609                    } else if (null !== r && (r.verticesDirty || r.isBonesUpdate())) {
67610                      this._updatePathVertices(s.vertices);
67611                      r.verticesDirty = !1;
67612                      n = !0;
67613                    }
67614                    if (n || this.dirty) {
67615                      var o = i.positionMode;
67616                      var a = i.spacingMode;
67617                      var l = i.rotateMode;
67618                      var h = this._bones;
67619                      var c = 0 === a;
67620                      var u = 2 === l;
67621                      var _ = 0 === l;
67622                      var d = h.length;
67623                      var p = _ ? d : d + 1;
67624                      var m = this.spacing;
67625                      var f = this._spaces;
67626                      f.length = p;
67627                      if (u || c) {
67628                        f[0] = 0;
67629                        for (var g = 0, y = p - 1; g < y; g++) {
67630                          (B = h[g]).updateByConstraint();
67631                          var b = B._boneData.length;
67632                          var S = b * (D = B.globalTransformMatrix).a;
67633                          var A = b * D.b;
67634                          var T = Math.sqrt(S * S + A * A);
67635                          u && (this._boneLengths[g] = T);
67636                          f[g + 1] = (b + m) * T / b;
67637                        }
67638                      } else for (g = 0; g < p; g++) f[g] = m;
67639                      this._computeBezierCurve(s, p, _, 1 === o, 2 === a);
67640                      var v = this._positions;
67641                      var E = this.rotateOffset;
67642                      var C = v[0], x = v[1];
67643                      var w;
67644                      if (0 === E) w = 1 === l; else {
67645                        w = !1;
67646                        if (null !== (B = e.parent)) {
67647                          E *= (D = B.globalTransformMatrix).a * D.d - D.b * D.c > 0 ? t.Transform.DEG_RAD : -t.Transform.DEG_RAD;
67648                        }
67649                      }
67650                      var R = this.rotateMix;
67651                      var I = this.translateMix;
67652                      g = 0;
67653                      for (var M = 3; g < d; g++, M += 3) {
67654                        var B;
67655                        (B = h[g]).updateByConstraint();
67656                        var D;
67657                        (D = B.globalTransformMatrix).tx += (C - D.tx) * I;
67658                        D.ty += (x - D.ty) * I;
67659                        var P = (S = v[M]) - C, O = (A = v[M + 1]) - x;
67660                        if (u) {
67661                          var N = this._boneLengths[g];
67662                          var L = (Math.sqrt(P * P + O * O) / N - 1) * R + 1;
67663                          D.a *= L;
67664                          D.b *= L;
67665                        }
67666                        C = S;
67667                        x = A;
67668                        if (R > 0) {
67669                          var F = D.a, V = D.b, k = D.c, U = D.d, G = void 0, z = void 0, H = void 0;
67670                          G = _ ? v[M - 1] : Math.atan2(O, P);
67671                          G -= Math.atan2(V, F);
67672                          if (w) {
67673                            z = Math.cos(G);
67674                            H = Math.sin(G);
67675                            var j = B._boneData.length;
67676                            C += (j * (z * F - H * V) - P) * R;
67677                            x += (j * (H * F + z * V) - O) * R;
67678                          } else G += E;
67679                          G > t.Transform.PI ? G -= t.Transform.PI_D : G < -t.Transform.PI && (G += t.Transform.PI_D);
67680                          G *= R;
67681                          z = Math.cos(G);
67682                          H = Math.sin(G);
67683                          D.a = z * F - H * V;
67684                          D.b = H * F + z * V;
67685                          D.c = z * k - H * U;
67686                          D.d = H * k + z * U;
67687                        }
67688                        B.global.fromMatrix(D);
67689                      }
67690                      this.dirty = !1;
67691                    }
67692                  }
67693                };
67694                i.prototype.invalidUpdate = function() {};
67695                return i;
67696              }(e);
67697              t.PathConstraint = s;
67698            }(a5 || (a5 = {}));
67699            !function(t) {
67700              var e = function() {
67701                function t(t) {
67702                  void 0 === t && (t = 0);
67703                  this.time = 0;
67704                  this.timeScale = 1;
67705                  this._systemTime = 0;
67706                  this._animatebles = [];
67707                  this._clock = null;
67708                  this.time = t;
67709                  this._systemTime = .001 * (new Date).getTime();
67710                }
67711                t.prototype.advanceTime = function(t) {
67712                  t != t && (t = 0);
67713                  var e = .001 * Date.now();
67714                  t < 0 && (t = e - this._systemTime);
67715                  this._systemTime = e;
67716                  1 !== this.timeScale && (t *= this.timeScale);
67717                  if (0 !== t) {
67718                    t < 0 ? this.time -= t : this.time += t;
67719                    var i = 0, s = 0, n = this._animatebles.length;
67720                    for (;i < n; ++i) {
67721                      var r = this._animatebles[i];
67722                      if (null !== r) {
67723                        if (s > 0) {
67724                          this._animatebles[i - s] = r;
67725                          this._animatebles[i] = null;
67726                        }
67727                        r.advanceTime(t);
67728                      } else s++;
67729                    }
67730                    if (s > 0) {
67731                      n = this._animatebles.length;
67732                      for (;i < n; ++i) {
67733                        var o = this._animatebles[i];
67734                        null !== o ? this._animatebles[i - s] = o : s++;
67735                      }
67736                      this._animatebles.length -= s;
67737                    }
67738                  }
67739                };
67740                t.prototype.contains = function(t) {
67741                  if (t === this) return !1;
67742                  var e = t;
67743                  for (;e !== this && null !== e; ) e = e.clock;
67744                  return e === this;
67745                };
67746                t.prototype.add = function(t) {
67747                  if (this._animatebles.indexOf(t) < 0) {
67748                    this._animatebles.push(t);
67749                    t.clock = this;
67750                  }
67751                };
67752                t.prototype.remove = function(t) {
67753                  var e = this._animatebles.indexOf(t);
67754                  if (e >= 0) {
67755                    this._animatebles[e] = null;
67756                    t.clock = null;
67757                  }
67758                };
67759                t.prototype.clear = function() {
67760                  for (var t = 0, e = this._animatebles; t < e.length; t++) {
67761                    var i = e[t];
67762                    null !== i && (i.clock = null);
67763                  }
67764                };
67765                Object.defineProperty(t.prototype, "clock", {
67766                  get: function() {
67767                    return this._clock;
67768                  },
67769                  set: function(t) {
67770                    if (this._clock !== t) {
67771                      null !== this._clock && this._clock.remove(this);
67772                      this._clock = t;
67773                      null !== this._clock && this._clock.add(this);
67774                    }
67775                  },
67776                  enumerable: !0,
67777                  configurable: !0
67778                });
67779                t.clock = new t;
67780                return t;
67781              }();
67782              t.WorldClock = e;
67783            }(a5 || (a5 = {}));
67784            !function(t) {
67785              var e = function(e) {
67786                r5(i, e);
67787                function i() {
67788                  var t = null !== e && e.apply(this, arguments) || this;
67789                  t._animationNames = [];
67790                  t._animationStates = [];
67791                  t._animations = {};
67792                  t._animationConfig = null;
67793                  return t;
67794                }
67795                i.toString = function() {
67796                  return "[class dragonBones.Animation]";
67797                };
67798                i.prototype._onClear = function() {
67799                  for (var t = 0, e = this._animationStates; t < e.length; t++) {
67800                    e[t].returnToPool();
67801                  }
67802                  for (var i in this._animations) delete this._animations[i];
67803                  null !== this._animationConfig && this._animationConfig.returnToPool();
67804                  this.timeScale = 1;
67805                  this._lockUpdate = !1;
67806                  this._animationDirty = !1;
67807                  this._inheritTimeScale = 1;
67808                  this._animationNames.length = 0;
67809                  this._animationStates.length = 0;
67810                  this._armature = null;
67811                  this._animationConfig = null;
67812                  this._lastAnimationState = null;
67813                };
67814                i.prototype._fadeOut = function(t) {
67815                  switch (t.fadeOutMode) {
67816                   case 1:
67817                    for (var e = 0, i = this._animationStates; e < i.length; e++) {
67818                      null === (h = i[e])._parent && (h.layer === t.layer && h.fadeOut(t.fadeOutTime, t.pauseFadeOut));
67819                    }
67820                    break;
67821
67822                   case 2:
67823                    for (var s = 0, n = this._animationStates; s < n.length; s++) {
67824                      null === (h = n[s])._parent && (h.group === t.group && h.fadeOut(t.fadeOutTime, t.pauseFadeOut));
67825                    }
67826                    break;
67827
67828                   case 3:
67829                    for (var r = 0, o = this._animationStates; r < o.length; r++) {
67830                      null === (h = o[r])._parent && (h.layer === t.layer && h.group === t.group && h.fadeOut(t.fadeOutTime, t.pauseFadeOut));
67831                    }
67832                    break;
67833
67834                   case 4:
67835                    for (var a = 0, l = this._animationStates; a < l.length; a++) {
67836                      var h;
67837                      null === (h = l[a])._parent && h.fadeOut(t.fadeOutTime, t.pauseFadeOut);
67838                    }
67839                  }
67840                };
67841                i.prototype.init = function(e) {
67842                  if (null === this._armature) {
67843                    this._armature = e;
67844                    this._animationConfig = t.BaseObject.borrowObject(t.AnimationConfig);
67845                  }
67846                };
67847                i.prototype.advanceTime = function(t) {
67848                  t < 0 && (t = -t);
67849                  this._armature.inheritAnimation && null !== this._armature._parent ? this._inheritTimeScale = this._armature._parent._armature.animation._inheritTimeScale * this.timeScale : this._inheritTimeScale = this.timeScale;
67850                  1 !== this._inheritTimeScale && (t *= this._inheritTimeScale);
67851                  var e = this._animationStates.length;
67852                  if (1 === e) {
67853                    if ((p = this._animationStates[0])._fadeState > 0 && p._subFadeState > 0) {
67854                      this._armature._dragonBones.bufferObject(p);
67855                      this._animationStates.length = 0;
67856                      this._lastAnimationState = null;
67857                    } else {
67858                      var i = p._animationData;
67859                      var s = i.cacheFrameRate;
67860                      if (this._animationDirty && s > 0) {
67861                        this._animationDirty = !1;
67862                        for (var n = 0, r = this._armature.getBones(); n < r.length; n++) {
67863                          var o = r[n];
67864                          o._cachedFrameIndices = i.getBoneCachedFrameIndices(o.name);
67865                        }
67866                        for (var a = 0, l = this._armature.getSlots(); a < l.length; a++) {
67867                          var h = l[a];
67868                          var c = h.rawDisplayDatas;
67869                          if (null !== c && c.length > 0) {
67870                            var u = c[0];
67871                            if (null !== u && u.parent === this._armature.armatureData.defaultSkin) {
67872                              h._cachedFrameIndices = i.getSlotCachedFrameIndices(h.name);
67873                              continue;
67874                            }
67875                          }
67876                          h._cachedFrameIndices = null;
67877                        }
67878                      }
67879                      p.advanceTime(t, s);
67880                    }
67881                  } else if (e > 1) {
67882                    for (var _ = 0, d = 0; _ < e; ++_) {
67883                      var p;
67884                      if ((p = this._animationStates[_])._fadeState > 0 && p._subFadeState > 0) {
67885                        d++;
67886                        this._armature._dragonBones.bufferObject(p);
67887                        this._animationDirty = !0;
67888                        this._lastAnimationState === p && (this._lastAnimationState = null);
67889                      } else {
67890                        d > 0 && (this._animationStates[_ - d] = p);
67891                        p.advanceTime(t, 0);
67892                      }
67893                      if (_ === e - 1 && d > 0) {
67894                        this._animationStates.length -= d;
67895                        null === this._lastAnimationState && this._animationStates.length > 0 && (this._lastAnimationState = this._animationStates[this._animationStates.length - 1]);
67896                      }
67897                    }
67898                    this._armature._cacheFrameIndex = -1;
67899                  } else this._armature._cacheFrameIndex = -1;
67900                };
67901                i.prototype.reset = function() {
67902                  for (var t = 0, e = this._animationStates; t < e.length; t++) {
67903                    e[t].returnToPool();
67904                  }
67905                  this._animationDirty = !1;
67906                  this._animationConfig.clear();
67907                  this._animationStates.length = 0;
67908                  this._lastAnimationState = null;
67909                };
67910                i.prototype.stop = function(t) {
67911                  void 0 === t && (t = null);
67912                  if (null !== t) {
67913                    null !== (s = this.getState(t)) && s.stop();
67914                  } else for (var e = 0, i = this._animationStates; e < i.length; e++) {
67915                    var s;
67916                    (s = i[e]).stop();
67917                  }
67918                };
67919                i.prototype.playConfig = function(e) {
67920                  var i = e.animation;
67921                  if (!(i in this._animations)) {
67922                    console.warn("Non-existent animation.\n", "DragonBones name: " + this._armature.armatureData.parent.name, "Armature name: " + this._armature.name, "Animation name: " + i);
67923                    return null;
67924                  }
67925                  var s = this._animations[i];
67926                  if (5 === e.fadeOutMode) for (var n = 0, r = this._animationStates; n < r.length; n++) {
67927                    var o = r[n];
67928                    if (o._animationData === s) return o;
67929                  }
67930                  0 === this._animationStates.length ? e.fadeInTime = 0 : e.fadeInTime < 0 && (e.fadeInTime = s.fadeInTime);
67931                  e.fadeOutTime < 0 && (e.fadeOutTime = e.fadeInTime);
67932                  e.timeScale <= -100 && (e.timeScale = 1 / s.scale);
67933                  if (s.frameCount > 1) {
67934                    if (e.position < 0) {
67935                      e.position %= s.duration;
67936                      e.position = s.duration - e.position;
67937                    } else e.position === s.duration ? e.position -= 1e-6 : e.position > s.duration && (e.position %= s.duration);
67938                    e.duration > 0 && e.position + e.duration > s.duration && (e.duration = s.duration - e.position);
67939                    e.playTimes < 0 && (e.playTimes = s.playTimes);
67940                  } else {
67941                    e.playTimes = 1;
67942                    e.position = 0;
67943                    e.duration > 0 && (e.duration = 0);
67944                  }
67945                  0 === e.duration && (e.duration = -1);
67946                  this._fadeOut(e);
67947                  var a = t.BaseObject.borrowObject(t.AnimationState);
67948                  a.init(this._armature, s, e);
67949                  this._animationDirty = !0;
67950                  this._armature._cacheFrameIndex = -1;
67951                  if (this._animationStates.length > 0) {
67952                    var l = !1;
67953                    for (var h = 0, c = this._animationStates.length; h < c; ++h) {
67954                      if (a.layer > this._animationStates[h].layer) {
67955                        l = !0;
67956                        this._animationStates.splice(h, 0, a);
67957                        break;
67958                      }
67959                      if (h !== c - 1 && a.layer > this._animationStates[h + 1].layer) {
67960                        l = !0;
67961                        this._animationStates.splice(h + 1, 0, a);
67962                        break;
67963                      }
67964                    }
67965                    l || this._animationStates.push(a);
67966                  } else this._animationStates.push(a);
67967                  for (var u = 0, _ = this._armature.getSlots(); u < _.length; u++) {
67968                    var d = _[u].childArmature;
67969                    null !== d && d.inheritAnimation && d.animation.hasAnimation(i) && null === d.animation.getState(i) && d.animation.fadeIn(i);
67970                  }
67971                  var p = !1;
67972                  for (var m in s.animationTimelines) {
67973                    if (!this._lockUpdate) {
67974                      p = !0;
67975                      this._lockUpdate = !0;
67976                    }
67977                    var f = this.fadeIn(m, e.fadeInTime, 1, a.layer, null, 0);
67978                    if (null !== f) {
67979                      f.resetToPose = !1;
67980                      f._parent = a;
67981                      f.stop();
67982                    }
67983                  }
67984                  p && (this._lockUpdate = !1);
67985                  if (!this._lockUpdate) {
67986                    e.fadeInTime <= 0 && this._armature.advanceTime(0);
67987                    this._lastAnimationState = a;
67988                  }
67989                  return a;
67990                };
67991                i.prototype.play = function(t, e) {
67992                  void 0 === t && (t = null);
67993                  void 0 === e && (e = -1);
67994                  this._animationConfig.clear();
67995                  this._animationConfig.resetToPose = !0;
67996                  this._animationConfig.playTimes = e;
67997                  this._animationConfig.fadeInTime = 0;
67998                  this._animationConfig.animation = null !== t ? t : "";
67999                  if (null !== t && t.length > 0) this.playConfig(this._animationConfig); else if (null === this._lastAnimationState) {
68000                    var i = this._armature.armatureData.defaultAnimation;
68001                    if (null !== i) {
68002                      this._animationConfig.animation = i.name;
68003                      this.playConfig(this._animationConfig);
68004                    }
68005                  } else if (this._lastAnimationState.isPlaying || this._lastAnimationState.isCompleted) {
68006                    this._animationConfig.animation = this._lastAnimationState.name;
68007                    this.playConfig(this._animationConfig);
68008                  } else this._lastAnimationState.play();
68009                  return this._lastAnimationState;
68010                };
68011                i.prototype.fadeIn = function(t, e, i, s, n, r) {
68012                  void 0 === e && (e = -1);
68013                  void 0 === i && (i = -1);
68014                  void 0 === s && (s = 0);
68015                  void 0 === n && (n = null);
68016                  void 0 === r && (r = 3);
68017                  this._animationConfig.clear();
68018                  this._animationConfig.fadeOutMode = r;
68019                  this._animationConfig.playTimes = i;
68020                  this._animationConfig.layer = s;
68021                  this._animationConfig.fadeInTime = e;
68022                  this._animationConfig.animation = t;
68023                  this._animationConfig.group = null !== n ? n : "";
68024                  return this.playConfig(this._animationConfig);
68025                };
68026                i.prototype.gotoAndPlayByTime = function(t, e, i) {
68027                  void 0 === e && (e = 0);
68028                  void 0 === i && (i = -1);
68029                  this._animationConfig.clear();
68030                  this._animationConfig.resetToPose = !0;
68031                  this._animationConfig.playTimes = i;
68032                  this._animationConfig.position = e;
68033                  this._animationConfig.fadeInTime = 0;
68034                  this._animationConfig.animation = t;
68035                  return this.playConfig(this._animationConfig);
68036                };
68037                i.prototype.gotoAndPlayByFrame = function(t, e, i) {
68038                  void 0 === e && (e = 0);
68039                  void 0 === i && (i = -1);
68040                  this._animationConfig.clear();
68041                  this._animationConfig.resetToPose = !0;
68042                  this._animationConfig.playTimes = i;
68043                  this._animationConfig.fadeInTime = 0;
68044                  this._animationConfig.animation = t;
68045                  var s = t in this._animations ? this._animations[t] : null;
68046                  null !== s && (this._animationConfig.position = s.duration * e / s.frameCount);
68047                  return this.playConfig(this._animationConfig);
68048                };
68049                i.prototype.gotoAndPlayByProgress = function(t, e, i) {
68050                  void 0 === e && (e = 0);
68051                  void 0 === i && (i = -1);
68052                  this._animationConfig.clear();
68053                  this._animationConfig.resetToPose = !0;
68054                  this._animationConfig.playTimes = i;
68055                  this._animationConfig.fadeInTime = 0;
68056                  this._animationConfig.animation = t;
68057                  var s = t in this._animations ? this._animations[t] : null;
68058                  null !== s && (this._animationConfig.position = s.duration * (e > 0 ? e : 0));
68059                  return this.playConfig(this._animationConfig);
68060                };
68061                i.prototype.gotoAndStopByTime = function(t, e) {
68062                  void 0 === e && (e = 0);
68063                  var i = this.gotoAndPlayByTime(t, e, 1);
68064                  null !== i && i.stop();
68065                  return i;
68066                };
68067                i.prototype.gotoAndStopByFrame = function(t, e) {
68068                  void 0 === e && (e = 0);
68069                  var i = this.gotoAndPlayByFrame(t, e, 1);
68070                  null !== i && i.stop();
68071                  return i;
68072                };
68073                i.prototype.gotoAndStopByProgress = function(t, e) {
68074                  void 0 === e && (e = 0);
68075                  var i = this.gotoAndPlayByProgress(t, e, 1);
68076                  null !== i && i.stop();
68077                  return i;
68078                };
68079                i.prototype.getState = function(t) {
68080                  var e = this._animationStates.length;
68081                  for (;e--; ) {
68082                    var i = this._animationStates[e];
68083                    if (i.name === t) return i;
68084                  }
68085                  return null;
68086                };
68087                i.prototype.hasAnimation = function(t) {
68088                  return t in this._animations;
68089                };
68090                i.prototype.getStates = function() {
68091                  return this._animationStates;
68092                };
68093                Object.defineProperty(i.prototype, "isPlaying", {
68094                  get: function() {
68095                    for (var t = 0, e = this._animationStates; t < e.length; t++) {
68096                      if (e[t].isPlaying) return !0;
68097                    }
68098                    return !1;
68099                  },
68100                  enumerable: !0,
68101                  configurable: !0
68102                });
68103                Object.defineProperty(i.prototype, "isCompleted", {
68104                  get: function() {
68105                    for (var t = 0, e = this._animationStates; t < e.length; t++) {
68106                      if (!e[t].isCompleted) return !1;
68107                    }
68108                    return this._animationStates.length > 0;
68109                  },
68110                  enumerable: !0,
68111                  configurable: !0
68112                });
68113                Object.defineProperty(i.prototype, "lastAnimationName", {
68114                  get: function() {
68115                    return null !== this._lastAnimationState ? this._lastAnimationState.name : "";
68116                  },
68117                  enumerable: !0,
68118                  configurable: !0
68119                });
68120                Object.defineProperty(i.prototype, "animationNames", {
68121                  get: function() {
68122                    return this._animationNames;
68123                  },
68124                  enumerable: !0,
68125                  configurable: !0
68126                });
68127                Object.defineProperty(i.prototype, "animations", {
68128                  get: function() {
68129                    return this._animations;
68130                  },
68131                  set: function(t) {
68132                    if (this._animations !== t) {
68133                      this._animationNames.length = 0;
68134                      for (var e in this._animations) delete this._animations[e];
68135                      for (var e in t) {
68136                        this._animationNames.push(e);
68137                        this._animations[e] = t[e];
68138                      }
68139                    }
68140                  },
68141                  enumerable: !0,
68142                  configurable: !0
68143                });
68144                Object.defineProperty(i.prototype, "animationConfig", {
68145                  get: function() {
68146                    this._animationConfig.clear();
68147                    return this._animationConfig;
68148                  },
68149                  enumerable: !0,
68150                  configurable: !0
68151                });
68152                Object.defineProperty(i.prototype, "lastAnimationState", {
68153                  get: function() {
68154                    return this._lastAnimationState;
68155                  },
68156                  enumerable: !0,
68157                  configurable: !0
68158                });
68159                i.prototype.gotoAndPlay = function(t, e, i, s, n, r, o, a, l) {
68160                  void 0 === e && (e = -1);
68161                  void 0 === i && (i = -1);
68162                  void 0 === s && (s = -1);
68163                  void 0 === n && (n = 0);
68164                  void 0 === r && (r = null);
68165                  void 0 === o && (o = 3);
68166                  console.warn("Deprecated.");
68167                  this._animationConfig.clear();
68168                  this._animationConfig.resetToPose = !0;
68169                  this._animationConfig.fadeOutMode = o;
68170                  this._animationConfig.playTimes = s;
68171                  this._animationConfig.layer = n;
68172                  this._animationConfig.fadeInTime = e;
68173                  this._animationConfig.animation = t;
68174                  this._animationConfig.group = null !== r ? r : "";
68175                  var h = this._animations[t];
68176                  h && i > 0 && (this._animationConfig.timeScale = h.duration / i);
68177                  return this.playConfig(this._animationConfig);
68178                };
68179                i.prototype.gotoAndStop = function(t, e) {
68180                  void 0 === e && (e = 0);
68181                  console.warn("Deprecated.");
68182                  return this.gotoAndStopByTime(t, e);
68183                };
68184                Object.defineProperty(i.prototype, "animationList", {
68185                  get: function() {
68186                    console.warn("Deprecated.");
68187                    return this._animationNames;
68188                  },
68189                  enumerable: !0,
68190                  configurable: !0
68191                });
68192                Object.defineProperty(i.prototype, "animationDataList", {
68193                  get: function() {
68194                    console.warn("Deprecated.");
68195                    var t = [];
68196                    for (var e = 0, i = this._animationNames.length; e < i; ++e) t.push(this._animations[this._animationNames[e]]);
68197                    return t;
68198                  },
68199                  enumerable: !0,
68200                  configurable: !0
68201                });
68202                return i;
68203              }(t.BaseObject);
68204              t.Animation = e;
68205            }(a5 || (a5 = {}));
68206            !function(t) {
68207              var e = function(e) {
68208                r5(n, e);
68209                function n() {
68210                  var t = null !== e && e.apply(this, arguments) || this;
68211                  t._blendState = new s;
68212                  t._boneMask = [];
68213                  t._boneTimelines = [];
68214                  t._surfaceTimelines = [];
68215                  t._slotTimelines = [];
68216                  t._constraintTimelines = [];
68217                  t._animationTimelines = [];
68218                  t._poseTimelines = [];
68219                  t._bonePoses = {};
68220                  t._actionTimeline = null;
68221                  t._zOrderTimeline = null;
68222                  t._parent = null;
68223                  return t;
68224                }
68225                n.toString = function() {
68226                  return "[class dragonBones.AnimationState]";
68227                };
68228                n.prototype._onClear = function() {
68229                  for (var t = 0, e = this._boneTimelines; t < e.length; t++) {
68230                    e[t].returnToPool();
68231                  }
68232                  for (var i = 0, s = this._surfaceTimelines; i < s.length; i++) {
68233                    s[i].returnToPool();
68234                  }
68235                  for (var n = 0, r = this._slotTimelines; n < r.length; n++) {
68236                    r[n].returnToPool();
68237                  }
68238                  for (var o = 0, a = this._constraintTimelines; o < a.length; o++) {
68239                    a[o].returnToPool();
68240                  }
68241                  for (var l = 0, h = this._animationTimelines; l < h.length; l++) {
68242                    h[l].returnToPool();
68243                  }
68244                  for (var c in this._bonePoses) {
68245                    this._bonePoses[c].returnToPool();
68246                    delete this._bonePoses[c];
68247                  }
68248                  null !== this._actionTimeline && this._actionTimeline.returnToPool();
68249                  null !== this._zOrderTimeline && this._zOrderTimeline.returnToPool();
68250                  this.actionEnabled = !1;
68251                  this.additiveBlending = !1;
68252                  this.displayControl = !1;
68253                  this.resetToPose = !1;
68254                  this.playTimes = 1;
68255                  this.layer = 0;
68256                  this.timeScale = 1;
68257                  this.weight = 1;
68258                  this.autoFadeOutTime = 0;
68259                  this.fadeTotalTime = 0;
68260                  this.name = "";
68261                  this.group = "";
68262                  this._timelineDirty = 2;
68263                  this._playheadState = 0;
68264                  this._fadeState = -1;
68265                  this._subFadeState = -1;
68266                  this._position = 0;
68267                  this._duration = 0;
68268                  this._fadeTime = 0;
68269                  this._time = 0;
68270                  this._fadeProgress = 0;
68271                  this._weightResult = 0;
68272                  this._blendState.clear();
68273                  this._boneMask.length = 0;
68274                  this._boneTimelines.length = 0;
68275                  this._surfaceTimelines.length = 0;
68276                  this._slotTimelines.length = 0;
68277                  this._constraintTimelines.length = 0;
68278                  this._animationTimelines.length = 0;
68279                  this._poseTimelines.length = 0;
68280                  this._animationData = null;
68281                  this._armature = null;
68282                  this._actionTimeline = null;
68283                  this._zOrderTimeline = null;
68284                  this._parent = null;
68285                };
68286                n.prototype._updateTimelines = function() {
68287                  for (var e = 0, i = this._armature._constraints; e < i.length; e++) {
68288                    var s = i[e];
68289                    if (null !== (h = this._animationData.getConstraintTimelines(s.name))) for (var n = 0, r = h; n < r.length; n++) {
68290                      if (30 === (_ = r[n]).type) {
68291                        (d = t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint = s;
68292                        d.init(this._armature, this, _);
68293                        this._constraintTimelines.push(d);
68294                      }
68295                    } else if (this.resetToPose) {
68296                      (d = t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint = s;
68297                      d.init(this._armature, this, null);
68298                      this._constraintTimelines.push(d);
68299                      this._poseTimelines.push(d);
68300                    }
68301                  }
68302                  for (var o = 0, a = this._armature.animation.getStates(); o < a.length; o++) {
68303                    var l = a[o];
68304                    if (l._parent === this) {
68305                      var h;
68306                      if (null !== (h = this._animationData.getAnimationTimelines(l.name))) for (var c = 0, u = h; c < u.length; c++) {
68307                        var _;
68308                        if (40 === (_ = u[c]).type) {
68309                          var d;
68310                          (d = t.BaseObject.borrowObject(t.AnimationTimelineState)).animationState = l;
68311                          d.init(this._armature, this, _);
68312                          this._animationTimelines.push(d);
68313                        }
68314                      }
68315                    }
68316                  }
68317                };
68318                n.prototype._updateBoneAndSlotTimelines = function() {
68319                  var e = {};
68320                  for (var s = 0, n = this._boneTimelines; s < n.length; s++) {
68321                    (l = (y = n[s]).bone.name) in e || (e[l] = []);
68322                    e[l].push(y);
68323                  }
68324                  for (var r = 0, o = this._armature.getBones(); r < o.length; r++) {
68325                    var a = o[r];
68326                    var l = a.name;
68327                    if (this.containsBoneMask(l)) if (l in e) delete e[l]; else if (0 === a._boneData.type) {
68328                      var h = this._animationData.getBoneTimelines(l);
68329                      var c = l in this._bonePoses ? this._bonePoses[l] : this._bonePoses[l] = t.BaseObject.borrowObject(i);
68330                      if (null !== h) for (var u = 0, _ = h; u < _.length; u++) {
68331                        switch ((B = _[u]).type) {
68332                         case 10:
68333                          (y = t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone = a;
68334                          y.bonePose = c;
68335                          y.init(this._armature, this, B);
68336                          this._boneTimelines.push(y);
68337                          break;
68338
68339                         case 11:
68340                          (y = t.BaseObject.borrowObject(t.BoneTranslateTimelineState)).bone = a;
68341                          y.bonePose = c;
68342                          y.init(this._armature, this, B);
68343                          this._boneTimelines.push(y);
68344                          break;
68345
68346                         case 12:
68347                          (y = t.BaseObject.borrowObject(t.BoneRotateTimelineState)).bone = a;
68348                          y.bonePose = c;
68349                          y.init(this._armature, this, B);
68350                          this._boneTimelines.push(y);
68351                          break;
68352
68353                         case 13:
68354                          (y = t.BaseObject.borrowObject(t.BoneScaleTimelineState)).bone = a;
68355                          y.bonePose = c;
68356                          y.init(this._armature, this, B);
68357                          this._boneTimelines.push(y);
68358                        }
68359                      } else if (this.resetToPose) {
68360                        (y = t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone = a;
68361                        y.bonePose = c;
68362                        y.init(this._armature, this, null);
68363                        this._boneTimelines.push(y);
68364                        this._poseTimelines.push(y);
68365                      }
68366                    } else if (1 === a._boneData.type) {
68367                      if (null !== (h = this._animationData.getSurfaceTimelines(l))) for (var d = 0, p = h; d < p.length; d++) {
68368                        if (50 === (B = p[d]).type) {
68369                          (y = t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface = a;
68370                          y.init(this._armature, this, B);
68371                          this._surfaceTimelines.push(y);
68372                        }
68373                      } else if (this.resetToPose) {
68374                        (y = t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface = a;
68375                        y.init(this._armature, this, null);
68376                        this._surfaceTimelines.push(y);
68377                        this._poseTimelines.push(y);
68378                      }
68379                    }
68380                  }
68381                  for (var m in e) for (var f = 0, g = e[m]; f < g.length; f++) {
68382                    var y = g[f];
68383                    this._boneTimelines.splice(this._boneTimelines.indexOf(y), 1);
68384                    y.returnToPool();
68385                  }
68386                  var b = {};
68387                  var S = [];
68388                  for (var A = 0, T = this._slotTimelines; A < T.length; A++) {
68389                    (l = (y = T[A]).slot.name) in b || (b[l] = []);
68390                    b[l].push(y);
68391                  }
68392                  for (var v = 0, E = this._armature.getSlots(); v < E.length; v++) {
68393                    var C = E[v];
68394                    var x = C.parent.name;
68395                    if (this.containsBoneMask(x)) {
68396                      l = C.name;
68397                      h = this._animationData.getSlotTimelines(l);
68398                      if (l in b) delete b[l]; else {
68399                        var w = !1;
68400                        var R = !1;
68401                        S.length = 0;
68402                        if (null !== h) for (var I = 0, M = h; I < M.length; I++) {
68403                          var B;
68404                          switch ((B = M[I]).type) {
68405                           case 20:
68406                            (y = t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot = C;
68407                            y.init(this._armature, this, B);
68408                            this._slotTimelines.push(y);
68409                            w = !0;
68410                            break;
68411
68412                           case 21:
68413                            (y = t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot = C;
68414                            y.init(this._armature, this, B);
68415                            this._slotTimelines.push(y);
68416                            R = !0;
68417                            break;
68418
68419                           case 22:
68420                            (y = t.BaseObject.borrowObject(t.DeformTimelineState)).slot = C;
68421                            y.init(this._armature, this, B);
68422                            this._slotTimelines.push(y);
68423                            S.push(y.vertexOffset);
68424                          }
68425                        }
68426                        if (this.resetToPose) {
68427                          if (!w) {
68428                            (y = t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot = C;
68429                            y.init(this._armature, this, null);
68430                            this._slotTimelines.push(y);
68431                            this._poseTimelines.push(y);
68432                          }
68433                          if (!R) {
68434                            (y = t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot = C;
68435                            y.init(this._armature, this, null);
68436                            this._slotTimelines.push(y);
68437                            this._poseTimelines.push(y);
68438                          }
68439                          if (null !== C.rawDisplayDatas) for (var D = 0, P = C.rawDisplayDatas; D < P.length; D++) {
68440                            var O = P[D];
68441                            if (null !== O && 2 === O.type) {
68442                              var N = O.vertices.offset;
68443                              if (S.indexOf(N) < 0) {
68444                                (y = t.BaseObject.borrowObject(t.DeformTimelineState)).vertexOffset = N;
68445                                y.slot = C;
68446                                y.init(this._armature, this, null);
68447                                this._slotTimelines.push(y);
68448                                this._poseTimelines.push(y);
68449                              }
68450                            }
68451                          }
68452                        }
68453                      }
68454                    }
68455                  }
68456                  for (var m in b) for (var L = 0, F = b[m]; L < F.length; L++) {
68457                    y = F[L];
68458                    this._slotTimelines.splice(this._slotTimelines.indexOf(y), 1);
68459                    y.returnToPool();
68460                  }
68461                };
68462                n.prototype._advanceFadeTime = function(e) {
68463                  var i = this._fadeState > 0;
68464                  if (this._subFadeState < 0) {
68465                    this._subFadeState = 0;
68466                    var s = i ? t.EventObject.FADE_OUT : t.EventObject.FADE_IN;
68467                    if (this._armature.eventDispatcher.hasDBEventListener(s)) {
68468                      (n = t.BaseObject.borrowObject(t.EventObject)).type = s;
68469                      n.armature = this._armature;
68470                      n.animationState = this;
68471                      this._armature._dragonBones.bufferEvent(n);
68472                    }
68473                  }
68474                  e < 0 && (e = -e);
68475                  this._fadeTime += e;
68476                  if (this._fadeTime >= this.fadeTotalTime) {
68477                    this._subFadeState = 1;
68478                    this._fadeProgress = i ? 0 : 1;
68479                  } else this._fadeTime > 0 ? this._fadeProgress = i ? 1 - this._fadeTime / this.fadeTotalTime : this._fadeTime / this.fadeTotalTime : this._fadeProgress = i ? 1 : 0;
68480                  if (this._subFadeState > 0) {
68481                    if (!i) {
68482                      this._playheadState |= 1;
68483                      this._fadeState = 0;
68484                    }
68485                    s = i ? t.EventObject.FADE_OUT_COMPLETE : t.EventObject.FADE_IN_COMPLETE;
68486                    if (this._armature.eventDispatcher.hasDBEventListener(s)) {
68487                      var n;
68488                      (n = t.BaseObject.borrowObject(t.EventObject)).type = s;
68489                      n.armature = this._armature;
68490                      n.animationState = this;
68491                      this._armature._dragonBones.bufferEvent(n);
68492                    }
68493                  }
68494                };
68495                n.prototype.init = function(e, i, s) {
68496                  if (null === this._armature) {
68497                    this._armature = e;
68498                    this._animationData = i;
68499                    this.resetToPose = s.resetToPose;
68500                    this.additiveBlending = s.additiveBlending;
68501                    this.displayControl = s.displayControl;
68502                    this.actionEnabled = s.actionEnabled;
68503                    this.layer = s.layer;
68504                    this.playTimes = s.playTimes;
68505                    this.timeScale = s.timeScale;
68506                    this.fadeTotalTime = s.fadeInTime;
68507                    this.autoFadeOutTime = s.autoFadeOutTime;
68508                    this.weight = s.weight;
68509                    this.name = s.name.length > 0 ? s.name : s.animation;
68510                    this.group = s.group;
68511                    s.pauseFadeIn ? this._playheadState = 2 : this._playheadState = 3;
68512                    if (s.duration < 0) {
68513                      this._position = 0;
68514                      this._duration = this._animationData.duration;
68515                      0 !== s.position ? this.timeScale >= 0 ? this._time = s.position : this._time = s.position - this._duration : this._time = 0;
68516                    } else {
68517                      this._position = s.position;
68518                      this._duration = s.duration;
68519                      this._time = 0;
68520                    }
68521                    this.timeScale < 0 && 0 === this._time && (this._time = -1e-6);
68522                    this.fadeTotalTime <= 0 && (this._fadeProgress = .999999);
68523                    if (s.boneMask.length > 0) {
68524                      this._boneMask.length = s.boneMask.length;
68525                      for (var n = 0, r = this._boneMask.length; n < r; ++n) this._boneMask[n] = s.boneMask[n];
68526                    }
68527                    this._actionTimeline = t.BaseObject.borrowObject(t.ActionTimelineState);
68528                    this._actionTimeline.init(this._armature, this, this._animationData.actionTimeline);
68529                    this._actionTimeline.currentTime = this._time;
68530                    this._actionTimeline.currentTime < 0 && (this._actionTimeline.currentTime = this._duration - this._actionTimeline.currentTime);
68531                    if (null !== this._animationData.zOrderTimeline) {
68532                      this._zOrderTimeline = t.BaseObject.borrowObject(t.ZOrderTimelineState);
68533                      this._zOrderTimeline.init(this._armature, this, this._animationData.zOrderTimeline);
68534                    }
68535                  }
68536                };
68537                n.prototype.advanceTime = function(e, i) {
68538                  this._blendState.dirty = !1;
68539                  0 === this._fadeState && 0 === this._subFadeState || this._advanceFadeTime(e);
68540                  if (3 === this._playheadState) {
68541                    1 !== this.timeScale && (e *= this.timeScale);
68542                    this._time += e;
68543                  }
68544                  if (0 !== this._timelineDirty) {
68545                    2 === this._timelineDirty && this._updateTimelines();
68546                    this._timelineDirty = 0;
68547                    this._updateBoneAndSlotTimelines();
68548                  }
68549                  if (0 !== this.weight) {
68550                    var s = 0 === this._fadeState && i > 0;
68551                    var n = !0;
68552                    var r = !0;
68553                    var o = this._time;
68554                    this._weightResult = this.weight * this._fadeProgress;
68555                    null !== this._parent && (this._weightResult *= this._parent._weightResult / this._parent._fadeProgress);
68556                    this._actionTimeline.playState <= 0 && this._actionTimeline.update(o);
68557                    if (s) {
68558                      var a = 2 * i;
68559                      this._actionTimeline.currentTime = Math.floor(this._actionTimeline.currentTime * a) / a;
68560                    }
68561                    null !== this._zOrderTimeline && this._zOrderTimeline.playState <= 0 && this._zOrderTimeline.update(o);
68562                    if (s) {
68563                      var l = Math.floor(this._actionTimeline.currentTime * i);
68564                      if (this._armature._cacheFrameIndex === l) {
68565                        n = !1;
68566                        r = !1;
68567                      } else {
68568                        this._armature._cacheFrameIndex = l;
68569                        this._animationData.cachedFrames[l] ? r = !1 : this._animationData.cachedFrames[l] = !0;
68570                      }
68571                    }
68572                    if (n) {
68573                      if (r) for (var h = 0, c = this._boneTimelines.length; h < c; ++h) {
68574                        (m = this._boneTimelines[h]).playState <= 0 && m.update(o);
68575                        if (h === c - 1 || m.bone !== this._boneTimelines[h + 1].bone) {
68576                          0 !== (u = m.bone._blendState.update(this._weightResult, this.layer)) && m.blend(u);
68577                        }
68578                      }
68579                      for (h = 0, c = this._surfaceTimelines.length; h < c; ++h) {
68580                        var u = (m = this._surfaceTimelines[h]).surface._blendState.update(this._weightResult, this.layer);
68581                        m.playState <= 0 && m.update(o);
68582                        0 !== u && m.blend(u);
68583                      }
68584                      if (this.displayControl) for (h = 0, c = this._slotTimelines.length; h < c; ++h) {
68585                        var _ = (m = this._slotTimelines[h]).slot.displayController;
68586                        null !== _ && _ !== this.name && _ !== this.group || m.playState <= 0 && m.update(o);
68587                      }
68588                      for (h = 0, c = this._constraintTimelines.length; h < c; ++h) {
68589                        (m = this._constraintTimelines[h]).playState <= 0 && m.update(o);
68590                      }
68591                      for (h = 0, c = this._animationTimelines.length; h < c; ++h) {
68592                        u = (m = this._animationTimelines[h]).animationState._blendState.update(this._weightResult, this.layer);
68593                        m.playState <= 0 && m.update(o);
68594                        0 !== u && m.blend(u);
68595                      }
68596                    }
68597                    if (0 === this._fadeState) {
68598                      if (this._subFadeState > 0) {
68599                        this._subFadeState = 0;
68600                        if (this._poseTimelines.length > 0) {
68601                          for (var d = 0, p = this._poseTimelines; d < p.length; d++) {
68602                            var m;
68603                            (m = p[d]) instanceof t.BoneTimelineState ? this._boneTimelines.splice(this._boneTimelines.indexOf(m), 1) : m instanceof t.SurfaceTimelineState ? this._surfaceTimelines.splice(this._surfaceTimelines.indexOf(m), 1) : m instanceof t.SlotTimelineState ? this._slotTimelines.splice(this._slotTimelines.indexOf(m), 1) : m instanceof t.ConstraintTimelineState && this._constraintTimelines.splice(this._constraintTimelines.indexOf(m), 1);
68604                            m.returnToPool();
68605                          }
68606                          this._poseTimelines.length = 0;
68607                        }
68608                      }
68609                      this._actionTimeline.playState > 0 && this.autoFadeOutTime >= 0 && this.fadeOut(this.autoFadeOutTime);
68610                    }
68611                  }
68612                };
68613                n.prototype.play = function() {
68614                  this._playheadState = 3;
68615                };
68616                n.prototype.stop = function() {
68617                  this._playheadState &= 1;
68618                };
68619                n.prototype.fadeOut = function(t, e) {
68620                  void 0 === e && (e = !0);
68621                  t < 0 && (t = 0);
68622                  e && (this._playheadState &= 2);
68623                  if (this._fadeState > 0) {
68624                    if (t > this.fadeTotalTime - this._fadeTime) return;
68625                  } else {
68626                    this._fadeState = 1;
68627                    this._subFadeState = -1;
68628                    (t <= 0 || this._fadeProgress <= 0) && (this._fadeProgress = 1e-6);
68629                    for (var i = 0, s = this._boneTimelines; i < s.length; i++) {
68630                      (_ = s[i]).fadeOut();
68631                    }
68632                    for (var n = 0, r = this._surfaceTimelines; n < r.length; n++) {
68633                      (_ = r[n]).fadeOut();
68634                    }
68635                    for (var o = 0, a = this._slotTimelines; o < a.length; o++) {
68636                      (_ = a[o]).fadeOut();
68637                    }
68638                    for (var l = 0, h = this._constraintTimelines; l < h.length; l++) {
68639                      (_ = h[l]).fadeOut();
68640                    }
68641                    for (var c = 0, u = this._animationTimelines; c < u.length; c++) {
68642                      var _;
68643                      (_ = u[c]).animationState.fadeOut(t, e);
68644                      _.fadeOut();
68645                    }
68646                  }
68647                  this.displayControl = !1;
68648                  this.fadeTotalTime = this._fadeProgress > 1e-6 ? t / this._fadeProgress : 0;
68649                  this._fadeTime = this.fadeTotalTime * (1 - this._fadeProgress);
68650                };
68651                n.prototype.containsBoneMask = function(t) {
68652                  return 0 === this._boneMask.length || this._boneMask.indexOf(t) >= 0;
68653                };
68654                n.prototype.addBoneMask = function(t, e) {
68655                  void 0 === e && (e = !0);
68656                  var i = this._armature.getBone(t);
68657                  if (null !== i) {
68658                    this._boneMask.indexOf(t) < 0 && this._boneMask.push(t);
68659                    if (e) for (var s = 0, n = this._armature.getBones(); s < n.length; s++) {
68660                      var r = n[s];
68661                      this._boneMask.indexOf(r.name) < 0 && i.contains(r) && this._boneMask.push(r.name);
68662                    }
68663                    this._timelineDirty = 1;
68664                  }
68665                };
68666                n.prototype.removeBoneMask = function(t, e) {
68667                  void 0 === e && (e = !0);
68668                  var i = this._boneMask.indexOf(t);
68669                  i >= 0 && this._boneMask.splice(i, 1);
68670                  if (e) {
68671                    var s = this._armature.getBone(t);
68672                    if (null !== s) {
68673                      var n = this._armature.getBones();
68674                      if (this._boneMask.length > 0) for (var r = 0, o = n; r < o.length; r++) {
68675                        var a = o[r];
68676                        var l = this._boneMask.indexOf(a.name);
68677                        l >= 0 && s.contains(a) && this._boneMask.splice(l, 1);
68678                      } else for (var h = 0, c = n; h < c.length; h++) {
68679                        (a = c[h]) !== s && (s.contains(a) || this._boneMask.push(a.name));
68680                      }
68681                    }
68682                  }
68683                  this._timelineDirty = 1;
68684                };
68685                n.prototype.removeAllBoneMask = function() {
68686                  this._boneMask.length = 0;
68687                  this._timelineDirty = 1;
68688                };
68689                Object.defineProperty(n.prototype, "isFadeIn", {
68690                  get: function() {
68691                    return this._fadeState < 0;
68692                  },
68693                  enumerable: !0,
68694                  configurable: !0
68695                });
68696                Object.defineProperty(n.prototype, "isFadeOut", {
68697                  get: function() {
68698                    return this._fadeState > 0;
68699                  },
68700                  enumerable: !0,
68701                  configurable: !0
68702                });
68703                Object.defineProperty(n.prototype, "isFadeComplete", {
68704                  get: function() {
68705                    return 0 === this._fadeState;
68706                  },
68707                  enumerable: !0,
68708                  configurable: !0
68709                });
68710                Object.defineProperty(n.prototype, "isPlaying", {
68711                  get: function() {
68712                    return 0 != (2 & this._playheadState) && this._actionTimeline.playState <= 0;
68713                  },
68714                  enumerable: !0,
68715                  configurable: !0
68716                });
68717                Object.defineProperty(n.prototype, "isCompleted", {
68718                  get: function() {
68719                    return this._actionTimeline.playState > 0;
68720                  },
68721                  enumerable: !0,
68722                  configurable: !0
68723                });
68724                Object.defineProperty(n.prototype, "currentPlayTimes", {
68725                  get: function() {
68726                    return this._actionTimeline.currentPlayTimes;
68727                  },
68728                  enumerable: !0,
68729                  configurable: !0
68730                });
68731                Object.defineProperty(n.prototype, "totalTime", {
68732                  get: function() {
68733                    return this._duration;
68734                  },
68735                  enumerable: !0,
68736                  configurable: !0
68737                });
68738                Object.defineProperty(n.prototype, "currentTime", {
68739                  get: function() {
68740                    return this._actionTimeline.currentTime;
68741                  },
68742                  set: function(t) {
68743                    var e = this._actionTimeline.currentPlayTimes - (this._actionTimeline.playState > 0 ? 1 : 0);
68744                    (t < 0 || this._duration < t) && (t = t % this._duration + e * this._duration) < 0 && (t += this._duration);
68745                    this.playTimes > 0 && e === this.playTimes - 1 && t === this._duration && (t = this._duration - 1e-6);
68746                    if (this._time !== t) {
68747                      this._time = t;
68748                      this._actionTimeline.setCurrentTime(this._time);
68749                      null !== this._zOrderTimeline && (this._zOrderTimeline.playState = -1);
68750                      for (var i = 0, s = this._boneTimelines; i < s.length; i++) {
68751                        s[i].playState = -1;
68752                      }
68753                      for (var n = 0, r = this._slotTimelines; n < r.length; n++) {
68754                        r[n].playState = -1;
68755                      }
68756                    }
68757                  },
68758                  enumerable: !0,
68759                  configurable: !0
68760                });
68761                Object.defineProperty(n.prototype, "animationData", {
68762                  get: function() {
68763                    return this._animationData;
68764                  },
68765                  enumerable: !0,
68766                  configurable: !0
68767                });
68768                return n;
68769              }(t.BaseObject);
68770              t.AnimationState = e;
68771              var i = function(e) {
68772                r5(i, e);
68773                function i() {
68774                  var i = null !== e && e.apply(this, arguments) || this;
68775                  i.current = new t.Transform;
68776                  i.delta = new t.Transform;
68777                  i.result = new t.Transform;
68778                  return i;
68779                }
68780                i.toString = function() {
68781                  return "[class dragonBones.BonePose]";
68782                };
68783                i.prototype._onClear = function() {
68784                  this.current.identity();
68785                  this.delta.identity();
68786                  this.result.identity();
68787                };
68788                return i;
68789              }(t.BaseObject);
68790              t.BonePose = i;
68791              var s = function() {
68792                function t() {}
68793                t.prototype.update = function(t, e) {
68794                  if (this.dirty) {
68795                    if (!(this.leftWeight > 0)) return 0;
68796                    if (this.layer !== e) {
68797                      if (this.layerWeight >= this.leftWeight) {
68798                        this.leftWeight = 0;
68799                        return 0;
68800                      }
68801                      this.layer = e;
68802                      this.leftWeight -= this.layerWeight;
68803                      this.layerWeight = 0;
68804                    }
68805                    t *= this.leftWeight;
68806                    this.layerWeight += t;
68807                    this.blendWeight = t;
68808                    return 2;
68809                  }
68810                  this.dirty = !0;
68811                  this.layer = e;
68812                  this.layerWeight = t;
68813                  this.leftWeight = 1;
68814                  this.blendWeight = t;
68815                  return 1;
68816                };
68817                t.prototype.clear = function() {
68818                  this.dirty = !1;
68819                  this.layer = 0;
68820                  this.leftWeight = 0;
68821                  this.layerWeight = 0;
68822                  this.blendWeight = 0;
68823                };
68824                return t;
68825              }();
68826              t.BlendState = s;
68827            }(a5 || (a5 = {}));
68828            !function(t) {
68829              var e = function(t) {
68830                r5(e, t);
68831                function e() {
68832                  return null !== t && t.apply(this, arguments) || this;
68833                }
68834                e.prototype._onClear = function() {
68835                  this.playState = -1;
68836                  this.currentPlayTimes = -1;
68837                  this.currentTime = -1;
68838                  this._tweenState = 0;
68839                  this._frameRate = 0;
68840                  this._frameValueOffset = 0;
68841                  this._frameCount = 0;
68842                  this._frameOffset = 0;
68843                  this._frameIndex = -1;
68844                  this._frameRateR = 0;
68845                  this._position = 0;
68846                  this._duration = 0;
68847                  this._timeScale = 1;
68848                  this._timeOffset = 0;
68849                  this._dragonBonesData = null;
68850                  this._animationData = null;
68851                  this._timelineData = null;
68852                  this._armature = null;
68853                  this._animationState = null;
68854                  this._actionTimeline = null;
68855                  this._frameArray = null;
68856                  this._frameIntArray = null;
68857                  this._frameFloatArray = null;
68858                  this._timelineArray = null;
68859                  this._frameIndices = null;
68860                };
68861                e.prototype._setCurrentTime = function(t) {
68862                  var e = this.playState;
68863                  var i = this.currentPlayTimes;
68864                  var s = this.currentTime;
68865                  if (null !== this._actionTimeline && this._frameCount <= 1) {
68866                    this.playState = this._actionTimeline.playState >= 0 ? 1 : -1;
68867                    this.currentPlayTimes = 1;
68868                    this.currentTime = this._actionTimeline.currentTime;
68869                  } else if (null === this._actionTimeline || 1 !== this._timeScale || 0 !== this._timeOffset) {
68870                    var n = this._animationState.playTimes;
68871                    var r = n * this._duration;
68872                    t *= this._timeScale;
68873                    0 !== this._timeOffset && (t += this._timeOffset * this._animationData.duration);
68874                    if (n > 0 && (t >= r || t <= -r)) {
68875                      this.playState <= 0 && 3 === this._animationState._playheadState && (this.playState = 1);
68876                      this.currentPlayTimes = n;
68877                      this.currentTime = t < 0 ? 0 : this._duration + 1e-6;
68878                    } else {
68879                      0 !== this.playState && 3 === this._animationState._playheadState && (this.playState = 0);
68880                      if (t < 0) {
68881                        t = -t;
68882                        this.currentPlayTimes = Math.floor(t / this._duration);
68883                        this.currentTime = this._duration - t % this._duration;
68884                      } else {
68885                        this.currentPlayTimes = Math.floor(t / this._duration);
68886                        this.currentTime = t % this._duration;
68887                      }
68888                    }
68889                    this.currentTime += this._position;
68890                  } else {
68891                    this.playState = this._actionTimeline.playState;
68892                    this.currentPlayTimes = this._actionTimeline.currentPlayTimes;
68893                    this.currentTime = this._actionTimeline.currentTime;
68894                  }
68895                  if (this.currentPlayTimes === i && this.currentTime === s) return !1;
68896                  (e < 0 && this.playState !== e || this.playState <= 0 && this.currentPlayTimes !== i) && (this._frameIndex = -1);
68897                  return !0;
68898                };
68899                e.prototype.init = function(t, e, i) {
68900                  this._armature = t;
68901                  this._animationState = e;
68902                  this._timelineData = i;
68903                  this._actionTimeline = this._animationState._actionTimeline;
68904                  this === this._actionTimeline && (this._actionTimeline = null);
68905                  this._animationData = this._animationState._animationData;
68906                  this._frameRate = this._animationData.parent.frameRate;
68907                  this._frameRateR = 1 / this._frameRate;
68908                  this._position = this._animationState._position;
68909                  this._duration = this._animationState._duration;
68910                  this._dragonBonesData = this._animationData.parent.parent;
68911                  if (null !== this._timelineData) {
68912                    this._frameIntArray = this._dragonBonesData.frameIntArray;
68913                    this._frameFloatArray = this._dragonBonesData.frameFloatArray;
68914                    this._frameArray = this._dragonBonesData.frameArray;
68915                    this._timelineArray = this._dragonBonesData.timelineArray;
68916                    this._frameIndices = this._dragonBonesData.frameIndices;
68917                    this._frameCount = this._timelineArray[this._timelineData.offset + 2];
68918                    this._frameValueOffset = this._timelineArray[this._timelineData.offset + 4];
68919                    this._timeScale = 100 / this._timelineArray[this._timelineData.offset + 0];
68920                    this._timeOffset = .01 * this._timelineArray[this._timelineData.offset + 1];
68921                  }
68922                };
68923                e.prototype.fadeOut = function() {};
68924                e.prototype.update = function(t) {
68925                  if (this._setCurrentTime(t)) {
68926                    if (this._frameCount > 1) {
68927                      var e = Math.floor(this.currentTime * this._frameRate);
68928                      var i = this._frameIndices[this._timelineData.frameIndicesOffset + e];
68929                      if (this._frameIndex !== i) {
68930                        this._frameIndex = i;
68931                        this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + this._frameIndex];
68932                        this._onArriveAtFrame();
68933                      }
68934                    } else if (this._frameIndex < 0) {
68935                      this._frameIndex = 0;
68936                      null !== this._timelineData && (this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5]);
68937                      this._onArriveAtFrame();
68938                    }
68939                    0 !== this._tweenState && this._onUpdateFrame();
68940                  }
68941                };
68942                return e;
68943              }(t.BaseObject);
68944              t.TimelineState = e;
68945              var i = function(t) {
68946                r5(e, t);
68947                function e() {
68948                  return null !== t && t.apply(this, arguments) || this;
68949                }
68950                e._getEasingValue = function(t, e, i) {
68951                  var s = e;
68952                  switch (t) {
68953                   case 3:
68954                    s = Math.pow(e, 2);
68955                    break;
68956
68957                   case 4:
68958                    s = 1 - Math.pow(1 - e, 2);
68959                    break;
68960
68961                   case 5:
68962                    s = .5 * (1 - Math.cos(e * Math.PI));
68963                  }
68964                  return (s - e) * i + e;
68965                };
68966                e._getEasingCurveValue = function(t, e, i, s) {
68967                  if (t <= 0) return 0;
68968                  if (t >= 1) return 1;
68969                  var n = i + 1;
68970                  var r = Math.floor(t * n);
68971                  var o = 0 === r ? 0 : e[s + r - 1];
68972                  return 1e-4 * (o + ((r === n - 1 ? 1e4 : e[s + r]) - o) * (t * n - r));
68973                };
68974                e.prototype._onClear = function() {
68975                  t.prototype._onClear.call(this);
68976                  this._tweenType = 0;
68977                  this._curveCount = 0;
68978                  this._framePosition = 0;
68979                  this._frameDurationR = 0;
68980                  this._tweenProgress = 0;
68981                  this._tweenEasing = 0;
68982                };
68983                e.prototype._onArriveAtFrame = function() {
68984                  if (this._frameCount > 1 && (this._frameIndex !== this._frameCount - 1 || 0 === this._animationState.playTimes || this._animationState.currentPlayTimes < this._animationState.playTimes - 1)) {
68985                    this._tweenType = this._frameArray[this._frameOffset + 1];
68986                    this._tweenState = 0 === this._tweenType ? 1 : 2;
68987                    2 === this._tweenType ? this._curveCount = this._frameArray[this._frameOffset + 2] : 0 !== this._tweenType && 1 !== this._tweenType && (this._tweenEasing = .01 * this._frameArray[this._frameOffset + 2]);
68988                    this._framePosition = this._frameArray[this._frameOffset] * this._frameRateR;
68989                    if (this._frameIndex === this._frameCount - 1) this._frameDurationR = 1 / (this._animationData.duration - this._framePosition); else {
68990                      var t = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + this._frameIndex + 1];
68991                      var e = this._frameArray[t] * this._frameRateR - this._framePosition;
68992                      this._frameDurationR = e > 0 ? 1 / e : 0;
68993                    }
68994                  } else this._tweenState = 1;
68995                };
68996                e.prototype._onUpdateFrame = function() {
68997                  if (2 === this._tweenState) {
68998                    this._tweenProgress = (this.currentTime - this._framePosition) * this._frameDurationR;
68999                    2 === this._tweenType ? this._tweenProgress = e._getEasingCurveValue(this._tweenProgress, this._frameArray, this._curveCount, this._frameOffset + 3) : 1 !== this._tweenType && (this._tweenProgress = e._getEasingValue(this._tweenType, this._tweenProgress, this._tweenEasing));
69000                  } else this._tweenProgress = 0;
69001                };
69002                return e;
69003              }(e);
69004              t.TweenTimelineState = i;
69005              var s = function(t) {
69006                r5(e, t);
69007                function e() {
69008                  return null !== t && t.apply(this, arguments) || this;
69009                }
69010                e.prototype._onClear = function() {
69011                  t.prototype._onClear.call(this);
69012                  this.bone = null;
69013                  this.bonePose = null;
69014                };
69015                e.prototype.blend = function(t) {
69016                  var e = this.bone._blendState.blendWeight;
69017                  var i = this.bone.animationPose;
69018                  var s = this.bonePose.result;
69019                  if (2 === t) {
69020                    i.x += s.x * e;
69021                    i.y += s.y * e;
69022                    i.rotation += s.rotation * e;
69023                    i.skew += s.skew * e;
69024                    i.scaleX += (s.scaleX - 1) * e;
69025                    i.scaleY += (s.scaleY - 1) * e;
69026                  } else if (1 !== e) {
69027                    i.x = s.x * e;
69028                    i.y = s.y * e;
69029                    i.rotation = s.rotation * e;
69030                    i.skew = s.skew * e;
69031                    i.scaleX = (s.scaleX - 1) * e + 1;
69032                    i.scaleY = (s.scaleY - 1) * e + 1;
69033                  } else {
69034                    i.x = s.x;
69035                    i.y = s.y;
69036                    i.rotation = s.rotation;
69037                    i.skew = s.skew;
69038                    i.scaleX = s.scaleX;
69039                    i.scaleY = s.scaleY;
69040                  }
69041                  0 === this._animationState._fadeState && 0 === this._animationState._subFadeState || (this.bone._transformDirty = !0);
69042                };
69043                return e;
69044              }(i);
69045              t.BoneTimelineState = s;
69046              var n = function(t) {
69047                r5(e, t);
69048                function e() {
69049                  return null !== t && t.apply(this, arguments) || this;
69050                }
69051                e.prototype._onClear = function() {
69052                  t.prototype._onClear.call(this);
69053                  this.slot = null;
69054                };
69055                return e;
69056              }(i);
69057              t.SlotTimelineState = n;
69058              var r = function(t) {
69059                r5(e, t);
69060                function e() {
69061                  return null !== t && t.apply(this, arguments) || this;
69062                }
69063                e.prototype._onClear = function() {
69064                  t.prototype._onClear.call(this);
69065                  this.constraint = null;
69066                };
69067                return e;
69068              }(i);
69069              t.ConstraintTimelineState = r;
69070            }(a5 || (a5 = {}));
69071            !function(t) {
69072              var e = function(e) {
69073                r5(i, e);
69074                function i() {
69075                  return null !== e && e.apply(this, arguments) || this;
69076                }
69077                i.toString = function() {
69078                  return "[class dragonBones.ActionTimelineState]";
69079                };
69080                i.prototype._onCrossFrame = function(e) {
69081                  var i = this._armature.eventDispatcher;
69082                  if (this._animationState.actionEnabled) {
69083                    var s = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5 + e];
69084                    var n = this._frameArray[s + 1];
69085                    var r = this._animationData.parent.actions;
69086                    for (var o = 0; o < n; ++o) {
69087                      var a = r[this._frameArray[s + 2 + o]];
69088                      if (0 === a.type) {
69089                        (h = t.BaseObject.borrowObject(t.EventObject)).time = this._frameArray[s] / this._frameRate;
69090                        h.animationState = this._animationState;
69091                        t.EventObject.actionDataToInstance(a, h, this._armature);
69092                        this._armature._bufferAction(h, !0);
69093                      } else {
69094                        var l = 10 === a.type ? t.EventObject.FRAME_EVENT : t.EventObject.SOUND_EVENT;
69095                        if (11 === a.type || i.hasDBEventListener(l)) {
69096                          var h;
69097                          (h = t.BaseObject.borrowObject(t.EventObject)).time = this._frameArray[s] / this._frameRate;
69098                          h.animationState = this._animationState;
69099                          t.EventObject.actionDataToInstance(a, h, this._armature);
69100                          this._armature._dragonBones.bufferEvent(h);
69101                        }
69102                      }
69103                    }
69104                  }
69105                };
69106                i.prototype._onArriveAtFrame = function() {};
69107                i.prototype._onUpdateFrame = function() {};
69108                i.prototype.update = function(e) {
69109                  var i = this.playState;
69110                  var s = this.currentPlayTimes;
69111                  var n = this.currentTime;
69112                  if (this._setCurrentTime(e)) {
69113                    var r = this._armature.eventDispatcher;
69114                    if (i < 0) {
69115                      if (this.playState === i) return;
69116                      this._animationState.displayControl && this._animationState.resetToPose && this._armature._sortZOrder(null, 0);
69117                      s = this.currentPlayTimes;
69118                      if (r.hasDBEventListener(t.EventObject.START)) {
69119                        var o = t.BaseObject.borrowObject(t.EventObject);
69120                        o.type = t.EventObject.START;
69121                        o.armature = this._armature;
69122                        o.animationState = this._animationState;
69123                        this._armature._dragonBones.bufferEvent(o);
69124                      }
69125                    }
69126                    var a = this._animationState.timeScale < 0;
69127                    var l = null;
69128                    var h = null;
69129                    if (this.currentPlayTimes !== s) {
69130                      if (r.hasDBEventListener(t.EventObject.LOOP_COMPLETE)) {
69131                        (l = t.BaseObject.borrowObject(t.EventObject)).type = t.EventObject.LOOP_COMPLETE;
69132                        l.armature = this._armature;
69133                        l.animationState = this._animationState;
69134                      }
69135                      if (this.playState > 0 && r.hasDBEventListener(t.EventObject.COMPLETE)) {
69136                        (h = t.BaseObject.borrowObject(t.EventObject)).type = t.EventObject.COMPLETE;
69137                        h.armature = this._armature;
69138                        h.animationState = this._animationState;
69139                      }
69140                    }
69141                    if (this._frameCount > 1) {
69142                      var c = this._timelineData;
69143                      var u = Math.floor(this.currentTime * this._frameRate);
69144                      var _ = this._frameIndices[c.frameIndicesOffset + u];
69145                      if (this._frameIndex !== _) {
69146                        var d = this._frameIndex;
69147                        this._frameIndex = _;
69148                        if (null !== this._timelineArray) {
69149                          this._frameOffset = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + this._frameIndex];
69150                          if (a) {
69151                            if (d < 0) {
69152                              var p = Math.floor(n * this._frameRate);
69153                              d = this._frameIndices[c.frameIndicesOffset + p];
69154                              this.currentPlayTimes === s && d === _ && (d = -1);
69155                            }
69156                            for (;d >= 0; ) {
69157                              var m = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + d];
69158                              var f = this._frameArray[m] / this._frameRate;
69159                              this._position <= f && f <= this._position + this._duration && this._onCrossFrame(d);
69160                              if (null !== l && 0 === d) {
69161                                this._armature._dragonBones.bufferEvent(l);
69162                                l = null;
69163                              }
69164                              d > 0 ? d-- : d = this._frameCount - 1;
69165                              if (d === _) break;
69166                            }
69167                          } else {
69168                            if (d < 0) {
69169                              p = Math.floor(n * this._frameRate);
69170                              d = this._frameIndices[c.frameIndicesOffset + p];
69171                              m = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + d];
69172                              f = this._frameArray[m] / this._frameRate;
69173                              this.currentPlayTimes === s && (n <= f ? d > 0 ? d-- : d = this._frameCount - 1 : d === _ && (d = -1));
69174                            }
69175                            for (;d >= 0; ) {
69176                              d < this._frameCount - 1 ? d++ : d = 0;
69177                              m = this._animationData.frameOffset + this._timelineArray[c.offset + 5 + d];
69178                              f = this._frameArray[m] / this._frameRate;
69179                              this._position <= f && f <= this._position + this._duration && this._onCrossFrame(d);
69180                              if (null !== l && 0 === d) {
69181                                this._armature._dragonBones.bufferEvent(l);
69182                                l = null;
69183                              }
69184                              if (d === _) break;
69185                            }
69186                          }
69187                        }
69188                      }
69189                    } else if (this._frameIndex < 0) {
69190                      this._frameIndex = 0;
69191                      if (null !== this._timelineData) {
69192                        this._frameOffset = this._animationData.frameOffset + this._timelineArray[this._timelineData.offset + 5];
69193                        f = this._frameArray[this._frameOffset] / this._frameRate;
69194                        if (this.currentPlayTimes === s) n <= f && this._onCrossFrame(this._frameIndex); else if (this._position <= f) {
69195                          if (!a && null !== l) {
69196                            this._armature._dragonBones.bufferEvent(l);
69197                            l = null;
69198                          }
69199                          this._onCrossFrame(this._frameIndex);
69200                        }
69201                      }
69202                    }
69203                    null !== l && this._armature._dragonBones.bufferEvent(l);
69204                    null !== h && this._armature._dragonBones.bufferEvent(h);
69205                  }
69206                };
69207                i.prototype.setCurrentTime = function(t) {
69208                  this._setCurrentTime(t);
69209                  this._frameIndex = -1;
69210                };
69211                return i;
69212              }(t.TimelineState);
69213              t.ActionTimelineState = e;
69214              var i = function(t) {
69215                r5(e, t);
69216                function e() {
69217                  return null !== t && t.apply(this, arguments) || this;
69218                }
69219                e.toString = function() {
69220                  return "[class dragonBones.ZOrderTimelineState]";
69221                };
69222                e.prototype._onArriveAtFrame = function() {
69223                  if (this.playState >= 0) {
69224                    this._frameArray[this._frameOffset + 1] > 0 ? this._armature._sortZOrder(this._frameArray, this._frameOffset + 2) : this._armature._sortZOrder(null, 0);
69225                  }
69226                };
69227                e.prototype._onUpdateFrame = function() {};
69228                return e;
69229              }(t.TimelineState);
69230              t.ZOrderTimelineState = i;
69231              var s = function(e) {
69232                r5(i, e);
69233                function i() {
69234                  return null !== e && e.apply(this, arguments) || this;
69235                }
69236                i.toString = function() {
69237                  return "[class dragonBones.BoneAllTimelineState]";
69238                };
69239                i.prototype._onArriveAtFrame = function() {
69240                  e.prototype._onArriveAtFrame.call(this);
69241                  if (null !== this._timelineData) {
69242                    var t = this._animationData.frameFloatOffset + this._frameValueOffset + 6 * this._frameIndex;
69243                    var i = this._armature._armatureData.scale;
69244                    var s = this._frameFloatArray;
69245                    var n = this.bonePose.current;
69246                    var r = this.bonePose.delta;
69247                    n.x = s[t++] * i;
69248                    n.y = s[t++] * i;
69249                    n.rotation = s[t++];
69250                    n.skew = s[t++];
69251                    n.scaleX = s[t++];
69252                    n.scaleY = s[t++];
69253                    if (2 === this._tweenState) {
69254                      this._frameIndex === this._frameCount - 1 && (t = this._animationData.frameFloatOffset + this._frameValueOffset);
69255                      r.x = s[t++] * i - n.x;
69256                      r.y = s[t++] * i - n.y;
69257                      r.rotation = s[t++] - n.rotation;
69258                      r.skew = s[t++] - n.skew;
69259                      r.scaleX = s[t++] - n.scaleX;
69260                      r.scaleY = s[t++] - n.scaleY;
69261                    } else {
69262                      r.x = 0;
69263                      r.y = 0;
69264                      r.rotation = 0;
69265                      r.skew = 0;
69266                      r.scaleX = 0;
69267                      r.scaleY = 0;
69268                    }
69269                  } else {
69270                    n = this.bonePose.current;
69271                    r = this.bonePose.delta;
69272                    n.x = 0;
69273                    n.y = 0;
69274                    n.rotation = 0;
69275                    n.skew = 0;
69276                    n.scaleX = 1;
69277                    n.scaleY = 1;
69278                    r.x = 0;
69279                    r.y = 0;
69280                    r.rotation = 0;
69281                    r.skew = 0;
69282                    r.scaleX = 0;
69283                    r.scaleY = 0;
69284                  }
69285                };
69286                i.prototype._onUpdateFrame = function() {
69287                  e.prototype._onUpdateFrame.call(this);
69288                  var t = this.bonePose.current;
69289                  var i = this.bonePose.delta;
69290                  var s = this.bonePose.result;
69291                  this.bone._transformDirty = !0;
69292                  2 !== this._tweenState && (this._tweenState = 0);
69293                  s.x = t.x + i.x * this._tweenProgress;
69294                  s.y = t.y + i.y * this._tweenProgress;
69295                  s.rotation = t.rotation + i.rotation * this._tweenProgress;
69296                  s.skew = t.skew + i.skew * this._tweenProgress;
69297                  s.scaleX = t.scaleX + i.scaleX * this._tweenProgress;
69298                  s.scaleY = t.scaleY + i.scaleY * this._tweenProgress;
69299                };
69300                i.prototype.fadeOut = function() {
69301                  var e = this.bonePose.result;
69302                  e.rotation = t.Transform.normalizeRadian(e.rotation);
69303                  e.skew = t.Transform.normalizeRadian(e.skew);
69304                };
69305                return i;
69306              }(t.BoneTimelineState);
69307              t.BoneAllTimelineState = s;
69308              var n = function(t) {
69309                r5(e, t);
69310                function e() {
69311                  return null !== t && t.apply(this, arguments) || this;
69312                }
69313                e.toString = function() {
69314                  return "[class dragonBones.BoneTranslateTimelineState]";
69315                };
69316                e.prototype._onArriveAtFrame = function() {
69317                  t.prototype._onArriveAtFrame.call(this);
69318                  if (null !== this._timelineData) {
69319                    var e = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex;
69320                    var i = this._armature._armatureData.scale;
69321                    var s = this._frameFloatArray;
69322                    var n = this.bonePose.current;
69323                    var r = this.bonePose.delta;
69324                    n.x = s[e++] * i;
69325                    n.y = s[e++] * i;
69326                    if (2 === this._tweenState) {
69327                      this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameFloatOffset + this._frameValueOffset);
69328                      r.x = s[e++] * i - n.x;
69329                      r.y = s[e++] * i - n.y;
69330                    } else {
69331                      r.x = 0;
69332                      r.y = 0;
69333                    }
69334                  } else {
69335                    n = this.bonePose.current;
69336                    r = this.bonePose.delta;
69337                    n.x = 0;
69338                    n.y = 0;
69339                    r.x = 0;
69340                    r.y = 0;
69341                  }
69342                };
69343                e.prototype._onUpdateFrame = function() {
69344                  t.prototype._onUpdateFrame.call(this);
69345                  var e = this.bonePose.current;
69346                  var i = this.bonePose.delta;
69347                  var s = this.bonePose.result;
69348                  this.bone._transformDirty = !0;
69349                  2 !== this._tweenState && (this._tweenState = 0);
69350                  s.x = e.x + i.x * this._tweenProgress;
69351                  s.y = e.y + i.y * this._tweenProgress;
69352                };
69353                return e;
69354              }(t.BoneTimelineState);
69355              t.BoneTranslateTimelineState = n;
69356              var r = function(e) {
69357                r5(i, e);
69358                function i() {
69359                  return null !== e && e.apply(this, arguments) || this;
69360                }
69361                i.toString = function() {
69362                  return "[class dragonBones.BoneRotateTimelineState]";
69363                };
69364                i.prototype._onArriveAtFrame = function() {
69365                  e.prototype._onArriveAtFrame.call(this);
69366                  if (null !== this._timelineData) {
69367                    var i = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex;
69368                    var s = this._frameFloatArray;
69369                    var n = this.bonePose.current;
69370                    var r = this.bonePose.delta;
69371                    n.rotation = s[i++];
69372                    n.skew = s[i++];
69373                    if (2 === this._tweenState) {
69374                      if (this._frameIndex === this._frameCount - 1) {
69375                        i = this._animationData.frameFloatOffset + this._frameValueOffset;
69376                        r.rotation = t.Transform.normalizeRadian(s[i++] - n.rotation);
69377                      } else r.rotation = s[i++] - n.rotation;
69378                      r.skew = s[i++] - n.skew;
69379                    } else {
69380                      r.rotation = 0;
69381                      r.skew = 0;
69382                    }
69383                  } else {
69384                    n = this.bonePose.current;
69385                    r = this.bonePose.delta;
69386                    n.rotation = 0;
69387                    n.skew = 0;
69388                    r.rotation = 0;
69389                    r.skew = 0;
69390                  }
69391                };
69392                i.prototype._onUpdateFrame = function() {
69393                  e.prototype._onUpdateFrame.call(this);
69394                  var t = this.bonePose.current;
69395                  var i = this.bonePose.delta;
69396                  var s = this.bonePose.result;
69397                  this.bone._transformDirty = !0;
69398                  2 !== this._tweenState && (this._tweenState = 0);
69399                  s.rotation = t.rotation + i.rotation * this._tweenProgress;
69400                  s.skew = t.skew + i.skew * this._tweenProgress;
69401                };
69402                i.prototype.fadeOut = function() {
69403                  var e = this.bonePose.result;
69404                  e.rotation = t.Transform.normalizeRadian(e.rotation);
69405                  e.skew = t.Transform.normalizeRadian(e.skew);
69406                };
69407                return i;
69408              }(t.BoneTimelineState);
69409              t.BoneRotateTimelineState = r;
69410              var o = function(t) {
69411                r5(e, t);
69412                function e() {
69413                  return null !== t && t.apply(this, arguments) || this;
69414                }
69415                e.toString = function() {
69416                  return "[class dragonBones.BoneScaleTimelineState]";
69417                };
69418                e.prototype._onArriveAtFrame = function() {
69419                  t.prototype._onArriveAtFrame.call(this);
69420                  if (null !== this._timelineData) {
69421                    var e = this._animationData.frameFloatOffset + this._frameValueOffset + 2 * this._frameIndex;
69422                    var i = this._frameFloatArray;
69423                    var s = this.bonePose.current;
69424                    var n = this.bonePose.delta;
69425                    s.scaleX = i[e++];
69426                    s.scaleY = i[e++];
69427                    if (2 === this._tweenState) {
69428                      this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameFloatOffset + this._frameValueOffset);
69429                      n.scaleX = i[e++] - s.scaleX;
69430                      n.scaleY = i[e++] - s.scaleY;
69431                    } else {
69432                      n.scaleX = 0;
69433                      n.scaleY = 0;
69434                    }
69435                  } else {
69436                    s = this.bonePose.current;
69437                    n = this.bonePose.delta;
69438                    s.scaleX = 1;
69439                    s.scaleY = 1;
69440                    n.scaleX = 0;
69441                    n.scaleY = 0;
69442                  }
69443                };
69444                e.prototype._onUpdateFrame = function() {
69445                  t.prototype._onUpdateFrame.call(this);
69446                  var e = this.bonePose.current;
69447                  var i = this.bonePose.delta;
69448                  var s = this.bonePose.result;
69449                  this.bone._transformDirty = !0;
69450                  2 !== this._tweenState && (this._tweenState = 0);
69451                  s.scaleX = e.scaleX + i.scaleX * this._tweenProgress;
69452                  s.scaleY = e.scaleY + i.scaleY * this._tweenProgress;
69453                };
69454                return e;
69455              }(t.BoneTimelineState);
69456              t.BoneScaleTimelineState = o;
69457              var a = function(t) {
69458                r5(e, t);
69459                function e() {
69460                  var e = null !== t && t.apply(this, arguments) || this;
69461                  e._current = [];
69462                  e._delta = [];
69463                  e._result = [];
69464                  return e;
69465                }
69466                e.toString = function() {
69467                  return "[class dragonBones.SurfaceTimelineState]";
69468                };
69469                e.prototype._onClear = function() {
69470                  t.prototype._onClear.call(this);
69471                  this.surface = null;
69472                  this._frameFloatOffset = 0;
69473                  this._valueCount = 0;
69474                  this._deformCount = 0;
69475                  this._valueOffset = 0;
69476                  this._current.length = 0;
69477                  this._delta.length = 0;
69478                  this._result.length = 0;
69479                };
69480                e.prototype._onArriveAtFrame = function() {
69481                  t.prototype._onArriveAtFrame.call(this);
69482                  if (null !== this._timelineData) {
69483                    var e = this._animationData.frameFloatOffset + this._frameValueOffset + this._frameIndex * this._valueCount;
69484                    var i = this._armature._armatureData.scale;
69485                    var s = this._frameFloatArray;
69486                    if (2 === this._tweenState) {
69487                      var n = e + this._valueCount;
69488                      this._frameIndex === this._frameCount - 1 && (n = this._animationData.frameFloatOffset + this._frameValueOffset);
69489                      for (var r = 0; r < this._valueCount; ++r) this._delta[r] = s[n + r] * i - (this._current[r] = s[e + r] * i);
69490                    } else for (r = 0; r < this._valueCount; ++r) this._current[r] = s[e + r] * i;
69491                  } else for (r = 0; r < this._valueCount; ++r) this._current[r] = 0;
69492                };
69493                e.prototype._onUpdateFrame = function() {
69494                  t.prototype._onUpdateFrame.call(this);
69495                  this.surface._transformDirty = !0;
69496                  2 !== this._tweenState && (this._tweenState = 0);
69497                  for (var e = 0; e < this._valueCount; ++e) this._result[e] = this._current[e] + this._delta[e] * this._tweenProgress;
69498                };
69499                e.prototype.init = function(e, i, s) {
69500                  t.prototype.init.call(this, e, i, s);
69501                  if (null !== this._timelineData) {
69502                    var n = this._animationData.frameIntOffset + this._timelineArray[this._timelineData.offset + 3];
69503                    this._deformCount = this._frameIntArray[n + 1];
69504                    this._valueCount = this._frameIntArray[n + 2];
69505                    this._valueOffset = this._frameIntArray[n + 3];
69506                    this._frameFloatOffset = this._frameIntArray[n + 4] + this._animationData.frameFloatOffset;
69507                  } else {
69508                    this._deformCount = this.surface._deformVertices.length;
69509                    this._valueCount = this._deformCount;
69510                    this._valueOffset = 0;
69511                    this._frameFloatOffset = 0;
69512                  }
69513                  this._current.length = this._valueCount;
69514                  this._delta.length = this._valueCount;
69515                  this._result.length = this._valueCount;
69516                  for (var r = 0; r < this._valueCount; ++r) this._delta[r] = 0;
69517                };
69518                e.prototype.blend = function(t) {
69519                  var e = this.surface._blendState.blendWeight;
69520                  var i = this.surface._deformVertices;
69521                  for (var s = 0; s < this._deformCount; ++s) {
69522                    var n = 0;
69523                    n = s < this._valueOffset ? this._frameFloatArray[this._frameFloatOffset + s] : s < this._valueOffset + this._valueCount ? this._result[s - this._valueOffset] : this._frameFloatArray[this._frameFloatOffset + s - this._valueCount];
69524                    2 === t ? i[s] += n * e : i[s] = 1 !== e ? n * e : n;
69525                  }
69526                  0 === this._animationState._fadeState && 0 === this._animationState._subFadeState || (this.surface._transformDirty = !0);
69527                };
69528                return e;
69529              }(t.TweenTimelineState);
69530              t.SurfaceTimelineState = a;
69531              var l = function(t) {
69532                r5(e, t);
69533                function e() {
69534                  return null !== t && t.apply(this, arguments) || this;
69535                }
69536                e.toString = function() {
69537                  return "[class dragonBones.SlotDislayTimelineState]";
69538                };
69539                e.prototype._onArriveAtFrame = function() {
69540                  if (this.playState >= 0) {
69541                    var t = null !== this._timelineData ? this._frameArray[this._frameOffset + 1] : this.slot._slotData.displayIndex;
69542                    this.slot.displayIndex !== t && this.slot._setDisplayIndex(t, !0);
69543                  }
69544                };
69545                return e;
69546              }(t.SlotTimelineState);
69547              t.SlotDislayTimelineState = l;
69548              var h = function(t) {
69549                r5(e, t);
69550                function e() {
69551                  var e = null !== t && t.apply(this, arguments) || this;
69552                  e._current = [ 0, 0, 0, 0, 0, 0, 0, 0 ];
69553                  e._delta = [ 0, 0, 0, 0, 0, 0, 0, 0 ];
69554                  e._result = [ 0, 0, 0, 0, 0, 0, 0, 0 ];
69555                  return e;
69556                }
69557                e.toString = function() {
69558                  return "[class dragonBones.SlotColorTimelineState]";
69559                };
69560                e.prototype._onClear = function() {
69561                  t.prototype._onClear.call(this);
69562                  this._dirty = !1;
69563                };
69564                e.prototype._onArriveAtFrame = function() {
69565                  t.prototype._onArriveAtFrame.call(this);
69566                  if (null !== this._timelineData) {
69567                    var e = this._dragonBonesData.intArray;
69568                    var i = this._frameIntArray;
69569                    var s = this._animationData.frameIntOffset + this._frameValueOffset + 1 * this._frameIndex;
69570                    var n = i[s];
69571                    n < 0 && (n += 65536);
69572                    this._current[0] = e[n++];
69573                    this._current[1] = e[n++];
69574                    this._current[2] = e[n++];
69575                    this._current[3] = e[n++];
69576                    this._current[4] = e[n++];
69577                    this._current[5] = e[n++];
69578                    this._current[6] = e[n++];
69579                    this._current[7] = e[n++];
69580                    if (2 === this._tweenState) {
69581                      (n = this._frameIndex === this._frameCount - 1 ? i[this._animationData.frameIntOffset + this._frameValueOffset] : i[s + 1]) < 0 && (n += 65536);
69582                      this._delta[0] = e[n++] - this._current[0];
69583                      this._delta[1] = e[n++] - this._current[1];
69584                      this._delta[2] = e[n++] - this._current[2];
69585                      this._delta[3] = e[n++] - this._current[3];
69586                      this._delta[4] = e[n++] - this._current[4];
69587                      this._delta[5] = e[n++] - this._current[5];
69588                      this._delta[6] = e[n++] - this._current[6];
69589                      this._delta[7] = e[n++] - this._current[7];
69590                    }
69591                  } else {
69592                    var r = this.slot._slotData.color;
69593                    this._current[0] = 100 * r.alphaMultiplier;
69594                    this._current[1] = 100 * r.redMultiplier;
69595                    this._current[2] = 100 * r.greenMultiplier;
69596                    this._current[3] = 100 * r.blueMultiplier;
69597                    this._current[4] = r.alphaOffset;
69598                    this._current[5] = r.redOffset;
69599                    this._current[6] = r.greenOffset;
69600                    this._current[7] = r.blueOffset;
69601                  }
69602                };
69603                e.prototype._onUpdateFrame = function() {
69604                  t.prototype._onUpdateFrame.call(this);
69605                  this._dirty = !0;
69606                  2 !== this._tweenState && (this._tweenState = 0);
69607                  this._result[0] = .01 * (this._current[0] + this._delta[0] * this._tweenProgress);
69608                  this._result[1] = .01 * (this._current[1] + this._delta[1] * this._tweenProgress);
69609                  this._result[2] = .01 * (this._current[2] + this._delta[2] * this._tweenProgress);
69610                  this._result[3] = .01 * (this._current[3] + this._delta[3] * this._tweenProgress);
69611                  this._result[4] = this._current[4] + this._delta[4] * this._tweenProgress;
69612                  this._result[5] = this._current[5] + this._delta[5] * this._tweenProgress;
69613                  this._result[6] = this._current[6] + this._delta[6] * this._tweenProgress;
69614                  this._result[7] = this._current[7] + this._delta[7] * this._tweenProgress;
69615                };
69616                e.prototype.fadeOut = function() {
69617                  this._tweenState = 0;
69618                  this._dirty = !1;
69619                };
69620                e.prototype.update = function(e) {
69621                  t.prototype.update.call(this, e);
69622                  if (0 !== this._tweenState || this._dirty) {
69623                    var i = this.slot._colorTransform;
69624                    if (0 !== this._animationState._fadeState || 0 !== this._animationState._subFadeState) {
69625                      if (i.alphaMultiplier !== this._result[0] || i.redMultiplier !== this._result[1] || i.greenMultiplier !== this._result[2] || i.blueMultiplier !== this._result[3] || i.alphaOffset !== this._result[4] || i.redOffset !== this._result[5] || i.greenOffset !== this._result[6] || i.blueOffset !== this._result[7]) {
69626                        var s = Math.pow(this._animationState._fadeProgress, 4);
69627                        i.alphaMultiplier += (this._result[0] - i.alphaMultiplier) * s;
69628                        i.redMultiplier += (this._result[1] - i.redMultiplier) * s;
69629                        i.greenMultiplier += (this._result[2] - i.greenMultiplier) * s;
69630                        i.blueMultiplier += (this._result[3] - i.blueMultiplier) * s;
69631                        i.alphaOffset += (this._result[4] - i.alphaOffset) * s;
69632                        i.redOffset += (this._result[5] - i.redOffset) * s;
69633                        i.greenOffset += (this._result[6] - i.greenOffset) * s;
69634                        i.blueOffset += (this._result[7] - i.blueOffset) * s;
69635                        this.slot._colorDirty = !0;
69636                      }
69637                    } else if (this._dirty) {
69638                      this._dirty = !1;
69639                      if (i.alphaMultiplier !== this._result[0] || i.redMultiplier !== this._result[1] || i.greenMultiplier !== this._result[2] || i.blueMultiplier !== this._result[3] || i.alphaOffset !== this._result[4] || i.redOffset !== this._result[5] || i.greenOffset !== this._result[6] || i.blueOffset !== this._result[7]) {
69640                        i.alphaMultiplier = this._result[0];
69641                        i.redMultiplier = this._result[1];
69642                        i.greenMultiplier = this._result[2];
69643                        i.blueMultiplier = this._result[3];
69644                        i.alphaOffset = this._result[4];
69645                        i.redOffset = this._result[5];
69646                        i.greenOffset = this._result[6];
69647                        i.blueOffset = this._result[7];
69648                        this.slot._colorDirty = !0;
69649                      }
69650                    }
69651                  }
69652                };
69653                return e;
69654              }(t.SlotTimelineState);
69655              t.SlotColorTimelineState = h;
69656              var c = function(t) {
69657                r5(e, t);
69658                function e() {
69659                  var e = null !== t && t.apply(this, arguments) || this;
69660                  e._current = [];
69661                  e._delta = [];
69662                  e._result = [];
69663                  return e;
69664                }
69665                e.toString = function() {
69666                  return "[class dragonBones.DeformTimelineState]";
69667                };
69668                e.prototype._onClear = function() {
69669                  t.prototype._onClear.call(this);
69670                  this.vertexOffset = 0;
69671                  this._dirty = !1;
69672                  this._frameFloatOffset = 0;
69673                  this._valueCount = 0;
69674                  this._deformCount = 0;
69675                  this._valueOffset = 0;
69676                  this._current.length = 0;
69677                  this._delta.length = 0;
69678                  this._result.length = 0;
69679                };
69680                e.prototype._onArriveAtFrame = function() {
69681                  t.prototype._onArriveAtFrame.call(this);
69682                  if (null !== this._timelineData) {
69683                    var e = this._animationData.frameFloatOffset + this._frameValueOffset + this._frameIndex * this._valueCount;
69684                    var i = this._armature._armatureData.scale;
69685                    var s = this._frameFloatArray;
69686                    if (2 === this._tweenState) {
69687                      var n = e + this._valueCount;
69688                      this._frameIndex === this._frameCount - 1 && (n = this._animationData.frameFloatOffset + this._frameValueOffset);
69689                      for (var r = 0; r < this._valueCount; ++r) this._delta[r] = s[n + r] * i - (this._current[r] = s[e + r] * i);
69690                    } else for (r = 0; r < this._valueCount; ++r) this._current[r] = s[e + r] * i;
69691                  } else for (r = 0; r < this._valueCount; ++r) this._current[r] = 0;
69692                };
69693                e.prototype._onUpdateFrame = function() {
69694                  t.prototype._onUpdateFrame.call(this);
69695                  this._dirty = !0;
69696                  2 !== this._tweenState && (this._tweenState = 0);
69697                  for (var e = 0; e < this._valueCount; ++e) this._result[e] = this._current[e] + this._delta[e] * this._tweenProgress;
69698                };
69699                e.prototype.init = function(e, i, s) {
69700                  t.prototype.init.call(this, e, i, s);
69701                  if (null !== this._timelineData) {
69702                    var n = this._animationData.frameIntOffset + this._timelineArray[this._timelineData.offset + 3];
69703                    this.vertexOffset = this._frameIntArray[n + 0];
69704                    this.vertexOffset < 0 && (this.vertexOffset += 65536);
69705                    this._deformCount = this._frameIntArray[n + 1];
69706                    this._valueCount = this._frameIntArray[n + 2];
69707                    this._valueOffset = this._frameIntArray[n + 3];
69708                    this._frameFloatOffset = this._frameIntArray[n + 4] + this._animationData.frameFloatOffset;
69709                  } else {
69710                    var r = this.slot._deformVertices;
69711                    this._deformCount = null !== r ? r.vertices.length : 0;
69712                    this._valueCount = this._deformCount;
69713                    this._valueOffset = 0;
69714                    this._frameFloatOffset = 0;
69715                  }
69716                  this._current.length = this._valueCount;
69717                  this._delta.length = this._valueCount;
69718                  this._result.length = this._valueCount;
69719                  for (var o = 0; o < this._valueCount; ++o) this._delta[o] = 0;
69720                };
69721                e.prototype.fadeOut = function() {
69722                  this._tweenState = 0;
69723                  this._dirty = !1;
69724                };
69725                e.prototype.update = function(e) {
69726                  var i = this.slot._deformVertices;
69727                  if (null !== i && null !== i.verticesData && i.verticesData.offset === this.vertexOffset) {
69728                    t.prototype.update.call(this, e);
69729                    if (0 !== this._tweenState || this._dirty) {
69730                      var s = i.vertices;
69731                      if (0 !== this._animationState._fadeState || 0 !== this._animationState._subFadeState) {
69732                        var n = Math.pow(this._animationState._fadeProgress, 2);
69733                        for (var r = 0; r < this._deformCount; ++r) r < this._valueOffset ? s[r] += (this._frameFloatArray[this._frameFloatOffset + r] - s[r]) * n : r < this._valueOffset + this._valueCount ? s[r] += (this._result[r - this._valueOffset] - s[r]) * n : s[r] += (this._frameFloatArray[this._frameFloatOffset + r - this._valueCount] - s[r]) * n;
69734                        i.verticesDirty = !0;
69735                      } else if (this._dirty) {
69736                        this._dirty = !1;
69737                        for (r = 0; r < this._deformCount; ++r) r < this._valueOffset ? s[r] = this._frameFloatArray[this._frameFloatOffset + r] : r < this._valueOffset + this._valueCount ? s[r] = this._result[r - this._valueOffset] : s[r] = this._frameFloatArray[this._frameFloatOffset + r - this._valueCount];
69738                        i.verticesDirty = !0;
69739                      }
69740                    }
69741                  }
69742                };
69743                return e;
69744              }(t.SlotTimelineState);
69745              t.DeformTimelineState = c;
69746              var u = function(t) {
69747                r5(e, t);
69748                function e() {
69749                  return null !== t && t.apply(this, arguments) || this;
69750                }
69751                e.toString = function() {
69752                  return "[class dragonBones.IKConstraintTimelineState]";
69753                };
69754                e.prototype._onClear = function() {
69755                  t.prototype._onClear.call(this);
69756                  this._current = 0;
69757                  this._delta = 0;
69758                };
69759                e.prototype._onArriveAtFrame = function() {
69760                  t.prototype._onArriveAtFrame.call(this);
69761                  var e = this.constraint;
69762                  if (null !== this._timelineData) {
69763                    var i = this._animationData.frameIntOffset + this._frameValueOffset + 2 * this._frameIndex;
69764                    var s = this._frameIntArray;
69765                    var n = 0 !== s[i++];
69766                    this._current = .01 * s[i++];
69767                    if (2 === this._tweenState) {
69768                      this._frameIndex === this._frameCount - 1 && (i = this._animationData.frameIntOffset + this._frameValueOffset);
69769                      this._delta = .01 * s[i + 1] - this._current;
69770                    } else this._delta = 0;
69771                    e._bendPositive = n;
69772                  } else {
69773                    var r = e._constraintData;
69774                    this._current = r.weight;
69775                    this._delta = 0;
69776                    e._bendPositive = r.bendPositive;
69777                  }
69778                  e.invalidUpdate();
69779                };
69780                e.prototype._onUpdateFrame = function() {
69781                  t.prototype._onUpdateFrame.call(this);
69782                  2 !== this._tweenState && (this._tweenState = 0);
69783                  var e = this.constraint;
69784                  e._weight = this._current + this._delta * this._tweenProgress;
69785                  e.invalidUpdate();
69786                };
69787                return e;
69788              }(t.ConstraintTimelineState);
69789              t.IKConstraintTimelineState = u;
69790              var _ = function(t) {
69791                r5(e, t);
69792                function e() {
69793                  var e = null !== t && t.apply(this, arguments) || this;
69794                  e._floats = [ 0, 0, 0, 0, 0, 0 ];
69795                  return e;
69796                }
69797                e.toString = function() {
69798                  return "[class dragonBones.AnimationTimelineState]";
69799                };
69800                e.prototype._onClear = function() {
69801                  t.prototype._onClear.call(this);
69802                  this.animationState = null;
69803                };
69804                e.prototype._onArriveAtFrame = function() {
69805                  t.prototype._onArriveAtFrame.call(this);
69806                  if (null !== this._timelineData) {
69807                    var e = this._animationData.frameIntOffset + this._frameValueOffset + 2 * this._frameIndex;
69808                    var i = 1 / this.animationState._animationData.parent.frameRate;
69809                    var s = this._frameIntArray;
69810                    this._floats[0] = s[e++] * i;
69811                    this._floats[3] = .01 * s[e++];
69812                    if (2 === this._tweenState) {
69813                      this._frameIndex === this._frameCount - 1 && (e = this._animationData.frameIntOffset + this._frameValueOffset);
69814                      this._floats[1] = s[e++] * i - this._floats[0];
69815                      this._floats[4] = .01 * s[e++] - this._floats[3];
69816                    } else {
69817                      this._floats[1] = 0;
69818                      this._floats[4] = 0;
69819                    }
69820                  }
69821                };
69822                e.prototype._onUpdateFrame = function() {
69823                  t.prototype._onUpdateFrame.call(this);
69824                  2 !== this._tweenState && (this._tweenState = 0);
69825                  this._floats[0] >= 0 && (this._floats[2] = this._floats[0] + this._floats[1] * this._tweenProgress);
69826                  this._floats[5] = this._floats[3] + this._floats[4] * this._tweenProgress;
69827                };
69828                e.prototype.blend = function(t) {
69829                  var e = this.animationState;
69830                  var i = e._blendState.blendWeight;
69831                  if (2 === t) {
69832                    e.weight += this._floats[5] * i;
69833                    e.currentTime += this._floats[2] * i;
69834                  } else {
69835                    e.weight = this._floats[5] * i;
69836                    e.currentTime = this._floats[2] * i;
69837                  }
69838                };
69839                return e;
69840              }(t.TweenTimelineState);
69841              t.AnimationTimelineState = _;
69842            }(a5 || (a5 = {}));
69843            !function(t) {
69844              var e = function(t) {
69845                r5(e, t);
69846                function e() {
69847                  return null !== t && t.apply(this, arguments) || this;
69848                }
69849                e.actionDataToInstance = function(t, i, s) {
69850                  0 === t.type ? i.type = e.FRAME_EVENT : i.type = 10 === t.type ? e.FRAME_EVENT : e.SOUND_EVENT;
69851                  i.name = t.name;
69852                  i.armature = s;
69853                  i.actionData = t;
69854                  i.data = t.data;
69855                  null !== t.bone && (i.bone = s.getBone(t.bone.name));
69856                  null !== t.slot && (i.slot = s.getSlot(t.slot.name));
69857                };
69858                e.toString = function() {
69859                  return "[class dragonBones.EventObject]";
69860                };
69861                e.prototype._onClear = function() {
69862                  this.time = 0;
69863                  this.type = "";
69864                  this.name = "";
69865                  this.armature = null;
69866                  this.bone = null;
69867                  this.slot = null;
69868                  this.animationState = null;
69869                  this.actionData = null;
69870                  this.data = null;
69871                };
69872                e.START = "start";
69873                e.LOOP_COMPLETE = "loopComplete";
69874                e.COMPLETE = "complete";
69875                e.FADE_IN = "fadeIn";
69876                e.FADE_IN_COMPLETE = "fadeInComplete";
69877                e.FADE_OUT = "fadeOut";
69878                e.FADE_OUT_COMPLETE = "fadeOutComplete";
69879                e.FRAME_EVENT = "frameEvent";
69880                e.SOUND_EVENT = "soundEvent";
69881                return e;
69882              }(t.BaseObject);
69883              t.EventObject = e;
69884            }(a5 || (a5 = {}));
69885            !function(t) {
69886              var e = function() {
69887                function e() {}
69888                e._getArmatureType = function(t) {
69889                  switch (t.toLowerCase()) {
69890                   case "stage":
69891                    return 2;
69892
69893                   case "armature":
69894                   default:
69895                    return 0;
69896
69897                   case "movieclip":
69898                    return 1;
69899                  }
69900                };
69901                e._getBoneType = function(t) {
69902                  switch (t.toLowerCase()) {
69903                   case "bone":
69904                   default:
69905                    return 0;
69906
69907                   case "surface":
69908                    return 1;
69909                  }
69910                };
69911                e._getDisplayType = function(t) {
69912                  switch (t.toLowerCase()) {
69913                   case "image":
69914                   default:
69915                    return 0;
69916
69917                   case "mesh":
69918                    return 2;
69919
69920                   case "armature":
69921                    return 1;
69922
69923                   case "boundingbox":
69924                    return 3;
69925
69926                   case "path":
69927                    return 4;
69928                  }
69929                };
69930                e._getBoundingBoxType = function(t) {
69931                  switch (t.toLowerCase()) {
69932                   case "rectangle":
69933                   default:
69934                    return 0;
69935
69936                   case "ellipse":
69937                    return 1;
69938
69939                   case "polygon":
69940                    return 2;
69941                  }
69942                };
69943                e._getActionType = function(t) {
69944                  switch (t.toLowerCase()) {
69945                   case "play":
69946                   default:
69947                    return 0;
69948
69949                   case "frame":
69950                    return 10;
69951
69952                   case "sound":
69953                    return 11;
69954                  }
69955                };
69956                e._getBlendMode = function(t) {
69957                  switch (t.toLowerCase()) {
69958                   case "normal":
69959                   default:
69960                    return 0;
69961
69962                   case "add":
69963                    return 1;
69964
69965                   case "alpha":
69966                    return 2;
69967
69968                   case "darken":
69969                    return 3;
69970
69971                   case "difference":
69972                    return 4;
69973
69974                   case "erase":
69975                    return 5;
69976
69977                   case "hardlight":
69978                    return 6;
69979
69980                   case "invert":
69981                    return 7;
69982
69983                   case "layer":
69984                    return 8;
69985
69986                   case "lighten":
69987                    return 9;
69988
69989                   case "multiply":
69990                    return 10;
69991
69992                   case "overlay":
69993                    return 11;
69994
69995                   case "screen":
69996                    return 12;
69997
69998                   case "subtract":
69999                    return 13;
70000                  }
70001                };
70002                e._getPositionMode = function(t) {
70003                  switch (t.toLocaleLowerCase()) {
70004                   case "percent":
70005                   default:
70006                    return 1;
70007
70008                   case "fixed":
70009                    return 0;
70010                  }
70011                };
70012                e._getSpacingMode = function(t) {
70013                  switch (t.toLocaleLowerCase()) {
70014                   case "length":
70015                   default:
70016                    return 0;
70017
70018                   case "percent":
70019                    return 2;
70020
70021                   case "fixed":
70022                    return 1;
70023                  }
70024                };
70025                e._getRotateMode = function(t) {
70026                  switch (t.toLocaleLowerCase()) {
70027                   case "tangent":
70028                   default:
70029                    return 0;
70030
70031                   case "chain":
70032                    return 1;
70033
70034                   case "chainscale":
70035                    return 2;
70036                  }
70037                };
70038                e.parseDragonBonesData = function(e) {
70039                  console.warn("Deprecated.");
70040                  return e instanceof ArrayBuffer ? t.BinaryDataParser.getInstance().parseDragonBonesData(e) : t.ObjectDataParser.getInstance().parseDragonBonesData(e);
70041                };
70042                e.parseTextureAtlasData = function(i, s) {
70043                  void 0 === s && (s = 1);
70044                  console.warn("已废弃");
70045                  var n = {};
70046                  var r = i[e.SUB_TEXTURE];
70047                  for (var o = 0, a = r.length; o < a; o++) {
70048                    var l = r[o];
70049                    var h = l[e.NAME];
70050                    var c = new t.Rectangle;
70051                    var u = null;
70052                    c.x = l[e.X] / s;
70053                    c.y = l[e.Y] / s;
70054                    c.width = l[e.WIDTH] / s;
70055                    c.height = l[e.HEIGHT] / s;
70056                    if (e.FRAME_WIDTH in l) {
70057                      (u = new t.Rectangle).x = l[e.FRAME_X] / s;
70058                      u.y = l[e.FRAME_Y] / s;
70059                      u.width = l[e.FRAME_WIDTH] / s;
70060                      u.height = l[e.FRAME_HEIGHT] / s;
70061                    }
70062                    n[h] = {
70063                      region: c,
70064                      frame: u,
70065                      rotated: !1
70066                    };
70067                  }
70068                  return n;
70069                };
70070                e.DATA_VERSION_2_3 = "2.3";
70071                e.DATA_VERSION_3_0 = "3.0";
70072                e.DATA_VERSION_4_0 = "4.0";
70073                e.DATA_VERSION_4_5 = "4.5";
70074                e.DATA_VERSION_5_0 = "5.0";
70075                e.DATA_VERSION_5_5 = "5.5";
70076                e.DATA_VERSION = e.DATA_VERSION_5_5;
70077                e.DATA_VERSIONS = [ e.DATA_VERSION_4_0, e.DATA_VERSION_4_5, e.DATA_VERSION_5_0, e.DATA_VERSION_5_5 ];
70078                e.TEXTURE_ATLAS = "textureAtlas";
70079                e.SUB_TEXTURE = "SubTexture";
70080                e.FORMAT = "format";
70081                e.IMAGE_PATH = "imagePath";
70082                e.WIDTH = "width";
70083                e.HEIGHT = "height";
70084                e.ROTATED = "rotated";
70085                e.FRAME_X = "frameX";
70086                e.FRAME_Y = "frameY";
70087                e.FRAME_WIDTH = "frameWidth";
70088                e.FRAME_HEIGHT = "frameHeight";
70089                e.DRADON_BONES = "dragonBones";
70090                e.USER_DATA = "userData";
70091                e.ARMATURE = "armature";
70092                e.BONE = "bone";
70093                e.SURFACE = "surface";
70094                e.SLOT = "slot";
70095                e.CONSTRAINT = "constraint";
70096                e.IK = "ik";
70097                e.PATH_CONSTRAINT = "path";
70098                e.SKIN = "skin";
70099                e.DISPLAY = "display";
70100                e.ANIMATION = "animation";
70101                e.Z_ORDER = "zOrder";
70102                e.FFD = "ffd";
70103                e.FRAME = "frame";
70104                e.TRANSLATE_FRAME = "translateFrame";
70105                e.ROTATE_FRAME = "rotateFrame";
70106                e.SCALE_FRAME = "scaleFrame";
70107                e.DISPLAY_FRAME = "displayFrame";
70108                e.COLOR_FRAME = "colorFrame";
70109                e.DEFAULT_ACTIONS = "defaultActions";
70110                e.ACTIONS = "actions";
70111                e.EVENTS = "events";
70112                e.INTS = "ints";
70113                e.FLOATS = "floats";
70114                e.STRINGS = "strings";
70115                e.CANVAS = "canvas";
70116                e.TRANSFORM = "transform";
70117                e.PIVOT = "pivot";
70118                e.AABB = "aabb";
70119                e.COLOR = "color";
70120                e.VERSION = "version";
70121                e.COMPATIBLE_VERSION = "compatibleVersion";
70122                e.FRAME_RATE = "frameRate";
70123                e.TYPE = "type";
70124                e.SUB_TYPE = "subType";
70125                e.NAME = "name";
70126                e.PARENT = "parent";
70127                e.TARGET = "target";
70128                e.STAGE = "stage";
70129                e.SHARE = "share";
70130                e.PATH = "path";
70131                e.LENGTH = "length";
70132                e.DISPLAY_INDEX = "displayIndex";
70133                e.BLEND_MODE = "blendMode";
70134                e.INHERIT_TRANSLATION = "inheritTranslation";
70135                e.INHERIT_ROTATION = "inheritRotation";
70136                e.INHERIT_SCALE = "inheritScale";
70137                e.INHERIT_REFLECTION = "inheritReflection";
70138                e.INHERIT_ANIMATION = "inheritAnimation";
70139                e.INHERIT_DEFORM = "inheritDeform";
70140                e.SEGMENT_X = "segmentX";
70141                e.SEGMENT_Y = "segmentY";
70142                e.BEND_POSITIVE = "bendPositive";
70143                e.CHAIN = "chain";
70144                e.WEIGHT = "weight";
70145                e.FADE_IN_TIME = "fadeInTime";
70146                e.PLAY_TIMES = "playTimes";
70147                e.SCALE = "scale";
70148                e.OFFSET = "offset";
70149                e.POSITION = "position";
70150                e.DURATION = "duration";
70151                e.TWEEN_EASING = "tweenEasing";
70152                e.TWEEN_ROTATE = "tweenRotate";
70153                e.TWEEN_SCALE = "tweenScale";
70154                e.CLOCK_WISE = "clockwise";
70155                e.CURVE = "curve";
70156                e.SOUND = "sound";
70157                e.EVENT = "event";
70158                e.ACTION = "action";
70159                e.X = "x";
70160                e.Y = "y";
70161                e.SKEW_X = "skX";
70162                e.SKEW_Y = "skY";
70163                e.SCALE_X = "scX";
70164                e.SCALE_Y = "scY";
70165                e.VALUE = "value";
70166                e.ROTATE = "rotate";
70167                e.SKEW = "skew";
70168                e.ALPHA_OFFSET = "aO";
70169                e.RED_OFFSET = "rO";
70170                e.GREEN_OFFSET = "gO";
70171                e.BLUE_OFFSET = "bO";
70172                e.ALPHA_MULTIPLIER = "aM";
70173                e.RED_MULTIPLIER = "rM";
70174                e.GREEN_MULTIPLIER = "gM";
70175                e.BLUE_MULTIPLIER = "bM";
70176                e.UVS = "uvs";
70177                e.VERTICES = "vertices";
70178                e.TRIANGLES = "triangles";
70179                e.WEIGHTS = "weights";
70180                e.SLOT_POSE = "slotPose";
70181                e.BONE_POSE = "bonePose";
70182                e.GLUE_WEIGHTS = "glueWeights";
70183                e.GLUE_MESHES = "glueMeshes";
70184                e.BONES = "bones";
70185                e.POSITION_MODE = "positionMode";
70186                e.SPACING_MODE = "spacingMode";
70187                e.ROTATE_MODE = "rotateMode";
70188                e.SPACING = "spacing";
70189                e.ROTATE_OFFSET = "rotateOffset";
70190                e.ROTATE_MIX = "rotateMix";
70191                e.TRANSLATE_MIX = "translateMix";
70192                e.TARGET_DISPLAY = "targetDisplay";
70193                e.CLOSED = "closed";
70194                e.CONSTANT_SPEED = "constantSpeed";
70195                e.VERTEX_COUNT = "vertexCount";
70196                e.LENGTHS = "lengths";
70197                e.GOTO_AND_PLAY = "gotoAndPlay";
70198                e.DEFAULT_NAME = "default";
70199                return e;
70200              }();
70201              t.DataParser = e;
70202            }(a5 || (a5 = {}));
70203            !function(t) {
70204              var e = function(e) {
70205                r5(s, e);
70206                function s() {
70207                  var i = null !== e && e.apply(this, arguments) || this;
70208                  i._rawTextureAtlasIndex = 0;
70209                  i._rawBones = [];
70210                  i._data = null;
70211                  i._armature = null;
70212                  i._bone = null;
70213                  i._surface = null;
70214                  i._slot = null;
70215                  i._skin = null;
70216                  i._mesh = null;
70217                  i._animation = null;
70218                  i._timeline = null;
70219                  i._rawTextureAtlases = null;
70220                  i._defaultColorOffset = -1;
70221                  i._prevClockwise = 0;
70222                  i._prevRotation = 0;
70223                  i._helpMatrixA = new t.Matrix;
70224                  i._helpMatrixB = new t.Matrix;
70225                  i._helpTransform = new t.Transform;
70226                  i._helpColorTransform = new t.ColorTransform;
70227                  i._helpPoint = new t.Point;
70228                  i._helpArray = [];
70229                  i._intArray = [];
70230                  i._floatArray = [];
70231                  i._frameIntArray = [];
70232                  i._frameFloatArray = [];
70233                  i._frameArray = [];
70234                  i._timelineArray = [];
70235                  i._cacheRawMeshes = [];
70236                  i._cacheMeshes = [];
70237                  i._actionFrames = [];
70238                  i._weightSlotPose = {};
70239                  i._weightBonePoses = {};
70240                  i._cacheBones = {};
70241                  i._slotChildActions = {};
70242                  return i;
70243                }
70244                s._getBoolean = function(t, e, i) {
70245                  if (e in t) {
70246                    var s = t[e];
70247                    var n = typeof s;
70248                    if ("boolean" === n) return s;
70249                    if ("string" !== n) return !!s;
70250                    switch (s) {
70251                     case "0":
70252                     case "NaN":
70253                     case "":
70254                     case "false":
70255                     case "null":
70256                     case "undefined":
70257                      return !1;
70258
70259                     default:
70260                      return !0;
70261                    }
70262                  }
70263                  return i;
70264                };
70265                s._getNumber = function(t, e, i) {
70266                  if (e in t) {
70267                    var s = t[e];
70268                    return null === s || "NaN" === s ? i : +s || 0;
70269                  }
70270                  return i;
70271                };
70272                s._getString = function(e, i, s) {
70273                  if (i in e) {
70274                    var n = e[i];
70275                    if ("string" === typeof n) {
70276                      if (t.DragonBones.webAssembly) for (var r = 0, o = n.length; r < o; ++r) if (n.charCodeAt(r) > 255) return encodeURI(n);
70277                      return n;
70278                    }
70279                    return String(n);
70280                  }
70281                  return s;
70282                };
70283                s.prototype._getCurvePoint = function(t, e, i, s, n, r, o, a, l, h) {
70284                  var c = 1 - l;
70285                  var u = c * c;
70286                  var _ = l * l;
70287                  var d = c * u;
70288                  var p = 3 * l * u;
70289                  var m = 3 * c * _;
70290                  var f = l * _;
70291                  h.x = d * t + p * i + m * n + f * o;
70292                  h.y = d * e + p * s + m * r + f * a;
70293                };
70294                s.prototype._samplingEasingCurve = function(t, e) {
70295                  var i = t.length;
70296                  var s = -2;
70297                  for (var n = 0, r = e.length; n < r; ++n) {
70298                    var o = (n + 1) / (r + 1);
70299                    for (;(s + 6 < i ? t[s + 6] : 1) < o; ) s += 6;
70300                    var a = s >= 0 && s + 6 < i;
70301                    var l = a ? t[s] : 0;
70302                    var h = a ? t[s + 1] : 0;
70303                    var c = t[s + 2];
70304                    var u = t[s + 3];
70305                    var _ = t[s + 4];
70306                    var d = t[s + 5];
70307                    var p = a ? t[s + 6] : 1;
70308                    var m = a ? t[s + 7] : 1;
70309                    var f = 0;
70310                    var g = 1;
70311                    for (;g - f > 1e-4; ) {
70312                      var y = .5 * (g + f);
70313                      this._getCurvePoint(l, h, c, u, _, d, p, m, y, this._helpPoint);
70314                      o - this._helpPoint.x > 0 ? f = y : g = y;
70315                    }
70316                    e[n] = this._helpPoint.y;
70317                  }
70318                };
70319                s.prototype._parseActionDataInFrame = function(e, i, s, n) {
70320                  t.DataParser.EVENT in e && this._mergeActionFrame(e[t.DataParser.EVENT], i, 10, s, n);
70321                  t.DataParser.SOUND in e && this._mergeActionFrame(e[t.DataParser.SOUND], i, 11, s, n);
70322                  t.DataParser.ACTION in e && this._mergeActionFrame(e[t.DataParser.ACTION], i, 0, s, n);
70323                  t.DataParser.EVENTS in e && this._mergeActionFrame(e[t.DataParser.EVENTS], i, 10, s, n);
70324                  t.DataParser.ACTIONS in e && this._mergeActionFrame(e[t.DataParser.ACTIONS], i, 0, s, n);
70325                };
70326                s.prototype._mergeActionFrame = function(e, s, n, r, o) {
70327                  var a = t.DragonBones.webAssembly ? this._armature.actions.size() : this._armature.actions.length;
70328                  var l = this._parseActionData(e, n, r, o);
70329                  var h = 0;
70330                  var c = null;
70331                  for (var u = 0, _ = l; u < _.length; u++) {
70332                    var d = _[u];
70333                    this._armature.addAction(d, !1);
70334                  }
70335                  if (0 === this._actionFrames.length) {
70336                    (c = new i).frameStart = 0;
70337                    this._actionFrames.push(c);
70338                    c = null;
70339                  }
70340                  for (var p = 0, m = this._actionFrames; p < m.length; p++) {
70341                    var f = m[p];
70342                    if (f.frameStart === s) {
70343                      c = f;
70344                      break;
70345                    }
70346                    if (f.frameStart > s) break;
70347                    h++;
70348                  }
70349                  if (null === c) {
70350                    (c = new i).frameStart = s;
70351                    this._actionFrames.splice(h + 1, 0, c);
70352                  }
70353                  for (var g = 0; g < l.length; ++g) c.actions.push(a + g);
70354                };
70355                s.prototype._parseArmature = function(e, i) {
70356                  var n = t.BaseObject.borrowObject(t.ArmatureData);
70357                  n.name = s._getString(e, t.DataParser.NAME, "");
70358                  n.frameRate = s._getNumber(e, t.DataParser.FRAME_RATE, this._data.frameRate);
70359                  n.scale = i;
70360                  t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? n.type = t.DataParser._getArmatureType(e[t.DataParser.TYPE]) : n.type = s._getNumber(e, t.DataParser.TYPE, 0);
70361                  0 === n.frameRate && (n.frameRate = 24);
70362                  this._armature = n;
70363                  if (t.DataParser.CANVAS in e) {
70364                    var r = e[t.DataParser.CANVAS];
70365                    var o = t.BaseObject.borrowObject(t.CanvasData);
70366                    t.DataParser.COLOR in r ? o.hasBackground = !0 : o.hasBackground = !1;
70367                    o.color = s._getNumber(r, t.DataParser.COLOR, 0);
70368                    o.x = s._getNumber(r, t.DataParser.X, 0) * n.scale;
70369                    o.y = s._getNumber(r, t.DataParser.Y, 0) * n.scale;
70370                    o.width = s._getNumber(r, t.DataParser.WIDTH, 0) * n.scale;
70371                    o.height = s._getNumber(r, t.DataParser.HEIGHT, 0) * n.scale;
70372                    n.canvas = o;
70373                  }
70374                  if (t.DataParser.AABB in e) {
70375                    var a = e[t.DataParser.AABB];
70376                    n.aabb.x = s._getNumber(a, t.DataParser.X, 0) * n.scale;
70377                    n.aabb.y = s._getNumber(a, t.DataParser.Y, 0) * n.scale;
70378                    n.aabb.width = s._getNumber(a, t.DataParser.WIDTH, 0) * n.scale;
70379                    n.aabb.height = s._getNumber(a, t.DataParser.HEIGHT, 0) * n.scale;
70380                  }
70381                  if (t.DataParser.BONE in e) {
70382                    for (var l = 0, h = e[t.DataParser.BONE]; l < h.length; l++) {
70383                      var c = h[l];
70384                      var u = s._getString(c, t.DataParser.PARENT, "");
70385                      var _ = this._parseBone(c);
70386                      if (u.length > 0) {
70387                        var d = n.getBone(u);
70388                        if (null !== d) _.parent = d; else {
70389                          u in this._cacheBones || (this._cacheBones[u] = []);
70390                          this._cacheBones[u].push(_);
70391                        }
70392                      }
70393                      if (_.name in this._cacheBones) {
70394                        for (var p = 0, m = this._cacheBones[_.name]; p < m.length; p++) {
70395                          m[p].parent = _;
70396                        }
70397                        delete this._cacheBones[_.name];
70398                      }
70399                      n.addBone(_);
70400                      this._rawBones.push(_);
70401                    }
70402                  }
70403                  if (t.DataParser.IK in e) {
70404                    for (var f = 0, g = e[t.DataParser.IK]; f < g.length; f++) {
70405                      var y = g[f];
70406                      (I = this._parseIKConstraint(y)) && n.addConstraint(I);
70407                    }
70408                  }
70409                  n.sortBones();
70410                  if (t.DataParser.SLOT in e) {
70411                    var b = 0;
70412                    for (var S = 0, A = e[t.DataParser.SLOT]; S < A.length; S++) {
70413                      var T = A[S];
70414                      n.addSlot(this._parseSlot(T, b++));
70415                    }
70416                  }
70417                  if (t.DataParser.SKIN in e) {
70418                    for (var v = 0, E = e[t.DataParser.SKIN]; v < E.length; v++) {
70419                      var C = E[v];
70420                      n.addSkin(this._parseSkin(C));
70421                    }
70422                  }
70423                  if (t.DataParser.PATH_CONSTRAINT in e) {
70424                    for (var x = 0, w = e[t.DataParser.PATH_CONSTRAINT]; x < w.length; x++) {
70425                      var R = w[x];
70426                      var I;
70427                      (I = this._parsePathConstraint(R)) && n.addConstraint(I);
70428                    }
70429                  }
70430                  for (var M = 0, B = this._cacheRawMeshes.length; M < B; ++M) {
70431                    var D = this._cacheRawMeshes[M];
70432                    t.DataParser.GLUE_WEIGHTS in D && t.DataParser.GLUE_MESHES in D && this._parseMeshGlue(D, this._cacheMeshes[M]);
70433                  }
70434                  for (M = 0, B = this._cacheRawMeshes.length; M < B; ++M) {
70435                    var P = this._cacheRawMeshes[M];
70436                    var O = s._getString(P, t.DataParser.SHARE, "");
70437                    if (0 !== O.length) {
70438                      var N = s._getString(P, t.DataParser.SKIN, t.DataParser.DEFAULT_NAME);
70439                      0 === N.length && (N = t.DataParser.DEFAULT_NAME);
70440                      var L = n.getMesh(N, "", O);
70441                      if (null !== L) {
70442                        this._cacheMeshes[M].vertices.shareFrom(L.vertices);
70443                      }
70444                    }
70445                  }
70446                  if (t.DataParser.ANIMATION in e) {
70447                    for (var F = 0, V = e[t.DataParser.ANIMATION]; F < V.length; F++) {
70448                      var k = V[F];
70449                      var U = this._parseAnimation(k);
70450                      n.addAnimation(U);
70451                    }
70452                  }
70453                  if (t.DataParser.DEFAULT_ACTIONS in e) {
70454                    for (var G = 0, z = this._parseActionData(e[t.DataParser.DEFAULT_ACTIONS], 0, null, null); G < z.length; G++) {
70455                      var H = z[G];
70456                      n.addAction(H, !0);
70457                      if (0 === H.type) {
70458                        null !== (U = n.getAnimation(H.name)) && (n.defaultAnimation = U);
70459                      }
70460                    }
70461                  }
70462                  if (t.DataParser.ACTIONS in e) {
70463                    for (var j = 0, X = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null); j < X.length; j++) {
70464                      H = X[j];
70465                      n.addAction(H, !1);
70466                    }
70467                  }
70468                  this._rawBones.length = 0;
70469                  this._cacheRawMeshes.length = 0;
70470                  this._cacheMeshes.length = 0;
70471                  this._armature = null;
70472                  for (var W in this._weightSlotPose) delete this._weightSlotPose[W];
70473                  for (var W in this._weightBonePoses) delete this._weightBonePoses[W];
70474                  for (var W in this._cacheBones) delete this._cacheBones[W];
70475                  for (var W in this._slotChildActions) delete this._slotChildActions[W];
70476                  return n;
70477                };
70478                s.prototype._parseBone = function(e) {
70479                  var i = this._armature.scale;
70480                  if (0 === (t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? t.DataParser._getBoneType(e[t.DataParser.TYPE]) : s._getNumber(e, t.DataParser.TYPE, 0))) {
70481                    var n = t.BaseObject.borrowObject(t.BoneData);
70482                    n.inheritTranslation = s._getBoolean(e, t.DataParser.INHERIT_TRANSLATION, !0);
70483                    n.inheritRotation = s._getBoolean(e, t.DataParser.INHERIT_ROTATION, !0);
70484                    n.inheritScale = s._getBoolean(e, t.DataParser.INHERIT_SCALE, !0);
70485                    n.inheritReflection = s._getBoolean(e, t.DataParser.INHERIT_REFLECTION, !0);
70486                    n.length = s._getNumber(e, t.DataParser.LENGTH, 0) * i;
70487                    n.name = s._getString(e, t.DataParser.NAME, "");
70488                    t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], n.transform, i);
70489                    return n;
70490                  }
70491                  var r = t.BaseObject.borrowObject(t.SurfaceData);
70492                  r.name = s._getString(e, t.DataParser.NAME, "");
70493                  r.segmentX = s._getNumber(e, t.DataParser.SEGMENT_X, 0);
70494                  r.segmentY = s._getNumber(e, t.DataParser.SEGMENT_Y, 0);
70495                  r.vertices.length = (r.segmentX + 1) * (r.segmentY + 1) * 2;
70496                  if (t.DataParser.VERTICES in e) {
70497                    var o = e[t.DataParser.VERTICES];
70498                    for (var a = 0, l = r.vertices.length; a < l; ++a) a < o.length ? r.vertices[a] = o[a] * i : r.vertices[a] = 0;
70499                  }
70500                  return r;
70501                };
70502                s.prototype._parseIKConstraint = function(e) {
70503                  var i = this._armature.getBone(s._getString(e, t.DataParser.BONE, ""));
70504                  if (null === i) return null;
70505                  var n = this._armature.getBone(s._getString(e, t.DataParser.TARGET, ""));
70506                  if (null === n) return null;
70507                  var r = t.BaseObject.borrowObject(t.IKConstraintData);
70508                  r.scaleEnabled = s._getBoolean(e, t.DataParser.SCALE, !1);
70509                  r.bendPositive = s._getBoolean(e, t.DataParser.BEND_POSITIVE, !0);
70510                  r.weight = s._getNumber(e, t.DataParser.WEIGHT, 1);
70511                  r.name = s._getString(e, t.DataParser.NAME, "");
70512                  r.type = 0;
70513                  r.target = n;
70514                  if (s._getNumber(e, t.DataParser.CHAIN, 0) > 0 && null !== i.parent) {
70515                    r.root = i.parent;
70516                    r.bone = i;
70517                  } else {
70518                    r.root = i;
70519                    r.bone = null;
70520                  }
70521                  return r;
70522                };
70523                s.prototype._parsePathConstraint = function(e) {
70524                  var i = this._armature.getSlot(s._getString(e, t.DataParser.TARGET, ""));
70525                  if (null === i) return null;
70526                  var n = this._armature.defaultSkin;
70527                  if (null === n) return null;
70528                  var r = n.getDisplay(i.name, s._getString(e, t.DataParser.TARGET_DISPLAY, i.name));
70529                  if (null === r || !(r instanceof t.PathDisplayData)) return null;
70530                  var o = e[t.DataParser.BONES];
70531                  if (null === o || 0 === o.length) return null;
70532                  var a = t.BaseObject.borrowObject(t.PathConstraintData);
70533                  a.name = s._getString(e, t.DataParser.NAME, "");
70534                  a.type = 1;
70535                  a.pathSlot = i;
70536                  a.pathDisplayData = r;
70537                  a.target = i.parent;
70538                  a.positionMode = t.DataParser._getPositionMode(s._getString(e, t.DataParser.POSITION_MODE, ""));
70539                  a.spacingMode = t.DataParser._getSpacingMode(s._getString(e, t.DataParser.SPACING_MODE, ""));
70540                  a.rotateMode = t.DataParser._getRotateMode(s._getString(e, t.DataParser.ROTATE_MODE, ""));
70541                  a.position = s._getNumber(e, t.DataParser.POSITION, 0);
70542                  a.spacing = s._getNumber(e, t.DataParser.SPACING, 0);
70543                  a.rotateOffset = s._getNumber(e, t.DataParser.ROTATE_OFFSET, 0);
70544                  a.rotateMix = s._getNumber(e, t.DataParser.ROTATE_MIX, 1);
70545                  a.translateMix = s._getNumber(e, t.DataParser.TRANSLATE_MIX, 1);
70546                  for (var l = 0, h = o; l < h.length; l++) {
70547                    var c = h[l];
70548                    var u = this._armature.getBone(c);
70549                    if (null !== u) {
70550                      a.AddBone(u);
70551                      null === a.root && (a.root = u);
70552                    }
70553                  }
70554                  return a;
70555                };
70556                s.prototype._parseSlot = function(e, i) {
70557                  var n = t.BaseObject.borrowObject(t.SlotData);
70558                  n.displayIndex = s._getNumber(e, t.DataParser.DISPLAY_INDEX, 0);
70559                  n.zOrder = i;
70560                  n.name = s._getString(e, t.DataParser.NAME, "");
70561                  n.parent = this._armature.getBone(s._getString(e, t.DataParser.PARENT, ""));
70562                  t.DataParser.BLEND_MODE in e && "string" == typeof e[t.DataParser.BLEND_MODE] ? n.blendMode = t.DataParser._getBlendMode(e[t.DataParser.BLEND_MODE]) : n.blendMode = s._getNumber(e, t.DataParser.BLEND_MODE, 0);
70563                  if (t.DataParser.COLOR in e) {
70564                    n.color = t.SlotData.createColor();
70565                    this._parseColorTransform(e[t.DataParser.COLOR], n.color);
70566                  } else n.color = t.SlotData.DEFAULT_COLOR;
70567                  t.DataParser.ACTIONS in e && (this._slotChildActions[n.name] = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null));
70568                  return n;
70569                };
70570                s.prototype._parseSkin = function(e) {
70571                  var i = t.BaseObject.borrowObject(t.SkinData);
70572                  i.name = s._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME);
70573                  0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME);
70574                  if (t.DataParser.SLOT in e) {
70575                    var n = e[t.DataParser.SLOT];
70576                    this._skin = i;
70577                    for (var r = 0, o = n; r < o.length; r++) {
70578                      var a = o[r];
70579                      var l = s._getString(a, t.DataParser.NAME, "");
70580                      var h = this._armature.getSlot(l);
70581                      if (null !== h) {
70582                        this._slot = h;
70583                        if (t.DataParser.DISPLAY in a) {
70584                          for (var c = 0, u = a[t.DataParser.DISPLAY]; c < u.length; c++) {
70585                            var _ = u[c];
70586                            _ ? i.addDisplay(l, this._parseDisplay(_)) : i.addDisplay(l, null);
70587                          }
70588                        }
70589                        this._slot = null;
70590                      }
70591                    }
70592                    this._skin = null;
70593                  }
70594                  return i;
70595                };
70596                s.prototype._parseDisplay = function(e) {
70597                  var i = s._getString(e, t.DataParser.NAME, "");
70598                  var n = s._getString(e, t.DataParser.PATH, "");
70599                  var r = 0;
70600                  var o = null;
70601                  switch (r = t.DataParser.TYPE in e && "string" == typeof e[t.DataParser.TYPE] ? t.DataParser._getDisplayType(e[t.DataParser.TYPE]) : s._getNumber(e, t.DataParser.TYPE, r)) {
70602                   case 0:
70603                    var a = o = t.BaseObject.borrowObject(t.ImageDisplayData);
70604                    a.name = i;
70605                    a.path = n.length > 0 ? n : i;
70606                    this._parsePivot(e, a);
70607                    break;
70608
70609                   case 1:
70610                    var l = o = t.BaseObject.borrowObject(t.ArmatureDisplayData);
70611                    l.name = i;
70612                    l.path = n.length > 0 ? n : i;
70613                    l.inheritAnimation = !0;
70614                    if (t.DataParser.ACTIONS in e) {
70615                      for (var h = 0, c = this._parseActionData(e[t.DataParser.ACTIONS], 0, null, null); h < c.length; h++) {
70616                        var u = c[h];
70617                        l.addAction(u);
70618                      }
70619                    } else if (this._slot.name in this._slotChildActions) {
70620                      var _ = this._skin.getDisplays(this._slot.name);
70621                      if (null === _ ? 0 === this._slot.displayIndex : this._slot.displayIndex === _.length) {
70622                        for (var d = 0, p = this._slotChildActions[this._slot.name]; d < p.length; d++) {
70623                          u = p[d];
70624                          l.addAction(u);
70625                        }
70626                        delete this._slotChildActions[this._slot.name];
70627                      }
70628                    }
70629                    break;
70630
70631                   case 2:
70632                    var m = o = t.BaseObject.borrowObject(t.MeshDisplayData);
70633                    m.vertices.inheritDeform = s._getBoolean(e, t.DataParser.INHERIT_DEFORM, !0);
70634                    m.name = i;
70635                    m.path = n.length > 0 ? n : i;
70636                    m.vertices.data = this._data;
70637                    if (t.DataParser.SHARE in e) {
70638                      this._cacheRawMeshes.push(e);
70639                      this._cacheMeshes.push(m);
70640                    } else this._parseMesh(e, m);
70641                    if (t.DataParser.GLUE_WEIGHTS in e && t.DataParser.GLUE_MESHES in e) {
70642                      this._cacheRawMeshes.push(e);
70643                      this._cacheMeshes.push(m);
70644                    }
70645                    break;
70646
70647                   case 3:
70648                    var f = this._parseBoundingBox(e);
70649                    if (null !== f) {
70650                      var g = o = t.BaseObject.borrowObject(t.BoundingBoxDisplayData);
70651                      g.name = i;
70652                      g.path = n.length > 0 ? n : i;
70653                      g.boundingBox = f;
70654                    }
70655                    break;
70656
70657                   case 4:
70658                    var y = e[t.DataParser.LENGTHS];
70659                    var b = o = t.BaseObject.borrowObject(t.PathDisplayData);
70660                    b.closed = s._getBoolean(e, t.DataParser.CLOSED, !1);
70661                    b.constantSpeed = s._getBoolean(e, t.DataParser.CONSTANT_SPEED, !1);
70662                    b.name = i;
70663                    b.path = n.length > 0 ? n : i;
70664                    b.vertices.data = this._data;
70665                    b.curveLengths.length = y.length;
70666                    for (var S = 0, A = y.length; S < A; ++S) b.curveLengths[S] = y[S];
70667                    this._parsePath(e, b);
70668                  }
70669                  null !== o && t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], o.transform, this._armature.scale);
70670                  return o;
70671                };
70672                s.prototype._parsePath = function(e, i) {
70673                  var n = e[t.DataParser.VERTICES];
70674                  var r = s._getNumber(e, t.DataParser.VERTEX_COUNT, 0);
70675                  var o = this._floatArray.length;
70676                  var a = this._intArray.length;
70677                  i.vertices.offset = a;
70678                  this._intArray.length += 2;
70679                  this._intArray[a + 0] = r;
70680                  this._intArray[a + 2] = o;
70681                  if (t.DataParser.WEIGHTS in e) {
70682                    var l = e[t.DataParser.WEIGHTS];
70683                    var h = e[t.DataParser.BONES];
70684                    var c = h.length;
70685                    var u = Math.floor(l.length - r) / 2;
70686                    var _ = this._intArray.length;
70687                    var d = this._floatArray.length;
70688                    var p = this._armature.sortedBones;
70689                    var m = t.BaseObject.borrowObject(t.WeightData);
70690                    m.count = u;
70691                    m.offset = _;
70692                    this._intArray.length += 2 + c + r + u;
70693                    this._intArray[_ + 0] = c;
70694                    this._intArray[_ + 1] = d;
70695                    for (R = 0; R < c; R++) {
70696                      var f = h[R];
70697                      var g = this._rawBones[f];
70698                      m.addBone(g);
70699                      this._intArray[_ + 2 + R] = p.indexOf(g);
70700                    }
70701                    this._floatArray.length += 3 * u;
70702                    R = 0;
70703                    for (var y = 0, b = 0, S = _ + 2 + c, A = d; R < u; R++) {
70704                      var T = l[y++];
70705                      this._intArray[S++] = T;
70706                      for (var v = 0; v < T; v++) {
70707                        var E = l[y++];
70708                        var C = l[y++];
70709                        var x = n[b++];
70710                        var w = n[b++];
70711                        this._intArray[S++] = h.indexOf(E);
70712                        this._floatArray[A++] = C;
70713                        this._floatArray[A++] = x;
70714                        this._floatArray[A++] = w;
70715                      }
70716                    }
70717                    i.vertices.weight = m;
70718                  } else {
70719                    this._floatArray.length += n.length;
70720                    for (var R = 0, I = n.length; R < I; ++R) this._floatArray[o + R] = n[R];
70721                  }
70722                };
70723                s.prototype._parsePivot = function(e, i) {
70724                  if (t.DataParser.PIVOT in e) {
70725                    var n = e[t.DataParser.PIVOT];
70726                    i.pivot.x = s._getNumber(n, t.DataParser.X, 0);
70727                    i.pivot.y = s._getNumber(n, t.DataParser.Y, 0);
70728                  } else {
70729                    i.pivot.x = .5;
70730                    i.pivot.y = .5;
70731                  }
70732                };
70733                s.prototype._parseMesh = function(e, i) {
70734                  var s = e[t.DataParser.VERTICES];
70735                  var n = e[t.DataParser.UVS];
70736                  var r = e[t.DataParser.TRIANGLES];
70737                  var o = Math.floor(s.length / 2);
70738                  var a = Math.floor(r.length / 3);
70739                  var l = this._floatArray.length;
70740                  var h = l + 2 * o;
70741                  var c = this._intArray.length;
70742                  var u = this._skin.name + "_" + this._slot.name + "_" + i.name;
70743                  i.vertices.offset = c;
70744                  this._intArray.length += 4 + 3 * a;
70745                  this._intArray[c + 0] = o;
70746                  this._intArray[c + 1] = a;
70747                  this._intArray[c + 2] = l;
70748                  for (var _ = 0, d = 3 * a; _ < d; ++_) this._intArray[c + 4 + _] = r[_];
70749                  this._floatArray.length += 2 * o + 2 * o;
70750                  for (_ = 0, d = 2 * o; _ < d; ++_) {
70751                    this._floatArray[l + _] = s[_];
70752                    this._floatArray[h + _] = n[_];
70753                  }
70754                  if (t.DataParser.WEIGHTS in e) {
70755                    var p = e[t.DataParser.WEIGHTS];
70756                    var m = e[t.DataParser.SLOT_POSE];
70757                    var f = e[t.DataParser.BONE_POSE];
70758                    var g = this._armature.sortedBones;
70759                    var y = new Array;
70760                    var b = Math.floor(f.length / 7);
70761                    var S = this._floatArray.length;
70762                    var A = Math.floor(p.length - o) / 2;
70763                    var T = this._intArray.length;
70764                    var v = t.BaseObject.borrowObject(t.WeightData);
70765                    v.count = A;
70766                    v.offset = T;
70767                    y.length = b;
70768                    this._intArray.length += 2 + b + o + A;
70769                    this._intArray[T + 1] = S;
70770                    for (_ = 0; _ < b; ++_) {
70771                      var E = f[7 * _];
70772                      var C = this._rawBones[E];
70773                      v.addBone(C);
70774                      y[_] = E;
70775                      this._intArray[T + 2 + _] = g.indexOf(C);
70776                    }
70777                    this._floatArray.length += 3 * A;
70778                    this._helpMatrixA.copyFromArray(m, 0);
70779                    _ = 0;
70780                    for (var x = 0, w = T + 2 + b, R = S; _ < o; ++_) {
70781                      var I = 2 * _;
70782                      var M = this._intArray[w++] = p[x++];
70783                      var B = this._floatArray[l + I];
70784                      var D = this._floatArray[l + I + 1];
70785                      this._helpMatrixA.transformPoint(B, D, this._helpPoint);
70786                      B = this._helpPoint.x;
70787                      D = this._helpPoint.y;
70788                      for (var P = 0; P < M; ++P) {
70789                        E = p[x++];
70790                        var O = y.indexOf(E);
70791                        this._helpMatrixB.copyFromArray(f, 7 * O + 1);
70792                        this._helpMatrixB.invert();
70793                        this._helpMatrixB.transformPoint(B, D, this._helpPoint);
70794                        this._intArray[w++] = O;
70795                        this._floatArray[R++] = p[x++];
70796                        this._floatArray[R++] = this._helpPoint.x;
70797                        this._floatArray[R++] = this._helpPoint.y;
70798                      }
70799                    }
70800                    i.vertices.weight = v;
70801                    this._weightSlotPose[u] = m;
70802                    this._weightBonePoses[u] = f;
70803                  }
70804                };
70805                s.prototype._parseMeshGlue = function(t, e) {};
70806                s.prototype._parseBoundingBox = function(e) {
70807                  var i = null;
70808                  var n = 0;
70809                  switch (n = t.DataParser.SUB_TYPE in e && "string" == typeof e[t.DataParser.SUB_TYPE] ? t.DataParser._getBoundingBoxType(e[t.DataParser.SUB_TYPE]) : s._getNumber(e, t.DataParser.SUB_TYPE, n)) {
70810                   case 0:
70811                    i = t.BaseObject.borrowObject(t.RectangleBoundingBoxData);
70812                    break;
70813
70814                   case 1:
70815                    i = t.BaseObject.borrowObject(t.EllipseBoundingBoxData);
70816                    break;
70817
70818                   case 2:
70819                    i = this._parsePolygonBoundingBox(e);
70820                  }
70821                  if (null !== i) {
70822                    i.color = s._getNumber(e, t.DataParser.COLOR, 0);
70823                    if (0 === i.type || 1 === i.type) {
70824                      i.width = s._getNumber(e, t.DataParser.WIDTH, 0);
70825                      i.height = s._getNumber(e, t.DataParser.HEIGHT, 0);
70826                    }
70827                  }
70828                  return i;
70829                };
70830                s.prototype._parsePolygonBoundingBox = function(e) {
70831                  var i = t.BaseObject.borrowObject(t.PolygonBoundingBoxData);
70832                  if (t.DataParser.VERTICES in e) {
70833                    var s = this._armature.scale;
70834                    var n = e[t.DataParser.VERTICES];
70835                    var r = i.vertices;
70836                    t.DragonBones.webAssembly ? r.resize(n.length, 0) : r.length = n.length;
70837                    for (var o = 0, a = n.length; o < a; o += 2) {
70838                      var l = n[o] * s;
70839                      var h = n[o + 1] * s;
70840                      if (t.DragonBones.webAssembly) {
70841                        r.set(o, l);
70842                        r.set(o + 1, h);
70843                      } else {
70844                        r[o] = l;
70845                        r[o + 1] = h;
70846                      }
70847                      if (0 === o) {
70848                        i.x = l;
70849                        i.y = h;
70850                        i.width = l;
70851                        i.height = h;
70852                      } else {
70853                        l < i.x ? i.x = l : l > i.width && (i.width = l);
70854                        h < i.y ? i.y = h : h > i.height && (i.height = h);
70855                      }
70856                    }
70857                    i.width -= i.x;
70858                    i.height -= i.y;
70859                  } else console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.");
70860                  return i;
70861                };
70862                s.prototype._parseAnimation = function(e) {
70863                  var i = t.BaseObject.borrowObject(t.AnimationData);
70864                  i.frameCount = Math.max(s._getNumber(e, t.DataParser.DURATION, 1), 1);
70865                  i.playTimes = s._getNumber(e, t.DataParser.PLAY_TIMES, 1);
70866                  i.duration = i.frameCount / this._armature.frameRate;
70867                  i.fadeInTime = s._getNumber(e, t.DataParser.FADE_IN_TIME, 0);
70868                  i.scale = s._getNumber(e, t.DataParser.SCALE, 1);
70869                  i.name = s._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME);
70870                  0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME);
70871                  i.frameIntOffset = this._frameIntArray.length;
70872                  i.frameFloatOffset = this._frameFloatArray.length;
70873                  i.frameOffset = this._frameArray.length;
70874                  this._animation = i;
70875                  if (t.DataParser.FRAME in e) {
70876                    var n = e[t.DataParser.FRAME];
70877                    var r = n.length;
70878                    if (r > 0) for (var o = 0, a = 0; o < r; ++o) {
70879                      var l = n[o];
70880                      this._parseActionDataInFrame(l, a, null, null);
70881                      a += s._getNumber(l, t.DataParser.DURATION, 1);
70882                    }
70883                  }
70884                  t.DataParser.Z_ORDER in e && (this._animation.zOrderTimeline = this._parseTimeline(e[t.DataParser.Z_ORDER], null, t.DataParser.FRAME, 1, !1, !1, 0, this._parseZOrderFrame));
70885                  if (t.DataParser.BONE in e) {
70886                    for (var h = 0, c = e[t.DataParser.BONE]; h < c.length; h++) {
70887                      var u = c[h];
70888                      this._parseBoneTimeline(u);
70889                    }
70890                  }
70891                  if (t.DataParser.SURFACE in e) {
70892                    for (var _ = 0, d = e[t.DataParser.SURFACE]; _ < d.length; _++) {
70893                      u = d[_];
70894                      var p = s._getString(u, t.DataParser.NAME, "");
70895                      this._surface = this._armature.getBone(p);
70896                      if (null !== this._surface) {
70897                        null !== (I = this._parseTimeline(u, null, t.DataParser.FRAME, 50, !1, !0, 0, this._parseSurfaceFrame)) && this._animation.addSurfaceTimeline(this._surface, I);
70898                        this._surface = null;
70899                      }
70900                    }
70901                  }
70902                  if (t.DataParser.SLOT in e) {
70903                    for (var m = 0, f = e[t.DataParser.SLOT]; m < f.length; m++) {
70904                      u = f[m];
70905                      this._parseSlotTimeline(u);
70906                    }
70907                  }
70908                  if (t.DataParser.FFD in e) {
70909                    for (var g = 0, y = e[t.DataParser.FFD]; g < y.length; g++) {
70910                      u = y[g];
70911                      var b = s._getString(u, t.DataParser.SKIN, t.DataParser.DEFAULT_NAME);
70912                      var S = s._getString(u, t.DataParser.SLOT, "");
70913                      var A = s._getString(u, t.DataParser.NAME, "");
70914                      0 === b.length && (b = t.DataParser.DEFAULT_NAME);
70915                      this._slot = this._armature.getSlot(S);
70916                      this._mesh = this._armature.getMesh(b, S, A);
70917                      if (null !== this._slot && null !== this._mesh) {
70918                        null !== (I = this._parseTimeline(u, null, t.DataParser.FRAME, 22, !1, !0, 0, this._parseSlotFFDFrame)) && this._animation.addSlotTimeline(this._slot, I);
70919                        this._slot = null;
70920                        this._mesh = null;
70921                      }
70922                    }
70923                  }
70924                  if (t.DataParser.IK in e) {
70925                    for (var T = 0, v = e[t.DataParser.IK]; T < v.length; T++) {
70926                      u = v[T];
70927                      var E = s._getString(u, t.DataParser.NAME, "");
70928                      var C = this._armature.getConstraint(E);
70929                      if (null !== C) {
70930                        null !== (I = this._parseTimeline(u, null, t.DataParser.FRAME, 30, !0, !1, 2, this._parseIKConstraintFrame)) && this._animation.addConstraintTimeline(C, I);
70931                      }
70932                    }
70933                  }
70934                  if (t.DataParser.ANIMATION in e) {
70935                    for (var x = 0, w = e[t.DataParser.ANIMATION]; x < w.length; x++) {
70936                      u = w[x];
70937                      var R = s._getString(u, t.DataParser.NAME, "");
70938                      var I;
70939                      null !== (I = this._parseTimeline(u, null, t.DataParser.FRAME, 40, !0, !1, 2, this._parseAnimationFrame)) && this._animation.addAnimationTimeline(R, I);
70940                    }
70941                  }
70942                  if (this._actionFrames.length > 0) {
70943                    this._animation.actionTimeline = this._parseTimeline(null, this._actionFrames, "", 0, !1, !1, 0, this._parseActionFrame);
70944                    this._actionFrames.length = 0;
70945                  }
70946                  this._animation = null;
70947                  return i;
70948                };
70949                s.prototype._parseTimeline = function(e, n, r, o, a, l, h, c) {
70950                  null !== e && r.length > 0 && r in e && (n = e[r]);
70951                  if (null === n) return null;
70952                  var u = n.length;
70953                  if (0 === u) return null;
70954                  var _ = this._frameIntArray.length;
70955                  var d = this._frameFloatArray.length;
70956                  var p = t.BaseObject.borrowObject(t.TimelineData);
70957                  var m = this._timelineArray.length;
70958                  this._timelineArray.length += 5 + u;
70959                  if (null !== e) {
70960                    this._timelineArray[m + 0] = Math.round(100 * s._getNumber(e, t.DataParser.SCALE, 1));
70961                    this._timelineArray[m + 1] = Math.round(100 * s._getNumber(e, t.DataParser.OFFSET, 0));
70962                  } else {
70963                    this._timelineArray[m + 0] = 100;
70964                    this._timelineArray[m + 1] = 0;
70965                  }
70966                  this._timelineArray[m + 2] = u;
70967                  this._timelineArray[m + 3] = h;
70968                  this._timelineArray[m + 4] = a ? _ - this._animation.frameIntOffset : l ? d - this._animation.frameFloatOffset : 0;
70969                  this._timeline = p;
70970                  p.type = o;
70971                  p.offset = m;
70972                  if (1 === u) {
70973                    p.frameIndicesOffset = -1;
70974                    this._timelineArray[m + 5 + 0] = c.call(this, n[0], 0, 0) - this._animation.frameOffset;
70975                  } else {
70976                    var f = this._animation.frameCount + 1;
70977                    var g = this._data.frameIndices;
70978                    var y = 0;
70979                    if (t.DragonBones.webAssembly) {
70980                      y = g.size();
70981                      g.resize(y + f, 0);
70982                    } else {
70983                      y = g.length;
70984                      g.length += f;
70985                    }
70986                    p.frameIndicesOffset = y;
70987                    for (var b = 0, S = 0, A = 0, T = 0; b < f; ++b) {
70988                      if (A + T <= b && S < u) {
70989                        var v = n[S];
70990                        A = b;
70991                        T = S === u - 1 ? this._animation.frameCount - A : v instanceof i ? this._actionFrames[S + 1].frameStart - A : s._getNumber(v, t.DataParser.DURATION, 1);
70992                        this._timelineArray[m + 5 + S] = c.call(this, v, A, T) - this._animation.frameOffset;
70993                        S++;
70994                      }
70995                      t.DragonBones.webAssembly ? g.set(y + b, S - 1) : g[y + b] = S - 1;
70996                    }
70997                  }
70998                  this._timeline = null;
70999                  return p;
71000                };
71001                s.prototype._parseBoneTimeline = function(e) {
71002                  var i = this._armature.getBone(s._getString(e, t.DataParser.NAME, ""));
71003                  if (null !== i) {
71004                    this._bone = i;
71005                    this._slot = this._armature.getSlot(this._bone.name);
71006                    if (t.DataParser.TRANSLATE_FRAME in e) {
71007                      null !== (n = this._parseTimeline(e, null, t.DataParser.TRANSLATE_FRAME, 11, !1, !0, 2, this._parseBoneTranslateFrame)) && this._animation.addBoneTimeline(i, n);
71008                    }
71009                    if (t.DataParser.ROTATE_FRAME in e) {
71010                      null !== (n = this._parseTimeline(e, null, t.DataParser.ROTATE_FRAME, 12, !1, !0, 2, this._parseBoneRotateFrame)) && this._animation.addBoneTimeline(i, n);
71011                    }
71012                    if (t.DataParser.SCALE_FRAME in e) {
71013                      null !== (n = this._parseTimeline(e, null, t.DataParser.SCALE_FRAME, 13, !1, !0, 2, this._parseBoneScaleFrame)) && this._animation.addBoneTimeline(i, n);
71014                    }
71015                    if (t.DataParser.FRAME in e) {
71016                      var n;
71017                      null !== (n = this._parseTimeline(e, null, t.DataParser.FRAME, 10, !1, !0, 6, this._parseBoneAllFrame)) && this._animation.addBoneTimeline(i, n);
71018                    }
71019                    this._bone = null;
71020                    this._slot = null;
71021                  }
71022                };
71023                s.prototype._parseSlotTimeline = function(e) {
71024                  var i = this._armature.getSlot(s._getString(e, t.DataParser.NAME, ""));
71025                  if (null !== i) {
71026                    this._slot = i;
71027                    var n = null;
71028                    null !== (n = t.DataParser.DISPLAY_FRAME in e ? this._parseTimeline(e, null, t.DataParser.DISPLAY_FRAME, 20, !1, !1, 0, this._parseSlotDisplayFrame) : this._parseTimeline(e, null, t.DataParser.FRAME, 20, !1, !1, 0, this._parseSlotDisplayFrame)) && this._animation.addSlotTimeline(i, n);
71029                    var r = null;
71030                    null !== (r = t.DataParser.COLOR_FRAME in e ? this._parseTimeline(e, null, t.DataParser.COLOR_FRAME, 21, !0, !1, 1, this._parseSlotColorFrame) : this._parseTimeline(e, null, t.DataParser.FRAME, 21, !0, !1, 1, this._parseSlotColorFrame)) && this._animation.addSlotTimeline(i, r);
71031                    this._slot = null;
71032                  }
71033                };
71034                s.prototype._parseFrame = function(t, e, i) {
71035                  var s = this._frameArray.length;
71036                  this._frameArray.length += 1;
71037                  this._frameArray[s + 0] = e;
71038                  return s;
71039                };
71040                s.prototype._parseTweenFrame = function(e, i, n) {
71041                  var r = this._parseFrame(e, i, n);
71042                  if (n > 0) if (t.DataParser.CURVE in e) {
71043                    var o = n + 1;
71044                    this._helpArray.length = o;
71045                    this._samplingEasingCurve(e[t.DataParser.CURVE], this._helpArray);
71046                    this._frameArray.length += 2 + this._helpArray.length;
71047                    this._frameArray[r + 1] = 2;
71048                    this._frameArray[r + 2] = o;
71049                    for (var a = 0; a < o; ++a) this._frameArray[r + 3 + a] = Math.round(1e4 * this._helpArray[a]);
71050                  } else {
71051                    var l = -2;
71052                    t.DataParser.TWEEN_EASING in e && (l = s._getNumber(e, t.DataParser.TWEEN_EASING, -2));
71053                    if (-2 === l) {
71054                      this._frameArray.length += 1;
71055                      this._frameArray[r + 1] = 0;
71056                    } else if (0 === l) {
71057                      this._frameArray.length += 1;
71058                      this._frameArray[r + 1] = 1;
71059                    } else if (l < 0) {
71060                      this._frameArray.length += 2;
71061                      this._frameArray[r + 1] = 3;
71062                      this._frameArray[r + 2] = Math.round(100 * -l);
71063                    } else if (l <= 1) {
71064                      this._frameArray.length += 2;
71065                      this._frameArray[r + 1] = 4;
71066                      this._frameArray[r + 2] = Math.round(100 * l);
71067                    } else {
71068                      this._frameArray.length += 2;
71069                      this._frameArray[r + 1] = 5;
71070                      this._frameArray[r + 2] = Math.round(100 * l - 100);
71071                    }
71072                  } else {
71073                    this._frameArray.length += 1;
71074                    this._frameArray[r + 1] = 0;
71075                  }
71076                  return r;
71077                };
71078                s.prototype._parseActionFrame = function(t, e, i) {
71079                  var s = this._frameArray.length;
71080                  var n = t.actions.length;
71081                  this._frameArray.length += 2 + n;
71082                  this._frameArray[s + 0] = e;
71083                  this._frameArray[s + 0 + 1] = n;
71084                  for (var r = 0; r < n; ++r) this._frameArray[s + 0 + 2 + r] = t.actions[r];
71085                  return s;
71086                };
71087                s.prototype._parseZOrderFrame = function(e, i, s) {
71088                  var n = this._parseFrame(e, i, s);
71089                  if (t.DataParser.Z_ORDER in e) {
71090                    var r = e[t.DataParser.Z_ORDER];
71091                    if (r.length > 0) {
71092                      var o = this._armature.sortedSlots.length;
71093                      var a = new Array(o - r.length / 2);
71094                      var l = new Array(o);
71095                      for (var h = 0; h < a.length; ++h) a[h] = 0;
71096                      for (var c = 0; c < o; ++c) l[c] = -1;
71097                      var u = 0;
71098                      var _ = 0;
71099                      for (var d = 0, p = r.length; d < p; d += 2) {
71100                        var m = r[d];
71101                        var f = r[d + 1];
71102                        for (;u !== m; ) a[_++] = u++;
71103                        l[u + f] = u++;
71104                      }
71105                      for (;u < o; ) a[_++] = u++;
71106                      this._frameArray.length += 1 + o;
71107                      this._frameArray[n + 1] = o;
71108                      var g = o;
71109                      for (;g--; ) -1 === l[g] ? this._frameArray[n + 2 + g] = a[--_] || 0 : this._frameArray[n + 2 + g] = l[g] || 0;
71110                      return n;
71111                    }
71112                  }
71113                  this._frameArray.length += 1;
71114                  this._frameArray[n + 1] = 0;
71115                  return n;
71116                };
71117                s.prototype._parseBoneAllFrame = function(e, i, n) {
71118                  this._helpTransform.identity();
71119                  t.DataParser.TRANSFORM in e && this._parseTransform(e[t.DataParser.TRANSFORM], this._helpTransform, 1);
71120                  var r = this._helpTransform.rotation;
71121                  if (0 !== i) if (0 === this._prevClockwise) r = this._prevRotation + t.Transform.normalizeRadian(r - this._prevRotation); else {
71122                    (this._prevClockwise > 0 ? r >= this._prevRotation : r <= this._prevRotation) && (this._prevClockwise = this._prevClockwise > 0 ? this._prevClockwise - 1 : this._prevClockwise + 1);
71123                    r = this._prevRotation + r - this._prevRotation + t.Transform.PI_D * this._prevClockwise;
71124                  }
71125                  this._prevClockwise = s._getNumber(e, t.DataParser.TWEEN_ROTATE, 0);
71126                  this._prevRotation = r;
71127                  var o = this._parseTweenFrame(e, i, n);
71128                  var a = this._frameFloatArray.length;
71129                  this._frameFloatArray.length += 6;
71130                  this._frameFloatArray[a++] = this._helpTransform.x;
71131                  this._frameFloatArray[a++] = this._helpTransform.y;
71132                  this._frameFloatArray[a++] = r;
71133                  this._frameFloatArray[a++] = this._helpTransform.skew;
71134                  this._frameFloatArray[a++] = this._helpTransform.scaleX;
71135                  this._frameFloatArray[a++] = this._helpTransform.scaleY;
71136                  this._parseActionDataInFrame(e, i, this._bone, this._slot);
71137                  return o;
71138                };
71139                s.prototype._parseBoneTranslateFrame = function(e, i, n) {
71140                  var r = this._parseTweenFrame(e, i, n);
71141                  var o = this._frameFloatArray.length;
71142                  this._frameFloatArray.length += 2;
71143                  this._frameFloatArray[o++] = s._getNumber(e, t.DataParser.X, 0);
71144                  this._frameFloatArray[o++] = s._getNumber(e, t.DataParser.Y, 0);
71145                  return r;
71146                };
71147                s.prototype._parseBoneRotateFrame = function(e, i, n) {
71148                  var r = s._getNumber(e, t.DataParser.ROTATE, 0) * t.Transform.DEG_RAD;
71149                  if (0 !== i) if (0 === this._prevClockwise) r = this._prevRotation + t.Transform.normalizeRadian(r - this._prevRotation); else {
71150                    (this._prevClockwise > 0 ? r >= this._prevRotation : r <= this._prevRotation) && (this._prevClockwise = this._prevClockwise > 0 ? this._prevClockwise - 1 : this._prevClockwise + 1);
71151                    r = this._prevRotation + r - this._prevRotation + t.Transform.PI_D * this._prevClockwise;
71152                  }
71153                  this._prevClockwise = s._getNumber(e, t.DataParser.CLOCK_WISE, 0);
71154                  this._prevRotation = r;
71155                  var o = this._parseTweenFrame(e, i, n);
71156                  var a = this._frameFloatArray.length;
71157                  this._frameFloatArray.length += 2;
71158                  this._frameFloatArray[a++] = r;
71159                  this._frameFloatArray[a++] = s._getNumber(e, t.DataParser.SKEW, 0) * t.Transform.DEG_RAD;
71160                  return o;
71161                };
71162                s.prototype._parseBoneScaleFrame = function(e, i, n) {
71163                  var r = this._parseTweenFrame(e, i, n);
71164                  var o = this._frameFloatArray.length;
71165                  this._frameFloatArray.length += 2;
71166                  this._frameFloatArray[o++] = s._getNumber(e, t.DataParser.X, 1);
71167                  this._frameFloatArray[o++] = s._getNumber(e, t.DataParser.Y, 1);
71168                  return r;
71169                };
71170                s.prototype._parseSurfaceFrame = function(e, i, n) {
71171                  var r = this._frameFloatArray.length;
71172                  var o = this._parseTweenFrame(e, i, n);
71173                  var a = e[t.DataParser.VERTICES];
71174                  var l = s._getNumber(e, t.DataParser.OFFSET, 0);
71175                  var h = this._surface.vertices.length / 2;
71176                  var c = 0;
71177                  var u = 0;
71178                  this._frameFloatArray.length += 2 * h;
71179                  for (var _ = 0; _ < 2 * h; _ += 2) {
71180                    c = _ < l || _ - l >= a.length ? 0 : a[_ - l];
71181                    u = _ + 1 < l || _ + 1 - l >= a.length ? 0 : a[_ + 1 - l];
71182                    this._frameFloatArray[r + _] = c;
71183                    this._frameFloatArray[r + _ + 1] = u;
71184                  }
71185                  if (0 === i) {
71186                    var d = this._frameIntArray.length;
71187                    this._frameIntArray.length += 5;
71188                    this._frameIntArray[d + 0] = 0;
71189                    this._frameIntArray[d + 1] = this._frameFloatArray.length - r;
71190                    this._frameIntArray[d + 2] = this._frameFloatArray.length - r;
71191                    this._frameIntArray[d + 3] = 0;
71192                    this._frameIntArray[d + 4] = r - this._animation.frameFloatOffset;
71193                    this._timelineArray[this._timeline.offset + 3] = d - this._animation.frameIntOffset;
71194                  }
71195                  return o;
71196                };
71197                s.prototype._parseSlotDisplayFrame = function(e, i, n) {
71198                  var r = this._parseFrame(e, i, n);
71199                  this._frameArray.length += 1;
71200                  t.DataParser.VALUE in e ? this._frameArray[r + 1] = s._getNumber(e, t.DataParser.VALUE, 0) : this._frameArray[r + 1] = s._getNumber(e, t.DataParser.DISPLAY_INDEX, 0);
71201                  this._parseActionDataInFrame(e, i, this._slot.parent, this._slot);
71202                  return r;
71203                };
71204                s.prototype._parseSlotColorFrame = function(e, i, s) {
71205                  var n = this._parseTweenFrame(e, i, s);
71206                  var r = -1;
71207                  if (t.DataParser.VALUE in e || t.DataParser.COLOR in e) {
71208                    var o = t.DataParser.VALUE in e ? e[t.DataParser.VALUE] : e[t.DataParser.COLOR];
71209                    for (var a in o) {
71210                      this._parseColorTransform(o, this._helpColorTransform);
71211                      r = this._intArray.length;
71212                      this._intArray.length += 8;
71213                      this._intArray[r++] = Math.round(100 * this._helpColorTransform.alphaMultiplier);
71214                      this._intArray[r++] = Math.round(100 * this._helpColorTransform.redMultiplier);
71215                      this._intArray[r++] = Math.round(100 * this._helpColorTransform.greenMultiplier);
71216                      this._intArray[r++] = Math.round(100 * this._helpColorTransform.blueMultiplier);
71217                      this._intArray[r++] = Math.round(this._helpColorTransform.alphaOffset);
71218                      this._intArray[r++] = Math.round(this._helpColorTransform.redOffset);
71219                      this._intArray[r++] = Math.round(this._helpColorTransform.greenOffset);
71220                      this._intArray[r++] = Math.round(this._helpColorTransform.blueOffset);
71221                      r -= 8;
71222                      break;
71223                    }
71224                  }
71225                  if (r < 0) {
71226                    if (this._defaultColorOffset < 0) {
71227                      this._defaultColorOffset = r = this._intArray.length;
71228                      this._intArray.length += 8;
71229                      this._intArray[r++] = 100;
71230                      this._intArray[r++] = 100;
71231                      this._intArray[r++] = 100;
71232                      this._intArray[r++] = 100;
71233                      this._intArray[r++] = 0;
71234                      this._intArray[r++] = 0;
71235                      this._intArray[r++] = 0;
71236                      this._intArray[r++] = 0;
71237                    }
71238                    r = this._defaultColorOffset;
71239                  }
71240                  var l = this._frameIntArray.length;
71241                  this._frameIntArray.length += 1;
71242                  this._frameIntArray[l] = r;
71243                  return n;
71244                };
71245                s.prototype._parseSlotFFDFrame = function(e, i, n) {
71246                  var r = this._frameFloatArray.length;
71247                  var o = this._parseTweenFrame(e, i, n);
71248                  var a = t.DataParser.VERTICES in e ? e[t.DataParser.VERTICES] : null;
71249                  var l = s._getNumber(e, t.DataParser.OFFSET, 0);
71250                  var h = this._intArray[this._mesh.vertices.offset + 0];
71251                  var c = this._mesh.parent.name + "_" + this._slot.name + "_" + this._mesh.name;
71252                  var u = this._mesh.vertices.weight;
71253                  var _ = 0;
71254                  var d = 0;
71255                  var p = 0;
71256                  var m = 0;
71257                  if (null !== u) {
71258                    var f = this._weightSlotPose[c];
71259                    this._helpMatrixA.copyFromArray(f, 0);
71260                    this._frameFloatArray.length += 2 * u.count;
71261                    p = u.offset + 2 + u.bones.length;
71262                  } else this._frameFloatArray.length += 2 * h;
71263                  for (var g = 0; g < 2 * h; g += 2) {
71264                    if (null === a) {
71265                      _ = 0;
71266                      d = 0;
71267                    } else {
71268                      _ = g < l || g - l >= a.length ? 0 : a[g - l];
71269                      d = g + 1 < l || g + 1 - l >= a.length ? 0 : a[g + 1 - l];
71270                    }
71271                    if (null !== u) {
71272                      var y = this._weightBonePoses[c];
71273                      var b = this._intArray[p++];
71274                      this._helpMatrixA.transformPoint(_, d, this._helpPoint, !0);
71275                      _ = this._helpPoint.x;
71276                      d = this._helpPoint.y;
71277                      for (var S = 0; S < b; ++S) {
71278                        var A = this._intArray[p++];
71279                        this._helpMatrixB.copyFromArray(y, 7 * A + 1);
71280                        this._helpMatrixB.invert();
71281                        this._helpMatrixB.transformPoint(_, d, this._helpPoint, !0);
71282                        this._frameFloatArray[r + m++] = this._helpPoint.x;
71283                        this._frameFloatArray[r + m++] = this._helpPoint.y;
71284                      }
71285                    } else {
71286                      this._frameFloatArray[r + g] = _;
71287                      this._frameFloatArray[r + g + 1] = d;
71288                    }
71289                  }
71290                  if (0 === i) {
71291                    var T = this._frameIntArray.length;
71292                    this._frameIntArray.length += 5;
71293                    this._frameIntArray[T + 0] = this._mesh.vertices.offset;
71294                    this._frameIntArray[T + 1] = this._frameFloatArray.length - r;
71295                    this._frameIntArray[T + 2] = this._frameFloatArray.length - r;
71296                    this._frameIntArray[T + 3] = 0;
71297                    this._frameIntArray[T + 4] = r - this._animation.frameFloatOffset;
71298                    this._timelineArray[this._timeline.offset + 3] = T - this._animation.frameIntOffset;
71299                  }
71300                  return o;
71301                };
71302                s.prototype._parseIKConstraintFrame = function(e, i, n) {
71303                  var r = this._parseTweenFrame(e, i, n);
71304                  var o = this._frameIntArray.length;
71305                  this._frameIntArray.length += 2;
71306                  this._frameIntArray[o++] = s._getBoolean(e, t.DataParser.BEND_POSITIVE, !0) ? 1 : 0;
71307                  this._frameIntArray[o++] = Math.round(100 * s._getNumber(e, t.DataParser.WEIGHT, 1));
71308                  return r;
71309                };
71310                s.prototype._parseAnimationFrame = function(e, i, n) {
71311                  var r = this._parseTweenFrame(e, i, n);
71312                  var o = this._frameIntArray.length;
71313                  this._frameIntArray.length += 2;
71314                  this._frameIntArray[o++] = s._getNumber(e, t.DataParser.VALUE, 0);
71315                  this._frameIntArray[o++] = Math.round(100 * s._getNumber(e, t.DataParser.WEIGHT, 1));
71316                  return r;
71317                };
71318                s.prototype._parseActionData = function(e, i, n, r) {
71319                  var o = new Array;
71320                  if ("string" == typeof e) {
71321                    (c = t.BaseObject.borrowObject(t.ActionData)).type = i;
71322                    c.name = e;
71323                    c.bone = n;
71324                    c.slot = r;
71325                    o.push(c);
71326                  } else if (e instanceof Array) for (var a = 0, l = e; a < l.length; a++) {
71327                    var h = l[a];
71328                    var c = t.BaseObject.borrowObject(t.ActionData);
71329                    if (t.DataParser.GOTO_AND_PLAY in h) {
71330                      c.type = 0;
71331                      c.name = s._getString(h, t.DataParser.GOTO_AND_PLAY, "");
71332                    } else {
71333                      t.DataParser.TYPE in h && "string" == typeof h[t.DataParser.TYPE] ? c.type = t.DataParser._getActionType(h[t.DataParser.TYPE]) : c.type = s._getNumber(h, t.DataParser.TYPE, i);
71334                      c.name = s._getString(h, t.DataParser.NAME, "");
71335                    }
71336                    if (t.DataParser.BONE in h) {
71337                      var u = s._getString(h, t.DataParser.BONE, "");
71338                      c.bone = this._armature.getBone(u);
71339                    } else c.bone = n;
71340                    if (t.DataParser.SLOT in h) {
71341                      var _ = s._getString(h, t.DataParser.SLOT, "");
71342                      c.slot = this._armature.getSlot(_);
71343                    } else c.slot = r;
71344                    var d = null;
71345                    if (t.DataParser.INTS in h) {
71346                      null === d && (d = t.BaseObject.borrowObject(t.UserData));
71347                      for (var p = 0, m = h[t.DataParser.INTS]; p < m.length; p++) {
71348                        var f = m[p];
71349                        d.addInt(f);
71350                      }
71351                    }
71352                    if (t.DataParser.FLOATS in h) {
71353                      null === d && (d = t.BaseObject.borrowObject(t.UserData));
71354                      for (var g = 0, y = h[t.DataParser.FLOATS]; g < y.length; g++) {
71355                        f = y[g];
71356                        d.addFloat(f);
71357                      }
71358                    }
71359                    if (t.DataParser.STRINGS in h) {
71360                      null === d && (d = t.BaseObject.borrowObject(t.UserData));
71361                      for (var b = 0, S = h[t.DataParser.STRINGS]; b < S.length; b++) {
71362                        f = S[b];
71363                        d.addString(f);
71364                      }
71365                    }
71366                    c.data = d;
71367                    o.push(c);
71368                  }
71369                  return o;
71370                };
71371                s.prototype._parseTransform = function(e, i, n) {
71372                  i.x = s._getNumber(e, t.DataParser.X, 0) * n;
71373                  i.y = s._getNumber(e, t.DataParser.Y, 0) * n;
71374                  if (t.DataParser.ROTATE in e || t.DataParser.SKEW in e) {
71375                    i.rotation = t.Transform.normalizeRadian(s._getNumber(e, t.DataParser.ROTATE, 0) * t.Transform.DEG_RAD);
71376                    i.skew = t.Transform.normalizeRadian(s._getNumber(e, t.DataParser.SKEW, 0) * t.Transform.DEG_RAD);
71377                  } else if (t.DataParser.SKEW_X in e || t.DataParser.SKEW_Y in e) {
71378                    i.rotation = t.Transform.normalizeRadian(s._getNumber(e, t.DataParser.SKEW_Y, 0) * t.Transform.DEG_RAD);
71379                    i.skew = t.Transform.normalizeRadian(s._getNumber(e, t.DataParser.SKEW_X, 0) * t.Transform.DEG_RAD) - i.rotation;
71380                  }
71381                  i.scaleX = s._getNumber(e, t.DataParser.SCALE_X, 1);
71382                  i.scaleY = s._getNumber(e, t.DataParser.SCALE_Y, 1);
71383                };
71384                s.prototype._parseColorTransform = function(e, i) {
71385                  i.alphaMultiplier = .01 * s._getNumber(e, t.DataParser.ALPHA_MULTIPLIER, 100);
71386                  i.redMultiplier = .01 * s._getNumber(e, t.DataParser.RED_MULTIPLIER, 100);
71387                  i.greenMultiplier = .01 * s._getNumber(e, t.DataParser.GREEN_MULTIPLIER, 100);
71388                  i.blueMultiplier = .01 * s._getNumber(e, t.DataParser.BLUE_MULTIPLIER, 100);
71389                  i.alphaOffset = s._getNumber(e, t.DataParser.ALPHA_OFFSET, 0);
71390                  i.redOffset = s._getNumber(e, t.DataParser.RED_OFFSET, 0);
71391                  i.greenOffset = s._getNumber(e, t.DataParser.GREEN_OFFSET, 0);
71392                  i.blueOffset = s._getNumber(e, t.DataParser.BLUE_OFFSET, 0);
71393                };
71394                s.prototype._parseArray = function(t) {
71395                  this._intArray.length = 0;
71396                  this._floatArray.length = 0;
71397                  this._frameIntArray.length = 0;
71398                  this._frameFloatArray.length = 0;
71399                  this._frameArray.length = 0;
71400                  this._timelineArray.length = 0;
71401                };
71402                s.prototype._modifyArray = function() {
71403                  this._intArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._intArray.push(0);
71404                  this._frameIntArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._frameIntArray.push(0);
71405                  this._frameArray.length % Int16Array.BYTES_PER_ELEMENT != 0 && this._frameArray.push(0);
71406                  this._timelineArray.length % Uint16Array.BYTES_PER_ELEMENT != 0 && this._timelineArray.push(0);
71407                  var e = this._intArray.length * Int16Array.BYTES_PER_ELEMENT;
71408                  var i = this._floatArray.length * Float32Array.BYTES_PER_ELEMENT;
71409                  var s = this._frameIntArray.length * Int16Array.BYTES_PER_ELEMENT;
71410                  var n = this._frameFloatArray.length * Float32Array.BYTES_PER_ELEMENT;
71411                  var r = this._frameArray.length * Int16Array.BYTES_PER_ELEMENT;
71412                  var o = this._timelineArray.length * Uint16Array.BYTES_PER_ELEMENT;
71413                  var a = e + i + s + n + r + o;
71414                  if (t.DragonBones.webAssembly) {
71415                    var l = t.webAssemblyModule.HEAP16.buffer;
71416                    var h = t.webAssemblyModule._malloc(a);
71417                    var c = new Int16Array(l, h, this._intArray.length);
71418                    var u = new Float32Array(l, h + e, this._floatArray.length);
71419                    var _ = new Int16Array(l, h + e + i, this._frameIntArray.length);
71420                    var d = new Float32Array(l, h + e + i + s, this._frameFloatArray.length);
71421                    var p = new Int16Array(l, h + e + i + s + n, this._frameArray.length);
71422                    var m = new Uint16Array(l, h + e + i + s + n + r, this._timelineArray.length);
71423                    for (var f = 0, g = this._intArray.length; f < g; ++f) c[f] = this._intArray[f];
71424                    for (f = 0, g = this._floatArray.length; f < g; ++f) u[f] = this._floatArray[f];
71425                    for (f = 0, g = this._frameIntArray.length; f < g; ++f) _[f] = this._frameIntArray[f];
71426                    for (f = 0, g = this._frameFloatArray.length; f < g; ++f) d[f] = this._frameFloatArray[f];
71427                    for (f = 0, g = this._frameArray.length; f < g; ++f) p[f] = this._frameArray[f];
71428                    for (f = 0, g = this._timelineArray.length; f < g; ++f) m[f] = this._timelineArray[f];
71429                    t.webAssemblyModule.setDataBinary(this._data, h, e, i, s, n, r, o);
71430                  } else {
71431                    var y = new ArrayBuffer(a);
71432                    c = new Int16Array(y, 0, this._intArray.length);
71433                    u = new Float32Array(y, e, this._floatArray.length);
71434                    _ = new Int16Array(y, e + i, this._frameIntArray.length);
71435                    d = new Float32Array(y, e + i + s, this._frameFloatArray.length);
71436                    p = new Int16Array(y, e + i + s + n, this._frameArray.length);
71437                    m = new Uint16Array(y, e + i + s + n + r, this._timelineArray.length);
71438                    for (f = 0, g = this._intArray.length; f < g; ++f) c[f] = this._intArray[f];
71439                    for (f = 0, g = this._floatArray.length; f < g; ++f) u[f] = this._floatArray[f];
71440                    for (f = 0, g = this._frameIntArray.length; f < g; ++f) _[f] = this._frameIntArray[f];
71441                    for (f = 0, g = this._frameFloatArray.length; f < g; ++f) d[f] = this._frameFloatArray[f];
71442                    for (f = 0, g = this._frameArray.length; f < g; ++f) p[f] = this._frameArray[f];
71443                    for (f = 0, g = this._timelineArray.length; f < g; ++f) m[f] = this._timelineArray[f];
71444                    this._data.binary = y;
71445                    this._data.intArray = c;
71446                    this._data.floatArray = u;
71447                    this._data.frameIntArray = _;
71448                    this._data.frameFloatArray = d;
71449                    this._data.frameArray = p;
71450                    this._data.timelineArray = m;
71451                  }
71452                  this._defaultColorOffset = -1;
71453                };
71454                s.prototype.parseDragonBonesData = function(e, i) {
71455                  void 0 === i && (i = 1);
71456                  console.assert(null != e, "Data error.");
71457                  var n = s._getString(e, t.DataParser.VERSION, "");
71458                  var r = s._getString(e, t.DataParser.COMPATIBLE_VERSION, "");
71459                  if (t.DataParser.DATA_VERSIONS.indexOf(n) >= 0 || t.DataParser.DATA_VERSIONS.indexOf(r) >= 0) {
71460                    var o = t.BaseObject.borrowObject(t.DragonBonesData);
71461                    o.version = n;
71462                    o.name = s._getString(e, t.DataParser.NAME, "");
71463                    o.frameRate = s._getNumber(e, t.DataParser.FRAME_RATE, 24);
71464                    0 === o.frameRate && (o.frameRate = 24);
71465                    if (t.DataParser.ARMATURE in e) {
71466                      this._data = o;
71467                      this._parseArray(e);
71468                      for (var a = 0, l = e[t.DataParser.ARMATURE]; a < l.length; a++) {
71469                        var h = l[a];
71470                        o.addArmature(this._parseArmature(h, i));
71471                      }
71472                      this._data.binary || this._modifyArray();
71473                      t.DataParser.STAGE in e ? o.stage = o.getArmature(s._getString(e, t.DataParser.STAGE, "")) : o.armatureNames.length > 0 && (o.stage = o.getArmature(o.armatureNames[0]));
71474                      this._data = null;
71475                    }
71476                    t.DataParser.TEXTURE_ATLAS in e && (this._rawTextureAtlases = e[t.DataParser.TEXTURE_ATLAS]);
71477                    return o;
71478                  }
71479                  console.assert(!1, "Nonsupport data version: " + n + "\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/");
71480                  return null;
71481                };
71482                s.prototype.parseTextureAtlasData = function(e, i, n) {
71483                  void 0 === n && (n = 1);
71484                  console.assert(void 0 !== e);
71485                  if (null === e) {
71486                    if (null === this._rawTextureAtlases || 0 === this._rawTextureAtlases.length) return !1;
71487                    var r = this._rawTextureAtlases[this._rawTextureAtlasIndex++];
71488                    this.parseTextureAtlasData(r, i, n);
71489                    if (this._rawTextureAtlasIndex >= this._rawTextureAtlases.length) {
71490                      this._rawTextureAtlasIndex = 0;
71491                      this._rawTextureAtlases = null;
71492                    }
71493                    return !0;
71494                  }
71495                  i.width = s._getNumber(e, t.DataParser.WIDTH, 0);
71496                  i.height = s._getNumber(e, t.DataParser.HEIGHT, 0);
71497                  i.scale = 1 === n ? 1 / s._getNumber(e, t.DataParser.SCALE, 1) : n;
71498                  i.name = s._getString(e, t.DataParser.NAME, "");
71499                  i.imagePath = s._getString(e, t.DataParser.IMAGE_PATH, "");
71500                  if (t.DataParser.SUB_TEXTURE in e) {
71501                    var o = e[t.DataParser.SUB_TEXTURE];
71502                    for (var a = 0, l = o.length; a < l; ++a) {
71503                      var h = o[a];
71504                      var c = i.createTexture();
71505                      c.rotated = s._getBoolean(h, t.DataParser.ROTATED, !1);
71506                      c.name = s._getString(h, t.DataParser.NAME, "");
71507                      c.region.x = s._getNumber(h, t.DataParser.X, 0);
71508                      c.region.y = s._getNumber(h, t.DataParser.Y, 0);
71509                      c.region.width = s._getNumber(h, t.DataParser.WIDTH, 0);
71510                      c.region.height = s._getNumber(h, t.DataParser.HEIGHT, 0);
71511                      var u = s._getNumber(h, t.DataParser.FRAME_WIDTH, -1);
71512                      var _ = s._getNumber(h, t.DataParser.FRAME_HEIGHT, -1);
71513                      if (u > 0 && _ > 0) {
71514                        c.frame = t.TextureData.createRectangle();
71515                        c.frame.x = s._getNumber(h, t.DataParser.FRAME_X, 0);
71516                        c.frame.y = s._getNumber(h, t.DataParser.FRAME_Y, 0);
71517                        c.frame.width = u;
71518                        c.frame.height = _;
71519                      }
71520                      i.addTexture(c);
71521                    }
71522                  }
71523                  return !0;
71524                };
71525                s.getInstance = function() {
71526                  null === s._objectDataParserInstance && (s._objectDataParserInstance = new s);
71527                  return s._objectDataParserInstance;
71528                };
71529                s._objectDataParserInstance = null;
71530                return s;
71531              }(t.DataParser);
71532              t.ObjectDataParser = e;
71533              var i = function() {
71534                this.frameStart = 0;
71535                this.actions = [];
71536              };
71537              t.ActionFrame = i;
71538            }(a5 || (a5 = {}));
71539            !function(t) {
71540              var e = function(e) {
71541                r5(i, e);
71542                function i() {
71543                  return null !== e && e.apply(this, arguments) || this;
71544                }
71545                i.prototype._inRange = function(t, e, i) {
71546                  return e <= t && t <= i;
71547                };
71548                i.prototype._decodeUTF8 = function(t) {
71549                  var e = 0;
71550                  var i = "";
71551                  var s;
71552                  var n = 0;
71553                  var r = 0;
71554                  var o = 0;
71555                  var a = 0;
71556                  for (;t.length > e; ) {
71557                    var l = t[e++];
71558                    if (-1 === l) s = 0 !== r ? 65533 : -1; else if (0 === r) if (this._inRange(l, 0, 127)) s = l; else {
71559                      if (this._inRange(l, 194, 223)) {
71560                        r = 1;
71561                        a = 128;
71562                        n = l - 192;
71563                      } else if (this._inRange(l, 224, 239)) {
71564                        r = 2;
71565                        a = 2048;
71566                        n = l - 224;
71567                      } else if (this._inRange(l, 240, 244)) {
71568                        r = 3;
71569                        a = 65536;
71570                        n = l - 240;
71571                      }
71572                      n *= Math.pow(64, r);
71573                      s = null;
71574                    } else if (this._inRange(l, 128, 191)) {
71575                      o += 1;
71576                      n += (l - 128) * Math.pow(64, r - o);
71577                      if (o !== r) s = null; else {
71578                        var h = n;
71579                        var c = a;
71580                        n = 0;
71581                        r = 0;
71582                        o = 0;
71583                        a = 0;
71584                        s = this._inRange(h, c, 1114111) && !this._inRange(h, 55296, 57343) ? h : l;
71585                      }
71586                    } else {
71587                      n = 0;
71588                      r = 0;
71589                      o = 0;
71590                      a = 0;
71591                      e--;
71592                      s = l;
71593                    }
71594                    if (null !== s && -1 !== s) if (s <= 65535) s > 0 && (i += String.fromCharCode(s)); else {
71595                      s -= 65536;
71596                      i += String.fromCharCode(55296 + (s >> 10 & 1023));
71597                      i += String.fromCharCode(56320 + (1023 & s));
71598                    }
71599                  }
71600                  return i;
71601                };
71602                i.prototype._getUTF16Key = function(t) {
71603                  for (var e = 0, i = t.length; e < i; ++e) if (t.charCodeAt(e) > 255) return encodeURI(t);
71604                  return t;
71605                };
71606                i.prototype._parseBinaryTimeline = function(e, i, s) {
71607                  void 0 === s && (s = null);
71608                  var n = null !== s ? s : t.BaseObject.borrowObject(t.TimelineData);
71609                  n.type = e;
71610                  n.offset = i;
71611                  this._timeline = n;
71612                  var r = this._timelineArrayBuffer[n.offset + 2];
71613                  if (1 === r) n.frameIndicesOffset = -1; else {
71614                    var o = 0;
71615                    var a = this._animation.frameCount + 1;
71616                    var l = this._data.frameIndices;
71617                    if (t.DragonBones.webAssembly) {
71618                      o = l.size();
71619                      l.resize(o + a, 0);
71620                    } else {
71621                      o = l.length;
71622                      l.length += a;
71623                    }
71624                    n.frameIndicesOffset = o;
71625                    for (var h = 0, c = 0, u = 0, _ = 0; h < a; ++h) {
71626                      if (u + _ <= h && c < r) {
71627                        u = this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[n.offset + 5 + c]];
71628                        _ = c === r - 1 ? this._animation.frameCount - u : this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[n.offset + 5 + c + 1]] - u;
71629                        c++;
71630                      }
71631                      t.DragonBones.webAssembly ? l.set(o + h, c - 1) : l[o + h] = c - 1;
71632                    }
71633                  }
71634                  this._timeline = null;
71635                  return n;
71636                };
71637                i.prototype._parseVertices = function(e, i) {
71638                  i.offset = e[t.DataParser.OFFSET];
71639                  var s = this._intArrayBuffer[i.offset + 3];
71640                  if (s >= 0) {
71641                    var n = t.BaseObject.borrowObject(t.WeightData);
71642                    var r = this._intArrayBuffer[i.offset + 0];
71643                    var o = this._intArrayBuffer[s + 0];
71644                    n.offset = s;
71645                    for (var a = 0; a < o; ++a) {
71646                      var l = this._intArrayBuffer[s + 2 + a];
71647                      n.addBone(this._rawBones[l]);
71648                    }
71649                    var h = s + 2 + o;
71650                    var c = 0;
71651                    a = 0;
71652                    for (var u = r; a < u; ++a) {
71653                      var _ = this._intArrayBuffer[h++];
71654                      c += _;
71655                      h += _;
71656                    }
71657                    n.count = c;
71658                    i.weight = n;
71659                  }
71660                };
71661                i.prototype._parseMesh = function(t, e) {
71662                  this._parseVertices(t, e.vertices);
71663                };
71664                i.prototype._parsePath = function(t, e) {
71665                  this._parseVertices(t, e.vertices);
71666                };
71667                i.prototype._parseAnimation = function(e) {
71668                  var i = t.BaseObject.borrowObject(t.AnimationData);
71669                  i.frameCount = Math.max(t.ObjectDataParser._getNumber(e, t.DataParser.DURATION, 1), 1);
71670                  i.playTimes = t.ObjectDataParser._getNumber(e, t.DataParser.PLAY_TIMES, 1);
71671                  i.duration = i.frameCount / this._armature.frameRate;
71672                  i.fadeInTime = t.ObjectDataParser._getNumber(e, t.DataParser.FADE_IN_TIME, 0);
71673                  i.scale = t.ObjectDataParser._getNumber(e, t.DataParser.SCALE, 1);
71674                  i.name = t.ObjectDataParser._getString(e, t.DataParser.NAME, t.DataParser.DEFAULT_NAME);
71675                  0 === i.name.length && (i.name = t.DataParser.DEFAULT_NAME);
71676                  var s = e[t.DataParser.OFFSET];
71677                  i.frameIntOffset = s[0];
71678                  i.frameFloatOffset = s[1];
71679                  i.frameOffset = s[2];
71680                  this._animation = i;
71681                  t.DataParser.ACTION in e && (i.actionTimeline = this._parseBinaryTimeline(0, e[t.DataParser.ACTION]));
71682                  t.DataParser.Z_ORDER in e && (i.zOrderTimeline = this._parseBinaryTimeline(1, e[t.DataParser.Z_ORDER]));
71683                  if (t.DataParser.BONE in e) {
71684                    var n = e[t.DataParser.BONE];
71685                    for (var r in n) {
71686                      var o = n[r];
71687                      t.DragonBones.webAssembly && (r = this._getUTF16Key(r));
71688                      var a = this._armature.getBone(r);
71689                      if (null !== a) for (var l = 0, h = o.length; l < h; l += 2) {
71690                        var c = o[l];
71691                        var u = o[l + 1];
71692                        var _ = this._parseBinaryTimeline(c, u);
71693                        this._animation.addBoneTimeline(a, _);
71694                      }
71695                    }
71696                  }
71697                  if (t.DataParser.SURFACE in e) {
71698                    n = e[t.DataParser.SURFACE];
71699                    for (var r in n) {
71700                      o = n[r];
71701                      t.DragonBones.webAssembly && (r = this._getUTF16Key(r));
71702                      var d = this._armature.getBone(r);
71703                      if (null !== d) for (l = 0, h = o.length; l < h; l += 2) {
71704                        c = o[l];
71705                        u = o[l + 1];
71706                        _ = this._parseBinaryTimeline(c, u);
71707                        this._animation.addSurfaceTimeline(d, _);
71708                      }
71709                    }
71710                  }
71711                  if (t.DataParser.SLOT in e) {
71712                    n = e[t.DataParser.SLOT];
71713                    for (var r in n) {
71714                      o = n[r];
71715                      t.DragonBones.webAssembly && (r = this._getUTF16Key(r));
71716                      var p = this._armature.getSlot(r);
71717                      if (null !== p) for (l = 0, h = o.length; l < h; l += 2) {
71718                        c = o[l];
71719                        u = o[l + 1];
71720                        _ = this._parseBinaryTimeline(c, u);
71721                        this._animation.addSlotTimeline(p, _);
71722                      }
71723                    }
71724                  }
71725                  if (t.DataParser.CONSTRAINT in e) {
71726                    n = e[t.DataParser.CONSTRAINT];
71727                    for (var r in n) {
71728                      o = n[r];
71729                      t.DragonBones.webAssembly && (r = this._getUTF16Key(r));
71730                      var m = this._armature.getConstraint(r);
71731                      if (null !== m) for (l = 0, h = o.length; l < h; l += 2) {
71732                        c = o[l];
71733                        u = o[l + 1];
71734                        _ = this._parseBinaryTimeline(c, u);
71735                        this._animation.addConstraintTimeline(m, _);
71736                      }
71737                    }
71738                  }
71739                  if (t.DataParser.ANIMATION in e) {
71740                    n = e[t.DataParser.ANIMATION];
71741                    for (var r in n) {
71742                      o = n[r];
71743                      t.DragonBones.webAssembly && (r = this._getUTF16Key(r));
71744                      for (l = 0, h = o.length; l < h; l += 2) {
71745                        c = o[l];
71746                        u = o[l + 1];
71747                        _ = this._parseBinaryTimeline(c, u);
71748                        this._animation.addAnimationTimeline(r, _);
71749                      }
71750                    }
71751                  }
71752                  this._animation = null;
71753                  return i;
71754                };
71755                i.prototype._parseArray = function(e) {
71756                  var i = e[t.DataParser.OFFSET];
71757                  var s = i[1];
71758                  var n = i[3];
71759                  var r = i[5];
71760                  var o = i[7];
71761                  var a = i[9];
71762                  var l = i[11];
71763                  var h = new Int16Array(this._binary, this._binaryOffset + i[0], s / Int16Array.BYTES_PER_ELEMENT);
71764                  var c = new Float32Array(this._binary, this._binaryOffset + i[2], n / Float32Array.BYTES_PER_ELEMENT);
71765                  var u = new Int16Array(this._binary, this._binaryOffset + i[4], r / Int16Array.BYTES_PER_ELEMENT);
71766                  var _ = new Float32Array(this._binary, this._binaryOffset + i[6], o / Float32Array.BYTES_PER_ELEMENT);
71767                  var d = new Int16Array(this._binary, this._binaryOffset + i[8], a / Int16Array.BYTES_PER_ELEMENT);
71768                  var p = new Uint16Array(this._binary, this._binaryOffset + i[10], l / Uint16Array.BYTES_PER_ELEMENT);
71769                  if (t.DragonBones.webAssembly) {
71770                    var m = s + n + r + o + a + l;
71771                    var f = t.webAssemblyModule._malloc(m);
71772                    var g = new Uint8Array(this._binary, this._binaryOffset, m / Uint8Array.BYTES_PER_ELEMENT);
71773                    var y = new Uint8Array(t.webAssemblyModule.HEAP16.buffer, f, g.length);
71774                    for (var b = 0, S = g.length; b < S; ++b) y[b] = g[b];
71775                    t.webAssemblyModule.setDataBinary(this._data, f, s, n, r, o, a, l);
71776                    this._intArrayBuffer = h;
71777                    this._floatArrayBuffer = c;
71778                    this._frameIntArrayBuffer = u;
71779                    this._frameFloatArrayBuffer = _;
71780                    this._frameArrayBuffer = d;
71781                    this._timelineArrayBuffer = p;
71782                  } else {
71783                    this._data.binary = this._binary;
71784                    this._data.intArray = this._intArrayBuffer = h;
71785                    this._data.floatArray = this._floatArrayBuffer = c;
71786                    this._data.frameIntArray = this._frameIntArrayBuffer = u;
71787                    this._data.frameFloatArray = this._frameFloatArrayBuffer = _;
71788                    this._data.frameArray = this._frameArrayBuffer = d;
71789                    this._data.timelineArray = this._timelineArrayBuffer = p;
71790                  }
71791                };
71792                i.prototype.parseDragonBonesData = function(t, i) {
71793                  void 0 === i && (i = 1);
71794                  console.assert(null != t && t instanceof ArrayBuffer, "Data error.");
71795                  var s = new Uint8Array(t, 0, 8);
71796                  if (s[0] !== "D".charCodeAt(0) || s[1] !== "B".charCodeAt(0) || s[2] !== "D".charCodeAt(0) || s[3] !== "T".charCodeAt(0)) {
71797                    console.assert(!1, "Nonsupport data.");
71798                    return null;
71799                  }
71800                  var n = new Uint32Array(t, 8, 1)[0];
71801                  var r = new Uint8Array(t, 12, n);
71802                  var o = this._decodeUTF8(r);
71803                  var a = JSON.parse(o);
71804                  this._binaryOffset = 12 + n;
71805                  this._binary = t;
71806                  return e.prototype.parseDragonBonesData.call(this, a, i);
71807                };
71808                i.getInstance = function() {
71809                  null === i._binaryDataParserInstance && (i._binaryDataParserInstance = new i);
71810                  return i._binaryDataParserInstance;
71811                };
71812                i._binaryDataParserInstance = null;
71813                return i;
71814              }(t.ObjectDataParser);
71815              t.BinaryDataParser = e;
71816            }(a5 || (a5 = {}));
71817            !function(t) {
71818              var e = function() {
71819                function e(i) {
71820                  void 0 === i && (i = null);
71821                  this.autoSearch = !1;
71822                  this._dragonBonesDataMap = {};
71823                  this._textureAtlasDataMap = {};
71824                  this._dragonBones = null;
71825                  this._dataParser = null;
71826                  null === e._objectParser && (e._objectParser = new t.ObjectDataParser);
71827                  null === e._binaryParser && (e._binaryParser = new t.BinaryDataParser);
71828                  this._dataParser = null !== i ? i : e._objectParser;
71829                }
71830                e.prototype._isSupportMesh = function() {
71831                  return !0;
71832                };
71833                e.prototype._getTextureData = function(t, e) {
71834                  if (t in this._textureAtlasDataMap) for (var i = 0, s = this._textureAtlasDataMap[t]; i < s.length; i++) {
71835                    if (null !== (l = (a = s[i]).getTexture(e))) return l;
71836                  }
71837                  if (this.autoSearch) for (var n in this._textureAtlasDataMap) for (var r = 0, o = this._textureAtlasDataMap[n]; r < o.length; r++) {
71838                    var a;
71839                    if ((a = o[r]).autoSearch) {
71840                      var l;
71841                      if (null !== (l = a.getTexture(e))) return l;
71842                    }
71843                  }
71844                  return null;
71845                };
71846                e.prototype._fillBuildArmaturePackage = function(t, e, i, s, n) {
71847                  var r = null;
71848                  var o = null;
71849                  e.length > 0 && e in this._dragonBonesDataMap && (o = (r = this._dragonBonesDataMap[e]).getArmature(i));
71850                  if (null === o && (0 === e.length || this.autoSearch)) for (var a in this._dragonBonesDataMap) {
71851                    r = this._dragonBonesDataMap[a];
71852                    if ((0 === e.length || r.autoSearch) && null !== (o = r.getArmature(i))) {
71853                      e = a;
71854                      break;
71855                    }
71856                  }
71857                  if (null !== o) {
71858                    t.dataName = e;
71859                    t.textureAtlasName = n;
71860                    t.data = r;
71861                    t.armature = o;
71862                    t.skin = null;
71863                    if (s.length > 0) {
71864                      t.skin = o.getSkin(s);
71865                      if (null === t.skin && this.autoSearch) for (var a in this._dragonBonesDataMap) {
71866                        var l = this._dragonBonesDataMap[a].getArmature(s);
71867                        if (null !== l) {
71868                          t.skin = l.defaultSkin;
71869                          break;
71870                        }
71871                      }
71872                    }
71873                    null === t.skin && (t.skin = o.defaultSkin);
71874                    return !0;
71875                  }
71876                  return !1;
71877                };
71878                e.prototype._buildBones = function(e, i) {
71879                  for (var s = 0, n = e.armature.sortedBones; s < n.length; s++) {
71880                    var r = n[s];
71881                    t.BaseObject.borrowObject(0 === r.type ? t.Bone : t.Surface).init(r, i);
71882                  }
71883                };
71884                e.prototype._buildSlots = function(e, i) {
71885                  var s = e.skin;
71886                  var n = e.armature.defaultSkin;
71887                  if (null !== s && null !== n) {
71888                    var r = {};
71889                    for (var o in n.displays) {
71890                      var a = n.getDisplays(o);
71891                      r[o] = a;
71892                    }
71893                    if (s !== n) for (var o in s.displays) {
71894                      a = s.getDisplays(o);
71895                      r[o] = a;
71896                    }
71897                    for (var l = 0, h = e.armature.sortedSlots; l < h.length; l++) {
71898                      var c = h[l];
71899                      var u = c.name in r ? r[c.name] : null;
71900                      var _ = this._buildSlot(e, c, i);
71901                      _.rawDisplayDatas = u;
71902                      if (null !== u) {
71903                        var d = new Array;
71904                        for (var p = 0, m = t.DragonBones.webAssembly ? u.size() : u.length; p < m; ++p) {
71905                          var f = t.DragonBones.webAssembly ? u.get(p) : u[p];
71906                          null !== f ? d.push(this._getSlotDisplay(e, f, null, _)) : d.push(null);
71907                        }
71908                        _._setDisplayList(d);
71909                      }
71910                      _._setDisplayIndex(c.displayIndex, !0);
71911                    }
71912                  }
71913                };
71914                e.prototype._buildConstraints = function(e, i) {
71915                  var s = e.armature.constraints;
71916                  for (var n in s) {
71917                    var r = s[n];
71918                    switch (r.type) {
71919                     case 0:
71920                      var o = t.BaseObject.borrowObject(t.IKConstraint);
71921                      o.init(r, i);
71922                      i._addConstraint(o);
71923                      break;
71924
71925                     case 1:
71926                      var a = t.BaseObject.borrowObject(t.PathConstraint);
71927                      a.init(r, i);
71928                      i._addConstraint(a);
71929                      break;
71930
71931                     default:
71932                      var l = t.BaseObject.borrowObject(t.IKConstraint);
71933                      l.init(r, i);
71934                      i._addConstraint(l);
71935                    }
71936                  }
71937                };
71938                e.prototype._buildChildArmature = function(t, e, i) {
71939                  return this.buildArmature(i.path, null !== t ? t.dataName : "", "", null !== t ? t.textureAtlasName : "");
71940                };
71941                e.prototype._getSlotDisplay = function(e, i, s, n) {
71942                  var r = null !== e ? e.dataName : i.parent.parent.parent.name;
71943                  var o = null;
71944                  switch (i.type) {
71945                   case 0:
71946                    var a = i;
71947                    null !== e && e.textureAtlasName.length > 0 && (a.texture = this._getTextureData(e.textureAtlasName, i.path));
71948                    null === a.texture && (a.texture = this._getTextureData(r, i.path));
71949                    o = null !== s && 2 === s.type && this._isSupportMesh() ? n.meshDisplay : n.rawDisplay;
71950                    break;
71951
71952                   case 2:
71953                    var l = i;
71954                    null !== e && e.textureAtlasName.length > 0 && (l.texture = this._getTextureData(e.textureAtlasName, l.path));
71955                    null === l.texture && (l.texture = this._getTextureData(r, l.path));
71956                    o = this._isSupportMesh() ? n.meshDisplay : n.rawDisplay;
71957                    break;
71958
71959                   case 1:
71960                    var h = i;
71961                    var c = this._buildChildArmature(e, n, i);
71962                    if (null !== c) {
71963                      c.inheritAnimation = h.inheritAnimation;
71964                      if (!c.inheritAnimation) {
71965                        var u = h.actions.length > 0 ? h.actions : c.armatureData.defaultActions;
71966                        if (u.length > 0) for (var _ = 0, d = u; _ < d.length; _++) {
71967                          var p = d[_];
71968                          var m = t.BaseObject.borrowObject(t.EventObject);
71969                          t.EventObject.actionDataToInstance(p, m, n.armature);
71970                          m.slot = n;
71971                          n.armature._bufferAction(m, !1);
71972                        } else c.animation.play();
71973                      }
71974                      h.armature = c.armatureData;
71975                    }
71976                    o = c;
71977                  }
71978                  return o;
71979                };
71980                e.prototype.parseDragonBonesData = function(t, i, s) {
71981                  void 0 === i && (i = null);
71982                  void 0 === s && (s = 1);
71983                  var n = t instanceof ArrayBuffer ? e._binaryParser : this._dataParser;
71984                  var r = n.parseDragonBonesData(t, s);
71985                  for (;;) {
71986                    var o = this._buildTextureAtlasData(null, null);
71987                    if (!n.parseTextureAtlasData(null, o, s)) {
71988                      o.returnToPool();
71989                      break;
71990                    }
71991                    this.addTextureAtlasData(o, i);
71992                  }
71993                  null !== r && this.addDragonBonesData(r, i);
71994                  return r;
71995                };
71996                e.prototype.parseTextureAtlasData = function(t, e, i, s) {
71997                  void 0 === i && (i = null);
71998                  void 0 === s && (s = 1);
71999                  var n = this._buildTextureAtlasData(null, null);
72000                  this._dataParser.parseTextureAtlasData(t, n, s);
72001                  this._buildTextureAtlasData(n, e || null);
72002                  this.addTextureAtlasData(n, i);
72003                  return n;
72004                };
72005                e.prototype.updateTextureAtlasData = function(t, e) {
72006                  var i = this.getTextureAtlasData(t);
72007                  if (null !== i) for (var s = 0, n = i.length; s < n; ++s) s < e.length && this._buildTextureAtlasData(i[s], e[s]);
72008                };
72009                e.prototype.getDragonBonesData = function(t) {
72010                  return t in this._dragonBonesDataMap ? this._dragonBonesDataMap[t] : null;
72011                };
72012                e.prototype.addDragonBonesData = function(t, e) {
72013                  void 0 === e && (e = null);
72014                  if ((e = null !== e ? e : t.name) in this._dragonBonesDataMap) {
72015                    if (this._dragonBonesDataMap[e] === t) return;
72016                    console.warn("Can not add same name data: " + e);
72017                  } else this._dragonBonesDataMap[e] = t;
72018                };
72019                e.prototype.removeDragonBonesData = function(t, e) {
72020                  void 0 === e && (e = !0);
72021                  if (t in this._dragonBonesDataMap) {
72022                    e && this._dragonBones.bufferObject(this._dragonBonesDataMap[t]);
72023                    delete this._dragonBonesDataMap[t];
72024                  }
72025                };
72026                e.prototype.getTextureAtlasData = function(t) {
72027                  return t in this._textureAtlasDataMap ? this._textureAtlasDataMap[t] : null;
72028                };
72029                e.prototype.addTextureAtlasData = function(t, e) {
72030                  void 0 === e && (e = null);
72031                  var i = (e = null !== e ? e : t.name) in this._textureAtlasDataMap ? this._textureAtlasDataMap[e] : this._textureAtlasDataMap[e] = [];
72032                  i.indexOf(t) < 0 && i.push(t);
72033                };
72034                e.prototype.removeTextureAtlasData = function(t, e) {
72035                  void 0 === e && (e = !0);
72036                  if (t in this._textureAtlasDataMap) {
72037                    var i = this._textureAtlasDataMap[t];
72038                    if (e) for (var s = 0, n = i; s < n.length; s++) {
72039                      var r = n[s];
72040                      this._dragonBones.bufferObject(r);
72041                    }
72042                    delete this._textureAtlasDataMap[t];
72043                  }
72044                };
72045                e.prototype.getArmatureData = function(t, e) {
72046                  void 0 === e && (e = "");
72047                  var s = new i;
72048                  return this._fillBuildArmaturePackage(s, e, t, "", "") ? s.armature : null;
72049                };
72050                e.prototype.clear = function(t) {
72051                  void 0 === t && (t = !0);
72052                  for (var e in this._dragonBonesDataMap) {
72053                    t && this._dragonBones.bufferObject(this._dragonBonesDataMap[e]);
72054                    delete this._dragonBonesDataMap[e];
72055                  }
72056                  for (var e in this._textureAtlasDataMap) {
72057                    if (t) {
72058                      for (var i = 0, s = this._textureAtlasDataMap[e]; i < s.length; i++) {
72059                        var n = s[i];
72060                        this._dragonBones.bufferObject(n);
72061                      }
72062                    }
72063                    delete this._textureAtlasDataMap[e];
72064                  }
72065                };
72066                e.prototype.buildArmature = function(t, e, s, n) {
72067                  void 0 === e && (e = "");
72068                  void 0 === s && (s = "");
72069                  void 0 === n && (n = "");
72070                  var r = new i;
72071                  if (!this._fillBuildArmaturePackage(r, e || "", t, s || "", n || "")) {
72072                    console.warn("No armature data: " + t + ", " + (null !== e ? e : ""));
72073                    return null;
72074                  }
72075                  var o = this._buildArmature(r);
72076                  this._buildBones(r, o);
72077                  this._buildSlots(r, o);
72078                  this._buildConstraints(r, o);
72079                  o.invalidUpdate(null, !0);
72080                  o.advanceTime(0);
72081                  return o;
72082                };
72083                e.prototype.replaceDisplay = function(e, i, s) {
72084                  void 0 === s && (s = -1);
72085                  s < 0 && (s = e.displayIndex);
72086                  s < 0 && (s = 0);
72087                  e.replaceDisplayData(i, s);
72088                  var n = e.displayList;
72089                  if (n.length <= s) {
72090                    n.length = s + 1;
72091                    for (var r = 0, o = n.length; r < o; ++r) n[r] || (n[r] = null);
72092                  }
72093                  if (null !== i) {
72094                    var a = e.rawDisplayDatas;
72095                    var l = null;
72096                    a && (t.DragonBones.webAssembly ? s < a.size() && (l = a.get(s)) : s < a.length && (l = a[s]));
72097                    n[s] = this._getSlotDisplay(null, i, l, e);
72098                  } else n[s] = null;
72099                  e.displayList = n;
72100                };
72101                e.prototype.replaceSlotDisplay = function(t, e, i, s, n, r) {
72102                  void 0 === r && (r = -1);
72103                  var o = this.getArmatureData(e, t || "");
72104                  if (!o || !o.defaultSkin) return !1;
72105                  var a = o.defaultSkin.getDisplay(i, s);
72106                  if (!a) return !1;
72107                  this.replaceDisplay(n, a, r);
72108                  return !0;
72109                };
72110                e.prototype.replaceSlotDisplayList = function(e, i, s, n) {
72111                  var r = this.getArmatureData(i, e || "");
72112                  if (!r || !r.defaultSkin) return !1;
72113                  var o = r.defaultSkin.getDisplays(s);
72114                  if (!o) return !1;
72115                  var a = 0;
72116                  for (var l = 0, h = t.DragonBones.webAssembly ? o.size() : o.length; l < h; ++l) {
72117                    var c = t.DragonBones.webAssembly ? o.get(l) : o[l];
72118                    this.replaceDisplay(n, c, a++);
72119                  }
72120                  return !0;
72121                };
72122                e.prototype.replaceSkin = function(e, i, s, n) {
72123                  void 0 === s && (s = !1);
72124                  void 0 === n && (n = null);
72125                  var r = !1;
72126                  var o = i.parent.defaultSkin;
72127                  for (var a = 0, l = e.getSlots(); a < l.length; a++) {
72128                    var h = l[a];
72129                    if (!(null !== n && n.indexOf(h.name) >= 0)) {
72130                      var c = i.getDisplays(h.name);
72131                      if (!c) {
72132                        null !== o && i !== o && (c = o.getDisplays(h.name));
72133                        if (!c) {
72134                          if (s) {
72135                            h.rawDisplayDatas = null;
72136                            h.displayList = [];
72137                          }
72138                          continue;
72139                        }
72140                      }
72141                      var u = t.DragonBones.webAssembly ? c.size() : c.length;
72142                      var _ = h.displayList;
72143                      _.length = u;
72144                      for (var d = 0, p = u; d < p; ++d) {
72145                        var m = t.DragonBones.webAssembly ? c.get(d) : c[d];
72146                        _[d] = null !== m ? this._getSlotDisplay(null, m, null, h) : null;
72147                      }
72148                      r = !0;
72149                      h.rawDisplayDatas = c;
72150                      h.displayList = _;
72151                    }
72152                  }
72153                  return r;
72154                };
72155                e.prototype.replaceAnimation = function(e, i, s) {
72156                  void 0 === s && (s = !0);
72157                  var n = i.defaultSkin;
72158                  if (null === n) return !1;
72159                  if (s) e.animation.animations = i.animations; else {
72160                    var r = e.animation.animations;
72161                    var o = {};
72162                    for (var a in r) o[a] = r[a];
72163                    for (var a in i.animations) o[a] = i.animations[a];
72164                    e.animation.animations = o;
72165                  }
72166                  for (var l = 0, h = e.getSlots(); l < h.length; l++) {
72167                    var c = h[l];
72168                    var u = 0;
72169                    for (var _ = 0, d = c.displayList; _ < d.length; _++) {
72170                      var p = d[_];
72171                      if (p instanceof t.Armature) {
72172                        var m = n.getDisplays(c.name);
72173                        if (null !== m && u < (t.DragonBones.webAssembly ? m.size() : m.length)) {
72174                          var f = t.DragonBones.webAssembly ? m.get(u) : m[u];
72175                          if (null !== f && 1 === f.type) {
72176                            var g = this.getArmatureData(f.path, f.parent.parent.parent.name);
72177                            g && this.replaceAnimation(p, g, s);
72178                          }
72179                        }
72180                      }
72181                      u++;
72182                    }
72183                  }
72184                  return !0;
72185                };
72186                e.prototype.getAllDragonBonesData = function() {
72187                  return this._dragonBonesDataMap;
72188                };
72189                e.prototype.getAllTextureAtlasData = function() {
72190                  return this._textureAtlasDataMap;
72191                };
72192                Object.defineProperty(e.prototype, "clock", {
72193                  get: function() {
72194                    return this._dragonBones.clock;
72195                  },
72196                  enumerable: !0,
72197                  configurable: !0
72198                });
72199                Object.defineProperty(e.prototype, "dragonBones", {
72200                  get: function() {
72201                    return this._dragonBones;
72202                  },
72203                  enumerable: !0,
72204                  configurable: !0
72205                });
72206                e.prototype.changeSkin = function(t, e, i) {
72207                  void 0 === i && (i = null);
72208                  return this.replaceSkin(t, e, !1, i);
72209                };
72210                e.prototype.copyAnimationsToArmature = function(t, e, i, s, n) {
72211                  void 0 === s && (s = "");
72212                  void 0 === n && (n = !0);
72213                  var r = this.getArmatureData(e, s);
72214                  return !!r && this.replaceAnimation(t, r, n);
72215                };
72216                e._objectParser = null;
72217                e._binaryParser = null;
72218                return e;
72219              }();
72220              t.BaseFactory = e;
72221              var i = function() {
72222                this.dataName = "";
72223                this.textureAtlasName = "";
72224                this.skin = null;
72225              };
72226              t.BuildArmaturePackage = i;
72227            }(a5 || (a5 = {}));
72228            !function(t) {
72229              t.BinaryOffset = {
72230                WeigthBoneCount: 0,
72231                WeigthFloatOffset: 1,
72232                WeigthBoneIndices: 2,
72233                MeshVertexCount: 0,
72234                MeshTriangleCount: 1,
72235                MeshFloatOffset: 2,
72236                MeshWeightOffset: 3,
72237                MeshVertexIndices: 4,
72238                TimelineScale: 0,
72239                TimelineOffset: 1,
72240                TimelineKeyFrameCount: 2,
72241                TimelineFrameValueCount: 3,
72242                TimelineFrameValueOffset: 4,
72243                TimelineFrameOffset: 5,
72244                FramePosition: 0,
72245                FrameTweenType: 1,
72246                FrameTweenEasingOrCurveSampleCount: 2,
72247                FrameCurveSamples: 3,
72248                DeformMeshOffset: 0,
72249                DeformCount: 1,
72250                DeformValueCount: 2,
72251                DeformValueOffset: 3,
72252                DeformFloatOffset: 4
72253              };
72254              t.ArmatureType = {
72255                Armature: 0,
72256                MovieClip: 1,
72257                Stage: 2
72258              };
72259              t.BoneType = {
72260                Bone: 0,
72261                Surface: 1
72262              };
72263              t.DisplayType = {
72264                Image: 0,
72265                Armature: 1,
72266                Mesh: 2,
72267                BoundingBox: 3
72268              };
72269              t.BoundingBoxType = {
72270                Rectangle: 0,
72271                Ellipse: 1,
72272                Polygon: 2
72273              };
72274              t.ActionType = {
72275                Play: 0,
72276                Stop: 1,
72277                GotoAndPlay: 2,
72278                GotoAndStop: 3,
72279                FadeIn: 4,
72280                FadeOut: 5,
72281                Frame: 10,
72282                Sound: 11
72283              };
72284              t.BlendMode = {
72285                Normal: 0,
72286                Add: 1,
72287                Alpha: 2,
72288                Darken: 3,
72289                Difference: 4,
72290                Erase: 5,
72291                HardLight: 6,
72292                Invert: 7,
72293                Layer: 8,
72294                Lighten: 9,
72295                Multiply: 10,
72296                Overlay: 11,
72297                Screen: 12,
72298                Subtract: 13
72299              };
72300              t.TweenType = {
72301                None: 0,
72302                Line: 1,
72303                Curve: 2,
72304                QuadIn: 3,
72305                QuadOut: 4,
72306                QuadInOut: 5
72307              };
72308              t.TimelineType = {
72309                Action: 0,
72310                ZOrder: 1,
72311                BoneAll: 10,
72312                BoneTranslate: 11,
72313                BoneRotate: 12,
72314                BoneScale: 13,
72315                Surface: 50,
72316                SlotDisplay: 20,
72317                SlotColor: 21,
72318                SlotFFD: 22,
72319                IKConstraint: 30,
72320                AnimationTime: 40,
72321                AnimationWeight: 41
72322              };
72323            }(a5 || (a5 = {}));
72324            const l5 = a5.DragonBones;
72325            const h5 = a5.BaseObject;
72326            const c5 = a5.Matrix;
72327            a5.Transform;
72328            a5.ColorTransform;
72329            a5.Point;
72330            a5.Rectangle;
72331            a5.UserData;
72332            a5.ActionData;
72333            a5.DragonBonesData;
72334            a5.ArmatureData;
72335            a5.BoneData;
72336            a5.SurfaceData;
72337            a5.SlotData;
72338            a5.ConstraintData;
72339            a5.IKConstraintData;
72340            a5.PathConstraintData;
72341            a5.CanvasData;
72342            a5.SkinData;
72343            a5.VerticesData;
72344            const u5 = a5.DisplayData;
72345            a5.ImageDisplayData;
72346            a5.ArmatureDisplayData;
72347            a5.MeshDisplayData;
72348            a5.BoundingBoxDisplayData;
72349            a5.PathDisplayData;
72350            a5.WeightData;
72351            a5.BoundingBoxData;
72352            a5.RectangleBoundingBoxData;
72353            a5.EllipseBoundingBoxData;
72354            a5.PolygonBoundingBoxData;
72355            a5.AnimationData;
72356            a5.TimelineData;
72357            a5.AnimationConfig;
72358            const _5 = a5.TextureAtlasData;
72359            const d5 = a5.TextureData;
72360            a5.DeformVertices;
72361            const p5 = a5.Armature;
72362            a5.TransformObject;
72363            a5.Bone;
72364            a5.Surface;
72365            const m5 = a5.Slot;
72366            a5.Constraint;
72367            a5.IKConstraint;
72368            a5.PathConstraint;
72369            a5.WorldClock;
72370            const f5 = a5.Animation;
72371            a5.AnimationState;
72372            a5.BonePose;
72373            a5.BlendState;
72374            a5.TimelineState;
72375            a5.TweenTimelineState;
72376            a5.BoneTimelineState;
72377            a5.SlotTimelineState;
72378            a5.ConstraintTimelineState;
72379            a5.ActionTimelineState;
72380            a5.ZOrderTimelineState;
72381            a5.BoneAllTimelineState;
72382            a5.BoneTranslateTimelineState;
72383            a5.BoneRotateTimelineState;
72384            a5.BoneScaleTimelineState;
72385            a5.SurfaceTimelineState;
72386            a5.SlotDislayTimelineState;
72387            a5.SlotColorTimelineState;
72388            a5.DeformTimelineState;
72389            a5.IKConstraintTimelineState;
72390            a5.AnimationTimelineState;
72391            const g5 = a5.EventObject;
72392            a5.DataParser;
72393            a5.ObjectDataParser;
72394            a5.ActionFrame;
72395            a5.BinaryDataParser;
72396            const y5 = a5.BaseFactory;
72397            a5.BuildArmaturePackage;
72398            const b5 = a5.BinaryOffset;
72399            a5.ArmatureType;
72400            const S5 = a5.BoneType;
72401            a5.DisplayType;
72402            a5.BoundingBoxType;
72403            a5.ActionType;
72404            a5.BlendMode;
72405            a5.TweenType;
72406            a5.TimelineType;
72407            var A5, T5, v5;
72408            let E5 = Ul("dragonBones.CCTextureAtlasData")(A5 = (T5 = class extends _5 {
72409              constructor(...t) {
72410                super(...t);
72411                this._renderTexture = null;
72412              }
72413              get renderTexture() {
72414                return this._renderTexture;
72415              }
72416              set renderTexture(t) {
72417                this._renderTexture = t;
72418                if (t) for (const e in this.textures) {
72419                  const i = this.textures[e];
72420                  if (!i.spriteFrame) {
72421                    let e = null;
72422                    if (i.rotated) e = new as(i.region.x, i.region.y, i.region.height, i.region.width); else {
72423                      e = new as(i.region.x, i.region.y, i.region.width, i.region.height);
72424                      i.spriteFrame = new GI;
72425                      i.spriteFrame.texture = t;
72426                      i.spriteFrame.rect = e;
72427                    }
72428                  }
72429                } else for (const t in this.textures) {
72430                  this.textures[t].spriteFrame = null;
72431                }
72432              }
72433              static toString() {
72434                return "[class dragonBones.CCTextureAtlasData]";
72435              }
72436              createTexture() {
72437                return h5.borrowObject(C5);
72438              }
72439              _onClear() {
72440                super._onClear();
72441                this.renderTexture = null;
72442              }
72443            }, T5)) || A5;
72444            let C5 = Ul("dragonBones.CCTextureData")(v5 = class extends d5 {
72445              constructor(...t) {
72446                super(...t);
72447                this.spriteFrame = null;
72448              }
72449              static toString() {
72450                return "[class dragonBones.CCTextureData]";
72451              }
72452              _onClear() {
72453                super._onClear();
72454                this.spriteFrame = null;
72455              }
72456            }) || v5;
72457            var x5, w5;
72458            let R5 = Ul("dragonBones.CCSlot")(x5 = (w5 = class extends m5 {
72459              static toString() {
72460                return "[class dragonBones.CCSlot]";
72461              }
72462              constructor() {
72463                super();
72464                this._localVertices = void 0;
72465                this._indices = void 0;
72466                this._matrix = void 0;
72467                this._worldMatrix = void 0;
72468                this._worldMatrixDirty = void 0;
72469                this._color = void 0;
72470                this._localVertices = [];
72471                this._indices = [];
72472                this._matrix = new qi;
72473                this._worldMatrix = new qi;
72474                this._worldMatrixDirty = !0;
72475                this._visible = !1;
72476                this._color = new Bi;
72477              }
72478              getTexture() {
72479                if (this._textureData) {
72480                  return this._textureData.spriteFrame.texture;
72481                }
72482                return null;
72483              }
72484              calculWorldMatrix() {
72485                const t = this._armature._parent;
72486                t ? this._mulMat(this._worldMatrix, t._worldMatrix, this._matrix) : qi.copy(this._worldMatrix, this._matrix);
72487                this._worldMatrixDirty = !1;
72488              }
72489              _onClear() {
72490                super._onClear();
72491                this._localVertices.length = 0;
72492                this._indices.length = 0;
72493                qi.identity(this._matrix);
72494                qi.identity(this._worldMatrix);
72495                this._worldMatrixDirty = !0;
72496                this._color = new Bi;
72497                this._visible = !1;
72498              }
72499              _onUpdateDisplay() {}
72500              _initDisplay(t) {}
72501              _addDisplay() {
72502                this._visible = !0;
72503              }
72504              _replaceDisplay(t) {}
72505              _removeDisplay() {
72506                this._visible = !1;
72507              }
72508              _disposeDisplay(t) {}
72509              _updateVisible() {
72510                this._visible = this.parent.visible;
72511              }
72512              _updateGlueMesh() {}
72513              _updateZOrder() {}
72514              _updateBlendMode() {
72515                if (this._childArmature) {
72516                  const t = this._childArmature.getSlots();
72517                  for (let e = 0, i = t.length; e < i; e++) {
72518                    const i = t[e];
72519                    i._blendMode = this._blendMode;
72520                    i._updateBlendMode();
72521                  }
72522                }
72523              }
72524              _updateColor() {
72525                const t = this._color;
72526                t.r = 255 * this._colorTransform.redMultiplier;
72527                t.g = 255 * this._colorTransform.greenMultiplier;
72528                t.b = 255 * this._colorTransform.blueMultiplier;
72529                t.a = 255 * this._colorTransform.alphaMultiplier;
72530              }
72531              _updateFrame() {
72532                this._indices.length = 0;
72533                const t = this._indices;
72534                const e = this._localVertices;
72535                let i = 0;
72536                let s = 0;
72537                const n = this._textureData;
72538                if (!this._display || this._displayIndex < 0 || !n || !n.spriteFrame) return;
72539                const r = n.spriteFrame.texture;
72540                const o = r.width;
72541                const a = r.height;
72542                const l = n.region;
72543                if (0 === o || 0 === a) {
72544                  console.error(`SpriteFrame ${n.spriteFrame.name} incorrect size ${o} x ${a}`);
72545                  return;
72546                }
72547                const h = null !== this._deformVertices && this._display === this._meshDisplay ? this._deformVertices.verticesData : null;
72548                if (h) {
72549                  const n = h.data;
72550                  const r = n.intArray;
72551                  const c = n.floatArray;
72552                  const u = r[h.offset + b5.MeshVertexCount];
72553                  const _ = r[h.offset + b5.MeshTriangleCount];
72554                  let d = r[h.offset + b5.MeshFloatOffset];
72555                  d < 0 && (d += 65536);
72556                  const p = d + 2 * u;
72557                  const m = this._armature._armatureData.scale;
72558                  for (let t = 0, i = 2 * u; t < i; t += 2) {
72559                    e[s++] = c[d + t] * m;
72560                    e[s++] = -c[d + t + 1] * m;
72561                    if (h.rotated) {
72562                      e[s++] = (l.x + (1 - c[p + t]) * l.width) / o;
72563                      e[s++] = (l.y + c[p + t + 1] * l.height) / a;
72564                    } else {
72565                      e[s++] = (l.x + c[p + t] * l.width) / o;
72566                      e[s++] = (l.y + c[p + t + 1] * l.height) / a;
72567                    }
72568                  }
72569                  for (let e = 0; e < 3 * _; ++e) t[i++] = r[h.offset + b5.MeshVertexIndices + e];
72570                  e.length = s;
72571                  t.length = i;
72572                  !!h.weight && this._identityTransform();
72573                } else {
72574                  const i = l.x / o;
72575                  const n = (l.y + l.height) / a;
72576                  const r = (l.x + l.width) / o;
72577                  const h = l.y / a;
72578                  e[s++] = 0;
72579                  e[s++] = 0;
72580                  e[s++] = i;
72581                  e[s++] = n;
72582                  e[s++] = l.width;
72583                  e[s++] = 0;
72584                  e[s++] = r;
72585                  e[s++] = n;
72586                  e[s++] = 0;
72587                  e[s++] = l.height;
72588                  e[s++] = i;
72589                  e[s++] = h;
72590                  e[s++] = l.width;
72591                  e[s++] = l.height;
72592                  e[s++] = r;
72593                  e[s++] = h;
72594                  t[0] = 0;
72595                  t[1] = 1;
72596                  t[2] = 2;
72597                  t[3] = 1;
72598                  t[4] = 3;
72599                  t[5] = 2;
72600                  e.length = s;
72601                  t.length = 6;
72602                }
72603                this._visibleDirty = !0;
72604                this._blendModeDirty = !0;
72605                this._colorDirty = !0;
72606              }
72607              _updateMesh() {
72608                const t = this._armature._armatureData.scale;
72609                const e = this._deformVertices.vertices;
72610                const i = this._deformVertices.bones;
72611                const s = this._deformVertices.verticesData;
72612                const n = s.weight;
72613                const r = e.length > 0 && s.inheritDeform;
72614                const o = this._localVertices;
72615                if (n) {
72616                  const a = s.data;
72617                  const l = a.intArray;
72618                  const h = a.floatArray;
72619                  const c = l[s.offset + b5.MeshVertexCount];
72620                  let u = l[n.offset + b5.WeigthFloatOffset];
72621                  u < 0 && (u += 65536);
72622                  for (let s = 0, a = n.offset + b5.WeigthBoneIndices + i.length, _ = u, d = 0, p = 0; s < c; s++,
72623                  p += 4) {
72624                    const s = l[a++];
72625                    let n = 0;
72626                    let c = 0;
72627                    for (let o = 0; o < s; ++o) {
72628                      const s = i[l[a++]];
72629                      if (null !== s) {
72630                        const i = s.globalTransformMatrix;
72631                        const o = h[_++];
72632                        let a = h[_++] * t;
72633                        let l = h[_++] * t;
72634                        if (r) {
72635                          a += e[d++];
72636                          l += e[d++];
72637                        }
72638                        n += (i.a * a + i.c * l + i.tx) * o;
72639                        c += (i.b * a + i.d * l + i.ty) * o;
72640                      }
72641                    }
72642                    o[p] = n;
72643                    o[p + 1] = -c;
72644                  }
72645                } else if (r) {
72646                  const i = this._parent._boneData.type !== S5.Bone;
72647                  const n = s.data;
72648                  const r = n.intArray;
72649                  const a = n.floatArray;
72650                  const l = r[s.offset + b5.MeshVertexCount];
72651                  let h = r[s.offset + b5.MeshFloatOffset];
72652                  h < 0 && (h += 65536);
72653                  for (let s = 0, n = l, r = 0; s < n; s++, r += 4) {
72654                    const n = a[h + 2 * s] * t + e[2 * s];
72655                    const l = a[h + 2 * s + 1] * t + e[2 * s + 1];
72656                    if (i) {
72657                      const t = this._parent._getGlobalTransformMatrix(n, l);
72658                      o[r] = t.a * n + t.c * l + t.tx;
72659                      o[r + 1] = -t.b * n + t.d * l + t.ty;
72660                    } else {
72661                      o[r] = n;
72662                      o[r + 1] = -l;
72663                    }
72664                  }
72665                }
72666                n && this._identityTransform();
72667              }
72668              _identityTransform() {
72669                const t = this._matrix;
72670                t.m00 = 1;
72671                t.m01 = 0;
72672                t.m04 = -0;
72673                t.m05 = -1;
72674                t.m12 = 0;
72675                t.m13 = 0;
72676                this._worldMatrixDirty = !0;
72677              }
72678              _updateTransform() {
72679                const t = this._matrix;
72680                t.m00 = this.globalTransformMatrix.a;
72681                t.m01 = this.globalTransformMatrix.b;
72682                t.m04 = -this.globalTransformMatrix.c;
72683                t.m05 = -this.globalTransformMatrix.d;
72684                if (this._childArmature) {
72685                  t.m12 = this.globalTransformMatrix.tx;
72686                  t.m13 = this.globalTransformMatrix.ty;
72687                } else {
72688                  t.m12 = this.globalTransformMatrix.tx - (this.globalTransformMatrix.a * this._pivotX - this.globalTransformMatrix.c * this._pivotY);
72689                  t.m13 = this.globalTransformMatrix.ty - (this.globalTransformMatrix.b * this._pivotX - this.globalTransformMatrix.d * this._pivotY);
72690                }
72691                this._worldMatrixDirty = !0;
72692              }
72693              updateWorldMatrix() {
72694                if (!this._armature) return;
72695                const t = this._armature._parent;
72696                t && t.updateWorldMatrix();
72697                if (this._worldMatrixDirty) {
72698                  this.calculWorldMatrix();
72699                  const t = this.childArmature;
72700                  if (!t) return;
72701                  const e = t.getSlots();
72702                  for (let t = 0, i = e.length; t < i; t++) {
72703                    const i = e[t];
72704                    i && (i._worldMatrixDirty = !0);
72705                  }
72706                }
72707              }
72708              _mulMat(t, e, i) {
72709                const s = e.m00;
72710                const n = e.m01;
72711                const r = e.m04;
72712                const o = e.m05;
72713                const a = e.m12;
72714                const l = e.m13;
72715                const h = i.m00;
72716                const c = i.m01;
72717                const u = i.m04;
72718                const _ = i.m05;
72719                const d = i.m12;
72720                const p = i.m13;
72721                if (0 !== n || 0 !== r) {
72722                  t.m00 = h * s + c * r;
72723                  t.m01 = h * n + c * o;
72724                  t.m04 = u * s + _ * r;
72725                  t.m05 = u * n + _ * o;
72726                  t.m12 = s * d + r * p + a;
72727                  t.m13 = n * d + o * p + l;
72728                } else {
72729                  t.m00 = h * s;
72730                  t.m01 = c * o;
72731                  t.m04 = u * s;
72732                  t.m05 = _ * o;
72733                  t.m12 = s * d + a;
72734                  t.m13 = o * p + l;
72735                }
72736              }
72737            }, w5)) || x5;
72738            var I5, M5;
72739            let B5 = Ul("dragonBones.CCArmatureDisplay")(I5 = (M5 = class extends u5 {
72740              get node() {
72741                return this;
72742              }
72743              constructor() {
72744                super();
72745                this.shouldAdvanced = !1;
72746                this._ccNode = null;
72747                this._ccComponent = null;
72748                this._eventTarget = void 0;
72749                this._armature = null;
72750                this._eventTarget = new vo;
72751              }
72752              hasEvent(t) {
72753                console.warn("Method not implemented.");
72754                return !1;
72755              }
72756              addEvent(t, e, i) {
72757                console.warn("Method not implemented.");
72758              }
72759              removeEvent(t, e, i) {
72760                console.warn("Method not implemented.");
72761              }
72762              setEventTarget(t) {
72763                this._eventTarget = t;
72764              }
72765              getRootDisplay() {
72766                let t = this._armature._parent;
72767                if (!t) return this;
72768                let e;
72769                for (;t; ) {
72770                  e = t;
72771                  t = t._armature._parent;
72772                }
72773                return e._armature.display;
72774              }
72775              convertToRootSpace(t) {
72776                const e = this._armature._parent;
72777                if (!e) return t;
72778                e.updateWorldMatrix();
72779                const i = e._worldMatrix;
72780                const s = new Pi(0, 0);
72781                s.x = t.x * i.m00 + t.y * i.m04 + i.m12;
72782                s.y = t.x * i.m01 + t.y * i.m05 + i.m13;
72783                return s;
72784              }
72785              convertToWorldSpace(t) {
72786                var e;
72787                const i = this.convertToRootSpace(t);
72788                const s = this.getRootNode();
72789                return null == s || null === (e = s._uiProps.uiTransformComp) || void 0 === e ? void 0 : e.convertToWorldSpaceAR(i);
72790              }
72791              getRootNode() {
72792                const t = this.getRootDisplay();
72793                return t && t._ccNode;
72794              }
72795              dbInit(t) {
72796                this._armature = t;
72797              }
72798              dbClear() {
72799                this._armature = null;
72800              }
72801              dbUpdate() {
72802                this._ccComponent && this._ccComponent.markForUpdateRenderData();
72803              }
72804              advanceTimeBySelf(t) {
72805                this.shouldAdvanced = !!t;
72806              }
72807              hasDBEventListener(t) {
72808                return this._eventTarget.hasEventListener(t);
72809              }
72810              addDBEventListener(t, e, i) {
72811                this._eventTarget.on(t, e, i);
72812              }
72813              removeDBEventListener(t, e, i) {
72814                this._eventTarget.off(t, e, i);
72815              }
72816              dispatchDBEvent(t, e) {
72817                this._eventTarget.emit(t, e);
72818              }
72819            }, M5)) || I5;
72820            var D5, P5, O5;
72821            let N5 = Ul("CCFactory")(D5 = (O5 = P5 = class t extends y5 {
72822              static getInstance() {
72823                t._factory || (t._factory = new t);
72824                return t._factory;
72825              }
72826              constructor() {
72827                super();
72828                this.id = void 0;
72829                this.uuid = void 0;
72830                this._slots = void 0;
72831                const t = new B5;
72832                this._dragonBones = new l5(t);
72833                if (IR.getScheduler()) {
72834                  BR.on(MR.EVENT_RESTART, this.onRestart, this);
72835                  this.initUpdate();
72836                }
72837                this.id = this.uuid = "CCFactory";
72838              }
72839              onRestart() {
72840                t._factory = null;
72841              }
72842              initUpdate(t) {
72843                Rg.enableForTarget(this);
72844                IR.getScheduler().scheduleUpdate(this, Tg.Priority.HIGH, !1);
72845              }
72846              update(t) {
72847                this._dragonBones.advanceTime(t);
72848              }
72849              getDragonBonesDataByRawData(t) {
72850                return (t instanceof ArrayBuffer ? y5._binaryParser : this._dataParser).parseDragonBonesData(t, 1);
72851              }
72852              buildArmatureDisplay(t, e, i, s) {
72853                const n = this.buildArmature(t, e, i, s);
72854                return n ? n._display : null;
72855              }
72856              createArmatureNode(t, e, i) {
72857                let s = (i = i || new _y).getComponent("dragonBones.ArmatureDisplay");
72858                s || (s = i.addComponent("dragonBones.ArmatureDisplay"));
72859                i.name = e;
72860                s._armatureName = e;
72861                s._dragonAsset = t.dragonAsset;
72862                s._dragonAtlasAsset = t.dragonAtlasAsset;
72863                s._init();
72864                return s;
72865              }
72866              _buildTextureAtlasData(t, e) {
72867                t ? t.renderTexture = e : t = h5.borrowObject(E5);
72868                return t;
72869              }
72870              _sortSlots() {
72871                const t = this._slots;
72872                const e = [];
72873                for (let i = 0, s = t.length; i < s; i++) {
72874                  const s = t[i];
72875                  const n = s._zOrder;
72876                  let r = !1;
72877                  for (let t = e.length - 1; t >= 0; t--) if (n >= e[t]._zOrder) {
72878                    e.splice(t + 1, 0, s);
72879                    r = !0;
72880                    break;
72881                  }
72882                  r || e.unshift(s);
72883                }
72884                this._slots = e;
72885              }
72886              _buildArmature(t) {
72887                const e = h5.borrowObject(p5);
72888                e._skinData = t.skin;
72889                e._animation = h5.borrowObject(f5);
72890                e._animation._armature = e;
72891                e._animation.animations = t.armature.animations;
72892                e._isChildArmature = !1;
72893                const i = new B5;
72894                e.init(t.armature, i, i, this._dragonBones);
72895                return e;
72896              }
72897              _buildSlot(t, e, i) {
72898                const s = h5.borrowObject(R5);
72899                const n = s;
72900                s.init(e, i, n, n);
72901                return s;
72902              }
72903              getDragonBonesDataByUUID(t) {
72904                for (const e in this._dragonBonesDataMap) if (-1 !== e.indexOf(t)) return this._dragonBonesDataMap[e];
72905                return null;
72906              }
72907              removeDragonBonesDataByUUID(t, e) {
72908                void 0 === e && (e = !0);
72909                for (const i in this._dragonBonesDataMap) if (-1 !== i.indexOf(t)) {
72910                  e && this._dragonBones.bufferObject(this._dragonBonesDataMap[i]);
72911                  delete this._dragonBonesDataMap[i];
72912                }
72913              }
72914            }, P5._factory = null, O5)) || D5;
72915            const L5 = 1 / 60;
72916            const F5 = [];
72917            const V5 = [];
72918            let k5 = 0;
72919            let U5 = 0;
72920            let G5 = 0;
72921            let z5 = null;
72922            let H5 = null;
72923            let j5 = 0;
72924            let X5 = 0;
72925            let W5 = 0;
72926            let Y5 = 0;
72927            let q5 = 0;
72928            let K5;
72929            let J5;
72930            class Z5 {
72931              constructor() {
72932                this.maxVertexCount = 0;
72933                this.maxIndexCount = 0;
72934                this._privateMode = !1;
72935                this._inited = !1;
72936                this._invalid = !0;
72937                this._enableCacheAttachedInfo = !1;
72938                this.frames = [];
72939                this.totalTime = 0;
72940                this.isCompleted = !1;
72941                this._frameIdx = -1;
72942                this._armatureInfo = null;
72943                this._animationName = null;
72944                this._tempSegments = null;
72945                this._tempColors = null;
72946                this._tempBoneInfos = null;
72947              }
72948              init(t, e) {
72949                this._inited = !0;
72950                this._armatureInfo = t;
72951                this._animationName = e;
72952              }
72953              clear() {
72954                this._inited = !1;
72955                for (let t = 0, e = this.frames.length; t < e; t++) {
72956                  this.frames[t].segments.length = 0;
72957                }
72958                this.invalidAllFrame();
72959              }
72960              begin() {
72961                if (!this._invalid) return;
72962                const t = this._armatureInfo;
72963                const e = t.curAnimationCache;
72964                e && e !== this && (this._privateMode ? e.invalidAllFrame() : e.updateToFrame());
72965                t.armature.animation.play(this._animationName, 1);
72966                t.curAnimationCache = this;
72967                this._invalid = !1;
72968                this._frameIdx = -1;
72969                this.totalTime = 0;
72970                this.isCompleted = !1;
72971              }
72972              end() {
72973                if (!this._needToUpdate()) {
72974                  this._armatureInfo.curAnimationCache = null;
72975                  this.frames.length = this._frameIdx + 1;
72976                  this.isCompleted = !0;
72977                }
72978              }
72979              _needToUpdate(t) {
72980                return !this._armatureInfo.armature.animation.isCompleted && this.totalTime < 30 && (void 0 === t || this._frameIdx < t);
72981              }
72982              updateToFrame(t) {
72983                if (!this._inited) return;
72984                this.begin();
72985                if (!this._needToUpdate(t)) return;
72986                const e = this._armatureInfo.armature;
72987                do {
72988                  e.advanceTime(L5);
72989                  this._frameIdx++;
72990                  this.updateFrame(e, this._frameIdx);
72991                  this.totalTime += L5;
72992                } while (this._needToUpdate(t));
72993                this.end();
72994              }
72995              isInited() {
72996                return this._inited;
72997              }
72998              isInvalid() {
72999                return this._invalid;
73000              }
73001              invalidAllFrame() {
73002                this.isCompleted = !1;
73003                this._invalid = !0;
73004              }
73005              updateAllFrame() {
73006                this.invalidAllFrame();
73007                this.updateToFrame();
73008              }
73009              enableCacheAttachedInfo() {
73010                if (!this._enableCacheAttachedInfo) {
73011                  this._enableCacheAttachedInfo = !0;
73012                  this.invalidAllFrame();
73013                }
73014              }
73015              updateFrame(t, e) {
73016                G5 = 0;
73017                k5 = 0;
73018                U5 = 0;
73019                z5 = null;
73020                H5 = null;
73021                j5 = 0;
73022                X5 = 0;
73023                W5 = 0;
73024                Y5 = 0;
73025                q5 = 0;
73026                this.frames[e] = this.frames[e] || {
73027                  segments: [],
73028                  colors: [],
73029                  boneInfos: [],
73030                  vertices: null,
73031                  uintVert: null,
73032                  indices: null
73033                };
73034                const i = this.frames[e];
73035                const s = this._tempSegments = i.segments;
73036                const n = this._tempColors = i.colors;
73037                const r = this._tempBoneInfos = i.boneInfos;
73038                this._traverseArmature(t, 1);
73039                Y5 > 0 && (n[Y5 - 1].vfOffset = G5);
73040                n.length = Y5;
73041                r.length = k5;
73042                const o = W5 - 1;
73043                if (o >= 0) if (X5 > 0) {
73044                  const t = s[o];
73045                  t.indexCount = X5;
73046                  t.vfCount = 9 * j5;
73047                  t.vertexCount = j5;
73048                  s.length = W5;
73049                } else s.length = W5 - 1;
73050                if (0 === s.length) return;
73051                let a = i.vertices;
73052                const l = G5 / 5;
73053                const h = 9 * l;
73054                (!a || a.length < G5) && (a = i.vertices = new Float32Array(h));
73055                let c;
73056                for (let t = 0, e = 0; t < h; ) {
73057                  a[t] = F5[e++];
73058                  a[t + 1] = F5[e++];
73059                  a[t + 3] = F5[e++];
73060                  a[t + 4] = F5[e++];
73061                  c = F5[e++];
73062                  a[t + 5] = (255 & c) / 255;
73063                  a[t + 6] = (c >> 8 & 255) / 255;
73064                  a[t + 7] = (c >> 16 & 255) / 255;
73065                  a[t + 8] = (c >> 24 & 255) / 255;
73066                  t += 9;
73067                }
73068                let u = i.indices;
73069                (!u || u.length < U5) && (u = i.indices = new Uint16Array(U5));
73070                for (let t = 0; t < U5; t++) u[t] = V5[t];
73071                i.vertices = a;
73072                i.indices = u;
73073                this.maxVertexCount = l > this.maxVertexCount ? l : this.maxVertexCount;
73074                this.maxIndexCount = u.length > this.maxIndexCount ? u.length : this.maxIndexCount;
73075              }
73076              _traverseArmature(t, e) {
73077                const i = this._tempColors;
73078                const s = this._tempSegments;
73079                const n = this._tempBoneInfos;
73080                const r = t._slots;
73081                let o;
73082                let a;
73083                let l;
73084                let h;
73085                let c;
73086                let u;
73087                let _;
73088                let d;
73089                let p;
73090                const m = t._bones;
73091                if (this._enableCacheAttachedInfo) for (let t = 0, e = m.length; t < e; t++, k5++) {
73092                  const e = m[t];
73093                  let i = n[k5];
73094                  i || (i = n[k5] = {
73095                    globalTransformMatrix: new c5
73096                  });
73097                  const s = e.globalTransformMatrix;
73098                  i.globalTransformMatrix.copyFrom(s);
73099                }
73100                for (let t = 0, n = r.length; t < n; t++) {
73101                  l = r[t];
73102                  if (l._visible && l._displayData) {
73103                    l.updateWorldMatrix();
73104                    c = l._color;
73105                    if (l.childArmature) this._traverseArmature(l.childArmature, e * c.a / 255); else {
73106                      _ = l.getTexture();
73107                      if (_) {
73108                        if (z5 !== _.nativeUrl || H5 !== l._blendMode) {
73109                          z5 = _.nativeUrl;
73110                          H5 = l._blendMode;
73111                          d = W5 - 1;
73112                          if (d >= 0) if (X5 > 0) {
73113                            p = s[d];
73114                            p.indexCount = X5;
73115                            p.vertexCount = j5;
73116                            p.vfCount = 9 * j5;
73117                          } else W5--;
73118                          s[W5] = {
73119                            tex: _,
73120                            blendMode: l._blendMode,
73121                            indexCount: 0,
73122                            vertexCount: 0,
73123                            vfCount: 0
73124                          };
73125                          W5++;
73126                          X5 = 0;
73127                          j5 = 0;
73128                        }
73129                        u = (c.a * e << 24 >>> 0) + (c.b << 16) + (c.g << 8) + c.r;
73130                        if (q5 !== u) {
73131                          q5 = u;
73132                          Y5 > 0 && (i[Y5 - 1].vfOffset = G5);
73133                          i[Y5++] = {
73134                            r: c.r,
73135                            g: c.g,
73136                            b: c.b,
73137                            a: c.a * e,
73138                            vfOffset: 0
73139                          };
73140                        }
73141                        o = l._localVertices;
73142                        a = l._indices;
73143                        h = l._worldMatrix;
73144                        for (let t = 0, e = o.length; t < e; ) {
73145                          K5 = o[t++];
73146                          J5 = o[t++];
73147                          F5[G5++] = K5 * h.m00 + J5 * h.m04 + h.m12;
73148                          F5[G5++] = K5 * h.m01 + J5 * h.m05 + h.m13;
73149                          F5[G5++] = o[t++];
73150                          F5[G5++] = o[t++];
73151                          F5[G5++] = u;
73152                        }
73153                        for (let t = 0, e = a.length; t < e; t++) V5[U5++] = j5 + a[t];
73154                        X5 += a.length;
73155                        j5 += o.length / 4;
73156                      }
73157                    }
73158                  }
73159                }
73160              }
73161            }
73162            class Q5 {
73163              constructor() {
73164                this._privateMode = !1;
73165                this._animationPool = {};
73166                this._armatureCache = {};
73167              }
73168              enablePrivateMode() {
73169                this._privateMode = !0;
73170              }
73171              dispose() {
73172                for (const t in this._armatureCache) {
73173                  const e = this._armatureCache[t];
73174                  if (e) {
73175                    const t = e.armature;
73176                    t && t.dispose();
73177                  }
73178                }
73179                this._armatureCache = {};
73180                this._animationPool = {};
73181              }
73182              _removeArmature(t) {
73183                const e = this._armatureCache[t];
73184                const i = e.animationsCache;
73185                for (const e in i) {
73186                  const s = i[e];
73187                  if (s) {
73188                    this._animationPool[`${t}#${e}`] = s;
73189                    s.clear();
73190                  }
73191                }
73192                const s = e.armature;
73193                s && s.dispose();
73194                delete this._armatureCache[t];
73195              }
73196              resetArmature(t) {
73197                for (const e in this._armatureCache) -1 !== e.indexOf(t) && this._removeArmature(e);
73198              }
73199              getArmatureCache(t, e, i) {
73200                const s = this._armatureCache[e];
73201                let n;
73202                if (s) n = s.armature; else {
73203                  const s = N5.getInstance().buildArmatureDisplay(t, e, "", i);
73204                  if (!s || !s._armature) return null;
73205                  n = s._armature;
73206                  if (!Q5.canCache(n)) {
73207                    n.dispose();
73208                    return null;
73209                  }
73210                  this._armatureCache[e] = {
73211                    armature: n,
73212                    animationsCache: {},
73213                    curAnimationCache: null
73214                  };
73215                }
73216                return n;
73217              }
73218              getAnimationCache(t, e) {
73219                const i = this._armatureCache[t];
73220                if (!i) return null;
73221                return i.animationsCache[e];
73222              }
73223              initAnimationCache(t, e) {
73224                if (!e) return null;
73225                const i = this._armatureCache[t];
73226                const s = i && i.armature;
73227                if (!s) return null;
73228                if (!s.animation.hasAnimation(e)) return null;
73229                const n = i.animationsCache;
73230                let r = n[e];
73231                if (!r) {
73232                  const s = `${t}#${e}`;
73233                  r = this._animationPool[s];
73234                  if (r) delete this._animationPool[s]; else {
73235                    r = new Z5;
73236                    r._privateMode = this._privateMode;
73237                  }
73238                  r.init(i, e);
73239                  n[e] = r;
73240                }
73241                return r;
73242              }
73243              invalidAnimationCache(t) {
73244                const e = this._armatureCache[t];
73245                if (!(e && e.armature)) return;
73246                const i = e.animationsCache;
73247                for (const t in i) {
73248                  i[t].invalidAllFrame();
73249                }
73250              }
73251              updateAnimationCache(t, e) {
73252                if (e) {
73253                  const i = this.initAnimationCache(t, e);
73254                  if (!i) return;
73255                  i.updateAllFrame();
73256                } else {
73257                  const e = this._armatureCache[t];
73258                  if (!(e && e.armature)) return;
73259                  const i = e.animationsCache;
73260                  for (const t in i) {
73261                    i[t].updateAllFrame();
73262                  }
73263                }
73264              }
73265              static canCache(t) {
73266                const e = t._slots;
73267                for (let t = 0, i = e.length; t < i; t++) {
73268                  if (e[t].childArmature) return !1;
73269                }
73270                return !0;
73271              }
73272            }
73273            Q5.FrameTime = L5;
73274            Q5.sharedCache = new Q5;
73275            var $5, t4, e4, i4;
73276            let s4 = Ul("dragonBones.DragonBonesAsset")($5 = (t4 = (i4 = class extends gc {
73277              constructor(...t) {
73278                super(...t);
73279                Ml(this, "_dragonBonesJson", e4, this);
73280                this._factory = null;
73281                this._dragonBonesJsonData = void 0;
73282                this._armaturesEnum = null;
73283              }
73284              get dragonBonesJson() {
73285                return this._dragonBonesJson;
73286              }
73287              set dragonBonesJson(t) {
73288                this._dragonBonesJson = t;
73289                this._dragonBonesJsonData = JSON.parse(t);
73290                this.reset();
73291              }
73292              constructctor() {
73293                this.reset();
73294              }
73295              createNode(t) {
73296                const e = new _y(this.name);
73297                e.addComponent("dragonBones.ArmatureDisplay").dragonAsset = this;
73298                return t(null, e);
73299              }
73300              reset() {
73301                this._clear();
73302              }
73303              init(t, e) {
73304                this._factory = t || N5.getInstance();
73305                !this._dragonBonesJsonData && this.dragonBonesJson && (this._dragonBonesJsonData = JSON.parse(this.dragonBonesJson));
73306                let i = null;
73307                i = this._dragonBonesJsonData ? this._dragonBonesJsonData : this._nativeAsset;
73308                if (!this._uuid) {
73309                  const t = this._factory.getDragonBonesDataByRawData(i);
73310                  t ? this._uuid = t.name : console.warn("dragonbones name is empty");
73311                }
73312                const s = `${this._uuid}#${e}`;
73313                if (this._factory.getDragonBonesData(s)) return s;
73314                this._factory.parseDragonBonesData(i instanceof ArrayBuffer ? i : i.buffer instanceof ArrayBuffer ? i.buffer : i, s);
73315                return s;
73316              }
73317              getArmatureEnum() {
73318                if (this._armaturesEnum) return this._armaturesEnum;
73319                this.init();
73320                const t = this._factory.getDragonBonesDataByUUID(this._uuid);
73321                if (t) {
73322                  const e = t.armatureNames;
73323                  const i = {};
73324                  for (let t = 0; t < e.length; t++) {
73325                    i[e[t]] = t;
73326                  }
73327                  return this._armaturesEnum = oe(i);
73328                }
73329                return null;
73330              }
73331              getAnimsEnum(t) {
73332                this.init();
73333                const e = this._factory.getDragonBonesDataByUUID(this._uuid);
73334                if (e) {
73335                  const i = e.getArmature(t);
73336                  if (!i) return null;
73337                  const s = {
73338                    "<None>": 0
73339                  };
73340                  const n = i.animations;
73341                  let r = 0;
73342                  for (const t in n) if (n.hasOwnProperty(t)) {
73343                    s[t] = r + 1;
73344                    r++;
73345                  }
73346                  return oe(s);
73347                }
73348                return null;
73349              }
73350              destroy() {
73351                this._clear();
73352                return super.destroy();
73353              }
73354              _clear() {
73355                if (this._factory) {
73356                  Q5.sharedCache.resetArmature(this._uuid);
73357                  this._factory.removeDragonBonesDataByUUID(this._uuid, !0);
73358                }
73359              }
73360            }, i4), e4 = Bl(t4.prototype, "_dragonBonesJson", [ Yl ], {
73361              configurable: !0,
73362              enumerable: !0,
73363              writable: !0,
73364              initializer: function() {
73365                return "";
73366              }
73367            }), t4)) || $5;
73368            m.internal.DragonBonesAsset = s4;
73369            var n4, r4, o4, a4, l4, h4, c4, u4, _4;
73370            let d4 = (n4 = Ul("dragonBones.DragonBonesAtlasAsset"), r4 = Th(LC), n4(o4 = (a4 = (_4 = class extends gc {
73371              constructor() {
73372                super();
73373                Ml(this, "_atlasJson", l4, this);
73374                Ml(this, "_texture", h4, this);
73375                Ml(this, "_atlasJsonData", c4, this);
73376                this._factory = null;
73377                Ml(this, "_textureAtlasData", u4, this);
73378                this._clear();
73379              }
73380              get atlasJson() {
73381                return this._atlasJson;
73382              }
73383              set atlasJson(t) {
73384                this._atlasJson = t;
73385                this._atlasJsonData = JSON.parse(this.atlasJson);
73386                this._clear();
73387              }
73388              get texture() {
73389                return this._texture;
73390              }
73391              set texture(t) {
73392                this._texture = t;
73393                this._clear();
73394              }
73395              createNode(t) {
73396                const e = new _y(this.name);
73397                e.addComponent("dragonBones.ArmatureDisplay").dragonAtlasAsset = this;
73398                return t(null, e);
73399              }
73400              init(t) {
73401                this._factory = t;
73402                this._atlasJsonData || (this._atlasJsonData = JSON.parse(this.atlasJson));
73403                const e = this._atlasJsonData;
73404                this._uuid = this._uuid || e.name;
73405                this._textureAtlasData ? t.addTextureAtlasData(this._textureAtlasData, this._uuid) : this._textureAtlasData = t.parseTextureAtlasData(e, this.texture, this._uuid);
73406              }
73407              destroy() {
73408                this._clear();
73409                return super.destroy();
73410              }
73411              _clear() {}
73412            }, _4), l4 = Bl(a4.prototype, "_atlasJson", [ Yl ], {
73413              configurable: !0,
73414              enumerable: !0,
73415              writable: !0,
73416              initializer: function() {
73417                return "";
73418              }
73419            }), h4 = Bl(a4.prototype, "_texture", [ Yl, r4 ], {
73420              configurable: !0,
73421              enumerable: !0,
73422              writable: !0,
73423              initializer: function() {
73424                return null;
73425              }
73426            }), c4 = Bl(a4.prototype, "_atlasJsonData", [ Yl ], {
73427              configurable: !0,
73428              enumerable: !0,
73429              writable: !0,
73430              initializer: function() {
73431                return {};
73432              }
73433            }), u4 = Bl(a4.prototype, "_textureAtlasData", [ Yl ], {
73434              configurable: !0,
73435              enumerable: !0,
73436              writable: !0,
73437              initializer: function() {
73438                return null;
73439              }
73440            }), a4)) || o4);
73441            m.internal.DragonBonesAtlasAsset = d4;
73442            var p4;
73443            const m4 = new qi;
73444            let f4 = Ul("dragonBones.AttachUtil")(p4 = class {
73445              constructor() {
73446                this._inited = !1;
73447                this._armature = null;
73448                this._armatureNode = null;
73449                this._armatureDisplay = null;
73450              }
73451              init(t) {
73452                this._inited = !0;
73453                this._armature = t._armature;
73454                this._armatureNode = t.node;
73455                this._armatureDisplay = t;
73456              }
73457              reset() {
73458                this._inited = !1;
73459                this._armature = null;
73460                this._armatureNode = null;
73461                this._armatureDisplay = null;
73462              }
73463              _syncAttachedNode() {
73464                if (!this._inited) return;
73465                this._armatureNode.worldMatrix;
73466                let t = null;
73467                const e = this._armatureDisplay.isAnimationCached();
73468                if (e && this._armatureDisplay) {
73469                  t = this._armatureDisplay._curFrame && this._armatureDisplay._curFrame.boneInfos;
73470                  if (!t) return;
73471                }
73472                const i = this._armatureDisplay.sockets;
73473                const s = this._armatureDisplay.socketNodes;
73474                const n = (t, e) => {
73475                  const i = m4;
73476                  i.m00 = e.a;
73477                  i.m01 = e.b;
73478                  i.m04 = -e.c;
73479                  i.m05 = -e.d;
73480                  i.m12 = e.tx;
73481                  i.m13 = e.ty;
73482                  t.matrix = m4;
73483                };
73484                const r = this._armature.getBones();
73485                for (let o = i.length - 1; o >= 0; o--) {
73486                  const a = i[o];
73487                  const l = a.target;
73488                  if (!l) continue;
73489                  if (!l.isValid) {
73490                    s.delete(a.path);
73491                    i.splice(o, 1);
73492                    continue;
73493                  }
73494                  const h = e ? t[a.boneIndex] : r[a.boneIndex];
73495                  h && n(l, h.globalTransformMatrix);
73496                }
73497              }
73498            }) || p4;
73499            class g4 extends Tg {
73500              constructor() {
73501                super();
73502                this._armatures = new Set;
73503              }
73504              static getInstance() {
73505                if (!g4._instance) {
73506                  g4._instance = new g4;
73507                  IR.registerSystem(g4.ID, g4._instance, Tg.Priority.HIGH);
73508                }
73509                return g4._instance;
73510              }
73511              add(t) {
73512                t && (this._armatures.has(t) || this._armatures.add(t));
73513              }
73514              remove(t) {
73515                t && this._armatures.has(t) && this._armatures.delete(t);
73516              }
73517              postUpdate(t) {
73518                this._armatures && this._armatures.forEach((e => {
73519                  e.updateAnimation(t);
73520                }));
73521              }
73522              prepareRenderData() {
73523                this._armatures && this._armatures.forEach((t => {
73524                  t.markForUpdateRenderData();
73525                }));
73526              }
73527            }
73528            g4.ID = "ARMATURE";
73529            g4._instance = void 0;
73530            m.internal.ArmatureSystem = g4;
73531            var y4, b4, S4, A4, T4, v4, E4, C4, x4, w4, R4, I4, M4, B4, D4, P4, O4, N4, L4, F4, V4, k4, U4, G4, z4, H4, j4, X4, W4, Y4, q4, K4, J4, Z4, Q4, $4, t8, e8, i8, s8, n8, r8, o8, a8, l8, h8, c8, u8, _8, d8;
73532            var p8;
73533            !function(t) {
73534              t[t.default = -1] = "default";
73535            }(p8 || (p8 = {}));
73536            he(p8);
73537            var m8;
73538            !function(t) {
73539              t[t["<None>"] = 0] = "<None>";
73540            }(m8 || (m8 = {}));
73541            he(m8);
73542            var f8;
73543            !function(t) {
73544              t[t.REALTIME = 0] = "REALTIME";
73545            }(f8 || (f8 = {}));
73546            he(m8);
73547            let g8;
73548            !function(t) {
73549              t[t.REALTIME = 0] = "REALTIME";
73550              t[t.SHARED_CACHE = 1] = "SHARED_CACHE";
73551              t[t.PRIVATE_CACHE = 2] = "PRIVATE_CACHE";
73552            }(g8 || (g8 = {}));
73553            he(g8);
73554            function y8(t, e, i) {
73555              si.Attr.setClassAttr(t, e, "type", "Enum");
73556              si.Attr.setClassAttr(t, e, "enumList", oe.getList(i));
73557            }
73558            let b8 = (y4 = Ul("dragonBones.ArmatureDisplay.DragonBoneSocket"), b4 = Th(_y),
73559            y4(S4 = (A4 = (E4 = class {
73560              constructor(t = "", e = null) {
73561                Ml(this, "path", T4, this);
73562                Ml(this, "target", v4, this);
73563                this.boneIndex = null;
73564                this.path = t;
73565                this.target = e;
73566              }
73567            }, E4), T4 = Bl(A4.prototype, "path", [ Yl, nh ], {
73568              configurable: !0,
73569              enumerable: !0,
73570              writable: !0,
73571              initializer: function() {
73572                return "";
73573              }
73574            }), v4 = Bl(A4.prototype, "target", [ b4, nh, Yl ], {
73575              configurable: !0,
73576              enumerable: !0,
73577              writable: !0,
73578              initializer: function() {
73579                return null;
73580              }
73581            }), A4)) || S4);
73582            Wt(b8, "dragonBones.ArmatureDisplay.DragonBoneSocket");
73583            let S8 = (C4 = Ul("dragonBones.ArmatureDisplay"), x4 = sh(), w4 = $l(), R4 = Th(s4),
73584            I4 = lh(), M4 = Th(d4), B4 = lh(), D4 = rh(), P4 = rh(), O4 = ah(), N4 = Th(p8),
73585            L4 = lh(), F4 = Th(m8), V4 = ah(), k4 = lh(), U4 = ah(), G4 = lh(), z4 = lh(), H4 = lh(),
73586            j4 = lh(), X4 = lh(), W4 = Th([ b8 ]), Y4 = lh(), q4 = Th(hm), K4 = ph(), J4 = ah(),
73587            C4(Z4 = x4(Z4 = w4(Z4 = Ql(Z4 = (Q4 = (d8 = _8 = class t extends uD {
73588              get dragonAsset() {
73589                return this._dragonAsset;
73590              }
73591              set dragonAsset(t) {
73592                this._dragonAsset = t;
73593                this.destroyRenderData();
73594                this._refresh();
73595              }
73596              get dragonAtlasAsset() {
73597                return this._dragonAtlasAsset;
73598              }
73599              set dragonAtlasAsset(t) {
73600                this._dragonAtlasAsset = t;
73601                this._parseDragonAtlasAsset();
73602                this._refresh();
73603              }
73604              get armatureName() {
73605                return this._armatureName;
73606              }
73607              set armatureName(t) {
73608                this._armatureName = t;
73609                const e = this.getAnimationNames(this._armatureName);
73610                (!this.animationName || e.indexOf(this.animationName) < 0) && (this.animationName = "");
73611                this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.remove(this._armature);
73612                this._refresh();
73613                this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature);
73614              }
73615              get animationName() {
73616                return this._animationName;
73617              }
73618              set animationName(t) {
73619                this._animationName = t;
73620              }
73621              get _defaultArmatureIndex() {
73622                return this._defaultArmatureIndexValue;
73623              }
73624              set _defaultArmatureIndex(t) {
73625                this._defaultArmatureIndexValue = t;
73626                let e = "";
73627                if (this.dragonAsset) {
73628                  let t;
73629                  this.dragonAsset && (t = this.dragonAsset.getArmatureEnum());
73630                  if (!t) {
73631                    F(7400, this.name);
73632                    return;
73633                  }
73634                  e = t[this._defaultArmatureIndex];
73635                }
73636                void 0 !== e ? this.armatureName = e : F(7401, this.name);
73637                this.markForUpdateRenderData();
73638              }
73639              get _animationIndex() {
73640                return this._animationIndexValue;
73641              }
73642              set _animationIndex(t) {
73643                this._animationIndexValue = t;
73644                if (0 === this._animationIndex) {
73645                  this.animationName = "";
73646                  return;
73647                }
73648                let e;
73649                this.dragonAsset && (e = this.dragonAsset.getAnimsEnum(this.armatureName));
73650                if (!e) return;
73651                const i = e[this._animationIndex];
73652                void 0 !== i ? this.playAnimation(i, this.playTimes) : F(7402, this.name);
73653              }
73654              get _defaultCacheMode() {
73655                return this._defaultCacheModeValue;
73656              }
73657              set _defaultCacheMode(t) {
73658                this._defaultCacheModeValue = t;
73659                if (this._defaultCacheMode === g8.REALTIME || !this._armature || Q5.canCache(this._armature)) this.setAnimationCacheMode(this._defaultCacheMode); else {
73660                  this._defaultCacheMode = g8.REALTIME;
73661                  console.warn("Animation cache mode doesn't support skeletal nesting");
73662                }
73663              }
73664              get timeScale() {
73665                return this._timeScale;
73666              }
73667              set timeScale(t) {
73668                this._timeScale = t;
73669                this._armature && !this.isAnimationCached() && (this._armature.animation.timeScale = this.timeScale);
73670              }
73671              get debugBones() {
73672                return this._debugBones;
73673              }
73674              set debugBones(t) {
73675                this._debugBones = t;
73676                this._updateDebugDraw();
73677              }
73678              get sockets() {
73679                return this._sockets;
73680              }
73681              set sockets(t) {
73682                this._verifySockets(t);
73683                this._sockets = t;
73684                this._updateSocketBindings();
73685                t.length > 0 && this._frameCache && this._frameCache.enableCacheAttachedInfo();
73686              }
73687              get socketNodes() {
73688                return this._socketNodes;
73689              }
73690              get drawList() {
73691                return this._drawList;
73692              }
73693              requestDrawInfo(t) {
73694                this._drawInfoList[t] || (this._drawInfoList[t] = new aB);
73695                return this._drawInfoList[t];
73696              }
73697              constructor() {
73698                super();
73699                Ml(this, "playTimes", $4, this);
73700                Ml(this, "premultipliedAlpha", t8, this);
73701                this._armature = null;
73702                this.attachUtil = void 0;
73703                Ml(this, "_defaultArmatureIndexValue", e8, this);
73704                Ml(this, "_dragonAsset", i8, this);
73705                Ml(this, "_dragonAtlasAsset", s8, this);
73706                Ml(this, "_armatureName", n8, this);
73707                Ml(this, "_animationName", r8, this);
73708                Ml(this, "_animationIndexValue", o8, this);
73709                this._preCacheMode = -1;
73710                this._cacheMode = g8.REALTIME;
73711                Ml(this, "_defaultCacheModeValue", a8, this);
73712                Ml(this, "_timeScale", l8, this);
73713                Ml(this, "_playTimes", h8, this);
73714                Ml(this, "_debugBones", c8, this);
73715                this._debugDraw = null;
73716                this._armatureKey = "";
73717                this._accTime = 0;
73718                this._playCount = 0;
73719                this._frameCache = null;
73720                this._curFrame = null;
73721                this._playing = !1;
73722                this._armatureCache = null;
73723                this._eventTarget = void 0;
73724                this._factory = null;
73725                this._displayProxy = null;
73726                this._drawIdx = 0;
73727                this._drawList = new to((() => ({
73728                  material: null,
73729                  texture: null,
73730                  indexOffset: 0,
73731                  indexCount: 0
73732                })), 1);
73733                this.maxVertexCount = 0;
73734                this.maxIndexCount = 0;
73735                this._materialCache = {};
73736                this._enumArmatures = oe({});
73737                this._enumAnimations = oe({});
73738                this._socketNodes = new Map;
73739                this._cachedSockets = new Map;
73740                Ml(this, "_sockets", u8, this);
73741                this._inited = void 0;
73742                this._drawInfoList = [];
73743                this._cacheModeEnum = void 0;
73744                this._eventTarget = new vo;
73745                this._inited = !1;
73746                this.attachUtil = new f4;
73747                this.initFactory();
73748                y8(this, "_animationIndex", this._enumAnimations);
73749                y8(this, "_defaultArmatureIndex", this._enumArmatures);
73750                this._useVertexOpacity = !0;
73751              }
73752              initFactory() {
73753                this._factory = N5.getInstance();
73754              }
73755              onLoad() {
73756                super.onLoad();
73757                const t = this.node.children;
73758                for (let e = 0, i = t.length; e < i; e++) {
73759                  const i = t[e];
73760                  0 === (i.name && i.name.search("CHILD_ARMATURE-")) && i.destroy();
73761                }
73762              }
73763              _requestDrawData(t, e, i, s) {
73764                const n = this._drawList.add();
73765                n.material = t;
73766                n.texture = e;
73767                n.indexOffset = i;
73768                n.indexCount = s;
73769                return n;
73770              }
73771              destroyRenderData() {
73772                this._drawList.reset();
73773                super.destroyRenderData();
73774              }
73775              getMaterialForBlend(t, e) {
73776                const i = `${t}/${e}`;
73777                let s = this._materialCache[i];
73778                if (s) return s;
73779                const n = this.getMaterial(0);
73780                s = new uS({
73781                  parent: n,
73782                  subModelIdx: 0,
73783                  owner: this
73784                });
73785                s.recompileShaders({
73786                  USE_LOCAL: !0
73787                }, 0);
73788                this._materialCache[i] = s;
73789                s.overridePipelineStates({
73790                  blendState: {
73791                    targets: [ {
73792                      blendSrc: t,
73793                      blendDst: e
73794                    } ]
73795                  }
73796                });
73797                return s;
73798              }
73799              get customMaterial() {
73800                return this._customMaterial;
73801              }
73802              set customMaterial(t) {
73803                this._customMaterial = t;
73804                this._cleanMaterialCache();
73805                this.setMaterial(this._customMaterial, 0);
73806                this.markForUpdateRenderData();
73807              }
73808              _render(t) {
73809                if (this.renderData && this._drawList) {
73810                  const e = this.renderData;
73811                  const i = e.chunk;
73812                  const s = i.vertexAccessor;
73813                  const n = e.getMeshBuffer();
73814                  const r = n.indexOffset;
73815                  s.appendIndices(i.bufferId, e.indices);
73816                  for (let e = 0; e < this._drawList.length; e++) {
73817                    this._drawIdx = e;
73818                    const i = this._drawList.data[e];
73819                    if (i.texture) {
73820                      const e = n.requireFreeIA(t.device);
73821                      e.firstIndex = r + i.indexOffset;
73822                      e.indexCount = i.indexCount;
73823                      t.commitIA(this, e, i.texture, i.material, this.node);
73824                    }
73825                  }
73826                }
73827              }
73828              __preload() {
73829                super.__preload();
73830                this._init();
73831              }
73832              _init() {
73833                this._cacheMode = this._defaultCacheMode;
73834                if (this._inited) return;
73835                this._inited = !0;
73836                this._parseDragonAtlasAsset();
73837                this._refresh();
73838                const t = this.node.children;
73839                for (let e = 0, i = t.length; e < i; e++) {
73840                  const i = t[e];
73841                  i && "DEBUG_DRAW_NODE" === i.name && i.destroy();
73842                }
73843                this._updateDebugDraw();
73844                this._indexBoneSockets();
73845                this._updateSocketBindings();
73846              }
73847              getArmatureKey() {
73848                return this._armatureKey;
73849              }
73850              setAnimationCacheMode(t) {
73851                if (this._preCacheMode !== t) {
73852                  this._cacheMode = t;
73853                  this._buildArmature();
73854                  this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature);
73855                  this._updateSocketBindings();
73856                  this.markForUpdateRenderData();
73857                }
73858              }
73859              isAnimationCached() {
73860                return this._cacheMode !== g8.REALTIME;
73861              }
73862              onEnable() {
73863                super.onEnable();
73864                this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.add(this._armature);
73865                this._flushAssembler();
73866                g4.getInstance().add(this);
73867              }
73868              onDisable() {
73869                super.onDisable();
73870                this._armature && !this.isAnimationCached() && this._factory._dragonBones.clock.remove(this._armature);
73871                g4.getInstance().remove(this);
73872              }
73873              _emitCacheCompleteEvent() {
73874                this._eventTarget.emit(g5.LOOP_COMPLETE);
73875                this._eventTarget.emit(g5.COMPLETE);
73876              }
73877              updateAnimation(t) {
73878                if (!this.isAnimationCached()) return;
73879                if (!this._frameCache) return;
73880                this.markForUpdateRenderData();
73881                const e = this._frameCache;
73882                if (!e.isInited()) return;
73883                const i = e.frames;
73884                if (!this._playing) {
73885                  if (e.isInvalid()) {
73886                    e.updateToFrame();
73887                    this._curFrame = i[i.length - 1];
73888                    if (this.renderData && (this.renderData.vertexCount < e.maxVertexCount || this.renderData.indexCount < e.maxIndexCount)) {
73889                      this.maxVertexCount = e.maxVertexCount > this.maxVertexCount ? e.maxVertexCount : this.maxVertexCount;
73890                      this.maxIndexCount = e.maxIndexCount > this.maxIndexCount ? e.maxIndexCount : this.maxIndexCount;
73891                      this.renderData.resize(this.maxVertexCount, this.maxIndexCount);
73892                      (!this.renderData.indices || this.maxIndexCount > this.renderData.indices.length) && (this.renderData.indices = new Uint16Array(this.maxIndexCount));
73893                    }
73894                  }
73895                  return;
73896                }
73897                const s = Q5.FrameTime;
73898                0 === this._accTime && 0 === this._playCount && this._eventTarget.emit(g5.START);
73899                this._accTime += t * this.timeScale * 1;
73900                let n = Math.floor(this._accTime / s);
73901                if (!e.isCompleted) {
73902                  e.updateToFrame(n);
73903                  if (this.renderData && (this.renderData.vertexCount < e.maxVertexCount || this.renderData.indexCount < e.maxIndexCount)) {
73904                    this.maxVertexCount = e.maxVertexCount > this.maxVertexCount ? e.maxVertexCount : this.maxVertexCount;
73905                    this.maxIndexCount = e.maxIndexCount > this.maxIndexCount ? e.maxIndexCount : this.maxIndexCount;
73906                    this.renderData.resize(this.maxVertexCount, this.maxIndexCount);
73907                    (!this.renderData.indices || this.maxIndexCount > this.renderData.indices.length) && (this.renderData.indices = new Uint16Array(this.maxIndexCount));
73908                  }
73909                }
73910                if (e.isCompleted && n >= i.length) {
73911                  this._playCount++;
73912                  if (this.playTimes > 0 && this._playCount >= this.playTimes) {
73913                    this._curFrame = i[i.length - 1];
73914                    this._accTime = 0;
73915                    this._playing = !1;
73916                    this._playCount = 0;
73917                    this._emitCacheCompleteEvent();
73918                    this.attachUtil._syncAttachedNode();
73919                    return;
73920                  }
73921                  this._accTime = 0;
73922                  n = 0;
73923                  this._emitCacheCompleteEvent();
73924                }
73925                this._curFrame = i[n];
73926                this.attachUtil._syncAttachedNode();
73927              }
73928              onDestroy() {
73929                this._materialInstances = this._materialInstances.filter((t => !!t));
73930                this._inited = !1;
73931                if (this._cacheMode === g8.PRIVATE_CACHE) {
73932                  this._armatureCache.dispose();
73933                  this._armatureCache = null;
73934                  this._armature = null;
73935                } else if (this._cacheMode === g8.SHARED_CACHE) {
73936                  this._armatureCache = null;
73937                  this._armature = null;
73938                } else if (this._armature) {
73939                  this._armature.dispose();
73940                  this._armature = null;
73941                }
73942                this._drawList.destroy();
73943                super.onDestroy();
73944              }
73945              _updateDebugDraw() {
73946                if (this.debugBones) {
73947                  if (!this._debugDraw) {
73948                    const t = new _y("DEBUG_DRAW_NODE");
73949                    t.hideFlags |= co.Flags.DontSave | co.Flags.HideInHierarchy;
73950                    const e = t.addComponent(dN);
73951                    e.lineWidth = 1;
73952                    e.strokeColor = new Bi(255, 0, 0, 255);
73953                    this._debugDraw = e;
73954                  }
73955                  this._debugDraw.node.parent = this.node;
73956                } else this._debugDraw && (this._debugDraw.node.parent = null);
73957                this.markForUpdateRenderData();
73958              }
73959              _buildArmature() {
73960                if (!this.dragonAsset || !this.dragonAtlasAsset || !this.armatureName) return;
73961                if (this._armature) {
73962                  this._preCacheMode === g8.PRIVATE_CACHE ? this._armatureCache.dispose() : this._preCacheMode === g8.REALTIME && this._armature.dispose();
73963                  this._armatureCache = null;
73964                  this._armature = null;
73965                  this._displayProxy = null;
73966                  this._frameCache = null;
73967                  this._curFrame = null;
73968                  this._playing = !1;
73969                  this._preCacheMode = -1;
73970                }
73971                if (this._cacheMode === g8.SHARED_CACHE) this._armatureCache = Q5.sharedCache; else if (this._cacheMode === g8.PRIVATE_CACHE) {
73972                  this._armatureCache = new Q5;
73973                  this._armatureCache.enablePrivateMode();
73974                }
73975                const t = this.dragonAtlasAsset._uuid;
73976                this._armatureKey = this.dragonAsset.init(this._factory, t);
73977                if (this.isAnimationCached()) {
73978                  this._armature = this._armatureCache.getArmatureCache(this.armatureName, this._armatureKey, t);
73979                  this._armature || (this._cacheMode = g8.REALTIME);
73980                }
73981                this._preCacheMode = this._cacheMode;
73982                if (this._cacheMode === g8.REALTIME) {
73983                  this._displayProxy = this._factory.buildArmatureDisplay(this.armatureName, this._armatureKey, "", t);
73984                  if (!this._displayProxy) return;
73985                  this._displayProxy._ccNode = this.node;
73986                  this._displayProxy._ccComponent = this;
73987                  this._displayProxy.setEventTarget(this._eventTarget);
73988                  this._armature = this._displayProxy._armature;
73989                  this._armature.animation.timeScale = this.timeScale;
73990                }
73991                this._cacheMode !== g8.REALTIME && this.debugBones && console.warn("Debug bones is invalid in cached mode");
73992                if (this._armature) {
73993                  const t = this._armature.armatureData.aabb;
73994                  this.node._uiProps.uiTransformComp.setContentSize(t.width, t.height);
73995                }
73996                this.attachUtil.init(this);
73997                this.animationName && this.playAnimation(this.animationName, this.playTimes);
73998                this._flushAssembler();
73999              }
74000              querySockets() {
74001                if (!this._armature) return [];
74002                0 === this._cachedSockets.size && this._indexBoneSockets();
74003                return Array.from(this._cachedSockets.keys()).sort();
74004              }
74005              querySocketPathByName(t) {
74006                const e = [];
74007                for (const i of this._cachedSockets.keys()) i.endsWith(t) && e.push(i);
74008                return e;
74009              }
74010              _parseDragonAtlasAsset() {
74011                this.dragonAtlasAsset && this.dragonAtlasAsset.init(this._factory);
74012              }
74013              _refresh() {
74014                this._buildArmature();
74015                this._indexBoneSockets();
74016                this.markForUpdateRenderData();
74017              }
74018              _updateCacheModeEnum() {
74019                this._cacheModeEnum = oe({});
74020                this._armature ? Object.assign(this._cacheModeEnum, g8) : Object.assign(this._cacheModeEnum, f8);
74021                y8(this, "_defaultCacheMode", this._cacheModeEnum);
74022              }
74023              _updateAnimEnum() {
74024                let t;
74025                t = this.dragonAsset ? this.dragonAsset.getAnimsEnum(this.armatureName) : m8;
74026                this._enumAnimations = oe({});
74027                Object.assign(this._enumAnimations, t || m8);
74028                oe.update(this._enumAnimations);
74029                y8(this, "_animationIndex", this._enumAnimations);
74030              }
74031              _updateArmatureEnum() {
74032                let t;
74033                t = this.dragonAsset ? this.dragonAsset.getArmatureEnum() : p8;
74034                this._enumArmatures = oe({});
74035                Object.assign(this._enumArmatures, t || p8);
74036                oe.update(this._enumArmatures);
74037                y8(this, "_defaultArmatureIndex", this._enumArmatures);
74038              }
74039              _indexBoneSockets() {
74040                if (!this._armature) return;
74041                this._cachedSockets.clear();
74042                const t = this._cachedSockets;
74043                const e = (t, i, s) => {
74044                  if (s.has(t)) return s.get(t);
74045                  const n = i[t];
74046                  if (!n.parent) {
74047                    s.set(t, n.name);
74048                    n.path = n.name;
74049                    return n.name;
74050                  }
74051                  const r = `${e(n.parent._boneIndex, i, s)}/${n.name}`;
74052                  s.set(t, r);
74053                  n.path = r;
74054                  return r;
74055                };
74056                const i = (s, n) => {
74057                  const r = n.getBones();
74058                  const o = new Map;
74059                  for (let t = 0; t < r.length; t++) r[t]._boneIndex = t;
74060                  for (let t = 0; t < r.length; t++) e(t, r, o);
74061                  for (const e of o.keys()) t.set(`${s}${o.get(e)}`, e);
74062                  const a = n.getSlots();
74063                  for (let t = 0; t < a.length; t++) a[t].childArmature && i(a[t].name, a[t].childArmature);
74064                };
74065                i("", this._armature);
74066              }
74067              playAnimation(t, e) {
74068                this.playTimes = void 0 === e ? -1 : e;
74069                this.animationName = t;
74070                if (this.isAnimationCached()) {
74071                  let e = this._armatureCache.getAnimationCache(this._armatureKey, t);
74072                  e || (e = this._armatureCache.initAnimationCache(this._armatureKey, t));
74073                  if (e) {
74074                    this._accTime = 0;
74075                    this._playCount = 0;
74076                    this._frameCache = e;
74077                    this._sockets.length > 0 && this._frameCache.enableCacheAttachedInfo();
74078                    this._frameCache.updateToFrame(0);
74079                    this._playing = !0;
74080                    this._curFrame = this._frameCache.frames[0];
74081                  }
74082                } else if (this._armature) return this._armature.animation.play(t, this.playTimes);
74083                this.markForUpdateRenderData();
74084                return null;
74085              }
74086              updateAnimationCache(t) {
74087                this.isAnimationCached() && this._armatureCache.updateAnimationCache(this._armatureKey, t);
74088              }
74089              invalidAnimationCache() {
74090                this.isAnimationCached() && this._armatureCache.invalidAnimationCache(this._armatureKey);
74091              }
74092              getArmatureNames() {
74093                const t = this._factory.getDragonBonesData(this._armatureKey);
74094                return t && t.armatureNames || [];
74095              }
74096              getAnimationNames(t) {
74097                const e = [];
74098                const i = this._factory.getDragonBonesData(this._armatureKey);
74099                if (i) {
74100                  const s = i.getArmature(t);
74101                  if (s) for (const t in s.animations) s.animations.hasOwnProperty(t) && e.push(t);
74102                }
74103                return e;
74104              }
74105              on(t, e, i) {
74106                this.addEventListener(t, e, i);
74107              }
74108              off(t, e, i) {
74109                this.removeEventListener(t, e, i);
74110              }
74111              once(t, e, i) {
74112                this._eventTarget.once(t, e, i);
74113              }
74114              addEventListener(t, e, i) {
74115                this._eventTarget.on(t, e, i);
74116              }
74117              removeEventListener(t, e, i) {
74118                this._eventTarget.off(t, e, i);
74119              }
74120              buildArmature(t, e) {
74121                return this._factory.createArmatureNode(this, t, e);
74122              }
74123              armature() {
74124                return this._armature;
74125              }
74126              _flushAssembler() {
74127                const e = t.Assembler.getAssembler(this);
74128                this._assembler !== e && (this._assembler = e);
74129                if (this._armature && this._assembler) {
74130                  this._renderData = this._assembler.createData(this);
74131                  if (this.renderData) {
74132                    this.maxVertexCount = this.renderData.vertexCount;
74133                    this.maxIndexCount = this.renderData.indexCount;
74134                  }
74135                  this.markForUpdateRenderData();
74136                  this._updateColor();
74137                }
74138              }
74139              _updateSocketBindings() {
74140                if (this._armature) {
74141                  this._socketNodes.clear();
74142                  for (let t = 0, e = this._sockets.length; t < e; t++) {
74143                    const e = this._sockets[t];
74144                    if (e.path && e.target) {
74145                      const t = this._cachedSockets.get(e.path);
74146                      if (!t) {
74147                        console.error(`Skeleton data does not contain path ${e.path}`);
74148                        continue;
74149                      }
74150                      e.boneIndex = t;
74151                      this._socketNodes.set(e.path, e.target);
74152                    }
74153                  }
74154                }
74155              }
74156              _verifySockets(t) {
74157                for (let e = 0, i = t.length; e < i; e++) {
74158                  const i = t[e].target;
74159                  !i || i.parent && i.parent === this.node || console.error(`Target node ${i.name} is expected to be a direct child of ${this.node.name}`);
74160                }
74161              }
74162              _cleanMaterialCache() {
74163                for (const t in this._materialCache) this._materialCache[t].destroy();
74164                this._materialCache = {};
74165              }
74166              createRenderEntity() {
74167                const t = new fB(uB.DYNAMIC);
74168                t.setUseLocal(!0);
74169                return t;
74170              }
74171              markForUpdateRenderData(t = !0) {
74172                super.markForUpdateRenderData(t);
74173                this._debugDraw && this._debugDraw.markForUpdateRenderData(t);
74174              }
74175            }, _8.AnimationCacheMode = g8, d8), Bl(Q4.prototype, "dragonAsset", [ nh, R4, I4 ], Object.getOwnPropertyDescriptor(Q4.prototype, "dragonAsset"), Q4.prototype),
74176            Bl(Q4.prototype, "dragonAtlasAsset", [ nh, M4, B4 ], Object.getOwnPropertyDescriptor(Q4.prototype, "dragonAtlasAsset"), Q4.prototype),
74177            Bl(Q4.prototype, "armatureName", [ D4 ], Object.getOwnPropertyDescriptor(Q4.prototype, "armatureName"), Q4.prototype),
74178            Bl(Q4.prototype, "animationName", [ P4 ], Object.getOwnPropertyDescriptor(Q4.prototype, "animationName"), Q4.prototype),
74179            Bl(Q4.prototype, "_defaultArmatureIndex", [ O4, nh, N4, L4 ], Object.getOwnPropertyDescriptor(Q4.prototype, "_defaultArmatureIndex"), Q4.prototype),
74180            Bl(Q4.prototype, "_animationIndex", [ nh, F4, V4, k4 ], Object.getOwnPropertyDescriptor(Q4.prototype, "_animationIndex"), Q4.prototype),
74181            Bl(Q4.prototype, "_defaultCacheMode", [ nh, U4, G4 ], Object.getOwnPropertyDescriptor(Q4.prototype, "_defaultCacheMode"), Q4.prototype),
74182            Bl(Q4.prototype, "timeScale", [ nh, z4, Yl ], Object.getOwnPropertyDescriptor(Q4.prototype, "timeScale"), Q4.prototype),
74183            $4 = Bl(Q4.prototype, "playTimes", [ H4, nh, Yl ], {
74184              configurable: !0,
74185              enumerable: !0,
74186              writable: !0,
74187              initializer: function() {
74188                return -1;
74189              }
74190            }), t8 = Bl(Q4.prototype, "premultipliedAlpha", [ Yl, nh, j4 ], {
74191              configurable: !0,
74192              enumerable: !0,
74193              writable: !0,
74194              initializer: function() {
74195                return !1;
74196              }
74197            }), Bl(Q4.prototype, "debugBones", [ X4, nh ], Object.getOwnPropertyDescriptor(Q4.prototype, "debugBones"), Q4.prototype),
74198            Bl(Q4.prototype, "sockets", [ W4, Y4 ], Object.getOwnPropertyDescriptor(Q4.prototype, "sockets"), Q4.prototype),
74199            e8 = Bl(Q4.prototype, "_defaultArmatureIndexValue", [ Yl ], {
74200              configurable: !0,
74201              enumerable: !0,
74202              writable: !0,
74203              initializer: function() {
74204                return p8.default;
74205              }
74206            }), i8 = Bl(Q4.prototype, "_dragonAsset", [ Yl ], {
74207              configurable: !0,
74208              enumerable: !0,
74209              writable: !0,
74210              initializer: function() {
74211                return null;
74212              }
74213            }), s8 = Bl(Q4.prototype, "_dragonAtlasAsset", [ Yl ], {
74214              configurable: !0,
74215              enumerable: !0,
74216              writable: !0,
74217              initializer: function() {
74218                return null;
74219              }
74220            }), n8 = Bl(Q4.prototype, "_armatureName", [ Yl ], {
74221              configurable: !0,
74222              enumerable: !0,
74223              writable: !0,
74224              initializer: function() {
74225                return "";
74226              }
74227            }), r8 = Bl(Q4.prototype, "_animationName", [ Yl ], {
74228              configurable: !0,
74229              enumerable: !0,
74230              writable: !0,
74231              initializer: function() {
74232                return "";
74233              }
74234            }), o8 = Bl(Q4.prototype, "_animationIndexValue", [ Yl ], {
74235              configurable: !0,
74236              enumerable: !0,
74237              writable: !0,
74238              initializer: function() {
74239                return 0;
74240              }
74241            }), a8 = Bl(Q4.prototype, "_defaultCacheModeValue", [ Yl ], {
74242              configurable: !0,
74243              enumerable: !0,
74244              writable: !0,
74245              initializer: function() {
74246                return g8.REALTIME;
74247              }
74248            }), l8 = Bl(Q4.prototype, "_timeScale", [ Yl ], {
74249              configurable: !0,
74250              enumerable: !0,
74251              writable: !0,
74252              initializer: function() {
74253                return 1;
74254              }
74255            }), h8 = Bl(Q4.prototype, "_playTimes", [ Yl ], {
74256              configurable: !0,
74257              enumerable: !0,
74258              writable: !0,
74259              initializer: function() {
74260                return -1;
74261              }
74262            }), c8 = Bl(Q4.prototype, "_debugBones", [ Yl ], {
74263              configurable: !0,
74264              enumerable: !0,
74265              writable: !0,
74266              initializer: function() {
74267                return !1;
74268              }
74269            }), u8 = Bl(Q4.prototype, "_sockets", [ Yl ], {
74270              configurable: !0,
74271              enumerable: !0,
74272              writable: !0,
74273              initializer: function() {
74274                return [];
74275              }
74276            }), Bl(Q4.prototype, "customMaterial", [ vh, q4, K4, J4 ], Object.getOwnPropertyDescriptor(Q4.prototype, "customMaterial"), Q4.prototype),
74277            Q4)) || Z4) || Z4) || Z4) || Z4);
74278            m.internal.ArmatureDisplay = S8;
74279            const A8 = new Bi(255, 0, 0, 255);
74280            const T8 = new Bi(0, 0, 255, 255);
74281            const v8 = new Bi(0, 255, 0, 255);
74282            let E8;
74283            let C8;
74284            let x8;
74285            let w8;
74286            let R8;
74287            let I8;
74288            let M8;
74289            let B8;
74290            let D8;
74291            let P8;
74292            let O8;
74293            let N8 = 0;
74294            let L8 = 0;
74295            let F8 = 0;
74296            let V8 = 0;
74297            let k8 = 0;
74298            let U8 = 0;
74299            let G8 = 0;
74300            let z8 = 0;
74301            let H8 = 0;
74302            let j8;
74303            let X8;
74304            const W8 = new Float32Array(4);
74305            let Y8;
74306            let q8;
74307            let K8;
74308            let J8;
74309            let Z8;
74310            let Q8;
74311            let $8;
74312            const t6 = new qi;
74313            let e6 = null;
74314            let i6 = null;
74315            function s6(t, e) {
74316              if (!t) return null;
74317              let i;
74318              let s;
74319              switch (e) {
74320               case 1:
74321                i = R8 ? Ls.ONE : Ls.SRC_ALPHA;
74322                s = Ls.ONE;
74323                break;
74324
74325               case 10:
74326                i = Ls.DST_COLOR;
74327                s = Ls.ONE_MINUS_SRC_ALPHA;
74328                break;
74329
74330               case 12:
74331                i = Ls.ONE;
74332                s = Ls.ONE_MINUS_SRC_COLOR;
74333                break;
74334
74335               default:
74336                i = R8 ? Ls.ONE : Ls.SRC_ALPHA;
74337                s = Ls.ONE_MINUS_SRC_ALPHA;
74338              }
74339              return O8.getMaterialForBlend(i, s);
74340            }
74341            function n6(t, e) {
74342              const i = t.a * e * w8;
74343              const s = R8 ? i / 255 : 1;
74344              const n = t.r * E8 * s / 255;
74345              const r = t.g * C8 * s / 255;
74346              const o = t.b * x8 * s / 255;
74347              W8[0] = n;
74348              W8[1] = r;
74349              W8[2] = o;
74350              W8[3] = R8 ? 1 : i / 255;
74351            }
74352            let r6 = null;
74353            const o6 = {
74354              accessor: r6,
74355              vCount: 32767,
74356              ensureAccessor() {
74357                if (!r6) {
74358                  const t = IR.root.device;
74359                  const e = IR.root.batcher2D;
74360                  const i = zM;
74361                  this.accessor = r6 = new iB(t, i, this.vCount);
74362                  e.registerBufferAccessor(Number.parseInt("DRAGONBONES", 36), r6);
74363                }
74364                return this.accessor;
74365              },
74366              createData(t) {
74367                let e = t.renderData;
74368                if (!e) {
74369                  this.ensureAccessor();
74370                  const i = t._armature._slots;
74371                  let s = 0;
74372                  let n = 0;
74373                  for (let t = 0; t < i.length; ++t) {
74374                    const e = i[t];
74375                    s += e._localVertices.length / 4;
74376                    n += e._indices.length;
74377                  }
74378                  e = SB.add(zM, this.accessor);
74379                  e.resize(s, n);
74380                  e.indices && n === e.indices.length || (e.indices = new Uint16Array(n));
74381                }
74382                return e;
74383              },
74384              updateRenderData(t, e) {
74385                O8 = t;
74386                t._armature && function(t, e) {
74387                  const i = t._armature;
74388                  if (!i) return;
74389                  I8 = !0;
74390                  R8 = t.premultipliedAlpha;
74391                  t.drawList.reset();
74392                  O8 = t;
74393                  P8 = t.node;
74394                  M8 = t.renderData;
74395                  O8 = t;
74396                  Y8 = 0;
74397                  e6 = null;
74398                  const s = t.color;
74399                  E8 = s.r / 255;
74400                  C8 = s.g / 255;
74401                  x8 = s.b / 255;
74402                  w8 = t.node._uiProps.opacity;
74403                  4294967295 !== s._val && (Y8 |= 1);
74404                  let n;
74405                  N8 = 0;
74406                  F8 = 0;
74407                  V8 = 0;
74408                  k8 = 0;
74409                  U8 = 0;
74410                  H8 = 0;
74411                  G8 = O8.maxVertexCount;
74412                  z8 = O8.maxIndexCount;
74413                  if (t.isAnimationCached()) !function(t, e) {
74414                    if (!t) return;
74415                    const i = t.segments;
74416                    if (0 === i.length) return;
74417                    let s = null;
74418                    const n = t.vertices;
74419                    const r = t.indices;
74420                    let o = 0;
74421                    let a = 0;
74422                    let l = 0;
74423                    let h = 0;
74424                    if (e) {
74425                      q8 = e.m00;
74426                      Z8 = e.m01;
74427                      K8 = e.m04;
74428                      Q8 = e.m05;
74429                      J8 = e.m12;
74430                      $8 = e.m13;
74431                    }
74432                    let c = 0;
74433                    const u = t.colors;
74434                    let _ = u[c++];
74435                    let d = _.vfOffset;
74436                    n6(_, 1);
74437                    const p = M8;
74438                    const m = p.chunk.vb;
74439                    const f = p.indices;
74440                    for (let t = 0, g = i.length; t < g; t++) {
74441                      const g = i[t];
74442                      s = s6(g.tex, g.blendMode);
74443                      if (!s) continue;
74444                      e6 || (e6 = s);
74445                      if (I8 || s.hash !== e6.hash || g.tex && g.tex !== i6) {
74446                        I8 = !1;
74447                        const t = U8 - H8;
74448                        if (t > 0) {
74449                          O8._requestDrawData(e6, i6, H8, t);
74450                          H8 = U8;
74451                        }
74452                        e6 = s;
74453                        i6 = g.tex;
74454                      }
74455                      L8 = g.vertexCount;
74456                      k8 = g.indexCount;
74457                      o = p.chunk.vertexOffset;
74458                      for (let t = U8, e = U8 + k8; t < e; t++) f[t] = o + F8 + r[l++];
74459                      h = g.vfCount;
74460                      const y = n.subarray(a, h);
74461                      m.set(y, a);
74462                      let b = 0;
74463                      if (e) for (let t = 0, e = L8; t < e; t++) {
74464                        j8 = m[b];
74465                        X8 = m[b + 1];
74466                        m[b] = j8 * q8 + X8 * K8 + J8;
74467                        m[b + 1] = j8 * Z8 + X8 * Q8 + $8;
74468                        b += 9;
74469                      }
74470                      if (1 & Y8) {
74471                        let t = a / 9 * 5;
74472                        for (let e = a, i = a + h; e < i; e += 9, t += 5) {
74473                          if (t >= d) {
74474                            _ = u[c++];
74475                            n6(_, 1);
74476                            d = _.vfOffset;
74477                          }
74478                          m.set(W8, e + 5);
74479                        }
74480                      }
74481                      a += h;
74482                      F8 += L8;
74483                      U8 += k8;
74484                      L8 = 0;
74485                      k8 = 0;
74486                    }
74487                    const g = U8 - H8;
74488                    i6 && g > 0 && O8._requestDrawData(e6, i6, H8, g);
74489                  }(t._curFrame, n); else {
74490                    a6(i, 1, n);
74491                    const e = t._debugDraw;
74492                    if (t.debugBones && e) {
74493                      e.clear();
74494                      e.lineWidth = 5;
74495                      e.strokeColor = A8;
74496                      e.fillColor = T8;
74497                      const t = i.getBones();
74498                      for (let i = 0, s = t.length; i < s; i++) {
74499                        const s = t[i];
74500                        const n = Math.max(s.boneData.length, 5);
74501                        const r = s.globalTransformMatrix.tx;
74502                        const o = s.globalTransformMatrix.ty;
74503                        const a = r + s.globalTransformMatrix.a * n;
74504                        const l = o + s.globalTransformMatrix.b * n;
74505                        e.moveTo(r, o);
74506                        e.lineTo(a, l);
74507                        e.stroke();
74508                        e.circle(r, o, 2 * Math.PI);
74509                        e.fill();
74510                        0 === i && (e.fillColor = v8);
74511                      }
74512                    }
74513                  }
74514                  r6.getMeshBuffer(M8.chunk.bufferId).setDirty();
74515                  t.attachUtil._syncAttachedNode();
74516                  P8 = void 0;
74517                  O8 = void 0;
74518                }(t);
74519              },
74520              updateColor(t) {
74521                if (t) {
74522                  O8 = t;
74523                  O8.markForUpdateRenderData();
74524                }
74525              }
74526            };
74527            function a6(t, e, i) {
74528              const s = M8;
74529              D8 = s.chunk.vb;
74530              B8 = s.indices;
74531              const n = t._slots;
74532              let r;
74533              let o;
74534              let a;
74535              let l;
74536              let h;
74537              let c = 0;
74538              for (let t = 0, c = n.length; t < c; t++) {
74539                h = n[t];
74540                l = h._color;
74541                if (!h._visible || !h._displayData) continue;
74542                i ? h._mulMat(h._worldMatrix, i, h._matrix) : qi.copy(h._worldMatrix, h._matrix);
74543                if (h.childArmature) {
74544                  a6(h.childArmature, l.a / 255, h._worldMatrix);
74545                  continue;
74546                }
74547                r = s6(h.getTexture(), h._blendMode);
74548                if (!r) continue;
74549                e6 || (e6 = r);
74550                const c = h.getTexture();
74551                if (I8 || r.hash !== e6.hash || c && i6 !== c) {
74552                  I8 = !1;
74553                  const t = U8 - H8;
74554                  if (t > 0) {
74555                    O8._requestDrawData(e6, i6, H8, t);
74556                    H8 = U8;
74557                  }
74558                  i6 = c;
74559                  e6 = r;
74560                }
74561                n6(l, e);
74562                t6.set(h._worldMatrix);
74563                o = h._localVertices;
74564                L8 = o.length / 4;
74565                N8 = 9 * L8;
74566                a = h._indices;
74567                k8 = a.length;
74568                let u = !1;
74569                if (F8 + L8 > G8) {
74570                  G8 = F8 + L8;
74571                  u = !0;
74572                }
74573                if (U8 + k8 > z8) {
74574                  z8 = U8 + k8;
74575                  u = !0;
74576                }
74577                if (u) {
74578                  const t = B8;
74579                  const e = s.chunk.vertexOffset;
74580                  s.resizeAndCopy(G8, z8 > s.indexCount ? z8 : s.indexCount);
74581                  D8 = s.chunk.vb;
74582                  z8 > B8.length && (B8 = s.indices = new Uint16Array(z8));
74583                  const i = s.chunk.vertexOffset - e;
74584                  for (let e = 0; e < U8; ++e) B8[e] = t[e] + i;
74585                }
74586                q8 = t6.m00;
74587                K8 = t6.m04;
74588                J8 = t6.m12;
74589                Z8 = t6.m01;
74590                Q8 = t6.m05;
74591                $8 = t6.m13;
74592                for (let t = 0, e = o.length, i = V8; t < e; i += 9) {
74593                  j8 = o[t++];
74594                  X8 = o[t++];
74595                  D8[i] = j8 * q8 + X8 * K8 + J8;
74596                  D8[i + 1] = j8 * Z8 + X8 * Q8 + $8;
74597                  D8[i + 3] = o[t++];
74598                  D8[i + 4] = o[t++];
74599                  D8.set(W8, i + 5);
74600                }
74601                const _ = s.chunk.vertexOffset;
74602                for (let t = 0, e = a.length, i = U8; t < e; t++, i++) B8[i] = F8 + a[t] + _;
74603                V8 += N8;
74604                F8 += L8;
74605                U8 += k8;
74606                L8 = 0;
74607                k8 = 0;
74608              }
74609              c = U8 - H8;
74610              if (i6 && c > 0) {
74611                O8._requestDrawData(e6, i6, H8, c);
74612                H8 = U8;
74613              }
74614              O8.maxIndexCount < z8 && (O8.maxIndexCount = z8);
74615              O8.maxVertexCount < G8 && (O8.maxVertexCount = G8);
74616            }
74617            m.internal.DragonBonesAssembler = o6;
74618            const l6 = {
74619              getAssembler: () => o6
74620            };
74621            S8.Assembler = l6;
74622            let h6;
74623            !function(t) {
74624              t[t.FFD = 0] = "FFD";
74625              t[t.AdjustColor = 10] = "AdjustColor";
74626              t[t.BevelFilter = 11] = "BevelFilter";
74627              t[t.BlurFilter = 12] = "BlurFilter";
74628              t[t.DropShadowFilter = 13] = "DropShadowFilter";
74629              t[t.GlowFilter = 14] = "GlowFilter";
74630              t[t.GradientBevelFilter = 15] = "GradientBevelFilter";
74631              t[t.GradientGlowFilter = 16] = "GradientGlowFilter";
74632            }(h6 || (h6 = {}));
74633            let c6;
74634            !function(t) {
74635              t[t.Frame = 0] = "Frame";
74636              t[t.Sound = 1] = "Sound";
74637            }(c6 || (c6 = {}));
74638            let u6;
74639            !function(t) {
74640              t[t.None = 0] = "None";
74641              t[t.SameLayer = 1] = "SameLayer";
74642              t[t.SameGroup = 2] = "SameGroup";
74643              t[t.SameLayerAndGroup = 3] = "SameLayerAndGroup";
74644              t[t.All = 4] = "All";
74645            }(u6 || (u6 = {}));
74646            const _6 = window.dragonBones;
74647            const d6 = _6.Slot;
74648            const p6 = _6.Matrix;
74649            const m6 = _6.BaseObject;
74650            const f6 = _6.BoundingBoxData;
74651            const g6 = _6.PolygonBoundingBoxData;
74652            const y6 = _6.Transform;
74653            const b6 = _6.Animation;
74654            const S6 = _6.TextureData;
74655            const A6 = _6.CCTextureData;
74656            const T6 = _6.BaseFactory;
74657            const v6 = _6.CCFactory;
74658            const E6 = _6.WorldClock;
74659            const C6 = _6.TextureAtlasData;
74660            const x6 = _6.CCArmatureDisplay;
74661            const w6 = _6.AnimationState;
74662            const R6 = _6.BoneData;
74663            const I6 = _6.EllipseBoundingBoxData;
74664            const M6 = _6.ArmatureData;
74665            const B6 = _6.CCTextureAtlasData;
74666            const D6 = _6.TransformObject;
74667            const P6 = _6.CCSlot;
74668            const O6 = _6.Armature;
74669            const N6 = _6.Bone;
74670            const L6 = _6.RectangleBoundingBoxData;
74671            const F6 = _6.ArmatureCacheMgr;
74672            const V6 = _6.SkinData;
74673            const k6 = _6.EventObject;
74674            const U6 = _6.SlotData;
74675            const G6 = _6.DragonBonesData;
74676            const z6 = _6.AnimationData;
74677            const H6 = _6.CCArmatureCacheDisplay;
74678            t("dragonBones", Object.freeze({
74679              __proto__: null,
74680              DragonBonesAsset: s4,
74681              DragonBonesAtlasAsset: d4,
74682              timeScale: 1,
74683              get AnimationCacheMode() {
74684                return g8;
74685              },
74686              DragonBoneSocket: b8,
74687              ArmatureDisplay: S8,
74688              AttachUtil: f4,
74689              simpleDragonBoneAssembler: l6,
74690              get ExtensionType() {
74691                return h6;
74692              },
74693              get EventType() {
74694                return c6;
74695              },
74696              get AnimationFadeOutMode() {
74697                return u6;
74698              },
74699              Slot: d6,
74700              Matrix: p6,
74701              BaseObject: m6,
74702              BoundingBoxData: f6,
74703              PolygonBoundingBoxData: g6,
74704              Transform: y6,
74705              Animation: b6,
74706              TextureData: S6,
74707              CCTextureData: A6,
74708              BaseFactory: T6,
74709              CCFactory: v6,
74710              WorldClock: E6,
74711              TextureAtlasData: C6,
74712              CCArmatureDisplay: x6,
74713              AnimationState: w6,
74714              BoneData: R6,
74715              EllipseBoundingBoxData: I6,
74716              ArmatureData: M6,
74717              CCTextureAtlasData: B6,
74718              TransformObject: D6,
74719              CCSlot: P6,
74720              Armature: O6,
74721              Bone: N6,
74722              RectangleBoundingBoxData: L6,
74723              ArmatureCacheMgr: F6,
74724              SkinData: V6,
74725              EventObject: k6,
74726              SlotData: U6,
74727              DragonBonesData: G6,
74728              AnimationData: z6,
74729              CCArmatureCacheDisplay: H6
74730            }));
74731            class j6 extends Dr {
74732              constructor(...t) {
74733                super(...t);
74734                this._gpuDescriptorSet = null;
74735              }
74736              get gpuDescriptorSet() {
74737                return this._gpuDescriptorSet;
74738              }
74739              initialize(t) {
74740                this._layout = t.layout;
74741                const {bindings: e, descriptorIndices: i, descriptorCount: s} = t.layout.gpuDescriptorSetLayout;
74742                this._buffers = Array(s).fill(null);
74743                this._textures = Array(s).fill(null);
74744                this._samplers = Array(s).fill(null);
74745                const n = [];
74746                this._gpuDescriptorSet = {
74747                  gpuDescriptors: n,
74748                  descriptorIndices: i
74749                };
74750                for (let t = 0; t < e.length; ++t) {
74751                  const i = e[t];
74752                  for (let t = 0; t < i.count; t++) n.push({
74753                    type: i.descriptorType,
74754                    gpuBuffer: null,
74755                    gpuTexture: null,
74756                    gpuSampler: null
74757                  });
74758                }
74759              }
74760              destroy() {
74761                this._layout = null;
74762                this._gpuDescriptorSet = null;
74763              }
74764              update() {
74765                if (this._isDirty && this._gpuDescriptorSet) {
74766                  const t = this._gpuDescriptorSet.gpuDescriptors;
74767                  for (let e = 0; e < t.length; ++e) if (t[e].type & _r) {
74768                    const i = this._buffers[e];
74769                    i && (t[e].gpuBuffer = i.gpuBuffer || i.gpuBufferView);
74770                  } else if (t[e].type & dr) {
74771                    this._textures[e] && (t[e].gpuTexture = this._textures[e].gpuTexture);
74772                    this._samplers[e] && (t[e].gpuSampler = this._samplers[e].gpuSampler);
74773                  }
74774                  this._isDirty = !1;
74775                }
74776              }
74777            }
74778            let X6;
74779            !function(t) {
74780              t[t.RGBA16F_EXT = 34842] = "RGBA16F_EXT";
74781              t[t.RGB16F_EXT = 34843] = "RGB16F_EXT";
74782              t[t.RGBA32F_EXT = 34836] = "RGBA32F_EXT";
74783              t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 33297] = "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT";
74784              t[t.UNSIGNED_NORMALIZED_EXT = 35863] = "UNSIGNED_NORMALIZED_EXT";
74785              t[t.UNSIGNED_INT_24_8_WEBGL = 34042] = "UNSIGNED_INT_24_8_WEBGL";
74786              t[t.HALF_FLOAT_OES = 36193] = "HALF_FLOAT_OES";
74787              t[t.SRGB_EXT = 35904] = "SRGB_EXT";
74788              t[t.SRGB_ALPHA_EXT = 35906] = "SRGB_ALPHA_EXT";
74789              t[t.SRGB8_ALPHA8_EXT = 35907] = "SRGB8_ALPHA8_EXT";
74790              t[t.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT";
74791              t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT";
74792              t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT";
74793              t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT";
74794              t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT";
74795              t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT";
74796              t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT";
74797              t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT";
74798              t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG";
74799              t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG";
74800              t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG";
74801              t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG";
74802              t[t.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL";
74803              t[t.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC";
74804              t[t.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC";
74805              t[t.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC";
74806              t[t.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC";
74807              t[t.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2";
74808              t[t.COMPRESSED_SRGB8_ETC2 = 37493] = "COMPRESSED_SRGB8_ETC2";
74809              t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2";
74810              t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2";
74811              t[t.COMPRESSED_RGBA8_ETC2_EAC = 37496] = "COMPRESSED_RGBA8_ETC2_EAC";
74812              t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC";
74813              t[t.COMPRESSED_RGBA_ASTC_4x4_KHR = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR";
74814              t[t.COMPRESSED_RGBA_ASTC_5x4_KHR = 37809] = "COMPRESSED_RGBA_ASTC_5x4_KHR";
74815              t[t.COMPRESSED_RGBA_ASTC_5x5_KHR = 37810] = "COMPRESSED_RGBA_ASTC_5x5_KHR";
74816              t[t.COMPRESSED_RGBA_ASTC_6x5_KHR = 37811] = "COMPRESSED_RGBA_ASTC_6x5_KHR";
74817              t[t.COMPRESSED_RGBA_ASTC_6x6_KHR = 37812] = "COMPRESSED_RGBA_ASTC_6x6_KHR";
74818              t[t.COMPRESSED_RGBA_ASTC_8x5_KHR = 37813] = "COMPRESSED_RGBA_ASTC_8x5_KHR";
74819              t[t.COMPRESSED_RGBA_ASTC_8x6_KHR = 37814] = "COMPRESSED_RGBA_ASTC_8x6_KHR";
74820              t[t.COMPRESSED_RGBA_ASTC_8x8_KHR = 37815] = "COMPRESSED_RGBA_ASTC_8x8_KHR";
74821              t[t.COMPRESSED_RGBA_ASTC_10x5_KHR = 37816] = "COMPRESSED_RGBA_ASTC_10x5_KHR";
74822              t[t.COMPRESSED_RGBA_ASTC_10x6_KHR = 37817] = "COMPRESSED_RGBA_ASTC_10x6_KHR";
74823              t[t.COMPRESSED_RGBA_ASTC_10x8_KHR = 37818] = "COMPRESSED_RGBA_ASTC_10x8_KHR";
74824              t[t.COMPRESSED_RGBA_ASTC_10x10_KHR = 37819] = "COMPRESSED_RGBA_ASTC_10x10_KHR";
74825              t[t.COMPRESSED_RGBA_ASTC_12x10_KHR = 37820] = "COMPRESSED_RGBA_ASTC_12x10_KHR";
74826              t[t.COMPRESSED_RGBA_ASTC_12x12_KHR = 37821] = "COMPRESSED_RGBA_ASTC_12x12_KHR";
74827              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 37840] = "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR";
74828              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 37841] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR";
74829              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 37842] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR";
74830              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 37843] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR";
74831              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 37844] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR";
74832              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 37845] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR";
74833              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 37846] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR";
74834              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 37847] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR";
74835              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 37848] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR";
74836              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 37849] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR";
74837              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 37850] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR";
74838              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 37851] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR";
74839              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 37852] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR";
74840              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 37853] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR";
74841            }(X6 || (X6 = {}));
74842            class W6 {
74843              static get instance() {
74844                return W6._instance;
74845              }
74846              static setInstance(t) {
74847                W6._instance = t;
74848              }
74849            }
74850            W6._instance = null;
74851            function Y6(t, e) {
74852              switch (t) {
74853               case bs.R8:
74854                return e.UNSIGNED_BYTE;
74855
74856               case bs.R8SN:
74857                return e.BYTE;
74858
74859               case bs.R8UI:
74860                return e.UNSIGNED_BYTE;
74861
74862               case bs.R8I:
74863                return e.BYTE;
74864
74865               case bs.R16F:
74866                return X6.HALF_FLOAT_OES;
74867
74868               case bs.R16UI:
74869                return e.UNSIGNED_SHORT;
74870
74871               case bs.R16I:
74872                return e.SHORT;
74873
74874               case bs.R32F:
74875                return e.FLOAT;
74876
74877               case bs.R32UI:
74878                return e.UNSIGNED_INT;
74879
74880               case bs.R32I:
74881                return e.INT;
74882
74883               case bs.RG8:
74884                return e.UNSIGNED_BYTE;
74885
74886               case bs.RG8SN:
74887                return e.BYTE;
74888
74889               case bs.RG8UI:
74890                return e.UNSIGNED_BYTE;
74891
74892               case bs.RG8I:
74893                return e.BYTE;
74894
74895               case bs.RG16F:
74896                return X6.HALF_FLOAT_OES;
74897
74898               case bs.RG16UI:
74899                return e.UNSIGNED_SHORT;
74900
74901               case bs.RG16I:
74902                return e.SHORT;
74903
74904               case bs.RG32F:
74905                return e.FLOAT;
74906
74907               case bs.RG32UI:
74908                return e.UNSIGNED_INT;
74909
74910               case bs.RG32I:
74911                return e.INT;
74912
74913               case bs.RGB8:
74914               case bs.SRGB8:
74915                return e.UNSIGNED_BYTE;
74916
74917               case bs.RGB8SN:
74918                return e.BYTE;
74919
74920               case bs.RGB8UI:
74921                return e.UNSIGNED_BYTE;
74922
74923               case bs.RGB8I:
74924                return e.BYTE;
74925
74926               case bs.RGB16F:
74927                return X6.HALF_FLOAT_OES;
74928
74929               case bs.RGB16UI:
74930                return e.UNSIGNED_SHORT;
74931
74932               case bs.RGB16I:
74933                return e.SHORT;
74934
74935               case bs.RGB32F:
74936                return e.FLOAT;
74937
74938               case bs.RGB32UI:
74939                return e.UNSIGNED_INT;
74940
74941               case bs.RGB32I:
74942                return e.INT;
74943
74944               case bs.BGRA8:
74945               case bs.RGBA8:
74946               case bs.SRGB8_A8:
74947                return e.UNSIGNED_BYTE;
74948
74949               case bs.RGBA8SN:
74950                return e.BYTE;
74951
74952               case bs.RGBA8UI:
74953                return e.UNSIGNED_BYTE;
74954
74955               case bs.RGBA8I:
74956                return e.BYTE;
74957
74958               case bs.RGBA16F:
74959                return X6.HALF_FLOAT_OES;
74960
74961               case bs.RGBA16UI:
74962                return e.UNSIGNED_SHORT;
74963
74964               case bs.RGBA16I:
74965                return e.SHORT;
74966
74967               case bs.RGBA32F:
74968                return e.FLOAT;
74969
74970               case bs.RGBA32UI:
74971                return e.UNSIGNED_INT;
74972
74973               case bs.RGBA32I:
74974                return e.INT;
74975
74976               case bs.R5G6B5:
74977                return e.UNSIGNED_SHORT_5_6_5;
74978
74979               case bs.R11G11B10F:
74980                return e.FLOAT;
74981
74982               case bs.RGB5A1:
74983                return e.UNSIGNED_SHORT_5_5_5_1;
74984
74985               case bs.RGBA4:
74986                return e.UNSIGNED_SHORT_4_4_4_4;
74987
74988               case bs.RGB10A2:
74989                return e.UNSIGNED_BYTE;
74990
74991               case bs.RGB10A2UI:
74992                return e.UNSIGNED_INT;
74993
74994               case bs.RGB9E5:
74995                return e.UNSIGNED_BYTE;
74996
74997               case bs.DEPTH:
74998                return e.UNSIGNED_INT;
74999
75000               case bs.DEPTH_STENCIL:
75001                return X6.UNSIGNED_INT_24_8_WEBGL;
75002
75003               case bs.BC1:
75004               case bs.BC1_SRGB:
75005               case bs.BC2:
75006               case bs.BC2_SRGB:
75007               case bs.BC3:
75008               case bs.BC3_SRGB:
75009               case bs.BC4:
75010                return e.UNSIGNED_BYTE;
75011
75012               case bs.BC4_SNORM:
75013                return e.BYTE;
75014
75015               case bs.BC5:
75016                return e.UNSIGNED_BYTE;
75017
75018               case bs.BC5_SNORM:
75019                return e.BYTE;
75020
75021               case bs.BC6H_SF16:
75022               case bs.BC6H_UF16:
75023                return e.FLOAT;
75024
75025               case bs.BC7:
75026               case bs.BC7_SRGB:
75027               case bs.ETC_RGB8:
75028               case bs.ETC2_RGB8:
75029               case bs.ETC2_SRGB8:
75030               case bs.ETC2_RGB8_A1:
75031               case bs.ETC2_SRGB8_A1:
75032               case bs.EAC_R11:
75033                return e.UNSIGNED_BYTE;
75034
75035               case bs.EAC_R11SN:
75036                return e.BYTE;
75037
75038               case bs.EAC_RG11:
75039                return e.UNSIGNED_BYTE;
75040
75041               case bs.EAC_RG11SN:
75042                return e.BYTE;
75043
75044               case bs.PVRTC_RGB2:
75045               case bs.PVRTC_RGBA2:
75046               case bs.PVRTC_RGB4:
75047               case bs.PVRTC_RGBA4:
75048               case bs.PVRTC2_2BPP:
75049               case bs.PVRTC2_4BPP:
75050               case bs.ASTC_RGBA_4X4:
75051               case bs.ASTC_RGBA_5X4:
75052               case bs.ASTC_RGBA_5X5:
75053               case bs.ASTC_RGBA_6X5:
75054               case bs.ASTC_RGBA_6X6:
75055               case bs.ASTC_RGBA_8X5:
75056               case bs.ASTC_RGBA_8X6:
75057               case bs.ASTC_RGBA_8X8:
75058               case bs.ASTC_RGBA_10X5:
75059               case bs.ASTC_RGBA_10X6:
75060               case bs.ASTC_RGBA_10X8:
75061               case bs.ASTC_RGBA_10X10:
75062               case bs.ASTC_RGBA_12X10:
75063               case bs.ASTC_RGBA_12X12:
75064               case bs.ASTC_SRGBA_4X4:
75065               case bs.ASTC_SRGBA_5X4:
75066               case bs.ASTC_SRGBA_5X5:
75067               case bs.ASTC_SRGBA_6X5:
75068               case bs.ASTC_SRGBA_6X6:
75069               case bs.ASTC_SRGBA_8X5:
75070               case bs.ASTC_SRGBA_8X6:
75071               case bs.ASTC_SRGBA_8X8:
75072               case bs.ASTC_SRGBA_10X5:
75073               case bs.ASTC_SRGBA_10X6:
75074               case bs.ASTC_SRGBA_10X8:
75075               case bs.ASTC_SRGBA_10X10:
75076               case bs.ASTC_SRGBA_12X10:
75077               case bs.ASTC_SRGBA_12X12:
75078               default:
75079                return e.UNSIGNED_BYTE;
75080              }
75081            }
75082            function q6(t, e) {
75083              switch (t) {
75084               case As.BOOL:
75085                return e.BOOL;
75086
75087               case As.BOOL2:
75088                return e.BOOL_VEC2;
75089
75090               case As.BOOL3:
75091                return e.BOOL_VEC3;
75092
75093               case As.BOOL4:
75094                return e.BOOL_VEC4;
75095
75096               case As.INT:
75097                return e.INT;
75098
75099               case As.INT2:
75100                return e.INT_VEC2;
75101
75102               case As.INT3:
75103                return e.INT_VEC3;
75104
75105               case As.INT4:
75106                return e.INT_VEC4;
75107
75108               case As.UINT:
75109                return e.UNSIGNED_INT;
75110
75111               case As.FLOAT:
75112                return e.FLOAT;
75113
75114               case As.FLOAT2:
75115                return e.FLOAT_VEC2;
75116
75117               case As.FLOAT3:
75118                return e.FLOAT_VEC3;
75119
75120               case As.FLOAT4:
75121                return e.FLOAT_VEC4;
75122
75123               case As.MAT2:
75124                return e.FLOAT_MAT2;
75125
75126               case As.MAT3:
75127                return e.FLOAT_MAT3;
75128
75129               case As.MAT4:
75130                return e.FLOAT_MAT4;
75131
75132               case As.SAMPLER2D:
75133                return e.SAMPLER_2D;
75134
75135               case As.SAMPLER_CUBE:
75136                return e.SAMPLER_CUBE;
75137
75138               default:
75139                console.error("Unsupported GLType, convert to GL type failed.");
75140                return As.UNKNOWN;
75141              }
75142            }
75143            function K6(t) {
75144              switch (t) {
75145               case As.BOOL:
75146               case As.BOOL2:
75147               case As.BOOL3:
75148               case As.BOOL4:
75149               case As.INT:
75150               case As.INT2:
75151               case As.INT3:
75152               case As.INT4:
75153               case As.UINT:
75154                return Int32Array;
75155
75156               case As.FLOAT:
75157               case As.FLOAT2:
75158               case As.FLOAT3:
75159               case As.FLOAT4:
75160               case As.MAT2:
75161               case As.MAT3:
75162               case As.MAT4:
75163                return Float32Array;
75164
75165               default:
75166                console.error("Unsupported GLType, convert to TypedArrayConstructor failed.");
75167                return Float32Array;
75168              }
75169            }
75170            function J6(t, e) {
75171              switch (t) {
75172               case e.BOOL:
75173                return As.BOOL;
75174
75175               case e.BOOL_VEC2:
75176                return As.BOOL2;
75177
75178               case e.BOOL_VEC3:
75179                return As.BOOL3;
75180
75181               case e.BOOL_VEC4:
75182                return As.BOOL4;
75183
75184               case e.INT:
75185                return As.INT;
75186
75187               case e.INT_VEC2:
75188                return As.INT2;
75189
75190               case e.INT_VEC3:
75191                return As.INT3;
75192
75193               case e.INT_VEC4:
75194                return As.INT4;
75195
75196               case e.UNSIGNED_INT:
75197                return As.UINT;
75198
75199               case e.FLOAT:
75200                return As.FLOAT;
75201
75202               case e.FLOAT_VEC2:
75203                return As.FLOAT2;
75204
75205               case e.FLOAT_VEC3:
75206                return As.FLOAT3;
75207
75208               case e.FLOAT_VEC4:
75209                return As.FLOAT4;
75210
75211               case e.FLOAT_MAT2:
75212                return As.MAT2;
75213
75214               case e.FLOAT_MAT3:
75215                return As.MAT3;
75216
75217               case e.FLOAT_MAT4:
75218                return As.MAT4;
75219
75220               case e.SAMPLER_2D:
75221                return As.SAMPLER2D;
75222
75223               case e.SAMPLER_CUBE:
75224                return As.SAMPLER_CUBE;
75225
75226               default:
75227                console.error("Unsupported GLType, convert to Type failed.");
75228                return As.UNKNOWN;
75229              }
75230            }
75231            function Z6(t, e) {
75232              switch (t) {
75233               case e.BOOL:
75234                return 4;
75235
75236               case e.BOOL_VEC2:
75237                return 8;
75238
75239               case e.BOOL_VEC3:
75240                return 12;
75241
75242               case e.BOOL_VEC4:
75243                return 16;
75244
75245               case e.INT:
75246                return 4;
75247
75248               case e.INT_VEC2:
75249                return 8;
75250
75251               case e.INT_VEC3:
75252                return 12;
75253
75254               case e.INT_VEC4:
75255                return 16;
75256
75257               case e.UNSIGNED_INT:
75258               case e.FLOAT:
75259                return 4;
75260
75261               case e.FLOAT_VEC2:
75262                return 8;
75263
75264               case e.FLOAT_VEC3:
75265                return 12;
75266
75267               case e.FLOAT_VEC4:
75268               case e.FLOAT_MAT2:
75269                return 16;
75270
75271               case e.FLOAT_MAT3:
75272                return 36;
75273
75274               case e.FLOAT_MAT4:
75275                return 64;
75276
75277               case e.SAMPLER_2D:
75278               case e.SAMPLER_CUBE:
75279                return 4;
75280
75281               default:
75282                console.error("Unsupported GLType, get type failed.");
75283                return 0;
75284              }
75285            }
75286            function Q6(t, e) {
75287              switch (t) {
75288               case e.FLOAT_MAT2:
75289                return 2;
75290
75291               case e.FLOAT_MAT3:
75292                return 3;
75293
75294               case e.FLOAT_MAT4:
75295                return 4;
75296
75297               default:
75298                return 1;
75299              }
75300            }
75301            const $6 = [ 512, 513, 514, 515, 516, 517, 518, 519 ];
75302            const t7 = [ 0, 7680, 7681, 7682, 7683, 5386, 34055, 34056 ];
75303            const e7 = [ 32774, 32778, 32779, 32775, 32776 ];
75304            const i7 = [ 0, 1, 770, 772, 771, 773, 768, 774, 769, 775, 776, 32769, 32770, 32771, 32772 ];
75305            let s7;
75306            !function(t) {
75307              t[t.BEGIN_RENDER_PASS = 0] = "BEGIN_RENDER_PASS";
75308              t[t.END_RENDER_PASS = 1] = "END_RENDER_PASS";
75309              t[t.BIND_STATES = 2] = "BIND_STATES";
75310              t[t.DRAW = 3] = "DRAW";
75311              t[t.UPDATE_BUFFER = 4] = "UPDATE_BUFFER";
75312              t[t.COPY_BUFFER_TO_TEXTURE = 5] = "COPY_BUFFER_TO_TEXTURE";
75313              t[t.COUNT = 6] = "COUNT";
75314            }(s7 || (s7 = {}));
75315            class n7 {
75316              constructor(t) {
75317                this.cmdType = void 0;
75318                this.refCount = 0;
75319                this.cmdType = t;
75320              }
75321            }
75322            class r7 extends n7 {
75323              constructor() {
75324                super(s7.BEGIN_RENDER_PASS);
75325                this.gpuRenderPass = null;
75326                this.gpuFramebuffer = null;
75327                this.renderArea = new hn;
75328                this.clearFlag = en.NONE;
75329                this.clearColors = [];
75330                this.clearDepth = 1;
75331                this.clearStencil = 0;
75332              }
75333              clear() {
75334                this.gpuFramebuffer = null;
75335                this.clearColors.length = 0;
75336              }
75337            }
75338            class o7 extends n7 {
75339              constructor() {
75340                super(s7.BIND_STATES);
75341                this.gpuPipelineState = null;
75342                this.gpuInputAssembler = null;
75343                this.gpuDescriptorSets = [];
75344                this.dynamicOffsets = [];
75345                this.dynamicStates = new lr;
75346              }
75347              clear() {
75348                this.gpuPipelineState = null;
75349                this.gpuDescriptorSets.length = 0;
75350                this.gpuInputAssembler = null;
75351                this.dynamicOffsets.length = 0;
75352              }
75353            }
75354            class a7 extends n7 {
75355              constructor() {
75356                super(s7.DRAW);
75357                this.drawInfo = new vn;
75358              }
75359              clear() {}
75360            }
75361            class l7 extends n7 {
75362              constructor() {
75363                super(s7.UPDATE_BUFFER);
75364                this.gpuBuffer = null;
75365                this.buffer = null;
75366                this.offset = 0;
75367                this.size = 0;
75368              }
75369              clear() {
75370                this.gpuBuffer = null;
75371                this.buffer = null;
75372              }
75373            }
75374            class h7 extends n7 {
75375              constructor() {
75376                super(s7.COPY_BUFFER_TO_TEXTURE);
75377                this.gpuTexture = null;
75378                this.buffers = [];
75379                this.regions = [];
75380              }
75381              clear() {
75382                this.gpuTexture = null;
75383                this.buffers.length = 0;
75384                this.regions.length = 0;
75385              }
75386            }
75387            class c7 {
75388              constructor() {
75389                this.cmds = new eo(1);
75390                this.beginRenderPassCmds = new eo(1);
75391                this.bindStatesCmds = new eo(1);
75392                this.drawCmds = new eo(1);
75393                this.updateBufferCmds = new eo(1);
75394                this.copyBufferToTextureCmds = new eo(1);
75395              }
75396              clearCmds(t) {
75397                if (this.beginRenderPassCmds.length) {
75398                  t.beginRenderPassCmdPool.freeCmds(this.beginRenderPassCmds);
75399                  this.beginRenderPassCmds.clear();
75400                }
75401                if (this.bindStatesCmds.length) {
75402                  t.bindStatesCmdPool.freeCmds(this.bindStatesCmds);
75403                  this.bindStatesCmds.clear();
75404                }
75405                if (this.drawCmds.length) {
75406                  t.drawCmdPool.freeCmds(this.drawCmds);
75407                  this.drawCmds.clear();
75408                }
75409                if (this.updateBufferCmds.length) {
75410                  t.updateBufferCmdPool.freeCmds(this.updateBufferCmds);
75411                  this.updateBufferCmds.clear();
75412                }
75413                if (this.copyBufferToTextureCmds.length) {
75414                  t.copyBufferToTextureCmdPool.freeCmds(this.copyBufferToTextureCmds);
75415                  this.copyBufferToTextureCmds.clear();
75416                }
75417                this.cmds.clear();
75418              }
75419            }
75420            function u7(t, e, i, s, n) {
75421              if (e.usage & Ts.UNIFORM) ArrayBuffer.isView(i) ? e.vf32.set(i, s / Float32Array.BYTES_PER_ELEMENT) : e.vf32.set(new Float32Array(i), s / Float32Array.BYTES_PER_ELEMENT); else if (e.usage & Ts.INDIRECT) {
75422                e.indirects.clearDraws();
75423                const t = i.drawInfos;
75424                for (let i = 0; i < t.length; ++i) e.indirects.setDrawInfo(s + i, t[i]);
75425              } else {
75426                const r = i;
75427                const {gl: o} = t;
75428                const a = t.stateCache;
75429                switch (e.glTarget) {
75430                 case o.ARRAY_BUFFER:
75431                  if (t.extensions.useVAO && a.glVAO) {
75432                    t.extensions.OES_vertex_array_object.bindVertexArrayOES(null);
75433                    a.glVAO = null;
75434                  }
75435                  d7.gpuInputAssembler = null;
75436                  if (t.stateCache.glArrayBuffer !== e.glBuffer) {
75437                    o.bindBuffer(o.ARRAY_BUFFER, e.glBuffer);
75438                    t.stateCache.glArrayBuffer = e.glBuffer;
75439                  }
75440                  break;
75441
75442                 case o.ELEMENT_ARRAY_BUFFER:
75443                  if (t.extensions.useVAO && a.glVAO) {
75444                    t.extensions.OES_vertex_array_object.bindVertexArrayOES(null);
75445                    a.glVAO = null;
75446                  }
75447                  d7.gpuInputAssembler = null;
75448                  if (t.stateCache.glElementArrayBuffer !== e.glBuffer) {
75449                    o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, e.glBuffer);
75450                    t.stateCache.glElementArrayBuffer = e.glBuffer;
75451                  }
75452                  break;
75453
75454                 default:
75455                  console.error("Unsupported BufferType, update buffer failed.");
75456                  return;
75457                }
75458                n === r.byteLength ? o.bufferSubData(e.glTarget, s, r) : o.bufferSubData(e.glTarget, s, r.slice(0, n));
75459              }
75460            }
75461            function _7(t, e) {
75462              const {gl: i} = t;
75463              e.glFormat = e.glInternalFmt = function(t, e) {
75464                switch (t) {
75465                 case bs.A8:
75466                  return e.ALPHA;
75467
75468                 case bs.L8:
75469                  return e.LUMINANCE;
75470
75471                 case bs.LA8:
75472                  return e.LUMINANCE_ALPHA;
75473
75474                 case bs.RGB8:
75475                 case bs.RGB16F:
75476                 case bs.RGB32F:
75477                  return e.RGB;
75478
75479                 case bs.BGRA8:
75480                 case bs.RGBA8:
75481                 case bs.SRGB8_A8:
75482                 case bs.RGBA16F:
75483                 case bs.RGBA32F:
75484                  return e.RGBA;
75485
75486                 case bs.R5G6B5:
75487                  return e.RGB;
75488
75489                 case bs.RGB5A1:
75490                 case bs.RGBA4:
75491                  return e.RGBA;
75492
75493                 case bs.DEPTH:
75494                  return e.DEPTH_COMPONENT;
75495
75496                 case bs.DEPTH_STENCIL:
75497                  return e.DEPTH_STENCIL;
75498
75499                 case bs.BC1:
75500                  return X6.COMPRESSED_RGB_S3TC_DXT1_EXT;
75501
75502                 case bs.BC1_ALPHA:
75503                  return X6.COMPRESSED_RGBA_S3TC_DXT1_EXT;
75504
75505                 case bs.BC1_SRGB:
75506                  return X6.COMPRESSED_SRGB_S3TC_DXT1_EXT;
75507
75508                 case bs.BC1_SRGB_ALPHA:
75509                  return X6.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
75510
75511                 case bs.BC2:
75512                  return X6.COMPRESSED_RGBA_S3TC_DXT3_EXT;
75513
75514                 case bs.BC2_SRGB:
75515                  return X6.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
75516
75517                 case bs.BC3:
75518                  return X6.COMPRESSED_RGBA_S3TC_DXT5_EXT;
75519
75520                 case bs.BC3_SRGB:
75521                  return X6.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
75522
75523                 case bs.ETC_RGB8:
75524                  return X6.COMPRESSED_RGB_ETC1_WEBGL;
75525
75526                 case bs.ETC2_RGB8:
75527                  return X6.COMPRESSED_RGB8_ETC2;
75528
75529                 case bs.ETC2_SRGB8:
75530                  return X6.COMPRESSED_SRGB8_ETC2;
75531
75532                 case bs.ETC2_RGB8_A1:
75533                  return X6.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
75534
75535                 case bs.ETC2_SRGB8_A1:
75536                  return X6.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
75537
75538                 case bs.ETC2_RGBA8:
75539                  return X6.COMPRESSED_RGBA8_ETC2_EAC;
75540
75541                 case bs.ETC2_SRGB8_A8:
75542                  return X6.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
75543
75544                 case bs.EAC_R11:
75545                  return X6.COMPRESSED_R11_EAC;
75546
75547                 case bs.EAC_R11SN:
75548                  return X6.COMPRESSED_SIGNED_R11_EAC;
75549
75550                 case bs.EAC_RG11:
75551                  return X6.COMPRESSED_RG11_EAC;
75552
75553                 case bs.EAC_RG11SN:
75554                  return X6.COMPRESSED_SIGNED_RG11_EAC;
75555
75556                 case bs.PVRTC_RGB2:
75557                  return X6.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
75558
75559                 case bs.PVRTC_RGBA2:
75560                  return X6.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
75561
75562                 case bs.PVRTC_RGB4:
75563                  return X6.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
75564
75565                 case bs.PVRTC_RGBA4:
75566                  return X6.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
75567
75568                 case bs.ASTC_RGBA_4X4:
75569                  return X6.COMPRESSED_RGBA_ASTC_4x4_KHR;
75570
75571                 case bs.ASTC_RGBA_5X4:
75572                  return X6.COMPRESSED_RGBA_ASTC_5x4_KHR;
75573
75574                 case bs.ASTC_RGBA_5X5:
75575                  return X6.COMPRESSED_RGBA_ASTC_5x5_KHR;
75576
75577                 case bs.ASTC_RGBA_6X5:
75578                  return X6.COMPRESSED_RGBA_ASTC_6x5_KHR;
75579
75580                 case bs.ASTC_RGBA_6X6:
75581                  return X6.COMPRESSED_RGBA_ASTC_6x6_KHR;
75582
75583                 case bs.ASTC_RGBA_8X5:
75584                  return X6.COMPRESSED_RGBA_ASTC_8x5_KHR;
75585
75586                 case bs.ASTC_RGBA_8X6:
75587                  return X6.COMPRESSED_RGBA_ASTC_8x6_KHR;
75588
75589                 case bs.ASTC_RGBA_8X8:
75590                  return X6.COMPRESSED_RGBA_ASTC_8x8_KHR;
75591
75592                 case bs.ASTC_RGBA_10X5:
75593                  return X6.COMPRESSED_RGBA_ASTC_10x5_KHR;
75594
75595                 case bs.ASTC_RGBA_10X6:
75596                  return X6.COMPRESSED_RGBA_ASTC_10x6_KHR;
75597
75598                 case bs.ASTC_RGBA_10X8:
75599                  return X6.COMPRESSED_RGBA_ASTC_10x8_KHR;
75600
75601                 case bs.ASTC_RGBA_10X10:
75602                  return X6.COMPRESSED_RGBA_ASTC_10x10_KHR;
75603
75604                 case bs.ASTC_RGBA_12X10:
75605                  return X6.COMPRESSED_RGBA_ASTC_12x10_KHR;
75606
75607                 case bs.ASTC_RGBA_12X12:
75608                  return X6.COMPRESSED_RGBA_ASTC_12x12_KHR;
75609
75610                 case bs.ASTC_SRGBA_4X4:
75611                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
75612
75613                 case bs.ASTC_SRGBA_5X4:
75614                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
75615
75616                 case bs.ASTC_SRGBA_5X5:
75617                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
75618
75619                 case bs.ASTC_SRGBA_6X5:
75620                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
75621
75622                 case bs.ASTC_SRGBA_6X6:
75623                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
75624
75625                 case bs.ASTC_SRGBA_8X5:
75626                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
75627
75628                 case bs.ASTC_SRGBA_8X6:
75629                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
75630
75631                 case bs.ASTC_SRGBA_8X8:
75632                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
75633
75634                 case bs.ASTC_SRGBA_10X5:
75635                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
75636
75637                 case bs.ASTC_SRGBA_10X6:
75638                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
75639
75640                 case bs.ASTC_SRGBA_10X8:
75641                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
75642
75643                 case bs.ASTC_SRGBA_10X10:
75644                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
75645
75646                 case bs.ASTC_SRGBA_12X10:
75647                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
75648
75649                 case bs.ASTC_SRGBA_12X12:
75650                  return X6.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
75651
75652                 default:
75653                  console.error("Unsupported Format, convert to WebGL format failed.");
75654                  return e.RGBA;
75655                }
75656              }(e.format, i);
75657              e.glType = Y6(e.format, i);
75658              let s = e.width;
75659              let n = e.height;
75660              switch (e.type) {
75661               case xs.TEX2D:
75662                {
75663                  e.glTarget = i.TEXTURE_2D;
75664                  if (e.isSwapchainTexture) break;
75665                  const r = Math.max(s, n);
75666                  r > t.capabilities.maxTextureSize && F(9100, r, t.capabilities.maxTextureSize);
75667                  if (t.textureExclusive[e.format] || t.extensions.WEBGL_depth_texture || !ur[e.format].hasDepth) {
75668                    e.glTexture = i.createTexture();
75669                    if (e.size > 0) {
75670                      const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
75671                      if (r.glTexture !== e.glTexture) {
75672                        i.bindTexture(i.TEXTURE_2D, e.glTexture);
75673                        r.glTexture = e.glTexture;
75674                      }
75675                      if (ur[e.format].isCompressed) for (let t = 0; t < e.mipLevel; ++t) {
75676                        const r = gr(e.format, s, n, 1);
75677                        const o = new Uint8Array(r);
75678                        i.compressedTexImage2D(i.TEXTURE_2D, t, e.glInternalFmt, s, n, 0, o);
75679                        s = Math.max(1, s >> 1);
75680                        n = Math.max(1, n >> 1);
75681                      } else for (let t = 0; t < e.mipLevel; ++t) {
75682                        i.texImage2D(i.TEXTURE_2D, t, e.glInternalFmt, s, n, 0, e.glFormat, e.glType, null);
75683                        s = Math.max(1, s >> 1);
75684                        n = Math.max(1, n >> 1);
75685                      }
75686                      if (e.isPowerOf2) {
75687                        e.glWrapS = i.REPEAT;
75688                        e.glWrapT = i.REPEAT;
75689                      } else {
75690                        e.glWrapS = i.CLAMP_TO_EDGE;
75691                        e.glWrapT = i.CLAMP_TO_EDGE;
75692                      }
75693                      e.glMinFilter = i.LINEAR;
75694                      e.glMagFilter = i.LINEAR;
75695                      i.texParameteri(e.glTarget, i.TEXTURE_WRAP_S, e.glWrapS);
75696                      i.texParameteri(e.glTarget, i.TEXTURE_WRAP_T, e.glWrapT);
75697                      i.texParameteri(e.glTarget, i.TEXTURE_MIN_FILTER, e.glMinFilter);
75698                      i.texParameteri(e.glTarget, i.TEXTURE_MAG_FILTER, e.glMagFilter);
75699                    }
75700                  } else {
75701                    e.glInternalFmt = function(t, e) {
75702                      switch (t) {
75703                       case bs.R5G6B5:
75704                        return e.RGB565;
75705
75706                       case bs.RGB5A1:
75707                        return e.RGB5_A1;
75708
75709                       case bs.RGBA4:
75710                        return e.RGBA4;
75711
75712                       case bs.RGBA16F:
75713                        return X6.RGBA16F_EXT;
75714
75715                       case bs.RGBA32F:
75716                        return X6.RGBA32F_EXT;
75717
75718                       case bs.SRGB8_A8:
75719                        return X6.SRGB8_ALPHA8_EXT;
75720
75721                       case bs.DEPTH:
75722                        return e.DEPTH_COMPONENT16;
75723
75724                       case bs.DEPTH_STENCIL:
75725                        return e.DEPTH_STENCIL;
75726
75727                       default:
75728                        console.error("Unsupported Format, convert to WebGL internal format failed.");
75729                        return e.RGBA;
75730                      }
75731                    }(e.format, i);
75732                    e.glRenderbuffer = i.createRenderbuffer();
75733                    if (e.size > 0) {
75734                      if (t.stateCache.glRenderbuffer !== e.glRenderbuffer) {
75735                        i.bindRenderbuffer(i.RENDERBUFFER, e.glRenderbuffer);
75736                        t.stateCache.glRenderbuffer = e.glRenderbuffer;
75737                      }
75738                      i.renderbufferStorage(i.RENDERBUFFER, e.glInternalFmt, s, n);
75739                    }
75740                  }
75741                  break;
75742                }
75743
75744               case xs.CUBE:
75745                {
75746                  e.glTarget = i.TEXTURE_CUBE_MAP;
75747                  const r = Math.max(s, n);
75748                  r > t.capabilities.maxCubeMapTextureSize && F(9100, r, t.capabilities.maxTextureSize);
75749                  e.glTexture = i.createTexture();
75750                  if (e.size > 0) {
75751                    const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
75752                    if (r.glTexture !== e.glTexture) {
75753                      i.bindTexture(i.TEXTURE_CUBE_MAP, e.glTexture);
75754                      r.glTexture = e.glTexture;
75755                    }
75756                    if (ur[e.format].isCompressed) for (let t = 0; t < 6; ++t) {
75757                      s = e.width;
75758                      n = e.height;
75759                      for (let r = 0; r < e.mipLevel; ++r) {
75760                        const o = gr(e.format, s, n, 1);
75761                        const a = new Uint8Array(o);
75762                        i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + t, r, e.glInternalFmt, s, n, 0, a);
75763                        s = Math.max(1, s >> 1);
75764                        n = Math.max(1, n >> 1);
75765                      }
75766                    } else for (let t = 0; t < 6; ++t) {
75767                      s = e.width;
75768                      n = e.height;
75769                      for (let r = 0; r < e.mipLevel; ++r) {
75770                        i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + t, r, e.glInternalFmt, s, n, 0, e.glFormat, e.glType, null);
75771                        s = Math.max(1, s >> 1);
75772                        n = Math.max(1, n >> 1);
75773                      }
75774                    }
75775                    if (e.isPowerOf2) {
75776                      e.glWrapS = i.REPEAT;
75777                      e.glWrapT = i.REPEAT;
75778                    } else {
75779                      e.glWrapS = i.CLAMP_TO_EDGE;
75780                      e.glWrapT = i.CLAMP_TO_EDGE;
75781                    }
75782                    e.glMinFilter = i.LINEAR;
75783                    e.glMagFilter = i.LINEAR;
75784                    i.texParameteri(e.glTarget, i.TEXTURE_WRAP_S, e.glWrapS);
75785                    i.texParameteri(e.glTarget, i.TEXTURE_WRAP_T, e.glWrapT);
75786                    i.texParameteri(e.glTarget, i.TEXTURE_MIN_FILTER, e.glMinFilter);
75787                    i.texParameteri(e.glTarget, i.TEXTURE_MAG_FILTER, e.glMagFilter);
75788                  }
75789                  break;
75790                }
75791
75792               default:
75793                console.error("Unsupported TextureType, create texture failed.");
75794                e.type = xs.TEX2D;
75795                e.glTarget = i.TEXTURE_2D;
75796              }
75797            }
75798            const d7 = {
75799              gpuPipelineState: null,
75800              gpuInputAssembler: null,
75801              glPrimitive: 0
75802            };
75803            const p7 = new hn;
75804            function m7(t, e, i, s, n, r, o) {
75805              const {gl: a} = t;
75806              const l = t.stateCache;
75807              let h = 0;
75808              if (i) {
75809                p7.x = s.x << i.lodLevel;
75810                p7.y = s.y << i.lodLevel;
75811                p7.width = s.width << i.lodLevel;
75812                p7.height = s.height << i.lodLevel;
75813              }
75814              if (i && e) {
75815                if (l.glFramebuffer !== i.glFramebuffer) {
75816                  a.bindFramebuffer(a.FRAMEBUFFER, i.glFramebuffer);
75817                  l.glFramebuffer = i.glFramebuffer;
75818                }
75819                if (l.viewport.left !== p7.x || l.viewport.top !== p7.y || l.viewport.width !== p7.width || l.viewport.height !== p7.height) {
75820                  a.viewport(p7.x, p7.y, p7.width, p7.height);
75821                  l.viewport.left = p7.x;
75822                  l.viewport.top = p7.y;
75823                  l.viewport.width = p7.width;
75824                  l.viewport.height = p7.height;
75825                }
75826                if (l.scissorRect.x !== p7.x || l.scissorRect.y !== p7.y || l.scissorRect.width !== p7.width || l.scissorRect.height !== p7.height) {
75827                  a.scissor(p7.x, p7.y, p7.width, p7.height);
75828                  l.scissorRect.x = p7.x;
75829                  l.scissorRect.y = p7.y;
75830                  l.scissorRect.width = p7.width;
75831                  l.scissorRect.height = p7.height;
75832                }
75833                let s = n.length;
75834                t.extensions.WEBGL_draw_buffers || (s = 1);
75835                for (let t = 0; t < s; ++t) {
75836                  const i = e.colorAttachments[t];
75837                  if (i.format !== bs.UNKNOWN) switch (i.loadOp) {
75838                   case Us.LOAD:
75839                    break;
75840
75841                   case Us.CLEAR:
75842                    {
75843                      l.bs.targets[0].blendColorMask !== Vs.ALL && a.colorMask(!0, !0, !0, !0);
75844                      const t = n[0];
75845                      a.clearColor(t.x, t.y, t.z, t.w);
75846                      h |= a.COLOR_BUFFER_BIT;
75847                      break;
75848                    }
75849
75850                   case Us.DISCARD:
75851                  }
75852                }
75853                if (e.depthStencilAttachment && e.depthStencilAttachment.format !== bs.UNKNOWN) {
75854                  switch (e.depthStencilAttachment.depthLoadOp) {
75855                   case Us.LOAD:
75856                    break;
75857
75858                   case Us.CLEAR:
75859                    l.dss.depthWrite || a.depthMask(!0);
75860                    a.clearDepth(r);
75861                    h |= a.DEPTH_BUFFER_BIT;
75862
75863                   case Us.DISCARD:
75864                  }
75865                  if (ur[e.depthStencilAttachment.format].hasStencil) switch (e.depthStencilAttachment.stencilLoadOp) {
75866                   case Us.LOAD:
75867                    break;
75868
75869                   case Us.CLEAR:
75870                    l.dss.stencilWriteMaskFront || a.stencilMaskSeparate(a.FRONT, 65535);
75871                    l.dss.stencilWriteMaskBack || a.stencilMaskSeparate(a.BACK, 65535);
75872                    a.clearStencil(o);
75873                    h |= a.STENCIL_BUFFER_BIT;
75874
75875                   case Us.DISCARD:
75876                  }
75877                }
75878                h && a.clear(h);
75879                if (h & a.COLOR_BUFFER_BIT) {
75880                  const t = l.bs.targets[0].blendColorMask;
75881                  if (t !== Vs.ALL) {
75882                    const e = (t & Vs.R) !== Vs.NONE;
75883                    const i = (t & Vs.G) !== Vs.NONE;
75884                    const s = (t & Vs.B) !== Vs.NONE;
75885                    const n = (t & Vs.A) !== Vs.NONE;
75886                    a.colorMask(e, i, s, n);
75887                  }
75888                }
75889                h & a.DEPTH_BUFFER_BIT && !l.dss.depthWrite && a.depthMask(!1);
75890                if (h & a.STENCIL_BUFFER_BIT) {
75891                  l.dss.stencilWriteMaskFront || a.stencilMaskSeparate(a.FRONT, 0);
75892                  l.dss.stencilWriteMaskBack || a.stencilMaskSeparate(a.BACK, 0);
75893                }
75894              }
75895            }
75896            function f7(t, e, i, s, n, r) {
75897              const {gl: o} = t;
75898              const a = t.stateCache;
75899              const l = e && e.gpuShader;
75900              let h = !1;
75901              let c;
75902              let u;
75903              let _;
75904              if (e && d7.gpuPipelineState !== e) {
75905                d7.gpuPipelineState = e;
75906                d7.glPrimitive = e.glPrimitive;
75907                if (e.gpuShader) {
75908                  const {glProgram: t} = e.gpuShader;
75909                  if (a.glProgram !== t) {
75910                    o.useProgram(t);
75911                    a.glProgram = t;
75912                    h = !0;
75913                  }
75914                }
75915                const {rs: t} = e;
75916                if (t) {
75917                  if (a.rs.cullMode !== t.cullMode) {
75918                    switch (t.cullMode) {
75919                     case qs.NONE:
75920                      o.disable(o.CULL_FACE);
75921                      break;
75922
75923                     case qs.FRONT:
75924                      o.enable(o.CULL_FACE);
75925                      o.cullFace(o.FRONT);
75926                      break;
75927
75928                     case qs.BACK:
75929                      o.enable(o.CULL_FACE);
75930                      o.cullFace(o.BACK);
75931                    }
75932                    a.rs.cullMode = t.cullMode;
75933                  }
75934                  const e = t.isFrontFaceCCW;
75935                  if (a.rs.isFrontFaceCCW !== e) {
75936                    o.frontFace(e ? o.CCW : o.CW);
75937                    a.rs.isFrontFaceCCW = e;
75938                  }
75939                  if (a.rs.depthBias !== t.depthBias || a.rs.depthBiasSlop !== t.depthBiasSlop) {
75940                    o.polygonOffset(t.depthBias, t.depthBiasSlop);
75941                    a.rs.depthBias = t.depthBias;
75942                    a.rs.depthBiasSlop = t.depthBiasSlop;
75943                  }
75944                  if (a.rs.lineWidth !== t.lineWidth) {
75945                    o.lineWidth(t.lineWidth);
75946                    a.rs.lineWidth = t.lineWidth;
75947                  }
75948                }
75949                const {dss: i} = e;
75950                if (i) {
75951                  if (a.dss.depthTest !== i.depthTest) {
75952                    i.depthTest ? o.enable(o.DEPTH_TEST) : o.disable(o.DEPTH_TEST);
75953                    a.dss.depthTest = i.depthTest;
75954                  }
75955                  if (a.dss.depthWrite !== i.depthWrite) {
75956                    o.depthMask(i.depthWrite);
75957                    a.dss.depthWrite = i.depthWrite;
75958                  }
75959                  if (a.dss.depthFunc !== i.depthFunc) {
75960                    o.depthFunc($6[i.depthFunc]);
75961                    a.dss.depthFunc = i.depthFunc;
75962                  }
75963                  if (a.dss.stencilTestFront !== i.stencilTestFront || a.dss.stencilTestBack !== i.stencilTestBack) {
75964                    i.stencilTestFront || i.stencilTestBack ? o.enable(o.STENCIL_TEST) : o.disable(o.STENCIL_TEST);
75965                    a.dss.stencilTestFront = i.stencilTestFront;
75966                    a.dss.stencilTestBack = i.stencilTestBack;
75967                  }
75968                  if (a.dss.stencilFuncFront !== i.stencilFuncFront || a.dss.stencilRefFront !== i.stencilRefFront || a.dss.stencilReadMaskFront !== i.stencilReadMaskFront) {
75969                    o.stencilFuncSeparate(o.FRONT, $6[i.stencilFuncFront], i.stencilRefFront, i.stencilReadMaskFront);
75970                    a.dss.stencilFuncFront = i.stencilFuncFront;
75971                    a.dss.stencilRefFront = i.stencilRefFront;
75972                    a.dss.stencilReadMaskFront = i.stencilReadMaskFront;
75973                  }
75974                  if (a.dss.stencilFailOpFront !== i.stencilFailOpFront || a.dss.stencilZFailOpFront !== i.stencilZFailOpFront || a.dss.stencilPassOpFront !== i.stencilPassOpFront) {
75975                    o.stencilOpSeparate(o.FRONT, t7[i.stencilFailOpFront], t7[i.stencilZFailOpFront], t7[i.stencilPassOpFront]);
75976                    a.dss.stencilFailOpFront = i.stencilFailOpFront;
75977                    a.dss.stencilZFailOpFront = i.stencilZFailOpFront;
75978                    a.dss.stencilPassOpFront = i.stencilPassOpFront;
75979                  }
75980                  if (a.dss.stencilWriteMaskFront !== i.stencilWriteMaskFront) {
75981                    o.stencilMaskSeparate(o.FRONT, i.stencilWriteMaskFront);
75982                    a.dss.stencilWriteMaskFront = i.stencilWriteMaskFront;
75983                  }
75984                  if (a.dss.stencilFuncBack !== i.stencilFuncBack || a.dss.stencilRefBack !== i.stencilRefBack || a.dss.stencilReadMaskBack !== i.stencilReadMaskBack) {
75985                    o.stencilFuncSeparate(o.BACK, $6[i.stencilFuncBack], i.stencilRefBack, i.stencilReadMaskBack);
75986                    a.dss.stencilFuncBack = i.stencilFuncBack;
75987                    a.dss.stencilRefBack = i.stencilRefBack;
75988                    a.dss.stencilReadMaskBack = i.stencilReadMaskBack;
75989                  }
75990                  if (a.dss.stencilFailOpBack !== i.stencilFailOpBack || a.dss.stencilZFailOpBack !== i.stencilZFailOpBack || a.dss.stencilPassOpBack !== i.stencilPassOpBack) {
75991                    o.stencilOpSeparate(o.BACK, t7[i.stencilFailOpBack], t7[i.stencilZFailOpBack], t7[i.stencilPassOpBack]);
75992                    a.dss.stencilFailOpBack = i.stencilFailOpBack;
75993                    a.dss.stencilZFailOpBack = i.stencilZFailOpBack;
75994                    a.dss.stencilPassOpBack = i.stencilPassOpBack;
75995                  }
75996                  if (a.dss.stencilWriteMaskBack !== i.stencilWriteMaskBack) {
75997                    o.stencilMaskSeparate(o.BACK, i.stencilWriteMaskBack);
75998                    a.dss.stencilWriteMaskBack = i.stencilWriteMaskBack;
75999                  }
76000                }
76001                const {bs: s} = e;
76002                if (s) {
76003                  if (a.bs.isA2C !== s.isA2C) {
76004                    s.isA2C ? o.enable(o.SAMPLE_ALPHA_TO_COVERAGE) : o.disable(o.SAMPLE_ALPHA_TO_COVERAGE);
76005                    a.bs.isA2C = s.isA2C;
76006                  }
76007                  if (a.bs.blendColor.x !== s.blendColor.x || a.bs.blendColor.y !== s.blendColor.y || a.bs.blendColor.z !== s.blendColor.z || a.bs.blendColor.w !== s.blendColor.w) {
76008                    o.blendColor(s.blendColor.x, s.blendColor.y, s.blendColor.z, s.blendColor.w);
76009                    a.bs.blendColor.x = s.blendColor.x;
76010                    a.bs.blendColor.y = s.blendColor.y;
76011                    a.bs.blendColor.z = s.blendColor.z;
76012                    a.bs.blendColor.w = s.blendColor.w;
76013                  }
76014                  const t = s.targets[0];
76015                  const e = a.bs.targets[0];
76016                  if (e.blend !== t.blend) {
76017                    t.blend ? o.enable(o.BLEND) : o.disable(o.BLEND);
76018                    e.blend = t.blend;
76019                  }
76020                  if (e.blendEq !== t.blendEq || e.blendAlphaEq !== t.blendAlphaEq) {
76021                    o.blendEquationSeparate(e7[t.blendEq], e7[t.blendAlphaEq]);
76022                    e.blendEq = t.blendEq;
76023                    e.blendAlphaEq = t.blendAlphaEq;
76024                  }
76025                  if (e.blendSrc !== t.blendSrc || e.blendDst !== t.blendDst || e.blendSrcAlpha !== t.blendSrcAlpha || e.blendDstAlpha !== t.blendDstAlpha) {
76026                    o.blendFuncSeparate(i7[t.blendSrc], i7[t.blendDst], i7[t.blendSrcAlpha], i7[t.blendDstAlpha]);
76027                    e.blendSrc = t.blendSrc;
76028                    e.blendDst = t.blendDst;
76029                    e.blendSrcAlpha = t.blendSrcAlpha;
76030                    e.blendDstAlpha = t.blendDstAlpha;
76031                  }
76032                  if (e.blendColorMask !== t.blendColorMask) {
76033                    o.colorMask((t.blendColorMask & Vs.R) !== Vs.NONE, (t.blendColorMask & Vs.G) !== Vs.NONE, (t.blendColorMask & Vs.B) !== Vs.NONE, (t.blendColorMask & Vs.A) !== Vs.NONE);
76034                    e.blendColorMask = t.blendColorMask;
76035                  }
76036                }
76037              }
76038              if (e && e.gpuPipelineLayout && l) {
76039                const i = l.glBlocks.length;
76040                const {dynamicOffsetIndices: r} = e.gpuPipelineLayout;
76041                for (let t = 0; t < i; t++) {
76042                  const e = l.glBlocks[t];
76043                  const i = s[e.set];
76044                  const a = i && i.descriptorIndices[e.binding];
76045                  const h = a >= 0 && i.gpuDescriptors[a];
76046                  let c = null;
76047                  let u = 0;
76048                  if (h && h.gpuBuffer) {
76049                    const {gpuBuffer: t} = h;
76050                    const i = r[e.set];
76051                    const s = i && i[e.binding];
76052                    s >= 0 && (u = n[s]);
76053                    if ("vf32" in t) c = t.vf32; else {
76054                      u += t.offset;
76055                      c = t.gpuBuffer.vf32;
76056                    }
76057                    u >>= 2;
76058                  }
76059                  if (!c) {
76060                    x(`Buffer binding '${e.name}' at set ${e.set} binding ${e.binding} is not bounded`);
76061                    continue;
76062                  }
76063                  const _ = e.glActiveUniforms.length;
76064                  for (let t = 0; t < _; t++) {
76065                    const i = e.glActiveUniforms[t];
76066                    switch (i.glType) {
76067                     case o.BOOL:
76068                     case o.INT:
76069                      for (let t = 0; t < i.array.length; ++t) {
76070                        const e = i.offset + u + t;
76071                        if (c[e] !== i.array[t]) {
76072                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76073                          o.uniform1iv(i.glLoc, i.array);
76074                          break;
76075                        }
76076                      }
76077                      break;
76078
76079                     case o.BOOL_VEC2:
76080                     case o.INT_VEC2:
76081                      for (let t = 0; t < i.array.length; ++t) {
76082                        const e = i.offset + u + t;
76083                        if (c[e] !== i.array[t]) {
76084                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76085                          o.uniform2iv(i.glLoc, i.array);
76086                          break;
76087                        }
76088                      }
76089                      break;
76090
76091                     case o.BOOL_VEC3:
76092                     case o.INT_VEC3:
76093                      for (let t = 0; t < i.array.length; ++t) {
76094                        const e = i.offset + u + t;
76095                        if (c[e] !== i.array[t]) {
76096                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76097                          o.uniform3iv(i.glLoc, i.array);
76098                          break;
76099                        }
76100                      }
76101                      break;
76102
76103                     case o.BOOL_VEC4:
76104                     case o.INT_VEC4:
76105                      for (let t = 0; t < i.array.length; ++t) {
76106                        const e = i.offset + u + t;
76107                        if (c[e] !== i.array[t]) {
76108                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76109                          o.uniform4iv(i.glLoc, i.array);
76110                          break;
76111                        }
76112                      }
76113                      break;
76114
76115                     case o.FLOAT:
76116                      for (let t = 0; t < i.array.length; ++t) {
76117                        const e = i.offset + u + t;
76118                        if (c[e] !== i.array[t]) {
76119                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76120                          o.uniform1fv(i.glLoc, i.array);
76121                          break;
76122                        }
76123                      }
76124                      break;
76125
76126                     case o.FLOAT_VEC2:
76127                      for (let t = 0; t < i.array.length; ++t) {
76128                        const e = i.offset + u + t;
76129                        if (c[e] !== i.array[t]) {
76130                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76131                          o.uniform2fv(i.glLoc, i.array);
76132                          break;
76133                        }
76134                      }
76135                      break;
76136
76137                     case o.FLOAT_VEC3:
76138                      for (let t = 0; t < i.array.length; ++t) {
76139                        const e = i.offset + u + t;
76140                        if (c[e] !== i.array[t]) {
76141                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76142                          o.uniform3fv(i.glLoc, i.array);
76143                          break;
76144                        }
76145                      }
76146                      break;
76147
76148                     case o.FLOAT_VEC4:
76149                      for (let t = 0; t < i.array.length; ++t) {
76150                        const e = i.offset + u + t;
76151                        if (c[e] !== i.array[t]) {
76152                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76153                          o.uniform4fv(i.glLoc, i.array);
76154                          break;
76155                        }
76156                      }
76157                      break;
76158
76159                     case o.FLOAT_MAT2:
76160                      for (let t = 0; t < i.array.length; ++t) {
76161                        const e = i.offset + u + t;
76162                        if (c[e] !== i.array[t]) {
76163                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76164                          o.uniformMatrix2fv(i.glLoc, !1, i.array);
76165                          break;
76166                        }
76167                      }
76168                      break;
76169
76170                     case o.FLOAT_MAT3:
76171                      for (let t = 0; t < i.array.length; ++t) {
76172                        const e = i.offset + u + t;
76173                        if (c[e] !== i.array[t]) {
76174                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76175                          o.uniformMatrix3fv(i.glLoc, !1, i.array);
76176                          break;
76177                        }
76178                      }
76179                      break;
76180
76181                     case o.FLOAT_MAT4:
76182                      for (let t = 0; t < i.array.length; ++t) {
76183                        const e = i.offset + u + t;
76184                        if (c[e] !== i.array[t]) {
76185                          for (let s = t, n = e; s < i.array.length; ++s, ++n) i.array[s] = c[n];
76186                          o.uniformMatrix4fv(i.glLoc, !1, i.array);
76187                          break;
76188                        }
76189                      }
76190                    }
76191                  }
76192                }
76193                const h = l.glSamplerTextures.length;
76194                for (let e = 0; e < h; e++) {
76195                  const i = l.glSamplerTextures[e];
76196                  const n = s[i.set];
76197                  let r = n && n.descriptorIndices[i.binding];
76198                  let h = r >= 0 && n.gpuDescriptors[r];
76199                  const d = i.units.length;
76200                  for (let e = 0; e < d; e++) {
76201                    const s = i.units[e];
76202                    if (h && h.gpuSampler) {
76203                      if (h.gpuTexture && h.gpuTexture.size > 0) {
76204                        const {gpuTexture: e} = h;
76205                        const i = a.glTexUnits[s];
76206                        if (i.glTexture !== e.glTexture) {
76207                          if (a.texUnit !== s) {
76208                            o.activeTexture(o.TEXTURE0 + s);
76209                            a.texUnit = s;
76210                          }
76211                          e.glTexture ? o.bindTexture(e.glTarget, e.glTexture) : o.bindTexture(e.glTarget, t.nullTex2D.gpuTexture.glTexture);
76212                          i.glTexture = e.glTexture;
76213                        }
76214                        const {gpuSampler: n} = h;
76215                        if (e.isPowerOf2) {
76216                          c = n.glWrapS;
76217                          u = n.glWrapT;
76218                        } else {
76219                          c = o.CLAMP_TO_EDGE;
76220                          u = o.CLAMP_TO_EDGE;
76221                        }
76222                        _ = e.isPowerOf2 ? e.mipLevel <= 1 && (n.glMinFilter === o.LINEAR_MIPMAP_NEAREST || n.glMinFilter === o.LINEAR_MIPMAP_LINEAR) ? o.LINEAR : n.glMinFilter : n.glMinFilter === o.LINEAR || n.glMinFilter === o.LINEAR_MIPMAP_NEAREST || n.glMinFilter === o.LINEAR_MIPMAP_LINEAR ? o.LINEAR : o.NEAREST;
76223                        if (e.glWrapS !== c) {
76224                          if (a.texUnit !== s) {
76225                            o.activeTexture(o.TEXTURE0 + s);
76226                            a.texUnit = s;
76227                          }
76228                          o.texParameteri(e.glTarget, o.TEXTURE_WRAP_S, c);
76229                          e.glWrapS = c;
76230                        }
76231                        if (e.glWrapT !== u) {
76232                          if (a.texUnit !== s) {
76233                            o.activeTexture(o.TEXTURE0 + s);
76234                            a.texUnit = s;
76235                          }
76236                          o.texParameteri(e.glTarget, o.TEXTURE_WRAP_T, u);
76237                          e.glWrapT = u;
76238                        }
76239                        if (e.glMinFilter !== _) {
76240                          if (a.texUnit !== s) {
76241                            o.activeTexture(o.TEXTURE0 + s);
76242                            a.texUnit = s;
76243                          }
76244                          o.texParameteri(e.glTarget, o.TEXTURE_MIN_FILTER, _);
76245                          e.glMinFilter = _;
76246                        }
76247                        if (e.glMagFilter !== n.glMagFilter) {
76248                          if (a.texUnit !== s) {
76249                            o.activeTexture(o.TEXTURE0 + s);
76250                            a.texUnit = s;
76251                          }
76252                          o.texParameteri(e.glTarget, o.TEXTURE_MAG_FILTER, n.glMagFilter);
76253                          e.glMagFilter = n.glMagFilter;
76254                        }
76255                      }
76256                      h = n.gpuDescriptors[++r];
76257                    } else x(`Sampler binding '${i.name}' at set ${i.set} binding ${i.binding} index ${e} is not bounded`);
76258                  }
76259                }
76260              }
76261              if (i && l && (h || d7.gpuInputAssembler !== i)) {
76262                d7.gpuInputAssembler = i;
76263                const e = t.extensions.ANGLE_instanced_arrays;
76264                if (t.extensions.useVAO) {
76265                  const s = t.extensions.OES_vertex_array_object;
76266                  let n = i.glVAOs.get(l.glProgram);
76267                  if (!n) {
76268                    n = s.createVertexArrayOES();
76269                    i.glVAOs.set(l.glProgram, n);
76270                    s.bindVertexArrayOES(n);
76271                    o.bindBuffer(o.ARRAY_BUFFER, null);
76272                    o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, null);
76273                    a.glArrayBuffer = null;
76274                    a.glElementArrayBuffer = null;
76275                    let t;
76276                    const r = l.glInputs.length;
76277                    for (let s = 0; s < r; s++) {
76278                      const n = l.glInputs[s];
76279                      t = null;
76280                      const r = i.glAttribs.length;
76281                      for (let e = 0; e < r; e++) {
76282                        const s = i.glAttribs[e];
76283                        if (s.name === n.name) {
76284                          t = s;
76285                          break;
76286                        }
76287                      }
76288                      if (t) {
76289                        if (a.glArrayBuffer !== t.glBuffer) {
76290                          o.bindBuffer(o.ARRAY_BUFFER, t.glBuffer);
76291                          a.glArrayBuffer = t.glBuffer;
76292                        }
76293                        for (let i = 0; i < t.componentCount; ++i) {
76294                          const s = n.glLoc + i;
76295                          const r = t.offset + t.size * i;
76296                          o.enableVertexAttribArray(s);
76297                          a.glCurrentAttribLocs[s] = !0;
76298                          o.vertexAttribPointer(s, t.count, t.glType, t.isNormalized, t.stride, r);
76299                          e && e.vertexAttribDivisorANGLE(s, t.isInstanced ? 1 : 0);
76300                        }
76301                      }
76302                    }
76303                    const h = i.gpuIndexBuffer;
76304                    h && o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, h.glBuffer);
76305                    s.bindVertexArrayOES(null);
76306                    o.bindBuffer(o.ARRAY_BUFFER, null);
76307                    o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, null);
76308                    a.glArrayBuffer = null;
76309                    a.glElementArrayBuffer = null;
76310                  }
76311                  if (a.glVAO !== n) {
76312                    s.bindVertexArrayOES(n);
76313                    a.glVAO = n;
76314                  }
76315                } else {
76316                  for (let e = 0; e < t.capabilities.maxVertexAttributes; ++e) a.glCurrentAttribLocs[e] = !1;
76317                  const s = l.glInputs.length;
76318                  for (let t = 0; t < s; t++) {
76319                    const s = l.glInputs[t];
76320                    let n = null;
76321                    const r = i.glAttribs.length;
76322                    for (let t = 0; t < r; t++) {
76323                      const e = i.glAttribs[t];
76324                      if (e.name === s.name) {
76325                        n = e;
76326                        break;
76327                      }
76328                    }
76329                    if (n) {
76330                      if (a.glArrayBuffer !== n.glBuffer) {
76331                        o.bindBuffer(o.ARRAY_BUFFER, n.glBuffer);
76332                        a.glArrayBuffer = n.glBuffer;
76333                      }
76334                      for (let t = 0; t < n.componentCount; ++t) {
76335                        const i = s.glLoc + t;
76336                        const r = n.offset + n.size * t;
76337                        if (!a.glEnabledAttribLocs[i] && i >= 0) {
76338                          o.enableVertexAttribArray(i);
76339                          a.glEnabledAttribLocs[i] = !0;
76340                        }
76341                        a.glCurrentAttribLocs[i] = !0;
76342                        o.vertexAttribPointer(i, n.count, n.glType, n.isNormalized, n.stride, r);
76343                        e && e.vertexAttribDivisorANGLE(i, n.isInstanced ? 1 : 0);
76344                      }
76345                    }
76346                  }
76347                  const n = i.gpuIndexBuffer;
76348                  if (n && a.glElementArrayBuffer !== n.glBuffer) {
76349                    o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, n.glBuffer);
76350                    a.glElementArrayBuffer = n.glBuffer;
76351                  }
76352                  for (let e = 0; e < t.capabilities.maxVertexAttributes; ++e) if (a.glEnabledAttribLocs[e] !== a.glCurrentAttribLocs[e]) {
76353                    o.disableVertexAttribArray(e);
76354                    a.glEnabledAttribLocs[e] = !1;
76355                  }
76356                }
76357              }
76358              if (e && e.dynamicStates.length) {
76359                const t = e.dynamicStates.length;
76360                for (let i = 0; i < t; i++) {
76361                  switch (e.dynamicStates[i]) {
76362                   case Ks.LINE_WIDTH:
76363                    if (a.rs.lineWidth !== r.lineWidth) {
76364                      o.lineWidth(r.lineWidth);
76365                      a.rs.lineWidth = r.lineWidth;
76366                    }
76367                    break;
76368
76369                   case Ks.DEPTH_BIAS:
76370                    if (a.rs.depthBias !== r.depthBiasConstant || a.rs.depthBiasSlop !== r.depthBiasSlope) {
76371                      o.polygonOffset(r.depthBiasConstant, r.depthBiasSlope);
76372                      a.rs.depthBias = r.depthBiasConstant;
76373                      a.rs.depthBiasSlop = r.depthBiasSlope;
76374                    }
76375                    break;
76376
76377                   case Ks.BLEND_CONSTANTS:
76378                    {
76379                      const t = r.blendConstant;
76380                      if (a.bs.blendColor.x !== t.x || a.bs.blendColor.y !== t.y || a.bs.blendColor.z !== t.z || a.bs.blendColor.w !== t.w) {
76381                        o.blendColor(t.x, t.y, t.z, t.w);
76382                        a.bs.blendColor.copy(t);
76383                      }
76384                      break;
76385                    }
76386
76387                   case Ks.STENCIL_WRITE_MASK:
76388                    {
76389                      const t = r.stencilStatesFront;
76390                      const e = r.stencilStatesBack;
76391                      if (a.dss.stencilWriteMaskFront !== t.writeMask) {
76392                        o.stencilMaskSeparate(o.FRONT, t.writeMask);
76393                        a.dss.stencilWriteMaskFront = t.writeMask;
76394                      }
76395                      if (a.dss.stencilWriteMaskBack !== e.writeMask) {
76396                        o.stencilMaskSeparate(o.BACK, e.writeMask);
76397                        a.dss.stencilWriteMaskBack = e.writeMask;
76398                      }
76399                      break;
76400                    }
76401
76402                   case Ks.STENCIL_COMPARE_MASK:
76403                    {
76404                      const t = r.stencilStatesFront;
76405                      const e = r.stencilStatesBack;
76406                      if (a.dss.stencilRefFront !== t.reference || a.dss.stencilReadMaskFront !== t.compareMask) {
76407                        o.stencilFuncSeparate(o.FRONT, $6[a.dss.stencilFuncFront], t.reference, t.compareMask);
76408                        a.dss.stencilRefFront = t.reference;
76409                        a.dss.stencilReadMaskFront = t.compareMask;
76410                      }
76411                      if (a.dss.stencilRefBack !== e.reference || a.dss.stencilReadMaskBack !== e.compareMask) {
76412                        o.stencilFuncSeparate(o.BACK, $6[a.dss.stencilFuncBack], e.reference, e.compareMask);
76413                        a.dss.stencilRefBack = e.reference;
76414                        a.dss.stencilReadMaskBack = e.compareMask;
76415                      }
76416                      break;
76417                    }
76418                  }
76419                }
76420              }
76421            }
76422            function g7(t, e) {
76423              const {gl: i} = t;
76424              const {ANGLE_instanced_arrays: s, WEBGL_multi_draw: n} = t.extensions;
76425              const {gpuInputAssembler: r, glPrimitive: o} = d7;
76426              if (r) {
76427                const t = r.gpuIndexBuffer;
76428                if (r.gpuIndirectBuffer) {
76429                  const e = r.gpuIndirectBuffer.indirects;
76430                  if (e.drawByIndex) {
76431                    for (let i = 0; i < e.drawCount; i++) e.byteOffsets[i] = e.offsets[i] * t.stride;
76432                    if (n) e.instancedDraw ? n.multiDrawElementsInstancedWEBGL(o, e.counts, 0, r.glIndexType, e.byteOffsets, 0, e.instances, 0, e.drawCount) : n.multiDrawElementsWEBGL(o, e.counts, 0, r.glIndexType, e.byteOffsets, 0, e.drawCount); else for (let t = 0; t < e.drawCount; t++) e.instances[t] && s ? s.drawElementsInstancedANGLE(o, e.counts[t], r.glIndexType, e.byteOffsets[t], e.instances[t]) : i.drawElements(o, e.counts[t], r.glIndexType, e.byteOffsets[t]);
76433                  } else if (n) e.instancedDraw ? n.multiDrawArraysInstancedWEBGL(o, e.offsets, 0, e.counts, 0, e.instances, 0, e.drawCount) : n.multiDrawArraysWEBGL(o, e.offsets, 0, e.counts, 0, e.drawCount); else for (let t = 0; t < e.drawCount; t++) e.instances[t] && s ? s.drawArraysInstancedANGLE(o, e.offsets[t], e.counts[t], e.instances[t]) : i.drawArrays(o, e.offsets[t], e.counts[t]);
76434                } else if (e.instanceCount && s) if (t) {
76435                  if (e.indexCount > 0) {
76436                    const i = e.firstIndex * t.stride;
76437                    s.drawElementsInstancedANGLE(o, e.indexCount, r.glIndexType, i, e.instanceCount);
76438                  }
76439                } else e.vertexCount > 0 && s.drawArraysInstancedANGLE(o, e.firstVertex, e.vertexCount, e.instanceCount); else if (t) {
76440                  if (e.indexCount > 0) {
76441                    const s = e.firstIndex * t.stride;
76442                    i.drawElements(o, e.indexCount, r.glIndexType, s);
76443                  }
76444                } else e.vertexCount > 0 && i.drawArrays(o, e.firstVertex, e.vertexCount);
76445              }
76446            }
76447            const y7 = new Array(s7.COUNT);
76448            function b7(t, e) {
76449              y7.fill(0);
76450              for (let i = 0; i < e.cmds.length; ++i) {
76451                const s = e.cmds.array[i];
76452                const n = y7[s]++;
76453                switch (s) {
76454                 case s7.BEGIN_RENDER_PASS:
76455                  {
76456                    const i = e.beginRenderPassCmds.array[n];
76457                    m7(t, i.gpuRenderPass, i.gpuFramebuffer, i.renderArea, i.clearColors, i.clearDepth, i.clearStencil);
76458                    break;
76459                  }
76460
76461                 case s7.BIND_STATES:
76462                  {
76463                    const i = e.bindStatesCmds.array[n];
76464                    f7(t, i.gpuPipelineState, i.gpuInputAssembler, i.gpuDescriptorSets, i.dynamicOffsets, i.dynamicStates);
76465                    break;
76466                  }
76467
76468                 case s7.DRAW:
76469                  g7(t, e.drawCmds.array[n].drawInfo);
76470                  break;
76471
76472                 case s7.UPDATE_BUFFER:
76473                  {
76474                    const i = e.updateBufferCmds.array[n];
76475                    u7(t, i.gpuBuffer, i.buffer, i.offset, i.size);
76476                    break;
76477                  }
76478
76479                 case s7.COPY_BUFFER_TO_TEXTURE:
76480                  {
76481                    const i = e.copyBufferToTextureCmds.array[n];
76482                    T7(t, i.buffers, i.gpuTexture, i.regions);
76483                    break;
76484                  }
76485                }
76486              }
76487            }
76488            let S7 = new Uint8Array(1);
76489            function A7(t, e, i, s, n) {
76490              const r = Tr(e).height;
76491              const o = gr(e, n.width, n.height, n.depth);
76492              const a = gr(e, s.width, 1, 1);
76493              const l = gr(e, s.width, s.height, 1);
76494              const h = gr(e, n.width, 1, 1);
76495              const c = Ar(ur[e]);
76496              S7.byteLength < o && (S7 = new Uint8Array(o));
76497              let u = 0;
76498              let _ = i;
76499              for (let e = 0; e < n.depth; e++) {
76500                _ = i + l * e;
76501                for (let e = 0; e < n.height; e += r) {
76502                  S7.subarray(u, u + h).set(new Uint8Array(t.buffer, t.byteOffset + _, h));
76503                  u += h;
76504                  _ += a;
76505                }
76506              }
76507              return new c(S7.buffer);
76508            }
76509            function T7(t, e, i, s) {
76510              const {gl: n} = t;
76511              const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
76512              if (r.glTexture !== i.glTexture) {
76513                n.bindTexture(i.glTarget, i.glTexture);
76514                r.glTexture = i.glTexture;
76515              }
76516              let o = 0;
76517              let a = 0;
76518              const l = ur[i.format];
76519              const h = Ar(l);
76520              const {isCompressed: c} = l;
76521              const u = Tr(i.format);
76522              const _ = new cn;
76523              const d = new ln;
76524              const p = new cn;
76525              switch (i.glTarget) {
76526               case n.TEXTURE_2D:
76527                for (let r = 0; r < s.length; r++) {
76528                  const a = s[r];
76529                  const l = a.texSubres.mipLevel;
76530                  d.x = 0 === a.texOffset.x ? 0 : vr(a.texOffset.x, u.width);
76531                  d.y = 0 === a.texOffset.y ? 0 : vr(a.texOffset.y, u.height);
76532                  _.width = a.texExtent.width < u.width ? a.texExtent.width : vr(a.texExtent.width, u.width);
76533                  _.height = a.texExtent.height < u.height ? a.texExtent.width : vr(a.texExtent.height, u.height);
76534                  p.width = a.buffStride > 0 ? a.buffStride : _.width;
76535                  p.height = a.buffTexHeight > 0 ? a.buffTexHeight : _.height;
76536                  const m = a.texExtent.width + d.x === i.width >> l ? a.texExtent.width : _.width;
76537                  const f = a.texExtent.height + d.y === i.height >> l ? a.texExtent.height : _.height;
76538                  let g;
76539                  const y = e[o++];
76540                  g = p.width === _.width && p.height === _.height ? new h(y.buffer, y.byteOffset + a.buffOffset) : A7(y, i.format, a.buffOffset, p, _);
76541                  c ? i.glInternalFmt === X6.COMPRESSED_RGB_ETC1_WEBGL || t.extensions.noCompressedTexSubImage2D ? n.compressedTexImage2D(n.TEXTURE_2D, l, i.glInternalFmt, m, f, 0, g) : n.compressedTexSubImage2D(n.TEXTURE_2D, l, d.x, d.y, m, f, i.glFormat, g) : n.texSubImage2D(n.TEXTURE_2D, l, d.x, d.y, m, f, i.glFormat, i.glType, g);
76542                }
76543                break;
76544
76545               case n.TEXTURE_CUBE_MAP:
76546                for (let r = 0; r < s.length; r++) {
76547                  const l = s[r];
76548                  const m = l.texSubres.mipLevel;
76549                  d.x = 0 === l.texOffset.x ? 0 : vr(l.texOffset.x, u.width);
76550                  d.y = 0 === l.texOffset.y ? 0 : vr(l.texOffset.y, u.height);
76551                  _.width = l.texExtent.width < u.width ? l.texExtent.width : vr(l.texExtent.width, u.width);
76552                  _.height = l.texExtent.height < u.height ? l.texExtent.width : vr(l.texExtent.height, u.height);
76553                  p.width = l.buffStride > 0 ? l.buffStride : _.width;
76554                  p.height = l.buffTexHeight > 0 ? l.buffTexHeight : _.height;
76555                  const f = l.texExtent.width + d.x === i.width >> m ? l.texExtent.width : _.width;
76556                  const g = l.texExtent.height + d.y === i.height >> m ? l.texExtent.height : _.height;
76557                  const y = l.texSubres.baseArrayLayer + l.texSubres.layerCount;
76558                  for (a = l.texSubres.baseArrayLayer; a < y; ++a) {
76559                    let s;
76560                    const r = e[o++];
76561                    s = p.width === _.width && p.height === _.height ? new h(r.buffer, r.byteOffset + l.buffOffset) : A7(r, i.format, l.buffOffset, p, _);
76562                    c ? i.glInternalFmt === X6.COMPRESSED_RGB_ETC1_WEBGL || t.extensions.noCompressedTexSubImage2D ? n.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, m, i.glInternalFmt, f, g, 0, s) : n.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, m, d.x, d.y, f, g, i.glFormat, s) : n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, m, d.x, d.y, f, g, i.glFormat, i.glType, s);
76563                  }
76564                }
76565                break;
76566
76567               default:
76568                console.error("Unsupported GL texture type, copy buffer to texture failed.");
76569              }
76570              i.flags & Rs.GEN_MIPMAP && n.generateMipmap(i.glTarget);
76571            }
76572            class v7 {
76573              constructor() {
76574                this.counts = void 0;
76575                this.offsets = void 0;
76576                this.instances = void 0;
76577                this.drawCount = 0;
76578                this.drawByIndex = !1;
76579                this.instancedDraw = !1;
76580                this.byteOffsets = void 0;
76581                this._capacity = 4;
76582                this.counts = new Int32Array(this._capacity);
76583                this.offsets = new Int32Array(this._capacity);
76584                this.instances = new Int32Array(this._capacity);
76585                this.byteOffsets = new Int32Array(this._capacity);
76586              }
76587              clearDraws() {
76588                this.drawCount = 0;
76589                this.drawByIndex = !1;
76590                this.instancedDraw = !1;
76591              }
76592              setDrawInfo(t, e) {
76593                this._ensureCapacity(t);
76594                this.drawByIndex = e.indexCount > 0;
76595                this.instancedDraw = !!e.instanceCount;
76596                this.drawCount = Math.max(t + 1, this.drawCount);
76597                if (this.drawByIndex) {
76598                  this.counts[t] = e.indexCount;
76599                  this.offsets[t] = e.firstIndex;
76600                } else {
76601                  this.counts[t] = e.vertexCount;
76602                  this.offsets[t] = e.firstVertex;
76603                }
76604                this.instances[t] = Math.max(1, e.instanceCount);
76605              }
76606              _ensureCapacity(t) {
76607                if (this._capacity > t) return;
76608                this._capacity = l(t);
76609                const e = new Int32Array(this._capacity);
76610                const i = new Int32Array(this._capacity);
76611                const s = new Int32Array(this._capacity);
76612                this.byteOffsets = new Int32Array(this._capacity);
76613                e.set(this.counts);
76614                i.set(this.offsets);
76615                s.set(this.instances);
76616                this.counts = e;
76617                this.offsets = i;
76618                this.instances = s;
76619              }
76620            }
76621            class E7 extends Pr {
76622              constructor(...t) {
76623                super(...t);
76624                this._gpuBuffer = null;
76625                this._gpuBufferView = null;
76626                this._uniformBuffer = null;
76627              }
76628              get gpuBuffer() {
76629                return this._gpuBuffer;
76630              }
76631              get gpuBufferView() {
76632                return this._gpuBufferView;
76633              }
76634              initialize(t) {
76635                if ("buffer" in t) {
76636                  this._isBufferView = !0;
76637                  const e = t.buffer;
76638                  this._usage = e.usage;
76639                  this._memUsage = e.memUsage;
76640                  this._size = this._stride = t.range;
76641                  this._count = 1;
76642                  this._flags = e.flags;
76643                  this._gpuBufferView = {
76644                    gpuBuffer: e.gpuBuffer,
76645                    offset: t.offset,
76646                    range: t.range
76647                  };
76648                } else {
76649                  this._usage = t.usage;
76650                  this._memUsage = t.memUsage;
76651                  this._size = t.size;
76652                  this._stride = Math.max(t.stride || this._size, 1);
76653                  this._count = this._size / this._stride;
76654                  this._flags = t.flags;
76655                  this._usage & Ts.UNIFORM && this._size > 0 && (this._uniformBuffer = new Uint8Array(this._size));
76656                  this._gpuBuffer = {
76657                    usage: this._usage,
76658                    memUsage: this._memUsage,
76659                    size: this._size,
76660                    stride: this._stride,
76661                    buffer: null,
76662                    vf32: null,
76663                    indirects: new v7,
76664                    glTarget: 0,
76665                    glBuffer: null
76666                  };
76667                  this._usage & Ts.UNIFORM && (this._gpuBuffer.buffer = this._uniformBuffer);
76668                  !function(t, e) {
76669                    const {gl: i} = t;
76670                    const s = t.stateCache;
76671                    const n = e.memUsage & Cs.HOST ? i.DYNAMIC_DRAW : i.STATIC_DRAW;
76672                    if (e.usage & Ts.VERTEX) {
76673                      e.glTarget = i.ARRAY_BUFFER;
76674                      const r = i.createBuffer();
76675                      if (r) {
76676                        e.glBuffer = r;
76677                        if (e.size > 0) {
76678                          if (t.extensions.useVAO && s.glVAO) {
76679                            t.extensions.OES_vertex_array_object.bindVertexArrayOES(null);
76680                            s.glVAO = null;
76681                          }
76682                          d7.gpuInputAssembler = null;
76683                          if (t.stateCache.glArrayBuffer !== e.glBuffer) {
76684                            i.bindBuffer(i.ARRAY_BUFFER, e.glBuffer);
76685                            t.stateCache.glArrayBuffer = e.glBuffer;
76686                          }
76687                          i.bufferData(i.ARRAY_BUFFER, e.size, n);
76688                          i.bindBuffer(i.ARRAY_BUFFER, null);
76689                          t.stateCache.glArrayBuffer = null;
76690                        }
76691                      }
76692                    } else if (e.usage & Ts.INDEX) {
76693                      e.glTarget = i.ELEMENT_ARRAY_BUFFER;
76694                      const r = i.createBuffer();
76695                      if (r) {
76696                        e.glBuffer = r;
76697                        if (e.size > 0) {
76698                          if (t.extensions.useVAO && s.glVAO) {
76699                            t.extensions.OES_vertex_array_object.bindVertexArrayOES(null);
76700                            s.glVAO = null;
76701                          }
76702                          d7.gpuInputAssembler = null;
76703                          if (t.stateCache.glElementArrayBuffer !== e.glBuffer) {
76704                            i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, e.glBuffer);
76705                            t.stateCache.glElementArrayBuffer = e.glBuffer;
76706                          }
76707                          i.bufferData(i.ELEMENT_ARRAY_BUFFER, e.size, n);
76708                          i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, null);
76709                          t.stateCache.glElementArrayBuffer = null;
76710                        }
76711                      }
76712                    } else if (e.usage & Ts.UNIFORM) {
76713                      e.glTarget = i.NONE;
76714                      e.buffer && (e.vf32 = new Float32Array(e.buffer.buffer));
76715                    } else if (e.usage & Ts.INDIRECT) e.glTarget = i.NONE; else if (e.usage & Ts.TRANSFER_DST) e.glTarget = i.NONE; else if (e.usage & Ts.TRANSFER_SRC) e.glTarget = i.NONE; else {
76716                      console.error("Unsupported BufferType, create buffer failed.");
76717                      e.glTarget = i.NONE;
76718                    }
76719                  }(W6.instance, this._gpuBuffer);
76720                  W6.instance.memoryStatus.bufferSize += this._size;
76721                }
76722              }
76723              destroy() {
76724                if (this._gpuBuffer) {
76725                  !function(t, e) {
76726                    const {gl: i} = t;
76727                    const s = t.stateCache;
76728                    if (e.glBuffer) {
76729                      switch (e.glTarget) {
76730                       case i.ARRAY_BUFFER:
76731                        if (t.extensions.useVAO && s.glVAO) {
76732                          t.extensions.OES_vertex_array_object.bindVertexArrayOES(null);
76733                          t.stateCache.glVAO = null;
76734                        }
76735                        d7.gpuInputAssembler = null;
76736                        i.bindBuffer(i.ARRAY_BUFFER, null);
76737                        t.stateCache.glArrayBuffer = null;
76738                        break;
76739
76740                       case i.ELEMENT_ARRAY_BUFFER:
76741                        if (t.extensions.useVAO && s.glVAO) {
76742                          t.extensions.OES_vertex_array_object.bindVertexArrayOES(null);
76743                          t.stateCache.glVAO = null;
76744                        }
76745                        d7.gpuInputAssembler = null;
76746                        i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, null);
76747                        t.stateCache.glElementArrayBuffer = null;
76748                      }
76749                      i.deleteBuffer(e.glBuffer);
76750                      e.glBuffer = null;
76751                    }
76752                  }(W6.instance, this._gpuBuffer);
76753                  W6.instance.memoryStatus.bufferSize -= this._size;
76754                  this._gpuBuffer = null;
76755                }
76756                this._gpuBufferView && (this._gpuBufferView = null);
76757              }
76758              resize(t) {
76759                if (this._isBufferView) {
76760                  console.warn("cannot resize buffer views!");
76761                  return;
76762                }
76763                const e = this._size;
76764                if (e !== t) {
76765                  this._size = t;
76766                  this._count = this._size / this._stride;
76767                  this._uniformBuffer && (this._uniformBuffer = new Uint8Array(t));
76768                  if (this._gpuBuffer) {
76769                    this._uniformBuffer && (this._gpuBuffer.buffer = this._uniformBuffer);
76770                    this._gpuBuffer.size = t;
76771                    if (t > 0) {
76772                      !function(t, e) {
76773                        const {gl: i} = t;
76774                        const s = t.stateCache;
76775                        const n = e.memUsage & Cs.HOST ? i.DYNAMIC_DRAW : i.STATIC_DRAW;
76776                        if (e.usage & Ts.VERTEX) {
76777                          if (t.extensions.useVAO && s.glVAO) {
76778                            t.extensions.OES_vertex_array_object.bindVertexArrayOES(null);
76779                            s.glVAO = null;
76780                          }
76781                          d7.gpuInputAssembler = null;
76782                          t.stateCache.glArrayBuffer !== e.glBuffer && i.bindBuffer(i.ARRAY_BUFFER, e.glBuffer);
76783                          e.buffer ? i.bufferData(i.ARRAY_BUFFER, e.buffer, n) : i.bufferData(i.ARRAY_BUFFER, e.size, n);
76784                          i.bindBuffer(i.ARRAY_BUFFER, null);
76785                          t.stateCache.glArrayBuffer = null;
76786                        } else if (e.usage & Ts.INDEX) {
76787                          if (t.extensions.useVAO && s.glVAO) {
76788                            t.extensions.OES_vertex_array_object.bindVertexArrayOES(null);
76789                            s.glVAO = null;
76790                          }
76791                          d7.gpuInputAssembler = null;
76792                          t.stateCache.glElementArrayBuffer !== e.glBuffer && i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, e.glBuffer);
76793                          e.buffer ? i.bufferData(i.ELEMENT_ARRAY_BUFFER, e.buffer, n) : i.bufferData(i.ELEMENT_ARRAY_BUFFER, e.size, n);
76794                          i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, null);
76795                          t.stateCache.glElementArrayBuffer = null;
76796                        } else if (e.usage & Ts.UNIFORM) e.buffer && (e.vf32 = new Float32Array(e.buffer.buffer)); else if (e.usage & Ts.INDIRECT || e.usage & Ts.TRANSFER_DST || e.usage & Ts.TRANSFER_SRC) e.glTarget = i.NONE; else {
76797                          console.error("Unsupported BufferType, create buffer failed.");
76798                          e.glTarget = i.NONE;
76799                        }
76800                      }(W6.instance, this._gpuBuffer);
76801                      W6.instance.memoryStatus.bufferSize -= e;
76802                      W6.instance.memoryStatus.bufferSize += t;
76803                    }
76804                  }
76805                }
76806              }
76807              update(t, e) {
76808                if (this._isBufferView) {
76809                  console.warn("cannot update through buffer views!");
76810                  return;
76811                }
76812                let i;
76813                i = void 0 !== e ? e : this._usage & Ts.INDIRECT ? 0 : t.byteLength;
76814                u7(W6.instance, this._gpuBuffer, t, 0, i);
76815              }
76816            }
76817            class C7 {
76818              constructor(t, e) {
76819                this._frees = void 0;
76820                this._freeIdx = 0;
76821                this._freeCmds = void 0;
76822                this._frees = new Array(e);
76823                this._freeCmds = new eo(e);
76824                for (let i = 0; i < e; ++i) this._frees[i] = new t;
76825                this._freeIdx = e - 1;
76826              }
76827              alloc(t) {
76828                if (this._freeIdx < 0) {
76829                  const e = 2 * this._frees.length;
76830                  const i = this._frees;
76831                  this._frees = new Array(e);
76832                  const s = e - i.length;
76833                  for (let e = 0; e < s; ++e) this._frees[e] = new t;
76834                  for (let t = s, n = 0; t < e; ++t, ++n) this._frees[t] = i[n];
76835                  this._freeIdx += s;
76836                }
76837                const e = this._frees[this._freeIdx];
76838                this._frees[this._freeIdx--] = null;
76839                ++e.refCount;
76840                return e;
76841              }
76842              free(t) {
76843                0 == --t.refCount && this._freeCmds.push(t);
76844              }
76845              freeCmds(t) {
76846                for (let e = 0; e < t.length; ++e) 0 == --t.array[e].refCount && this._freeCmds.push(t.array[e]);
76847              }
76848              release() {
76849                for (let t = 0; t < this._freeCmds.length; ++t) {
76850                  const e = this._freeCmds.array[t];
76851                  e.clear();
76852                  this._frees[++this._freeIdx] = e;
76853                }
76854                this._freeCmds.clear();
76855              }
76856            }
76857            class x7 {
76858              constructor() {
76859                this.beginRenderPassCmdPool = void 0;
76860                this.bindStatesCmdPool = void 0;
76861                this.drawCmdPool = void 0;
76862                this.updateBufferCmdPool = void 0;
76863                this.copyBufferToTextureCmdPool = void 0;
76864                this.beginRenderPassCmdPool = new C7(r7, 1);
76865                this.bindStatesCmdPool = new C7(o7, 1);
76866                this.drawCmdPool = new C7(a7, 1);
76867                this.updateBufferCmdPool = new C7(l7, 1);
76868                this.copyBufferToTextureCmdPool = new C7(h7, 1);
76869              }
76870              clearCmds(t) {
76871                if (t.beginRenderPassCmds.length) {
76872                  this.beginRenderPassCmdPool.freeCmds(t.beginRenderPassCmds);
76873                  t.beginRenderPassCmds.clear();
76874                }
76875                if (t.bindStatesCmds.length) {
76876                  this.bindStatesCmdPool.freeCmds(t.bindStatesCmds);
76877                  t.bindStatesCmds.clear();
76878                }
76879                if (t.drawCmds.length) {
76880                  this.drawCmdPool.freeCmds(t.drawCmds);
76881                  t.drawCmds.clear();
76882                }
76883                if (t.updateBufferCmds.length) {
76884                  this.updateBufferCmdPool.freeCmds(t.updateBufferCmds);
76885                  t.updateBufferCmds.clear();
76886                }
76887                if (t.copyBufferToTextureCmds.length) {
76888                  this.copyBufferToTextureCmdPool.freeCmds(t.copyBufferToTextureCmds);
76889                  t.copyBufferToTextureCmds.clear();
76890                }
76891                t.cmds.clear();
76892              }
76893              releaseCmds() {
76894                this.beginRenderPassCmdPool.release();
76895                this.bindStatesCmdPool.release();
76896                this.drawCmdPool.release();
76897                this.updateBufferCmdPool.release();
76898                this.copyBufferToTextureCmdPool.release();
76899              }
76900            }
76901            class w7 extends Or {
76902              constructor(...t) {
76903                super(...t);
76904                this.cmdPackage = new c7;
76905                this._cmdAllocator = new x7;
76906                this._isInRenderPass = !1;
76907                this._curGPUPipelineState = null;
76908                this._curGPUInputAssembler = null;
76909                this._curGPUDescriptorSets = [];
76910                this._curDynamicOffsets = Array(8).fill(0);
76911                this._curDynamicStates = new lr;
76912                this._isStateInvalied = !1;
76913              }
76914              initialize(t) {
76915                this._type = t.type;
76916                this._queue = t.queue;
76917                const e = W6.instance.bindingMappings.blockOffsets.length;
76918                for (let t = 0; t < e; t++) this._curGPUDescriptorSets.push(null);
76919              }
76920              destroy() {
76921                this._cmdAllocator.clearCmds(this.cmdPackage);
76922              }
76923              begin(t, e = 0, i) {
76924                this._cmdAllocator.clearCmds(this.cmdPackage);
76925                this._curGPUPipelineState = null;
76926                this._curGPUInputAssembler = null;
76927                this._curGPUDescriptorSets.length = 0;
76928                this._numDrawCalls = 0;
76929                this._numInstances = 0;
76930                this._numTris = 0;
76931              }
76932              end() {
76933                this._isStateInvalied && this.bindStates();
76934                this._isInRenderPass = !1;
76935              }
76936              beginRenderPass(t, e, i, s, n, r) {
76937                const o = this._cmdAllocator.beginRenderPassCmdPool.alloc(r7);
76938                o.gpuRenderPass = t.gpuRenderPass;
76939                o.gpuFramebuffer = e.gpuFramebuffer;
76940                o.renderArea.copy(i);
76941                o.clearColors.length = s.length;
76942                for (let t = 0; t < s.length; ++t) o.clearColors[t] = s[t];
76943                o.clearDepth = n;
76944                o.clearStencil = r;
76945                this.cmdPackage.beginRenderPassCmds.push(o);
76946                this.cmdPackage.cmds.push(s7.BEGIN_RENDER_PASS);
76947                this._isInRenderPass = !0;
76948              }
76949              endRenderPass() {
76950                this._isInRenderPass = !1;
76951              }
76952              bindPipelineState(t) {
76953                const e = t.gpuPipelineState;
76954                if (e !== this._curGPUPipelineState) {
76955                  this._curGPUPipelineState = e;
76956                  this._isStateInvalied = !0;
76957                }
76958              }
76959              bindDescriptorSet(t, e, i) {
76960                const s = e.gpuDescriptorSet;
76961                if (s !== this._curGPUDescriptorSets[t]) {
76962                  this._curGPUDescriptorSets[t] = s;
76963                  this._isStateInvalied = !0;
76964                }
76965                if (i) {
76966                  var n;
76967                  const e = null === (n = this._curGPUPipelineState) || void 0 === n ? void 0 : n.gpuPipelineLayout;
76968                  if (e) {
76969                    const s = this._curDynamicOffsets;
76970                    const n = e.dynamicOffsetOffsets[t];
76971                    for (let t = 0; t < i.length; t++) s[n + t] = i[t];
76972                    this._isStateInvalied = !0;
76973                  }
76974                }
76975              }
76976              bindInputAssembler(t) {
76977                const e = t.gpuInputAssembler;
76978                this._curGPUInputAssembler = e;
76979                this._isStateInvalied = !0;
76980              }
76981              setViewport(t) {
76982                const e = this._curDynamicStates.viewport;
76983                if (e.left !== t.left || e.top !== t.top || e.width !== t.width || e.height !== t.height || e.minDepth !== t.minDepth || e.maxDepth !== t.maxDepth) {
76984                  e.left = t.left;
76985                  e.top = t.top;
76986                  e.width = t.width;
76987                  e.height = t.height;
76988                  e.minDepth = t.minDepth;
76989                  e.maxDepth = t.maxDepth;
76990                  this._isStateInvalied = !0;
76991                }
76992              }
76993              setScissor(t) {
76994                const e = this._curDynamicStates.scissor;
76995                if (e.x !== t.x || e.y !== t.y || e.width !== t.width || e.height !== t.height) {
76996                  e.x = t.x;
76997                  e.y = t.y;
76998                  e.width = t.width;
76999                  e.height = t.height;
77000                  this._isStateInvalied = !0;
77001                }
77002              }
77003              setLineWidth(t) {
77004                if (this._curDynamicStates.lineWidth !== t) {
77005                  this._curDynamicStates.lineWidth = t;
77006                  this._isStateInvalied = !0;
77007                }
77008              }
77009              setDepthBias(t, e, i) {
77010                const s = this._curDynamicStates;
77011                if (s.depthBiasConstant !== t || s.depthBiasClamp !== e || s.depthBiasSlope !== i) {
77012                  s.depthBiasConstant = t;
77013                  s.depthBiasClamp = e;
77014                  s.depthBiasSlope = i;
77015                  this._isStateInvalied = !0;
77016                }
77017              }
77018              setBlendConstants(t) {
77019                const e = this._curDynamicStates.blendConstant;
77020                if (e.x !== t.x || e.y !== t.y || e.z !== t.z || e.w !== t.w) {
77021                  e.copy(t);
77022                  this._isStateInvalied = !0;
77023                }
77024              }
77025              setDepthBound(t, e) {
77026                const i = this._curDynamicStates;
77027                if (i.depthMinBounds !== t || i.depthMaxBounds !== e) {
77028                  i.depthMinBounds = t;
77029                  i.depthMaxBounds = e;
77030                  this._isStateInvalied = !0;
77031                }
77032              }
77033              setStencilWriteMask(t, e) {
77034                const i = this._curDynamicStates.stencilStatesFront;
77035                const s = this._curDynamicStates.stencilStatesBack;
77036                if (t & Js.FRONT && i.writeMask !== e) {
77037                  i.writeMask = e;
77038                  this._isStateInvalied = !0;
77039                }
77040                if (t & Js.BACK && s.writeMask !== e) {
77041                  s.writeMask = e;
77042                  this._isStateInvalied = !0;
77043                }
77044              }
77045              setStencilCompareMask(t, e, i) {
77046                const s = this._curDynamicStates.stencilStatesFront;
77047                const n = this._curDynamicStates.stencilStatesBack;
77048                if (t & Js.FRONT && (s.compareMask !== i || s.reference !== e)) {
77049                  s.reference = e;
77050                  s.compareMask = i;
77051                  this._isStateInvalied = !0;
77052                }
77053                if (t & Js.BACK && (n.compareMask !== i || n.reference !== e)) {
77054                  n.reference = e;
77055                  n.compareMask = i;
77056                  this._isStateInvalied = !0;
77057                }
77058              }
77059              draw(t) {
77060                if (this._type === tn.PRIMARY && this._isInRenderPass || this._type === tn.SECONDARY) {
77061                  this._isStateInvalied && this.bindStates();
77062                  const e = "drawInfo" in t ? t.drawInfo : t;
77063                  const i = this._cmdAllocator.drawCmdPool.alloc(a7);
77064                  i.drawInfo.copy(e);
77065                  this.cmdPackage.drawCmds.push(i);
77066                  this.cmdPackage.cmds.push(s7.DRAW);
77067                  ++this._numDrawCalls;
77068                  this._numInstances += e.instanceCount;
77069                  const s = e.indexCount || e.vertexCount;
77070                  if (this._curGPUPipelineState) {
77071                    switch (this._curGPUPipelineState.glPrimitive) {
77072                     case 4:
77073                      this._numTris += s / 3 * Math.max(e.instanceCount, 1);
77074                      break;
77075
77076                     case 5:
77077                     case 6:
77078                      this._numTris += (s - 2) * Math.max(e.instanceCount, 1);
77079                    }
77080                  }
77081                } else console.error("Command 'draw' must be recorded inside a render pass.");
77082              }
77083              updateBuffer(t, e, i) {
77084                if (this._type === tn.PRIMARY && !this._isInRenderPass || this._type === tn.SECONDARY) {
77085                  const s = t.gpuBuffer;
77086                  if (s) {
77087                    const n = this._cmdAllocator.updateBufferCmdPool.alloc(l7);
77088                    let r = 0;
77089                    let o = null;
77090                    if (t.usage & Ts.INDIRECT) o = e; else {
77091                      r = void 0 !== i ? i : e.byteLength;
77092                      o = e;
77093                    }
77094                    n.gpuBuffer = s;
77095                    n.buffer = o;
77096                    n.offset = 0;
77097                    n.size = r;
77098                    this.cmdPackage.updateBufferCmds.push(n);
77099                    this.cmdPackage.cmds.push(s7.UPDATE_BUFFER);
77100                  }
77101                } else console.error("Command 'updateBuffer' must be recorded outside a render pass.");
77102              }
77103              copyBuffersToTexture(t, e, i) {
77104                if (this._type === tn.PRIMARY && !this._isInRenderPass || this._type === tn.SECONDARY) {
77105                  const s = e.gpuTexture;
77106                  if (s) {
77107                    const e = this._cmdAllocator.copyBufferToTextureCmdPool.alloc(h7);
77108                    if (e) {
77109                      e.gpuTexture = s;
77110                      e.regions = i;
77111                      e.buffers = t;
77112                      this.cmdPackage.copyBufferToTextureCmds.push(e);
77113                      this.cmdPackage.cmds.push(s7.COPY_BUFFER_TO_TEXTURE);
77114                    }
77115                  }
77116                } else console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.");
77117              }
77118              execute(t, e) {
77119                for (let i = 0; i < e; ++i) {
77120                  const e = t[i];
77121                  for (let t = 0; t < e.cmdPackage.beginRenderPassCmds.length; ++t) {
77122                    const i = e.cmdPackage.beginRenderPassCmds.array[t];
77123                    ++i.refCount;
77124                    this.cmdPackage.beginRenderPassCmds.push(i);
77125                  }
77126                  for (let t = 0; t < e.cmdPackage.bindStatesCmds.length; ++t) {
77127                    const i = e.cmdPackage.bindStatesCmds.array[t];
77128                    ++i.refCount;
77129                    this.cmdPackage.bindStatesCmds.push(i);
77130                  }
77131                  for (let t = 0; t < e.cmdPackage.drawCmds.length; ++t) {
77132                    const i = e.cmdPackage.drawCmds.array[t];
77133                    ++i.refCount;
77134                    this.cmdPackage.drawCmds.push(i);
77135                  }
77136                  for (let t = 0; t < e.cmdPackage.updateBufferCmds.length; ++t) {
77137                    const i = e.cmdPackage.updateBufferCmds.array[t];
77138                    ++i.refCount;
77139                    this.cmdPackage.updateBufferCmds.push(i);
77140                  }
77141                  for (let t = 0; t < e.cmdPackage.copyBufferToTextureCmds.length; ++t) {
77142                    const i = e.cmdPackage.copyBufferToTextureCmds.array[t];
77143                    ++i.refCount;
77144                    this.cmdPackage.copyBufferToTextureCmds.push(i);
77145                  }
77146                  this.cmdPackage.cmds.concat(e.cmdPackage.cmds.array);
77147                  this._numDrawCalls += e._numDrawCalls;
77148                  this._numInstances += e._numInstances;
77149                  this._numTris += e._numTris;
77150                }
77151              }
77152              pipelineBarrier(t, e, i, s, n) {}
77153              bindStates() {
77154                const t = this._cmdAllocator.bindStatesCmdPool.alloc(o7);
77155                if (t) {
77156                  t.gpuPipelineState = this._curGPUPipelineState;
77157                  Array.prototype.push.apply(t.gpuDescriptorSets, this._curGPUDescriptorSets);
77158                  Array.prototype.push.apply(t.dynamicOffsets, this._curDynamicOffsets);
77159                  t.gpuInputAssembler = this._curGPUInputAssembler;
77160                  t.dynamicStates.copy(this._curDynamicStates);
77161                  this.cmdPackage.bindStatesCmds.push(t);
77162                  this.cmdPackage.cmds.push(s7.BIND_STATES);
77163                  this._isStateInvalied = !1;
77164                }
77165              }
77166            }
77167            class R7 extends Fr {
77168              constructor(...t) {
77169                super(...t);
77170                this._gpuFramebuffer = null;
77171              }
77172              get gpuFramebuffer() {
77173                return this._gpuFramebuffer;
77174              }
77175              initialize(t) {
77176                this._renderPass = t.renderPass;
77177                this._colorTextures = t.colorTextures || [];
77178                this._depthStencilTexture = t.depthStencilTexture || null;
77179                let e = 0;
77180                const i = [];
77181                for (let s = 0; s < t.colorTextures.length; ++s) {
77182                  const n = t.colorTextures[s];
77183                  if (n) {
77184                    i.push(n.gpuTexture);
77185                    e = n.lodLevel;
77186                  }
77187                }
77188                let s = null;
77189                if (t.depthStencilTexture) {
77190                  s = t.depthStencilTexture.gpuTexture;
77191                  e = t.depthStencilTexture.lodLevel;
77192                }
77193                let n = Number.MAX_SAFE_INTEGER;
77194                let r = Number.MAX_SAFE_INTEGER;
77195                this._gpuFramebuffer = {
77196                  gpuRenderPass: t.renderPass.gpuRenderPass,
77197                  gpuColorTextures: i,
77198                  gpuDepthStencilTexture: s,
77199                  glFramebuffer: null,
77200                  isOffscreen: !0,
77201                  get width() {
77202                    return this.isOffscreen ? n : this.gpuColorTextures[0].width;
77203                  },
77204                  set width(t) {
77205                    n = t;
77206                  },
77207                  get height() {
77208                    return this.isOffscreen ? r : this.gpuColorTextures[0].height;
77209                  },
77210                  set height(t) {
77211                    r = t;
77212                  },
77213                  lodLevel: e
77214                };
77215                !function(t, e) {
77216                  for (let t = 0; t < e.gpuColorTextures.length; ++t) if (e.gpuColorTextures[t].isSwapchainTexture) {
77217                    e.isOffscreen = !1;
77218                    return;
77219                  }
77220                  const {gl: i} = t;
77221                  const s = [];
77222                  const n = i.createFramebuffer();
77223                  if (n) {
77224                    e.glFramebuffer = n;
77225                    t.stateCache.glFramebuffer !== e.glFramebuffer && i.bindFramebuffer(i.FRAMEBUFFER, e.glFramebuffer);
77226                    for (let t = 0; t < e.gpuColorTextures.length; ++t) {
77227                      const n = e.gpuColorTextures[t];
77228                      if (n) {
77229                        n.glTexture ? i.framebufferTexture2D(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0 + t, n.glTarget, n.glTexture, 0) : i.framebufferRenderbuffer(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0 + t, i.RENDERBUFFER, n.glRenderbuffer);
77230                        s.push(i.COLOR_ATTACHMENT0 + t);
77231                        e.width = Math.min(e.width, n.width);
77232                        e.height = Math.min(e.height, n.height);
77233                      }
77234                    }
77235                    const r = e.gpuDepthStencilTexture;
77236                    if (r) {
77237                      const t = ur[r.format].hasStencil ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT;
77238                      r.glTexture ? i.framebufferTexture2D(i.FRAMEBUFFER, t, r.glTarget, r.glTexture, 0) : i.framebufferRenderbuffer(i.FRAMEBUFFER, t, i.RENDERBUFFER, r.glRenderbuffer);
77239                      e.width = Math.min(e.width, r.width);
77240                      e.height = Math.min(e.height, r.height);
77241                    }
77242                    t.extensions.WEBGL_draw_buffers && t.extensions.WEBGL_draw_buffers.drawBuffersWEBGL(s);
77243                    const o = i.checkFramebufferStatus(i.FRAMEBUFFER);
77244                    if (o !== i.FRAMEBUFFER_COMPLETE) switch (o) {
77245                     case i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
77246                      console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
77247                      break;
77248
77249                     case i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
77250                      console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
77251                      break;
77252
77253                     case i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
77254                      console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");
77255                      break;
77256
77257                     case i.FRAMEBUFFER_UNSUPPORTED:
77258                      console.error("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED");
77259                    }
77260                    t.stateCache.glFramebuffer !== e.glFramebuffer && i.bindFramebuffer(i.FRAMEBUFFER, t.stateCache.glFramebuffer);
77261                  }
77262                }(W6.instance, this._gpuFramebuffer);
77263              }
77264              destroy() {
77265                if (this._gpuFramebuffer) {
77266                  !function(t, e) {
77267                    if (e.glFramebuffer) {
77268                      t.gl.deleteFramebuffer(e.glFramebuffer);
77269                      if (t.stateCache.glFramebuffer === e.glFramebuffer) {
77270                        t.gl.bindFramebuffer(t.gl.FRAMEBUFFER, null);
77271                        t.stateCache.glFramebuffer = null;
77272                      }
77273                      e.glFramebuffer = null;
77274                    }
77275                  }(W6.instance, this._gpuFramebuffer);
77276                  this._gpuFramebuffer = null;
77277                }
77278              }
77279            }
77280            class I7 extends Gr {
77281              constructor(...t) {
77282                super(...t);
77283                this._gpuInputAssembler = null;
77284              }
77285              get gpuInputAssembler() {
77286                return this._gpuInputAssembler;
77287              }
77288              initialize(t) {
77289                if (0 === t.vertexBuffers.length) {
77290                  console.error("InputAssemblerInfo.vertexBuffers is null.");
77291                  return;
77292                }
77293                this._attributes = t.attributes;
77294                this._attributesHash = this.computeAttributesHash();
77295                this._vertexBuffers = t.vertexBuffers;
77296                if (t.indexBuffer) {
77297                  this._indexBuffer = t.indexBuffer;
77298                  this._drawInfo.indexCount = this._indexBuffer.size / this._indexBuffer.stride;
77299                  this._drawInfo.firstIndex = 0;
77300                } else {
77301                  const t = this._vertexBuffers[0];
77302                  this._drawInfo.vertexCount = t.size / t.stride;
77303                  this._drawInfo.firstVertex = 0;
77304                  this._drawInfo.vertexOffset = 0;
77305                }
77306                this._drawInfo.instanceCount = 0;
77307                this._drawInfo.firstInstance = 0;
77308                this._indirectBuffer = t.indirectBuffer || null;
77309                const e = new Array(t.vertexBuffers.length);
77310                for (let i = 0; i < t.vertexBuffers.length; ++i) {
77311                  const s = t.vertexBuffers[i];
77312                  s.gpuBuffer && (e[i] = s.gpuBuffer);
77313                }
77314                let i = null;
77315                let s = 0;
77316                if (t.indexBuffer) {
77317                  i = t.indexBuffer.gpuBuffer;
77318                  if (i) switch (i.stride) {
77319                   case 1:
77320                    s = 5121;
77321                    break;
77322
77323                   case 2:
77324                    s = 5123;
77325                    break;
77326
77327                   case 4:
77328                    s = 5125;
77329                    break;
77330
77331                   default:
77332                    console.error("Error index buffer stride.");
77333                  }
77334                }
77335                let n = null;
77336                t.indirectBuffer && (n = t.indirectBuffer.gpuBuffer);
77337                this._gpuInputAssembler = {
77338                  attributes: t.attributes,
77339                  gpuVertexBuffers: e,
77340                  gpuIndexBuffer: i,
77341                  gpuIndirectBuffer: n,
77342                  glAttribs: [],
77343                  glIndexType: s,
77344                  glVAOs: new Map
77345                };
77346                !function(t, e) {
77347                  const {gl: i} = t;
77348                  e.glAttribs = new Array(e.attributes.length);
77349                  const s = [ 0, 0, 0, 0, 0, 0, 0, 0 ];
77350                  for (let t = 0; t < e.attributes.length; ++t) {
77351                    const n = e.attributes[t];
77352                    const r = void 0 !== n.stream ? n.stream : 0;
77353                    const o = e.gpuVertexBuffers[r];
77354                    const a = Y6(n.format, i);
77355                    const {size: l} = ur[n.format];
77356                    e.glAttribs[t] = {
77357                      name: n.name,
77358                      glBuffer: o.glBuffer,
77359                      glType: a,
77360                      size: l,
77361                      count: ur[n.format].count,
77362                      stride: o.stride,
77363                      componentCount: Q6(a, i),
77364                      isNormalized: void 0 !== n.isNormalized && n.isNormalized,
77365                      isInstanced: void 0 !== n.isInstanced && n.isInstanced,
77366                      offset: s[r]
77367                    };
77368                    s[r] += l;
77369                  }
77370                }(W6.instance, this._gpuInputAssembler);
77371              }
77372              destroy() {
77373                const t = W6.instance;
77374                this._gpuInputAssembler && t.extensions.useVAO && function(t, e) {
77375                  const i = e.glVAOs.values();
77376                  let s = i.next();
77377                  const n = t.extensions.OES_vertex_array_object;
77378                  let r = t.stateCache.glVAO;
77379                  for (;!s.done; ) {
77380                    n.deleteVertexArrayOES(s.value);
77381                    if (r === s.value) {
77382                      n.bindVertexArrayOES(null);
77383                      r = null;
77384                    }
77385                    s = i.next();
77386                  }
77387                  t.stateCache.glVAO = r;
77388                  e.glVAOs.clear();
77389                }(t, this._gpuInputAssembler);
77390                this._gpuInputAssembler = null;
77391              }
77392            }
77393            class M7 extends zr {
77394              constructor(...t) {
77395                super(...t);
77396                this._gpuDescriptorSetLayout = null;
77397              }
77398              get gpuDescriptorSetLayout() {
77399                return this._gpuDescriptorSetLayout;
77400              }
77401              initialize(t) {
77402                Array.prototype.push.apply(this._bindings, t.bindings);
77403                let e = 0;
77404                let i = -1;
77405                const s = [];
77406                for (let t = 0; t < this._bindings.length; t++) {
77407                  const n = this._bindings[t];
77408                  s.push(e);
77409                  e += n.count;
77410                  n.binding > i && (i = n.binding);
77411                }
77412                this._bindingIndices = Array(i + 1).fill(-1);
77413                const n = this._descriptorIndices = Array(i + 1).fill(-1);
77414                for (let t = 0; t < this._bindings.length; t++) {
77415                  const e = this._bindings[t];
77416                  this._bindingIndices[e.binding] = t;
77417                  n[e.binding] = s[t];
77418                }
77419                const r = [];
77420                for (let t = 0; t < this._bindings.length; t++) {
77421                  const e = this._bindings[t];
77422                  if (e.descriptorType & pr) for (let t = 0; t < e.count; t++) r.push(e.binding);
77423                }
77424                this._gpuDescriptorSetLayout = {
77425                  bindings: this._bindings,
77426                  dynamicBindings: r,
77427                  descriptorIndices: n,
77428                  descriptorCount: e
77429                };
77430              }
77431              destroy() {
77432                this._bindings.length = 0;
77433              }
77434            }
77435            class B7 extends Hr {
77436              constructor(...t) {
77437                super(...t);
77438                this._gpuPipelineLayout = null;
77439              }
77440              get gpuPipelineLayout() {
77441                return this._gpuPipelineLayout;
77442              }
77443              initialize(t) {
77444                Array.prototype.push.apply(this._setLayouts, t.setLayouts);
77445                const e = [];
77446                const i = [];
77447                let s = 0;
77448                const n = [];
77449                for (let t = 0; t < this._setLayouts.length; t++) {
77450                  const r = this._setLayouts[t];
77451                  const o = r.gpuDescriptorSetLayout.dynamicBindings;
77452                  const a = Array(r.bindingIndices.length).fill(-1);
77453                  for (let t = 0; t < o.length; t++) {
77454                    const e = o[t];
77455                    a[e] < 0 && (a[e] = s + t);
77456                  }
77457                  i.push(r.gpuDescriptorSetLayout);
77458                  e.push(a);
77459                  n.push(s);
77460                  s += o.length;
77461                }
77462                this._gpuPipelineLayout = {
77463                  gpuSetLayouts: i,
77464                  dynamicOffsetIndices: e,
77465                  dynamicOffsetCount: s,
77466                  dynamicOffsetOffsets: n
77467                };
77468              }
77469              destroy() {
77470                this._setLayouts.length = 0;
77471              }
77472            }
77473            const D7 = [ 0, 1, 3, 2, 0, 0, 0, 4, 5, 6, 0, 0, 0, 0 ];
77474            class P7 extends Mr {
77475              constructor(...t) {
77476                super(...t);
77477                this._gpuPipelineState = null;
77478              }
77479              get gpuPipelineState() {
77480                return this._gpuPipelineState;
77481              }
77482              initialize(t) {
77483                this._primitive = t.primitive;
77484                this._shader = t.shader;
77485                this._pipelineLayout = t.pipelineLayout;
77486                const e = this._bs;
77487                if (t.blendState) {
77488                  const i = t.blendState;
77489                  const {targets: s} = i;
77490                  s && s.forEach(((t, i) => {
77491                    e.setTarget(i, t);
77492                  }));
77493                  void 0 !== i.isA2C && (e.isA2C = i.isA2C);
77494                  void 0 !== i.isIndepend && (e.isIndepend = i.isIndepend);
77495                  void 0 !== i.blendColor && (e.blendColor = i.blendColor);
77496                }
77497                Object.assign(this._rs, t.rasterizerState);
77498                Object.assign(this._dss, t.depthStencilState);
77499                this._is = t.inputState;
77500                this._renderPass = t.renderPass;
77501                this._dynamicStates = t.dynamicStates;
77502                const i = [];
77503                for (let t = 0; t < 31; t++) this._dynamicStates & 1 << t && i.push(1 << t);
77504                this._gpuPipelineState = {
77505                  glPrimitive: D7[t.primitive],
77506                  gpuShader: t.shader.gpuShader,
77507                  gpuPipelineLayout: t.pipelineLayout.gpuPipelineLayout,
77508                  rs: t.rasterizerState,
77509                  dss: t.depthStencilState,
77510                  bs: t.blendState,
77511                  gpuRenderPass: t.renderPass.gpuRenderPass,
77512                  dynamicStates: i
77513                };
77514              }
77515              destroy() {
77516                this._gpuPipelineState = null;
77517              }
77518            }
77519            class O7 extends w7 {
77520              beginRenderPass(t, e, i, s, n, r) {
77521                m7(W6.instance, t.gpuRenderPass, e.gpuFramebuffer, i, s, n, r);
77522                this._isInRenderPass = !0;
77523              }
77524              draw(t) {
77525                if (this._isInRenderPass) {
77526                  this._isStateInvalied && this.bindStates();
77527                  const e = "drawInfo" in t ? t.drawInfo : t;
77528                  g7(W6.instance, e);
77529                  ++this._numDrawCalls;
77530                  this._numInstances += e.instanceCount;
77531                  const i = e.indexCount || e.vertexCount;
77532                  if (this._curGPUPipelineState) {
77533                    switch (this._curGPUPipelineState.glPrimitive) {
77534                     case 4:
77535                      this._numTris += i / 3 * Math.max(e.instanceCount, 1);
77536                      break;
77537
77538                     case 5:
77539                     case 6:
77540                      this._numTris += (i - 2) * Math.max(e.instanceCount, 1);
77541                    }
77542                  }
77543                } else console.error("Command 'draw' must be recorded inside a render pass.");
77544              }
77545              setViewport(t) {
77546                const {stateCache: e, gl: i} = W6.instance;
77547                if (e.viewport.left !== t.left || e.viewport.top !== t.top || e.viewport.width !== t.width || e.viewport.height !== t.height) {
77548                  i.viewport(t.left, t.top, t.width, t.height);
77549                  e.viewport.left = t.left;
77550                  e.viewport.top = t.top;
77551                  e.viewport.width = t.width;
77552                  e.viewport.height = t.height;
77553                }
77554              }
77555              setScissor(t) {
77556                const {stateCache: e, gl: i} = W6.instance;
77557                if (e.scissorRect.x !== t.x || e.scissorRect.y !== t.y || e.scissorRect.width !== t.width || e.scissorRect.height !== t.height) {
77558                  i.scissor(t.x, t.y, t.width, t.height);
77559                  e.scissorRect.x = t.x;
77560                  e.scissorRect.y = t.y;
77561                  e.scissorRect.width = t.width;
77562                  e.scissorRect.height = t.height;
77563                }
77564              }
77565              updateBuffer(t, e, i) {
77566                if (this._isInRenderPass) console.error("Command 'updateBuffer' must be recorded outside a render pass."); else {
77567                  const s = t.gpuBuffer;
77568                  if (s) {
77569                    let n;
77570                    n = void 0 !== i ? i : t.usage & Ts.INDIRECT ? 0 : e.byteLength;
77571                    u7(W6.instance, s, e, 0, n);
77572                  }
77573                }
77574              }
77575              copyBuffersToTexture(t, e, i) {
77576                if (this._isInRenderPass) console.error("Command 'copyBufferToTexture' must be recorded outside a render pass."); else {
77577                  const s = e.gpuTexture;
77578                  s && T7(W6.instance, t, s, i);
77579                }
77580              }
77581              execute(t, e) {
77582                for (let i = 0; i < e; ++i) {
77583                  const e = t[i];
77584                  b7(W6.instance, e.cmdPackage);
77585                  this._numDrawCalls += e._numDrawCalls;
77586                  this._numInstances += e._numInstances;
77587                  this._numTris += e._numTris;
77588                }
77589              }
77590              bindStates() {
77591                f7(W6.instance, this._curGPUPipelineState, this._curGPUInputAssembler, this._curGPUDescriptorSets, this._curDynamicOffsets, this._curDynamicStates);
77592                this._isStateInvalied = !1;
77593              }
77594            }
77595            class N7 extends jr {
77596              constructor(...t) {
77597                super(...t);
77598                this.numDrawCalls = 0;
77599                this.numInstances = 0;
77600                this.numTris = 0;
77601              }
77602              initialize(t) {
77603                this._type = t.type;
77604              }
77605              destroy() {}
77606              submit(t) {
77607                const e = t.length;
77608                for (let i = 0; i < e; i++) {
77609                  const e = t[i];
77610                  this.numDrawCalls += e.numDrawCalls;
77611                  this.numInstances += e.numInstances;
77612                  this.numTris += e.numTris;
77613                }
77614              }
77615              clear() {
77616                this.numDrawCalls = 0;
77617                this.numInstances = 0;
77618                this.numTris = 0;
77619              }
77620            }
77621            class L7 extends Xr {
77622              constructor(...t) {
77623                super(...t);
77624                this._gpuRenderPass = null;
77625              }
77626              get gpuRenderPass() {
77627                return this._gpuRenderPass;
77628              }
77629              initialize(t) {
77630                this._colorInfos = t.colorAttachments;
77631                this._depthStencilInfo = t.depthStencilAttachment;
77632                this._subpasses = t.subpasses;
77633                this._gpuRenderPass = {
77634                  colorAttachments: this._colorInfos,
77635                  depthStencilAttachment: this._depthStencilInfo
77636                };
77637                this._hash = this.computeHash();
77638              }
77639              destroy() {
77640                this._gpuRenderPass = null;
77641              }
77642            }
77643            const F7 = [ 10497, 33648, 33071, 33071 ];
77644            class V7 extends qr {
77645              get gpuSampler() {
77646                return this._gpuSampler;
77647              }
77648              constructor(t, e) {
77649                super(t, e);
77650                this._gpuSampler = null;
77651                let i = 0;
77652                let s = 0;
77653                const n = this._info.minFilter;
77654                const r = this._info.magFilter;
77655                const o = this._info.mipFilter;
77656                i = n === Ds.LINEAR || n === Ds.ANISOTROPIC ? o === Ds.LINEAR || o === Ds.ANISOTROPIC ? 9987 : o === Ds.POINT ? 9985 : 9729 : o === Ds.LINEAR || o === Ds.ANISOTROPIC ? 9986 : o === Ds.POINT ? 9984 : 9728;
77657                s = r === Ds.LINEAR || r === Ds.ANISOTROPIC ? 9729 : 9728;
77658                const a = F7[this._info.addressU];
77659                const l = F7[this._info.addressV];
77660                const h = F7[this._info.addressW];
77661                this._gpuSampler = {
77662                  glMinFilter: i,
77663                  glMagFilter: s,
77664                  glWrapS: a,
77665                  glWrapT: l,
77666                  glWrapR: h
77667                };
77668              }
77669            }
77670            class k7 extends Wr {
77671              constructor(...t) {
77672                super(...t);
77673                this._gpuShader = null;
77674              }
77675              get gpuShader() {
77676                null === this._gpuShader.glProgram && function(t, e) {
77677                  const {gl: i} = t;
77678                  for (let t = 0; t < e.gpuStages.length; t++) {
77679                    const s = e.gpuStages[t];
77680                    let n = 0;
77681                    let r = "";
77682                    let o = 1;
77683                    switch (s.type) {
77684                     case ks.VERTEX:
77685                      r = "VertexShader";
77686                      n = i.VERTEX_SHADER;
77687                      break;
77688
77689                     case ks.FRAGMENT:
77690                      r = "FragmentShader";
77691                      n = i.FRAGMENT_SHADER;
77692                      break;
77693
77694                     default:
77695                      console.error("Unsupported ShaderType.");
77696                      return;
77697                    }
77698                    const a = i.createShader(n);
77699                    if (a) {
77700                      s.glShader = a;
77701                      i.shaderSource(s.glShader, s.source);
77702                      i.compileShader(s.glShader);
77703                      if (!i.getShaderParameter(s.glShader, i.COMPILE_STATUS)) {
77704                        console.error(`${r} in '${e.name}' compilation failed.`);
77705                        console.error("Shader source dump:", s.source.replace(/^|\n/g, (() => `\n${o++} `)));
77706                        console.error(i.getShaderInfoLog(s.glShader));
77707                        for (let s = 0; s < e.gpuStages.length; s++) {
77708                          const s = e.gpuStages[t];
77709                          if (s.glShader) {
77710                            i.deleteShader(s.glShader);
77711                            s.glShader = null;
77712                          }
77713                        }
77714                        return;
77715                      }
77716                    }
77717                  }
77718                  const s = i.createProgram();
77719                  if (!s) return;
77720                  e.glProgram = s;
77721                  for (let t = 0; t < e.gpuStages.length; t++) {
77722                    const s = e.gpuStages[t];
77723                    i.attachShader(e.glProgram, s.glShader);
77724                  }
77725                  i.linkProgram(e.glProgram);
77726                  if (t.extensions.destroyShadersImmediately) for (let t = 0; t < e.gpuStages.length; t++) {
77727                    const s = e.gpuStages[t];
77728                    if (s.glShader) {
77729                      i.detachShader(e.glProgram, s.glShader);
77730                      i.deleteShader(s.glShader);
77731                      s.glShader = null;
77732                    }
77733                  }
77734                  if (!i.getProgramParameter(e.glProgram, i.LINK_STATUS)) {
77735                    console.error(`Failed to link shader '${e.name}'.`);
77736                    console.error(i.getProgramInfoLog(e.glProgram));
77737                    return;
77738                  }
77739                  R(`Shader '${e.name}' compilation succeeded.`);
77740                  const n = i.getProgramParameter(e.glProgram, i.ACTIVE_ATTRIBUTES);
77741                  e.glInputs = new Array(n);
77742                  for (let t = 0; t < n; ++t) {
77743                    const s = i.getActiveAttrib(e.glProgram, t);
77744                    if (s) {
77745                      let n;
77746                      const r = s.name.indexOf("[");
77747                      n = -1 !== r ? s.name.substr(0, r) : s.name;
77748                      const o = i.getAttribLocation(e.glProgram, n);
77749                      const a = J6(s.type, i);
77750                      const l = Z6(s.type, i);
77751                      e.glInputs[t] = {
77752                        binding: o,
77753                        name: n,
77754                        type: a,
77755                        stride: l,
77756                        count: s.size,
77757                        size: l * s.size,
77758                        glType: s.type,
77759                        glLoc: o
77760                      };
77761                    }
77762                  }
77763                  if (e.blocks.length > 0) {
77764                    e.glBlocks = new Array(e.blocks.length);
77765                    for (let t = 0; t < e.blocks.length; ++t) {
77766                      const s = e.blocks[t];
77767                      const n = {
77768                        set: s.set,
77769                        binding: s.binding,
77770                        name: s.name,
77771                        size: 0,
77772                        glUniforms: new Array(s.members.length),
77773                        glActiveUniforms: []
77774                      };
77775                      e.glBlocks[t] = n;
77776                      for (let t = 0; t < s.members.length; ++t) {
77777                        const e = s.members[t];
77778                        const r = q6(e.type, i);
77779                        const o = Z6(r, i);
77780                        const a = o * e.count;
77781                        n.glUniforms[t] = {
77782                          binding: -1,
77783                          name: e.name,
77784                          type: e.type,
77785                          stride: o,
77786                          count: e.count,
77787                          size: a,
77788                          offset: 0,
77789                          glType: r,
77790                          glLoc: null,
77791                          array: null
77792                        };
77793                      }
77794                    }
77795                  }
77796                  for (let t = 0; t < e.subpassInputs.length; ++t) {
77797                    const i = e.subpassInputs[t];
77798                    e.samplerTextures.push(new Bn(i.set, i.binding, i.name, As.SAMPLER2D, i.count));
77799                  }
77800                  if (e.samplerTextures.length > 0) {
77801                    e.glSamplerTextures = new Array(e.samplerTextures.length);
77802                    for (let t = 0; t < e.samplerTextures.length; ++t) {
77803                      const s = e.samplerTextures[t];
77804                      e.glSamplerTextures[t] = {
77805                        set: s.set,
77806                        binding: s.binding,
77807                        name: s.name,
77808                        type: s.type,
77809                        count: s.count,
77810                        units: [],
77811                        glUnits: null,
77812                        glType: q6(s.type, i),
77813                        glLoc: null
77814                      };
77815                    }
77816                  }
77817                  const r = i.getProgramParameter(e.glProgram, i.ACTIVE_UNIFORMS);
77818                  for (let s = 0; s < r; ++s) {
77819                    const n = i.getActiveUniform(e.glProgram, s);
77820                    if (n && n.type !== i.SAMPLER_2D && n.type !== i.SAMPLER_CUBE) {
77821                      const s = i.getUniformLocation(e.glProgram, n.name);
77822                      if (t.extensions.isLocationActive(s)) {
77823                        let t;
77824                        const i = n.name.indexOf("[");
77825                        t = -1 !== i ? n.name.substr(0, i) : n.name;
77826                        for (let i = 0; i < e.glBlocks.length; i++) {
77827                          const r = e.glBlocks[i];
77828                          for (let e = 0; e < r.glUniforms.length; e++) {
77829                            const i = r.glUniforms[e];
77830                            if (i.name === t) {
77831                              i.glLoc = s;
77832                              i.count = n.size;
77833                              i.size = i.stride * i.count;
77834                              i.array = new (K6(i.type))(i.size / 4);
77835                              r.glActiveUniforms.push(i);
77836                              break;
77837                            }
77838                          }
77839                        }
77840                      }
77841                    }
77842                  }
77843                  for (let t = 0; t < e.glBlocks.length; t++) {
77844                    const i = e.glBlocks[t];
77845                    for (let t = 0; t < i.glUniforms.length; t++) {
77846                      const e = i.glUniforms[t];
77847                      e.offset = i.size / 4;
77848                      i.size += e.size;
77849                    }
77850                  }
77851                  const o = [];
77852                  const a = [];
77853                  const {bindingMappings: l} = t;
77854                  const {texUnitCacheMap: h} = t.stateCache;
77855                  let c = 0;
77856                  for (let t = 0; t < e.blocks.length; ++t) e.blocks[t].set === l.flexibleSet && c++;
77857                  let u = 0;
77858                  for (let s = 0; s < e.samplerTextures.length; ++s) {
77859                    const n = e.samplerTextures[s];
77860                    const r = i.getUniformLocation(e.glProgram, n.name);
77861                    if (t.extensions.isLocationActive(r)) {
77862                      o.push(e.glSamplerTextures[s]);
77863                      a.push(r);
77864                    }
77865                    if (void 0 === h[n.name]) {
77866                      let e = n.binding + l.samplerTextureOffsets[n.set] + u;
77867                      n.set === l.flexibleSet && (e -= c);
77868                      h[n.name] = e % t.capabilities.maxTextureUnits;
77869                      u += n.count - 1;
77870                    }
77871                  }
77872                  if (o.length) {
77873                    const s = [];
77874                    for (let e = 0; e < o.length; ++e) {
77875                      const i = o[e];
77876                      let n = h[i.name];
77877                      if (void 0 !== n) {
77878                        i.glLoc = a[e];
77879                        for (let e = 0; e < i.count; ++e) {
77880                          for (;s[n]; ) n = (n + 1) % t.capabilities.maxTextureUnits;
77881                          i.units.push(n);
77882                          s[n] = !0;
77883                        }
77884                      }
77885                    }
77886                    let n = 0;
77887                    for (let e = 0; e < o.length; ++e) {
77888                      const i = o[e];
77889                      if (!t.extensions.isLocationActive(i.glLoc)) {
77890                        i.glLoc = a[e];
77891                        for (let e = 0; e < i.count; ++e) {
77892                          for (;s[n]; ) n = (n + 1) % t.capabilities.maxTextureUnits;
77893                          void 0 === h[i.name] && (h[i.name] = n);
77894                          i.units.push(n);
77895                          s[n] = !0;
77896                        }
77897                      }
77898                    }
77899                    t.stateCache.glProgram !== e.glProgram && i.useProgram(e.glProgram);
77900                    for (let t = 0; t < o.length; t++) {
77901                      const e = o[t];
77902                      e.glUnits = new Int32Array(e.units);
77903                      i.uniform1iv(e.glLoc, e.glUnits);
77904                    }
77905                    t.stateCache.glProgram !== e.glProgram && i.useProgram(t.stateCache.glProgram);
77906                  }
77907                  for (let t = 0; t < e.glBlocks.length; ) if (e.glBlocks[t].glActiveUniforms.length) t++; else {
77908                    e.glBlocks[t] = e.glBlocks[e.glBlocks.length - 1];
77909                    e.glBlocks.length--;
77910                  }
77911                  e.glSamplerTextures = o;
77912                }(W6.instance, this._gpuShader);
77913                return this._gpuShader;
77914              }
77915              initialize(t) {
77916                this._name = t.name;
77917                this._stages = t.stages;
77918                this._attributes = t.attributes;
77919                this._blocks = t.blocks;
77920                this._samplers = t.samplers;
77921                this._gpuShader = {
77922                  name: t.name,
77923                  blocks: t.blocks.slice(),
77924                  samplerTextures: t.samplerTextures.slice(),
77925                  subpassInputs: t.subpassInputs.slice(),
77926                  gpuStages: new Array(t.stages.length),
77927                  glProgram: null,
77928                  glInputs: [],
77929                  glUniforms: [],
77930                  glBlocks: [],
77931                  glSamplerTextures: []
77932                };
77933                for (let e = 0; e < t.stages.length; ++e) {
77934                  const i = t.stages[e];
77935                  this._gpuShader.gpuStages[e] = {
77936                    type: i.stage,
77937                    source: i.source,
77938                    glShader: null
77939                  };
77940                }
77941              }
77942              destroy() {
77943                if (this._gpuShader) {
77944                  !function(t, e) {
77945                    if (e.glProgram) {
77946                      const {gl: i} = t;
77947                      if (!t.extensions.destroyShadersImmediately) for (let t = 0; t < e.gpuStages.length; t++) {
77948                        const s = e.gpuStages[t];
77949                        if (s.glShader) {
77950                          i.detachShader(e.glProgram, s.glShader);
77951                          i.deleteShader(s.glShader);
77952                          s.glShader = null;
77953                        }
77954                      }
77955                      i.deleteProgram(e.glProgram);
77956                      if (t.stateCache.glProgram === e.glProgram) {
77957                        t.gl.useProgram(null);
77958                        t.stateCache.glProgram = null;
77959                      }
77960                      e.glProgram = null;
77961                    }
77962                  }(W6.instance, this._gpuShader);
77963                  this._gpuShader = null;
77964                }
77965              }
77966            }
77967            class U7 {
77968              constructor() {
77969                this.glArrayBuffer = null;
77970                this.glElementArrayBuffer = null;
77971                this.glVAO = null;
77972                this.texUnit = 0;
77973                this.glTexUnits = [];
77974                this.glRenderbuffer = null;
77975                this.glFramebuffer = null;
77976                this.viewport = new fn;
77977                this.scissorRect = new hn(0, 0, 0, 0);
77978                this.rs = new Cr;
77979                this.dss = new wr;
77980                this.bs = new Ir;
77981                this.glProgram = null;
77982                this.glEnabledAttribLocs = [];
77983                this.glCurrentAttribLocs = [];
77984                this.texUnitCacheMap = {};
77985              }
77986              initialize(t, e) {
77987                for (let e = 0; e < t; ++e) this.glTexUnits.push({
77988                  glTexture: null
77989                });
77990                this.glEnabledAttribLocs.length = e;
77991                this.glEnabledAttribLocs.fill(!1);
77992                this.glCurrentAttribLocs.length = e;
77993                this.glCurrentAttribLocs.fill(!1);
77994              }
77995            }
77996            class G7 extends Yr {
77997              constructor(...t) {
77998                super(...t);
77999                this._gpuTexture = null;
78000                this._lodLevel = 0;
78001              }
78002              get gpuTexture() {
78003                return this._gpuTexture;
78004              }
78005              get lodLevel() {
78006                return this._lodLevel;
78007              }
78008              initialize(t, e) {
78009                let i = t;
78010                const s = t;
78011                if ("texture" in t) {
78012                  i = s.texture.info;
78013                  this._isTextureView = !0;
78014                }
78015                this._info.copy(i);
78016                this._isPowerOf2 = fr(this._info.width) && fr(this._info.height);
78017                this._size = yr(this._info.format, this.width, this.height, this.depth, this._info.levelCount) * this._info.layerCount;
78018                if (this._isTextureView) {
78019                  this._viewInfo.copy(s);
78020                  this._lodLevel = s.baseLevel;
78021                  this._gpuTexture = s.texture._gpuTexture;
78022                } else {
78023                  this._gpuTexture = {
78024                    type: i.type,
78025                    format: i.format,
78026                    usage: i.usage,
78027                    width: i.width,
78028                    height: i.height,
78029                    depth: i.depth,
78030                    size: this._size,
78031                    arrayLayer: i.layerCount,
78032                    mipLevel: i.levelCount,
78033                    samples: i.samples,
78034                    flags: i.flags,
78035                    isPowerOf2: this._isPowerOf2,
78036                    glTarget: 0,
78037                    glInternalFmt: 0,
78038                    glFormat: 0,
78039                    glType: 0,
78040                    glUsage: 0,
78041                    glTexture: null,
78042                    glRenderbuffer: null,
78043                    glWrapS: 0,
78044                    glWrapT: 0,
78045                    glMinFilter: 0,
78046                    glMagFilter: 0,
78047                    isSwapchainTexture: e || !1
78048                  };
78049                  _7(W6.instance, this._gpuTexture);
78050                  W6.instance.memoryStatus.textureSize += this._size;
78051                  this._viewInfo.texture = this;
78052                  this._viewInfo.type = t.type;
78053                  this._viewInfo.format = t.format;
78054                  this._viewInfo.baseLevel = 0;
78055                  this._viewInfo.levelCount = t.levelCount;
78056                  this._viewInfo.baseLayer = 0;
78057                  this._viewInfo.layerCount = t.layerCount;
78058                }
78059              }
78060              destroy() {
78061                if (!this._isTextureView && this._gpuTexture) {
78062                  !function(t, e) {
78063                    const {gl: i} = t;
78064                    if (e.glTexture) {
78065                      const s = t.stateCache.glTexUnits;
78066                      let n = t.stateCache.texUnit;
78067                      i.deleteTexture(e.glTexture);
78068                      for (let t = 0; t < s.length; t++) if (s[t].glTexture === e.glTexture) {
78069                        i.activeTexture(i.TEXTURE0 + t);
78070                        n = t;
78071                        i.bindTexture(e.glTarget, null);
78072                        s[t].glTexture = null;
78073                      }
78074                      t.stateCache.texUnit = n;
78075                      e.glTexture = null;
78076                    }
78077                    if (e.glRenderbuffer) {
78078                      let s = t.stateCache.glRenderbuffer;
78079                      i.deleteRenderbuffer(e.glRenderbuffer);
78080                      if (s === e.glRenderbuffer) {
78081                        i.bindRenderbuffer(i.RENDERBUFFER, null);
78082                        s = null;
78083                      }
78084                      e.glRenderbuffer = null;
78085                    }
78086                  }(W6.instance, this._gpuTexture);
78087                  W6.instance.memoryStatus.textureSize -= this._size;
78088                  this._gpuTexture = null;
78089                }
78090              }
78091              resize(t, e) {
78092                if (this._info.width === t && this._info.height === e) return;
78093                this._info.levelCount === G7.getLevelCount(this._info.width, this._info.height) ? this._info.levelCount = G7.getLevelCount(t, e) : this._info.levelCount > 1 && (this._info.levelCount = Math.min(this._info.levelCount, G7.getLevelCount(t, e)));
78094                const i = this._size;
78095                this._info.width = t;
78096                this._info.height = e;
78097                this._size = yr(this._info.format, this.width, this.height, this.depth, this._info.levelCount) * this._info.layerCount;
78098                if (!this._isTextureView && this._gpuTexture) {
78099                  this._gpuTexture.width = t;
78100                  this._gpuTexture.height = e;
78101                  this._gpuTexture.size = this._size;
78102                  !function(t, e) {
78103                    if (!e.size) return;
78104                    const {gl: i} = t;
78105                    let s = e.width;
78106                    let n = e.height;
78107                    switch (e.type) {
78108                     case xs.TEX2D:
78109                      {
78110                        e.glTarget = i.TEXTURE_2D;
78111                        const r = Math.max(s, n);
78112                        r > t.capabilities.maxTextureSize && F(9100, r, t.capabilities.maxTextureSize);
78113                        if (e.glRenderbuffer) {
78114                          if (t.stateCache.glRenderbuffer !== e.glRenderbuffer) {
78115                            i.bindRenderbuffer(i.RENDERBUFFER, e.glRenderbuffer);
78116                            t.stateCache.glRenderbuffer = e.glRenderbuffer;
78117                          }
78118                          i.renderbufferStorage(i.RENDERBUFFER, e.glInternalFmt, s, n);
78119                        } else if (e.glTexture) {
78120                          const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
78121                          if (r.glTexture !== e.glTexture) {
78122                            i.bindTexture(i.TEXTURE_2D, e.glTexture);
78123                            r.glTexture = e.glTexture;
78124                          }
78125                          if (ur[e.format].isCompressed) for (let t = 0; t < e.mipLevel; ++t) {
78126                            const r = gr(e.format, s, n, 1);
78127                            const o = new Uint8Array(r);
78128                            i.compressedTexImage2D(i.TEXTURE_2D, t, e.glInternalFmt, s, n, 0, o);
78129                            s = Math.max(1, s >> 1);
78130                            n = Math.max(1, n >> 1);
78131                          } else for (let t = 0; t < e.mipLevel; ++t) {
78132                            i.texImage2D(i.TEXTURE_2D, t, e.glInternalFmt, s, n, 0, e.glFormat, e.glType, null);
78133                            s = Math.max(1, s >> 1);
78134                            n = Math.max(1, n >> 1);
78135                          }
78136                        }
78137                        break;
78138                      }
78139
78140                     case xs.CUBE:
78141                      {
78142                        e.glTarget = i.TEXTURE_CUBE_MAP;
78143                        const r = Math.max(s, n);
78144                        r > t.capabilities.maxCubeMapTextureSize && F(9100, r, t.capabilities.maxTextureSize);
78145                        const o = t.stateCache.glTexUnits[t.stateCache.texUnit];
78146                        if (o.glTexture !== e.glTexture) {
78147                          i.bindTexture(i.TEXTURE_CUBE_MAP, e.glTexture);
78148                          o.glTexture = e.glTexture;
78149                        }
78150                        if (ur[e.format].isCompressed) for (let t = 0; t < 6; ++t) {
78151                          s = e.width;
78152                          n = e.height;
78153                          for (let r = 0; r < e.mipLevel; ++r) {
78154                            const o = gr(e.format, s, n, 1);
78155                            const a = new Uint8Array(o);
78156                            i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + t, r, e.glInternalFmt, s, n, 0, a);
78157                            s = Math.max(1, s >> 1);
78158                            n = Math.max(1, n >> 1);
78159                          }
78160                        } else for (let t = 0; t < 6; ++t) {
78161                          s = e.width;
78162                          n = e.height;
78163                          for (let r = 0; r < e.mipLevel; ++r) {
78164                            i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + t, r, e.glInternalFmt, s, n, 0, e.glFormat, e.glType, null);
78165                            s = Math.max(1, s >> 1);
78166                            n = Math.max(1, n >> 1);
78167                          }
78168                        }
78169                        break;
78170                      }
78171
78172                     default:
78173                      console.error("Unsupported TextureType, create texture failed.");
78174                      e.type = xs.TEX2D;
78175                      e.glTarget = i.TEXTURE_2D;
78176                    }
78177                  }(W6.instance, this._gpuTexture);
78178                  W6.instance.memoryStatus.textureSize -= i;
78179                  W6.instance.memoryStatus.textureSize += this._size;
78180                }
78181              }
78182              initAsSwapchainTexture(t) {
78183                const e = new xn;
78184                e.format = t.format;
78185                e.usage = ur[t.format].hasDepth ? ws.DEPTH_STENCIL_ATTACHMENT : ws.COLOR_ATTACHMENT;
78186                e.width = t.width;
78187                e.height = t.height;
78188                this.initialize(e, !0);
78189              }
78190            }
78191            const z7 = "webglcontextlost";
78192            function H7(t, e) {
78193              const i = [ "", "WEBKIT_", "MOZ_" ];
78194              for (let s = 0; s < i.length; ++s) {
78195                const n = t.getExtension(i[s] + e);
78196                if (n) return n;
78197              }
78198              return null;
78199            }
78200            function j7(t) {
78201              const e = {
78202                EXT_texture_filter_anisotropic: H7(t, "EXT_texture_filter_anisotropic"),
78203                EXT_blend_minmax: H7(t, "EXT_blend_minmax"),
78204                EXT_frag_depth: H7(t, "EXT_frag_depth"),
78205                EXT_shader_texture_lod: H7(t, "EXT_shader_texture_lod"),
78206                EXT_sRGB: H7(t, "EXT_sRGB"),
78207                OES_vertex_array_object: H7(t, "OES_vertex_array_object"),
78208                EXT_color_buffer_half_float: H7(t, "EXT_color_buffer_half_float"),
78209                WEBGL_color_buffer_float: H7(t, "WEBGL_color_buffer_float"),
78210                WEBGL_compressed_texture_etc1: H7(t, "WEBGL_compressed_texture_etc1"),
78211                WEBGL_compressed_texture_etc: H7(t, "WEBGL_compressed_texture_etc"),
78212                WEBGL_compressed_texture_pvrtc: H7(t, "WEBGL_compressed_texture_pvrtc"),
78213                WEBGL_compressed_texture_s3tc: H7(t, "WEBGL_compressed_texture_s3tc"),
78214                WEBGL_compressed_texture_s3tc_srgb: H7(t, "WEBGL_compressed_texture_s3tc_srgb"),
78215                WEBGL_debug_shaders: H7(t, "WEBGL_debug_shaders"),
78216                WEBGL_draw_buffers: H7(t, "WEBGL_draw_buffers"),
78217                WEBGL_lose_context: H7(t, "WEBGL_lose_context"),
78218                WEBGL_depth_texture: H7(t, "WEBGL_depth_texture"),
78219                OES_texture_half_float: H7(t, "OES_texture_half_float"),
78220                OES_texture_half_float_linear: H7(t, "OES_texture_half_float_linear"),
78221                OES_texture_float: H7(t, "OES_texture_float"),
78222                OES_texture_float_linear: H7(t, "OES_texture_float_linear"),
78223                OES_standard_derivatives: H7(t, "OES_standard_derivatives"),
78224                OES_element_index_uint: H7(t, "OES_element_index_uint"),
78225                ANGLE_instanced_arrays: H7(t, "ANGLE_instanced_arrays"),
78226                WEBGL_debug_renderer_info: H7(t, "WEBGL_debug_renderer_info"),
78227                WEBGL_multi_draw: null,
78228                WEBGL_compressed_texture_astc: null,
78229                destroyShadersImmediately: !0,
78230                noCompressedTexSubImage2D: !1,
78231                isLocationActive: t => !!t,
78232                useVAO: !1
78233              };
78234              Po.os === Ro.IOS && 14 === Po.osMainVersion && Po.isBrowser || (e.WEBGL_compressed_texture_astc = H7(t, "WEBGL_compressed_texture_astc"));
78235              Po.os !== Ro.ABC && Po.os !== Ro.IOS && (e.WEBGL_multi_draw = H7(t, "WEBGL_multi_draw"));
78236              Po.browserType === Co.UC && (e.ANGLE_instanced_arrays = null);
78237              Po.os === Ro.IOS && Po.osMainVersion <= 10 && (e.destroyShadersImmediately = !1);
78238              e.OES_vertex_array_object && (e.useVAO = !0);
78239              return e;
78240            }
78241            class X7 extends Lr {
78242              constructor(...t) {
78243                super(...t);
78244                this.stateCache = new U7;
78245                this.cmdAllocator = new x7;
78246                this.nullTex2D = null;
78247                this.nullTexCube = null;
78248                this._canvas = null;
78249                this._webGLContextLostHandler = null;
78250                this._extensions = null;
78251              }
78252              get extensions() {
78253                return this._extensions;
78254              }
78255              initialize(t) {
78256                this._canvas = t.windowHandle;
78257                this._webGLContextLostHandler = this._onWebGLContextLost.bind(this);
78258                this._canvas.addEventListener(z7, this._onWebGLContextLost);
78259                const e = W6.instance.gl;
78260                this.stateCache.initialize(W6.instance.capabilities.maxTextureUnits, W6.instance.capabilities.maxVertexAttributes);
78261                this._extensions = j7(e);
78262                !function(t) {
78263                  t.activeTexture(t.TEXTURE0);
78264                  t.pixelStorei(t.PACK_ALIGNMENT, 1);
78265                  t.pixelStorei(t.UNPACK_ALIGNMENT, 1);
78266                  t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, !1);
78267                  t.bindFramebuffer(t.FRAMEBUFFER, null);
78268                  t.enable(t.SCISSOR_TEST);
78269                  t.enable(t.CULL_FACE);
78270                  t.cullFace(t.BACK);
78271                  t.frontFace(t.CCW);
78272                  t.disable(t.POLYGON_OFFSET_FILL);
78273                  t.polygonOffset(0, 0);
78274                  t.enable(t.DEPTH_TEST);
78275                  t.depthMask(!0);
78276                  t.depthFunc(t.LESS);
78277                  t.depthRange(0, 1);
78278                  t.stencilFuncSeparate(t.FRONT, t.ALWAYS, 1, 65535);
78279                  t.stencilOpSeparate(t.FRONT, t.KEEP, t.KEEP, t.KEEP);
78280                  t.stencilMaskSeparate(t.FRONT, 65535);
78281                  t.stencilFuncSeparate(t.BACK, t.ALWAYS, 1, 65535);
78282                  t.stencilOpSeparate(t.BACK, t.KEEP, t.KEEP, t.KEEP);
78283                  t.stencilMaskSeparate(t.BACK, 65535);
78284                  t.disable(t.STENCIL_TEST);
78285                  t.disable(t.SAMPLE_ALPHA_TO_COVERAGE);
78286                  t.disable(t.BLEND);
78287                  t.blendEquationSeparate(t.FUNC_ADD, t.FUNC_ADD);
78288                  t.blendFuncSeparate(t.ONE, t.ZERO, t.ONE, t.ZERO);
78289                  t.colorMask(!0, !0, !0, !0);
78290                  t.blendColor(0, 0, 0, 0);
78291                }(e);
78292                const i = bs.RGBA8;
78293                let s = bs.DEPTH_STENCIL;
78294                let n = e.getParameter(e.DEPTH_BITS);
78295                const r = e.getParameter(e.STENCIL_BITS);
78296                n && r ? s = bs.DEPTH_STENCIL : n && (s = bs.DEPTH);
78297                this._colorTexture = new G7;
78298                this._colorTexture.initAsSwapchainTexture({
78299                  swapchain: this,
78300                  format: i,
78301                  width: t.width,
78302                  height: t.height
78303                });
78304                this._depthStencilTexture = new G7;
78305                this._depthStencilTexture.initAsSwapchainTexture({
78306                  swapchain: this,
78307                  format: s,
78308                  width: t.width,
78309                  height: t.height
78310                });
78311                this.nullTex2D = W6.instance.createTexture(new xn(xs.TEX2D, ws.SAMPLED, bs.RGBA8, 2, 2, Rs.GEN_MIPMAP));
78312                this.nullTexCube = W6.instance.createTexture(new xn(xs.CUBE, ws.SAMPLED, bs.RGBA8, 2, 2, Rs.GEN_MIPMAP, 6));
78313                const o = new mn;
78314                o.texExtent.width = 2;
78315                o.texExtent.height = 2;
78316                const a = new Uint8Array(this.nullTex2D.size);
78317                a.fill(0);
78318                W6.instance.copyBuffersToTexture([ a ], this.nullTex2D, [ o ]);
78319                o.texSubres.layerCount = 6;
78320                W6.instance.copyBuffersToTexture([ a, a, a, a, a, a ], this.nullTexCube, [ o ]);
78321              }
78322              destroy() {
78323                if (this._canvas && this._webGLContextLostHandler) {
78324                  this._canvas.removeEventListener(z7, this._webGLContextLostHandler);
78325                  this._webGLContextLostHandler = null;
78326                }
78327                if (this.nullTex2D) {
78328                  this.nullTex2D.destroy();
78329                  this.nullTex2D = null;
78330                }
78331                if (this.nullTexCube) {
78332                  this.nullTexCube.destroy();
78333                  this.nullTexCube = null;
78334                }
78335                this._extensions = null;
78336                this._canvas = null;
78337              }
78338              resize(t, e, i) {
78339                if (this._colorTexture.width !== t || this._colorTexture.height !== e) {
78340                  R(`Resizing swapchain: ${t}x${e}`);
78341                  this._canvas.width = t;
78342                  this._canvas.height = e;
78343                  this._colorTexture.resize(t, e);
78344                  this._depthStencilTexture.resize(t, e);
78345                }
78346              }
78347              _onWebGLContextLost(t) {
78348                N(11e3);
78349                C(t);
78350              }
78351            }
78352            class W7 extends hr {
78353              get info() {
78354                return this._info;
78355              }
78356              get hash() {
78357                return this._hash;
78358              }
78359              constructor(t, e) {
78360                super(ps.BUFFER_BARRIER);
78361                this._info = new qn;
78362                this._hash = 0;
78363                this._info.copy(t);
78364                this._hash = e;
78365              }
78366              static computeHash(t) {
78367                let e = `${t.prevAccesses} ${t.nextAccesses}`;
78368                e += t.type;
78369                e += t.offset;
78370                e += t.size;
78371                e += t.discardContents;
78372                e += t.srcQueue ? t.srcQueue.type : 0;
78373                e += t.dstQueue ? t.dstQueue.type : 0;
78374                return Ur(e, 666);
78375              }
78376            }
78377            class Y7 extends Nr {
78378              constructor(...t) {
78379                super(...t);
78380                this._swapchain = null;
78381                this._context = null;
78382                this._bindingMappings = null;
78383                this._textureExclusive = new Array(bs.COUNT);
78384              }
78385              get gl() {
78386                return this._context;
78387              }
78388              get extensions() {
78389                return this._swapchain.extensions;
78390              }
78391              get stateCache() {
78392                return this._swapchain.stateCache;
78393              }
78394              get nullTex2D() {
78395                return this._swapchain.nullTex2D;
78396              }
78397              get nullTexCube() {
78398                return this._swapchain.nullTexCube;
78399              }
78400              get textureExclusive() {
78401                return this._textureExclusive;
78402              }
78403              get bindingMappings() {
78404                return this._bindingMappings;
78405              }
78406              initialize(t) {
78407                W6.setInstance(this);
78408                this._gfxAPI = fs.WEBGL;
78409                const e = this._bindingMappingInfo = t.bindingMappingInfo;
78410                const i = [];
78411                const s = [];
78412                const n = e.setIndices[0];
78413                i[n] = 0;
78414                s[n] = 0;
78415                for (let t = 1; t < e.setIndices.length; ++t) {
78416                  const n = e.setIndices[t];
78417                  const r = e.setIndices[t - 1];
78418                  i[n] = e.maxBlockCounts[r] + i[r];
78419                  s[n] = e.maxSamplerTextureCounts[r] + s[r];
78420                }
78421                for (let t = 0; t < e.setIndices.length; ++t) {
78422                  const i = e.setIndices[t];
78423                  s[i] -= e.maxBlockCounts[i];
78424                }
78425                this._bindingMappings = {
78426                  blockOffsets: i,
78427                  samplerTextureOffsets: s,
78428                  flexibleSet: e.setIndices[e.setIndices.length - 1]
78429                };
78430                const r = this._context = function(t) {
78431                  let e = null;
78432                  try {
78433                    const i = {
78434                      alpha: pe.ENABLE_TRANSPARENT_CANVAS,
78435                      antialias: pe.ENABLE_WEBGL_ANTIALIAS,
78436                      depth: !0,
78437                      stencil: !0,
78438                      premultipliedAlpha: !1,
78439                      preserveDrawingBuffer: !1,
78440                      powerPreference: "default",
78441                      failIfMajorPerformanceCaveat: !1
78442                    };
78443                    e = t.getContext("webgl", i);
78444                  } catch (t) {
78445                    return null;
78446                  }
78447                  return e;
78448                }(Nr.canvas);
78449                if (!r) {
78450                  console.error("This device does not support WebGL.");
78451                  return !1;
78452                }
78453                this._queue = this.createQueue(new ir(Qs.GRAPHICS));
78454                this._cmdBuff = this.createCommandBuffer(new er(this._queue));
78455                this._caps.maxVertexAttributes = r.getParameter(r.MAX_VERTEX_ATTRIBS);
78456                this._caps.maxVertexUniformVectors = r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS);
78457                this._caps.maxFragmentUniformVectors = r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS);
78458                this._caps.maxTextureUnits = r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS);
78459                this._caps.maxVertexTextureUnits = r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
78460                this._caps.maxTextureSize = r.getParameter(r.MAX_TEXTURE_SIZE);
78461                this._caps.maxCubeMapTextureSize = r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE);
78462                this._caps.maxUniformBufferBindings = 16;
78463                const o = r.getSupportedExtensions();
78464                let a = "";
78465                if (o) for (const t of o) a += `${t} `;
78466                const l = j7(r);
78467                if (l.WEBGL_debug_renderer_info) {
78468                  this._renderer = r.getParameter(l.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL);
78469                  this._vendor = r.getParameter(l.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL);
78470                } else {
78471                  this._renderer = r.getParameter(r.RENDERER);
78472                  this._vendor = r.getParameter(r.VENDOR);
78473                }
78474                const h = r.getParameter(r.VERSION);
78475                this._features.fill(!1);
78476                this.initFormatFeatures(l);
78477                l.EXT_blend_minmax && (this._features[ys.BLEND_MINMAX] = !0);
78478                l.OES_element_index_uint && (this._features[ys.ELEMENT_INDEX_UINT] = !0);
78479                l.ANGLE_instanced_arrays && (this._features[ys.INSTANCED_ARRAYS] = !0);
78480                l.WEBGL_draw_buffers && (this._features[ys.MULTIPLE_RENDER_TARGETS] = !0);
78481                let c = "";
78482                this.getFormatFeatures(bs.ETC_RGB8) && (c += "etc1 ");
78483                this.getFormatFeatures(bs.ETC2_RGB8) && (c += "etc2 ");
78484                this.getFormatFeatures(bs.BC1) && (c += "dxt ");
78485                this.getFormatFeatures(bs.PVRTC_RGB2) && (c += "pvrtc ");
78486                this.getFormatFeatures(bs.ASTC_RGBA_4X4) && (c += "astc ");
78487                R("WebGL device initialized.");
78488                R(`RENDERER: ${this._renderer}`);
78489                R(`VENDOR: ${this._vendor}`);
78490                R(`VERSION: ${h}`);
78491                R(`COMPRESSED_FORMAT: ${c}`);
78492                R(`EXTENSIONS: ${a}`);
78493                return !0;
78494              }
78495              destroy() {
78496                if (this._queue) {
78497                  this._queue.destroy();
78498                  this._queue = null;
78499                }
78500                if (this._cmdBuff) {
78501                  this._cmdBuff.destroy();
78502                  this._cmdBuff = null;
78503                }
78504                this._swapchain = null;
78505              }
78506              flushCommands(t) {}
78507              acquire(t) {}
78508              present() {
78509                const t = this._queue;
78510                this._numDrawCalls = t.numDrawCalls;
78511                this._numInstances = t.numInstances;
78512                this._numTris = t.numTris;
78513                t.clear();
78514              }
78515              initFormatFeatures(t) {
78516                this._formatFeatures.fill(Is.NONE);
78517                this._textureExclusive.fill(!0);
78518                const e = Is.RENDER_TARGET | Is.SAMPLED_TEXTURE | Is.LINEAR_FILTER;
78519                this._formatFeatures[bs.RGB8] = e;
78520                this._formatFeatures[bs.R5G6B5] = e;
78521                this._textureExclusive[bs.R5G6B5] = !1;
78522                this._formatFeatures[bs.RGBA8] = e;
78523                this._formatFeatures[bs.RGBA4] = e;
78524                this._textureExclusive[bs.RGBA4] = !1;
78525                this._formatFeatures[bs.RGB5A1] = e;
78526                this._textureExclusive[bs.RGB5A1] = !1;
78527                this._formatFeatures[bs.DEPTH] = Is.RENDER_TARGET;
78528                this._textureExclusive[bs.DEPTH] = !1;
78529                this._formatFeatures[bs.DEPTH_STENCIL] = Is.RENDER_TARGET;
78530                this._textureExclusive[bs.DEPTH_STENCIL] = !1;
78531                this._formatFeatures[bs.R8I] |= Is.VERTEX_ATTRIBUTE;
78532                this._formatFeatures[bs.RG8I] |= Is.VERTEX_ATTRIBUTE;
78533                this._formatFeatures[bs.RGB8I] |= Is.VERTEX_ATTRIBUTE;
78534                this._formatFeatures[bs.RGBA8I] |= Is.VERTEX_ATTRIBUTE;
78535                this._formatFeatures[bs.R8UI] |= Is.VERTEX_ATTRIBUTE;
78536                this._formatFeatures[bs.RG8UI] |= Is.VERTEX_ATTRIBUTE;
78537                this._formatFeatures[bs.RGB8UI] |= Is.VERTEX_ATTRIBUTE;
78538                this._formatFeatures[bs.RGBA8UI] |= Is.VERTEX_ATTRIBUTE;
78539                this._formatFeatures[bs.R8I] |= Is.VERTEX_ATTRIBUTE;
78540                this._formatFeatures[bs.RG8I] |= Is.VERTEX_ATTRIBUTE;
78541                this._formatFeatures[bs.RGB8I] |= Is.VERTEX_ATTRIBUTE;
78542                this._formatFeatures[bs.RGBA8I] |= Is.VERTEX_ATTRIBUTE;
78543                this._formatFeatures[bs.R8UI] |= Is.VERTEX_ATTRIBUTE;
78544                this._formatFeatures[bs.RG8UI] |= Is.VERTEX_ATTRIBUTE;
78545                this._formatFeatures[bs.RGB8UI] |= Is.VERTEX_ATTRIBUTE;
78546                this._formatFeatures[bs.RGBA8UI] |= Is.VERTEX_ATTRIBUTE;
78547                this._formatFeatures[bs.R32F] |= Is.VERTEX_ATTRIBUTE;
78548                this._formatFeatures[bs.RG32F] |= Is.VERTEX_ATTRIBUTE;
78549                this._formatFeatures[bs.RGB32F] |= Is.VERTEX_ATTRIBUTE;
78550                this._formatFeatures[bs.RGBA32F] |= Is.VERTEX_ATTRIBUTE;
78551                if (t.EXT_sRGB) {
78552                  this._formatFeatures[bs.SRGB8] = e;
78553                  this._formatFeatures[bs.SRGB8_A8] = e;
78554                  this._textureExclusive[bs.SRGB8_A8] = !1;
78555                }
78556                if (t.WEBGL_depth_texture) {
78557                  this._formatFeatures[bs.DEPTH] |= e;
78558                  this._formatFeatures[bs.DEPTH_STENCIL] |= e;
78559                }
78560                if (t.WEBGL_color_buffer_float) {
78561                  this._formatFeatures[bs.RGB32F] |= Is.RENDER_TARGET;
78562                  this._formatFeatures[bs.RGBA32F] |= Is.RENDER_TARGET;
78563                  this._textureExclusive[bs.RGB32F] = !1;
78564                  this._textureExclusive[bs.RGBA32F] = !1;
78565                }
78566                if (t.EXT_color_buffer_half_float) {
78567                  this._formatFeatures[bs.RGB16F] |= Is.RENDER_TARGET;
78568                  this._formatFeatures[bs.RGBA16F] |= Is.RENDER_TARGET;
78569                  this._textureExclusive[bs.RGB16F] = !1;
78570                  this._textureExclusive[bs.RGBA16F] = !1;
78571                }
78572                if (t.OES_texture_float) {
78573                  this._formatFeatures[bs.RGB32F] |= Is.RENDER_TARGET | Is.SAMPLED_TEXTURE;
78574                  this._formatFeatures[bs.RGBA32F] |= Is.RENDER_TARGET | Is.SAMPLED_TEXTURE;
78575                }
78576                if (t.OES_texture_half_float) {
78577                  this._formatFeatures[bs.RGB16F] |= Is.RENDER_TARGET | Is.SAMPLED_TEXTURE;
78578                  this._formatFeatures[bs.RGBA16F] |= Is.RENDER_TARGET | Is.SAMPLED_TEXTURE;
78579                }
78580                if (t.OES_texture_float_linear) {
78581                  this._formatFeatures[bs.RGB32F] |= Is.LINEAR_FILTER;
78582                  this._formatFeatures[bs.RGBA32F] |= Is.LINEAR_FILTER;
78583                }
78584                if (t.OES_texture_half_float_linear) {
78585                  this._formatFeatures[bs.RGB16F] |= Is.LINEAR_FILTER;
78586                  this._formatFeatures[bs.RGBA16F] |= Is.LINEAR_FILTER;
78587                }
78588                const i = Is.SAMPLED_TEXTURE | Is.LINEAR_FILTER;
78589                t.WEBGL_compressed_texture_etc1 && (this._formatFeatures[bs.ETC_RGB8] = i);
78590                if (t.WEBGL_compressed_texture_etc) {
78591                  this._formatFeatures[bs.ETC2_RGB8] = i;
78592                  this._formatFeatures[bs.ETC2_RGBA8] = i;
78593                  this._formatFeatures[bs.ETC2_SRGB8] = i;
78594                  this._formatFeatures[bs.ETC2_SRGB8_A8] = i;
78595                  this._formatFeatures[bs.ETC2_RGB8_A1] = i;
78596                  this._formatFeatures[bs.ETC2_SRGB8_A1] = i;
78597                }
78598                if (t.WEBGL_compressed_texture_s3tc) {
78599                  this._formatFeatures[bs.BC1] = i;
78600                  this._formatFeatures[bs.BC1_ALPHA] = i;
78601                  this._formatFeatures[bs.BC1_SRGB] = i;
78602                  this._formatFeatures[bs.BC1_SRGB_ALPHA] = i;
78603                  this._formatFeatures[bs.BC2] = i;
78604                  this._formatFeatures[bs.BC2_SRGB] = i;
78605                  this._formatFeatures[bs.BC3] = i;
78606                  this._formatFeatures[bs.BC3_SRGB] = i;
78607                }
78608                if (t.WEBGL_compressed_texture_pvrtc) {
78609                  this._formatFeatures[bs.PVRTC_RGB2] |= i;
78610                  this._formatFeatures[bs.PVRTC_RGBA2] |= i;
78611                  this._formatFeatures[bs.PVRTC_RGB4] |= i;
78612                  this._formatFeatures[bs.PVRTC_RGBA4] |= i;
78613                }
78614                if (t.WEBGL_compressed_texture_astc) {
78615                  this._formatFeatures[bs.ASTC_RGBA_4X4] |= i;
78616                  this._formatFeatures[bs.ASTC_RGBA_5X4] |= i;
78617                  this._formatFeatures[bs.ASTC_RGBA_5X5] |= i;
78618                  this._formatFeatures[bs.ASTC_RGBA_6X5] |= i;
78619                  this._formatFeatures[bs.ASTC_RGBA_6X6] |= i;
78620                  this._formatFeatures[bs.ASTC_RGBA_8X5] |= i;
78621                  this._formatFeatures[bs.ASTC_RGBA_8X6] |= i;
78622                  this._formatFeatures[bs.ASTC_RGBA_8X8] |= i;
78623                  this._formatFeatures[bs.ASTC_RGBA_10X5] |= i;
78624                  this._formatFeatures[bs.ASTC_RGBA_10X6] |= i;
78625                  this._formatFeatures[bs.ASTC_RGBA_10X8] |= i;
78626                  this._formatFeatures[bs.ASTC_RGBA_10X10] |= i;
78627                  this._formatFeatures[bs.ASTC_RGBA_12X10] |= i;
78628                  this._formatFeatures[bs.ASTC_RGBA_12X12] |= i;
78629                  this._formatFeatures[bs.ASTC_SRGBA_4X4] |= i;
78630                  this._formatFeatures[bs.ASTC_SRGBA_5X4] |= i;
78631                  this._formatFeatures[bs.ASTC_SRGBA_5X5] |= i;
78632                  this._formatFeatures[bs.ASTC_SRGBA_6X5] |= i;
78633                  this._formatFeatures[bs.ASTC_SRGBA_6X6] |= i;
78634                  this._formatFeatures[bs.ASTC_SRGBA_8X5] |= i;
78635                  this._formatFeatures[bs.ASTC_SRGBA_8X6] |= i;
78636                  this._formatFeatures[bs.ASTC_SRGBA_8X8] |= i;
78637                  this._formatFeatures[bs.ASTC_SRGBA_10X5] |= i;
78638                  this._formatFeatures[bs.ASTC_SRGBA_10X6] |= i;
78639                  this._formatFeatures[bs.ASTC_SRGBA_10X8] |= i;
78640                  this._formatFeatures[bs.ASTC_SRGBA_10X10] |= i;
78641                  this._formatFeatures[bs.ASTC_SRGBA_12X10] |= i;
78642                  this._formatFeatures[bs.ASTC_SRGBA_12X12] |= i;
78643                }
78644              }
78645              createCommandBuffer(t) {
78646                const e = new (t.type === tn.PRIMARY ? O7 : w7);
78647                e.initialize(t);
78648                return e;
78649              }
78650              createSwapchain(t) {
78651                const e = new X7;
78652                this._swapchain = e;
78653                e.initialize(t);
78654                return e;
78655              }
78656              createBuffer(t) {
78657                const e = new E7;
78658                e.initialize(t);
78659                return e;
78660              }
78661              createTexture(t) {
78662                const e = new G7;
78663                e.initialize(t);
78664                return e;
78665              }
78666              createDescriptorSet(t) {
78667                const e = new j6;
78668                e.initialize(t);
78669                return e;
78670              }
78671              createShader(t) {
78672                const e = new k7;
78673                e.initialize(t);
78674                return e;
78675              }
78676              createInputAssembler(t) {
78677                const e = new I7;
78678                e.initialize(t);
78679                return e;
78680              }
78681              createRenderPass(t) {
78682                const e = new L7;
78683                e.initialize(t);
78684                return e;
78685              }
78686              createFramebuffer(t) {
78687                const e = new R7;
78688                e.initialize(t);
78689                return e;
78690              }
78691              createDescriptorSetLayout(t) {
78692                const e = new M7;
78693                e.initialize(t);
78694                return e;
78695              }
78696              createPipelineLayout(t) {
78697                const e = new B7;
78698                e.initialize(t);
78699                return e;
78700              }
78701              createPipelineState(t) {
78702                const e = new P7;
78703                e.initialize(t);
78704                return e;
78705              }
78706              createQueue(t) {
78707                const e = new N7;
78708                e.initialize(t);
78709                return e;
78710              }
78711              getSampler(t) {
78712                const e = qr.computeHash(t);
78713                this._samplers.has(e) || this._samplers.set(e, new V7(t, e));
78714                return this._samplers.get(e);
78715              }
78716              getSwapchains() {
78717                return [ this._swapchain ];
78718              }
78719              getGeneralBarrier(t) {
78720                const e = Kr.computeHash(t);
78721                this._generalBarrierss.has(e) || this._generalBarrierss.set(e, new Kr(t, e));
78722                return this._generalBarrierss.get(e);
78723              }
78724              getTextureBarrier(t) {
78725                const e = Jr.computeHash(t);
78726                this._textureBarriers.has(e) || this._textureBarriers.set(e, new Jr(t, e));
78727                return this._textureBarriers.get(e);
78728              }
78729              getBufferBarrier(t) {
78730                const e = W7.computeHash(t);
78731                this._bufferBarriers.has(e) || this._bufferBarriers.set(e, new W7(t, e));
78732                return this._bufferBarriers.get(e);
78733              }
78734              copyBuffersToTexture(t, e, i) {
78735                T7(this, t, e.gpuTexture, i);
78736              }
78737              copyTextureToBuffers(t, e, i) {
78738                !function(t, e, i, s) {
78739                  const {gl: n} = t;
78740                  const r = t.stateCache;
78741                  const o = n.createFramebuffer();
78742                  n.bindFramebuffer(n.FRAMEBUFFER, o);
78743                  let a = 0;
78744                  let l = 0;
78745                  let h = 1;
78746                  let c = 1;
78747                  if (e.glTarget === n.TEXTURE_2D) for (let t = 0; t < s.length; t++) {
78748                    const r = s[t];
78749                    n.framebufferTexture2D(n.FRAMEBUFFER, n.COLOR_ATTACHMENT0, e.glTarget, e.glTexture, r.texSubres.mipLevel);
78750                    a = r.texOffset.x;
78751                    l = r.texOffset.y;
78752                    h = r.texExtent.width;
78753                    c = r.texExtent.height;
78754                    n.readPixels(a, l, h, c, e.glFormat, e.glType, i[t]);
78755                  } else console.error("Unsupported GL texture type, copy texture to buffers failed.");
78756                  n.bindFramebuffer(n.FRAMEBUFFER, null);
78757                  r.glFramebuffer = null;
78758                  n.deleteFramebuffer(o);
78759                }(this, t.gpuTexture, e, i);
78760              }
78761              copyTexImagesToTexture(t, e, i) {
78762                !function(t, e, i, s) {
78763                  const {gl: n} = t;
78764                  const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
78765                  if (r.glTexture !== i.glTexture) {
78766                    n.bindTexture(i.glTarget, i.glTexture);
78767                    r.glTexture = i.glTexture;
78768                  }
78769                  let o = 0;
78770                  let a = 0;
78771                  switch (i.glTarget) {
78772                   case n.TEXTURE_2D:
78773                    for (let t = 0; t < s.length; t++) {
78774                      const r = s[t];
78775                      n.texSubImage2D(n.TEXTURE_2D, r.texSubres.mipLevel, r.texOffset.x, r.texOffset.y, i.glFormat, i.glType, e[o++]);
78776                    }
78777                    break;
78778
78779                   case n.TEXTURE_CUBE_MAP:
78780                    for (let t = 0; t < s.length; t++) {
78781                      const r = s[t];
78782                      const l = r.texSubres.baseArrayLayer + r.texSubres.layerCount;
78783                      for (a = r.texSubres.baseArrayLayer; a < l; ++a) n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, r.texSubres.mipLevel, r.texOffset.x, r.texOffset.y, i.glFormat, i.glType, e[o++]);
78784                    }
78785                    break;
78786
78787                   default:
78788                    console.error("Unsupported GL texture type, copy buffer to texture failed.");
78789                  }
78790                  i.flags & Rs.GEN_MIPMAP && i.isPowerOf2 && n.generateMipmap(i.glTarget);
78791                }(this, t, e.gpuTexture, i);
78792              }
78793            }
78794            t("WebGLDevice", Y7);
78795            m.WebGLDevice = Y7;
78796            class q7 extends Dr {
78797              constructor(...t) {
78798                super(...t);
78799                this._gpuDescriptorSet = null;
78800              }
78801              get gpuDescriptorSet() {
78802                return this._gpuDescriptorSet;
78803              }
78804              initialize(t) {
78805                this._layout = t.layout;
78806                const {bindings: e, descriptorIndices: i, descriptorCount: s} = t.layout.gpuDescriptorSetLayout;
78807                this._buffers = Array(s).fill(null);
78808                this._textures = Array(s).fill(null);
78809                this._samplers = Array(s).fill(null);
78810                const n = [];
78811                this._gpuDescriptorSet = {
78812                  gpuDescriptors: n,
78813                  descriptorIndices: i
78814                };
78815                for (let t = 0; t < e.length; ++t) {
78816                  const i = e[t];
78817                  for (let t = 0; t < i.count; t++) n.push({
78818                    type: i.descriptorType,
78819                    gpuBuffer: null,
78820                    gpuTextureView: null,
78821                    gpuSampler: null
78822                  });
78823                }
78824              }
78825              destroy() {
78826                this._layout = null;
78827                this._gpuDescriptorSet = null;
78828              }
78829              update() {
78830                if (this._isDirty && this._gpuDescriptorSet) {
78831                  const t = this._gpuDescriptorSet.gpuDescriptors;
78832                  for (let e = 0; e < t.length; ++e) if (t[e].type & _r) this._buffers[e] && (t[e].gpuBuffer = this._buffers[e].gpuBuffer); else if (t[e].type & dr) {
78833                    this._textures[e] && (t[e].gpuTextureView = this._textures[e].gpuTextureView);
78834                    this._samplers[e] && (t[e].gpuSampler = this._samplers[e].gpuSampler);
78835                  }
78836                  this._isDirty = !1;
78837                }
78838              }
78839            }
78840            let K7;
78841            !function(t) {
78842              t[t.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT";
78843              t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT";
78844              t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT";
78845              t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT";
78846              t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT";
78847              t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT";
78848              t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT";
78849              t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT";
78850              t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG";
78851              t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG";
78852              t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG";
78853              t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG";
78854              t[t.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL";
78855              t[t.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC";
78856              t[t.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC";
78857              t[t.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC";
78858              t[t.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC";
78859              t[t.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2";
78860              t[t.COMPRESSED_SRGB8_ETC2 = 37493] = "COMPRESSED_SRGB8_ETC2";
78861              t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2";
78862              t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2";
78863              t[t.COMPRESSED_RGBA8_ETC2_EAC = 37496] = "COMPRESSED_RGBA8_ETC2_EAC";
78864              t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC";
78865              t[t.COMPRESSED_RGBA_ASTC_4x4_KHR = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR";
78866              t[t.COMPRESSED_RGBA_ASTC_5x4_KHR = 37809] = "COMPRESSED_RGBA_ASTC_5x4_KHR";
78867              t[t.COMPRESSED_RGBA_ASTC_5x5_KHR = 37810] = "COMPRESSED_RGBA_ASTC_5x5_KHR";
78868              t[t.COMPRESSED_RGBA_ASTC_6x5_KHR = 37811] = "COMPRESSED_RGBA_ASTC_6x5_KHR";
78869              t[t.COMPRESSED_RGBA_ASTC_6x6_KHR = 37812] = "COMPRESSED_RGBA_ASTC_6x6_KHR";
78870              t[t.COMPRESSED_RGBA_ASTC_8x5_KHR = 37813] = "COMPRESSED_RGBA_ASTC_8x5_KHR";
78871              t[t.COMPRESSED_RGBA_ASTC_8x6_KHR = 37814] = "COMPRESSED_RGBA_ASTC_8x6_KHR";
78872              t[t.COMPRESSED_RGBA_ASTC_8x8_KHR = 37815] = "COMPRESSED_RGBA_ASTC_8x8_KHR";
78873              t[t.COMPRESSED_RGBA_ASTC_10x5_KHR = 37816] = "COMPRESSED_RGBA_ASTC_10x5_KHR";
78874              t[t.COMPRESSED_RGBA_ASTC_10x6_KHR = 37817] = "COMPRESSED_RGBA_ASTC_10x6_KHR";
78875              t[t.COMPRESSED_RGBA_ASTC_10x8_KHR = 37818] = "COMPRESSED_RGBA_ASTC_10x8_KHR";
78876              t[t.COMPRESSED_RGBA_ASTC_10x10_KHR = 37819] = "COMPRESSED_RGBA_ASTC_10x10_KHR";
78877              t[t.COMPRESSED_RGBA_ASTC_12x10_KHR = 37820] = "COMPRESSED_RGBA_ASTC_12x10_KHR";
78878              t[t.COMPRESSED_RGBA_ASTC_12x12_KHR = 37821] = "COMPRESSED_RGBA_ASTC_12x12_KHR";
78879              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 37840] = "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR";
78880              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 37841] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR";
78881              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 37842] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR";
78882              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 37843] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR";
78883              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 37844] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR";
78884              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 37845] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR";
78885              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 37846] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR";
78886              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 37847] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR";
78887              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 37848] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR";
78888              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 37849] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR";
78889              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 37850] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR";
78890              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 37851] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR";
78891              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 37852] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR";
78892              t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 37853] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR";
78893            }(K7 || (K7 = {}));
78894            class J7 {
78895              static get instance() {
78896                return J7._instance;
78897              }
78898              static setInstance(t) {
78899                J7._instance = t;
78900              }
78901            }
78902            J7._instance = null;
78903            const Z7 = [ 10497, 33648, 33071, 33071 ];
78904            const Q7 = new Float32Array(4);
78905            function $7(t, e) {
78906              switch (t) {
78907               case bs.R8:
78908                return e.UNSIGNED_BYTE;
78909
78910               case bs.R8SN:
78911                return e.BYTE;
78912
78913               case bs.R8UI:
78914                return e.UNSIGNED_BYTE;
78915
78916               case bs.R8I:
78917                return e.BYTE;
78918
78919               case bs.R16F:
78920                return e.HALF_FLOAT;
78921
78922               case bs.R16UI:
78923                return e.UNSIGNED_SHORT;
78924
78925               case bs.R16I:
78926                return e.SHORT;
78927
78928               case bs.R32F:
78929                return e.FLOAT;
78930
78931               case bs.R32UI:
78932                return e.UNSIGNED_INT;
78933
78934               case bs.R32I:
78935                return e.INT;
78936
78937               case bs.RG8:
78938                return e.UNSIGNED_BYTE;
78939
78940               case bs.RG8SN:
78941                return e.BYTE;
78942
78943               case bs.RG8UI:
78944                return e.UNSIGNED_BYTE;
78945
78946               case bs.RG8I:
78947                return e.BYTE;
78948
78949               case bs.RG16F:
78950                return e.HALF_FLOAT;
78951
78952               case bs.RG16UI:
78953                return e.UNSIGNED_SHORT;
78954
78955               case bs.RG16I:
78956                return e.SHORT;
78957
78958               case bs.RG32F:
78959                return e.FLOAT;
78960
78961               case bs.RG32UI:
78962                return e.UNSIGNED_INT;
78963
78964               case bs.RG32I:
78965                return e.INT;
78966
78967               case bs.RGB8:
78968               case bs.SRGB8:
78969                return e.UNSIGNED_BYTE;
78970
78971               case bs.RGB8SN:
78972                return e.BYTE;
78973
78974               case bs.RGB8UI:
78975                return e.UNSIGNED_BYTE;
78976
78977               case bs.RGB8I:
78978                return e.BYTE;
78979
78980               case bs.RGB16F:
78981                return e.HALF_FLOAT;
78982
78983               case bs.RGB16UI:
78984                return e.UNSIGNED_SHORT;
78985
78986               case bs.RGB16I:
78987                return e.SHORT;
78988
78989               case bs.RGB32F:
78990                return e.FLOAT;
78991
78992               case bs.RGB32UI:
78993                return e.UNSIGNED_INT;
78994
78995               case bs.RGB32I:
78996                return e.INT;
78997
78998               case bs.BGRA8:
78999               case bs.RGBA8:
79000               case bs.SRGB8_A8:
79001                return e.UNSIGNED_BYTE;
79002
79003               case bs.RGBA8SN:
79004                return e.BYTE;
79005
79006               case bs.RGBA8UI:
79007                return e.UNSIGNED_BYTE;
79008
79009               case bs.RGBA8I:
79010                return e.BYTE;
79011
79012               case bs.RGBA16F:
79013                return e.HALF_FLOAT;
79014
79015               case bs.RGBA16UI:
79016                return e.UNSIGNED_SHORT;
79017
79018               case bs.RGBA16I:
79019                return e.SHORT;
79020
79021               case bs.RGBA32F:
79022                return e.FLOAT;
79023
79024               case bs.RGBA32UI:
79025                return e.UNSIGNED_INT;
79026
79027               case bs.RGBA32I:
79028                return e.INT;
79029
79030               case bs.R5G6B5:
79031                return e.UNSIGNED_SHORT_5_6_5;
79032
79033               case bs.R11G11B10F:
79034                return e.UNSIGNED_INT_10F_11F_11F_REV;
79035
79036               case bs.RGB5A1:
79037                return e.UNSIGNED_SHORT_5_5_5_1;
79038
79039               case bs.RGBA4:
79040                return e.UNSIGNED_SHORT_4_4_4_4;
79041
79042               case bs.RGB10A2:
79043               case bs.RGB10A2UI:
79044                return e.UNSIGNED_INT_2_10_10_10_REV;
79045
79046               case bs.RGB9E5:
79047               case bs.DEPTH:
79048                return e.FLOAT;
79049
79050               case bs.DEPTH_STENCIL:
79051                return e.UNSIGNED_INT_24_8;
79052
79053               case bs.BC1:
79054               case bs.BC1_SRGB:
79055               case bs.BC2:
79056               case bs.BC2_SRGB:
79057               case bs.BC3:
79058               case bs.BC3_SRGB:
79059               case bs.BC4:
79060                return e.UNSIGNED_BYTE;
79061
79062               case bs.BC4_SNORM:
79063                return e.BYTE;
79064
79065               case bs.BC5:
79066                return e.UNSIGNED_BYTE;
79067
79068               case bs.BC5_SNORM:
79069                return e.BYTE;
79070
79071               case bs.BC6H_SF16:
79072               case bs.BC6H_UF16:
79073                return e.FLOAT;
79074
79075               case bs.BC7:
79076               case bs.BC7_SRGB:
79077               case bs.ETC_RGB8:
79078               case bs.ETC2_RGB8:
79079               case bs.ETC2_SRGB8:
79080               case bs.ETC2_RGB8_A1:
79081               case bs.ETC2_SRGB8_A1:
79082               case bs.EAC_R11:
79083                return e.UNSIGNED_BYTE;
79084
79085               case bs.EAC_R11SN:
79086                return e.BYTE;
79087
79088               case bs.EAC_RG11:
79089                return e.UNSIGNED_BYTE;
79090
79091               case bs.EAC_RG11SN:
79092                return e.BYTE;
79093
79094               case bs.PVRTC_RGB2:
79095               case bs.PVRTC_RGBA2:
79096               case bs.PVRTC_RGB4:
79097               case bs.PVRTC_RGBA4:
79098               case bs.PVRTC2_2BPP:
79099               case bs.PVRTC2_4BPP:
79100               case bs.ASTC_RGBA_4X4:
79101               case bs.ASTC_RGBA_5X4:
79102               case bs.ASTC_RGBA_5X5:
79103               case bs.ASTC_RGBA_6X5:
79104               case bs.ASTC_RGBA_6X6:
79105               case bs.ASTC_RGBA_8X5:
79106               case bs.ASTC_RGBA_8X6:
79107               case bs.ASTC_RGBA_8X8:
79108               case bs.ASTC_RGBA_10X5:
79109               case bs.ASTC_RGBA_10X6:
79110               case bs.ASTC_RGBA_10X8:
79111               case bs.ASTC_RGBA_10X10:
79112               case bs.ASTC_RGBA_12X10:
79113               case bs.ASTC_RGBA_12X12:
79114               case bs.ASTC_SRGBA_4X4:
79115               case bs.ASTC_SRGBA_5X4:
79116               case bs.ASTC_SRGBA_5X5:
79117               case bs.ASTC_SRGBA_6X5:
79118               case bs.ASTC_SRGBA_6X6:
79119               case bs.ASTC_SRGBA_8X5:
79120               case bs.ASTC_SRGBA_8X6:
79121               case bs.ASTC_SRGBA_8X8:
79122               case bs.ASTC_SRGBA_10X5:
79123               case bs.ASTC_SRGBA_10X6:
79124               case bs.ASTC_SRGBA_10X8:
79125               case bs.ASTC_SRGBA_10X10:
79126               case bs.ASTC_SRGBA_12X10:
79127               case bs.ASTC_SRGBA_12X12:
79128               default:
79129                return e.UNSIGNED_BYTE;
79130              }
79131            }
79132            function t9(t, e) {
79133              switch (t) {
79134               case As.BOOL:
79135                return e.BOOL;
79136
79137               case As.BOOL2:
79138                return e.BOOL_VEC2;
79139
79140               case As.BOOL3:
79141                return e.BOOL_VEC3;
79142
79143               case As.BOOL4:
79144                return e.BOOL_VEC4;
79145
79146               case As.INT:
79147                return e.INT;
79148
79149               case As.INT2:
79150                return e.INT_VEC2;
79151
79152               case As.INT3:
79153                return e.INT_VEC3;
79154
79155               case As.INT4:
79156                return e.INT_VEC4;
79157
79158               case As.UINT:
79159                return e.UNSIGNED_INT;
79160
79161               case As.FLOAT:
79162                return e.FLOAT;
79163
79164               case As.FLOAT2:
79165                return e.FLOAT_VEC2;
79166
79167               case As.FLOAT3:
79168                return e.FLOAT_VEC3;
79169
79170               case As.FLOAT4:
79171                return e.FLOAT_VEC4;
79172
79173               case As.MAT2:
79174                return e.FLOAT_MAT2;
79175
79176               case As.MAT2X3:
79177                return e.FLOAT_MAT2x3;
79178
79179               case As.MAT2X4:
79180                return e.FLOAT_MAT2x4;
79181
79182               case As.MAT3X2:
79183                return e.FLOAT_MAT3x2;
79184
79185               case As.MAT3:
79186                return e.FLOAT_MAT3;
79187
79188               case As.MAT3X4:
79189                return e.FLOAT_MAT3x4;
79190
79191               case As.MAT4X2:
79192                return e.FLOAT_MAT4x2;
79193
79194               case As.MAT4X3:
79195                return e.FLOAT_MAT4x3;
79196
79197               case As.MAT4:
79198                return e.FLOAT_MAT4;
79199
79200               case As.SAMPLER2D:
79201                return e.SAMPLER_2D;
79202
79203               case As.SAMPLER2D_ARRAY:
79204                return e.SAMPLER_2D_ARRAY;
79205
79206               case As.SAMPLER3D:
79207                return e.SAMPLER_3D;
79208
79209               case As.SAMPLER_CUBE:
79210                return e.SAMPLER_CUBE;
79211
79212               default:
79213                console.error("Unsupported GLType, convert to GL type failed.");
79214                return As.UNKNOWN;
79215              }
79216            }
79217            function e9(t, e) {
79218              switch (t) {
79219               case e.BOOL:
79220                return As.BOOL;
79221
79222               case e.BOOL_VEC2:
79223                return As.BOOL2;
79224
79225               case e.BOOL_VEC3:
79226                return As.BOOL3;
79227
79228               case e.BOOL_VEC4:
79229                return As.BOOL4;
79230
79231               case e.INT:
79232                return As.INT;
79233
79234               case e.INT_VEC2:
79235                return As.INT2;
79236
79237               case e.INT_VEC3:
79238                return As.INT3;
79239
79240               case e.INT_VEC4:
79241                return As.INT4;
79242
79243               case e.UNSIGNED_INT:
79244                return As.UINT;
79245
79246               case e.UNSIGNED_INT_VEC2:
79247                return As.UINT2;
79248
79249               case e.UNSIGNED_INT_VEC3:
79250                return As.UINT3;
79251
79252               case e.UNSIGNED_INT_VEC4:
79253                return As.UINT4;
79254
79255               case e.FLOAT:
79256                return As.FLOAT;
79257
79258               case e.FLOAT_VEC2:
79259                return As.FLOAT2;
79260
79261               case e.FLOAT_VEC3:
79262                return As.FLOAT3;
79263
79264               case e.FLOAT_VEC4:
79265                return As.FLOAT4;
79266
79267               case e.FLOAT_MAT2:
79268                return As.MAT2;
79269
79270               case e.FLOAT_MAT2x3:
79271                return As.MAT2X3;
79272
79273               case e.FLOAT_MAT2x4:
79274                return As.MAT2X4;
79275
79276               case e.FLOAT_MAT3x2:
79277                return As.MAT3X2;
79278
79279               case e.FLOAT_MAT3:
79280                return As.MAT3;
79281
79282               case e.FLOAT_MAT3x4:
79283                return As.MAT3X4;
79284
79285               case e.FLOAT_MAT4x2:
79286                return As.MAT4X2;
79287
79288               case e.FLOAT_MAT4x3:
79289                return As.MAT4X3;
79290
79291               case e.FLOAT_MAT4:
79292                return As.MAT4;
79293
79294               case e.SAMPLER_2D:
79295                return As.SAMPLER2D;
79296
79297               case e.SAMPLER_2D_ARRAY:
79298                return As.SAMPLER2D_ARRAY;
79299
79300               case e.SAMPLER_3D:
79301                return As.SAMPLER3D;
79302
79303               case e.SAMPLER_CUBE:
79304                return As.SAMPLER_CUBE;
79305
79306               default:
79307                console.error("Unsupported GLType, convert to Type failed.");
79308                return As.UNKNOWN;
79309              }
79310            }
79311            function i9(t, e) {
79312              switch (t) {
79313               case e.BOOL:
79314                return 4;
79315
79316               case e.BOOL_VEC2:
79317                return 8;
79318
79319               case e.BOOL_VEC3:
79320                return 12;
79321
79322               case e.BOOL_VEC4:
79323                return 16;
79324
79325               case e.INT:
79326                return 4;
79327
79328               case e.INT_VEC2:
79329                return 8;
79330
79331               case e.INT_VEC3:
79332                return 12;
79333
79334               case e.INT_VEC4:
79335                return 16;
79336
79337               case e.UNSIGNED_INT:
79338                return 4;
79339
79340               case e.UNSIGNED_INT_VEC2:
79341                return 8;
79342
79343               case e.UNSIGNED_INT_VEC3:
79344                return 12;
79345
79346               case e.UNSIGNED_INT_VEC4:
79347                return 16;
79348
79349               case e.FLOAT:
79350                return 4;
79351
79352               case e.FLOAT_VEC2:
79353                return 8;
79354
79355               case e.FLOAT_VEC3:
79356                return 12;
79357
79358               case e.FLOAT_VEC4:
79359               case e.FLOAT_MAT2:
79360                return 16;
79361
79362               case e.FLOAT_MAT2x3:
79363                return 24;
79364
79365               case e.FLOAT_MAT2x4:
79366                return 32;
79367
79368               case e.FLOAT_MAT3x2:
79369                return 24;
79370
79371               case e.FLOAT_MAT3:
79372                return 36;
79373
79374               case e.FLOAT_MAT3x4:
79375                return 48;
79376
79377               case e.FLOAT_MAT4x2:
79378                return 32;
79379
79380               case e.FLOAT_MAT4x3:
79381                return 48;
79382
79383               case e.FLOAT_MAT4:
79384                return 64;
79385
79386               case e.SAMPLER_2D:
79387               case e.SAMPLER_2D_ARRAY:
79388               case e.SAMPLER_2D_ARRAY_SHADOW:
79389               case e.SAMPLER_3D:
79390               case e.SAMPLER_CUBE:
79391               case e.INT_SAMPLER_2D:
79392               case e.INT_SAMPLER_2D_ARRAY:
79393               case e.INT_SAMPLER_3D:
79394               case e.INT_SAMPLER_CUBE:
79395               case e.UNSIGNED_INT_SAMPLER_2D:
79396               case e.UNSIGNED_INT_SAMPLER_2D_ARRAY:
79397               case e.UNSIGNED_INT_SAMPLER_3D:
79398               case e.UNSIGNED_INT_SAMPLER_CUBE:
79399                return 4;
79400
79401               default:
79402                console.error("Unsupported GLType, get type failed.");
79403                return 0;
79404              }
79405            }
79406            function s9(t, e) {
79407              switch (t) {
79408               case e.FLOAT_MAT2:
79409               case e.FLOAT_MAT2x3:
79410               case e.FLOAT_MAT2x4:
79411                return 2;
79412
79413               case e.FLOAT_MAT3x2:
79414               case e.FLOAT_MAT3:
79415               case e.FLOAT_MAT3x4:
79416                return 3;
79417
79418               case e.FLOAT_MAT4x2:
79419               case e.FLOAT_MAT4x3:
79420               case e.FLOAT_MAT4:
79421                return 4;
79422
79423               default:
79424                return 1;
79425              }
79426            }
79427            const n9 = [ 512, 513, 514, 515, 516, 517, 518, 519 ];
79428            const r9 = [ 0, 7680, 7681, 7682, 7683, 5386, 34055, 34056 ];
79429            const o9 = [ 32774, 32778, 32779, 32775, 32776 ];
79430            const a9 = [ 0, 1, 770, 772, 771, 773, 768, 774, 769, 775, 776, 32769, 32770, 32771, 32772 ];
79431            let l9;
79432            !function(t) {
79433              t[t.BEGIN_RENDER_PASS = 0] = "BEGIN_RENDER_PASS";
79434              t[t.END_RENDER_PASS = 1] = "END_RENDER_PASS";
79435              t[t.BIND_STATES = 2] = "BIND_STATES";
79436              t[t.DRAW = 3] = "DRAW";
79437              t[t.UPDATE_BUFFER = 4] = "UPDATE_BUFFER";
79438              t[t.COPY_BUFFER_TO_TEXTURE = 5] = "COPY_BUFFER_TO_TEXTURE";
79439              t[t.COUNT = 6] = "COUNT";
79440            }(l9 || (l9 = {}));
79441            class h9 {
79442              constructor(t) {
79443                this.cmdType = void 0;
79444                this.refCount = 0;
79445                this.cmdType = t;
79446              }
79447            }
79448            class c9 extends h9 {
79449              constructor() {
79450                super(l9.BEGIN_RENDER_PASS);
79451                this.gpuRenderPass = null;
79452                this.gpuFramebuffer = null;
79453                this.renderArea = new hn;
79454                this.clearColors = [];
79455                this.clearDepth = 1;
79456                this.clearStencil = 0;
79457              }
79458              clear() {
79459                this.gpuFramebuffer = null;
79460                this.clearColors.length = 0;
79461              }
79462            }
79463            class u9 extends h9 {
79464              constructor() {
79465                super(l9.BIND_STATES);
79466                this.gpuPipelineState = null;
79467                this.gpuInputAssembler = null;
79468                this.gpuDescriptorSets = [];
79469                this.dynamicOffsets = [];
79470                this.dynamicStates = new lr;
79471              }
79472              clear() {
79473                this.gpuPipelineState = null;
79474                this.gpuInputAssembler = null;
79475                this.gpuDescriptorSets.length = 0;
79476                this.dynamicOffsets.length = 0;
79477              }
79478            }
79479            class _9 extends h9 {
79480              constructor() {
79481                super(l9.DRAW);
79482                this.drawInfo = new vn;
79483              }
79484              clear() {}
79485            }
79486            class d9 extends h9 {
79487              constructor() {
79488                super(l9.UPDATE_BUFFER);
79489                this.gpuBuffer = null;
79490                this.buffer = null;
79491                this.offset = 0;
79492                this.size = 0;
79493              }
79494              clear() {
79495                this.gpuBuffer = null;
79496                this.buffer = null;
79497              }
79498            }
79499            class p9 extends h9 {
79500              constructor() {
79501                super(l9.COPY_BUFFER_TO_TEXTURE);
79502                this.gpuTexture = null;
79503                this.buffers = [];
79504                this.regions = [];
79505              }
79506              clear() {
79507                this.gpuTexture = null;
79508                this.buffers.length = 0;
79509                this.regions.length = 0;
79510              }
79511            }
79512            class m9 {
79513              constructor() {
79514                this.cmds = new eo(1);
79515                this.beginRenderPassCmds = new eo(1);
79516                this.bindStatesCmds = new eo(1);
79517                this.drawCmds = new eo(1);
79518                this.updateBufferCmds = new eo(1);
79519                this.copyBufferToTextureCmds = new eo(1);
79520              }
79521              clearCmds(t) {
79522                if (this.beginRenderPassCmds.length) {
79523                  t.beginRenderPassCmdPool.freeCmds(this.beginRenderPassCmds);
79524                  this.beginRenderPassCmds.clear();
79525                }
79526                if (this.bindStatesCmds.length) {
79527                  t.bindStatesCmdPool.freeCmds(this.bindStatesCmds);
79528                  this.bindStatesCmds.clear();
79529                }
79530                if (this.drawCmds.length) {
79531                  t.drawCmdPool.freeCmds(this.drawCmds);
79532                  this.drawCmds.clear();
79533                }
79534                if (this.updateBufferCmds.length) {
79535                  t.updateBufferCmdPool.freeCmds(this.updateBufferCmds);
79536                  this.updateBufferCmds.clear();
79537                }
79538                if (this.copyBufferToTextureCmds.length) {
79539                  t.copyBufferToTextureCmdPool.freeCmds(this.copyBufferToTextureCmds);
79540                  this.copyBufferToTextureCmds.clear();
79541                }
79542                this.cmds.clear();
79543              }
79544            }
79545            function f9(t, e, i, s, n) {
79546              if (e.usage & Ts.INDIRECT) {
79547                e.indirects.clearDraws();
79548                const t = i.drawInfos;
79549                for (let i = 0; i < t.length; ++i) e.indirects.setDrawInfo(s + i, t[i]);
79550              } else {
79551                const r = i;
79552                const {gl: o} = t;
79553                const a = t.stateCache;
79554                switch (e.glTarget) {
79555                 case o.ARRAY_BUFFER:
79556                  if (t.extensions.useVAO && a.glVAO) {
79557                    o.bindVertexArray(null);
79558                    a.glVAO = null;
79559                  }
79560                  b9.gpuInputAssembler = null;
79561                  if (a.glArrayBuffer !== e.glBuffer) {
79562                    o.bindBuffer(o.ARRAY_BUFFER, e.glBuffer);
79563                    a.glArrayBuffer = e.glBuffer;
79564                  }
79565                  n === r.byteLength ? o.bufferSubData(e.glTarget, s, r) : o.bufferSubData(e.glTarget, s, r.slice(0, n));
79566                  break;
79567
79568                 case o.ELEMENT_ARRAY_BUFFER:
79569                  if (t.extensions.useVAO && a.glVAO) {
79570                    o.bindVertexArray(null);
79571                    a.glVAO = null;
79572                  }
79573                  b9.gpuInputAssembler = null;
79574                  if (a.glElementArrayBuffer !== e.glBuffer) {
79575                    o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, e.glBuffer);
79576                    a.glElementArrayBuffer = e.glBuffer;
79577                  }
79578                  n === r.byteLength ? o.bufferSubData(e.glTarget, s, r) : o.bufferSubData(e.glTarget, s, r.slice(0, n));
79579                  break;
79580
79581                 case o.UNIFORM_BUFFER:
79582                  if (a.glUniformBuffer !== e.glBuffer) {
79583                    o.bindBuffer(o.UNIFORM_BUFFER, e.glBuffer);
79584                    a.glUniformBuffer = e.glBuffer;
79585                  }
79586                  n === r.byteLength ? o.bufferSubData(e.glTarget, s, r) : o.bufferSubData(e.glTarget, s, new Float32Array(r, 0, n / 4));
79587                  break;
79588
79589                 default:
79590                  console.error("Unsupported BufferType, update buffer failed.");
79591                }
79592              }
79593            }
79594            function g9(t, e) {
79595              const {gl: i} = t;
79596              e.glInternalFmt = function(t, e) {
79597                switch (t) {
79598                 case bs.A8:
79599                  return e.ALPHA;
79600
79601                 case bs.L8:
79602                  return e.LUMINANCE;
79603
79604                 case bs.LA8:
79605                  return e.LUMINANCE_ALPHA;
79606
79607                 case bs.R8:
79608                  return e.R8;
79609
79610                 case bs.R8SN:
79611                  return e.R8_SNORM;
79612
79613                 case bs.R8UI:
79614                  return e.R8UI;
79615
79616                 case bs.R8I:
79617                  return e.R8I;
79618
79619                 case bs.RG8:
79620                  return e.RG8;
79621
79622                 case bs.RG8SN:
79623                  return e.RG8_SNORM;
79624
79625                 case bs.RG8UI:
79626                  return e.RG8UI;
79627
79628                 case bs.RG8I:
79629                  return e.RG8I;
79630
79631                 case bs.RGB8:
79632                  return e.RGB8;
79633
79634                 case bs.RGB8SN:
79635                  return e.RGB8_SNORM;
79636
79637                 case bs.RGB8UI:
79638                  return e.RGB8UI;
79639
79640                 case bs.RGB8I:
79641                  return e.RGB8I;
79642
79643                 case bs.BGRA8:
79644                 case bs.RGBA8:
79645                  return e.RGBA8;
79646
79647                 case bs.RGBA8SN:
79648                  return e.RGBA8_SNORM;
79649
79650                 case bs.RGBA8UI:
79651                  return e.RGBA8UI;
79652
79653                 case bs.RGBA8I:
79654                  return e.RGBA8I;
79655
79656                 case bs.R16I:
79657                  return e.R16I;
79658
79659                 case bs.R16UI:
79660                  return e.R16UI;
79661
79662                 case bs.R16F:
79663                  return e.R16F;
79664
79665                 case bs.RG16I:
79666                  return e.RG16I;
79667
79668                 case bs.RG16UI:
79669                  return e.RG16UI;
79670
79671                 case bs.RG16F:
79672                  return e.RG16F;
79673
79674                 case bs.RGB16I:
79675                  return e.RGB16I;
79676
79677                 case bs.RGB16UI:
79678                  return e.RGB16UI;
79679
79680                 case bs.RGB16F:
79681                  return e.RGB16F;
79682
79683                 case bs.RGBA16I:
79684                  return e.RGBA16I;
79685
79686                 case bs.RGBA16UI:
79687                  return e.RGBA16UI;
79688
79689                 case bs.RGBA16F:
79690                  return e.RGBA16F;
79691
79692                 case bs.R32I:
79693                  return e.R32I;
79694
79695                 case bs.R32UI:
79696                  return e.R32UI;
79697
79698                 case bs.R32F:
79699                  return e.R32F;
79700
79701                 case bs.RG32I:
79702                  return e.RG32I;
79703
79704                 case bs.RG32UI:
79705                  return e.RG32UI;
79706
79707                 case bs.RG32F:
79708                  return e.RG32F;
79709
79710                 case bs.RGB32I:
79711                  return e.RGB32I;
79712
79713                 case bs.RGB32UI:
79714                  return e.RGB32UI;
79715
79716                 case bs.RGB32F:
79717                  return e.RGB32F;
79718
79719                 case bs.RGBA32I:
79720                  return e.RGBA32I;
79721
79722                 case bs.RGBA32UI:
79723                  return e.RGBA32UI;
79724
79725                 case bs.RGBA32F:
79726                  return e.RGBA32F;
79727
79728                 case bs.R5G6B5:
79729                  return e.RGB565;
79730
79731                 case bs.RGB5A1:
79732                  return e.RGB5_A1;
79733
79734                 case bs.RGBA4:
79735                  return e.RGBA4;
79736
79737                 case bs.SRGB8:
79738                  return e.SRGB8;
79739
79740                 case bs.SRGB8_A8:
79741                  return e.SRGB8_ALPHA8;
79742
79743                 case bs.RGB10A2:
79744                  return e.RGB10_A2;
79745
79746                 case bs.RGB10A2UI:
79747                  return e.RGB10_A2UI;
79748
79749                 case bs.R11G11B10F:
79750                  return e.R11F_G11F_B10F;
79751
79752                 case bs.DEPTH:
79753                  return e.DEPTH_COMPONENT32F;
79754
79755                 case bs.DEPTH_STENCIL:
79756                  return e.DEPTH24_STENCIL8;
79757
79758                 case bs.BC1:
79759                  return K7.COMPRESSED_RGB_S3TC_DXT1_EXT;
79760
79761                 case bs.BC1_ALPHA:
79762                  return K7.COMPRESSED_RGBA_S3TC_DXT1_EXT;
79763
79764                 case bs.BC1_SRGB:
79765                  return K7.COMPRESSED_SRGB_S3TC_DXT1_EXT;
79766
79767                 case bs.BC1_SRGB_ALPHA:
79768                  return K7.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
79769
79770                 case bs.BC2:
79771                  return K7.COMPRESSED_RGBA_S3TC_DXT3_EXT;
79772
79773                 case bs.BC2_SRGB:
79774                  return K7.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
79775
79776                 case bs.BC3:
79777                  return K7.COMPRESSED_RGBA_S3TC_DXT5_EXT;
79778
79779                 case bs.BC3_SRGB:
79780                  return K7.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
79781
79782                 case bs.ETC_RGB8:
79783                  return K7.COMPRESSED_RGB_ETC1_WEBGL;
79784
79785                 case bs.ETC2_RGB8:
79786                  return K7.COMPRESSED_RGB8_ETC2;
79787
79788                 case bs.ETC2_SRGB8:
79789                  return K7.COMPRESSED_SRGB8_ETC2;
79790
79791                 case bs.ETC2_RGB8_A1:
79792                  return K7.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
79793
79794                 case bs.ETC2_SRGB8_A1:
79795                  return K7.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
79796
79797                 case bs.ETC2_RGBA8:
79798                  return K7.COMPRESSED_RGBA8_ETC2_EAC;
79799
79800                 case bs.ETC2_SRGB8_A8:
79801                  return K7.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
79802
79803                 case bs.EAC_R11:
79804                  return K7.COMPRESSED_R11_EAC;
79805
79806                 case bs.EAC_R11SN:
79807                  return K7.COMPRESSED_SIGNED_R11_EAC;
79808
79809                 case bs.EAC_RG11:
79810                  return K7.COMPRESSED_RG11_EAC;
79811
79812                 case bs.EAC_RG11SN:
79813                  return K7.COMPRESSED_SIGNED_RG11_EAC;
79814
79815                 case bs.PVRTC_RGB2:
79816                  return K7.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
79817
79818                 case bs.PVRTC_RGBA2:
79819                  return K7.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
79820
79821                 case bs.PVRTC_RGB4:
79822                  return K7.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
79823
79824                 case bs.PVRTC_RGBA4:
79825                  return K7.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
79826
79827                 case bs.ASTC_RGBA_4X4:
79828                  return K7.COMPRESSED_RGBA_ASTC_4x4_KHR;
79829
79830                 case bs.ASTC_RGBA_5X4:
79831                  return K7.COMPRESSED_RGBA_ASTC_5x4_KHR;
79832
79833                 case bs.ASTC_RGBA_5X5:
79834                  return K7.COMPRESSED_RGBA_ASTC_5x5_KHR;
79835
79836                 case bs.ASTC_RGBA_6X5:
79837                  return K7.COMPRESSED_RGBA_ASTC_6x5_KHR;
79838
79839                 case bs.ASTC_RGBA_6X6:
79840                  return K7.COMPRESSED_RGBA_ASTC_6x6_KHR;
79841
79842                 case bs.ASTC_RGBA_8X5:
79843                  return K7.COMPRESSED_RGBA_ASTC_8x5_KHR;
79844
79845                 case bs.ASTC_RGBA_8X6:
79846                  return K7.COMPRESSED_RGBA_ASTC_8x6_KHR;
79847
79848                 case bs.ASTC_RGBA_8X8:
79849                  return K7.COMPRESSED_RGBA_ASTC_8x8_KHR;
79850
79851                 case bs.ASTC_RGBA_10X5:
79852                  return K7.COMPRESSED_RGBA_ASTC_10x5_KHR;
79853
79854                 case bs.ASTC_RGBA_10X6:
79855                  return K7.COMPRESSED_RGBA_ASTC_10x6_KHR;
79856
79857                 case bs.ASTC_RGBA_10X8:
79858                  return K7.COMPRESSED_RGBA_ASTC_10x8_KHR;
79859
79860                 case bs.ASTC_RGBA_10X10:
79861                  return K7.COMPRESSED_RGBA_ASTC_10x10_KHR;
79862
79863                 case bs.ASTC_RGBA_12X10:
79864                  return K7.COMPRESSED_RGBA_ASTC_12x10_KHR;
79865
79866                 case bs.ASTC_RGBA_12X12:
79867                  return K7.COMPRESSED_RGBA_ASTC_12x12_KHR;
79868
79869                 case bs.ASTC_SRGBA_4X4:
79870                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
79871
79872                 case bs.ASTC_SRGBA_5X4:
79873                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
79874
79875                 case bs.ASTC_SRGBA_5X5:
79876                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
79877
79878                 case bs.ASTC_SRGBA_6X5:
79879                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
79880
79881                 case bs.ASTC_SRGBA_6X6:
79882                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
79883
79884                 case bs.ASTC_SRGBA_8X5:
79885                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
79886
79887                 case bs.ASTC_SRGBA_8X6:
79888                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
79889
79890                 case bs.ASTC_SRGBA_8X8:
79891                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
79892
79893                 case bs.ASTC_SRGBA_10X5:
79894                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
79895
79896                 case bs.ASTC_SRGBA_10X6:
79897                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
79898
79899                 case bs.ASTC_SRGBA_10X8:
79900                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
79901
79902                 case bs.ASTC_SRGBA_10X10:
79903                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
79904
79905                 case bs.ASTC_SRGBA_12X10:
79906                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
79907
79908                 case bs.ASTC_SRGBA_12X12:
79909                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
79910
79911                 default:
79912                  console.error("Unsupported Format, convert to WebGL internal format failed.");
79913                  return e.RGBA;
79914                }
79915              }(e.format, i);
79916              e.glFormat = function(t, e) {
79917                switch (t) {
79918                 case bs.A8:
79919                  return e.ALPHA;
79920
79921                 case bs.L8:
79922                  return e.LUMINANCE;
79923
79924                 case bs.LA8:
79925                  return e.LUMINANCE_ALPHA;
79926
79927                 case bs.R8:
79928                 case bs.R8SN:
79929                 case bs.R8UI:
79930                 case bs.R8I:
79931                  return e.RED;
79932
79933                 case bs.RG8:
79934                 case bs.RG8SN:
79935                 case bs.RG8UI:
79936                 case bs.RG8I:
79937                  return e.RG;
79938
79939                 case bs.RGB8:
79940                 case bs.RGB8SN:
79941                 case bs.RGB8UI:
79942                 case bs.RGB8I:
79943                  return e.RGB;
79944
79945                 case bs.BGRA8:
79946                 case bs.RGBA8:
79947                 case bs.RGBA8SN:
79948                 case bs.RGBA8UI:
79949                 case bs.RGBA8I:
79950                  return e.RGBA;
79951
79952                 case bs.R16UI:
79953                 case bs.R16I:
79954                 case bs.R16F:
79955                  return e.RED;
79956
79957                 case bs.RG16UI:
79958                 case bs.RG16I:
79959                 case bs.RG16F:
79960                  return e.RG;
79961
79962                 case bs.RGB16UI:
79963                 case bs.RGB16I:
79964                 case bs.RGB16F:
79965                  return e.RGB;
79966
79967                 case bs.RGBA16UI:
79968                 case bs.RGBA16I:
79969                 case bs.RGBA16F:
79970                  return e.RGBA;
79971
79972                 case bs.R32UI:
79973                 case bs.R32I:
79974                 case bs.R32F:
79975                  return e.RED;
79976
79977                 case bs.RG32UI:
79978                 case bs.RG32I:
79979                 case bs.RG32F:
79980                  return e.RG;
79981
79982                 case bs.RGB32UI:
79983                 case bs.RGB32I:
79984                 case bs.RGB32F:
79985                  return e.RGB;
79986
79987                 case bs.RGBA32UI:
79988                 case bs.RGBA32I:
79989                 case bs.RGBA32F:
79990                 case bs.RGB10A2:
79991                  return e.RGBA;
79992
79993                 case bs.R11G11B10F:
79994                 case bs.R5G6B5:
79995                  return e.RGB;
79996
79997                 case bs.RGB5A1:
79998                 case bs.RGBA4:
79999                  return e.RGBA;
80000
80001                 case bs.SRGB8:
80002                  return e.RGB;
80003
80004                 case bs.SRGB8_A8:
80005                  return e.RGBA;
80006
80007                 case bs.DEPTH:
80008                  return e.DEPTH_COMPONENT;
80009
80010                 case bs.DEPTH_STENCIL:
80011                  return e.DEPTH_STENCIL;
80012
80013                 case bs.BC1:
80014                  return K7.COMPRESSED_RGB_S3TC_DXT1_EXT;
80015
80016                 case bs.BC1_ALPHA:
80017                  return K7.COMPRESSED_RGBA_S3TC_DXT1_EXT;
80018
80019                 case bs.BC1_SRGB:
80020                  return K7.COMPRESSED_SRGB_S3TC_DXT1_EXT;
80021
80022                 case bs.BC1_SRGB_ALPHA:
80023                  return K7.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
80024
80025                 case bs.BC2:
80026                  return K7.COMPRESSED_RGBA_S3TC_DXT3_EXT;
80027
80028                 case bs.BC2_SRGB:
80029                  return K7.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
80030
80031                 case bs.BC3:
80032                  return K7.COMPRESSED_RGBA_S3TC_DXT5_EXT;
80033
80034                 case bs.BC3_SRGB:
80035                  return K7.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
80036
80037                 case bs.ETC_RGB8:
80038                  return K7.COMPRESSED_RGB_ETC1_WEBGL;
80039
80040                 case bs.ETC2_RGB8:
80041                  return K7.COMPRESSED_RGB8_ETC2;
80042
80043                 case bs.ETC2_SRGB8:
80044                  return K7.COMPRESSED_SRGB8_ETC2;
80045
80046                 case bs.ETC2_RGB8_A1:
80047                  return K7.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
80048
80049                 case bs.ETC2_SRGB8_A1:
80050                  return K7.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
80051
80052                 case bs.ETC2_RGBA8:
80053                  return K7.COMPRESSED_RGBA8_ETC2_EAC;
80054
80055                 case bs.ETC2_SRGB8_A8:
80056                  return K7.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
80057
80058                 case bs.EAC_R11:
80059                  return K7.COMPRESSED_R11_EAC;
80060
80061                 case bs.EAC_R11SN:
80062                  return K7.COMPRESSED_SIGNED_R11_EAC;
80063
80064                 case bs.EAC_RG11:
80065                  return K7.COMPRESSED_RG11_EAC;
80066
80067                 case bs.EAC_RG11SN:
80068                  return K7.COMPRESSED_SIGNED_RG11_EAC;
80069
80070                 case bs.PVRTC_RGB2:
80071                  return K7.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
80072
80073                 case bs.PVRTC_RGBA2:
80074                  return K7.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
80075
80076                 case bs.PVRTC_RGB4:
80077                  return K7.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
80078
80079                 case bs.PVRTC_RGBA4:
80080                  return K7.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
80081
80082                 case bs.ASTC_RGBA_4X4:
80083                  return K7.COMPRESSED_RGBA_ASTC_4x4_KHR;
80084
80085                 case bs.ASTC_RGBA_5X4:
80086                  return K7.COMPRESSED_RGBA_ASTC_5x4_KHR;
80087
80088                 case bs.ASTC_RGBA_5X5:
80089                  return K7.COMPRESSED_RGBA_ASTC_5x5_KHR;
80090
80091                 case bs.ASTC_RGBA_6X5:
80092                  return K7.COMPRESSED_RGBA_ASTC_6x5_KHR;
80093
80094                 case bs.ASTC_RGBA_6X6:
80095                  return K7.COMPRESSED_RGBA_ASTC_6x6_KHR;
80096
80097                 case bs.ASTC_RGBA_8X5:
80098                  return K7.COMPRESSED_RGBA_ASTC_8x5_KHR;
80099
80100                 case bs.ASTC_RGBA_8X6:
80101                  return K7.COMPRESSED_RGBA_ASTC_8x6_KHR;
80102
80103                 case bs.ASTC_RGBA_8X8:
80104                  return K7.COMPRESSED_RGBA_ASTC_8x8_KHR;
80105
80106                 case bs.ASTC_RGBA_10X5:
80107                  return K7.COMPRESSED_RGBA_ASTC_10x5_KHR;
80108
80109                 case bs.ASTC_RGBA_10X6:
80110                  return K7.COMPRESSED_RGBA_ASTC_10x6_KHR;
80111
80112                 case bs.ASTC_RGBA_10X8:
80113                  return K7.COMPRESSED_RGBA_ASTC_10x8_KHR;
80114
80115                 case bs.ASTC_RGBA_10X10:
80116                  return K7.COMPRESSED_RGBA_ASTC_10x10_KHR;
80117
80118                 case bs.ASTC_RGBA_12X10:
80119                  return K7.COMPRESSED_RGBA_ASTC_12x10_KHR;
80120
80121                 case bs.ASTC_RGBA_12X12:
80122                  return K7.COMPRESSED_RGBA_ASTC_12x12_KHR;
80123
80124                 case bs.ASTC_SRGBA_4X4:
80125                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
80126
80127                 case bs.ASTC_SRGBA_5X4:
80128                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
80129
80130                 case bs.ASTC_SRGBA_5X5:
80131                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
80132
80133                 case bs.ASTC_SRGBA_6X5:
80134                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
80135
80136                 case bs.ASTC_SRGBA_6X6:
80137                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
80138
80139                 case bs.ASTC_SRGBA_8X5:
80140                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
80141
80142                 case bs.ASTC_SRGBA_8X6:
80143                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
80144
80145                 case bs.ASTC_SRGBA_8X8:
80146                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
80147
80148                 case bs.ASTC_SRGBA_10X5:
80149                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
80150
80151                 case bs.ASTC_SRGBA_10X6:
80152                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
80153
80154                 case bs.ASTC_SRGBA_10X8:
80155                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
80156
80157                 case bs.ASTC_SRGBA_10X10:
80158                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
80159
80160                 case bs.ASTC_SRGBA_12X10:
80161                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
80162
80163                 case bs.ASTC_SRGBA_12X12:
80164                  return K7.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
80165
80166                 default:
80167                  console.error("Unsupported Format, convert to WebGL format failed.");
80168                  return e.RGBA;
80169                }
80170              }(e.format, i);
80171              e.glType = $7(e.format, i);
80172              let s = e.width;
80173              let n = e.height;
80174              switch (e.type) {
80175               case xs.TEX2D:
80176                {
80177                  e.glTarget = i.TEXTURE_2D;
80178                  if (e.isSwapchainTexture) break;
80179                  const r = Math.max(s, n);
80180                  r > t.capabilities.maxTextureSize && F(9100, r, t.capabilities.maxTextureSize);
80181                  if (e.samples === Ms.ONE) {
80182                    e.glTexture = i.createTexture();
80183                    if (e.size > 0) {
80184                      const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
80185                      if (r.glTexture !== e.glTexture) {
80186                        i.bindTexture(i.TEXTURE_2D, e.glTexture);
80187                        r.glTexture = e.glTexture;
80188                      }
80189                      if (ur[e.format].isCompressed) for (let t = 0; t < e.mipLevel; ++t) {
80190                        const r = gr(e.format, s, n, 1);
80191                        const o = new Uint8Array(r);
80192                        i.compressedTexImage2D(i.TEXTURE_2D, t, e.glInternalFmt, s, n, 0, o);
80193                        s = Math.max(1, s >> 1);
80194                        n = Math.max(1, n >> 1);
80195                      } else i.texStorage2D(i.TEXTURE_2D, e.mipLevel, e.glInternalFmt, s, n);
80196                    }
80197                  } else {
80198                    e.glRenderbuffer = i.createRenderbuffer();
80199                    if (e.size > 0) {
80200                      if (t.stateCache.glRenderbuffer !== e.glRenderbuffer) {
80201                        i.bindRenderbuffer(i.RENDERBUFFER, e.glRenderbuffer);
80202                        t.stateCache.glRenderbuffer = e.glRenderbuffer;
80203                      }
80204                      i.renderbufferStorageMultisample(i.RENDERBUFFER, e.samples, e.glInternalFmt, e.width, e.height);
80205                    }
80206                  }
80207                  break;
80208                }
80209
80210               case xs.CUBE:
80211                {
80212                  e.glTarget = i.TEXTURE_CUBE_MAP;
80213                  const r = Math.max(s, n);
80214                  r > t.capabilities.maxCubeMapTextureSize && F(9100, r, t.capabilities.maxTextureSize);
80215                  e.glTexture = i.createTexture();
80216                  if (e.size > 0) {
80217                    const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
80218                    if (r.glTexture !== e.glTexture) {
80219                      i.bindTexture(i.TEXTURE_CUBE_MAP, e.glTexture);
80220                      r.glTexture = e.glTexture;
80221                    }
80222                    if (ur[e.format].isCompressed) for (let t = 0; t < e.mipLevel; ++t) {
80223                      const r = gr(e.format, s, n, 1);
80224                      const o = new Uint8Array(r);
80225                      for (let r = 0; r < 6; ++r) i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + r, t, e.glInternalFmt, s, n, 0, o);
80226                      s = Math.max(1, s >> 1);
80227                      n = Math.max(1, n >> 1);
80228                    } else i.texStorage2D(i.TEXTURE_CUBE_MAP, e.mipLevel, e.glInternalFmt, s, n);
80229                  }
80230                  break;
80231                }
80232
80233               default:
80234                console.error("Unsupported TextureType, create texture failed.");
80235                e.type = xs.TEX2D;
80236                e.glTarget = i.TEXTURE_2D;
80237              }
80238            }
80239            function y9(t, e) {
80240              const {gl: i} = t;
80241              if (e.glTexture) {
80242                const s = t.stateCache.glTexUnits;
80243                let n = t.stateCache.texUnit;
80244                i.deleteTexture(e.glTexture);
80245                for (let t = 0; t < s.length; ++t) if (s[t].glTexture === e.glTexture) {
80246                  i.activeTexture(i.TEXTURE0 + t);
80247                  n = t;
80248                  i.bindTexture(e.glTarget, null);
80249                  s[t].glTexture = null;
80250                }
80251                t.stateCache.texUnit = n;
80252                e.glTexture = null;
80253              }
80254              if (e.glRenderbuffer) {
80255                let s = t.stateCache.glRenderbuffer;
80256                i.deleteRenderbuffer(e.glRenderbuffer);
80257                if (s === e.glRenderbuffer) {
80258                  i.bindRenderbuffer(i.RENDERBUFFER, null);
80259                  s = null;
80260                }
80261                e.glRenderbuffer = null;
80262              }
80263            }
80264            const b9 = {
80265              gpuPipelineState: null,
80266              gpuInputAssembler: null,
80267              glPrimitive: 0,
80268              invalidateAttachments: []
80269            };
80270            function S9(t, e, i, s, n, r, o) {
80271              const {gl: a} = t;
80272              const l = t.stateCache;
80273              let h = 0;
80274              if (i && e) {
80275                if (l.glFramebuffer !== i.glFramebuffer) {
80276                  a.bindFramebuffer(a.FRAMEBUFFER, i.glFramebuffer);
80277                  l.glFramebuffer = i.glFramebuffer;
80278                }
80279                if (l.viewport.left !== s.x || l.viewport.top !== s.y || l.viewport.width !== s.width || l.viewport.height !== s.height) {
80280                  a.viewport(s.x, s.y, s.width, s.height);
80281                  l.viewport.left = s.x;
80282                  l.viewport.top = s.y;
80283                  l.viewport.width = s.width;
80284                  l.viewport.height = s.height;
80285                }
80286                if (l.scissorRect.x !== s.x || l.scissorRect.y !== s.y || l.scissorRect.width !== s.width || l.scissorRect.height !== s.height) {
80287                  a.scissor(s.x, s.y, s.width, s.height);
80288                  l.scissorRect.x = s.x;
80289                  l.scissorRect.y = s.y;
80290                  l.scissorRect.width = s.width;
80291                  l.scissorRect.height = s.height;
80292                }
80293                b9.invalidateAttachments.length = 0;
80294                for (let t = 0; t < n.length; ++t) {
80295                  const s = e.colorAttachments[t];
80296                  if (s.format !== bs.UNKNOWN) switch (s.loadOp) {
80297                   case Us.LOAD:
80298                    break;
80299
80300                   case Us.CLEAR:
80301                    l.bs.targets[0].blendColorMask !== Vs.ALL && a.colorMask(!0, !0, !0, !0);
80302                    if (i.isOffscreen) {
80303                      Q7[0] = n[t].x;
80304                      Q7[1] = n[t].y;
80305                      Q7[2] = n[t].z;
80306                      Q7[3] = n[t].w;
80307                      a.clearBufferfv(a.COLOR, t, Q7);
80308                    } else {
80309                      const t = n[0];
80310                      a.clearColor(t.x, t.y, t.z, t.w);
80311                      h |= a.COLOR_BUFFER_BIT;
80312                    }
80313                    break;
80314
80315                   case Us.DISCARD:
80316                    b9.invalidateAttachments.push(a.COLOR_ATTACHMENT0 + t);
80317                  }
80318                }
80319                if (e.depthStencilAttachment && e.depthStencilAttachment.format !== bs.UNKNOWN) {
80320                  switch (e.depthStencilAttachment.depthLoadOp) {
80321                   case Us.LOAD:
80322                    break;
80323
80324                   case Us.CLEAR:
80325                    l.dss.depthWrite || a.depthMask(!0);
80326                    a.clearDepth(r);
80327                    h |= a.DEPTH_BUFFER_BIT;
80328                    break;
80329
80330                   case Us.DISCARD:
80331                    b9.invalidateAttachments.push(a.DEPTH_ATTACHMENT);
80332                  }
80333                  if (ur[e.depthStencilAttachment.format].hasStencil) switch (e.depthStencilAttachment.stencilLoadOp) {
80334                   case Us.LOAD:
80335                    break;
80336
80337                   case Us.CLEAR:
80338                    l.dss.stencilWriteMaskFront || a.stencilMaskSeparate(a.FRONT, 65535);
80339                    l.dss.stencilWriteMaskBack || a.stencilMaskSeparate(a.BACK, 65535);
80340                    a.clearStencil(o);
80341                    h |= a.STENCIL_BUFFER_BIT;
80342                    break;
80343
80344                   case Us.DISCARD:
80345                    b9.invalidateAttachments.push(a.STENCIL_ATTACHMENT);
80346                  }
80347                }
80348                i.glFramebuffer && b9.invalidateAttachments.length && a.invalidateFramebuffer(a.FRAMEBUFFER, b9.invalidateAttachments);
80349                h && a.clear(h);
80350                if (h & a.COLOR_BUFFER_BIT) {
80351                  const t = l.bs.targets[0].blendColorMask;
80352                  if (t !== Vs.ALL) {
80353                    const e = (t & Vs.R) !== Vs.NONE;
80354                    const i = (t & Vs.G) !== Vs.NONE;
80355                    const s = (t & Vs.B) !== Vs.NONE;
80356                    const n = (t & Vs.A) !== Vs.NONE;
80357                    a.colorMask(e, i, s, n);
80358                  }
80359                }
80360                h & a.DEPTH_BUFFER_BIT && !l.dss.depthWrite && a.depthMask(!1);
80361                if (h & a.STENCIL_BUFFER_BIT) {
80362                  l.dss.stencilWriteMaskFront || a.stencilMaskSeparate(a.FRONT, 0);
80363                  l.dss.stencilWriteMaskBack || a.stencilMaskSeparate(a.BACK, 0);
80364                }
80365              }
80366            }
80367            function A9(t, e, i, s, n, r) {
80368              const {gl: o} = t;
80369              const a = t.stateCache;
80370              const l = e && e.gpuShader;
80371              let h = !1;
80372              if (e && b9.gpuPipelineState !== e) {
80373                b9.gpuPipelineState = e;
80374                b9.glPrimitive = e.glPrimitive;
80375                if (l) {
80376                  const {glProgram: t} = l;
80377                  if (a.glProgram !== t) {
80378                    o.useProgram(t);
80379                    a.glProgram = t;
80380                    h = !0;
80381                  }
80382                }
80383                const {rs: i} = e;
80384                if (i) {
80385                  if (a.rs.cullMode !== i.cullMode) {
80386                    switch (i.cullMode) {
80387                     case qs.NONE:
80388                      o.disable(o.CULL_FACE);
80389                      break;
80390
80391                     case qs.FRONT:
80392                      o.enable(o.CULL_FACE);
80393                      o.cullFace(o.FRONT);
80394                      break;
80395
80396                     case qs.BACK:
80397                      o.enable(o.CULL_FACE);
80398                      o.cullFace(o.BACK);
80399                    }
80400                    t.stateCache.rs.cullMode = i.cullMode;
80401                  }
80402                  const e = i.isFrontFaceCCW;
80403                  if (t.stateCache.rs.isFrontFaceCCW !== e) {
80404                    o.frontFace(e ? o.CCW : o.CW);
80405                    t.stateCache.rs.isFrontFaceCCW = e;
80406                  }
80407                  if (t.stateCache.rs.depthBias !== i.depthBias || t.stateCache.rs.depthBiasSlop !== i.depthBiasSlop) {
80408                    o.polygonOffset(i.depthBias, i.depthBiasSlop);
80409                    t.stateCache.rs.depthBias = i.depthBias;
80410                    t.stateCache.rs.depthBiasSlop = i.depthBiasSlop;
80411                  }
80412                  if (t.stateCache.rs.lineWidth !== i.lineWidth) {
80413                    o.lineWidth(i.lineWidth);
80414                    t.stateCache.rs.lineWidth = i.lineWidth;
80415                  }
80416                }
80417                const {dss: s} = e;
80418                if (s) {
80419                  if (a.dss.depthTest !== s.depthTest) {
80420                    s.depthTest ? o.enable(o.DEPTH_TEST) : o.disable(o.DEPTH_TEST);
80421                    a.dss.depthTest = s.depthTest;
80422                  }
80423                  if (a.dss.depthWrite !== s.depthWrite) {
80424                    o.depthMask(s.depthWrite);
80425                    a.dss.depthWrite = s.depthWrite;
80426                  }
80427                  if (a.dss.depthFunc !== s.depthFunc) {
80428                    o.depthFunc(n9[s.depthFunc]);
80429                    a.dss.depthFunc = s.depthFunc;
80430                  }
80431                  if (a.dss.stencilTestFront !== s.stencilTestFront || a.dss.stencilTestBack !== s.stencilTestBack) {
80432                    s.stencilTestFront || s.stencilTestBack ? o.enable(o.STENCIL_TEST) : o.disable(o.STENCIL_TEST);
80433                    a.dss.stencilTestFront = s.stencilTestFront;
80434                    a.dss.stencilTestBack = s.stencilTestBack;
80435                  }
80436                  if (a.dss.stencilFuncFront !== s.stencilFuncFront || a.dss.stencilRefFront !== s.stencilRefFront || a.dss.stencilReadMaskFront !== s.stencilReadMaskFront) {
80437                    o.stencilFuncSeparate(o.FRONT, n9[s.stencilFuncFront], s.stencilRefFront, s.stencilReadMaskFront);
80438                    a.dss.stencilFuncFront = s.stencilFuncFront;
80439                    a.dss.stencilRefFront = s.stencilRefFront;
80440                    a.dss.stencilReadMaskFront = s.stencilReadMaskFront;
80441                  }
80442                  if (a.dss.stencilFailOpFront !== s.stencilFailOpFront || a.dss.stencilZFailOpFront !== s.stencilZFailOpFront || a.dss.stencilPassOpFront !== s.stencilPassOpFront) {
80443                    o.stencilOpSeparate(o.FRONT, r9[s.stencilFailOpFront], r9[s.stencilZFailOpFront], r9[s.stencilPassOpFront]);
80444                    a.dss.stencilFailOpFront = s.stencilFailOpFront;
80445                    a.dss.stencilZFailOpFront = s.stencilZFailOpFront;
80446                    a.dss.stencilPassOpFront = s.stencilPassOpFront;
80447                  }
80448                  if (a.dss.stencilWriteMaskFront !== s.stencilWriteMaskFront) {
80449                    o.stencilMaskSeparate(o.FRONT, s.stencilWriteMaskFront);
80450                    a.dss.stencilWriteMaskFront = s.stencilWriteMaskFront;
80451                  }
80452                  if (a.dss.stencilFuncBack !== s.stencilFuncBack || a.dss.stencilRefBack !== s.stencilRefBack || a.dss.stencilReadMaskBack !== s.stencilReadMaskBack) {
80453                    o.stencilFuncSeparate(o.BACK, n9[s.stencilFuncBack], s.stencilRefBack, s.stencilReadMaskBack);
80454                    a.dss.stencilFuncBack = s.stencilFuncBack;
80455                    a.dss.stencilRefBack = s.stencilRefBack;
80456                    a.dss.stencilReadMaskBack = s.stencilReadMaskBack;
80457                  }
80458                  if (a.dss.stencilFailOpBack !== s.stencilFailOpBack || a.dss.stencilZFailOpBack !== s.stencilZFailOpBack || a.dss.stencilPassOpBack !== s.stencilPassOpBack) {
80459                    o.stencilOpSeparate(o.BACK, r9[s.stencilFailOpBack], r9[s.stencilZFailOpBack], r9[s.stencilPassOpBack]);
80460                    a.dss.stencilFailOpBack = s.stencilFailOpBack;
80461                    a.dss.stencilZFailOpBack = s.stencilZFailOpBack;
80462                    a.dss.stencilPassOpBack = s.stencilPassOpBack;
80463                  }
80464                  if (a.dss.stencilWriteMaskBack !== s.stencilWriteMaskBack) {
80465                    o.stencilMaskSeparate(o.BACK, s.stencilWriteMaskBack);
80466                    a.dss.stencilWriteMaskBack = s.stencilWriteMaskBack;
80467                  }
80468                }
80469                const {bs: n} = e;
80470                if (n) {
80471                  if (a.bs.isA2C !== n.isA2C) {
80472                    n.isA2C ? o.enable(o.SAMPLE_ALPHA_TO_COVERAGE) : o.disable(o.SAMPLE_ALPHA_TO_COVERAGE);
80473                    a.bs.isA2C = n.isA2C;
80474                  }
80475                  if (a.bs.blendColor.x !== n.blendColor.x || a.bs.blendColor.y !== n.blendColor.y || a.bs.blendColor.z !== n.blendColor.z || a.bs.blendColor.w !== n.blendColor.w) {
80476                    o.blendColor(n.blendColor.x, n.blendColor.y, n.blendColor.z, n.blendColor.w);
80477                    a.bs.blendColor.x = n.blendColor.x;
80478                    a.bs.blendColor.y = n.blendColor.y;
80479                    a.bs.blendColor.z = n.blendColor.z;
80480                    a.bs.blendColor.w = n.blendColor.w;
80481                  }
80482                  const t = n.targets[0];
80483                  const e = a.bs.targets[0];
80484                  if (e.blend !== t.blend) {
80485                    t.blend ? o.enable(o.BLEND) : o.disable(o.BLEND);
80486                    e.blend = t.blend;
80487                  }
80488                  if (e.blendEq !== t.blendEq || e.blendAlphaEq !== t.blendAlphaEq) {
80489                    o.blendEquationSeparate(o9[t.blendEq], o9[t.blendAlphaEq]);
80490                    e.blendEq = t.blendEq;
80491                    e.blendAlphaEq = t.blendAlphaEq;
80492                  }
80493                  if (e.blendSrc !== t.blendSrc || e.blendDst !== t.blendDst || e.blendSrcAlpha !== t.blendSrcAlpha || e.blendDstAlpha !== t.blendDstAlpha) {
80494                    o.blendFuncSeparate(a9[t.blendSrc], a9[t.blendDst], a9[t.blendSrcAlpha], a9[t.blendDstAlpha]);
80495                    e.blendSrc = t.blendSrc;
80496                    e.blendDst = t.blendDst;
80497                    e.blendSrcAlpha = t.blendSrcAlpha;
80498                    e.blendDstAlpha = t.blendDstAlpha;
80499                  }
80500                  if (e.blendColorMask !== t.blendColorMask) {
80501                    o.colorMask((t.blendColorMask & Vs.R) !== Vs.NONE, (t.blendColorMask & Vs.G) !== Vs.NONE, (t.blendColorMask & Vs.B) !== Vs.NONE, (t.blendColorMask & Vs.A) !== Vs.NONE);
80502                    e.blendColorMask = t.blendColorMask;
80503                  }
80504                }
80505              }
80506              if (e && e.gpuPipelineLayout && l) {
80507                const i = l.glBlocks.length;
80508                const {dynamicOffsetIndices: r} = e.gpuPipelineLayout;
80509                for (let t = 0; t < i; t++) {
80510                  const e = l.glBlocks[t];
80511                  const i = s[e.set];
80512                  const h = i && i.descriptorIndices[e.binding];
80513                  const c = h >= 0 && i.gpuDescriptors[h];
80514                  if (!c || !c.gpuBuffer) {
80515                    x(`Buffer binding '${e.name}' at set ${e.set} binding ${e.binding} is not bounded`);
80516                    continue;
80517                  }
80518                  const u = r[e.set];
80519                  const _ = u && u[e.binding];
80520                  let d = c.gpuBuffer.glOffset;
80521                  _ >= 0 && (d += n[_]);
80522                  if (a.glBindUBOs[e.glBinding] !== c.gpuBuffer.glBuffer || a.glBindUBOOffsets[e.glBinding] !== d) {
80523                    d ? o.bindBufferRange(o.UNIFORM_BUFFER, e.glBinding, c.gpuBuffer.glBuffer, d, c.gpuBuffer.size) : o.bindBufferBase(o.UNIFORM_BUFFER, e.glBinding, c.gpuBuffer.glBuffer);
80524                    a.glUniformBuffer = a.glBindUBOs[e.glBinding] = c.gpuBuffer.glBuffer;
80525                    a.glBindUBOOffsets[e.glBinding] = d;
80526                  }
80527                }
80528                const h = l.glSamplerTextures.length;
80529                for (let e = 0; e < h; e++) {
80530                  const i = l.glSamplerTextures[e];
80531                  const n = s[i.set];
80532                  let r = n && n.descriptorIndices[i.binding];
80533                  let h = r >= 0 && n.gpuDescriptors[r];
80534                  for (let e = 0; e < i.units.length; e++) {
80535                    const s = i.units[e];
80536                    const l = a.glTexUnits[s];
80537                    if (!(h && h.gpuTextureView && h.gpuTextureView.gpuTexture && h.gpuSampler)) {
80538                      x(`Sampler binding '${i.name}' at set ${i.set} binding ${i.binding} index ${e} is not bounded`);
80539                      continue;
80540                    }
80541                    const c = h.gpuTextureView;
80542                    const u = c.gpuTexture;
80543                    const _ = c.baseLevel;
80544                    const d = _ + c.levelCount;
80545                    if (u.size > 0) {
80546                      if (l.glTexture !== u.glTexture) {
80547                        if (a.texUnit !== s) {
80548                          o.activeTexture(o.TEXTURE0 + s);
80549                          a.texUnit = s;
80550                        }
80551                        u.glTexture ? o.bindTexture(u.glTarget, u.glTexture) : o.bindTexture(u.glTarget, t.nullTex2D.gpuTexture.glTexture);
80552                        l.glTexture = u.glTexture;
80553                      }
80554                      const {gpuSampler: e} = h;
80555                      const i = e.getGLSampler(t, _, d);
80556                      if (a.glSamplerUnits[s] !== i) {
80557                        o.bindSampler(s, i);
80558                        a.glSamplerUnits[s] = i;
80559                      }
80560                    }
80561                    h = n.gpuDescriptors[++r];
80562                  }
80563                }
80564              }
80565              if (i && l && (h || b9.gpuInputAssembler !== i)) {
80566                b9.gpuInputAssembler = i;
80567                if (t.extensions.useVAO) {
80568                  let t = i.glVAOs.get(l.glProgram);
80569                  if (!t) {
80570                    t = o.createVertexArray();
80571                    i.glVAOs.set(l.glProgram, t);
80572                    o.bindVertexArray(t);
80573                    o.bindBuffer(o.ARRAY_BUFFER, null);
80574                    o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, null);
80575                    a.glArrayBuffer = null;
80576                    a.glElementArrayBuffer = null;
80577                    let e;
80578                    for (let t = 0; t < l.glInputs.length; t++) {
80579                      const s = l.glInputs[t];
80580                      e = null;
80581                      for (let t = 0; t < i.glAttribs.length; t++) {
80582                        const n = i.glAttribs[t];
80583                        if (n.name === s.name) {
80584                          e = n;
80585                          break;
80586                        }
80587                      }
80588                      if (e) {
80589                        if (a.glArrayBuffer !== e.glBuffer) {
80590                          o.bindBuffer(o.ARRAY_BUFFER, e.glBuffer);
80591                          a.glArrayBuffer = e.glBuffer;
80592                        }
80593                        for (let t = 0; t < e.componentCount; ++t) {
80594                          const i = s.glLoc + t;
80595                          const n = e.offset + e.size * t;
80596                          o.enableVertexAttribArray(i);
80597                          a.glCurrentAttribLocs[i] = !0;
80598                          o.vertexAttribPointer(i, e.count, e.glType, e.isNormalized, e.stride, n);
80599                          o.vertexAttribDivisor(i, e.isInstanced ? 1 : 0);
80600                        }
80601                      }
80602                    }
80603                    const s = i.gpuIndexBuffer;
80604                    s && o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, s.glBuffer);
80605                    o.bindVertexArray(null);
80606                    o.bindBuffer(o.ARRAY_BUFFER, null);
80607                    o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, null);
80608                    a.glArrayBuffer = null;
80609                    a.glElementArrayBuffer = null;
80610                  }
80611                  if (a.glVAO !== t) {
80612                    o.bindVertexArray(t);
80613                    a.glVAO = t;
80614                  }
80615                } else {
80616                  for (let e = 0; e < t.capabilities.maxVertexAttributes; ++e) a.glCurrentAttribLocs[e] = !1;
80617                  for (let t = 0; t < l.glInputs.length; t++) {
80618                    const e = l.glInputs[t];
80619                    let s = null;
80620                    for (let t = 0; t < i.glAttribs.length; t++) {
80621                      const n = i.glAttribs[t];
80622                      if (n.name === e.name) {
80623                        s = n;
80624                        break;
80625                      }
80626                    }
80627                    if (s) {
80628                      if (a.glArrayBuffer !== s.glBuffer) {
80629                        o.bindBuffer(o.ARRAY_BUFFER, s.glBuffer);
80630                        a.glArrayBuffer = s.glBuffer;
80631                      }
80632                      for (let t = 0; t < s.componentCount; ++t) {
80633                        const i = e.glLoc + t;
80634                        const n = s.offset + s.size * t;
80635                        if (!a.glEnabledAttribLocs[i] && i >= 0) {
80636                          o.enableVertexAttribArray(i);
80637                          a.glEnabledAttribLocs[i] = !0;
80638                        }
80639                        a.glCurrentAttribLocs[i] = !0;
80640                        o.vertexAttribPointer(i, s.count, s.glType, s.isNormalized, s.stride, n);
80641                        o.vertexAttribDivisor(i, s.isInstanced ? 1 : 0);
80642                      }
80643                    }
80644                  }
80645                  const e = i.gpuIndexBuffer;
80646                  if (e && a.glElementArrayBuffer !== e.glBuffer) {
80647                    o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, e.glBuffer);
80648                    a.glElementArrayBuffer = e.glBuffer;
80649                  }
80650                  for (let e = 0; e < t.capabilities.maxVertexAttributes; ++e) if (a.glEnabledAttribLocs[e] !== a.glCurrentAttribLocs[e]) {
80651                    o.disableVertexAttribArray(e);
80652                    a.glEnabledAttribLocs[e] = !1;
80653                  }
80654                }
80655              }
80656              if (e && e.dynamicStates.length) {
80657                const t = e.dynamicStates.length;
80658                for (let i = 0; i < t; i++) {
80659                  switch (e.dynamicStates[i]) {
80660                   case Ks.LINE_WIDTH:
80661                    if (a.rs.lineWidth !== r.lineWidth) {
80662                      o.lineWidth(r.lineWidth);
80663                      a.rs.lineWidth = r.lineWidth;
80664                    }
80665                    break;
80666
80667                   case Ks.DEPTH_BIAS:
80668                    if (a.rs.depthBias !== r.depthBiasConstant || a.rs.depthBiasSlop !== r.depthBiasSlope) {
80669                      o.polygonOffset(r.depthBiasConstant, r.depthBiasSlope);
80670                      a.rs.depthBias = r.depthBiasConstant;
80671                      a.rs.depthBiasSlop = r.depthBiasSlope;
80672                    }
80673                    break;
80674
80675                   case Ks.BLEND_CONSTANTS:
80676                    {
80677                      const t = r.blendConstant;
80678                      if (a.bs.blendColor.x !== t.x || a.bs.blendColor.y !== t.y || a.bs.blendColor.z !== t.z || a.bs.blendColor.w !== t.w) {
80679                        o.blendColor(t.x, t.y, t.z, t.w);
80680                        a.bs.blendColor.copy(t);
80681                      }
80682                      break;
80683                    }
80684
80685                   case Ks.STENCIL_WRITE_MASK:
80686                    {
80687                      const t = r.stencilStatesFront;
80688                      const e = r.stencilStatesBack;
80689                      if (a.dss.stencilWriteMaskFront !== t.writeMask) {
80690                        o.stencilMaskSeparate(o.FRONT, t.writeMask);
80691                        a.dss.stencilWriteMaskFront = t.writeMask;
80692                      }
80693                      if (a.dss.stencilWriteMaskBack !== e.writeMask) {
80694                        o.stencilMaskSeparate(o.BACK, e.writeMask);
80695                        a.dss.stencilWriteMaskBack = e.writeMask;
80696                      }
80697                      break;
80698                    }
80699
80700                   case Ks.STENCIL_COMPARE_MASK:
80701                    {
80702                      const t = r.stencilStatesFront;
80703                      const e = r.stencilStatesBack;
80704                      if (a.dss.stencilRefFront !== t.reference || a.dss.stencilReadMaskFront !== t.compareMask) {
80705                        o.stencilFuncSeparate(o.FRONT, n9[a.dss.stencilFuncFront], t.reference, t.compareMask);
80706                        a.dss.stencilRefFront = t.reference;
80707                        a.dss.stencilReadMaskFront = t.compareMask;
80708                      }
80709                      if (a.dss.stencilRefBack !== e.reference || a.dss.stencilReadMaskBack !== e.compareMask) {
80710                        o.stencilFuncSeparate(o.BACK, n9[a.dss.stencilFuncBack], e.reference, e.compareMask);
80711                        a.dss.stencilRefBack = e.reference;
80712                        a.dss.stencilReadMaskBack = e.compareMask;
80713                      }
80714                      break;
80715                    }
80716                  }
80717                }
80718              }
80719            }
80720            function T9(t, e) {
80721              const {gl: i} = t;
80722              const {gpuInputAssembler: s, glPrimitive: n} = b9;
80723              const r = t.extensions.WEBGL_multi_draw;
80724              if (s) {
80725                const t = s.gpuIndexBuffer;
80726                if (s.gpuIndirectBuffer) {
80727                  const {indirects: e} = s.gpuIndirectBuffer;
80728                  if (e.drawByIndex) {
80729                    for (let i = 0; i < e.drawCount; i++) e.byteOffsets[i] = e.offsets[i] * t.stride;
80730                    if (r) e.instancedDraw ? r.multiDrawElementsInstancedWEBGL(n, e.counts, 0, s.glIndexType, e.byteOffsets, 0, e.instances, 0, e.drawCount) : r.multiDrawElementsWEBGL(n, e.counts, 0, s.glIndexType, e.byteOffsets, 0, e.drawCount); else for (let t = 0; t < e.drawCount; t++) e.instances[t] ? i.drawElementsInstanced(n, e.counts[t], s.glIndexType, e.byteOffsets[t], e.instances[t]) : i.drawElements(n, e.counts[t], s.glIndexType, e.byteOffsets[t]);
80731                  } else if (r) e.instancedDraw ? r.multiDrawArraysInstancedWEBGL(n, e.offsets, 0, e.counts, 0, e.instances, 0, e.drawCount) : r.multiDrawArraysWEBGL(n, e.offsets, 0, e.counts, 0, e.drawCount); else for (let t = 0; t < e.drawCount; t++) e.instances[t] ? i.drawArraysInstanced(n, e.offsets[t], e.counts[t], e.instances[t]) : i.drawArrays(n, e.offsets[t], e.counts[t]);
80732                } else if (e.instanceCount) if (t) {
80733                  if (e.indexCount > 0) {
80734                    const r = e.firstIndex * t.stride;
80735                    i.drawElementsInstanced(n, e.indexCount, s.glIndexType, r, e.instanceCount);
80736                  }
80737                } else e.vertexCount > 0 && i.drawArraysInstanced(n, e.firstVertex, e.vertexCount, e.instanceCount); else if (t) {
80738                  if (e.indexCount > 0) {
80739                    const r = e.firstIndex * t.stride;
80740                    i.drawElements(n, e.indexCount, s.glIndexType, r);
80741                  }
80742                } else e.vertexCount > 0 && i.drawArrays(n, e.firstVertex, e.vertexCount);
80743              }
80744            }
80745            const v9 = new Array(l9.COUNT);
80746            function E9(t, e) {
80747              v9.fill(0);
80748              for (let i = 0; i < e.cmds.length; ++i) {
80749                const s = e.cmds.array[i];
80750                const n = v9[s]++;
80751                switch (s) {
80752                 case l9.BEGIN_RENDER_PASS:
80753                  {
80754                    const i = e.beginRenderPassCmds.array[n];
80755                    S9(t, i.gpuRenderPass, i.gpuFramebuffer, i.renderArea, i.clearColors, i.clearDepth, i.clearStencil);
80756                    break;
80757                  }
80758
80759                 case l9.BIND_STATES:
80760                  {
80761                    const i = e.bindStatesCmds.array[n];
80762                    A9(t, i.gpuPipelineState, i.gpuInputAssembler, i.gpuDescriptorSets, i.dynamicOffsets, i.dynamicStates);
80763                    break;
80764                  }
80765
80766                 case l9.DRAW:
80767                  T9(t, e.drawCmds.array[n].drawInfo);
80768                  break;
80769
80770                 case l9.UPDATE_BUFFER:
80771                  {
80772                    const i = e.updateBufferCmds.array[n];
80773                    f9(t, i.gpuBuffer, i.buffer, i.offset, i.size);
80774                    break;
80775                  }
80776
80777                 case l9.COPY_BUFFER_TO_TEXTURE:
80778                  {
80779                    const i = e.copyBufferToTextureCmds.array[n];
80780                    w9(t, i.buffers, i.gpuTexture, i.regions);
80781                    break;
80782                  }
80783                }
80784              }
80785            }
80786            let C9 = new Uint8Array(1);
80787            function x9(t, e, i, s, n) {
80788              const r = Tr(e).height;
80789              const o = gr(e, n.width, n.height, n.depth);
80790              const a = gr(e, s.width, 1, 1);
80791              const l = gr(e, s.width, s.height, 1);
80792              const h = gr(e, n.width, 1, 1);
80793              const c = Ar(ur[e]);
80794              C9.byteLength < o && (C9 = new Uint8Array(o));
80795              let u = 0;
80796              let _ = i;
80797              for (let e = 0; e < n.depth; e++) {
80798                _ = i + l * e;
80799                for (let e = 0; e < n.height; e += r) {
80800                  C9.subarray(u, u + h).set(new Uint8Array(t.buffer, t.byteOffset + _, h));
80801                  u += h;
80802                  _ += a;
80803                }
80804              }
80805              return new c(C9.buffer);
80806            }
80807            function w9(t, e, i, s) {
80808              const {gl: n} = t;
80809              const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
80810              if (r.glTexture !== i.glTexture) {
80811                n.bindTexture(i.glTarget, i.glTexture);
80812                r.glTexture = i.glTexture;
80813              }
80814              let o = 0;
80815              let a = 0;
80816              const l = ur[i.format];
80817              const h = Ar(l);
80818              const {isCompressed: c} = l;
80819              const u = Tr(i.format);
80820              const _ = new cn;
80821              const d = new ln;
80822              const p = new cn;
80823              switch (i.glTarget) {
80824               case n.TEXTURE_2D:
80825                for (let t = 0; t < s.length; t++) {
80826                  const r = s[t];
80827                  const a = r.texSubres.mipLevel;
80828                  d.x = 0 === r.texOffset.x ? 0 : vr(r.texOffset.x, u.width);
80829                  d.y = 0 === r.texOffset.y ? 0 : vr(r.texOffset.y, u.height);
80830                  _.width = r.texExtent.width < u.width ? r.texExtent.width : vr(r.texExtent.width, u.width);
80831                  _.height = r.texExtent.height < u.height ? r.texExtent.width : vr(r.texExtent.height, u.height);
80832                  p.width = r.buffStride > 0 ? r.buffStride : _.width;
80833                  p.height = r.buffTexHeight > 0 ? r.buffTexHeight : _.height;
80834                  const l = r.texExtent.width + d.x === i.width >> a ? r.texExtent.width : _.width;
80835                  const m = r.texExtent.height + d.y === i.height >> a ? r.texExtent.height : _.height;
80836                  let f;
80837                  const g = e[o++];
80838                  f = p.width === _.width && p.height === _.height ? new h(g.buffer, g.byteOffset + r.buffOffset) : x9(g, i.format, r.buffOffset, p, _);
80839                  c ? i.glInternalFmt !== K7.COMPRESSED_RGB_ETC1_WEBGL ? n.compressedTexSubImage2D(n.TEXTURE_2D, a, d.x, d.y, l, m, i.glFormat, f) : n.compressedTexImage2D(n.TEXTURE_2D, a, i.glInternalFmt, l, m, 0, f) : n.texSubImage2D(n.TEXTURE_2D, a, d.x, d.y, l, m, i.glFormat, i.glType, f);
80840                }
80841                break;
80842
80843               case n.TEXTURE_2D_ARRAY:
80844                for (let t = 0; t < s.length; t++) {
80845                  const r = s[t];
80846                  const l = r.texSubres.mipLevel;
80847                  d.x = 0 === r.texOffset.x ? 0 : vr(r.texOffset.x, u.width);
80848                  d.y = 0 === r.texOffset.y ? 0 : vr(r.texOffset.y, u.height);
80849                  _.width = r.texExtent.width < u.width ? r.texExtent.width : vr(r.texExtent.width, u.width);
80850                  _.height = r.texExtent.height < u.height ? r.texExtent.width : vr(r.texExtent.height, u.height);
80851                  _.depth = 1;
80852                  p.width = r.buffStride > 0 ? r.buffStride : _.width;
80853                  p.height = r.buffTexHeight > 0 ? r.buffTexHeight : _.height;
80854                  const m = r.texExtent.width + d.x === i.width >> l ? r.texExtent.width : _.width;
80855                  const f = r.texExtent.height + d.y === i.height >> l ? r.texExtent.height : _.height;
80856                  const g = r.texSubres.baseArrayLayer + r.texSubres.layerCount;
80857                  for (a = r.texSubres.baseArrayLayer; a < g; ++a) {
80858                    d.z = a;
80859                    let t;
80860                    const s = e[o++];
80861                    t = p.width === _.width && p.height === _.height ? new h(s.buffer, s.byteOffset + r.buffOffset) : x9(s, i.format, r.buffOffset, p, _);
80862                    c ? i.glInternalFmt !== K7.COMPRESSED_RGB_ETC1_WEBGL ? n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY, l, d.x, d.y, d.z, m, f, _.depth, i.glFormat, t) : n.compressedTexImage3D(n.TEXTURE_2D_ARRAY, l, i.glInternalFmt, m, f, _.depth, 0, t) : n.texSubImage3D(n.TEXTURE_2D_ARRAY, l, d.x, d.y, d.z, m, f, _.depth, i.glFormat, i.glType, t);
80863                  }
80864                }
80865                break;
80866
80867               case n.TEXTURE_3D:
80868                for (let t = 0; t < s.length; t++) {
80869                  const r = s[t];
80870                  const a = r.texSubres.mipLevel;
80871                  d.x = 0 === r.texOffset.x ? 0 : vr(r.texOffset.x, u.width);
80872                  d.y = 0 === r.texOffset.y ? 0 : vr(r.texOffset.y, u.height);
80873                  d.z = r.texOffset.z;
80874                  _.width = r.texExtent.width < u.width ? r.texExtent.width : vr(r.texExtent.width, u.width);
80875                  _.height = r.texExtent.height < u.height ? r.texExtent.width : vr(r.texExtent.height, u.height);
80876                  _.depth = r.texExtent.depth;
80877                  p.width = r.buffStride > 0 ? r.buffStride : _.width;
80878                  p.height = r.buffTexHeight > 0 ? r.buffTexHeight : _.height;
80879                  const l = r.texExtent.width + d.x === i.width >> a ? r.texExtent.width : _.width;
80880                  const m = r.texExtent.height + d.y === i.height >> a ? r.texExtent.height : _.height;
80881                  let f;
80882                  const g = e[o++];
80883                  f = p.width === _.width && p.height === _.height ? new h(g.buffer, g.byteOffset + r.buffOffset) : x9(g, i.format, r.buffOffset, p, _);
80884                  c ? i.glInternalFmt !== K7.COMPRESSED_RGB_ETC1_WEBGL ? n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY, a, d.x, d.y, d.z, l, m, _.depth, i.glFormat, f) : n.compressedTexImage3D(n.TEXTURE_2D_ARRAY, a, i.glInternalFmt, l, m, _.depth, 0, f) : n.texSubImage3D(n.TEXTURE_2D_ARRAY, a, d.x, d.y, d.z, l, m, _.depth, i.glFormat, i.glType, f);
80885                }
80886                break;
80887
80888               case n.TEXTURE_CUBE_MAP:
80889                for (let t = 0; t < s.length; t++) {
80890                  const r = s[t];
80891                  const l = r.texSubres.mipLevel;
80892                  d.x = 0 === r.texOffset.x ? 0 : vr(r.texOffset.x, u.width);
80893                  d.y = 0 === r.texOffset.y ? 0 : vr(r.texOffset.y, u.height);
80894                  _.width = r.texExtent.width < u.width ? r.texExtent.width : vr(r.texExtent.width, u.width);
80895                  _.height = r.texExtent.height < u.height ? r.texExtent.width : vr(r.texExtent.height, u.height);
80896                  p.width = r.buffStride > 0 ? r.buffStride : _.width;
80897                  p.height = r.buffTexHeight > 0 ? r.buffTexHeight : _.height;
80898                  const m = r.texExtent.width + d.x === i.width >> l ? r.texExtent.width : _.width;
80899                  const f = r.texExtent.height + d.y === i.height >> l ? r.texExtent.height : _.height;
80900                  const g = r.texSubres.baseArrayLayer + r.texSubres.layerCount;
80901                  for (a = r.texSubres.baseArrayLayer; a < g; ++a) {
80902                    let t;
80903                    const s = e[o++];
80904                    t = p.width === _.width && p.height === _.height ? new h(s.buffer, s.byteOffset + r.buffOffset) : x9(s, i.format, r.buffOffset, p, _);
80905                    c ? i.glInternalFmt !== K7.COMPRESSED_RGB_ETC1_WEBGL ? n.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, l, d.x, d.y, m, f, i.glFormat, t) : n.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, l, i.glInternalFmt, m, f, 0, t) : n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, l, d.x, d.y, m, f, i.glFormat, i.glType, t);
80906                  }
80907                }
80908                break;
80909
80910               default:
80911                console.error("Unsupported GL texture type, copy buffer to texture failed.");
80912              }
80913              i.flags & Rs.GEN_MIPMAP && n.generateMipmap(i.glTarget);
80914            }
80915            class R9 {
80916              constructor() {
80917                this.counts = void 0;
80918                this.offsets = void 0;
80919                this.instances = void 0;
80920                this.drawCount = 0;
80921                this.drawByIndex = !1;
80922                this.instancedDraw = !1;
80923                this.byteOffsets = void 0;
80924                this._capacity = 4;
80925                this.counts = new Int32Array(this._capacity);
80926                this.offsets = new Int32Array(this._capacity);
80927                this.instances = new Int32Array(this._capacity);
80928                this.byteOffsets = new Int32Array(this._capacity);
80929              }
80930              clearDraws() {
80931                this.drawCount = 0;
80932                this.drawByIndex = !1;
80933                this.instancedDraw = !1;
80934              }
80935              setDrawInfo(t, e) {
80936                this._ensureCapacity(t);
80937                this.drawByIndex = e.indexCount > 0;
80938                this.instancedDraw = !!e.instanceCount;
80939                this.drawCount = Math.max(t + 1, this.drawCount);
80940                if (this.drawByIndex) {
80941                  this.counts[t] = e.indexCount;
80942                  this.offsets[t] = e.firstIndex;
80943                } else {
80944                  this.counts[t] = e.vertexCount;
80945                  this.offsets[t] = e.firstVertex;
80946                }
80947                this.instances[t] = Math.max(1, e.instanceCount);
80948              }
80949              _ensureCapacity(t) {
80950                if (this._capacity > t) return;
80951                this._capacity = l(t);
80952                const e = new Int32Array(this._capacity);
80953                const i = new Int32Array(this._capacity);
80954                const s = new Int32Array(this._capacity);
80955                this.byteOffsets = new Int32Array(this._capacity);
80956                e.set(this.counts);
80957                i.set(this.offsets);
80958                s.set(this.instances);
80959                this.counts = e;
80960                this.offsets = i;
80961                this.instances = s;
80962              }
80963            }
80964            class I9 extends Pr {
80965              constructor(...t) {
80966                super(...t);
80967                this._gpuBuffer = null;
80968              }
80969              get gpuBuffer() {
80970                return this._gpuBuffer;
80971              }
80972              initialize(t) {
80973                if ("buffer" in t) {
80974                  this._isBufferView = !0;
80975                  const e = t.buffer;
80976                  this._usage = e.usage;
80977                  this._memUsage = e.memUsage;
80978                  this._size = this._stride = t.range;
80979                  this._count = 1;
80980                  this._flags = e.flags;
80981                  this._gpuBuffer = {
80982                    usage: this._usage,
80983                    memUsage: this._memUsage,
80984                    size: this._size,
80985                    stride: this._stride,
80986                    buffer: null,
80987                    indirects: e.gpuBuffer.indirects,
80988                    glTarget: e.gpuBuffer.glTarget,
80989                    glBuffer: e.gpuBuffer.glBuffer,
80990                    glOffset: t.offset
80991                  };
80992                } else {
80993                  this._usage = t.usage;
80994                  this._memUsage = t.memUsage;
80995                  this._size = t.size;
80996                  this._stride = Math.max(t.stride || this._size, 1);
80997                  this._count = this._size / this._stride;
80998                  this._flags = t.flags;
80999                  this._gpuBuffer = {
81000                    usage: this._usage,
81001                    memUsage: this._memUsage,
81002                    size: this._size,
81003                    stride: this._stride,
81004                    buffer: null,
81005                    indirects: new R9,
81006                    glTarget: 0,
81007                    glBuffer: null,
81008                    glOffset: 0
81009                  };
81010                  !function(t, e) {
81011                    const {gl: i} = t;
81012                    const s = t.stateCache;
81013                    const n = e.memUsage & Cs.HOST ? i.DYNAMIC_DRAW : i.STATIC_DRAW;
81014                    if (e.usage & Ts.VERTEX) {
81015                      e.glTarget = i.ARRAY_BUFFER;
81016                      const r = i.createBuffer();
81017                      if (r) {
81018                        e.glBuffer = r;
81019                        if (e.size > 0) {
81020                          if (t.extensions.useVAO && s.glVAO) {
81021                            i.bindVertexArray(null);
81022                            s.glVAO = null;
81023                          }
81024                          b9.gpuInputAssembler = null;
81025                          if (t.stateCache.glArrayBuffer !== e.glBuffer) {
81026                            i.bindBuffer(i.ARRAY_BUFFER, e.glBuffer);
81027                            t.stateCache.glArrayBuffer = e.glBuffer;
81028                          }
81029                          i.bufferData(i.ARRAY_BUFFER, e.size, n);
81030                          i.bindBuffer(i.ARRAY_BUFFER, null);
81031                          t.stateCache.glArrayBuffer = null;
81032                        }
81033                      }
81034                    } else if (e.usage & Ts.INDEX) {
81035                      e.glTarget = i.ELEMENT_ARRAY_BUFFER;
81036                      const r = i.createBuffer();
81037                      if (r) {
81038                        e.glBuffer = r;
81039                        if (e.size > 0) {
81040                          if (t.extensions.useVAO && s.glVAO) {
81041                            i.bindVertexArray(null);
81042                            s.glVAO = null;
81043                          }
81044                          b9.gpuInputAssembler = null;
81045                          if (t.stateCache.glElementArrayBuffer !== e.glBuffer) {
81046                            i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, e.glBuffer);
81047                            t.stateCache.glElementArrayBuffer = e.glBuffer;
81048                          }
81049                          i.bufferData(i.ELEMENT_ARRAY_BUFFER, e.size, n);
81050                          i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, null);
81051                          t.stateCache.glElementArrayBuffer = null;
81052                        }
81053                      }
81054                    } else if (e.usage & Ts.UNIFORM) {
81055                      e.glTarget = i.UNIFORM_BUFFER;
81056                      const s = i.createBuffer();
81057                      if (s && e.size > 0) {
81058                        e.glBuffer = s;
81059                        if (t.stateCache.glUniformBuffer !== e.glBuffer) {
81060                          i.bindBuffer(i.UNIFORM_BUFFER, e.glBuffer);
81061                          t.stateCache.glUniformBuffer = e.glBuffer;
81062                        }
81063                        i.bufferData(i.UNIFORM_BUFFER, e.size, n);
81064                        i.bindBuffer(i.UNIFORM_BUFFER, null);
81065                        t.stateCache.glUniformBuffer = null;
81066                      }
81067                    } else if (e.usage & Ts.INDIRECT) e.glTarget = i.NONE; else if (e.usage & Ts.TRANSFER_DST) e.glTarget = i.NONE; else if (e.usage & Ts.TRANSFER_SRC) e.glTarget = i.NONE; else {
81068                      console.error("Unsupported BufferType, create buffer failed.");
81069                      e.glTarget = i.NONE;
81070                    }
81071                  }(J7.instance, this._gpuBuffer);
81072                  J7.instance.memoryStatus.bufferSize += this._size;
81073                }
81074              }
81075              destroy() {
81076                if (this._gpuBuffer) {
81077                  if (!this._isBufferView) {
81078                    !function(t, e) {
81079                      const {gl: i} = t;
81080                      const s = t.stateCache;
81081                      if (e.glBuffer) {
81082                        switch (e.glTarget) {
81083                         case i.ARRAY_BUFFER:
81084                          if (t.extensions.useVAO && s.glVAO) {
81085                            i.bindVertexArray(null);
81086                            t.stateCache.glVAO = null;
81087                          }
81088                          b9.gpuInputAssembler = null;
81089                          i.bindBuffer(i.ARRAY_BUFFER, null);
81090                          t.stateCache.glArrayBuffer = null;
81091                          break;
81092
81093                         case i.ELEMENT_ARRAY_BUFFER:
81094                          if (t.extensions.useVAO && s.glVAO) {
81095                            i.bindVertexArray(null);
81096                            t.stateCache.glVAO = null;
81097                          }
81098                          b9.gpuInputAssembler = null;
81099                          i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, null);
81100                          t.stateCache.glElementArrayBuffer = null;
81101                          break;
81102
81103                         case i.UNIFORM_BUFFER:
81104                          i.bindBuffer(i.UNIFORM_BUFFER, null);
81105                          t.stateCache.glUniformBuffer = null;
81106                        }
81107                        i.deleteBuffer(e.glBuffer);
81108                        e.glBuffer = null;
81109                      }
81110                    }(J7.instance, this._gpuBuffer);
81111                    J7.instance.memoryStatus.bufferSize -= this._size;
81112                  }
81113                  this._gpuBuffer = null;
81114                }
81115              }
81116              resize(t) {
81117                if (this._isBufferView) {
81118                  console.warn("cannot resize buffer views!");
81119                  return;
81120                }
81121                const e = this._size;
81122                if (e !== t) {
81123                  this._size = t;
81124                  this._count = this._size / this._stride;
81125                  if (this._gpuBuffer) {
81126                    this._gpuBuffer.size = t;
81127                    if (t > 0) {
81128                      !function(t, e) {
81129                        const {gl: i} = t;
81130                        const s = t.stateCache;
81131                        const n = e.memUsage & Cs.HOST ? i.DYNAMIC_DRAW : i.STATIC_DRAW;
81132                        if (e.usage & Ts.VERTEX) {
81133                          if (t.extensions.useVAO && s.glVAO) {
81134                            i.bindVertexArray(null);
81135                            s.glVAO = null;
81136                          }
81137                          b9.gpuInputAssembler = null;
81138                          s.glArrayBuffer !== e.glBuffer && i.bindBuffer(i.ARRAY_BUFFER, e.glBuffer);
81139                          e.buffer ? i.bufferData(i.ARRAY_BUFFER, e.buffer, n) : i.bufferData(i.ARRAY_BUFFER, e.size, n);
81140                          i.bindBuffer(i.ARRAY_BUFFER, null);
81141                          s.glArrayBuffer = null;
81142                        } else if (e.usage & Ts.INDEX) {
81143                          if (t.extensions.useVAO && s.glVAO) {
81144                            i.bindVertexArray(null);
81145                            s.glVAO = null;
81146                          }
81147                          b9.gpuInputAssembler = null;
81148                          t.stateCache.glElementArrayBuffer !== e.glBuffer && i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, e.glBuffer);
81149                          e.buffer ? i.bufferData(i.ELEMENT_ARRAY_BUFFER, e.buffer, n) : i.bufferData(i.ELEMENT_ARRAY_BUFFER, e.size, n);
81150                          i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, null);
81151                          t.stateCache.glElementArrayBuffer = null;
81152                        } else if (e.usage & Ts.UNIFORM) {
81153                          t.stateCache.glUniformBuffer !== e.glBuffer && i.bindBuffer(i.UNIFORM_BUFFER, e.glBuffer);
81154                          i.bufferData(i.UNIFORM_BUFFER, e.size, n);
81155                          i.bindBuffer(i.UNIFORM_BUFFER, null);
81156                          t.stateCache.glUniformBuffer = null;
81157                        } else if (e.usage & Ts.INDIRECT || e.usage & Ts.TRANSFER_DST || e.usage & Ts.TRANSFER_SRC) e.glTarget = i.NONE; else {
81158                          console.error("Unsupported BufferType, create buffer failed.");
81159                          e.glTarget = i.NONE;
81160                        }
81161                      }(J7.instance, this._gpuBuffer);
81162                      J7.instance.memoryStatus.bufferSize -= e;
81163                      J7.instance.memoryStatus.bufferSize += t;
81164                    }
81165                  }
81166                }
81167              }
81168              update(t, e) {
81169                if (this._isBufferView) {
81170                  console.warn("cannot update through buffer views!");
81171                  return;
81172                }
81173                let i;
81174                i = void 0 !== e ? e : this._usage & Ts.INDIRECT ? 0 : t.byteLength;
81175                f9(J7.instance, this._gpuBuffer, t, 0, i);
81176              }
81177            }
81178            class M9 {
81179              constructor(t, e) {
81180                this._frees = void 0;
81181                this._freeIdx = 0;
81182                this._freeCmds = void 0;
81183                this._frees = new Array(e);
81184                this._freeCmds = new eo(e);
81185                for (let i = 0; i < e; ++i) this._frees[i] = new t;
81186                this._freeIdx = e - 1;
81187              }
81188              alloc(t) {
81189                if (this._freeIdx < 0) {
81190                  const e = 2 * this._frees.length;
81191                  const i = this._frees;
81192                  this._frees = new Array(e);
81193                  const s = e - i.length;
81194                  for (let e = 0; e < s; ++e) this._frees[e] = new t;
81195                  for (let t = s, n = 0; t < e; ++t, ++n) this._frees[t] = i[n];
81196                  this._freeIdx += s;
81197                }
81198                const e = this._frees[this._freeIdx];
81199                this._frees[this._freeIdx--] = null;
81200                ++e.refCount;
81201                return e;
81202              }
81203              free(t) {
81204                0 == --t.refCount && this._freeCmds.push(t);
81205              }
81206              freeCmds(t) {
81207                for (let e = 0; e < t.length; ++e) 0 == --t.array[e].refCount && this._freeCmds.push(t.array[e]);
81208              }
81209              release() {
81210                for (let t = 0; t < this._freeCmds.length; ++t) {
81211                  const e = this._freeCmds.array[t];
81212                  e.clear();
81213                  this._frees[++this._freeIdx] = e;
81214                }
81215                this._freeCmds.clear();
81216              }
81217            }
81218            class B9 {
81219              constructor() {
81220                this.beginRenderPassCmdPool = void 0;
81221                this.bindStatesCmdPool = void 0;
81222                this.drawCmdPool = void 0;
81223                this.updateBufferCmdPool = void 0;
81224                this.copyBufferToTextureCmdPool = void 0;
81225                this.beginRenderPassCmdPool = new M9(c9, 1);
81226                this.bindStatesCmdPool = new M9(u9, 1);
81227                this.drawCmdPool = new M9(_9, 1);
81228                this.updateBufferCmdPool = new M9(d9, 1);
81229                this.copyBufferToTextureCmdPool = new M9(p9, 1);
81230              }
81231              clearCmds(t) {
81232                if (t.beginRenderPassCmds.length) {
81233                  this.beginRenderPassCmdPool.freeCmds(t.beginRenderPassCmds);
81234                  t.beginRenderPassCmds.clear();
81235                }
81236                if (t.bindStatesCmds.length) {
81237                  this.bindStatesCmdPool.freeCmds(t.bindStatesCmds);
81238                  t.bindStatesCmds.clear();
81239                }
81240                if (t.drawCmds.length) {
81241                  this.drawCmdPool.freeCmds(t.drawCmds);
81242                  t.drawCmds.clear();
81243                }
81244                if (t.updateBufferCmds.length) {
81245                  this.updateBufferCmdPool.freeCmds(t.updateBufferCmds);
81246                  t.updateBufferCmds.clear();
81247                }
81248                if (t.copyBufferToTextureCmds.length) {
81249                  this.copyBufferToTextureCmdPool.freeCmds(t.copyBufferToTextureCmds);
81250                  t.copyBufferToTextureCmds.clear();
81251                }
81252                t.cmds.clear();
81253              }
81254              releaseCmds() {
81255                this.beginRenderPassCmdPool.release();
81256                this.bindStatesCmdPool.release();
81257                this.drawCmdPool.release();
81258                this.updateBufferCmdPool.release();
81259                this.copyBufferToTextureCmdPool.release();
81260              }
81261            }
81262            class D9 extends Or {
81263              constructor(...t) {
81264                super(...t);
81265                this.cmdPackage = new m9;
81266                this._cmdAllocator = new B9;
81267                this._isInRenderPass = !1;
81268                this._curGPUPipelineState = null;
81269                this._curGPUDescriptorSets = [];
81270                this._curGPUInputAssembler = null;
81271                this._curDynamicOffsets = Array(8).fill(0);
81272                this._curDynamicStates = new lr;
81273                this._isStateInvalied = !1;
81274              }
81275              initialize(t) {
81276                this._type = t.type;
81277                this._queue = t.queue;
81278                const e = J7.instance.bindingMappings.blockOffsets.length;
81279                for (let t = 0; t < e; t++) this._curGPUDescriptorSets.push(null);
81280              }
81281              destroy() {
81282                this._cmdAllocator.clearCmds(this.cmdPackage);
81283              }
81284              begin(t, e = 0, i) {
81285                this._cmdAllocator.clearCmds(this.cmdPackage);
81286                this._curGPUPipelineState = null;
81287                this._curGPUInputAssembler = null;
81288                this._curGPUDescriptorSets.length = 0;
81289                this._numDrawCalls = 0;
81290                this._numInstances = 0;
81291                this._numTris = 0;
81292              }
81293              end() {
81294                this._isStateInvalied && this.bindStates();
81295                this._isInRenderPass = !1;
81296              }
81297              beginRenderPass(t, e, i, s, n, r) {
81298                const o = this._cmdAllocator.beginRenderPassCmdPool.alloc(c9);
81299                o.gpuRenderPass = t.gpuRenderPass;
81300                o.gpuFramebuffer = e.gpuFramebuffer;
81301                o.renderArea.copy(i);
81302                for (let t = 0; t < s.length; ++t) o.clearColors[t] = s[t];
81303                o.clearDepth = n;
81304                o.clearStencil = r;
81305                this.cmdPackage.beginRenderPassCmds.push(o);
81306                this.cmdPackage.cmds.push(l9.BEGIN_RENDER_PASS);
81307                this._isInRenderPass = !0;
81308              }
81309              endRenderPass() {
81310                this._isInRenderPass = !1;
81311              }
81312              bindPipelineState(t) {
81313                const e = t.gpuPipelineState;
81314                if (e !== this._curGPUPipelineState) {
81315                  this._curGPUPipelineState = e;
81316                  this._isStateInvalied = !0;
81317                }
81318              }
81319              bindDescriptorSet(t, e, i) {
81320                const s = e.gpuDescriptorSet;
81321                if (s !== this._curGPUDescriptorSets[t]) {
81322                  this._curGPUDescriptorSets[t] = s;
81323                  this._isStateInvalied = !0;
81324                }
81325                if (i) {
81326                  var n;
81327                  const e = null === (n = this._curGPUPipelineState) || void 0 === n ? void 0 : n.gpuPipelineLayout;
81328                  if (e) {
81329                    const s = this._curDynamicOffsets;
81330                    const n = e.dynamicOffsetOffsets[t];
81331                    for (let t = 0; t < i.length; t++) s[n + t] = i[t];
81332                    this._isStateInvalied = !0;
81333                  }
81334                }
81335              }
81336              bindInputAssembler(t) {
81337                const e = t.gpuInputAssembler;
81338                this._curGPUInputAssembler = e;
81339                this._isStateInvalied = !0;
81340              }
81341              setViewport(t) {
81342                const e = this._curDynamicStates.viewport;
81343                if (e.left !== t.left || e.top !== t.top || e.width !== t.width || e.height !== t.height || e.minDepth !== t.minDepth || e.maxDepth !== t.maxDepth) {
81344                  e.left = t.left;
81345                  e.top = t.top;
81346                  e.width = t.width;
81347                  e.height = t.height;
81348                  e.minDepth = t.minDepth;
81349                  e.maxDepth = t.maxDepth;
81350                  this._isStateInvalied = !0;
81351                }
81352              }
81353              setScissor(t) {
81354                const e = this._curDynamicStates.scissor;
81355                if (e.x !== t.x || e.y !== t.y || e.width !== t.width || e.height !== t.height) {
81356                  e.x = t.x;
81357                  e.y = t.y;
81358                  e.width = t.width;
81359                  e.height = t.height;
81360                  this._isStateInvalied = !0;
81361                }
81362              }
81363              setLineWidth(t) {
81364                if (this._curDynamicStates.lineWidth !== t) {
81365                  this._curDynamicStates.lineWidth = t;
81366                  this._isStateInvalied = !0;
81367                }
81368              }
81369              setDepthBias(t, e, i) {
81370                const s = this._curDynamicStates;
81371                if (s.depthBiasConstant !== t || s.depthBiasClamp !== e || s.depthBiasSlope !== i) {
81372                  s.depthBiasConstant = t;
81373                  s.depthBiasClamp = e;
81374                  s.depthBiasSlope = i;
81375                  this._isStateInvalied = !0;
81376                }
81377              }
81378              setBlendConstants(t) {
81379                const e = this._curDynamicStates.blendConstant;
81380                if (e.x !== t.x || e.y !== t.y || e.z !== t.z || e.w !== t.w) {
81381                  e.copy(t);
81382                  this._isStateInvalied = !0;
81383                }
81384              }
81385              setDepthBound(t, e) {
81386                const i = this._curDynamicStates;
81387                if (i.depthMinBounds !== t || i.depthMaxBounds !== e) {
81388                  i.depthMinBounds = t;
81389                  i.depthMaxBounds = e;
81390                  this._isStateInvalied = !0;
81391                }
81392              }
81393              setStencilWriteMask(t, e) {
81394                const i = this._curDynamicStates.stencilStatesFront;
81395                const s = this._curDynamicStates.stencilStatesBack;
81396                if (t & Js.FRONT && i.writeMask !== e) {
81397                  i.writeMask = e;
81398                  this._isStateInvalied = !0;
81399                }
81400                if (t & Js.BACK && s.writeMask !== e) {
81401                  s.writeMask = e;
81402                  this._isStateInvalied = !0;
81403                }
81404              }
81405              setStencilCompareMask(t, e, i) {
81406                const s = this._curDynamicStates.stencilStatesFront;
81407                const n = this._curDynamicStates.stencilStatesBack;
81408                if (t & Js.FRONT && (s.compareMask !== i || s.reference !== e)) {
81409                  s.reference = e;
81410                  s.compareMask = i;
81411                  this._isStateInvalied = !0;
81412                }
81413                if (t & Js.BACK && (n.compareMask !== i || n.reference !== e)) {
81414                  n.reference = e;
81415                  n.compareMask = i;
81416                  this._isStateInvalied = !0;
81417                }
81418              }
81419              draw(t) {
81420                if (this._type === tn.PRIMARY && this._isInRenderPass || this._type === tn.SECONDARY) {
81421                  this._isStateInvalied && this.bindStates();
81422                  const e = "drawInfo" in t ? t.drawInfo : t;
81423                  const i = this._cmdAllocator.drawCmdPool.alloc(_9);
81424                  i.drawInfo.copy(e);
81425                  this.cmdPackage.drawCmds.push(i);
81426                  this.cmdPackage.cmds.push(l9.DRAW);
81427                  ++this._numDrawCalls;
81428                  this._numInstances += e.instanceCount;
81429                  const s = e.indexCount || e.vertexCount;
81430                  if (this._curGPUPipelineState) {
81431                    switch (this._curGPUPipelineState.glPrimitive) {
81432                     case 4:
81433                      this._numTris += s / 3 * Math.max(e.instanceCount, 1);
81434                      break;
81435
81436                     case 5:
81437                     case 6:
81438                      this._numTris += (s - 2) * Math.max(e.instanceCount, 1);
81439                    }
81440                  }
81441                } else console.error("Command 'draw' must be recorded inside a render pass.");
81442              }
81443              updateBuffer(t, e, i) {
81444                if (this._type === tn.PRIMARY && !this._isInRenderPass || this._type === tn.SECONDARY) {
81445                  const s = t.gpuBuffer;
81446                  if (s) {
81447                    const n = this._cmdAllocator.updateBufferCmdPool.alloc(d9);
81448                    let r = 0;
81449                    let o = null;
81450                    if (t.usage & Ts.INDIRECT) o = e; else {
81451                      r = void 0 !== i ? i : e.byteLength;
81452                      o = e;
81453                    }
81454                    n.gpuBuffer = s;
81455                    n.buffer = o;
81456                    n.offset = 0;
81457                    n.size = r;
81458                    this.cmdPackage.updateBufferCmds.push(n);
81459                    this.cmdPackage.cmds.push(l9.UPDATE_BUFFER);
81460                  }
81461                } else console.error("Command 'updateBuffer' must be recorded outside a render pass.");
81462              }
81463              copyBuffersToTexture(t, e, i) {
81464                if (this._type === tn.PRIMARY && !this._isInRenderPass || this._type === tn.SECONDARY) {
81465                  const s = e.gpuTexture;
81466                  if (s) {
81467                    const e = this._cmdAllocator.copyBufferToTextureCmdPool.alloc(p9);
81468                    e.gpuTexture = s;
81469                    e.regions = i;
81470                    e.buffers = t;
81471                    this.cmdPackage.copyBufferToTextureCmds.push(e);
81472                    this.cmdPackage.cmds.push(l9.COPY_BUFFER_TO_TEXTURE);
81473                  }
81474                } else console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.");
81475              }
81476              execute(t, e) {
81477                for (let i = 0; i < e; ++i) {
81478                  const e = t[i];
81479                  for (let t = 0; t < e.cmdPackage.beginRenderPassCmds.length; ++t) {
81480                    const i = e.cmdPackage.beginRenderPassCmds.array[t];
81481                    ++i.refCount;
81482                    this.cmdPackage.beginRenderPassCmds.push(i);
81483                  }
81484                  for (let t = 0; t < e.cmdPackage.bindStatesCmds.length; ++t) {
81485                    const i = e.cmdPackage.bindStatesCmds.array[t];
81486                    ++i.refCount;
81487                    this.cmdPackage.bindStatesCmds.push(i);
81488                  }
81489                  for (let t = 0; t < e.cmdPackage.drawCmds.length; ++t) {
81490                    const i = e.cmdPackage.drawCmds.array[t];
81491                    ++i.refCount;
81492                    this.cmdPackage.drawCmds.push(i);
81493                  }
81494                  for (let t = 0; t < e.cmdPackage.updateBufferCmds.length; ++t) {
81495                    const i = e.cmdPackage.updateBufferCmds.array[t];
81496                    ++i.refCount;
81497                    this.cmdPackage.updateBufferCmds.push(i);
81498                  }
81499                  for (let t = 0; t < e.cmdPackage.copyBufferToTextureCmds.length; ++t) {
81500                    const i = e.cmdPackage.copyBufferToTextureCmds.array[t];
81501                    ++i.refCount;
81502                    this.cmdPackage.copyBufferToTextureCmds.push(i);
81503                  }
81504                  this.cmdPackage.cmds.concat(e.cmdPackage.cmds.array);
81505                  this._numDrawCalls += e._numDrawCalls;
81506                  this._numInstances += e._numInstances;
81507                  this._numTris += e._numTris;
81508                }
81509              }
81510              pipelineBarrier(t, e, i, s, n) {}
81511              bindStates() {
81512                const t = this._cmdAllocator.bindStatesCmdPool.alloc(u9);
81513                t.gpuPipelineState = this._curGPUPipelineState;
81514                Array.prototype.push.apply(t.gpuDescriptorSets, this._curGPUDescriptorSets);
81515                Array.prototype.push.apply(t.dynamicOffsets, this._curDynamicOffsets);
81516                t.gpuInputAssembler = this._curGPUInputAssembler;
81517                t.dynamicStates = this._curDynamicStates;
81518                this.cmdPackage.bindStatesCmds.push(t);
81519                this.cmdPackage.cmds.push(l9.BIND_STATES);
81520                this._isStateInvalied = !1;
81521              }
81522            }
81523            class P9 extends Fr {
81524              constructor(...t) {
81525                super(...t);
81526                this._gpuFramebuffer = null;
81527              }
81528              get gpuFramebuffer() {
81529                return this._gpuFramebuffer;
81530              }
81531              initialize(t) {
81532                this._renderPass = t.renderPass;
81533                this._colorTextures = t.colorTextures || [];
81534                this._depthStencilTexture = t.depthStencilTexture || null;
81535                const e = [];
81536                for (let i = 0; i < t.colorTextures.length; i++) {
81537                  const s = t.colorTextures[i];
81538                  s && e.push(s.gpuTextureView);
81539                }
81540                let i = null;
81541                t.depthStencilTexture && (i = t.depthStencilTexture.gpuTextureView);
81542                let s = Number.MAX_SAFE_INTEGER;
81543                this._gpuFramebuffer = {
81544                  gpuRenderPass: t.renderPass.gpuRenderPass,
81545                  gpuColorViews: e,
81546                  gpuDepthStencilView: i,
81547                  glFramebuffer: null,
81548                  isOffscreen: !0,
81549                  get width() {
81550                    return this.isOffscreen ? s : this.gpuColorViews.length > 0 ? this.gpuColorViews[0].gpuTexture.width : this.gpuDepthStencilView.gpuTexture.width;
81551                  },
81552                  set width(t) {
81553                    s = t;
81554                  },
81555                  get height() {
81556                    return this.isOffscreen ? s : this.gpuColorViews.length > 0 ? this.gpuColorViews[0].gpuTexture.height : this.gpuDepthStencilView.gpuTexture.height;
81557                  },
81558                  set height(t) {}
81559                };
81560                !function(t, e) {
81561                  for (let t = 0; t < e.gpuColorViews.length; ++t) if (e.gpuColorViews[t].gpuTexture.isSwapchainTexture) {
81562                    e.isOffscreen = !1;
81563                    return;
81564                  }
81565                  const {gl: i} = t;
81566                  const s = [];
81567                  const n = i.createFramebuffer();
81568                  if (n) {
81569                    e.glFramebuffer = n;
81570                    t.stateCache.glFramebuffer !== e.glFramebuffer && i.bindFramebuffer(i.FRAMEBUFFER, e.glFramebuffer);
81571                    for (let t = 0; t < e.gpuColorViews.length; ++t) {
81572                      const n = e.gpuColorViews[t];
81573                      const r = n.gpuTexture;
81574                      if (r) {
81575                        r.glTexture ? i.framebufferTexture2D(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0 + t, r.glTarget, r.glTexture, n.baseLevel) : i.framebufferRenderbuffer(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0 + t, i.RENDERBUFFER, r.glRenderbuffer);
81576                        s.push(i.COLOR_ATTACHMENT0 + t);
81577                        e.width = Math.min(e.width, r.width >> n.baseLevel);
81578                        e.height = Math.min(e.height, r.height >> n.baseLevel);
81579                      }
81580                    }
81581                    const r = e.gpuDepthStencilView;
81582                    if (r) {
81583                      const t = r.gpuTexture;
81584                      const s = ur[t.format].hasStencil ? i.DEPTH_STENCIL_ATTACHMENT : i.DEPTH_ATTACHMENT;
81585                      t.glTexture ? i.framebufferTexture2D(i.FRAMEBUFFER, s, t.glTarget, t.glTexture, e.gpuDepthStencilView.baseLevel) : i.framebufferRenderbuffer(i.FRAMEBUFFER, s, i.RENDERBUFFER, t.glRenderbuffer);
81586                      e.width = Math.min(e.width, t.width >> r.baseLevel);
81587                      e.height = Math.min(e.height, t.height >> r.baseLevel);
81588                    }
81589                    i.drawBuffers(s);
81590                    const o = i.checkFramebufferStatus(i.FRAMEBUFFER);
81591                    if (o !== i.FRAMEBUFFER_COMPLETE) switch (o) {
81592                     case i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
81593                      console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
81594                      break;
81595
81596                     case i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
81597                      console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
81598                      break;
81599
81600                     case i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
81601                      console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");
81602                      break;
81603
81604                     case i.FRAMEBUFFER_UNSUPPORTED:
81605                      console.error("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED");
81606                    }
81607                    t.stateCache.glFramebuffer !== e.glFramebuffer && i.bindFramebuffer(i.FRAMEBUFFER, t.stateCache.glFramebuffer);
81608                  }
81609                }(J7.instance, this._gpuFramebuffer);
81610              }
81611              destroy() {
81612                if (this._gpuFramebuffer) {
81613                  !function(t, e) {
81614                    if (e.glFramebuffer) {
81615                      t.gl.deleteFramebuffer(e.glFramebuffer);
81616                      if (t.stateCache.glFramebuffer === e.glFramebuffer) {
81617                        t.gl.bindFramebuffer(t.gl.FRAMEBUFFER, null);
81618                        t.stateCache.glFramebuffer = null;
81619                      }
81620                      e.glFramebuffer = null;
81621                    }
81622                  }(J7.instance, this._gpuFramebuffer);
81623                  this._gpuFramebuffer = null;
81624                }
81625              }
81626            }
81627            class O9 extends Gr {
81628              constructor(...t) {
81629                super(...t);
81630                this._gpuInputAssembler = null;
81631              }
81632              get gpuInputAssembler() {
81633                return this._gpuInputAssembler;
81634              }
81635              initialize(t) {
81636                if (0 === t.vertexBuffers.length) {
81637                  console.error("InputAssemblerInfo.vertexBuffers is null.");
81638                  return;
81639                }
81640                this._attributes = t.attributes;
81641                this._attributesHash = this.computeAttributesHash();
81642                this._vertexBuffers = t.vertexBuffers;
81643                if (t.indexBuffer) {
81644                  this._indexBuffer = t.indexBuffer;
81645                  this._drawInfo.indexCount = this._indexBuffer.size / this._indexBuffer.stride;
81646                  this._drawInfo.firstIndex = 0;
81647                } else {
81648                  const t = this._vertexBuffers[0];
81649                  this._drawInfo.vertexCount = t.size / t.stride;
81650                  this._drawInfo.firstVertex = 0;
81651                  this._drawInfo.vertexOffset = 0;
81652                }
81653                this._drawInfo.instanceCount = 0;
81654                this._drawInfo.firstInstance = 0;
81655                this._indirectBuffer = t.indirectBuffer || null;
81656                const e = new Array(t.vertexBuffers.length);
81657                for (let i = 0; i < t.vertexBuffers.length; ++i) {
81658                  const s = t.vertexBuffers[i];
81659                  s.gpuBuffer && (e[i] = s.gpuBuffer);
81660                }
81661                let i = null;
81662                let s = 0;
81663                if (t.indexBuffer) {
81664                  i = t.indexBuffer.gpuBuffer;
81665                  if (i) switch (i.stride) {
81666                   case 1:
81667                    s = 5121;
81668                    break;
81669
81670                   case 2:
81671                    s = 5123;
81672                    break;
81673
81674                   case 4:
81675                    s = 5125;
81676                    break;
81677
81678                   default:
81679                    console.error("Illegal index buffer stride.");
81680                  }
81681                }
81682                let n = null;
81683                t.indirectBuffer && (n = t.indirectBuffer.gpuBuffer);
81684                this._gpuInputAssembler = {
81685                  attributes: t.attributes,
81686                  gpuVertexBuffers: e,
81687                  gpuIndexBuffer: i,
81688                  gpuIndirectBuffer: n,
81689                  glAttribs: [],
81690                  glIndexType: s,
81691                  glVAOs: new Map
81692                };
81693                !function(t, e) {
81694                  const {gl: i} = t;
81695                  e.glAttribs = new Array(e.attributes.length);
81696                  const s = [ 0, 0, 0, 0, 0, 0, 0, 0 ];
81697                  for (let t = 0; t < e.attributes.length; ++t) {
81698                    const n = e.attributes[t];
81699                    const r = void 0 !== n.stream ? n.stream : 0;
81700                    const o = e.gpuVertexBuffers[r];
81701                    const a = $7(n.format, i);
81702                    const {size: l} = ur[n.format];
81703                    e.glAttribs[t] = {
81704                      name: n.name,
81705                      glBuffer: o.glBuffer,
81706                      glType: a,
81707                      size: l,
81708                      count: ur[n.format].count,
81709                      stride: o.stride,
81710                      componentCount: s9(a, i),
81711                      isNormalized: void 0 !== n.isNormalized && n.isNormalized,
81712                      isInstanced: void 0 !== n.isInstanced && n.isInstanced,
81713                      offset: s[r]
81714                    };
81715                    s[r] += l;
81716                  }
81717                }(J7.instance, this._gpuInputAssembler);
81718              }
81719              destroy() {
81720                const t = J7.instance;
81721                this._gpuInputAssembler && t.extensions.useVAO && function(t, e) {
81722                  const i = e.glVAOs.values();
81723                  let s = i.next();
81724                  const {gl: n} = t;
81725                  let r = t.stateCache.glVAO;
81726                  for (;!s.done; ) {
81727                    n.deleteVertexArray(s.value);
81728                    if (r === s.value) {
81729                      n.bindVertexArray(null);
81730                      r = null;
81731                    }
81732                    s = i.next();
81733                  }
81734                  t.stateCache.glVAO = r;
81735                  e.glVAOs.clear();
81736                }(t, this._gpuInputAssembler);
81737                this._gpuInputAssembler = null;
81738              }
81739            }
81740            class N9 extends zr {
81741              constructor(...t) {
81742                super(...t);
81743                this._gpuDescriptorSetLayout = null;
81744              }
81745              get gpuDescriptorSetLayout() {
81746                return this._gpuDescriptorSetLayout;
81747              }
81748              initialize(t) {
81749                Array.prototype.push.apply(this._bindings, t.bindings);
81750                let e = 0;
81751                let i = -1;
81752                const s = [];
81753                for (let t = 0; t < this._bindings.length; t++) {
81754                  const n = this._bindings[t];
81755                  s.push(e);
81756                  e += n.count;
81757                  n.binding > i && (i = n.binding);
81758                }
81759                this._bindingIndices = Array(i + 1).fill(-1);
81760                const n = this._descriptorIndices = Array(i + 1).fill(-1);
81761                for (let t = 0; t < this._bindings.length; t++) {
81762                  const e = this._bindings[t];
81763                  this._bindingIndices[e.binding] = t;
81764                  n[e.binding] = s[t];
81765                }
81766                const r = [];
81767                for (let t = 0; t < this._bindings.length; t++) {
81768                  const e = this._bindings[t];
81769                  if (e.descriptorType & pr) for (let t = 0; t < e.count; t++) r.push(e.binding);
81770                }
81771                this._gpuDescriptorSetLayout = {
81772                  bindings: this._bindings,
81773                  dynamicBindings: r,
81774                  descriptorIndices: n,
81775                  descriptorCount: e
81776                };
81777              }
81778              destroy() {
81779                this._bindings.length = 0;
81780              }
81781            }
81782            class L9 extends Hr {
81783              constructor(...t) {
81784                super(...t);
81785                this._gpuPipelineLayout = null;
81786              }
81787              get gpuPipelineLayout() {
81788                return this._gpuPipelineLayout;
81789              }
81790              initialize(t) {
81791                Array.prototype.push.apply(this._setLayouts, t.setLayouts);
81792                const e = [];
81793                const i = [];
81794                let s = 0;
81795                const n = [];
81796                for (let t = 0; t < this._setLayouts.length; t++) {
81797                  const r = this._setLayouts[t];
81798                  const o = r.gpuDescriptorSetLayout.dynamicBindings;
81799                  const a = Array(r.bindingIndices.length).fill(-1);
81800                  for (let t = 0; t < o.length; t++) {
81801                    const e = o[t];
81802                    a[e] < 0 && (a[e] = s + t);
81803                  }
81804                  i.push(r.gpuDescriptorSetLayout);
81805                  e.push(a);
81806                  n.push(s);
81807                  s += o.length;
81808                }
81809                this._gpuPipelineLayout = {
81810                  gpuSetLayouts: i,
81811                  dynamicOffsetIndices: e,
81812                  dynamicOffsetCount: s,
81813                  dynamicOffsetOffsets: n
81814                };
81815              }
81816              destroy() {
81817                this._setLayouts.length = 0;
81818              }
81819            }
81820            const F9 = [ 0, 1, 3, 2, 0, 0, 0, 4, 5, 6, 0, 0, 0, 0 ];
81821            class V9 extends Mr {
81822              constructor(...t) {
81823                super(...t);
81824                this._gpuPipelineState = null;
81825              }
81826              get gpuPipelineState() {
81827                return this._gpuPipelineState;
81828              }
81829              initialize(t) {
81830                this._primitive = t.primitive;
81831                this._shader = t.shader;
81832                this._pipelineLayout = t.pipelineLayout;
81833                const e = this._bs;
81834                if (t.blendState) {
81835                  const i = t.blendState;
81836                  const {targets: s} = i;
81837                  s && s.forEach(((t, i) => {
81838                    e.setTarget(i, t);
81839                  }));
81840                  void 0 !== i.isA2C && (e.isA2C = i.isA2C);
81841                  void 0 !== i.isIndepend && (e.isIndepend = i.isIndepend);
81842                  void 0 !== i.blendColor && (e.blendColor = i.blendColor);
81843                }
81844                Object.assign(this._rs, t.rasterizerState);
81845                Object.assign(this._dss, t.depthStencilState);
81846                this._is = t.inputState;
81847                this._renderPass = t.renderPass;
81848                this._dynamicStates = t.dynamicStates;
81849                const i = [];
81850                for (let t = 0; t < 31; t++) this._dynamicStates & 1 << t && i.push(1 << t);
81851                this._gpuPipelineState = {
81852                  glPrimitive: F9[t.primitive],
81853                  gpuShader: t.shader.gpuShader,
81854                  gpuPipelineLayout: t.pipelineLayout.gpuPipelineLayout,
81855                  rs: t.rasterizerState,
81856                  dss: t.depthStencilState,
81857                  bs: t.blendState,
81858                  gpuRenderPass: t.renderPass.gpuRenderPass,
81859                  dynamicStates: i
81860                };
81861              }
81862              destroy() {
81863                this._gpuPipelineState = null;
81864              }
81865            }
81866            class k9 extends D9 {
81867              beginRenderPass(t, e, i, s, n, r) {
81868                S9(J7.instance, t.gpuRenderPass, e.gpuFramebuffer, i, s, n, r);
81869                this._isInRenderPass = !0;
81870              }
81871              draw(t) {
81872                if (this._isInRenderPass) {
81873                  this._isStateInvalied && this.bindStates();
81874                  const e = "drawInfo" in t ? t.drawInfo : t;
81875                  T9(J7.instance, e);
81876                  ++this._numDrawCalls;
81877                  this._numInstances += e.instanceCount;
81878                  const i = e.indexCount || e.vertexCount;
81879                  if (this._curGPUPipelineState) {
81880                    switch (this._curGPUPipelineState.glPrimitive) {
81881                     case 4:
81882                      this._numTris += i / 3 * Math.max(e.instanceCount, 1);
81883                      break;
81884
81885                     case 5:
81886                     case 6:
81887                      this._numTris += (i - 2) * Math.max(e.instanceCount, 1);
81888                    }
81889                  }
81890                } else console.error("Command 'draw' must be recorded inside a render pass.");
81891              }
81892              setViewport(t) {
81893                const {stateCache: e, gl: i} = J7.instance;
81894                if (e.viewport.left !== t.left || e.viewport.top !== t.top || e.viewport.width !== t.width || e.viewport.height !== t.height) {
81895                  i.viewport(t.left, t.top, t.width, t.height);
81896                  e.viewport.left = t.left;
81897                  e.viewport.top = t.top;
81898                  e.viewport.width = t.width;
81899                  e.viewport.height = t.height;
81900                }
81901              }
81902              setScissor(t) {
81903                const {stateCache: e, gl: i} = J7.instance;
81904                if (e.scissorRect.x !== t.x || e.scissorRect.y !== t.y || e.scissorRect.width !== t.width || e.scissorRect.height !== t.height) {
81905                  i.scissor(t.x, t.y, t.width, t.height);
81906                  e.scissorRect.x = t.x;
81907                  e.scissorRect.y = t.y;
81908                  e.scissorRect.width = t.width;
81909                  e.scissorRect.height = t.height;
81910                }
81911              }
81912              updateBuffer(t, e, i) {
81913                if (this._isInRenderPass) console.error("Command 'updateBuffer' must be recorded outside a render pass."); else {
81914                  const s = t.gpuBuffer;
81915                  if (s) {
81916                    let n;
81917                    n = void 0 !== i ? i : t.usage & Ts.INDIRECT ? 0 : e.byteLength;
81918                    f9(J7.instance, s, e, 0, n);
81919                  }
81920                }
81921              }
81922              copyBuffersToTexture(t, e, i) {
81923                if (this._isInRenderPass) console.error("Command 'copyBufferToTexture' must be recorded outside a render pass."); else {
81924                  const s = e.gpuTexture;
81925                  s && w9(J7.instance, t, s, i);
81926                }
81927              }
81928              execute(t, e) {
81929                for (let i = 0; i < e; ++i) {
81930                  const e = t[i];
81931                  E9(J7.instance, e.cmdPackage);
81932                  this._numDrawCalls += e._numDrawCalls;
81933                  this._numInstances += e._numInstances;
81934                  this._numTris += e._numTris;
81935                }
81936              }
81937              bindStates() {
81938                A9(J7.instance, this._curGPUPipelineState, this._curGPUInputAssembler, this._curGPUDescriptorSets, this._curDynamicOffsets, this._curDynamicStates);
81939                this._isStateInvalied = !1;
81940              }
81941            }
81942            class U9 extends jr {
81943              constructor(...t) {
81944                super(...t);
81945                this.numDrawCalls = 0;
81946                this.numInstances = 0;
81947                this.numTris = 0;
81948              }
81949              initialize(t) {
81950                this._type = t.type;
81951              }
81952              destroy() {}
81953              submit(t) {
81954                for (let e = 0; e < t.length; e++) {
81955                  const i = t[e];
81956                  this.numDrawCalls += i.numDrawCalls;
81957                  this.numInstances += i.numInstances;
81958                  this.numTris += i.numTris;
81959                }
81960              }
81961              clear() {
81962                this.numDrawCalls = 0;
81963                this.numInstances = 0;
81964                this.numTris = 0;
81965              }
81966            }
81967            class G9 extends Xr {
81968              constructor(...t) {
81969                super(...t);
81970                this._gpuRenderPass = null;
81971              }
81972              get gpuRenderPass() {
81973                return this._gpuRenderPass;
81974              }
81975              initialize(t) {
81976                this._colorInfos = t.colorAttachments;
81977                this._depthStencilInfo = t.depthStencilAttachment;
81978                this._subpasses = t.subpasses;
81979                this._gpuRenderPass = {
81980                  colorAttachments: this._colorInfos,
81981                  depthStencilAttachment: this._depthStencilInfo
81982                };
81983                this._hash = this.computeHash();
81984              }
81985              destroy() {
81986                this._gpuRenderPass = null;
81987              }
81988            }
81989            class z9 extends qr {
81990              get gpuSampler() {
81991                return this._gpuSampler;
81992              }
81993              constructor(t, e) {
81994                super(t, e);
81995                this._gpuSampler = null;
81996                this._gpuSampler = {
81997                  glSamplers: new Map,
81998                  minFilter: this._info.minFilter,
81999                  magFilter: this._info.magFilter,
82000                  mipFilter: this._info.mipFilter,
82001                  addressU: this._info.addressU,
82002                  addressV: this._info.addressV,
82003                  addressW: this._info.addressW,
82004                  glMinFilter: 0,
82005                  glMagFilter: 0,
82006                  glWrapS: 0,
82007                  glWrapT: 0,
82008                  glWrapR: 0,
82009                  getGLSampler(t, e, i) {
82010                    const {gl: s} = t;
82011                    const n = e << 16 | i;
82012                    if (!this.glSamplers.has(n)) {
82013                      const t = s.createSampler();
82014                      if (t) {
82015                        this.glSamplers.set(n, t);
82016                        s.samplerParameteri(t, s.TEXTURE_MIN_FILTER, this.glMinFilter);
82017                        s.samplerParameteri(t, s.TEXTURE_MAG_FILTER, this.glMagFilter);
82018                        s.samplerParameteri(t, s.TEXTURE_WRAP_S, this.glWrapS);
82019                        s.samplerParameteri(t, s.TEXTURE_WRAP_T, this.glWrapT);
82020                        s.samplerParameteri(t, s.TEXTURE_WRAP_R, this.glWrapR);
82021                        s.samplerParameterf(t, s.TEXTURE_MIN_LOD, e);
82022                        s.samplerParameterf(t, s.TEXTURE_MAX_LOD, i);
82023                      }
82024                    }
82025                    return this.glSamplers.get(n);
82026                  }
82027                };
82028                !function(t, e) {
82029                  const {gl: i} = t;
82030                  e.minFilter === Ds.LINEAR || e.minFilter === Ds.ANISOTROPIC ? e.mipFilter === Ds.LINEAR || e.mipFilter === Ds.ANISOTROPIC ? e.glMinFilter = i.LINEAR_MIPMAP_LINEAR : e.mipFilter === Ds.POINT ? e.glMinFilter = i.LINEAR_MIPMAP_NEAREST : e.glMinFilter = i.LINEAR : e.mipFilter === Ds.LINEAR || e.mipFilter === Ds.ANISOTROPIC ? e.glMinFilter = i.NEAREST_MIPMAP_LINEAR : e.mipFilter === Ds.POINT ? e.glMinFilter = i.NEAREST_MIPMAP_NEAREST : e.glMinFilter = i.NEAREST;
82031                  e.magFilter === Ds.LINEAR || e.magFilter === Ds.ANISOTROPIC ? e.glMagFilter = i.LINEAR : e.glMagFilter = i.NEAREST;
82032                  e.glWrapS = Z7[e.addressU];
82033                  e.glWrapT = Z7[e.addressV];
82034                  e.glWrapR = Z7[e.addressW];
82035                }(J7.instance, this._gpuSampler);
82036              }
82037              destroy() {
82038                if (this._gpuSampler) {
82039                  !function(t, e) {
82040                    const {gl: i} = t;
82041                    const s = e.glSamplers.values().next();
82042                    for (;!s.done; ) {
82043                      i.deleteSampler(s.value);
82044                      const e = t.stateCache.glSamplerUnits;
82045                      for (let t = 0; t < e.length; ++t) if (e[t] === s.value) {
82046                        i.bindSampler(t, null);
82047                        e[t] = null;
82048                      }
82049                    }
82050                    e.glSamplers.clear();
82051                  }(J7.instance, this._gpuSampler);
82052                  this._gpuSampler = null;
82053                }
82054              }
82055            }
82056            class H9 extends Wr {
82057              constructor(...t) {
82058                super(...t);
82059                this._gpuShader = null;
82060              }
82061              get gpuShader() {
82062                null === this._gpuShader.glProgram && function(t, e) {
82063                  const {gl: i} = t;
82064                  for (let t = 0; t < e.gpuStages.length; t++) {
82065                    const s = e.gpuStages[t];
82066                    let n = 0;
82067                    let r = "";
82068                    let o = 1;
82069                    switch (s.type) {
82070                     case ks.VERTEX:
82071                      r = "VertexShader";
82072                      n = i.VERTEX_SHADER;
82073                      break;
82074
82075                     case ks.FRAGMENT:
82076                      r = "FragmentShader";
82077                      n = i.FRAGMENT_SHADER;
82078                      break;
82079
82080                     default:
82081                      console.error("Unsupported ShaderType.");
82082                      return;
82083                    }
82084                    const a = i.createShader(n);
82085                    if (a) {
82086                      s.glShader = a;
82087                      i.shaderSource(s.glShader, `#version 300 es\n${s.source}`);
82088                      i.compileShader(s.glShader);
82089                      if (!i.getShaderParameter(s.glShader, i.COMPILE_STATUS)) {
82090                        console.error(`${r} in '${e.name}' compilation failed.`);
82091                        console.error("Shader source dump:", s.source.replace(/^|\n/g, (() => `\n${o++} `)));
82092                        console.error(i.getShaderInfoLog(s.glShader));
82093                        for (let s = 0; s < e.gpuStages.length; s++) {
82094                          const s = e.gpuStages[t];
82095                          if (s.glShader) {
82096                            i.deleteShader(s.glShader);
82097                            s.glShader = null;
82098                          }
82099                        }
82100                        return;
82101                      }
82102                    }
82103                  }
82104                  const s = i.createProgram();
82105                  if (!s) return;
82106                  e.glProgram = s;
82107                  for (let t = 0; t < e.gpuStages.length; t++) {
82108                    const s = e.gpuStages[t];
82109                    i.attachShader(e.glProgram, s.glShader);
82110                  }
82111                  i.linkProgram(e.glProgram);
82112                  for (let t = 0; t < e.gpuStages.length; t++) {
82113                    const s = e.gpuStages[t];
82114                    if (s.glShader) {
82115                      i.detachShader(e.glProgram, s.glShader);
82116                      i.deleteShader(s.glShader);
82117                      s.glShader = null;
82118                    }
82119                  }
82120                  if (!i.getProgramParameter(e.glProgram, i.LINK_STATUS)) {
82121                    console.error(`Failed to link shader '${e.name}'.`);
82122                    console.error(i.getProgramInfoLog(e.glProgram));
82123                    return;
82124                  }
82125                  R(`Shader '${e.name}' compilation succeeded.`);
82126                  const n = i.getProgramParameter(e.glProgram, i.ACTIVE_ATTRIBUTES);
82127                  e.glInputs = new Array(n);
82128                  for (let t = 0; t < n; ++t) {
82129                    const s = i.getActiveAttrib(e.glProgram, t);
82130                    if (s) {
82131                      let n;
82132                      const r = s.name.indexOf("[");
82133                      n = -1 !== r ? s.name.substr(0, r) : s.name;
82134                      const o = i.getAttribLocation(e.glProgram, n);
82135                      const a = e9(s.type, i);
82136                      const l = i9(s.type, i);
82137                      e.glInputs[t] = {
82138                        name: n,
82139                        type: a,
82140                        stride: l,
82141                        count: s.size,
82142                        size: l * s.size,
82143                        glType: s.type,
82144                        glLoc: o
82145                      };
82146                    }
82147                  }
82148                  const r = i.getProgramParameter(e.glProgram, i.ACTIVE_UNIFORM_BLOCKS);
82149                  let o;
82150                  let a;
82151                  let l;
82152                  let h;
82153                  if (r) {
82154                    e.glBlocks = new Array(r);
82155                    for (let s = 0; s < r; ++s) {
82156                      o = i.getActiveUniformBlockName(e.glProgram, s);
82157                      const n = o.indexOf("[");
82158                      -1 !== n && (o = o.substr(0, n));
82159                      h = null;
82160                      for (let t = 0; t < e.blocks.length; t++) if (e.blocks[t].name === o) {
82161                        h = e.blocks[t];
82162                        break;
82163                      }
82164                      if (h) {
82165                        a = s;
82166                        l = i.getActiveUniformBlockParameter(e.glProgram, a, i.UNIFORM_BLOCK_DATA_SIZE);
82167                        const n = h.binding + (t.bindingMappings.blockOffsets[h.set] || 0);
82168                        i.uniformBlockBinding(e.glProgram, a, n);
82169                        e.glBlocks[s] = {
82170                          set: h.set,
82171                          binding: h.binding,
82172                          idx: a,
82173                          name: o,
82174                          size: l,
82175                          glBinding: n
82176                        };
82177                      } else x(`Block '${o}' does not bound`);
82178                    }
82179                  }
82180                  for (let t = 0; t < e.subpassInputs.length; ++t) {
82181                    const i = e.subpassInputs[t];
82182                    e.samplerTextures.push(new Bn(i.set, i.binding, i.name, As.SAMPLER2D, i.count));
82183                  }
82184                  if (e.samplerTextures.length > 0) {
82185                    e.glSamplerTextures = new Array(e.samplerTextures.length);
82186                    for (let t = 0; t < e.samplerTextures.length; ++t) {
82187                      const s = e.samplerTextures[t];
82188                      e.glSamplerTextures[t] = {
82189                        set: s.set,
82190                        binding: s.binding,
82191                        name: s.name,
82192                        type: s.type,
82193                        count: s.count,
82194                        units: [],
82195                        glUnits: null,
82196                        glType: t9(s.type, i),
82197                        glLoc: null
82198                      };
82199                    }
82200                  }
82201                  const c = [];
82202                  const u = [];
82203                  const _ = t.stateCache.texUnitCacheMap;
82204                  let d = 0;
82205                  for (let i = 0; i < e.blocks.length; ++i) e.blocks[i].set === t.bindingMappings.flexibleSet && d++;
82206                  let p = 0;
82207                  for (let s = 0; s < e.samplerTextures.length; ++s) {
82208                    const n = e.samplerTextures[s];
82209                    const r = i.getUniformLocation(e.glProgram, n.name);
82210                    if (r && -1 !== r.id) {
82211                      c.push(e.glSamplerTextures[s]);
82212                      u.push(r);
82213                    }
82214                    if (void 0 === _[n.name]) {
82215                      let e = n.binding + t.bindingMappings.samplerTextureOffsets[n.set] + p;
82216                      n.set === t.bindingMappings.flexibleSet && (e -= d);
82217                      _[n.name] = e % t.capabilities.maxTextureUnits;
82218                      p += n.count - 1;
82219                    }
82220                  }
82221                  if (c.length) {
82222                    const s = [];
82223                    for (let e = 0; e < c.length; ++e) {
82224                      const i = c[e];
82225                      let n = _[i.name];
82226                      if (void 0 !== n) {
82227                        i.glLoc = u[e];
82228                        for (let e = 0; e < i.count; ++e) {
82229                          for (;s[n]; ) n = (n + 1) % t.capabilities.maxTextureUnits;
82230                          i.units.push(n);
82231                          s[n] = !0;
82232                        }
82233                      }
82234                    }
82235                    let n = 0;
82236                    for (let e = 0; e < c.length; ++e) {
82237                      const i = c[e];
82238                      if (!i.glLoc) {
82239                        i.glLoc = u[e];
82240                        for (;s[n]; ) n++;
82241                        for (let e = 0; e < i.count; ++e) {
82242                          for (;s[n]; ) n = (n + 1) % t.capabilities.maxTextureUnits;
82243                          void 0 === _[i.name] && (_[i.name] = n);
82244                          i.units.push(n);
82245                          s[n] = !0;
82246                        }
82247                      }
82248                    }
82249                    t.stateCache.glProgram !== e.glProgram && i.useProgram(e.glProgram);
82250                    for (let t = 0; t < c.length; t++) {
82251                      const e = c[t];
82252                      e.glUnits = new Int32Array(e.units);
82253                      i.uniform1iv(e.glLoc, e.glUnits);
82254                    }
82255                    t.stateCache.glProgram !== e.glProgram && i.useProgram(t.stateCache.glProgram);
82256                  }
82257                  e.glSamplerTextures = c;
82258                }(J7.instance, this._gpuShader);
82259                return this._gpuShader;
82260              }
82261              initialize(t) {
82262                this._name = t.name;
82263                this._stages = t.stages;
82264                this._attributes = t.attributes;
82265                this._blocks = t.blocks;
82266                this._samplers = t.samplers;
82267                this._gpuShader = {
82268                  name: t.name,
82269                  blocks: t.blocks.slice(),
82270                  samplerTextures: t.samplerTextures.slice(),
82271                  subpassInputs: t.subpassInputs.slice(),
82272                  gpuStages: new Array(t.stages.length),
82273                  glProgram: null,
82274                  glInputs: [],
82275                  glUniforms: [],
82276                  glBlocks: [],
82277                  glSamplerTextures: []
82278                };
82279                for (let e = 0; e < t.stages.length; ++e) {
82280                  const i = t.stages[e];
82281                  this._gpuShader.gpuStages[e] = {
82282                    type: i.stage,
82283                    source: i.source,
82284                    glShader: null
82285                  };
82286                }
82287              }
82288              destroy() {
82289                if (this._gpuShader) {
82290                  !function(t, e) {
82291                    if (e.glProgram) {
82292                      t.gl.deleteProgram(e.glProgram);
82293                      if (t.stateCache.glProgram === e.glProgram) {
82294                        t.gl.useProgram(null);
82295                        t.stateCache.glProgram = null;
82296                      }
82297                      e.glProgram = null;
82298                    }
82299                  }(J7.instance, this._gpuShader);
82300                  this._gpuShader = null;
82301                }
82302              }
82303            }
82304            class j9 {
82305              constructor() {
82306                this.glArrayBuffer = null;
82307                this.glElementArrayBuffer = null;
82308                this.glUniformBuffer = null;
82309                this.glBindUBOs = [];
82310                this.glBindUBOOffsets = [];
82311                this.glVAO = null;
82312                this.texUnit = 0;
82313                this.glTexUnits = [];
82314                this.glSamplerUnits = [];
82315                this.glRenderbuffer = null;
82316                this.glFramebuffer = null;
82317                this.glReadFramebuffer = null;
82318                this.viewport = new fn;
82319                this.scissorRect = new hn(0, 0, 0, 0);
82320                this.rs = new Cr;
82321                this.dss = new wr;
82322                this.bs = new Ir;
82323                this.glProgram = null;
82324                this.glEnabledAttribLocs = [];
82325                this.glCurrentAttribLocs = [];
82326                this.texUnitCacheMap = {};
82327              }
82328              initialize(t, e, i) {
82329                for (let e = 0; e < t; ++e) this.glTexUnits.push({
82330                  glTexture: null
82331                });
82332                this.glSamplerUnits.length = t;
82333                this.glSamplerUnits.fill(null);
82334                this.glBindUBOs.length = e;
82335                this.glBindUBOs.fill(null);
82336                this.glBindUBOOffsets.length = e;
82337                this.glBindUBOOffsets.fill(0);
82338                this.glEnabledAttribLocs.length = i;
82339                this.glEnabledAttribLocs.fill(!1);
82340                this.glCurrentAttribLocs.length = i;
82341                this.glCurrentAttribLocs.fill(!1);
82342              }
82343            }
82344            class X9 extends Yr {
82345              constructor(...t) {
82346                super(...t);
82347                this._gpuTexture = null;
82348                this._gpuTextureView = null;
82349              }
82350              get gpuTexture() {
82351                return this._gpuTexture;
82352              }
82353              get gpuTextureView() {
82354                return this._gpuTextureView;
82355              }
82356              initialize(t, e) {
82357                let i = t;
82358                const s = t;
82359                if ("texture" in t) {
82360                  i = s.texture.info;
82361                  this._isTextureView = !0;
82362                }
82363                this._info.copy(i);
82364                this._isPowerOf2 = fr(this._info.width) && fr(this._info.height);
82365                this._size = yr(this._info.format, this.width, this.height, this.depth, this._info.levelCount) * this._info.layerCount;
82366                if (this._isTextureView) {
82367                  var n;
82368                  this._viewInfo.copy(s);
82369                  this._gpuTexture = s.texture._gpuTexture;
82370                  if ((null === (n = this._gpuTexture) || void 0 === n ? void 0 : n.format) !== i.format) {
82371                    console.log("GPU memory alias is not supported");
82372                    return;
82373                  }
82374                  this._gpuTextureView = {
82375                    gpuTexture: this._gpuTexture,
82376                    type: s.type,
82377                    format: s.format,
82378                    baseLevel: s.baseLevel,
82379                    levelCount: s.levelCount
82380                  };
82381                } else {
82382                  this._gpuTexture = {
82383                    type: i.type,
82384                    format: i.format,
82385                    usage: i.usage,
82386                    width: i.width,
82387                    height: i.height,
82388                    depth: i.depth,
82389                    size: this._size,
82390                    arrayLayer: i.layerCount,
82391                    mipLevel: i.levelCount,
82392                    samples: i.samples,
82393                    flags: i.flags,
82394                    isPowerOf2: this._isPowerOf2,
82395                    glTarget: 0,
82396                    glInternalFmt: 0,
82397                    glFormat: 0,
82398                    glType: 0,
82399                    glUsage: 0,
82400                    glTexture: null,
82401                    glRenderbuffer: null,
82402                    glWrapS: 0,
82403                    glWrapT: 0,
82404                    glMinFilter: 0,
82405                    glMagFilter: 0,
82406                    isSwapchainTexture: e || !1
82407                  };
82408                  g9(J7.instance, this._gpuTexture);
82409                  J7.instance.memoryStatus.textureSize += this._size;
82410                  this._viewInfo.texture = this;
82411                  this._viewInfo.type = t.type;
82412                  this._viewInfo.format = t.format;
82413                  this._viewInfo.baseLevel = 0;
82414                  this._viewInfo.levelCount = t.levelCount;
82415                  this._viewInfo.baseLayer = 0;
82416                  this._viewInfo.layerCount = t.layerCount;
82417                  this._gpuTextureView = {
82418                    gpuTexture: this._gpuTexture,
82419                    type: this._viewInfo.type,
82420                    format: this._viewInfo.format,
82421                    baseLevel: this._viewInfo.baseLevel,
82422                    levelCount: this._viewInfo.levelCount
82423                  };
82424                }
82425              }
82426              destroy() {
82427                if (!this._isTextureView && this._gpuTexture) {
82428                  y9(J7.instance, this._gpuTexture);
82429                  J7.instance.memoryStatus.textureSize -= this._size;
82430                  this._gpuTexture = null;
82431                }
82432              }
82433              resize(t, e) {
82434                if (this._info.width === t && this._info.height === e) return;
82435                this._info.levelCount === X9.getLevelCount(this._info.width, this._info.height) ? this._info.levelCount = X9.getLevelCount(t, e) : this._info.levelCount > 1 && (this._info.levelCount = Math.min(this._info.levelCount, X9.getLevelCount(t, e)));
82436                const i = this._size;
82437                this._info.width = t;
82438                this._info.height = e;
82439                this._size = yr(this._info.format, this.width, this.height, this.depth, this._info.levelCount) * this._info.layerCount;
82440                if (!this._isTextureView && this._gpuTexture) {
82441                  this._gpuTexture.width = t;
82442                  this._gpuTexture.height = e;
82443                  this._gpuTexture.size = this._size;
82444                  !function(t, e) {
82445                    if (!e.size) return;
82446                    const {gl: i} = t;
82447                    let s = e.width;
82448                    let n = e.height;
82449                    switch (e.type) {
82450                     case xs.TEX2D:
82451                      {
82452                        e.glTarget = i.TEXTURE_2D;
82453                        const r = Math.max(s, n);
82454                        r > t.capabilities.maxTextureSize && F(9100, r, t.capabilities.maxTextureSize);
82455                        if (e.samples === Ms.ONE) {
82456                          const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
82457                          if (r.glTexture !== e.glTexture) {
82458                            i.bindTexture(i.TEXTURE_2D, e.glTexture);
82459                            r.glTexture = e.glTexture;
82460                          }
82461                          if (ur[e.format].isCompressed) for (let t = 0; t < e.mipLevel; ++t) {
82462                            const r = gr(e.format, s, n, 1);
82463                            const o = new Uint8Array(r);
82464                            i.compressedTexImage2D(i.TEXTURE_2D, t, e.glInternalFmt, s, n, 0, o);
82465                            s = Math.max(1, s >> 1);
82466                            n = Math.max(1, n >> 1);
82467                          } else {
82468                            y9(t, e);
82469                            g9(t, e);
82470                          }
82471                        } else if (e.glRenderbuffer) {
82472                          if (t.stateCache.glRenderbuffer !== e.glRenderbuffer) {
82473                            i.bindRenderbuffer(i.RENDERBUFFER, e.glRenderbuffer);
82474                            t.stateCache.glRenderbuffer = e.glRenderbuffer;
82475                          }
82476                          i.renderbufferStorageMultisample(i.RENDERBUFFER, e.samples, e.glInternalFmt, e.width, e.height);
82477                        }
82478                        break;
82479                      }
82480
82481                     case xs.CUBE:
82482                      {
82483                        e.type = xs.CUBE;
82484                        e.glTarget = i.TEXTURE_CUBE_MAP;
82485                        const r = Math.max(s, n);
82486                        r > t.capabilities.maxCubeMapTextureSize && F(9100, r, t.capabilities.maxTextureSize);
82487                        const o = t.stateCache.glTexUnits[t.stateCache.texUnit];
82488                        if (o.glTexture !== e.glTexture) {
82489                          i.bindTexture(i.TEXTURE_CUBE_MAP, e.glTexture);
82490                          o.glTexture = e.glTexture;
82491                        }
82492                        if (ur[e.format].isCompressed) for (let t = 0; t < 6; ++t) {
82493                          s = e.width;
82494                          n = e.height;
82495                          for (let r = 0; r < e.mipLevel; ++r) {
82496                            const o = gr(e.format, s, n, 1);
82497                            const a = new Uint8Array(o);
82498                            i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X + t, r, e.glInternalFmt, s, n, 0, a);
82499                            s = Math.max(1, s >> 1);
82500                            n = Math.max(1, n >> 1);
82501                          }
82502                        } else {
82503                          y9(t, e);
82504                          g9(t, e);
82505                        }
82506                        break;
82507                      }
82508
82509                     default:
82510                      console.error("Unsupported TextureType, create texture failed.");
82511                      e.type = xs.TEX2D;
82512                      e.glTarget = i.TEXTURE_2D;
82513                    }
82514                  }(J7.instance, this._gpuTexture);
82515                  J7.instance.memoryStatus.textureSize -= i;
82516                  J7.instance.memoryStatus.textureSize += this._size;
82517                }
82518              }
82519              initAsSwapchainTexture(t) {
82520                const e = new xn;
82521                e.format = t.format;
82522                e.usage = ur[t.format].hasDepth ? ws.DEPTH_STENCIL_ATTACHMENT : ws.COLOR_ATTACHMENT;
82523                e.width = t.width;
82524                e.height = t.height;
82525                this.initialize(e, !0);
82526              }
82527            }
82528            const W9 = "webglcontextlost";
82529            function Y9(t, e) {
82530              const i = [ "", "WEBKIT_", "MOZ_" ];
82531              for (let s = 0; s < i.length; ++s) {
82532                const n = t.getExtension(i[s] + e);
82533                if (n) return n;
82534              }
82535              return null;
82536            }
82537            function q9(t) {
82538              const e = {
82539                EXT_texture_filter_anisotropic: Y9(t, "EXT_texture_filter_anisotropic"),
82540                EXT_color_buffer_half_float: Y9(t, "EXT_color_buffer_half_float"),
82541                EXT_color_buffer_float: Y9(t, "EXT_color_buffer_float"),
82542                WEBGL_compressed_texture_etc1: Y9(t, "WEBGL_compressed_texture_etc1"),
82543                WEBGL_compressed_texture_etc: Y9(t, "WEBGL_compressed_texture_etc"),
82544                WEBGL_compressed_texture_pvrtc: Y9(t, "WEBGL_compressed_texture_pvrtc"),
82545                WEBGL_compressed_texture_astc: Y9(t, "WEBGL_compressed_texture_astc"),
82546                WEBGL_compressed_texture_s3tc: Y9(t, "WEBGL_compressed_texture_s3tc"),
82547                WEBGL_compressed_texture_s3tc_srgb: Y9(t, "WEBGL_compressed_texture_s3tc_srgb"),
82548                WEBGL_debug_shaders: Y9(t, "WEBGL_debug_shaders"),
82549                WEBGL_lose_context: Y9(t, "WEBGL_lose_context"),
82550                WEBGL_debug_renderer_info: Y9(t, "WEBGL_debug_renderer_info"),
82551                OES_texture_half_float_linear: Y9(t, "OES_texture_half_float_linear"),
82552                OES_texture_float_linear: Y9(t, "OES_texture_float_linear"),
82553                WEBGL_multi_draw: null,
82554                useVAO: !0
82555              };
82556              Po.os !== Ro.ABC && Po.os !== Ro.IOS && (e.WEBGL_multi_draw = Y9(t, "WEBGL_multi_draw"));
82557              return e;
82558            }
82559            class K9 extends Lr {
82560              constructor(...t) {
82561                super(...t);
82562                this.stateCache = new j9;
82563                this.nullTex2D = null;
82564                this.nullTexCube = null;
82565                this._canvas = null;
82566                this._webGL2ContextLostHandler = null;
82567                this._extensions = null;
82568              }
82569              get extensions() {
82570                return this._extensions;
82571              }
82572              initialize(t) {
82573                this._canvas = t.windowHandle;
82574                this._webGL2ContextLostHandler = this._onWebGLContextLost.bind(this);
82575                this._canvas.addEventListener(W9, this._onWebGLContextLost);
82576                const e = J7.instance.gl;
82577                this.stateCache.initialize(J7.instance.capabilities.maxTextureUnits, J7.instance.capabilities.maxUniformBufferBindings, J7.instance.capabilities.maxVertexAttributes);
82578                this._extensions = q9(e);
82579                !function(t) {
82580                  t.activeTexture(t.TEXTURE0);
82581                  t.pixelStorei(t.PACK_ALIGNMENT, 1);
82582                  t.pixelStorei(t.UNPACK_ALIGNMENT, 1);
82583                  t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, !1);
82584                  t.bindFramebuffer(t.FRAMEBUFFER, null);
82585                  t.enable(t.SCISSOR_TEST);
82586                  t.enable(t.CULL_FACE);
82587                  t.cullFace(t.BACK);
82588                  t.frontFace(t.CCW);
82589                  t.polygonOffset(0, 0);
82590                  t.enable(t.DEPTH_TEST);
82591                  t.depthMask(!0);
82592                  t.depthFunc(t.LESS);
82593                  t.stencilFuncSeparate(t.FRONT, t.ALWAYS, 1, 65535);
82594                  t.stencilOpSeparate(t.FRONT, t.KEEP, t.KEEP, t.KEEP);
82595                  t.stencilMaskSeparate(t.FRONT, 65535);
82596                  t.stencilFuncSeparate(t.BACK, t.ALWAYS, 1, 65535);
82597                  t.stencilOpSeparate(t.BACK, t.KEEP, t.KEEP, t.KEEP);
82598                  t.stencilMaskSeparate(t.BACK, 65535);
82599                  t.disable(t.STENCIL_TEST);
82600                  t.disable(t.SAMPLE_ALPHA_TO_COVERAGE);
82601                  t.disable(t.BLEND);
82602                  t.blendEquationSeparate(t.FUNC_ADD, t.FUNC_ADD);
82603                  t.blendFuncSeparate(t.ONE, t.ZERO, t.ONE, t.ZERO);
82604                  t.colorMask(!0, !0, !0, !0);
82605                  t.blendColor(0, 0, 0, 0);
82606                }(e);
82607                const i = bs.RGBA8;
82608                let s = bs.DEPTH_STENCIL;
82609                const n = e.getParameter(e.DEPTH_BITS);
82610                const r = e.getParameter(e.STENCIL_BITS);
82611                n && r ? s = bs.DEPTH_STENCIL : n && (s = bs.DEPTH);
82612                this._colorTexture = new X9;
82613                this._colorTexture.initAsSwapchainTexture({
82614                  swapchain: this,
82615                  format: i,
82616                  width: t.width,
82617                  height: t.height
82618                });
82619                this._depthStencilTexture = new X9;
82620                this._depthStencilTexture.initAsSwapchainTexture({
82621                  swapchain: this,
82622                  format: s,
82623                  width: t.width,
82624                  height: t.height
82625                });
82626                this.nullTex2D = J7.instance.createTexture(new xn(xs.TEX2D, ws.SAMPLED, bs.RGBA8, 2, 2, Rs.NONE));
82627                this.nullTexCube = J7.instance.createTexture(new xn(xs.CUBE, ws.SAMPLED, bs.RGBA8, 2, 2, Rs.NONE, 6));
82628                const o = new mn;
82629                o.texExtent.width = 2;
82630                o.texExtent.height = 2;
82631                const a = new Uint8Array(this.nullTex2D.size);
82632                a.fill(0);
82633                J7.instance.copyBuffersToTexture([ a ], this.nullTex2D, [ o ]);
82634                o.texSubres.layerCount = 6;
82635                J7.instance.copyBuffersToTexture([ a, a, a, a, a, a ], this.nullTexCube, [ o ]);
82636              }
82637              destroy() {
82638                if (this._canvas && this._webGL2ContextLostHandler) {
82639                  this._canvas.removeEventListener(W9, this._webGL2ContextLostHandler);
82640                  this._webGL2ContextLostHandler = null;
82641                }
82642                if (this.nullTex2D) {
82643                  this.nullTex2D.destroy();
82644                  this.nullTex2D = null;
82645                }
82646                if (this.nullTexCube) {
82647                  this.nullTexCube.destroy();
82648                  this.nullTexCube = null;
82649                }
82650                this._extensions = null;
82651                this._canvas = null;
82652              }
82653              resize(t, e, i) {
82654                if (this._colorTexture.width !== t || this._colorTexture.height !== e) {
82655                  R(`Resizing swapchain: ${t}x${e}`);
82656                  this._canvas.width = t;
82657                  this._canvas.height = e;
82658                  this._colorTexture.resize(t, e);
82659                  this._depthStencilTexture.resize(t, e);
82660                }
82661              }
82662              _onWebGLContextLost(t) {
82663                N(11e3);
82664                C(t);
82665              }
82666            }
82667            class J9 extends Nr {
82668              constructor(...t) {
82669                super(...t);
82670                this._swapchain = null;
82671                this._context = null;
82672                this._bindingMappings = null;
82673                this._textureExclusive = new Array(bs.COUNT);
82674              }
82675              get gl() {
82676                return this._context;
82677              }
82678              get extensions() {
82679                return this._swapchain.extensions;
82680              }
82681              get stateCache() {
82682                return this._swapchain.stateCache;
82683              }
82684              get nullTex2D() {
82685                return this._swapchain.nullTex2D;
82686              }
82687              get nullTexCube() {
82688                return this._swapchain.nullTexCube;
82689              }
82690              get textureExclusive() {
82691                return this._textureExclusive;
82692              }
82693              get bindingMappings() {
82694                return this._bindingMappings;
82695              }
82696              initialize(t) {
82697                J7.setInstance(this);
82698                this._gfxAPI = fs.WEBGL2;
82699                const e = this._bindingMappingInfo = t.bindingMappingInfo;
82700                const i = [];
82701                const s = [];
82702                const n = e.setIndices[0];
82703                i[n] = 0;
82704                s[n] = 0;
82705                for (let t = 1; t < e.setIndices.length; ++t) {
82706                  const n = e.setIndices[t];
82707                  const r = e.setIndices[t - 1];
82708                  i[n] = e.maxBlockCounts[r] + i[r];
82709                  s[n] = e.maxSamplerTextureCounts[r] + s[r];
82710                }
82711                for (let t = 0; t < e.setIndices.length; ++t) {
82712                  const i = e.setIndices[t];
82713                  s[i] -= e.maxBlockCounts[i];
82714                }
82715                this._bindingMappings = {
82716                  blockOffsets: i,
82717                  samplerTextureOffsets: s,
82718                  flexibleSet: e.setIndices[e.setIndices.length - 1]
82719                };
82720                const r = this._context = function(t) {
82721                  let e = null;
82722                  try {
82723                    const i = {
82724                      alpha: pe.ENABLE_TRANSPARENT_CANVAS,
82725                      antialias: pe.ENABLE_WEBGL_ANTIALIAS,
82726                      depth: !0,
82727                      stencil: !0,
82728                      premultipliedAlpha: !1,
82729                      preserveDrawingBuffer: !1,
82730                      powerPreference: "default",
82731                      failIfMajorPerformanceCaveat: !1
82732                    };
82733                    e = t.getContext("webgl2", i);
82734                  } catch (t) {
82735                    return null;
82736                  }
82737                  return e;
82738                }(Nr.canvas);
82739                if (!r) {
82740                  console.error("This device does not support WebGL.");
82741                  return !1;
82742                }
82743                this._queue = this.createQueue(new ir(Qs.GRAPHICS));
82744                this._cmdBuff = this.createCommandBuffer(new er(this._queue));
82745                this._caps.maxVertexAttributes = r.getParameter(r.MAX_VERTEX_ATTRIBS);
82746                this._caps.maxVertexUniformVectors = r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS);
82747                this._caps.maxFragmentUniformVectors = r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS);
82748                this._caps.maxTextureUnits = r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS);
82749                this._caps.maxVertexTextureUnits = r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
82750                this._caps.maxUniformBufferBindings = r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);
82751                this._caps.maxUniformBlockSize = r.getParameter(r.MAX_UNIFORM_BLOCK_SIZE);
82752                this._caps.maxTextureSize = r.getParameter(r.MAX_TEXTURE_SIZE);
82753                this._caps.maxCubeMapTextureSize = r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE);
82754                this._caps.uboOffsetAlignment = r.getParameter(r.UNIFORM_BUFFER_OFFSET_ALIGNMENT);
82755                const o = r.getSupportedExtensions();
82756                let a = "";
82757                if (o) for (const t of o) a += `${t} `;
82758                const l = q9(r);
82759                if (l.WEBGL_debug_renderer_info) {
82760                  this._renderer = r.getParameter(l.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL);
82761                  this._vendor = r.getParameter(l.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL);
82762                } else {
82763                  this._renderer = r.getParameter(r.RENDERER);
82764                  this._vendor = r.getParameter(r.VENDOR);
82765                }
82766                const h = r.getParameter(r.VERSION);
82767                this._features.fill(!1);
82768                this.initFormatFeatures(l);
82769                this._features[ys.ELEMENT_INDEX_UINT] = !0;
82770                this._features[ys.INSTANCED_ARRAYS] = !0;
82771                this._features[ys.MULTIPLE_RENDER_TARGETS] = !0;
82772                this._features[ys.BLEND_MINMAX] = !0;
82773                let c = "";
82774                this.getFormatFeatures(bs.ETC_RGB8) && (c += "etc1 ");
82775                this.getFormatFeatures(bs.ETC2_RGB8) && (c += "etc2 ");
82776                this.getFormatFeatures(bs.BC1) && (c += "dxt ");
82777                this.getFormatFeatures(bs.PVRTC_RGB2) && (c += "pvrtc ");
82778                this.getFormatFeatures(bs.ASTC_RGBA_4X4) && (c += "astc ");
82779                R("WebGL2 device initialized.");
82780                R(`RENDERER: ${this._renderer}`);
82781                R(`VENDOR: ${this._vendor}`);
82782                R(`VERSION: ${h}`);
82783                R(`COMPRESSED_FORMAT: ${c}`);
82784                R(`EXTENSIONS: ${a}`);
82785                return !0;
82786              }
82787              destroy() {
82788                if (this._queue) {
82789                  this._queue.destroy();
82790                  this._queue = null;
82791                }
82792                if (this._cmdBuff) {
82793                  this._cmdBuff.destroy();
82794                  this._cmdBuff = null;
82795                }
82796                const t = this._samplers.values();
82797                let e = t.next();
82798                for (;!e.done; ) {
82799                  e.value.destroy();
82800                  e = t.next();
82801                }
82802                this._swapchain = null;
82803              }
82804              flushCommands(t) {}
82805              acquire(t) {}
82806              present() {
82807                const t = this._queue;
82808                this._numDrawCalls = t.numDrawCalls;
82809                this._numInstances = t.numInstances;
82810                this._numTris = t.numTris;
82811                t.clear();
82812              }
82813              initFormatFeatures(t) {
82814                this._formatFeatures.fill(Is.NONE);
82815                this._textureExclusive.fill(!0);
82816                let e = Is.RENDER_TARGET | Is.SAMPLED_TEXTURE | Is.STORAGE_TEXTURE | Is.LINEAR_FILTER | Is.VERTEX_ATTRIBUTE;
82817                this._formatFeatures[bs.R8] = e;
82818                this._formatFeatures[bs.RG8] = e;
82819                this._formatFeatures[bs.RGB8] = e;
82820                this._formatFeatures[bs.RGBA8] = e;
82821                e = Is.RENDER_TARGET | Is.SAMPLED_TEXTURE | Is.STORAGE_TEXTURE | Is.LINEAR_FILTER;
82822                this._formatFeatures[bs.R8SN] = e;
82823                this._formatFeatures[bs.RG8SN] = e;
82824                this._formatFeatures[bs.RGB8SN] = e;
82825                this._formatFeatures[bs.RGBA8SN] = e;
82826                this._formatFeatures[bs.R5G6B5] = e;
82827                this._formatFeatures[bs.RGBA4] = e;
82828                this._formatFeatures[bs.RGB5A1] = e;
82829                this._formatFeatures[bs.RGB10A2] = e;
82830                this._formatFeatures[bs.SRGB8] = e;
82831                this._formatFeatures[bs.SRGB8_A8] = e;
82832                this._formatFeatures[bs.R11G11B10F] = e;
82833                this._formatFeatures[bs.RGB9E5] = e;
82834                this._formatFeatures[bs.DEPTH] = e;
82835                this._formatFeatures[bs.DEPTH_STENCIL] = e;
82836                this._formatFeatures[bs.RGB10A2UI] = Is.RENDER_TARGET | Is.STORAGE_TEXTURE | Is.SAMPLED_TEXTURE | Is.LINEAR_FILTER;
82837                e = Is.RENDER_TARGET | Is.SAMPLED_TEXTURE | Is.STORAGE_TEXTURE | Is.VERTEX_ATTRIBUTE;
82838                this._formatFeatures[bs.R16F] = e;
82839                this._formatFeatures[bs.RG16F] = e;
82840                this._formatFeatures[bs.RGB16F] = e;
82841                this._formatFeatures[bs.RGBA16F] = e;
82842                e = Is.STORAGE_TEXTURE | Is.SAMPLED_TEXTURE | Is.VERTEX_ATTRIBUTE;
82843                this._formatFeatures[bs.R32F] = e;
82844                this._formatFeatures[bs.RG32F] = e;
82845                this._formatFeatures[bs.RGB32F] = e;
82846                this._formatFeatures[bs.RGBA32F] = e;
82847                this._formatFeatures[bs.RGB10A2UI] = Is.RENDER_TARGET | Is.STORAGE_TEXTURE | Is.SAMPLED_TEXTURE | Is.LINEAR_FILTER;
82848                e = Is.RENDER_TARGET | Is.STORAGE_TEXTURE | Is.SAMPLED_TEXTURE | Is.LINEAR_FILTER | Is.VERTEX_ATTRIBUTE;
82849                this._formatFeatures[bs.R8I] = e;
82850                this._formatFeatures[bs.R8UI] = e;
82851                this._formatFeatures[bs.R16I] = e;
82852                this._formatFeatures[bs.R16UI] = e;
82853                this._formatFeatures[bs.R32I] = e;
82854                this._formatFeatures[bs.R32UI] = e;
82855                this._formatFeatures[bs.RG8I] = e;
82856                this._formatFeatures[bs.RG8UI] = e;
82857                this._formatFeatures[bs.RG16I] = e;
82858                this._formatFeatures[bs.RG16UI] = e;
82859                this._formatFeatures[bs.RG32I] = e;
82860                this._formatFeatures[bs.RG32UI] = e;
82861                this._formatFeatures[bs.RGB8I] = e;
82862                this._formatFeatures[bs.RGB8UI] = e;
82863                this._formatFeatures[bs.RGB16I] = e;
82864                this._formatFeatures[bs.RGB16UI] = e;
82865                this._formatFeatures[bs.RGB32I] = e;
82866                this._formatFeatures[bs.RGB32UI] = e;
82867                this._formatFeatures[bs.RGBA8I] = e;
82868                this._formatFeatures[bs.RGBA8UI] = e;
82869                this._formatFeatures[bs.RGBA16I] = e;
82870                this._formatFeatures[bs.RGBA16UI] = e;
82871                this._formatFeatures[bs.RGBA32I] = e;
82872                this._formatFeatures[bs.RGBA32UI] = e;
82873                this._textureExclusive[bs.R8] = !1;
82874                this._textureExclusive[bs.RG8] = !1;
82875                this._textureExclusive[bs.RGB8] = !1;
82876                this._textureExclusive[bs.R5G6B5] = !1;
82877                this._textureExclusive[bs.RGBA4] = !1;
82878                this._textureExclusive[bs.RGB5A1] = !1;
82879                this._textureExclusive[bs.RGBA8] = !1;
82880                this._textureExclusive[bs.RGB10A2] = !1;
82881                this._textureExclusive[bs.RGB10A2UI] = !1;
82882                this._textureExclusive[bs.SRGB8_A8] = !1;
82883                this._textureExclusive[bs.R8I] = !1;
82884                this._textureExclusive[bs.R8UI] = !1;
82885                this._textureExclusive[bs.R16I] = !1;
82886                this._textureExclusive[bs.R16UI] = !1;
82887                this._textureExclusive[bs.R32I] = !1;
82888                this._textureExclusive[bs.R32UI] = !1;
82889                this._textureExclusive[bs.RG8I] = !1;
82890                this._textureExclusive[bs.RG8UI] = !1;
82891                this._textureExclusive[bs.RG16I] = !1;
82892                this._textureExclusive[bs.RG16UI] = !1;
82893                this._textureExclusive[bs.RG32I] = !1;
82894                this._textureExclusive[bs.RG32UI] = !1;
82895                this._textureExclusive[bs.RGBA8I] = !1;
82896                this._textureExclusive[bs.RGBA8UI] = !1;
82897                this._textureExclusive[bs.RGBA16I] = !1;
82898                this._textureExclusive[bs.RGBA16UI] = !1;
82899                this._textureExclusive[bs.RGBA32I] = !1;
82900                this._textureExclusive[bs.RGBA32UI] = !1;
82901                this._textureExclusive[bs.DEPTH] = !1;
82902                this._textureExclusive[bs.DEPTH_STENCIL] = !1;
82903                if (t.EXT_color_buffer_float) {
82904                  this._formatFeatures[bs.R32F] |= Is.RENDER_TARGET;
82905                  this._formatFeatures[bs.RG32F] |= Is.RENDER_TARGET;
82906                  this._formatFeatures[bs.RGBA32F] |= Is.RENDER_TARGET;
82907                  this._textureExclusive[bs.R32F] = !1;
82908                  this._textureExclusive[bs.RG32F] = !1;
82909                  this._textureExclusive[bs.RGBA32F] = !1;
82910                }
82911                if (t.EXT_color_buffer_half_float) {
82912                  this._textureExclusive[bs.R16F] = !1;
82913                  this._textureExclusive[bs.RG16F] = !1;
82914                  this._textureExclusive[bs.RGBA16F] = !1;
82915                }
82916                if (t.OES_texture_float_linear) {
82917                  this._formatFeatures[bs.RGB32F] |= Is.LINEAR_FILTER;
82918                  this._formatFeatures[bs.RGBA32F] |= Is.LINEAR_FILTER;
82919                  this._formatFeatures[bs.R32F] |= Is.LINEAR_FILTER;
82920                  this._formatFeatures[bs.RG32F] |= Is.LINEAR_FILTER;
82921                }
82922                if (t.OES_texture_half_float_linear) {
82923                  this._formatFeatures[bs.RGB16F] |= Is.LINEAR_FILTER;
82924                  this._formatFeatures[bs.RGBA16F] |= Is.LINEAR_FILTER;
82925                  this._formatFeatures[bs.R16F] |= Is.LINEAR_FILTER;
82926                  this._formatFeatures[bs.RG16F] |= Is.LINEAR_FILTER;
82927                }
82928                const i = Is.SAMPLED_TEXTURE | Is.LINEAR_FILTER;
82929                t.WEBGL_compressed_texture_etc1 && (this._formatFeatures[bs.ETC_RGB8] = i);
82930                if (t.WEBGL_compressed_texture_etc) {
82931                  this._formatFeatures[bs.ETC2_RGB8] = i;
82932                  this._formatFeatures[bs.ETC2_RGBA8] = i;
82933                  this._formatFeatures[bs.ETC2_SRGB8] = i;
82934                  this._formatFeatures[bs.ETC2_SRGB8_A8] = i;
82935                  this._formatFeatures[bs.ETC2_RGB8_A1] = i;
82936                  this._formatFeatures[bs.ETC2_SRGB8_A1] = i;
82937                }
82938                if (t.WEBGL_compressed_texture_s3tc) {
82939                  this._formatFeatures[bs.BC1] = i;
82940                  this._formatFeatures[bs.BC1_ALPHA] = i;
82941                  this._formatFeatures[bs.BC1_SRGB] = i;
82942                  this._formatFeatures[bs.BC1_SRGB_ALPHA] = i;
82943                  this._formatFeatures[bs.BC2] = i;
82944                  this._formatFeatures[bs.BC2_SRGB] = i;
82945                  this._formatFeatures[bs.BC3] = i;
82946                  this._formatFeatures[bs.BC3_SRGB] = i;
82947                }
82948                if (t.WEBGL_compressed_texture_pvrtc) {
82949                  this._formatFeatures[bs.PVRTC_RGB2] = i;
82950                  this._formatFeatures[bs.PVRTC_RGBA2] = i;
82951                  this._formatFeatures[bs.PVRTC_RGB4] = i;
82952                  this._formatFeatures[bs.PVRTC_RGBA4] = i;
82953                }
82954                if (t.WEBGL_compressed_texture_astc) {
82955                  this._formatFeatures[bs.ASTC_RGBA_4X4] = i;
82956                  this._formatFeatures[bs.ASTC_RGBA_5X4] = i;
82957                  this._formatFeatures[bs.ASTC_RGBA_5X5] = i;
82958                  this._formatFeatures[bs.ASTC_RGBA_6X5] = i;
82959                  this._formatFeatures[bs.ASTC_RGBA_6X6] = i;
82960                  this._formatFeatures[bs.ASTC_RGBA_8X5] = i;
82961                  this._formatFeatures[bs.ASTC_RGBA_8X6] = i;
82962                  this._formatFeatures[bs.ASTC_RGBA_8X8] = i;
82963                  this._formatFeatures[bs.ASTC_RGBA_10X5] = i;
82964                  this._formatFeatures[bs.ASTC_RGBA_10X6] = i;
82965                  this._formatFeatures[bs.ASTC_RGBA_10X8] = i;
82966                  this._formatFeatures[bs.ASTC_RGBA_10X10] = i;
82967                  this._formatFeatures[bs.ASTC_RGBA_12X10] = i;
82968                  this._formatFeatures[bs.ASTC_RGBA_12X12] = i;
82969                  this._formatFeatures[bs.ASTC_SRGBA_4X4] = i;
82970                  this._formatFeatures[bs.ASTC_SRGBA_5X4] = i;
82971                  this._formatFeatures[bs.ASTC_SRGBA_5X5] = i;
82972                  this._formatFeatures[bs.ASTC_SRGBA_6X5] = i;
82973                  this._formatFeatures[bs.ASTC_SRGBA_6X6] = i;
82974                  this._formatFeatures[bs.ASTC_SRGBA_8X5] = i;
82975                  this._formatFeatures[bs.ASTC_SRGBA_8X6] = i;
82976                  this._formatFeatures[bs.ASTC_SRGBA_8X8] = i;
82977                  this._formatFeatures[bs.ASTC_SRGBA_10X5] = i;
82978                  this._formatFeatures[bs.ASTC_SRGBA_10X6] = i;
82979                  this._formatFeatures[bs.ASTC_SRGBA_10X8] = i;
82980                  this._formatFeatures[bs.ASTC_SRGBA_10X10] = i;
82981                  this._formatFeatures[bs.ASTC_SRGBA_12X10] = i;
82982                  this._formatFeatures[bs.ASTC_SRGBA_12X12] = i;
82983                }
82984              }
82985              createCommandBuffer(t) {
82986                const e = new (t.type === tn.PRIMARY ? k9 : D9);
82987                e.initialize(t);
82988                return e;
82989              }
82990              createSwapchain(t) {
82991                const e = new K9;
82992                this._swapchain = e;
82993                e.initialize(t);
82994                return e;
82995              }
82996              createBuffer(t) {
82997                const e = new I9;
82998                e.initialize(t);
82999                return e;
83000              }
83001              createTexture(t) {
83002                const e = new X9;
83003                e.initialize(t);
83004                return e;
83005              }
83006              createDescriptorSet(t) {
83007                const e = new q7;
83008                e.initialize(t);
83009                return e;
83010              }
83011              createShader(t) {
83012                const e = new H9;
83013                e.initialize(t);
83014                return e;
83015              }
83016              createInputAssembler(t) {
83017                const e = new O9;
83018                e.initialize(t);
83019                return e;
83020              }
83021              createRenderPass(t) {
83022                const e = new G9;
83023                e.initialize(t);
83024                return e;
83025              }
83026              createFramebuffer(t) {
83027                const e = new P9;
83028                e.initialize(t);
83029                return e;
83030              }
83031              createDescriptorSetLayout(t) {
83032                const e = new N9;
83033                e.initialize(t);
83034                return e;
83035              }
83036              createPipelineLayout(t) {
83037                const e = new L9;
83038                e.initialize(t);
83039                return e;
83040              }
83041              createPipelineState(t) {
83042                const e = new V9;
83043                e.initialize(t);
83044                return e;
83045              }
83046              createQueue(t) {
83047                const e = new U9;
83048                e.initialize(t);
83049                return e;
83050              }
83051              getSampler(t) {
83052                const e = qr.computeHash(t);
83053                this._samplers.has(e) || this._samplers.set(e, new z9(t, e));
83054                return this._samplers.get(e);
83055              }
83056              getSwapchains() {
83057                return [ this._swapchain ];
83058              }
83059              getGeneralBarrier(t) {
83060                const e = Kr.computeHash(t);
83061                this._generalBarrierss.has(e) || this._generalBarrierss.set(e, new Kr(t, e));
83062                return this._generalBarrierss.get(e);
83063              }
83064              getTextureBarrier(t) {
83065                const e = Jr.computeHash(t);
83066                this._textureBarriers.has(e) || this._textureBarriers.set(e, new Jr(t, e));
83067                return this._textureBarriers.get(e);
83068              }
83069              getBufferBarrier(t) {
83070                const e = W7.computeHash(t);
83071                this._bufferBarriers.has(e) || this._bufferBarriers.set(e, new W7(t, e));
83072                return this._bufferBarriers.get(e);
83073              }
83074              copyBuffersToTexture(t, e, i) {
83075                w9(this, t, e.gpuTexture, i);
83076              }
83077              copyTextureToBuffers(t, e, i) {
83078                !function(t, e, i, s) {
83079                  const {gl: n} = t;
83080                  const r = t.stateCache;
83081                  const o = n.createFramebuffer();
83082                  n.bindFramebuffer(n.FRAMEBUFFER, o);
83083                  let a = 0;
83084                  let l = 0;
83085                  let h = 1;
83086                  let c = 1;
83087                  if (e.glTarget === n.TEXTURE_2D) for (let t = 0; t < s.length; t++) {
83088                    const r = s[t];
83089                    n.framebufferTexture2D(n.FRAMEBUFFER, n.COLOR_ATTACHMENT0, e.glTarget, e.glTexture, r.texSubres.mipLevel);
83090                    a = r.texOffset.x;
83091                    l = r.texOffset.y;
83092                    h = r.texExtent.width;
83093                    c = r.texExtent.height;
83094                    n.readPixels(a, l, h, c, e.glFormat, e.glType, i[t]);
83095                  } else console.error("Unsupported GL texture type, copy texture to buffers failed.");
83096                  n.bindFramebuffer(n.FRAMEBUFFER, null);
83097                  r.glFramebuffer = null;
83098                  n.deleteFramebuffer(o);
83099                }(this, t.gpuTexture, e, i);
83100              }
83101              copyTexImagesToTexture(t, e, i) {
83102                !function(t, e, i, s) {
83103                  const {gl: n} = t;
83104                  const r = t.stateCache.glTexUnits[t.stateCache.texUnit];
83105                  if (r.glTexture !== i.glTexture) {
83106                    n.bindTexture(i.glTarget, i.glTexture);
83107                    r.glTexture = i.glTexture;
83108                  }
83109                  let o = 0;
83110                  let a = 0;
83111                  switch (i.glTarget) {
83112                   case n.TEXTURE_2D:
83113                    for (let t = 0; t < s.length; t++) {
83114                      const r = s[t];
83115                      n.texSubImage2D(n.TEXTURE_2D, r.texSubres.mipLevel, r.texOffset.x, r.texOffset.y, i.glFormat, i.glType, e[o++]);
83116                    }
83117                    break;
83118
83119                   case n.TEXTURE_CUBE_MAP:
83120                    for (let t = 0; t < s.length; t++) {
83121                      const r = s[t];
83122                      const l = r.texSubres.baseArrayLayer + r.texSubres.layerCount;
83123                      for (a = r.texSubres.baseArrayLayer; a < l; ++a) n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + a, r.texSubres.mipLevel, r.texOffset.x, r.texOffset.y, i.glFormat, i.glType, e[o++]);
83124                    }
83125                    break;
83126
83127                   default:
83128                    console.error("Unsupported GL texture type, copy buffer to texture failed.");
83129                  }
83130                  i.flags & Rs.GEN_MIPMAP && n.generateMipmap(i.glTarget);
83131                }(this, t, e.gpuTexture, i);
83132              }
83133            }
83134            t("WebGL2Device", J9);
83135            m.WebGL2Device = J9;
83136            function Z9(t, e, i, s) {
83137              const n = (s.x - i.x) * (t.y - i.y) - (s.y - i.y) * (t.x - i.x);
83138              const r = (e.x - t.x) * (t.y - i.y) - (e.y - t.y) * (t.x - i.x);
83139              const o = (s.y - i.y) * (e.x - t.x) - (s.x - i.x) * (e.y - t.y);
83140              if (0 !== o) {
83141                const t = n / o;
83142                const e = r / o;
83143                if (t >= 0 && t <= 1 && e >= 0 && e <= 1) return !0;
83144              }
83145              return !1;
83146            }
83147            const Q9 = new Qi;
83148            const $9 = new Qi;
83149            const ttt = new Qi;
83150            const ett = new Qi;
83151            function itt(t, e, i) {
83152              const s = i.length;
83153              for (let n = 0; n < s; ++n) {
83154                if (Z9(t, e, i[n], i[(n + 1) % s])) return !0;
83155              }
83156              return !1;
83157            }
83158            function stt(t, e) {
83159              let i = !1;
83160              const s = t.x;
83161              const n = t.y;
83162              const r = e.length;
83163              for (let t = 0, o = r - 1; t < r; o = t++) {
83164                const r = e[t].x;
83165                const a = e[t].y;
83166                const l = e[o].x;
83167                const h = e[o].y;
83168                a > n != h > n && s < (l - r) * (n - a) / (h - a) + r && (i = !i);
83169              }
83170              return i;
83171            }
83172            function ntt(t, e, i, s) {
83173              let n = i.x - e.x;
83174              let r = i.y - e.y;
83175              const o = n * n + r * r;
83176              const a = ((t.x - e.x) * n + (t.y - e.y) * r) / o;
83177              let l;
83178              l = s ? o ? a < 0 ? e : a > 1 ? i : Q9.set(e.x + a * n, e.y + a * r) : e : Q9.set(e.x + a * n, e.y + a * r);
83179              n = t.x - l.x;
83180              r = t.y - l.y;
83181              return Math.sqrt(n * n + r * r);
83182            }
83183            class rtt {}
83184            t("Intersection2D", rtt);
83185            rtt.lineLine = Z9;
83186            rtt.lineRect = function(t, e, i) {
83187              const s = Q9.set(i.x, i.y);
83188              const n = $9.set(i.x, i.yMax);
83189              const r = ttt.set(i.xMax, i.yMax);
83190              const o = ett.set(i.xMax, i.y);
83191              return !!Z9(t, e, s, n) || (!!Z9(t, e, n, r) || (!!Z9(t, e, r, o) || !!Z9(t, e, o, s)));
83192            };
83193            rtt.linePolygon = itt;
83194            rtt.rectRect = function(t, e) {
83195              const i = t.x;
83196              const s = t.y;
83197              const n = t.x + t.width;
83198              const r = t.y + t.height;
83199              const o = e.x;
83200              const a = e.y;
83201              const l = e.x + e.width;
83202              const h = e.y + e.height;
83203              return i <= l && n >= o && s <= h && r >= a;
83204            };
83205            rtt.rectPolygon = function(t, e) {
83206              const i = Q9.set(t.x, t.y);
83207              const s = $9.set(t.x, t.yMax);
83208              const n = ttt.set(t.xMax, t.yMax);
83209              const r = ett.set(t.xMax, t.y);
83210              if (itt(i, s, e)) return !0;
83211              if (itt(s, n, e)) return !0;
83212              if (itt(n, r, e)) return !0;
83213              if (itt(r, i, e)) return !0;
83214              for (let i = 0, s = e.length; i < s; ++i) if (t.contains(e[i])) return !0;
83215              return !!stt(i, e) || (!!stt(s, e) || (!!stt(n, e) || !!stt(r, e)));
83216            };
83217            rtt.rectCircle = function(t, e, i) {
83218              const s = e.x;
83219              const n = e.y;
83220              const r = t.x;
83221              const o = t.y;
83222              const a = t.width;
83223              const l = t.height;
83224              let h = s;
83225              let c = n;
83226              s < r ? h = r : s > r + a && (h = r + a);
83227              n < o ? c = o : n > o + l && (c = o + l);
83228              const u = s - h;
83229              const _ = n - c;
83230              return Math.sqrt(u * u + _ * _) <= i;
83231            };
83232            rtt.polygonPolygon = function(t, e) {
83233              let i;
83234              let s;
83235              for (i = 0, s = t.length; i < s; ++i) {
83236                if (itt(t[i], t[(i + 1) % s], e)) return !0;
83237              }
83238              for (i = 0, s = e.length; i < s; ++i) if (stt(e[i], t)) return !0;
83239              for (i = 0, s = t.length; i < s; ++i) if (stt(t[i], e)) return !0;
83240              return !1;
83241            };
83242            rtt.circleCircle = function(t, e, i, s) {
83243              return Qi.distance(t, i) < e + s;
83244            };
83245            rtt.polygonCircle = function(t, e, i) {
83246              const s = e;
83247              if (stt(s, t)) return !0;
83248              for (let e = 0, n = t.length; e < n; e++) {
83249                if (ntt(s, 0 === e ? t[t.length - 1] : t[e - 1], t[e], !0) < i) return !0;
83250              }
83251              return !1;
83252            };
83253            rtt.pointInPolygon = stt;
83254            rtt.pointLineDistance = ntt;
83255            var ott, att, ltt, htt, ctt, utt, _tt, dtt, ptt, mtt, ftt, gtt, ytt, btt, Stt;
83256            let Att = function(e) {
83257              return t({
83258                Billboard: e,
83259                BillboardComponent: e
83260              }), e;
83261            }((ott = Ul("cc.Billboard"), att = sh(), ltt = $l(), htt = Th(LC), ctt = Th(LC),
83262            utt = lh(), _tt = lh(), dtt = lh(), ptt = lh(), ott(mtt = att(mtt = ltt(mtt = Ql(mtt = (ftt = class extends Qc {
83263              get texture() {
83264                return this._texture;
83265              }
83266              set texture(t) {
83267                this._texture = t;
83268                this._material && this._material.setProperty("mainTexture", t);
83269              }
83270              get height() {
83271                return this._height;
83272              }
83273              set height(t) {
83274                this._height = t;
83275                if (this._material) {
83276                  this._uniform.y = t;
83277                  this._material.setProperty("cc_size_rotation", this._uniform);
83278                }
83279              }
83280              get width() {
83281                return this._width;
83282              }
83283              set width(t) {
83284                this._width = t;
83285                if (this._material) {
83286                  this._uniform.x = t;
83287                  this._material.setProperty("cc_size_rotation", this._uniform);
83288                }
83289              }
83290              get rotation() {
83291                return Math.round(100 * fi(this._rotation)) / 100;
83292              }
83293              set rotation(t) {
83294                this._rotation = mi(t);
83295                if (this._material) {
83296                  this._uniform.z = this._rotation;
83297                  this._material.setProperty("cc_size_rotation", this._uniform);
83298                }
83299              }
83300              constructor() {
83301                super();
83302                Ml(this, "_texture", gtt, this);
83303                Ml(this, "_height", ytt, this);
83304                Ml(this, "_width", btt, this);
83305                Ml(this, "_rotation", Stt, this);
83306                this._model = null;
83307                this._mesh = null;
83308                this._material = null;
83309                this._uniform = new is(1, 1, 0, 0);
83310              }
83311              onLoad() {
83312                this.createModel();
83313              }
83314              onEnable() {
83315                this.attachToScene();
83316                this._model.enabled = !0;
83317                this.width = this._width;
83318                this.height = this._height;
83319                this.rotation = this.rotation;
83320                this.texture = this.texture;
83321              }
83322              onDisable() {
83323                this.detachFromScene();
83324              }
83325              attachToScene() {
83326                if (this._model && this.node && this.node.scene) {
83327                  this._model.scene && this.detachFromScene();
83328                  this._getRenderScene().addModel(this._model);
83329                }
83330              }
83331              detachFromScene() {
83332                this._model && this._model.scene && this._model.scene.removeModel(this._model);
83333              }
83334              createModel() {
83335                this._mesh = DI({
83336                  primitiveMode: Xs.TRIANGLE_LIST,
83337                  positions: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
83338                  uvs: [ 0, 0, 1, 0, 0, 1, 1, 1 ],
83339                  colors: [ Bi.WHITE.r, Bi.WHITE.g, Bi.WHITE.b, Bi.WHITE.a, Bi.WHITE.r, Bi.WHITE.g, Bi.WHITE.b, Bi.WHITE.a, Bi.WHITE.r, Bi.WHITE.g, Bi.WHITE.b, Bi.WHITE.a, Bi.WHITE.r, Bi.WHITE.g, Bi.WHITE.b, Bi.WHITE.a ],
83340                  attributes: [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RG32F), new Vn(cr.ATTR_COLOR, bs.RGBA8UI, !0) ],
83341                  indices: [ 0, 1, 2, 1, 2, 3 ]
83342                }, void 0, {
83343                  calculateBounds: !1
83344                });
83345                const t = this._model = m.director.root.createModel(wA, this.node);
83346                t.node = t.transform = this.node;
83347                if (null == this._material) {
83348                  this._material = new hm;
83349                  this._material.copy(xR.get("default-billboard-material"));
83350                }
83351                t.initSubModel(0, this._mesh.renderingSubMeshes[0], this._material);
83352              }
83353            }, gtt = Bl(ftt.prototype, "_texture", [ htt ], {
83354              configurable: !0,
83355              enumerable: !0,
83356              writable: !0,
83357              initializer: function() {
83358                return null;
83359              }
83360            }), Bl(ftt.prototype, "texture", [ ctt, utt ], Object.getOwnPropertyDescriptor(ftt.prototype, "texture"), ftt.prototype),
83361            ytt = Bl(ftt.prototype, "_height", [ Yl ], {
83362              configurable: !0,
83363              enumerable: !0,
83364              writable: !0,
83365              initializer: function() {
83366                return 0;
83367              }
83368            }), Bl(ftt.prototype, "height", [ _tt ], Object.getOwnPropertyDescriptor(ftt.prototype, "height"), ftt.prototype),
83369            btt = Bl(ftt.prototype, "_width", [ Yl ], {
83370              configurable: !0,
83371              enumerable: !0,
83372              writable: !0,
83373              initializer: function() {
83374                return 0;
83375              }
83376            }), Bl(ftt.prototype, "width", [ dtt ], Object.getOwnPropertyDescriptor(ftt.prototype, "width"), ftt.prototype),
83377            Stt = Bl(ftt.prototype, "_rotation", [ Yl ], {
83378              configurable: !0,
83379              enumerable: !0,
83380              writable: !0,
83381              initializer: function() {
83382                return 0;
83383              }
83384            }), Bl(ftt.prototype, "rotation", [ ptt ], Object.getOwnPropertyDescriptor(ftt.prototype, "rotation"), ftt.prototype),
83385            ftt)) || mtt) || mtt) || mtt) || mtt));
83386            const Ttt = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RGBA32F), new Vn(cr.ATTR_TEX_COORD1, bs.RGB32F), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0) ];
83387            const vtt = new Pi;
83388            const Ett = new Pi;
83389            class Ctt extends wA {
83390              constructor() {
83391                super();
83392                this._capacity = void 0;
83393                this._vertSize = 0;
83394                this._vBuffer = null;
83395                this._vertAttrsFloatCount = 0;
83396                this._vdataF32 = null;
83397                this._vdataUint32 = null;
83398                this._iaInfo = void 0;
83399                this._iaInfoBuffer = void 0;
83400                this._subMeshData = null;
83401                this._vertCount = 0;
83402                this._indexCount = 0;
83403                this._material = null;
83404                this._registerListeners();
83405                this.type = xA.LINE;
83406                this._capacity = 100;
83407                this._iaInfo = new Cn([ new vn ]);
83408                this._iaInfoBuffer = this._device.createBuffer(new An(Ts.INDIRECT, Cs.DEVICE, mr, mr));
83409              }
83410              setCapacity(t) {
83411                this._capacity = t;
83412                this.createBuffer();
83413              }
83414              createBuffer() {
83415                this._vertSize = 0;
83416                for (const t of Ttt) {
83417                  t.offset = this._vertSize;
83418                  this._vertSize += ur[t.format].size;
83419                }
83420                this._vertAttrsFloatCount = this._vertSize / 4;
83421                this._vBuffer = this.createSubMeshData();
83422                this._vdataF32 = new Float32Array(this._vBuffer);
83423                this._vdataUint32 = new Uint32Array(this._vBuffer);
83424              }
83425              updateMaterial(t) {
83426                this._material = t;
83427                super.setSubModelMaterial(0, t);
83428              }
83429              createSubMeshData() {
83430                this._subMeshData && this.destroySubMeshData();
83431                this._vertCount = 2;
83432                this._indexCount = 6;
83433                const t = this._device.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.DEVICE, this._vertSize * this._capacity * this._vertCount, this._vertSize));
83434                const e = new ArrayBuffer(this._vertSize * this._capacity * this._vertCount);
83435                t.update(e);
83436                const i = new Uint16Array((this._capacity - 1) * this._indexCount);
83437                let s = 0;
83438                for (let t = 0; t < this._capacity - 1; ++t) {
83439                  const e = 2 * t;
83440                  i[s++] = e;
83441                  i[s++] = e + 1;
83442                  i[s++] = e + 2;
83443                  i[s++] = e + 3;
83444                  i[s++] = e + 2;
83445                  i[s++] = e + 1;
83446                }
83447                const n = this._device.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, (this._capacity - 1) * this._indexCount * Uint16Array.BYTES_PER_ELEMENT, Uint16Array.BYTES_PER_ELEMENT));
83448                n.update(i);
83449                this._iaInfo.drawInfos[0].vertexCount = this._capacity * this._vertCount;
83450                this._iaInfo.drawInfos[0].indexCount = (this._capacity - 1) * this._indexCount;
83451                this._iaInfoBuffer.update(this._iaInfo);
83452                this._subMeshData = new fC([ t ], Ttt, Xs.TRIANGLE_LIST, n, this._iaInfoBuffer);
83453                this.initSubModel(0, this._subMeshData, this._material);
83454                return e;
83455              }
83456              addLineVertexData(t, e, i) {
83457                if (t.length > 1) {
83458                  let s = 0;
83459                  Pi.subtract(vtt, t[1], t[0]);
83460                  this._vdataF32[s++] = t[0].x;
83461                  this._vdataF32[s++] = t[0].y;
83462                  this._vdataF32[s++] = t[0].z;
83463                  this._vdataF32[s++] = 0;
83464                  this._vdataF32[s++] = e.evaluate(0, 1);
83465                  this._vdataF32[s++] = 0;
83466                  this._vdataF32[s++] = 0;
83467                  this._vdataF32[s++] = vtt.x;
83468                  this._vdataF32[s++] = vtt.y;
83469                  this._vdataF32[s++] = vtt.z;
83470                  this._vdataUint32[s++] = i.evaluate(0, 1)._val;
83471                  this._vdataF32[s++] = t[0].x;
83472                  this._vdataF32[s++] = t[0].y;
83473                  this._vdataF32[s++] = t[0].z;
83474                  this._vdataF32[s++] = 1;
83475                  this._vdataF32[s++] = e.evaluate(0, 1);
83476                  this._vdataF32[s++] = 0;
83477                  this._vdataF32[s++] = 1;
83478                  this._vdataF32[s++] = vtt.x;
83479                  this._vdataF32[s++] = vtt.y;
83480                  this._vdataF32[s++] = vtt.z;
83481                  this._vdataUint32[s++] = i.evaluate(0, 1)._val;
83482                  for (let n = 1; n < t.length - 1; n++) {
83483                    Pi.subtract(vtt, t[n - 1], t[n]);
83484                    Pi.subtract(Ett, t[n + 1], t[n]);
83485                    Pi.subtract(Ett, Ett, vtt);
83486                    const r = n / t.length;
83487                    this._vdataF32[s++] = t[n].x;
83488                    this._vdataF32[s++] = t[n].y;
83489                    this._vdataF32[s++] = t[n].z;
83490                    this._vdataF32[s++] = 0;
83491                    this._vdataF32[s++] = e.evaluate(r, 1);
83492                    this._vdataF32[s++] = r;
83493                    this._vdataF32[s++] = 0;
83494                    this._vdataF32[s++] = Ett.x;
83495                    this._vdataF32[s++] = Ett.y;
83496                    this._vdataF32[s++] = Ett.z;
83497                    this._vdataUint32[s++] = i.evaluate(r, 1)._val;
83498                    this._vdataF32[s++] = t[n].x;
83499                    this._vdataF32[s++] = t[n].y;
83500                    this._vdataF32[s++] = t[n].z;
83501                    this._vdataF32[s++] = 1;
83502                    this._vdataF32[s++] = e.evaluate(r, 1);
83503                    this._vdataF32[s++] = r;
83504                    this._vdataF32[s++] = 1;
83505                    this._vdataF32[s++] = Ett.x;
83506                    this._vdataF32[s++] = Ett.y;
83507                    this._vdataF32[s++] = Ett.z;
83508                    this._vdataUint32[s++] = i.evaluate(r, 1)._val;
83509                  }
83510                  Pi.subtract(vtt, t[t.length - 1], t[t.length - 2]);
83511                  this._vdataF32[s++] = t[t.length - 1].x;
83512                  this._vdataF32[s++] = t[t.length - 1].y;
83513                  this._vdataF32[s++] = t[t.length - 1].z;
83514                  this._vdataF32[s++] = 0;
83515                  this._vdataF32[s++] = e.evaluate(1, 1);
83516                  this._vdataF32[s++] = 1;
83517                  this._vdataF32[s++] = 0;
83518                  this._vdataF32[s++] = vtt.x;
83519                  this._vdataF32[s++] = vtt.y;
83520                  this._vdataF32[s++] = vtt.z;
83521                  this._vdataUint32[s++] = i.evaluate(1, 1)._val;
83522                  this._vdataF32[s++] = t[t.length - 1].x;
83523                  this._vdataF32[s++] = t[t.length - 1].y;
83524                  this._vdataF32[s++] = t[t.length - 1].z;
83525                  this._vdataF32[s++] = 1;
83526                  this._vdataF32[s++] = e.evaluate(1, 1);
83527                  this._vdataF32[s++] = 1;
83528                  this._vdataF32[s++] = 1;
83529                  this._vdataF32[s++] = vtt.x;
83530                  this._vdataF32[s++] = vtt.y;
83531                  this._vdataF32[s++] = vtt.z;
83532                  this._vdataUint32[s++] = i.evaluate(1, 1)._val;
83533                }
83534                this.updateIA(Math.max(0, t.length - 1));
83535              }
83536              updateIA(t) {
83537                this._subModels[0].inputAssembler.vertexBuffers[0].update(this._vdataF32);
83538                this._iaInfo.drawInfos[0].firstIndex = 0;
83539                this._iaInfo.drawInfos[0].indexCount = this._indexCount * t;
83540                this._iaInfoBuffer.update(this._iaInfo);
83541              }
83542              destroySubMeshData() {
83543                if (this._subMeshData) {
83544                  this._subMeshData.destroy();
83545                  this._subMeshData = null;
83546                }
83547              }
83548            }
83549            var xtt, wtt, Rtt;
83550            const Itt = si.Attr.setClassAttr;
83551            const Mtt = [ [ "mode", "constant", "multiplier" ], [ "mode", "spline", "multiplier" ], [ "mode", "splineMin", "splineMax", "multiplier" ], [ "mode", "constantMin", "constantMax", "multiplier" ] ];
83552            const Btt = oe({
83553              Constant: 0,
83554              Curve: 1,
83555              TwoCurves: 2,
83556              TwoConstants: 3
83557            });
83558            let Dtt = t("CurveRange", Ul("cc.CurveRange")(xtt = (Rtt = wtt = class {
83559              get curve() {
83560                var t;
83561                return null !== (t = this._curve) && void 0 !== t ? t : this._curve = new Op(this.spline);
83562              }
83563              set curve(t) {
83564                this._curve = t;
83565                this.spline = t._internalCurve;
83566              }
83567              get curveMin() {
83568                var t;
83569                return null !== (t = this._curveMin) && void 0 !== t ? t : this._curveMin = new Op(this.splineMin);
83570              }
83571              set curveMin(t) {
83572                this._curveMin = t;
83573                this.splineMin = t._internalCurve;
83574              }
83575              get curveMax() {
83576                var t;
83577                return null !== (t = this._curveMax) && void 0 !== t ? t : this._curveMax = new Op(this.splineMax);
83578              }
83579              set curveMax(t) {
83580                this._curveMax = t;
83581                this.splineMax = t._internalCurve;
83582              }
83583              constructor() {
83584                this.mode = Btt.Constant;
83585                this.spline = Fp();
83586                this.splineMin = Fp();
83587                this.splineMax = Fp();
83588                this.constant = 0;
83589                this.constantMin = 0;
83590                this.constantMax = 0;
83591                this.multiplier = 1;
83592              }
83593              evaluate(t, e) {
83594                switch (this.mode) {
83595                 default:
83596                 case Btt.Constant:
83597                  return this.constant;
83598
83599                 case Btt.Curve:
83600                  return this.spline.evaluate(t) * this.multiplier;
83601
83602                 case Btt.TwoCurves:
83603                  return pi(this.splineMin.evaluate(t), this.splineMax.evaluate(t), e) * this.multiplier;
83604
83605                 case Btt.TwoConstants:
83606                  return pi(this.constantMin, this.constantMax, e);
83607                }
83608              }
83609              getMax() {
83610                switch (this.mode) {
83611                 default:
83612                 case Btt.Constant:
83613                  return this.constant;
83614
83615                 case Btt.Curve:
83616                  return this.multiplier;
83617
83618                 case Btt.TwoConstants:
83619                  return this.constantMax;
83620
83621                 case Btt.TwoCurves:
83622                  return this.multiplier;
83623                }
83624              }
83625              _onBeforeSerialize(t) {
83626                return Mtt[this.mode];
83627              }
83628            }, wtt.Mode = Btt, Rtt)) || xtt);
83629            si.fastDefine("cc.CurveRange", Dtt, {
83630              multiplier: 1,
83631              constantMax: 0,
83632              constantMin: 0,
83633              constant: 0,
83634              mode: Btt.Constant,
83635              splineMax: Object.freeze(Fp()),
83636              splineMin: Object.freeze(Fp()),
83637              spline: Object.freeze(Fp())
83638            });
83639            Itt(Dtt, "multiplier", "visible", !0);
83640            Itt(Dtt, "constantMax", "visible", !0);
83641            Itt(Dtt, "constantMin", "visible", !0);
83642            Itt(Dtt, "constant", "visible", !0);
83643            Itt(Dtt, "mode", "type", "Enum");
83644            Itt(Dtt, "mode", "enumList", oe.getList(Btt));
83645            Itt(Dtt, "mode", "visible", !0);
83646            Itt(Dtt, "splineMax", "type", "Object");
83647            Itt(Dtt, "splineMax", "ctor", Od);
83648            Itt(Dtt, "splineMax", "visible", !0);
83649            Itt(Dtt, "splineMin", "type", "Object");
83650            Itt(Dtt, "splineMin", "ctor", Od);
83651            Itt(Dtt, "splineMin", "visible", !0);
83652            Itt(Dtt, "spline", "type", "Object");
83653            Itt(Dtt, "spline", "ctor", Od);
83654            Itt(Dtt, "spline", "visible", !0);
83655            function Ptt(t, e, i) {
83656              switch (t.mode) {
83657               case Btt.Constant:
83658                return t.constant;
83659
83660               case Btt.Curve:
83661                return t.spline.evaluate(e) * t.multiplier;
83662
83663               case Btt.TwoCurves:
83664                return 0 === i ? t.splineMin.evaluate(e) * t.multiplier : t.splineMax.evaluate(e) * t.multiplier;
83665
83666               case Btt.TwoConstants:
83667                return 0 === i ? t.constantMin : t.constantMax;
83668
83669               default:
83670                return 0;
83671              }
83672            }
83673            function Ott(t) {
83674              switch (t.mode) {
83675               case Btt.TwoConstants:
83676               case Btt.TwoCurves:
83677                return 2;
83678
83679               default:
83680                return 1;
83681              }
83682            }
83683            function Ntt(t, e, i, s) {
83684              if (null === t || i !== t.width || s !== t.height) {
83685                t && t.destroy();
83686                t = function(t, e, i) {
83687                  const s = new IC({
83688                    width: e,
83689                    height: i,
83690                    _data: t,
83691                    _compressed: !1,
83692                    format: Jp.RGBA32F
83693                  });
83694                  const n = new LC;
83695                  n.setFilters(Qp.NEAREST, Qp.NEAREST);
83696                  n.setMipFilter(Qp.NONE);
83697                  n.setWrapMode(Zp.CLAMP_TO_EDGE, Zp.CLAMP_TO_EDGE, Zp.CLAMP_TO_EDGE);
83698                  n.image = s;
83699                  return n;
83700                }(e, i, s);
83701              } else t.uploadData(e);
83702              return t;
83703            }
83704            function Ltt(t, e, i, s, n, r, o) {
83705              const a = Math.max(Ott(s), Ott(n), Ott(r));
83706              const l = i * a * 4;
83707              null !== e && e.length === l || (e = new Float32Array(i * a * 4));
83708              const h = [ s, n, r ];
83709              const c = 1 / (i - 1);
83710              for (let t = 0; t < a; t++) for (let s = 0; s < 3; s++) {
83711                const n = h[s];
83712                let r = 0;
83713                let a = 0;
83714                for (let l = 0; l < i; l++) {
83715                  const h = Ptt(n, c * l, t);
83716                  if (o) a = h; else {
83717                    r += h;
83718                    a = r / (l + 1);
83719                  }
83720                  e[4 * (t * i + l) + s] = a;
83721                }
83722              }
83723              return {
83724                texture: Ntt(t, e, i, a),
83725                texdata: e
83726              };
83727            }
83728            const Ftt = oe({
83729              Blend: 0,
83730              Fixed: 1
83731            });
83732            class Vtt {
83733              constructor() {
83734                this.color = Bi.WHITE.clone();
83735                this.time = 0;
83736              }
83737            }
83738            t("ColorKey", Vtt);
83739            si.fastDefine("cc.ColorKey", Vtt, {
83740              color: Bi.WHITE.clone(),
83741              time: 0
83742            });
83743            si.Attr.setClassAttr(Vtt, "color", "visible", !0);
83744            si.Attr.setClassAttr(Vtt, "time", "visible", !0);
83745            class ktt {
83746              constructor() {
83747                this.alpha = 1;
83748                this.time = 0;
83749              }
83750            }
83751            t("AlphaKey", ktt);
83752            si.fastDefine("cc.AlphaKey", ktt, {
83753              alpha: 1,
83754              time: 0
83755            });
83756            si.Attr.setClassAttr(ktt, "alpha", "visible", !0);
83757            si.Attr.setClassAttr(ktt, "time", "visible", !0);
83758            class Utt {
83759              constructor() {
83760                this.colorKeys = new Array;
83761                this.alphaKeys = new Array;
83762                this.mode = Ftt.Blend;
83763                this._color = void 0;
83764                this._color = Bi.WHITE.clone();
83765              }
83766              setKeys(t, e) {
83767                this.colorKeys = t;
83768                this.alphaKeys = e;
83769              }
83770              sortKeys() {
83771                this.colorKeys.length > 1 && this.colorKeys.sort(((t, e) => t.time - e.time));
83772                this.alphaKeys.length > 1 && this.alphaKeys.sort(((t, e) => t.time - e.time));
83773              }
83774              evaluate(t) {
83775                this.getRGB(t);
83776                this._color._set_a_unsafe(this.getAlpha(t));
83777                return this._color;
83778              }
83779              randomColor() {
83780                const t = this.colorKeys[Math.trunc(Math.random() * this.colorKeys.length)];
83781                const e = this.alphaKeys[Math.trunc(Math.random() * this.alphaKeys.length)];
83782                this._color.set(t.color);
83783                this._color._set_a_unsafe(e.alpha);
83784                return this._color;
83785              }
83786              getRGB(t) {
83787                if (this.colorKeys.length > 1) {
83788                  t = Ei(t, 1);
83789                  for (let e = 1; e < this.colorKeys.length; ++e) {
83790                    const i = this.colorKeys[e - 1].time;
83791                    const s = this.colorKeys[e].time;
83792                    if (t >= i && t < s) {
83793                      if (this.mode === Ftt.Fixed) return this.colorKeys[e].color;
83794                      const n = (t - i) / (s - i);
83795                      Bi.lerp(this._color, this.colorKeys[e - 1].color, this.colorKeys[e].color, n);
83796                      return this._color;
83797                    }
83798                  }
83799                  const e = this.colorKeys.length - 1;
83800                  t < this.colorKeys[0].time ? Bi.lerp(this._color, Bi.BLACK, this.colorKeys[0].color, t / this.colorKeys[0].time) : t > this.colorKeys[e].time && Bi.lerp(this._color, this.colorKeys[e].color, Bi.BLACK, (t - this.colorKeys[e].time) / (1 - this.colorKeys[e].time));
83801                  return this._color;
83802                }
83803                if (1 === this.colorKeys.length) {
83804                  this._color.set(this.colorKeys[0].color);
83805                  return this._color;
83806                }
83807                this._color.set(Bi.WHITE);
83808                return this._color;
83809              }
83810              getAlpha(t) {
83811                if (this.alphaKeys.length > 1) {
83812                  t = Ei(t, 1);
83813                  for (let e = 1; e < this.alphaKeys.length; ++e) {
83814                    const i = this.alphaKeys[e - 1].time;
83815                    const s = this.alphaKeys[e].time;
83816                    if (t >= i && t < s) {
83817                      if (this.mode === Ftt.Fixed) return this.alphaKeys[e].alpha;
83818                      const n = (t - i) / (s - i);
83819                      return pi(this.alphaKeys[e - 1].alpha, this.alphaKeys[e].alpha, n);
83820                    }
83821                  }
83822                  const e = this.alphaKeys.length - 1;
83823                  return t < this.alphaKeys[0].time ? pi(0, this.alphaKeys[0].alpha, t / this.alphaKeys[0].time) : t > this.alphaKeys[e].time ? pi(this.alphaKeys[e].alpha, 0, (t - this.alphaKeys[e].time) / (1 - this.alphaKeys[e].time)) : 255;
83824                }
83825                return 1 === this.alphaKeys.length ? this.alphaKeys[0].alpha : 255;
83826              }
83827            }
83828            t("Gradient", Utt);
83829            Utt.Mode = Ftt;
83830            si.fastDefine("cc.Gradient", Utt, {
83831              colorKeys: [],
83832              alphaKeys: [],
83833              mode: Ftt.Blend
83834            });
83835            si.Attr.setClassAttr(Utt, "colorKeys", "visible", !0);
83836            si.Attr.setClassAttr(Utt, "alphaKeys", "visible", !0);
83837            si.Attr.setClassAttr(Utt, "mode", "visible", !0);
83838            var Gtt, ztt, Htt, jtt, Xtt, Wtt, Ytt, qtt, Ktt, Jtt, Ztt, Qtt, $tt, tet, eet, iet, set;
83839            const net = oe({
83840              Color: 0,
83841              Gradient: 1,
83842              TwoColors: 2,
83843              TwoGradients: 3,
83844              RandomColor: 4
83845            });
83846            let ret = t("GradientRange", (Gtt = Ul("cc.GradientRange"), ztt = Th(net), Htt = Th(Utt),
83847            jtt = Th(Utt), Xtt = Th(Utt), Wtt = Th(net), Gtt(Ytt = (qtt = (set = iet = class {
83848              constructor() {
83849                Ml(this, "color", Ktt, this);
83850                Ml(this, "colorMin", Jtt, this);
83851                Ml(this, "colorMax", Ztt, this);
83852                Ml(this, "gradient", Qtt, this);
83853                Ml(this, "gradientMin", $tt, this);
83854                Ml(this, "gradientMax", tet, this);
83855                Ml(this, "_mode", eet, this);
83856                this._color = Bi.WHITE.clone();
83857              }
83858              get mode() {
83859                return this._mode;
83860              }
83861              set mode(t) {
83862                this._mode = t;
83863              }
83864              evaluate(t, e) {
83865                switch (this._mode) {
83866                 case net.Color:
83867                  return this.color;
83868
83869                 case net.TwoColors:
83870                  Bi.lerp(this._color, this.colorMin, this.colorMax, e);
83871                  return this._color;
83872
83873                 case net.RandomColor:
83874                  return this.gradient.randomColor();
83875
83876                 case net.Gradient:
83877                  return this.gradient.evaluate(t);
83878
83879                 case net.TwoGradients:
83880                  Bi.lerp(this._color, this.gradientMin.evaluate(t), this.gradientMax.evaluate(t), e);
83881                  return this._color;
83882
83883                 default:
83884                  return this.color;
83885                }
83886              }
83887              _onBeforeSerialize(t) {
83888                return false[this._mode];
83889              }
83890            }, iet.Mode = net, set), Bl(qtt.prototype, "mode", [ ztt ], Object.getOwnPropertyDescriptor(qtt.prototype, "mode"), qtt.prototype),
83891            Ktt = Bl(qtt.prototype, "color", [ Yl, nh ], {
83892              configurable: !0,
83893              enumerable: !0,
83894              writable: !0,
83895              initializer: function() {
83896                return Bi.WHITE.clone();
83897              }
83898            }), Jtt = Bl(qtt.prototype, "colorMin", [ Yl, nh ], {
83899              configurable: !0,
83900              enumerable: !0,
83901              writable: !0,
83902              initializer: function() {
83903                return Bi.WHITE.clone();
83904              }
83905            }), Ztt = Bl(qtt.prototype, "colorMax", [ Yl, nh ], {
83906              configurable: !0,
83907              enumerable: !0,
83908              writable: !0,
83909              initializer: function() {
83910                return Bi.WHITE.clone();
83911              }
83912            }), Qtt = Bl(qtt.prototype, "gradient", [ Htt ], {
83913              configurable: !0,
83914              enumerable: !0,
83915              writable: !0,
83916              initializer: function() {
83917                return new Utt;
83918              }
83919            }), $tt = Bl(qtt.prototype, "gradientMin", [ jtt ], {
83920              configurable: !0,
83921              enumerable: !0,
83922              writable: !0,
83923              initializer: function() {
83924                return new Utt;
83925              }
83926            }), tet = Bl(qtt.prototype, "gradientMax", [ Xtt ], {
83927              configurable: !0,
83928              enumerable: !0,
83929              writable: !0,
83930              initializer: function() {
83931                return new Utt;
83932              }
83933            }), eet = Bl(qtt.prototype, "_mode", [ Wtt ], {
83934              configurable: !0,
83935              enumerable: !0,
83936              writable: !0,
83937              initializer: function() {
83938                return net.Color;
83939              }
83940            }), qtt)) || Ytt));
83941            function oet(t, e, i) {
83942              switch (t.mode) {
83943               case net.Color:
83944                return t.color;
83945
83946               case net.TwoColors:
83947                return 0 === i ? t.colorMin : t.colorMax;
83948
83949               case net.RandomColor:
83950                return t.gradient.randomColor();
83951
83952               case net.Gradient:
83953                return t.gradient.evaluate(e);
83954
83955               case net.TwoGradients:
83956                return 0 === i ? t.gradientMin.evaluate(e) : t.gradientMax.evaluate(e);
83957
83958               default:
83959                return t.color;
83960              }
83961            }
83962            function aet(t, e, i, s) {
83963              const n = function(t) {
83964                switch (t.mode) {
83965                 case net.TwoColors:
83966                 case net.TwoGradients:
83967                  return 2;
83968
83969                 default:
83970                  return 1;
83971                }
83972              }(s);
83973              const r = i * n * 4;
83974              null !== e && e.length === r || (e = new Uint8Array(i * n * 4));
83975              const o = 1 / i;
83976              let a = 0;
83977              for (let t = 0; t < n; t++) for (let n = 0; n < i; n++) {
83978                const i = oet(s, o * n, t);
83979                e[a] = i.r;
83980                e[a + 1] = i.g;
83981                e[a + 2] = i.b;
83982                e[a + 3] = i.a;
83983                a += 4;
83984              }
83985              if (null === t || i !== t.width || n !== t.height) {
83986                t && t.destroy();
83987                (t = new LC).create(i, n, Jp.RGBA8888);
83988                t.setFilters(Qp.LINEAR, Qp.LINEAR);
83989                t.setWrapMode(Zp.CLAMP_TO_EDGE, Zp.CLAMP_TO_EDGE);
83990              }
83991              t.uploadData(e);
83992              return {
83993                texture: t,
83994                texdata: e
83995              };
83996            }
83997            var het, cet, uet, _et, det, pet, met, fet, get, yet, bet, Aet, Tet, vet, Eet, Cet, xet, wet, Ret, Iet, Met, Bet, Det, Pet, Oet, Net, Let, Fet, Vet, ket, Uet, Get, zet, Het, jet, Xet, Wet, Yet, qet, Ket, Jet;
83998            const Zet = {
83999              parent: null,
84000              owner: null,
84001              subModelIdx: 0
84002            };
84003            const Qet = {
84004              CC_USE_WORLD_SPACE: !1
84005            };
84006            let $et = function(e) {
84007              return t({
84008                Line: e,
84009                LineComponent: e
84010              }), e;
84011            }((het = Ul("cc.Line"), cet = sh(), uet = $l(), _et = Th(LC), det = Th(LC), pet = ph(),
84012            met = lh(), fet = Th(hm), get = ph(), yet = lh(), bet = ph(), Aet = lh(), Tet = Th([ Pi ]),
84013            vet = Th([ Pi ]), Eet = ph(), Cet = lh(), xet = Th(Dtt), wet = Th(Dtt), Ret = hh(),
84014            Iet = ph(), Met = lh(), Bet = Th(Qi), Det = ph(), Pet = lh(), Oet = Th(Qi), Net = ph(),
84015            Let = lh(), Fet = Th(ret), Vet = Th(ret), ket = ph(), Uet = lh(), het(Get = cet(Get = uet(Get = Ql(Get = (zet = class extends Qc {
84016              get texture() {
84017                return this._texture;
84018              }
84019              set texture(t) {
84020                this._texture = t;
84021                this._materialInstance && this._materialInstance.setProperty("mainTexture", t);
84022              }
84023              get material() {
84024                return this._material;
84025              }
84026              set material(t) {
84027                this._material = t;
84028              }
84029              get worldSpace() {
84030                return this._worldSpace;
84031              }
84032              set worldSpace(t) {
84033                this._worldSpace = t;
84034                if (this._materialInstance) {
84035                  Qet.CC_USE_WORLD_SPACE = this.worldSpace;
84036                  this._materialInstance.recompileShaders(Qet);
84037                  this._model && this._model.setSubModelMaterial(0, this._materialInstance);
84038                }
84039              }
84040              get positions() {
84041                return this._positions;
84042              }
84043              set positions(t) {
84044                this._positions = t;
84045                this._model && this._model.addLineVertexData(this._positions, this._width, this._color);
84046              }
84047              get width() {
84048                return this._width;
84049              }
84050              set width(t) {
84051                this._width = t;
84052                this._model && this._model.addLineVertexData(this._positions, this._width, this._color);
84053              }
84054              get tile() {
84055                return this._tile;
84056              }
84057              set tile(t) {
84058                this._tile.set(t);
84059                if (this._materialInstance) {
84060                  this._tile_offset.x = this._tile.x;
84061                  this._tile_offset.y = this._tile.y;
84062                  this._materialInstance.setProperty("mainTiling_Offset", this._tile_offset);
84063                }
84064              }
84065              get offset() {
84066                return this._offset;
84067              }
84068              set offset(t) {
84069                this._offset.set(t);
84070                if (this._materialInstance) {
84071                  this._tile_offset.z = this._offset.x;
84072                  this._tile_offset.w = this._offset.y;
84073                  this._materialInstance.setProperty("mainTiling_Offset", this._tile_offset);
84074                }
84075              }
84076              get color() {
84077                return this._color;
84078              }
84079              set color(t) {
84080                this._color = t;
84081                this._model && this._model.addLineVertexData(this._positions, this._width, this._color);
84082              }
84083              constructor() {
84084                super();
84085                Ml(this, "_texture", Het, this);
84086                Ml(this, "_material", jet, this);
84087                this._materialInstance = null;
84088                Ml(this, "_worldSpace", Xet, this);
84089                Ml(this, "_positions", Wet, this);
84090                Ml(this, "_width", Yet, this);
84091                Ml(this, "_tile", qet, this);
84092                Ml(this, "_offset", Ket, this);
84093                Ml(this, "_color", Jet, this);
84094                this._model = null;
84095                this._tile_offset = new is;
84096              }
84097              onLoad() {
84098                const t = this._model = m.director.root.createModel(Ctt);
84099                t.node = t.transform = this.node;
84100                if (null === this._material) {
84101                  this._material = new hm;
84102                  this._material.copy(xR.get("default-trail-material"));
84103                }
84104                if (this._material) {
84105                  Qet.CC_USE_WORLD_SPACE = this.worldSpace;
84106                  Zet.parent = this._material;
84107                  Zet.subModelIdx = 0;
84108                  this._materialInstance = new uS(Zet);
84109                  Zet.parent = null;
84110                  Zet.subModelIdx = 0;
84111                  this._materialInstance.recompileShaders(Qet);
84112                }
84113                t.updateMaterial(this._materialInstance);
84114                t.setCapacity(100);
84115              }
84116              onEnable() {
84117                if (this._model) {
84118                  this._attachToScene();
84119                  this.texture = this._texture;
84120                  this.tile = this._tile;
84121                  this.offset = this._offset;
84122                  this._model.addLineVertexData(this._positions, this._width, this._color);
84123                }
84124              }
84125              onDisable() {
84126                this._model && this._detachFromScene();
84127              }
84128              _attachToScene() {
84129                if (this._model && this.node && this.node.scene) {
84130                  this._model.scene && this._detachFromScene();
84131                  this._getRenderScene().addModel(this._model);
84132                }
84133              }
84134              _detachFromScene() {
84135                this._model && this._model.scene && this._model.scene.removeModel(this._model);
84136              }
84137            }, Het = Bl(zet.prototype, "_texture", [ _et ], {
84138              configurable: !0,
84139              enumerable: !0,
84140              writable: !0,
84141              initializer: function() {
84142                return null;
84143              }
84144            }), Bl(zet.prototype, "texture", [ det, pet, met ], Object.getOwnPropertyDescriptor(zet.prototype, "texture"), zet.prototype),
84145            jet = Bl(zet.prototype, "_material", [ Yl ], {
84146              configurable: !0,
84147              enumerable: !0,
84148              writable: !0,
84149              initializer: function() {
84150                return null;
84151              }
84152            }), Bl(zet.prototype, "material", [ fet, get, yet ], Object.getOwnPropertyDescriptor(zet.prototype, "material"), zet.prototype),
84153            Xet = Bl(zet.prototype, "_worldSpace", [ Yl ], {
84154              configurable: !0,
84155              enumerable: !0,
84156              writable: !0,
84157              initializer: function() {
84158                return !1;
84159              }
84160            }), Bl(zet.prototype, "worldSpace", [ bet, Aet ], Object.getOwnPropertyDescriptor(zet.prototype, "worldSpace"), zet.prototype),
84161            Wet = Bl(zet.prototype, "_positions", [ Tet ], {
84162              configurable: !0,
84163              enumerable: !0,
84164              writable: !0,
84165              initializer: function() {
84166                return [];
84167              }
84168            }), Bl(zet.prototype, "positions", [ vet, Eet, Cet ], Object.getOwnPropertyDescriptor(zet.prototype, "positions"), zet.prototype),
84169            Yet = Bl(zet.prototype, "_width", [ xet ], {
84170              configurable: !0,
84171              enumerable: !0,
84172              writable: !0,
84173              initializer: function() {
84174                return new Dtt;
84175              }
84176            }), Bl(zet.prototype, "width", [ wet, Ret, Iet, Met ], Object.getOwnPropertyDescriptor(zet.prototype, "width"), zet.prototype),
84177            qet = Bl(zet.prototype, "_tile", [ Yl ], {
84178              configurable: !0,
84179              enumerable: !0,
84180              writable: !0,
84181              initializer: function() {
84182                return new Qi(1, 1);
84183              }
84184            }), Bl(zet.prototype, "tile", [ Bet, Det, Pet ], Object.getOwnPropertyDescriptor(zet.prototype, "tile"), zet.prototype),
84185            Ket = Bl(zet.prototype, "_offset", [ Yl ], {
84186              configurable: !0,
84187              enumerable: !0,
84188              writable: !0,
84189              initializer: function() {
84190                return new Qi(0, 0);
84191              }
84192            }), Bl(zet.prototype, "offset", [ Oet, Net, Let ], Object.getOwnPropertyDescriptor(zet.prototype, "offset"), zet.prototype),
84193            Jet = Bl(zet.prototype, "_color", [ Fet ], {
84194              configurable: !0,
84195              enumerable: !0,
84196              writable: !0,
84197              initializer: function() {
84198                return new ret;
84199              }
84200            }), Bl(zet.prototype, "color", [ Vet, ket, Uet ], Object.getOwnPropertyDescriptor(zet.prototype, "color"), zet.prototype),
84201            zet)) || Get) || Get) || Get) || Get));
84202            class tit {
84203              constructor(t) {
84204                this.particleSystem = void 0;
84205                this.position = void 0;
84206                this.velocity = void 0;
84207                this.animatedVelocity = void 0;
84208                this.ultimateVelocity = void 0;
84209                this.angularVelocity = void 0;
84210                this.axisOfRotation = void 0;
84211                this.rotation = void 0;
84212                this.startEuler = void 0;
84213                this.startRotation = void 0;
84214                this.startRotated = void 0;
84215                this.deltaQuat = void 0;
84216                this.deltaMat = void 0;
84217                this.localMat = void 0;
84218                this.startSize = void 0;
84219                this.size = void 0;
84220                this.startColor = void 0;
84221                this.color = void 0;
84222                this.randomSeed = void 0;
84223                this.remainingLifetime = void 0;
84224                this.loopCount = void 0;
84225                this.lastLoop = void 0;
84226                this.trailDelay = void 0;
84227                this.startLifetime = void 0;
84228                this.emitAccumulator0 = void 0;
84229                this.emitAccumulator1 = void 0;
84230                this.frameIndex = void 0;
84231                this.startRow = void 0;
84232                this.particleSystem = t;
84233                this.position = new Pi(0, 0, 0);
84234                this.velocity = new Pi(0, 0, 0);
84235                this.animatedVelocity = new Pi(0, 0, 0);
84236                this.ultimateVelocity = new Pi(0, 0, 0);
84237                this.angularVelocity = new Pi(0, 0, 0);
84238                this.axisOfRotation = new Pi(0, 0, 0);
84239                this.rotation = new Pi(0, 0, 0);
84240                this.startEuler = new Pi(0, 0, 0);
84241                this.startRotation = new Ui;
84242                this.startRotated = !1;
84243                this.deltaQuat = new Ui;
84244                this.deltaMat = new qi;
84245                this.localMat = new qi;
84246                this.startSize = new Pi(0, 0, 0);
84247                this.size = new Pi(0, 0, 0);
84248                this.startColor = Bi.WHITE.clone();
84249                this.color = Bi.WHITE.clone();
84250                this.randomSeed = 0;
84251                this.remainingLifetime = 0;
84252                this.loopCount = 0;
84253                this.lastLoop = 0;
84254                this.trailDelay = 0;
84255                this.startLifetime = 0;
84256                this.emitAccumulator0 = 0;
84257                this.emitAccumulator1 = 0;
84258                this.frameIndex = 0;
84259                this.startRow = 0;
84260              }
84261              reset() {
84262                this.rotation.set(0, 0, 0);
84263                this.startEuler.set(0, 0, 0);
84264                this.startRotation.set(0, 0, 0, 1);
84265                this.startRotated = !1;
84266                this.deltaQuat.set(0, 0, 0, 1);
84267                this.deltaMat.identity();
84268                this.localMat.identity();
84269              }
84270            }
84271            tit.INDENTIFY_NEG_QUAT = 10;
84272            tit.R2D = 180 / Math.PI;
84273            const eit = "colorModule", iit = "forceModule", sit = "limitModule", nit = "rotationModule", rit = "sizeModule", oit = "velocityModule", ait = "textureModule", lit = "noiseModule";
84274            const hit = [ "sizeModule", "colorModule", "forceModule", "velocityModule", "limitModule", "rotationModule", "textureModule", "noiseModule" ];
84275            const cit = [ "_colorOverLifetimeModule", "_shapeModule", "_sizeOvertimeModule", "_velocityOvertimeModule", "_forceOvertimeModule", "_limitVelocityOvertimeModule", "_rotationOvertimeModule", "_textureAnimationModule", "_noiseModule", "_trailModule" ];
84276            class uit {
84277              constructor() {
84278                this.target = null;
84279                this.needUpdate = !1;
84280                this.needAnimate = !0;
84281                this.name = void 0;
84282              }
84283              bindTarget(t) {
84284                this.target = t;
84285              }
84286              update(t, e) {}
84287            }
84288            const _it = oe({
84289              World: 0,
84290              Local: 1,
84291              Custom: 2
84292            });
84293            const dit = oe({
84294              Pause: 0,
84295              PauseAndCatchup: 1,
84296              AlwaysSimulate: 2
84297            });
84298            const pit = oe({
84299              World: 0,
84300              Local: 1,
84301              View: 2
84302            });
84303            const mit = oe({
84304              Billboard: 0,
84305              StrecthedBillboard: 1,
84306              HorizontalBillboard: 2,
84307              VerticalBillboard: 3,
84308              Mesh: 4
84309            });
84310            const fit = oe({
84311              Box: 0,
84312              Circle: 1,
84313              Cone: 2,
84314              Sphere: 3,
84315              Hemisphere: 4
84316            });
84317            const git = oe({
84318              Base: 0,
84319              Edge: 1,
84320              Shell: 2,
84321              Volume: 3
84322            });
84323            const yit = oe({
84324              Random: 0,
84325              Loop: 1,
84326              PingPong: 2
84327            });
84328            const bit = oe({
84329              Particles: 0
84330            });
84331            const Sit = oe({
84332              Stretch: 0
84333            });
84334            const Ait = 23541, Tit = 39825, vit = 90794, Eit = 212165, Cit = 125292, xit = 197866, wit = 156497, Rit = 984136;
84335            var Iit, Mit, Bit, Dit, Pit, Oit, Nit, Lit;
84336            const Fit = 91041;
84337            let Vit = (Iit = Ul("cc.ColorOvertimeModule"), Mit = ph(), Bit = Th(ret), Dit = ph(),
84338            Iit(Pit = (Oit = class extends uit {
84339              constructor(...t) {
84340                super(...t);
84341                Ml(this, "_enable", Nit, this);
84342                Ml(this, "color", Lit, this);
84343                this.name = eit;
84344              }
84345              get enable() {
84346                return this._enable;
84347              }
84348              set enable(t) {
84349                if (this._enable !== t) {
84350                  this._enable = t;
84351                  this.target && this.target.enableModule(this.name, t, this);
84352                }
84353              }
84354              animate(t) {
84355                t.color.set(t.startColor);
84356                t.color.multiply(this.color.evaluate(1 - t.remainingLifetime / t.startLifetime, Si(t.randomSeed + Fit)));
84357              }
84358            }, Nit = Bl(Oit.prototype, "_enable", [ Yl ], {
84359              configurable: !0,
84360              enumerable: !0,
84361              writable: !0,
84362              initializer: function() {
84363                return !1;
84364              }
84365            }), Bl(Oit.prototype, "enable", [ Mit ], Object.getOwnPropertyDescriptor(Oit.prototype, "enable"), Oit.prototype),
84366            Lit = Bl(Oit.prototype, "color", [ Bit, Yl, Dit ], {
84367              configurable: !0,
84368              enumerable: !0,
84369              writable: !0,
84370              initializer: function() {
84371                return new ret;
84372              }
84373            }), Oit)) || Pit);
84374            const kit = new Pi(0, 0, -1);
84375            function Uit(t, e, i, s) {
84376              if (e !== t) {
84377                if (t === _it.World) qi.getRotation(s, i); else {
84378                  qi.invert(i, i);
84379                  qi.getRotation(s, i);
84380                }
84381                return !0;
84382              }
84383              Ui.set(s, 0, 0, 0, 1);
84384              return !1;
84385            }
84386            function Git(t, e) {
84387              Qi.set(t, Math.cos(e), Math.sin(e));
84388            }
84389            function zit(t) {
84390              const e = yi(-1, 1);
84391              const i = yi(0, 2 * Math.PI);
84392              const s = Math.sqrt(1 - e * e);
84393              const n = s * Math.cos(i);
84394              const r = s * Math.sin(i);
84395              Pi.set(t, n, r, e);
84396            }
84397            function Hit(t, e, i) {
84398              zit(t);
84399              Pi.multiplyScalar(t, t, e + (i - e) * gi());
84400            }
84401            function jit(t, e, i, s) {
84402              Git(t, s);
84403              t.z = 0;
84404              Pi.multiplyScalar(t, t, e + (i - e) * gi());
84405            }
84406            function Xit(t) {
84407              for (let e = 0; e < t.length; e++) {
84408                const i = e + bi(0, t.length - e);
84409                const s = t[i];
84410                t[i] = t[e];
84411                t[e] = s;
84412              }
84413            }
84414            function Wit() {
84415              let t = yi(-1, 1);
84416              0 === t && t++;
84417              return n(t);
84418            }
84419            var Yit, qit, Kit, Jit, Zit, Qit, $it, tst, est, ist, sst, nst, rst, ost, ast, lst, hst, cst, ust, _st, dst, pst, mst, fst, gst;
84420            const yst = Eit;
84421            const bst = new Pi;
84422            let Sst = (Yit = Ul("cc.ForceOvertimeModule"), qit = ph(), Kit = Th(Dtt), Jit = hh(),
84423            Zit = ph(), Qit = lh(), $it = Th(Dtt), tst = hh(), est = ph(), ist = lh(), sst = Th(Dtt),
84424            nst = hh(), rst = ph(), ost = lh(), ast = Th(_it), lst = ph(), hst = lh(), Yit(cst = (ust = (gst = class extends uit {
84425              get enable() {
84426                return this._enable;
84427              }
84428              set enable(t) {
84429                if (this._enable !== t) {
84430                  this._enable = t;
84431                  this.target && this.target.enableModule(this.name, t, this);
84432                }
84433              }
84434              constructor() {
84435                super();
84436                Ml(this, "_enable", _st, this);
84437                Ml(this, "x", dst, this);
84438                Ml(this, "y", pst, this);
84439                Ml(this, "z", mst, this);
84440                Ml(this, "space", fst, this);
84441                this.randomized = !1;
84442                this.rotation = void 0;
84443                this.needTransform = void 0;
84444                this.name = iit;
84445                this.rotation = new Ui;
84446                this.needTransform = !1;
84447                this.needUpdate = !0;
84448              }
84449              update(t, e) {
84450                this.needTransform = Uit(t, this.space, e, this.rotation);
84451              }
84452              animate(t, e) {
84453                const i = 1 - t.remainingLifetime / t.startLifetime;
84454                const s = Pi.set(bst, this.x.evaluate(i, Si(t.randomSeed + yst)), this.y.evaluate(i, Si(t.randomSeed + yst)), this.z.evaluate(i, Si(t.randomSeed + yst)));
84455                this.needTransform && Pi.transformQuat(s, s, this.rotation);
84456                Pi.scaleAndAdd(t.velocity, t.velocity, s, e);
84457                Pi.copy(t.ultimateVelocity, t.velocity);
84458              }
84459            }, gst), _st = Bl(ust.prototype, "_enable", [ Yl ], {
84460              configurable: !0,
84461              enumerable: !0,
84462              writable: !0,
84463              initializer: function() {
84464                return !1;
84465              }
84466            }), Bl(ust.prototype, "enable", [ qit ], Object.getOwnPropertyDescriptor(ust.prototype, "enable"), ust.prototype),
84467            dst = Bl(ust.prototype, "x", [ Kit, Yl, Jit, Zit, Qit ], {
84468              configurable: !0,
84469              enumerable: !0,
84470              writable: !0,
84471              initializer: function() {
84472                return new Dtt;
84473              }
84474            }), pst = Bl(ust.prototype, "y", [ $it, Yl, tst, est, ist ], {
84475              configurable: !0,
84476              enumerable: !0,
84477              writable: !0,
84478              initializer: function() {
84479                return new Dtt;
84480              }
84481            }), mst = Bl(ust.prototype, "z", [ sst, Yl, nst, rst, ost ], {
84482              configurable: !0,
84483              enumerable: !0,
84484              writable: !0,
84485              initializer: function() {
84486                return new Dtt;
84487              }
84488            }), fst = Bl(ust.prototype, "space", [ ast, Yl, lst, hst ], {
84489              configurable: !0,
84490              enumerable: !0,
84491              writable: !0,
84492              initializer: function() {
84493                return _it.Local;
84494              }
84495            }), ust)) || cst);
84496            var Ast, Tst, vst, Est, Cst, xst, wst, Rst, Ist, Mst, Bst, Dst, Pst, Ost, Nst, Lst, Fst, Vst, kst, Ust, Gst, zst, Hst, jst, Xst, Wst, Yst, qst, Kst, Jst, Zst, Qst, $st, tnt, ent, int, snt, nnt, rnt, ont;
84497            const ant = Ait;
84498            const lnt = new Pi;
84499            const hnt = new Pi;
84500            let cnt = (Ast = Ul("cc.LimitVelocityOvertimeModule"), Tst = ph(), vst = Th(Dtt),
84501            Est = hh(), Cst = ph(), xst = lh(), wst = rh(), Rst = Th(Dtt), Ist = hh(), Mst = ph(),
84502            Bst = lh(), Dst = rh(), Pst = Th(Dtt), Ost = hh(), Nst = ph(), Lst = lh(), Fst = rh(),
84503            Vst = Th(Dtt), kst = hh(), Ust = ph(), Gst = lh(), zst = rh(), Hst = ph(), jst = lh(),
84504            Xst = ph(), Wst = lh(), Yst = Th(_it), qst = ph(), Kst = lh(), Ast(Jst = (Zst = (ont = class extends uit {
84505              get enable() {
84506                return this._enable;
84507              }
84508              set enable(t) {
84509                if (this._enable !== t) {
84510                  this._enable = t;
84511                  this.target && this.target.enableModule(this.name, t, this);
84512                }
84513              }
84514              constructor() {
84515                super();
84516                Ml(this, "_enable", Qst, this);
84517                Ml(this, "limitX", $st, this);
84518                Ml(this, "limitY", tnt, this);
84519                Ml(this, "limitZ", ent, this);
84520                Ml(this, "limit", int, this);
84521                Ml(this, "dampen", snt, this);
84522                Ml(this, "separateAxes", nnt, this);
84523                Ml(this, "space", rnt, this);
84524                this.drag = null;
84525                this.multiplyDragByParticleSize = !1;
84526                this.multiplyDragByParticleVelocity = !1;
84527                this.name = sit;
84528                this.rotation = void 0;
84529                this.needTransform = void 0;
84530                this.rotation = new Ui;
84531                this.needTransform = !1;
84532                this.needUpdate = !0;
84533              }
84534              update(t, e) {
84535                this.needTransform = Uit(t, this.space, e, this.rotation);
84536              }
84537              animate(t, e) {
84538                const i = 1 - t.remainingLifetime / t.startLifetime;
84539                const s = lnt;
84540                if (this.separateAxes) {
84541                  Pi.set(hnt, this.limitX.evaluate(i, Si(t.randomSeed + ant)), this.limitY.evaluate(i, Si(t.randomSeed + ant)), this.limitZ.evaluate(i, Si(t.randomSeed + ant)));
84542                  this.needTransform && Pi.transformQuat(hnt, hnt, this.rotation);
84543                  Pi.set(s, unt(t.ultimateVelocity.x, hnt.x, this.dampen), unt(t.ultimateVelocity.y, hnt.y, this.dampen), unt(t.ultimateVelocity.z, hnt.z, this.dampen));
84544                } else {
84545                  Pi.normalize(s, t.ultimateVelocity);
84546                  Pi.multiplyScalar(s, s, unt(t.ultimateVelocity.length(), this.limit.evaluate(i, Si(t.randomSeed + ant)), this.dampen));
84547                }
84548                Pi.copy(t.ultimateVelocity, s);
84549              }
84550            }, ont), Qst = Bl(Zst.prototype, "_enable", [ Yl ], {
84551              configurable: !0,
84552              enumerable: !0,
84553              writable: !0,
84554              initializer: function() {
84555                return !1;
84556              }
84557            }), Bl(Zst.prototype, "enable", [ Tst ], Object.getOwnPropertyDescriptor(Zst.prototype, "enable"), Zst.prototype),
84558            $st = Bl(Zst.prototype, "limitX", [ vst, Yl, Est, Cst, xst, wst ], {
84559              configurable: !0,
84560              enumerable: !0,
84561              writable: !0,
84562              initializer: function() {
84563                return new Dtt;
84564              }
84565            }), tnt = Bl(Zst.prototype, "limitY", [ Rst, Yl, Ist, Mst, Bst, Dst ], {
84566              configurable: !0,
84567              enumerable: !0,
84568              writable: !0,
84569              initializer: function() {
84570                return new Dtt;
84571              }
84572            }), ent = Bl(Zst.prototype, "limitZ", [ Pst, Yl, Ost, Nst, Lst, Fst ], {
84573              configurable: !0,
84574              enumerable: !0,
84575              writable: !0,
84576              initializer: function() {
84577                return new Dtt;
84578              }
84579            }), int = Bl(Zst.prototype, "limit", [ Vst, Yl, kst, Ust, Gst, zst ], {
84580              configurable: !0,
84581              enumerable: !0,
84582              writable: !0,
84583              initializer: function() {
84584                return new Dtt;
84585              }
84586            }), snt = Bl(Zst.prototype, "dampen", [ Yl, Hst, jst ], {
84587              configurable: !0,
84588              enumerable: !0,
84589              writable: !0,
84590              initializer: function() {
84591                return 3;
84592              }
84593            }), nnt = Bl(Zst.prototype, "separateAxes", [ Yl, Xst, Wst ], {
84594              configurable: !0,
84595              enumerable: !0,
84596              writable: !0,
84597              initializer: function() {
84598                return !1;
84599              }
84600            }), rnt = Bl(Zst.prototype, "space", [ Yst, Yl, qst, Kst ], {
84601              configurable: !0,
84602              enumerable: !0,
84603              writable: !0,
84604              initializer: function() {
84605                return _it.Local;
84606              }
84607            }), Zst)) || Jst);
84608            function unt(t, e, i) {
84609              const s = Math.sign(t);
84610              let n = Math.abs(t);
84611              n > e && (n = pi(n, e, i));
84612              return n * s;
84613            }
84614            var _nt, dnt, pnt, mnt, fnt, gnt, ynt, bnt, Snt, Ant, Tnt, vnt, Ent, Cnt, xnt, wnt, Rnt, Int, Mnt, Bnt, Dnt, Pnt, Ont, Nnt, Lnt;
84615            const Fnt = Cit;
84616            let Vnt = (_nt = Ul("cc.RotationOvertimeModule"), dnt = ph(), pnt = ph(), mnt = lh(),
84617            fnt = Th(Dtt), gnt = hh(), ynt = ph(), bnt = lh(), Snt = rh(), Ant = Th(Dtt), Tnt = hh(),
84618            vnt = ph(), Ent = lh(), Cnt = rh(), xnt = Th(Dtt), wnt = hh(), Rnt = ph(), Int = lh(),
84619            _nt(Mnt = (Bnt = class extends uit {
84620              constructor(...t) {
84621                super(...t);
84622                Ml(this, "_enable", Dnt, this);
84623                Ml(this, "_separateAxes", Pnt, this);
84624                Ml(this, "x", Ont, this);
84625                Ml(this, "y", Nnt, this);
84626                Ml(this, "z", Lnt, this);
84627                this.name = nit;
84628                this._startMat = new qi;
84629                this._matRot = new qi;
84630                this._quatRot = new Ui;
84631                this._otherEuler = new Pi;
84632              }
84633              get enable() {
84634                return this._enable;
84635              }
84636              set enable(t) {
84637                if (this._enable !== t) {
84638                  this._enable = t;
84639                  this.target && this.target.enableModule(this.name, t, this);
84640                }
84641              }
84642              get separateAxes() {
84643                return this._separateAxes;
84644              }
84645              set separateAxes(t) {
84646                this._separateAxes = t;
84647              }
84648              _processRotation(t, e) {
84649                const i = t.particleSystem.processor.getInfo().renderMode;
84650                i !== mit.Mesh && i === mit.StrecthedBillboard && this._quatRot.set(0, 0, 0, 1);
84651                Ui.normalize(this._quatRot, this._quatRot);
84652                this._quatRot.w < 0 && (this._quatRot.x += tit.INDENTIFY_NEG_QUAT);
84653              }
84654              animate(t, e) {
84655                const i = 1 - t.remainingLifetime / t.startLifetime;
84656                const s = Si(t.randomSeed + Fnt);
84657                const n = t.particleSystem.processor.getInfo().renderMode;
84658                this._separateAxes && n !== mit.VerticalBillboard && n !== mit.HorizontalBillboard ? Ui.fromEuler(t.deltaQuat, this.x.evaluate(i, s) * e * tit.R2D, this.y.evaluate(i, s) * e * tit.R2D, this.z.evaluate(i, s) * e * tit.R2D) : Ui.fromEuler(t.deltaQuat, 0, 0, this.z.evaluate(i, s) * e * tit.R2D);
84659                t.deltaMat = qi.fromQuat(t.deltaMat, t.deltaQuat);
84660                t.localMat = t.localMat.multiply(t.deltaMat);
84661                if (!t.startRotated) {
84662                  n !== mit.Mesh && (n === mit.StrecthedBillboard ? t.startEuler.set(0, 0, 0) : n !== mit.Billboard && t.startEuler.set(0, 0, t.startEuler.z));
84663                  Ui.fromEuler(t.startRotation, t.startEuler.x * tit.R2D, t.startEuler.y * tit.R2D, t.startEuler.z * tit.R2D);
84664                  t.startRotated = !0;
84665                }
84666                this._startMat = qi.fromQuat(this._startMat, t.startRotation);
84667                this._matRot = this._startMat.multiply(t.localMat);
84668                qi.getRotation(this._quatRot, this._matRot);
84669                this._processRotation(t, tit.R2D);
84670                t.rotation.set(this._quatRot.x, this._quatRot.y, this._quatRot.z);
84671              }
84672            }, Dnt = Bl(Bnt.prototype, "_enable", [ Yl ], {
84673              configurable: !0,
84674              enumerable: !0,
84675              writable: !0,
84676              initializer: function() {
84677                return !1;
84678              }
84679            }), Bl(Bnt.prototype, "enable", [ dnt ], Object.getOwnPropertyDescriptor(Bnt.prototype, "enable"), Bnt.prototype),
84680            Pnt = Bl(Bnt.prototype, "_separateAxes", [ Yl ], {
84681              configurable: !0,
84682              enumerable: !0,
84683              writable: !0,
84684              initializer: function() {
84685                return !1;
84686              }
84687            }), Bl(Bnt.prototype, "separateAxes", [ pnt, mnt ], Object.getOwnPropertyDescriptor(Bnt.prototype, "separateAxes"), Bnt.prototype),
84688            Ont = Bl(Bnt.prototype, "x", [ fnt, Yl, gnt, mh, ynt, bnt, Snt ], {
84689              configurable: !0,
84690              enumerable: !0,
84691              writable: !0,
84692              initializer: function() {
84693                return new Dtt;
84694              }
84695            }), Nnt = Bl(Bnt.prototype, "y", [ Ant, Yl, Tnt, mh, vnt, Ent, Cnt ], {
84696              configurable: !0,
84697              enumerable: !0,
84698              writable: !0,
84699              initializer: function() {
84700                return new Dtt;
84701              }
84702            }), Lnt = Bl(Bnt.prototype, "z", [ xnt, Yl, wnt, mh, Rnt, Int ], {
84703              configurable: !0,
84704              enumerable: !0,
84705              writable: !0,
84706              initializer: function() {
84707                return new Dtt;
84708              }
84709            }), Bnt)) || Mnt);
84710            var knt, Unt, Gnt, znt, Hnt, jnt, Xnt, Wnt, Ynt, qnt, Knt, Jnt, Znt, Qnt, $nt, trt, ert, irt, srt, nrt, rrt, ort, art, lrt, hrt, crt, urt, _rt, drt, prt, mrt, frt;
84711            const grt = Tit;
84712            let yrt = (knt = Ul("cc.SizeOvertimeModule"), Unt = ph(), Gnt = ph(), znt = lh(),
84713            Hnt = Th(Dtt), jnt = hh(), Xnt = ph(), Wnt = lh(), Ynt = rh(), qnt = Th(Dtt), Knt = hh(),
84714            Jnt = ph(), Znt = lh(), Qnt = rh(), $nt = Th(Dtt), trt = hh(), ert = ph(), irt = lh(),
84715            srt = rh(), nrt = Th(Dtt), rrt = hh(), ort = ph(), art = lh(), lrt = rh(), knt(hrt = (crt = class extends uit {
84716              constructor(...t) {
84717                super(...t);
84718                Ml(this, "_enable", urt, this);
84719                Ml(this, "separateAxes", _rt, this);
84720                Ml(this, "size", drt, this);
84721                Ml(this, "x", prt, this);
84722                Ml(this, "y", mrt, this);
84723                Ml(this, "z", frt, this);
84724                this.name = rit;
84725              }
84726              get enable() {
84727                return this._enable;
84728              }
84729              set enable(t) {
84730                if (this._enable !== t) {
84731                  this._enable = t;
84732                  this.target && this.target.enableModule(this.name, t, this);
84733                }
84734              }
84735              animate(t, e) {
84736                if (this.separateAxes) {
84737                  const e = 1 - t.remainingLifetime / t.startLifetime;
84738                  const i = Si(t.randomSeed + grt);
84739                  t.size.x = t.startSize.x * this.x.evaluate(e, i);
84740                  t.size.y = t.startSize.y * this.y.evaluate(e, i);
84741                  t.size.z = t.startSize.z * this.z.evaluate(e, i);
84742                } else Pi.multiplyScalar(t.size, t.startSize, this.size.evaluate(1 - t.remainingLifetime / t.startLifetime, Si(t.randomSeed + grt)));
84743              }
84744            }, urt = Bl(crt.prototype, "_enable", [ Yl ], {
84745              configurable: !0,
84746              enumerable: !0,
84747              writable: !0,
84748              initializer: function() {
84749                return !1;
84750              }
84751            }), Bl(crt.prototype, "enable", [ Unt ], Object.getOwnPropertyDescriptor(crt.prototype, "enable"), crt.prototype),
84752            _rt = Bl(crt.prototype, "separateAxes", [ Yl, Gnt, znt ], {
84753              configurable: !0,
84754              enumerable: !0,
84755              writable: !0,
84756              initializer: function() {
84757                return !1;
84758              }
84759            }), drt = Bl(crt.prototype, "size", [ Hnt, Yl, jnt, Xnt, Wnt, Ynt ], {
84760              configurable: !0,
84761              enumerable: !0,
84762              writable: !0,
84763              initializer: function() {
84764                return new Dtt;
84765              }
84766            }), prt = Bl(crt.prototype, "x", [ qnt, Yl, Knt, Jnt, Znt, Qnt ], {
84767              configurable: !0,
84768              enumerable: !0,
84769              writable: !0,
84770              initializer: function() {
84771                return new Dtt;
84772              }
84773            }), mrt = Bl(crt.prototype, "y", [ $nt, Yl, trt, ert, irt, srt ], {
84774              configurable: !0,
84775              enumerable: !0,
84776              writable: !0,
84777              initializer: function() {
84778                return new Dtt;
84779              }
84780            }), frt = Bl(crt.prototype, "z", [ nrt, Yl, rrt, ort, art, lrt ], {
84781              configurable: !0,
84782              enumerable: !0,
84783              writable: !0,
84784              initializer: function() {
84785                return new Dtt;
84786              }
84787            }), crt)) || hrt);
84788            var brt, Srt, Art, Trt, vrt, Ert, Crt, xrt, wrt, Rrt, Irt, Mrt, Brt, Drt, Prt, Ort, Nrt, Lrt, Frt, Vrt, krt, Urt, Grt, zrt, Hrt, jrt, Xrt, Wrt, Yrt, qrt, Krt, Jrt, Zrt, Qrt, $rt, tot, eot, iot, sot, not, rot, oot, aot, lot;
84789            const hot = vit;
84790            const cot = oe({
84791              Grid: 0
84792            });
84793            const uot = oe({
84794              WholeSheet: 0,
84795              SingleRow: 1
84796            });
84797            let _ot = (brt = Ul("cc.TextureAnimationModule"), Srt = ql("numTilesX"), Art = ql("numTilesY"),
84798            Trt = ph(), vrt = Th(cot), Ert = Th(cot), Crt = ph(), xrt = lh(), wrt = ph(), Rrt = lh(),
84799            Irt = ph(), Mrt = lh(), Brt = Th(uot), Drt = ph(), Prt = lh(), Ort = Th(Dtt), Nrt = hh(),
84800            Lrt = ph(), Frt = lh(), Vrt = Th(Dtt), krt = hh(), Urt = ph(), Grt = lh(), zrt = ph(),
84801            Hrt = lh(), jrt = ph(), Xrt = lh(), Wrt = ph(), Yrt = lh(), brt(qrt = (Krt = class extends uit {
84802              constructor(...t) {
84803                super(...t);
84804                Ml(this, "_enable", Jrt, this);
84805                Ml(this, "_numTilesX", Zrt, this);
84806                Ml(this, "_numTilesY", Qrt, this);
84807                Ml(this, "_mode", $rt, this);
84808                Ml(this, "animation", tot, this);
84809                Ml(this, "frameOverTime", eot, this);
84810                Ml(this, "startFrame", iot, this);
84811                Ml(this, "cycleCount", sot, this);
84812                Ml(this, "_flipU", not, this);
84813                Ml(this, "_flipV", rot, this);
84814                Ml(this, "_uvChannelMask", oot, this);
84815                Ml(this, "randomRow", aot, this);
84816                Ml(this, "rowIndex", lot, this);
84817                this.name = ait;
84818              }
84819              get enable() {
84820                return this._enable;
84821              }
84822              set enable(t) {
84823                if (this._enable !== t) {
84824                  this._enable = t;
84825                  if (this.target) {
84826                    this.target.updateMaterialParams();
84827                    this.target.enableModule(this.name, t, this);
84828                  }
84829                }
84830              }
84831              get mode() {
84832                return this._mode;
84833              }
84834              set mode(t) {
84835                t !== cot.Grid && console.error("particle texture animation's sprites is not supported!");
84836              }
84837              get numTilesX() {
84838                return this._numTilesX;
84839              }
84840              set numTilesX(t) {
84841                if (this._numTilesX !== t) {
84842                  this._numTilesX = t;
84843                  this.target.updateMaterialParams();
84844                }
84845              }
84846              get numTilesY() {
84847                return this._numTilesY;
84848              }
84849              set numTilesY(t) {
84850                if (this._numTilesY !== t) {
84851                  this._numTilesY = t;
84852                  this.target.updateMaterialParams();
84853                }
84854              }
84855              get flipU() {
84856                return this._flipU;
84857              }
84858              set flipU(t) {
84859                console.error("particle texture animation's flipU is not supported!");
84860              }
84861              get flipV() {
84862                return this._flipV;
84863              }
84864              set flipV(t) {
84865                console.error("particle texture animation's flipV is not supported!");
84866              }
84867              get uvChannelMask() {
84868                return this._uvChannelMask;
84869              }
84870              set uvChannelMask(t) {
84871                console.error("particle texture animation's uvChannelMask is not supported!");
84872              }
84873              init(t) {
84874                t.startRow = Math.floor(Math.random() * this.numTilesY);
84875              }
84876              animate(t, e) {
84877                const i = 1 - t.remainingLifetime / t.startLifetime;
84878                const s = this.startFrame.evaluate(i, Si(t.randomSeed + hot)) / (this.numTilesX * this.numTilesY);
84879                if (this.animation === uot.WholeSheet) t.frameIndex = Ei(this.cycleCount * (this.frameOverTime.evaluate(i, Si(t.randomSeed + hot)) + s), 1); else if (this.animation === uot.SingleRow) {
84880                  const e = 1 / this.numTilesY;
84881                  if (this.randomRow) {
84882                    const n = Ei(this.cycleCount * (this.frameOverTime.evaluate(i, Si(t.randomSeed + hot)) + s), 1);
84883                    const r = t.startRow * e;
84884                    const o = r + e;
84885                    t.frameIndex = pi(r, o, n);
84886                  } else {
84887                    const n = this.rowIndex * e;
84888                    const r = n + e;
84889                    t.frameIndex = pi(n, r, Ei(this.cycleCount * (this.frameOverTime.evaluate(i, Si(t.randomSeed + hot)) + s), 1));
84890                  }
84891                }
84892              }
84893            }, Jrt = Bl(Krt.prototype, "_enable", [ Yl ], {
84894              configurable: !0,
84895              enumerable: !0,
84896              writable: !0,
84897              initializer: function() {
84898                return !1;
84899              }
84900            }), Zrt = Bl(Krt.prototype, "_numTilesX", [ Srt ], {
84901              configurable: !0,
84902              enumerable: !0,
84903              writable: !0,
84904              initializer: function() {
84905                return 0;
84906              }
84907            }), Qrt = Bl(Krt.prototype, "_numTilesY", [ Art ], {
84908              configurable: !0,
84909              enumerable: !0,
84910              writable: !0,
84911              initializer: function() {
84912                return 0;
84913              }
84914            }), Bl(Krt.prototype, "enable", [ Trt ], Object.getOwnPropertyDescriptor(Krt.prototype, "enable"), Krt.prototype),
84915            $rt = Bl(Krt.prototype, "_mode", [ vrt ], {
84916              configurable: !0,
84917              enumerable: !0,
84918              writable: !0,
84919              initializer: function() {
84920                return cot.Grid;
84921              }
84922            }), Bl(Krt.prototype, "mode", [ Ert, Crt, xrt ], Object.getOwnPropertyDescriptor(Krt.prototype, "mode"), Krt.prototype),
84923            Bl(Krt.prototype, "numTilesX", [ wrt, Rrt ], Object.getOwnPropertyDescriptor(Krt.prototype, "numTilesX"), Krt.prototype),
84924            Bl(Krt.prototype, "numTilesY", [ Irt, Mrt ], Object.getOwnPropertyDescriptor(Krt.prototype, "numTilesY"), Krt.prototype),
84925            tot = Bl(Krt.prototype, "animation", [ Brt, Yl, Drt, Prt ], {
84926              configurable: !0,
84927              enumerable: !0,
84928              writable: !0,
84929              initializer: function() {
84930                return uot.WholeSheet;
84931              }
84932            }), eot = Bl(Krt.prototype, "frameOverTime", [ Ort, Yl, Nrt, Lrt, Frt ], {
84933              configurable: !0,
84934              enumerable: !0,
84935              writable: !0,
84936              initializer: function() {
84937                return new Dtt;
84938              }
84939            }), iot = Bl(Krt.prototype, "startFrame", [ Vrt, Yl, krt, Urt, Grt ], {
84940              configurable: !0,
84941              enumerable: !0,
84942              writable: !0,
84943              initializer: function() {
84944                return new Dtt;
84945              }
84946            }), sot = Bl(Krt.prototype, "cycleCount", [ Yl, zrt, Hrt ], {
84947              configurable: !0,
84948              enumerable: !0,
84949              writable: !0,
84950              initializer: function() {
84951                return 0;
84952              }
84953            }), not = Bl(Krt.prototype, "_flipU", [ Yl ], {
84954              configurable: !0,
84955              enumerable: !0,
84956              writable: !0,
84957              initializer: function() {
84958                return 0;
84959              }
84960            }), rot = Bl(Krt.prototype, "_flipV", [ Yl ], {
84961              configurable: !0,
84962              enumerable: !0,
84963              writable: !0,
84964              initializer: function() {
84965                return 0;
84966              }
84967            }), oot = Bl(Krt.prototype, "_uvChannelMask", [ Yl ], {
84968              configurable: !0,
84969              enumerable: !0,
84970              writable: !0,
84971              initializer: function() {
84972                return -1;
84973              }
84974            }), aot = Bl(Krt.prototype, "randomRow", [ Yl, jrt, Xrt ], {
84975              configurable: !0,
84976              enumerable: !0,
84977              writable: !0,
84978              initializer: function() {
84979                return !1;
84980              }
84981            }), lot = Bl(Krt.prototype, "rowIndex", [ Yl, Wrt, Yrt ], {
84982              configurable: !0,
84983              enumerable: !0,
84984              writable: !0,
84985              initializer: function() {
84986                return 0;
84987              }
84988            }), Krt)) || qrt);
84989            var dot, pot, mot, fot, got, yot, bot, Sot, Aot, Tot, vot, Eot, Cot, xot, wot, Rot, Iot, Mot, Bot, Dot, Pot, Oot, Not, Lot, Fot, Vot, kot, Uot, Got, zot;
84990            const Hot = xit;
84991            const jot = wit;
84992            const Xot = Rit;
84993            const Wot = new Pi;
84994            let Yot = (dot = Ul("cc.VelocityOvertimeModule"), pot = ph(), mot = Th(Dtt), fot = hh(),
84995            got = ph(), yot = lh(), bot = Th(Dtt), Sot = hh(), Aot = ph(), Tot = lh(), vot = Th(Dtt),
84996            Eot = hh(), Cot = ph(), xot = lh(), wot = Th(Dtt), Rot = hh(), Iot = ph(), Mot = lh(),
84997            Bot = Th(_it), Dot = ph(), Pot = lh(), dot(Oot = (Not = (zot = class extends uit {
84998              get enable() {
84999                return this._enable;
85000              }
85001              set enable(t) {
85002                if (this._enable !== t) {
85003                  this._enable = t;
85004                  this.target && this.target.enableModule(this.name, t, this);
85005                }
85006              }
85007              constructor() {
85008                super();
85009                Ml(this, "_enable", Lot, this);
85010                Ml(this, "x", Fot, this);
85011                Ml(this, "y", Vot, this);
85012                Ml(this, "z", kot, this);
85013                Ml(this, "speedModifier", Uot, this);
85014                Ml(this, "space", Got, this);
85015                this.rotation = void 0;
85016                this.needTransform = void 0;
85017                this.name = oit;
85018                this.rotation = new Ui;
85019                this.speedModifier.constant = 1;
85020                this.needTransform = !1;
85021                this.needUpdate = !0;
85022              }
85023              update(t, e) {
85024                this.needTransform = Uit(t, this.space, e, this.rotation);
85025              }
85026              animate(t, e) {
85027                const i = 1 - t.remainingLifetime / t.startLifetime;
85028                const s = Pi.set(Wot, this.x.evaluate(i, Si(t.randomSeed ^ Hot)), this.y.evaluate(i, Si(t.randomSeed ^ jot)), this.z.evaluate(i, Si(t.randomSeed ^ Xot)));
85029                this.needTransform && Pi.transformQuat(s, s, this.rotation);
85030                Pi.add(t.animatedVelocity, t.animatedVelocity, s);
85031                Pi.add(t.ultimateVelocity, t.velocity, t.animatedVelocity);
85032                Pi.multiplyScalar(t.ultimateVelocity, t.ultimateVelocity, this.speedModifier.evaluate(1 - t.remainingLifetime / t.startLifetime, Si(t.randomSeed + Hot)));
85033              }
85034            }, zot), Lot = Bl(Not.prototype, "_enable", [ Yl ], {
85035              configurable: !0,
85036              enumerable: !0,
85037              writable: !0,
85038              initializer: function() {
85039                return !1;
85040              }
85041            }), Bl(Not.prototype, "enable", [ pot ], Object.getOwnPropertyDescriptor(Not.prototype, "enable"), Not.prototype),
85042            Fot = Bl(Not.prototype, "x", [ mot, Yl, fot, got, yot ], {
85043              configurable: !0,
85044              enumerable: !0,
85045              writable: !0,
85046              initializer: function() {
85047                return new Dtt;
85048              }
85049            }), Vot = Bl(Not.prototype, "y", [ bot, Yl, Sot, Aot, Tot ], {
85050              configurable: !0,
85051              enumerable: !0,
85052              writable: !0,
85053              initializer: function() {
85054                return new Dtt;
85055              }
85056            }), kot = Bl(Not.prototype, "z", [ vot, Yl, Eot, Cot, xot ], {
85057              configurable: !0,
85058              enumerable: !0,
85059              writable: !0,
85060              initializer: function() {
85061                return new Dtt;
85062              }
85063            }), Uot = Bl(Not.prototype, "speedModifier", [ wot, Yl, Rot, Iot, Mot ], {
85064              configurable: !0,
85065              enumerable: !0,
85066              writable: !0,
85067              initializer: function() {
85068                return new Dtt;
85069              }
85070            }), Got = Bl(Not.prototype, "space", [ Bot, Yl, Dot, Pot ], {
85071              configurable: !0,
85072              enumerable: !0,
85073              writable: !0,
85074              initializer: function() {
85075                return _it.Local;
85076              }
85077            }), Not)) || Oot);
85078            var qot, Kot, Jot, Zot, Qot, $ot, tat, eat, iat;
85079            let sat = t("Burst", (qot = Ul("cc.Burst"), Kot = Th(Dtt), Jot = hh(), qot(Zot = (Qot = class {
85080              get time() {
85081                return this._time;
85082              }
85083              set time(t) {
85084                this._time = t;
85085                this._curTime = t;
85086              }
85087              get repeatCount() {
85088                return this._repeatCount;
85089              }
85090              set repeatCount(t) {
85091                this._repeatCount = t;
85092                this._remainingCount = t;
85093              }
85094              constructor() {
85095                Ml(this, "_time", $ot, this);
85096                Ml(this, "_repeatCount", tat, this);
85097                Ml(this, "repeatInterval", eat, this);
85098                Ml(this, "count", iat, this);
85099                this._remainingCount = void 0;
85100                this._curTime = void 0;
85101                this._remainingCount = 0;
85102                this._curTime = 0;
85103              }
85104              update(t, e) {
85105                if (0 === this._remainingCount) {
85106                  this._remainingCount = this._repeatCount;
85107                  this._curTime = this._time;
85108                }
85109                if (this._remainingCount > 0) {
85110                  let i = Ei(t._time - t.startDelay.evaluate(0, 1), t.duration) - e;
85111                  i = i > 0 ? i : 0;
85112                  const s = Ei(t.time - t.startDelay.evaluate(0, 1), t.duration);
85113                  if (this._curTime >= i && this._curTime < s) {
85114                    t.emit(this.count.evaluate(this._curTime / t.duration, 1), e - (s - this._curTime));
85115                    this._curTime += this.repeatInterval;
85116                    --this._remainingCount;
85117                  }
85118                }
85119              }
85120              reset() {
85121                this._remainingCount = 0;
85122                this._curTime = 0;
85123              }
85124              getMaxCount(t) {
85125                return this.count.getMax() * Math.min(Math.ceil(t.duration / this.repeatInterval), this.repeatCount);
85126              }
85127            }, $ot = Bl(Qot.prototype, "_time", [ Yl ], {
85128              configurable: !0,
85129              enumerable: !0,
85130              writable: !0,
85131              initializer: function() {
85132                return 0;
85133              }
85134            }), Bl(Qot.prototype, "time", [ nh ], Object.getOwnPropertyDescriptor(Qot.prototype, "time"), Qot.prototype),
85135            tat = Bl(Qot.prototype, "_repeatCount", [ Yl ], {
85136              configurable: !0,
85137              enumerable: !0,
85138              writable: !0,
85139              initializer: function() {
85140                return 1;
85141              }
85142            }), Bl(Qot.prototype, "repeatCount", [ nh ], Object.getOwnPropertyDescriptor(Qot.prototype, "repeatCount"), Qot.prototype),
85143            eat = Bl(Qot.prototype, "repeatInterval", [ Yl, nh ], {
85144              configurable: !0,
85145              enumerable: !0,
85146              writable: !0,
85147              initializer: function() {
85148                return 1;
85149              }
85150            }), iat = Bl(Qot.prototype, "count", [ Kot, Yl, Jot ], {
85151              configurable: !0,
85152              enumerable: !0,
85153              writable: !0,
85154              initializer: function() {
85155                return new Dtt;
85156              }
85157            }), Qot)) || Zot));
85158            var nat, rat, oat, aat, lat, hat, cat, uat, _at, dat, pat, mat, fat, gat, yat, bat, Sat, Aat, Tat, vat, Eat, Cat, xat, wat, Rat, Iat, Mat, Bat, Dat, Pat, Oat, Nat, Lat, Fat, Vat, kat, Uat, Gat, zat, Hat, jat, Xat, Wat, Yat, qat, Kat, Jat, Zat, Qat, $at, tlt, elt, ilt, slt, nlt, rlt, olt, alt, llt, hlt, clt, ult, _lt, dlt, plt, mlt, flt, glt, ylt, blt, Slt, Alt, Tlt, vlt, Elt, Clt, xlt, wlt, Rlt;
85159            const Ilt = new Pi(0, 0, 0);
85160            const Mlt = [];
85161            const Blt = new Pi(.5, .5, .5);
85162            let Dlt = (nat = Ul("cc.ShapeModule"), rat = ph(), oat = lh(), aat = ph(), lat = lh(),
85163            hat = ph(), cat = lh(), uat = ph(), _at = lh(), dat = rh(), pat = ph(), mat = lh(),
85164            fat = rh(), gat = ph(), yat = Th(fit), bat = ql("shapeType"), Sat = ph(), Aat = Th(fit),
85165            Tat = lh(), vat = Th(git), Eat = ph(), Cat = lh(), xat = rh(), wat = ph(), Rat = lh(),
85166            Iat = ph(), Mat = lh(), Bat = ph(), Dat = lh(), Pat = ph(), Oat = lh(), Nat = ph(),
85167            Lat = lh(), Fat = rh(), Vat = ph(), kat = lh(), Uat = rh(), Gat = Th(yit), zat = ph(),
85168            Hat = lh(), jat = rh(), Xat = rh(), Wat = ph(), Yat = lh(), qat = rh(), Kat = Th(Dtt),
85169            Jat = rh(), Zat = hh(), Qat = ph(), $at = lh(), tlt = rh(), elt = ph(), ilt = lh(),
85170            slt = rh(), nlt = ph(), rlt = lh(), olt = rh(), nat(alt = (llt = (Rlt = class {
85171              get position() {
85172                return this._position;
85173              }
85174              set position(t) {
85175                this._position = t;
85176                this.constructMat();
85177              }
85178              get rotation() {
85179                return this._rotation;
85180              }
85181              set rotation(t) {
85182                this._rotation = t;
85183                this.constructMat();
85184              }
85185              get scale() {
85186                return this._scale;
85187              }
85188              set scale(t) {
85189                this._scale = t;
85190                this.constructMat();
85191              }
85192              get arc() {
85193                return fi(this._arc);
85194              }
85195              set arc(t) {
85196                this._arc = mi(t);
85197              }
85198              get angle() {
85199                return Math.round(100 * fi(this._angle)) / 100;
85200              }
85201              set angle(t) {
85202                this._angle = mi(t);
85203              }
85204              get enable() {
85205                return this._enable;
85206              }
85207              set enable(t) {
85208                this._enable = t;
85209              }
85210              get shapeType() {
85211                return this._shapeType;
85212              }
85213              set shapeType(t) {
85214                this._shapeType = t;
85215                switch (this._shapeType) {
85216                 case fit.Box:
85217                  this.emitFrom === git.Base && (this.emitFrom = git.Volume);
85218                  break;
85219
85220                 case fit.Cone:
85221                  this.emitFrom === git.Edge && (this.emitFrom = git.Base);
85222                  break;
85223
85224                 case fit.Sphere:
85225                 case fit.Hemisphere:
85226                  this.emitFrom !== git.Base && this.emitFrom !== git.Edge || (this.emitFrom = git.Volume);
85227                }
85228              }
85229              constructor() {
85230                Ml(this, "_enable", hlt, this);
85231                Ml(this, "_shapeType", clt, this);
85232                Ml(this, "emitFrom", ult, this);
85233                Ml(this, "alignToDirection", _lt, this);
85234                Ml(this, "randomDirectionAmount", dlt, this);
85235                Ml(this, "sphericalDirectionAmount", plt, this);
85236                Ml(this, "randomPositionAmount", mlt, this);
85237                Ml(this, "radius", flt, this);
85238                Ml(this, "radiusThickness", glt, this);
85239                Ml(this, "arcMode", ylt, this);
85240                Ml(this, "arcSpread", blt, this);
85241                Ml(this, "arcSpeed", Slt, this);
85242                Ml(this, "length", Alt, this);
85243                Ml(this, "boxThickness", Tlt, this);
85244                Ml(this, "_position", vlt, this);
85245                Ml(this, "_rotation", Elt, this);
85246                Ml(this, "_scale", Clt, this);
85247                Ml(this, "_arc", xlt, this);
85248                Ml(this, "_angle", wlt, this);
85249                this.mat = void 0;
85250                this.quat = void 0;
85251                this.particleSystem = void 0;
85252                this.lastTime = void 0;
85253                this.totalAngle = void 0;
85254                this.mat = new qi;
85255                this.quat = new Ui;
85256                this.particleSystem = null;
85257                this.lastTime = 0;
85258                this.totalAngle = 0;
85259              }
85260              onInit(t) {
85261                this.particleSystem = t;
85262                this.constructMat();
85263                this.lastTime = this.particleSystem._time;
85264              }
85265              emit(t) {
85266                switch (this.shapeType) {
85267                 case fit.Box:
85268                  !function(t, e, i, s) {
85269                    switch (t) {
85270                     case git.Volume:
85271                      !function(t, e) {
85272                        Pi.set(t, yi(-e.x, e.x), yi(-e.y, e.y), yi(-e.z, e.z));
85273                      }(i, Blt);
85274                      break;
85275
85276                     case git.Shell:
85277                      Mlt.splice(0, Mlt.length);
85278                      Mlt.push(yi(-.5, .5));
85279                      Mlt.push(yi(-.5, .5));
85280                      Mlt.push(.5 * Wit());
85281                      Xit(Mlt);
85282                      Plt(Mlt, e);
85283                      Pi.set(i, Mlt[0], Mlt[1], Mlt[2]);
85284                      break;
85285
85286                     case git.Edge:
85287                      Mlt.splice(0, Mlt.length);
85288                      Mlt.push(yi(-.5, .5));
85289                      Mlt.push(.5 * Wit());
85290                      Mlt.push(.5 * Wit());
85291                      Xit(Mlt);
85292                      Plt(Mlt, e);
85293                      Pi.set(i, Mlt[0], Mlt[1], Mlt[2]);
85294                      break;
85295
85296                     default:
85297                      console.warn(`${t} is not supported for box emitter.`);
85298                    }
85299                    Pi.copy(s, kit);
85300                  }(this.emitFrom, this.boxThickness, t.position, t.velocity);
85301                  break;
85302
85303                 case fit.Circle:
85304                  !function(t, e, i, s, n) {
85305                    jit(s, t * (1 - e), t, i);
85306                    Pi.normalize(n, s);
85307                  }(this.radius, this.radiusThickness, this.generateArcAngle(), t.position, t.velocity);
85308                  break;
85309
85310                 case fit.Cone:
85311                  !function(t, e, i, s, n, r, o, a) {
85312                    switch (t) {
85313                     case git.Base:
85314                      jit(o, e * (1 - i), e, s);
85315                      Qi.multiplyScalar(a, o, Math.sin(n));
85316                      a.z = -Math.cos(n) * e;
85317                      Pi.normalize(a, a);
85318                      o.z = 0;
85319                      break;
85320
85321                     case git.Shell:
85322                      Git(o, s);
85323                      Qi.multiplyScalar(a, o, Math.sin(n));
85324                      a.z = -Math.cos(n);
85325                      Pi.normalize(a, a);
85326                      Qi.multiplyScalar(o, o, e);
85327                      o.z = 0;
85328                      break;
85329
85330                     case git.Volume:
85331                      jit(o, e * (1 - i), e, s);
85332                      Qi.multiplyScalar(a, o, Math.sin(n));
85333                      a.z = -Math.cos(n) * e;
85334                      Pi.normalize(a, a);
85335                      o.z = 0;
85336                      Pi.add(o, o, Pi.multiplyScalar(Ilt, a, r * gi() / -a.z));
85337                      break;
85338
85339                     default:
85340                      console.warn(`${t} is not supported for cone emitter.`);
85341                    }
85342                  }(this.emitFrom, this.radius, this.radiusThickness, this.generateArcAngle(), this._angle, this.length, t.position, t.velocity);
85343                  break;
85344
85345                 case fit.Sphere:
85346                  !function(t, e, i, s, n) {
85347                    switch (t) {
85348                     case git.Volume:
85349                      Hit(s, e * (1 - i), e);
85350                      Pi.normalize(n, s);
85351                      break;
85352
85353                     case git.Shell:
85354                      zit(s);
85355                      Pi.multiplyScalar(s, s, e);
85356                      Pi.normalize(n, s);
85357                      break;
85358
85359                     default:
85360                      console.warn(`${t} is not supported for sphere emitter.`);
85361                    }
85362                  }(this.emitFrom, this.radius, this.radiusThickness, t.position, t.velocity);
85363                  break;
85364
85365                 case fit.Hemisphere:
85366                  !function(t, e, i, s, n) {
85367                    switch (t) {
85368                     case git.Volume:
85369                      Hit(s, e * (1 - i), e);
85370                      s.z > 0 && (s.z *= -1);
85371                      Pi.normalize(n, s);
85372                      break;
85373
85374                     case git.Shell:
85375                      zit(s);
85376                      Pi.multiplyScalar(s, s, e);
85377                      s.z > 0 && (s.z *= -1);
85378                      Pi.normalize(n, s);
85379                      break;
85380
85381                     default:
85382                      console.warn(`${t} is not supported for hemisphere emitter.`);
85383                    }
85384                  }(this.emitFrom, this.radius, this.radiusThickness, t.position, t.velocity);
85385                  break;
85386
85387                 default:
85388                  console.warn(`${this.shapeType} shapeType is not supported by ShapeModule.`);
85389                }
85390                if (this.randomPositionAmount > 0) {
85391                  t.position.x += yi(-this.randomPositionAmount, this.randomPositionAmount);
85392                  t.position.y += yi(-this.randomPositionAmount, this.randomPositionAmount);
85393                  t.position.z += yi(-this.randomPositionAmount, this.randomPositionAmount);
85394                }
85395                Pi.transformQuat(t.velocity, t.velocity, this.quat);
85396                Pi.transformMat4(t.position, t.position, this.mat);
85397                if (this.sphericalDirectionAmount > 0) {
85398                  const e = Pi.normalize(Ilt, t.position);
85399                  Pi.lerp(t.velocity, t.velocity, e, this.sphericalDirectionAmount);
85400                }
85401                this.lastTime = this.particleSystem._time;
85402              }
85403              constructMat() {
85404                Ui.fromEuler(this.quat, this._rotation.x, this._rotation.y, this._rotation.z);
85405                qi.fromRTS(this.mat, this.quat, this._position, this._scale);
85406              }
85407              generateArcAngle() {
85408                if (this.arcMode === yit.Random) return yi(0, this._arc);
85409                let t = this.totalAngle + 2 * Math.PI * this.arcSpeed.evaluate(this.particleSystem._time, 1) * (this.particleSystem._time - this.lastTime);
85410                this.totalAngle = t;
85411                0 !== this.arcSpread && (t = Math.floor(t / (this._arc * this.arcSpread)) * this._arc * this.arcSpread);
85412                switch (this.arcMode) {
85413                 case yit.Loop:
85414                  return Ei(t, this._arc);
85415
85416                 case yit.PingPong:
85417                  return Ci(t, this._arc);
85418
85419                 default:
85420                  return Ei(t, this._arc);
85421                }
85422              }
85423            }, Rlt), Bl(llt.prototype, "position", [ rat, oat ], Object.getOwnPropertyDescriptor(llt.prototype, "position"), llt.prototype),
85424            Bl(llt.prototype, "rotation", [ aat, lat ], Object.getOwnPropertyDescriptor(llt.prototype, "rotation"), llt.prototype),
85425            Bl(llt.prototype, "scale", [ hat, cat ], Object.getOwnPropertyDescriptor(llt.prototype, "scale"), llt.prototype),
85426            Bl(llt.prototype, "arc", [ uat, _at, dat ], Object.getOwnPropertyDescriptor(llt.prototype, "arc"), llt.prototype),
85427            Bl(llt.prototype, "angle", [ pat, mat, fat ], Object.getOwnPropertyDescriptor(llt.prototype, "angle"), llt.prototype),
85428            hlt = Bl(llt.prototype, "_enable", [ Yl ], {
85429              configurable: !0,
85430              enumerable: !0,
85431              writable: !0,
85432              initializer: function() {
85433                return !1;
85434              }
85435            }), Bl(llt.prototype, "enable", [ gat ], Object.getOwnPropertyDescriptor(llt.prototype, "enable"), llt.prototype),
85436            clt = Bl(llt.prototype, "_shapeType", [ yat, bat, Sat ], {
85437              configurable: !0,
85438              enumerable: !0,
85439              writable: !0,
85440              initializer: function() {
85441                return fit.Cone;
85442              }
85443            }), Bl(llt.prototype, "shapeType", [ Aat, Tat ], Object.getOwnPropertyDescriptor(llt.prototype, "shapeType"), llt.prototype),
85444            ult = Bl(llt.prototype, "emitFrom", [ vat, Yl, Eat, Cat, xat ], {
85445              configurable: !0,
85446              enumerable: !0,
85447              writable: !0,
85448              initializer: function() {
85449                return git.Volume;
85450              }
85451            }), _lt = Bl(llt.prototype, "alignToDirection", [ Yl, wat, Rat ], {
85452              configurable: !0,
85453              enumerable: !0,
85454              writable: !0,
85455              initializer: function() {
85456                return !1;
85457              }
85458            }), dlt = Bl(llt.prototype, "randomDirectionAmount", [ Yl, Iat, Mat ], {
85459              configurable: !0,
85460              enumerable: !0,
85461              writable: !0,
85462              initializer: function() {
85463                return 0;
85464              }
85465            }), plt = Bl(llt.prototype, "sphericalDirectionAmount", [ Yl, Bat, Dat ], {
85466              configurable: !0,
85467              enumerable: !0,
85468              writable: !0,
85469              initializer: function() {
85470                return 0;
85471              }
85472            }), mlt = Bl(llt.prototype, "randomPositionAmount", [ Yl, Pat, Oat ], {
85473              configurable: !0,
85474              enumerable: !0,
85475              writable: !0,
85476              initializer: function() {
85477                return 0;
85478              }
85479            }), flt = Bl(llt.prototype, "radius", [ Yl, Nat, Lat, Fat ], {
85480              configurable: !0,
85481              enumerable: !0,
85482              writable: !0,
85483              initializer: function() {
85484                return 1;
85485              }
85486            }), glt = Bl(llt.prototype, "radiusThickness", [ Yl, Vat, kat, Uat ], {
85487              configurable: !0,
85488              enumerable: !0,
85489              writable: !0,
85490              initializer: function() {
85491                return 1;
85492              }
85493            }), ylt = Bl(llt.prototype, "arcMode", [ Gat, Yl, zat, Hat, jat ], {
85494              configurable: !0,
85495              enumerable: !0,
85496              writable: !0,
85497              initializer: function() {
85498                return yit.Random;
85499              }
85500            }), blt = Bl(llt.prototype, "arcSpread", [ Xat, Yl, Wat, Yat, qat ], {
85501              configurable: !0,
85502              enumerable: !0,
85503              writable: !0,
85504              initializer: function() {
85505                return 0;
85506              }
85507            }), Slt = Bl(llt.prototype, "arcSpeed", [ Kat, Jat, Zat, Yl, Qat, $at, tlt ], {
85508              configurable: !0,
85509              enumerable: !0,
85510              writable: !0,
85511              initializer: function() {
85512                return new Dtt;
85513              }
85514            }), Alt = Bl(llt.prototype, "length", [ Yl, elt, ilt, slt ], {
85515              configurable: !0,
85516              enumerable: !0,
85517              writable: !0,
85518              initializer: function() {
85519                return 5;
85520              }
85521            }), Tlt = Bl(llt.prototype, "boxThickness", [ Yl, nlt, rlt, olt ], {
85522              configurable: !0,
85523              enumerable: !0,
85524              writable: !0,
85525              initializer: function() {
85526                return new Pi(0, 0, 0);
85527              }
85528            }), vlt = Bl(llt.prototype, "_position", [ Yl ], {
85529              configurable: !0,
85530              enumerable: !0,
85531              writable: !0,
85532              initializer: function() {
85533                return new Pi(0, 0, 0);
85534              }
85535            }), Elt = Bl(llt.prototype, "_rotation", [ Yl ], {
85536              configurable: !0,
85537              enumerable: !0,
85538              writable: !0,
85539              initializer: function() {
85540                return new Pi(0, 0, 0);
85541              }
85542            }), Clt = Bl(llt.prototype, "_scale", [ Yl ], {
85543              configurable: !0,
85544              enumerable: !0,
85545              writable: !0,
85546              initializer: function() {
85547                return new Pi(1, 1, 1);
85548              }
85549            }), xlt = Bl(llt.prototype, "_arc", [ Yl ], {
85550              configurable: !0,
85551              enumerable: !0,
85552              writable: !0,
85553              initializer: function() {
85554                return mi(360);
85555              }
85556            }), wlt = Bl(llt.prototype, "_angle", [ Yl ], {
85557              configurable: !0,
85558              enumerable: !0,
85559              writable: !0,
85560              initializer: function() {
85561                return mi(25);
85562              }
85563            }), llt)) || alt);
85564            function Plt(t, e) {
85565              if (e.x > 0) {
85566                t[0] += .5 * yi(-e.x, e.x);
85567                t[0] = _i(t[0], -.5, .5);
85568              }
85569              if (e.y > 0) {
85570                t[1] += .5 * yi(-e.y, e.y);
85571                t[1] = _i(t[1], -.5, .5);
85572              }
85573              if (e.z > 0) {
85574                t[2] += .5 * yi(-e.z, e.z);
85575                t[2] = _i(t[2], -.5, .5);
85576              }
85577            }
85578            const Olt = [ 0, 0, 1, 0, 0, 1, 1, 1 ];
85579            const Nlt = [ 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0 ];
85580            class Llt extends wA {
85581              constructor() {
85582                super();
85583                this._capacity = void 0;
85584                this._vertAttrs = void 0;
85585                this._vertAttribSize = void 0;
85586                this._vBuffer = void 0;
85587                this._vertAttrsFloatCount = void 0;
85588                this._vdataF32 = void 0;
85589                this._vdataUint32 = void 0;
85590                this._iaInfo = void 0;
85591                this._iaInfoBuffer = void 0;
85592                this._subMeshData = void 0;
85593                this._mesh = void 0;
85594                this._vertCount = 0;
85595                this._indexCount = 0;
85596                this._startTimeOffset = 0;
85597                this._lifeTimeOffset = 0;
85598                this._material = null;
85599                this._vertAttribSizeStatic = void 0;
85600                this._vertStaticAttrsFloatCount = void 0;
85601                this._insBuffers = void 0;
85602                this._insIndices = void 0;
85603                this._useInstance = void 0;
85604                this._registerListeners();
85605                this.type = xA.PARTICLE_BATCH;
85606                this._capacity = 0;
85607                this._vertAttrs = null;
85608                this._vertAttribSize = 0;
85609                this._vBuffer = null;
85610                this._vertAttrsFloatCount = 0;
85611                this._vdataF32 = null;
85612                this._vdataUint32 = null;
85613                this._vertAttribSizeStatic = 0;
85614                this._vertStaticAttrsFloatCount = 0;
85615                this._insBuffers = [];
85616                this._insIndices = null;
85617                zo.gfxDevice.hasFeature(ys.INSTANCED_ARRAYS) ? this._useInstance = !0 : this._useInstance = !1;
85618                this._iaInfo = new Cn([ new vn ]);
85619                this._iaInfoBuffer = this._device.createBuffer(new An(Ts.INDIRECT, Cs.HOST | Cs.DEVICE, mr, mr));
85620                this._subMeshData = null;
85621                this._mesh = null;
85622              }
85623              setCapacity(t) {
85624                const e = this._capacity !== t;
85625                this._capacity = t;
85626                this._subMeshData && e && this.rebuild();
85627              }
85628              setVertexAttributes(t, e) {
85629                if (this._useInstance) this.setVertexAttributesIns(t, e); else {
85630                  if (this._mesh === t && this._vertAttrs === e) return;
85631                  this._mesh = t;
85632                  this._vertAttrs = e;
85633                  this._vertAttribSize = 0;
85634                  for (const t of this._vertAttrs) {
85635                    t.offset = this._vertAttribSize;
85636                    this._vertAttribSize += ur[t.format].size;
85637                  }
85638                  this._vertAttrsFloatCount = this._vertAttribSize / 4;
85639                  this.rebuild();
85640                }
85641              }
85642              setVertexAttributesIns(t, e) {
85643                if (this._mesh !== t || this._vertAttrs !== e) {
85644                  this._mesh = t;
85645                  this._vertAttrs = e;
85646                  this._vertAttribSize = 0;
85647                  this._vertAttribSizeStatic = 0;
85648                  for (const t of this._vertAttrs) if (0 === t.stream) {
85649                    t.offset = this._vertAttribSize;
85650                    this._vertAttribSize += ur[t.format].size;
85651                  } else if (1 === t.stream) {
85652                    t.offset = this._vertAttribSizeStatic;
85653                    this._vertAttribSizeStatic += ur[t.format].size;
85654                  }
85655                  this._vertAttrsFloatCount = this._vertAttribSize / 4;
85656                  this._vertStaticAttrsFloatCount = this._vertAttribSizeStatic / 4;
85657                  this.rebuild();
85658                }
85659              }
85660              createSubMeshData() {
85661                this.destroySubMeshData();
85662                this._vertCount = 4;
85663                this._indexCount = 6;
85664                if (this._mesh) {
85665                  this._vertCount = this._mesh.struct.vertexBundles[this._mesh.struct.primitives[0].vertexBundelIndices[0]].view.count;
85666                  this._indexCount = this._mesh.struct.primitives[0].indexView.count;
85667                }
85668                const t = this._device.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.HOST | Cs.DEVICE, this._vertAttribSize * this._capacity * this._vertCount, this._vertAttribSize));
85669                const e = new ArrayBuffer(this._vertAttribSize * this._capacity * this._vertCount);
85670                if (this._mesh && this._capacity > 0) {
85671                  let t = this._vertAttrs[this._vertAttrs.findIndex((t => t.name === cr.ATTR_TEX_COORD))].offset;
85672                  this._mesh.copyAttribute(0, cr.ATTR_TEX_COORD, e, this._vertAttribSize, t);
85673                  let i = this._vertAttrs.findIndex((t => t.name === cr.ATTR_TEX_COORD3));
85674                  t = this._vertAttrs[i++].offset;
85675                  this._mesh.copyAttribute(0, cr.ATTR_POSITION, e, this._vertAttribSize, t);
85676                  t = this._vertAttrs[i++].offset;
85677                  this._mesh.copyAttribute(0, cr.ATTR_NORMAL, e, this._vertAttribSize, t);
85678                  t = this._vertAttrs[i++].offset;
85679                  if (!this._mesh.copyAttribute(0, cr.ATTR_COLOR, e, this._vertAttribSize, t)) {
85680                    const i = new Uint32Array(e);
85681                    for (let e = 0; e < this._vertCount; ++e) i[e * this._vertAttrsFloatCount + t / 4] = Bi.WHITE._val;
85682                  }
85683                  const s = new Float32Array(e);
85684                  for (let t = 1; t < this._capacity; t++) s.copyWithin(t * this._vertAttribSize * this._vertCount / 4, 0, this._vertAttribSize * this._vertCount / 4);
85685                }
85686                t.update(e);
85687                const i = new Uint16Array(this._capacity * this._indexCount);
85688                if (this._mesh && this._capacity > 0) {
85689                  this._mesh.copyIndices(0, i);
85690                  for (let t = 1; t < this._capacity; t++) for (let e = 0; e < this._indexCount; e++) i[t * this._indexCount + e] = i[e] + t * this._vertCount;
85691                } else {
85692                  let t = 0;
85693                  for (let e = 0; e < this._capacity; ++e) {
85694                    const s = 4 * e;
85695                    i[t++] = s;
85696                    i[t++] = s + 1;
85697                    i[t++] = s + 2;
85698                    i[t++] = s + 3;
85699                    i[t++] = s + 2;
85700                    i[t++] = s + 1;
85701                  }
85702                }
85703                const s = this._device.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, this._capacity * this._indexCount * Uint16Array.BYTES_PER_ELEMENT, Uint16Array.BYTES_PER_ELEMENT));
85704                s.update(i);
85705                this._iaInfo.drawInfos[0].vertexCount = this._capacity * this._vertCount;
85706                this._iaInfo.drawInfos[0].indexCount = this._capacity * this._indexCount;
85707                this._iaInfoBuffer || (this._iaInfoBuffer = this._device.createBuffer(new An(Ts.INDIRECT, Cs.HOST | Cs.DEVICE, mr, mr)));
85708                this._iaInfoBuffer.update(this._iaInfo);
85709                this._subMeshData = new fC([ t ], this._vertAttrs, Xs.TRIANGLE_LIST, s, this._iaInfoBuffer);
85710                this.initSubModel(0, this._subMeshData, this._material);
85711                return e;
85712              }
85713              createSubMeshDataInsDynamic() {
85714                this.destroySubMeshData();
85715                const t = this._device.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.HOST | Cs.DEVICE, this._vertAttribSize * this._capacity, this._vertAttribSize));
85716                const e = new ArrayBuffer(this._vertAttribSize * this._capacity);
85717                t.update(e);
85718                this._insBuffers.push(t);
85719                return e;
85720              }
85721              createSubMeshDataInsStatic() {
85722                this._vertCount = 4;
85723                this._indexCount = 6;
85724                if (this._mesh) {
85725                  this._vertCount = this._mesh.struct.vertexBundles[this._mesh.struct.primitives[0].vertexBundelIndices[0]].view.count;
85726                  this._indexCount = this._mesh.struct.primitives[0].indexView.count;
85727                }
85728                const t = this._device.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.HOST | Cs.DEVICE, this._vertAttribSizeStatic * this._vertCount, this._vertAttribSizeStatic));
85729                const e = new ArrayBuffer(this._vertAttribSizeStatic * this._vertCount);
85730                if (this._mesh) {
85731                  let t = this._vertAttrs.findIndex((t => t.name === cr.ATTR_TEX_COORD));
85732                  let i = this._vertAttrs[t].offset;
85733                  this._mesh.copyAttribute(0, cr.ATTR_TEX_COORD, e, this._vertAttribSizeStatic, i);
85734                  t = this._vertAttrs.findIndex((t => t.name === cr.ATTR_TEX_COORD3));
85735                  i = this._vertAttrs[t++].offset;
85736                  this._mesh.copyAttribute(0, cr.ATTR_POSITION, e, this._vertAttribSizeStatic, i);
85737                  i = this._vertAttrs[t++].offset;
85738                  this._mesh.copyAttribute(0, cr.ATTR_NORMAL, e, this._vertAttribSizeStatic, i);
85739                  i = this._vertAttrs[t++].offset;
85740                  if (!this._mesh.copyAttribute(0, cr.ATTR_COLOR, e, this._vertAttribSizeStatic, i)) {
85741                    const t = new Uint32Array(e);
85742                    for (let e = 0; e < this._vertCount; ++e) t[e * this._vertStaticAttrsFloatCount + i / 4] = Bi.WHITE._val;
85743                  }
85744                } else {
85745                  const t = new Float32Array(e);
85746                  for (let e = 0; e < Nlt.length; ++e) t[e] = Nlt[e];
85747                }
85748                t.update(e);
85749                const i = new Uint16Array(this._indexCount);
85750                if (this._mesh) this._mesh.copyIndices(0, i); else {
85751                  i[0] = 0;
85752                  i[1] = 1;
85753                  i[2] = 2;
85754                  i[3] = 3;
85755                  i[4] = 2;
85756                  i[5] = 1;
85757                }
85758                const s = this._device.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, this._indexCount * Uint16Array.BYTES_PER_ELEMENT, Uint16Array.BYTES_PER_ELEMENT));
85759                s.update(i);
85760                this._insIndices = s;
85761                this._iaInfo.drawInfos[0].vertexCount = this._vertCount;
85762                this._iaInfo.drawInfos[0].indexCount = this._indexCount;
85763                this._iaInfoBuffer || (this._iaInfoBuffer = this._device.createBuffer(new An(Ts.INDIRECT, Cs.HOST | Cs.DEVICE, mr, mr)));
85764                this._iaInfoBuffer.update(this._iaInfo);
85765                this._insBuffers.push(t);
85766              }
85767              createInsSubmesh() {
85768                this._subMeshData = new fC(this._insBuffers, this._vertAttrs, Xs.TRIANGLE_LIST, this._insIndices, this._iaInfoBuffer);
85769                this.initSubModel(0, this._subMeshData, this._material);
85770              }
85771              updateMaterial(t) {
85772                this._material = t;
85773                this.setSubModelMaterial(0, t);
85774              }
85775              addParticleVertexData(t, e) {
85776                if (this._useInstance) this.addParticleVertexDataIns(t, e); else if (this._mesh) for (let i = 0; i < this._vertCount; i++) {
85777                  let s = (t * this._vertCount + i) * this._vertAttrsFloatCount;
85778                  this._vdataF32[s++] = e[0].x;
85779                  this._vdataF32[s++] = e[0].y;
85780                  this._vdataF32[s++] = e[0].z;
85781                  s += 2;
85782                  this._vdataF32[s++] = e[1].z;
85783                  this._vdataF32[s++] = e[2].x;
85784                  this._vdataF32[s++] = e[2].y;
85785                  this._vdataF32[s++] = e[2].z;
85786                  this._vdataF32[s++] = e[3].x;
85787                  this._vdataF32[s++] = e[3].y;
85788                  this._vdataF32[s++] = e[3].z;
85789                  this._vdataUint32[s++] = e[4];
85790                } else {
85791                  let i = t * this._vertAttrsFloatCount;
85792                  this._vdataF32[i++] = e[0].x;
85793                  this._vdataF32[i++] = e[0].y;
85794                  this._vdataF32[i++] = e[0].z;
85795                  this._vdataF32[i++] = e[1].x;
85796                  this._vdataF32[i++] = e[1].y;
85797                  this._vdataF32[i++] = e[1].z;
85798                  this._vdataF32[i++] = e[2].x;
85799                  this._vdataF32[i++] = e[2].y;
85800                  this._vdataF32[i++] = e[2].z;
85801                  this._vdataF32[i++] = e[3].x;
85802                  this._vdataF32[i++] = e[3].y;
85803                  this._vdataF32[i++] = e[3].z;
85804                  this._vdataUint32[i++] = e[4];
85805                  if (e[5]) {
85806                    this._vdataF32[i++] = e[5].x;
85807                    this._vdataF32[i++] = e[5].y;
85808                    this._vdataF32[i++] = e[5].z;
85809                  }
85810                }
85811              }
85812              addParticleVertexDataIns(t, e) {
85813                let i = t * this._vertAttrsFloatCount;
85814                if (this._mesh) {
85815                  this._vdataF32[i++] = e[0].x;
85816                  this._vdataF32[i++] = e[0].y;
85817                  this._vdataF32[i++] = e[0].z;
85818                  this._vdataF32[i++] = e[1].z;
85819                  this._vdataF32[i++] = e[2].x;
85820                  this._vdataF32[i++] = e[2].y;
85821                  this._vdataF32[i++] = e[2].z;
85822                  this._vdataF32[i++] = e[3].x;
85823                  this._vdataF32[i++] = e[3].y;
85824                  this._vdataF32[i++] = e[3].z;
85825                  this._vdataUint32[i++] = e[4];
85826                } else {
85827                  this._vdataF32[i++] = e[0].x;
85828                  this._vdataF32[i++] = e[0].y;
85829                  this._vdataF32[i++] = e[0].z;
85830                  this._vdataF32[i++] = e[1].z;
85831                  this._vdataF32[i++] = e[2].x;
85832                  this._vdataF32[i++] = e[2].y;
85833                  this._vdataF32[i++] = e[2].z;
85834                  this._vdataF32[i++] = e[3].x;
85835                  this._vdataF32[i++] = e[3].y;
85836                  this._vdataF32[i++] = e[3].z;
85837                  this._vdataUint32[i++] = e[4];
85838                  if (e[5]) {
85839                    this._vdataF32[i++] = e[5].x;
85840                    this._vdataF32[i++] = e[5].y;
85841                    this._vdataF32[i++] = e[5].z;
85842                  }
85843                }
85844              }
85845              addGPUParticleVertexData(t, e, i) {
85846                if (this._useInstance) this.addGPUParticleVertexDataIns(t, e, i); else {
85847                  let s = e * this._vertAttrsFloatCount * this._vertCount;
85848                  for (let e = 0; e < this._vertCount; e++) {
85849                    let n = s;
85850                    this._vdataF32[n++] = t.position.x;
85851                    this._vdataF32[n++] = t.position.y;
85852                    this._vdataF32[n++] = t.position.z;
85853                    this._vdataF32[n++] = i;
85854                    this._vdataF32[n++] = t.startSize.x;
85855                    this._vdataF32[n++] = t.startSize.y;
85856                    this._vdataF32[n++] = t.startSize.z;
85857                    this._vdataF32[n++] = Olt[2 * e];
85858                    this._vdataF32[n++] = t.rotation.x;
85859                    this._vdataF32[n++] = t.rotation.y;
85860                    this._vdataF32[n++] = t.rotation.z;
85861                    this._vdataF32[n++] = Olt[2 * e + 1];
85862                    this._vdataF32[n++] = t.startColor.r / 255;
85863                    this._vdataF32[n++] = t.startColor.g / 255;
85864                    this._vdataF32[n++] = t.startColor.b / 255;
85865                    this._vdataF32[n++] = t.startColor.a / 255;
85866                    this._vdataF32[n++] = t.velocity.x;
85867                    this._vdataF32[n++] = t.velocity.y;
85868                    this._vdataF32[n++] = t.velocity.z;
85869                    this._vdataF32[n++] = t.startLifetime;
85870                    this._vdataF32[n++] = t.randomSeed;
85871                    s += this._vertAttrsFloatCount;
85872                  }
85873                }
85874              }
85875              addGPUParticleVertexDataIns(t, e, i) {
85876                let s = e * this._vertAttrsFloatCount;
85877                let n = s;
85878                this._vdataF32[n++] = t.position.x;
85879                this._vdataF32[n++] = t.position.y;
85880                this._vdataF32[n++] = t.position.z;
85881                this._vdataF32[n++] = i;
85882                this._vdataF32[n++] = t.startSize.x;
85883                this._vdataF32[n++] = t.startSize.y;
85884                this._vdataF32[n++] = t.startSize.z;
85885                this._vdataF32[n++] = t.frameIndex;
85886                this._vdataF32[n++] = t.rotation.x;
85887                this._vdataF32[n++] = t.rotation.y;
85888                this._vdataF32[n++] = t.rotation.z;
85889                this._vdataF32[n++] = t.randomSeed;
85890                this._vdataF32[n++] = t.startColor.r / 255;
85891                this._vdataF32[n++] = t.startColor.g / 255;
85892                this._vdataF32[n++] = t.startColor.b / 255;
85893                this._vdataF32[n++] = t.startColor.a / 255;
85894                this._vdataF32[n++] = t.velocity.x;
85895                this._vdataF32[n++] = t.velocity.y;
85896                this._vdataF32[n++] = t.velocity.z;
85897                this._vdataF32[n++] = t.startLifetime;
85898                s += this._vertAttrsFloatCount;
85899              }
85900              updateGPUParticles(t, e, i) {
85901                if (this._useInstance) return this.updateGPUParticlesIns(t, e, i);
85902                {
85903                  const s = this._vertAttrsFloatCount * this._vertCount;
85904                  let n = 0;
85905                  let r = 0;
85906                  let o = 0;
85907                  let a = 0;
85908                  let l = 0;
85909                  for (let h = 0; h < t; ++h) {
85910                    n = h * s;
85911                    r = this._vdataF32[n + this._startTimeOffset];
85912                    o = this._vdataF32[n + this._lifeTimeOffset];
85913                    l = e - r;
85914                    if (o - l < i) {
85915                      a = --t * s;
85916                      this._vdataF32.copyWithin(n, a, a + s);
85917                      h--;
85918                    }
85919                  }
85920                  return t;
85921                }
85922              }
85923              updateGPUParticlesIns(t, e, i) {
85924                const s = this._vertAttrsFloatCount;
85925                let n = 0;
85926                let r = 0;
85927                let o = 0;
85928                let a = 0;
85929                let l = 0;
85930                for (let h = 0; h < t; ++h) {
85931                  n = h * s;
85932                  r = this._vdataF32[n + this._startTimeOffset];
85933                  o = this._vdataF32[n + this._lifeTimeOffset];
85934                  l = e - r;
85935                  if (o - l < i) {
85936                    a = --t * s;
85937                    this._vdataF32.copyWithin(n, a, a + s);
85938                    h--;
85939                  }
85940                }
85941                return t;
85942              }
85943              constructAttributeIndex() {
85944                if (!this._vertAttrs) return;
85945                let t = this._vertAttrs.findIndex((t => "a_position_starttime" === t.name));
85946                let e = this._vertAttrs[t].offset;
85947                this._startTimeOffset = e / 4 + 3;
85948                t = this._vertAttrs.findIndex((t => "a_dir_life" === t.name));
85949                e = this._vertAttrs[t].offset;
85950                this._lifeTimeOffset = e / 4 + 3;
85951              }
85952              updateIA(t) {
85953                if (this._useInstance) this.updateIAIns(t); else {
85954                  if (t <= 0) return;
85955                  this._subModels[0].inputAssembler.vertexBuffers[0].update(this._vdataF32);
85956                  this._iaInfo.drawInfos[0].firstIndex = 0;
85957                  this._iaInfo.drawInfos[0].indexCount = this._indexCount * t;
85958                  this._iaInfoBuffer.update(this._iaInfo);
85959                }
85960              }
85961              updateIAIns(t) {
85962                if (t <= 0) return;
85963                const e = this._subModels[0].inputAssembler;
85964                e.vertexBuffers[0].update(this._vdataF32);
85965                e.instanceCount = t;
85966                this._iaInfo.drawInfos[0].firstIndex = 0;
85967                this._iaInfo.drawInfos[0].indexCount = this._indexCount;
85968                this._iaInfo.drawInfos[0].instanceCount = t;
85969                this._iaInfoBuffer.update(this._iaInfo);
85970              }
85971              clear() {
85972                this._useInstance ? this.clearIns() : this._subModels[0].inputAssembler.indexCount = 0;
85973              }
85974              clearIns() {
85975                this._subModels[0].inputAssembler.instanceCount = 0;
85976              }
85977              destroy() {
85978                super.destroy();
85979                this.doDestroy();
85980              }
85981              doDestroy() {
85982                this._vBuffer = null;
85983                this._vdataF32 = null;
85984                this._vdataUint32 = null;
85985                this._insBuffers = [];
85986                this._insIndices = null;
85987                this._vertAttrs = null;
85988                this._material = null;
85989                this._mesh = null;
85990                this.destroySubMeshData();
85991              }
85992              rebuild() {
85993                if (this._useInstance) this.rebuildIns(); else {
85994                  this._vBuffer = this.createSubMeshData();
85995                  this._vdataF32 = new Float32Array(this._vBuffer);
85996                  this._vdataUint32 = new Uint32Array(this._vBuffer);
85997                }
85998              }
85999              rebuildIns() {
86000                this._vBuffer = this.createSubMeshDataInsDynamic();
86001                this._vdataF32 = new Float32Array(this._vBuffer);
86002                this._vdataUint32 = new Uint32Array(this._vBuffer);
86003                this.createSubMeshDataInsStatic();
86004                this.createInsSubmesh();
86005              }
86006              destroySubMeshData() {
86007                if (this._subMeshData) {
86008                  this._subMeshData.destroy();
86009                  this._subMeshData = null;
86010                }
86011                this._iaInfoBuffer && (this._iaInfoBuffer = null);
86012              }
86013              set useInstance(t) {
86014                this._useInstance !== t && (this._useInstance = t);
86015              }
86016              get useInstance() {
86017                return this._useInstance;
86018              }
86019            }
86020            class Flt {
86021              constructor(t) {
86022                this._particleSystem = null;
86023                this._model = null;
86024                this._renderInfo = null;
86025                this._vertAttrs = [];
86026                this._useInstance = void 0;
86027                this._renderInfo = t;
86028                zo.gfxDevice.hasFeature(ys.INSTANCED_ARRAYS) ? this._useInstance = !0 : this._useInstance = !1;
86029              }
86030              getUseInstance() {
86031                return this._useInstance;
86032              }
86033              getInfo() {
86034                return this._renderInfo;
86035              }
86036              onInit(t) {
86037                this._particleSystem = t;
86038              }
86039              onEnable() {
86040                if (!this._particleSystem) return;
86041                this.attachToScene();
86042                const t = this._model;
86043                t && (t.node = t.transform = this._particleSystem.node);
86044              }
86045              onDisable() {
86046                this.detachFromScene();
86047              }
86048              onDestroy() {
86049                if (this._model) {
86050                  m.director.root.destroyModel(this._model);
86051                  this._model = null;
86052                }
86053              }
86054              attachToScene() {
86055                if (this._model) {
86056                  this._model.scene && this.detachFromScene();
86057                  this._particleSystem._getRenderScene().addModel(this._model);
86058                }
86059              }
86060              detachFromScene() {
86061                this._model && this._model.scene && this._model.scene.removeModel(this._model);
86062              }
86063              setVertexAttributes() {
86064                if (this._model) {
86065                  this.updateVertexAttrib();
86066                  this._model.setVertexAttributes(this._renderInfo.renderMode === mit.Mesh ? this._renderInfo.mesh : null, this._vertAttrs);
86067                }
86068              }
86069              clear() {
86070                this._model && (this._model.enabled = !1);
86071              }
86072              getModel() {
86073                return this._model;
86074              }
86075              _initModel() {
86076                if (!this._model) {
86077                  this._model = m.director.root.createModel(Llt);
86078                  this._model.setCapacity(this._particleSystem.capacity);
86079                  this._model.visFlags = this._particleSystem.visibility;
86080                }
86081              }
86082              updateTrailMaterial() {}
86083              getDefaultTrailMaterial() {
86084                return null;
86085              }
86086            }
86087            class Vlt {
86088              constructor(t) {
86089                this.permutation = [ 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180 ];
86090                this.accSpeed = new Pi;
86091                this.noiseSpeed = new Pi;
86092                this.noiseFrequency = 0;
86093                this.noiseAbs = new Pi;
86094                this.noiseAmplitude = new Pi;
86095                this.octaves = new Pi;
86096                this.dt = 0;
86097                this.point = new Pi;
86098                this.result = new Pi;
86099                this.mixOut = new Qi;
86100                t && (this.permutation = t);
86101              }
86102              noise(t, e, i, s = 0, n = 1) {
86103                const r = new Array(512);
86104                for (let t = 0; t < 256; t++) r[256 + t] = r[t] = this.permutation[t];
86105                const o = 255 & Math.floor(t);
86106                const a = 255 & Math.floor(e);
86107                const l = 255 & Math.floor(i);
86108                t -= Math.floor(t);
86109                e -= Math.floor(e);
86110                i -= Math.floor(i);
86111                const h = this.fade(t);
86112                const c = this.fade(e);
86113                const u = this.fade(i);
86114                const _ = r[o] + a;
86115                const d = r[_] + l;
86116                const p = r[_ + 1] + l;
86117                const m = r[o + 1] + a;
86118                const f = r[m] + l;
86119                const g = r[m + 1] + l;
86120                return s + this.scale(this.lerp(u, this.lerp(c, this.lerp(h, this.grad(r[d], t, e, i), this.grad(r[f], t - 1, e, i)), this.lerp(h, this.grad(r[p], t, e - 1, i), this.grad(r[g], t - 1, e - 1, i))), this.lerp(c, this.lerp(h, this.grad(r[d + 1], t, e, i - 1), this.grad(r[f + 1], t - 1, e, i - 1)), this.lerp(h, this.grad(r[p + 1], t, e - 1, i - 1), this.grad(r[g + 1], t - 1, e - 1, i - 1))))) * (n - s);
86121              }
86122              fade(t) {
86123                return t * t * t * (t * (6 * t - 15) + 10);
86124              }
86125              lerp(t, e, i) {
86126                return e + t * (i - e);
86127              }
86128              grad(t, e, i, s) {
86129                const n = 15 & t;
86130                const r = n < 8 ? e : i;
86131                const o = n < 4 ? i : 12 === n || 14 === n ? e : s;
86132                return (0 == (1 & n) ? r : -r) + (0 == (2 & n) ? o : -o);
86133              }
86134              scale(t) {
86135                return (1 + t) / 2;
86136              }
86137              setSpeed(t, e, i) {
86138                this.noiseSpeed.set(t, e, i);
86139              }
86140              setFrequency(t) {
86141                this.noiseFrequency = t;
86142              }
86143              setAbs(t, e, i) {
86144                this.noiseAbs.set(t, e, i);
86145              }
86146              setAmplititude(t, e, i) {
86147                this.noiseAmplitude.set(t, e, i);
86148              }
86149              setOctaves(t, e, i) {
86150                this.octaves.set(t, e, i);
86151              }
86152              setTime(t) {
86153                this.dt = t;
86154              }
86155              setSamplePoint(t) {
86156                this.point.set(t);
86157              }
86158              getResult() {
86159                return this.result;
86160              }
86161              getNoise(t, e, i, s, n, r, o) {
86162                let a = r;
86163                let l = 0;
86164                l += this.noise(t * a, e * a, i * a, -1, 1);
86165                if (1 === o.x) return l;
86166                let h = 1;
86167                let c = 1;
86168                for (let s = 1; s < o.x; ++s) {
86169                  h *= o.y;
86170                  a *= o.z;
86171                  c += h;
86172                  l += this.noise(t * a, e * a, i * a, -1, 1) * h;
86173                }
86174                return l / c;
86175              }
86176              getNoiseMix(t, e, i, s, n, r) {
86177                t.x = this.getNoise(e.x, e.y, e.z, i, s, n, r);
86178                t.y = this.getNoise(e.y, e.z, e.x, i, s, n, r);
86179              }
86180              getNoiseParticle() {
86181                this.accSpeed.set(this.noiseSpeed.x * this.dt, this.noiseSpeed.y * this.dt, this.noiseSpeed.z * this.dt);
86182                const t = this.getNoise(this.point.z + this.accSpeed.x, this.point.y, this.point.x, this.dt, this.accSpeed, this.noiseFrequency, this.octaves);
86183                const e = this.getNoise(this.point.x + 1e3, this.point.z + this.accSpeed.y, this.point.y, this.dt, this.accSpeed, this.noiseFrequency, this.octaves);
86184                const i = this.getNoise(this.point.y, this.point.x + 1e3, this.point.z + this.accSpeed.z, this.dt, this.accSpeed, this.noiseFrequency, this.octaves);
86185                this.result.set(t * this.noiseAmplitude.x, e * this.noiseAmplitude.y, i * this.noiseAmplitude.z);
86186              }
86187              getPreview(t, e, i) {
86188                for (let s = 0; s < i; ++s) for (let n = 0; n < e; ++n) {
86189                  const r = (n - .5 * e) / e + this.noiseSpeed.x * this.dt;
86190                  const o = (s - .5 * i) / i + this.noiseSpeed.y * this.dt;
86191                  const a = this.getNoise(r, o, 0, this.dt, this.accSpeed, this.noiseFrequency, this.octaves);
86192                  t[s * e + n] = .5 * (a + 1);
86193                }
86194              }
86195            }
86196            const klt = new Pi;
86197            const Ult = new qi;
86198            const Glt = new qi;
86199            const zlt = new Ui;
86200            new Pi;
86201            const Hlt = [ "_colorOverLifetimeModule", "_sizeOvertimeModule", "_velocityOvertimeModule", "_forceOvertimeModule", "_limitVelocityOvertimeModule", "_rotationOvertimeModule", "_textureAnimationModule", "_noiseModule" ];
86202            const jlt = [ 0, 0, 1, 0, 0, 1, 1, 1 ];
86203            const Xlt = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD1, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD2, bs.RGB32F), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0) ];
86204            const Wlt = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD1, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD2, bs.RGB32F), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0), new Vn(cr.ATTR_COLOR1, bs.RGB32F) ];
86205            const Ylt = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD1, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD2, bs.RGB32F), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0), new Vn(cr.ATTR_TEX_COORD3, bs.RGB32F), new Vn(cr.ATTR_NORMAL, bs.RGB32F), new Vn(cr.ATTR_COLOR1, bs.RGBA8, !0) ];
86206            const qlt = [ new Vn(cr.ATTR_TEX_COORD4, bs.RGBA32F, !1, 0, !0), new Vn(cr.ATTR_TEX_COORD1, bs.RGB32F, !1, 0, !0), new Vn(cr.ATTR_TEX_COORD2, bs.RGB32F, !1, 0, !0), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0, 0, !0), new Vn(cr.ATTR_TEX_COORD, bs.RGB32F, !1, 1) ];
86207            const Klt = [ new Vn(cr.ATTR_TEX_COORD4, bs.RGBA32F, !1, 0, !0), new Vn(cr.ATTR_TEX_COORD1, bs.RGB32F, !1, 0, !0), new Vn(cr.ATTR_TEX_COORD2, bs.RGB32F, !1, 0, !0), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0, 0, !0), new Vn(cr.ATTR_COLOR1, bs.RGB32F, !1, 0, !0), new Vn(cr.ATTR_TEX_COORD, bs.RGB32F, !1, 1) ];
86208            const Jlt = [ new Vn(cr.ATTR_TEX_COORD4, bs.RGBA32F, !1, 0, !0), new Vn(cr.ATTR_TEX_COORD1, bs.RGB32F, !1, 0, !0), new Vn(cr.ATTR_TEX_COORD2, bs.RGB32F, !1, 0, !0), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0, 0, !0), new Vn(cr.ATTR_TEX_COORD, bs.RGB32F, !1, 1), new Vn(cr.ATTR_TEX_COORD3, bs.RGB32F, !1, 1), new Vn(cr.ATTR_NORMAL, bs.RGB32F, !1, 1), new Vn(cr.ATTR_COLOR1, bs.RGBA8, !0, 1) ];
86209            const Zlt = {
86210              parent: null,
86211              owner: null,
86212              subModelIdx: 0
86213            };
86214            class Qlt extends Flt {
86215              constructor(t) {
86216                super(t);
86217                this._defines = void 0;
86218                this._trailDefines = void 0;
86219                this._frameTile_velLenScale = void 0;
86220                this._tmp_velLenScale = void 0;
86221                this._defaultMat = null;
86222                this._node_scale = void 0;
86223                this._attrs = void 0;
86224                this._particles = null;
86225                this._defaultTrailMat = null;
86226                this._updateList = new Map;
86227                this._animateList = new Map;
86228                this._runAnimateList = new Array;
86229                this._fillDataFunc = null;
86230                this._uScaleHandle = 0;
86231                this._uLenHandle = 0;
86232                this._uNodeRotHandle = 0;
86233                this._alignSpace = pit.View;
86234                this._inited = !1;
86235                this._localMat = new qi;
86236                this._gravity = new is;
86237                this.noise = new Vlt;
86238                this._model = null;
86239                this._frameTile_velLenScale = new is(1, 1, 0, 0);
86240                this._tmp_velLenScale = this._frameTile_velLenScale.clone();
86241                this._node_scale = new is;
86242                this._attrs = new Array(7);
86243                this._defines = {
86244                  CC_USE_WORLD_SPACE: !0,
86245                  CC_USE_BILLBOARD: !0,
86246                  CC_USE_STRETCHED_BILLBOARD: !1,
86247                  CC_USE_HORIZONTAL_BILLBOARD: !1,
86248                  CC_USE_VERTICAL_BILLBOARD: !1
86249                };
86250                this._trailDefines = {
86251                  CC_USE_WORLD_SPACE: !0
86252                };
86253              }
86254              onInit(t) {
86255                super.onInit(t);
86256                this._particles = new to((() => new tit(this)), 16);
86257                this._setVertexAttrib();
86258                this._setFillFunc();
86259                this._initModuleList();
86260                this._initModel();
86261                this.updateMaterialParams();
86262                this.updateTrailMaterial();
86263                this.setVertexAttributes();
86264                this._inited = !0;
86265              }
86266              clear() {
86267                super.clear();
86268                this._particles.reset();
86269                this._particleSystem._trailModule && this._particleSystem._trailModule.clear();
86270                this.updateRenderData();
86271                this._model.enabled = !1;
86272              }
86273              updateRenderMode() {
86274                this._setVertexAttrib();
86275                this._setFillFunc();
86276                this.updateMaterialParams();
86277                this.setVertexAttributes();
86278              }
86279              onDestroy() {
86280                var t;
86281                null === (t = this._particles) || void 0 === t || t.destroy();
86282                super.onDestroy();
86283              }
86284              getFreeParticle() {
86285                return this._particles.length >= this._particleSystem.capacity ? null : this._particles.add();
86286              }
86287              getDefaultTrailMaterial() {
86288                return this._defaultTrailMat;
86289              }
86290              setNewParticle(t) {}
86291              _initModuleList() {
86292                Hlt.forEach((t => {
86293                  const e = this._particleSystem[t];
86294                  if (e && e.enable) {
86295                    e.needUpdate && (this._updateList[e.name] = e);
86296                    e.needAnimate && (this._animateList[e.name] = e);
86297                  }
86298                }));
86299                this._runAnimateList.length = 0;
86300                for (let t = 0, e = hit.length; t < e; t++) {
86301                  const e = this._animateList[hit[t]];
86302                  e && this._runAnimateList.push(e);
86303                }
86304              }
86305              enableModule(t, e, i) {
86306                if (e) {
86307                  i.needUpdate && (this._updateList[i.name] = i);
86308                  i.needAnimate && (this._animateList[i.name] = i);
86309                } else {
86310                  delete this._animateList[t];
86311                  delete this._updateList[t];
86312                }
86313                this._runAnimateList.length = 0;
86314                for (let t = 0, e = hit.length; t < e; t++) {
86315                  const e = this._animateList[hit[t]];
86316                  e && this._runAnimateList.push(e);
86317                }
86318                this.updateMaterialParams();
86319              }
86320              updateAlignSpace(t) {
86321                this._alignSpace = t;
86322              }
86323              getDefaultMaterial() {
86324                return this._defaultMat;
86325              }
86326              updateRotation(t) {
86327                t && this.doUpdateRotation(t);
86328              }
86329              doUpdateRotation(t) {
86330                if (this._renderInfo.renderMode === mit.Mesh || this._alignSpace !== pit.View) {
86331                  if (this._alignSpace === pit.Local) this._particleSystem.node.getRotation(zlt); else if (this._alignSpace === pit.World) this._particleSystem.node.getWorldRotation(zlt); else if (this._alignSpace === pit.View) {
86332                    var e;
86333                    zlt.set(0, 0, 0, 1);
86334                    const t = null === (e = this._particleSystem.node.scene.renderScene) || void 0 === e ? void 0 : e.cameras;
86335                    if (void 0 !== t) for (let e = 0; e < (null == t ? void 0 : t.length); ++e) {
86336                      const i = t[e];
86337                      if ((i.visibility & this._particleSystem.node.layer) === this._particleSystem.node.layer) {
86338                        Ui.fromViewUp(zlt, i.forward);
86339                        break;
86340                      }
86341                    }
86342                  } else zlt.set(0, 0, 0, 1);
86343                  t.setUniform(this._uNodeRotHandle, zlt);
86344                }
86345              }
86346              updateScale(t) {
86347                t && this.doUpdateScale(t);
86348              }
86349              doUpdateScale(t) {
86350                switch (this._particleSystem.scaleSpace) {
86351                 case _it.Local:
86352                  this._particleSystem.node.getScale(this._node_scale);
86353                  break;
86354
86355                 case _it.World:
86356                  this._particleSystem.node.getWorldScale(this._node_scale);
86357                }
86358                t.setUniform(this._uScaleHandle, this._node_scale);
86359              }
86360              updateParticles(t) {
86361                const e = this._particleSystem;
86362                if (!e) return this._particles.length;
86363                e.node.getWorldMatrix(Ult);
86364                const i = (e.getMaterialInstance(0) || this._defaultMat).passes[0];
86365                this.doUpdateScale(i);
86366                this.doUpdateRotation(i);
86367                this._updateList.forEach(((t, i) => {
86368                  t.update(e._simulationSpace, Ult);
86369                }));
86370                const s = e._trailModule;
86371                const n = s && s.enable;
86372                n && s.update();
86373                if (e.simulationSpace === _it.Local) {
86374                  const t = e.node.getRotation();
86375                  qi.fromQuat(this._localMat, t);
86376                  this._localMat.transpose();
86377                }
86378                if (e.node.parent) {
86379                  e.node.parent.getWorldMatrix(Glt);
86380                  Glt.invert();
86381                }
86382                for (let i = 0; i < this._particles.length; ++i) {
86383                  const r = this._particles.data[i];
86384                  r.remainingLifetime -= t;
86385                  Pi.set(r.animatedVelocity, 0, 0, 0);
86386                  if (r.remainingLifetime < 0) {
86387                    n && s.removeParticle(r);
86388                    this._particles.removeAt(i);
86389                    --i;
86390                  } else {
86391                    if (e.simulationSpace === _it.Local) {
86392                      const i = 9.8 * -e.gravityModifier.evaluate(1 - r.remainingLifetime / r.startLifetime, Si(r.randomSeed)) * t;
86393                      this._gravity.x = 0;
86394                      this._gravity.y = i;
86395                      this._gravity.z = 0;
86396                      this._gravity.w = 1;
86397                      if (!ui(i, 0, hi)) {
86398                        e.node.parent && (this._gravity = this._gravity.transformMat4(Glt));
86399                        this._gravity = this._gravity.transformMat4(this._localMat);
86400                        r.velocity.x += this._gravity.x;
86401                        r.velocity.y += this._gravity.y;
86402                        r.velocity.z += this._gravity.z;
86403                      }
86404                    } else r.velocity.y -= 9.8 * e.gravityModifier.evaluate(1 - r.remainingLifetime / r.startLifetime, Si(r.randomSeed)) * t;
86405                    Pi.copy(r.ultimateVelocity, r.velocity);
86406                    this._runAnimateList.forEach((e => {
86407                      e.animate(r, t);
86408                    }));
86409                    Pi.scaleAndAdd(r.position, r.position, r.ultimateVelocity, t);
86410                    n && s.animate(r, t);
86411                  }
86412                }
86413                this._model.enabled = this._particles.length > 0;
86414                return this._particles.length;
86415              }
86416              getNoisePreview(t, e, i) {
86417                this._runAnimateList.forEach((s => {
86418                  if (s.name === lit) {
86419                    s.getNoisePreview(t, this._particleSystem, e, i);
86420                  }
86421                }));
86422              }
86423              updateRenderData() {
86424                let t = 0;
86425                for (let e = 0; e < this._particles.length; ++e) {
86426                  const i = this._particles.data[e];
86427                  let s = 0;
86428                  const n = this._particleSystem._textureAnimationModule;
86429                  n && n.enable && (s = i.frameIndex);
86430                  t = 4 * e;
86431                  this._fillDataFunc(i, t, s);
86432                }
86433              }
86434              beforeRender() {
86435                this._model.updateIA(this._particles.length);
86436              }
86437              getParticleCount() {
86438                return this._particles.length;
86439              }
86440              onMaterialModified(t, e) {
86441                this._inited && (0 === t ? this.updateMaterialParams() : this.updateTrailMaterial());
86442              }
86443              onRebuildPSO(t, e) {
86444                this._model && 0 === t && this._model.setSubModelMaterial(0, e);
86445                const i = this._particleSystem._trailModule;
86446                i && i._trailModel && 1 === t && i._trailModel.setSubModelMaterial(0, e);
86447              }
86448              _setFillFunc() {
86449                this._renderInfo.renderMode === mit.Mesh ? this._fillDataFunc = this._fillMeshData : this._renderInfo.renderMode === mit.StrecthedBillboard ? this._fillDataFunc = this._fillStrecthedData : this._fillDataFunc = this._fillNormalData;
86450              }
86451              _fillMeshData(t, e, i) {
86452                const s = e / 4;
86453                this._attrs[0] = t.position;
86454                klt.z = i;
86455                this._attrs[1] = klt;
86456                this._attrs[2] = t.size;
86457                this._attrs[3] = t.rotation;
86458                this._attrs[4] = t.color._val;
86459                this._model.addParticleVertexData(s, this._attrs);
86460              }
86461              _fillStrecthedData(t, e, i) {
86462                if (this._useInstance) this._fillStrecthedDataIns(t, e, i); else for (let s = 0; s < 4; ++s) {
86463                  this._attrs[0] = t.position;
86464                  klt.x = jlt[2 * s];
86465                  klt.y = jlt[2 * s + 1];
86466                  klt.z = i;
86467                  this._attrs[1] = klt;
86468                  this._attrs[2] = t.size;
86469                  this._attrs[3] = t.rotation;
86470                  this._attrs[4] = t.color._val;
86471                  this._attrs[5] = t.ultimateVelocity;
86472                  this._attrs[6] = null;
86473                  this._model.addParticleVertexData(e++, this._attrs);
86474                }
86475              }
86476              _fillStrecthedDataIns(t, e, i) {
86477                const s = e / 4;
86478                this._attrs[0] = t.position;
86479                klt.z = i;
86480                this._attrs[1] = klt;
86481                this._attrs[2] = t.size;
86482                this._attrs[3] = t.rotation;
86483                this._attrs[4] = t.color._val;
86484                this._attrs[5] = t.ultimateVelocity;
86485                this._model.addParticleVertexData(s, this._attrs);
86486              }
86487              _fillNormalData(t, e, i) {
86488                if (this._useInstance) this._fillNormalDataIns(t, e, i); else for (let s = 0; s < 4; ++s) {
86489                  this._attrs[0] = t.position;
86490                  klt.x = jlt[2 * s];
86491                  klt.y = jlt[2 * s + 1];
86492                  klt.z = i;
86493                  this._attrs[1] = klt;
86494                  this._attrs[2] = t.size;
86495                  this._attrs[3] = t.rotation;
86496                  this._attrs[4] = t.color._val;
86497                  this._attrs[5] = null;
86498                  this._model.addParticleVertexData(e++, this._attrs);
86499                }
86500              }
86501              _fillNormalDataIns(t, e, i) {
86502                const s = e / 4;
86503                this._attrs[0] = t.position;
86504                klt.z = i;
86505                this._attrs[1] = klt;
86506                this._attrs[2] = t.size;
86507                this._attrs[3] = t.rotation;
86508                this._attrs[4] = t.color._val;
86509                this._attrs[5] = null;
86510                this._model.addParticleVertexData(s, this._attrs);
86511              }
86512              updateVertexAttrib() {
86513                if (this._renderInfo.renderMode === mit.Mesh && this._renderInfo.mesh) {
86514                  const t = this._renderInfo.mesh.readAttributeFormat(0, cr.ATTR_COLOR);
86515                  if (t) {
86516                    let e = bs.RGBA8;
86517                    for (let i = 0; i < ur.length; ++i) if (ur[i].name === t.name) {
86518                      e = i;
86519                      break;
86520                    }
86521                    this._vertAttrs[7] = new Vn(cr.ATTR_COLOR1, e, !0, this._useInstance ? 1 : 0);
86522                  } else {
86523                    const t = bs.RGBA8;
86524                    this._vertAttrs[7] = new Vn(cr.ATTR_COLOR1, t, !0, this._useInstance ? 1 : 0);
86525                  }
86526                }
86527              }
86528              _setVertexAttrib() {
86529                if (this._useInstance) this._setVertexAttribIns(); else switch (this._renderInfo.renderMode) {
86530                 case mit.StrecthedBillboard:
86531                  this._vertAttrs = Wlt.slice();
86532                  break;
86533
86534                 case mit.Mesh:
86535                  this._vertAttrs = Ylt.slice();
86536                  break;
86537
86538                 default:
86539                  this._vertAttrs = Xlt.slice();
86540                }
86541              }
86542              _setVertexAttribIns() {
86543                switch (this._renderInfo.renderMode) {
86544                 case mit.StrecthedBillboard:
86545                  this._vertAttrs = Klt.slice();
86546                  break;
86547
86548                 case mit.Mesh:
86549                  this._vertAttrs = Jlt.slice();
86550                  break;
86551
86552                 default:
86553                  this._vertAttrs = qlt.slice();
86554                }
86555              }
86556              updateMaterialParams() {
86557                if (!this._particleSystem) return;
86558                const t = this._particleSystem;
86559                const e = t.sharedMaterial;
86560                if (null != e) {
86561                  e._effectAsset._name;
86562                  this._renderInfo.mainTexture = e.getProperty("mainTexture", 0);
86563                }
86564                if (null == t.sharedMaterial && null == this._defaultMat) {
86565                  Zlt.parent = xR.get("default-particle-material");
86566                  Zlt.owner = this._particleSystem;
86567                  Zlt.subModelIdx = 0;
86568                  this._defaultMat = new uS(Zlt);
86569                  Zlt.parent = null;
86570                  Zlt.owner = null;
86571                  Zlt.subModelIdx = 0;
86572                  null !== this._renderInfo.mainTexture && this._defaultMat.setProperty("mainTexture", this._renderInfo.mainTexture);
86573                }
86574                const i = t.getMaterialInstance(0) || this._defaultMat;
86575                t._simulationSpace === _it.World ? this._defines.CC_USE_WORLD_SPACE = !0 : this._defines.CC_USE_WORLD_SPACE = !1;
86576                const s = i.passes[0];
86577                this._uScaleHandle = s.getHandle("scale");
86578                this._uLenHandle = s.getHandle("frameTile_velLenScale");
86579                this._uNodeRotHandle = s.getHandle("nodeRotation");
86580                const n = this._renderInfo.renderMode;
86581                const r = this._frameTile_velLenScale;
86582                if (n === mit.Billboard) this._defines.CC_RENDER_MODE = 0; else if (n === mit.StrecthedBillboard) {
86583                  this._defines.CC_RENDER_MODE = 1;
86584                  r.z = this._renderInfo.velocityScale;
86585                  r.w = this._renderInfo.lengthScale;
86586                } else n === mit.HorizontalBillboard ? this._defines.CC_RENDER_MODE = 2 : n === mit.VerticalBillboard ? this._defines.CC_RENDER_MODE = 3 : n === mit.Mesh ? this._defines.CC_RENDER_MODE = 4 : console.warn(`particle system renderMode ${n} not support.`);
86587                const o = t._textureAnimationModule;
86588                if (o && o.enable) {
86589                  is.copy(this._tmp_velLenScale, r);
86590                  Qi.set(this._tmp_velLenScale, o.numTilesX, o.numTilesY);
86591                  s.setUniform(this._uLenHandle, this._tmp_velLenScale);
86592                } else s.setUniform(this._uLenHandle, r);
86593                let a = !1;
86594                const l = this._particleSystem._rotationOvertimeModule;
86595                a = l && l.enable;
86596                this._defines.ROTATION_OVER_TIME_MODULE_ENABLE = a;
86597                this._defines.CC_INSTANCE_PARTICLE = this._useInstance;
86598                i.recompileShaders(this._defines);
86599                this._model && this._model.updateMaterial(i);
86600              }
86601              updateTrailMaterial() {
86602                if (!this._particleSystem) return;
86603                const t = this._particleSystem;
86604                const e = t._trailModule;
86605                if (e && e.enable) {
86606                  t.simulationSpace === _it.World || e.space === _it.World ? this._trailDefines.CC_USE_WORLD_SPACE = !0 : this._trailDefines.CC_USE_WORLD_SPACE = !1;
86607                  let i = t.getMaterialInstance(1);
86608                  if (null === i && null === this._defaultTrailMat) {
86609                    Zlt.parent = xR.get("default-trail-material");
86610                    Zlt.owner = this._particleSystem;
86611                    Zlt.subModelIdx = 1;
86612                    this._defaultTrailMat = new uS(Zlt);
86613                    Zlt.parent = null;
86614                    Zlt.owner = null;
86615                    Zlt.subModelIdx = 0;
86616                  }
86617                  i = i || this._defaultTrailMat;
86618                  i.recompileShaders(this._trailDefines);
86619                  e.updateMaterial();
86620                }
86621              }
86622              setUseInstance(t) {
86623                if (this._useInstance !== t) {
86624                  this._useInstance = t;
86625                  if (this._model) {
86626                    this._model.useInstance = t;
86627                    this._model.doDestroy();
86628                  }
86629                  this.updateRenderMode();
86630                }
86631              }
86632            }
86633            const $lt = new qi;
86634            const tht = new is;
86635            const eht = new Ui;
86636            const iht = new Ui;
86637            new Pi;
86638            const sht = 32;
86639            const nht = "a_position_starttime", rht = "a_size_uv", oht = "a_rotation_uv", aht = "a_color", lht = "a_dir_life", hht = "a_rndSeed", cht = "a_size_fid", uht = "a_rotation_rnd", _ht = "a_uv";
86640            const dht = [ new Vn(nht, bs.RGBA32F), new Vn(rht, bs.RGBA32F), new Vn(oht, bs.RGBA32F), new Vn(aht, bs.RGBA32F), new Vn(lht, bs.RGBA32F), new Vn(hht, bs.R32F) ];
86641            const pht = [ new Vn(nht, bs.RGBA32F), new Vn(rht, bs.RGBA32F), new Vn(oht, bs.RGBA32F), new Vn(aht, bs.RGBA32F), new Vn(lht, bs.RGBA32F), new Vn(hht, bs.R32F), new Vn(cr.ATTR_TEX_COORD, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD3, bs.RGB32F), new Vn(cr.ATTR_NORMAL, bs.RGB32F), new Vn(cr.ATTR_COLOR1, bs.RGBA8, !0) ];
86642            const mht = [ new Vn(nht, bs.RGBA32F, !1, 0, !0), new Vn(cht, bs.RGBA32F, !1, 0, !0), new Vn(uht, bs.RGBA32F, !1, 0, !0), new Vn(aht, bs.RGBA32F, !1, 0, !0), new Vn(lht, bs.RGBA32F, !1, 0, !0), new Vn(_ht, bs.RGB32F, !1, 1) ];
86643            const fht = [ new Vn(nht, bs.RGBA32F, !1, 0, !0), new Vn(cht, bs.RGBA32F, !1, 0, !0), new Vn(uht, bs.RGBA32F, !1, 0, !0), new Vn(aht, bs.RGBA32F, !1, 0, !0), new Vn(lht, bs.RGBA32F, !1, 0, !0), new Vn(cr.ATTR_TEX_COORD, bs.RGB32F, !1, 1), new Vn(cr.ATTR_TEX_COORD3, bs.RGB32F, !1, 1), new Vn(cr.ATTR_NORMAL, bs.RGB32F, !1, 1), new Vn(cr.ATTR_COLOR1, bs.RGBA8, !0, 1) ];
86644            const ght = {
86645              parent: null,
86646              owner: null,
86647              subModelIdx: 0
86648            };
86649            class yht extends Flt {
86650              constructor(t) {
86651                super(t);
86652                this._defines = void 0;
86653                this._frameTile_velLenScale = void 0;
86654                this._unifrom_velLenScale = void 0;
86655                this._tmp_velLenScale = void 0;
86656                this._node_scale = void 0;
86657                this._vertAttrs = [];
86658                this._defaultMat = null;
86659                this._particleNum = 0;
86660                this._tempParticle = null;
86661                this._colorTexture = null;
86662                this._forceTexture = null;
86663                this._velocityTexture = null;
86664                this._rotationTexture = null;
86665                this._sizeTexture = null;
86666                this._animTexture = null;
86667                this._colorData = null;
86668                this._forceData = null;
86669                this._velocityData = null;
86670                this._rotationData = null;
86671                this._sizeData = null;
86672                this._animData = null;
86673                this._uTimeHandle = 0;
86674                this._uRotHandle = 0;
86675                this._uNodeRotHandle = 0;
86676                this._alignSpace = pit.View;
86677                this._inited = !1;
86678                this._frameTile_velLenScale = new is(1, 1, 0, 0);
86679                this._unifrom_velLenScale = this._frameTile_velLenScale.clone();
86680                this._tmp_velLenScale = this._frameTile_velLenScale.clone();
86681                this._node_scale = new is;
86682                this._defines = {
86683                  CC_USE_WORLD_SPACE: !0,
86684                  CC_USE_BILLBOARD: !0,
86685                  CC_USE_STRETCHED_BILLBOARD: !1,
86686                  CC_USE_HORIZONTAL_BILLBOARD: !1,
86687                  CC_USE_VERTICAL_BILLBOARD: !1,
86688                  COLOR_OVER_TIME_MODULE_ENABLE: !1
86689                };
86690                this._tempParticle = new tit(null);
86691                this._particleNum = 0;
86692              }
86693              onInit(t) {
86694                super.onInit(t);
86695                this._setVertexAttrib();
86696                this._initModel();
86697                this.updateMaterialParams();
86698                this.setVertexAttributes();
86699                this._inited = !0;
86700              }
86701              updateRenderMode() {
86702                this._setVertexAttrib();
86703                this.updateMaterialParams();
86704                this.setVertexAttributes();
86705              }
86706              setVertexAttributes() {
86707                super.setVertexAttributes();
86708                this._model.constructAttributeIndex();
86709              }
86710              clear() {
86711                super.clear();
86712                this._particleNum = 0;
86713                this.updateRenderData();
86714              }
86715              onDestroy() {
86716                super.onDestroy();
86717                this._forceTexture && this._forceTexture.destroy();
86718                this._velocityTexture && this._velocityTexture.destroy();
86719                this._colorTexture && this._colorTexture.destroy();
86720                this._sizeTexture && this._sizeTexture.destroy();
86721                this._rotationTexture && this._rotationTexture.destroy();
86722                this._animTexture && this._animTexture.destroy();
86723                this._forceData = null;
86724                this._velocityData = null;
86725                this._colorData = null;
86726                this._sizeData = null;
86727                this._rotationData = null;
86728                this._animData = null;
86729              }
86730              enableModule(t, e, i) {
86731                const s = this._particleSystem.getMaterialInstance(0) || this._defaultMat;
86732                if (s) {
86733                  this.initShaderUniform(s);
86734                  s.recompileShaders(this._defines);
86735                  this._model && this._model.setSubModelMaterial(0, s);
86736                }
86737              }
86738              getFreeParticle() {
86739                return this._particleNum >= this._particleSystem._capacity ? null : this._tempParticle;
86740              }
86741              setNewParticle(t) {
86742                this._model.addGPUParticleVertexData(t, this._particleNum, this._particleSystem._time);
86743                this._particleNum++;
86744              }
86745              getDefaultMaterial() {
86746                return this._defaultMat;
86747              }
86748              updateRotation(t) {
86749                t && this.doUpdateRotation(t);
86750              }
86751              doUpdateRotation(t) {
86752                if (this._renderInfo.renderMode === mit.Mesh || this._alignSpace !== pit.View) {
86753                  if (this._alignSpace === pit.Local) this._particleSystem.node.getRotation(iht); else if (this._alignSpace === pit.World) this._particleSystem.node.getWorldRotation(iht); else if (this._alignSpace === pit.View) {
86754                    var e;
86755                    iht.set(0, 0, 0, 1);
86756                    const t = null === (e = this._particleSystem.node.scene.renderScene) || void 0 === e ? void 0 : e.cameras;
86757                    if (void 0 !== t) for (let e = 0; e < (null == t ? void 0 : t.length); ++e) {
86758                      const i = t[e];
86759                      if ((i.visibility & this._particleSystem.node.layer) === this._particleSystem.node.layer) {
86760                        Ui.fromViewUp(iht, i.forward);
86761                        break;
86762                      }
86763                    }
86764                  } else iht.set(0, 0, 0, 1);
86765                  t.setUniform(this._uNodeRotHandle, iht);
86766                }
86767              }
86768              updateScale(t) {
86769                t && this.doUpdateScale(t);
86770              }
86771              doUpdateScale(t) {
86772                switch (this._particleSystem.scaleSpace) {
86773                 case _it.Local:
86774                  this._particleSystem.node.getScale(this._node_scale);
86775                  break;
86776
86777                 case _it.World:
86778                  this._particleSystem.node.getWorldScale(this._node_scale);
86779                }
86780                t.setUniform(t.getHandle("scale"), this._node_scale);
86781              }
86782              updateParticles(t) {
86783                this._particleNum = this._model.updateGPUParticles(this._particleNum, this._particleSystem._time, t);
86784                this.updateShaderUniform(t);
86785                this._model.enabled = this._particleNum > 0;
86786                return this._particleNum;
86787              }
86788              updateRenderData() {}
86789              beforeRender() {
86790                this._model.updateIA(this._particleNum);
86791              }
86792              updateAlignSpace(t) {
86793                this._alignSpace = t;
86794              }
86795              updateShaderUniform(t) {
86796                const e = this._particleSystem.getMaterialInstance(0) || this._defaultMat;
86797                if (!e) return;
86798                const i = e.passes[0];
86799                tht.x = this._particleSystem._time;
86800                tht.y = t;
86801                i.setUniform(this._uTimeHandle, tht);
86802                this._particleSystem.node.getWorldRotation(eht);
86803                i.setUniform(this._uRotHandle, eht);
86804                this.doUpdateRotation(i);
86805              }
86806              initShaderUniform(t) {
86807                const e = t.passes[0];
86808                this._uTimeHandle = e.getHandle("u_timeDelta");
86809                this._uRotHandle = e.getHandle("u_worldRot");
86810                this._uNodeRotHandle = e.getHandle("nodeRotation");
86811                this.doUpdateScale(e);
86812                e.setUniform(e.getHandle("frameTile_velLenScale"), this._unifrom_velLenScale);
86813                tht.x = sht;
86814                tht.y = .03125;
86815                e.setUniform(e.getHandle("u_sampleInfo"), tht);
86816                let i = !1;
86817                const s = this._particleSystem._forceOvertimeModule;
86818                i = s && s.enable;
86819                this._defines.FORCE_OVER_TIME_MODULE_ENABLE = i;
86820                if (i) {
86821                  const t = Ltt(this._forceTexture, this._forceData, sht, s.x, s.y, s.z);
86822                  this._forceTexture = t.texture;
86823                  this._forceData = t.texdata;
86824                  const i = e.getHandle("force_over_time_tex0");
86825                  const n = XP.getBindingFromHandle(i);
86826                  e.bindSampler(n, this._forceTexture.getGFXSampler());
86827                  e.bindTexture(n, this._forceTexture.getGFXTexture());
86828                  const r = e.getHandle("u_force_space");
86829                  e.setUniform(r, s.space);
86830                  const o = e.getHandle("u_force_mode");
86831                  e.setUniform(o, this._forceTexture.height);
86832                }
86833                const n = this._particleSystem._velocityOvertimeModule;
86834                i = n && n.enable;
86835                this._defines.VELOCITY_OVER_TIME_MODULE_ENABLE = i;
86836                if (i) {
86837                  const t = function(t, e, i, s, n, r, o, a) {
86838                    const l = Math.max(Ott(s), Ott(n), Ott(r), Ott(o));
86839                    const h = i * l * 4;
86840                    null !== e && e.length === h || (e = new Float32Array(i * l * 4));
86841                    const c = [ s, n, r, o ];
86842                    const u = 1 / (i - 1);
86843                    for (let t = 0; t < l; t++) for (let s = 0; s < 4; s++) {
86844                      const n = c[s];
86845                      let r = 0;
86846                      let o = 0;
86847                      for (let l = 0; l < i; l++) {
86848                        const h = Ptt(n, u * l, t);
86849                        if (a) o = h; else {
86850                          r += h;
86851                          o = r / (l + 1);
86852                        }
86853                        e[4 * (t * i + l) + s] = o;
86854                      }
86855                    }
86856                    return {
86857                      texture: Ntt(t, e, i, l),
86858                      texdata: e
86859                    };
86860                  }(this._velocityTexture, this._velocityData, sht, n.x, n.y, n.z, n.speedModifier);
86861                  this._velocityTexture = t.texture;
86862                  this._velocityData = t.texdata;
86863                  const i = e.getHandle("velocity_over_time_tex0");
86864                  const s = XP.getBindingFromHandle(i);
86865                  e.bindSampler(s, this._velocityTexture.getGFXSampler());
86866                  e.bindTexture(s, this._velocityTexture.getGFXTexture());
86867                  const r = e.getHandle("u_velocity_space");
86868                  e.setUniform(r, n.space);
86869                  const o = e.getHandle("u_velocity_mode");
86870                  e.setUniform(o, this._velocityTexture.height);
86871                }
86872                const r = this._particleSystem._colorOverLifetimeModule;
86873                i = r && r.enable;
86874                this._defines.COLOR_OVER_TIME_MODULE_ENABLE = i;
86875                if (i) {
86876                  const t = aet(this._colorTexture, this._colorData, sht, r.color);
86877                  this._colorTexture = t.texture;
86878                  this._colorData = t.texdata;
86879                  const i = e.getHandle("color_over_time_tex0");
86880                  const s = XP.getBindingFromHandle(i);
86881                  e.bindSampler(s, this._colorTexture.getGFXSampler());
86882                  e.bindTexture(s, this._colorTexture.getGFXTexture());
86883                  const n = e.getHandle("u_color_mode");
86884                  e.setUniform(n, this._colorTexture.height);
86885                }
86886                const o = this._particleSystem._rotationOvertimeModule;
86887                i = o && o.enable;
86888                this._defines.ROTATION_OVER_TIME_MODULE_ENABLE = i;
86889                if (i) {
86890                  let t;
86891                  t = o.separateAxes ? Ltt(this._rotationTexture, this._rotationData, sht, o.x, o.y, o.z) : function(t, e, i, s, n) {
86892                    const r = Ott(s);
86893                    const o = i * r * 4;
86894                    null !== e && e.length === o || (e = new Float32Array(i * r * 4));
86895                    const a = 1 / (i - 1);
86896                    let l = 0;
86897                    for (let t = 0; t < r; t++) for (let n = 0; n < i; n++) {
86898                      const i = Ptt(s, a * n, t);
86899                      e[l + 2] = i;
86900                      l += 4;
86901                    }
86902                    return {
86903                      texture: Ntt(t, e, i, r),
86904                      texdata: e
86905                    };
86906                  }(this._rotationTexture, this._rotationData, sht, o.z);
86907                  this._rotationTexture = t.texture;
86908                  this._rotationData = t.texdata;
86909                  if (this._rotationTexture) {
86910                    const t = e.getHandle("rotation_over_time_tex0");
86911                    const i = XP.getBindingFromHandle(t);
86912                    e.bindSampler(i, this._rotationTexture.getGFXSampler());
86913                    e.bindTexture(i, this._rotationTexture.getGFXTexture());
86914                    const s = e.getHandle("u_rotation_mode");
86915                    e.setUniform(s, this._rotationTexture.height);
86916                  }
86917                }
86918                const a = this._particleSystem._sizeOvertimeModule;
86919                i = a && a.enable;
86920                this._defines.SIZE_OVER_TIME_MODULE_ENABLE = i;
86921                if (i) {
86922                  let t;
86923                  t = a.separateAxes ? Ltt(this._sizeTexture, this._sizeData, sht, a.x, a.y, a.z, !0) : function(t, e, i, s, n) {
86924                    const r = Ott(s);
86925                    const o = i * r * 4;
86926                    null !== e && e.length === o || (e = new Float32Array(i * r * 4));
86927                    const a = 1 / (i - 1);
86928                    let l = 0;
86929                    let h = 0;
86930                    let c = 0;
86931                    for (let t = 0; t < r; t++) {
86932                      l = 0;
86933                      for (let r = 0; r < i; r++) {
86934                        const i = Ptt(s, a * r, t);
86935                        if (n) h = i; else {
86936                          l += i;
86937                          h = l / (r + 1);
86938                        }
86939                        e[c] = h;
86940                        e[c + 1] = h;
86941                        e[c + 2] = h;
86942                        c += 4;
86943                      }
86944                    }
86945                    return {
86946                      texture: Ntt(t, e, i, r),
86947                      texdata: e
86948                    };
86949                  }(this._sizeTexture, this._sizeData, sht, a.size, !0);
86950                  this._sizeTexture = t.texture;
86951                  this._sizeData = t.texdata;
86952                  if (this._sizeTexture) {
86953                    const t = e.getHandle("size_over_time_tex0");
86954                    const i = XP.getBindingFromHandle(t);
86955                    e.bindSampler(i, this._sizeTexture.getGFXSampler());
86956                    e.bindTexture(i, this._sizeTexture.getGFXTexture());
86957                    const s = e.getHandle("u_size_mode");
86958                    e.setUniform(s, this._sizeTexture.height);
86959                  }
86960                }
86961                const l = this._particleSystem._textureAnimationModule;
86962                i = l && l.enable;
86963                this._defines.TEXTURE_ANIMATION_MODULE_ENABLE = i;
86964                if (i) {
86965                  const t = function(t, e, i, s, n, r) {
86966                    const o = Math.max(Ott(s), Ott(n));
86967                    const a = i * o * 4;
86968                    null !== e && e.length === a || (e = new Float32Array(i * o * 4));
86969                    const l = [ s, n ];
86970                    const h = 1 / (i - 1);
86971                    for (let t = 0; t < o; t++) for (let s = 0; s < 2; s++) {
86972                      const n = l[s];
86973                      let o = 0;
86974                      let a = 0;
86975                      for (let l = 0; l < i; l++) {
86976                        const c = Ptt(n, h * l, t);
86977                        if (r) a = c; else {
86978                          o += c;
86979                          a = o / (l + 1);
86980                        }
86981                        e[4 * (t * i + l) + s] = a;
86982                      }
86983                    }
86984                    return {
86985                      texture: Ntt(t, e, i, o),
86986                      texdata: e
86987                    };
86988                  }(this._animTexture, this._animData, sht, l.startFrame, l.frameOverTime, !0);
86989                  this._animTexture = t.texture;
86990                  this._animData = t.texdata;
86991                  const i = e.getHandle("texture_animation_tex0");
86992                  const s = XP.getBindingFromHandle(i);
86993                  e.bindSampler(s, this._animTexture.getGFXSampler());
86994                  e.bindTexture(s, this._animTexture.getGFXTexture());
86995                  const n = e.getHandle("u_anim_info");
86996                  tht.x = this._animTexture.height;
86997                  tht.y = l.numTilesX * l.numTilesY;
86998                  tht.z = l.cycleCount;
86999                  e.setUniform(n, tht);
87000                }
87001                this._defines.USE_VK_SHADER = zo.gfxDevice.gfxAPI === fs.VULKAN;
87002                this._defines.CC_INSTANCE_PARTICLE = this._useInstance;
87003              }
87004              getParticleCount() {
87005                return this._particleNum;
87006              }
87007              onMaterialModified(t, e) {
87008                this._inited && this.updateMaterialParams();
87009              }
87010              onRebuildPSO(t, e) {
87011                this._model && 0 === t && this._model.setSubModelMaterial(0, e);
87012              }
87013              updateVertexAttrib() {
87014                if (this._renderInfo.renderMode === mit.Mesh && this._renderInfo.mesh) {
87015                  const t = this._renderInfo.mesh.readAttributeFormat(0, cr.ATTR_COLOR);
87016                  if (t) {
87017                    let e = bs.RGBA8;
87018                    for (let i = 0; i < ur.length; ++i) if (ur[i].name === t.name) {
87019                      e = i;
87020                      break;
87021                    }
87022                    this._vertAttrs[9] = new Vn(cr.ATTR_COLOR1, e, !0, this._useInstance ? 1 : 0);
87023                  } else {
87024                    const t = bs.RGBA8;
87025                    this._vertAttrs[9] = new Vn(cr.ATTR_COLOR1, t, !0, this._useInstance ? 1 : 0);
87026                  }
87027                }
87028              }
87029              _setVertexAttrib() {
87030                if (this._useInstance) this._setVertexAttribIns(); else switch (this._renderInfo.renderMode) {
87031                 case mit.StrecthedBillboard:
87032                  this._vertAttrs = dht.slice();
87033                  break;
87034
87035                 case mit.Mesh:
87036                  this._vertAttrs = pht.slice();
87037                  break;
87038
87039                 default:
87040                  this._vertAttrs = dht.slice();
87041                }
87042              }
87043              _setVertexAttribIns() {
87044                switch (this._renderInfo.renderMode) {
87045                 case mit.StrecthedBillboard:
87046                  this._vertAttrs = mht.slice();
87047                  break;
87048
87049                 case mit.Mesh:
87050                  this._vertAttrs = fht.slice();
87051                  break;
87052
87053                 default:
87054                  this._vertAttrs = mht.slice();
87055                }
87056              }
87057              updateMaterialParams() {
87058                if (!this._particleSystem) return;
87059                const t = this._particleSystem;
87060                const e = t.sharedMaterial;
87061                if (null !== e) {
87062                  e._effectAsset._name;
87063                  this._renderInfo.mainTexture = e.getProperty("mainTexture", 0);
87064                }
87065                if (null == t.sharedMaterial && null == this._defaultMat) {
87066                  ght.parent = xR.get("default-particle-gpu-material");
87067                  ght.owner = t;
87068                  ght.subModelIdx = 0;
87069                  this._defaultMat = new uS(ght);
87070                  ght.parent = null;
87071                  ght.owner = null;
87072                  ght.subModelIdx = 0;
87073                  null !== this._renderInfo.mainTexture && this._defaultMat.setProperty("mainTexture", this._renderInfo.mainTexture);
87074                }
87075                const i = t.getMaterialInstance(0) || this._defaultMat;
87076                t.node.getWorldMatrix($lt);
87077                t._simulationSpace === _it.World ? this._defines.CC_USE_WORLD_SPACE = !0 : this._defines.CC_USE_WORLD_SPACE = !1;
87078                const s = this._renderInfo.renderMode;
87079                if (s === mit.Billboard) this._defines.CC_RENDER_MODE = 0; else if (s === mit.StrecthedBillboard) {
87080                  this._defines.CC_RENDER_MODE = 1;
87081                  this._frameTile_velLenScale.z = this._renderInfo.velocityScale;
87082                  this._frameTile_velLenScale.w = this._renderInfo.lengthScale;
87083                } else s === mit.HorizontalBillboard ? this._defines.CC_RENDER_MODE = 2 : s === mit.VerticalBillboard ? this._defines.CC_RENDER_MODE = 3 : s === mit.Mesh ? this._defines.CC_RENDER_MODE = 4 : console.warn(`particle system renderMode ${s} not support.`);
87084                const n = t._textureAnimationModule;
87085                if (n && n.enable) {
87086                  Qi.set(this._frameTile_velLenScale, n.numTilesX, n.numTilesY);
87087                  is.copy(this._unifrom_velLenScale, this._frameTile_velLenScale);
87088                } else {
87089                  this._tmp_velLenScale.z = this._frameTile_velLenScale.z;
87090                  this._tmp_velLenScale.w = this._frameTile_velLenScale.w;
87091                  is.copy(this._unifrom_velLenScale, this._tmp_velLenScale);
87092                }
87093                this.initShaderUniform(i);
87094                i.recompileShaders(this._defines);
87095                this._model && this._model.updateMaterial(i);
87096              }
87097              setUseInstance(t) {
87098                if (this._useInstance !== t) {
87099                  this._useInstance = t;
87100                  if (this._model) {
87101                    this._model.useInstance = t;
87102                    this._model.doDestroy();
87103                  }
87104                  this.updateRenderMode();
87105                }
87106              }
87107              getNoisePreview(t, e, i) {}
87108            }
87109            var bht, Sht, Aht, Tht, vht, Eht, Cht, xht, wht, Rht, Iht, Mht, Bht, Dht, Pht, Oht, Nht, Lht, Fht, Vht, kht, Uht, Ght, zht, Hht, jht, Xht, Wht, Yht, qht, Kht, Jht, Zht, Qht, $ht, tct, ect, ict, sct, nct, rct, oct, act, lct;
87110            function hct() {
87111              const t = IR.root.device;
87112              if (t.capabilities.maxVertexTextureUnits >= 8 && t.getFormatFeatures(bs.RGBA32F) & (Is.RENDER_TARGET | Is.SAMPLED_TEXTURE)) return !0;
87113              m.warn("Maybe the device has restrictions on vertex textures or does not support float textures.");
87114              return !1;
87115            }
87116            let cct = (bht = Ul("cc.ParticleSystemRenderer"), Sht = Th(mit), Aht = ph(), Tht = lh(),
87117            vht = ph(), Eht = lh(), Cht = ph(), xht = lh(), wht = Th(mit), Rht = Th(Ez), Iht = ph(),
87118            Mht = lh(), Bht = Th(hm), Dht = ph(), Pht = rh(), Oht = lh(), Nht = Th(hm), Lht = ph(),
87119            Fht = rh(), Vht = Th(hm), kht = ph(), Uht = rh(), Ght = Th(hm), zht = ph(), Hht = rh(),
87120            jht = lh(), Xht = ph(), Wht = lh(), Yht = Th(pit), qht = ph(), Kht = lh(), bht(Jht = (Bl((Zht = (lct = act = class {
87121              constructor() {
87122                Ml(this, "_renderMode", Qht, this);
87123                Ml(this, "_velocityScale", $ht, this);
87124                Ml(this, "_lengthScale", tct, this);
87125                Ml(this, "_mesh", ect, this);
87126                Ml(this, "_cpuMaterial", ict, this);
87127                Ml(this, "_gpuMaterial", sct, this);
87128                Ml(this, "_mainTexture", nct, this);
87129                Ml(this, "_useGPU", rct, this);
87130                Ml(this, "_alignSpace", oct, this);
87131                this._particleSystem = null;
87132              }
87133              get renderMode() {
87134                return this._renderMode;
87135              }
87136              set renderMode(t) {
87137                if (this._renderMode !== t) {
87138                  this._renderMode = t;
87139                  this._particleSystem && this._particleSystem.processor.updateRenderMode();
87140                }
87141              }
87142              get velocityScale() {
87143                return this._velocityScale;
87144              }
87145              set velocityScale(t) {
87146                this._velocityScale = t;
87147                this._particleSystem && this._particleSystem.processor.updateMaterialParams();
87148              }
87149              get lengthScale() {
87150                return this._lengthScale;
87151              }
87152              set lengthScale(t) {
87153                this._lengthScale = t;
87154                this._particleSystem && this._particleSystem.processor.updateMaterialParams();
87155              }
87156              get mesh() {
87157                return this._mesh;
87158              }
87159              set mesh(t) {
87160                this._mesh = t;
87161                this._particleSystem && this._particleSystem.processor.setVertexAttributes();
87162              }
87163              get particleMaterial() {
87164                return this._particleSystem ? this._particleSystem.getMaterial(0) : null;
87165              }
87166              set particleMaterial(t) {
87167                this._particleSystem && this._particleSystem.setMaterial(t, 0);
87168              }
87169              get cpuMaterial() {
87170                return this._cpuMaterial;
87171              }
87172              set cpuMaterial(t) {
87173                if (null !== t) {
87174                  {
87175                    const e = t.effectName;
87176                    if (-1 === e.indexOf("particle") || -1 !== e.indexOf("particle-gpu")) {
87177                      N(6035);
87178                      return;
87179                    }
87180                  }
87181                  this._cpuMaterial = t;
87182                  this.particleMaterial = this._cpuMaterial;
87183                }
87184              }
87185              get gpuMaterial() {
87186                return this._gpuMaterial;
87187              }
87188              set gpuMaterial(t) {
87189                if (null !== t) {
87190                  if (-1 === t.effectName.indexOf("particle-gpu")) {
87191                    N(6035);
87192                    return;
87193                  }
87194                  this._gpuMaterial = t;
87195                  this.particleMaterial = this._gpuMaterial;
87196                }
87197              }
87198              get trailMaterial() {
87199                return this._particleSystem ? this._particleSystem.getMaterial(1) : null;
87200              }
87201              set trailMaterial(t) {
87202                this._particleSystem && this._particleSystem.setMaterial(t, 1);
87203              }
87204              get mainTexture() {
87205                return this._mainTexture;
87206              }
87207              set mainTexture(t) {
87208                this._mainTexture = t;
87209              }
87210              get useGPU() {
87211                return this._useGPU;
87212              }
87213              set useGPU(t) {
87214                if (this._useGPU !== t) {
87215                  hct() ? this._useGPU = t : this._useGPU = !1;
87216                  this._switchProcessor();
87217                }
87218              }
87219              get alignSpace() {
87220                return this._alignSpace;
87221              }
87222              set alignSpace(t) {
87223                this._alignSpace = t;
87224                this._particleSystem.processor.updateAlignSpace(this._alignSpace);
87225              }
87226              create(t) {
87227                null === this._particleSystem ? this._particleSystem = t : this._particleSystem !== t && F(6033);
87228              }
87229              onInit(t) {
87230                this.create(t);
87231                const e = this._useGPU && hct();
87232                if (this._particleSystem.processor) F(6034); else {
87233                  this._particleSystem.processor = e ? new yht(this) : new Qlt(this);
87234                  this._particleSystem.processor.updateAlignSpace(this.alignSpace);
87235                  this._particleSystem.processor.onInit(t);
87236                }
87237                if (e) this.gpuMaterial = this.particleMaterial; else {
87238                  if (this.particleMaterial && -1 !== this.particleMaterial.effectName.indexOf("particle-gpu")) {
87239                    this.particleMaterial = null;
87240                    N(6035);
87241                  }
87242                  this.cpuMaterial = this.particleMaterial;
87243                }
87244              }
87245              _switchProcessor() {
87246                if (!this._particleSystem) return;
87247                if (this._particleSystem.processor) {
87248                  this._particleSystem.processor.detachFromScene();
87249                  this._particleSystem.processor.clear();
87250                  this._particleSystem.processor = null;
87251                }
87252                const t = this._useGPU && hct();
87253                !t && this.cpuMaterial && (this.particleMaterial = this.cpuMaterial);
87254                t && this.gpuMaterial && (this.particleMaterial = this.gpuMaterial);
87255                this._particleSystem.processor = t ? new yht(this) : new Qlt(this);
87256                this._particleSystem.processor.updateAlignSpace(this.alignSpace);
87257                this._particleSystem.processor.onInit(this._particleSystem);
87258                this._particleSystem.processor.onEnable();
87259                this._particleSystem.bindModule();
87260              }
87261            }, act.AlignmentSpace = pit, lct)).prototype, "renderMode", [ Sht, Aht, Tht ], Object.getOwnPropertyDescriptor(Zht.prototype, "renderMode"), Zht.prototype),
87262            Bl(Zht.prototype, "velocityScale", [ vht, Eht ], Object.getOwnPropertyDescriptor(Zht.prototype, "velocityScale"), Zht.prototype),
87263            Bl(Zht.prototype, "lengthScale", [ Cht, xht ], Object.getOwnPropertyDescriptor(Zht.prototype, "lengthScale"), Zht.prototype),
87264            Qht = Bl(Zht.prototype, "_renderMode", [ wht, Yl ], {
87265              configurable: !0,
87266              enumerable: !0,
87267              writable: !0,
87268              initializer: function() {
87269                return mit.Billboard;
87270              }
87271            }), $ht = Bl(Zht.prototype, "_velocityScale", [ Yl ], {
87272              configurable: !0,
87273              enumerable: !0,
87274              writable: !0,
87275              initializer: function() {
87276                return 1;
87277              }
87278            }), tct = Bl(Zht.prototype, "_lengthScale", [ Yl ], {
87279              configurable: !0,
87280              enumerable: !0,
87281              writable: !0,
87282              initializer: function() {
87283                return 1;
87284              }
87285            }), ect = Bl(Zht.prototype, "_mesh", [ Yl ], {
87286              configurable: !0,
87287              enumerable: !0,
87288              writable: !0,
87289              initializer: function() {
87290                return null;
87291              }
87292            }), Bl(Zht.prototype, "mesh", [ Rht, Iht, Mht ], Object.getOwnPropertyDescriptor(Zht.prototype, "mesh"), Zht.prototype),
87293            Bl(Zht.prototype, "particleMaterial", [ Bht, Dht, gh, Pht, Oht ], Object.getOwnPropertyDescriptor(Zht.prototype, "particleMaterial"), Zht.prototype),
87294            Bl(Zht.prototype, "cpuMaterial", [ Nht, Lht, gh, Fht ], Object.getOwnPropertyDescriptor(Zht.prototype, "cpuMaterial"), Zht.prototype),
87295            ict = Bl(Zht.prototype, "_cpuMaterial", [ Yl ], {
87296              configurable: !0,
87297              enumerable: !0,
87298              writable: !0,
87299              initializer: function() {
87300                return null;
87301              }
87302            }), Bl(Zht.prototype, "gpuMaterial", [ Vht, kht, gh, Uht ], Object.getOwnPropertyDescriptor(Zht.prototype, "gpuMaterial"), Zht.prototype),
87303            sct = Bl(Zht.prototype, "_gpuMaterial", [ Yl ], {
87304              configurable: !0,
87305              enumerable: !0,
87306              writable: !0,
87307              initializer: function() {
87308                return null;
87309              }
87310            }), Bl(Zht.prototype, "trailMaterial", [ Ght, zht, gh, Hht, jht ], Object.getOwnPropertyDescriptor(Zht.prototype, "trailMaterial"), Zht.prototype),
87311            nct = Bl(Zht.prototype, "_mainTexture", [ Yl ], {
87312              configurable: !0,
87313              enumerable: !0,
87314              writable: !0,
87315              initializer: function() {
87316                return null;
87317              }
87318            }), rct = Bl(Zht.prototype, "_useGPU", [ Yl ], {
87319              configurable: !0,
87320              enumerable: !0,
87321              writable: !0,
87322              initializer: function() {
87323                return !1;
87324              }
87325            }), Bl(Zht.prototype, "useGPU", [ Xht, Wht ], Object.getOwnPropertyDescriptor(Zht.prototype, "useGPU"), Zht.prototype),
87326            Bl(Zht.prototype, "alignSpace", [ Yht, qht, Kht ], Object.getOwnPropertyDescriptor(Zht.prototype, "alignSpace"), Zht.prototype),
87327            oct = Bl(Zht.prototype, "_alignSpace", [ Yl ], {
87328              configurable: !0,
87329              enumerable: !0,
87330              writable: !0,
87331              initializer: function() {
87332                return pit.View;
87333              }
87334            }), Zht)) || Jht);
87335            var uct, _ct, dct, pct, mct, fct, gct, yct, bct, Sct, Act, Tct, vct, Ect, Cct, xct, wct, Rct, Ict, Mct, Bct, Dct, Pct, Oct, Nct, Lct, Fct, Vct, kct, Uct, Gct, zct, Hct, jct, Xct, Wct, Yct, qct, Kct, Jct, Zct, Qct, $ct, tut, eut, iut, sut, nut;
87336            const rut = Math.cos(mi(100));
87337            const out = {
87338              position: new Pi,
87339              velocity: new Pi
87340            };
87341            const aut = new Ui;
87342            const lut = new qi;
87343            const hut = new Pi;
87344            const cut = new Pi;
87345            const uut = new Bi;
87346            class _ut {
87347              constructor(t) {
87348                this.start = void 0;
87349                this.end = void 0;
87350                this.trailElements = void 0;
87351                this.start = -1;
87352                this.end = -1;
87353                this.trailElements = [];
87354                for (;t--; ) this.trailElements.push({
87355                  position: new Pi,
87356                  lifetime: 0,
87357                  width: 0,
87358                  velocity: new Pi,
87359                  direction: 0,
87360                  color: new Bi
87361                });
87362              }
87363              getElement(t) {
87364                if (-1 === this.start) return null;
87365                t < 0 && (t = (t + this.trailElements.length) % this.trailElements.length);
87366                t >= this.trailElements.length && (t %= this.trailElements.length);
87367                return this.trailElements[t];
87368              }
87369              addElement() {
87370                if (0 === this.trailElements.length) return null;
87371                if (-1 === this.start) {
87372                  this.start = 0;
87373                  this.end = 1;
87374                  return this.trailElements[0];
87375                }
87376                if (this.start === this.end) {
87377                  this.trailElements.splice(this.end, 0, {
87378                    position: new Pi,
87379                    lifetime: 0,
87380                    width: 0,
87381                    velocity: new Pi,
87382                    direction: 0,
87383                    color: new Bi
87384                  });
87385                  this.start++;
87386                  this.start %= this.trailElements.length;
87387                }
87388                const t = this.end++;
87389                this.end %= this.trailElements.length;
87390                return this.trailElements[t];
87391              }
87392              iterateElement(t, e, i, s) {
87393                const n = this.start >= this.end ? this.end + this.trailElements.length : this.end;
87394                for (let r = this.start; r < n; r++) if (e(t, this.trailElements[r % this.trailElements.length], i, s)) {
87395                  this.start++;
87396                  this.start %= this.trailElements.length;
87397                }
87398                if (this.start === n) {
87399                  this.start = -1;
87400                  this.end = -1;
87401                }
87402              }
87403              count() {
87404                return this.start < this.end ? this.end - this.start : this.trailElements.length + this.end - this.start;
87405              }
87406              clear() {
87407                this.start = -1;
87408                this.end = -1;
87409              }
87410            }
87411            let dut = (uct = Ul("cc.TrailModule"), _ct = ph(), dct = Th(bit), pct = ph(), mct = lh(),
87412            fct = Th(Dtt), gct = hh(), yct = ph(), bct = lh(), Sct = ph(), Act = lh(), Tct = Th(_it),
87413            vct = ph(), Ect = lh(), Cct = Th(Sit), xct = ph(), wct = lh(), Rct = ph(), Ict = lh(),
87414            Mct = Th(Dtt), Bct = hh(), Dct = ph(), Pct = lh(), Oct = ph(), Nct = lh(), Lct = Th(ret),
87415            Fct = ph(), Vct = lh(), kct = Th(ret), Uct = ph(), Gct = lh(), zct = Th(_it), uct(Hct = (jct = (nut = class {
87416              get enable() {
87417                return this._enable;
87418              }
87419              set enable(t) {
87420                if (t !== this._enable || !this._trailModel) {
87421                  if (t && !this._enable) {
87422                    this._enable = t;
87423                    this._particleSystem.processor && this._particleSystem.processor.updateTrailMaterial();
87424                  }
87425                  if (t && !this._trailModel) {
87426                    this._createModel();
87427                    this.rebuild();
87428                  }
87429                  this._enable = t;
87430                  this._trailModel && (this._trailModel.enabled = t);
87431                  t ? this.onEnable() : this.onDisable();
87432                }
87433              }
87434              get minParticleDistance() {
87435                return this._minParticleDistance;
87436              }
87437              set minParticleDistance(t) {
87438                this._minParticleDistance = t;
87439                this._minSquaredDistance = t * t;
87440              }
87441              get space() {
87442                return this._space;
87443              }
87444              set space(t) {
87445                this._space = t;
87446                const e = this._particleSystem;
87447                e && e.processor && e.processor.updateTrailMaterial();
87448              }
87449              getModel() {
87450                return this._trailModel;
87451              }
87452              constructor() {
87453                Ml(this, "_enable", Xct, this);
87454                Ml(this, "mode", Wct, this);
87455                Ml(this, "lifeTime", Yct, this);
87456                Ml(this, "_minParticleDistance", qct, this);
87457                Ml(this, "existWithParticles", Kct, this);
87458                Ml(this, "textureMode", Jct, this);
87459                Ml(this, "widthFromParticle", Zct, this);
87460                Ml(this, "widthRatio", Qct, this);
87461                Ml(this, "colorFromParticle", $ct, this);
87462                Ml(this, "colorOverTrail", tut, this);
87463                Ml(this, "colorOvertime", eut, this);
87464                Ml(this, "_space", iut, this);
87465                Ml(this, "_particleSystem", sut, this);
87466                this._minSquaredDistance = 0;
87467                this._vertSize = void 0;
87468                this._trailNum = 0;
87469                this._trailLifetime = 0;
87470                this.vbOffset = 0;
87471                this.ibOffset = 0;
87472                this._trailSegments = null;
87473                this._particleTrail = void 0;
87474                this._trailModel = null;
87475                this._iaInfo = void 0;
87476                this._iaInfoBuffer = null;
87477                this._subMeshData = null;
87478                this._vertAttrs = void 0;
87479                this._vbF32 = null;
87480                this._vbUint32 = null;
87481                this._iBuffer = null;
87482                this._needTransform = !1;
87483                this._material = null;
87484                this._iaInfo = new Cn([ new vn ]);
87485                this._vertAttrs = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RGBA32F), new Vn(cr.ATTR_TEX_COORD1, bs.RGB32F), new Vn(cr.ATTR_COLOR, bs.RGBA8, !0) ];
87486                this._vertSize = 0;
87487                for (const t of this._vertAttrs) this._vertSize += ur[t.format].size;
87488                this._particleTrail = new Map;
87489              }
87490              onInit(t) {
87491                this._particleSystem = t;
87492                this.minParticleDistance = this._minParticleDistance;
87493                let e = 0;
87494                const i = t.startLifetime.getMax();
87495                const s = t.rateOverTime.getMax();
87496                const n = t.duration;
87497                for (let s = 0, r = t.bursts.length; s < r; s++) {
87498                  e += t.bursts[s].getMaxCount(t) * Math.ceil(i / n);
87499                }
87500                this.lifeTime.getMax() < 1 && N(6036);
87501                this._trailNum = Math.ceil(i * Math.ceil(this.lifeTime.getMax()) * 60 * (s * n + e));
87502                this._trailSegments = new $r((() => new _ut(10)), Math.ceil(s * n), (t => t.trailElements.length = 0));
87503                this._enable && (this.enable = this._enable);
87504              }
87505              onEnable() {
87506                this._attachToScene();
87507              }
87508              onDisable() {
87509                this._particleTrail.clear();
87510                this._detachFromScene();
87511              }
87512              _attachToScene() {
87513                if (this._trailModel) {
87514                  this._trailModel.scene && this._detachFromScene();
87515                  this._particleSystem._getRenderScene().addModel(this._trailModel);
87516                }
87517              }
87518              _detachFromScene() {
87519                this._trailModel && this._trailModel.scene && this._trailModel.scene.removeModel(this._trailModel);
87520              }
87521              destroy() {
87522                this.destroySubMeshData();
87523                if (this._trailModel) {
87524                  IR.root.destroyModel(this._trailModel);
87525                  this._trailModel = null;
87526                }
87527                if (this._trailSegments) {
87528                  this._trailSegments.destroy();
87529                  this._trailSegments = null;
87530                }
87531              }
87532              play() {
87533                this._trailModel && this._enable && (this._trailModel.enabled = !0);
87534              }
87535              clear() {
87536                if (this.enable) {
87537                  const t = this._particleTrail.values();
87538                  let e = t.next();
87539                  for (;!e.done; ) {
87540                    e.value.clear();
87541                    e = t.next();
87542                  }
87543                  this._particleTrail.clear();
87544                  this.updateRenderData();
87545                  this._trailModel && (this._trailModel.enabled = !1);
87546                }
87547              }
87548              updateMaterial() {
87549                if (this._particleSystem) {
87550                  this._material = this._particleSystem.getMaterialInstance(1) || this._particleSystem.processor._defaultTrailMat;
87551                  this._trailModel && this._trailModel.setSubModelMaterial(0, this._material);
87552                }
87553              }
87554              update() {
87555                this._trailLifetime = this.lifeTime.evaluate(this._particleSystem._time, 1);
87556                if (this.space === _it.World && this._particleSystem._simulationSpace === _it.Local) {
87557                  this._needTransform = !0;
87558                  this._particleSystem.node.getWorldMatrix(lut);
87559                  this._particleSystem.node.getWorldRotation(aut);
87560                } else this._needTransform = !1;
87561              }
87562              animate(t, e) {
87563                if (!this._trailSegments) return;
87564                if (t.loopCount > t.lastLoop) {
87565                  if (t.trailDelay > 1) {
87566                    t.lastLoop = t.loopCount;
87567                    t.trailDelay = 0;
87568                  } else t.trailDelay++;
87569                  return;
87570                }
87571                let i = this._particleTrail.get(t);
87572                if (!i) {
87573                  i = this._trailSegments.alloc();
87574                  this._particleTrail.set(t, i);
87575                  return;
87576                }
87577                let s = i.getElement(i.end - 1);
87578                this._needTransform ? Pi.transformMat4(hut, t.position, lut) : Pi.copy(hut, t.position);
87579                if (s) {
87580                  i.iterateElement(this, this._updateTrailElement, t, e);
87581                  if (Pi.squaredDistance(s.position, hut) < this._minSquaredDistance) return;
87582                }
87583                s = i.addElement();
87584                if (!s) return;
87585                Pi.copy(s.position, hut);
87586                s.lifetime = 0;
87587                this.widthFromParticle ? s.width = t.size.x * this.widthRatio.evaluate(0, 1) : s.width = this.widthRatio.evaluate(0, 1);
87588                const n = i.count();
87589                if (2 === n) {
87590                  const t = i.getElement(i.end - 2);
87591                  Pi.subtract(t.velocity, s.position, t.position);
87592                } else if (n > 2) {
87593                  const t = i.getElement(i.end - 2);
87594                  const e = i.getElement(i.end - 3);
87595                  Pi.subtract(hut, e.position, t.position);
87596                  Pi.subtract(cut, s.position, t.position);
87597                  Pi.subtract(t.velocity, cut, hut);
87598                  Pi.equals(Pi.ZERO, t.velocity) && Pi.copy(t.velocity, hut);
87599                  Pi.normalize(t.velocity, t.velocity);
87600                  this._checkDirectionReverse(t, e);
87601                }
87602                this.colorFromParticle ? s.color.set(t.color) : s.color.set(this.colorOvertime.evaluate(0, 1));
87603              }
87604              removeParticle(t) {
87605                const e = this._particleTrail.get(t);
87606                if (e && this._trailSegments) {
87607                  e.clear();
87608                  this._trailSegments.free(e);
87609                  this._particleTrail.delete(t);
87610                }
87611              }
87612              updateRenderData() {
87613                this.vbOffset = 0;
87614                this.ibOffset = 0;
87615                for (const t of this._particleTrail.keys()) {
87616                  const e = this._particleTrail.get(t);
87617                  if (-1 === e.start) continue;
87618                  const i = 4 * this.vbOffset / this._vertSize;
87619                  const s = e.start >= e.end ? e.end + e.trailElements.length : e.end;
87620                  const n = s - e.start;
87621                  const r = 1 / n;
87622                  const o = e.trailElements[e.start];
87623                  this._fillVertexBuffer(o, this.colorOverTrail.evaluate(1, 1), i, 1, 0, 4);
87624                  for (let t = e.start + 1; t < s; t++) {
87625                    const s = e.trailElements[t % e.trailElements.length];
87626                    const o = t - e.start;
87627                    this._fillVertexBuffer(s, this.colorOverTrail.evaluate(1 - o / n, 1), i, 1 - o * r, o, 5);
87628                  }
87629                  this._needTransform ? Pi.transformMat4(out.position, t.position, lut) : Pi.copy(out.position, t.position);
87630                  const a = this._trailModel;
87631                  a && a.node.invalidateChildren(ay.POSITION);
87632                  if (1 === n || 2 === n) {
87633                    const t = e.getElement(e.end - 1);
87634                    Pi.subtract(t.velocity, out.position, t.position);
87635                    this._vbF32[this.vbOffset - this._vertSize / 4 - 4] = t.velocity.x;
87636                    this._vbF32[this.vbOffset - this._vertSize / 4 - 3] = t.velocity.y;
87637                    this._vbF32[this.vbOffset - this._vertSize / 4 - 2] = t.velocity.z;
87638                    this._vbF32[this.vbOffset - 4] = t.velocity.x;
87639                    this._vbF32[this.vbOffset - 3] = t.velocity.y;
87640                    this._vbF32[this.vbOffset - 2] = t.velocity.z;
87641                    Pi.subtract(out.velocity, out.position, t.position);
87642                    this._checkDirectionReverse(out, t);
87643                  } else if (n > 2) {
87644                    const t = e.getElement(e.end - 1);
87645                    const s = e.getElement(e.end - 2);
87646                    Pi.subtract(hut, s.position, t.position);
87647                    Pi.subtract(cut, out.position, t.position);
87648                    Pi.normalize(hut, hut);
87649                    Pi.normalize(cut, cut);
87650                    Pi.subtract(t.velocity, cut, hut);
87651                    Pi.normalize(t.velocity, t.velocity);
87652                    this._checkDirectionReverse(t, s);
87653                    this.vbOffset -= this._vertSize / 4 * 2;
87654                    this.ibOffset -= 6;
87655                    this._fillVertexBuffer(t, this.colorOverTrail.evaluate(r, 1), i, r, n - 1, 5);
87656                    Pi.subtract(out.velocity, out.position, t.position);
87657                    Pi.normalize(out.velocity, out.velocity);
87658                    this._checkDirectionReverse(out, t);
87659                  }
87660                  this.widthFromParticle ? out.width = t.size.x * this.widthRatio.evaluate(0, 1) : out.width = this.widthRatio.evaluate(0, 1);
87661                  out.color = t.color;
87662                  Pi.equals(out.velocity, Pi.ZERO) ? this.ibOffset -= 3 : this._fillVertexBuffer(out, this.colorOverTrail.evaluate(0, 1), i, 0, n, 1);
87663                }
87664                this._trailModel && (this._trailModel.enabled = this.ibOffset > 0);
87665              }
87666              updateIA(t) {
87667                const e = this._trailModel && this._trailModel.subModels;
87668                if (e && e.length > 0) {
87669                  const i = e[0];
87670                  i.inputAssembler.vertexBuffers[0].update(this._vbF32);
87671                  i.inputAssembler.indexBuffer.update(this._iBuffer);
87672                  this._iaInfo.drawInfos[0].firstIndex = 0;
87673                  this._iaInfo.drawInfos[0].indexCount = t;
87674                  this._iaInfoBuffer.update(this._iaInfo);
87675                }
87676              }
87677              beforeRender() {
87678                this.updateIA(this.ibOffset);
87679              }
87680              _createModel() {
87681                this._trailModel || (this._trailModel = m.director.root.createModel(wA));
87682              }
87683              rebuild() {
87684                const t = IR.root.device;
87685                const e = t.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.HOST | Cs.DEVICE, this._vertSize * (this._trailNum + 1) * 2, this._vertSize));
87686                const i = new ArrayBuffer(this._vertSize * (this._trailNum + 1) * 2);
87687                this._vbF32 = new Float32Array(i);
87688                this._vbUint32 = new Uint32Array(i);
87689                e.update(i);
87690                const s = t.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.HOST | Cs.DEVICE, 6 * Math.max(1, this._trailNum) * Uint16Array.BYTES_PER_ELEMENT, Uint16Array.BYTES_PER_ELEMENT));
87691                this._iBuffer = new Uint16Array(6 * Math.max(1, this._trailNum));
87692                s.update(this._iBuffer);
87693                this._iaInfoBuffer = t.createBuffer(new An(Ts.INDIRECT, Cs.HOST | Cs.DEVICE, mr, mr));
87694                this._iaInfo.drawInfos[0].vertexCount = 2 * (this._trailNum + 1);
87695                this._iaInfo.drawInfos[0].indexCount = 6 * this._trailNum;
87696                this._iaInfoBuffer.update(this._iaInfo);
87697                this._subMeshData = new fC([ e ], this._vertAttrs, Xs.TRIANGLE_LIST, s, this._iaInfoBuffer);
87698                const n = this._trailModel;
87699                if (n && this._material) {
87700                  n.node = n.transform = this._particleSystem.node;
87701                  n.visFlags = this._particleSystem.visibility;
87702                  n.initSubModel(0, this._subMeshData, this._material);
87703                  n.enabled = !0;
87704                }
87705              }
87706              _updateTrailElement(t, e, i, s) {
87707                e.lifetime += s;
87708                if (t.colorFromParticle) {
87709                  e.color.set(i.color);
87710                  e.color.multiply(t.colorOvertime.evaluate(1 - i.remainingLifetime / i.startLifetime, 1));
87711                } else e.color.set(t.colorOvertime.evaluate(1 - i.remainingLifetime / i.startLifetime, 1));
87712                t.widthFromParticle ? e.width = i.size.x * t.widthRatio.evaluate(e.lifetime / t._trailLifetime, 1) : e.width = t.widthRatio.evaluate(e.lifetime / t._trailLifetime, 1);
87713                return e.lifetime > t._trailLifetime;
87714              }
87715              _fillVertexBuffer(t, e, i, s, n, r) {
87716                this._vbF32[this.vbOffset++] = t.position.x;
87717                this._vbF32[this.vbOffset++] = t.position.y;
87718                this._vbF32[this.vbOffset++] = t.position.z;
87719                this._vbF32[this.vbOffset++] = t.direction;
87720                this._vbF32[this.vbOffset++] = t.width;
87721                this._vbF32[this.vbOffset++] = s;
87722                this._vbF32[this.vbOffset++] = 0;
87723                this._vbF32[this.vbOffset++] = t.velocity.x;
87724                this._vbF32[this.vbOffset++] = t.velocity.y;
87725                this._vbF32[this.vbOffset++] = t.velocity.z;
87726                uut.set(t.color);
87727                uut.multiply(e);
87728                this._vbUint32[this.vbOffset++] = uut._val;
87729                this._vbF32[this.vbOffset++] = t.position.x;
87730                this._vbF32[this.vbOffset++] = t.position.y;
87731                this._vbF32[this.vbOffset++] = t.position.z;
87732                this._vbF32[this.vbOffset++] = 1 - t.direction;
87733                this._vbF32[this.vbOffset++] = t.width;
87734                this._vbF32[this.vbOffset++] = s;
87735                this._vbF32[this.vbOffset++] = 1;
87736                this._vbF32[this.vbOffset++] = t.velocity.x;
87737                this._vbF32[this.vbOffset++] = t.velocity.y;
87738                this._vbF32[this.vbOffset++] = t.velocity.z;
87739                this._vbUint32[this.vbOffset++] = uut._val;
87740                if (1 & r) {
87741                  this._iBuffer[this.ibOffset++] = i + 2 * n;
87742                  this._iBuffer[this.ibOffset++] = i + 2 * n - 1;
87743                  this._iBuffer[this.ibOffset++] = i + 2 * n + 1;
87744                }
87745                if (4 & r) {
87746                  this._iBuffer[this.ibOffset++] = i + 2 * n;
87747                  this._iBuffer[this.ibOffset++] = i + 2 * n + 1;
87748                  this._iBuffer[this.ibOffset++] = i + 2 * n + 2;
87749                }
87750              }
87751              _checkDirectionReverse(t, e) {
87752                Pi.dot(t.velocity, e.velocity) < rut ? t.direction = 1 - e.direction : t.direction = e.direction;
87753              }
87754              destroySubMeshData() {
87755                if (this._subMeshData) {
87756                  this._subMeshData.destroy();
87757                  this._subMeshData = null;
87758                }
87759              }
87760            }, nut), Bl(jct.prototype, "enable", [ _ct ], Object.getOwnPropertyDescriptor(jct.prototype, "enable"), jct.prototype),
87761            Xct = Bl(jct.prototype, "_enable", [ Yl ], {
87762              configurable: !0,
87763              enumerable: !0,
87764              writable: !0,
87765              initializer: function() {
87766                return !1;
87767              }
87768            }), Wct = Bl(jct.prototype, "mode", [ dct, Yl, pct, mct ], {
87769              configurable: !0,
87770              enumerable: !0,
87771              writable: !0,
87772              initializer: function() {
87773                return bit.Particles;
87774              }
87775            }), Yct = Bl(jct.prototype, "lifeTime", [ fct, Yl, gct, yct, bct ], {
87776              configurable: !0,
87777              enumerable: !0,
87778              writable: !0,
87779              initializer: function() {
87780                return new Dtt;
87781              }
87782            }), qct = Bl(jct.prototype, "_minParticleDistance", [ Yl ], {
87783              configurable: !0,
87784              enumerable: !0,
87785              writable: !0,
87786              initializer: function() {
87787                return .1;
87788              }
87789            }), Bl(jct.prototype, "minParticleDistance", [ Sct, Act ], Object.getOwnPropertyDescriptor(jct.prototype, "minParticleDistance"), jct.prototype),
87790            Bl(jct.prototype, "space", [ Tct, vct, Ect ], Object.getOwnPropertyDescriptor(jct.prototype, "space"), jct.prototype),
87791            Kct = Bl(jct.prototype, "existWithParticles", [ Yl ], {
87792              configurable: !0,
87793              enumerable: !0,
87794              writable: !0,
87795              initializer: function() {
87796                return !0;
87797              }
87798            }), Jct = Bl(jct.prototype, "textureMode", [ Cct, Yl, xct, wct ], {
87799              configurable: !0,
87800              enumerable: !0,
87801              writable: !0,
87802              initializer: function() {
87803                return Sit.Stretch;
87804              }
87805            }), Zct = Bl(jct.prototype, "widthFromParticle", [ Yl, Rct, Ict ], {
87806              configurable: !0,
87807              enumerable: !0,
87808              writable: !0,
87809              initializer: function() {
87810                return !0;
87811              }
87812            }), Qct = Bl(jct.prototype, "widthRatio", [ Mct, Yl, Bct, Dct, Pct ], {
87813              configurable: !0,
87814              enumerable: !0,
87815              writable: !0,
87816              initializer: function() {
87817                return new Dtt;
87818              }
87819            }), $ct = Bl(jct.prototype, "colorFromParticle", [ Yl, Oct, Nct ], {
87820              configurable: !0,
87821              enumerable: !0,
87822              writable: !0,
87823              initializer: function() {
87824                return !1;
87825              }
87826            }), tut = Bl(jct.prototype, "colorOverTrail", [ Lct, Yl, Fct, Vct ], {
87827              configurable: !0,
87828              enumerable: !0,
87829              writable: !0,
87830              initializer: function() {
87831                return new ret;
87832              }
87833            }), eut = Bl(jct.prototype, "colorOvertime", [ kct, Yl, Uct, Gct ], {
87834              configurable: !0,
87835              enumerable: !0,
87836              writable: !0,
87837              initializer: function() {
87838                return new ret;
87839              }
87840            }), iut = Bl(jct.prototype, "_space", [ zct ], {
87841              configurable: !0,
87842              enumerable: !0,
87843              writable: !0,
87844              initializer: function() {
87845                return _it.World;
87846              }
87847            }), sut = Bl(jct.prototype, "_particleSystem", [ Yl ], {
87848              configurable: !0,
87849              enumerable: !0,
87850              writable: !0,
87851              initializer: function() {
87852                return null;
87853              }
87854            }), jct)) || Hct);
87855            const put = new qi;
87856            const mut = new qi;
87857            const fut = new Ui;
87858            const gut = new Pi;
87859            const yut = [ "_colorOverLifetimeModule", "_sizeOvertimeModule", "_velocityOvertimeModule", "_forceOvertimeModule", "_limitVelocityOvertimeModule", "_rotationOvertimeModule", "_textureAnimationModule" ];
87860            class but {
87861              constructor(t) {
87862                this._particleSystem = void 0;
87863                this._processor = void 0;
87864                this._node = void 0;
87865                this._particlesAll = void 0;
87866                this._updateList = new Map;
87867                this._animateList = new Map;
87868                this._runAnimateList = new Array;
87869                this._localMat = new qi;
87870                this._gravity = new is;
87871                this.minPos = new Pi;
87872                this.maxPos = new Pi;
87873                this._nodePos = new Pi;
87874                this._nodeSize = new Pi;
87875                this._particleSystem = t;
87876                this._processor = this._particleSystem.processor;
87877                this._node = t.node;
87878                this._particlesAll = [];
87879                this._initModuleList();
87880              }
87881              _updateBoundingNode() {
87882                this._nodeSize.set(this.maxPos.x - this.minPos.x, this.maxPos.y - this.minPos.y, this.maxPos.z - this.minPos.z);
87883                this._nodePos.set(this.minPos.x + .5 * this._nodeSize.x, this.minPos.y + .5 * this._nodeSize.y, this.minPos.z + .5 * this._nodeSize.z);
87884              }
87885              setBoundingBoxSize(t) {
87886                this.maxPos.x = this._nodePos.x + t.x;
87887                this.maxPos.y = this._nodePos.y + t.y;
87888                this.maxPos.z = this._nodePos.z + t.z;
87889                this.minPos.x = this._nodePos.x - t.x;
87890                this.minPos.y = this._nodePos.y - t.y;
87891                this.minPos.z = this._nodePos.z - t.z;
87892                this._updateBoundingNode();
87893              }
87894              setBoundingBoxCenter(t, e, i) {
87895                this.maxPos.x = t + .5 * this._nodeSize.x;
87896                this.maxPos.y = e + .5 * this._nodeSize.y;
87897                this.maxPos.z = i + .5 * this._nodeSize.z;
87898                this.minPos.x = t - .5 * this._nodeSize.x;
87899                this.minPos.y = e - .5 * this._nodeSize.y;
87900                this.minPos.z = i - .5 * this._nodeSize.z;
87901                this._updateBoundingNode();
87902              }
87903              _initModuleList() {
87904                yut.forEach((t => {
87905                  const e = this._particleSystem[t];
87906                  if (e && e.enable) {
87907                    e.needUpdate && (this._updateList[e.name] = e);
87908                    e.needAnimate && (this._animateList[e.name] = e);
87909                  }
87910                }));
87911                this._runAnimateList.length = 0;
87912                for (let t = 0, e = hit.length; t < e; t++) {
87913                  const e = this._animateList[hit[t]];
87914                  e && this._runAnimateList.push(e);
87915                }
87916              }
87917              _emit(t, e, i) {
87918                const n = this._particleSystem;
87919                const r = this._node;
87920                const o = n.time % n.duration / n.duration;
87921                r.invalidateChildren(ay.POSITION);
87922                if (n.simulationSpace === _it.World) {
87923                  r.getWorldMatrix(put);
87924                  r.getWorldRotation(fut);
87925                }
87926                for (let r = 0; r < t; ++r) {
87927                  const t = new tit(n);
87928                  t.particleSystem = n;
87929                  t.reset();
87930                  const r = Si(bi(0, s));
87931                  if (n._shapeModule && n._shapeModule.enable) n._shapeModule.emit(t); else {
87932                    Pi.set(t.position, 0, 0, 0);
87933                    Pi.copy(t.velocity, kit);
87934                  }
87935                  n._textureAnimationModule && n._textureAnimationModule.enable && n._textureAnimationModule.init(t);
87936                  const a = n.startSpeed.evaluate(o, r);
87937                  Pi.multiplyScalar(t.velocity, t.velocity, a);
87938                  if (n.simulationSpace === _it.World) {
87939                    Pi.transformMat4(t.position, t.position, put);
87940                    Pi.transformQuat(t.velocity, t.velocity, fut);
87941                  }
87942                  Pi.copy(t.ultimateVelocity, t.velocity);
87943                  Pi.set(t.rotation, 0, 0, 0);
87944                  if (n.startSize3D) Pi.set(t.startSize, n.startSizeX.evaluate(o, r), n.startSizeY.evaluate(o, r), n.startSizeZ.evaluate(o, r)); else {
87945                    Pi.set(t.startSize, n.startSizeX.evaluate(o, r), 1, 1);
87946                    t.startSize.y = t.startSize.x;
87947                  }
87948                  Pi.copy(t.size, t.startSize);
87949                  t.startLifetime = n.startLifetime.evaluate(o, r) + e;
87950                  t.remainingLifetime = t.startLifetime;
87951                  i.push(t);
87952                }
87953              }
87954              _updateParticles(t, e) {
87955                const i = this._particleSystem;
87956                i.node.getWorldMatrix(put);
87957                switch (i.scaleSpace) {
87958                 case _it.Local:
87959                  i.node.getScale(gut);
87960                  break;
87961
87962                 case _it.World:
87963                  i.node.getWorldScale(gut);
87964                }
87965                this._updateList.forEach(((t, e) => {
87966                  t.update(i.simulationSpace, put);
87967                }));
87968                if (i.simulationSpace === _it.Local) {
87969                  const t = i.node.getRotation();
87970                  qi.fromQuat(this._localMat, t);
87971                  this._localMat.transpose();
87972                }
87973                if (i.node.parent) {
87974                  i.node.parent.getWorldMatrix(mut);
87975                  mut.invert();
87976                }
87977                for (let s = 0; s < e.length; ++s) {
87978                  const n = e[s];
87979                  n.remainingLifetime -= t;
87980                  Pi.set(n.animatedVelocity, 0, 0, 0);
87981                  if (i.simulationSpace === _it.Local) {
87982                    const e = 9.8 * -i.gravityModifier.evaluate(1 - n.remainingLifetime / n.startLifetime, Si(n.randomSeed)) * t;
87983                    this._gravity.x = 0;
87984                    this._gravity.y = e;
87985                    this._gravity.z = 0;
87986                    this._gravity.w = 1;
87987                    if (!ui(e, 0, hi)) {
87988                      i.node.parent && (this._gravity = this._gravity.transformMat4(mut));
87989                      this._gravity = this._gravity.transformMat4(this._localMat);
87990                      n.velocity.x += this._gravity.x;
87991                      n.velocity.y += this._gravity.y;
87992                      n.velocity.z += this._gravity.z;
87993                    }
87994                  } else n.velocity.y -= 9.8 * i.gravityModifier.evaluate(1 - n.remainingLifetime / n.startLifetime, Si(n.randomSeed)) * t;
87995                  Pi.copy(n.ultimateVelocity, n.velocity);
87996                  this._runAnimateList.forEach((e => {
87997                    e.animate(n, t);
87998                  }));
87999                  Pi.scaleAndAdd(n.position, n.position, n.ultimateVelocity, t);
88000                }
88001              }
88002              _calculateBounding(t) {
88003                const e = new Pi;
88004                const i = new Pi;
88005                const s = new Pi;
88006                const n = new Pi;
88007                const r = new Pi(1, 1, 1);
88008                if (this._processor.getInfo().renderMode === mit.Mesh) {
88009                  const t = this._processor.getInfo().mesh;
88010                  if (t && t.struct.minPosition && t.struct.maxPosition) {
88011                    const e = new hl;
88012                    hl.fromPoints(e, t.struct.minPosition, t.struct.maxPosition);
88013                    const i = Math.max(e.halfExtents.x, e.halfExtents.y, e.halfExtents.z);
88014                    r.set(i, i, i);
88015                  }
88016                }
88017                const o = this._particleSystem.node.worldMatrix;
88018                for (let a = 0; a < this._particlesAll.length; ++a) {
88019                  const l = this._particlesAll[a];
88020                  Pi.multiply(e, gut, l.size);
88021                  Pi.multiply(e, e, r);
88022                  i.set(l.position);
88023                  this._particleSystem.simulationSpace !== _it.World && Pi.transformMat4(i, i, o);
88024                  if (t && 0 === a) {
88025                    Pi.subtract(this.minPos, i, e);
88026                    Pi.add(this.maxPos, i, e);
88027                  } else {
88028                    Pi.subtract(s, i, e);
88029                    Pi.add(n, i, e);
88030                    Pi.min(this.minPos, this.minPos, s);
88031                    Pi.max(this.maxPos, this.maxPos, n);
88032                  }
88033                }
88034              }
88035              calculatePositions() {
88036                this._emit(this._particleSystem.capacity, 0, this._particlesAll);
88037                const t = Si(bi(0, s));
88038                this._updateParticles(0, this._particlesAll);
88039                this._calculateBounding(!0);
88040                this._updateParticles(this._particleSystem.startLifetime.evaluate(0, t), this._particlesAll);
88041                this._calculateBounding(!1);
88042                this._updateBoundingNode();
88043              }
88044              clear() {
88045                this._particlesAll.length = 0;
88046              }
88047              destroy() {}
88048            }
88049            var Sut, Aut, Tut, vut, Eut, Cut, xut, wut, Rut, Iut, Mut, But, Dut, Put, Out, Nut, Lut, Fut, Vut, kut, Uut, Gut, zut, Hut, jut, Xut, Wut, Yut, qut, Kut, Jut, Zut, Qut, $ut, t_t, e_t, i_t, s_t, n_t, r_t, o_t, a_t, l_t, h_t, c_t, u_t, __t, d_t, p_t, m_t, f_t, g_t, y_t, b_t, S_t, A_t, T_t, v_t, E_t, C_t, x_t, w_t, R_t, I_t, M_t, B_t, D_t, P_t, O_t, N_t;
88050            let L_t = (Sut = Ul("cc.NoiseModule"), Aut = ph(), Tut = Th(Ne), vut = hh(), Eut = ph(),
88051            Cut = Th(Ne), xut = hh(), wut = ph(), Rut = Th(Ne), Iut = hh(), Mut = ph(), But = Th(Ne),
88052            Dut = hh(), Put = ph(), Out = Th(Ne), Nut = hh(), Lut = ph(), Fut = Th(Ne), Vut = hh(),
88053            kut = ph(), Uut = Th(Ne), Gut = hh(), zut = _h(), Hut = ph(), jut = rh(), Xut = Th(Ne),
88054            Wut = hh(), Yut = _h(), qut = ph(), Kut = rh(), Jut = Th(Ne), Zut = hh(), Qut = _h(),
88055            $ut = ph(), t_t = rh(), e_t = Th(Ne), i_t = hh(), s_t = _h(), n_t = ph(), r_t = Th(Oe),
88056            o_t = hh(), a_t = _h(), l_t = ph(), h_t = rh(), c_t = Th(Ne), u_t = hh(), __t = _h(),
88057            d_t = ph(), p_t = rh(), m_t = Th(Ne), f_t = hh(), g_t = _h(), y_t = ph(), Sut(b_t = (S_t = (N_t = class extends uit {
88058              constructor(...t) {
88059                super(...t);
88060                Ml(this, "_enable", A_t, this);
88061                Ml(this, "_strengthX", T_t, this);
88062                Ml(this, "_strengthY", v_t, this);
88063                Ml(this, "_strengthZ", E_t, this);
88064                Ml(this, "_noiseSpeedX", C_t, this);
88065                Ml(this, "_noiseSpeedY", x_t, this);
88066                Ml(this, "_noiseSpeedZ", w_t, this);
88067                Ml(this, "_noiseFrequency", R_t, this);
88068                Ml(this, "_remapX", I_t, this);
88069                Ml(this, "_remapY", M_t, this);
88070                Ml(this, "_remapZ", B_t, this);
88071                Ml(this, "_octaves", D_t, this);
88072                Ml(this, "_octaveMultiplier", P_t, this);
88073                Ml(this, "_octaveScale", O_t, this);
88074                this.name = lit;
88075                this.noise = new Vlt;
88076                this.samplePosition = new Pi;
88077              }
88078              get enable() {
88079                return this._enable;
88080              }
88081              set enable(t) {
88082                if (this._enable !== t) {
88083                  this._enable = t;
88084                  this.target && this.target.enableModule(this.name, t, this);
88085                }
88086              }
88087              get strengthX() {
88088                return this._strengthX;
88089              }
88090              set strengthX(t) {
88091                this._strengthX = t;
88092              }
88093              get strengthY() {
88094                return this._strengthY;
88095              }
88096              set strengthY(t) {
88097                this._strengthY = t;
88098              }
88099              get strengthZ() {
88100                return this._strengthZ;
88101              }
88102              set strengthZ(t) {
88103                this._strengthZ = t;
88104              }
88105              get noiseSpeedX() {
88106                return this._noiseSpeedX;
88107              }
88108              set noiseSpeedX(t) {
88109                this._noiseSpeedX = t;
88110              }
88111              get noiseSpeedY() {
88112                return this._noiseSpeedY;
88113              }
88114              set noiseSpeedY(t) {
88115                this._noiseSpeedY = t;
88116              }
88117              get noiseSpeedZ() {
88118                return this._noiseSpeedZ;
88119              }
88120              set noiseSpeedZ(t) {
88121                this._noiseSpeedZ = t;
88122              }
88123              get noiseFrequency() {
88124                return this._noiseFrequency;
88125              }
88126              set noiseFrequency(t) {
88127                this._noiseFrequency = t;
88128              }
88129              get remapX() {
88130                return this._remapX;
88131              }
88132              set remapX(t) {
88133                this._remapX = t;
88134              }
88135              get remapY() {
88136                return this._remapY;
88137              }
88138              set remapY(t) {
88139                this._remapY = t;
88140              }
88141              get remapZ() {
88142                return this._remapZ;
88143              }
88144              set remapZ(t) {
88145                this._remapZ = t;
88146              }
88147              get octaves() {
88148                return this._octaves;
88149              }
88150              set octaves(t) {
88151                this._octaves = t;
88152              }
88153              get octaveMultiplier() {
88154                return this._octaveMultiplier;
88155              }
88156              set octaveMultiplier(t) {
88157                this._octaveMultiplier = t;
88158              }
88159              get octaveScale() {
88160                return this._octaveScale;
88161              }
88162              set octaveScale(t) {
88163                this._octaveScale = t;
88164              }
88165              animate(t, e) {
88166                this.noise.setTime(t.particleSystem.time);
88167                this.noise.setSpeed(this.noiseSpeedX, this.noiseSpeedY, this.noiseSpeedZ);
88168                this.noise.setFrequency(this.noiseFrequency);
88169                this.noise.setAbs(this.remapX, this.remapY, this.remapZ);
88170                this.noise.setAmplititude(this.strengthX, this.strengthY, this.strengthZ);
88171                this.noise.setOctaves(this.octaves, this.octaveMultiplier, this.octaveScale);
88172                this.samplePosition.set(t.position);
88173                this.samplePosition.add3f(1 * Math.random(), 1 * Math.random(), 1 * Math.random());
88174                this.noise.setSamplePoint(this.samplePosition);
88175                this.noise.getNoiseParticle();
88176                const i = this.noise.getResult();
88177                i.multiply3f(Math.random(), Math.random(), Math.random());
88178                Pi.add(t.position, t.position, i.multiplyScalar(e));
88179              }
88180              getNoisePreview(t, e, i, s) {
88181                this.noise.setTime(e.time);
88182                this.noise.setSpeed(this.noiseSpeedX, this.noiseSpeedY, this.noiseSpeedZ);
88183                this.noise.setFrequency(this.noiseFrequency);
88184                this.noise.setAbs(this.remapX, this.remapY, this.remapZ);
88185                this.noise.setAmplititude(this.strengthX, this.strengthY, this.strengthZ);
88186                this.noise.setOctaves(this.octaves, this.octaveMultiplier, this.octaveScale);
88187                this.noise.getNoiseParticle();
88188                this.noise.getPreview(t, i, s);
88189              }
88190            }, N_t), A_t = Bl(S_t.prototype, "_enable", [ Yl ], {
88191              configurable: !0,
88192              enumerable: !0,
88193              writable: !0,
88194              initializer: function() {
88195                return !1;
88196              }
88197            }), Bl(S_t.prototype, "enable", [ Aut ], Object.getOwnPropertyDescriptor(S_t.prototype, "enable"), S_t.prototype),
88198            Bl(S_t.prototype, "strengthX", [ Tut, vut, Eut, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "strengthX"), S_t.prototype),
88199            T_t = Bl(S_t.prototype, "_strengthX", [ Yl ], {
88200              configurable: !0,
88201              enumerable: !0,
88202              writable: !0,
88203              initializer: function() {
88204                return 10;
88205              }
88206            }), Bl(S_t.prototype, "strengthY", [ Cut, xut, wut, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "strengthY"), S_t.prototype),
88207            v_t = Bl(S_t.prototype, "_strengthY", [ Yl ], {
88208              configurable: !0,
88209              enumerable: !0,
88210              writable: !0,
88211              initializer: function() {
88212                return 10;
88213              }
88214            }), Bl(S_t.prototype, "strengthZ", [ Rut, Iut, Mut, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "strengthZ"), S_t.prototype),
88215            E_t = Bl(S_t.prototype, "_strengthZ", [ Yl ], {
88216              configurable: !0,
88217              enumerable: !0,
88218              writable: !0,
88219              initializer: function() {
88220                return 10;
88221              }
88222            }), Bl(S_t.prototype, "noiseSpeedX", [ But, Dut, dh, Put ], Object.getOwnPropertyDescriptor(S_t.prototype, "noiseSpeedX"), S_t.prototype),
88223            C_t = Bl(S_t.prototype, "_noiseSpeedX", [ Yl ], {
88224              configurable: !0,
88225              enumerable: !0,
88226              writable: !0,
88227              initializer: function() {
88228                return 0;
88229              }
88230            }), Bl(S_t.prototype, "noiseSpeedY", [ Out, Nut, Lut, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "noiseSpeedY"), S_t.prototype),
88231            x_t = Bl(S_t.prototype, "_noiseSpeedY", [ Yl ], {
88232              configurable: !0,
88233              enumerable: !0,
88234              writable: !0,
88235              initializer: function() {
88236                return 0;
88237              }
88238            }), Bl(S_t.prototype, "noiseSpeedZ", [ Fut, Vut, kut, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "noiseSpeedZ"), S_t.prototype),
88239            w_t = Bl(S_t.prototype, "_noiseSpeedZ", [ Yl ], {
88240              configurable: !0,
88241              enumerable: !0,
88242              writable: !0,
88243              initializer: function() {
88244                return 0;
88245              }
88246            }), Bl(S_t.prototype, "noiseFrequency", [ Uut, Gut, zut, Hut, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "noiseFrequency"), S_t.prototype),
88247            R_t = Bl(S_t.prototype, "_noiseFrequency", [ Yl ], {
88248              configurable: !0,
88249              enumerable: !0,
88250              writable: !0,
88251              initializer: function() {
88252                return 1;
88253              }
88254            }), Bl(S_t.prototype, "remapX", [ jut, Xut, Wut, Yut, qut, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "remapX"), S_t.prototype),
88255            I_t = Bl(S_t.prototype, "_remapX", [ Yl ], {
88256              configurable: !0,
88257              enumerable: !0,
88258              writable: !0,
88259              initializer: function() {
88260                return 0;
88261              }
88262            }), Bl(S_t.prototype, "remapY", [ Kut, Jut, Zut, Qut, $ut, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "remapY"), S_t.prototype),
88263            M_t = Bl(S_t.prototype, "_remapY", [ Yl ], {
88264              configurable: !0,
88265              enumerable: !0,
88266              writable: !0,
88267              initializer: function() {
88268                return 0;
88269              }
88270            }), Bl(S_t.prototype, "remapZ", [ t_t, e_t, i_t, s_t, n_t, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "remapZ"), S_t.prototype),
88271            B_t = Bl(S_t.prototype, "_remapZ", [ Yl ], {
88272              configurable: !0,
88273              enumerable: !0,
88274              writable: !0,
88275              initializer: function() {
88276                return 0;
88277              }
88278            }), Bl(S_t.prototype, "octaves", [ r_t, o_t, a_t, l_t, dh ], Object.getOwnPropertyDescriptor(S_t.prototype, "octaves"), S_t.prototype),
88279            D_t = Bl(S_t.prototype, "_octaves", [ Yl ], {
88280              configurable: !0,
88281              enumerable: !0,
88282              writable: !0,
88283              initializer: function() {
88284                return 1;
88285              }
88286            }), Bl(S_t.prototype, "octaveMultiplier", [ h_t, c_t, u_t, __t, d_t ], Object.getOwnPropertyDescriptor(S_t.prototype, "octaveMultiplier"), S_t.prototype),
88287            P_t = Bl(S_t.prototype, "_octaveMultiplier", [ Yl ], {
88288              configurable: !0,
88289              enumerable: !0,
88290              writable: !0,
88291              initializer: function() {
88292                return .5;
88293              }
88294            }), Bl(S_t.prototype, "octaveScale", [ p_t, m_t, f_t, g_t, y_t ], Object.getOwnPropertyDescriptor(S_t.prototype, "octaveScale"), S_t.prototype),
88295            O_t = Bl(S_t.prototype, "_octaveScale", [ Yl ], {
88296              configurable: !0,
88297              enumerable: !0,
88298              writable: !0,
88299              initializer: function() {
88300                return 2;
88301              }
88302            }), S_t)) || b_t);
88303            var F_t, V_t, k_t, U_t, G_t, z_t, H_t, j_t, X_t, W_t, Y_t, q_t, K_t, J_t, Z_t, Q_t, $_t, tdt, edt, idt, sdt, ndt, rdt, odt, adt, ldt, hdt, cdt, udt, _dt, ddt, pdt, mdt, fdt, gdt, ydt, bdt, Sdt, Adt, Tdt, vdt, Edt, Cdt, xdt, wdt, Rdt, Idt, Mdt, Bdt, Ddt, Pdt, Odt, Ndt, Ldt, Fdt, Vdt, kdt, Udt, Gdt, zdt, Hdt, jdt, Xdt, Wdt, Ydt, qdt, Kdt, Jdt, Zdt, Qdt, $dt, tpt, ept, ipt, spt, npt, rpt, opt, apt, lpt, hpt, cpt, upt, _pt, dpt, ppt, mpt, fpt, gpt, ypt, bpt, Spt, Apt, Tpt, vpt, Ept, Cpt, xpt, wpt, Rpt, Ipt, Mpt, Bpt, Dpt, Ppt, Opt, Npt, Lpt, Fpt, Vpt, kpt, Upt, Gpt, zpt, Hpt, jpt, Xpt, Wpt, Ypt, qpt, Kpt, Jpt, Zpt, Qpt, $pt, tmt, emt, imt, smt, nmt, rmt, omt, amt, lmt, hmt, cmt, umt, _mt, dmt, pmt, mmt, fmt, gmt, ymt, bmt, Smt, Amt, Tmt, vmt, Emt, Cmt, xmt, wmt, Rmt, Imt, Mmt, Bmt, Dmt, Pmt, Omt, Nmt, Lmt, Fmt, Vmt, kmt, Umt, Gmt, zmt, Hmt, jmt, Xmt, Wmt, Ymt, qmt, Kmt, Jmt, Zmt, Qmt, $mt, tft, eft, ift, sft, nft, rft, oft, aft, lft, hft, cft, uft, _ft, dft, pft, mft, fft;
88304            const gft = new qi;
88305            const yft = new Ui;
88306            const bft = Object.getOwnPropertyDescriptor(vS.prototype, "sharedMaterials");
88307            let Sft = function(e) {
88308              return t({
88309                ParticleSystem: e,
88310                ParticleSystemComponent: e
88311              }), e;
88312            }((F_t = Ul("cc.ParticleSystem"), V_t = sh(), k_t = $l(), U_t = zl(99), G_t = hh(),
88313            z_t = ph(), H_t = lh(), j_t = Th(ret), X_t = ph(), W_t = lh(), Y_t = Th(_it), q_t = ph(),
88314            K_t = lh(), J_t = ph(), Z_t = lh(), Q_t = ql("startSize"), $_t = hh(), tdt = Th(Dtt),
88315            edt = ph(), idt = lh(), sdt = Th(Dtt), ndt = hh(), rdt = ph(), odt = lh(), adt = rh(),
88316            ldt = Th(Dtt), hdt = hh(), cdt = ph(), udt = lh(), _dt = rh(), ddt = Th(Dtt), pdt = hh(),
88317            mdt = ph(), fdt = lh(), gdt = ph(), ydt = lh(), bdt = Th(Dtt), Sdt = hh(), Adt = ph(),
88318            Tdt = lh(), vdt = rh(), Edt = Th(Dtt), Cdt = hh(), xdt = ph(), wdt = lh(), Rdt = rh(),
88319            Idt = Th(Dtt), Mdt = ql("startRotation"), Bdt = hh(), Ddt = ph(), Pdt = lh(), Odt = rh(),
88320            Ndt = Th(Dtt), Ldt = hh(), Fdt = ph(), Vdt = lh(), kdt = Th(Dtt), Udt = hh(), Gdt = ph(),
88321            zdt = lh(), Hdt = ph(), jdt = lh(), Xdt = ph(), Wdt = lh(), Ydt = ph(), qdt = lh(),
88322            Kdt = Th(_it), Jdt = ph(), Zdt = lh(), Qdt = ph(), $dt = lh(), tpt = ph(), ept = lh(),
88323            ipt = Th(Dtt), spt = hh(), npt = ph(), rpt = lh(), opt = Th(Dtt), apt = hh(), lpt = ph(),
88324            hpt = lh(), cpt = Th(Dtt), upt = hh(), _pt = ph(), dpt = lh(), ppt = Th([ sat ]),
88325            mpt = ph(), fpt = lh(), gpt = Th(Le), ypt = ph(), bpt = lh(), Spt = Th(dit), Apt = ph(),
88326            Tpt = lh(), vpt = Th(Ne), Ept = ph(), Cpt = lh(), xpt = Th(Ne), wpt = ph(), Rpt = lh(),
88327            Ipt = Th(Ne), Mpt = ph(), Bpt = lh(), Dpt = ph(), Ppt = lh(), Opt = ql("enableCulling"),
88328            Npt = rh(), Lpt = Th(hm), Fpt = ah(), Vpt = Th(Vit), kpt = Th(Vit), Upt = ph(),
88329            Gpt = lh(), zpt = Th(Dlt), Hpt = Th(Dlt), jpt = ph(), Xpt = lh(), Wpt = Th(yrt),
88330            Ypt = Th(yrt), qpt = ph(), Kpt = lh(), Jpt = Th(Yot), Zpt = Th(Yot), Qpt = ph(),
88331            $pt = lh(), tmt = Th(Sst), emt = Th(Sst), imt = ph(), smt = lh(), nmt = Th(cnt),
88332            rmt = Th(cnt), omt = ph(), amt = lh(), lmt = Th(Vnt), hmt = Th(Vnt), cmt = ph(),
88333            umt = lh(), _mt = Th(_ot), dmt = Th(_ot), pmt = ph(), mmt = lh(), fmt = Th(L_t),
88334            gmt = Th(L_t), ymt = ph(), bmt = Th(dut), Smt = Th(dut), Amt = ph(), Tmt = lh(),
88335            vmt = Th(cct), Emt = ph(), Cmt = lh(), F_t(xmt = V_t(xmt = k_t(xmt = U_t(xmt = Ql(xmt = (wmt = (fft = mft = class extends wS {
88336              get capacity() {
88337                return this._capacity;
88338              }
88339              set capacity(t) {
88340                this._capacity = Math.floor(t > 0 ? t : 0);
88341                this.processor && this.processor._model && this.processor._model.setCapacity(this._capacity);
88342              }
88343              get prewarm() {
88344                return this._prewarm;
88345              }
88346              set prewarm(t) {
88347                !0 === t && this.loop;
88348                this._prewarm = t;
88349              }
88350              get simulationSpace() {
88351                return this._simulationSpace;
88352              }
88353              set simulationSpace(t) {
88354                if (t !== this._simulationSpace) {
88355                  this._simulationSpace = t;
88356                  if (this.processor) {
88357                    this.processor.updateMaterialParams();
88358                    this.processor.updateTrailMaterial();
88359                  }
88360                }
88361              }
88362              set renderCulling(t) {
88363                this._renderCulling = t;
88364                if (t && !this._boundingBox) {
88365                  this._boundingBox = new hl;
88366                  this._calculateBounding(!1);
88367                }
88368              }
88369              get renderCulling() {
88370                return this._renderCulling;
88371              }
88372              get cullingMode() {
88373                return this._cullingMode;
88374              }
88375              set cullingMode(t) {
88376                this._cullingMode = t;
88377              }
88378              get aabbHalfX() {
88379                const t = this.getBoundingX();
88380                return t || 0;
88381              }
88382              set aabbHalfX(t) {
88383                this.setBoundingX(t);
88384              }
88385              get aabbHalfY() {
88386                const t = this.getBoundingY();
88387                return t || 0;
88388              }
88389              set aabbHalfY(t) {
88390                this.setBoundingY(t);
88391              }
88392              get aabbHalfZ() {
88393                const t = this.getBoundingZ();
88394                return t || 0;
88395              }
88396              set aabbHalfZ(t) {
88397                this.setBoundingZ(t);
88398              }
88399              get dataCulling() {
88400                return this._dataCulling;
88401              }
88402              set dataCulling(t) {
88403                this._dataCulling = t;
88404              }
88405              get sharedMaterials() {
88406                return bft.get.call(this);
88407              }
88408              set sharedMaterials(t) {
88409                bft.set.call(this, t);
88410              }
88411              get colorOverLifetimeModule() {
88412                return this._colorOverLifetimeModule;
88413              }
88414              set colorOverLifetimeModule(t) {
88415                t && (this._colorOverLifetimeModule = t);
88416              }
88417              get shapeModule() {
88418                return this._shapeModule;
88419              }
88420              set shapeModule(t) {
88421                t && (this._shapeModule = t);
88422              }
88423              get sizeOvertimeModule() {
88424                return this._sizeOvertimeModule;
88425              }
88426              set sizeOvertimeModule(t) {
88427                t && (this._sizeOvertimeModule = t);
88428              }
88429              get velocityOvertimeModule() {
88430                return this._velocityOvertimeModule;
88431              }
88432              set velocityOvertimeModule(t) {
88433                t && (this._velocityOvertimeModule = t);
88434              }
88435              get forceOvertimeModule() {
88436                return this._forceOvertimeModule;
88437              }
88438              set forceOvertimeModule(t) {
88439                t && (this._forceOvertimeModule = t);
88440              }
88441              get limitVelocityOvertimeModule() {
88442                return this._limitVelocityOvertimeModule;
88443              }
88444              set limitVelocityOvertimeModule(t) {
88445                t && (this._limitVelocityOvertimeModule = t);
88446              }
88447              get rotationOvertimeModule() {
88448                return this._rotationOvertimeModule;
88449              }
88450              set rotationOvertimeModule(t) {
88451                t && (this._rotationOvertimeModule = t);
88452              }
88453              get textureAnimationModule() {
88454                return this._textureAnimationModule;
88455              }
88456              set textureAnimationModule(t) {
88457                t && (this._textureAnimationModule = t);
88458              }
88459              get noiseModule() {
88460                return this._noiseModule;
88461              }
88462              set noiseModule(t) {
88463                t && (this._noiseModule = t);
88464              }
88465              get trailModule() {
88466                return this._trailModule;
88467              }
88468              set trailModule(t) {
88469                t && (this._trailModule = t);
88470              }
88471              constructor() {
88472                super();
88473                Ml(this, "startColor", Rmt, this);
88474                Ml(this, "scaleSpace", Imt, this);
88475                Ml(this, "startSize3D", Mmt, this);
88476                Ml(this, "startSizeX", Bmt, this);
88477                Ml(this, "startSizeY", Dmt, this);
88478                Ml(this, "startSizeZ", Pmt, this);
88479                Ml(this, "startSpeed", Omt, this);
88480                Ml(this, "startRotation3D", Nmt, this);
88481                Ml(this, "startRotationX", Lmt, this);
88482                Ml(this, "startRotationY", Fmt, this);
88483                Ml(this, "startRotationZ", Vmt, this);
88484                Ml(this, "startDelay", kmt, this);
88485                Ml(this, "startLifetime", Umt, this);
88486                Ml(this, "duration", Gmt, this);
88487                Ml(this, "loop", zmt, this);
88488                Ml(this, "simulationSpeed", Hmt, this);
88489                Ml(this, "playOnAwake", jmt, this);
88490                Ml(this, "gravityModifier", Xmt, this);
88491                Ml(this, "rateOverTime", Wmt, this);
88492                Ml(this, "rateOverDistance", Ymt, this);
88493                Ml(this, "bursts", qmt, this);
88494                Ml(this, "_renderCulling", Kmt, this);
88495                Ml(this, "_cullingMode", Jmt, this);
88496                Ml(this, "_aabbHalfX", Zmt, this);
88497                Ml(this, "_aabbHalfY", Qmt, this);
88498                Ml(this, "_aabbHalfZ", $mt, this);
88499                Ml(this, "_dataCulling", tft, this);
88500                Ml(this, "_colorOverLifetimeModule", eft, this);
88501                Ml(this, "_shapeModule", ift, this);
88502                Ml(this, "_sizeOvertimeModule", sft, this);
88503                Ml(this, "_velocityOvertimeModule", nft, this);
88504                Ml(this, "_forceOvertimeModule", rft, this);
88505                Ml(this, "_limitVelocityOvertimeModule", oft, this);
88506                Ml(this, "_rotationOvertimeModule", aft, this);
88507                Ml(this, "_textureAnimationModule", lft, this);
88508                Ml(this, "_noiseModule", hft, this);
88509                Ml(this, "_trailModule", cft, this);
88510                Ml(this, "renderer", uft, this);
88511                this._isPlaying = void 0;
88512                this._isPaused = void 0;
88513                this._isStopped = void 0;
88514                this._isEmitting = void 0;
88515                this._needRefresh = void 0;
88516                this._time = void 0;
88517                this._emitRateTimeCounter = void 0;
88518                this._emitRateDistanceCounter = void 0;
88519                this._oldWPos = void 0;
88520                this._curWPos = void 0;
88521                this._boundingBox = void 0;
88522                this._culler = void 0;
88523                this._oldPos = void 0;
88524                this._curPos = void 0;
88525                this._isCulled = void 0;
88526                this._isSimulating = void 0;
88527                this._customData1 = void 0;
88528                this._customData2 = void 0;
88529                this._subEmitters = void 0;
88530                this._needAttach = void 0;
88531                Ml(this, "_prewarm", _ft, this);
88532                Ml(this, "_capacity", dft, this);
88533                Ml(this, "_simulationSpace", pft, this);
88534                this.processor = null;
88535                this.rateOverTime.constant = 10;
88536                this.startLifetime.constant = 5;
88537                this.startSizeX.constant = 1;
88538                this.startSpeed.constant = 5;
88539                this._isPlaying = !1;
88540                this._isPaused = !1;
88541                this._isStopped = !0;
88542                this._isEmitting = !1;
88543                this._needRefresh = !0;
88544                this._needAttach = !1;
88545                this._time = 0;
88546                this._emitRateTimeCounter = 0;
88547                this._emitRateDistanceCounter = 0;
88548                this._oldWPos = new Pi;
88549                this._curWPos = new Pi;
88550                this._boundingBox = null;
88551                this._culler = null;
88552                this._oldPos = null;
88553                this._curPos = null;
88554                this._isCulled = !1;
88555                this._isSimulating = !0;
88556                this._customData1 = new Qi;
88557                this._customData2 = new Qi;
88558                this._subEmitters = [];
88559              }
88560              onFocusInEditor() {
88561                this.renderer.create(this);
88562              }
88563              onLoad() {
88564                this.renderer.onInit(this);
88565                this._shapeModule && this._shapeModule.onInit(this);
88566                this._trailModule && !this.renderer.useGPU && this._trailModule.onInit(this);
88567                this.bindModule();
88568                this._resetPosition();
88569              }
88570              _onMaterialModified(t, e) {
88571                null !== this.processor && this.processor.onMaterialModified(t, e);
88572              }
88573              _onRebuildPSO(t, e) {
88574                this.processor.onRebuildPSO(t, e);
88575              }
88576              _collectModels() {
88577                this._models.length = 0;
88578                this._models.push(this.processor._model);
88579                this._trailModule && this._trailModule.enable && this._trailModule._trailModel && this._models.push(this._trailModule._trailModel);
88580                return this._models;
88581              }
88582              _attachToScene() {
88583                this.processor.attachToScene();
88584                this._trailModule && this._trailModule.enable && this._trailModule._attachToScene();
88585              }
88586              _detachFromScene() {
88587                this.processor.detachFromScene();
88588                this._trailModule && this._trailModule.enable && this._trailModule._detachFromScene();
88589                this._boundingBox && (this._boundingBox = null);
88590                if (this._culler) {
88591                  this._culler.clear();
88592                  this._culler.destroy();
88593                  this._culler = null;
88594                }
88595              }
88596              bindModule() {
88597                this._colorOverLifetimeModule && this._colorOverLifetimeModule.bindTarget(this.processor);
88598                this._sizeOvertimeModule && this._sizeOvertimeModule.bindTarget(this.processor);
88599                this._rotationOvertimeModule && this._rotationOvertimeModule.bindTarget(this.processor);
88600                this._forceOvertimeModule && this._forceOvertimeModule.bindTarget(this.processor);
88601                this._limitVelocityOvertimeModule && this._limitVelocityOvertimeModule.bindTarget(this.processor);
88602                this._velocityOvertimeModule && this._velocityOvertimeModule.bindTarget(this.processor);
88603                this._textureAnimationModule && this._textureAnimationModule.bindTarget(this.processor);
88604                this._noiseModule && this._noiseModule.bindTarget(this.processor);
88605              }
88606              play() {
88607                this._isPaused && (this._isPaused = !1);
88608                this._isStopped && (this._isStopped = !1);
88609                this._isPlaying = !0;
88610                this._isEmitting = !0;
88611                this._resetPosition();
88612                this._prewarm && this._prewarmSystem();
88613                this._trailModule && this._trailModule.play();
88614                if (this.processor) {
88615                  const t = this.processor.getModel();
88616                  t && (t.enabled = this.enabledInHierarchy);
88617                }
88618              }
88619              pause() {
88620                if (this._isStopped) console.warn("pause(): particle system is already stopped."); else {
88621                  this._isPlaying && (this._isPlaying = !1);
88622                  this._isPaused = !0;
88623                }
88624              }
88625              stopEmitting() {
88626                this._isEmitting = !1;
88627              }
88628              stop() {
88629                (this._isPlaying || this._isPaused) && this.clear();
88630                this._isPlaying && (this._isPlaying = !1);
88631                this._isPaused && (this._isPaused = !1);
88632                this._isEmitting && (this._isEmitting = !1);
88633                this._time = 0;
88634                this._emitRateTimeCounter = 0;
88635                this._emitRateDistanceCounter = 0;
88636                this._isStopped = !0;
88637                this._needRefresh = !0;
88638                for (const t of this.bursts) t.reset();
88639              }
88640              clear() {
88641                if (this.enabledInHierarchy) {
88642                  this.processor.clear();
88643                  this._trailModule && this._trailModule.clear();
88644                }
88645                this._calculateBounding(!1);
88646              }
88647              getParticleCount() {
88648                return this.processor.getParticleCount();
88649              }
88650              setCustomData1(t, e) {
88651                Qi.set(this._customData1, t, e);
88652              }
88653              setCustomData2(t, e) {
88654                Qi.set(this._customData2, t, e);
88655              }
88656              onDestroy() {
88657                var t;
88658                this.stop();
88659                if (null === (t = this.processor.getModel()) || void 0 === t ? void 0 : t.scene) {
88660                  this.processor.detachFromScene();
88661                  this._trailModule && this._trailModule.enable && this._trailModule._detachFromScene();
88662                }
88663                m.director.off(m.Director.EVENT_BEFORE_COMMIT, this.beforeRender, this);
88664                this.processor.onDestroy();
88665                this._trailModule && this._trailModule.destroy();
88666                if (this._culler) {
88667                  this._culler.clear();
88668                  this._culler.destroy();
88669                  this._culler = null;
88670                }
88671              }
88672              onEnable() {
88673                super.onEnable();
88674                m.director.on(m.Director.EVENT_BEFORE_COMMIT, this.beforeRender, this);
88675                this.playOnAwake && this.play();
88676                this.processor.onEnable();
88677                this._trailModule && this._trailModule.onEnable();
88678              }
88679              onDisable() {
88680                m.director.off(m.Director.EVENT_BEFORE_COMMIT, this.beforeRender, this);
88681                this.processor.onDisable();
88682                this._trailModule && this._trailModule.onDisable();
88683                this._boundingBox && (this._boundingBox = null);
88684                if (this._culler) {
88685                  this._culler.clear();
88686                  this._culler.destroy();
88687                  this._culler = null;
88688                }
88689              }
88690              _calculateBounding(t) {
88691                if (this._boundingBox) {
88692                  this._culler || (this._culler = new but(this));
88693                  this._culler.calculatePositions();
88694                  hl.fromPoints(this._boundingBox, this._culler.minPos, this._culler.maxPos);
88695                  if (t) {
88696                    this.aabbHalfX = this._boundingBox.halfExtents.x;
88697                    this.aabbHalfY = this._boundingBox.halfExtents.y;
88698                    this.aabbHalfZ = this._boundingBox.halfExtents.z;
88699                  } else {
88700                    this.aabbHalfX ? this.setBoundingX(this.aabbHalfX) : this.aabbHalfX = this._boundingBox.halfExtents.x;
88701                    this.aabbHalfY ? this.setBoundingY(this.aabbHalfY) : this.aabbHalfY = this._boundingBox.halfExtents.y;
88702                    this.aabbHalfZ ? this.setBoundingZ(this.aabbHalfZ) : this.aabbHalfZ = this._boundingBox.halfExtents.z;
88703                  }
88704                  this._culler.clear();
88705                }
88706              }
88707              update(t) {
88708                const e = t * this.simulationSpeed;
88709                if (this.renderCulling) {
88710                  var i;
88711                  if (!this._boundingBox) {
88712                    this._boundingBox = new hl;
88713                    this._calculateBounding(!1);
88714                  }
88715                  this._curPos || (this._curPos = new Pi);
88716                  this.node.getWorldPosition(this._curPos);
88717                  if (!this._oldPos) {
88718                    this._oldPos = new Pi;
88719                    this._oldPos.set(this._curPos);
88720                  }
88721                  if (!this._curPos.equals(this._oldPos) && this._boundingBox && this._culler) {
88722                    const t = this._curPos.x - this._oldPos.x;
88723                    const e = this._curPos.y - this._oldPos.y;
88724                    const i = this._curPos.z - this._oldPos.z;
88725                    const s = this._boundingBox.center;
88726                    s.x += t;
88727                    s.y += e;
88728                    s.z += i;
88729                    this._culler.setBoundingBoxCenter(s.x, s.y, s.z);
88730                    this._oldPos.set(this._curPos);
88731                  }
88732                  const t = null === (i = this.node.scene.renderScene) || void 0 === i ? void 0 : i.cameras;
88733                  let s = !0;
88734                  if (void 0 !== t && this._boundingBox) for (let e = 0; e < t.length; ++e) {
88735                    const i = t[e];
88736                    if ((i.visibility & this.node.layer) === this.node.layer && Za.aabbFrustum(this._boundingBox, i.frustum)) {
88737                      s = !1;
88738                      break;
88739                    }
88740                  }
88741                  if (s) {
88742                    this._cullingMode !== dit.AlwaysSimulate && (this._isSimulating = !1);
88743                    if (!this._isCulled) {
88744                      this.processor.detachFromScene();
88745                      this._isCulled = !0;
88746                    }
88747                    this._trailModule && this._trailModule.enable && this._trailModule._detachFromScene();
88748                    this._cullingMode === dit.PauseAndCatchup && (this._time += e);
88749                    if (this._cullingMode !== dit.AlwaysSimulate) return;
88750                  } else {
88751                    if (this._isCulled) {
88752                      this._attachToScene();
88753                      this._isCulled = !1;
88754                    }
88755                    this._isSimulating || (this._isSimulating = !0);
88756                  }
88757                  if (!this._isSimulating) return;
88758                } else {
88759                  this._boundingBox && (this._boundingBox = null);
88760                  if (this._culler) {
88761                    this._culler.clear();
88762                    this._culler.destroy();
88763                    this._culler = null;
88764                  }
88765                  this._isSimulating = !0;
88766                }
88767                if (this._isPlaying) {
88768                  this._time += e;
88769                  this._emit(e);
88770                  0 !== this.processor.updateParticles(e) || this._isEmitting || this.stop();
88771                } else {
88772                  const t = (this.getMaterialInstance(0) || this.processor.getDefaultMaterial()).passes[0];
88773                  this.processor.updateRotation(t);
88774                  this.processor.updateScale(t);
88775                }
88776                this.processor.updateRenderData();
88777                this._trailModule && this._trailModule.enable && this._trailModule.updateRenderData();
88778                if (this._needAttach && this.getParticleCount() > 0 && !this._isCulled) {
88779                  var s;
88780                  (null === (s = this.processor.getModel()) || void 0 === s ? void 0 : s.scene) || this.processor.attachToScene();
88781                  if (this._trailModule && this._trailModule.enable) {
88782                    var n;
88783                    (null === (n = this._trailModule.getModel()) || void 0 === n ? void 0 : n.scene) || this._trailModule._attachToScene();
88784                  }
88785                  this._needAttach = !1;
88786                }
88787              }
88788              beforeRender() {
88789                var t;
88790                if (this._isPlaying) {
88791                  this.processor.beforeRender();
88792                  this._trailModule && this._trailModule.enable && this._trailModule.beforeRender();
88793                  if (this.getParticleCount() <= 0) {
88794                    var e;
88795                    if (null === (e = this.processor.getModel()) || void 0 === e ? void 0 : e.scene) {
88796                      this.processor.detachFromScene();
88797                      this._trailModule && this._trailModule.enable && this._trailModule._detachFromScene();
88798                      this._needAttach = !1;
88799                    }
88800                  } else (null === (t = this.processor.getModel()) || void 0 === t ? void 0 : t.scene) || (this._needAttach = !0);
88801                }
88802              }
88803              _onVisibilityChange(t) {
88804                this.processor._model && (this.processor._model.visFlags = t);
88805              }
88806              emit(t, e) {
88807                const i = this._time % this.duration / this.duration;
88808                if (this._needRefresh) {
88809                  this.node.invalidateChildren(ay.POSITION);
88810                  this._needRefresh = !1;
88811                }
88812                if (this._simulationSpace === _it.World) {
88813                  this.node.getWorldMatrix(gft);
88814                  this.node.getWorldRotation(yft);
88815                }
88816                for (let n = 0; n < t; ++n) {
88817                  const t = this.processor.getFreeParticle();
88818                  if (null === t) return;
88819                  t.particleSystem = this;
88820                  t.reset();
88821                  const n = Si(bi(0, s));
88822                  if (this._shapeModule && this._shapeModule.enable) this._shapeModule.emit(t); else {
88823                    Pi.set(t.position, 0, 0, 0);
88824                    Pi.copy(t.velocity, kit);
88825                  }
88826                  this._textureAnimationModule && this._textureAnimationModule.enable && this._textureAnimationModule.init(t);
88827                  const r = this.startSpeed.evaluate(i, n);
88828                  Pi.multiplyScalar(t.velocity, t.velocity, r);
88829                  if (this._simulationSpace === _it.World) {
88830                    Pi.transformMat4(t.position, t.position, gft);
88831                    Pi.transformQuat(t.velocity, t.velocity, yft);
88832                  }
88833                  Pi.copy(t.ultimateVelocity, t.velocity);
88834                  this.startRotation3D ? t.startEuler.set(this.startRotationX.evaluate(i, n), this.startRotationY.evaluate(i, n), this.startRotationZ.evaluate(i, n)) : t.startEuler.set(0, 0, this.startRotationZ.evaluate(i, n));
88835                  t.rotation.set(t.startEuler);
88836                  if (this.startSize3D) Pi.set(t.startSize, this.startSizeX.evaluate(i, n), this.startSizeY.evaluate(i, n), this.startSizeZ.evaluate(i, n)); else {
88837                    Pi.set(t.startSize, this.startSizeX.evaluate(i, n), 1, 1);
88838                    t.startSize.y = t.startSize.x;
88839                  }
88840                  Pi.copy(t.size, t.startSize);
88841                  t.startColor.set(this.startColor.evaluate(i, n));
88842                  t.color.set(t.startColor);
88843                  t.startLifetime = this.startLifetime.evaluate(i, n) + e;
88844                  t.remainingLifetime = t.startLifetime;
88845                  t.randomSeed = bi(0, 233280);
88846                  t.loopCount++;
88847                  this.processor.setNewParticle(t);
88848                }
88849              }
88850              _prewarmSystem() {
88851                this.startDelay.mode = Btt.Constant;
88852                this.startDelay.constant = 0;
88853                const t = this.duration / 1;
88854                for (let e = 0; e < t; ++e) {
88855                  this._time += 1;
88856                  this._emit(1);
88857                  this.processor.updateParticles(1);
88858                }
88859              }
88860              _emit(t) {
88861                const e = this.startDelay.evaluate(0, 1);
88862                if (this._time > e) {
88863                  this._time > this.duration + e && (this.loop || (this._isEmitting = !1));
88864                  if (!this._isEmitting) return;
88865                  this._emitRateTimeCounter += this.rateOverTime.evaluate(this._time / this.duration, 1) * t;
88866                  if (this._emitRateTimeCounter > 1) {
88867                    const e = Math.floor(this._emitRateTimeCounter);
88868                    this._emitRateTimeCounter -= e;
88869                    this.emit(e, t);
88870                  }
88871                  this.node.getWorldPosition(this._curWPos);
88872                  const i = Pi.distance(this._curWPos, this._oldWPos);
88873                  Pi.copy(this._oldWPos, this._curWPos);
88874                  this._emitRateDistanceCounter += i * this.rateOverDistance.evaluate(this._time / this.duration, 1);
88875                  if (this._emitRateDistanceCounter > 1) {
88876                    const e = Math.floor(this._emitRateDistanceCounter);
88877                    this._emitRateDistanceCounter -= e;
88878                    this.emit(e, t);
88879                  }
88880                  for (const e of this.bursts) e.update(this, t);
88881                }
88882              }
88883              _resetPosition() {
88884                this.node.getWorldPosition(this._oldWPos);
88885                Pi.copy(this._curWPos, this._oldWPos);
88886              }
88887              addSubEmitter(t) {
88888                this._subEmitters.push(t);
88889              }
88890              removeSubEmitter(t) {
88891                this._subEmitters.splice(this._subEmitters.indexOf(t), 1);
88892              }
88893              addBurst(t) {
88894                this.bursts.push(t);
88895              }
88896              removeBurst(t) {
88897                this.bursts.splice(this.bursts.indexOf(t), 1);
88898              }
88899              getBoundingX() {
88900                return this._aabbHalfX;
88901              }
88902              getBoundingY() {
88903                return this._aabbHalfY;
88904              }
88905              getBoundingZ() {
88906                return this._aabbHalfZ;
88907              }
88908              setBoundingX(t) {
88909                if (this._boundingBox && this._culler) {
88910                  this._boundingBox.halfExtents.x = t;
88911                  this._culler.setBoundingBoxSize(this._boundingBox.halfExtents);
88912                  this._aabbHalfX = t;
88913                }
88914              }
88915              setBoundingY(t) {
88916                if (this._boundingBox && this._culler) {
88917                  this._boundingBox.halfExtents.y = t;
88918                  this._culler.setBoundingBoxSize(this._boundingBox.halfExtents);
88919                  this._aabbHalfY = t;
88920                }
88921              }
88922              setBoundingZ(t) {
88923                if (this._boundingBox && this._culler) {
88924                  this._boundingBox.halfExtents.z = t;
88925                  this._culler.setBoundingBoxSize(this._boundingBox.halfExtents);
88926                  this._aabbHalfZ = t;
88927                }
88928              }
88929              get isPlaying() {
88930                return this._isPlaying;
88931              }
88932              get isPaused() {
88933                return this._isPaused;
88934              }
88935              get isStopped() {
88936                return this._isStopped;
88937              }
88938              get isEmitting() {
88939                return this._isEmitting;
88940              }
88941              get time() {
88942                return this._time;
88943              }
88944              _onBeforeSerialize(t) {
88945                return this.dataCulling ? t.filter((t => !cit.includes(t) || this[t] && this[t].enable)) : t;
88946              }
88947              getNoisePreview(t, e) {
88948                const i = [];
88949                this.processor && this.processor.getNoisePreview(i, t, e);
88950                return i;
88951              }
88952            }, mft.CullingMode = dit, fft), Bl(wmt.prototype, "capacity", [ G_t, z_t, H_t ], Object.getOwnPropertyDescriptor(wmt.prototype, "capacity"), wmt.prototype),
88953            Rmt = Bl(wmt.prototype, "startColor", [ j_t, Yl, X_t, W_t ], {
88954              configurable: !0,
88955              enumerable: !0,
88956              writable: !0,
88957              initializer: function() {
88958                return new ret;
88959              }
88960            }), Imt = Bl(wmt.prototype, "scaleSpace", [ Y_t, Yl, q_t, K_t ], {
88961              configurable: !0,
88962              enumerable: !0,
88963              writable: !0,
88964              initializer: function() {
88965                return _it.Local;
88966              }
88967            }), Mmt = Bl(wmt.prototype, "startSize3D", [ Yl, J_t, Z_t ], {
88968              configurable: !0,
88969              enumerable: !0,
88970              writable: !0,
88971              initializer: function() {
88972                return !1;
88973              }
88974            }), Bmt = Bl(wmt.prototype, "startSizeX", [ Q_t, $_t, tdt, edt, idt ], {
88975              configurable: !0,
88976              enumerable: !0,
88977              writable: !0,
88978              initializer: function() {
88979                return new Dtt;
88980              }
88981            }), Dmt = Bl(wmt.prototype, "startSizeY", [ sdt, Yl, ndt, rdt, odt, adt ], {
88982              configurable: !0,
88983              enumerable: !0,
88984              writable: !0,
88985              initializer: function() {
88986                return new Dtt;
88987              }
88988            }), Pmt = Bl(wmt.prototype, "startSizeZ", [ ldt, Yl, hdt, cdt, udt, _dt ], {
88989              configurable: !0,
88990              enumerable: !0,
88991              writable: !0,
88992              initializer: function() {
88993                return new Dtt;
88994              }
88995            }), Omt = Bl(wmt.prototype, "startSpeed", [ ddt, Yl, pdt, mdt, fdt ], {
88996              configurable: !0,
88997              enumerable: !0,
88998              writable: !0,
88999              initializer: function() {
89000                return new Dtt;
89001              }
89002            }), Nmt = Bl(wmt.prototype, "startRotation3D", [ Yl, gdt, ydt ], {
89003              configurable: !0,
89004              enumerable: !0,
89005              writable: !0,
89006              initializer: function() {
89007                return !1;
89008              }
89009            }), Lmt = Bl(wmt.prototype, "startRotationX", [ bdt, Yl, Sdt, mh, Adt, Tdt, vdt ], {
89010              configurable: !0,
89011              enumerable: !0,
89012              writable: !0,
89013              initializer: function() {
89014                return new Dtt;
89015              }
89016            }), Fmt = Bl(wmt.prototype, "startRotationY", [ Edt, Yl, Cdt, mh, xdt, wdt, Rdt ], {
89017              configurable: !0,
89018              enumerable: !0,
89019              writable: !0,
89020              initializer: function() {
89021                return new Dtt;
89022              }
89023            }), Vmt = Bl(wmt.prototype, "startRotationZ", [ Idt, Mdt, Bdt, mh, Ddt, Pdt, Odt ], {
89024              configurable: !0,
89025              enumerable: !0,
89026              writable: !0,
89027              initializer: function() {
89028                return new Dtt;
89029              }
89030            }), kmt = Bl(wmt.prototype, "startDelay", [ Ndt, Yl, Ldt, Fdt, Vdt ], {
89031              configurable: !0,
89032              enumerable: !0,
89033              writable: !0,
89034              initializer: function() {
89035                return new Dtt;
89036              }
89037            }), Umt = Bl(wmt.prototype, "startLifetime", [ kdt, Yl, Udt, Gdt, zdt ], {
89038              configurable: !0,
89039              enumerable: !0,
89040              writable: !0,
89041              initializer: function() {
89042                return new Dtt;
89043              }
89044            }), Gmt = Bl(wmt.prototype, "duration", [ Yl, Hdt, jdt ], {
89045              configurable: !0,
89046              enumerable: !0,
89047              writable: !0,
89048              initializer: function() {
89049                return 5;
89050              }
89051            }), zmt = Bl(wmt.prototype, "loop", [ Yl, Xdt, Wdt ], {
89052              configurable: !0,
89053              enumerable: !0,
89054              writable: !0,
89055              initializer: function() {
89056                return !0;
89057              }
89058            }), Bl(wmt.prototype, "prewarm", [ Ydt, qdt ], Object.getOwnPropertyDescriptor(wmt.prototype, "prewarm"), wmt.prototype),
89059            Bl(wmt.prototype, "simulationSpace", [ Kdt, Yl, Jdt, Zdt ], Object.getOwnPropertyDescriptor(wmt.prototype, "simulationSpace"), wmt.prototype),
89060            Hmt = Bl(wmt.prototype, "simulationSpeed", [ Yl, Qdt, $dt ], {
89061              configurable: !0,
89062              enumerable: !0,
89063              writable: !0,
89064              initializer: function() {
89065                return 1;
89066              }
89067            }), jmt = Bl(wmt.prototype, "playOnAwake", [ Yl, tpt, ept ], {
89068              configurable: !0,
89069              enumerable: !0,
89070              writable: !0,
89071              initializer: function() {
89072                return !0;
89073              }
89074            }), Xmt = Bl(wmt.prototype, "gravityModifier", [ ipt, Yl, spt, npt, rpt ], {
89075              configurable: !0,
89076              enumerable: !0,
89077              writable: !0,
89078              initializer: function() {
89079                return new Dtt;
89080              }
89081            }), Wmt = Bl(wmt.prototype, "rateOverTime", [ opt, Yl, apt, lpt, hpt ], {
89082              configurable: !0,
89083              enumerable: !0,
89084              writable: !0,
89085              initializer: function() {
89086                return new Dtt;
89087              }
89088            }), Ymt = Bl(wmt.prototype, "rateOverDistance", [ cpt, Yl, upt, _pt, dpt ], {
89089              configurable: !0,
89090              enumerable: !0,
89091              writable: !0,
89092              initializer: function() {
89093                return new Dtt;
89094              }
89095            }), qmt = Bl(wmt.prototype, "bursts", [ ppt, Yl, mpt, fpt ], {
89096              configurable: !0,
89097              enumerable: !0,
89098              writable: !0,
89099              initializer: function() {
89100                return [];
89101              }
89102            }), Bl(wmt.prototype, "renderCulling", [ gpt, ypt, bpt ], Object.getOwnPropertyDescriptor(wmt.prototype, "renderCulling"), wmt.prototype),
89103            Kmt = Bl(wmt.prototype, "_renderCulling", [ Yl ], {
89104              configurable: !0,
89105              enumerable: !0,
89106              writable: !0,
89107              initializer: function() {
89108                return !1;
89109              }
89110            }), Bl(wmt.prototype, "cullingMode", [ Spt, Apt, Tpt ], Object.getOwnPropertyDescriptor(wmt.prototype, "cullingMode"), wmt.prototype),
89111            Jmt = Bl(wmt.prototype, "_cullingMode", [ Yl ], {
89112              configurable: !0,
89113              enumerable: !0,
89114              writable: !0,
89115              initializer: function() {
89116                return dit.Pause;
89117              }
89118            }), Bl(wmt.prototype, "aabbHalfX", [ vpt, Ept, Cpt ], Object.getOwnPropertyDescriptor(wmt.prototype, "aabbHalfX"), wmt.prototype),
89119            Zmt = Bl(wmt.prototype, "_aabbHalfX", [ Yl ], {
89120              configurable: !0,
89121              enumerable: !0,
89122              writable: !0,
89123              initializer: function() {
89124                return 0;
89125              }
89126            }), Bl(wmt.prototype, "aabbHalfY", [ xpt, wpt, Rpt ], Object.getOwnPropertyDescriptor(wmt.prototype, "aabbHalfY"), wmt.prototype),
89127            Qmt = Bl(wmt.prototype, "_aabbHalfY", [ Yl ], {
89128              configurable: !0,
89129              enumerable: !0,
89130              writable: !0,
89131              initializer: function() {
89132                return 0;
89133              }
89134            }), Bl(wmt.prototype, "aabbHalfZ", [ Ipt, Mpt, Bpt ], Object.getOwnPropertyDescriptor(wmt.prototype, "aabbHalfZ"), wmt.prototype),
89135            $mt = Bl(wmt.prototype, "_aabbHalfZ", [ Yl ], {
89136              configurable: !0,
89137              enumerable: !0,
89138              writable: !0,
89139              initializer: function() {
89140                return 0;
89141              }
89142            }), Bl(wmt.prototype, "dataCulling", [ Dpt, Ppt ], Object.getOwnPropertyDescriptor(wmt.prototype, "dataCulling"), wmt.prototype),
89143            tft = Bl(wmt.prototype, "_dataCulling", [ Yl, Opt ], {
89144              configurable: !0,
89145              enumerable: !0,
89146              writable: !0,
89147              initializer: function() {
89148                return !1;
89149              }
89150            }), Bl(wmt.prototype, "sharedMaterials", [ vh, Npt, Lpt, Yl, Fpt ], Object.getOwnPropertyDescriptor(wmt.prototype, "sharedMaterials"), wmt.prototype),
89151            eft = Bl(wmt.prototype, "_colorOverLifetimeModule", [ Vpt ], {
89152              configurable: !0,
89153              enumerable: !0,
89154              writable: !0,
89155              initializer: function() {
89156                return null;
89157              }
89158            }), Bl(wmt.prototype, "colorOverLifetimeModule", [ kpt, Upt, Gpt ], Object.getOwnPropertyDescriptor(wmt.prototype, "colorOverLifetimeModule"), wmt.prototype),
89159            ift = Bl(wmt.prototype, "_shapeModule", [ zpt ], {
89160              configurable: !0,
89161              enumerable: !0,
89162              writable: !0,
89163              initializer: function() {
89164                return null;
89165              }
89166            }), Bl(wmt.prototype, "shapeModule", [ Hpt, jpt, Xpt ], Object.getOwnPropertyDescriptor(wmt.prototype, "shapeModule"), wmt.prototype),
89167            sft = Bl(wmt.prototype, "_sizeOvertimeModule", [ Wpt ], {
89168              configurable: !0,
89169              enumerable: !0,
89170              writable: !0,
89171              initializer: function() {
89172                return null;
89173              }
89174            }), Bl(wmt.prototype, "sizeOvertimeModule", [ Ypt, qpt, Kpt ], Object.getOwnPropertyDescriptor(wmt.prototype, "sizeOvertimeModule"), wmt.prototype),
89175            nft = Bl(wmt.prototype, "_velocityOvertimeModule", [ Jpt ], {
89176              configurable: !0,
89177              enumerable: !0,
89178              writable: !0,
89179              initializer: function() {
89180                return null;
89181              }
89182            }), Bl(wmt.prototype, "velocityOvertimeModule", [ Zpt, Qpt, $pt ], Object.getOwnPropertyDescriptor(wmt.prototype, "velocityOvertimeModule"), wmt.prototype),
89183            rft = Bl(wmt.prototype, "_forceOvertimeModule", [ tmt ], {
89184              configurable: !0,
89185              enumerable: !0,
89186              writable: !0,
89187              initializer: function() {
89188                return null;
89189              }
89190            }), Bl(wmt.prototype, "forceOvertimeModule", [ emt, imt, smt ], Object.getOwnPropertyDescriptor(wmt.prototype, "forceOvertimeModule"), wmt.prototype),
89191            oft = Bl(wmt.prototype, "_limitVelocityOvertimeModule", [ nmt ], {
89192              configurable: !0,
89193              enumerable: !0,
89194              writable: !0,
89195              initializer: function() {
89196                return null;
89197              }
89198            }), Bl(wmt.prototype, "limitVelocityOvertimeModule", [ rmt, omt, amt ], Object.getOwnPropertyDescriptor(wmt.prototype, "limitVelocityOvertimeModule"), wmt.prototype),
89199            aft = Bl(wmt.prototype, "_rotationOvertimeModule", [ lmt ], {
89200              configurable: !0,
89201              enumerable: !0,
89202              writable: !0,
89203              initializer: function() {
89204                return null;
89205              }
89206            }), Bl(wmt.prototype, "rotationOvertimeModule", [ hmt, cmt, umt ], Object.getOwnPropertyDescriptor(wmt.prototype, "rotationOvertimeModule"), wmt.prototype),
89207            lft = Bl(wmt.prototype, "_textureAnimationModule", [ _mt ], {
89208              configurable: !0,
89209              enumerable: !0,
89210              writable: !0,
89211              initializer: function() {
89212                return null;
89213              }
89214            }), Bl(wmt.prototype, "textureAnimationModule", [ dmt, pmt, mmt ], Object.getOwnPropertyDescriptor(wmt.prototype, "textureAnimationModule"), wmt.prototype),
89215            hft = Bl(wmt.prototype, "_noiseModule", [ fmt ], {
89216              configurable: !0,
89217              enumerable: !0,
89218              writable: !0,
89219              initializer: function() {
89220                return null;
89221              }
89222            }), Bl(wmt.prototype, "noiseModule", [ gmt, ymt ], Object.getOwnPropertyDescriptor(wmt.prototype, "noiseModule"), wmt.prototype),
89223            cft = Bl(wmt.prototype, "_trailModule", [ bmt ], {
89224              configurable: !0,
89225              enumerable: !0,
89226              writable: !0,
89227              initializer: function() {
89228                return null;
89229              }
89230            }), Bl(wmt.prototype, "trailModule", [ Smt, Amt, Tmt ], Object.getOwnPropertyDescriptor(wmt.prototype, "trailModule"), wmt.prototype),
89231            uft = Bl(wmt.prototype, "renderer", [ vmt, Yl, Emt, Cmt ], {
89232              configurable: !0,
89233              enumerable: !0,
89234              writable: !0,
89235              initializer: function() {
89236                return new cct;
89237              }
89238            }), _ft = Bl(wmt.prototype, "_prewarm", [ Yl ], {
89239              configurable: !0,
89240              enumerable: !0,
89241              writable: !0,
89242              initializer: function() {
89243                return !1;
89244              }
89245            }), dft = Bl(wmt.prototype, "_capacity", [ Yl ], {
89246              configurable: !0,
89247              enumerable: !0,
89248              writable: !0,
89249              initializer: function() {
89250                return 100;
89251              }
89252            }), pft = Bl(wmt.prototype, "_simulationSpace", [ Yl ], {
89253              configurable: !0,
89254              enumerable: !0,
89255              writable: !0,
89256              initializer: function() {
89257                return _it.Local;
89258              }
89259            }), wmt)) || xmt) || xmt) || xmt) || xmt) || xmt));
89260            class Aft {
89261              static instantiate(t) {
89262                if (!this.registeredSceneEvent) {
89263                  IR.on(RR.EVENT_BEFORE_SCENE_LAUNCH, this.onSceneUnload, this);
89264                  this.registeredSceneEvent = !0;
89265                }
89266                this.particleSystemPool.has(t._uuid) || this.particleSystemPool.set(t._uuid, new $r((() => d_(t) || new _y), 1, (t => t.destroy())));
89267                return this.particleSystemPool.get(t._uuid).alloc();
89268              }
89269              static destroy(t) {
89270                if (this.particleSystemPool.has(t._prefab.asset._uuid)) {
89271                  this.stop(t);
89272                  this.particleSystemPool.get(t._prefab.asset._uuid).free(t);
89273                }
89274              }
89275              static play(t) {
89276                for (const e of t.getComponentsInChildren(Sft)) e.play();
89277              }
89278              static stop(t) {
89279                for (const e of t.getComponentsInChildren(Sft)) e.stop();
89280              }
89281              static onSceneUnload() {
89282                this.particleSystemPool.forEach((t => t.destroy()));
89283                this.particleSystemPool.clear();
89284              }
89285            }
89286            t("ParticleUtils", Aft);
89287            Aft.particleSystemPool = new Map;
89288            Aft.registeredSceneEvent = !1;
89289            Y(sat.prototype, "Burst.prototype", [ {
89290              name: "minCount"
89291            }, {
89292              name: "maxCount"
89293            } ]);
89294            W(Sft.prototype, "ParticleSystem.prototype", [ {
89295              name: "enableCulling",
89296              newName: "dataCulling"
89297            } ]);
89298            m.ParticleSystemComponent = Sft;
89299            ee.setClassAlias(Sft, "cc.ParticleSystemComponent");
89300            m.BillboardComponent = Att;
89301            ee.setClassAlias(Att, "cc.BillboardComponent");
89302            m.LineComponent = $et;
89303            ee.setClassAlias($et, "cc.LineComponent");
89304            m.ParticleUtils = Aft;
89305            const Tft = oe({
89306              GRAVITY: 0,
89307              RADIUS: 1
89308            });
89309            const vft = oe({
89310              FREE: 0,
89311              RELATIVE: 1,
89312              GROUPED: 2
89313            });
89314            const Eft = new Qi(0, 0);
89315            const Cft = new Qi;
89316            const xft = new Qi;
89317            const wft = new Qi;
89318            const Rft = new Qi;
89319            const Ift = WM(zM);
89320            class Mft {
89321              constructor() {
89322                this.pos = new Qi(0, 0);
89323                this.startPos = new Qi(0, 0);
89324                this.color = new Bi(0, 0, 0, 255);
89325                this.deltaColor = {
89326                  r: 0,
89327                  g: 0,
89328                  b: 0,
89329                  a: 255
89330                };
89331                this.size = 0;
89332                this.deltaSize = 0;
89333                this.rotation = 0;
89334                this.deltaRotation = 0;
89335                this.timeToLive = 0;
89336                this.drawPos = new Qi(0, 0);
89337                this.aspectRatio = 1;
89338                this.dir = new Qi(0, 0);
89339                this.radialAccel = 0;
89340                this.tangentialAccel = 0;
89341                this.angle = 0;
89342                this.degreesPerSecond = 0;
89343                this.radius = 0;
89344                this.deltaRadius = 0;
89345              }
89346            }
89347            const Bft = new class extends $t {
89348              get() {
89349                return this._get() || new Mft;
89350              }
89351            }((t => {
89352              t.pos.set(Eft);
89353              t.startPos.set(Eft);
89354              t.color._val = 4278190080;
89355              t.deltaColor.r = t.deltaColor.g = t.deltaColor.b = 0;
89356              t.deltaColor.a = 255;
89357              t.size = 0;
89358              t.deltaSize = 0;
89359              t.rotation = 0;
89360              t.deltaRotation = 0;
89361              t.timeToLive = 0;
89362              t.drawPos.set(Eft);
89363              t.aspectRatio = 1;
89364              t.dir.set(Eft);
89365              t.radialAccel = 0;
89366              t.tangentialAccel = 0;
89367              t.angle = 0;
89368              t.degreesPerSecond = 0;
89369              t.radius = 0;
89370              t.deltaRadius = 0;
89371            }), 1024);
89372            class Dft {
89373              constructor(t) {
89374                this.particles = [];
89375                this.active = !1;
89376                this.uvFilled = 0;
89377                this.finished = !1;
89378                this.readyToPlay = !0;
89379                this.elapsed = 0;
89380                this.emitCounter = 0;
89381                this._worldRotation = 0;
89382                this.sys = t;
89383                this.particles = [];
89384                this.active = !1;
89385                this.readyToPlay = !0;
89386                this.finished = !1;
89387                this.elapsed = 0;
89388                this.emitCounter = 0;
89389                this.uvFilled = 0;
89390                this._worldRotation = 0;
89391              }
89392              stop() {
89393                this.active = !1;
89394                this.readyToPlay = !1;
89395                this.elapsed = this.sys.duration;
89396                this.emitCounter = 0;
89397              }
89398              reset() {
89399                this.active = !0;
89400                this.readyToPlay = !0;
89401                this.elapsed = 0;
89402                this.emitCounter = 0;
89403                this.finished = !1;
89404                const t = this.particles;
89405                for (let e = 0; e < t.length; ++e) Bft.put(t[e]);
89406                t.length = 0;
89407              }
89408              emitParticle(t) {
89409                const e = this.sys;
89410                const i = Bft.get();
89411                this.particles.push(i);
89412                i.timeToLive = e.life + e.lifeVar * (Math.random() - .5) * 2;
89413                const s = i.timeToLive = Math.max(0, i.timeToLive);
89414                i.pos.x = e.sourcePos.x + e.posVar.x * (Math.random() - .5) * 2;
89415                i.pos.y = e.sourcePos.y + e.posVar.y * (Math.random() - .5) * 2;
89416                let n = 0;
89417                let r = 0;
89418                let o = 0;
89419                let a = 0;
89420                const l = e.startColor;
89421                const h = e.startColorVar;
89422                const c = e.endColor;
89423                const u = e.endColorVar;
89424                i.color.r = n = Ee(l.r + h.r * (Math.random() - .5) * 2, 0, 255);
89425                i.color.g = r = Ee(l.g + h.g * (Math.random() - .5) * 2, 0, 255);
89426                i.color.b = o = Ee(l.b + h.b * (Math.random() - .5) * 2, 0, 255);
89427                i.color.a = a = Ee(l.a + h.a * (Math.random() - .5) * 2, 0, 255);
89428                i.deltaColor.r = (Ee(c.r + u.r * (Math.random() - .5) * 2, 0, 255) - n) / s;
89429                i.deltaColor.g = (Ee(c.g + u.g * (Math.random() - .5) * 2, 0, 255) - r) / s;
89430                i.deltaColor.b = (Ee(c.b + u.b * (Math.random() - .5) * 2, 0, 255) - o) / s;
89431                i.deltaColor.a = (Ee(c.a + u.a * (Math.random() - .5) * 2, 0, 255) - a) / s;
89432                let _ = e.startSize + e.startSizeVar * (Math.random() - .5) * 2;
89433                _ = Math.max(0, _);
89434                i.size = _;
89435                if (-1 === e.endSize) i.deltaSize = 0; else {
89436                  let t = e.endSize + e.endSizeVar * (Math.random() - .5) * 2;
89437                  t = Math.max(0, t);
89438                  i.deltaSize = (t - _) / s;
89439                }
89440                const d = e.startSpin + e.startSpinVar * (Math.random() - .5) * 2;
89441                const p = e.endSpin + e.endSpinVar * (Math.random() - .5) * 2;
89442                i.rotation = d;
89443                i.deltaRotation = (p - d) / s;
89444                i.startPos.x = t.x;
89445                i.startPos.y = t.y;
89446                i.aspectRatio = e.aspectRatio || 1;
89447                const m = Ce(e.angle + this._worldRotation + e.angleVar * (Math.random() - .5) * 2);
89448                if (e.emitterMode === Tft.GRAVITY) {
89449                  const t = e.speed + e.speedVar * (Math.random() - .5) * 2;
89450                  i.dir.x = Math.cos(m);
89451                  i.dir.y = Math.sin(m);
89452                  i.dir.multiplyScalar(t);
89453                  i.radialAccel = e.radialAccel + e.radialAccelVar * (Math.random() - .5) * 2;
89454                  i.tangentialAccel = e.tangentialAccel + e.tangentialAccelVar * (Math.random() - .5) * 2;
89455                  e.rotationIsDir && (i.rotation = -xe(Math.atan2(i.dir.y, i.dir.x)));
89456                } else {
89457                  const t = e.startRadius + e.startRadiusVar * (Math.random() - .5) * 2;
89458                  const n = e.endRadius + e.endRadiusVar * (Math.random() - .5) * 2;
89459                  i.radius = t;
89460                  i.deltaRadius = -1 === e.endRadius ? 0 : (n - t) / s;
89461                  i.angle = m;
89462                  i.degreesPerSecond = Ce(e.rotatePerS + e.rotatePerSVar * (Math.random() - .5) * 2);
89463                }
89464              }
89465              updateUVs(t) {
89466                const e = this.renderData;
89467                if (e && this.sys._renderSpriteFrame) {
89468                  const i = e.vData;
89469                  const s = this.sys._renderSpriteFrame.uv;
89470                  const n = t ? 0 : this.uvFilled;
89471                  const r = this.particles.length;
89472                  for (let t = n; t < r; t++) {
89473                    const e = t * Ift * 4;
89474                    i[e + 3] = s[0];
89475                    i[e + 4] = s[1];
89476                    i[e + 12] = s[2];
89477                    i[e + 13] = s[3];
89478                    i[e + 21] = s[4];
89479                    i[e + 22] = s[5];
89480                    i[e + 30] = s[6];
89481                    i[e + 31] = s[7];
89482                  }
89483                  this.uvFilled = r;
89484                }
89485              }
89486              updateParticleBuffer(t, e, i, s) {
89487                const n = i.vData;
89488                const r = e.x;
89489                const o = e.y;
89490                let a = t.size;
89491                let l = a;
89492                const h = t.aspectRatio;
89493                h > 1 ? l = a / h : a = l * h;
89494                const c = a / 2;
89495                const u = l / 2;
89496                if (t.rotation) {
89497                  const e = -c;
89498                  const i = -u;
89499                  const a = c;
89500                  const l = u;
89501                  const h = -Ce(t.rotation);
89502                  const _ = Math.cos(h);
89503                  const d = Math.sin(h);
89504                  n[s] = e * _ - i * d + r;
89505                  n[s + 1] = e * d + i * _ + o;
89506                  n[s + 2] = 0;
89507                  n[s + 9] = a * _ - i * d + r;
89508                  n[s + 10] = a * d + i * _ + o;
89509                  n[s + 11] = 0;
89510                  n[s + 18] = e * _ - l * d + r;
89511                  n[s + 19] = e * d + l * _ + o;
89512                  n[s + 20] = 0;
89513                  n[s + 27] = a * _ - l * d + r;
89514                  n[s + 28] = a * d + l * _ + o;
89515                  n[s + 29] = 0;
89516                } else {
89517                  n[s] = r - c;
89518                  n[s + 1] = o - u;
89519                  n[s + 2] = 0;
89520                  n[s + 9] = r + c;
89521                  n[s + 10] = o - u;
89522                  n[s + 11] = 0;
89523                  n[s + 18] = r - c;
89524                  n[s + 19] = o + u;
89525                  n[s + 20] = 0;
89526                  n[s + 27] = r + c;
89527                  n[s + 28] = o + u;
89528                  n[s + 29] = 0;
89529                }
89530                Bi.toArray(n, t.color, s + 5);
89531                Bi.toArray(n, t.color, s + 14);
89532                Bi.toArray(n, t.color, s + 23);
89533                Bi.toArray(n, t.color, s + 32);
89534              }
89535              step(t) {
89536                const e = this.sys.assembler;
89537                const i = this.sys;
89538                const s = i.node;
89539                const n = this.particles;
89540                t = t > e.maxParticleDeltaTime ? e.maxParticleDeltaTime : t;
89541                s.updateWorldTransform();
89542                if (i.positionType === vft.FREE) {
89543                  this._worldRotation = function(t) {
89544                    let e = 0;
89545                    let i = t;
89546                    for (;i; ) {
89547                      e += i.eulerAngles.z;
89548                      i = i.parent;
89549                    }
89550                    return e;
89551                  }(s);
89552                  const t = s.worldMatrix;
89553                  Cft.x = t.m12;
89554                  Cft.y = t.m13;
89555                } else if (i.positionType === vft.RELATIVE) {
89556                  this._worldRotation = s.eulerAngles.z;
89557                  Cft.x = s.position.x;
89558                  Cft.y = s.position.y;
89559                } else this._worldRotation = 0;
89560                if (this.active && i.emissionRate) {
89561                  const e = 1 / i.emissionRate;
89562                  n.length < i.totalParticles && (this.emitCounter += t);
89563                  for (;n.length < i.totalParticles && this.emitCounter > e; ) {
89564                    this.emitParticle(Cft);
89565                    this.emitCounter -= e;
89566                  }
89567                  this.elapsed += t;
89568                  -1 !== i.duration && i.duration < this.elapsed && i.stopSystem();
89569                }
89570                const r = this.renderData;
89571                const o = n.length;
89572                r.reset();
89573                this.requestData(4 * o, 6 * o);
89574                o > this.uvFilled && this.updateUVs();
89575                let a = 0;
89576                for (;a < n.length; ) {
89577                  xft.x = xft.y = wft.x = wft.y = Rft.x = Rft.y = 0;
89578                  const e = n[a];
89579                  e.timeToLive -= t;
89580                  if (e.timeToLive > 0) {
89581                    if (i.emitterMode === Tft.GRAVITY) {
89582                      const s = Rft;
89583                      const n = xft;
89584                      const r = wft;
89585                      if (e.pos.x || e.pos.y) {
89586                        n.set(e.pos);
89587                        n.normalize();
89588                      }
89589                      r.set(n);
89590                      n.multiplyScalar(e.radialAccel);
89591                      const o = r.x;
89592                      r.x = -r.y;
89593                      r.y = o;
89594                      r.multiplyScalar(e.tangentialAccel);
89595                      s.set(n);
89596                      s.add(r);
89597                      s.add(i.gravity);
89598                      s.multiplyScalar(t);
89599                      e.dir.add(s);
89600                      s.set(e.dir);
89601                      s.multiplyScalar(t);
89602                      e.pos.add(s);
89603                    } else {
89604                      e.angle += e.degreesPerSecond * t;
89605                      e.radius += e.deltaRadius * t;
89606                      e.pos.x = -Math.cos(e.angle) * e.radius;
89607                      e.pos.y = -Math.sin(e.angle) * e.radius;
89608                    }
89609                    e.color.r += e.deltaColor.r * t;
89610                    e.color.g += e.deltaColor.g * t;
89611                    e.color.b += e.deltaColor.b * t;
89612                    e.color.a += e.deltaColor.a * t;
89613                    e.size += e.deltaSize * t;
89614                    e.size < 0 && (e.size = 0);
89615                    e.rotation += e.deltaRotation * t;
89616                    const s = xft;
89617                    s.set(e.pos);
89618                    i.positionType !== vft.GROUPED && s.add(e.startPos);
89619                    const n = Ift * a * 4;
89620                    this.updateParticleBuffer(e, s, r, n);
89621                    ++a;
89622                  } else {
89623                    const t = n[a];
89624                    a !== n.length - 1 && (n[a] = n[n.length - 1]);
89625                    Bft.put(t);
89626                    n.length--;
89627                    r.resize(r.vertexCount - 4, r.indexCount - 6);
89628                  }
89629                }
89630                this.renderData.material = this.sys.getRenderMaterial(0);
89631                this.renderData.frame = this.sys._renderSpriteFrame;
89632                r.setRenderDrawInfoAttributes();
89633                if (0 === n.length && !this.active && !this.readyToPlay) {
89634                  this.finished = !0;
89635                  i._finishedSimulation();
89636                }
89637              }
89638              requestData(t, e) {
89639                let i = this.renderData.indexCount;
89640                this.renderData.request(t, e);
89641                const s = this.renderData.indexCount / 6;
89642                const n = this.renderData.iData;
89643                for (let t = i; t < s; t++) {
89644                  const e = 4 * t;
89645                  n[i++] = e;
89646                  n[i++] = e + 1;
89647                  n[i++] = e + 2;
89648                  n[i++] = e + 1;
89649                  n[i++] = e + 3;
89650                  n[i++] = e + 2;
89651                }
89652              }
89653              initDrawInfo() {
89654                this.renderData.setRenderDrawInfoAttributes();
89655              }
89656            }
89657            var Pft, Oft, Nft;
89658            let Lft = t("ParticleAsset", Ul("cc.ParticleAsset")(Pft = (Oft = class extends gc {
89659              constructor(...t) {
89660                super(...t);
89661                Ml(this, "spriteFrame", Nft, this);
89662              }
89663            }, Nft = Bl(Oft.prototype, "spriteFrame", [ Yl, nh ], {
89664              configurable: !0,
89665              enumerable: !0,
89666              writable: !0,
89667              initializer: function() {
89668                return null;
89669              }
89670            }), Oft)) || Pft);
89671            m.ParticleAsset = Lft;
89672            var Fft = {};
89673            (function() {
89674              function t(t) {
89675                throw t;
89676              }
89677              var e = void 0, i = !0, s = this;
89678              function n(t, i) {
89679                var n = t.split("."), r = s;
89680                !(n[0] in r) && r.execScript && r.execScript("var " + n[0]);
89681                for (var o; n.length && (o = n.shift()); ) n.length || i === e ? r = r[o] ? r[o] : r[o] = {} : r[o] = i;
89682              }
89683              var r = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array;
89684              function o(t) {
89685                if ("string" == typeof t) {
89686                  var e, i, s = t.split("");
89687                  e = 0;
89688                  for (i = s.length; e < i; e++) s[e] = (255 & s[e].charCodeAt(0)) >>> 0;
89689                  t = s;
89690                }
89691                for (var n, r = 1, o = 0, a = t.length, l = 0; 0 < a; ) {
89692                  a -= n = 1024 < a ? 1024 : a;
89693                  do {
89694                    o += r += t[l++];
89695                  } while (--n);
89696                  r %= 65521;
89697                  o %= 65521;
89698                }
89699                return (o << 16 | r) >>> 0;
89700              }
89701              function a(e, i) {
89702                this.index = "number" == typeof i ? i : 0;
89703                this.i = 0;
89704                this.buffer = e instanceof (r ? Uint8Array : Array) ? e : new (r ? Uint8Array : Array)(32768);
89705                2 * this.buffer.length <= this.index && t(Error("invalid index"));
89706                this.buffer.length <= this.index && this.f();
89707              }
89708              a.prototype.f = function() {
89709                var t, e = this.buffer, i = e.length, s = new (r ? Uint8Array : Array)(i << 1);
89710                if (r) s.set(e); else for (t = 0; t < i; ++t) s[t] = e[t];
89711                return this.buffer = s;
89712              };
89713              a.prototype.d = function(t, e, i) {
89714                var s, n = this.buffer, r = this.index, o = this.i, a = n[r];
89715                i && 1 < e && (t = 8 < e ? (d[255 & t] << 24 | d[t >>> 8 & 255] << 16 | d[t >>> 16 & 255] << 8 | d[t >>> 24 & 255]) >> 32 - e : d[t] >> 8 - e);
89716                if (8 > e + o) a = a << e | t, o += e; else for (s = 0; s < e; ++s) a = a << 1 | t >> e - s - 1 & 1,
89717                8 == ++o && (o = 0, n[r++] = d[a], a = 0, r === n.length && (n = this.f()));
89718                n[r] = a;
89719                this.buffer = n;
89720                this.i = o;
89721                this.index = r;
89722              };
89723              a.prototype.finish = function() {
89724                var t, e = this.buffer, i = this.index;
89725                0 < this.i && (e[i] <<= 8 - this.i, e[i] = d[e[i]], i++);
89726                r ? t = e.subarray(0, i) : (e.length = i, t = e);
89727                return t;
89728              };
89729              var l, h = new (r ? Uint8Array : Array)(256);
89730              for (l = 0; 256 > l; ++l) {
89731                for (var c = _ = l, u = 7, _ = _ >>> 1; _; _ >>>= 1) c <<= 1, c |= 1 & _, --u;
89732                h[l] = (c << u & 255) >>> 0;
89733              }
89734              var d = h;
89735              function p(t) {
89736                this.buffer = new (r ? Uint16Array : Array)(2 * t);
89737                this.length = 0;
89738              }
89739              p.prototype.getParent = function(t) {
89740                return 2 * ((t - 2) / 4 | 0);
89741              };
89742              p.prototype.push = function(t, e) {
89743                var i, s, n, r = this.buffer;
89744                i = this.length;
89745                r[this.length++] = e;
89746                for (r[this.length++] = t; 0 < i && (s = this.getParent(i), r[i] > r[s]); ) n = r[i],
89747                r[i] = r[s], r[s] = n, n = r[i + 1], r[i + 1] = r[s + 1], r[s + 1] = n, i = s;
89748                return this.length;
89749              };
89750              p.prototype.pop = function() {
89751                var t, e, i, s, n, r = this.buffer;
89752                e = r[0];
89753                t = r[1];
89754                this.length -= 2;
89755                r[0] = r[this.length];
89756                r[1] = r[this.length + 1];
89757                for (n = 0; !((s = 2 * n + 2) >= this.length); ) {
89758                  s + 2 < this.length && r[s + 2] > r[s] && (s += 2);
89759                  if (!(r[s] > r[n])) break;
89760                  i = r[n], r[n] = r[s], r[s] = i, i = r[n + 1], r[n + 1] = r[s + 1], r[s + 1] = i;
89761                  n = s;
89762                }
89763                return {
89764                  index: t,
89765                  value: e,
89766                  length: this.length
89767                };
89768              };
89769              function m(t) {
89770                var e, i, s, n, o, a, l, h, c, u = t.length, _ = 0, d = Number.POSITIVE_INFINITY;
89771                for (h = 0; h < u; ++h) t[h] > _ && (_ = t[h]), t[h] < d && (d = t[h]);
89772                e = 1 << _;
89773                i = new (r ? Uint32Array : Array)(e);
89774                s = 1;
89775                n = 0;
89776                for (o = 2; s <= _; ) {
89777                  for (h = 0; h < u; ++h) if (t[h] === s) {
89778                    a = 0;
89779                    l = n;
89780                    for (c = 0; c < s; ++c) a = a << 1 | 1 & l, l >>= 1;
89781                    for (c = a; c < e; c += o) i[c] = s << 16 | h;
89782                    ++n;
89783                  }
89784                  ++s;
89785                  n <<= 1;
89786                  o <<= 1;
89787                }
89788                return [ i, _, d ];
89789              }
89790              function f(t, e) {
89791                this.h = y;
89792                this.w = 0;
89793                this.input = t;
89794                this.b = 0;
89795                e && (e.lazy && (this.w = e.lazy), "number" == typeof e.compressionType && (this.h = e.compressionType),
89796                e.outputBuffer && (this.a = r && e.outputBuffer instanceof Array ? new Uint8Array(e.outputBuffer) : e.outputBuffer),
89797                "number" == typeof e.outputIndex && (this.b = e.outputIndex));
89798                this.a || (this.a = new (r ? Uint8Array : Array)(32768));
89799              }
89800              var g, y = 2, b = {
89801                NONE: 0,
89802                r: 1,
89803                j: y,
89804                N: 3
89805              }, S = [];
89806              for (g = 0; 288 > g; g++) switch (i) {
89807               case 143 >= g:
89808                S.push([ g + 48, 8 ]);
89809                break;
89810
89811               case 255 >= g:
89812                S.push([ g - 144 + 400, 9 ]);
89813                break;
89814
89815               case 279 >= g:
89816                S.push([ g - 256 + 0, 7 ]);
89817                break;
89818
89819               case 287 >= g:
89820                S.push([ g - 280 + 192, 8 ]);
89821                break;
89822
89823               default:
89824                t("invalid literal: " + g);
89825              }
89826              f.prototype.n = function() {
89827                var s, n, o, l, h = this.input;
89828                switch (this.h) {
89829                 case 0:
89830                  o = 0;
89831                  for (l = h.length; o < l; ) {
89832                    var c, u, _, d = n = r ? h.subarray(o, o + 65535) : h.slice(o, o + 65535), p = (o += n.length) === l, m = e, f = e, g = this.a, b = this.b;
89833                    if (r) {
89834                      for (g = new Uint8Array(this.a.buffer); g.length <= b + d.length + 5; ) g = new Uint8Array(g.length << 1);
89835                      g.set(this.a);
89836                    }
89837                    c = p ? 1 : 0;
89838                    g[b++] = 0 | c;
89839                    _ = 65536 + ~(u = d.length) & 65535;
89840                    g[b++] = 255 & u;
89841                    g[b++] = u >>> 8 & 255;
89842                    g[b++] = 255 & _;
89843                    g[b++] = _ >>> 8 & 255;
89844                    if (r) g.set(d, b), b += d.length, g = g.subarray(0, b); else {
89845                      m = 0;
89846                      for (f = d.length; m < f; ++m) g[b++] = d[m];
89847                      g.length = b;
89848                    }
89849                    this.b = b;
89850                    this.a = g;
89851                  }
89852                  break;
89853
89854                 case 1:
89855                  var A = new a(new Uint8Array(this.a.buffer), this.b);
89856                  A.d(1, 1, i);
89857                  A.d(1, 2, i);
89858                  var T, v, E, C = w(this, h);
89859                  T = 0;
89860                  for (v = C.length; T < v; T++) if (E = C[T], a.prototype.d.apply(A, S[E]), 256 < E) A.d(C[++T], C[++T], i),
89861                  A.d(C[++T], 5), A.d(C[++T], C[++T], i); else if (256 === E) break;
89862                  this.a = A.finish();
89863                  this.b = this.a.length;
89864                  break;
89865
89866                 case y:
89867                  var x, M, B, D, P, O, N, L, F, V, k, U, G, z, H, j = new a(new Uint8Array(this.a), this.b), X = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], W = Array(19);
89868                  x = y;
89869                  j.d(1, 1, i);
89870                  j.d(x, 2, i);
89871                  M = w(this, h);
89872                  N = I(O = R(this.L, 15));
89873                  F = I(L = R(this.K, 7));
89874                  for (B = 286; 257 < B && 0 === O[B - 1]; B--) ;
89875                  for (D = 30; 1 < D && 0 === L[D - 1]; D--) ;
89876                  var Y, q, K, J, Z, Q, $ = B, tt = D, et = new (r ? Uint32Array : Array)($ + tt), it = new (r ? Uint32Array : Array)(316), st = new (r ? Uint8Array : Array)(19);
89877                  for (Y = q = 0; Y < $; Y++) et[q++] = O[Y];
89878                  for (Y = 0; Y < tt; Y++) et[q++] = L[Y];
89879                  if (!r) {
89880                    Y = 0;
89881                    for (J = st.length; Y < J; ++Y) st[Y] = 0;
89882                  }
89883                  Y = Z = 0;
89884                  for (J = et.length; Y < J; Y += q) {
89885                    for (q = 1; Y + q < J && et[Y + q] === et[Y]; ++q) ;
89886                    K = q;
89887                    if (0 === et[Y]) if (3 > K) for (;0 < K--; ) it[Z++] = 0, st[0]++; else for (;0 < K; ) (Q = 138 > K ? K : 138) > K - 3 && Q < K && (Q = K - 3),
89888                    10 >= Q ? (it[Z++] = 17, it[Z++] = Q - 3, st[17]++) : (it[Z++] = 18, it[Z++] = Q - 11,
89889                    st[18]++), K -= Q; else if (it[Z++] = et[Y], st[et[Y]]++, 3 > --K) for (;0 < K--; ) it[Z++] = et[Y],
89890                    st[et[Y]]++; else for (;0 < K; ) (Q = 6 > K ? K : 6) > K - 3 && Q < K && (Q = K - 3),
89891                    it[Z++] = 16, it[Z++] = Q - 3, st[16]++, K -= Q;
89892                  }
89893                  s = r ? it.subarray(0, Z) : it.slice(0, Z);
89894                  V = R(st, 7);
89895                  for (z = 0; 19 > z; z++) W[z] = V[X[z]];
89896                  for (P = 19; 4 < P && 0 === W[P - 1]; P--) ;
89897                  k = I(V);
89898                  j.d(B - 257, 5, i);
89899                  j.d(D - 1, 5, i);
89900                  j.d(P - 4, 4, i);
89901                  for (z = 0; z < P; z++) j.d(W[z], 3, i);
89902                  z = 0;
89903                  for (H = s.length; z < H; z++) if (U = s[z], j.d(k[U], V[U], i), 16 <= U) {
89904                    z++;
89905                    switch (U) {
89906                     case 16:
89907                      G = 2;
89908                      break;
89909
89910                     case 17:
89911                      G = 3;
89912                      break;
89913
89914                     case 18:
89915                      G = 7;
89916                      break;
89917
89918                     default:
89919                      t("invalid code: " + U);
89920                    }
89921                    j.d(s[z], G, i);
89922                  }
89923                  var nt, rt, ot, at, lt, ht, ct, ut, _t = [ N, O ], dt = [ F, L ];
89924                  lt = _t[0];
89925                  ht = _t[1];
89926                  ct = dt[0];
89927                  ut = dt[1];
89928                  nt = 0;
89929                  for (rt = M.length; nt < rt; ++nt) if (ot = M[nt], j.d(lt[ot], ht[ot], i), 256 < ot) j.d(M[++nt], M[++nt], i),
89930                  at = M[++nt], j.d(ct[at], ut[at], i), j.d(M[++nt], M[++nt], i); else if (256 === ot) break;
89931                  this.a = j.finish();
89932                  this.b = this.a.length;
89933                  break;
89934
89935                 default:
89936                  t("invalid compression type");
89937                }
89938                return this.a;
89939              };
89940              function A(t, e) {
89941                this.length = t;
89942                this.G = e;
89943              }
89944              function T() {
89945                var e = v;
89946                switch (i) {
89947                 case 3 === e:
89948                  return [ 257, e - 3, 0 ];
89949
89950                 case 4 === e:
89951                  return [ 258, e - 4, 0 ];
89952
89953                 case 5 === e:
89954                  return [ 259, e - 5, 0 ];
89955
89956                 case 6 === e:
89957                  return [ 260, e - 6, 0 ];
89958
89959                 case 7 === e:
89960                  return [ 261, e - 7, 0 ];
89961
89962                 case 8 === e:
89963                  return [ 262, e - 8, 0 ];
89964
89965                 case 9 === e:
89966                  return [ 263, e - 9, 0 ];
89967
89968                 case 10 === e:
89969                  return [ 264, e - 10, 0 ];
89970
89971                 case 12 >= e:
89972                  return [ 265, e - 11, 1 ];
89973
89974                 case 14 >= e:
89975                  return [ 266, e - 13, 1 ];
89976
89977                 case 16 >= e:
89978                  return [ 267, e - 15, 1 ];
89979
89980                 case 18 >= e:
89981                  return [ 268, e - 17, 1 ];
89982
89983                 case 22 >= e:
89984                  return [ 269, e - 19, 2 ];
89985
89986                 case 26 >= e:
89987                  return [ 270, e - 23, 2 ];
89988
89989                 case 30 >= e:
89990                  return [ 271, e - 27, 2 ];
89991
89992                 case 34 >= e:
89993                  return [ 272, e - 31, 2 ];
89994
89995                 case 42 >= e:
89996                  return [ 273, e - 35, 3 ];
89997
89998                 case 50 >= e:
89999                  return [ 274, e - 43, 3 ];
90000
90001                 case 58 >= e:
90002                  return [ 275, e - 51, 3 ];
90003
90004                 case 66 >= e:
90005                  return [ 276, e - 59, 3 ];
90006
90007                 case 82 >= e:
90008                  return [ 277, e - 67, 4 ];
90009
90010                 case 98 >= e:
90011                  return [ 278, e - 83, 4 ];
90012
90013                 case 114 >= e:
90014                  return [ 279, e - 99, 4 ];
90015
90016                 case 130 >= e:
90017                  return [ 280, e - 115, 4 ];
90018
90019                 case 162 >= e:
90020                  return [ 281, e - 131, 5 ];
90021
90022                 case 194 >= e:
90023                  return [ 282, e - 163, 5 ];
90024
90025                 case 226 >= e:
90026                  return [ 283, e - 195, 5 ];
90027
90028                 case 257 >= e:
90029                  return [ 284, e - 227, 5 ];
90030
90031                 case 258 === e:
90032                  return [ 285, e - 258, 0 ];
90033
90034                 default:
90035                  t("invalid length: " + e);
90036                }
90037              }
90038              var v, E, C = [];
90039              for (v = 3; 258 >= v; v++) E = T(), C[v] = E[2] << 24 | E[1] << 16 | E[0];
90040              var x = r ? new Uint32Array(C) : C;
90041              function w(s, n) {
90042                function o(e, s) {
90043                  var n, r = e.G, o = [], a = 0;
90044                  n = x[e.length];
90045                  o[a++] = 65535 & n;
90046                  o[a++] = n >> 16 & 255;
90047                  o[a++] = n >> 24;
90048                  var l;
90049                  switch (i) {
90050                   case 1 === r:
90051                    l = [ 0, r - 1, 0 ];
90052                    break;
90053
90054                   case 2 === r:
90055                    l = [ 1, r - 2, 0 ];
90056                    break;
90057
90058                   case 3 === r:
90059                    l = [ 2, r - 3, 0 ];
90060                    break;
90061
90062                   case 4 === r:
90063                    l = [ 3, r - 4, 0 ];
90064                    break;
90065
90066                   case 6 >= r:
90067                    l = [ 4, r - 5, 1 ];
90068                    break;
90069
90070                   case 8 >= r:
90071                    l = [ 5, r - 7, 1 ];
90072                    break;
90073
90074                   case 12 >= r:
90075                    l = [ 6, r - 9, 2 ];
90076                    break;
90077
90078                   case 16 >= r:
90079                    l = [ 7, r - 13, 2 ];
90080                    break;
90081
90082                   case 24 >= r:
90083                    l = [ 8, r - 17, 3 ];
90084                    break;
90085
90086                   case 32 >= r:
90087                    l = [ 9, r - 25, 3 ];
90088                    break;
90089
90090                   case 48 >= r:
90091                    l = [ 10, r - 33, 4 ];
90092                    break;
90093
90094                   case 64 >= r:
90095                    l = [ 11, r - 49, 4 ];
90096                    break;
90097
90098                   case 96 >= r:
90099                    l = [ 12, r - 65, 5 ];
90100                    break;
90101
90102                   case 128 >= r:
90103                    l = [ 13, r - 97, 5 ];
90104                    break;
90105
90106                   case 192 >= r:
90107                    l = [ 14, r - 129, 6 ];
90108                    break;
90109
90110                   case 256 >= r:
90111                    l = [ 15, r - 193, 6 ];
90112                    break;
90113
90114                   case 384 >= r:
90115                    l = [ 16, r - 257, 7 ];
90116                    break;
90117
90118                   case 512 >= r:
90119                    l = [ 17, r - 385, 7 ];
90120                    break;
90121
90122                   case 768 >= r:
90123                    l = [ 18, r - 513, 8 ];
90124                    break;
90125
90126                   case 1024 >= r:
90127                    l = [ 19, r - 769, 8 ];
90128                    break;
90129
90130                   case 1536 >= r:
90131                    l = [ 20, r - 1025, 9 ];
90132                    break;
90133
90134                   case 2048 >= r:
90135                    l = [ 21, r - 1537, 9 ];
90136                    break;
90137
90138                   case 3072 >= r:
90139                    l = [ 22, r - 2049, 10 ];
90140                    break;
90141
90142                   case 4096 >= r:
90143                    l = [ 23, r - 3073, 10 ];
90144                    break;
90145
90146                   case 6144 >= r:
90147                    l = [ 24, r - 4097, 11 ];
90148                    break;
90149
90150                   case 8192 >= r:
90151                    l = [ 25, r - 6145, 11 ];
90152                    break;
90153
90154                   case 12288 >= r:
90155                    l = [ 26, r - 8193, 12 ];
90156                    break;
90157
90158                   case 16384 >= r:
90159                    l = [ 27, r - 12289, 12 ];
90160                    break;
90161
90162                   case 24576 >= r:
90163                    l = [ 28, r - 16385, 13 ];
90164                    break;
90165
90166                   case 32768 >= r:
90167                    l = [ 29, r - 24577, 13 ];
90168                    break;
90169
90170                   default:
90171                    t("invalid distance");
90172                  }
90173                  n = l;
90174                  o[a++] = n[0];
90175                  o[a++] = n[1];
90176                  o[a++] = n[2];
90177                  var h, c;
90178                  h = 0;
90179                  for (c = o.length; h < c; ++h) g[y++] = o[h];
90180                  S[o[0]]++;
90181                  T[o[3]]++;
90182                  b = e.length + s - 1;
90183                  p = null;
90184                }
90185                var a, l, h, c, u, _, d, p, m, f = {}, g = r ? new Uint16Array(2 * n.length) : [], y = 0, b = 0, S = new (r ? Uint32Array : Array)(286), T = new (r ? Uint32Array : Array)(30), v = s.w;
90186                if (!r) {
90187                  for (h = 0; 285 >= h; ) S[h++] = 0;
90188                  for (h = 0; 29 >= h; ) T[h++] = 0;
90189                }
90190                S[256] = 1;
90191                a = 0;
90192                for (l = n.length; a < l; ++a) {
90193                  h = u = 0;
90194                  for (c = 3; h < c && a + h !== l; ++h) u = u << 8 | n[a + h];
90195                  f[u] === e && (f[u] = []);
90196                  _ = f[u];
90197                  if (!(0 < b--)) {
90198                    for (;0 < _.length && 32768 < a - _[0]; ) _.shift();
90199                    if (a + 3 >= l) {
90200                      p && o(p, -1);
90201                      h = 0;
90202                      for (c = l - a; h < c; ++h) m = n[a + h], g[y++] = m, ++S[m];
90203                      break;
90204                    }
90205                    if (0 < _.length) {
90206                      var E = e, C = e, w = 0, R = e, I = e, M = e, B = n.length, D = (I = 0, _.length);
90207                      t: for (;I < D; I++) {
90208                        E = _[D - I - 1];
90209                        R = 3;
90210                        if (3 < w) {
90211                          for (M = w; 3 < M; M--) if (n[E + M - 1] !== n[a + M - 1]) continue t;
90212                          R = w;
90213                        }
90214                        for (;258 > R && a + R < B && n[E + R] === n[a + R]; ) ++R;
90215                        R > w && (C = E, w = R);
90216                        if (258 === R) break;
90217                      }
90218                      d = new A(w, a - C);
90219                      p ? p.length < d.length ? (m = n[a - 1], g[y++] = m, ++S[m], o(d, 0)) : o(p, -1) : d.length < v ? p = d : o(d, 0);
90220                    } else p ? o(p, -1) : (m = n[a], g[y++] = m, ++S[m]);
90221                  }
90222                  _.push(a);
90223                }
90224                g[y++] = 256;
90225                S[256]++;
90226                s.L = S;
90227                s.K = T;
90228                return r ? g.subarray(0, y) : g;
90229              }
90230              function R(t, e) {
90231                function i(t) {
90232                  var e = v[t][E[t]];
90233                  e === y ? (i(t + 1), i(t + 1)) : --A[e];
90234                  ++E[t];
90235                }
90236                var s, n, o, a, l, h = t.length, c = new p(572), u = new (r ? Uint8Array : Array)(h);
90237                if (!r) for (a = 0; a < h; a++) u[a] = 0;
90238                for (a = 0; a < h; ++a) 0 < t[a] && c.push(a, t[a]);
90239                s = Array(c.length / 2);
90240                n = new (r ? Uint32Array : Array)(c.length / 2);
90241                if (1 === s.length) return u[c.pop().index] = 1, u;
90242                a = 0;
90243                for (l = c.length / 2; a < l; ++a) s[a] = c.pop(), n[a] = s[a].value;
90244                var _, d, m, f, g, y = n.length, b = new (r ? Uint16Array : Array)(e), S = new (r ? Uint8Array : Array)(e), A = new (r ? Uint8Array : Array)(y), T = Array(e), v = Array(e), E = Array(e), C = (1 << e) - y, x = 1 << e - 1;
90245                b[e - 1] = y;
90246                for (d = 0; d < e; ++d) C < x ? S[d] = 0 : (S[d] = 1, C -= x), C <<= 1, b[e - 2 - d] = (b[e - 1 - d] / 2 | 0) + y;
90247                b[0] = S[0];
90248                T[0] = Array(b[0]);
90249                v[0] = Array(b[0]);
90250                for (d = 1; d < e; ++d) b[d] > 2 * b[d - 1] + S[d] && (b[d] = 2 * b[d - 1] + S[d]),
90251                T[d] = Array(b[d]), v[d] = Array(b[d]);
90252                for (_ = 0; _ < y; ++_) A[_] = e;
90253                for (m = 0; m < b[e - 1]; ++m) T[e - 1][m] = n[m], v[e - 1][m] = m;
90254                for (_ = 0; _ < e; ++_) E[_] = 0;
90255                1 === S[e - 1] && (--A[0], ++E[e - 1]);
90256                for (d = e - 2; 0 <= d; --d) {
90257                  f = _ = 0;
90258                  g = E[d + 1];
90259                  for (m = 0; m < b[d]; m++) (f = T[d + 1][g] + T[d + 1][g + 1]) > n[_] ? (T[d][m] = f,
90260                  v[d][m] = y, g += 2) : (T[d][m] = n[_], v[d][m] = _, ++_);
90261                  E[d] = 0;
90262                  1 === S[d] && i(d);
90263                }
90264                o = A;
90265                a = 0;
90266                for (l = s.length; a < l; ++a) u[s[a].index] = o[a];
90267                return u;
90268              }
90269              function I(e) {
90270                var i, s, n, o, a = new (r ? Uint16Array : Array)(e.length), l = [], h = [], c = 0;
90271                i = 0;
90272                for (s = e.length; i < s; i++) l[e[i]] = 1 + (0 | l[e[i]]);
90273                i = 1;
90274                for (s = 16; i <= s; i++) h[i] = c, (c += 0 | l[i]) > 1 << i && t("overcommitted"),
90275                c <<= 1;
90276                65536 > c && t("undercommitted");
90277                i = 0;
90278                for (s = e.length; i < s; i++) {
90279                  c = h[e[i]];
90280                  h[e[i]] += 1;
90281                  n = a[i] = 0;
90282                  for (o = e[i]; n < o; n++) a[i] = a[i] << 1 | 1 & c, c >>>= 1;
90283                }
90284                return a;
90285              }
90286              function M(t, e) {
90287                this.input = t;
90288                this.a = new (r ? Uint8Array : Array)(32768);
90289                this.h = B.j;
90290                var i, s = {};
90291                !e && (e = {}) || "number" != typeof e.compressionType || (this.h = e.compressionType);
90292                for (i in e) s[i] = e[i];
90293                s.outputBuffer = this.a;
90294                this.z = new f(this.input, s);
90295              }
90296              var B = b;
90297              M.prototype.n = function() {
90298                var e, i, s, n, a, l, h, c = 0;
90299                h = this.a;
90300                if ((e = ct) === ct) i = Math.LOG2E * Math.log(32768) - 8; else t(Error("invalid compression method"));
90301                s = i << 4 | e;
90302                h[c++] = s;
90303                if (e === ct) switch (this.h) {
90304                 case B.NONE:
90305                  a = 0;
90306                  break;
90307
90308                 case B.r:
90309                  a = 1;
90310                  break;
90311
90312                 case B.j:
90313                  a = 2;
90314                  break;
90315
90316                 default:
90317                  t(Error("unsupported compression type"));
90318                } else t(Error("invalid compression method"));
90319                n = a << 6 | 0;
90320                h[c++] = n | 31 - (256 * s + n) % 31;
90321                l = o(this.input);
90322                this.z.b = c;
90323                c = (h = this.z.n()).length;
90324                r && ((h = new Uint8Array(h.buffer)).length <= c + 4 && (this.a = new Uint8Array(h.length + 4),
90325                this.a.set(h), h = this.a), h = h.subarray(0, c + 4));
90326                h[c++] = l >> 24 & 255;
90327                h[c++] = l >> 16 & 255;
90328                h[c++] = l >> 8 & 255;
90329                h[c++] = 255 & l;
90330                return h;
90331              };
90332              n("Zlib.Deflate", M);
90333              n("Zlib.Deflate.compress", (function(t, e) {
90334                return new M(t, e).n();
90335              }));
90336              n("Zlib.Deflate.CompressionType", B);
90337              n("Zlib.Deflate.CompressionType.NONE", B.NONE);
90338              n("Zlib.Deflate.CompressionType.FIXED", B.r);
90339              n("Zlib.Deflate.CompressionType.DYNAMIC", B.j);
90340              function D(e, i) {
90341                this.k = [];
90342                this.l = 32768;
90343                this.e = this.g = this.c = this.q = 0;
90344                this.input = r ? new Uint8Array(e) : e;
90345                this.s = !1;
90346                this.m = O;
90347                this.B = !1;
90348                !i && (i = {}) || (i.index && (this.c = i.index), i.bufferSize && (this.l = i.bufferSize),
90349                i.bufferType && (this.m = i.bufferType), i.resize && (this.B = i.resize));
90350                switch (this.m) {
90351                 case P:
90352                  this.b = 32768;
90353                  this.a = new (r ? Uint8Array : Array)(32768 + this.l + 258);
90354                  break;
90355
90356                 case O:
90357                  this.b = 0;
90358                  this.a = new (r ? Uint8Array : Array)(this.l);
90359                  this.f = this.J;
90360                  this.t = this.H;
90361                  this.o = this.I;
90362                  break;
90363
90364                 default:
90365                  t(Error("invalid inflate mode"));
90366                }
90367              }
90368              var P = 0, O = 1, N = {
90369                D: P,
90370                C: O
90371              };
90372              D.prototype.p = function() {
90373                for (;!this.s; ) {
90374                  var s = tt(this, 3);
90375                  1 & s && (this.s = i);
90376                  switch (s >>>= 1) {
90377                   case 0:
90378                    var n = this.input, o = this.c, a = this.a, l = this.b, h = e, c = e, u = e, _ = a.length, d = e;
90379                    this.e = this.g = 0;
90380                    (h = n[o++]) === e && t(Error("invalid uncompressed block header: LEN (first byte)"));
90381                    c = h;
90382                    (h = n[o++]) === e && t(Error("invalid uncompressed block header: LEN (second byte)"));
90383                    c |= h << 8;
90384                    (h = n[o++]) === e && t(Error("invalid uncompressed block header: NLEN (first byte)"));
90385                    u = h;
90386                    (h = n[o++]) === e && t(Error("invalid uncompressed block header: NLEN (second byte)"));
90387                    c === ~(u |= h << 8) && t(Error("invalid uncompressed block header: length verify"));
90388                    o + c > n.length && t(Error("input buffer is broken"));
90389                    switch (this.m) {
90390                     case P:
90391                      for (;l + c > a.length; ) {
90392                        c -= d = _ - l;
90393                        if (r) a.set(n.subarray(o, o + d), l), l += d, o += d; else for (;d--; ) a[l++] = n[o++];
90394                        this.b = l;
90395                        a = this.f();
90396                        l = this.b;
90397                      }
90398                      break;
90399
90400                     case O:
90401                      for (;l + c > a.length; ) a = this.f({
90402                        v: 2
90403                      });
90404                      break;
90405
90406                     default:
90407                      t(Error("invalid inflate mode"));
90408                    }
90409                    if (r) a.set(n.subarray(o, o + c), l), l += c, o += c; else for (;c--; ) a[l++] = n[o++];
90410                    this.c = o;
90411                    this.b = l;
90412                    this.a = a;
90413                    break;
90414
90415                   case 1:
90416                    this.o(Z, $);
90417                    break;
90418
90419                   case 2:
90420                    it(this);
90421                    break;
90422
90423                   default:
90424                    t(Error("unknown BTYPE: " + s));
90425                  }
90426                }
90427                return this.t();
90428              };
90429              var L, F, V = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], k = r ? new Uint16Array(V) : V, U = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 258, 258 ], G = r ? new Uint16Array(U) : U, z = [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0 ], H = r ? new Uint8Array(z) : z, j = [ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 ], X = r ? new Uint16Array(j) : j, W = [ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 ], Y = r ? new Uint8Array(W) : W, q = new (r ? Uint8Array : Array)(288);
90430              L = 0;
90431              for (F = q.length; L < F; ++L) q[L] = 143 >= L ? 8 : 255 >= L ? 9 : 279 >= L ? 7 : 8;
90432              var K, J, Z = m(q), Q = new (r ? Uint8Array : Array)(30);
90433              K = 0;
90434              for (J = Q.length; K < J; ++K) Q[K] = 5;
90435              var $ = m(Q);
90436              function tt(i, s) {
90437                for (var n, r = i.g, o = i.e, a = i.input, l = i.c; o < s; ) (n = a[l++]) === e && t(Error("input buffer is broken")),
90438                r |= n << o, o += 8;
90439                n = r & (1 << s) - 1;
90440                i.g = r >>> s;
90441                i.e = o - s;
90442                i.c = l;
90443                return n;
90444              }
90445              function et(i, s) {
90446                for (var n, r, o, a = i.g, l = i.e, h = i.input, c = i.c, u = s[0], _ = s[1]; l < _; ) (n = h[c++]) === e && t(Error("input buffer is broken")),
90447                a |= n << l, l += 8;
90448                o = (r = u[a & (1 << _) - 1]) >>> 16;
90449                i.g = a >> o;
90450                i.e = l - o;
90451                i.c = c;
90452                return 65535 & r;
90453              }
90454              function it(t) {
90455                function e(t, e, i) {
90456                  var s, n, r, o;
90457                  for (o = 0; o < t; ) switch (s = et(this, e), s) {
90458                   case 16:
90459                    for (r = 3 + tt(this, 2); r--; ) i[o++] = n;
90460                    break;
90461
90462                   case 17:
90463                    for (r = 3 + tt(this, 3); r--; ) i[o++] = 0;
90464                    n = 0;
90465                    break;
90466
90467                   case 18:
90468                    for (r = 11 + tt(this, 7); r--; ) i[o++] = 0;
90469                    n = 0;
90470                    break;
90471
90472                   default:
90473                    n = i[o++] = s;
90474                  }
90475                  return i;
90476                }
90477                var i, s, n, o, a = tt(t, 5) + 257, l = tt(t, 5) + 1, h = tt(t, 4) + 4, c = new (r ? Uint8Array : Array)(k.length);
90478                for (o = 0; o < h; ++o) c[k[o]] = tt(t, 3);
90479                i = m(c);
90480                s = new (r ? Uint8Array : Array)(a);
90481                n = new (r ? Uint8Array : Array)(l);
90482                t.o(m(e.call(t, a, i, s)), m(e.call(t, l, i, n)));
90483              }
90484              D.prototype.o = function(t, e) {
90485                var i = this.a, s = this.b;
90486                this.u = t;
90487                for (var n, r, o, a, l = i.length - 258; 256 !== (n = et(this, t)); ) if (256 > n) s >= l && (this.b = s,
90488                i = this.f(), s = this.b), i[s++] = n; else {
90489                  a = G[r = n - 257];
90490                  0 < H[r] && (a += tt(this, H[r]));
90491                  n = et(this, e);
90492                  o = X[n];
90493                  0 < Y[n] && (o += tt(this, Y[n]));
90494                  s >= l && (this.b = s, i = this.f(), s = this.b);
90495                  for (;a--; ) i[s] = i[s++ - o];
90496                }
90497                for (;8 <= this.e; ) this.e -= 8, this.c--;
90498                this.b = s;
90499              };
90500              D.prototype.I = function(t, e) {
90501                var i = this.a, s = this.b;
90502                this.u = t;
90503                for (var n, r, o, a, l = i.length; 256 !== (n = et(this, t)); ) if (256 > n) s >= l && (l = (i = this.f()).length),
90504                i[s++] = n; else {
90505                  a = G[r = n - 257];
90506                  0 < H[r] && (a += tt(this, H[r]));
90507                  n = et(this, e);
90508                  o = X[n];
90509                  0 < Y[n] && (o += tt(this, Y[n]));
90510                  s + a > l && (l = (i = this.f()).length);
90511                  for (;a--; ) i[s] = i[s++ - o];
90512                }
90513                for (;8 <= this.e; ) this.e -= 8, this.c--;
90514                this.b = s;
90515              };
90516              D.prototype.f = function() {
90517                var t, e, i = new (r ? Uint8Array : Array)(this.b - 32768), s = this.b - 32768, n = this.a;
90518                if (r) i.set(n.subarray(32768, i.length)); else {
90519                  t = 0;
90520                  for (e = i.length; t < e; ++t) i[t] = n[t + 32768];
90521                }
90522                this.k.push(i);
90523                this.q += i.length;
90524                if (r) n.set(n.subarray(s, s + 32768)); else for (t = 0; 32768 > t; ++t) n[t] = n[s + t];
90525                this.b = 32768;
90526                return n;
90527              };
90528              D.prototype.J = function(t) {
90529                var e, i, s, n = this.input.length / this.c + 1 | 0, o = this.input, a = this.a;
90530                t && ("number" == typeof t.v && (n = t.v), "number" == typeof t.F && (n += t.F));
90531                2 > n ? i = (s = (o.length - this.c) / this.u[2] / 2 * 258 | 0) < a.length ? a.length + s : a.length << 1 : i = a.length * n;
90532                r ? (e = new Uint8Array(i)).set(a) : e = a;
90533                return this.a = e;
90534              };
90535              D.prototype.t = function() {
90536                var t, e, i, s, n, o = 0, a = this.a, l = this.k, h = new (r ? Uint8Array : Array)(this.q + (this.b - 32768));
90537                if (0 === l.length) return r ? this.a.subarray(32768, this.b) : this.a.slice(32768, this.b);
90538                e = 0;
90539                for (i = l.length; e < i; ++e) {
90540                  s = 0;
90541                  for (n = (t = l[e]).length; s < n; ++s) h[o++] = t[s];
90542                }
90543                e = 32768;
90544                for (i = this.b; e < i; ++e) h[o++] = a[e];
90545                this.k = [];
90546                return this.buffer = h;
90547              };
90548              D.prototype.H = function() {
90549                var t, e = this.b;
90550                r ? this.B ? (t = new Uint8Array(e)).set(this.a.subarray(0, e)) : t = this.a.subarray(0, e) : (this.a.length > e && (this.a.length = e),
90551                t = this.a);
90552                return this.buffer = t;
90553              };
90554              function st(e, i) {
90555                var s, n;
90556                this.input = e;
90557                this.c = 0;
90558                !i && (i = {}) || (i.index && (this.c = i.index), i.verify && (this.M = i.verify));
90559                s = e[this.c++];
90560                n = e[this.c++];
90561                if ((15 & s) === ct) this.method = ct; else t(Error("unsupported compression method"));
90562                0 != ((s << 8) + n) % 31 && t(Error("invalid fcheck flag:" + ((s << 8) + n) % 31));
90563                32 & n && t(Error("fdict flag is not supported"));
90564                this.A = new D(e, {
90565                  index: this.c,
90566                  bufferSize: i.bufferSize,
90567                  bufferType: i.bufferType,
90568                  resize: i.resize
90569                });
90570              }
90571              st.prototype.p = function() {
90572                var e, i = this.input;
90573                e = this.A.p();
90574                this.c = this.A.c;
90575                this.M && ((i[this.c++] << 24 | i[this.c++] << 16 | i[this.c++] << 8 | i[this.c++]) >>> 0 !== o(e) && t(Error("invalid adler-32 checksum")));
90576                return e;
90577              };
90578              n("Zlib.Inflate", st);
90579              n("Zlib.Inflate.BufferType", N);
90580              N.ADAPTIVE = N.C;
90581              N.BLOCK = N.D;
90582              n("Zlib.Inflate.prototype.decompress", st.prototype.p);
90583              var nt, rt, ot = new (r ? Uint8Array : Array)(288);
90584              nt = 0;
90585              for (rt = ot.length; nt < rt; ++nt) ot[nt] = 143 >= nt ? 8 : 255 >= nt ? 9 : 279 >= nt ? 7 : 8;
90586              m(ot);
90587              var at, lt, ht = new (r ? Uint8Array : Array)(30);
90588              at = 0;
90589              for (lt = ht.length; at < lt; ++at) ht[at] = 5;
90590              m(ht);
90591              var ct = 8;
90592            }).call(Fft);
90593            var Vft = Fft.Zlib;
90594            Vft.Deflate = Vft.Deflate;
90595            Vft.Deflate.compress = Vft.Deflate.compress;
90596            Vft.Inflate = Vft.Inflate;
90597            Vft.Inflate.BufferType = Vft.Inflate.BufferType;
90598            Vft.Inflate.prototype.decompress = Vft.Inflate.prototype.decompress;
90599            class kft {
90600              constructor(t) {
90601                this.pos = 8;
90602                this.palette = [];
90603                this.imgData = [];
90604                this.text = {};
90605                this.width = 0;
90606                this.height = 0;
90607                this.bits = 0;
90608                this.colorType = 0;
90609                this.compressionMethod = 0;
90610                this.filterMethod = 0;
90611                this.interlaceMethod = 0;
90612                this.colors = 0;
90613                this.hasAlphaChannel = !1;
90614                this.pixelBitlength = 0;
90615                this.data = t;
90616                this.transparency = {
90617                  indexed: [],
90618                  rgb: 0,
90619                  grayscale: 0
90620                };
90621                let e;
90622                let i = 0;
90623                let s = 0;
90624                let n = 0;
90625                let r = 0;
90626                for (;;) {
90627                  r = this.readUInt32();
90628                  const o = (() => {
90629                    const t = [];
90630                    for (i = s = 0; s < 4; i = ++s) t.push(String.fromCharCode(this.data[this.pos++]));
90631                    return t;
90632                  }).call(this).join("");
90633                  switch (o) {
90634                   case "IHDR":
90635                    this.width = this.readUInt32();
90636                    this.height = this.readUInt32();
90637                    this.bits = this.data[this.pos++];
90638                    this.colorType = this.data[this.pos++];
90639                    this.compressionMethod = this.data[this.pos++];
90640                    this.filterMethod = this.data[this.pos++];
90641                    this.interlaceMethod = this.data[this.pos++];
90642                    break;
90643
90644                   case "acTL":
90645                    this.animation = {
90646                      numFrames: this.readUInt32(),
90647                      numPlays: this.readUInt32() || 1 / 0,
90648                      frames: []
90649                    };
90650                    break;
90651
90652                   case "PLTE":
90653                    this.palette = this.read(r);
90654                    break;
90655
90656                   case "fcTL":
90657                    e && this.animation.frames.push(e);
90658                    this.pos += 4;
90659                    e = {
90660                      width: this.readUInt32(),
90661                      height: this.readUInt32(),
90662                      xOffset: this.readUInt32(),
90663                      yOffset: this.readUInt32()
90664                    };
90665                    const a = this.readUInt16();
90666                    const l = this.readUInt16() || 100;
90667                    e.delay = 1e3 * a / l;
90668                    e.disposeOp = this.data[this.pos++];
90669                    e.blendOp = this.data[this.pos++];
90670                    e.data = [];
90671                    break;
90672
90673                   case "IDAT":
90674                   case "fdAT":
90675                    if ("fdAT" === o) {
90676                      this.pos += 4;
90677                      r -= 4;
90678                    }
90679                    t = (null != e ? e.data : void 0) || this.imgData;
90680                    for (i = s = 0; r >= 0 ? s < r : s > r; i = r >= 0 ? ++s : --s) t.push(this.data[this.pos++]);
90681                    break;
90682
90683                   case "tRNS":
90684                    this.transparency = {};
90685                    switch (this.colorType) {
90686                     case 3:
90687                      this.transparency.indexed = this.read(r);
90688                      const t = 255 - this.transparency.indexed.length;
90689                      if (t > 0) for (i = n = 0; t >= 0 ? n < t : n > t; i = t >= 0 ? ++n : --n) this.transparency.indexed.push(255);
90690                      break;
90691
90692                     case 0:
90693                      this.transparency.grayscale = this.read(r)[0];
90694                      break;
90695
90696                     case 2:
90697                      this.transparency.rgb = this.read(r);
90698                    }
90699                    break;
90700
90701                   case "tEXt":
90702                    const h = this.read(r);
90703                    const c = h.indexOf(0);
90704                    const u = String.fromCharCode.apply(String, h.slice(0, c));
90705                    this.text[u] = String.fromCharCode.apply(String, h.slice(c + 1));
90706                    break;
90707
90708                   case "IEND":
90709                    e && this.animation.frames.push(e);
90710                    this.colors = (() => {
90711                      switch (this.colorType) {
90712                       case 0:
90713                       case 3:
90714                       case 4:
90715                        return 1;
90716
90717                       case 2:
90718                       case 6:
90719                        return 3;
90720                      }
90721                    }).call(this);
90722                    const _ = this.colorType;
90723                    this.hasAlphaChannel = 4 === _ || 6 === _;
90724                    const d = this.colors + (this.hasAlphaChannel ? 1 : 0);
90725                    this.pixelBitlength = this.bits * d;
90726                    this.colorSpace = (() => {
90727                      switch (this.colors) {
90728                       case 1:
90729                        return "DeviceGray";
90730
90731                       case 3:
90732                        return "DeviceRGB";
90733                      }
90734                    }).call(this);
90735                    this.imgData instanceof Uint8Array || (this.imgData = new Uint8Array(this.imgData));
90736                    return;
90737
90738                   default:
90739                    this.pos += r;
90740                  }
90741                  this.pos += 4;
90742                  if (this.pos > this.data.length) throw new Error(G(6017));
90743                }
90744              }
90745              read(t) {
90746                let e = 0;
90747                let i = 0;
90748                const s = [];
90749                for (e = i = 0; t >= 0 ? i < t : i > t; e = t >= 0 ? ++i : --i) s.push(this.data[this.pos++]);
90750                return s;
90751              }
90752              readUInt32() {
90753                return this.data[this.pos++] << 24 | this.data[this.pos++] << 16 | this.data[this.pos++] << 8 | this.data[this.pos++];
90754              }
90755              readUInt16() {
90756                return this.data[this.pos++] << 8 | this.data[this.pos++];
90757              }
90758              decodePixels(t) {
90759                null == t && (t = this.imgData);
90760                if (0 === t.length) return new Uint8Array(0);
90761                t = new Vft.Inflate(t, {
90762                  index: 0,
90763                  verify: !1
90764                }).decompress();
90765                const e = this.pixelBitlength / 8;
90766                const i = e * this.width;
90767                const s = new Uint8Array(i * this.height);
90768                const n = t.length;
90769                let r = 0;
90770                let o = 0;
90771                let a = 0;
90772                let l = 0;
90773                let h = 0;
90774                let c = 0;
90775                let u = 0;
90776                let _ = 0;
90777                let d = 0;
90778                let p = 0;
90779                let m = 0;
90780                let f = 0;
90781                let g = 0;
90782                let y = 0;
90783                let b = 0;
90784                let S = 0;
90785                let A = 0;
90786                let T = 0;
90787                let v = 0;
90788                for (;o < n; ) {
90789                  switch (t[o++]) {
90790                   case 0:
90791                    for (c = u = 0; u < i; c = u += 1) s[a++] = t[o++];
90792                    break;
90793
90794                   case 1:
90795                    for (c = _ = 0; _ < i; c = _ += 1) {
90796                      l = t[o++];
90797                      f = c < e ? 0 : s[a - e];
90798                      s[a++] = (l + f) % 256;
90799                    }
90800                    break;
90801
90802                   case 2:
90803                    for (c = d = 0; d < i; c = d += 1) {
90804                      l = t[o++];
90805                      h = (c - c % e) / e;
90806                      T = r && s[(r - 1) * i + h * e + c % e];
90807                      s[a++] = (T + l) % 256;
90808                    }
90809                    break;
90810
90811                   case 3:
90812                    for (c = p = 0; p < i; c = p += 1) {
90813                      l = t[o++];
90814                      h = (c - c % e) / e;
90815                      f = c < e ? 0 : s[a - e];
90816                      T = r && s[(r - 1) * i + h * e + c % e];
90817                      s[a++] = (l + Math.floor((f + T) / 2)) % 256;
90818                    }
90819                    break;
90820
90821                   case 4:
90822                    for (c = m = 0; m < i; c = m += 1) {
90823                      l = t[o++];
90824                      h = (c - c % e) / e;
90825                      f = c < e ? 0 : s[a - e];
90826                      if (0 === r) T = v = 0; else {
90827                        T = s[(r - 1) * i + h * e + c % e];
90828                        v = h && s[(r - 1) * i + (h - 1) * e + c % e];
90829                      }
90830                      g = f + T - v;
90831                      y = Math.abs(g - f);
90832                      S = Math.abs(g - T);
90833                      A = Math.abs(g - v);
90834                      b = y <= S && y <= A ? f : S <= A ? T : v;
90835                      s[a++] = (l + b) % 256;
90836                    }
90837                    break;
90838
90839                   default:
90840                    throw new Error(G(6018, t[o - 1]));
90841                  }
90842                  r++;
90843                }
90844                return s;
90845              }
90846              copyToImageData(t, e) {
90847                let i = this.hasAlphaChannel;
90848                let s;
90849                let n = this.colors;
90850                if (this.palette.length) {
90851                  s = null != this._decodedPalette ? this._decodedPalette : this._decodedPalette = this.decodePalette();
90852                  n = 4;
90853                  i = !0;
90854                }
90855                const r = t.data || t;
90856                const o = r.length;
90857                const a = s || e;
90858                let l = 0;
90859                let h = 0;
90860                let c = 0;
90861                let u = 0;
90862                if (1 === n) for (;l < o; ) {
90863                  c = s ? 4 * e[l / 4] : h;
90864                  u = a[c++];
90865                  r[l++] = u;
90866                  r[l++] = u;
90867                  r[l++] = u;
90868                  r[l++] = i ? a[c++] : 255;
90869                  h = c;
90870                } else for (;l < o; ) {
90871                  c = s ? 4 * e[l / 4] : h;
90872                  r[l++] = a[c++];
90873                  r[l++] = a[c++];
90874                  r[l++] = a[c++];
90875                  r[l++] = i ? a[c++] : 255;
90876                  h = c;
90877                }
90878              }
90879              decodePalette() {
90880                const t = this.palette;
90881                const e = this.transparency.indexed || [];
90882                const i = new Uint8Array((e.length || 0) + t.length);
90883                let s = 0;
90884                let n = 0;
90885                let r = 0;
90886                for (let o = 0, a = 0, l = t.length; a < l; o = a += 3) {
90887                  i[s++] = t[o];
90888                  i[s++] = t[o + 1];
90889                  i[s++] = t[o + 2];
90890                  r = e[n++];
90891                  i[s++] = null != r ? r : 255;
90892                }
90893                return i;
90894              }
90895              render(t) {
90896                t.width = this.width;
90897                t.height = this.height;
90898                const e = t.getContext("2d");
90899                const i = e.createImageData(this.width, this.height);
90900                this.copyToImageData(i, this.decodePixels(null));
90901                return e.putImageData(i, 0, 0);
90902              }
90903            }
90904            class Uft {
90905              constructor() {
90906                this._littleEndian = !1;
90907                this._tiffData = [];
90908                this._fileDirectories = [];
90909              }
90910              getUint8(t) {
90911                return this._tiffData[t];
90912              }
90913              getUint16(t) {
90914                return this._littleEndian ? this._tiffData[t + 1] << 8 | this._tiffData[t] : this._tiffData[t] << 8 | this._tiffData[t + 1];
90915              }
90916              getUint32(t) {
90917                const e = this._tiffData;
90918                return this._littleEndian ? e[t + 3] << 24 | e[t + 2] << 16 | e[t + 1] << 8 | e[t] : e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3];
90919              }
90920              checkLittleEndian() {
90921                const t = this.getUint16(0);
90922                if (18761 === t) this._littleEndian = !0; else {
90923                  if (19789 !== t) {
90924                    console.log(t);
90925                    throw TypeError(G(6019));
90926                  }
90927                  this._littleEndian = !1;
90928                }
90929                return this._littleEndian;
90930              }
90931              hasTowel() {
90932                if (42 !== this.getUint16(2)) throw RangeError(G(6020));
90933                return !0;
90934              }
90935              getFieldTypeName(t) {
90936                return t in zft ? zft[t] : null;
90937              }
90938              getFieldTagName(t) {
90939                if (t in Gft) return Gft[t];
90940                P(6021, t);
90941                return `Tag${t}`;
90942              }
90943              getFieldTypeLength(t) {
90944                return -1 !== [ "BYTE", "ASCII", "SBYTE", "UNDEFINED" ].indexOf(t) ? 1 : -1 !== [ "SHORT", "SSHORT" ].indexOf(t) ? 2 : -1 !== [ "LONG", "SLONG", "FLOAT" ].indexOf(t) ? 4 : -1 !== [ "RATIONAL", "SRATIONAL", "DOUBLE" ].indexOf(t) ? 8 : 0;
90945              }
90946              getFieldValues(t, e, i, s) {
90947                const n = [];
90948                const r = this.getFieldTypeLength(e);
90949                if (r * i <= 4) !1 === this._littleEndian ? n.push(s >>> 8 * (4 - r)) : n.push(s); else for (let t = 0; t < i; t++) {
90950                  const i = r * t;
90951                  if (r >= 8) if (-1 !== [ "RATIONAL", "SRATIONAL" ].indexOf(e)) {
90952                    n.push(this.getUint32(s + i));
90953                    n.push(this.getUint32(s + i + 4));
90954                  } else P(8e3); else n.push(this.getBytes(r, s + i));
90955                }
90956                "ASCII" === e && n.forEach(((t, e, i) => {
90957                  i[e] = String.fromCharCode(t);
90958                }));
90959                return n;
90960              }
90961              getBytes(t, e) {
90962                if (t <= 0) P(8001); else {
90963                  if (t <= 1) return this.getUint8(e);
90964                  if (t <= 2) return this.getUint16(e);
90965                  if (t <= 3) return this.getUint32(e) >>> 8;
90966                  if (t <= 4) return this.getUint32(e);
90967                  P(8002);
90968                }
90969                return 0;
90970              }
90971              getBits(t, e, i) {
90972                i = i || 0;
90973                const s = e + Math.floor(i / 8);
90974                const n = i + t;
90975                const r = 32 - t;
90976                let o = 0;
90977                let a = 0;
90978                if (n <= 0) P(6023); else if (n <= 8) {
90979                  o = 24 + i;
90980                  a = this.getUint8(s);
90981                } else if (n <= 16) {
90982                  o = 16 + i;
90983                  a = this.getUint16(s);
90984                } else if (n <= 32) {
90985                  o = i;
90986                  a = this.getUint32(s);
90987                } else P(6022);
90988                return {
90989                  bits: a << o >>> r,
90990                  byteOffset: s + Math.floor(n / 8),
90991                  bitOffset: n % 8
90992                };
90993              }
90994              parseFileDirectory(t) {
90995                const e = this.getUint16(t);
90996                const i = [];
90997                let s = 0;
90998                let n = 0;
90999                for (s = t + 2, n = 0; n < e; s += 12, n++) {
91000                  const t = this.getUint16(s);
91001                  const e = this.getUint16(s + 2);
91002                  const n = this.getUint32(s + 4);
91003                  const r = this.getUint32(s + 8);
91004                  const o = this.getFieldTagName(t);
91005                  const a = this.getFieldTypeName(e);
91006                  const l = this.getFieldValues(o, a, n, r);
91007                  i[o] = {
91008                    type: a,
91009                    values: l
91010                  };
91011                }
91012                this._fileDirectories.push(i);
91013                const r = this.getUint32(s);
91014                0 !== r && this.parseFileDirectory(r);
91015              }
91016              clampColorSample(t, e) {
91017                const i = Math.pow(2, 8 - e);
91018                return Math.floor(t * i + (i - 1));
91019              }
91020              parseTIFF(t, e) {
91021                e = e || document.createElement("canvas");
91022                this._tiffData = t;
91023                this._canvas = e;
91024                this.checkLittleEndian();
91025                if (!this.hasTowel()) return;
91026                const i = this.getUint32(4);
91027                this._fileDirectories.length = 0;
91028                this.parseFileDirectory(i);
91029                const s = this._fileDirectories[0];
91030                const n = s.ImageWidth.values[0];
91031                const r = s.ImageLength.values[0];
91032                this._canvas.width = n;
91033                this._canvas.height = r;
91034                const o = [];
91035                const a = s.Compression ? s.Compression.values[0] : 1;
91036                const l = s.SamplesPerPixel.values[0];
91037                const h = [];
91038                let c = 0;
91039                let u = !1;
91040                s.BitsPerSample.values.forEach(((t, e, i) => {
91041                  h[e] = {
91042                    bitsPerSample: t,
91043                    hasBytesPerSample: !1,
91044                    bytesPerSample: void 0
91045                  };
91046                  if (t % 8 == 0) {
91047                    h[e].hasBytesPerSample = !0;
91048                    h[e].bytesPerSample = t / 8;
91049                  }
91050                  c += t;
91051                }), this);
91052                let _ = 0;
91053                if (c % 8 == 0) {
91054                  u = !0;
91055                  _ = c / 8;
91056                }
91057                const d = s.StripOffsets.values;
91058                const p = d.length;
91059                let m;
91060                if (s.StripByteCounts) m = s.StripByteCounts.values; else {
91061                  P(8003);
91062                  if (1 !== p) throw Error(G(6024));
91063                  m = [ Math.ceil(n * r * c / 8) ];
91064                }
91065                let f = 1;
91066                let g = 1;
91067                for (let t = 0; t < p; t++) {
91068                  const e = d[t];
91069                  o[t] = [];
91070                  const i = m[t];
91071                  for (let s = 0, n = 0, r = 1, c = !0, d = [], p = 0, m = 0, y = 0; s < i; s += r) switch (a) {
91072                   case 1:
91073                    d = [];
91074                    for (let t = 0; t < l; t++) {
91075                      const i = h[t];
91076                      if (!i.hasBytesPerSample) {
91077                        const t = this.getBits(i.bitsPerSample, e + s, n);
91078                        d.push(t.bits);
91079                        s = t.byteOffset - e;
91080                        n = t.bitOffset;
91081                        throw RangeError(G(6025));
91082                      }
91083                      {
91084                        const n = i.bytesPerSample * t;
91085                        d.push(this.getBytes(i.bytesPerSample, e + s + n));
91086                      }
91087                    }
91088                    o[t].push(d);
91089                    if (!u) {
91090                      r = 0;
91091                      throw RangeError(G(6026));
91092                    }
91093                    r = _;
91094                    break;
91095
91096                   case 2:
91097                   case 3:
91098                   case 4:
91099                   case 5:
91100                   case 6:
91101                   case 7:
91102                    break;
91103
91104                   case 32773:
91105                    if (c) {
91106                      c = !1;
91107                      const t = this.getUint8(e + s);
91108                      t >= 0 && t <= 127 ? f = t + 1 : t >= -127 && t <= -1 ? g = 1 - t : c = !0;
91109                    } else {
91110                      const i = this.getUint8(e + s);
91111                      for (let e = 0; e < g; e++) {
91112                        const e = h[m];
91113                        if (!e.hasBytesPerSample) throw RangeError(G(6025));
91114                        y = y << 8 * p | i;
91115                        p++;
91116                        if (p === e.bytesPerSample) {
91117                          d.push(y);
91118                          y = p = 0;
91119                          m++;
91120                        }
91121                        if (m === l) {
91122                          o[t].push(d);
91123                          d = [];
91124                          m = 0;
91125                        }
91126                      }
91127                      f--;
91128                      0 === f && (c = !0);
91129                    }
91130                    r = 1;
91131                  }
91132                }
91133                if (e.getContext) {
91134                  const t = this._canvas.getContext("2d");
91135                  t.fillStyle = "rgba(255, 255, 255, 0)";
91136                  const e = s.RowsPerStrip ? s.RowsPerStrip.values[0] : r;
91137                  const i = o.length;
91138                  const a = r % e;
91139                  const l = 0 === a ? e : a;
91140                  let c = e;
91141                  let u = 0;
91142                  const _ = s.PhotometricInterpretation.values[0];
91143                  let d = [];
91144                  let p = 0;
91145                  if (s.ExtraSamples) {
91146                    d = s.ExtraSamples.values;
91147                    p = d.length;
91148                  }
91149                  let m = [];
91150                  let f = 0;
91151                  if (s.ColorMap) {
91152                    m = s.ColorMap.values;
91153                    f = Math.pow(2, h[0].bitsPerSample);
91154                  }
91155                  for (let e = 0; e < i; e++) {
91156                    e + 1 === i && (c = l);
91157                    const s = o[e].length;
91158                    const r = u * e;
91159                    for (let i = 0, a = 0; i < c && a < s; i++) for (let s = 0; s < n; s++, a++) {
91160                      const n = o[e][a];
91161                      let l = 0;
91162                      let c = 0;
91163                      let u = 0;
91164                      let g = 1;
91165                      if (p > 0) for (let t = 0; t < p; t++) if (1 === d[t] || 2 === d[t]) {
91166                        g = n[3 + t] / 256;
91167                        break;
91168                      }
91169                      switch (_) {
91170                       case 0:
91171                        let t = 0;
91172                        h[0].hasBytesPerSample && (t = Math.pow(16, 2 * h[0].bytesPerSample));
91173                        n.forEach(((e, i, s) => {
91174                          s[i] = t - e;
91175                        }));
91176
91177                       case 1:
91178                        l = c = u = this.clampColorSample(n[0], h[0].bitsPerSample);
91179                        break;
91180
91181                       case 2:
91182                        l = this.clampColorSample(n[0], h[0].bitsPerSample);
91183                        c = this.clampColorSample(n[1], h[1].bitsPerSample);
91184                        u = this.clampColorSample(n[2], h[2].bitsPerSample);
91185                        break;
91186
91187                       case 3:
91188                        if (void 0 === m) throw Error(G(6027));
91189                        const e = n[0];
91190                        l = this.clampColorSample(m[e], 16);
91191                        c = this.clampColorSample(m[f + e], 16);
91192                        u = this.clampColorSample(m[2 * f + e], 16);
91193                        break;
91194
91195                       default:
91196                        throw RangeError(G(6028, _));
91197                      }
91198                      t.fillStyle = `rgba(${l}, ${c}, ${u}, ${g})`;
91199                      t.fillRect(s, r + i, 1, 1);
91200                    }
91201                    u = c;
91202                  }
91203                }
91204                return this._canvas;
91205              }
91206            }
91207            const Gft = {
91208              315: "Artist",
91209              258: "BitsPerSample",
91210              265: "CellLength",
91211              264: "CellWidth",
91212              320: "ColorMap",
91213              259: "Compression",
91214              33432: "Copyright",
91215              306: "DateTime",
91216              338: "ExtraSamples",
91217              266: "FillOrder",
91218              289: "FreeByteCounts",
91219              288: "FreeOffsets",
91220              291: "GrayResponseCurve",
91221              290: "GrayResponseUnit",
91222              316: "HostComputer",
91223              270: "ImageDescription",
91224              257: "ImageLength",
91225              256: "ImageWidth",
91226              271: "Make",
91227              281: "MaxSampleValue",
91228              280: "MinSampleValue",
91229              272: "Model",
91230              254: "NewSubfileType",
91231              274: "Orientation",
91232              262: "PhotometricInterpretation",
91233              284: "PlanarConfiguration",
91234              296: "ResolutionUnit",
91235              278: "RowsPerStrip",
91236              277: "SamplesPerPixel",
91237              305: "Software",
91238              279: "StripByteCounts",
91239              273: "StripOffsets",
91240              255: "SubfileType",
91241              263: "Threshholding",
91242              282: "XResolution",
91243              283: "YResolution",
91244              326: "BadFaxLines",
91245              327: "CleanFaxData",
91246              343: "ClipPath",
91247              328: "ConsecutiveBadFaxLines",
91248              433: "Decode",
91249              434: "DefaultImageColor",
91250              269: "DocumentName",
91251              336: "DotRange",
91252              321: "HalftoneHints",
91253              346: "Indexed",
91254              347: "JPEGTables",
91255              285: "PageName",
91256              297: "PageNumber",
91257              317: "Predictor",
91258              319: "PrimaryChromaticities",
91259              532: "ReferenceBlackWhite",
91260              339: "SampleFormat",
91261              559: "StripRowCounts",
91262              330: "SubIFDs",
91263              292: "T4Options",
91264              293: "T6Options",
91265              325: "TileByteCounts",
91266              323: "TileLength",
91267              324: "TileOffsets",
91268              322: "TileWidth",
91269              301: "TransferFunction",
91270              318: "WhitePoint",
91271              344: "XClipPathUnits",
91272              286: "XPosition",
91273              529: "YCbCrCoefficients",
91274              531: "YCbCrPositioning",
91275              530: "YCbCrSubSampling",
91276              345: "YClipPathUnits",
91277              287: "YPosition",
91278              37378: "ApertureValue",
91279              40961: "ColorSpace",
91280              36868: "DateTimeDigitized",
91281              36867: "DateTimeOriginal",
91282              34665: "Exif IFD",
91283              36864: "ExifVersion",
91284              33434: "ExposureTime",
91285              41728: "FileSource",
91286              37385: "Flash",
91287              40960: "FlashpixVersion",
91288              33437: "FNumber",
91289              42016: "ImageUniqueID",
91290              37384: "LightSource",
91291              37500: "MakerNote",
91292              37377: "ShutterSpeedValue",
91293              37510: "UserComment",
91294              33723: "IPTC",
91295              34675: "ICC Profile",
91296              700: "XMP",
91297              42112: "GDAL_METADATA",
91298              42113: "GDAL_NODATA",
91299              34377: "Photoshop"
91300            };
91301            const zft = {
91302              1: "BYTE",
91303              2: "ASCII",
91304              3: "SHORT",
91305              4: "LONG",
91306              5: "RATIONAL",
91307              6: "SBYTE",
91308              7: "UNDEFINED",
91309              8: "SSHORT",
91310              9: "SLONG",
91311              10: "SRATIONAL",
91312              11: "FLOAT",
91313              12: "DOUBLE"
91314            };
91315            const Hft = new Array(123);
91316            for (let t = 0; t < 123; ++t) Hft[t] = 64;
91317            for (let t = 0; t < 64; ++t) Hft["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(t)] = t;
91318            var jft = {
91319              name: "Jacob__Codec__Base64"
91320            };
91321            jft.decode = function(t) {
91322              var e, i, s, n, r, o, a = [], l = 0;
91323              t = t.replace(/[^A-Za-z0-9\+\/\=]/g, "");
91324              for (;l < t.length; ) {
91325                e = Hft[t.charCodeAt(l++)] << 2 | (n = Hft[t.charCodeAt(l++)]) >> 4;
91326                i = (15 & n) << 4 | (r = Hft[t.charCodeAt(l++)]) >> 2;
91327                s = (3 & r) << 6 | (o = Hft[t.charCodeAt(l++)]);
91328                a.push(String.fromCharCode(e));
91329                64 !== r && a.push(String.fromCharCode(i));
91330                64 !== o && a.push(String.fromCharCode(s));
91331              }
91332              return a = a.join("");
91333            };
91334            jft.decodeAsArray = function(t, e) {
91335              var i, s, n, r = this.decode(t), o = [];
91336              for (i = 0, n = r.length / e; i < n; i++) {
91337                o[i] = 0;
91338                for (s = e - 1; s >= 0; --s) o[i] += r.charCodeAt(i * e + s) << 8 * s;
91339              }
91340              return o;
91341            };
91342            var Xft = function(t) {
91343              this.data = t;
91344              this.debug = !1;
91345              this.gpflags = void 0;
91346              this.files = 0;
91347              this.unzipped = [];
91348              this.buf32k = new Array(32768);
91349              this.bIdx = 0;
91350              this.modeZIP = !1;
91351              this.bytepos = 0;
91352              this.bb = 1;
91353              this.bits = 0;
91354              this.nameBuf = [];
91355              this.fileout = void 0;
91356              this.literalTree = new Array(Xft.LITERALS);
91357              this.distanceTree = new Array(32);
91358              this.treepos = 0;
91359              this.Places = null;
91360              this.len = 0;
91361              this.fpos = new Array(17);
91362              this.fpos[0] = 0;
91363              this.flens = void 0;
91364              this.fmax = void 0;
91365            };
91366            Xft.gunzip = function(t) {
91367              t.constructor === Array || t.constructor;
91368              return new Xft(t).gunzip()[0][0];
91369            };
91370            Xft.HufNode = function() {
91371              this.b0 = 0;
91372              this.b1 = 0;
91373              this.jump = null;
91374              this.jumppos = -1;
91375            };
91376            Xft.LITERALS = 288;
91377            Xft.NAMEMAX = 256;
91378            Xft.bitReverse = [ 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255 ];
91379            Xft.cplens = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 ];
91380            Xft.cplext = [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99 ];
91381            Xft.cpdist = [ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 ];
91382            Xft.cpdext = [ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 ];
91383            Xft.border = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
91384            Xft.prototype.gunzip = function() {
91385              this.outputArr = [];
91386              this.nextFile();
91387              return this.unzipped;
91388            };
91389            Xft.prototype.readByte = function() {
91390              this.bits += 8;
91391              return this.bytepos < this.data.length ? this.data.charCodeAt(this.bytepos++) : -1;
91392            };
91393            Xft.prototype.byteAlign = function() {
91394              this.bb = 1;
91395            };
91396            Xft.prototype.readBit = function() {
91397              var t;
91398              this.bits++;
91399              t = 1 & this.bb;
91400              this.bb >>= 1;
91401              if (0 === this.bb) {
91402                this.bb = this.readByte();
91403                t = 1 & this.bb;
91404                this.bb = this.bb >> 1 | 128;
91405              }
91406              return t;
91407            };
91408            Xft.prototype.readBits = function(t) {
91409              var e = 0, i = t;
91410              for (;i--; ) e = e << 1 | this.readBit();
91411              t && (e = Xft.bitReverse[e] >> 8 - t);
91412              return e;
91413            };
91414            Xft.prototype.flushBuffer = function() {
91415              this.bIdx = 0;
91416            };
91417            Xft.prototype.addBuffer = function(t) {
91418              this.buf32k[this.bIdx++] = t;
91419              this.outputArr.push(String.fromCharCode(t));
91420              32768 === this.bIdx && (this.bIdx = 0);
91421            };
91422            Xft.prototype.IsPat = function() {
91423              for (;;) {
91424                if (this.fpos[this.len] >= this.fmax) return -1;
91425                if (this.flens[this.fpos[this.len]] === this.len) return this.fpos[this.len]++;
91426                this.fpos[this.len]++;
91427              }
91428            };
91429            Xft.prototype.Rec = function() {
91430              var t = this.Places[this.treepos];
91431              var e;
91432              if (17 === this.len) return -1;
91433              this.treepos++;
91434              this.len++;
91435              if ((e = this.IsPat()) >= 0) t.b0 = e; else {
91436                t.b0 = 32768;
91437                if (this.Rec()) return -1;
91438              }
91439              if ((e = this.IsPat()) >= 0) {
91440                t.b1 = e;
91441                t.jump = null;
91442              } else {
91443                t.b1 = 32768;
91444                t.jump = this.Places[this.treepos];
91445                t.jumppos = this.treepos;
91446                if (this.Rec()) return -1;
91447              }
91448              this.len--;
91449              return 0;
91450            };
91451            Xft.prototype.CreateTree = function(t, e, i, s) {
91452              var n;
91453              this.Places = t;
91454              this.treepos = 0;
91455              this.flens = i;
91456              this.fmax = e;
91457              for (n = 0; n < 17; n++) this.fpos[n] = 0;
91458              this.len = 0;
91459              return this.Rec() ? -1 : 0;
91460            };
91461            Xft.prototype.DecodeValue = function(t) {
91462              var e, i, s = 0, n = t[s];
91463              for (;;) if (this.readBit()) {
91464                if (!(32768 & n.b1)) return n.b1;
91465                n = n.jump;
91466                e = t.length;
91467                for (i = 0; i < e; i++) if (t[i] === n) {
91468                  s = i;
91469                  break;
91470                }
91471              } else {
91472                if (!(32768 & n.b0)) return n.b0;
91473                n = t[++s];
91474              }
91475              return -1;
91476            };
91477            Xft.prototype.DeflateLoop = function() {
91478              var t, e, i;
91479              do {
91480                t = this.readBit();
91481                if (0 === (e = this.readBits(2))) {
91482                  var s, n;
91483                  this.byteAlign();
91484                  s = this.readByte();
91485                  s |= this.readByte() << 8;
91486                  n = this.readByte();
91487                  65535 & (s ^ ~(n |= this.readByte() << 8)) && document.write("BlockLen checksum mismatch\n");
91488                  for (;s--; ) {
91489                    r = this.readByte();
91490                    this.addBuffer(r);
91491                  }
91492                } else if (1 === e) {
91493                  for (;;) {
91494                    (o = Xft.bitReverse[this.readBits(7)] >> 1) > 23 ? (o = o << 1 | this.readBit()) > 199 ? o = (o -= 128) << 1 | this.readBit() : (o -= 48) > 143 && (o += 136) : o += 256;
91495                    if (o < 256) this.addBuffer(o); else {
91496                      if (256 === o) break;
91497                      o -= 257;
91498                      p = this.readBits(Xft.cplext[o]) + Xft.cplens[o];
91499                      o = Xft.bitReverse[this.readBits(5)] >> 3;
91500                      if (Xft.cpdext[o] > 8) {
91501                        m = this.readBits(8);
91502                        m |= this.readBits(Xft.cpdext[o] - 8) << 8;
91503                      } else m = this.readBits(Xft.cpdext[o]);
91504                      m += Xft.cpdist[o];
91505                      for (o = 0; o < p; o++) {
91506                        var r = this.buf32k[this.bIdx - m & 32767];
91507                        this.addBuffer(r);
91508                      }
91509                    }
91510                  }
91511                } else if (2 === e) {
91512                  var o, a, l, h, c;
91513                  var u = new Array(320);
91514                  l = 257 + this.readBits(5);
91515                  h = 1 + this.readBits(5);
91516                  c = 4 + this.readBits(4);
91517                  for (o = 0; o < 19; o++) u[o] = 0;
91518                  for (o = 0; o < c; o++) u[Xft.border[o]] = this.readBits(3);
91519                  p = this.distanceTree.length;
91520                  for (i = 0; i < p; i++) this.distanceTree[i] = new Xft.HufNode;
91521                  if (this.CreateTree(this.distanceTree, 19, u, 0)) {
91522                    this.flushBuffer();
91523                    return 1;
91524                  }
91525                  a = l + h;
91526                  i = 0;
91527                  for (;i < a; ) if ((o = this.DecodeValue(this.distanceTree)) < 16) u[i++] = o; else if (16 === o) {
91528                    var _;
91529                    if (i + (o = 3 + this.readBits(2)) > a) {
91530                      this.flushBuffer();
91531                      return 1;
91532                    }
91533                    _ = i ? u[i - 1] : 0;
91534                    for (;o--; ) u[i++] = _;
91535                  } else {
91536                    if (i + (o = 17 === o ? 3 + this.readBits(3) : 11 + this.readBits(7)) > a) {
91537                      this.flushBuffer();
91538                      return 1;
91539                    }
91540                    for (;o--; ) u[i++] = 0;
91541                  }
91542                  p = this.literalTree.length;
91543                  for (i = 0; i < p; i++) this.literalTree[i] = new Xft.HufNode;
91544                  if (this.CreateTree(this.literalTree, l, u, 0)) {
91545                    this.flushBuffer();
91546                    return 1;
91547                  }
91548                  p = this.literalTree.length;
91549                  for (i = 0; i < p; i++) this.distanceTree[i] = new Xft.HufNode;
91550                  var d = new Array;
91551                  for (i = l; i < u.length; i++) d[i - l] = u[i];
91552                  if (this.CreateTree(this.distanceTree, h, d, 0)) {
91553                    this.flushBuffer();
91554                    return 1;
91555                  }
91556                  for (;;) if ((o = this.DecodeValue(this.literalTree)) >= 256) {
91557                    var p, m;
91558                    if (0 === (o -= 256)) break;
91559                    o--;
91560                    p = this.readBits(Xft.cplext[o]) + Xft.cplens[o];
91561                    o = this.DecodeValue(this.distanceTree);
91562                    if (Xft.cpdext[o] > 8) {
91563                      m = this.readBits(8);
91564                      m |= this.readBits(Xft.cpdext[o] - 8) << 8;
91565                    } else m = this.readBits(Xft.cpdext[o]);
91566                    m += Xft.cpdist[o];
91567                    for (;p--; ) {
91568                      r = this.buf32k[this.bIdx - m & 32767];
91569                      this.addBuffer(r);
91570                    }
91571                  } else this.addBuffer(o);
91572                }
91573              } while (!t);
91574              this.flushBuffer();
91575              this.byteAlign();
91576              return 0;
91577            };
91578            Xft.prototype.unzipFile = function(t) {
91579              var e;
91580              this.gunzip();
91581              for (e = 0; e < this.unzipped.length; e++) if (this.unzipped[e][1] === t) return this.unzipped[e][0];
91582            };
91583            Xft.prototype.nextFile = function() {
91584              this.outputArr = [];
91585              this.modeZIP = !1;
91586              var t = [];
91587              t[0] = this.readByte();
91588              t[1] = this.readByte();
91589              if (120 === t[0] && 218 === t[1]) {
91590                this.DeflateLoop();
91591                this.unzipped[this.files] = [ this.outputArr.join(""), "geonext.gxt" ];
91592                this.files++;
91593              }
91594              if (31 === t[0] && 139 === t[1]) {
91595                this.skipdir();
91596                this.unzipped[this.files] = [ this.outputArr.join(""), "file" ];
91597                this.files++;
91598              }
91599              if (80 === t[0] && 75 === t[1]) {
91600                this.modeZIP = !0;
91601                t[2] = this.readByte();
91602                t[3] = this.readByte();
91603                if (3 === t[2] && 4 === t[3]) {
91604                  t[0] = this.readByte();
91605                  t[1] = this.readByte();
91606                  this.gpflags = this.readByte();
91607                  this.gpflags |= this.readByte() << 8;
91608                  var e = this.readByte();
91609                  e |= this.readByte() << 8;
91610                  this.readByte();
91611                  this.readByte();
91612                  this.readByte();
91613                  this.readByte();
91614                  this.readByte();
91615                  this.readByte() << 8;
91616                  this.readByte() << 16;
91617                  this.readByte() << 24;
91618                  this.readByte();
91619                  this.readByte() << 8;
91620                  this.readByte() << 16;
91621                  this.readByte() << 24;
91622                  var i = this.readByte();
91623                  i |= this.readByte() << 8;
91624                  var s = this.readByte();
91625                  s |= this.readByte() << 8;
91626                  r = 0;
91627                  this.nameBuf = [];
91628                  for (;i--; ) {
91629                    var n = this.readByte();
91630                    "/" === n | ":" === n ? r = 0 : r < Xft.NAMEMAX - 1 && (this.nameBuf[r++] = String.fromCharCode(n));
91631                  }
91632                  this.fileout || (this.fileout = this.nameBuf);
91633                  var r = 0;
91634                  for (;r < s; ) {
91635                    n = this.readByte();
91636                    r++;
91637                  }
91638                  if (8 === e) {
91639                    this.DeflateLoop();
91640                    this.unzipped[this.files] = [ this.outputArr.join(""), this.nameBuf.join("") ];
91641                    this.files++;
91642                  }
91643                  this.skipdir();
91644                }
91645              }
91646            };
91647            Xft.prototype.skipdir = function() {
91648              var t = [];
91649              var e, i;
91650              if (8 & this.gpflags) {
91651                t[0] = this.readByte();
91652                t[1] = this.readByte();
91653                t[2] = this.readByte();
91654                t[3] = this.readByte();
91655                this.readByte();
91656                this.readByte() << 8;
91657                this.readByte() << 16;
91658                this.readByte() << 24;
91659                this.readByte();
91660                this.readByte() << 8;
91661                this.readByte() << 16;
91662                this.readByte() << 24;
91663              }
91664              this.modeZIP && this.nextFile();
91665              t[0] = this.readByte();
91666              if (8 !== t[0]) return 0;
91667              this.gpflags = this.readByte();
91668              this.readByte();
91669              this.readByte();
91670              this.readByte();
91671              this.readByte();
91672              this.readByte();
91673              this.readByte();
91674              if (4 & this.gpflags) {
91675                t[0] = this.readByte();
91676                t[2] = this.readByte();
91677                this.len = t[0] + 256 * t[1];
91678                for (e = 0; e < this.len; e++) this.readByte();
91679              }
91680              if (8 & this.gpflags) {
91681                e = 0;
91682                this.nameBuf = [];
91683                for (;i = this.readByte(); ) {
91684                  "7" !== i && ":" !== i || (e = 0);
91685                  e < Xft.NAMEMAX - 1 && (this.nameBuf[e++] = i);
91686                }
91687              }
91688              if (16 & this.gpflags) for (;i = this.readByte(); ) ;
91689              if (2 & this.gpflags) {
91690                this.readByte();
91691                this.readByte();
91692              }
91693              this.DeflateLoop();
91694              this.readByte();
91695              this.readByte() << 8;
91696              this.readByte() << 16;
91697              this.readByte() << 24;
91698              this.modeZIP && this.nextFile();
91699            };
91700            var Wft = {
91701              name: "Jacob__Codec"
91702            };
91703            Wft.Base64 = jft;
91704            Wft.GZip = Xft;
91705            Wft.unzip = function() {
91706              return Wft.GZip.gunzip.apply(Wft.GZip, arguments);
91707            };
91708            Wft.unzipBase64 = function() {
91709              var t = Wft.Base64.decode.apply(Wft.Base64, arguments);
91710              try {
91711                return Wft.GZip.gunzip.call(Wft.GZip, t);
91712              } catch (e) {
91713                return t.slice(7);
91714              }
91715            };
91716            Wft.unzipBase64AsArray = function(t, e) {
91717              e = e || 1;
91718              var i, s, n, r = this.unzipBase64(t), o = [];
91719              for (i = 0, n = r.length / e; i < n; i++) {
91720                o[i] = 0;
91721                for (s = e - 1; s >= 0; --s) o[i] += r.charCodeAt(i * e + s) << 8 * s;
91722              }
91723              return o;
91724            };
91725            Wft.unzipAsArray = function(t, e) {
91726              e = e || 1;
91727              var i, s, n, r = this.unzip(t), o = [];
91728              for (i = 0, n = r.length / e; i < n; i++) {
91729                o[i] = 0;
91730                for (s = e - 1; s >= 0; --s) o[i] += r.charCodeAt(i * e + s) << 8 * s;
91731              }
91732              return o;
91733            };
91734            var Yft, qft, Kft, Jft, Zft, Qft, $ft, tgt, egt, igt, sgt, ngt, rgt, ogt, agt, lgt, hgt, cgt, ugt, _gt, dgt, pgt, mgt, fgt, ggt, ygt, bgt, Sgt, Agt, Tgt, vgt, Egt, Cgt, xgt, wgt, Rgt, Igt, Mgt, Bgt, Dgt, Pgt, Ogt, Ngt, Lgt, Fgt, Vgt, kgt, Ugt, Ggt, zgt, Hgt, jgt, Xgt, Wgt, Ygt, qgt, Kgt, Jgt, Zgt, Qgt, $gt, tyt, eyt, iyt, syt, nyt, ryt, oyt, ayt, lyt, hyt, cyt, uyt, _yt, dyt, pyt, myt, fyt, gyt, yyt, byt, Syt, Ayt, Tyt, vyt, Eyt, Cyt, xyt, wyt, Ryt, Iyt, Myt, Byt, Dyt, Pyt, Oyt, Nyt, Lyt, Fyt, Vyt, kyt, Uyt;
91735            let Gyt;
91736            !function(t) {
91737              t[t.JPG = 0] = "JPG";
91738              t[t.PNG = 1] = "PNG";
91739              t[t.TIFF = 2] = "TIFF";
91740              t[t.WEBP = 3] = "WEBP";
91741              t[t.PVR = 4] = "PVR";
91742              t[t.ETC = 5] = "ETC";
91743              t[t.S3TC = 6] = "S3TC";
91744              t[t.ATITC = 7] = "ATITC";
91745              t[t.TGA = 8] = "TGA";
91746              t[t.RAWDATA = 9] = "RAWDATA";
91747              t[t.UNKNOWN = 10] = "UNKNOWN";
91748            }(Gyt || (Gyt = {}));
91749            function zyt(t) {
91750              const e = t.parent;
91751              const i = t.getComponent(Hyt);
91752              return e && i ? zyt(e) : t.getComponentsInChildren(Hyt);
91753            }
91754            let Hyt = t("ParticleSystem2D", (Yft = Ul("cc.ParticleSystem2D"), qft = $l(), Kft = ph(),
91755            Jft = lh(), Zft = Th(Lft), Qft = ph(), $ft = lh(), tgt = Th(GI), egt = lh(), igt = lh(),
91756            sgt = lh(), ngt = lh(), rgt = lh(), ogt = lh(), agt = lh(), lgt = lh(), hgt = rh(),
91757            cgt = lh(), ugt = lh(), _gt = lh(), dgt = lh(), pgt = lh(), mgt = lh(), fgt = lh(),
91758            ggt = lh(), ygt = lh(), bgt = lh(), Sgt = lh(), Agt = lh(), Tgt = lh(), vgt = Th(vft),
91759            Egt = lh(), Cgt = ph(), xgt = lh(), wgt = Th(Tft), Rgt = lh(), Igt = lh(), Mgt = lh(),
91760            Bgt = lh(), Dgt = lh(), Pgt = lh(), Ogt = lh(), Ngt = lh(), Lgt = lh(), Fgt = lh(),
91761            Vgt = lh(), kgt = lh(), Ugt = lh(), Ggt = lh(), zgt = lh(), Hgt = ph(), jgt = lh(),
91762            Xgt = ph(), Wgt = lh(), Ygt = ql("preview"), Yft(qgt = qft(qgt = th(qgt = Ql(qgt = (Kgt = (Uyt = kyt = class t extends uD {
91763              get custom() {
91764                return this._custom;
91765              }
91766              set custom(t) {
91767                if (this._custom !== t) {
91768                  this._custom = t;
91769                  this._applyFile();
91770                }
91771              }
91772              get file() {
91773                return this._file;
91774              }
91775              set file(t) {
91776                if (this._file !== t) {
91777                  this._file = t;
91778                  t ? this._applyFile() : this.custom = !0;
91779                }
91780              }
91781              get spriteFrame() {
91782                return this._spriteFrame;
91783              }
91784              set spriteFrame(t) {
91785                if (this._renderSpriteFrame !== t) {
91786                  this._renderSpriteFrame = t;
91787                  t && !t._uuid || (this._spriteFrame = t);
91788                  this._applySpriteFrame();
91789                }
91790              }
91791              get particleCount() {
91792                return this._simulator.particles.length;
91793              }
91794              get totalParticles() {
91795                return this._totalParticles;
91796              }
91797              set totalParticles(t) {
91798                this._totalParticles !== t && (this._totalParticles = t);
91799              }
91800              get startColor() {
91801                return this._startColor;
91802              }
91803              set startColor(t) {
91804                this._startColor.r = t.r;
91805                this._startColor.g = t.g;
91806                this._startColor.b = t.b;
91807                this._startColor.a = t.a;
91808              }
91809              get startColorVar() {
91810                return this._startColorVar;
91811              }
91812              set startColorVar(t) {
91813                this._startColorVar.r = t.r;
91814                this._startColorVar.g = t.g;
91815                this._startColorVar.b = t.b;
91816                this._startColorVar.a = t.a;
91817              }
91818              set color(t) {}
91819              get color() {
91820                return this._color;
91821              }
91822              get endColor() {
91823                return this._endColor;
91824              }
91825              set endColor(t) {
91826                this._endColor.r = t.r;
91827                this._endColor.g = t.g;
91828                this._endColor.b = t.b;
91829                this._endColor.a = t.a;
91830              }
91831              get endColorVar() {
91832                return this._endColorVar;
91833              }
91834              set endColorVar(t) {
91835                this._endColorVar.r = t.r;
91836                this._endColorVar.g = t.g;
91837                this._endColorVar.b = t.b;
91838                this._endColorVar.a = t.a;
91839              }
91840              get positionType() {
91841                return this._positionType;
91842              }
91843              set positionType(t) {
91844                this._positionType = t;
91845                this._updateMaterial();
91846                this._updatePositionType();
91847              }
91848              get preview() {
91849                return this._preview;
91850              }
91851              set preview(t) {
91852                t ? this._startPreview() : this._stopPreview();
91853                this._preview = t;
91854              }
91855              get stopped() {
91856                return this._stopped;
91857              }
91858              get active() {
91859                return this._simulator.active;
91860              }
91861              get assembler() {
91862                return this._assembler;
91863              }
91864              constructor() {
91865                super();
91866                Ml(this, "duration", Jgt, this);
91867                Ml(this, "emissionRate", Zgt, this);
91868                Ml(this, "life", Qgt, this);
91869                Ml(this, "lifeVar", $gt, this);
91870                Ml(this, "angle", tyt, this);
91871                Ml(this, "angleVar", eyt, this);
91872                Ml(this, "startSize", iyt, this);
91873                Ml(this, "startSizeVar", syt, this);
91874                Ml(this, "endSize", nyt, this);
91875                Ml(this, "endSizeVar", ryt, this);
91876                Ml(this, "startSpin", oyt, this);
91877                Ml(this, "startSpinVar", ayt, this);
91878                Ml(this, "endSpin", lyt, this);
91879                Ml(this, "endSpinVar", hyt, this);
91880                Ml(this, "sourcePos", cyt, this);
91881                Ml(this, "posVar", uyt, this);
91882                Ml(this, "emitterMode", _yt, this);
91883                Ml(this, "gravity", dyt, this);
91884                Ml(this, "speed", pyt, this);
91885                Ml(this, "speedVar", myt, this);
91886                Ml(this, "tangentialAccel", fyt, this);
91887                Ml(this, "tangentialAccelVar", gyt, this);
91888                Ml(this, "radialAccel", yyt, this);
91889                Ml(this, "radialAccelVar", byt, this);
91890                Ml(this, "rotationIsDir", Syt, this);
91891                Ml(this, "startRadius", Ayt, this);
91892                Ml(this, "startRadiusVar", Tyt, this);
91893                Ml(this, "endRadius", vyt, this);
91894                Ml(this, "endRadiusVar", Eyt, this);
91895                Ml(this, "rotatePerS", Cyt, this);
91896                Ml(this, "rotatePerSVar", xyt, this);
91897                this.aspectRatio = 1;
91898                Ml(this, "playOnLoad", wyt, this);
91899                Ml(this, "autoRemoveOnFinish", Ryt, this);
91900                Ml(this, "_preview", Iyt, this);
91901                Ml(this, "_custom", Myt, this);
91902                Ml(this, "_file", Byt, this);
91903                Ml(this, "_spriteFrame", Dyt, this);
91904                Ml(this, "_totalParticles", Pyt, this);
91905                Ml(this, "_startColor", Oyt, this);
91906                Ml(this, "_startColorVar", Nyt, this);
91907                Ml(this, "_endColor", Lyt, this);
91908                Ml(this, "_endColorVar", Fyt, this);
91909                Ml(this, "_positionType", Vyt, this);
91910                this._stopped = !0;
91911                this.initProperties();
91912              }
91913              onEnable() {
91914                super.onEnable();
91915                this._updateMaterial();
91916                this._updatePositionType();
91917              }
91918              onDestroy() {
91919                super.onDestroy();
91920                this.autoRemoveOnFinish && (this.autoRemoveOnFinish = !1);
91921                this._simulator.uvFilled = 0;
91922                this._simulator.renderData && this._assembler && this._assembler.removeData(this._simulator.renderData);
91923              }
91924              initProperties() {
91925                this._previewTimer = null;
91926                this._focused = !1;
91927                this.aspectRatio = 1;
91928                this._simulator = new Dft(this);
91929              }
91930              onFocusInEditor() {
91931                this._focused = !0;
91932                const t = zyt(this.node);
91933                for (let e = 0; e < t.length; ++e) t[e]._startPreview();
91934              }
91935              onLostFocusInEditor() {
91936                this._focused = !1;
91937                const t = zyt(this.node);
91938                for (let e = 0; e < t.length; ++e) t[e]._stopPreview();
91939              }
91940              _startPreview() {
91941                this._preview && this.resetSystem();
91942              }
91943              _stopPreview() {
91944                if (this._preview) {
91945                  this.resetSystem();
91946                  this.stopSystem();
91947                }
91948                this._previewTimer && clearInterval(this._previewTimer);
91949              }
91950              __preload() {
91951                super.__preload();
91952                if (this._custom && this.spriteFrame && !this._renderSpriteFrame) this._applySpriteFrame(); else if (this._file) if (this._custom) {
91953                  !this._getTexture() && this._applyFile();
91954                } else this._applyFile();
91955                this.playOnLoad && this.resetSystem();
91956              }
91957              _flushAssembler() {
91958                const e = t.Assembler.getAssembler(this);
91959                this._assembler !== e && (this._assembler = e);
91960                if (this._assembler && this._assembler.createData) {
91961                  this._simulator.renderData = this._assembler.createData(this);
91962                  this._simulator.renderData.particleInitRenderDrawInfo(this.renderEntity);
91963                  this._simulator.initDrawInfo();
91964                }
91965              }
91966              lateUpdate(t) {
91967                this._simulator.finished || this._simulator.step(t);
91968              }
91969              addParticle() {}
91970              stopSystem() {
91971                this._stopped = !0;
91972                this._simulator.stop();
91973              }
91974              resetSystem() {
91975                this._stopped = !1;
91976                this._simulator.reset();
91977                this.markForUpdateRenderData();
91978              }
91979              isFull() {
91980                return this.particleCount >= this.totalParticles;
91981              }
91982              _applyFile() {
91983                const t = this._file;
91984                if (t) {
91985                  if (!t) {
91986                    F(6029);
91987                    return;
91988                  }
91989                  if (!this.isValid) return;
91990                  this._plistFile = t.nativeUrl;
91991                  if (!this._custom) {
91992                    this._spriteFrame !== t.spriteFrame && (this.spriteFrame = t.spriteFrame);
91993                    this._initWithDictionary(t._nativeAsset);
91994                  }
91995                  this._spriteFrame ? !this._renderSpriteFrame && this._spriteFrame && this._applySpriteFrame() : t.spriteFrame ? this.spriteFrame = t.spriteFrame : this._custom && this._initTextureWithDictionary(t._nativeAsset);
91996                }
91997              }
91998              _initTextureWithDictionary(t) {
91999                if (t.spriteFrameUuid) {
92000                  const e = t.spriteFrameUuid;
92001                  SR.loadAny(e, ((e, i) => {
92002                    if (e) {
92003                      t.spriteFrameUuid = void 0;
92004                      this._initTextureWithDictionary(t);
92005                      x(e);
92006                    } else this.spriteFrame = i;
92007                  }));
92008                } else {
92009                  const i = hc(this._plistFile, t.textureFileName || "");
92010                  if (t.textureFileName) SR.loadRemote(i, ((e, i) => {
92011                    if (e) {
92012                      t.textureFileName = void 0;
92013                      this._initTextureWithDictionary(t);
92014                      x(e);
92015                    } else this.spriteFrame = i ? GI.createWithImage(i) : GI.createWithImage(xR.get("white-texture"));
92016                  })); else if (t.textureImageData) {
92017                    const s = t.textureImageData;
92018                    if (!(s && s.length > 0)) return !1;
92019                    {
92020                      let t = SR.assets.get(i);
92021                      if (!t) {
92022                        const n = Wft.unzipBase64AsArray(s, 1);
92023                        if (!n) {
92024                          N(6030, this._file.name);
92025                          return !1;
92026                        }
92027                        const r = (e = n).length > 8 && 137 === e[0] && 80 === e[1] && 78 === e[2] && 71 === e[3] && 13 === e[4] && 10 === e[5] && 26 === e[6] && 10 === e[7] ? Gyt.PNG : e.length > 2 && (73 === e[0] && 73 === e[1] || 77 === e[0] && 77 === e[1] || 255 === e[0] && 216 === e[1]) ? Gyt.TIFF : Gyt.UNKNOWN;
92028                        if (r !== Gyt.TIFF && r !== Gyt.PNG) {
92029                          N(6031, this._file.name);
92030                          return !1;
92031                        }
92032                        const o = document.createElement("canvas");
92033                        if (r === Gyt.PNG) {
92034                          new kft(n).render(o);
92035                        } else {
92036                          this._tiffReader || (this._tiffReader = new Uft);
92037                          this._tiffReader.parseTIFF(n, o);
92038                        }
92039                        t = new IC(o);
92040                        SR.assets.add(i, t);
92041                      }
92042                      t || N(6032, this._file.name);
92043                      this.spriteFrame = t ? GI.createWithImage(t) : GI.createWithImage(xR.get("white-texture"));
92044                    }
92045                  }
92046                }
92047                var e;
92048                return !0;
92049              }
92050              _initWithDictionary(t) {
92051                this.totalParticles = parseInt(t.maxParticles || 0);
92052                this.life = parseFloat(t.particleLifespan || 0);
92053                this.lifeVar = parseFloat(t.particleLifespanVariance || 0);
92054                const e = t.emissionRate;
92055                this.emissionRate = e || Math.min(this.totalParticles / this.life, Number.MAX_VALUE);
92056                this.duration = parseFloat(t.duration || 0);
92057                this._srcBlendFactor = parseInt(t.blendFuncSource || Ls.SRC_ALPHA);
92058                this._dstBlendFactor = parseInt(t.blendFuncDestination || Ls.ONE_MINUS_SRC_ALPHA);
92059                const i = this._startColor;
92060                i.r = 255 * parseFloat(t.startColorRed || 0);
92061                i.g = 255 * parseFloat(t.startColorGreen || 0);
92062                i.b = 255 * parseFloat(t.startColorBlue || 0);
92063                i.a = 255 * parseFloat(t.startColorAlpha || 0);
92064                const s = this._startColorVar;
92065                s.r = 255 * parseFloat(t.startColorVarianceRed || 0);
92066                s.g = 255 * parseFloat(t.startColorVarianceGreen || 0);
92067                s.b = 255 * parseFloat(t.startColorVarianceBlue || 0);
92068                s.a = 255 * parseFloat(t.startColorVarianceAlpha || 0);
92069                const n = this._endColor;
92070                n.r = 255 * parseFloat(t.finishColorRed || 0);
92071                n.g = 255 * parseFloat(t.finishColorGreen || 0);
92072                n.b = 255 * parseFloat(t.finishColorBlue || 0);
92073                n.a = 255 * parseFloat(t.finishColorAlpha || 0);
92074                const r = this._endColorVar;
92075                r.r = 255 * parseFloat(t.finishColorVarianceRed || 0);
92076                r.g = 255 * parseFloat(t.finishColorVarianceGreen || 0);
92077                r.b = 255 * parseFloat(t.finishColorVarianceBlue || 0);
92078                r.a = 255 * parseFloat(t.finishColorVarianceAlpha || 0);
92079                this.startSize = parseFloat(t.startParticleSize || 0);
92080                this.startSizeVar = parseFloat(t.startParticleSizeVariance || 0);
92081                this.endSize = parseFloat(t.finishParticleSize || 0);
92082                this.endSizeVar = parseFloat(t.finishParticleSizeVariance || 0);
92083                this.positionType = parseFloat(void 0 !== t.positionType ? t.positionType : vft.FREE);
92084                this.sourcePos.set(0, 0);
92085                this.posVar.set(parseFloat(t.sourcePositionVariancex || 0), parseFloat(t.sourcePositionVariancey || 0));
92086                this.angle = parseFloat(t.angle || 0);
92087                this.angleVar = parseFloat(t.angleVariance || 0);
92088                this.startSpin = parseFloat(t.rotationStart || 0);
92089                this.startSpinVar = parseFloat(t.rotationStartVariance || 0);
92090                this.endSpin = parseFloat(t.rotationEnd || 0);
92091                this.endSpinVar = parseFloat(t.rotationEndVariance || 0);
92092                this.emitterMode = parseInt(t.emitterType || Tft.GRAVITY);
92093                if (this.emitterMode === Tft.GRAVITY) {
92094                  this.gravity.set(parseFloat(t.gravityx || 0), parseFloat(t.gravityy || 0));
92095                  this.speed = parseFloat(t.speed || 0);
92096                  this.speedVar = parseFloat(t.speedVariance || 0);
92097                  this.radialAccel = parseFloat(t.radialAcceleration || 0);
92098                  this.radialAccelVar = parseFloat(t.radialAccelVariance || 0);
92099                  this.tangentialAccel = parseFloat(t.tangentialAcceleration || 0);
92100                  this.tangentialAccelVar = parseFloat(t.tangentialAccelVariance || 0);
92101                  let e = t.rotationIsDir || "";
92102                  if (null !== e) {
92103                    e = e.toString().toLowerCase();
92104                    this.rotationIsDir = "true" === e || "1" === e;
92105                  } else this.rotationIsDir = !1;
92106                } else {
92107                  if (this.emitterMode !== Tft.RADIUS) {
92108                    N(6009);
92109                    return !1;
92110                  }
92111                  this.startRadius = parseFloat(t.maxRadius || 0);
92112                  this.startRadiusVar = parseFloat(t.maxRadiusVariance || 0);
92113                  this.endRadius = parseFloat(t.minRadius || 0);
92114                  this.endRadiusVar = parseFloat(t.minRadiusVariance || 0);
92115                  this.rotatePerS = parseFloat(t.rotatePerSecond || 0);
92116                  this.rotatePerSVar = parseFloat(t.rotatePerSecondVariance || 0);
92117                }
92118                this._initTextureWithDictionary(t);
92119                return !0;
92120              }
92121              _syncAspect() {
92122                if (this._renderSpriteFrame) {
92123                  const t = this._renderSpriteFrame.rect;
92124                  this.aspectRatio = t.width / t.height;
92125                }
92126              }
92127              _applySpriteFrame() {
92128                this._renderSpriteFrame = this._renderSpriteFrame || this._spriteFrame;
92129                if (this._renderSpriteFrame) {
92130                  if (this._renderSpriteFrame.texture) {
92131                    this._simulator.updateUVs(!0);
92132                    this._syncAspect();
92133                    this._updateMaterial();
92134                    this._stopped = !1;
92135                    this.markForUpdateRenderData();
92136                  }
92137                } else this.resetSystem();
92138              }
92139              _getTexture() {
92140                return this._renderSpriteFrame && this._renderSpriteFrame.texture;
92141              }
92142              _updateMaterial() {
92143                const t = this.getMaterialInstance(0);
92144                t && t.recompileShaders({
92145                  USE_LOCAL: this._positionType !== vft.FREE
92146                });
92147                t && t.passes.length > 0 && this._updateBlendFunc();
92148              }
92149              _finishedSimulation() {
92150                this.resetSystem();
92151                this.stopSystem();
92152                this.markForUpdateRenderData();
92153                this.autoRemoveOnFinish && this._stopped && this.node.destroy();
92154              }
92155              _canRender() {
92156                return super._canRender() && !this._stopped && null !== this._renderSpriteFrame && void 0 !== this._renderSpriteFrame;
92157              }
92158              _render(t) {
92159                this._positionType === vft.RELATIVE ? t.commitComp(this, this._simulator.renderData, this._renderSpriteFrame, this._assembler, this.node.parent) : this.positionType === vft.GROUPED ? t.commitComp(this, this._simulator.renderData, this._renderSpriteFrame, this._assembler, this.node) : t.commitComp(this, this._simulator.renderData, this._renderSpriteFrame, this._assembler, null);
92160              }
92161              _updatePositionType() {
92162                if (this._positionType === vft.RELATIVE) {
92163                  this._renderEntity.setRenderTransform(this.node.parent);
92164                  this._renderEntity.setUseLocal(!0);
92165                } else if (this.positionType === vft.GROUPED) {
92166                  this._renderEntity.setRenderTransform(this.node);
92167                  this._renderEntity.setUseLocal(!0);
92168                } else {
92169                  this._renderEntity.setRenderTransform(null);
92170                  this._renderEntity.setUseLocal(!1);
92171                }
92172              }
92173            }, kyt.EmitterMode = Tft, kyt.PositionType = vft, kyt.DURATION_INFINITY = -1, kyt.START_SIZE_EQUAL_TO_END_SIZE = -1,
92174            kyt.START_RADIUS_EQUAL_TO_END_RADIUS = -1, Uyt), Bl(Kgt.prototype, "custom", [ nh, Kft, Jft ], Object.getOwnPropertyDescriptor(Kgt.prototype, "custom"), Kgt.prototype),
92175            Bl(Kgt.prototype, "file", [ Zft, Qft, $ft ], Object.getOwnPropertyDescriptor(Kgt.prototype, "file"), Kgt.prototype),
92176            Bl(Kgt.prototype, "spriteFrame", [ tgt, egt ], Object.getOwnPropertyDescriptor(Kgt.prototype, "spriteFrame"), Kgt.prototype),
92177            Bl(Kgt.prototype, "totalParticles", [ nh, igt ], Object.getOwnPropertyDescriptor(Kgt.prototype, "totalParticles"), Kgt.prototype),
92178            Jgt = Bl(Kgt.prototype, "duration", [ Yl, nh, sgt ], {
92179              configurable: !0,
92180              enumerable: !0,
92181              writable: !0,
92182              initializer: function() {
92183                return -1;
92184              }
92185            }), Zgt = Bl(Kgt.prototype, "emissionRate", [ Yl, nh, ngt ], {
92186              configurable: !0,
92187              enumerable: !0,
92188              writable: !0,
92189              initializer: function() {
92190                return 10;
92191              }
92192            }), Qgt = Bl(Kgt.prototype, "life", [ Yl, nh, rgt ], {
92193              configurable: !0,
92194              enumerable: !0,
92195              writable: !0,
92196              initializer: function() {
92197                return 1;
92198              }
92199            }), $gt = Bl(Kgt.prototype, "lifeVar", [ Yl, nh, ogt ], {
92200              configurable: !0,
92201              enumerable: !0,
92202              writable: !0,
92203              initializer: function() {
92204                return 0;
92205              }
92206            }), Bl(Kgt.prototype, "startColor", [ nh, agt ], Object.getOwnPropertyDescriptor(Kgt.prototype, "startColor"), Kgt.prototype),
92207            Bl(Kgt.prototype, "startColorVar", [ nh, lgt ], Object.getOwnPropertyDescriptor(Kgt.prototype, "startColorVar"), Kgt.prototype),
92208            Bl(Kgt.prototype, "color", [ hgt ], Object.getOwnPropertyDescriptor(Kgt.prototype, "color"), Kgt.prototype),
92209            Bl(Kgt.prototype, "endColor", [ nh, cgt ], Object.getOwnPropertyDescriptor(Kgt.prototype, "endColor"), Kgt.prototype),
92210            Bl(Kgt.prototype, "endColorVar", [ nh, ugt ], Object.getOwnPropertyDescriptor(Kgt.prototype, "endColorVar"), Kgt.prototype),
92211            tyt = Bl(Kgt.prototype, "angle", [ Yl, nh, _gt ], {
92212              configurable: !0,
92213              enumerable: !0,
92214              writable: !0,
92215              initializer: function() {
92216                return 90;
92217              }
92218            }), eyt = Bl(Kgt.prototype, "angleVar", [ Yl, nh, dgt ], {
92219              configurable: !0,
92220              enumerable: !0,
92221              writable: !0,
92222              initializer: function() {
92223                return 20;
92224              }
92225            }), iyt = Bl(Kgt.prototype, "startSize", [ Yl, nh, pgt ], {
92226              configurable: !0,
92227              enumerable: !0,
92228              writable: !0,
92229              initializer: function() {
92230                return 50;
92231              }
92232            }), syt = Bl(Kgt.prototype, "startSizeVar", [ Yl, nh, mgt ], {
92233              configurable: !0,
92234              enumerable: !0,
92235              writable: !0,
92236              initializer: function() {
92237                return 0;
92238              }
92239            }), nyt = Bl(Kgt.prototype, "endSize", [ Yl, nh, fgt ], {
92240              configurable: !0,
92241              enumerable: !0,
92242              writable: !0,
92243              initializer: function() {
92244                return 0;
92245              }
92246            }), ryt = Bl(Kgt.prototype, "endSizeVar", [ Yl, nh, ggt ], {
92247              configurable: !0,
92248              enumerable: !0,
92249              writable: !0,
92250              initializer: function() {
92251                return 0;
92252              }
92253            }), oyt = Bl(Kgt.prototype, "startSpin", [ Yl, nh, ygt ], {
92254              configurable: !0,
92255              enumerable: !0,
92256              writable: !0,
92257              initializer: function() {
92258                return 0;
92259              }
92260            }), ayt = Bl(Kgt.prototype, "startSpinVar", [ Yl, nh, bgt ], {
92261              configurable: !0,
92262              enumerable: !0,
92263              writable: !0,
92264              initializer: function() {
92265                return 0;
92266              }
92267            }), lyt = Bl(Kgt.prototype, "endSpin", [ Yl, nh, Sgt ], {
92268              configurable: !0,
92269              enumerable: !0,
92270              writable: !0,
92271              initializer: function() {
92272                return 0;
92273              }
92274            }), hyt = Bl(Kgt.prototype, "endSpinVar", [ Yl, nh, Agt ], {
92275              configurable: !0,
92276              enumerable: !0,
92277              writable: !0,
92278              initializer: function() {
92279                return 0;
92280              }
92281            }), cyt = Bl(Kgt.prototype, "sourcePos", [ Yl ], {
92282              configurable: !0,
92283              enumerable: !0,
92284              writable: !0,
92285              initializer: function() {
92286                return Qi.ZERO.clone();
92287              }
92288            }), uyt = Bl(Kgt.prototype, "posVar", [ Yl, nh, Tgt ], {
92289              configurable: !0,
92290              enumerable: !0,
92291              writable: !0,
92292              initializer: function() {
92293                return Qi.ZERO.clone();
92294              }
92295            }), Bl(Kgt.prototype, "positionType", [ vgt, Egt ], Object.getOwnPropertyDescriptor(Kgt.prototype, "positionType"), Kgt.prototype),
92296            Bl(Kgt.prototype, "preview", [ nh, Cgt, xgt ], Object.getOwnPropertyDescriptor(Kgt.prototype, "preview"), Kgt.prototype),
92297            _yt = Bl(Kgt.prototype, "emitterMode", [ Yl, nh, wgt, Rgt ], {
92298              configurable: !0,
92299              enumerable: !0,
92300              writable: !0,
92301              initializer: function() {
92302                return Tft.GRAVITY;
92303              }
92304            }), dyt = Bl(Kgt.prototype, "gravity", [ Yl, nh, Igt ], {
92305              configurable: !0,
92306              enumerable: !0,
92307              writable: !0,
92308              initializer: function() {
92309                return Qi.ZERO.clone();
92310              }
92311            }), pyt = Bl(Kgt.prototype, "speed", [ Yl, nh, Mgt ], {
92312              configurable: !0,
92313              enumerable: !0,
92314              writable: !0,
92315              initializer: function() {
92316                return 180;
92317              }
92318            }), myt = Bl(Kgt.prototype, "speedVar", [ Yl, nh, Bgt ], {
92319              configurable: !0,
92320              enumerable: !0,
92321              writable: !0,
92322              initializer: function() {
92323                return 50;
92324              }
92325            }), fyt = Bl(Kgt.prototype, "tangentialAccel", [ Yl, nh, Dgt ], {
92326              configurable: !0,
92327              enumerable: !0,
92328              writable: !0,
92329              initializer: function() {
92330                return 80;
92331              }
92332            }), gyt = Bl(Kgt.prototype, "tangentialAccelVar", [ Yl, nh, Pgt ], {
92333              configurable: !0,
92334              enumerable: !0,
92335              writable: !0,
92336              initializer: function() {
92337                return 0;
92338              }
92339            }), yyt = Bl(Kgt.prototype, "radialAccel", [ Yl, nh, Ogt ], {
92340              configurable: !0,
92341              enumerable: !0,
92342              writable: !0,
92343              initializer: function() {
92344                return 0;
92345              }
92346            }), byt = Bl(Kgt.prototype, "radialAccelVar", [ Yl, nh, Ngt ], {
92347              configurable: !0,
92348              enumerable: !0,
92349              writable: !0,
92350              initializer: function() {
92351                return 0;
92352              }
92353            }), Syt = Bl(Kgt.prototype, "rotationIsDir", [ Yl, nh, Lgt ], {
92354              configurable: !0,
92355              enumerable: !0,
92356              writable: !0,
92357              initializer: function() {
92358                return !1;
92359              }
92360            }), Ayt = Bl(Kgt.prototype, "startRadius", [ Yl, nh, Fgt ], {
92361              configurable: !0,
92362              enumerable: !0,
92363              writable: !0,
92364              initializer: function() {
92365                return 0;
92366              }
92367            }), Tyt = Bl(Kgt.prototype, "startRadiusVar", [ Yl, nh, Vgt ], {
92368              configurable: !0,
92369              enumerable: !0,
92370              writable: !0,
92371              initializer: function() {
92372                return 0;
92373              }
92374            }), vyt = Bl(Kgt.prototype, "endRadius", [ Yl, nh, kgt ], {
92375              configurable: !0,
92376              enumerable: !0,
92377              writable: !0,
92378              initializer: function() {
92379                return 0;
92380              }
92381            }), Eyt = Bl(Kgt.prototype, "endRadiusVar", [ Yl, nh, Ugt ], {
92382              configurable: !0,
92383              enumerable: !0,
92384              writable: !0,
92385              initializer: function() {
92386                return 0;
92387              }
92388            }), Cyt = Bl(Kgt.prototype, "rotatePerS", [ Yl, nh, Ggt ], {
92389              configurable: !0,
92390              enumerable: !0,
92391              writable: !0,
92392              initializer: function() {
92393                return 0;
92394              }
92395            }), xyt = Bl(Kgt.prototype, "rotatePerSVar", [ Yl, nh, zgt ], {
92396              configurable: !0,
92397              enumerable: !0,
92398              writable: !0,
92399              initializer: function() {
92400                return 0;
92401              }
92402            }), wyt = Bl(Kgt.prototype, "playOnLoad", [ Yl, nh, Hgt, jgt ], {
92403              configurable: !0,
92404              enumerable: !0,
92405              writable: !0,
92406              initializer: function() {
92407                return !0;
92408              }
92409            }), Ryt = Bl(Kgt.prototype, "autoRemoveOnFinish", [ Yl, nh, Xgt, Wgt ], {
92410              configurable: !0,
92411              enumerable: !0,
92412              writable: !0,
92413              initializer: function() {
92414                return !1;
92415              }
92416            }), Iyt = Bl(Kgt.prototype, "_preview", [ Ygt ], {
92417              configurable: !0,
92418              enumerable: !0,
92419              writable: !0,
92420              initializer: function() {
92421                return !0;
92422              }
92423            }), Myt = Bl(Kgt.prototype, "_custom", [ Yl ], {
92424              configurable: !0,
92425              enumerable: !0,
92426              writable: !0,
92427              initializer: function() {
92428                return !1;
92429              }
92430            }), Byt = Bl(Kgt.prototype, "_file", [ Yl ], {
92431              configurable: !0,
92432              enumerable: !0,
92433              writable: !0,
92434              initializer: function() {
92435                return null;
92436              }
92437            }), Dyt = Bl(Kgt.prototype, "_spriteFrame", [ Yl ], {
92438              configurable: !0,
92439              enumerable: !0,
92440              writable: !0,
92441              initializer: function() {
92442                return null;
92443              }
92444            }), Pyt = Bl(Kgt.prototype, "_totalParticles", [ Yl ], {
92445              configurable: !0,
92446              enumerable: !0,
92447              writable: !0,
92448              initializer: function() {
92449                return 150;
92450              }
92451            }), Oyt = Bl(Kgt.prototype, "_startColor", [ Yl ], {
92452              configurable: !0,
92453              enumerable: !0,
92454              writable: !0,
92455              initializer: function() {
92456                return new Bi(255, 255, 255, 255);
92457              }
92458            }), Nyt = Bl(Kgt.prototype, "_startColorVar", [ Yl ], {
92459              configurable: !0,
92460              enumerable: !0,
92461              writable: !0,
92462              initializer: function() {
92463                return new Bi(0, 0, 0, 0);
92464              }
92465            }), Lyt = Bl(Kgt.prototype, "_endColor", [ Yl ], {
92466              configurable: !0,
92467              enumerable: !0,
92468              writable: !0,
92469              initializer: function() {
92470                return new Bi(255, 255, 255, 0);
92471              }
92472            }), Fyt = Bl(Kgt.prototype, "_endColorVar", [ Yl ], {
92473              configurable: !0,
92474              enumerable: !0,
92475              writable: !0,
92476              initializer: function() {
92477                return new Bi(0, 0, 0, 0);
92478              }
92479            }), Vyt = Bl(Kgt.prototype, "_positionType", [ Yl ], {
92480              configurable: !0,
92481              enumerable: !0,
92482              writable: !0,
92483              initializer: function() {
92484                return vft.FREE;
92485              }
92486            }), Kgt)) || qgt) || qgt) || qgt) || qgt));
92487            var jyt, Xyt, Wyt, Yyt, qyt, Kyt, Jyt, Zyt, Qyt, $yt, tbt, ebt, ibt, sbt;
92488            let nbt = t("MotionStreak", (jyt = Ul("cc.MotionStreak"), Xyt = $l(), Wyt = sh(),
92489            Yyt = Th(LC), jyt(qyt = Ql(qyt = th(qyt = Xyt(qyt = Wyt(qyt = (Kyt = (sbt = ibt = class t extends uD {
92490              constructor(...t) {
92491                super(...t);
92492                Ml(this, "_preview", Jyt, this);
92493                Ml(this, "_fadeTime", Zyt, this);
92494                Ml(this, "_minSeg", Qyt, this);
92495                Ml(this, "_stroke", $yt, this);
92496                Ml(this, "_texture", tbt, this);
92497                Ml(this, "_fastMode", ebt, this);
92498                this._points = [];
92499              }
92500              get preview() {
92501                return this._preview;
92502              }
92503              set preview(t) {
92504                this._preview = t;
92505                this.reset();
92506              }
92507              get fadeTime() {
92508                return this._fadeTime;
92509              }
92510              set fadeTime(t) {
92511                this._fadeTime = t;
92512                this.reset();
92513              }
92514              get minSeg() {
92515                return this._minSeg;
92516              }
92517              set minSeg(t) {
92518                this._minSeg = t;
92519              }
92520              get stroke() {
92521                return this._stroke;
92522              }
92523              set stroke(t) {
92524                this._stroke = t;
92525              }
92526              get texture() {
92527                return this._texture;
92528              }
92529              set texture(t) {
92530                this._texture !== t && (this._texture = t);
92531              }
92532              get fastMode() {
92533                return this._fastMode;
92534              }
92535              set fastMode(t) {
92536                this._fastMode = t;
92537              }
92538              get points() {
92539                return this._points;
92540              }
92541              onEnable() {
92542                super.onEnable();
92543                this.reset();
92544              }
92545              _flushAssembler() {
92546                const e = t.Assembler.getAssembler(this);
92547                this._assembler !== e && (this._assembler = e);
92548                if (!this.renderData && this._assembler && this._assembler.createData) {
92549                  this._renderData = this._assembler.createData(this);
92550                  this.renderData.material = this.material;
92551                  this._updateColor();
92552                }
92553              }
92554              onFocusInEditor() {
92555                this._preview && this.reset();
92556              }
92557              onLostFocusInEditor() {
92558                this._preview && this.reset();
92559              }
92560              reset() {
92561                this._points.length = 0;
92562                this.renderData && this.renderData.clear();
92563              }
92564              lateUpdate(t) {
92565                this._assembler && this._assembler.update(this, t);
92566              }
92567              _render(t) {
92568                t.commitComp(this, this.renderData, this._texture, this._assembler, null);
92569              }
92570            }, ibt.Point = class {
92571              constructor(t, e) {
92572                this.point = new Qi;
92573                this.dir = new Qi;
92574                this.distance = 0;
92575                this.time = 0;
92576                t && this.point.set(t);
92577                e && this.dir.set(e);
92578              }
92579              setPoint(t, e) {
92580                this.point.x = t;
92581                this.point.y = e;
92582              }
92583              setDir(t, e) {
92584                this.dir.x = t;
92585                this.dir.y = e;
92586              }
92587            }, sbt), Bl(Kyt.prototype, "preview", [ nh ], Object.getOwnPropertyDescriptor(Kyt.prototype, "preview"), Kyt.prototype),
92588            Bl(Kyt.prototype, "fadeTime", [ nh ], Object.getOwnPropertyDescriptor(Kyt.prototype, "fadeTime"), Kyt.prototype),
92589            Bl(Kyt.prototype, "minSeg", [ nh ], Object.getOwnPropertyDescriptor(Kyt.prototype, "minSeg"), Kyt.prototype),
92590            Bl(Kyt.prototype, "stroke", [ nh ], Object.getOwnPropertyDescriptor(Kyt.prototype, "stroke"), Kyt.prototype),
92591            Bl(Kyt.prototype, "texture", [ Yyt ], Object.getOwnPropertyDescriptor(Kyt.prototype, "texture"), Kyt.prototype),
92592            Bl(Kyt.prototype, "fastMode", [ nh ], Object.getOwnPropertyDescriptor(Kyt.prototype, "fastMode"), Kyt.prototype),
92593            Jyt = Bl(Kyt.prototype, "_preview", [ Yl ], {
92594              configurable: !0,
92595              enumerable: !0,
92596              writable: !0,
92597              initializer: function() {
92598                return !1;
92599              }
92600            }), Zyt = Bl(Kyt.prototype, "_fadeTime", [ Yl ], {
92601              configurable: !0,
92602              enumerable: !0,
92603              writable: !0,
92604              initializer: function() {
92605                return 1;
92606              }
92607            }), Qyt = Bl(Kyt.prototype, "_minSeg", [ Yl ], {
92608              configurable: !0,
92609              enumerable: !0,
92610              writable: !0,
92611              initializer: function() {
92612                return 1;
92613              }
92614            }), $yt = Bl(Kyt.prototype, "_stroke", [ Yl ], {
92615              configurable: !0,
92616              enumerable: !0,
92617              writable: !0,
92618              initializer: function() {
92619                return 64;
92620              }
92621            }), tbt = Bl(Kyt.prototype, "_texture", [ Yl ], {
92622              configurable: !0,
92623              enumerable: !0,
92624              writable: !0,
92625              initializer: function() {
92626                return null;
92627              }
92628            }), ebt = Bl(Kyt.prototype, "_fastMode", [ Yl ], {
92629              configurable: !0,
92630              enumerable: !0,
92631              writable: !0,
92632              initializer: function() {
92633                return !1;
92634              }
92635            }), Kyt)) || qyt) || qyt) || qyt) || qyt) || qyt));
92636            new Qi;
92637            const rbt = new Qi;
92638            const obt = new Qi;
92639            let abt;
92640            function lbt(t, e) {
92641              t.x = -e.y;
92642              t.y = e.x;
92643              return t;
92644            }
92645            const hbt = {
92646              createData(t) {
92647                const e = t.requestRenderData();
92648                e.dataLength = 4;
92649                e.resize(16, 42);
92650                return e;
92651              },
92652              update(t, e) {
92653                const i = t.stroke / 2;
92654                const s = t.node.worldMatrix;
92655                const n = s.m12;
92656                const r = s.m13;
92657                const o = t.points;
92658                let a;
92659                if (o.length > 1) {
92660                  const e = o[0];
92661                  const i = e.point.x - n;
92662                  const s = e.point.y - r;
92663                  i * i + s * s < t.minSeg && (a = e);
92664                }
92665                if (!a) {
92666                  a = new nbt.Point;
92667                  o.unshift(a);
92668                }
92669                a.setPoint(n, r);
92670                a.time = t.fadeTime + e;
92671                let l = 0;
92672                let h = 0;
92673                if (o.length < 2) return;
92674                const c = t.renderData;
92675                this.updateRenderDataCache(t, c);
92676                const u = t.color;
92677                const _ = u.r;
92678                const d = u.g;
92679                const p = u.b;
92680                const m = u.a;
92681                const f = o[1];
92682                f.distance = Qi.subtract(obt, a.point, f.point).length();
92683                obt.normalize();
92684                f.setDir(obt.x, obt.y);
92685                a.setDir(obt.x, obt.y);
92686                c.dataLength = 2 * o.length;
92687                const g = c.data;
92688                const y = t.fadeTime;
92689                let b = !1;
92690                for (let t = o.length - 1; t >= 0; t--) {
92691                  const s = o[t];
92692                  const n = s.point;
92693                  const r = s.dir;
92694                  s.time -= e;
92695                  if (s.time < 0) {
92696                    o.splice(t, 1);
92697                    continue;
92698                  }
92699                  const a = s.time / y;
92700                  const h = o[t - 1];
92701                  if (!b) {
92702                    if (!h) {
92703                      o.splice(t, 1);
92704                      continue;
92705                    }
92706                    n.x = h.point.x - r.x * a;
92707                    n.y = h.point.y - r.y * a;
92708                  }
92709                  b = !0;
92710                  lbt(rbt, r);
92711                  const c = (a * m << 24 >>> 0) + (p << 16) + (d << 8) + _;
92712                  let u = l;
92713                  g[u].x = n.x + rbt.x * i;
92714                  g[u].y = n.y + rbt.y * i;
92715                  g[u].u = 1;
92716                  g[u].v = a;
92717                  g[u].color._val = c;
92718                  u += 1;
92719                  g[u].x = n.x - rbt.x * i;
92720                  g[u].y = n.y - rbt.y * i;
92721                  g[u].u = 0;
92722                  g[u].v = a;
92723                  g[u].color._val = c;
92724                  l += 2;
92725                }
92726                h = l <= 2 ? 0 : 3 * (l - 2);
92727                c.resize(l, h);
92728                {
92729                  const e = c.indexCount;
92730                  this.createQuadIndices(t, e);
92731                  c.chunk.setIndexBuffer(abt);
92732                  this.updateWorldVertexAllData(t);
92733                  c.updateRenderData(t, t.texture);
92734                  c.renderDrawInfo.setVertDirty(!1);
92735                  t.node.hasChangedFlags = 0;
92736                }
92737              },
92738              updateWorldVertexAllData(t) {
92739                const e = t.renderData;
92740                const i = e.floatStride;
92741                const s = e.data;
92742                const n = e.chunk.vb;
92743                for (let t = 0; t < s.length; t++) {
92744                  const e = t * i;
92745                  n[e + 0] = s[t].x;
92746                  n[e + 1] = s[t].y;
92747                  n[e + 2] = s[t].z;
92748                  n[e + 3] = s[t].u;
92749                  n[e + 4] = s[t].v;
92750                  Bi.toArray(n, s[t].color, e + 5);
92751                }
92752              },
92753              createQuadIndices(t, e) {
92754                let i = t.renderData.chunk.meshBuffer.indexOffset;
92755                abt = null;
92756                abt = new Uint16Array(e);
92757                for (let t = 0, s = e; t < s; t += 2) {
92758                  const e = 0 + t;
92759                  abt[i++] = e;
92760                  abt[i++] = e + 2;
92761                  abt[i++] = e + 1;
92762                  abt[i++] = e + 1;
92763                  abt[i++] = e + 2;
92764                  abt[i++] = e + 3;
92765                }
92766              },
92767              updateRenderDataCache(t, e) {
92768                e.passDirty && e.updatePass(t);
92769                e.nodeDirty && e.updateNode(t);
92770                if (e.textureDirty && t.texture) {
92771                  e.updateTexture(t.texture);
92772                  e.material = t.getRenderMaterial(0);
92773                }
92774                e.hashDirty && e.updateHash();
92775              },
92776              updateRenderData(t) {},
92777              updateColor(t) {},
92778              fillBuffers(t, e) {
92779                const i = t.renderData;
92780                const s = i.chunk;
92781                const n = i.data;
92782                const r = i.vertexCount;
92783                const o = i.indexCount;
92784                const a = s.vb;
92785                let l = 0;
92786                for (let t = 0; t < r; t++) {
92787                  const e = n[t];
92788                  a[l++] = e.x;
92789                  a[l++] = e.y;
92790                  a[l++] = e.z;
92791                  a[l++] = e.u;
92792                  a[l++] = e.v;
92793                  Bi.toArray(a, e.color, l);
92794                  l += 4;
92795                }
92796                s.bufferId;
92797                const h = s.vertexOffset;
92798                const c = s.meshBuffer;
92799                const u = s.meshBuffer.iData;
92800                let _ = c.indexOffset;
92801                for (let t = 0, e = o; t < e; t += 2) {
92802                  const e = h + t;
92803                  u[_++] = e;
92804                  u[_++] = e + 2;
92805                  u[_++] = e + 1;
92806                  u[_++] = e + 1;
92807                  u[_++] = e + 2;
92808                  u[_++] = e + 3;
92809                }
92810                c.indexOffset += i.indexCount;
92811                c.setDirty();
92812              }
92813            };
92814            const cbt = t("MotionStreakAssemblerManager", {
92815              getAssembler: t => hbt
92816            });
92817            nbt.Assembler = cbt;
92818            const ubt = {
92819              maxParticleDeltaTime: 0,
92820              createData: t => AB.add(),
92821              removeData(t) {
92822                AB.remove(t);
92823              },
92824              updateRenderData() {},
92825              fillBuffers(t, e) {}
92826            };
92827            const _bt = t("ParticleSystem2DAssembler", {
92828              getAssembler(t) {
92829                ubt.maxParticleDeltaTime || (ubt.maxParticleDeltaTime = m.game.frameTime / 1e3 * 2);
92830                return ubt;
92831              }
92832            });
92833            Hyt.Assembler = _bt;
92834            let dbt;
92835            let pbt;
92836            "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self;
92837            var mbt = function(t, e) {
92838              return t(e = {
92839                exports: {}
92840              }, e.exports), e.exports;
92841            }((function(t, e) {
92842              !function(t) {
92843                function e(t, ...e) {
92844                  if (!t) throw new Error(...e);
92845                }
92846                function i(t, e) {
92847                  return void 0 !== t ? t : e;
92848                }
92849                const s = 1e37;
92850                const n = 1e-5;
92851                const r = n * n;
92852                const o = 3.14159265359;
92853                const a = 2;
92854                const l = 8;
92855                const h = .1;
92856                const c = 2;
92857                const u = .008;
92858                const _ = 2 / 180 * o;
92859                const d = 2 * u;
92860                const p = 8;
92861                const m = 32;
92862                const f = 1;
92863                const g = .2;
92864                const y = 8 / 180 * o;
92865                const b = 2;
92866                const S = b * b;
92867                const A = .5 * o;
92868                const T = A * A;
92869                const v = .2;
92870                const E = .75;
92871                const C = -1;
92872                const x = 2147483647;
92873                const w = .75;
92874                const R = 1;
92875                const I = .25;
92876                const M = .5;
92877                const B = 2;
92878                const D = B * B;
92879                const P = 256;
92880                const O = 2.5;
92881                const N = .5;
92882                const L = .01;
92883                const F = 2 / 180 * o;
92884                function V(t) {
92885                  return null;
92886                }
92887                function k(t) {}
92888                function U(t, ...e) {}
92889                class G {
92890                  constructor(t = 0, e = 0, i = 0) {
92891                    this.major = 0;
92892                    this.minor = 0;
92893                    this.revision = 0;
92894                    this.major = t;
92895                    this.minor = e;
92896                    this.revision = i;
92897                  }
92898                  toString() {
92899                    return this.major + "." + this.minor + "." + this.revision;
92900                  }
92901                }
92902                const z = new G(2, 3, 2);
92903                const H = "master";
92904                const j = "fbf51801d80fc389d43dc46524520e89043b6faf";
92905                function X(t) {
92906                  return parseInt(t, 10);
92907                }
92908                function W(t) {
92909                  return Math.abs(parseInt(t, 10));
92910                }
92911                function Y(t, e) {
92912                  const i = new Array(t);
92913                  for (let s = 0; s < t; ++s) i[s] = e(s);
92914                  return i;
92915                }
92916                function q(t) {
92917                  const e = new Array(t);
92918                  for (let i = 0; i < t; ++i) e[i] = null;
92919                  return e;
92920                }
92921                function K(t, e = 0) {
92922                  const i = new Array(t);
92923                  for (let s = 0; s < t; ++s) i[s] = e;
92924                  return i;
92925                }
92926                const J = o / 180;
92927                const Z = 180 / o;
92928                const Q = 2 * o;
92929                const $ = Math.abs;
92930                function tt(t, e) {
92931                  return t < e ? t : e;
92932                }
92933                function et(t, e) {
92934                  return t > e ? t : e;
92935                }
92936                function it(t, e, i) {
92937                  return t < e ? e : t > i ? i : t;
92938                }
92939                function st(t, e) {
92940                  const i = t[0];
92941                  t[0] = e[0];
92942                  e[0] = i;
92943                }
92944                const nt = isFinite;
92945                function rt(t) {
92946                  return t * t;
92947                }
92948                function ot(t) {
92949                  return 1 / Math.sqrt(t);
92950                }
92951                const at = Math.sqrt;
92952                const lt = Math.pow;
92953                function ht(t) {
92954                  return t * J;
92955                }
92956                function ct(t) {
92957                  return t * Z;
92958                }
92959                const ut = Math.cos;
92960                const _t = Math.sin;
92961                const dt = Math.acos;
92962                const pt = Math.asin;
92963                const mt = Math.atan2;
92964                function ft(t) {
92965                  t |= t >> 1 & 2147483647;
92966                  t |= t >> 2 & 1073741823;
92967                  t |= t >> 4 & 268435455;
92968                  t |= t >> 8 & 16777215;
92969                  return 1 + (t |= t >> 16 & 65535);
92970                }
92971                function gt(t) {
92972                  return t > 0 && 0 == (t & t - 1);
92973                }
92974                function yt() {
92975                  return 2 * Math.random() - 1;
92976                }
92977                function bt(t, e) {
92978                  return (e - t) * Math.random() + t;
92979                }
92980                class St {
92981                  constructor(...t) {
92982                    if (t[0] instanceof Float32Array) {
92983                      if (2 !== t[0].length) throw new Error;
92984                      this.data = t[0];
92985                    } else {
92986                      const e = "number" == typeof t[0] ? t[0] : 0;
92987                      const i = "number" == typeof t[1] ? t[1] : 0;
92988                      this.data = new Float32Array([ e, i ]);
92989                    }
92990                  }
92991                  get x() {
92992                    return this.data[0];
92993                  }
92994                  set x(t) {
92995                    this.data[0] = t;
92996                  }
92997                  get y() {
92998                    return this.data[1];
92999                  }
93000                  set y(t) {
93001                    this.data[1] = t;
93002                  }
93003                  Clone() {
93004                    return new St(this.x, this.y);
93005                  }
93006                  SetZero() {
93007                    this.x = 0;
93008                    this.y = 0;
93009                    return this;
93010                  }
93011                  Set(t, e) {
93012                    this.x = t;
93013                    this.y = e;
93014                    return this;
93015                  }
93016                  Copy(t) {
93017                    this.x = t.x;
93018                    this.y = t.y;
93019                    return this;
93020                  }
93021                  SelfAdd(t) {
93022                    this.x += t.x;
93023                    this.y += t.y;
93024                    return this;
93025                  }
93026                  SelfAddXY(t, e) {
93027                    this.x += t;
93028                    this.y += e;
93029                    return this;
93030                  }
93031                  SelfSub(t) {
93032                    this.x -= t.x;
93033                    this.y -= t.y;
93034                    return this;
93035                  }
93036                  SelfSubXY(t, e) {
93037                    this.x -= t;
93038                    this.y -= e;
93039                    return this;
93040                  }
93041                  SelfMul(t) {
93042                    this.x *= t;
93043                    this.y *= t;
93044                    return this;
93045                  }
93046                  SelfMulAdd(t, e) {
93047                    this.x += t * e.x;
93048                    this.y += t * e.y;
93049                    return this;
93050                  }
93051                  SelfMulSub(t, e) {
93052                    this.x -= t * e.x;
93053                    this.y -= t * e.y;
93054                    return this;
93055                  }
93056                  Dot(t) {
93057                    return this.x * t.x + this.y * t.y;
93058                  }
93059                  Cross(t) {
93060                    return this.x * t.y - this.y * t.x;
93061                  }
93062                  Length() {
93063                    const t = this.x, e = this.y;
93064                    return Math.sqrt(t * t + e * e);
93065                  }
93066                  LengthSquared() {
93067                    const t = this.x, e = this.y;
93068                    return t * t + e * e;
93069                  }
93070                  Normalize() {
93071                    const t = this.Length();
93072                    if (t >= n) {
93073                      const e = 1 / t;
93074                      this.x *= e;
93075                      this.y *= e;
93076                    }
93077                    return t;
93078                  }
93079                  SelfNormalize() {
93080                    const t = this.Length();
93081                    if (t >= n) {
93082                      const e = 1 / t;
93083                      this.x *= e;
93084                      this.y *= e;
93085                    }
93086                    return this;
93087                  }
93088                  SelfRotate(t) {
93089                    const e = Math.cos(t);
93090                    const i = Math.sin(t);
93091                    const s = this.x;
93092                    this.x = e * s - i * this.y;
93093                    this.y = i * s + e * this.y;
93094                    return this;
93095                  }
93096                  SelfRotateCosSin(t, e) {
93097                    const i = this.x;
93098                    this.x = t * i - e * this.y;
93099                    this.y = e * i + t * this.y;
93100                    return this;
93101                  }
93102                  IsValid() {
93103                    return isFinite(this.x) && isFinite(this.y);
93104                  }
93105                  SelfCrossVS(t) {
93106                    const e = this.x;
93107                    this.x = t * this.y;
93108                    this.y = -t * e;
93109                    return this;
93110                  }
93111                  SelfCrossSV(t) {
93112                    const e = this.x;
93113                    this.x = -t * this.y;
93114                    this.y = t * e;
93115                    return this;
93116                  }
93117                  SelfMinV(t) {
93118                    this.x = tt(this.x, t.x);
93119                    this.y = tt(this.y, t.y);
93120                    return this;
93121                  }
93122                  SelfMaxV(t) {
93123                    this.x = et(this.x, t.x);
93124                    this.y = et(this.y, t.y);
93125                    return this;
93126                  }
93127                  SelfAbs() {
93128                    this.x = $(this.x);
93129                    this.y = $(this.y);
93130                    return this;
93131                  }
93132                  SelfNeg() {
93133                    this.x = -this.x;
93134                    this.y = -this.y;
93135                    return this;
93136                  }
93137                  SelfSkew() {
93138                    const t = this.x;
93139                    this.x = -this.y;
93140                    this.y = t;
93141                    return this;
93142                  }
93143                  static MakeArray(t) {
93144                    return Y(t, (t => new St));
93145                  }
93146                  static AbsV(t, e) {
93147                    e.x = $(t.x);
93148                    e.y = $(t.y);
93149                    return e;
93150                  }
93151                  static MinV(t, e, i) {
93152                    i.x = tt(t.x, e.x);
93153                    i.y = tt(t.y, e.y);
93154                    return i;
93155                  }
93156                  static MaxV(t, e, i) {
93157                    i.x = et(t.x, e.x);
93158                    i.y = et(t.y, e.y);
93159                    return i;
93160                  }
93161                  static ClampV(t, e, i, s) {
93162                    s.x = it(t.x, e.x, i.x);
93163                    s.y = it(t.y, e.y, i.y);
93164                    return s;
93165                  }
93166                  static RotateV(t, e, i) {
93167                    const s = t.x, n = t.y;
93168                    const r = Math.cos(e);
93169                    const o = Math.sin(e);
93170                    i.x = r * s - o * n;
93171                    i.y = o * s + r * n;
93172                    return i;
93173                  }
93174                  static DotVV(t, e) {
93175                    return t.x * e.x + t.y * e.y;
93176                  }
93177                  static CrossVV(t, e) {
93178                    return t.x * e.y - t.y * e.x;
93179                  }
93180                  static CrossVS(t, e, i) {
93181                    const s = t.x;
93182                    i.x = e * t.y;
93183                    i.y = -e * s;
93184                    return i;
93185                  }
93186                  static CrossVOne(t, e) {
93187                    const i = t.x;
93188                    e.x = t.y;
93189                    e.y = -i;
93190                    return e;
93191                  }
93192                  static CrossSV(t, e, i) {
93193                    const s = e.x;
93194                    i.x = -t * e.y;
93195                    i.y = t * s;
93196                    return i;
93197                  }
93198                  static CrossOneV(t, e) {
93199                    const i = t.x;
93200                    e.x = -t.y;
93201                    e.y = i;
93202                    return e;
93203                  }
93204                  static AddVV(t, e, i) {
93205                    i.x = t.x + e.x;
93206                    i.y = t.y + e.y;
93207                    return i;
93208                  }
93209                  static SubVV(t, e, i) {
93210                    i.x = t.x - e.x;
93211                    i.y = t.y - e.y;
93212                    return i;
93213                  }
93214                  static MulSV(t, e, i) {
93215                    i.x = e.x * t;
93216                    i.y = e.y * t;
93217                    return i;
93218                  }
93219                  static MulVS(t, e, i) {
93220                    i.x = t.x * e;
93221                    i.y = t.y * e;
93222                    return i;
93223                  }
93224                  static AddVMulSV(t, e, i, s) {
93225                    s.x = t.x + e * i.x;
93226                    s.y = t.y + e * i.y;
93227                    return s;
93228                  }
93229                  static SubVMulSV(t, e, i, s) {
93230                    s.x = t.x - e * i.x;
93231                    s.y = t.y - e * i.y;
93232                    return s;
93233                  }
93234                  static AddVCrossSV(t, e, i, s) {
93235                    const n = i.x;
93236                    s.x = t.x - e * i.y;
93237                    s.y = t.y + e * n;
93238                    return s;
93239                  }
93240                  static MidVV(t, e, i) {
93241                    i.x = .5 * (t.x + e.x);
93242                    i.y = .5 * (t.y + e.y);
93243                    return i;
93244                  }
93245                  static ExtVV(t, e, i) {
93246                    i.x = .5 * (e.x - t.x);
93247                    i.y = .5 * (e.y - t.y);
93248                    return i;
93249                  }
93250                  static IsEqualToV(t, e) {
93251                    return t.x === e.x && t.y === e.y;
93252                  }
93253                  static DistanceVV(t, e) {
93254                    const i = t.x - e.x;
93255                    const s = t.y - e.y;
93256                    return Math.sqrt(i * i + s * s);
93257                  }
93258                  static DistanceSquaredVV(t, e) {
93259                    const i = t.x - e.x;
93260                    const s = t.y - e.y;
93261                    return i * i + s * s;
93262                  }
93263                  static NegV(t, e) {
93264                    e.x = -t.x;
93265                    e.y = -t.y;
93266                    return e;
93267                  }
93268                }
93269                St.ZERO = new St(0, 0);
93270                St.UNITX = new St(1, 0);
93271                St.UNITY = new St(0, 1);
93272                St.s_t0 = new St;
93273                St.s_t1 = new St;
93274                St.s_t2 = new St;
93275                St.s_t3 = new St;
93276                const At = new St(0, 0);
93277                class Tt {
93278                  constructor(...t) {
93279                    if (t[0] instanceof Float32Array) {
93280                      if (3 !== t[0].length) throw new Error;
93281                      this.data = t[0];
93282                    } else {
93283                      const e = "number" == typeof t[0] ? t[0] : 0;
93284                      const i = "number" == typeof t[1] ? t[1] : 0;
93285                      const s = "number" == typeof t[2] ? t[2] : 0;
93286                      this.data = new Float32Array([ e, i, s ]);
93287                    }
93288                  }
93289                  get x() {
93290                    return this.data[0];
93291                  }
93292                  set x(t) {
93293                    this.data[0] = t;
93294                  }
93295                  get y() {
93296                    return this.data[1];
93297                  }
93298                  set y(t) {
93299                    this.data[1] = t;
93300                  }
93301                  get z() {
93302                    return this.data[2];
93303                  }
93304                  set z(t) {
93305                    this.data[2] = t;
93306                  }
93307                  Clone() {
93308                    return new Tt(this.x, this.y, this.z);
93309                  }
93310                  SetZero() {
93311                    this.x = 0;
93312                    this.y = 0;
93313                    this.z = 0;
93314                    return this;
93315                  }
93316                  SetXYZ(t, e, i) {
93317                    this.x = t;
93318                    this.y = e;
93319                    this.z = i;
93320                    return this;
93321                  }
93322                  Copy(t) {
93323                    this.x = t.x;
93324                    this.y = t.y;
93325                    this.z = t.z;
93326                    return this;
93327                  }
93328                  SelfNeg() {
93329                    this.x = -this.x;
93330                    this.y = -this.y;
93331                    this.z = -this.z;
93332                    return this;
93333                  }
93334                  SelfAdd(t) {
93335                    this.x += t.x;
93336                    this.y += t.y;
93337                    this.z += t.z;
93338                    return this;
93339                  }
93340                  SelfAddXYZ(t, e, i) {
93341                    this.x += t;
93342                    this.y += e;
93343                    this.z += i;
93344                    return this;
93345                  }
93346                  SelfSub(t) {
93347                    this.x -= t.x;
93348                    this.y -= t.y;
93349                    this.z -= t.z;
93350                    return this;
93351                  }
93352                  SelfSubXYZ(t, e, i) {
93353                    this.x -= t;
93354                    this.y -= e;
93355                    this.z -= i;
93356                    return this;
93357                  }
93358                  SelfMul(t) {
93359                    this.x *= t;
93360                    this.y *= t;
93361                    this.z *= t;
93362                    return this;
93363                  }
93364                  static DotV3V3(t, e) {
93365                    return t.x * e.x + t.y * e.y + t.z * e.z;
93366                  }
93367                  static CrossV3V3(t, e, i) {
93368                    const s = t.x, n = t.y, r = t.z;
93369                    const o = e.x, a = e.y, l = e.z;
93370                    i.x = n * l - r * a;
93371                    i.y = r * o - s * l;
93372                    i.z = s * a - n * o;
93373                    return i;
93374                  }
93375                }
93376                Tt.ZERO = new Tt(0, 0, 0);
93377                Tt.s_t0 = new Tt;
93378                class vt {
93379                  constructor() {
93380                    this.data = new Float32Array([ 1, 0, 0, 1 ]);
93381                    this.ex = new St(this.data.subarray(0, 2));
93382                    this.ey = new St(this.data.subarray(2, 4));
93383                  }
93384                  Clone() {
93385                    return (new vt).Copy(this);
93386                  }
93387                  static FromVV(t, e) {
93388                    return (new vt).SetVV(t, e);
93389                  }
93390                  static FromSSSS(t, e, i, s) {
93391                    return (new vt).SetSSSS(t, e, i, s);
93392                  }
93393                  static FromAngle(t) {
93394                    return (new vt).SetAngle(t);
93395                  }
93396                  SetSSSS(t, e, i, s) {
93397                    this.ex.Set(t, i);
93398                    this.ey.Set(e, s);
93399                    return this;
93400                  }
93401                  SetVV(t, e) {
93402                    this.ex.Copy(t);
93403                    this.ey.Copy(e);
93404                    return this;
93405                  }
93406                  SetAngle(t) {
93407                    const e = Math.cos(t);
93408                    const i = Math.sin(t);
93409                    this.ex.Set(e, i);
93410                    this.ey.Set(-i, e);
93411                    return this;
93412                  }
93413                  Copy(t) {
93414                    this.ex.Copy(t.ex);
93415                    this.ey.Copy(t.ey);
93416                    return this;
93417                  }
93418                  SetIdentity() {
93419                    this.ex.Set(1, 0);
93420                    this.ey.Set(0, 1);
93421                    return this;
93422                  }
93423                  SetZero() {
93424                    this.ex.SetZero();
93425                    this.ey.SetZero();
93426                    return this;
93427                  }
93428                  GetAngle() {
93429                    return Math.atan2(this.ex.y, this.ex.x);
93430                  }
93431                  GetInverse(t) {
93432                    const e = this.ex.x;
93433                    const i = this.ey.x;
93434                    const s = this.ex.y;
93435                    const n = this.ey.y;
93436                    let r = e * n - i * s;
93437                    0 !== r && (r = 1 / r);
93438                    t.ex.x = r * n;
93439                    t.ey.x = -r * i;
93440                    t.ex.y = -r * s;
93441                    t.ey.y = r * e;
93442                    return t;
93443                  }
93444                  Solve(t, e, i) {
93445                    const s = this.ex.x, n = this.ey.x;
93446                    const r = this.ex.y, o = this.ey.y;
93447                    let a = s * o - n * r;
93448                    0 !== a && (a = 1 / a);
93449                    i.x = a * (o * t - n * e);
93450                    i.y = a * (s * e - r * t);
93451                    return i;
93452                  }
93453                  SelfAbs() {
93454                    this.ex.SelfAbs();
93455                    this.ey.SelfAbs();
93456                    return this;
93457                  }
93458                  SelfInv() {
93459                    this.GetInverse(this);
93460                    return this;
93461                  }
93462                  SelfAddM(t) {
93463                    this.ex.SelfAdd(t.ex);
93464                    this.ey.SelfAdd(t.ey);
93465                    return this;
93466                  }
93467                  SelfSubM(t) {
93468                    this.ex.SelfSub(t.ex);
93469                    this.ey.SelfSub(t.ey);
93470                    return this;
93471                  }
93472                  static AbsM(t, e) {
93473                    const i = t.ex, s = t.ey;
93474                    e.ex.x = $(i.x);
93475                    e.ex.y = $(i.y);
93476                    e.ey.x = $(s.x);
93477                    e.ey.y = $(s.y);
93478                    return e;
93479                  }
93480                  static MulMV(t, e, i) {
93481                    const s = t.ex, n = t.ey;
93482                    const r = e.x, o = e.y;
93483                    i.x = s.x * r + n.x * o;
93484                    i.y = s.y * r + n.y * o;
93485                    return i;
93486                  }
93487                  static MulTMV(t, e, i) {
93488                    const s = t.ex, n = t.ey;
93489                    const r = e.x, o = e.y;
93490                    i.x = s.x * r + s.y * o;
93491                    i.y = n.x * r + n.y * o;
93492                    return i;
93493                  }
93494                  static AddMM(t, e, i) {
93495                    const s = t.ex, n = t.ey;
93496                    const r = e.ex, o = e.ey;
93497                    i.ex.x = s.x + r.x;
93498                    i.ex.y = s.y + r.y;
93499                    i.ey.x = n.x + o.x;
93500                    i.ey.y = n.y + o.y;
93501                    return i;
93502                  }
93503                  static MulMM(t, e, i) {
93504                    const s = t.ex.x, n = t.ex.y;
93505                    const r = t.ey.x, o = t.ey.y;
93506                    const a = e.ex.x, l = e.ex.y;
93507                    const h = e.ey.x, c = e.ey.y;
93508                    i.ex.x = s * a + r * l;
93509                    i.ex.y = n * a + o * l;
93510                    i.ey.x = s * h + r * c;
93511                    i.ey.y = n * h + o * c;
93512                    return i;
93513                  }
93514                  static MulTMM(t, e, i) {
93515                    const s = t.ex.x, n = t.ex.y;
93516                    const r = t.ey.x, o = t.ey.y;
93517                    const a = e.ex.x, l = e.ex.y;
93518                    const h = e.ey.x, c = e.ey.y;
93519                    i.ex.x = s * a + n * l;
93520                    i.ex.y = r * a + o * l;
93521                    i.ey.x = s * h + n * c;
93522                    i.ey.y = r * h + o * c;
93523                    return i;
93524                  }
93525                }
93526                vt.IDENTITY = new vt;
93527                class Et {
93528                  constructor() {
93529                    this.data = new Float32Array([ 1, 0, 0, 0, 1, 0, 0, 0, 1 ]);
93530                    this.ex = new Tt(this.data.subarray(0, 3));
93531                    this.ey = new Tt(this.data.subarray(3, 6));
93532                    this.ez = new Tt(this.data.subarray(6, 9));
93533                  }
93534                  Clone() {
93535                    return (new Et).Copy(this);
93536                  }
93537                  SetVVV(t, e, i) {
93538                    this.ex.Copy(t);
93539                    this.ey.Copy(e);
93540                    this.ez.Copy(i);
93541                    return this;
93542                  }
93543                  Copy(t) {
93544                    this.ex.Copy(t.ex);
93545                    this.ey.Copy(t.ey);
93546                    this.ez.Copy(t.ez);
93547                    return this;
93548                  }
93549                  SetIdentity() {
93550                    this.ex.SetXYZ(1, 0, 0);
93551                    this.ey.SetXYZ(0, 1, 0);
93552                    this.ez.SetXYZ(0, 0, 1);
93553                    return this;
93554                  }
93555                  SetZero() {
93556                    this.ex.SetZero();
93557                    this.ey.SetZero();
93558                    this.ez.SetZero();
93559                    return this;
93560                  }
93561                  SelfAddM(t) {
93562                    this.ex.SelfAdd(t.ex);
93563                    this.ey.SelfAdd(t.ey);
93564                    this.ez.SelfAdd(t.ez);
93565                    return this;
93566                  }
93567                  Solve33(t, e, i, s) {
93568                    const n = this.ex.x, r = this.ex.y, o = this.ex.z;
93569                    const a = this.ey.x, l = this.ey.y, h = this.ey.z;
93570                    const c = this.ez.x, u = this.ez.y, _ = this.ez.z;
93571                    let d = n * (l * _ - h * u) + r * (h * c - a * _) + o * (a * u - l * c);
93572                    0 !== d && (d = 1 / d);
93573                    s.x = d * (t * (l * _ - h * u) + e * (h * c - a * _) + i * (a * u - l * c));
93574                    s.y = d * (n * (e * _ - i * u) + r * (i * c - t * _) + o * (t * u - e * c));
93575                    s.z = d * (n * (l * i - h * e) + r * (h * t - a * i) + o * (a * e - l * t));
93576                    return s;
93577                  }
93578                  Solve22(t, e, i) {
93579                    const s = this.ex.x, n = this.ey.x;
93580                    const r = this.ex.y, o = this.ey.y;
93581                    let a = s * o - n * r;
93582                    0 !== a && (a = 1 / a);
93583                    i.x = a * (o * t - n * e);
93584                    i.y = a * (s * e - r * t);
93585                    return i;
93586                  }
93587                  GetInverse22(t) {
93588                    const e = this.ex.x, i = this.ey.x, s = this.ex.y, n = this.ey.y;
93589                    let r = e * n - i * s;
93590                    0 !== r && (r = 1 / r);
93591                    t.ex.x = r * n;
93592                    t.ey.x = -r * i;
93593                    t.ex.z = 0;
93594                    t.ex.y = -r * s;
93595                    t.ey.y = r * e;
93596                    t.ey.z = 0;
93597                    t.ez.x = 0;
93598                    t.ez.y = 0;
93599                    t.ez.z = 0;
93600                  }
93601                  GetSymInverse33(t) {
93602                    let e = Tt.DotV3V3(this.ex, Tt.CrossV3V3(this.ey, this.ez, Tt.s_t0));
93603                    0 !== e && (e = 1 / e);
93604                    const i = this.ex.x, s = this.ey.x, n = this.ez.x;
93605                    const r = this.ey.y, o = this.ez.y;
93606                    const a = this.ez.z;
93607                    t.ex.x = e * (r * a - o * o);
93608                    t.ex.y = e * (n * o - s * a);
93609                    t.ex.z = e * (s * o - n * r);
93610                    t.ey.x = t.ex.y;
93611                    t.ey.y = e * (i * a - n * n);
93612                    t.ey.z = e * (n * s - i * o);
93613                    t.ez.x = t.ex.z;
93614                    t.ez.y = t.ey.z;
93615                    t.ez.z = e * (i * r - s * s);
93616                  }
93617                  static MulM33V3(t, e, i) {
93618                    const s = e.x, n = e.y, r = e.z;
93619                    i.x = t.ex.x * s + t.ey.x * n + t.ez.x * r;
93620                    i.y = t.ex.y * s + t.ey.y * n + t.ez.y * r;
93621                    i.z = t.ex.z * s + t.ey.z * n + t.ez.z * r;
93622                    return i;
93623                  }
93624                  static MulM33XYZ(t, e, i, s, n) {
93625                    n.x = t.ex.x * e + t.ey.x * i + t.ez.x * s;
93626                    n.y = t.ex.y * e + t.ey.y * i + t.ez.y * s;
93627                    n.z = t.ex.z * e + t.ey.z * i + t.ez.z * s;
93628                    return n;
93629                  }
93630                  static MulM33V2(t, e, i) {
93631                    const s = e.x, n = e.y;
93632                    i.x = t.ex.x * s + t.ey.x * n;
93633                    i.y = t.ex.y * s + t.ey.y * n;
93634                    return i;
93635                  }
93636                  static MulM33XY(t, e, i, s) {
93637                    s.x = t.ex.x * e + t.ey.x * i;
93638                    s.y = t.ex.y * e + t.ey.y * i;
93639                    return s;
93640                  }
93641                }
93642                Et.IDENTITY = new Et;
93643                class Ct {
93644                  constructor(t = 0) {
93645                    this.s = 0;
93646                    this.c = 1;
93647                    if (t) {
93648                      this.s = Math.sin(t);
93649                      this.c = Math.cos(t);
93650                    }
93651                  }
93652                  Clone() {
93653                    return (new Ct).Copy(this);
93654                  }
93655                  Copy(t) {
93656                    this.s = t.s;
93657                    this.c = t.c;
93658                    return this;
93659                  }
93660                  SetAngle(t) {
93661                    this.s = Math.sin(t);
93662                    this.c = Math.cos(t);
93663                    return this;
93664                  }
93665                  SetIdentity() {
93666                    this.s = 0;
93667                    this.c = 1;
93668                    return this;
93669                  }
93670                  GetAngle() {
93671                    return Math.atan2(this.s, this.c);
93672                  }
93673                  GetXAxis(t) {
93674                    t.x = this.c;
93675                    t.y = this.s;
93676                    return t;
93677                  }
93678                  GetYAxis(t) {
93679                    t.x = -this.s;
93680                    t.y = this.c;
93681                    return t;
93682                  }
93683                  static MulRR(t, e, i) {
93684                    const s = t.c, n = t.s;
93685                    const r = e.c, o = e.s;
93686                    i.s = n * r + s * o;
93687                    i.c = s * r - n * o;
93688                    return i;
93689                  }
93690                  static MulTRR(t, e, i) {
93691                    const s = t.c, n = t.s;
93692                    const r = e.c, o = e.s;
93693                    i.s = s * o - n * r;
93694                    i.c = s * r + n * o;
93695                    return i;
93696                  }
93697                  static MulRV(t, e, i) {
93698                    const s = t.c, n = t.s;
93699                    const r = e.x, o = e.y;
93700                    i.x = s * r - n * o;
93701                    i.y = n * r + s * o;
93702                    return i;
93703                  }
93704                  static MulTRV(t, e, i) {
93705                    const s = t.c, n = t.s;
93706                    const r = e.x, o = e.y;
93707                    i.x = s * r + n * o;
93708                    i.y = -n * r + s * o;
93709                    return i;
93710                  }
93711                }
93712                Ct.IDENTITY = new Ct;
93713                class xt {
93714                  constructor() {
93715                    this.p = new St;
93716                    this.q = new Ct;
93717                  }
93718                  Clone() {
93719                    return (new xt).Copy(this);
93720                  }
93721                  Copy(t) {
93722                    this.p.Copy(t.p);
93723                    this.q.Copy(t.q);
93724                    return this;
93725                  }
93726                  SetIdentity() {
93727                    this.p.SetZero();
93728                    this.q.SetIdentity();
93729                    return this;
93730                  }
93731                  SetPositionRotation(t, e) {
93732                    this.p.Copy(t);
93733                    this.q.Copy(e);
93734                    return this;
93735                  }
93736                  SetPositionAngle(t, e) {
93737                    this.p.Copy(t);
93738                    this.q.SetAngle(e);
93739                    return this;
93740                  }
93741                  SetPosition(t) {
93742                    this.p.Copy(t);
93743                    return this;
93744                  }
93745                  SetPositionXY(t, e) {
93746                    this.p.Set(t, e);
93747                    return this;
93748                  }
93749                  SetRotation(t) {
93750                    this.q.Copy(t);
93751                    return this;
93752                  }
93753                  SetRotationAngle(t) {
93754                    this.q.SetAngle(t);
93755                    return this;
93756                  }
93757                  GetPosition() {
93758                    return this.p;
93759                  }
93760                  GetRotation() {
93761                    return this.q;
93762                  }
93763                  GetRotationAngle() {
93764                    return this.q.GetAngle();
93765                  }
93766                  GetAngle() {
93767                    return this.q.GetAngle();
93768                  }
93769                  static MulXV(t, e, i) {
93770                    const s = t.q.c, n = t.q.s;
93771                    const r = e.x, o = e.y;
93772                    i.x = s * r - n * o + t.p.x;
93773                    i.y = n * r + s * o + t.p.y;
93774                    return i;
93775                  }
93776                  static MulTXV(t, e, i) {
93777                    const s = t.q.c, n = t.q.s;
93778                    const r = e.x - t.p.x;
93779                    const o = e.y - t.p.y;
93780                    i.x = s * r + n * o;
93781                    i.y = -n * r + s * o;
93782                    return i;
93783                  }
93784                  static MulXX(t, e, i) {
93785                    Ct.MulRR(t.q, e.q, i.q);
93786                    St.AddVV(Ct.MulRV(t.q, e.p, i.p), t.p, i.p);
93787                    return i;
93788                  }
93789                  static MulTXX(t, e, i) {
93790                    Ct.MulTRR(t.q, e.q, i.q);
93791                    Ct.MulTRV(t.q, St.SubVV(e.p, t.p, i.p), i.p);
93792                    return i;
93793                  }
93794                }
93795                xt.IDENTITY = new xt;
93796                class wt {
93797                  constructor() {
93798                    this.localCenter = new St;
93799                    this.c0 = new St;
93800                    this.c = new St;
93801                    this.a0 = 0;
93802                    this.a = 0;
93803                    this.alpha0 = 0;
93804                  }
93805                  Clone() {
93806                    return (new wt).Copy(this);
93807                  }
93808                  Copy(t) {
93809                    this.localCenter.Copy(t.localCenter);
93810                    this.c0.Copy(t.c0);
93811                    this.c.Copy(t.c);
93812                    this.a0 = t.a0;
93813                    this.a = t.a;
93814                    this.alpha0 = t.alpha0;
93815                    return this;
93816                  }
93817                  GetTransform(t, e) {
93818                    const i = 1 - e;
93819                    t.p.x = i * this.c0.x + e * this.c.x;
93820                    t.p.y = i * this.c0.y + e * this.c.y;
93821                    const s = i * this.a0 + e * this.a;
93822                    t.q.SetAngle(s);
93823                    t.p.SelfSub(Ct.MulRV(t.q, this.localCenter, St.s_t0));
93824                    return t;
93825                  }
93826                  Advance(t) {
93827                    const e = (t - this.alpha0) / (1 - this.alpha0);
93828                    const i = 1 - e;
93829                    this.c0.x = i * this.c0.x + e * this.c.x;
93830                    this.c0.y = i * this.c0.y + e * this.c.y;
93831                    this.a0 = i * this.a0 + e * this.a;
93832                    this.alpha0 = t;
93833                  }
93834                  Normalize() {
93835                    const t = Q * Math.floor(this.a0 / Q);
93836                    this.a0 -= t;
93837                    this.a -= t;
93838                  }
93839                }
93840                class Rt {
93841                  constructor(...t) {
93842                    if (t[0] instanceof Float32Array) {
93843                      if (4 !== t[0].length) throw new Error;
93844                      this.data = t[0];
93845                    } else {
93846                      const e = "number" == typeof t[0] ? t[0] : .5;
93847                      const i = "number" == typeof t[1] ? t[1] : .5;
93848                      const s = "number" == typeof t[2] ? t[2] : .5;
93849                      const n = "number" == typeof t[3] ? t[3] : 1;
93850                      this.data = new Float32Array([ e, i, s, n ]);
93851                    }
93852                  }
93853                  get r() {
93854                    return this.data[0];
93855                  }
93856                  set r(t) {
93857                    this.data[0] = t;
93858                  }
93859                  get g() {
93860                    return this.data[1];
93861                  }
93862                  set g(t) {
93863                    this.data[1] = t;
93864                  }
93865                  get b() {
93866                    return this.data[2];
93867                  }
93868                  set b(t) {
93869                    this.data[2] = t;
93870                  }
93871                  get a() {
93872                    return this.data[3];
93873                  }
93874                  set a(t) {
93875                    this.data[3] = t;
93876                  }
93877                  Clone() {
93878                    return (new Rt).Copy(this);
93879                  }
93880                  Copy(t) {
93881                    this.r = t.r;
93882                    this.g = t.g;
93883                    this.b = t.b;
93884                    this.a = t.a;
93885                    return this;
93886                  }
93887                  IsEqual(t) {
93888                    return this.r === t.r && this.g === t.g && this.b === t.b && this.a === t.a;
93889                  }
93890                  IsZero() {
93891                    return 0 === this.r && 0 === this.g && 0 === this.b && 0 === this.a;
93892                  }
93893                  Set(t, e, i, s = this.a) {
93894                    this.SetRGBA(t, e, i, s);
93895                  }
93896                  SetByteRGB(t, e, i) {
93897                    this.r = t / 255;
93898                    this.g = e / 255;
93899                    this.b = i / 255;
93900                    return this;
93901                  }
93902                  SetByteRGBA(t, e, i, s) {
93903                    this.r = t / 255;
93904                    this.g = e / 255;
93905                    this.b = i / 255;
93906                    this.a = s / 255;
93907                    return this;
93908                  }
93909                  SetRGB(t, e, i) {
93910                    this.r = t;
93911                    this.g = e;
93912                    this.b = i;
93913                    return this;
93914                  }
93915                  SetRGBA(t, e, i, s) {
93916                    this.r = t;
93917                    this.g = e;
93918                    this.b = i;
93919                    this.a = s;
93920                    return this;
93921                  }
93922                  SelfAdd(t) {
93923                    this.r += t.r;
93924                    this.g += t.g;
93925                    this.b += t.b;
93926                    this.a += t.a;
93927                    return this;
93928                  }
93929                  Add(t, e) {
93930                    e.r = this.r + t.r;
93931                    e.g = this.g + t.g;
93932                    e.b = this.b + t.b;
93933                    e.a = this.a + t.a;
93934                    return e;
93935                  }
93936                  SelfSub(t) {
93937                    this.r -= t.r;
93938                    this.g -= t.g;
93939                    this.b -= t.b;
93940                    this.a -= t.a;
93941                    return this;
93942                  }
93943                  Sub(t, e) {
93944                    e.r = this.r - t.r;
93945                    e.g = this.g - t.g;
93946                    e.b = this.b - t.b;
93947                    e.a = this.a - t.a;
93948                    return e;
93949                  }
93950                  SelfMul(t) {
93951                    this.r *= t;
93952                    this.g *= t;
93953                    this.b *= t;
93954                    this.a *= t;
93955                    return this;
93956                  }
93957                  Mul(t, e) {
93958                    e.r = this.r * t;
93959                    e.g = this.g * t;
93960                    e.b = this.b * t;
93961                    e.a = this.a * t;
93962                    return e;
93963                  }
93964                  Mix(t, e) {
93965                    Rt.MixColors(this, t, e);
93966                  }
93967                  static MixColors(t, e, i) {
93968                    const s = i * (e.r - t.r);
93969                    const n = i * (e.g - t.g);
93970                    const r = i * (e.b - t.b);
93971                    const o = i * (e.a - t.a);
93972                    t.r += s;
93973                    t.g += n;
93974                    t.b += r;
93975                    t.a += o;
93976                    e.r -= s;
93977                    e.g -= n;
93978                    e.b -= r;
93979                    e.a -= o;
93980                  }
93981                  MakeStyleString(t = this.a) {
93982                    return Rt.MakeStyleString(this.r, this.g, this.b, t);
93983                  }
93984                  static MakeStyleString(t, e, i, s = 1) {
93985                    t *= 255;
93986                    e *= 255;
93987                    i *= 255;
93988                    return s < 1 ? `rgba(${t},${e},${i},${s})` : `rgb(${t},${e},${i})`;
93989                  }
93990                }
93991                Rt.ZERO = new Rt(0, 0, 0, 0);
93992                Rt.RED = new Rt(1, 0, 0);
93993                Rt.GREEN = new Rt(0, 1, 0);
93994                Rt.BLUE = new Rt(0, 0, 1);
93995                !function(t) {
93996                  t[t.e_none = 0] = "e_none";
93997                  t[t.e_shapeBit = 1] = "e_shapeBit";
93998                  t[t.e_jointBit = 2] = "e_jointBit";
93999                  t[t.e_aabbBit = 4] = "e_aabbBit";
94000                  t[t.e_pairBit = 8] = "e_pairBit";
94001                  t[t.e_centerOfMassBit = 16] = "e_centerOfMassBit";
94002                  t[t.e_particleBit = 32] = "e_particleBit";
94003                  t[t.e_controllerBit = 64] = "e_controllerBit";
94004                  t[t.e_all = 63] = "e_all";
94005                }(t.b2DrawFlags || (t.b2DrawFlags = {}));
94006                class It {
94007                  constructor() {
94008                    this.m_drawFlags = 0;
94009                  }
94010                  SetFlags(t) {
94011                    this.m_drawFlags = t;
94012                  }
94013                  GetFlags() {
94014                    return this.m_drawFlags;
94015                  }
94016                  AppendFlags(t) {
94017                    this.m_drawFlags |= t;
94018                  }
94019                  ClearFlags(t) {
94020                    this.m_drawFlags &= ~t;
94021                  }
94022                }
94023                class Mt {
94024                  constructor() {
94025                    this.m_start = Date.now();
94026                  }
94027                  Reset() {
94028                    this.m_start = Date.now();
94029                    return this;
94030                  }
94031                  GetMilliseconds() {
94032                    return Date.now() - this.m_start;
94033                  }
94034                }
94035                class Bt {
94036                  constructor() {
94037                    this.m_count = 0;
94038                    this.m_min_count = 0;
94039                    this.m_max_count = 0;
94040                  }
94041                  GetCount() {
94042                    return this.m_count;
94043                  }
94044                  GetMinCount() {
94045                    return this.m_min_count;
94046                  }
94047                  GetMaxCount() {
94048                    return this.m_max_count;
94049                  }
94050                  ResetCount() {
94051                    const t = this.m_count;
94052                    this.m_count = 0;
94053                    return t;
94054                  }
94055                  ResetMinCount() {
94056                    this.m_min_count = 0;
94057                  }
94058                  ResetMaxCount() {
94059                    this.m_max_count = 0;
94060                  }
94061                  Increment() {
94062                    this.m_count++;
94063                    this.m_max_count < this.m_count && (this.m_max_count = this.m_count);
94064                  }
94065                  Decrement() {
94066                    this.m_count--;
94067                    this.m_min_count > this.m_count && (this.m_min_count = this.m_count);
94068                  }
94069                }
94070                class Dt {
94071                  constructor(t) {
94072                    this.m_stack = [];
94073                    this.m_count = 0;
94074                    this.m_stack = Y(t, (t => null));
94075                    this.m_count = 0;
94076                  }
94077                  Reset() {
94078                    this.m_count = 0;
94079                    return this;
94080                  }
94081                  Push(t) {
94082                    this.m_stack[this.m_count] = t;
94083                    this.m_count++;
94084                  }
94085                  Pop() {
94086                    this.m_count--;
94087                    const t = this.m_stack[this.m_count];
94088                    this.m_stack[this.m_count] = null;
94089                    if (null === t) throw new Error;
94090                    return t;
94091                  }
94092                  GetCount() {
94093                    return this.m_count;
94094                  }
94095                }
94096                class Pt {}
94097                class Ot {}
94098                class Nt {
94099                  constructor() {
94100                    this.m_buffer = St.MakeArray(2);
94101                    this.m_vertices = this.m_buffer;
94102                    this.m_count = 0;
94103                    this.m_radius = 0;
94104                  }
94105                  Copy(t) {
94106                    if (t.m_vertices === t.m_buffer) {
94107                      this.m_vertices = this.m_buffer;
94108                      this.m_buffer[0].Copy(t.m_buffer[0]);
94109                      this.m_buffer[1].Copy(t.m_buffer[1]);
94110                    } else this.m_vertices = t.m_vertices;
94111                    this.m_count = t.m_count;
94112                    this.m_radius = t.m_radius;
94113                    return this;
94114                  }
94115                  Reset() {
94116                    this.m_vertices = this.m_buffer;
94117                    this.m_count = 0;
94118                    this.m_radius = 0;
94119                    return this;
94120                  }
94121                  SetShape(t, e) {
94122                    t.SetupDistanceProxy(this, e);
94123                  }
94124                  SetVerticesRadius(t, e, i) {
94125                    this.m_vertices = t;
94126                    this.m_count = e;
94127                    this.m_radius = i;
94128                  }
94129                  GetSupport(t) {
94130                    let e = 0;
94131                    let i = St.DotVV(this.m_vertices[0], t);
94132                    for (let s = 1; s < this.m_count; ++s) {
94133                      const n = St.DotVV(this.m_vertices[s], t);
94134                      if (n > i) {
94135                        e = s;
94136                        i = n;
94137                      }
94138                    }
94139                    return e;
94140                  }
94141                  GetSupportVertex(t) {
94142                    let e = 0;
94143                    let i = St.DotVV(this.m_vertices[0], t);
94144                    for (let s = 1; s < this.m_count; ++s) {
94145                      const n = St.DotVV(this.m_vertices[s], t);
94146                      if (n > i) {
94147                        e = s;
94148                        i = n;
94149                      }
94150                    }
94151                    return this.m_vertices[e];
94152                  }
94153                  GetVertexCount() {
94154                    return this.m_count;
94155                  }
94156                  GetVertex(t) {
94157                    return this.m_vertices[t];
94158                  }
94159                }
94160                class Lt {
94161                  constructor() {
94162                    this.metric = 0;
94163                    this.count = 0;
94164                    this.indexA = [ 0, 0, 0 ];
94165                    this.indexB = [ 0, 0, 0 ];
94166                  }
94167                  Reset() {
94168                    this.metric = 0;
94169                    this.count = 0;
94170                    return this;
94171                  }
94172                }
94173                class Ft {
94174                  constructor() {
94175                    this.proxyA = new Nt;
94176                    this.proxyB = new Nt;
94177                    this.transformA = new xt;
94178                    this.transformB = new xt;
94179                    this.useRadii = !1;
94180                  }
94181                  Reset() {
94182                    this.proxyA.Reset();
94183                    this.proxyB.Reset();
94184                    this.transformA.SetIdentity();
94185                    this.transformB.SetIdentity();
94186                    this.useRadii = !1;
94187                    return this;
94188                  }
94189                }
94190                class Vt {
94191                  constructor() {
94192                    this.pointA = new St;
94193                    this.pointB = new St;
94194                    this.distance = 0;
94195                    this.iterations = 0;
94196                  }
94197                  Reset() {
94198                    this.pointA.SetZero();
94199                    this.pointB.SetZero();
94200                    this.distance = 0;
94201                    this.iterations = 0;
94202                    return this;
94203                  }
94204                }
94205                class kt {
94206                  constructor() {
94207                    this.proxyA = new Nt;
94208                    this.proxyB = new Nt;
94209                    this.transformA = new xt;
94210                    this.transformB = new xt;
94211                    this.translationB = new St;
94212                  }
94213                }
94214                class Ut {
94215                  constructor() {
94216                    this.point = new St;
94217                    this.normal = new St;
94218                    this.lambda = 0;
94219                    this.iterations = 0;
94220                  }
94221                }
94222                t.b2_gjkCalls = 0;
94223                t.b2_gjkIters = 0;
94224                t.b2_gjkMaxIters = 0;
94225                function Gt() {
94226                  t.b2_gjkCalls = 0;
94227                  t.b2_gjkIters = 0;
94228                  t.b2_gjkMaxIters = 0;
94229                }
94230                class zt {
94231                  constructor() {
94232                    this.wA = new St;
94233                    this.wB = new St;
94234                    this.w = new St;
94235                    this.a = 0;
94236                    this.indexA = 0;
94237                    this.indexB = 0;
94238                  }
94239                  Copy(t) {
94240                    this.wA.Copy(t.wA);
94241                    this.wB.Copy(t.wB);
94242                    this.w.Copy(t.w);
94243                    this.a = t.a;
94244                    this.indexA = t.indexA;
94245                    this.indexB = t.indexB;
94246                    return this;
94247                  }
94248                }
94249                class Ht {
94250                  constructor() {
94251                    this.m_v1 = new zt;
94252                    this.m_v2 = new zt;
94253                    this.m_v3 = new zt;
94254                    this.m_vertices = [];
94255                    this.m_count = 0;
94256                    this.m_vertices[0] = this.m_v1;
94257                    this.m_vertices[1] = this.m_v2;
94258                    this.m_vertices[2] = this.m_v3;
94259                  }
94260                  ReadCache(t, e, i, s, r) {
94261                    this.m_count = t.count;
94262                    const o = this.m_vertices;
94263                    for (let n = 0; n < this.m_count; ++n) {
94264                      const a = o[n];
94265                      a.indexA = t.indexA[n];
94266                      a.indexB = t.indexB[n];
94267                      const l = e.GetVertex(a.indexA);
94268                      const h = s.GetVertex(a.indexB);
94269                      xt.MulXV(i, l, a.wA);
94270                      xt.MulXV(r, h, a.wB);
94271                      St.SubVV(a.wB, a.wA, a.w);
94272                      a.a = 0;
94273                    }
94274                    if (this.m_count > 1) {
94275                      const e = t.metric;
94276                      const i = this.GetMetric();
94277                      (i < .5 * e || 2 * e < i || i < n) && (this.m_count = 0);
94278                    }
94279                    if (0 === this.m_count) {
94280                      const t = o[0];
94281                      t.indexA = 0;
94282                      t.indexB = 0;
94283                      const n = e.GetVertex(0);
94284                      const a = s.GetVertex(0);
94285                      xt.MulXV(i, n, t.wA);
94286                      xt.MulXV(r, a, t.wB);
94287                      St.SubVV(t.wB, t.wA, t.w);
94288                      t.a = 1;
94289                      this.m_count = 1;
94290                    }
94291                  }
94292                  WriteCache(t) {
94293                    t.metric = this.GetMetric();
94294                    t.count = this.m_count;
94295                    const e = this.m_vertices;
94296                    for (let i = 0; i < this.m_count; ++i) {
94297                      t.indexA[i] = e[i].indexA;
94298                      t.indexB[i] = e[i].indexB;
94299                    }
94300                  }
94301                  GetSearchDirection(t) {
94302                    switch (this.m_count) {
94303                     case 1:
94304                      return St.NegV(this.m_v1.w, t);
94305
94306                     case 2:
94307                      {
94308                        const e = St.SubVV(this.m_v2.w, this.m_v1.w, t);
94309                        return St.CrossVV(e, St.NegV(this.m_v1.w, St.s_t0)) > 0 ? St.CrossOneV(e, t) : St.CrossVOne(e, t);
94310                      }
94311
94312                     default:
94313                      return t.SetZero();
94314                    }
94315                  }
94316                  GetClosestPoint(t) {
94317                    switch (this.m_count) {
94318                     case 0:
94319                     case 3:
94320                     default:
94321                      return t.SetZero();
94322
94323                     case 1:
94324                      return t.Copy(this.m_v1.w);
94325
94326                     case 2:
94327                      return t.Set(this.m_v1.a * this.m_v1.w.x + this.m_v2.a * this.m_v2.w.x, this.m_v1.a * this.m_v1.w.y + this.m_v2.a * this.m_v2.w.y);
94328                    }
94329                  }
94330                  GetWitnessPoints(t, e) {
94331                    switch (this.m_count) {
94332                     case 0:
94333                      break;
94334
94335                     case 1:
94336                      t.Copy(this.m_v1.wA);
94337                      e.Copy(this.m_v1.wB);
94338                      break;
94339
94340                     case 2:
94341                      t.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x;
94342                      t.y = this.m_v1.a * this.m_v1.wA.y + this.m_v2.a * this.m_v2.wA.y;
94343                      e.x = this.m_v1.a * this.m_v1.wB.x + this.m_v2.a * this.m_v2.wB.x;
94344                      e.y = this.m_v1.a * this.m_v1.wB.y + this.m_v2.a * this.m_v2.wB.y;
94345                      break;
94346
94347                     case 3:
94348                      e.x = t.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x + this.m_v3.a * this.m_v3.wA.x;
94349                      e.y = t.y = this.m_v1.a * this.m_v1.wA.y + this.m_v2.a * this.m_v2.wA.y + this.m_v3.a * this.m_v3.wA.y;
94350                    }
94351                  }
94352                  GetMetric() {
94353                    switch (this.m_count) {
94354                     case 0:
94355                     case 1:
94356                     default:
94357                      return 0;
94358
94359                     case 2:
94360                      return St.DistanceVV(this.m_v1.w, this.m_v2.w);
94361
94362                     case 3:
94363                      return St.CrossVV(St.SubVV(this.m_v2.w, this.m_v1.w, St.s_t0), St.SubVV(this.m_v3.w, this.m_v1.w, St.s_t1));
94364                    }
94365                  }
94366                  Solve2() {
94367                    const t = this.m_v1.w;
94368                    const e = this.m_v2.w;
94369                    const i = St.SubVV(e, t, Ht.s_e12);
94370                    const s = -St.DotVV(t, i);
94371                    if (s <= 0) {
94372                      this.m_v1.a = 1;
94373                      this.m_count = 1;
94374                      return;
94375                    }
94376                    const n = St.DotVV(e, i);
94377                    if (n <= 0) {
94378                      this.m_v2.a = 1;
94379                      this.m_count = 1;
94380                      this.m_v1.Copy(this.m_v2);
94381                      return;
94382                    }
94383                    const r = 1 / (n + s);
94384                    this.m_v1.a = n * r;
94385                    this.m_v2.a = s * r;
94386                    this.m_count = 2;
94387                  }
94388                  Solve3() {
94389                    const t = this.m_v1.w;
94390                    const e = this.m_v2.w;
94391                    const i = this.m_v3.w;
94392                    const s = St.SubVV(e, t, Ht.s_e12);
94393                    const n = St.DotVV(t, s);
94394                    const r = St.DotVV(e, s);
94395                    const o = -n;
94396                    const a = St.SubVV(i, t, Ht.s_e13);
94397                    const l = St.DotVV(t, a);
94398                    const h = St.DotVV(i, a);
94399                    const c = -l;
94400                    const u = St.SubVV(i, e, Ht.s_e23);
94401                    const _ = St.DotVV(e, u);
94402                    const d = St.DotVV(i, u);
94403                    const p = -_;
94404                    const m = St.CrossVV(s, a);
94405                    const f = m * St.CrossVV(e, i);
94406                    const g = m * St.CrossVV(i, t);
94407                    const y = m * St.CrossVV(t, e);
94408                    if (o <= 0 && c <= 0) {
94409                      this.m_v1.a = 1;
94410                      this.m_count = 1;
94411                      return;
94412                    }
94413                    if (r > 0 && o > 0 && y <= 0) {
94414                      const t = 1 / (r + o);
94415                      this.m_v1.a = r * t;
94416                      this.m_v2.a = o * t;
94417                      this.m_count = 2;
94418                      return;
94419                    }
94420                    if (h > 0 && c > 0 && g <= 0) {
94421                      const t = 1 / (h + c);
94422                      this.m_v1.a = h * t;
94423                      this.m_v3.a = c * t;
94424                      this.m_count = 2;
94425                      this.m_v2.Copy(this.m_v3);
94426                      return;
94427                    }
94428                    if (r <= 0 && p <= 0) {
94429                      this.m_v2.a = 1;
94430                      this.m_count = 1;
94431                      this.m_v1.Copy(this.m_v2);
94432                      return;
94433                    }
94434                    if (h <= 0 && d <= 0) {
94435                      this.m_v3.a = 1;
94436                      this.m_count = 1;
94437                      this.m_v1.Copy(this.m_v3);
94438                      return;
94439                    }
94440                    if (d > 0 && p > 0 && f <= 0) {
94441                      const t = 1 / (d + p);
94442                      this.m_v2.a = d * t;
94443                      this.m_v3.a = p * t;
94444                      this.m_count = 2;
94445                      this.m_v1.Copy(this.m_v3);
94446                      return;
94447                    }
94448                    const b = 1 / (f + g + y);
94449                    this.m_v1.a = f * b;
94450                    this.m_v2.a = g * b;
94451                    this.m_v3.a = y * b;
94452                    this.m_count = 3;
94453                  }
94454                }
94455                Ht.s_e12 = new St;
94456                Ht.s_e13 = new St;
94457                Ht.s_e23 = new St;
94458                const jt = new Ht;
94459                const Xt = [ 0, 0, 0 ];
94460                const Wt = [ 0, 0, 0 ];
94461                const Yt = new St;
94462                const qt = new St;
94463                const Kt = new St;
94464                const Jt = new St;
94465                const Zt = new St;
94466                function Qt(e, i, s) {
94467                  ++t.b2_gjkCalls;
94468                  const o = s.proxyA;
94469                  const a = s.proxyB;
94470                  const l = s.transformA;
94471                  const h = s.transformB;
94472                  const c = jt;
94473                  c.ReadCache(i, o, l, a, h);
94474                  const u = c.m_vertices;
94475                  const _ = 20;
94476                  const d = Xt;
94477                  const p = Wt;
94478                  let m = 0;
94479                  let f = 0;
94480                  for (;f < _; ) {
94481                    m = c.m_count;
94482                    for (let t = 0; t < m; ++t) {
94483                      d[t] = u[t].indexA;
94484                      p[t] = u[t].indexB;
94485                    }
94486                    switch (c.m_count) {
94487                     case 1:
94488                      break;
94489
94490                     case 2:
94491                      c.Solve2();
94492                      break;
94493
94494                     case 3:
94495                      c.Solve3();
94496                    }
94497                    if (3 === c.m_count) break;
94498                    const e = c.GetSearchDirection(qt);
94499                    if (e.LengthSquared() < r) break;
94500                    const i = u[c.m_count];
94501                    i.indexA = o.GetSupport(Ct.MulTRV(l.q, St.NegV(e, St.s_t0), Jt));
94502                    xt.MulXV(l, o.GetVertex(i.indexA), i.wA);
94503                    i.indexB = a.GetSupport(Ct.MulTRV(h.q, e, Zt));
94504                    xt.MulXV(h, a.GetVertex(i.indexB), i.wB);
94505                    St.SubVV(i.wB, i.wA, i.w);
94506                    ++f;
94507                    ++t.b2_gjkIters;
94508                    let s = !1;
94509                    for (let t = 0; t < m; ++t) if (i.indexA === d[t] && i.indexB === p[t]) {
94510                      s = !0;
94511                      break;
94512                    }
94513                    if (s) break;
94514                    ++c.m_count;
94515                  }
94516                  t.b2_gjkMaxIters = et(t.b2_gjkMaxIters, f);
94517                  c.GetWitnessPoints(e.pointA, e.pointB);
94518                  e.distance = St.DistanceVV(e.pointA, e.pointB);
94519                  e.iterations = f;
94520                  c.WriteCache(i);
94521                  if (s.useRadii) {
94522                    const t = o.m_radius;
94523                    const i = a.m_radius;
94524                    if (e.distance > t + i && e.distance > n) {
94525                      e.distance -= t + i;
94526                      const s = St.SubVV(e.pointB, e.pointA, Kt);
94527                      s.Normalize();
94528                      e.pointA.SelfMulAdd(t, s);
94529                      e.pointB.SelfMulSub(i, s);
94530                    } else {
94531                      const t = St.MidVV(e.pointA, e.pointB, Yt);
94532                      e.pointA.Copy(t);
94533                      e.pointB.Copy(t);
94534                      e.distance = 0;
94535                    }
94536                  }
94537                }
94538                const $t = new St;
94539                const te = new Ht;
94540                const ee = new St;
94541                const ie = new St;
94542                const se = new St;
94543                const ne = new St;
94544                const re = new St;
94545                const oe = new St;
94546                function ae(t, e) {
94547                  t.iterations = 0;
94548                  t.lambda = 1;
94549                  t.normal.SetZero();
94550                  t.point.SetZero();
94551                  const i = e.proxyA;
94552                  const s = e.proxyB;
94553                  const n = et(i.m_radius, d) + et(s.m_radius, d);
94554                  const r = e.transformA;
94555                  const o = e.transformB;
94556                  const a = e.translationB;
94557                  const l = $t.Set(0, 0);
94558                  let h = 0;
94559                  const c = te;
94560                  c.m_count = 0;
94561                  const _ = c.m_vertices;
94562                  let p = i.GetSupport(Ct.MulTRV(r.q, St.NegV(a, St.s_t1), St.s_t0));
94563                  let m = xt.MulXV(r, i.GetVertex(p), ee);
94564                  let f = s.GetSupport(Ct.MulTRV(o.q, a, St.s_t0));
94565                  let g = xt.MulXV(o, s.GetVertex(f), ie);
94566                  const y = St.SubVV(m, g, se);
94567                  const b = et(d, n - d);
94568                  const S = .5 * u;
94569                  const A = 20;
94570                  let T = 0;
94571                  for (;T < A && $(y.Length() - b) > S; ) {
94572                    t.iterations += 1;
94573                    p = i.GetSupport(Ct.MulTRV(r.q, St.NegV(y, St.s_t1), St.s_t0));
94574                    m = xt.MulXV(r, i.GetVertex(p), ee);
94575                    f = s.GetSupport(Ct.MulTRV(o.q, y, St.s_t0));
94576                    g = xt.MulXV(o, s.GetVertex(f), ie);
94577                    const e = St.SubVV(m, g, ne);
94578                    y.Normalize();
94579                    const n = St.DotVV(y, e);
94580                    const u = St.DotVV(y, a);
94581                    if (n - b > h * u) {
94582                      if (u <= 0) return !1;
94583                      h = (n - b) / u;
94584                      if (h > 1) return !1;
94585                      l.Copy(y).SelfNeg();
94586                      c.m_count = 0;
94587                    }
94588                    const d = _[c.m_count];
94589                    d.indexA = f;
94590                    d.wA.Copy(g).SelfMulAdd(h, a);
94591                    d.indexB = p;
94592                    d.wB.Copy(m);
94593                    d.w.Copy(d.wB).SelfSub(d.wA);
94594                    d.a = 1;
94595                    c.m_count += 1;
94596                    switch (c.m_count) {
94597                     case 1:
94598                      break;
94599
94600                     case 2:
94601                      c.Solve2();
94602                      break;
94603
94604                     case 3:
94605                      c.Solve3();
94606                    }
94607                    if (3 === c.m_count) return !1;
94608                    c.GetClosestPoint(y);
94609                    ++T;
94610                  }
94611                  const v = re;
94612                  const E = oe;
94613                  c.GetWitnessPoints(v, E);
94614                  if (y.LengthSquared() > 0) {
94615                    l.Copy(y).SelfNeg();
94616                    l.Normalize();
94617                  }
94618                  t.normal.Copy(l);
94619                  t.lambda = h;
94620                  t.iterations = T;
94621                  return !0;
94622                }
94623                !function(t) {
94624                  t[t.e_vertex = 0] = "e_vertex";
94625                  t[t.e_face = 1] = "e_face";
94626                }(t.b2ContactFeatureType || (t.b2ContactFeatureType = {}));
94627                class le {
94628                  constructor() {
94629                    this._key = 0;
94630                    this._key_invalid = !1;
94631                    this._indexA = 0;
94632                    this._indexB = 0;
94633                    this._typeA = 0;
94634                    this._typeB = 0;
94635                  }
94636                  get key() {
94637                    if (this._key_invalid) {
94638                      this._key_invalid = !1;
94639                      this._key = this._indexA | this._indexB << 8 | this._typeA << 16 | this._typeB << 24;
94640                    }
94641                    return this._key;
94642                  }
94643                  set key(t) {
94644                    this._key = t;
94645                    this._key_invalid = !1;
94646                    this._indexA = 255 & this._key;
94647                    this._indexB = this._key >> 8 & 255;
94648                    this._typeA = this._key >> 16 & 255;
94649                    this._typeB = this._key >> 24 & 255;
94650                  }
94651                  get indexA() {
94652                    return this._indexA;
94653                  }
94654                  set indexA(t) {
94655                    this._indexA = t;
94656                    this._key_invalid = !0;
94657                  }
94658                  get indexB() {
94659                    return this._indexB;
94660                  }
94661                  set indexB(t) {
94662                    this._indexB = t;
94663                    this._key_invalid = !0;
94664                  }
94665                  get typeA() {
94666                    return this._typeA;
94667                  }
94668                  set typeA(t) {
94669                    this._typeA = t;
94670                    this._key_invalid = !0;
94671                  }
94672                  get typeB() {
94673                    return this._typeB;
94674                  }
94675                  set typeB(t) {
94676                    this._typeB = t;
94677                    this._key_invalid = !0;
94678                  }
94679                }
94680                class he {
94681                  constructor() {
94682                    this.cf = new le;
94683                  }
94684                  Copy(t) {
94685                    this.key = t.key;
94686                    return this;
94687                  }
94688                  Clone() {
94689                    return (new he).Copy(this);
94690                  }
94691                  get key() {
94692                    return this.cf.key;
94693                  }
94694                  set key(t) {
94695                    this.cf.key = t;
94696                  }
94697                }
94698                class ce {
94699                  constructor() {
94700                    this.localPoint = new St;
94701                    this.normalImpulse = 0;
94702                    this.tangentImpulse = 0;
94703                    this.id = new he;
94704                  }
94705                  static MakeArray(t) {
94706                    return Y(t, (t => new ce));
94707                  }
94708                  Reset() {
94709                    this.localPoint.SetZero();
94710                    this.normalImpulse = 0;
94711                    this.tangentImpulse = 0;
94712                    this.id.key = 0;
94713                  }
94714                  Copy(t) {
94715                    this.localPoint.Copy(t.localPoint);
94716                    this.normalImpulse = t.normalImpulse;
94717                    this.tangentImpulse = t.tangentImpulse;
94718                    this.id.Copy(t.id);
94719                    return this;
94720                  }
94721                }
94722                !function(t) {
94723                  t[t.e_unknown = -1] = "e_unknown";
94724                  t[t.e_circles = 0] = "e_circles";
94725                  t[t.e_faceA = 1] = "e_faceA";
94726                  t[t.e_faceB = 2] = "e_faceB";
94727                }(t.b2ManifoldType || (t.b2ManifoldType = {}));
94728                class ue {
94729                  constructor() {
94730                    this.points = ce.MakeArray(a);
94731                    this.localNormal = new St;
94732                    this.localPoint = new St;
94733                    this.type = t.b2ManifoldType.e_unknown;
94734                    this.pointCount = 0;
94735                  }
94736                  Reset() {
94737                    for (let t = 0; t < a; ++t) this.points[t].Reset();
94738                    this.localNormal.SetZero();
94739                    this.localPoint.SetZero();
94740                    this.type = t.b2ManifoldType.e_unknown;
94741                    this.pointCount = 0;
94742                  }
94743                  Copy(t) {
94744                    this.pointCount = t.pointCount;
94745                    for (let e = 0; e < a; ++e) this.points[e].Copy(t.points[e]);
94746                    this.localNormal.Copy(t.localNormal);
94747                    this.localPoint.Copy(t.localPoint);
94748                    this.type = t.type;
94749                    return this;
94750                  }
94751                  Clone() {
94752                    return (new ue).Copy(this);
94753                  }
94754                }
94755                class _e {
94756                  constructor() {
94757                    this.normal = new St;
94758                    this.points = St.MakeArray(a);
94759                    this.separations = K(a);
94760                  }
94761                  Initialize(e, i, s, n, o) {
94762                    if (0 !== e.pointCount) switch (e.type) {
94763                     case t.b2ManifoldType.e_circles:
94764                      {
94765                        this.normal.Set(1, 0);
94766                        const t = xt.MulXV(i, e.localPoint, _e.Initialize_s_pointA);
94767                        const a = xt.MulXV(n, e.points[0].localPoint, _e.Initialize_s_pointB);
94768                        St.DistanceSquaredVV(t, a) > r && St.SubVV(a, t, this.normal).SelfNormalize();
94769                        const l = St.AddVMulSV(t, s, this.normal, _e.Initialize_s_cA);
94770                        const h = St.SubVMulSV(a, o, this.normal, _e.Initialize_s_cB);
94771                        St.MidVV(l, h, this.points[0]);
94772                        this.separations[0] = St.DotVV(St.SubVV(h, l, St.s_t0), this.normal);
94773                        break;
94774                      }
94775
94776                     case t.b2ManifoldType.e_faceA:
94777                      {
94778                        Ct.MulRV(i.q, e.localNormal, this.normal);
94779                        const t = xt.MulXV(i, e.localPoint, _e.Initialize_s_planePoint);
94780                        for (let i = 0; i < e.pointCount; ++i) {
94781                          const r = xt.MulXV(n, e.points[i].localPoint, _e.Initialize_s_clipPoint);
94782                          const a = s - St.DotVV(St.SubVV(r, t, St.s_t0), this.normal);
94783                          const l = St.AddVMulSV(r, a, this.normal, _e.Initialize_s_cA);
94784                          const h = St.SubVMulSV(r, o, this.normal, _e.Initialize_s_cB);
94785                          St.MidVV(l, h, this.points[i]);
94786                          this.separations[i] = St.DotVV(St.SubVV(h, l, St.s_t0), this.normal);
94787                        }
94788                        break;
94789                      }
94790
94791                     case t.b2ManifoldType.e_faceB:
94792                      {
94793                        Ct.MulRV(n.q, e.localNormal, this.normal);
94794                        const t = xt.MulXV(n, e.localPoint, _e.Initialize_s_planePoint);
94795                        for (let n = 0; n < e.pointCount; ++n) {
94796                          const r = xt.MulXV(i, e.points[n].localPoint, _e.Initialize_s_clipPoint);
94797                          const a = o - St.DotVV(St.SubVV(r, t, St.s_t0), this.normal);
94798                          const l = St.AddVMulSV(r, a, this.normal, _e.Initialize_s_cB);
94799                          const h = St.SubVMulSV(r, s, this.normal, _e.Initialize_s_cA);
94800                          St.MidVV(h, l, this.points[n]);
94801                          this.separations[n] = St.DotVV(St.SubVV(h, l, St.s_t0), this.normal);
94802                        }
94803                        this.normal.SelfNeg();
94804                        break;
94805                      }
94806                    }
94807                  }
94808                }
94809                _e.Initialize_s_pointA = new St;
94810                _e.Initialize_s_pointB = new St;
94811                _e.Initialize_s_cA = new St;
94812                _e.Initialize_s_cB = new St;
94813                _e.Initialize_s_planePoint = new St;
94814                _e.Initialize_s_clipPoint = new St;
94815                !function(t) {
94816                  t[t.b2_nullState = 0] = "b2_nullState";
94817                  t[t.b2_addState = 1] = "b2_addState";
94818                  t[t.b2_persistState = 2] = "b2_persistState";
94819                  t[t.b2_removeState = 3] = "b2_removeState";
94820                }(t.b2PointState || (t.b2PointState = {}));
94821                function de(e, i, s, n) {
94822                  let r;
94823                  for (r = 0; r < s.pointCount; ++r) {
94824                    const i = s.points[r].id.key;
94825                    e[r] = t.b2PointState.b2_removeState;
94826                    for (let s = 0, o = n.pointCount; s < o; ++s) if (n.points[s].id.key === i) {
94827                      e[r] = t.b2PointState.b2_persistState;
94828                      break;
94829                    }
94830                  }
94831                  for (;r < a; ++r) e[r] = t.b2PointState.b2_nullState;
94832                  for (r = 0; r < n.pointCount; ++r) {
94833                    const e = n.points[r].id.key;
94834                    i[r] = t.b2PointState.b2_addState;
94835                    for (let n = 0, o = s.pointCount; n < o; ++n) if (s.points[n].id.key === e) {
94836                      i[r] = t.b2PointState.b2_persistState;
94837                      break;
94838                    }
94839                  }
94840                  for (;r < a; ++r) i[r] = t.b2PointState.b2_nullState;
94841                }
94842                class pe {
94843                  constructor() {
94844                    this.v = new St;
94845                    this.id = new he;
94846                  }
94847                  static MakeArray(t) {
94848                    return Y(t, (t => new pe));
94849                  }
94850                  Copy(t) {
94851                    this.v.Copy(t.v);
94852                    this.id.Copy(t.id);
94853                    return this;
94854                  }
94855                }
94856                class me {
94857                  constructor() {
94858                    this.p1 = new St;
94859                    this.p2 = new St;
94860                    this.maxFraction = 1;
94861                  }
94862                  Copy(t) {
94863                    this.p1.Copy(t.p1);
94864                    this.p2.Copy(t.p2);
94865                    this.maxFraction = t.maxFraction;
94866                    return this;
94867                  }
94868                }
94869                class fe {
94870                  constructor() {
94871                    this.normal = new St;
94872                    this.fraction = 0;
94873                  }
94874                  Copy(t) {
94875                    this.normal.Copy(t.normal);
94876                    this.fraction = t.fraction;
94877                    return this;
94878                  }
94879                }
94880                class ge {
94881                  constructor() {
94882                    this.lowerBound = new St;
94883                    this.upperBound = new St;
94884                    this.m_cache_center = new St;
94885                    this.m_cache_extent = new St;
94886                  }
94887                  Copy(t) {
94888                    this.lowerBound.Copy(t.lowerBound);
94889                    this.upperBound.Copy(t.upperBound);
94890                    return this;
94891                  }
94892                  IsValid() {
94893                    return !(!this.lowerBound.IsValid() || !this.upperBound.IsValid() || this.upperBound.x < this.lowerBound.x || this.upperBound.y < this.lowerBound.y);
94894                  }
94895                  GetCenter() {
94896                    return St.MidVV(this.lowerBound, this.upperBound, this.m_cache_center);
94897                  }
94898                  GetExtents() {
94899                    return St.ExtVV(this.lowerBound, this.upperBound, this.m_cache_extent);
94900                  }
94901                  GetPerimeter() {
94902                    return 2 * (this.upperBound.x - this.lowerBound.x + (this.upperBound.y - this.lowerBound.y));
94903                  }
94904                  Combine1(t) {
94905                    this.lowerBound.x = tt(this.lowerBound.x, t.lowerBound.x);
94906                    this.lowerBound.y = tt(this.lowerBound.y, t.lowerBound.y);
94907                    this.upperBound.x = et(this.upperBound.x, t.upperBound.x);
94908                    this.upperBound.y = et(this.upperBound.y, t.upperBound.y);
94909                    return this;
94910                  }
94911                  Combine2(t, e) {
94912                    this.lowerBound.x = tt(t.lowerBound.x, e.lowerBound.x);
94913                    this.lowerBound.y = tt(t.lowerBound.y, e.lowerBound.y);
94914                    this.upperBound.x = et(t.upperBound.x, e.upperBound.x);
94915                    this.upperBound.y = et(t.upperBound.y, e.upperBound.y);
94916                    return this;
94917                  }
94918                  static Combine(t, e, i) {
94919                    i.Combine2(t, e);
94920                    return i;
94921                  }
94922                  Contains(t) {
94923                    return !(this.lowerBound.x <= t.lowerBound.x || this.lowerBound.y <= t.lowerBound.y || t.upperBound.x <= this.upperBound.x || t.upperBound.y <= this.upperBound.y);
94924                  }
94925                  RayCast(t, e) {
94926                    let i = -s;
94927                    let r = s;
94928                    const o = e.p1.x;
94929                    const a = e.p1.y;
94930                    const l = e.p2.x - e.p1.x;
94931                    const h = e.p2.y - e.p1.y;
94932                    const c = $(l);
94933                    const u = $(h);
94934                    const _ = t.normal;
94935                    if (c < n) {
94936                      if (o < this.lowerBound.x || this.upperBound.x < o) return !1;
94937                    } else {
94938                      const t = 1 / l;
94939                      let e = (this.lowerBound.x - o) * t;
94940                      let s = (this.upperBound.x - o) * t;
94941                      let n = -1;
94942                      if (e > s) {
94943                        const t = e;
94944                        e = s;
94945                        s = t;
94946                        n = 1;
94947                      }
94948                      if (e > i) {
94949                        _.x = n;
94950                        _.y = 0;
94951                        i = e;
94952                      }
94953                      r = tt(r, s);
94954                      if (i > r) return !1;
94955                    }
94956                    if (u < n) {
94957                      if (a < this.lowerBound.y || this.upperBound.y < a) return !1;
94958                    } else {
94959                      const t = 1 / h;
94960                      let e = (this.lowerBound.y - a) * t;
94961                      let s = (this.upperBound.y - a) * t;
94962                      let n = -1;
94963                      if (e > s) {
94964                        const t = e;
94965                        e = s;
94966                        s = t;
94967                        n = 1;
94968                      }
94969                      if (e > i) {
94970                        _.x = 0;
94971                        _.y = n;
94972                        i = e;
94973                      }
94974                      r = tt(r, s);
94975                      if (i > r) return !1;
94976                    }
94977                    if (i < 0 || e.maxFraction < i) return !1;
94978                    t.fraction = i;
94979                    return !0;
94980                  }
94981                  TestContain(t) {
94982                    return !(t.x < this.lowerBound.x || this.upperBound.x < t.x || t.y < this.lowerBound.y || this.upperBound.y < t.y);
94983                  }
94984                  TestOverlap(t) {
94985                    return !(this.upperBound.x < t.lowerBound.x || this.upperBound.y < t.lowerBound.y || t.upperBound.x < this.lowerBound.x || t.upperBound.y < this.lowerBound.y);
94986                  }
94987                }
94988                function ye(t, e) {
94989                  return !(t.upperBound.x < e.lowerBound.x || t.upperBound.y < e.lowerBound.y || e.upperBound.x < t.lowerBound.x || e.upperBound.y < t.lowerBound.y);
94990                }
94991                function be(e, i, s, n, r) {
94992                  let o = 0;
94993                  const a = i[0];
94994                  const l = i[1];
94995                  const h = St.DotVV(s, a.v) - n;
94996                  const c = St.DotVV(s, l.v) - n;
94997                  h <= 0 && e[o++].Copy(a);
94998                  c <= 0 && e[o++].Copy(l);
94999                  if (h * c < 0) {
95000                    const i = h / (h - c);
95001                    const s = e[o].v;
95002                    s.x = a.v.x + i * (l.v.x - a.v.x);
95003                    s.y = a.v.y + i * (l.v.y - a.v.y);
95004                    const n = e[o].id;
95005                    n.cf.indexA = r;
95006                    n.cf.indexB = a.id.cf.indexB;
95007                    n.cf.typeA = t.b2ContactFeatureType.e_vertex;
95008                    n.cf.typeB = t.b2ContactFeatureType.e_face;
95009                    ++o;
95010                  }
95011                  return o;
95012                }
95013                const Se = new Ft;
95014                const Ae = new Lt;
95015                const Te = new Vt;
95016                function ve(t, e, i, s, r, o) {
95017                  const a = Se.Reset();
95018                  a.proxyA.SetShape(t, e);
95019                  a.proxyB.SetShape(i, s);
95020                  a.transformA.Copy(r);
95021                  a.transformB.Copy(o);
95022                  a.useRadii = !0;
95023                  const l = Ae.Reset();
95024                  l.count = 0;
95025                  const h = Te.Reset();
95026                  Qt(h, l, a);
95027                  return h.distance < 10 * n;
95028                }
95029                function Ee(t) {
95030                  if (null === t) throw new Error;
95031                  return t;
95032                }
95033                class Ce {
95034                  constructor(t = 0) {
95035                    this.m_id = 0;
95036                    this.aabb = new ge;
95037                    this._userData = null;
95038                    this.parent = null;
95039                    this.child1 = null;
95040                    this.child2 = null;
95041                    this.height = 0;
95042                    this.m_id = t;
95043                  }
95044                  get userData() {
95045                    if (null === this._userData) throw new Error;
95046                    return this._userData;
95047                  }
95048                  set userData(t) {
95049                    if (null !== this._userData) throw new Error;
95050                    this._userData = t;
95051                  }
95052                  Reset() {
95053                    this._userData = null;
95054                  }
95055                  IsLeaf() {
95056                    return null === this.child1;
95057                  }
95058                }
95059                class xe {
95060                  constructor() {
95061                    this.m_root = null;
95062                    this.m_freeList = null;
95063                    this.m_path = 0;
95064                    this.m_insertionCount = 0;
95065                    this.m_stack = new Dt(256);
95066                  }
95067                  Query(t, e) {
95068                    const i = this.m_stack.Reset();
95069                    i.Push(this.m_root);
95070                    for (;i.GetCount() > 0; ) {
95071                      const s = i.Pop();
95072                      if (null !== s && s.aabb.TestOverlap(t)) if (s.IsLeaf()) {
95073                        if (!e(s)) return;
95074                      } else {
95075                        i.Push(s.child1);
95076                        i.Push(s.child2);
95077                      }
95078                    }
95079                  }
95080                  QueryPoint(t, e) {
95081                    const i = this.m_stack.Reset();
95082                    i.Push(this.m_root);
95083                    for (;i.GetCount() > 0; ) {
95084                      const s = i.Pop();
95085                      if (null !== s && s.aabb.TestContain(t)) if (s.IsLeaf()) {
95086                        if (!e(s)) return;
95087                      } else {
95088                        i.Push(s.child1);
95089                        i.Push(s.child2);
95090                      }
95091                    }
95092                  }
95093                  RayCast(t, e) {
95094                    const i = t.p1;
95095                    const s = t.p2;
95096                    const n = St.SubVV(s, i, xe.s_r);
95097                    n.Normalize();
95098                    const r = St.CrossOneV(n, xe.s_v);
95099                    const o = St.AbsV(r, xe.s_abs_v);
95100                    let a = t.maxFraction;
95101                    const l = xe.s_segmentAABB;
95102                    let h = i.x + a * (s.x - i.x);
95103                    let c = i.y + a * (s.y - i.y);
95104                    l.lowerBound.x = tt(i.x, h);
95105                    l.lowerBound.y = tt(i.y, c);
95106                    l.upperBound.x = et(i.x, h);
95107                    l.upperBound.y = et(i.y, c);
95108                    const u = this.m_stack.Reset();
95109                    u.Push(this.m_root);
95110                    for (;u.GetCount() > 0; ) {
95111                      const n = u.Pop();
95112                      if (null === n) continue;
95113                      if (!ye(n.aabb, l)) continue;
95114                      const _ = n.aabb.GetCenter();
95115                      const d = n.aabb.GetExtents();
95116                      if (!($(St.DotVV(r, St.SubVV(i, _, St.s_t0))) - St.DotVV(o, d) > 0)) if (n.IsLeaf()) {
95117                        const r = xe.s_subInput;
95118                        r.p1.Copy(t.p1);
95119                        r.p2.Copy(t.p2);
95120                        r.maxFraction = a;
95121                        const o = e(r, n);
95122                        if (0 === o) return;
95123                        if (o > 0) {
95124                          a = o;
95125                          h = i.x + a * (s.x - i.x);
95126                          c = i.y + a * (s.y - i.y);
95127                          l.lowerBound.x = tt(i.x, h);
95128                          l.lowerBound.y = tt(i.y, c);
95129                          l.upperBound.x = et(i.x, h);
95130                          l.upperBound.y = et(i.y, c);
95131                        }
95132                      } else {
95133                        u.Push(n.child1);
95134                        u.Push(n.child2);
95135                      }
95136                    }
95137                  }
95138                  AllocateNode() {
95139                    if (null !== this.m_freeList) {
95140                      const t = this.m_freeList;
95141                      this.m_freeList = t.parent;
95142                      t.parent = null;
95143                      t.child1 = null;
95144                      t.child2 = null;
95145                      t.height = 0;
95146                      return t;
95147                    }
95148                    return new Ce(xe.s_node_id++);
95149                  }
95150                  FreeNode(t) {
95151                    t.parent = this.m_freeList;
95152                    t.child1 = null;
95153                    t.child2 = null;
95154                    t.height = -1;
95155                    t.Reset();
95156                    this.m_freeList = t;
95157                  }
95158                  CreateProxy(t, e) {
95159                    const i = this.AllocateNode();
95160                    const s = h;
95161                    const n = h;
95162                    i.aabb.lowerBound.x = t.lowerBound.x - s;
95163                    i.aabb.lowerBound.y = t.lowerBound.y - n;
95164                    i.aabb.upperBound.x = t.upperBound.x + s;
95165                    i.aabb.upperBound.y = t.upperBound.y + n;
95166                    i.userData = e;
95167                    i.height = 0;
95168                    this.InsertLeaf(i);
95169                    return i;
95170                  }
95171                  DestroyProxy(t) {
95172                    this.RemoveLeaf(t);
95173                    this.FreeNode(t);
95174                  }
95175                  MoveProxy(t, e, i) {
95176                    if (t.aabb.Contains(e)) return !1;
95177                    this.RemoveLeaf(t);
95178                    const s = h;
95179                    const n = h;
95180                    t.aabb.lowerBound.x = e.lowerBound.x - s;
95181                    t.aabb.lowerBound.y = e.lowerBound.y - n;
95182                    t.aabb.upperBound.x = e.upperBound.x + s;
95183                    t.aabb.upperBound.y = e.upperBound.y + n;
95184                    const r = c * i.x;
95185                    const o = c * i.y;
95186                    r < 0 ? t.aabb.lowerBound.x += r : t.aabb.upperBound.x += r;
95187                    o < 0 ? t.aabb.lowerBound.y += o : t.aabb.upperBound.y += o;
95188                    this.InsertLeaf(t);
95189                    return !0;
95190                  }
95191                  InsertLeaf(t) {
95192                    ++this.m_insertionCount;
95193                    if (null === this.m_root) {
95194                      this.m_root = t;
95195                      this.m_root.parent = null;
95196                      return;
95197                    }
95198                    const e = t.aabb;
95199                    let i = this.m_root;
95200                    for (;!i.IsLeaf(); ) {
95201                      const t = Ee(i.child1);
95202                      const s = Ee(i.child2);
95203                      const n = i.aabb.GetPerimeter();
95204                      const r = xe.s_combinedAABB;
95205                      r.Combine2(i.aabb, e);
95206                      const o = r.GetPerimeter();
95207                      const a = 2 * o;
95208                      const l = 2 * (o - n);
95209                      let h;
95210                      const c = xe.s_aabb;
95211                      let u;
95212                      let _;
95213                      if (t.IsLeaf()) {
95214                        c.Combine2(e, t.aabb);
95215                        h = c.GetPerimeter() + l;
95216                      } else {
95217                        c.Combine2(e, t.aabb);
95218                        u = t.aabb.GetPerimeter();
95219                        _ = c.GetPerimeter();
95220                        h = _ - u + l;
95221                      }
95222                      let d;
95223                      if (s.IsLeaf()) {
95224                        c.Combine2(e, s.aabb);
95225                        d = c.GetPerimeter() + l;
95226                      } else {
95227                        c.Combine2(e, s.aabb);
95228                        u = s.aabb.GetPerimeter();
95229                        _ = c.GetPerimeter();
95230                        d = _ - u + l;
95231                      }
95232                      if (a < h && a < d) break;
95233                      i = h < d ? t : s;
95234                    }
95235                    const s = i.parent;
95236                    const n = this.AllocateNode();
95237                    n.parent = s;
95238                    n.aabb.Combine2(e, i.aabb);
95239                    n.height = i.height + 1;
95240                    if (null !== s) {
95241                      s.child1 === i ? s.child1 = n : s.child2 = n;
95242                      n.child1 = i;
95243                      n.child2 = t;
95244                      i.parent = n;
95245                      t.parent = n;
95246                    } else {
95247                      n.child1 = i;
95248                      n.child2 = t;
95249                      i.parent = n;
95250                      t.parent = n;
95251                      this.m_root = n;
95252                    }
95253                    let r = t.parent;
95254                    for (;null !== r; ) {
95255                      r = this.Balance(r);
95256                      const t = Ee(r.child1);
95257                      const e = Ee(r.child2);
95258                      r.height = 1 + et(t.height, e.height);
95259                      r.aabb.Combine2(t.aabb, e.aabb);
95260                      r = r.parent;
95261                    }
95262                  }
95263                  RemoveLeaf(t) {
95264                    if (t === this.m_root) {
95265                      this.m_root = null;
95266                      return;
95267                    }
95268                    const e = Ee(t.parent);
95269                    const i = e && e.parent;
95270                    const s = Ee(e.child1 === t ? e.child2 : e.child1);
95271                    if (null !== i) {
95272                      i.child1 === e ? i.child1 = s : i.child2 = s;
95273                      s.parent = i;
95274                      this.FreeNode(e);
95275                      let t = i;
95276                      for (;null !== t; ) {
95277                        t = this.Balance(t);
95278                        const e = Ee(t.child1);
95279                        const i = Ee(t.child2);
95280                        t.aabb.Combine2(e.aabb, i.aabb);
95281                        t.height = 1 + et(e.height, i.height);
95282                        t = t.parent;
95283                      }
95284                    } else {
95285                      this.m_root = s;
95286                      s.parent = null;
95287                      this.FreeNode(e);
95288                    }
95289                  }
95290                  Balance(t) {
95291                    if (t.IsLeaf() || t.height < 2) return t;
95292                    const e = Ee(t.child1);
95293                    const i = Ee(t.child2);
95294                    const s = i.height - e.height;
95295                    if (s > 1) {
95296                      const s = Ee(i.child1);
95297                      const n = Ee(i.child2);
95298                      i.child1 = t;
95299                      i.parent = t.parent;
95300                      t.parent = i;
95301                      null !== i.parent ? i.parent.child1 === t ? i.parent.child1 = i : i.parent.child2 = i : this.m_root = i;
95302                      if (s.height > n.height) {
95303                        i.child2 = s;
95304                        t.child2 = n;
95305                        n.parent = t;
95306                        t.aabb.Combine2(e.aabb, n.aabb);
95307                        i.aabb.Combine2(t.aabb, s.aabb);
95308                        t.height = 1 + et(e.height, n.height);
95309                        i.height = 1 + et(t.height, s.height);
95310                      } else {
95311                        i.child2 = n;
95312                        t.child2 = s;
95313                        s.parent = t;
95314                        t.aabb.Combine2(e.aabb, s.aabb);
95315                        i.aabb.Combine2(t.aabb, n.aabb);
95316                        t.height = 1 + et(e.height, s.height);
95317                        i.height = 1 + et(t.height, n.height);
95318                      }
95319                      return i;
95320                    }
95321                    if (s < -1) {
95322                      const s = Ee(e.child1);
95323                      const n = Ee(e.child2);
95324                      e.child1 = t;
95325                      e.parent = t.parent;
95326                      t.parent = e;
95327                      null !== e.parent ? e.parent.child1 === t ? e.parent.child1 = e : e.parent.child2 = e : this.m_root = e;
95328                      if (s.height > n.height) {
95329                        e.child2 = s;
95330                        t.child1 = n;
95331                        n.parent = t;
95332                        t.aabb.Combine2(i.aabb, n.aabb);
95333                        e.aabb.Combine2(t.aabb, s.aabb);
95334                        t.height = 1 + et(i.height, n.height);
95335                        e.height = 1 + et(t.height, s.height);
95336                      } else {
95337                        e.child2 = n;
95338                        t.child1 = s;
95339                        s.parent = t;
95340                        t.aabb.Combine2(i.aabb, s.aabb);
95341                        e.aabb.Combine2(t.aabb, n.aabb);
95342                        t.height = 1 + et(i.height, s.height);
95343                        e.height = 1 + et(t.height, n.height);
95344                      }
95345                      return e;
95346                    }
95347                    return t;
95348                  }
95349                  GetHeight() {
95350                    return null === this.m_root ? 0 : this.m_root.height;
95351                  }
95352                  static GetAreaNode(t) {
95353                    if (null === t) return 0;
95354                    if (t.IsLeaf()) return 0;
95355                    let e = t.aabb.GetPerimeter();
95356                    e += xe.GetAreaNode(t.child1);
95357                    e += xe.GetAreaNode(t.child2);
95358                    return e;
95359                  }
95360                  GetAreaRatio() {
95361                    if (null === this.m_root) return 0;
95362                    const t = this.m_root.aabb.GetPerimeter();
95363                    return xe.GetAreaNode(this.m_root) / t;
95364                  }
95365                  static ComputeHeightNode(t) {
95366                    return null === t || t.IsLeaf() ? 0 : 1 + et(xe.ComputeHeightNode(t.child1), xe.ComputeHeightNode(t.child2));
95367                  }
95368                  ComputeHeight() {
95369                    return xe.ComputeHeightNode(this.m_root);
95370                  }
95371                  ValidateStructure(t) {
95372                    if (null === t) return;
95373                    this.m_root;
95374                    if (t.IsLeaf()) return;
95375                    const e = Ee(t.child1);
95376                    const i = Ee(t.child2);
95377                    this.ValidateStructure(e);
95378                    this.ValidateStructure(i);
95379                  }
95380                  ValidateMetrics(t) {
95381                    if (null === t) return;
95382                    if (t.IsLeaf()) return;
95383                    const e = Ee(t.child1);
95384                    const i = Ee(t.child2);
95385                    xe.s_aabb.Combine2(e.aabb, i.aabb);
95386                    this.ValidateMetrics(e);
95387                    this.ValidateMetrics(i);
95388                  }
95389                  Validate() {}
95390                  static GetMaxBalanceNode(t, e) {
95391                    if (null === t) return e;
95392                    if (t.height <= 1) return e;
95393                    const i = Ee(t.child1);
95394                    const s = Ee(t.child2);
95395                    return et(e, $(s.height - i.height));
95396                  }
95397                  GetMaxBalance() {
95398                    return xe.GetMaxBalanceNode(this.m_root, 0);
95399                  }
95400                  RebuildBottomUp() {
95401                    this.Validate();
95402                  }
95403                  static ShiftOriginNode(t, e) {
95404                    if (null === t) return;
95405                    if (t.height <= 1) return;
95406                    const i = t.child1;
95407                    const s = t.child2;
95408                    xe.ShiftOriginNode(i, e);
95409                    xe.ShiftOriginNode(s, e);
95410                    t.aabb.lowerBound.SelfSub(e);
95411                    t.aabb.upperBound.SelfSub(e);
95412                  }
95413                  ShiftOrigin(t) {
95414                    xe.ShiftOriginNode(this.m_root, t);
95415                  }
95416                }
95417                xe.s_r = new St;
95418                xe.s_v = new St;
95419                xe.s_abs_v = new St;
95420                xe.s_segmentAABB = new ge;
95421                xe.s_subInput = new me;
95422                xe.s_combinedAABB = new ge;
95423                xe.s_aabb = new ge;
95424                xe.s_node_id = 0;
95425                function we(t, e, i) {
95426                  const s = t[e];
95427                  t[e] = t[i];
95428                  t[i] = s;
95429                }
95430                function Re(t, e) {
95431                  return t < e;
95432                }
95433                function Ie(t, e = 0, i = t.length - e, s = Re) {
95434                  let n = e;
95435                  const r = [];
95436                  let o = 0;
95437                  for (;;) {
95438                    for (;n + 1 < i; i++) {
95439                      const e = t[n + Math.floor(Math.random() * (i - n))];
95440                      r[o++] = i;
95441                      for (let r = n - 1; ;) {
95442                        for (;s(t[++r], e); ) ;
95443                        for (;s(e, t[--i]); ) ;
95444                        if (r >= i) break;
95445                        we(t, r, i);
95446                      }
95447                    }
95448                    if (0 === o) break;
95449                    n = i;
95450                    i = r[--o];
95451                  }
95452                  return t;
95453                }
95454                class Me {
95455                  constructor(t, e) {
95456                    this.proxyA = t;
95457                    this.proxyB = e;
95458                  }
95459                }
95460                class Be {
95461                  constructor() {
95462                    this.m_tree = new xe;
95463                    this.m_proxyCount = 0;
95464                    this.m_moveCount = 0;
95465                    this.m_moveBuffer = [];
95466                    this.m_pairCount = 0;
95467                    this.m_pairBuffer = [];
95468                  }
95469                  CreateProxy(t, e) {
95470                    const i = this.m_tree.CreateProxy(t, e);
95471                    ++this.m_proxyCount;
95472                    this.BufferMove(i);
95473                    return i;
95474                  }
95475                  DestroyProxy(t) {
95476                    this.UnBufferMove(t);
95477                    --this.m_proxyCount;
95478                    this.m_tree.DestroyProxy(t);
95479                  }
95480                  MoveProxy(t, e, i) {
95481                    this.m_tree.MoveProxy(t, e, i) && this.BufferMove(t);
95482                  }
95483                  TouchProxy(t) {
95484                    this.BufferMove(t);
95485                  }
95486                  GetProxyCount() {
95487                    return this.m_proxyCount;
95488                  }
95489                  UpdatePairs(t) {
95490                    this.m_pairCount = 0;
95491                    for (let t = 0; t < this.m_moveCount; ++t) {
95492                      const e = this.m_moveBuffer[t];
95493                      if (null === e) continue;
95494                      const i = e.aabb;
95495                      this.m_tree.Query(i, (t => {
95496                        if (t.m_id === e.m_id) return !0;
95497                        let i;
95498                        let s;
95499                        if (t.m_id < e.m_id) {
95500                          i = t;
95501                          s = e;
95502                        } else {
95503                          i = e;
95504                          s = t;
95505                        }
95506                        if (this.m_pairCount === this.m_pairBuffer.length) this.m_pairBuffer[this.m_pairCount] = new Me(i, s); else {
95507                          const t = this.m_pairBuffer[this.m_pairCount];
95508                          t.proxyA = i;
95509                          t.proxyB = s;
95510                        }
95511                        ++this.m_pairCount;
95512                        return !0;
95513                      }));
95514                    }
95515                    this.m_moveCount = 0;
95516                    Ie(this.m_pairBuffer, 0, this.m_pairCount, De);
95517                    let e = 0;
95518                    for (;e < this.m_pairCount; ) {
95519                      const i = this.m_pairBuffer[e];
95520                      t(i.proxyA.userData, i.proxyB.userData);
95521                      ++e;
95522                      for (;e < this.m_pairCount; ) {
95523                        const t = this.m_pairBuffer[e];
95524                        if (t.proxyA.m_id !== i.proxyA.m_id || t.proxyB.m_id !== i.proxyB.m_id) break;
95525                        ++e;
95526                      }
95527                    }
95528                  }
95529                  Query(t, e) {
95530                    this.m_tree.Query(t, e);
95531                  }
95532                  QueryPoint(t, e) {
95533                    this.m_tree.QueryPoint(t, e);
95534                  }
95535                  RayCast(t, e) {
95536                    this.m_tree.RayCast(t, e);
95537                  }
95538                  GetTreeHeight() {
95539                    return this.m_tree.GetHeight();
95540                  }
95541                  GetTreeBalance() {
95542                    return this.m_tree.GetMaxBalance();
95543                  }
95544                  GetTreeQuality() {
95545                    return this.m_tree.GetAreaRatio();
95546                  }
95547                  ShiftOrigin(t) {
95548                    this.m_tree.ShiftOrigin(t);
95549                  }
95550                  BufferMove(t) {
95551                    this.m_moveBuffer[this.m_moveCount] = t;
95552                    ++this.m_moveCount;
95553                  }
95554                  UnBufferMove(t) {
95555                    const e = this.m_moveBuffer.indexOf(t);
95556                    this.m_moveBuffer[e] = null;
95557                  }
95558                }
95559                function De(t, e) {
95560                  return t.proxyA.m_id < e.proxyA.m_id || t.proxyA.m_id === e.proxyA.m_id && t.proxyB.m_id < e.proxyB.m_id;
95561                }
95562                t.b2_toiTime = 0;
95563                t.b2_toiMaxTime = 0;
95564                t.b2_toiCalls = 0;
95565                t.b2_toiIters = 0;
95566                t.b2_toiMaxIters = 0;
95567                t.b2_toiRootIters = 0;
95568                t.b2_toiMaxRootIters = 0;
95569                function Pe() {
95570                  t.b2_toiTime = 0;
95571                  t.b2_toiMaxTime = 0;
95572                  t.b2_toiCalls = 0;
95573                  t.b2_toiIters = 0;
95574                  t.b2_toiMaxIters = 0;
95575                  t.b2_toiRootIters = 0;
95576                  t.b2_toiMaxRootIters = 0;
95577                }
95578                const Oe = new xt;
95579                const Ne = new xt;
95580                const Le = new St;
95581                const Fe = new St;
95582                const Ve = new St;
95583                const ke = new St;
95584                const Ue = new St;
95585                class Ge {
95586                  constructor() {
95587                    this.proxyA = new Nt;
95588                    this.proxyB = new Nt;
95589                    this.sweepA = new wt;
95590                    this.sweepB = new wt;
95591                    this.tMax = 0;
95592                  }
95593                }
95594                !function(t) {
95595                  t[t.e_unknown = 0] = "e_unknown";
95596                  t[t.e_failed = 1] = "e_failed";
95597                  t[t.e_overlapped = 2] = "e_overlapped";
95598                  t[t.e_touching = 3] = "e_touching";
95599                  t[t.e_separated = 4] = "e_separated";
95600                }(t.b2TOIOutputState || (t.b2TOIOutputState = {}));
95601                class ze {
95602                  constructor() {
95603                    this.state = t.b2TOIOutputState.e_unknown;
95604                    this.t = 0;
95605                  }
95606                }
95607                !function(t) {
95608                  t[t.e_unknown = -1] = "e_unknown";
95609                  t[t.e_points = 0] = "e_points";
95610                  t[t.e_faceA = 1] = "e_faceA";
95611                  t[t.e_faceB = 2] = "e_faceB";
95612                }(t.b2SeparationFunctionType || (t.b2SeparationFunctionType = {}));
95613                class He {
95614                  constructor() {
95615                    this.m_sweepA = new wt;
95616                    this.m_sweepB = new wt;
95617                    this.m_type = t.b2SeparationFunctionType.e_unknown;
95618                    this.m_localPoint = new St;
95619                    this.m_axis = new St;
95620                  }
95621                  Initialize(e, i, s, n, r, o) {
95622                    this.m_proxyA = i;
95623                    this.m_proxyB = n;
95624                    const a = e.count;
95625                    this.m_sweepA.Copy(s);
95626                    this.m_sweepB.Copy(r);
95627                    const l = Oe;
95628                    const h = Ne;
95629                    this.m_sweepA.GetTransform(l, o);
95630                    this.m_sweepB.GetTransform(h, o);
95631                    if (1 === a) {
95632                      this.m_type = t.b2SeparationFunctionType.e_points;
95633                      const i = this.m_proxyA.GetVertex(e.indexA[0]);
95634                      const s = this.m_proxyB.GetVertex(e.indexB[0]);
95635                      const n = xt.MulXV(l, i, Le);
95636                      const r = xt.MulXV(h, s, Fe);
95637                      St.SubVV(r, n, this.m_axis);
95638                      const o = this.m_axis.Normalize();
95639                      this.m_localPoint.SetZero();
95640                      return o;
95641                    }
95642                    if (e.indexA[0] === e.indexA[1]) {
95643                      this.m_type = t.b2SeparationFunctionType.e_faceB;
95644                      const i = this.m_proxyB.GetVertex(e.indexB[0]);
95645                      const s = this.m_proxyB.GetVertex(e.indexB[1]);
95646                      St.CrossVOne(St.SubVV(s, i, St.s_t0), this.m_axis).SelfNormalize();
95647                      const n = Ct.MulRV(h.q, this.m_axis, Ve);
95648                      St.MidVV(i, s, this.m_localPoint);
95649                      const r = xt.MulXV(h, this.m_localPoint, Fe);
95650                      const o = this.m_proxyA.GetVertex(e.indexA[0]);
95651                      const a = xt.MulXV(l, o, Le);
95652                      let c = St.DotVV(St.SubVV(a, r, St.s_t0), n);
95653                      if (c < 0) {
95654                        this.m_axis.SelfNeg();
95655                        c = -c;
95656                      }
95657                      return c;
95658                    }
95659                    {
95660                      this.m_type = t.b2SeparationFunctionType.e_faceA;
95661                      const i = this.m_proxyA.GetVertex(e.indexA[0]);
95662                      const s = this.m_proxyA.GetVertex(e.indexA[1]);
95663                      St.CrossVOne(St.SubVV(s, i, St.s_t0), this.m_axis).SelfNormalize();
95664                      const n = Ct.MulRV(l.q, this.m_axis, Ve);
95665                      St.MidVV(i, s, this.m_localPoint);
95666                      const r = xt.MulXV(l, this.m_localPoint, Le);
95667                      const o = this.m_proxyB.GetVertex(e.indexB[0]);
95668                      const a = xt.MulXV(h, o, Fe);
95669                      let c = St.DotVV(St.SubVV(a, r, St.s_t0), n);
95670                      if (c < 0) {
95671                        this.m_axis.SelfNeg();
95672                        c = -c;
95673                      }
95674                      return c;
95675                    }
95676                  }
95677                  FindMinSeparation(e, i, s) {
95678                    const n = Oe;
95679                    const r = Ne;
95680                    this.m_sweepA.GetTransform(n, s);
95681                    this.m_sweepB.GetTransform(r, s);
95682                    switch (this.m_type) {
95683                     case t.b2SeparationFunctionType.e_points:
95684                      {
95685                        const t = Ct.MulTRV(n.q, this.m_axis, ke);
95686                        const s = Ct.MulTRV(r.q, St.NegV(this.m_axis, St.s_t0), Ue);
95687                        e[0] = this.m_proxyA.GetSupport(t);
95688                        i[0] = this.m_proxyB.GetSupport(s);
95689                        const o = this.m_proxyA.GetVertex(e[0]);
95690                        const a = this.m_proxyB.GetVertex(i[0]);
95691                        const l = xt.MulXV(n, o, Le);
95692                        const h = xt.MulXV(r, a, Fe);
95693                        return St.DotVV(St.SubVV(h, l, St.s_t0), this.m_axis);
95694                      }
95695
95696                     case t.b2SeparationFunctionType.e_faceA:
95697                      {
95698                        const t = Ct.MulRV(n.q, this.m_axis, Ve);
95699                        const s = xt.MulXV(n, this.m_localPoint, Le);
95700                        const o = Ct.MulTRV(r.q, St.NegV(t, St.s_t0), Ue);
95701                        e[0] = -1;
95702                        i[0] = this.m_proxyB.GetSupport(o);
95703                        const a = this.m_proxyB.GetVertex(i[0]);
95704                        const l = xt.MulXV(r, a, Fe);
95705                        return St.DotVV(St.SubVV(l, s, St.s_t0), t);
95706                      }
95707
95708                     case t.b2SeparationFunctionType.e_faceB:
95709                      {
95710                        const t = Ct.MulRV(r.q, this.m_axis, Ve);
95711                        const s = xt.MulXV(r, this.m_localPoint, Fe);
95712                        const o = Ct.MulTRV(n.q, St.NegV(t, St.s_t0), ke);
95713                        i[0] = -1;
95714                        e[0] = this.m_proxyA.GetSupport(o);
95715                        const a = this.m_proxyA.GetVertex(e[0]);
95716                        const l = xt.MulXV(n, a, Le);
95717                        return St.DotVV(St.SubVV(l, s, St.s_t0), t);
95718                      }
95719
95720                     default:
95721                      e[0] = -1;
95722                      i[0] = -1;
95723                      return 0;
95724                    }
95725                  }
95726                  Evaluate(e, i, s) {
95727                    const n = Oe;
95728                    const r = Ne;
95729                    this.m_sweepA.GetTransform(n, s);
95730                    this.m_sweepB.GetTransform(r, s);
95731                    switch (this.m_type) {
95732                     case t.b2SeparationFunctionType.e_points:
95733                      {
95734                        const t = this.m_proxyA.GetVertex(e);
95735                        const s = this.m_proxyB.GetVertex(i);
95736                        const o = xt.MulXV(n, t, Le);
95737                        const a = xt.MulXV(r, s, Fe);
95738                        return St.DotVV(St.SubVV(a, o, St.s_t0), this.m_axis);
95739                      }
95740
95741                     case t.b2SeparationFunctionType.e_faceA:
95742                      {
95743                        const t = Ct.MulRV(n.q, this.m_axis, Ve);
95744                        const e = xt.MulXV(n, this.m_localPoint, Le);
95745                        const s = this.m_proxyB.GetVertex(i);
95746                        const o = xt.MulXV(r, s, Fe);
95747                        return St.DotVV(St.SubVV(o, e, St.s_t0), t);
95748                      }
95749
95750                     case t.b2SeparationFunctionType.e_faceB:
95751                      {
95752                        const t = Ct.MulRV(r.q, this.m_axis, Ve);
95753                        const i = xt.MulXV(r, this.m_localPoint, Fe);
95754                        const s = this.m_proxyA.GetVertex(e);
95755                        const o = xt.MulXV(n, s, Le);
95756                        return St.DotVV(St.SubVV(o, i, St.s_t0), t);
95757                      }
95758
95759                     default:
95760                      return 0;
95761                    }
95762                  }
95763                }
95764                const je = new Mt;
95765                const Xe = new Lt;
95766                const We = new Ft;
95767                const Ye = new Vt;
95768                const qe = new He;
95769                const Ke = [ 0 ];
95770                const Je = [ 0 ];
95771                const Ze = new wt;
95772                const Qe = new wt;
95773                function $e(e, i) {
95774                  const s = je.Reset();
95775                  ++t.b2_toiCalls;
95776                  e.state = t.b2TOIOutputState.e_unknown;
95777                  e.t = i.tMax;
95778                  const n = i.proxyA;
95779                  const r = i.proxyB;
95780                  const o = et(l, et(n.m_count, r.m_count));
95781                  const a = Ze.Copy(i.sweepA);
95782                  const h = Qe.Copy(i.sweepB);
95783                  a.Normalize();
95784                  h.Normalize();
95785                  const c = i.tMax;
95786                  const _ = n.m_radius + r.m_radius;
95787                  const d = et(u, _ - 3 * u);
95788                  const p = .25 * u;
95789                  let m = 0;
95790                  const f = 20;
95791                  let g = 0;
95792                  const y = Xe;
95793                  y.count = 0;
95794                  const b = We;
95795                  b.proxyA.Copy(i.proxyA);
95796                  b.proxyB.Copy(i.proxyB);
95797                  b.useRadii = !1;
95798                  for (;;) {
95799                    const i = Oe;
95800                    const s = Ne;
95801                    a.GetTransform(i, m);
95802                    h.GetTransform(s, m);
95803                    b.transformA.Copy(i);
95804                    b.transformB.Copy(s);
95805                    const l = Ye;
95806                    Qt(l, y, b);
95807                    if (l.distance <= 0) {
95808                      e.state = t.b2TOIOutputState.e_overlapped;
95809                      e.t = 0;
95810                      break;
95811                    }
95812                    if (l.distance < d + p) {
95813                      e.state = t.b2TOIOutputState.e_touching;
95814                      e.t = m;
95815                      break;
95816                    }
95817                    const u = qe;
95818                    u.Initialize(y, n, a, r, h, m);
95819                    let _ = !1;
95820                    let S = c;
95821                    let A = 0;
95822                    for (;;) {
95823                      const i = Ke;
95824                      const s = Je;
95825                      let n = u.FindMinSeparation(i, s, S);
95826                      if (n > d + p) {
95827                        e.state = t.b2TOIOutputState.e_separated;
95828                        e.t = c;
95829                        _ = !0;
95830                        break;
95831                      }
95832                      if (n > d - p) {
95833                        m = S;
95834                        break;
95835                      }
95836                      let r = u.Evaluate(i[0], s[0], m);
95837                      if (r < d - p) {
95838                        e.state = t.b2TOIOutputState.e_failed;
95839                        e.t = m;
95840                        _ = !0;
95841                        break;
95842                      }
95843                      if (r <= d + p) {
95844                        e.state = t.b2TOIOutputState.e_touching;
95845                        e.t = m;
95846                        _ = !0;
95847                        break;
95848                      }
95849                      let a = 0;
95850                      let l = m;
95851                      let h = S;
95852                      for (;;) {
95853                        let e = 0;
95854                        e = 1 & a ? l + (d - r) * (h - l) / (n - r) : .5 * (l + h);
95855                        ++a;
95856                        ++t.b2_toiRootIters;
95857                        const o = u.Evaluate(i[0], s[0], e);
95858                        if ($(o - d) < p) {
95859                          S = e;
95860                          break;
95861                        }
95862                        if (o > d) {
95863                          l = e;
95864                          r = o;
95865                        } else {
95866                          h = e;
95867                          n = o;
95868                        }
95869                        if (50 === a) break;
95870                      }
95871                      t.b2_toiMaxRootIters = et(t.b2_toiMaxRootIters, a);
95872                      ++A;
95873                      if (A === o) break;
95874                    }
95875                    ++g;
95876                    ++t.b2_toiIters;
95877                    if (_) break;
95878                    if (g === f) {
95879                      e.state = t.b2TOIOutputState.e_failed;
95880                      e.t = m;
95881                      break;
95882                    }
95883                  }
95884                  t.b2_toiMaxIters = et(t.b2_toiMaxIters, g);
95885                  const S = s.GetMilliseconds();
95886                  t.b2_toiMaxTime = et(t.b2_toiMaxTime, S);
95887                  t.b2_toiTime += S;
95888                }
95889                const ti = new St;
95890                const ei = new St;
95891                function ii(e, i, s, n, r) {
95892                  e.pointCount = 0;
95893                  const o = xt.MulXV(s, i.m_p, ti);
95894                  const a = xt.MulXV(r, n.m_p, ei);
95895                  const l = St.DistanceSquaredVV(o, a);
95896                  const h = i.m_radius + n.m_radius;
95897                  if (!(l > h * h)) {
95898                    e.type = t.b2ManifoldType.e_circles;
95899                    e.localPoint.Copy(i.m_p);
95900                    e.localNormal.SetZero();
95901                    e.pointCount = 1;
95902                    e.points[0].localPoint.Copy(n.m_p);
95903                    e.points[0].id.key = 0;
95904                  }
95905                }
95906                const si = new St;
95907                const ni = new St;
95908                const ri = new St;
95909                function oi(e, i, r, o, a) {
95910                  e.pointCount = 0;
95911                  const l = xt.MulXV(a, o.m_p, si);
95912                  const h = xt.MulTXV(r, l, ni);
95913                  let c = 0;
95914                  let u = -s;
95915                  const _ = i.m_radius + o.m_radius;
95916                  const d = i.m_count;
95917                  const p = i.m_vertices;
95918                  const m = i.m_normals;
95919                  for (let t = 0; t < d; ++t) {
95920                    const e = St.DotVV(m[t], St.SubVV(h, p[t], St.s_t0));
95921                    if (e > _) return;
95922                    if (e > u) {
95923                      u = e;
95924                      c = t;
95925                    }
95926                  }
95927                  const f = c;
95928                  const g = (f + 1) % d;
95929                  const y = p[f];
95930                  const b = p[g];
95931                  if (u < n) {
95932                    e.pointCount = 1;
95933                    e.type = t.b2ManifoldType.e_faceA;
95934                    e.localNormal.Copy(m[c]);
95935                    St.MidVV(y, b, e.localPoint);
95936                    e.points[0].localPoint.Copy(o.m_p);
95937                    e.points[0].id.key = 0;
95938                    return;
95939                  }
95940                  const S = St.DotVV(St.SubVV(h, y, St.s_t0), St.SubVV(b, y, St.s_t1));
95941                  const A = St.DotVV(St.SubVV(h, b, St.s_t0), St.SubVV(y, b, St.s_t1));
95942                  if (S <= 0) {
95943                    if (St.DistanceSquaredVV(h, y) > _ * _) return;
95944                    e.pointCount = 1;
95945                    e.type = t.b2ManifoldType.e_faceA;
95946                    St.SubVV(h, y, e.localNormal).SelfNormalize();
95947                    e.localPoint.Copy(y);
95948                    e.points[0].localPoint.Copy(o.m_p);
95949                    e.points[0].id.key = 0;
95950                  } else if (A <= 0) {
95951                    if (St.DistanceSquaredVV(h, b) > _ * _) return;
95952                    e.pointCount = 1;
95953                    e.type = t.b2ManifoldType.e_faceA;
95954                    St.SubVV(h, b, e.localNormal).SelfNormalize();
95955                    e.localPoint.Copy(b);
95956                    e.points[0].localPoint.Copy(o.m_p);
95957                    e.points[0].id.key = 0;
95958                  } else {
95959                    const i = St.MidVV(y, b, ri);
95960                    if (St.DotVV(St.SubVV(h, i, St.s_t1), m[f]) > _) return;
95961                    e.pointCount = 1;
95962                    e.type = t.b2ManifoldType.e_faceA;
95963                    e.localNormal.Copy(m[f]).SelfNormalize();
95964                    e.localPoint.Copy(i);
95965                    e.points[0].localPoint.Copy(o.m_p);
95966                    e.points[0].id.key = 0;
95967                  }
95968                }
95969                const ai = new St;
95970                const li = new St;
95971                const hi = new St;
95972                const ci = new St;
95973                function ui(t, e, i, n, r) {
95974                  const o = t.m_vertices;
95975                  const a = t.m_normals;
95976                  const l = n.m_count;
95977                  const h = n.m_vertices;
95978                  const c = Ct.MulRV(e.q, a[i], ai);
95979                  const u = Ct.MulTRV(r.q, c, li);
95980                  let _ = 0;
95981                  let d = s;
95982                  for (let t = 0; t < l; ++t) {
95983                    const e = St.DotVV(h[t], u);
95984                    if (e < d) {
95985                      d = e;
95986                      _ = t;
95987                    }
95988                  }
95989                  const p = xt.MulXV(e, o[i], hi);
95990                  const m = xt.MulXV(r, h[_], ci);
95991                  return St.DotVV(St.SubVV(m, p, St.s_t0), c);
95992                }
95993                const _i = new St;
95994                const di = new St;
95995                function pi(t, e, i, n, r) {
95996                  const o = e.m_count;
95997                  const a = e.m_normals;
95998                  const l = St.SubVV(xt.MulXV(r, n.m_centroid, St.s_t0), xt.MulXV(i, e.m_centroid, St.s_t1), _i);
95999                  const h = Ct.MulTRV(i.q, l, di);
96000                  let c = 0;
96001                  let u = -s;
96002                  for (let t = 0; t < o; ++t) {
96003                    const e = St.DotVV(a[t], h);
96004                    if (e > u) {
96005                      u = e;
96006                      c = t;
96007                    }
96008                  }
96009                  let _ = ui(e, i, c, n, r);
96010                  const d = (c + o - 1) % o;
96011                  const p = ui(e, i, d, n, r);
96012                  const m = (c + 1) % o;
96013                  const f = ui(e, i, m, n, r);
96014                  let g = 0;
96015                  let y = 0;
96016                  let b = 0;
96017                  if (p > _ && p > f) {
96018                    b = -1;
96019                    g = d;
96020                    y = p;
96021                  } else {
96022                    if (!(f > _)) {
96023                      t[0] = c;
96024                      return _;
96025                    }
96026                    b = 1;
96027                    g = m;
96028                    y = f;
96029                  }
96030                  for (;;) {
96031                    c = -1 === b ? (g + o - 1) % o : (g + 1) % o;
96032                    _ = ui(e, i, c, n, r);
96033                    if (!(_ > y)) break;
96034                    g = c;
96035                    y = _;
96036                  }
96037                  t[0] = g;
96038                  return y;
96039                }
96040                const mi = new St;
96041                function fi(e, i, n, r, o, a) {
96042                  const l = i.m_normals;
96043                  const h = o.m_count;
96044                  const c = o.m_vertices;
96045                  const u = o.m_normals;
96046                  const _ = Ct.MulTRV(a.q, Ct.MulRV(n.q, l[r], St.s_t0), mi);
96047                  let d = 0;
96048                  let p = s;
96049                  for (let t = 0; t < h; ++t) {
96050                    const e = St.DotVV(_, u[t]);
96051                    if (e < p) {
96052                      p = e;
96053                      d = t;
96054                    }
96055                  }
96056                  const m = d;
96057                  const f = (m + 1) % h;
96058                  const g = e[0];
96059                  xt.MulXV(a, c[m], g.v);
96060                  const y = g.id.cf;
96061                  y.indexA = r;
96062                  y.indexB = m;
96063                  y.typeA = t.b2ContactFeatureType.e_face;
96064                  y.typeB = t.b2ContactFeatureType.e_vertex;
96065                  const b = e[1];
96066                  xt.MulXV(a, c[f], b.v);
96067                  const S = b.id.cf;
96068                  S.indexA = r;
96069                  S.indexB = f;
96070                  S.typeA = t.b2ContactFeatureType.e_face;
96071                  S.typeB = t.b2ContactFeatureType.e_vertex;
96072                }
96073                const gi = pe.MakeArray(2);
96074                const yi = pe.MakeArray(2);
96075                const bi = pe.MakeArray(2);
96076                const Si = [ 0 ];
96077                const Ai = [ 0 ];
96078                const Ti = new St;
96079                const vi = new St;
96080                const Ei = new St;
96081                const Ci = new St;
96082                const xi = new St;
96083                const wi = new St;
96084                const Ri = new St;
96085                const Ii = new St;
96086                function Mi(e, i, s, n, r) {
96087                  e.pointCount = 0;
96088                  const o = i.m_radius + n.m_radius;
96089                  const l = Si;
96090                  l[0] = 0;
96091                  const h = pi(l, i, s, n, r);
96092                  if (h > o) return;
96093                  const c = Ai;
96094                  c[0] = 0;
96095                  const u = pi(c, n, r, i, s);
96096                  if (u > o) return;
96097                  let _;
96098                  let d;
96099                  let p, m;
96100                  let f = 0;
96101                  let g = 0;
96102                  if (u > .98 * h + .001) {
96103                    _ = n;
96104                    d = i;
96105                    p = r;
96106                    m = s;
96107                    f = c[0];
96108                    e.type = t.b2ManifoldType.e_faceB;
96109                    g = 1;
96110                  } else {
96111                    _ = i;
96112                    d = n;
96113                    p = s;
96114                    m = r;
96115                    f = l[0];
96116                    e.type = t.b2ManifoldType.e_faceA;
96117                    g = 0;
96118                  }
96119                  const y = gi;
96120                  fi(y, _, p, f, d, m);
96121                  const b = _.m_count;
96122                  const S = _.m_vertices;
96123                  const A = f;
96124                  const T = (f + 1) % b;
96125                  const v = S[A];
96126                  const E = S[T];
96127                  const C = St.SubVV(E, v, Ti);
96128                  C.Normalize();
96129                  const x = St.CrossVOne(C, vi);
96130                  const w = St.MidVV(v, E, Ei);
96131                  const R = Ct.MulRV(p.q, C, xi);
96132                  const I = St.CrossVOne(R, Ci);
96133                  const M = xt.MulXV(p, v, Ri);
96134                  const B = xt.MulXV(p, E, Ii);
96135                  const D = St.DotVV(I, M);
96136                  const P = -St.DotVV(R, M) + o;
96137                  const O = St.DotVV(R, B) + o;
96138                  const N = yi;
96139                  const L = bi;
96140                  let F;
96141                  F = be(N, y, St.NegV(R, wi), P, A);
96142                  if (F < 2) return;
96143                  F = be(L, N, R, O, T);
96144                  if (F < 2) return;
96145                  e.localNormal.Copy(x);
96146                  e.localPoint.Copy(w);
96147                  let V = 0;
96148                  for (let t = 0; t < a; ++t) {
96149                    const i = L[t];
96150                    if (St.DotVV(I, i.v) - D <= o) {
96151                      const t = e.points[V];
96152                      xt.MulTXV(m, i.v, t.localPoint);
96153                      t.id.Copy(i.id);
96154                      if (g) {
96155                        const e = t.id.cf;
96156                        t.id.cf.indexA = e.indexB;
96157                        t.id.cf.indexB = e.indexA;
96158                        t.id.cf.typeA = e.typeB;
96159                        t.id.cf.typeB = e.typeA;
96160                      }
96161                      ++V;
96162                    }
96163                  }
96164                  e.pointCount = V;
96165                }
96166                const Bi = new St;
96167                const Di = new St;
96168                const Pi = new St;
96169                const Oi = new St;
96170                const Ni = new St;
96171                const Li = new St;
96172                const Fi = new St;
96173                const Vi = new he;
96174                function ki(e, i, s, n, r) {
96175                  e.pointCount = 0;
96176                  const o = xt.MulTXV(s, xt.MulXV(r, n.m_p, St.s_t0), Bi);
96177                  const a = i.m_vertex1;
96178                  const l = i.m_vertex2;
96179                  const h = St.SubVV(l, a, Di);
96180                  const c = St.DotVV(h, St.SubVV(l, o, St.s_t0));
96181                  const u = St.DotVV(h, St.SubVV(o, a, St.s_t0));
96182                  const _ = i.m_radius + n.m_radius;
96183                  const d = Vi;
96184                  d.cf.indexB = 0;
96185                  d.cf.typeB = t.b2ContactFeatureType.e_vertex;
96186                  if (u <= 0) {
96187                    const s = a;
96188                    const r = St.SubVV(o, s, Pi);
96189                    if (St.DotVV(r, r) > _ * _) return;
96190                    if (i.m_hasVertex0) {
96191                      const t = i.m_vertex0;
96192                      const e = a;
96193                      const s = St.SubVV(e, t, Oi);
96194                      if (St.DotVV(s, St.SubVV(e, o, St.s_t0)) > 0) return;
96195                    }
96196                    d.cf.indexA = 0;
96197                    d.cf.typeA = t.b2ContactFeatureType.e_vertex;
96198                    e.pointCount = 1;
96199                    e.type = t.b2ManifoldType.e_circles;
96200                    e.localNormal.SetZero();
96201                    e.localPoint.Copy(s);
96202                    e.points[0].id.Copy(d);
96203                    e.points[0].localPoint.Copy(n.m_p);
96204                    return;
96205                  }
96206                  if (c <= 0) {
96207                    const s = l;
96208                    const r = St.SubVV(o, s, Pi);
96209                    if (St.DotVV(r, r) > _ * _) return;
96210                    if (i.m_hasVertex3) {
96211                      const t = i.m_vertex3;
96212                      const e = l;
96213                      const s = St.SubVV(t, e, Ni);
96214                      if (St.DotVV(s, St.SubVV(o, e, St.s_t0)) > 0) return;
96215                    }
96216                    d.cf.indexA = 1;
96217                    d.cf.typeA = t.b2ContactFeatureType.e_vertex;
96218                    e.pointCount = 1;
96219                    e.type = t.b2ManifoldType.e_circles;
96220                    e.localNormal.SetZero();
96221                    e.localPoint.Copy(s);
96222                    e.points[0].id.Copy(d);
96223                    e.points[0].localPoint.Copy(n.m_p);
96224                    return;
96225                  }
96226                  const p = St.DotVV(h, h);
96227                  const m = Li;
96228                  m.x = 1 / p * (c * a.x + u * l.x);
96229                  m.y = 1 / p * (c * a.y + u * l.y);
96230                  const f = St.SubVV(o, m, Pi);
96231                  if (St.DotVV(f, f) > _ * _) return;
96232                  const g = Fi.Set(-h.y, h.x);
96233                  St.DotVV(g, St.SubVV(o, a, St.s_t0)) < 0 && g.Set(-g.x, -g.y);
96234                  g.Normalize();
96235                  d.cf.indexA = 0;
96236                  d.cf.typeA = t.b2ContactFeatureType.e_face;
96237                  e.pointCount = 1;
96238                  e.type = t.b2ManifoldType.e_faceA;
96239                  e.localNormal.Copy(g);
96240                  e.localPoint.Copy(a);
96241                  e.points[0].id.Copy(d);
96242                  e.points[0].localPoint.Copy(n.m_p);
96243                }
96244                var Ui;
96245                !function(t) {
96246                  t[t.e_unknown = 0] = "e_unknown";
96247                  t[t.e_edgeA = 1] = "e_edgeA";
96248                  t[t.e_edgeB = 2] = "e_edgeB";
96249                }(Ui || (Ui = {}));
96250                class Gi {
96251                  constructor() {
96252                    this.type = Ui.e_unknown;
96253                    this.index = 0;
96254                    this.separation = 0;
96255                  }
96256                }
96257                class zi {
96258                  constructor() {
96259                    this.vertices = [];
96260                    this.normals = [];
96261                    this.count = 0;
96262                  }
96263                }
96264                class Hi {
96265                  constructor() {
96266                    this.i1 = 0;
96267                    this.i2 = 0;
96268                    this.v1 = new St;
96269                    this.v2 = new St;
96270                    this.normal = new St;
96271                    this.sideNormal1 = new St;
96272                    this.sideOffset1 = 0;
96273                    this.sideNormal2 = new St;
96274                    this.sideOffset2 = 0;
96275                  }
96276                }
96277                var ji;
96278                !function(t) {
96279                  t[t.e_isolated = 0] = "e_isolated";
96280                  t[t.e_concave = 1] = "e_concave";
96281                  t[t.e_convex = 2] = "e_convex";
96282                }(ji || (ji = {}));
96283                class Xi {
96284                  constructor() {
96285                    this.m_polygonB = new zi;
96286                    this.m_xf = new xt;
96287                    this.m_centroidB = new St;
96288                    this.m_v0 = new St;
96289                    this.m_v1 = new St;
96290                    this.m_v2 = new St;
96291                    this.m_v3 = new St;
96292                    this.m_normal0 = new St;
96293                    this.m_normal1 = new St;
96294                    this.m_normal2 = new St;
96295                    this.m_normal = new St;
96296                    this.m_type1 = ji.e_isolated;
96297                    this.m_type2 = ji.e_isolated;
96298                    this.m_lowerLimit = new St;
96299                    this.m_upperLimit = new St;
96300                    this.m_radius = 0;
96301                    this.m_front = !1;
96302                  }
96303                  Collide(e, i, s, n, r) {
96304                    xt.MulTXX(s, r, this.m_xf);
96305                    xt.MulXV(this.m_xf, n.m_centroid, this.m_centroidB);
96306                    this.m_v0.Copy(i.m_vertex0);
96307                    this.m_v1.Copy(i.m_vertex1);
96308                    this.m_v2.Copy(i.m_vertex2);
96309                    this.m_v3.Copy(i.m_vertex3);
96310                    const o = i.m_hasVertex0;
96311                    const l = i.m_hasVertex3;
96312                    const h = St.SubVV(this.m_v2, this.m_v1, Xi.s_edge1);
96313                    h.Normalize();
96314                    this.m_normal1.Set(h.y, -h.x);
96315                    const c = St.DotVV(this.m_normal1, St.SubVV(this.m_centroidB, this.m_v1, St.s_t0));
96316                    let u = 0;
96317                    let _ = 0;
96318                    let d = !1;
96319                    let p = !1;
96320                    if (o) {
96321                      const t = St.SubVV(this.m_v1, this.m_v0, Xi.s_edge0);
96322                      t.Normalize();
96323                      this.m_normal0.Set(t.y, -t.x);
96324                      d = St.CrossVV(t, h) >= 0;
96325                      u = St.DotVV(this.m_normal0, St.SubVV(this.m_centroidB, this.m_v0, St.s_t0));
96326                    }
96327                    if (l) {
96328                      const t = St.SubVV(this.m_v3, this.m_v2, Xi.s_edge2);
96329                      t.Normalize();
96330                      this.m_normal2.Set(t.y, -t.x);
96331                      p = St.CrossVV(h, t) > 0;
96332                      _ = St.DotVV(this.m_normal2, St.SubVV(this.m_centroidB, this.m_v2, St.s_t0));
96333                    }
96334                    if (o && l) if (d && p) {
96335                      this.m_front = u >= 0 || c >= 0 || _ >= 0;
96336                      if (this.m_front) {
96337                        this.m_normal.Copy(this.m_normal1);
96338                        this.m_lowerLimit.Copy(this.m_normal0);
96339                        this.m_upperLimit.Copy(this.m_normal2);
96340                      } else {
96341                        this.m_normal.Copy(this.m_normal1).SelfNeg();
96342                        this.m_lowerLimit.Copy(this.m_normal1).SelfNeg();
96343                        this.m_upperLimit.Copy(this.m_normal1).SelfNeg();
96344                      }
96345                    } else if (d) {
96346                      this.m_front = u >= 0 || c >= 0 && _ >= 0;
96347                      if (this.m_front) {
96348                        this.m_normal.Copy(this.m_normal1);
96349                        this.m_lowerLimit.Copy(this.m_normal0);
96350                        this.m_upperLimit.Copy(this.m_normal1);
96351                      } else {
96352                        this.m_normal.Copy(this.m_normal1).SelfNeg();
96353                        this.m_lowerLimit.Copy(this.m_normal2).SelfNeg();
96354                        this.m_upperLimit.Copy(this.m_normal1).SelfNeg();
96355                      }
96356                    } else if (p) {
96357                      this.m_front = _ >= 0 || u >= 0 && c >= 0;
96358                      if (this.m_front) {
96359                        this.m_normal.Copy(this.m_normal1);
96360                        this.m_lowerLimit.Copy(this.m_normal1);
96361                        this.m_upperLimit.Copy(this.m_normal2);
96362                      } else {
96363                        this.m_normal.Copy(this.m_normal1).SelfNeg();
96364                        this.m_lowerLimit.Copy(this.m_normal1).SelfNeg();
96365                        this.m_upperLimit.Copy(this.m_normal0).SelfNeg();
96366                      }
96367                    } else {
96368                      this.m_front = u >= 0 && c >= 0 && _ >= 0;
96369                      if (this.m_front) {
96370                        this.m_normal.Copy(this.m_normal1);
96371                        this.m_lowerLimit.Copy(this.m_normal1);
96372                        this.m_upperLimit.Copy(this.m_normal1);
96373                      } else {
96374                        this.m_normal.Copy(this.m_normal1).SelfNeg();
96375                        this.m_lowerLimit.Copy(this.m_normal2).SelfNeg();
96376                        this.m_upperLimit.Copy(this.m_normal0).SelfNeg();
96377                      }
96378                    } else if (o) if (d) {
96379                      this.m_front = u >= 0 || c >= 0;
96380                      if (this.m_front) {
96381                        this.m_normal.Copy(this.m_normal1);
96382                        this.m_lowerLimit.Copy(this.m_normal0);
96383                        this.m_upperLimit.Copy(this.m_normal1).SelfNeg();
96384                      } else {
96385                        this.m_normal.Copy(this.m_normal1).SelfNeg();
96386                        this.m_lowerLimit.Copy(this.m_normal1);
96387                        this.m_upperLimit.Copy(this.m_normal1).SelfNeg();
96388                      }
96389                    } else {
96390                      this.m_front = u >= 0 && c >= 0;
96391                      if (this.m_front) {
96392                        this.m_normal.Copy(this.m_normal1);
96393                        this.m_lowerLimit.Copy(this.m_normal1);
96394                        this.m_upperLimit.Copy(this.m_normal1).SelfNeg();
96395                      } else {
96396                        this.m_normal.Copy(this.m_normal1).SelfNeg();
96397                        this.m_lowerLimit.Copy(this.m_normal1);
96398                        this.m_upperLimit.Copy(this.m_normal0).SelfNeg();
96399                      }
96400                    } else if (l) if (p) {
96401                      this.m_front = c >= 0 || _ >= 0;
96402                      if (this.m_front) {
96403                        this.m_normal.Copy(this.m_normal1);
96404                        this.m_lowerLimit.Copy(this.m_normal1).SelfNeg();
96405                        this.m_upperLimit.Copy(this.m_normal2);
96406                      } else {
96407                        this.m_normal.Copy(this.m_normal1).SelfNeg();
96408                        this.m_lowerLimit.Copy(this.m_normal1).SelfNeg();
96409                        this.m_upperLimit.Copy(this.m_normal1);
96410                      }
96411                    } else {
96412                      this.m_front = c >= 0 && _ >= 0;
96413                      if (this.m_front) {
96414                        this.m_normal.Copy(this.m_normal1);
96415                        this.m_lowerLimit.Copy(this.m_normal1).SelfNeg();
96416                        this.m_upperLimit.Copy(this.m_normal1);
96417                      } else {
96418                        this.m_normal.Copy(this.m_normal1).SelfNeg();
96419                        this.m_lowerLimit.Copy(this.m_normal2).SelfNeg();
96420                        this.m_upperLimit.Copy(this.m_normal1);
96421                      }
96422                    } else {
96423                      this.m_front = c >= 0;
96424                      if (this.m_front) {
96425                        this.m_normal.Copy(this.m_normal1);
96426                        this.m_lowerLimit.Copy(this.m_normal1).SelfNeg();
96427                        this.m_upperLimit.Copy(this.m_normal1).SelfNeg();
96428                      } else {
96429                        this.m_normal.Copy(this.m_normal1).SelfNeg();
96430                        this.m_lowerLimit.Copy(this.m_normal1);
96431                        this.m_upperLimit.Copy(this.m_normal1);
96432                      }
96433                    }
96434                    this.m_polygonB.count = n.m_count;
96435                    for (let t = 0; t < n.m_count; ++t) {
96436                      this.m_polygonB.vertices.length <= t && this.m_polygonB.vertices.push(new St);
96437                      this.m_polygonB.normals.length <= t && this.m_polygonB.normals.push(new St);
96438                      xt.MulXV(this.m_xf, n.m_vertices[t], this.m_polygonB.vertices[t]);
96439                      Ct.MulRV(this.m_xf.q, n.m_normals[t], this.m_polygonB.normals[t]);
96440                    }
96441                    this.m_radius = n.m_radius + i.m_radius;
96442                    e.pointCount = 0;
96443                    const m = this.ComputeEdgeSeparation(Xi.s_edgeAxis);
96444                    if (m.type === Ui.e_unknown) return;
96445                    if (m.separation > this.m_radius) return;
96446                    const f = this.ComputePolygonSeparation(Xi.s_polygonAxis);
96447                    if (f.type !== Ui.e_unknown && f.separation > this.m_radius) return;
96448                    const g = .98;
96449                    const y = .001;
96450                    let b;
96451                    b = f.type === Ui.e_unknown ? m : f.separation > g * m.separation + y ? f : m;
96452                    const S = Xi.s_ie;
96453                    const A = Xi.s_rf;
96454                    if (b.type === Ui.e_edgeA) {
96455                      e.type = t.b2ManifoldType.e_faceA;
96456                      let i = 0;
96457                      let s = St.DotVV(this.m_normal, this.m_polygonB.normals[0]);
96458                      for (let t = 1; t < this.m_polygonB.count; ++t) {
96459                        const e = St.DotVV(this.m_normal, this.m_polygonB.normals[t]);
96460                        if (e < s) {
96461                          s = e;
96462                          i = t;
96463                        }
96464                      }
96465                      const n = i;
96466                      const r = (n + 1) % this.m_polygonB.count;
96467                      const o = S[0];
96468                      o.v.Copy(this.m_polygonB.vertices[n]);
96469                      o.id.cf.indexA = 0;
96470                      o.id.cf.indexB = n;
96471                      o.id.cf.typeA = t.b2ContactFeatureType.e_face;
96472                      o.id.cf.typeB = t.b2ContactFeatureType.e_vertex;
96473                      const a = S[1];
96474                      a.v.Copy(this.m_polygonB.vertices[r]);
96475                      a.id.cf.indexA = 0;
96476                      a.id.cf.indexB = r;
96477                      a.id.cf.typeA = t.b2ContactFeatureType.e_face;
96478                      a.id.cf.typeB = t.b2ContactFeatureType.e_vertex;
96479                      if (this.m_front) {
96480                        A.i1 = 0;
96481                        A.i2 = 1;
96482                        A.v1.Copy(this.m_v1);
96483                        A.v2.Copy(this.m_v2);
96484                        A.normal.Copy(this.m_normal1);
96485                      } else {
96486                        A.i1 = 1;
96487                        A.i2 = 0;
96488                        A.v1.Copy(this.m_v2);
96489                        A.v2.Copy(this.m_v1);
96490                        A.normal.Copy(this.m_normal1).SelfNeg();
96491                      }
96492                    } else {
96493                      e.type = t.b2ManifoldType.e_faceB;
96494                      const i = S[0];
96495                      i.v.Copy(this.m_v1);
96496                      i.id.cf.indexA = 0;
96497                      i.id.cf.indexB = b.index;
96498                      i.id.cf.typeA = t.b2ContactFeatureType.e_vertex;
96499                      i.id.cf.typeB = t.b2ContactFeatureType.e_face;
96500                      const s = S[1];
96501                      s.v.Copy(this.m_v2);
96502                      s.id.cf.indexA = 0;
96503                      s.id.cf.indexB = b.index;
96504                      s.id.cf.typeA = t.b2ContactFeatureType.e_vertex;
96505                      s.id.cf.typeB = t.b2ContactFeatureType.e_face;
96506                      A.i1 = b.index;
96507                      A.i2 = (A.i1 + 1) % this.m_polygonB.count;
96508                      A.v1.Copy(this.m_polygonB.vertices[A.i1]);
96509                      A.v2.Copy(this.m_polygonB.vertices[A.i2]);
96510                      A.normal.Copy(this.m_polygonB.normals[A.i1]);
96511                    }
96512                    A.sideNormal1.Set(A.normal.y, -A.normal.x);
96513                    A.sideNormal2.Copy(A.sideNormal1).SelfNeg();
96514                    A.sideOffset1 = St.DotVV(A.sideNormal1, A.v1);
96515                    A.sideOffset2 = St.DotVV(A.sideNormal2, A.v2);
96516                    const T = Xi.s_clipPoints1;
96517                    const v = Xi.s_clipPoints2;
96518                    let E = 0;
96519                    E = be(T, S, A.sideNormal1, A.sideOffset1, A.i1);
96520                    if (E < a) return;
96521                    E = be(v, T, A.sideNormal2, A.sideOffset2, A.i2);
96522                    if (E < a) return;
96523                    if (b.type === Ui.e_edgeA) {
96524                      e.localNormal.Copy(A.normal);
96525                      e.localPoint.Copy(A.v1);
96526                    } else {
96527                      e.localNormal.Copy(n.m_normals[A.i1]);
96528                      e.localPoint.Copy(n.m_vertices[A.i1]);
96529                    }
96530                    let C = 0;
96531                    for (let t = 0; t < a; ++t) {
96532                      let i;
96533                      i = St.DotVV(A.normal, St.SubVV(v[t].v, A.v1, St.s_t0));
96534                      if (i <= this.m_radius) {
96535                        const i = e.points[C];
96536                        if (b.type === Ui.e_edgeA) {
96537                          xt.MulTXV(this.m_xf, v[t].v, i.localPoint);
96538                          i.id.Copy(v[t].id);
96539                        } else {
96540                          i.localPoint.Copy(v[t].v);
96541                          i.id.cf.typeA = v[t].id.cf.typeB;
96542                          i.id.cf.typeB = v[t].id.cf.typeA;
96543                          i.id.cf.indexA = v[t].id.cf.indexB;
96544                          i.id.cf.indexB = v[t].id.cf.indexA;
96545                        }
96546                        ++C;
96547                      }
96548                    }
96549                    e.pointCount = C;
96550                  }
96551                  ComputeEdgeSeparation(t) {
96552                    const e = t;
96553                    e.type = Ui.e_edgeA;
96554                    e.index = this.m_front ? 0 : 1;
96555                    e.separation = s;
96556                    for (let t = 0; t < this.m_polygonB.count; ++t) {
96557                      const i = St.DotVV(this.m_normal, St.SubVV(this.m_polygonB.vertices[t], this.m_v1, St.s_t0));
96558                      i < e.separation && (e.separation = i);
96559                    }
96560                    return e;
96561                  }
96562                  ComputePolygonSeparation(t) {
96563                    const e = t;
96564                    e.type = Ui.e_unknown;
96565                    e.index = -1;
96566                    e.separation = -s;
96567                    const i = Xi.s_perp.Set(-this.m_normal.y, this.m_normal.x);
96568                    for (let t = 0; t < this.m_polygonB.count; ++t) {
96569                      const s = St.NegV(this.m_polygonB.normals[t], Xi.s_n);
96570                      const n = tt(St.DotVV(s, St.SubVV(this.m_polygonB.vertices[t], this.m_v1, St.s_t0)), St.DotVV(s, St.SubVV(this.m_polygonB.vertices[t], this.m_v2, St.s_t0)));
96571                      if (n > this.m_radius) {
96572                        e.type = Ui.e_edgeB;
96573                        e.index = t;
96574                        e.separation = n;
96575                        return e;
96576                      }
96577                      if (St.DotVV(s, i) >= 0) {
96578                        if (St.DotVV(St.SubVV(s, this.m_upperLimit, St.s_t0), this.m_normal) < -_) continue;
96579                      } else if (St.DotVV(St.SubVV(s, this.m_lowerLimit, St.s_t0), this.m_normal) < -_) continue;
96580                      if (n > e.separation) {
96581                        e.type = Ui.e_edgeB;
96582                        e.index = t;
96583                        e.separation = n;
96584                      }
96585                    }
96586                    return e;
96587                  }
96588                }
96589                Xi.s_edge1 = new St;
96590                Xi.s_edge0 = new St;
96591                Xi.s_edge2 = new St;
96592                Xi.s_ie = pe.MakeArray(2);
96593                Xi.s_rf = new Hi;
96594                Xi.s_clipPoints1 = pe.MakeArray(2);
96595                Xi.s_clipPoints2 = pe.MakeArray(2);
96596                Xi.s_edgeAxis = new Gi;
96597                Xi.s_polygonAxis = new Gi;
96598                Xi.s_n = new St;
96599                Xi.s_perp = new St;
96600                const Wi = new Xi;
96601                function Yi(t, e, i, s, n) {
96602                  Wi.Collide(t, e, i, s, n);
96603                }
96604                class qi {
96605                  constructor() {
96606                    this.mass = 0;
96607                    this.center = new St(0, 0);
96608                    this.I = 0;
96609                  }
96610                }
96611                !function(t) {
96612                  t[t.e_unknown = -1] = "e_unknown";
96613                  t[t.e_circleShape = 0] = "e_circleShape";
96614                  t[t.e_edgeShape = 1] = "e_edgeShape";
96615                  t[t.e_polygonShape = 2] = "e_polygonShape";
96616                  t[t.e_chainShape = 3] = "e_chainShape";
96617                  t[t.e_shapeTypeCount = 4] = "e_shapeTypeCount";
96618                }(t.b2ShapeType || (t.b2ShapeType = {}));
96619                class Ki {
96620                  constructor(e, i) {
96621                    this.m_type = t.b2ShapeType.e_unknown;
96622                    this.m_radius = 0;
96623                    this.m_type = e;
96624                    this.m_radius = i;
96625                  }
96626                  Copy(t) {
96627                    this.m_radius = t.m_radius;
96628                    return this;
96629                  }
96630                  GetType() {
96631                    return this.m_type;
96632                  }
96633                }
96634                class Ji extends Ki {
96635                  constructor(e = 0) {
96636                    super(t.b2ShapeType.e_circleShape, e);
96637                    this.m_p = new St;
96638                  }
96639                  Set(t, e = this.m_radius) {
96640                    this.m_p.Copy(t);
96641                    this.m_radius = e;
96642                    return this;
96643                  }
96644                  Clone() {
96645                    return (new Ji).Copy(this);
96646                  }
96647                  Copy(t) {
96648                    super.Copy(t);
96649                    this.m_p.Copy(t.m_p);
96650                    return this;
96651                  }
96652                  GetChildCount() {
96653                    return 1;
96654                  }
96655                  TestPoint(t, e) {
96656                    const i = xt.MulXV(t, this.m_p, Ji.TestPoint_s_center);
96657                    const s = St.SubVV(e, i, Ji.TestPoint_s_d);
96658                    return St.DotVV(s, s) <= rt(this.m_radius);
96659                  }
96660                  ComputeDistance(t, e, i, s) {
96661                    const n = xt.MulXV(t, this.m_p, Ji.ComputeDistance_s_center);
96662                    St.SubVV(e, n, i);
96663                    return i.Normalize() - this.m_radius;
96664                  }
96665                  RayCast(t, e, i, s) {
96666                    const r = xt.MulXV(i, this.m_p, Ji.RayCast_s_position);
96667                    const o = St.SubVV(e.p1, r, Ji.RayCast_s_s);
96668                    const a = St.DotVV(o, o) - rt(this.m_radius);
96669                    const l = St.SubVV(e.p2, e.p1, Ji.RayCast_s_r);
96670                    const h = St.DotVV(o, l);
96671                    const c = St.DotVV(l, l);
96672                    const u = h * h - c * a;
96673                    if (u < 0 || c < n) return !1;
96674                    let _ = -(h + at(u));
96675                    if (0 <= _ && _ <= e.maxFraction * c) {
96676                      _ /= c;
96677                      t.fraction = _;
96678                      St.AddVMulSV(o, _, l, t.normal).SelfNormalize();
96679                      return !0;
96680                    }
96681                    return !1;
96682                  }
96683                  ComputeAABB(t, e, i) {
96684                    const s = xt.MulXV(e, this.m_p, Ji.ComputeAABB_s_p);
96685                    t.lowerBound.Set(s.x - this.m_radius, s.y - this.m_radius);
96686                    t.upperBound.Set(s.x + this.m_radius, s.y + this.m_radius);
96687                  }
96688                  ComputeMass(t, e) {
96689                    const i = rt(this.m_radius);
96690                    t.mass = e * o * i;
96691                    t.center.Copy(this.m_p);
96692                    t.I = t.mass * (.5 * i + St.DotVV(this.m_p, this.m_p));
96693                  }
96694                  SetupDistanceProxy(t, e) {
96695                    t.m_vertices = t.m_buffer;
96696                    t.m_vertices[0].Copy(this.m_p);
96697                    t.m_count = 1;
96698                    t.m_radius = this.m_radius;
96699                  }
96700                  ComputeSubmergedArea(t, e, i, s) {
96701                    const r = xt.MulXV(i, this.m_p, new St);
96702                    const a = -(St.DotVV(t, r) - e);
96703                    if (a < -this.m_radius + n) return 0;
96704                    if (a > this.m_radius) {
96705                      s.Copy(r);
96706                      return o * this.m_radius * this.m_radius;
96707                    }
96708                    const l = this.m_radius * this.m_radius;
96709                    const h = a * a;
96710                    const c = l * (pt(a / this.m_radius) + o / 2) + a * at(l - h);
96711                    const u = -2 / 3 * lt(l - h, 1.5) / c;
96712                    s.x = r.x + t.x * u;
96713                    s.y = r.y + t.y * u;
96714                    return c;
96715                  }
96716                  Dump(t) {
96717                    t("    const shape: b2CircleShape = new b2CircleShape();\n");
96718                    t("    shape.m_radius = %.15f;\n", this.m_radius);
96719                    t("    shape.m_p.Set(%.15f, %.15f);\n", this.m_p.x, this.m_p.y);
96720                  }
96721                }
96722                Ji.TestPoint_s_center = new St;
96723                Ji.TestPoint_s_d = new St;
96724                Ji.ComputeDistance_s_center = new St;
96725                Ji.RayCast_s_position = new St;
96726                Ji.RayCast_s_s = new St;
96727                Ji.RayCast_s_r = new St;
96728                Ji.ComputeAABB_s_p = new St;
96729                class Zi extends Ki {
96730                  constructor() {
96731                    super(t.b2ShapeType.e_polygonShape, d);
96732                    this.m_centroid = new St(0, 0);
96733                    this.m_vertices = [];
96734                    this.m_normals = [];
96735                    this.m_count = 0;
96736                  }
96737                  Clone() {
96738                    return (new Zi).Copy(this);
96739                  }
96740                  Copy(t) {
96741                    super.Copy(t);
96742                    this.m_centroid.Copy(t.m_centroid);
96743                    this.m_count = t.m_count;
96744                    this.m_vertices = St.MakeArray(this.m_count);
96745                    this.m_normals = St.MakeArray(this.m_count);
96746                    for (let e = 0; e < this.m_count; ++e) {
96747                      this.m_vertices[e].Copy(t.m_vertices[e]);
96748                      this.m_normals[e].Copy(t.m_normals[e]);
96749                    }
96750                    return this;
96751                  }
96752                  GetChildCount() {
96753                    return 1;
96754                  }
96755                  Set(...t) {
96756                    if ("number" == typeof t[0][0]) {
96757                      const e = t[0];
96758                      if (e.length % 2 != 0) throw new Error;
96759                      return this._Set((t => ({
96760                        x: e[2 * t],
96761                        y: e[2 * t + 1]
96762                      })), e.length / 2);
96763                    }
96764                    {
96765                      const e = t[0];
96766                      const i = t[1] || e.length;
96767                      return this._Set((t => e[t]), i);
96768                    }
96769                  }
96770                  _Set(t, e) {
96771                    if (e < 3) return this.SetAsBox(1, 1);
96772                    let i = e;
96773                    const s = [];
96774                    for (let e = 0; e < i; ++e) {
96775                      const i = t(e);
96776                      let n = !0;
96777                      for (let t = 0; t < s.length; ++t) if (St.DistanceSquaredVV(i, s[t]) < .5 * u * (.5 * u)) {
96778                        n = !1;
96779                        break;
96780                      }
96781                      n && s.push(i);
96782                    }
96783                    i = s.length;
96784                    if (i < 3) return this.SetAsBox(1, 1);
96785                    let n = 0;
96786                    let r = s[0].x;
96787                    for (let t = 1; t < i; ++t) {
96788                      const e = s[t].x;
96789                      if (e > r || e === r && s[t].y < s[n].y) {
96790                        n = t;
96791                        r = e;
96792                      }
96793                    }
96794                    const o = [];
96795                    let a = 0;
96796                    let l = n;
96797                    for (;;) {
96798                      o[a] = l;
96799                      let t = 0;
96800                      for (let e = 1; e < i; ++e) {
96801                        if (t === l) {
96802                          t = e;
96803                          continue;
96804                        }
96805                        const i = St.SubVV(s[t], s[o[a]], Zi.Set_s_r);
96806                        const n = St.SubVV(s[e], s[o[a]], Zi.Set_s_v);
96807                        const r = St.CrossVV(i, n);
96808                        r < 0 && (t = e);
96809                        0 === r && n.LengthSquared() > i.LengthSquared() && (t = e);
96810                      }
96811                      ++a;
96812                      l = t;
96813                      if (t === n) break;
96814                    }
96815                    this.m_count = a;
96816                    this.m_vertices = St.MakeArray(this.m_count);
96817                    this.m_normals = St.MakeArray(this.m_count);
96818                    for (let t = 0; t < a; ++t) this.m_vertices[t].Copy(s[o[t]]);
96819                    for (let t = 0; t < a; ++t) {
96820                      const e = this.m_vertices[t];
96821                      const i = this.m_vertices[(t + 1) % a];
96822                      const s = St.SubVV(i, e, St.s_t0);
96823                      St.CrossVOne(s, this.m_normals[t]).SelfNormalize();
96824                    }
96825                    Zi.ComputeCentroid(this.m_vertices, a, this.m_centroid);
96826                    return this;
96827                  }
96828                  SetAsBox(t, e, i, s = 0) {
96829                    this.m_count = 4;
96830                    this.m_vertices = St.MakeArray(this.m_count);
96831                    this.m_normals = St.MakeArray(this.m_count);
96832                    this.m_vertices[0].Set(-t, -e);
96833                    this.m_vertices[1].Set(t, -e);
96834                    this.m_vertices[2].Set(t, e);
96835                    this.m_vertices[3].Set(-t, e);
96836                    this.m_normals[0].Set(0, -1);
96837                    this.m_normals[1].Set(1, 0);
96838                    this.m_normals[2].Set(0, 1);
96839                    this.m_normals[3].Set(-1, 0);
96840                    this.m_centroid.SetZero();
96841                    if (i) {
96842                      this.m_centroid.Copy(i);
96843                      const t = new xt;
96844                      t.SetPosition(i);
96845                      t.SetRotationAngle(s);
96846                      for (let e = 0; e < this.m_count; ++e) {
96847                        xt.MulXV(t, this.m_vertices[e], this.m_vertices[e]);
96848                        Ct.MulRV(t.q, this.m_normals[e], this.m_normals[e]);
96849                      }
96850                    }
96851                    return this;
96852                  }
96853                  TestPoint(t, e) {
96854                    const i = xt.MulTXV(t, e, Zi.TestPoint_s_pLocal);
96855                    for (let t = 0; t < this.m_count; ++t) if (St.DotVV(this.m_normals[t], St.SubVV(i, this.m_vertices[t], St.s_t0)) > 0) return !1;
96856                    return !0;
96857                  }
96858                  ComputeDistance(t, e, i, n) {
96859                    const r = xt.MulTXV(t, e, Zi.ComputeDistance_s_pLocal);
96860                    let o = -s;
96861                    const a = Zi.ComputeDistance_s_normalForMaxDistance.Copy(r);
96862                    for (let t = 0; t < this.m_count; ++t) {
96863                      const e = St.DotVV(this.m_normals[t], St.SubVV(r, this.m_vertices[t], St.s_t0));
96864                      if (e > o) {
96865                        o = e;
96866                        a.Copy(this.m_normals[t]);
96867                      }
96868                    }
96869                    if (o > 0) {
96870                      const e = Zi.ComputeDistance_s_minDistance.Copy(a);
96871                      let s = o * o;
96872                      for (let t = 0; t < this.m_count; ++t) {
96873                        const i = St.SubVV(r, this.m_vertices[t], Zi.ComputeDistance_s_distance);
96874                        const n = i.LengthSquared();
96875                        if (s > n) {
96876                          e.Copy(i);
96877                          s = n;
96878                        }
96879                      }
96880                      Ct.MulRV(t.q, e, i);
96881                      i.Normalize();
96882                      return Math.sqrt(s);
96883                    }
96884                    Ct.MulRV(t.q, a, i);
96885                    return o;
96886                  }
96887                  RayCast(t, e, i, s) {
96888                    const n = xt.MulTXV(i, e.p1, Zi.RayCast_s_p1);
96889                    const r = xt.MulTXV(i, e.p2, Zi.RayCast_s_p2);
96890                    const o = St.SubVV(r, n, Zi.RayCast_s_d);
96891                    let a = 0, l = e.maxFraction;
96892                    let h = -1;
96893                    for (let t = 0; t < this.m_count; ++t) {
96894                      const e = St.DotVV(this.m_normals[t], St.SubVV(this.m_vertices[t], n, St.s_t0));
96895                      const i = St.DotVV(this.m_normals[t], o);
96896                      if (0 === i) {
96897                        if (e < 0) return !1;
96898                      } else if (i < 0 && e < a * i) {
96899                        a = e / i;
96900                        h = t;
96901                      } else i > 0 && e < l * i && (l = e / i);
96902                      if (l < a) return !1;
96903                    }
96904                    if (h >= 0) {
96905                      t.fraction = a;
96906                      Ct.MulRV(i.q, this.m_normals[h], t.normal);
96907                      return !0;
96908                    }
96909                    return !1;
96910                  }
96911                  ComputeAABB(t, e, i) {
96912                    const s = xt.MulXV(e, this.m_vertices[0], t.lowerBound);
96913                    const n = t.upperBound.Copy(s);
96914                    for (let t = 0; t < this.m_count; ++t) {
96915                      const i = xt.MulXV(e, this.m_vertices[t], Zi.ComputeAABB_s_v);
96916                      St.MinV(i, s, s);
96917                      St.MaxV(i, n, n);
96918                    }
96919                    const r = this.m_radius;
96920                    s.SelfSubXY(r, r);
96921                    n.SelfAddXY(r, r);
96922                  }
96923                  ComputeMass(t, e) {
96924                    const i = Zi.ComputeMass_s_center.SetZero();
96925                    let s = 0;
96926                    let n = 0;
96927                    const r = Zi.ComputeMass_s_s.SetZero();
96928                    for (let t = 0; t < this.m_count; ++t) r.SelfAdd(this.m_vertices[t]);
96929                    r.SelfMul(1 / this.m_count);
96930                    const o = 1 / 3;
96931                    for (let t = 0; t < this.m_count; ++t) {
96932                      const e = St.SubVV(this.m_vertices[t], r, Zi.ComputeMass_s_e1);
96933                      const a = St.SubVV(this.m_vertices[(t + 1) % this.m_count], r, Zi.ComputeMass_s_e2);
96934                      const l = St.CrossVV(e, a);
96935                      const h = .5 * l;
96936                      s += h;
96937                      i.SelfAdd(St.MulSV(h * o, St.AddVV(e, a, St.s_t0), St.s_t1));
96938                      const c = e.x;
96939                      const u = e.y;
96940                      const _ = a.x;
96941                      const d = a.y;
96942                      n += .25 * o * l * (c * c + _ * c + _ * _ + (u * u + d * u + d * d));
96943                    }
96944                    t.mass = e * s;
96945                    i.SelfMul(1 / s);
96946                    St.AddVV(i, r, t.center);
96947                    t.I = e * n;
96948                    t.I += t.mass * (St.DotVV(t.center, t.center) - St.DotVV(i, i));
96949                  }
96950                  Validate() {
96951                    for (let t = 0; t < this.m_count; ++t) {
96952                      const e = t;
96953                      const i = (t + 1) % this.m_count;
96954                      const s = this.m_vertices[e];
96955                      const n = St.SubVV(this.m_vertices[i], s, Zi.Validate_s_e);
96956                      for (let t = 0; t < this.m_count; ++t) {
96957                        if (t === e || t === i) continue;
96958                        const r = St.SubVV(this.m_vertices[t], s, Zi.Validate_s_v);
96959                        if (St.CrossVV(n, r) < 0) return !1;
96960                      }
96961                    }
96962                    return !0;
96963                  }
96964                  SetupDistanceProxy(t, e) {
96965                    t.m_vertices = this.m_vertices;
96966                    t.m_count = this.m_count;
96967                    t.m_radius = this.m_radius;
96968                  }
96969                  ComputeSubmergedArea(t, e, i, s) {
96970                    const r = Ct.MulTRV(i.q, t, Zi.ComputeSubmergedArea_s_normalL);
96971                    const o = e - St.DotVV(t, i.p);
96972                    const a = [];
96973                    let l = 0;
96974                    let h = -1;
96975                    let c = -1;
96976                    let u = !1;
96977                    for (let t = 0; t < this.m_count; ++t) {
96978                      a[t] = St.DotVV(r, this.m_vertices[t]) - o;
96979                      const e = a[t] < -n;
96980                      if (t > 0) if (e) {
96981                        if (!u) {
96982                          h = t - 1;
96983                          l++;
96984                        }
96985                      } else if (u) {
96986                        c = t - 1;
96987                        l++;
96988                      }
96989                      u = e;
96990                    }
96991                    switch (l) {
96992                     case 0:
96993                      if (u) {
96994                        const t = Zi.ComputeSubmergedArea_s_md;
96995                        this.ComputeMass(t, 1);
96996                        xt.MulXV(i, t.center, s);
96997                        return t.mass;
96998                      }
96999                      return 0;
97000
97001                     case 1:
97002                      -1 === h ? h = this.m_count - 1 : c = this.m_count - 1;
97003                    }
97004                    const _ = (h + 1) % this.m_count;
97005                    const d = (c + 1) % this.m_count;
97006                    const p = (0 - a[h]) / (a[_] - a[h]);
97007                    const m = (0 - a[c]) / (a[d] - a[c]);
97008                    const f = Zi.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[h].x * (1 - p) + this.m_vertices[_].x * p, this.m_vertices[h].y * (1 - p) + this.m_vertices[_].y * p);
97009                    const g = Zi.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[c].x * (1 - m) + this.m_vertices[d].x * m, this.m_vertices[c].y * (1 - m) + this.m_vertices[d].y * m);
97010                    let y = 0;
97011                    const b = Zi.ComputeSubmergedArea_s_center.SetZero();
97012                    let S = this.m_vertices[_];
97013                    let A;
97014                    let T = _;
97015                    for (;T !== d; ) {
97016                      T = (T + 1) % this.m_count;
97017                      A = T === d ? g : this.m_vertices[T];
97018                      const t = .5 * ((S.x - f.x) * (A.y - f.y) - (S.y - f.y) * (A.x - f.x));
97019                      y += t;
97020                      b.x += t * (f.x + S.x + A.x) / 3;
97021                      b.y += t * (f.y + S.y + A.y) / 3;
97022                      S = A;
97023                    }
97024                    b.SelfMul(1 / y);
97025                    xt.MulXV(i, b, s);
97026                    return y;
97027                  }
97028                  Dump(t) {
97029                    t("    const shape: b2PolygonShape = new b2PolygonShape();\n");
97030                    t("    const vs: b2Vec2[] = [];\n");
97031                    for (let e = 0; e < this.m_count; ++e) t("    vs[%d] = new b2Vec2(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y);
97032                    t("    shape.Set(vs, %d);\n", this.m_count);
97033                  }
97034                  static ComputeCentroid(t, e, i) {
97035                    const s = i;
97036                    s.SetZero();
97037                    let n = 0;
97038                    const r = Zi.ComputeCentroid_s_pRef.SetZero();
97039                    const o = 1 / 3;
97040                    for (let i = 0; i < e; ++i) {
97041                      const a = r;
97042                      const l = t[i];
97043                      const h = t[(i + 1) % e];
97044                      const c = St.SubVV(l, a, Zi.ComputeCentroid_s_e1);
97045                      const u = St.SubVV(h, a, Zi.ComputeCentroid_s_e2);
97046                      const _ = .5 * St.CrossVV(c, u);
97047                      n += _;
97048                      s.x += _ * o * (a.x + l.x + h.x);
97049                      s.y += _ * o * (a.y + l.y + h.y);
97050                    }
97051                    s.SelfMul(1 / n);
97052                    return s;
97053                  }
97054                }
97055                Zi.Set_s_r = new St;
97056                Zi.Set_s_v = new St;
97057                Zi.TestPoint_s_pLocal = new St;
97058                Zi.ComputeDistance_s_pLocal = new St;
97059                Zi.ComputeDistance_s_normalForMaxDistance = new St;
97060                Zi.ComputeDistance_s_minDistance = new St;
97061                Zi.ComputeDistance_s_distance = new St;
97062                Zi.RayCast_s_p1 = new St;
97063                Zi.RayCast_s_p2 = new St;
97064                Zi.RayCast_s_d = new St;
97065                Zi.ComputeAABB_s_v = new St;
97066                Zi.ComputeMass_s_center = new St;
97067                Zi.ComputeMass_s_s = new St;
97068                Zi.ComputeMass_s_e1 = new St;
97069                Zi.ComputeMass_s_e2 = new St;
97070                Zi.Validate_s_e = new St;
97071                Zi.Validate_s_v = new St;
97072                Zi.ComputeSubmergedArea_s_normalL = new St;
97073                Zi.ComputeSubmergedArea_s_md = new qi;
97074                Zi.ComputeSubmergedArea_s_intoVec = new St;
97075                Zi.ComputeSubmergedArea_s_outoVec = new St;
97076                Zi.ComputeSubmergedArea_s_center = new St;
97077                Zi.ComputeCentroid_s_pRef = new St;
97078                Zi.ComputeCentroid_s_e1 = new St;
97079                Zi.ComputeCentroid_s_e2 = new St;
97080                class Qi extends Ki {
97081                  constructor() {
97082                    super(t.b2ShapeType.e_edgeShape, d);
97083                    this.m_vertex1 = new St;
97084                    this.m_vertex2 = new St;
97085                    this.m_vertex0 = new St;
97086                    this.m_vertex3 = new St;
97087                    this.m_hasVertex0 = !1;
97088                    this.m_hasVertex3 = !1;
97089                  }
97090                  Set(t, e) {
97091                    this.m_vertex1.Copy(t);
97092                    this.m_vertex2.Copy(e);
97093                    this.m_hasVertex0 = !1;
97094                    this.m_hasVertex3 = !1;
97095                    return this;
97096                  }
97097                  Clone() {
97098                    return (new Qi).Copy(this);
97099                  }
97100                  Copy(t) {
97101                    super.Copy(t);
97102                    this.m_vertex1.Copy(t.m_vertex1);
97103                    this.m_vertex2.Copy(t.m_vertex2);
97104                    this.m_vertex0.Copy(t.m_vertex0);
97105                    this.m_vertex3.Copy(t.m_vertex3);
97106                    this.m_hasVertex0 = t.m_hasVertex0;
97107                    this.m_hasVertex3 = t.m_hasVertex3;
97108                    return this;
97109                  }
97110                  GetChildCount() {
97111                    return 1;
97112                  }
97113                  TestPoint(t, e) {
97114                    return !1;
97115                  }
97116                  ComputeDistance(t, e, i, s) {
97117                    const n = xt.MulXV(t, this.m_vertex1, Qi.ComputeDistance_s_v1);
97118                    const r = xt.MulXV(t, this.m_vertex2, Qi.ComputeDistance_s_v2);
97119                    const o = St.SubVV(e, n, Qi.ComputeDistance_s_d);
97120                    const a = St.SubVV(r, n, Qi.ComputeDistance_s_s);
97121                    const l = St.DotVV(o, a);
97122                    if (l > 0) {
97123                      const t = St.DotVV(a, a);
97124                      l > t ? St.SubVV(e, r, o) : o.SelfMulSub(l / t, a);
97125                    }
97126                    i.Copy(o);
97127                    return i.Normalize();
97128                  }
97129                  RayCast(t, e, i, s) {
97130                    const n = xt.MulTXV(i, e.p1, Qi.RayCast_s_p1);
97131                    const r = xt.MulTXV(i, e.p2, Qi.RayCast_s_p2);
97132                    const o = St.SubVV(r, n, Qi.RayCast_s_d);
97133                    const a = this.m_vertex1;
97134                    const l = this.m_vertex2;
97135                    const h = St.SubVV(l, a, Qi.RayCast_s_e);
97136                    const c = t.normal.Set(h.y, -h.x).SelfNormalize();
97137                    const u = St.DotVV(c, St.SubVV(a, n, St.s_t0));
97138                    const _ = St.DotVV(c, o);
97139                    if (0 === _) return !1;
97140                    const d = u / _;
97141                    if (d < 0 || e.maxFraction < d) return !1;
97142                    const p = St.AddVMulSV(n, d, o, Qi.RayCast_s_q);
97143                    const m = St.SubVV(l, a, Qi.RayCast_s_r);
97144                    const f = St.DotVV(m, m);
97145                    if (0 === f) return !1;
97146                    const g = St.DotVV(St.SubVV(p, a, St.s_t0), m) / f;
97147                    if (g < 0 || 1 < g) return !1;
97148                    t.fraction = d;
97149                    Ct.MulRV(i.q, t.normal, t.normal);
97150                    u > 0 && t.normal.SelfNeg();
97151                    return !0;
97152                  }
97153                  ComputeAABB(t, e, i) {
97154                    const s = xt.MulXV(e, this.m_vertex1, Qi.ComputeAABB_s_v1);
97155                    const n = xt.MulXV(e, this.m_vertex2, Qi.ComputeAABB_s_v2);
97156                    St.MinV(s, n, t.lowerBound);
97157                    St.MaxV(s, n, t.upperBound);
97158                    const r = this.m_radius;
97159                    t.lowerBound.SelfSubXY(r, r);
97160                    t.upperBound.SelfAddXY(r, r);
97161                  }
97162                  ComputeMass(t, e) {
97163                    t.mass = 0;
97164                    St.MidVV(this.m_vertex1, this.m_vertex2, t.center);
97165                    t.I = 0;
97166                  }
97167                  SetupDistanceProxy(t, e) {
97168                    t.m_vertices = t.m_buffer;
97169                    t.m_vertices[0].Copy(this.m_vertex1);
97170                    t.m_vertices[1].Copy(this.m_vertex2);
97171                    t.m_count = 2;
97172                    t.m_radius = this.m_radius;
97173                  }
97174                  ComputeSubmergedArea(t, e, i, s) {
97175                    s.SetZero();
97176                    return 0;
97177                  }
97178                  Dump(t) {
97179                    t("    const shape: b2EdgeShape = new b2EdgeShape();\n");
97180                    t("    shape.m_radius = %.15f;\n", this.m_radius);
97181                    t("    shape.m_vertex0.Set(%.15f, %.15f);\n", this.m_vertex0.x, this.m_vertex0.y);
97182                    t("    shape.m_vertex1.Set(%.15f, %.15f);\n", this.m_vertex1.x, this.m_vertex1.y);
97183                    t("    shape.m_vertex2.Set(%.15f, %.15f);\n", this.m_vertex2.x, this.m_vertex2.y);
97184                    t("    shape.m_vertex3.Set(%.15f, %.15f);\n", this.m_vertex3.x, this.m_vertex3.y);
97185                    t("    shape.m_hasVertex0 = %s;\n", this.m_hasVertex0);
97186                    t("    shape.m_hasVertex3 = %s;\n", this.m_hasVertex3);
97187                  }
97188                }
97189                Qi.ComputeDistance_s_v1 = new St;
97190                Qi.ComputeDistance_s_v2 = new St;
97191                Qi.ComputeDistance_s_d = new St;
97192                Qi.ComputeDistance_s_s = new St;
97193                Qi.RayCast_s_p1 = new St;
97194                Qi.RayCast_s_p2 = new St;
97195                Qi.RayCast_s_d = new St;
97196                Qi.RayCast_s_e = new St;
97197                Qi.RayCast_s_q = new St;
97198                Qi.RayCast_s_r = new St;
97199                Qi.ComputeAABB_s_v1 = new St;
97200                Qi.ComputeAABB_s_v2 = new St;
97201                class $i extends Ki {
97202                  constructor() {
97203                    super(t.b2ShapeType.e_chainShape, d);
97204                    this.m_vertices = [];
97205                    this.m_count = 0;
97206                    this.m_prevVertex = new St;
97207                    this.m_nextVertex = new St;
97208                    this.m_hasPrevVertex = !1;
97209                    this.m_hasNextVertex = !1;
97210                  }
97211                  CreateLoop(...t) {
97212                    if ("number" == typeof t[0][0]) {
97213                      const e = t[0];
97214                      if (e.length % 2 != 0) throw new Error;
97215                      return this._CreateLoop((t => ({
97216                        x: e[2 * t],
97217                        y: e[2 * t + 1]
97218                      })), e.length / 2);
97219                    }
97220                    {
97221                      const e = t[0];
97222                      const i = t[1] || e.length;
97223                      return this._CreateLoop((t => e[t]), i);
97224                    }
97225                  }
97226                  _CreateLoop(t, e) {
97227                    if (e < 3) return this;
97228                    this.m_count = e + 1;
97229                    this.m_vertices = St.MakeArray(this.m_count);
97230                    for (let i = 0; i < e; ++i) this.m_vertices[i].Copy(t(i));
97231                    this.m_vertices[e].Copy(this.m_vertices[0]);
97232                    this.m_prevVertex.Copy(this.m_vertices[this.m_count - 2]);
97233                    this.m_nextVertex.Copy(this.m_vertices[1]);
97234                    this.m_hasPrevVertex = !0;
97235                    this.m_hasNextVertex = !0;
97236                    return this;
97237                  }
97238                  CreateChain(...t) {
97239                    if ("number" == typeof t[0][0]) {
97240                      const e = t[0];
97241                      if (e.length % 2 != 0) throw new Error;
97242                      return this._CreateChain((t => ({
97243                        x: e[2 * t],
97244                        y: e[2 * t + 1]
97245                      })), e.length / 2);
97246                    }
97247                    {
97248                      const e = t[0];
97249                      const i = t[1] || e.length;
97250                      return this._CreateChain((t => e[t]), i);
97251                    }
97252                  }
97253                  _CreateChain(t, e) {
97254                    this.m_count = e;
97255                    this.m_vertices = St.MakeArray(e);
97256                    for (let i = 0; i < e; ++i) this.m_vertices[i].Copy(t(i));
97257                    this.m_hasPrevVertex = !1;
97258                    this.m_hasNextVertex = !1;
97259                    this.m_prevVertex.SetZero();
97260                    this.m_nextVertex.SetZero();
97261                    return this;
97262                  }
97263                  SetPrevVertex(t) {
97264                    this.m_prevVertex.Copy(t);
97265                    this.m_hasPrevVertex = !0;
97266                    return this;
97267                  }
97268                  SetNextVertex(t) {
97269                    this.m_nextVertex.Copy(t);
97270                    this.m_hasNextVertex = !0;
97271                    return this;
97272                  }
97273                  Clone() {
97274                    return (new $i).Copy(this);
97275                  }
97276                  Copy(t) {
97277                    super.Copy(t);
97278                    this._CreateChain((e => t.m_vertices[e]), t.m_count);
97279                    this.m_prevVertex.Copy(t.m_prevVertex);
97280                    this.m_nextVertex.Copy(t.m_nextVertex);
97281                    this.m_hasPrevVertex = t.m_hasPrevVertex;
97282                    this.m_hasNextVertex = t.m_hasNextVertex;
97283                    return this;
97284                  }
97285                  GetChildCount() {
97286                    return this.m_count - 1;
97287                  }
97288                  GetChildEdge(t, e) {
97289                    t.m_radius = this.m_radius;
97290                    t.m_vertex1.Copy(this.m_vertices[e]);
97291                    t.m_vertex2.Copy(this.m_vertices[e + 1]);
97292                    if (e > 0) {
97293                      t.m_vertex0.Copy(this.m_vertices[e - 1]);
97294                      t.m_hasVertex0 = !0;
97295                    } else {
97296                      t.m_vertex0.Copy(this.m_prevVertex);
97297                      t.m_hasVertex0 = this.m_hasPrevVertex;
97298                    }
97299                    if (e < this.m_count - 2) {
97300                      t.m_vertex3.Copy(this.m_vertices[e + 2]);
97301                      t.m_hasVertex3 = !0;
97302                    } else {
97303                      t.m_vertex3.Copy(this.m_nextVertex);
97304                      t.m_hasVertex3 = this.m_hasNextVertex;
97305                    }
97306                  }
97307                  TestPoint(t, e) {
97308                    return !1;
97309                  }
97310                  ComputeDistance(t, e, i, s) {
97311                    const n = $i.ComputeDistance_s_edgeShape;
97312                    this.GetChildEdge(n, s);
97313                    return n.ComputeDistance(t, e, i, 0);
97314                  }
97315                  RayCast(t, e, i, s) {
97316                    const n = $i.RayCast_s_edgeShape;
97317                    n.m_vertex1.Copy(this.m_vertices[s]);
97318                    n.m_vertex2.Copy(this.m_vertices[(s + 1) % this.m_count]);
97319                    return n.RayCast(t, e, i, 0);
97320                  }
97321                  ComputeAABB(t, e, i) {
97322                    const s = this.m_vertices[i];
97323                    const n = this.m_vertices[(i + 1) % this.m_count];
97324                    const r = xt.MulXV(e, s, $i.ComputeAABB_s_v1);
97325                    const o = xt.MulXV(e, n, $i.ComputeAABB_s_v2);
97326                    St.MinV(r, o, t.lowerBound);
97327                    St.MaxV(r, o, t.upperBound);
97328                  }
97329                  ComputeMass(t, e) {
97330                    t.mass = 0;
97331                    t.center.SetZero();
97332                    t.I = 0;
97333                  }
97334                  SetupDistanceProxy(t, e) {
97335                    t.m_vertices = t.m_buffer;
97336                    t.m_vertices[0].Copy(this.m_vertices[e]);
97337                    e + 1 < this.m_count ? t.m_vertices[1].Copy(this.m_vertices[e + 1]) : t.m_vertices[1].Copy(this.m_vertices[0]);
97338                    t.m_count = 2;
97339                    t.m_radius = this.m_radius;
97340                  }
97341                  ComputeSubmergedArea(t, e, i, s) {
97342                    s.SetZero();
97343                    return 0;
97344                  }
97345                  Dump(t) {
97346                    t("    const shape: b2ChainShape = new b2ChainShape();\n");
97347                    t("    const vs: b2Vec2[] = [];\n");
97348                    for (let e = 0; e < this.m_count; ++e) t("    vs[%d] = new bVec2(%.15f, %.15f);\n", e, this.m_vertices[e].x, this.m_vertices[e].y);
97349                    t("    shape.CreateChain(vs, %d);\n", this.m_count);
97350                    t("    shape.m_prevVertex.Set(%.15f, %.15f);\n", this.m_prevVertex.x, this.m_prevVertex.y);
97351                    t("    shape.m_nextVertex.Set(%.15f, %.15f);\n", this.m_nextVertex.x, this.m_nextVertex.y);
97352                    t("    shape.m_hasPrevVertex = %s;\n", this.m_hasPrevVertex ? "true" : "false");
97353                    t("    shape.m_hasNextVertex = %s;\n", this.m_hasNextVertex ? "true" : "false");
97354                  }
97355                }
97356                $i.ComputeDistance_s_edgeShape = new Qi;
97357                $i.RayCast_s_edgeShape = new Qi;
97358                $i.ComputeAABB_s_v1 = new St;
97359                $i.ComputeAABB_s_v2 = new St;
97360                class ts {
97361                  constructor() {
97362                    this.categoryBits = 1;
97363                    this.maskBits = 65535;
97364                    this.groupIndex = 0;
97365                  }
97366                  Clone() {
97367                    return (new ts).Copy(this);
97368                  }
97369                  Copy(t) {
97370                    this.categoryBits = t.categoryBits;
97371                    this.maskBits = t.maskBits;
97372                    this.groupIndex = t.groupIndex || 0;
97373                    return this;
97374                  }
97375                }
97376                ts.DEFAULT = new ts;
97377                class es {
97378                  constructor() {
97379                    this.userData = null;
97380                    this.friction = .2;
97381                    this.restitution = 0;
97382                    this.density = 0;
97383                    this.isSensor = !1;
97384                    this.filter = new ts;
97385                  }
97386                }
97387                class is {
97388                  constructor(t, e) {
97389                    this.aabb = new ge;
97390                    this.childIndex = 0;
97391                    this.fixture = t;
97392                    this.childIndex = e;
97393                    this.fixture.m_shape.ComputeAABB(this.aabb, this.fixture.m_body.GetTransform(), e);
97394                    this.treeNode = this.fixture.m_body.m_world.m_contactManager.m_broadPhase.CreateProxy(this.aabb, this);
97395                  }
97396                  Reset() {
97397                    this.fixture.m_body.m_world.m_contactManager.m_broadPhase.DestroyProxy(this.treeNode);
97398                  }
97399                  Touch() {
97400                    this.fixture.m_body.m_world.m_contactManager.m_broadPhase.TouchProxy(this.treeNode);
97401                  }
97402                  Synchronize(t, e, i) {
97403                    if (t === e) {
97404                      this.fixture.m_shape.ComputeAABB(this.aabb, t, this.childIndex);
97405                      this.fixture.m_body.m_world.m_contactManager.m_broadPhase.MoveProxy(this.treeNode, this.aabb, i);
97406                    } else {
97407                      const s = is.Synchronize_s_aabb1;
97408                      const n = is.Synchronize_s_aabb2;
97409                      this.fixture.m_shape.ComputeAABB(s, t, this.childIndex);
97410                      this.fixture.m_shape.ComputeAABB(n, e, this.childIndex);
97411                      this.aabb.Combine2(s, n);
97412                      this.fixture.m_body.m_world.m_contactManager.m_broadPhase.MoveProxy(this.treeNode, this.aabb, i);
97413                    }
97414                  }
97415                }
97416                is.Synchronize_s_aabb1 = new ge;
97417                is.Synchronize_s_aabb2 = new ge;
97418                class ss {
97419                  constructor(t, e) {
97420                    this.m_density = 0;
97421                    this.m_next = null;
97422                    this.m_friction = 0;
97423                    this.m_restitution = 0;
97424                    this.m_proxies = [];
97425                    this.m_filter = new ts;
97426                    this.m_isSensor = !1;
97427                    this.m_userData = null;
97428                    this.m_body = t;
97429                    this.m_shape = e.shape.Clone();
97430                    this.m_userData = i(e.userData, null);
97431                    this.m_friction = i(e.friction, .2);
97432                    this.m_restitution = i(e.restitution, 0);
97433                    this.m_filter.Copy(i(e.filter, ts.DEFAULT));
97434                    this.m_isSensor = i(e.isSensor, !1);
97435                    this.m_density = i(e.density, 0);
97436                  }
97437                  get m_proxyCount() {
97438                    return this.m_proxies.length;
97439                  }
97440                  Reset() {}
97441                  GetType() {
97442                    return this.m_shape.GetType();
97443                  }
97444                  GetShape() {
97445                    return this.m_shape;
97446                  }
97447                  SetSensor(t) {
97448                    if (t !== this.m_isSensor) {
97449                      this.m_body.SetAwake(!0);
97450                      this.m_isSensor = t;
97451                    }
97452                  }
97453                  IsSensor() {
97454                    return this.m_isSensor;
97455                  }
97456                  SetFilterData(t) {
97457                    this.m_filter.Copy(t);
97458                    this.Refilter();
97459                  }
97460                  GetFilterData() {
97461                    return this.m_filter;
97462                  }
97463                  Refilter() {
97464                    let t = this.m_body.GetContactList();
97465                    for (;t; ) {
97466                      const e = t.contact;
97467                      const i = e.GetFixtureA();
97468                      const s = e.GetFixtureB();
97469                      i !== this && s !== this || e.FlagForFiltering();
97470                      t = t.next;
97471                    }
97472                    this.TouchProxies();
97473                  }
97474                  GetBody() {
97475                    return this.m_body;
97476                  }
97477                  GetNext() {
97478                    return this.m_next;
97479                  }
97480                  GetUserData() {
97481                    return this.m_userData;
97482                  }
97483                  SetUserData(t) {
97484                    this.m_userData = t;
97485                  }
97486                  TestPoint(t) {
97487                    return this.m_shape.TestPoint(this.m_body.GetTransform(), t);
97488                  }
97489                  ComputeDistance(t, e, i) {
97490                    return this.m_shape.ComputeDistance(this.m_body.GetTransform(), t, e, i);
97491                  }
97492                  RayCast(t, e, i) {
97493                    return this.m_shape.RayCast(t, e, this.m_body.GetTransform(), i);
97494                  }
97495                  GetMassData(t = new qi) {
97496                    this.m_shape.ComputeMass(t, this.m_density);
97497                    return t;
97498                  }
97499                  SetDensity(t) {
97500                    this.m_density = t;
97501                  }
97502                  GetDensity() {
97503                    return this.m_density;
97504                  }
97505                  GetFriction() {
97506                    return this.m_friction;
97507                  }
97508                  SetFriction(t) {
97509                    this.m_friction = t;
97510                  }
97511                  GetRestitution() {
97512                    return this.m_restitution;
97513                  }
97514                  SetRestitution(t) {
97515                    this.m_restitution = t;
97516                  }
97517                  GetAABB(t) {
97518                    return this.m_proxies[t].aabb;
97519                  }
97520                  Dump(t, e) {
97521                    t("    const fd: b2FixtureDef = new b2FixtureDef();\n");
97522                    t("    fd.friction = %.15f;\n", this.m_friction);
97523                    t("    fd.restitution = %.15f;\n", this.m_restitution);
97524                    t("    fd.density = %.15f;\n", this.m_density);
97525                    t("    fd.isSensor = %s;\n", this.m_isSensor ? "true" : "false");
97526                    t("    fd.filter.categoryBits = %d;\n", this.m_filter.categoryBits);
97527                    t("    fd.filter.maskBits = %d;\n", this.m_filter.maskBits);
97528                    t("    fd.filter.groupIndex = %d;\n", this.m_filter.groupIndex);
97529                    this.m_shape.Dump(t);
97530                    t("\n");
97531                    t("    fd.shape = shape;\n");
97532                    t("\n");
97533                    t("    bodies[%d].CreateFixture(fd);\n", e);
97534                  }
97535                  CreateProxies() {
97536                    if (0 !== this.m_proxies.length) throw new Error;
97537                    for (let t = 0; t < this.m_shape.GetChildCount(); ++t) this.m_proxies[t] = new is(this, t);
97538                  }
97539                  DestroyProxies() {
97540                    for (const t of this.m_proxies) t.Reset();
97541                    this.m_proxies.length = 0;
97542                  }
97543                  TouchProxies() {
97544                    for (const t of this.m_proxies) t.Touch();
97545                  }
97546                  SynchronizeProxies(t, e, i) {
97547                    for (const s of this.m_proxies) s.Synchronize(t, e, i);
97548                  }
97549                }
97550                !function(t) {
97551                  t[t.b2_unknown = -1] = "b2_unknown";
97552                  t[t.b2_staticBody = 0] = "b2_staticBody";
97553                  t[t.b2_kinematicBody = 1] = "b2_kinematicBody";
97554                  t[t.b2_dynamicBody = 2] = "b2_dynamicBody";
97555                }(t.b2BodyType || (t.b2BodyType = {}));
97556                class ns {
97557                  constructor() {
97558                    this.type = t.b2BodyType.b2_staticBody;
97559                    this.position = new St(0, 0);
97560                    this.angle = 0;
97561                    this.linearVelocity = new St(0, 0);
97562                    this.angularVelocity = 0;
97563                    this.linearDamping = 0;
97564                    this.angularDamping = 0;
97565                    this.allowSleep = !0;
97566                    this.awake = !0;
97567                    this.fixedRotation = !1;
97568                    this.bullet = !1;
97569                    this.active = !0;
97570                    this.userData = null;
97571                    this.gravityScale = 1;
97572                  }
97573                }
97574                class rs {
97575                  constructor(e, s) {
97576                    this.m_type = t.b2BodyType.b2_staticBody;
97577                    this.m_islandFlag = !1;
97578                    this.m_awakeFlag = !1;
97579                    this.m_autoSleepFlag = !1;
97580                    this.m_bulletFlag = !1;
97581                    this.m_fixedRotationFlag = !1;
97582                    this.m_activeFlag = !1;
97583                    this.m_toiFlag = !1;
97584                    this.m_islandIndex = 0;
97585                    this.m_xf = new xt;
97586                    this.m_xf0 = new xt;
97587                    this.m_sweep = new wt;
97588                    this.m_linearVelocity = new St;
97589                    this.m_angularVelocity = 0;
97590                    this.m_force = new St;
97591                    this.m_torque = 0;
97592                    this.m_prev = null;
97593                    this.m_next = null;
97594                    this.m_fixtureList = null;
97595                    this.m_fixtureCount = 0;
97596                    this.m_jointList = null;
97597                    this.m_contactList = null;
97598                    this.m_mass = 1;
97599                    this.m_invMass = 1;
97600                    this.m_I = 0;
97601                    this.m_invI = 0;
97602                    this.m_linearDamping = 0;
97603                    this.m_angularDamping = 0;
97604                    this.m_gravityScale = 1;
97605                    this.m_sleepTime = 0;
97606                    this.m_userData = null;
97607                    this.m_controllerList = null;
97608                    this.m_controllerCount = 0;
97609                    this.m_bulletFlag = i(e.bullet, !1);
97610                    this.m_fixedRotationFlag = i(e.fixedRotation, !1);
97611                    this.m_autoSleepFlag = i(e.allowSleep, !0);
97612                    this.m_awakeFlag = i(e.awake, !0);
97613                    this.m_activeFlag = i(e.active, !0);
97614                    this.m_world = s;
97615                    this.m_xf.p.Copy(i(e.position, St.ZERO));
97616                    this.m_xf.q.SetAngle(i(e.angle, 0));
97617                    this.m_xf0.Copy(this.m_xf);
97618                    this.m_sweep.localCenter.SetZero();
97619                    this.m_sweep.c0.Copy(this.m_xf.p);
97620                    this.m_sweep.c.Copy(this.m_xf.p);
97621                    this.m_sweep.a0 = this.m_sweep.a = this.m_xf.q.GetAngle();
97622                    this.m_sweep.alpha0 = 0;
97623                    this.m_linearVelocity.Copy(i(e.linearVelocity, St.ZERO));
97624                    this.m_angularVelocity = i(e.angularVelocity, 0);
97625                    this.m_linearDamping = i(e.linearDamping, 0);
97626                    this.m_angularDamping = i(e.angularDamping, 0);
97627                    this.m_gravityScale = i(e.gravityScale, 1);
97628                    this.m_force.SetZero();
97629                    this.m_torque = 0;
97630                    this.m_sleepTime = 0;
97631                    this.m_type = i(e.type, t.b2BodyType.b2_staticBody);
97632                    if (e.type === t.b2BodyType.b2_dynamicBody) {
97633                      this.m_mass = 1;
97634                      this.m_invMass = 1;
97635                    } else {
97636                      this.m_mass = 0;
97637                      this.m_invMass = 0;
97638                    }
97639                    this.m_I = 0;
97640                    this.m_invI = 0;
97641                    this.m_userData = e.userData;
97642                    this.m_fixtureList = null;
97643                    this.m_fixtureCount = 0;
97644                    this.m_controllerList = null;
97645                    this.m_controllerCount = 0;
97646                  }
97647                  CreateFixture(t, e = 0) {
97648                    return t instanceof Ki ? this.CreateFixtureShapeDensity(t, e) : this.CreateFixtureDef(t);
97649                  }
97650                  CreateFixtureDef(t) {
97651                    if (this.m_world.IsLocked()) throw new Error;
97652                    const e = new ss(this, t);
97653                    this.m_activeFlag && e.CreateProxies();
97654                    e.m_next = this.m_fixtureList;
97655                    this.m_fixtureList = e;
97656                    ++this.m_fixtureCount;
97657                    e.m_density > 0 && this.ResetMassData();
97658                    this.m_world.m_newFixture = !0;
97659                    return e;
97660                  }
97661                  CreateFixtureShapeDensity(t, e = 0) {
97662                    const i = rs.CreateFixtureShapeDensity_s_def;
97663                    i.shape = t;
97664                    i.density = e;
97665                    return this.CreateFixtureDef(i);
97666                  }
97667                  DestroyFixture(t) {
97668                    if (this.m_world.IsLocked()) throw new Error;
97669                    let e = this.m_fixtureList;
97670                    let i = null;
97671                    for (;null !== e; ) {
97672                      if (e === t) {
97673                        i ? i.m_next = t.m_next : this.m_fixtureList = t.m_next;
97674                        break;
97675                      }
97676                      i = e;
97677                      e = e.m_next;
97678                    }
97679                    let s = this.m_contactList;
97680                    for (;s; ) {
97681                      const e = s.contact;
97682                      s = s.next;
97683                      const i = e.GetFixtureA();
97684                      const n = e.GetFixtureB();
97685                      t !== i && t !== n || this.m_world.m_contactManager.Destroy(e);
97686                    }
97687                    this.m_activeFlag && t.DestroyProxies();
97688                    t.m_next = null;
97689                    t.Reset();
97690                    --this.m_fixtureCount;
97691                    this.ResetMassData();
97692                  }
97693                  SetTransformVec(t, e) {
97694                    this.SetTransformXY(t.x, t.y, e);
97695                  }
97696                  SetTransformXY(t, e, i) {
97697                    if (this.m_world.IsLocked()) throw new Error;
97698                    this.m_xf.q.SetAngle(i);
97699                    this.m_xf.p.Set(t, e);
97700                    this.m_xf0.Copy(this.m_xf);
97701                    xt.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c);
97702                    this.m_sweep.a = i;
97703                    this.m_sweep.c0.Copy(this.m_sweep.c);
97704                    this.m_sweep.a0 = i;
97705                    for (let t = this.m_fixtureList; t; t = t.m_next) t.SynchronizeProxies(this.m_xf, this.m_xf, St.ZERO);
97706                    this.m_world.m_contactManager.FindNewContacts();
97707                  }
97708                  SetTransform(t) {
97709                    this.SetTransformVec(t.p, t.GetAngle());
97710                  }
97711                  GetTransform() {
97712                    return this.m_xf;
97713                  }
97714                  GetPosition() {
97715                    return this.m_xf.p;
97716                  }
97717                  SetPosition(t) {
97718                    this.SetTransformVec(t, this.GetAngle());
97719                  }
97720                  SetPositionXY(t, e) {
97721                    this.SetTransformXY(t, e, this.GetAngle());
97722                  }
97723                  GetAngle() {
97724                    return this.m_sweep.a;
97725                  }
97726                  SetAngle(t) {
97727                    this.SetTransformVec(this.GetPosition(), t);
97728                  }
97729                  GetWorldCenter() {
97730                    return this.m_sweep.c;
97731                  }
97732                  GetLocalCenter() {
97733                    return this.m_sweep.localCenter;
97734                  }
97735                  SetLinearVelocity(e) {
97736                    if (this.m_type !== t.b2BodyType.b2_staticBody) {
97737                      St.DotVV(e, e) > 0 && this.SetAwake(!0);
97738                      this.m_linearVelocity.Copy(e);
97739                    }
97740                  }
97741                  GetLinearVelocity() {
97742                    return this.m_linearVelocity;
97743                  }
97744                  SetAngularVelocity(e) {
97745                    if (this.m_type !== t.b2BodyType.b2_staticBody) {
97746                      e * e > 0 && this.SetAwake(!0);
97747                      this.m_angularVelocity = e;
97748                    }
97749                  }
97750                  GetAngularVelocity() {
97751                    return this.m_angularVelocity;
97752                  }
97753                  GetDefinition(t) {
97754                    t.type = this.GetType();
97755                    t.allowSleep = this.m_autoSleepFlag;
97756                    t.angle = this.GetAngle();
97757                    t.angularDamping = this.m_angularDamping;
97758                    t.gravityScale = this.m_gravityScale;
97759                    t.angularVelocity = this.m_angularVelocity;
97760                    t.fixedRotation = this.m_fixedRotationFlag;
97761                    t.bullet = this.m_bulletFlag;
97762                    t.awake = this.m_awakeFlag;
97763                    t.linearDamping = this.m_linearDamping;
97764                    t.linearVelocity.Copy(this.GetLinearVelocity());
97765                    t.position.Copy(this.GetPosition());
97766                    t.userData = this.GetUserData();
97767                    return t;
97768                  }
97769                  ApplyForce(e, i, s = !0) {
97770                    if (this.m_type === t.b2BodyType.b2_dynamicBody) {
97771                      s && !this.m_awakeFlag && this.SetAwake(!0);
97772                      if (this.m_awakeFlag) {
97773                        this.m_force.x += e.x;
97774                        this.m_force.y += e.y;
97775                        this.m_torque += (i.x - this.m_sweep.c.x) * e.y - (i.y - this.m_sweep.c.y) * e.x;
97776                      }
97777                    }
97778                  }
97779                  ApplyForceToCenter(e, i = !0) {
97780                    if (this.m_type === t.b2BodyType.b2_dynamicBody) {
97781                      i && !this.m_awakeFlag && this.SetAwake(!0);
97782                      if (this.m_awakeFlag) {
97783                        this.m_force.x += e.x;
97784                        this.m_force.y += e.y;
97785                      }
97786                    }
97787                  }
97788                  ApplyTorque(e, i = !0) {
97789                    if (this.m_type === t.b2BodyType.b2_dynamicBody) {
97790                      i && !this.m_awakeFlag && this.SetAwake(!0);
97791                      this.m_awakeFlag && (this.m_torque += e);
97792                    }
97793                  }
97794                  ApplyLinearImpulse(e, i, s = !0) {
97795                    if (this.m_type === t.b2BodyType.b2_dynamicBody) {
97796                      s && !this.m_awakeFlag && this.SetAwake(!0);
97797                      if (this.m_awakeFlag) {
97798                        this.m_linearVelocity.x += this.m_invMass * e.x;
97799                        this.m_linearVelocity.y += this.m_invMass * e.y;
97800                        this.m_angularVelocity += this.m_invI * ((i.x - this.m_sweep.c.x) * e.y - (i.y - this.m_sweep.c.y) * e.x);
97801                      }
97802                    }
97803                  }
97804                  ApplyLinearImpulseToCenter(e, i = !0) {
97805                    if (this.m_type === t.b2BodyType.b2_dynamicBody) {
97806                      i && !this.m_awakeFlag && this.SetAwake(!0);
97807                      if (this.m_awakeFlag) {
97808                        this.m_linearVelocity.x += this.m_invMass * e.x;
97809                        this.m_linearVelocity.y += this.m_invMass * e.y;
97810                      }
97811                    }
97812                  }
97813                  ApplyAngularImpulse(e, i = !0) {
97814                    if (this.m_type === t.b2BodyType.b2_dynamicBody) {
97815                      i && !this.m_awakeFlag && this.SetAwake(!0);
97816                      this.m_awakeFlag && (this.m_angularVelocity += this.m_invI * e);
97817                    }
97818                  }
97819                  GetMass() {
97820                    return this.m_mass;
97821                  }
97822                  GetInertia() {
97823                    return this.m_I + this.m_mass * St.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter);
97824                  }
97825                  GetMassData(t) {
97826                    t.mass = this.m_mass;
97827                    t.I = this.m_I + this.m_mass * St.DotVV(this.m_sweep.localCenter, this.m_sweep.localCenter);
97828                    t.center.Copy(this.m_sweep.localCenter);
97829                    return t;
97830                  }
97831                  SetMassData(e) {
97832                    if (this.m_world.IsLocked()) throw new Error;
97833                    if (this.m_type !== t.b2BodyType.b2_dynamicBody) return;
97834                    this.m_invMass = 0;
97835                    this.m_I = 0;
97836                    this.m_invI = 0;
97837                    this.m_mass = e.mass;
97838                    this.m_mass <= 0 && (this.m_mass = 1);
97839                    this.m_invMass = 1 / this.m_mass;
97840                    if (e.I > 0 && !this.m_fixedRotationFlag) {
97841                      this.m_I = e.I - this.m_mass * St.DotVV(e.center, e.center);
97842                      this.m_invI = 1 / this.m_I;
97843                    }
97844                    const i = rs.SetMassData_s_oldCenter.Copy(this.m_sweep.c);
97845                    this.m_sweep.localCenter.Copy(e.center);
97846                    xt.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c);
97847                    this.m_sweep.c0.Copy(this.m_sweep.c);
97848                    St.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, St.SubVV(this.m_sweep.c, i, St.s_t0), this.m_linearVelocity);
97849                  }
97850                  ResetMassData() {
97851                    this.m_mass = 0;
97852                    this.m_invMass = 0;
97853                    this.m_I = 0;
97854                    this.m_invI = 0;
97855                    this.m_sweep.localCenter.SetZero();
97856                    if (this.m_type === t.b2BodyType.b2_staticBody || this.m_type === t.b2BodyType.b2_kinematicBody) {
97857                      this.m_sweep.c0.Copy(this.m_xf.p);
97858                      this.m_sweep.c.Copy(this.m_xf.p);
97859                      this.m_sweep.a0 = this.m_sweep.a;
97860                      return;
97861                    }
97862                    const e = rs.ResetMassData_s_localCenter.SetZero();
97863                    for (let t = this.m_fixtureList; t; t = t.m_next) {
97864                      if (0 === t.m_density) continue;
97865                      const i = t.GetMassData(rs.ResetMassData_s_massData);
97866                      this.m_mass += i.mass;
97867                      e.x += i.center.x * i.mass;
97868                      e.y += i.center.y * i.mass;
97869                      this.m_I += i.I;
97870                    }
97871                    if (this.m_mass > 0) {
97872                      this.m_invMass = 1 / this.m_mass;
97873                      e.x *= this.m_invMass;
97874                      e.y *= this.m_invMass;
97875                    } else {
97876                      this.m_mass = 1;
97877                      this.m_invMass = 1;
97878                    }
97879                    if (this.m_I > 0 && !this.m_fixedRotationFlag) {
97880                      this.m_I -= this.m_mass * St.DotVV(e, e);
97881                      this.m_invI = 1 / this.m_I;
97882                    } else {
97883                      this.m_I = 0;
97884                      this.m_invI = 0;
97885                    }
97886                    const i = rs.ResetMassData_s_oldCenter.Copy(this.m_sweep.c);
97887                    this.m_sweep.localCenter.Copy(e);
97888                    xt.MulXV(this.m_xf, this.m_sweep.localCenter, this.m_sweep.c);
97889                    this.m_sweep.c0.Copy(this.m_sweep.c);
97890                    St.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, St.SubVV(this.m_sweep.c, i, St.s_t0), this.m_linearVelocity);
97891                  }
97892                  GetWorldPoint(t, e) {
97893                    return xt.MulXV(this.m_xf, t, e);
97894                  }
97895                  GetWorldVector(t, e) {
97896                    return Ct.MulRV(this.m_xf.q, t, e);
97897                  }
97898                  GetLocalPoint(t, e) {
97899                    return xt.MulTXV(this.m_xf, t, e);
97900                  }
97901                  GetLocalVector(t, e) {
97902                    return Ct.MulTRV(this.m_xf.q, t, e);
97903                  }
97904                  GetLinearVelocityFromWorldPoint(t, e) {
97905                    return St.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, St.SubVV(t, this.m_sweep.c, St.s_t0), e);
97906                  }
97907                  GetLinearVelocityFromLocalPoint(t, e) {
97908                    return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t, e), e);
97909                  }
97910                  GetLinearDamping() {
97911                    return this.m_linearDamping;
97912                  }
97913                  SetLinearDamping(t) {
97914                    this.m_linearDamping = t;
97915                  }
97916                  GetAngularDamping() {
97917                    return this.m_angularDamping;
97918                  }
97919                  SetAngularDamping(t) {
97920                    this.m_angularDamping = t;
97921                  }
97922                  GetGravityScale() {
97923                    return this.m_gravityScale;
97924                  }
97925                  SetGravityScale(t) {
97926                    this.m_gravityScale = t;
97927                  }
97928                  SetType(e) {
97929                    if (this.m_world.IsLocked()) throw new Error;
97930                    if (this.m_type === e) return;
97931                    this.m_type = e;
97932                    this.ResetMassData();
97933                    if (this.m_type === t.b2BodyType.b2_staticBody) {
97934                      this.m_linearVelocity.SetZero();
97935                      this.m_angularVelocity = 0;
97936                      this.m_sweep.a0 = this.m_sweep.a;
97937                      this.m_sweep.c0.Copy(this.m_sweep.c);
97938                      this.SynchronizeFixtures();
97939                    }
97940                    this.SetAwake(!0);
97941                    this.m_force.SetZero();
97942                    this.m_torque = 0;
97943                    let i = this.m_contactList;
97944                    for (;i; ) {
97945                      const t = i;
97946                      i = i.next;
97947                      this.m_world.m_contactManager.Destroy(t.contact);
97948                    }
97949                    this.m_contactList = null;
97950                    for (let t = this.m_fixtureList; t; t = t.m_next) t.TouchProxies();
97951                  }
97952                  GetType() {
97953                    return this.m_type;
97954                  }
97955                  SetBullet(t) {
97956                    this.m_bulletFlag = t;
97957                  }
97958                  IsBullet() {
97959                    return this.m_bulletFlag;
97960                  }
97961                  SetSleepingAllowed(t) {
97962                    this.m_autoSleepFlag = t;
97963                    t || this.SetAwake(!0);
97964                  }
97965                  IsSleepingAllowed() {
97966                    return this.m_autoSleepFlag;
97967                  }
97968                  SetAwake(t) {
97969                    if (t) {
97970                      this.m_awakeFlag = !0;
97971                      this.m_sleepTime = 0;
97972                    } else {
97973                      this.m_awakeFlag = !1;
97974                      this.m_sleepTime = 0;
97975                      this.m_linearVelocity.SetZero();
97976                      this.m_angularVelocity = 0;
97977                      this.m_force.SetZero();
97978                      this.m_torque = 0;
97979                    }
97980                  }
97981                  IsAwake() {
97982                    return this.m_awakeFlag;
97983                  }
97984                  SetActive(t) {
97985                    if (this.m_world.IsLocked()) throw new Error;
97986                    if (t !== this.IsActive()) {
97987                      this.m_activeFlag = t;
97988                      if (t) for (let t = this.m_fixtureList; t; t = t.m_next) t.CreateProxies(); else {
97989                        for (let t = this.m_fixtureList; t; t = t.m_next) t.DestroyProxies();
97990                        let t = this.m_contactList;
97991                        for (;t; ) {
97992                          const e = t;
97993                          t = t.next;
97994                          this.m_world.m_contactManager.Destroy(e.contact);
97995                        }
97996                        this.m_contactList = null;
97997                      }
97998                    }
97999                  }
98000                  IsActive() {
98001                    return this.m_activeFlag;
98002                  }
98003                  SetFixedRotation(t) {
98004                    if (this.m_fixedRotationFlag !== t) {
98005                      this.m_fixedRotationFlag = t;
98006                      this.m_angularVelocity = 0;
98007                      this.ResetMassData();
98008                    }
98009                  }
98010                  IsFixedRotation() {
98011                    return this.m_fixedRotationFlag;
98012                  }
98013                  GetFixtureList() {
98014                    return this.m_fixtureList;
98015                  }
98016                  GetJointList() {
98017                    return this.m_jointList;
98018                  }
98019                  GetContactList() {
98020                    return this.m_contactList;
98021                  }
98022                  GetNext() {
98023                    return this.m_next;
98024                  }
98025                  GetUserData() {
98026                    return this.m_userData;
98027                  }
98028                  SetUserData(t) {
98029                    this.m_userData = t;
98030                  }
98031                  GetWorld() {
98032                    return this.m_world;
98033                  }
98034                  Dump(e) {
98035                    const i = this.m_islandIndex;
98036                    e("{\n");
98037                    e("  const bd: b2BodyDef = new b2BodyDef();\n");
98038                    let s = "";
98039                    switch (this.m_type) {
98040                     case t.b2BodyType.b2_staticBody:
98041                      s = "b2BodyType.b2_staticBody";
98042                      break;
98043
98044                     case t.b2BodyType.b2_kinematicBody:
98045                      s = "b2BodyType.b2_kinematicBody";
98046                      break;
98047
98048                     case t.b2BodyType.b2_dynamicBody:
98049                      s = "b2BodyType.b2_dynamicBody";
98050                    }
98051                    e("  bd.type = %s;\n", s);
98052                    e("  bd.position.Set(%.15f, %.15f);\n", this.m_xf.p.x, this.m_xf.p.y);
98053                    e("  bd.angle = %.15f;\n", this.m_sweep.a);
98054                    e("  bd.linearVelocity.Set(%.15f, %.15f);\n", this.m_linearVelocity.x, this.m_linearVelocity.y);
98055                    e("  bd.angularVelocity = %.15f;\n", this.m_angularVelocity);
98056                    e("  bd.linearDamping = %.15f;\n", this.m_linearDamping);
98057                    e("  bd.angularDamping = %.15f;\n", this.m_angularDamping);
98058                    e("  bd.allowSleep = %s;\n", this.m_autoSleepFlag ? "true" : "false");
98059                    e("  bd.awake = %s;\n", this.m_awakeFlag ? "true" : "false");
98060                    e("  bd.fixedRotation = %s;\n", this.m_fixedRotationFlag ? "true" : "false");
98061                    e("  bd.bullet = %s;\n", this.m_bulletFlag ? "true" : "false");
98062                    e("  bd.active = %s;\n", this.m_activeFlag ? "true" : "false");
98063                    e("  bd.gravityScale = %.15f;\n", this.m_gravityScale);
98064                    e("\n");
98065                    e("  bodies[%d] = this.m_world.CreateBody(bd);\n", this.m_islandIndex);
98066                    e("\n");
98067                    for (let t = this.m_fixtureList; t; t = t.m_next) {
98068                      e("  {\n");
98069                      t.Dump(e, i);
98070                      e("  }\n");
98071                    }
98072                    e("}\n");
98073                  }
98074                  SynchronizeFixtures() {
98075                    const t = rs.SynchronizeFixtures_s_xf1;
98076                    t.q.SetAngle(this.m_sweep.a0);
98077                    Ct.MulRV(t.q, this.m_sweep.localCenter, t.p);
98078                    St.SubVV(this.m_sweep.c0, t.p, t.p);
98079                    const e = St.SubVV(this.m_sweep.c, this.m_sweep.c0, rs.SynchronizeFixtures_s_displacement);
98080                    for (let i = this.m_fixtureList; i; i = i.m_next) i.SynchronizeProxies(t, this.m_xf, e);
98081                  }
98082                  SynchronizeTransform() {
98083                    this.m_xf.q.SetAngle(this.m_sweep.a);
98084                    Ct.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p);
98085                    St.SubVV(this.m_sweep.c, this.m_xf.p, this.m_xf.p);
98086                  }
98087                  ShouldCollide(e) {
98088                    return (this.m_type !== t.b2BodyType.b2_staticBody || e.m_type !== t.b2BodyType.b2_staticBody) && this.ShouldCollideConnected(e);
98089                  }
98090                  ShouldCollideConnected(t) {
98091                    for (let e = this.m_jointList; e; e = e.next) if (e.other === t && !e.joint.m_collideConnected) return !1;
98092                    return !0;
98093                  }
98094                  Advance(t) {
98095                    this.m_sweep.Advance(t);
98096                    this.m_sweep.c.Copy(this.m_sweep.c0);
98097                    this.m_sweep.a = this.m_sweep.a0;
98098                    this.m_xf.q.SetAngle(this.m_sweep.a);
98099                    Ct.MulRV(this.m_xf.q, this.m_sweep.localCenter, this.m_xf.p);
98100                    St.SubVV(this.m_sweep.c, this.m_xf.p, this.m_xf.p);
98101                  }
98102                  GetControllerList() {
98103                    return this.m_controllerList;
98104                  }
98105                  GetControllerCount() {
98106                    return this.m_controllerCount;
98107                  }
98108                }
98109                rs.CreateFixtureShapeDensity_s_def = new es;
98110                rs.SetMassData_s_oldCenter = new St;
98111                rs.ResetMassData_s_localCenter = new St;
98112                rs.ResetMassData_s_oldCenter = new St;
98113                rs.ResetMassData_s_massData = new qi;
98114                rs.SynchronizeFixtures_s_xf1 = new xt;
98115                rs.SynchronizeFixtures_s_displacement = new St;
98116                !function(t) {
98117                  t[t.e_unknownJoint = 0] = "e_unknownJoint";
98118                  t[t.e_revoluteJoint = 1] = "e_revoluteJoint";
98119                  t[t.e_prismaticJoint = 2] = "e_prismaticJoint";
98120                  t[t.e_distanceJoint = 3] = "e_distanceJoint";
98121                  t[t.e_pulleyJoint = 4] = "e_pulleyJoint";
98122                  t[t.e_mouseJoint = 5] = "e_mouseJoint";
98123                  t[t.e_gearJoint = 6] = "e_gearJoint";
98124                  t[t.e_wheelJoint = 7] = "e_wheelJoint";
98125                  t[t.e_weldJoint = 8] = "e_weldJoint";
98126                  t[t.e_frictionJoint = 9] = "e_frictionJoint";
98127                  t[t.e_ropeJoint = 10] = "e_ropeJoint";
98128                  t[t.e_motorJoint = 11] = "e_motorJoint";
98129                  t[t.e_areaJoint = 12] = "e_areaJoint";
98130                }(t.b2JointType || (t.b2JointType = {}));
98131                !function(t) {
98132                  t[t.e_inactiveLimit = 0] = "e_inactiveLimit";
98133                  t[t.e_atLowerLimit = 1] = "e_atLowerLimit";
98134                  t[t.e_atUpperLimit = 2] = "e_atUpperLimit";
98135                  t[t.e_equalLimits = 3] = "e_equalLimits";
98136                }(t.b2LimitState || (t.b2LimitState = {}));
98137                class os {
98138                  constructor() {
98139                    this.linear = new St;
98140                    this.angularA = 0;
98141                    this.angularB = 0;
98142                  }
98143                  SetZero() {
98144                    this.linear.SetZero();
98145                    this.angularA = 0;
98146                    this.angularB = 0;
98147                    return this;
98148                  }
98149                  Set(t, e, i) {
98150                    this.linear.Copy(t);
98151                    this.angularA = e;
98152                    this.angularB = i;
98153                    return this;
98154                  }
98155                }
98156                class as {
98157                  constructor(t) {
98158                    this._other = null;
98159                    this.prev = null;
98160                    this.next = null;
98161                    this.joint = t;
98162                  }
98163                  get other() {
98164                    if (null === this._other) throw new Error;
98165                    return this._other;
98166                  }
98167                  set other(t) {
98168                    if (null !== this._other) throw new Error;
98169                    this._other = t;
98170                  }
98171                  Reset() {
98172                    this._other = null;
98173                    this.prev = null;
98174                    this.next = null;
98175                  }
98176                }
98177                class ls {
98178                  constructor(e) {
98179                    this.type = t.b2JointType.e_unknownJoint;
98180                    this.userData = null;
98181                    this.collideConnected = !1;
98182                    this.type = e;
98183                  }
98184                }
98185                class hs {
98186                  constructor(e) {
98187                    this.m_type = t.b2JointType.e_unknownJoint;
98188                    this.m_prev = null;
98189                    this.m_next = null;
98190                    this.m_edgeA = new as(this);
98191                    this.m_edgeB = new as(this);
98192                    this.m_index = 0;
98193                    this.m_islandFlag = !1;
98194                    this.m_collideConnected = !1;
98195                    this.m_userData = null;
98196                    this.m_type = e.type;
98197                    this.m_edgeA.other = e.bodyB;
98198                    this.m_edgeB.other = e.bodyA;
98199                    this.m_bodyA = e.bodyA;
98200                    this.m_bodyB = e.bodyB;
98201                    this.m_collideConnected = i(e.collideConnected, !1);
98202                    this.m_userData = i(e.userData, null);
98203                  }
98204                  GetType() {
98205                    return this.m_type;
98206                  }
98207                  GetBodyA() {
98208                    return this.m_bodyA;
98209                  }
98210                  GetBodyB() {
98211                    return this.m_bodyB;
98212                  }
98213                  GetNext() {
98214                    return this.m_next;
98215                  }
98216                  GetUserData() {
98217                    return this.m_userData;
98218                  }
98219                  SetUserData(t) {
98220                    this.m_userData = t;
98221                  }
98222                  IsActive() {
98223                    return this.m_bodyA.IsActive() && this.m_bodyB.IsActive();
98224                  }
98225                  GetCollideConnected() {
98226                    return this.m_collideConnected;
98227                  }
98228                  Dump(t) {
98229                    t("// Dump is not supported for this joint type.\n");
98230                  }
98231                  ShiftOrigin(t) {}
98232                }
98233                class cs extends ls {
98234                  constructor() {
98235                    super(t.b2JointType.e_distanceJoint);
98236                    this.localAnchorA = new St;
98237                    this.localAnchorB = new St;
98238                    this.length = 1;
98239                    this.frequencyHz = 0;
98240                    this.dampingRatio = 0;
98241                  }
98242                  Initialize(t, e, i, s) {
98243                    this.bodyA = t;
98244                    this.bodyB = e;
98245                    this.bodyA.GetLocalPoint(i, this.localAnchorA);
98246                    this.bodyB.GetLocalPoint(s, this.localAnchorB);
98247                    this.length = St.DistanceVV(i, s);
98248                    this.frequencyHz = 0;
98249                    this.dampingRatio = 0;
98250                  }
98251                }
98252                class us extends hs {
98253                  constructor(t) {
98254                    super(t);
98255                    this.m_frequencyHz = 0;
98256                    this.m_dampingRatio = 0;
98257                    this.m_bias = 0;
98258                    this.m_localAnchorA = new St;
98259                    this.m_localAnchorB = new St;
98260                    this.m_gamma = 0;
98261                    this.m_impulse = 0;
98262                    this.m_length = 0;
98263                    this.m_indexA = 0;
98264                    this.m_indexB = 0;
98265                    this.m_u = new St;
98266                    this.m_rA = new St;
98267                    this.m_rB = new St;
98268                    this.m_localCenterA = new St;
98269                    this.m_localCenterB = new St;
98270                    this.m_invMassA = 0;
98271                    this.m_invMassB = 0;
98272                    this.m_invIA = 0;
98273                    this.m_invIB = 0;
98274                    this.m_mass = 0;
98275                    this.m_qA = new Ct;
98276                    this.m_qB = new Ct;
98277                    this.m_lalcA = new St;
98278                    this.m_lalcB = new St;
98279                    this.m_frequencyHz = i(t.frequencyHz, 0);
98280                    this.m_dampingRatio = i(t.dampingRatio, 0);
98281                    this.m_localAnchorA.Copy(t.localAnchorA);
98282                    this.m_localAnchorB.Copy(t.localAnchorB);
98283                    this.m_length = t.length;
98284                  }
98285                  GetAnchorA(t) {
98286                    return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t);
98287                  }
98288                  GetAnchorB(t) {
98289                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
98290                  }
98291                  GetReactionForce(t, e) {
98292                    e.x = t * this.m_impulse * this.m_u.x;
98293                    e.y = t * this.m_impulse * this.m_u.y;
98294                    return e;
98295                  }
98296                  GetReactionTorque(t) {
98297                    return 0;
98298                  }
98299                  GetLocalAnchorA() {
98300                    return this.m_localAnchorA;
98301                  }
98302                  GetLocalAnchorB() {
98303                    return this.m_localAnchorB;
98304                  }
98305                  SetLength(t) {
98306                    this.m_length = t;
98307                  }
98308                  Length() {
98309                    return this.m_length;
98310                  }
98311                  SetFrequency(t) {
98312                    this.m_frequencyHz = t;
98313                  }
98314                  GetFrequency() {
98315                    return this.m_frequencyHz;
98316                  }
98317                  SetDampingRatio(t) {
98318                    this.m_dampingRatio = t;
98319                  }
98320                  GetDampingRatio() {
98321                    return this.m_dampingRatio;
98322                  }
98323                  Dump(t) {
98324                    const e = this.m_bodyA.m_islandIndex;
98325                    const i = this.m_bodyB.m_islandIndex;
98326                    t("  const jd: b2DistanceJointDef = new b2DistanceJointDef();\n");
98327                    t("  jd.bodyA = bodies[%d];\n", e);
98328                    t("  jd.bodyB = bodies[%d];\n", i);
98329                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
98330                    t("  jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y);
98331                    t("  jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y);
98332                    t("  jd.length = %.15f;\n", this.m_length);
98333                    t("  jd.frequencyHz = %.15f;\n", this.m_frequencyHz);
98334                    t("  jd.dampingRatio = %.15f;\n", this.m_dampingRatio);
98335                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
98336                  }
98337                  InitVelocityConstraints(t) {
98338                    this.m_indexA = this.m_bodyA.m_islandIndex;
98339                    this.m_indexB = this.m_bodyB.m_islandIndex;
98340                    this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);
98341                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
98342                    this.m_invMassA = this.m_bodyA.m_invMass;
98343                    this.m_invMassB = this.m_bodyB.m_invMass;
98344                    this.m_invIA = this.m_bodyA.m_invI;
98345                    this.m_invIB = this.m_bodyB.m_invI;
98346                    const e = t.positions[this.m_indexA].c;
98347                    const i = t.positions[this.m_indexA].a;
98348                    const s = t.velocities[this.m_indexA].v;
98349                    let n = t.velocities[this.m_indexA].w;
98350                    const r = t.positions[this.m_indexB].c;
98351                    const a = t.positions[this.m_indexB].a;
98352                    const l = t.velocities[this.m_indexB].v;
98353                    let h = t.velocities[this.m_indexB].w;
98354                    const c = this.m_qA.SetAngle(i), _ = this.m_qB.SetAngle(a);
98355                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
98356                    Ct.MulRV(c, this.m_lalcA, this.m_rA);
98357                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
98358                    Ct.MulRV(_, this.m_lalcB, this.m_rB);
98359                    this.m_u.x = r.x + this.m_rB.x - e.x - this.m_rA.x;
98360                    this.m_u.y = r.y + this.m_rB.y - e.y - this.m_rA.y;
98361                    const d = this.m_u.Length();
98362                    d > u ? this.m_u.SelfMul(1 / d) : this.m_u.SetZero();
98363                    const p = St.CrossVV(this.m_rA, this.m_u);
98364                    const m = St.CrossVV(this.m_rB, this.m_u);
98365                    let f = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m;
98366                    this.m_mass = 0 !== f ? 1 / f : 0;
98367                    if (this.m_frequencyHz > 0) {
98368                      const e = d - this.m_length;
98369                      const i = 2 * o * this.m_frequencyHz;
98370                      const s = 2 * this.m_mass * this.m_dampingRatio * i;
98371                      const n = this.m_mass * i * i;
98372                      const r = t.step.dt;
98373                      this.m_gamma = r * (s + r * n);
98374                      this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0;
98375                      this.m_bias = e * r * n * this.m_gamma;
98376                      f += this.m_gamma;
98377                      this.m_mass = 0 !== f ? 1 / f : 0;
98378                    } else {
98379                      this.m_gamma = 0;
98380                      this.m_bias = 0;
98381                    }
98382                    if (t.step.warmStarting) {
98383                      this.m_impulse *= t.step.dtRatio;
98384                      const e = St.MulSV(this.m_impulse, this.m_u, us.InitVelocityConstraints_s_P);
98385                      s.SelfMulSub(this.m_invMassA, e);
98386                      n -= this.m_invIA * St.CrossVV(this.m_rA, e);
98387                      l.SelfMulAdd(this.m_invMassB, e);
98388                      h += this.m_invIB * St.CrossVV(this.m_rB, e);
98389                    } else this.m_impulse = 0;
98390                    t.velocities[this.m_indexA].w = n;
98391                    t.velocities[this.m_indexB].w = h;
98392                  }
98393                  SolveVelocityConstraints(t) {
98394                    const e = t.velocities[this.m_indexA].v;
98395                    let i = t.velocities[this.m_indexA].w;
98396                    const s = t.velocities[this.m_indexB].v;
98397                    let n = t.velocities[this.m_indexB].w;
98398                    const r = St.AddVCrossSV(e, i, this.m_rA, us.SolveVelocityConstraints_s_vpA);
98399                    const o = St.AddVCrossSV(s, n, this.m_rB, us.SolveVelocityConstraints_s_vpB);
98400                    const a = St.DotVV(this.m_u, St.SubVV(o, r, St.s_t0));
98401                    const l = -this.m_mass * (a + this.m_bias + this.m_gamma * this.m_impulse);
98402                    this.m_impulse += l;
98403                    const h = St.MulSV(l, this.m_u, us.SolveVelocityConstraints_s_P);
98404                    e.SelfMulSub(this.m_invMassA, h);
98405                    i -= this.m_invIA * St.CrossVV(this.m_rA, h);
98406                    s.SelfMulAdd(this.m_invMassB, h);
98407                    n += this.m_invIB * St.CrossVV(this.m_rB, h);
98408                    t.velocities[this.m_indexA].w = i;
98409                    t.velocities[this.m_indexB].w = n;
98410                  }
98411                  SolvePositionConstraints(t) {
98412                    if (this.m_frequencyHz > 0) return !0;
98413                    const e = t.positions[this.m_indexA].c;
98414                    let i = t.positions[this.m_indexA].a;
98415                    const s = t.positions[this.m_indexB].c;
98416                    let n = t.positions[this.m_indexB].a;
98417                    const r = this.m_qA.SetAngle(i), o = this.m_qB.SetAngle(n);
98418                    const a = Ct.MulRV(r, this.m_lalcA, this.m_rA);
98419                    const l = Ct.MulRV(o, this.m_lalcB, this.m_rB);
98420                    const h = this.m_u;
98421                    h.x = s.x + l.x - e.x - a.x;
98422                    h.y = s.y + l.y - e.y - a.y;
98423                    let c = this.m_u.Normalize() - this.m_length;
98424                    c = it(c, -g, g);
98425                    const _ = -this.m_mass * c;
98426                    const d = St.MulSV(_, h, us.SolvePositionConstraints_s_P);
98427                    e.SelfMulSub(this.m_invMassA, d);
98428                    i -= this.m_invIA * St.CrossVV(a, d);
98429                    s.SelfMulAdd(this.m_invMassB, d);
98430                    n += this.m_invIB * St.CrossVV(l, d);
98431                    t.positions[this.m_indexA].a = i;
98432                    t.positions[this.m_indexB].a = n;
98433                    return $(c) < u;
98434                  }
98435                }
98436                us.InitVelocityConstraints_s_P = new St;
98437                us.SolveVelocityConstraints_s_vpA = new St;
98438                us.SolveVelocityConstraints_s_vpB = new St;
98439                us.SolveVelocityConstraints_s_P = new St;
98440                us.SolvePositionConstraints_s_P = new St;
98441                class _s extends ls {
98442                  constructor() {
98443                    super(t.b2JointType.e_areaJoint);
98444                    this.bodies = [];
98445                    this.frequencyHz = 0;
98446                    this.dampingRatio = 0;
98447                  }
98448                  AddBody(t) {
98449                    this.bodies.push(t);
98450                    1 === this.bodies.length ? this.bodyA = t : 2 === this.bodies.length && (this.bodyB = t);
98451                  }
98452                }
98453                class ds extends hs {
98454                  constructor(t) {
98455                    super(t);
98456                    this.m_frequencyHz = 0;
98457                    this.m_dampingRatio = 0;
98458                    this.m_impulse = 0;
98459                    this.m_targetArea = 0;
98460                    this.m_delta = new St;
98461                    this.m_bodies = t.bodies;
98462                    this.m_frequencyHz = i(t.frequencyHz, 0);
98463                    this.m_dampingRatio = i(t.dampingRatio, 0);
98464                    this.m_targetLengths = K(t.bodies.length);
98465                    this.m_normals = St.MakeArray(t.bodies.length);
98466                    this.m_joints = [];
98467                    this.m_deltas = St.MakeArray(t.bodies.length);
98468                    const e = new cs;
98469                    e.frequencyHz = this.m_frequencyHz;
98470                    e.dampingRatio = this.m_dampingRatio;
98471                    this.m_targetArea = 0;
98472                    for (let t = 0; t < this.m_bodies.length; ++t) {
98473                      const i = this.m_bodies[t];
98474                      const s = this.m_bodies[(t + 1) % this.m_bodies.length];
98475                      const n = i.GetWorldCenter();
98476                      const r = s.GetWorldCenter();
98477                      this.m_targetLengths[t] = St.DistanceVV(n, r);
98478                      this.m_targetArea += St.CrossVV(n, r);
98479                      e.Initialize(i, s, n, r);
98480                      this.m_joints[t] = i.GetWorld().CreateJoint(e);
98481                    }
98482                    this.m_targetArea *= .5;
98483                  }
98484                  GetAnchorA(t) {
98485                    return t;
98486                  }
98487                  GetAnchorB(t) {
98488                    return t;
98489                  }
98490                  GetReactionForce(t, e) {
98491                    return e;
98492                  }
98493                  GetReactionTorque(t) {
98494                    return 0;
98495                  }
98496                  SetFrequency(t) {
98497                    this.m_frequencyHz = t;
98498                    for (let e = 0; e < this.m_joints.length; ++e) this.m_joints[e].SetFrequency(t);
98499                  }
98500                  GetFrequency() {
98501                    return this.m_frequencyHz;
98502                  }
98503                  SetDampingRatio(t) {
98504                    this.m_dampingRatio = t;
98505                    for (let e = 0; e < this.m_joints.length; ++e) this.m_joints[e].SetDampingRatio(t);
98506                  }
98507                  GetDampingRatio() {
98508                    return this.m_dampingRatio;
98509                  }
98510                  Dump(t) {
98511                    t("Area joint dumping is not supported.\n");
98512                  }
98513                  InitVelocityConstraints(t) {
98514                    for (let e = 0; e < this.m_bodies.length; ++e) {
98515                      const i = this.m_bodies[(e + this.m_bodies.length - 1) % this.m_bodies.length];
98516                      const s = this.m_bodies[(e + 1) % this.m_bodies.length];
98517                      const n = t.positions[i.m_islandIndex].c;
98518                      const r = t.positions[s.m_islandIndex].c;
98519                      const o = this.m_deltas[e];
98520                      St.SubVV(r, n, o);
98521                    }
98522                    if (t.step.warmStarting) {
98523                      this.m_impulse *= t.step.dtRatio;
98524                      for (let e = 0; e < this.m_bodies.length; ++e) {
98525                        const i = this.m_bodies[e];
98526                        const s = t.velocities[i.m_islandIndex].v;
98527                        const n = this.m_deltas[e];
98528                        s.x += i.m_invMass * n.y * .5 * this.m_impulse;
98529                        s.y += i.m_invMass * -n.x * .5 * this.m_impulse;
98530                      }
98531                    } else this.m_impulse = 0;
98532                  }
98533                  SolveVelocityConstraints(t) {
98534                    let e = 0;
98535                    let i = 0;
98536                    for (let s = 0; s < this.m_bodies.length; ++s) {
98537                      const n = this.m_bodies[s];
98538                      const r = t.velocities[n.m_islandIndex].v;
98539                      const o = this.m_deltas[s];
98540                      e += o.LengthSquared() / n.GetMass();
98541                      i += St.CrossVV(r, o);
98542                    }
98543                    const s = -2 * i / e;
98544                    this.m_impulse += s;
98545                    for (let e = 0; e < this.m_bodies.length; ++e) {
98546                      const i = this.m_bodies[e];
98547                      const n = t.velocities[i.m_islandIndex].v;
98548                      const r = this.m_deltas[e];
98549                      n.x += i.m_invMass * r.y * .5 * s;
98550                      n.y += i.m_invMass * -r.x * .5 * s;
98551                    }
98552                  }
98553                  SolvePositionConstraints(t) {
98554                    let e = 0;
98555                    let i = 0;
98556                    for (let s = 0; s < this.m_bodies.length; ++s) {
98557                      const r = this.m_bodies[s];
98558                      const o = this.m_bodies[(s + 1) % this.m_bodies.length];
98559                      const a = t.positions[r.m_islandIndex].c;
98560                      const l = t.positions[o.m_islandIndex].c;
98561                      const h = St.SubVV(l, a, this.m_delta);
98562                      let c = h.Length();
98563                      c < n && (c = 1);
98564                      this.m_normals[s].x = h.y / c;
98565                      this.m_normals[s].y = -h.x / c;
98566                      e += c;
98567                      i += St.CrossVV(a, l);
98568                    }
98569                    i *= .5;
98570                    const s = .5 * (this.m_targetArea - i) / e;
98571                    let r = !0;
98572                    for (let e = 0; e < this.m_bodies.length; ++e) {
98573                      const i = this.m_bodies[e];
98574                      const n = t.positions[i.m_islandIndex].c;
98575                      const o = (e + 1) % this.m_bodies.length;
98576                      const a = St.AddVV(this.m_normals[e], this.m_normals[o], this.m_delta);
98577                      a.SelfMul(s);
98578                      const l = a.LengthSquared();
98579                      l > rt(g) && a.SelfMul(g / at(l));
98580                      l > rt(u) && (r = !1);
98581                      n.x += a.x;
98582                      n.y += a.y;
98583                    }
98584                    return r;
98585                  }
98586                }
98587                class ps extends ls {
98588                  constructor() {
98589                    super(t.b2JointType.e_frictionJoint);
98590                    this.localAnchorA = new St;
98591                    this.localAnchorB = new St;
98592                    this.maxForce = 0;
98593                    this.maxTorque = 0;
98594                  }
98595                  Initialize(t, e, i) {
98596                    this.bodyA = t;
98597                    this.bodyB = e;
98598                    this.bodyA.GetLocalPoint(i, this.localAnchorA);
98599                    this.bodyB.GetLocalPoint(i, this.localAnchorB);
98600                  }
98601                }
98602                class ms extends hs {
98603                  constructor(t) {
98604                    super(t);
98605                    this.m_localAnchorA = new St;
98606                    this.m_localAnchorB = new St;
98607                    this.m_linearImpulse = new St;
98608                    this.m_angularImpulse = 0;
98609                    this.m_maxForce = 0;
98610                    this.m_maxTorque = 0;
98611                    this.m_indexA = 0;
98612                    this.m_indexB = 0;
98613                    this.m_rA = new St;
98614                    this.m_rB = new St;
98615                    this.m_localCenterA = new St;
98616                    this.m_localCenterB = new St;
98617                    this.m_invMassA = 0;
98618                    this.m_invMassB = 0;
98619                    this.m_invIA = 0;
98620                    this.m_invIB = 0;
98621                    this.m_linearMass = new vt;
98622                    this.m_angularMass = 0;
98623                    this.m_qA = new Ct;
98624                    this.m_qB = new Ct;
98625                    this.m_lalcA = new St;
98626                    this.m_lalcB = new St;
98627                    this.m_K = new vt;
98628                    this.m_localAnchorA.Copy(t.localAnchorA);
98629                    this.m_localAnchorB.Copy(t.localAnchorB);
98630                    this.m_linearImpulse.SetZero();
98631                    this.m_maxForce = i(t.maxForce, 0);
98632                    this.m_maxTorque = i(t.maxTorque, 0);
98633                    this.m_linearMass.SetZero();
98634                  }
98635                  InitVelocityConstraints(t) {
98636                    this.m_indexA = this.m_bodyA.m_islandIndex;
98637                    this.m_indexB = this.m_bodyB.m_islandIndex;
98638                    this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);
98639                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
98640                    this.m_invMassA = this.m_bodyA.m_invMass;
98641                    this.m_invMassB = this.m_bodyB.m_invMass;
98642                    this.m_invIA = this.m_bodyA.m_invI;
98643                    this.m_invIB = this.m_bodyB.m_invI;
98644                    const e = t.positions[this.m_indexA].a;
98645                    const i = t.velocities[this.m_indexA].v;
98646                    let s = t.velocities[this.m_indexA].w;
98647                    const n = t.positions[this.m_indexB].a;
98648                    const r = t.velocities[this.m_indexB].v;
98649                    let o = t.velocities[this.m_indexB].w;
98650                    const a = this.m_qA.SetAngle(e), l = this.m_qB.SetAngle(n);
98651                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
98652                    const h = Ct.MulRV(a, this.m_lalcA, this.m_rA);
98653                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
98654                    const c = Ct.MulRV(l, this.m_lalcB, this.m_rB);
98655                    const u = this.m_invMassA, _ = this.m_invMassB;
98656                    const d = this.m_invIA, p = this.m_invIB;
98657                    const m = this.m_K;
98658                    m.ex.x = u + _ + d * h.y * h.y + p * c.y * c.y;
98659                    m.ex.y = -d * h.x * h.y - p * c.x * c.y;
98660                    m.ey.x = m.ex.y;
98661                    m.ey.y = u + _ + d * h.x * h.x + p * c.x * c.x;
98662                    m.GetInverse(this.m_linearMass);
98663                    this.m_angularMass = d + p;
98664                    this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass);
98665                    if (t.step.warmStarting) {
98666                      this.m_linearImpulse.SelfMul(t.step.dtRatio);
98667                      this.m_angularImpulse *= t.step.dtRatio;
98668                      const e = this.m_linearImpulse;
98669                      i.SelfMulSub(u, e);
98670                      s -= d * (St.CrossVV(this.m_rA, e) + this.m_angularImpulse);
98671                      r.SelfMulAdd(_, e);
98672                      o += p * (St.CrossVV(this.m_rB, e) + this.m_angularImpulse);
98673                    } else {
98674                      this.m_linearImpulse.SetZero();
98675                      this.m_angularImpulse = 0;
98676                    }
98677                    t.velocities[this.m_indexA].w = s;
98678                    t.velocities[this.m_indexB].w = o;
98679                  }
98680                  SolveVelocityConstraints(t) {
98681                    const e = t.velocities[this.m_indexA].v;
98682                    let i = t.velocities[this.m_indexA].w;
98683                    const s = t.velocities[this.m_indexB].v;
98684                    let n = t.velocities[this.m_indexB].w;
98685                    const r = this.m_invMassA, o = this.m_invMassB;
98686                    const a = this.m_invIA, l = this.m_invIB;
98687                    const h = t.step.dt;
98688                    {
98689                      const t = n - i;
98690                      let e = -this.m_angularMass * t;
98691                      const s = this.m_angularImpulse;
98692                      const r = h * this.m_maxTorque;
98693                      this.m_angularImpulse = it(this.m_angularImpulse + e, -r, r);
98694                      e = this.m_angularImpulse - s;
98695                      i -= a * e;
98696                      n += l * e;
98697                    }
98698                    {
98699                      const t = St.SubVV(St.AddVCrossSV(s, n, this.m_rB, St.s_t0), St.AddVCrossSV(e, i, this.m_rA, St.s_t1), ms.SolveVelocityConstraints_s_Cdot_v2);
98700                      const c = vt.MulMV(this.m_linearMass, t, ms.SolveVelocityConstraints_s_impulseV).SelfNeg();
98701                      const u = ms.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse);
98702                      this.m_linearImpulse.SelfAdd(c);
98703                      const _ = h * this.m_maxForce;
98704                      if (this.m_linearImpulse.LengthSquared() > _ * _) {
98705                        this.m_linearImpulse.Normalize();
98706                        this.m_linearImpulse.SelfMul(_);
98707                      }
98708                      St.SubVV(this.m_linearImpulse, u, c);
98709                      e.SelfMulSub(r, c);
98710                      i -= a * St.CrossVV(this.m_rA, c);
98711                      s.SelfMulAdd(o, c);
98712                      n += l * St.CrossVV(this.m_rB, c);
98713                    }
98714                    t.velocities[this.m_indexA].w = i;
98715                    t.velocities[this.m_indexB].w = n;
98716                  }
98717                  SolvePositionConstraints(t) {
98718                    return !0;
98719                  }
98720                  GetAnchorA(t) {
98721                    return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t);
98722                  }
98723                  GetAnchorB(t) {
98724                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
98725                  }
98726                  GetReactionForce(t, e) {
98727                    e.x = t * this.m_linearImpulse.x;
98728                    e.y = t * this.m_linearImpulse.y;
98729                    return e;
98730                  }
98731                  GetReactionTorque(t) {
98732                    return t * this.m_angularImpulse;
98733                  }
98734                  GetLocalAnchorA() {
98735                    return this.m_localAnchorA;
98736                  }
98737                  GetLocalAnchorB() {
98738                    return this.m_localAnchorB;
98739                  }
98740                  SetMaxForce(t) {
98741                    this.m_maxForce = t;
98742                  }
98743                  GetMaxForce() {
98744                    return this.m_maxForce;
98745                  }
98746                  SetMaxTorque(t) {
98747                    this.m_maxTorque = t;
98748                  }
98749                  GetMaxTorque() {
98750                    return this.m_maxTorque;
98751                  }
98752                  Dump(t) {
98753                    const e = this.m_bodyA.m_islandIndex;
98754                    const i = this.m_bodyB.m_islandIndex;
98755                    t("  const jd: b2FrictionJointDef = new b2FrictionJointDef();\n");
98756                    t("  jd.bodyA = bodies[%d];\n", e);
98757                    t("  jd.bodyB = bodies[%d];\n", i);
98758                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
98759                    t("  jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y);
98760                    t("  jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y);
98761                    t("  jd.maxForce = %.15f;\n", this.m_maxForce);
98762                    t("  jd.maxTorque = %.15f;\n", this.m_maxTorque);
98763                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
98764                  }
98765                }
98766                ms.SolveVelocityConstraints_s_Cdot_v2 = new St;
98767                ms.SolveVelocityConstraints_s_impulseV = new St;
98768                ms.SolveVelocityConstraints_s_oldImpulseV = new St;
98769                class fs extends ls {
98770                  constructor() {
98771                    super(t.b2JointType.e_gearJoint);
98772                    this.ratio = 1;
98773                  }
98774                }
98775                class gs extends hs {
98776                  constructor(e) {
98777                    super(e);
98778                    this.m_typeA = t.b2JointType.e_unknownJoint;
98779                    this.m_typeB = t.b2JointType.e_unknownJoint;
98780                    this.m_localAnchorA = new St;
98781                    this.m_localAnchorB = new St;
98782                    this.m_localAnchorC = new St;
98783                    this.m_localAnchorD = new St;
98784                    this.m_localAxisC = new St;
98785                    this.m_localAxisD = new St;
98786                    this.m_referenceAngleA = 0;
98787                    this.m_referenceAngleB = 0;
98788                    this.m_constant = 0;
98789                    this.m_ratio = 0;
98790                    this.m_impulse = 0;
98791                    this.m_indexA = 0;
98792                    this.m_indexB = 0;
98793                    this.m_indexC = 0;
98794                    this.m_indexD = 0;
98795                    this.m_lcA = new St;
98796                    this.m_lcB = new St;
98797                    this.m_lcC = new St;
98798                    this.m_lcD = new St;
98799                    this.m_mA = 0;
98800                    this.m_mB = 0;
98801                    this.m_mC = 0;
98802                    this.m_mD = 0;
98803                    this.m_iA = 0;
98804                    this.m_iB = 0;
98805                    this.m_iC = 0;
98806                    this.m_iD = 0;
98807                    this.m_JvAC = new St;
98808                    this.m_JvBD = new St;
98809                    this.m_JwA = 0;
98810                    this.m_JwB = 0;
98811                    this.m_JwC = 0;
98812                    this.m_JwD = 0;
98813                    this.m_mass = 0;
98814                    this.m_qA = new Ct;
98815                    this.m_qB = new Ct;
98816                    this.m_qC = new Ct;
98817                    this.m_qD = new Ct;
98818                    this.m_lalcA = new St;
98819                    this.m_lalcB = new St;
98820                    this.m_lalcC = new St;
98821                    this.m_lalcD = new St;
98822                    this.m_joint1 = e.joint1;
98823                    this.m_joint2 = e.joint2;
98824                    this.m_typeA = this.m_joint1.GetType();
98825                    this.m_typeB = this.m_joint2.GetType();
98826                    let s, n;
98827                    this.m_bodyC = this.m_joint1.GetBodyA();
98828                    this.m_bodyA = this.m_joint1.GetBodyB();
98829                    const r = this.m_bodyA.m_xf;
98830                    const o = this.m_bodyA.m_sweep.a;
98831                    const a = this.m_bodyC.m_xf;
98832                    const l = this.m_bodyC.m_sweep.a;
98833                    if (this.m_typeA === t.b2JointType.e_revoluteJoint) {
98834                      const t = e.joint1;
98835                      this.m_localAnchorC.Copy(t.m_localAnchorA);
98836                      this.m_localAnchorA.Copy(t.m_localAnchorB);
98837                      this.m_referenceAngleA = t.m_referenceAngle;
98838                      this.m_localAxisC.SetZero();
98839                      s = o - l - this.m_referenceAngleA;
98840                    } else {
98841                      const t = e.joint1;
98842                      this.m_localAnchorC.Copy(t.m_localAnchorA);
98843                      this.m_localAnchorA.Copy(t.m_localAnchorB);
98844                      this.m_referenceAngleA = t.m_referenceAngle;
98845                      this.m_localAxisC.Copy(t.m_localXAxisA);
98846                      const i = this.m_localAnchorC;
98847                      const n = Ct.MulTRV(a.q, St.AddVV(Ct.MulRV(r.q, this.m_localAnchorA, St.s_t0), St.SubVV(r.p, a.p, St.s_t1), St.s_t0), St.s_t0);
98848                      s = St.DotVV(St.SubVV(n, i, St.s_t0), this.m_localAxisC);
98849                    }
98850                    this.m_bodyD = this.m_joint2.GetBodyA();
98851                    this.m_bodyB = this.m_joint2.GetBodyB();
98852                    const h = this.m_bodyB.m_xf;
98853                    const c = this.m_bodyB.m_sweep.a;
98854                    const u = this.m_bodyD.m_xf;
98855                    const _ = this.m_bodyD.m_sweep.a;
98856                    if (this.m_typeB === t.b2JointType.e_revoluteJoint) {
98857                      const t = e.joint2;
98858                      this.m_localAnchorD.Copy(t.m_localAnchorA);
98859                      this.m_localAnchorB.Copy(t.m_localAnchorB);
98860                      this.m_referenceAngleB = t.m_referenceAngle;
98861                      this.m_localAxisD.SetZero();
98862                      n = c - _ - this.m_referenceAngleB;
98863                    } else {
98864                      const t = e.joint2;
98865                      this.m_localAnchorD.Copy(t.m_localAnchorA);
98866                      this.m_localAnchorB.Copy(t.m_localAnchorB);
98867                      this.m_referenceAngleB = t.m_referenceAngle;
98868                      this.m_localAxisD.Copy(t.m_localXAxisA);
98869                      const i = this.m_localAnchorD;
98870                      const s = Ct.MulTRV(u.q, St.AddVV(Ct.MulRV(h.q, this.m_localAnchorB, St.s_t0), St.SubVV(h.p, u.p, St.s_t1), St.s_t0), St.s_t0);
98871                      n = St.DotVV(St.SubVV(s, i, St.s_t0), this.m_localAxisD);
98872                    }
98873                    this.m_ratio = i(e.ratio, 1);
98874                    this.m_constant = s + this.m_ratio * n;
98875                    this.m_impulse = 0;
98876                  }
98877                  InitVelocityConstraints(e) {
98878                    this.m_indexA = this.m_bodyA.m_islandIndex;
98879                    this.m_indexB = this.m_bodyB.m_islandIndex;
98880                    this.m_indexC = this.m_bodyC.m_islandIndex;
98881                    this.m_indexD = this.m_bodyD.m_islandIndex;
98882                    this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter);
98883                    this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter);
98884                    this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter);
98885                    this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter);
98886                    this.m_mA = this.m_bodyA.m_invMass;
98887                    this.m_mB = this.m_bodyB.m_invMass;
98888                    this.m_mC = this.m_bodyC.m_invMass;
98889                    this.m_mD = this.m_bodyD.m_invMass;
98890                    this.m_iA = this.m_bodyA.m_invI;
98891                    this.m_iB = this.m_bodyB.m_invI;
98892                    this.m_iC = this.m_bodyC.m_invI;
98893                    this.m_iD = this.m_bodyD.m_invI;
98894                    const i = e.positions[this.m_indexA].a;
98895                    const s = e.velocities[this.m_indexA].v;
98896                    let n = e.velocities[this.m_indexA].w;
98897                    const r = e.positions[this.m_indexB].a;
98898                    const o = e.velocities[this.m_indexB].v;
98899                    let a = e.velocities[this.m_indexB].w;
98900                    const l = e.positions[this.m_indexC].a;
98901                    const h = e.velocities[this.m_indexC].v;
98902                    let c = e.velocities[this.m_indexC].w;
98903                    const u = e.positions[this.m_indexD].a;
98904                    const _ = e.velocities[this.m_indexD].v;
98905                    let d = e.velocities[this.m_indexD].w;
98906                    const p = this.m_qA.SetAngle(i), m = this.m_qB.SetAngle(r), f = this.m_qC.SetAngle(l), g = this.m_qD.SetAngle(u);
98907                    this.m_mass = 0;
98908                    if (this.m_typeA === t.b2JointType.e_revoluteJoint) {
98909                      this.m_JvAC.SetZero();
98910                      this.m_JwA = 1;
98911                      this.m_JwC = 1;
98912                      this.m_mass += this.m_iA + this.m_iC;
98913                    } else {
98914                      const t = Ct.MulRV(f, this.m_localAxisC, gs.InitVelocityConstraints_s_u);
98915                      St.SubVV(this.m_localAnchorC, this.m_lcC, this.m_lalcC);
98916                      const e = Ct.MulRV(f, this.m_lalcC, gs.InitVelocityConstraints_s_rC);
98917                      St.SubVV(this.m_localAnchorA, this.m_lcA, this.m_lalcA);
98918                      const i = Ct.MulRV(p, this.m_lalcA, gs.InitVelocityConstraints_s_rA);
98919                      this.m_JvAC.Copy(t);
98920                      this.m_JwC = St.CrossVV(e, t);
98921                      this.m_JwA = St.CrossVV(i, t);
98922                      this.m_mass += this.m_mC + this.m_mA + this.m_iC * this.m_JwC * this.m_JwC + this.m_iA * this.m_JwA * this.m_JwA;
98923                    }
98924                    if (this.m_typeB === t.b2JointType.e_revoluteJoint) {
98925                      this.m_JvBD.SetZero();
98926                      this.m_JwB = this.m_ratio;
98927                      this.m_JwD = this.m_ratio;
98928                      this.m_mass += this.m_ratio * this.m_ratio * (this.m_iB + this.m_iD);
98929                    } else {
98930                      const t = Ct.MulRV(g, this.m_localAxisD, gs.InitVelocityConstraints_s_u);
98931                      St.SubVV(this.m_localAnchorD, this.m_lcD, this.m_lalcD);
98932                      const e = Ct.MulRV(g, this.m_lalcD, gs.InitVelocityConstraints_s_rD);
98933                      St.SubVV(this.m_localAnchorB, this.m_lcB, this.m_lalcB);
98934                      const i = Ct.MulRV(m, this.m_lalcB, gs.InitVelocityConstraints_s_rB);
98935                      St.MulSV(this.m_ratio, t, this.m_JvBD);
98936                      this.m_JwD = this.m_ratio * St.CrossVV(e, t);
98937                      this.m_JwB = this.m_ratio * St.CrossVV(i, t);
98938                      this.m_mass += this.m_ratio * this.m_ratio * (this.m_mD + this.m_mB) + this.m_iD * this.m_JwD * this.m_JwD + this.m_iB * this.m_JwB * this.m_JwB;
98939                    }
98940                    this.m_mass = this.m_mass > 0 ? 1 / this.m_mass : 0;
98941                    if (e.step.warmStarting) {
98942                      s.SelfMulAdd(this.m_mA * this.m_impulse, this.m_JvAC);
98943                      n += this.m_iA * this.m_impulse * this.m_JwA;
98944                      o.SelfMulAdd(this.m_mB * this.m_impulse, this.m_JvBD);
98945                      a += this.m_iB * this.m_impulse * this.m_JwB;
98946                      h.SelfMulSub(this.m_mC * this.m_impulse, this.m_JvAC);
98947                      c -= this.m_iC * this.m_impulse * this.m_JwC;
98948                      _.SelfMulSub(this.m_mD * this.m_impulse, this.m_JvBD);
98949                      d -= this.m_iD * this.m_impulse * this.m_JwD;
98950                    } else this.m_impulse = 0;
98951                    e.velocities[this.m_indexA].w = n;
98952                    e.velocities[this.m_indexB].w = a;
98953                    e.velocities[this.m_indexC].w = c;
98954                    e.velocities[this.m_indexD].w = d;
98955                  }
98956                  SolveVelocityConstraints(t) {
98957                    const e = t.velocities[this.m_indexA].v;
98958                    let i = t.velocities[this.m_indexA].w;
98959                    const s = t.velocities[this.m_indexB].v;
98960                    let n = t.velocities[this.m_indexB].w;
98961                    const r = t.velocities[this.m_indexC].v;
98962                    let o = t.velocities[this.m_indexC].w;
98963                    const a = t.velocities[this.m_indexD].v;
98964                    let l = t.velocities[this.m_indexD].w;
98965                    let h = St.DotVV(this.m_JvAC, St.SubVV(e, r, St.s_t0)) + St.DotVV(this.m_JvBD, St.SubVV(s, a, St.s_t0));
98966                    h += this.m_JwA * i - this.m_JwC * o + (this.m_JwB * n - this.m_JwD * l);
98967                    const c = -this.m_mass * h;
98968                    this.m_impulse += c;
98969                    e.SelfMulAdd(this.m_mA * c, this.m_JvAC);
98970                    i += this.m_iA * c * this.m_JwA;
98971                    s.SelfMulAdd(this.m_mB * c, this.m_JvBD);
98972                    n += this.m_iB * c * this.m_JwB;
98973                    r.SelfMulSub(this.m_mC * c, this.m_JvAC);
98974                    o -= this.m_iC * c * this.m_JwC;
98975                    a.SelfMulSub(this.m_mD * c, this.m_JvBD);
98976                    l -= this.m_iD * c * this.m_JwD;
98977                    t.velocities[this.m_indexA].w = i;
98978                    t.velocities[this.m_indexB].w = n;
98979                    t.velocities[this.m_indexC].w = o;
98980                    t.velocities[this.m_indexD].w = l;
98981                  }
98982                  SolvePositionConstraints(e) {
98983                    const i = e.positions[this.m_indexA].c;
98984                    let s = e.positions[this.m_indexA].a;
98985                    const n = e.positions[this.m_indexB].c;
98986                    let r = e.positions[this.m_indexB].a;
98987                    const o = e.positions[this.m_indexC].c;
98988                    let a = e.positions[this.m_indexC].a;
98989                    const l = e.positions[this.m_indexD].c;
98990                    let h = e.positions[this.m_indexD].a;
98991                    const c = this.m_qA.SetAngle(s), _ = this.m_qB.SetAngle(r), d = this.m_qC.SetAngle(a), p = this.m_qD.SetAngle(h);
98992                    const m = 0;
98993                    let f, g;
98994                    const y = this.m_JvAC, b = this.m_JvBD;
98995                    let S, A, T, v;
98996                    let E = 0;
98997                    if (this.m_typeA === t.b2JointType.e_revoluteJoint) {
98998                      y.SetZero();
98999                      S = 1;
99000                      T = 1;
99001                      E += this.m_iA + this.m_iC;
99002                      f = s - a - this.m_referenceAngleA;
99003                    } else {
99004                      const t = Ct.MulRV(d, this.m_localAxisC, gs.SolvePositionConstraints_s_u);
99005                      const e = Ct.MulRV(d, this.m_lalcC, gs.SolvePositionConstraints_s_rC);
99006                      const s = Ct.MulRV(c, this.m_lalcA, gs.SolvePositionConstraints_s_rA);
99007                      y.Copy(t);
99008                      T = St.CrossVV(e, t);
99009                      S = St.CrossVV(s, t);
99010                      E += this.m_mC + this.m_mA + this.m_iC * T * T + this.m_iA * S * S;
99011                      const n = this.m_lalcC;
99012                      const r = Ct.MulTRV(d, St.AddVV(s, St.SubVV(i, o, St.s_t0), St.s_t0), St.s_t0);
99013                      f = St.DotVV(St.SubVV(r, n, St.s_t0), this.m_localAxisC);
99014                    }
99015                    if (this.m_typeB === t.b2JointType.e_revoluteJoint) {
99016                      b.SetZero();
99017                      A = this.m_ratio;
99018                      v = this.m_ratio;
99019                      E += this.m_ratio * this.m_ratio * (this.m_iB + this.m_iD);
99020                      g = r - h - this.m_referenceAngleB;
99021                    } else {
99022                      const t = Ct.MulRV(p, this.m_localAxisD, gs.SolvePositionConstraints_s_u);
99023                      const e = Ct.MulRV(p, this.m_lalcD, gs.SolvePositionConstraints_s_rD);
99024                      const i = Ct.MulRV(_, this.m_lalcB, gs.SolvePositionConstraints_s_rB);
99025                      St.MulSV(this.m_ratio, t, b);
99026                      v = this.m_ratio * St.CrossVV(e, t);
99027                      A = this.m_ratio * St.CrossVV(i, t);
99028                      E += this.m_ratio * this.m_ratio * (this.m_mD + this.m_mB) + this.m_iD * v * v + this.m_iB * A * A;
99029                      const s = this.m_lalcD;
99030                      const r = Ct.MulTRV(p, St.AddVV(i, St.SubVV(n, l, St.s_t0), St.s_t0), St.s_t0);
99031                      g = St.DotVV(St.SubVV(r, s, St.s_t0), this.m_localAxisD);
99032                    }
99033                    const C = f + this.m_ratio * g - this.m_constant;
99034                    let x = 0;
99035                    E > 0 && (x = -C / E);
99036                    i.SelfMulAdd(this.m_mA * x, y);
99037                    s += this.m_iA * x * S;
99038                    n.SelfMulAdd(this.m_mB * x, b);
99039                    r += this.m_iB * x * A;
99040                    o.SelfMulSub(this.m_mC * x, y);
99041                    a -= this.m_iC * x * T;
99042                    l.SelfMulSub(this.m_mD * x, b);
99043                    h -= this.m_iD * x * v;
99044                    e.positions[this.m_indexA].a = s;
99045                    e.positions[this.m_indexB].a = r;
99046                    e.positions[this.m_indexC].a = a;
99047                    e.positions[this.m_indexD].a = h;
99048                    return m < u;
99049                  }
99050                  GetAnchorA(t) {
99051                    return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t);
99052                  }
99053                  GetAnchorB(t) {
99054                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
99055                  }
99056                  GetReactionForce(t, e) {
99057                    return St.MulSV(t * this.m_impulse, this.m_JvAC, e);
99058                  }
99059                  GetReactionTorque(t) {
99060                    return t * this.m_impulse * this.m_JwA;
99061                  }
99062                  GetJoint1() {
99063                    return this.m_joint1;
99064                  }
99065                  GetJoint2() {
99066                    return this.m_joint2;
99067                  }
99068                  GetRatio() {
99069                    return this.m_ratio;
99070                  }
99071                  SetRatio(t) {
99072                    this.m_ratio = t;
99073                  }
99074                  Dump(t) {
99075                    const e = this.m_bodyA.m_islandIndex;
99076                    const i = this.m_bodyB.m_islandIndex;
99077                    const s = this.m_joint1.m_index;
99078                    const n = this.m_joint2.m_index;
99079                    t("  const jd: b2GearJointDef = new b2GearJointDef();\n");
99080                    t("  jd.bodyA = bodies[%d];\n", e);
99081                    t("  jd.bodyB = bodies[%d];\n", i);
99082                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
99083                    t("  jd.joint1 = joints[%d];\n", s);
99084                    t("  jd.joint2 = joints[%d];\n", n);
99085                    t("  jd.ratio = %.15f;\n", this.m_ratio);
99086                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
99087                  }
99088                }
99089                gs.InitVelocityConstraints_s_u = new St;
99090                gs.InitVelocityConstraints_s_rA = new St;
99091                gs.InitVelocityConstraints_s_rB = new St;
99092                gs.InitVelocityConstraints_s_rC = new St;
99093                gs.InitVelocityConstraints_s_rD = new St;
99094                gs.SolvePositionConstraints_s_u = new St;
99095                gs.SolvePositionConstraints_s_rA = new St;
99096                gs.SolvePositionConstraints_s_rB = new St;
99097                gs.SolvePositionConstraints_s_rC = new St;
99098                gs.SolvePositionConstraints_s_rD = new St;
99099                class ys extends ls {
99100                  constructor() {
99101                    super(t.b2JointType.e_motorJoint);
99102                    this.linearOffset = new St(0, 0);
99103                    this.angularOffset = 0;
99104                    this.maxForce = 1;
99105                    this.maxTorque = 1;
99106                    this.correctionFactor = .3;
99107                  }
99108                  Initialize(t, e) {
99109                    this.bodyA = t;
99110                    this.bodyB = e;
99111                    this.bodyA.GetLocalPoint(this.bodyB.GetPosition(), this.linearOffset);
99112                    const i = this.bodyA.GetAngle();
99113                    const s = this.bodyB.GetAngle();
99114                    this.angularOffset = s - i;
99115                  }
99116                }
99117                class bs extends hs {
99118                  constructor(t) {
99119                    super(t);
99120                    this.m_linearOffset = new St;
99121                    this.m_angularOffset = 0;
99122                    this.m_linearImpulse = new St;
99123                    this.m_angularImpulse = 0;
99124                    this.m_maxForce = 0;
99125                    this.m_maxTorque = 0;
99126                    this.m_correctionFactor = .3;
99127                    this.m_indexA = 0;
99128                    this.m_indexB = 0;
99129                    this.m_rA = new St;
99130                    this.m_rB = new St;
99131                    this.m_localCenterA = new St;
99132                    this.m_localCenterB = new St;
99133                    this.m_linearError = new St;
99134                    this.m_angularError = 0;
99135                    this.m_invMassA = 0;
99136                    this.m_invMassB = 0;
99137                    this.m_invIA = 0;
99138                    this.m_invIB = 0;
99139                    this.m_linearMass = new vt;
99140                    this.m_angularMass = 0;
99141                    this.m_qA = new Ct;
99142                    this.m_qB = new Ct;
99143                    this.m_K = new vt;
99144                    this.m_linearOffset.Copy(i(t.linearOffset, St.ZERO));
99145                    this.m_linearImpulse.SetZero();
99146                    this.m_maxForce = i(t.maxForce, 0);
99147                    this.m_maxTorque = i(t.maxTorque, 0);
99148                    this.m_correctionFactor = i(t.correctionFactor, .3);
99149                  }
99150                  GetAnchorA(t) {
99151                    const e = this.m_bodyA.GetPosition();
99152                    t.x = e.x;
99153                    t.y = e.y;
99154                    return t;
99155                  }
99156                  GetAnchorB(t) {
99157                    const e = this.m_bodyB.GetPosition();
99158                    t.x = e.x;
99159                    t.y = e.y;
99160                    return t;
99161                  }
99162                  GetReactionForce(t, e) {
99163                    return St.MulSV(t, this.m_linearImpulse, e);
99164                  }
99165                  GetReactionTorque(t) {
99166                    return t * this.m_angularImpulse;
99167                  }
99168                  SetLinearOffset(t) {
99169                    if (!St.IsEqualToV(t, this.m_linearOffset)) {
99170                      this.m_bodyA.SetAwake(!0);
99171                      this.m_bodyB.SetAwake(!0);
99172                      this.m_linearOffset.Copy(t);
99173                    }
99174                  }
99175                  GetLinearOffset() {
99176                    return this.m_linearOffset;
99177                  }
99178                  SetAngularOffset(t) {
99179                    if (t !== this.m_angularOffset) {
99180                      this.m_bodyA.SetAwake(!0);
99181                      this.m_bodyB.SetAwake(!0);
99182                      this.m_angularOffset = t;
99183                    }
99184                  }
99185                  GetAngularOffset() {
99186                    return this.m_angularOffset;
99187                  }
99188                  SetMaxForce(t) {
99189                    this.m_maxForce = t;
99190                  }
99191                  GetMaxForce() {
99192                    return this.m_maxForce;
99193                  }
99194                  SetMaxTorque(t) {
99195                    this.m_maxTorque = t;
99196                  }
99197                  GetMaxTorque() {
99198                    return this.m_maxTorque;
99199                  }
99200                  InitVelocityConstraints(t) {
99201                    this.m_indexA = this.m_bodyA.m_islandIndex;
99202                    this.m_indexB = this.m_bodyB.m_islandIndex;
99203                    this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);
99204                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
99205                    this.m_invMassA = this.m_bodyA.m_invMass;
99206                    this.m_invMassB = this.m_bodyB.m_invMass;
99207                    this.m_invIA = this.m_bodyA.m_invI;
99208                    this.m_invIB = this.m_bodyB.m_invI;
99209                    const e = t.positions[this.m_indexA].c;
99210                    const i = t.positions[this.m_indexA].a;
99211                    const s = t.velocities[this.m_indexA].v;
99212                    let n = t.velocities[this.m_indexA].w;
99213                    const r = t.positions[this.m_indexB].c;
99214                    const o = t.positions[this.m_indexB].a;
99215                    const a = t.velocities[this.m_indexB].v;
99216                    let l = t.velocities[this.m_indexB].w;
99217                    const h = this.m_qA.SetAngle(i), c = this.m_qB.SetAngle(o);
99218                    const u = Ct.MulRV(h, St.SubVV(this.m_linearOffset, this.m_localCenterA, St.s_t0), this.m_rA);
99219                    const _ = Ct.MulRV(c, St.NegV(this.m_localCenterB, St.s_t0), this.m_rB);
99220                    const d = this.m_invMassA, p = this.m_invMassB;
99221                    const m = this.m_invIA, f = this.m_invIB;
99222                    const g = this.m_K;
99223                    g.ex.x = d + p + m * u.y * u.y + f * _.y * _.y;
99224                    g.ex.y = -m * u.x * u.y - f * _.x * _.y;
99225                    g.ey.x = g.ex.y;
99226                    g.ey.y = d + p + m * u.x * u.x + f * _.x * _.x;
99227                    g.GetInverse(this.m_linearMass);
99228                    this.m_angularMass = m + f;
99229                    this.m_angularMass > 0 && (this.m_angularMass = 1 / this.m_angularMass);
99230                    St.SubVV(St.AddVV(r, _, St.s_t0), St.AddVV(e, u, St.s_t1), this.m_linearError);
99231                    this.m_angularError = o - i - this.m_angularOffset;
99232                    if (t.step.warmStarting) {
99233                      this.m_linearImpulse.SelfMul(t.step.dtRatio);
99234                      this.m_angularImpulse *= t.step.dtRatio;
99235                      const e = this.m_linearImpulse;
99236                      s.SelfMulSub(d, e);
99237                      n -= m * (St.CrossVV(u, e) + this.m_angularImpulse);
99238                      a.SelfMulAdd(p, e);
99239                      l += f * (St.CrossVV(_, e) + this.m_angularImpulse);
99240                    } else {
99241                      this.m_linearImpulse.SetZero();
99242                      this.m_angularImpulse = 0;
99243                    }
99244                    t.velocities[this.m_indexA].w = n;
99245                    t.velocities[this.m_indexB].w = l;
99246                  }
99247                  SolveVelocityConstraints(t) {
99248                    const e = t.velocities[this.m_indexA].v;
99249                    let i = t.velocities[this.m_indexA].w;
99250                    const s = t.velocities[this.m_indexB].v;
99251                    let n = t.velocities[this.m_indexB].w;
99252                    const r = this.m_invMassA, o = this.m_invMassB;
99253                    const a = this.m_invIA, l = this.m_invIB;
99254                    const h = t.step.dt;
99255                    const c = t.step.inv_dt;
99256                    {
99257                      const t = n - i + c * this.m_correctionFactor * this.m_angularError;
99258                      let e = -this.m_angularMass * t;
99259                      const s = this.m_angularImpulse;
99260                      const r = h * this.m_maxTorque;
99261                      this.m_angularImpulse = it(this.m_angularImpulse + e, -r, r);
99262                      e = this.m_angularImpulse - s;
99263                      i -= a * e;
99264                      n += l * e;
99265                    }
99266                    {
99267                      const t = this.m_rA;
99268                      const u = this.m_rB;
99269                      const _ = St.AddVV(St.SubVV(St.AddVV(s, St.CrossSV(n, u, St.s_t0), St.s_t0), St.AddVV(e, St.CrossSV(i, t, St.s_t1), St.s_t1), St.s_t2), St.MulSV(c * this.m_correctionFactor, this.m_linearError, St.s_t3), bs.SolveVelocityConstraints_s_Cdot_v2);
99270                      const d = vt.MulMV(this.m_linearMass, _, bs.SolveVelocityConstraints_s_impulse_v2).SelfNeg();
99271                      const p = bs.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);
99272                      this.m_linearImpulse.SelfAdd(d);
99273                      const m = h * this.m_maxForce;
99274                      if (this.m_linearImpulse.LengthSquared() > m * m) {
99275                        this.m_linearImpulse.Normalize();
99276                        this.m_linearImpulse.SelfMul(m);
99277                      }
99278                      St.SubVV(this.m_linearImpulse, p, d);
99279                      e.SelfMulSub(r, d);
99280                      i -= a * St.CrossVV(t, d);
99281                      s.SelfMulAdd(o, d);
99282                      n += l * St.CrossVV(u, d);
99283                    }
99284                    t.velocities[this.m_indexA].w = i;
99285                    t.velocities[this.m_indexB].w = n;
99286                  }
99287                  SolvePositionConstraints(t) {
99288                    return !0;
99289                  }
99290                  Dump(t) {
99291                    const e = this.m_bodyA.m_islandIndex;
99292                    const i = this.m_bodyB.m_islandIndex;
99293                    t("  const jd: b2MotorJointDef = new b2MotorJointDef();\n");
99294                    t("  jd.bodyA = bodies[%d];\n", e);
99295                    t("  jd.bodyB = bodies[%d];\n", i);
99296                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
99297                    t("  jd.linearOffset.Set(%.15f, %.15f);\n", this.m_linearOffset.x, this.m_linearOffset.y);
99298                    t("  jd.angularOffset = %.15f;\n", this.m_angularOffset);
99299                    t("  jd.maxForce = %.15f;\n", this.m_maxForce);
99300                    t("  jd.maxTorque = %.15f;\n", this.m_maxTorque);
99301                    t("  jd.correctionFactor = %.15f;\n", this.m_correctionFactor);
99302                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
99303                  }
99304                }
99305                bs.SolveVelocityConstraints_s_Cdot_v2 = new St;
99306                bs.SolveVelocityConstraints_s_impulse_v2 = new St;
99307                bs.SolveVelocityConstraints_s_oldImpulse_v2 = new St;
99308                class Ss extends ls {
99309                  constructor() {
99310                    super(t.b2JointType.e_mouseJoint);
99311                    this.target = new St;
99312                    this.maxForce = 0;
99313                    this.frequencyHz = 5;
99314                    this.dampingRatio = .7;
99315                  }
99316                }
99317                class As extends hs {
99318                  constructor(t) {
99319                    super(t);
99320                    this.m_localAnchorB = new St;
99321                    this.m_targetA = new St;
99322                    this.m_frequencyHz = 0;
99323                    this.m_dampingRatio = 0;
99324                    this.m_beta = 0;
99325                    this.m_impulse = new St;
99326                    this.m_maxForce = 0;
99327                    this.m_gamma = 0;
99328                    this.m_indexA = 0;
99329                    this.m_indexB = 0;
99330                    this.m_rB = new St;
99331                    this.m_localCenterB = new St;
99332                    this.m_invMassB = 0;
99333                    this.m_invIB = 0;
99334                    this.m_mass = new vt;
99335                    this.m_C = new St;
99336                    this.m_qB = new Ct;
99337                    this.m_lalcB = new St;
99338                    this.m_K = new vt;
99339                    this.m_targetA.Copy(i(t.target, St.ZERO));
99340                    xt.MulTXV(this.m_bodyB.GetTransform(), this.m_targetA, this.m_localAnchorB);
99341                    this.m_maxForce = i(t.maxForce, 0);
99342                    this.m_impulse.SetZero();
99343                    this.m_frequencyHz = i(t.frequencyHz, 0);
99344                    this.m_dampingRatio = i(t.dampingRatio, 0);
99345                    this.m_beta = 0;
99346                    this.m_gamma = 0;
99347                  }
99348                  SetTarget(t) {
99349                    this.m_bodyB.IsAwake() || this.m_bodyB.SetAwake(!0);
99350                    this.m_targetA.Copy(t);
99351                  }
99352                  GetTarget() {
99353                    return this.m_targetA;
99354                  }
99355                  SetMaxForce(t) {
99356                    this.m_maxForce = t;
99357                  }
99358                  GetMaxForce() {
99359                    return this.m_maxForce;
99360                  }
99361                  SetFrequency(t) {
99362                    this.m_frequencyHz = t;
99363                  }
99364                  GetFrequency() {
99365                    return this.m_frequencyHz;
99366                  }
99367                  SetDampingRatio(t) {
99368                    this.m_dampingRatio = t;
99369                  }
99370                  GetDampingRatio() {
99371                    return this.m_dampingRatio;
99372                  }
99373                  InitVelocityConstraints(t) {
99374                    this.m_indexB = this.m_bodyB.m_islandIndex;
99375                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
99376                    this.m_invMassB = this.m_bodyB.m_invMass;
99377                    this.m_invIB = this.m_bodyB.m_invI;
99378                    const e = t.positions[this.m_indexB].c;
99379                    const i = t.positions[this.m_indexB].a;
99380                    const s = t.velocities[this.m_indexB].v;
99381                    let n = t.velocities[this.m_indexB].w;
99382                    const r = this.m_qB.SetAngle(i);
99383                    const a = this.m_bodyB.GetMass();
99384                    const l = 2 * o * this.m_frequencyHz;
99385                    const h = 2 * a * this.m_dampingRatio * l;
99386                    const c = a * (l * l);
99387                    const u = t.step.dt;
99388                    this.m_gamma = u * (h + u * c);
99389                    0 !== this.m_gamma && (this.m_gamma = 1 / this.m_gamma);
99390                    this.m_beta = u * c * this.m_gamma;
99391                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
99392                    Ct.MulRV(r, this.m_lalcB, this.m_rB);
99393                    const _ = this.m_K;
99394                    _.ex.x = this.m_invMassB + this.m_invIB * this.m_rB.y * this.m_rB.y + this.m_gamma;
99395                    _.ex.y = -this.m_invIB * this.m_rB.x * this.m_rB.y;
99396                    _.ey.x = _.ex.y;
99397                    _.ey.y = this.m_invMassB + this.m_invIB * this.m_rB.x * this.m_rB.x + this.m_gamma;
99398                    _.GetInverse(this.m_mass);
99399                    this.m_C.x = e.x + this.m_rB.x - this.m_targetA.x;
99400                    this.m_C.y = e.y + this.m_rB.y - this.m_targetA.y;
99401                    this.m_C.SelfMul(this.m_beta);
99402                    n *= .98;
99403                    if (t.step.warmStarting) {
99404                      this.m_impulse.SelfMul(t.step.dtRatio);
99405                      s.x += this.m_invMassB * this.m_impulse.x;
99406                      s.y += this.m_invMassB * this.m_impulse.y;
99407                      n += this.m_invIB * St.CrossVV(this.m_rB, this.m_impulse);
99408                    } else this.m_impulse.SetZero();
99409                    t.velocities[this.m_indexB].w = n;
99410                  }
99411                  SolveVelocityConstraints(t) {
99412                    const e = t.velocities[this.m_indexB].v;
99413                    let i = t.velocities[this.m_indexB].w;
99414                    const s = St.AddVCrossSV(e, i, this.m_rB, As.SolveVelocityConstraints_s_Cdot);
99415                    const n = vt.MulMV(this.m_mass, St.AddVV(s, St.AddVV(this.m_C, St.MulSV(this.m_gamma, this.m_impulse, St.s_t0), St.s_t0), St.s_t0).SelfNeg(), As.SolveVelocityConstraints_s_impulse);
99416                    const r = As.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);
99417                    this.m_impulse.SelfAdd(n);
99418                    const o = t.step.dt * this.m_maxForce;
99419                    this.m_impulse.LengthSquared() > o * o && this.m_impulse.SelfMul(o / this.m_impulse.Length());
99420                    St.SubVV(this.m_impulse, r, n);
99421                    e.SelfMulAdd(this.m_invMassB, n);
99422                    i += this.m_invIB * St.CrossVV(this.m_rB, n);
99423                    t.velocities[this.m_indexB].w = i;
99424                  }
99425                  SolvePositionConstraints(t) {
99426                    return !0;
99427                  }
99428                  GetAnchorA(t) {
99429                    t.x = this.m_targetA.x;
99430                    t.y = this.m_targetA.y;
99431                    return t;
99432                  }
99433                  GetAnchorB(t) {
99434                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
99435                  }
99436                  GetReactionForce(t, e) {
99437                    return St.MulSV(t, this.m_impulse, e);
99438                  }
99439                  GetReactionTorque(t) {
99440                    return 0;
99441                  }
99442                  Dump(t) {
99443                    t("Mouse joint dumping is not supported.\n");
99444                  }
99445                  ShiftOrigin(t) {
99446                    this.m_targetA.SelfSub(t);
99447                  }
99448                }
99449                As.SolveVelocityConstraints_s_Cdot = new St;
99450                As.SolveVelocityConstraints_s_impulse = new St;
99451                As.SolveVelocityConstraints_s_oldImpulse = new St;
99452                class Ts extends ls {
99453                  constructor() {
99454                    super(t.b2JointType.e_prismaticJoint);
99455                    this.localAnchorA = new St;
99456                    this.localAnchorB = new St;
99457                    this.localAxisA = new St(1, 0);
99458                    this.referenceAngle = 0;
99459                    this.enableLimit = !1;
99460                    this.lowerTranslation = 0;
99461                    this.upperTranslation = 0;
99462                    this.enableMotor = !1;
99463                    this.maxMotorForce = 0;
99464                    this.motorSpeed = 0;
99465                  }
99466                  Initialize(t, e, i, s) {
99467                    this.bodyA = t;
99468                    this.bodyB = e;
99469                    this.bodyA.GetLocalPoint(i, this.localAnchorA);
99470                    this.bodyB.GetLocalPoint(i, this.localAnchorB);
99471                    this.bodyA.GetLocalVector(s, this.localAxisA);
99472                    this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
99473                  }
99474                }
99475                class vs extends hs {
99476                  constructor(e) {
99477                    super(e);
99478                    this.m_localAnchorA = new St;
99479                    this.m_localAnchorB = new St;
99480                    this.m_localXAxisA = new St;
99481                    this.m_localYAxisA = new St;
99482                    this.m_referenceAngle = 0;
99483                    this.m_impulse = new Tt(0, 0, 0);
99484                    this.m_motorImpulse = 0;
99485                    this.m_lowerTranslation = 0;
99486                    this.m_upperTranslation = 0;
99487                    this.m_maxMotorForce = 0;
99488                    this.m_motorSpeed = 0;
99489                    this.m_enableLimit = !1;
99490                    this.m_enableMotor = !1;
99491                    this.m_limitState = t.b2LimitState.e_inactiveLimit;
99492                    this.m_indexA = 0;
99493                    this.m_indexB = 0;
99494                    this.m_localCenterA = new St;
99495                    this.m_localCenterB = new St;
99496                    this.m_invMassA = 0;
99497                    this.m_invMassB = 0;
99498                    this.m_invIA = 0;
99499                    this.m_invIB = 0;
99500                    this.m_axis = new St(0, 0);
99501                    this.m_perp = new St(0, 0);
99502                    this.m_s1 = 0;
99503                    this.m_s2 = 0;
99504                    this.m_a1 = 0;
99505                    this.m_a2 = 0;
99506                    this.m_K = new Et;
99507                    this.m_K3 = new Et;
99508                    this.m_K2 = new vt;
99509                    this.m_motorMass = 0;
99510                    this.m_qA = new Ct;
99511                    this.m_qB = new Ct;
99512                    this.m_lalcA = new St;
99513                    this.m_lalcB = new St;
99514                    this.m_rA = new St;
99515                    this.m_rB = new St;
99516                    this.m_localAnchorA.Copy(i(e.localAnchorA, St.ZERO));
99517                    this.m_localAnchorB.Copy(i(e.localAnchorB, St.ZERO));
99518                    this.m_localXAxisA.Copy(i(e.localAxisA, new St(1, 0))).SelfNormalize();
99519                    St.CrossOneV(this.m_localXAxisA, this.m_localYAxisA);
99520                    this.m_referenceAngle = i(e.referenceAngle, 0);
99521                    this.m_lowerTranslation = i(e.lowerTranslation, 0);
99522                    this.m_upperTranslation = i(e.upperTranslation, 0);
99523                    this.m_maxMotorForce = i(e.maxMotorForce, 0);
99524                    this.m_motorSpeed = i(e.motorSpeed, 0);
99525                    this.m_enableLimit = i(e.enableLimit, !1);
99526                    this.m_enableMotor = i(e.enableMotor, !1);
99527                  }
99528                  InitVelocityConstraints(e) {
99529                    this.m_indexA = this.m_bodyA.m_islandIndex;
99530                    this.m_indexB = this.m_bodyB.m_islandIndex;
99531                    this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);
99532                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
99533                    this.m_invMassA = this.m_bodyA.m_invMass;
99534                    this.m_invMassB = this.m_bodyB.m_invMass;
99535                    this.m_invIA = this.m_bodyA.m_invI;
99536                    this.m_invIB = this.m_bodyB.m_invI;
99537                    const i = e.positions[this.m_indexA].c;
99538                    const s = e.positions[this.m_indexA].a;
99539                    const n = e.velocities[this.m_indexA].v;
99540                    let r = e.velocities[this.m_indexA].w;
99541                    const o = e.positions[this.m_indexB].c;
99542                    const a = e.positions[this.m_indexB].a;
99543                    const l = e.velocities[this.m_indexB].v;
99544                    let h = e.velocities[this.m_indexB].w;
99545                    const c = this.m_qA.SetAngle(s), _ = this.m_qB.SetAngle(a);
99546                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
99547                    const d = Ct.MulRV(c, this.m_lalcA, this.m_rA);
99548                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
99549                    const p = Ct.MulRV(_, this.m_lalcB, this.m_rB);
99550                    const m = St.AddVV(St.SubVV(o, i, St.s_t0), St.SubVV(p, d, St.s_t1), vs.InitVelocityConstraints_s_d);
99551                    const f = this.m_invMassA, g = this.m_invMassB;
99552                    const y = this.m_invIA, b = this.m_invIB;
99553                    Ct.MulRV(c, this.m_localXAxisA, this.m_axis);
99554                    this.m_a1 = St.CrossVV(St.AddVV(m, d, St.s_t0), this.m_axis);
99555                    this.m_a2 = St.CrossVV(p, this.m_axis);
99556                    this.m_motorMass = f + g + y * this.m_a1 * this.m_a1 + b * this.m_a2 * this.m_a2;
99557                    this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass);
99558                    Ct.MulRV(c, this.m_localYAxisA, this.m_perp);
99559                    this.m_s1 = St.CrossVV(St.AddVV(m, d, St.s_t0), this.m_perp);
99560                    this.m_s2 = St.CrossVV(p, this.m_perp);
99561                    this.m_K.ex.x = f + g + y * this.m_s1 * this.m_s1 + b * this.m_s2 * this.m_s2;
99562                    this.m_K.ex.y = y * this.m_s1 + b * this.m_s2;
99563                    this.m_K.ex.z = y * this.m_s1 * this.m_a1 + b * this.m_s2 * this.m_a2;
99564                    this.m_K.ey.x = this.m_K.ex.y;
99565                    this.m_K.ey.y = y + b;
99566                    0 === this.m_K.ey.y && (this.m_K.ey.y = 1);
99567                    this.m_K.ey.z = y * this.m_a1 + b * this.m_a2;
99568                    this.m_K.ez.x = this.m_K.ex.z;
99569                    this.m_K.ez.y = this.m_K.ey.z;
99570                    this.m_K.ez.z = f + g + y * this.m_a1 * this.m_a1 + b * this.m_a2 * this.m_a2;
99571                    if (this.m_enableLimit) {
99572                      const e = St.DotVV(this.m_axis, m);
99573                      if ($(this.m_upperTranslation - this.m_lowerTranslation) < 2 * u) this.m_limitState = t.b2LimitState.e_equalLimits; else if (e <= this.m_lowerTranslation) {
99574                        if (this.m_limitState !== t.b2LimitState.e_atLowerLimit) {
99575                          this.m_limitState = t.b2LimitState.e_atLowerLimit;
99576                          this.m_impulse.z = 0;
99577                        }
99578                      } else if (e >= this.m_upperTranslation) {
99579                        if (this.m_limitState !== t.b2LimitState.e_atUpperLimit) {
99580                          this.m_limitState = t.b2LimitState.e_atUpperLimit;
99581                          this.m_impulse.z = 0;
99582                        }
99583                      } else {
99584                        this.m_limitState = t.b2LimitState.e_inactiveLimit;
99585                        this.m_impulse.z = 0;
99586                      }
99587                    } else {
99588                      this.m_limitState = t.b2LimitState.e_inactiveLimit;
99589                      this.m_impulse.z = 0;
99590                    }
99591                    this.m_enableMotor || (this.m_motorImpulse = 0);
99592                    if (e.step.warmStarting) {
99593                      this.m_impulse.SelfMul(e.step.dtRatio);
99594                      this.m_motorImpulse *= e.step.dtRatio;
99595                      const t = St.AddVV(St.MulSV(this.m_impulse.x, this.m_perp, St.s_t0), St.MulSV(this.m_motorImpulse + this.m_impulse.z, this.m_axis, St.s_t1), vs.InitVelocityConstraints_s_P);
99596                      const i = this.m_impulse.x * this.m_s1 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a1;
99597                      const s = this.m_impulse.x * this.m_s2 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a2;
99598                      n.SelfMulSub(f, t);
99599                      r -= y * i;
99600                      l.SelfMulAdd(g, t);
99601                      h += b * s;
99602                    } else {
99603                      this.m_impulse.SetZero();
99604                      this.m_motorImpulse = 0;
99605                    }
99606                    e.velocities[this.m_indexA].w = r;
99607                    e.velocities[this.m_indexB].w = h;
99608                  }
99609                  SolveVelocityConstraints(e) {
99610                    const i = e.velocities[this.m_indexA].v;
99611                    let s = e.velocities[this.m_indexA].w;
99612                    const n = e.velocities[this.m_indexB].v;
99613                    let r = e.velocities[this.m_indexB].w;
99614                    const o = this.m_invMassA, a = this.m_invMassB;
99615                    const l = this.m_invIA, h = this.m_invIB;
99616                    if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits) {
99617                      const t = St.DotVV(this.m_axis, St.SubVV(n, i, St.s_t0)) + this.m_a2 * r - this.m_a1 * s;
99618                      let c = this.m_motorMass * (this.m_motorSpeed - t);
99619                      const u = this.m_motorImpulse;
99620                      const _ = e.step.dt * this.m_maxMotorForce;
99621                      this.m_motorImpulse = it(this.m_motorImpulse + c, -_, _);
99622                      c = this.m_motorImpulse - u;
99623                      const d = St.MulSV(c, this.m_axis, vs.SolveVelocityConstraints_s_P);
99624                      const p = c * this.m_a1;
99625                      const m = c * this.m_a2;
99626                      i.SelfMulSub(o, d);
99627                      s -= l * p;
99628                      n.SelfMulAdd(a, d);
99629                      r += h * m;
99630                    }
99631                    const c = St.DotVV(this.m_perp, St.SubVV(n, i, St.s_t0)) + this.m_s2 * r - this.m_s1 * s;
99632                    const u = r - s;
99633                    if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit) {
99634                      const e = St.DotVV(this.m_axis, St.SubVV(n, i, St.s_t0)) + this.m_a2 * r - this.m_a1 * s;
99635                      const _ = vs.SolveVelocityConstraints_s_f1.Copy(this.m_impulse);
99636                      const d = this.m_K.Solve33(-c, -u, -e, vs.SolveVelocityConstraints_s_df3);
99637                      this.m_impulse.SelfAdd(d);
99638                      this.m_limitState === t.b2LimitState.e_atLowerLimit ? this.m_impulse.z = et(this.m_impulse.z, 0) : this.m_limitState === t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = tt(this.m_impulse.z, 0));
99639                      const p = -c - (this.m_impulse.z - _.z) * this.m_K.ez.x;
99640                      const m = -u - (this.m_impulse.z - _.z) * this.m_K.ez.y;
99641                      const f = this.m_K.Solve22(p, m, vs.SolveVelocityConstraints_s_f2r);
99642                      f.x += _.x;
99643                      f.y += _.y;
99644                      this.m_impulse.x = f.x;
99645                      this.m_impulse.y = f.y;
99646                      d.x = this.m_impulse.x - _.x;
99647                      d.y = this.m_impulse.y - _.y;
99648                      d.z = this.m_impulse.z - _.z;
99649                      const g = St.AddVV(St.MulSV(d.x, this.m_perp, St.s_t0), St.MulSV(d.z, this.m_axis, St.s_t1), vs.SolveVelocityConstraints_s_P);
99650                      const y = d.x * this.m_s1 + d.y + d.z * this.m_a1;
99651                      const b = d.x * this.m_s2 + d.y + d.z * this.m_a2;
99652                      i.SelfMulSub(o, g);
99653                      s -= l * y;
99654                      n.SelfMulAdd(a, g);
99655                      r += h * b;
99656                    } else {
99657                      const t = this.m_K.Solve22(-c, -u, vs.SolveVelocityConstraints_s_df2);
99658                      this.m_impulse.x += t.x;
99659                      this.m_impulse.y += t.y;
99660                      const e = St.MulSV(t.x, this.m_perp, vs.SolveVelocityConstraints_s_P);
99661                      const _ = t.x * this.m_s1 + t.y;
99662                      const d = t.x * this.m_s2 + t.y;
99663                      i.SelfMulSub(o, e);
99664                      s -= l * _;
99665                      n.SelfMulAdd(a, e);
99666                      r += h * d;
99667                    }
99668                    e.velocities[this.m_indexA].w = s;
99669                    e.velocities[this.m_indexB].w = r;
99670                  }
99671                  SolvePositionConstraints(t) {
99672                    const e = t.positions[this.m_indexA].c;
99673                    let i = t.positions[this.m_indexA].a;
99674                    const s = t.positions[this.m_indexB].c;
99675                    let n = t.positions[this.m_indexB].a;
99676                    const r = this.m_qA.SetAngle(i), o = this.m_qB.SetAngle(n);
99677                    const a = this.m_invMassA, l = this.m_invMassB;
99678                    const h = this.m_invIA, c = this.m_invIB;
99679                    const d = Ct.MulRV(r, this.m_lalcA, this.m_rA);
99680                    const p = Ct.MulRV(o, this.m_lalcB, this.m_rB);
99681                    const m = St.SubVV(St.AddVV(s, p, St.s_t0), St.AddVV(e, d, St.s_t1), vs.SolvePositionConstraints_s_d);
99682                    const f = Ct.MulRV(r, this.m_localXAxisA, this.m_axis);
99683                    const y = St.CrossVV(St.AddVV(m, d, St.s_t0), f);
99684                    const b = St.CrossVV(p, f);
99685                    const S = Ct.MulRV(r, this.m_localYAxisA, this.m_perp);
99686                    const A = St.CrossVV(St.AddVV(m, d, St.s_t0), S);
99687                    const T = St.CrossVV(p, S);
99688                    let v = vs.SolvePositionConstraints_s_impulse;
99689                    const E = St.DotVV(S, m);
99690                    const C = n - i - this.m_referenceAngle;
99691                    let x = $(E);
99692                    const w = $(C);
99693                    let R = !1;
99694                    let I = 0;
99695                    if (this.m_enableLimit) {
99696                      const t = St.DotVV(f, m);
99697                      if ($(this.m_upperTranslation - this.m_lowerTranslation) < 2 * u) {
99698                        I = it(t, -g, g);
99699                        x = et(x, $(t));
99700                        R = !0;
99701                      } else if (t <= this.m_lowerTranslation) {
99702                        I = it(t - this.m_lowerTranslation + u, -g, 0);
99703                        x = et(x, this.m_lowerTranslation - t);
99704                        R = !0;
99705                      } else if (t >= this.m_upperTranslation) {
99706                        I = it(t - this.m_upperTranslation - u, 0, g);
99707                        x = et(x, t - this.m_upperTranslation);
99708                        R = !0;
99709                      }
99710                    }
99711                    if (R) {
99712                      const t = a + l + h * A * A + c * T * T;
99713                      const e = h * A + c * T;
99714                      const i = h * A * y + c * T * b;
99715                      let s = h + c;
99716                      0 === s && (s = 1);
99717                      const n = h * y + c * b;
99718                      const r = a + l + h * y * y + c * b * b;
99719                      const o = this.m_K3;
99720                      o.ex.SetXYZ(t, e, i);
99721                      o.ey.SetXYZ(e, s, n);
99722                      o.ez.SetXYZ(i, n, r);
99723                      v = o.Solve33(-E, -C, -I, v);
99724                    } else {
99725                      const t = a + l + h * A * A + c * T * T;
99726                      const e = h * A + c * T;
99727                      let i = h + c;
99728                      0 === i && (i = 1);
99729                      const s = this.m_K2;
99730                      s.ex.Set(t, e);
99731                      s.ey.Set(e, i);
99732                      const n = s.Solve(-E, -C, vs.SolvePositionConstraints_s_impulse1);
99733                      v.x = n.x;
99734                      v.y = n.y;
99735                      v.z = 0;
99736                    }
99737                    const M = St.AddVV(St.MulSV(v.x, S, St.s_t0), St.MulSV(v.z, f, St.s_t1), vs.SolvePositionConstraints_s_P);
99738                    const B = v.x * A + v.y + v.z * y;
99739                    const D = v.x * T + v.y + v.z * b;
99740                    e.SelfMulSub(a, M);
99741                    i -= h * B;
99742                    s.SelfMulAdd(l, M);
99743                    n += c * D;
99744                    t.positions[this.m_indexA].a = i;
99745                    t.positions[this.m_indexB].a = n;
99746                    return x <= u && w <= _;
99747                  }
99748                  GetAnchorA(t) {
99749                    return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t);
99750                  }
99751                  GetAnchorB(t) {
99752                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
99753                  }
99754                  GetReactionForce(t, e) {
99755                    e.x = t * (this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.x);
99756                    e.y = t * (this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.y);
99757                    return e;
99758                  }
99759                  GetReactionTorque(t) {
99760                    return t * this.m_impulse.y;
99761                  }
99762                  GetLocalAnchorA() {
99763                    return this.m_localAnchorA;
99764                  }
99765                  GetLocalAnchorB() {
99766                    return this.m_localAnchorB;
99767                  }
99768                  GetLocalAxisA() {
99769                    return this.m_localXAxisA;
99770                  }
99771                  GetReferenceAngle() {
99772                    return this.m_referenceAngle;
99773                  }
99774                  GetJointTranslation() {
99775                    const t = this.m_bodyA.GetWorldPoint(this.m_localAnchorA, vs.GetJointTranslation_s_pA);
99776                    const e = this.m_bodyB.GetWorldPoint(this.m_localAnchorB, vs.GetJointTranslation_s_pB);
99777                    const i = St.SubVV(e, t, vs.GetJointTranslation_s_d);
99778                    const s = this.m_bodyA.GetWorldVector(this.m_localXAxisA, vs.GetJointTranslation_s_axis);
99779                    return St.DotVV(i, s);
99780                  }
99781                  GetJointSpeed() {
99782                    const t = this.m_bodyA;
99783                    const e = this.m_bodyB;
99784                    St.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA);
99785                    const i = Ct.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA);
99786                    St.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB);
99787                    const s = Ct.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB);
99788                    const n = St.AddVV(t.m_sweep.c, i, St.s_t0);
99789                    const r = St.AddVV(e.m_sweep.c, s, St.s_t1);
99790                    const o = St.SubVV(r, n, St.s_t2);
99791                    const a = t.GetWorldVector(this.m_localXAxisA, this.m_axis);
99792                    const l = t.m_linearVelocity;
99793                    const h = e.m_linearVelocity;
99794                    const c = t.m_angularVelocity;
99795                    const u = e.m_angularVelocity;
99796                    return St.DotVV(o, St.CrossSV(c, a, St.s_t0)) + St.DotVV(a, St.SubVV(St.AddVCrossSV(h, u, s, St.s_t0), St.AddVCrossSV(l, c, i, St.s_t1), St.s_t0));
99797                  }
99798                  IsLimitEnabled() {
99799                    return this.m_enableLimit;
99800                  }
99801                  EnableLimit(t) {
99802                    if (t !== this.m_enableLimit) {
99803                      this.m_bodyA.SetAwake(!0);
99804                      this.m_bodyB.SetAwake(!0);
99805                      this.m_enableLimit = t;
99806                      this.m_impulse.z = 0;
99807                    }
99808                  }
99809                  GetLowerLimit() {
99810                    return this.m_lowerTranslation;
99811                  }
99812                  GetUpperLimit() {
99813                    return this.m_upperTranslation;
99814                  }
99815                  SetLimits(t, e) {
99816                    if (t !== this.m_lowerTranslation || e !== this.m_upperTranslation) {
99817                      this.m_bodyA.SetAwake(!0);
99818                      this.m_bodyB.SetAwake(!0);
99819                      this.m_lowerTranslation = t;
99820                      this.m_upperTranslation = e;
99821                      this.m_impulse.z = 0;
99822                    }
99823                  }
99824                  IsMotorEnabled() {
99825                    return this.m_enableMotor;
99826                  }
99827                  EnableMotor(t) {
99828                    if (t !== this.m_enableMotor) {
99829                      this.m_bodyA.SetAwake(!0);
99830                      this.m_bodyB.SetAwake(!0);
99831                      this.m_enableMotor = t;
99832                    }
99833                  }
99834                  SetMotorSpeed(t) {
99835                    if (t !== this.m_motorSpeed) {
99836                      this.m_bodyA.SetAwake(!0);
99837                      this.m_bodyB.SetAwake(!0);
99838                      this.m_motorSpeed = t;
99839                    }
99840                  }
99841                  GetMotorSpeed() {
99842                    return this.m_motorSpeed;
99843                  }
99844                  SetMaxMotorForce(t) {
99845                    if (t !== this.m_maxMotorForce) {
99846                      this.m_bodyA.SetAwake(!0);
99847                      this.m_bodyB.SetAwake(!0);
99848                      this.m_maxMotorForce = t;
99849                    }
99850                  }
99851                  GetMaxMotorForce() {
99852                    return this.m_maxMotorForce;
99853                  }
99854                  GetMotorForce(t) {
99855                    return t * this.m_motorImpulse;
99856                  }
99857                  Dump(t) {
99858                    const e = this.m_bodyA.m_islandIndex;
99859                    const i = this.m_bodyB.m_islandIndex;
99860                    t("  const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n");
99861                    t("  jd.bodyA = bodies[%d];\n", e);
99862                    t("  jd.bodyB = bodies[%d];\n", i);
99863                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
99864                    t("  jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y);
99865                    t("  jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y);
99866                    t("  jd.localAxisA.Set(%.15f, %.15f);\n", this.m_localXAxisA.x, this.m_localXAxisA.y);
99867                    t("  jd.referenceAngle = %.15f;\n", this.m_referenceAngle);
99868                    t("  jd.enableLimit = %s;\n", this.m_enableLimit ? "true" : "false");
99869                    t("  jd.lowerTranslation = %.15f;\n", this.m_lowerTranslation);
99870                    t("  jd.upperTranslation = %.15f;\n", this.m_upperTranslation);
99871                    t("  jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false");
99872                    t("  jd.motorSpeed = %.15f;\n", this.m_motorSpeed);
99873                    t("  jd.maxMotorForce = %.15f;\n", this.m_maxMotorForce);
99874                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
99875                  }
99876                }
99877                vs.InitVelocityConstraints_s_d = new St;
99878                vs.InitVelocityConstraints_s_P = new St;
99879                vs.SolveVelocityConstraints_s_P = new St;
99880                vs.SolveVelocityConstraints_s_f2r = new St;
99881                vs.SolveVelocityConstraints_s_f1 = new Tt;
99882                vs.SolveVelocityConstraints_s_df3 = new Tt;
99883                vs.SolveVelocityConstraints_s_df2 = new St;
99884                vs.SolvePositionConstraints_s_d = new St;
99885                vs.SolvePositionConstraints_s_impulse = new Tt;
99886                vs.SolvePositionConstraints_s_impulse1 = new St;
99887                vs.SolvePositionConstraints_s_P = new St;
99888                vs.GetJointTranslation_s_pA = new St;
99889                vs.GetJointTranslation_s_pB = new St;
99890                vs.GetJointTranslation_s_d = new St;
99891                vs.GetJointTranslation_s_axis = new St;
99892                const Es = 2;
99893                class Cs extends ls {
99894                  constructor() {
99895                    super(t.b2JointType.e_pulleyJoint);
99896                    this.groundAnchorA = new St(-1, 1);
99897                    this.groundAnchorB = new St(1, 1);
99898                    this.localAnchorA = new St(-1, 0);
99899                    this.localAnchorB = new St(1, 0);
99900                    this.lengthA = 0;
99901                    this.lengthB = 0;
99902                    this.ratio = 1;
99903                    this.collideConnected = !0;
99904                  }
99905                  Initialize(t, e, i, s, n, r, o) {
99906                    this.bodyA = t;
99907                    this.bodyB = e;
99908                    this.groundAnchorA.Copy(i);
99909                    this.groundAnchorB.Copy(s);
99910                    this.bodyA.GetLocalPoint(n, this.localAnchorA);
99911                    this.bodyB.GetLocalPoint(r, this.localAnchorB);
99912                    this.lengthA = St.DistanceVV(n, i);
99913                    this.lengthB = St.DistanceVV(r, s);
99914                    this.ratio = o;
99915                  }
99916                }
99917                class xs extends hs {
99918                  constructor(t) {
99919                    super(t);
99920                    this.m_groundAnchorA = new St;
99921                    this.m_groundAnchorB = new St;
99922                    this.m_lengthA = 0;
99923                    this.m_lengthB = 0;
99924                    this.m_localAnchorA = new St;
99925                    this.m_localAnchorB = new St;
99926                    this.m_constant = 0;
99927                    this.m_ratio = 0;
99928                    this.m_impulse = 0;
99929                    this.m_indexA = 0;
99930                    this.m_indexB = 0;
99931                    this.m_uA = new St;
99932                    this.m_uB = new St;
99933                    this.m_rA = new St;
99934                    this.m_rB = new St;
99935                    this.m_localCenterA = new St;
99936                    this.m_localCenterB = new St;
99937                    this.m_invMassA = 0;
99938                    this.m_invMassB = 0;
99939                    this.m_invIA = 0;
99940                    this.m_invIB = 0;
99941                    this.m_mass = 0;
99942                    this.m_qA = new Ct;
99943                    this.m_qB = new Ct;
99944                    this.m_lalcA = new St;
99945                    this.m_lalcB = new St;
99946                    this.m_groundAnchorA.Copy(i(t.groundAnchorA, new St(-1, 1)));
99947                    this.m_groundAnchorB.Copy(i(t.groundAnchorB, new St(1, 0)));
99948                    this.m_localAnchorA.Copy(i(t.localAnchorA, new St(-1, 0)));
99949                    this.m_localAnchorB.Copy(i(t.localAnchorB, new St(1, 0)));
99950                    this.m_lengthA = i(t.lengthA, 0);
99951                    this.m_lengthB = i(t.lengthB, 0);
99952                    this.m_ratio = i(t.ratio, 1);
99953                    this.m_constant = i(t.lengthA, 0) + this.m_ratio * i(t.lengthB, 0);
99954                    this.m_impulse = 0;
99955                  }
99956                  InitVelocityConstraints(t) {
99957                    this.m_indexA = this.m_bodyA.m_islandIndex;
99958                    this.m_indexB = this.m_bodyB.m_islandIndex;
99959                    this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);
99960                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
99961                    this.m_invMassA = this.m_bodyA.m_invMass;
99962                    this.m_invMassB = this.m_bodyB.m_invMass;
99963                    this.m_invIA = this.m_bodyA.m_invI;
99964                    this.m_invIB = this.m_bodyB.m_invI;
99965                    const e = t.positions[this.m_indexA].c;
99966                    const i = t.positions[this.m_indexA].a;
99967                    const s = t.velocities[this.m_indexA].v;
99968                    let n = t.velocities[this.m_indexA].w;
99969                    const r = t.positions[this.m_indexB].c;
99970                    const o = t.positions[this.m_indexB].a;
99971                    const a = t.velocities[this.m_indexB].v;
99972                    let l = t.velocities[this.m_indexB].w;
99973                    const h = this.m_qA.SetAngle(i), c = this.m_qB.SetAngle(o);
99974                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
99975                    Ct.MulRV(h, this.m_lalcA, this.m_rA);
99976                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
99977                    Ct.MulRV(c, this.m_lalcB, this.m_rB);
99978                    this.m_uA.Copy(e).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA);
99979                    this.m_uB.Copy(r).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);
99980                    const _ = this.m_uA.Length();
99981                    const d = this.m_uB.Length();
99982                    _ > 10 * u ? this.m_uA.SelfMul(1 / _) : this.m_uA.SetZero();
99983                    d > 10 * u ? this.m_uB.SelfMul(1 / d) : this.m_uB.SetZero();
99984                    const p = St.CrossVV(this.m_rA, this.m_uA);
99985                    const m = St.CrossVV(this.m_rB, this.m_uB);
99986                    const f = this.m_invMassA + this.m_invIA * p * p;
99987                    const g = this.m_invMassB + this.m_invIB * m * m;
99988                    this.m_mass = f + this.m_ratio * this.m_ratio * g;
99989                    this.m_mass > 0 && (this.m_mass = 1 / this.m_mass);
99990                    if (t.step.warmStarting) {
99991                      this.m_impulse *= t.step.dtRatio;
99992                      const e = St.MulSV(-this.m_impulse, this.m_uA, xs.InitVelocityConstraints_s_PA);
99993                      const i = St.MulSV(-this.m_ratio * this.m_impulse, this.m_uB, xs.InitVelocityConstraints_s_PB);
99994                      s.SelfMulAdd(this.m_invMassA, e);
99995                      n += this.m_invIA * St.CrossVV(this.m_rA, e);
99996                      a.SelfMulAdd(this.m_invMassB, i);
99997                      l += this.m_invIB * St.CrossVV(this.m_rB, i);
99998                    } else this.m_impulse = 0;
99999                    t.velocities[this.m_indexA].w = n;
100000                    t.velocities[this.m_indexB].w = l;
100001                  }
100002                  SolveVelocityConstraints(t) {
100003                    const e = t.velocities[this.m_indexA].v;
100004                    let i = t.velocities[this.m_indexA].w;
100005                    const s = t.velocities[this.m_indexB].v;
100006                    let n = t.velocities[this.m_indexB].w;
100007                    const r = St.AddVCrossSV(e, i, this.m_rA, xs.SolveVelocityConstraints_s_vpA);
100008                    const o = St.AddVCrossSV(s, n, this.m_rB, xs.SolveVelocityConstraints_s_vpB);
100009                    const a = -St.DotVV(this.m_uA, r) - this.m_ratio * St.DotVV(this.m_uB, o);
100010                    const l = -this.m_mass * a;
100011                    this.m_impulse += l;
100012                    const h = St.MulSV(-l, this.m_uA, xs.SolveVelocityConstraints_s_PA);
100013                    const c = St.MulSV(-this.m_ratio * l, this.m_uB, xs.SolveVelocityConstraints_s_PB);
100014                    e.SelfMulAdd(this.m_invMassA, h);
100015                    i += this.m_invIA * St.CrossVV(this.m_rA, h);
100016                    s.SelfMulAdd(this.m_invMassB, c);
100017                    n += this.m_invIB * St.CrossVV(this.m_rB, c);
100018                    t.velocities[this.m_indexA].w = i;
100019                    t.velocities[this.m_indexB].w = n;
100020                  }
100021                  SolvePositionConstraints(t) {
100022                    const e = t.positions[this.m_indexA].c;
100023                    let i = t.positions[this.m_indexA].a;
100024                    const s = t.positions[this.m_indexB].c;
100025                    let n = t.positions[this.m_indexB].a;
100026                    const r = this.m_qA.SetAngle(i), o = this.m_qB.SetAngle(n);
100027                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
100028                    const a = Ct.MulRV(r, this.m_lalcA, this.m_rA);
100029                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
100030                    const l = Ct.MulRV(o, this.m_lalcB, this.m_rB);
100031                    const h = this.m_uA.Copy(e).SelfAdd(a).SelfSub(this.m_groundAnchorA);
100032                    const c = this.m_uB.Copy(s).SelfAdd(l).SelfSub(this.m_groundAnchorB);
100033                    const _ = h.Length();
100034                    const d = c.Length();
100035                    _ > 10 * u ? h.SelfMul(1 / _) : h.SetZero();
100036                    d > 10 * u ? c.SelfMul(1 / d) : c.SetZero();
100037                    const p = St.CrossVV(a, h);
100038                    const m = St.CrossVV(l, c);
100039                    const f = this.m_invMassA + this.m_invIA * p * p;
100040                    const g = this.m_invMassB + this.m_invIB * m * m;
100041                    let y = f + this.m_ratio * this.m_ratio * g;
100042                    y > 0 && (y = 1 / y);
100043                    const b = this.m_constant - _ - this.m_ratio * d;
100044                    const S = $(b);
100045                    const A = -y * b;
100046                    const T = St.MulSV(-A, h, xs.SolvePositionConstraints_s_PA);
100047                    const v = St.MulSV(-this.m_ratio * A, c, xs.SolvePositionConstraints_s_PB);
100048                    e.SelfMulAdd(this.m_invMassA, T);
100049                    i += this.m_invIA * St.CrossVV(a, T);
100050                    s.SelfMulAdd(this.m_invMassB, v);
100051                    n += this.m_invIB * St.CrossVV(l, v);
100052                    t.positions[this.m_indexA].a = i;
100053                    t.positions[this.m_indexB].a = n;
100054                    return S < u;
100055                  }
100056                  GetAnchorA(t) {
100057                    return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t);
100058                  }
100059                  GetAnchorB(t) {
100060                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
100061                  }
100062                  GetReactionForce(t, e) {
100063                    e.x = t * this.m_impulse * this.m_uB.x;
100064                    e.y = t * this.m_impulse * this.m_uB.y;
100065                    return e;
100066                  }
100067                  GetReactionTorque(t) {
100068                    return 0;
100069                  }
100070                  GetGroundAnchorA() {
100071                    return this.m_groundAnchorA;
100072                  }
100073                  GetGroundAnchorB() {
100074                    return this.m_groundAnchorB;
100075                  }
100076                  GetLengthA() {
100077                    return this.m_lengthA;
100078                  }
100079                  GetLengthB() {
100080                    return this.m_lengthB;
100081                  }
100082                  GetRatio() {
100083                    return this.m_ratio;
100084                  }
100085                  GetCurrentLengthA() {
100086                    const t = this.m_bodyA.GetWorldPoint(this.m_localAnchorA, xs.GetCurrentLengthA_s_p);
100087                    const e = this.m_groundAnchorA;
100088                    return St.DistanceVV(t, e);
100089                  }
100090                  GetCurrentLengthB() {
100091                    const t = this.m_bodyB.GetWorldPoint(this.m_localAnchorB, xs.GetCurrentLengthB_s_p);
100092                    const e = this.m_groundAnchorB;
100093                    return St.DistanceVV(t, e);
100094                  }
100095                  Dump(t) {
100096                    const e = this.m_bodyA.m_islandIndex;
100097                    const i = this.m_bodyB.m_islandIndex;
100098                    t("  const jd: b2PulleyJointDef = new b2PulleyJointDef();\n");
100099                    t("  jd.bodyA = bodies[%d];\n", e);
100100                    t("  jd.bodyB = bodies[%d];\n", i);
100101                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
100102                    t("  jd.groundAnchorA.Set(%.15f, %.15f);\n", this.m_groundAnchorA.x, this.m_groundAnchorA.y);
100103                    t("  jd.groundAnchorB.Set(%.15f, %.15f);\n", this.m_groundAnchorB.x, this.m_groundAnchorB.y);
100104                    t("  jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y);
100105                    t("  jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y);
100106                    t("  jd.lengthA = %.15f;\n", this.m_lengthA);
100107                    t("  jd.lengthB = %.15f;\n", this.m_lengthB);
100108                    t("  jd.ratio = %.15f;\n", this.m_ratio);
100109                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
100110                  }
100111                  ShiftOrigin(t) {
100112                    this.m_groundAnchorA.SelfSub(t);
100113                    this.m_groundAnchorB.SelfSub(t);
100114                  }
100115                }
100116                xs.InitVelocityConstraints_s_PA = new St;
100117                xs.InitVelocityConstraints_s_PB = new St;
100118                xs.SolveVelocityConstraints_s_vpA = new St;
100119                xs.SolveVelocityConstraints_s_vpB = new St;
100120                xs.SolveVelocityConstraints_s_PA = new St;
100121                xs.SolveVelocityConstraints_s_PB = new St;
100122                xs.SolvePositionConstraints_s_PA = new St;
100123                xs.SolvePositionConstraints_s_PB = new St;
100124                xs.GetCurrentLengthA_s_p = new St;
100125                xs.GetCurrentLengthB_s_p = new St;
100126                class ws extends ls {
100127                  constructor() {
100128                    super(t.b2JointType.e_revoluteJoint);
100129                    this.localAnchorA = new St(0, 0);
100130                    this.localAnchorB = new St(0, 0);
100131                    this.referenceAngle = 0;
100132                    this.enableLimit = !1;
100133                    this.lowerAngle = 0;
100134                    this.upperAngle = 0;
100135                    this.enableMotor = !1;
100136                    this.motorSpeed = 0;
100137                    this.maxMotorTorque = 0;
100138                  }
100139                  Initialize(t, e, i) {
100140                    this.bodyA = t;
100141                    this.bodyB = e;
100142                    this.bodyA.GetLocalPoint(i, this.localAnchorA);
100143                    this.bodyB.GetLocalPoint(i, this.localAnchorB);
100144                    this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
100145                  }
100146                }
100147                class Rs extends hs {
100148                  constructor(e) {
100149                    super(e);
100150                    this.m_localAnchorA = new St;
100151                    this.m_localAnchorB = new St;
100152                    this.m_impulse = new Tt;
100153                    this.m_motorImpulse = 0;
100154                    this.m_enableMotor = !1;
100155                    this.m_maxMotorTorque = 0;
100156                    this.m_motorSpeed = 0;
100157                    this.m_enableLimit = !1;
100158                    this.m_referenceAngle = 0;
100159                    this.m_lowerAngle = 0;
100160                    this.m_upperAngle = 0;
100161                    this.m_indexA = 0;
100162                    this.m_indexB = 0;
100163                    this.m_rA = new St;
100164                    this.m_rB = new St;
100165                    this.m_localCenterA = new St;
100166                    this.m_localCenterB = new St;
100167                    this.m_invMassA = 0;
100168                    this.m_invMassB = 0;
100169                    this.m_invIA = 0;
100170                    this.m_invIB = 0;
100171                    this.m_mass = new Et;
100172                    this.m_motorMass = 0;
100173                    this.m_limitState = t.b2LimitState.e_inactiveLimit;
100174                    this.m_qA = new Ct;
100175                    this.m_qB = new Ct;
100176                    this.m_lalcA = new St;
100177                    this.m_lalcB = new St;
100178                    this.m_K = new vt;
100179                    this.m_localAnchorA.Copy(i(e.localAnchorA, St.ZERO));
100180                    this.m_localAnchorB.Copy(i(e.localAnchorB, St.ZERO));
100181                    this.m_referenceAngle = i(e.referenceAngle, 0);
100182                    this.m_impulse.SetZero();
100183                    this.m_motorImpulse = 0;
100184                    this.m_lowerAngle = i(e.lowerAngle, 0);
100185                    this.m_upperAngle = i(e.upperAngle, 0);
100186                    this.m_maxMotorTorque = i(e.maxMotorTorque, 0);
100187                    this.m_motorSpeed = i(e.motorSpeed, 0);
100188                    this.m_enableLimit = i(e.enableLimit, !1);
100189                    this.m_enableMotor = i(e.enableMotor, !1);
100190                    this.m_limitState = t.b2LimitState.e_inactiveLimit;
100191                  }
100192                  InitVelocityConstraints(e) {
100193                    this.m_indexA = this.m_bodyA.m_islandIndex;
100194                    this.m_indexB = this.m_bodyB.m_islandIndex;
100195                    this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);
100196                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
100197                    this.m_invMassA = this.m_bodyA.m_invMass;
100198                    this.m_invMassB = this.m_bodyB.m_invMass;
100199                    this.m_invIA = this.m_bodyA.m_invI;
100200                    this.m_invIB = this.m_bodyB.m_invI;
100201                    const i = e.positions[this.m_indexA].a;
100202                    const s = e.velocities[this.m_indexA].v;
100203                    let n = e.velocities[this.m_indexA].w;
100204                    const r = e.positions[this.m_indexB].a;
100205                    const o = e.velocities[this.m_indexB].v;
100206                    let a = e.velocities[this.m_indexB].w;
100207                    const l = this.m_qA.SetAngle(i), h = this.m_qB.SetAngle(r);
100208                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
100209                    Ct.MulRV(l, this.m_lalcA, this.m_rA);
100210                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
100211                    Ct.MulRV(h, this.m_lalcB, this.m_rB);
100212                    const c = this.m_invMassA, u = this.m_invMassB;
100213                    const d = this.m_invIA, p = this.m_invIB;
100214                    const m = d + p === 0;
100215                    this.m_mass.ex.x = c + u + this.m_rA.y * this.m_rA.y * d + this.m_rB.y * this.m_rB.y * p;
100216                    this.m_mass.ey.x = -this.m_rA.y * this.m_rA.x * d - this.m_rB.y * this.m_rB.x * p;
100217                    this.m_mass.ez.x = -this.m_rA.y * d - this.m_rB.y * p;
100218                    this.m_mass.ex.y = this.m_mass.ey.x;
100219                    this.m_mass.ey.y = c + u + this.m_rA.x * this.m_rA.x * d + this.m_rB.x * this.m_rB.x * p;
100220                    this.m_mass.ez.y = this.m_rA.x * d + this.m_rB.x * p;
100221                    this.m_mass.ex.z = this.m_mass.ez.x;
100222                    this.m_mass.ey.z = this.m_mass.ez.y;
100223                    this.m_mass.ez.z = d + p;
100224                    this.m_motorMass = d + p;
100225                    this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass);
100226                    this.m_enableMotor && !m || (this.m_motorImpulse = 0);
100227                    if (this.m_enableLimit && !m) {
100228                      const e = r - i - this.m_referenceAngle;
100229                      if ($(this.m_upperAngle - this.m_lowerAngle) < 2 * _) this.m_limitState = t.b2LimitState.e_equalLimits; else if (e <= this.m_lowerAngle) {
100230                        this.m_limitState !== t.b2LimitState.e_atLowerLimit && (this.m_impulse.z = 0);
100231                        this.m_limitState = t.b2LimitState.e_atLowerLimit;
100232                      } else if (e >= this.m_upperAngle) {
100233                        this.m_limitState !== t.b2LimitState.e_atUpperLimit && (this.m_impulse.z = 0);
100234                        this.m_limitState = t.b2LimitState.e_atUpperLimit;
100235                      } else {
100236                        this.m_limitState = t.b2LimitState.e_inactiveLimit;
100237                        this.m_impulse.z = 0;
100238                      }
100239                    } else this.m_limitState = t.b2LimitState.e_inactiveLimit;
100240                    if (e.step.warmStarting) {
100241                      this.m_impulse.SelfMul(e.step.dtRatio);
100242                      this.m_motorImpulse *= e.step.dtRatio;
100243                      const t = Rs.InitVelocityConstraints_s_P.Set(this.m_impulse.x, this.m_impulse.y);
100244                      s.SelfMulSub(c, t);
100245                      n -= d * (St.CrossVV(this.m_rA, t) + this.m_motorImpulse + this.m_impulse.z);
100246                      o.SelfMulAdd(u, t);
100247                      a += p * (St.CrossVV(this.m_rB, t) + this.m_motorImpulse + this.m_impulse.z);
100248                    } else {
100249                      this.m_impulse.SetZero();
100250                      this.m_motorImpulse = 0;
100251                    }
100252                    e.velocities[this.m_indexA].w = n;
100253                    e.velocities[this.m_indexB].w = a;
100254                  }
100255                  SolveVelocityConstraints(e) {
100256                    const i = e.velocities[this.m_indexA].v;
100257                    let s = e.velocities[this.m_indexA].w;
100258                    const n = e.velocities[this.m_indexB].v;
100259                    let r = e.velocities[this.m_indexB].w;
100260                    const o = this.m_invMassA, a = this.m_invMassB;
100261                    const l = this.m_invIA, h = this.m_invIB;
100262                    const c = l + h === 0;
100263                    if (this.m_enableMotor && this.m_limitState !== t.b2LimitState.e_equalLimits && !c) {
100264                      const t = r - s - this.m_motorSpeed;
100265                      let i = -this.m_motorMass * t;
100266                      const n = this.m_motorImpulse;
100267                      const o = e.step.dt * this.m_maxMotorTorque;
100268                      this.m_motorImpulse = it(this.m_motorImpulse + i, -o, o);
100269                      i = this.m_motorImpulse - n;
100270                      s -= l * i;
100271                      r += h * i;
100272                    }
100273                    if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !c) {
100274                      const e = St.SubVV(St.AddVCrossSV(n, r, this.m_rB, St.s_t0), St.AddVCrossSV(i, s, this.m_rA, St.s_t1), Rs.SolveVelocityConstraints_s_Cdot1);
100275                      const c = r - s;
100276                      const u = this.m_mass.Solve33(e.x, e.y, c, Rs.SolveVelocityConstraints_s_impulse_v3).SelfNeg();
100277                      if (this.m_limitState === t.b2LimitState.e_equalLimits) this.m_impulse.SelfAdd(u); else if (this.m_limitState === t.b2LimitState.e_atLowerLimit) if (this.m_impulse.z + u.z < 0) {
100278                        const t = -e.x + this.m_impulse.z * this.m_mass.ez.x;
100279                        const i = -e.y + this.m_impulse.z * this.m_mass.ez.y;
100280                        const s = this.m_mass.Solve22(t, i, Rs.SolveVelocityConstraints_s_reduced_v2);
100281                        u.x = s.x;
100282                        u.y = s.y;
100283                        u.z = -this.m_impulse.z;
100284                        this.m_impulse.x += s.x;
100285                        this.m_impulse.y += s.y;
100286                        this.m_impulse.z = 0;
100287                      } else this.m_impulse.SelfAdd(u); else if (this.m_limitState === t.b2LimitState.e_atUpperLimit) if (this.m_impulse.z + u.z > 0) {
100288                        const t = -e.x + this.m_impulse.z * this.m_mass.ez.x;
100289                        const i = -e.y + this.m_impulse.z * this.m_mass.ez.y;
100290                        const s = this.m_mass.Solve22(t, i, Rs.SolveVelocityConstraints_s_reduced_v2);
100291                        u.x = s.x;
100292                        u.y = s.y;
100293                        u.z = -this.m_impulse.z;
100294                        this.m_impulse.x += s.x;
100295                        this.m_impulse.y += s.y;
100296                        this.m_impulse.z = 0;
100297                      } else this.m_impulse.SelfAdd(u);
100298                      const _ = Rs.SolveVelocityConstraints_s_P.Set(u.x, u.y);
100299                      i.SelfMulSub(o, _);
100300                      s -= l * (St.CrossVV(this.m_rA, _) + u.z);
100301                      n.SelfMulAdd(a, _);
100302                      r += h * (St.CrossVV(this.m_rB, _) + u.z);
100303                    } else {
100304                      const t = St.SubVV(St.AddVCrossSV(n, r, this.m_rB, St.s_t0), St.AddVCrossSV(i, s, this.m_rA, St.s_t1), Rs.SolveVelocityConstraints_s_Cdot_v2);
100305                      const e = this.m_mass.Solve22(-t.x, -t.y, Rs.SolveVelocityConstraints_s_impulse_v2);
100306                      this.m_impulse.x += e.x;
100307                      this.m_impulse.y += e.y;
100308                      i.SelfMulSub(o, e);
100309                      s -= l * St.CrossVV(this.m_rA, e);
100310                      n.SelfMulAdd(a, e);
100311                      r += h * St.CrossVV(this.m_rB, e);
100312                    }
100313                    e.velocities[this.m_indexA].w = s;
100314                    e.velocities[this.m_indexB].w = r;
100315                  }
100316                  SolvePositionConstraints(e) {
100317                    const i = e.positions[this.m_indexA].c;
100318                    let s = e.positions[this.m_indexA].a;
100319                    const n = e.positions[this.m_indexB].c;
100320                    let r = e.positions[this.m_indexB].a;
100321                    const o = this.m_qA.SetAngle(s), a = this.m_qB.SetAngle(r);
100322                    let l = 0;
100323                    let h = 0;
100324                    const c = this.m_invIA + this.m_invIB === 0;
100325                    if (this.m_enableLimit && this.m_limitState !== t.b2LimitState.e_inactiveLimit && !c) {
100326                      const e = r - s - this.m_referenceAngle;
100327                      let i = 0;
100328                      if (this.m_limitState === t.b2LimitState.e_equalLimits) {
100329                        const t = it(e - this.m_lowerAngle, -y, y);
100330                        i = -this.m_motorMass * t;
100331                        l = $(t);
100332                      } else if (this.m_limitState === t.b2LimitState.e_atLowerLimit) {
100333                        let t = e - this.m_lowerAngle;
100334                        l = -t;
100335                        t = it(t + _, -y, 0);
100336                        i = -this.m_motorMass * t;
100337                      } else if (this.m_limitState === t.b2LimitState.e_atUpperLimit) {
100338                        let t = e - this.m_upperAngle;
100339                        l = t;
100340                        t = it(t - _, 0, y);
100341                        i = -this.m_motorMass * t;
100342                      }
100343                      s -= this.m_invIA * i;
100344                      r += this.m_invIB * i;
100345                    }
100346                    {
100347                      o.SetAngle(s);
100348                      a.SetAngle(r);
100349                      St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
100350                      const t = Ct.MulRV(o, this.m_lalcA, this.m_rA);
100351                      St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
100352                      const e = Ct.MulRV(a, this.m_lalcB, this.m_rB);
100353                      const l = St.SubVV(St.AddVV(n, e, St.s_t0), St.AddVV(i, t, St.s_t1), Rs.SolvePositionConstraints_s_C_v2);
100354                      h = l.Length();
100355                      const c = this.m_invMassA, u = this.m_invMassB;
100356                      const _ = this.m_invIA, d = this.m_invIB;
100357                      const p = this.m_K;
100358                      p.ex.x = c + u + _ * t.y * t.y + d * e.y * e.y;
100359                      p.ex.y = -_ * t.x * t.y - d * e.x * e.y;
100360                      p.ey.x = p.ex.y;
100361                      p.ey.y = c + u + _ * t.x * t.x + d * e.x * e.x;
100362                      const m = p.Solve(l.x, l.y, Rs.SolvePositionConstraints_s_impulse).SelfNeg();
100363                      i.SelfMulSub(c, m);
100364                      s -= _ * St.CrossVV(t, m);
100365                      n.SelfMulAdd(u, m);
100366                      r += d * St.CrossVV(e, m);
100367                    }
100368                    e.positions[this.m_indexA].a = s;
100369                    e.positions[this.m_indexB].a = r;
100370                    return h <= u && l <= _;
100371                  }
100372                  GetAnchorA(t) {
100373                    return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t);
100374                  }
100375                  GetAnchorB(t) {
100376                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
100377                  }
100378                  GetReactionForce(t, e) {
100379                    e.x = t * this.m_impulse.x;
100380                    e.y = t * this.m_impulse.y;
100381                    return e;
100382                  }
100383                  GetReactionTorque(t) {
100384                    return t * this.m_impulse.z;
100385                  }
100386                  GetLocalAnchorA() {
100387                    return this.m_localAnchorA;
100388                  }
100389                  GetLocalAnchorB() {
100390                    return this.m_localAnchorB;
100391                  }
100392                  GetReferenceAngle() {
100393                    return this.m_referenceAngle;
100394                  }
100395                  GetJointAngle() {
100396                    return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a - this.m_referenceAngle;
100397                  }
100398                  GetJointSpeed() {
100399                    return this.m_bodyB.m_angularVelocity - this.m_bodyA.m_angularVelocity;
100400                  }
100401                  IsMotorEnabled() {
100402                    return this.m_enableMotor;
100403                  }
100404                  EnableMotor(t) {
100405                    if (t !== this.m_enableMotor) {
100406                      this.m_bodyA.SetAwake(!0);
100407                      this.m_bodyB.SetAwake(!0);
100408                      this.m_enableMotor = t;
100409                    }
100410                  }
100411                  GetMotorTorque(t) {
100412                    return t * this.m_motorImpulse;
100413                  }
100414                  GetMotorSpeed() {
100415                    return this.m_motorSpeed;
100416                  }
100417                  SetMaxMotorTorque(t) {
100418                    if (t !== this.m_maxMotorTorque) {
100419                      this.m_bodyA.SetAwake(!0);
100420                      this.m_bodyB.SetAwake(!0);
100421                      this.m_maxMotorTorque = t;
100422                    }
100423                  }
100424                  GetMaxMotorTorque() {
100425                    return this.m_maxMotorTorque;
100426                  }
100427                  IsLimitEnabled() {
100428                    return this.m_enableLimit;
100429                  }
100430                  EnableLimit(t) {
100431                    if (t !== this.m_enableLimit) {
100432                      this.m_bodyA.SetAwake(!0);
100433                      this.m_bodyB.SetAwake(!0);
100434                      this.m_enableLimit = t;
100435                      this.m_impulse.z = 0;
100436                    }
100437                  }
100438                  GetLowerLimit() {
100439                    return this.m_lowerAngle;
100440                  }
100441                  GetUpperLimit() {
100442                    return this.m_upperAngle;
100443                  }
100444                  SetLimits(t, e) {
100445                    if (t !== this.m_lowerAngle || e !== this.m_upperAngle) {
100446                      this.m_bodyA.SetAwake(!0);
100447                      this.m_bodyB.SetAwake(!0);
100448                      this.m_impulse.z = 0;
100449                      this.m_lowerAngle = t;
100450                      this.m_upperAngle = e;
100451                    }
100452                  }
100453                  SetMotorSpeed(t) {
100454                    if (t !== this.m_motorSpeed) {
100455                      this.m_bodyA.SetAwake(!0);
100456                      this.m_bodyB.SetAwake(!0);
100457                      this.m_motorSpeed = t;
100458                    }
100459                  }
100460                  Dump(t) {
100461                    const e = this.m_bodyA.m_islandIndex;
100462                    const i = this.m_bodyB.m_islandIndex;
100463                    t("  const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n");
100464                    t("  jd.bodyA = bodies[%d];\n", e);
100465                    t("  jd.bodyB = bodies[%d];\n", i);
100466                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
100467                    t("  jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y);
100468                    t("  jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y);
100469                    t("  jd.referenceAngle = %.15f;\n", this.m_referenceAngle);
100470                    t("  jd.enableLimit = %s;\n", this.m_enableLimit ? "true" : "false");
100471                    t("  jd.lowerAngle = %.15f;\n", this.m_lowerAngle);
100472                    t("  jd.upperAngle = %.15f;\n", this.m_upperAngle);
100473                    t("  jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false");
100474                    t("  jd.motorSpeed = %.15f;\n", this.m_motorSpeed);
100475                    t("  jd.maxMotorTorque = %.15f;\n", this.m_maxMotorTorque);
100476                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
100477                  }
100478                }
100479                Rs.InitVelocityConstraints_s_P = new St;
100480                Rs.SolveVelocityConstraints_s_P = new St;
100481                Rs.SolveVelocityConstraints_s_Cdot_v2 = new St;
100482                Rs.SolveVelocityConstraints_s_Cdot1 = new St;
100483                Rs.SolveVelocityConstraints_s_impulse_v3 = new Tt;
100484                Rs.SolveVelocityConstraints_s_reduced_v2 = new St;
100485                Rs.SolveVelocityConstraints_s_impulse_v2 = new St;
100486                Rs.SolvePositionConstraints_s_C_v2 = new St;
100487                Rs.SolvePositionConstraints_s_impulse = new St;
100488                class Is extends ls {
100489                  constructor() {
100490                    super(t.b2JointType.e_ropeJoint);
100491                    this.localAnchorA = new St(-1, 0);
100492                    this.localAnchorB = new St(1, 0);
100493                    this.maxLength = 0;
100494                  }
100495                }
100496                class Ms extends hs {
100497                  constructor(e) {
100498                    super(e);
100499                    this.m_localAnchorA = new St;
100500                    this.m_localAnchorB = new St;
100501                    this.m_maxLength = 0;
100502                    this.m_length = 0;
100503                    this.m_impulse = 0;
100504                    this.m_indexA = 0;
100505                    this.m_indexB = 0;
100506                    this.m_u = new St;
100507                    this.m_rA = new St;
100508                    this.m_rB = new St;
100509                    this.m_localCenterA = new St;
100510                    this.m_localCenterB = new St;
100511                    this.m_invMassA = 0;
100512                    this.m_invMassB = 0;
100513                    this.m_invIA = 0;
100514                    this.m_invIB = 0;
100515                    this.m_mass = 0;
100516                    this.m_state = t.b2LimitState.e_inactiveLimit;
100517                    this.m_qA = new Ct;
100518                    this.m_qB = new Ct;
100519                    this.m_lalcA = new St;
100520                    this.m_lalcB = new St;
100521                    this.m_localAnchorA.Copy(i(e.localAnchorA, new St(-1, 0)));
100522                    this.m_localAnchorB.Copy(i(e.localAnchorB, new St(1, 0)));
100523                    this.m_maxLength = i(e.maxLength, 0);
100524                  }
100525                  InitVelocityConstraints(e) {
100526                    this.m_indexA = this.m_bodyA.m_islandIndex;
100527                    this.m_indexB = this.m_bodyB.m_islandIndex;
100528                    this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);
100529                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
100530                    this.m_invMassA = this.m_bodyA.m_invMass;
100531                    this.m_invMassB = this.m_bodyB.m_invMass;
100532                    this.m_invIA = this.m_bodyA.m_invI;
100533                    this.m_invIB = this.m_bodyB.m_invI;
100534                    const i = e.positions[this.m_indexA].c;
100535                    const s = e.positions[this.m_indexA].a;
100536                    const n = e.velocities[this.m_indexA].v;
100537                    let r = e.velocities[this.m_indexA].w;
100538                    const o = e.positions[this.m_indexB].c;
100539                    const a = e.positions[this.m_indexB].a;
100540                    const l = e.velocities[this.m_indexB].v;
100541                    let h = e.velocities[this.m_indexB].w;
100542                    const c = this.m_qA.SetAngle(s), _ = this.m_qB.SetAngle(a);
100543                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
100544                    Ct.MulRV(c, this.m_lalcA, this.m_rA);
100545                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
100546                    Ct.MulRV(_, this.m_lalcB, this.m_rB);
100547                    this.m_u.Copy(o).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA);
100548                    this.m_length = this.m_u.Length();
100549                    const d = this.m_length - this.m_maxLength;
100550                    this.m_state = d > 0 ? t.b2LimitState.e_atUpperLimit : t.b2LimitState.e_inactiveLimit;
100551                    if (!(this.m_length > u)) {
100552                      this.m_u.SetZero();
100553                      this.m_mass = 0;
100554                      this.m_impulse = 0;
100555                      return;
100556                    }
100557                    this.m_u.SelfMul(1 / this.m_length);
100558                    const p = St.CrossVV(this.m_rA, this.m_u);
100559                    const m = St.CrossVV(this.m_rB, this.m_u);
100560                    const f = this.m_invMassA + this.m_invIA * p * p + this.m_invMassB + this.m_invIB * m * m;
100561                    this.m_mass = 0 !== f ? 1 / f : 0;
100562                    if (e.step.warmStarting) {
100563                      this.m_impulse *= e.step.dtRatio;
100564                      const t = St.MulSV(this.m_impulse, this.m_u, Ms.InitVelocityConstraints_s_P);
100565                      n.SelfMulSub(this.m_invMassA, t);
100566                      r -= this.m_invIA * St.CrossVV(this.m_rA, t);
100567                      l.SelfMulAdd(this.m_invMassB, t);
100568                      h += this.m_invIB * St.CrossVV(this.m_rB, t);
100569                    } else this.m_impulse = 0;
100570                    e.velocities[this.m_indexA].w = r;
100571                    e.velocities[this.m_indexB].w = h;
100572                  }
100573                  SolveVelocityConstraints(t) {
100574                    const e = t.velocities[this.m_indexA].v;
100575                    let i = t.velocities[this.m_indexA].w;
100576                    const s = t.velocities[this.m_indexB].v;
100577                    let n = t.velocities[this.m_indexB].w;
100578                    const r = St.AddVCrossSV(e, i, this.m_rA, Ms.SolveVelocityConstraints_s_vpA);
100579                    const o = St.AddVCrossSV(s, n, this.m_rB, Ms.SolveVelocityConstraints_s_vpB);
100580                    const a = this.m_length - this.m_maxLength;
100581                    let l = St.DotVV(this.m_u, St.SubVV(o, r, St.s_t0));
100582                    a < 0 && (l += t.step.inv_dt * a);
100583                    let h = -this.m_mass * l;
100584                    const c = this.m_impulse;
100585                    this.m_impulse = tt(0, this.m_impulse + h);
100586                    h = this.m_impulse - c;
100587                    const u = St.MulSV(h, this.m_u, Ms.SolveVelocityConstraints_s_P);
100588                    e.SelfMulSub(this.m_invMassA, u);
100589                    i -= this.m_invIA * St.CrossVV(this.m_rA, u);
100590                    s.SelfMulAdd(this.m_invMassB, u);
100591                    n += this.m_invIB * St.CrossVV(this.m_rB, u);
100592                    t.velocities[this.m_indexA].w = i;
100593                    t.velocities[this.m_indexB].w = n;
100594                  }
100595                  SolvePositionConstraints(t) {
100596                    const e = t.positions[this.m_indexA].c;
100597                    let i = t.positions[this.m_indexA].a;
100598                    const s = t.positions[this.m_indexB].c;
100599                    let n = t.positions[this.m_indexB].a;
100600                    const r = this.m_qA.SetAngle(i), o = this.m_qB.SetAngle(n);
100601                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
100602                    const a = Ct.MulRV(r, this.m_lalcA, this.m_rA);
100603                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
100604                    const l = Ct.MulRV(o, this.m_lalcB, this.m_rB);
100605                    const h = this.m_u.Copy(s).SelfAdd(l).SelfSub(e).SelfSub(a);
100606                    const c = h.Normalize();
100607                    let _ = c - this.m_maxLength;
100608                    _ = it(_, 0, g);
100609                    const d = -this.m_mass * _;
100610                    const p = St.MulSV(d, h, Ms.SolvePositionConstraints_s_P);
100611                    e.SelfMulSub(this.m_invMassA, p);
100612                    i -= this.m_invIA * St.CrossVV(a, p);
100613                    s.SelfMulAdd(this.m_invMassB, p);
100614                    n += this.m_invIB * St.CrossVV(l, p);
100615                    t.positions[this.m_indexA].a = i;
100616                    t.positions[this.m_indexB].a = n;
100617                    return c - this.m_maxLength < u;
100618                  }
100619                  GetAnchorA(t) {
100620                    return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t);
100621                  }
100622                  GetAnchorB(t) {
100623                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
100624                  }
100625                  GetReactionForce(t, e) {
100626                    return St.MulSV(t * this.m_impulse, this.m_u, e);
100627                  }
100628                  GetReactionTorque(t) {
100629                    return 0;
100630                  }
100631                  GetLocalAnchorA() {
100632                    return this.m_localAnchorA;
100633                  }
100634                  GetLocalAnchorB() {
100635                    return this.m_localAnchorB;
100636                  }
100637                  SetMaxLength(t) {
100638                    this.m_maxLength = t;
100639                  }
100640                  GetMaxLength() {
100641                    return this.m_maxLength;
100642                  }
100643                  GetLimitState() {
100644                    return this.m_state;
100645                  }
100646                  Dump(t) {
100647                    const e = this.m_bodyA.m_islandIndex;
100648                    const i = this.m_bodyB.m_islandIndex;
100649                    t("  const jd: b2RopeJointDef = new b2RopeJointDef();\n");
100650                    t("  jd.bodyA = bodies[%d];\n", e);
100651                    t("  jd.bodyB = bodies[%d];\n", i);
100652                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
100653                    t("  jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y);
100654                    t("  jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y);
100655                    t("  jd.maxLength = %.15f;\n", this.m_maxLength);
100656                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
100657                  }
100658                }
100659                Ms.InitVelocityConstraints_s_P = new St;
100660                Ms.SolveVelocityConstraints_s_vpA = new St;
100661                Ms.SolveVelocityConstraints_s_vpB = new St;
100662                Ms.SolveVelocityConstraints_s_P = new St;
100663                Ms.SolvePositionConstraints_s_P = new St;
100664                class Bs extends ls {
100665                  constructor() {
100666                    super(t.b2JointType.e_weldJoint);
100667                    this.localAnchorA = new St;
100668                    this.localAnchorB = new St;
100669                    this.referenceAngle = 0;
100670                    this.frequencyHz = 0;
100671                    this.dampingRatio = 0;
100672                  }
100673                  Initialize(t, e, i) {
100674                    this.bodyA = t;
100675                    this.bodyB = e;
100676                    this.bodyA.GetLocalPoint(i, this.localAnchorA);
100677                    this.bodyB.GetLocalPoint(i, this.localAnchorB);
100678                    this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
100679                  }
100680                }
100681                class Ds extends hs {
100682                  constructor(t) {
100683                    super(t);
100684                    this.m_frequencyHz = 0;
100685                    this.m_dampingRatio = 0;
100686                    this.m_bias = 0;
100687                    this.m_localAnchorA = new St;
100688                    this.m_localAnchorB = new St;
100689                    this.m_referenceAngle = 0;
100690                    this.m_gamma = 0;
100691                    this.m_impulse = new Tt(0, 0, 0);
100692                    this.m_indexA = 0;
100693                    this.m_indexB = 0;
100694                    this.m_rA = new St;
100695                    this.m_rB = new St;
100696                    this.m_localCenterA = new St;
100697                    this.m_localCenterB = new St;
100698                    this.m_invMassA = 0;
100699                    this.m_invMassB = 0;
100700                    this.m_invIA = 0;
100701                    this.m_invIB = 0;
100702                    this.m_mass = new Et;
100703                    this.m_qA = new Ct;
100704                    this.m_qB = new Ct;
100705                    this.m_lalcA = new St;
100706                    this.m_lalcB = new St;
100707                    this.m_K = new Et;
100708                    this.m_frequencyHz = i(t.frequencyHz, 0);
100709                    this.m_dampingRatio = i(t.dampingRatio, 0);
100710                    this.m_localAnchorA.Copy(i(t.localAnchorA, St.ZERO));
100711                    this.m_localAnchorB.Copy(i(t.localAnchorB, St.ZERO));
100712                    this.m_referenceAngle = i(t.referenceAngle, 0);
100713                    this.m_impulse.SetZero();
100714                  }
100715                  InitVelocityConstraints(t) {
100716                    this.m_indexA = this.m_bodyA.m_islandIndex;
100717                    this.m_indexB = this.m_bodyB.m_islandIndex;
100718                    this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);
100719                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
100720                    this.m_invMassA = this.m_bodyA.m_invMass;
100721                    this.m_invMassB = this.m_bodyB.m_invMass;
100722                    this.m_invIA = this.m_bodyA.m_invI;
100723                    this.m_invIB = this.m_bodyB.m_invI;
100724                    const e = t.positions[this.m_indexA].a;
100725                    const i = t.velocities[this.m_indexA].v;
100726                    let s = t.velocities[this.m_indexA].w;
100727                    const n = t.positions[this.m_indexB].a;
100728                    const r = t.velocities[this.m_indexB].v;
100729                    let a = t.velocities[this.m_indexB].w;
100730                    const l = this.m_qA.SetAngle(e), h = this.m_qB.SetAngle(n);
100731                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
100732                    Ct.MulRV(l, this.m_lalcA, this.m_rA);
100733                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
100734                    Ct.MulRV(h, this.m_lalcB, this.m_rB);
100735                    const c = this.m_invMassA, u = this.m_invMassB;
100736                    const _ = this.m_invIA, d = this.m_invIB;
100737                    const p = this.m_K;
100738                    p.ex.x = c + u + this.m_rA.y * this.m_rA.y * _ + this.m_rB.y * this.m_rB.y * d;
100739                    p.ey.x = -this.m_rA.y * this.m_rA.x * _ - this.m_rB.y * this.m_rB.x * d;
100740                    p.ez.x = -this.m_rA.y * _ - this.m_rB.y * d;
100741                    p.ex.y = p.ey.x;
100742                    p.ey.y = c + u + this.m_rA.x * this.m_rA.x * _ + this.m_rB.x * this.m_rB.x * d;
100743                    p.ez.y = this.m_rA.x * _ + this.m_rB.x * d;
100744                    p.ex.z = p.ez.x;
100745                    p.ey.z = p.ez.y;
100746                    p.ez.z = _ + d;
100747                    if (this.m_frequencyHz > 0) {
100748                      p.GetInverse22(this.m_mass);
100749                      let i = _ + d;
100750                      const s = i > 0 ? 1 / i : 0;
100751                      const r = n - e - this.m_referenceAngle;
100752                      const a = 2 * o * this.m_frequencyHz;
100753                      const l = 2 * s * this.m_dampingRatio * a;
100754                      const h = s * a * a;
100755                      const c = t.step.dt;
100756                      this.m_gamma = c * (l + c * h);
100757                      this.m_gamma = 0 !== this.m_gamma ? 1 / this.m_gamma : 0;
100758                      this.m_bias = r * c * h * this.m_gamma;
100759                      i += this.m_gamma;
100760                      this.m_mass.ez.z = 0 !== i ? 1 / i : 0;
100761                    } else {
100762                      p.GetSymInverse33(this.m_mass);
100763                      this.m_gamma = 0;
100764                      this.m_bias = 0;
100765                    }
100766                    if (t.step.warmStarting) {
100767                      this.m_impulse.SelfMul(t.step.dtRatio);
100768                      const e = Ds.InitVelocityConstraints_s_P.Set(this.m_impulse.x, this.m_impulse.y);
100769                      i.SelfMulSub(c, e);
100770                      s -= _ * (St.CrossVV(this.m_rA, e) + this.m_impulse.z);
100771                      r.SelfMulAdd(u, e);
100772                      a += d * (St.CrossVV(this.m_rB, e) + this.m_impulse.z);
100773                    } else this.m_impulse.SetZero();
100774                    t.velocities[this.m_indexA].w = s;
100775                    t.velocities[this.m_indexB].w = a;
100776                  }
100777                  SolveVelocityConstraints(t) {
100778                    const e = t.velocities[this.m_indexA].v;
100779                    let i = t.velocities[this.m_indexA].w;
100780                    const s = t.velocities[this.m_indexB].v;
100781                    let n = t.velocities[this.m_indexB].w;
100782                    const r = this.m_invMassA, o = this.m_invMassB;
100783                    const a = this.m_invIA, l = this.m_invIB;
100784                    if (this.m_frequencyHz > 0) {
100785                      const t = n - i;
100786                      const h = -this.m_mass.ez.z * (t + this.m_bias + this.m_gamma * this.m_impulse.z);
100787                      this.m_impulse.z += h;
100788                      i -= a * h;
100789                      n += l * h;
100790                      const c = St.SubVV(St.AddVCrossSV(s, n, this.m_rB, St.s_t0), St.AddVCrossSV(e, i, this.m_rA, St.s_t1), Ds.SolveVelocityConstraints_s_Cdot1);
100791                      const u = Et.MulM33XY(this.m_mass, c.x, c.y, Ds.SolveVelocityConstraints_s_impulse1).SelfNeg();
100792                      this.m_impulse.x += u.x;
100793                      this.m_impulse.y += u.y;
100794                      const _ = u;
100795                      e.SelfMulSub(r, _);
100796                      i -= a * St.CrossVV(this.m_rA, _);
100797                      s.SelfMulAdd(o, _);
100798                      n += l * St.CrossVV(this.m_rB, _);
100799                    } else {
100800                      const t = St.SubVV(St.AddVCrossSV(s, n, this.m_rB, St.s_t0), St.AddVCrossSV(e, i, this.m_rA, St.s_t1), Ds.SolveVelocityConstraints_s_Cdot1);
100801                      const h = n - i;
100802                      const c = Et.MulM33XYZ(this.m_mass, t.x, t.y, h, Ds.SolveVelocityConstraints_s_impulse).SelfNeg();
100803                      this.m_impulse.SelfAdd(c);
100804                      const u = Ds.SolveVelocityConstraints_s_P.Set(c.x, c.y);
100805                      e.SelfMulSub(r, u);
100806                      i -= a * (St.CrossVV(this.m_rA, u) + c.z);
100807                      s.SelfMulAdd(o, u);
100808                      n += l * (St.CrossVV(this.m_rB, u) + c.z);
100809                    }
100810                    t.velocities[this.m_indexA].w = i;
100811                    t.velocities[this.m_indexB].w = n;
100812                  }
100813                  SolvePositionConstraints(t) {
100814                    const e = t.positions[this.m_indexA].c;
100815                    let i = t.positions[this.m_indexA].a;
100816                    const s = t.positions[this.m_indexB].c;
100817                    let n = t.positions[this.m_indexB].a;
100818                    const r = this.m_qA.SetAngle(i), o = this.m_qB.SetAngle(n);
100819                    const a = this.m_invMassA, l = this.m_invMassB;
100820                    const h = this.m_invIA, c = this.m_invIB;
100821                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
100822                    const d = Ct.MulRV(r, this.m_lalcA, this.m_rA);
100823                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
100824                    const p = Ct.MulRV(o, this.m_lalcB, this.m_rB);
100825                    let m, f;
100826                    const g = this.m_K;
100827                    g.ex.x = a + l + d.y * d.y * h + p.y * p.y * c;
100828                    g.ey.x = -d.y * d.x * h - p.y * p.x * c;
100829                    g.ez.x = -d.y * h - p.y * c;
100830                    g.ex.y = g.ey.x;
100831                    g.ey.y = a + l + d.x * d.x * h + p.x * p.x * c;
100832                    g.ez.y = d.x * h + p.x * c;
100833                    g.ex.z = g.ez.x;
100834                    g.ey.z = g.ez.y;
100835                    g.ez.z = h + c;
100836                    if (this.m_frequencyHz > 0) {
100837                      const t = St.SubVV(St.AddVV(s, p, St.s_t0), St.AddVV(e, d, St.s_t1), Ds.SolvePositionConstraints_s_C1);
100838                      m = t.Length();
100839                      f = 0;
100840                      const r = g.Solve22(t.x, t.y, Ds.SolvePositionConstraints_s_P).SelfNeg();
100841                      e.SelfMulSub(a, r);
100842                      i -= h * St.CrossVV(d, r);
100843                      s.SelfMulAdd(l, r);
100844                      n += c * St.CrossVV(p, r);
100845                    } else {
100846                      const t = St.SubVV(St.AddVV(s, p, St.s_t0), St.AddVV(e, d, St.s_t1), Ds.SolvePositionConstraints_s_C1);
100847                      const r = n - i - this.m_referenceAngle;
100848                      m = t.Length();
100849                      f = $(r);
100850                      const o = g.Solve33(t.x, t.y, r, Ds.SolvePositionConstraints_s_impulse).SelfNeg();
100851                      const u = Ds.SolvePositionConstraints_s_P.Set(o.x, o.y);
100852                      e.SelfMulSub(a, u);
100853                      i -= h * (St.CrossVV(this.m_rA, u) + o.z);
100854                      s.SelfMulAdd(l, u);
100855                      n += c * (St.CrossVV(this.m_rB, u) + o.z);
100856                    }
100857                    t.positions[this.m_indexA].a = i;
100858                    t.positions[this.m_indexB].a = n;
100859                    return m <= u && f <= _;
100860                  }
100861                  GetAnchorA(t) {
100862                    return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t);
100863                  }
100864                  GetAnchorB(t) {
100865                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
100866                  }
100867                  GetReactionForce(t, e) {
100868                    e.x = t * this.m_impulse.x;
100869                    e.y = t * this.m_impulse.y;
100870                    return e;
100871                  }
100872                  GetReactionTorque(t) {
100873                    return t * this.m_impulse.z;
100874                  }
100875                  GetLocalAnchorA() {
100876                    return this.m_localAnchorA;
100877                  }
100878                  GetLocalAnchorB() {
100879                    return this.m_localAnchorB;
100880                  }
100881                  GetReferenceAngle() {
100882                    return this.m_referenceAngle;
100883                  }
100884                  SetFrequency(t) {
100885                    this.m_frequencyHz = t;
100886                  }
100887                  GetFrequency() {
100888                    return this.m_frequencyHz;
100889                  }
100890                  SetDampingRatio(t) {
100891                    this.m_dampingRatio = t;
100892                  }
100893                  GetDampingRatio() {
100894                    return this.m_dampingRatio;
100895                  }
100896                  Dump(t) {
100897                    const e = this.m_bodyA.m_islandIndex;
100898                    const i = this.m_bodyB.m_islandIndex;
100899                    t("  const jd: b2WeldJointDef = new b2WeldJointDef();\n");
100900                    t("  jd.bodyA = bodies[%d];\n", e);
100901                    t("  jd.bodyB = bodies[%d];\n", i);
100902                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
100903                    t("  jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y);
100904                    t("  jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y);
100905                    t("  jd.referenceAngle = %.15f;\n", this.m_referenceAngle);
100906                    t("  jd.frequencyHz = %.15f;\n", this.m_frequencyHz);
100907                    t("  jd.dampingRatio = %.15f;\n", this.m_dampingRatio);
100908                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
100909                  }
100910                }
100911                Ds.InitVelocityConstraints_s_P = new St;
100912                Ds.SolveVelocityConstraints_s_Cdot1 = new St;
100913                Ds.SolveVelocityConstraints_s_impulse1 = new St;
100914                Ds.SolveVelocityConstraints_s_impulse = new Tt;
100915                Ds.SolveVelocityConstraints_s_P = new St;
100916                Ds.SolvePositionConstraints_s_C1 = new St;
100917                Ds.SolvePositionConstraints_s_P = new St;
100918                Ds.SolvePositionConstraints_s_impulse = new Tt;
100919                class Ps extends ls {
100920                  constructor() {
100921                    super(t.b2JointType.e_wheelJoint);
100922                    this.localAnchorA = new St(0, 0);
100923                    this.localAnchorB = new St(0, 0);
100924                    this.localAxisA = new St(1, 0);
100925                    this.enableMotor = !1;
100926                    this.maxMotorTorque = 0;
100927                    this.motorSpeed = 0;
100928                    this.frequencyHz = 2;
100929                    this.dampingRatio = .7;
100930                  }
100931                  Initialize(t, e, i, s) {
100932                    this.bodyA = t;
100933                    this.bodyB = e;
100934                    this.bodyA.GetLocalPoint(i, this.localAnchorA);
100935                    this.bodyB.GetLocalPoint(i, this.localAnchorB);
100936                    this.bodyA.GetLocalVector(s, this.localAxisA);
100937                  }
100938                }
100939                class Os extends hs {
100940                  constructor(t) {
100941                    super(t);
100942                    this.m_frequencyHz = 0;
100943                    this.m_dampingRatio = 0;
100944                    this.m_localAnchorA = new St;
100945                    this.m_localAnchorB = new St;
100946                    this.m_localXAxisA = new St;
100947                    this.m_localYAxisA = new St;
100948                    this.m_impulse = 0;
100949                    this.m_motorImpulse = 0;
100950                    this.m_springImpulse = 0;
100951                    this.m_maxMotorTorque = 0;
100952                    this.m_motorSpeed = 0;
100953                    this.m_enableMotor = !1;
100954                    this.m_indexA = 0;
100955                    this.m_indexB = 0;
100956                    this.m_localCenterA = new St;
100957                    this.m_localCenterB = new St;
100958                    this.m_invMassA = 0;
100959                    this.m_invMassB = 0;
100960                    this.m_invIA = 0;
100961                    this.m_invIB = 0;
100962                    this.m_ax = new St;
100963                    this.m_ay = new St;
100964                    this.m_sAx = 0;
100965                    this.m_sBx = 0;
100966                    this.m_sAy = 0;
100967                    this.m_sBy = 0;
100968                    this.m_mass = 0;
100969                    this.m_motorMass = 0;
100970                    this.m_springMass = 0;
100971                    this.m_bias = 0;
100972                    this.m_gamma = 0;
100973                    this.m_qA = new Ct;
100974                    this.m_qB = new Ct;
100975                    this.m_lalcA = new St;
100976                    this.m_lalcB = new St;
100977                    this.m_rA = new St;
100978                    this.m_rB = new St;
100979                    this.m_frequencyHz = i(t.frequencyHz, 2);
100980                    this.m_dampingRatio = i(t.dampingRatio, .7);
100981                    this.m_localAnchorA.Copy(i(t.localAnchorA, St.ZERO));
100982                    this.m_localAnchorB.Copy(i(t.localAnchorB, St.ZERO));
100983                    this.m_localXAxisA.Copy(i(t.localAxisA, St.UNITX));
100984                    St.CrossOneV(this.m_localXAxisA, this.m_localYAxisA);
100985                    this.m_maxMotorTorque = i(t.maxMotorTorque, 0);
100986                    this.m_motorSpeed = i(t.motorSpeed, 0);
100987                    this.m_enableMotor = i(t.enableMotor, !1);
100988                    this.m_ax.SetZero();
100989                    this.m_ay.SetZero();
100990                  }
100991                  GetMotorSpeed() {
100992                    return this.m_motorSpeed;
100993                  }
100994                  GetMaxMotorTorque() {
100995                    return this.m_maxMotorTorque;
100996                  }
100997                  SetSpringFrequencyHz(t) {
100998                    this.m_frequencyHz = t;
100999                  }
101000                  GetSpringFrequencyHz() {
101001                    return this.m_frequencyHz;
101002                  }
101003                  SetSpringDampingRatio(t) {
101004                    this.m_dampingRatio = t;
101005                  }
101006                  GetSpringDampingRatio() {
101007                    return this.m_dampingRatio;
101008                  }
101009                  InitVelocityConstraints(t) {
101010                    this.m_indexA = this.m_bodyA.m_islandIndex;
101011                    this.m_indexB = this.m_bodyB.m_islandIndex;
101012                    this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);
101013                    this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);
101014                    this.m_invMassA = this.m_bodyA.m_invMass;
101015                    this.m_invMassB = this.m_bodyB.m_invMass;
101016                    this.m_invIA = this.m_bodyA.m_invI;
101017                    this.m_invIB = this.m_bodyB.m_invI;
101018                    const e = this.m_invMassA, i = this.m_invMassB;
101019                    const s = this.m_invIA, n = this.m_invIB;
101020                    const r = t.positions[this.m_indexA].c;
101021                    const a = t.positions[this.m_indexA].a;
101022                    const l = t.velocities[this.m_indexA].v;
101023                    let h = t.velocities[this.m_indexA].w;
101024                    const c = t.positions[this.m_indexB].c;
101025                    const u = t.positions[this.m_indexB].a;
101026                    const _ = t.velocities[this.m_indexB].v;
101027                    let d = t.velocities[this.m_indexB].w;
101028                    const p = this.m_qA.SetAngle(a), m = this.m_qB.SetAngle(u);
101029                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
101030                    const f = Ct.MulRV(p, this.m_lalcA, this.m_rA);
101031                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
101032                    const g = Ct.MulRV(m, this.m_lalcB, this.m_rB);
101033                    const y = St.SubVV(St.AddVV(c, g, St.s_t0), St.AddVV(r, f, St.s_t1), Os.InitVelocityConstraints_s_d);
101034                    Ct.MulRV(p, this.m_localYAxisA, this.m_ay);
101035                    this.m_sAy = St.CrossVV(St.AddVV(y, f, St.s_t0), this.m_ay);
101036                    this.m_sBy = St.CrossVV(g, this.m_ay);
101037                    this.m_mass = e + i + s * this.m_sAy * this.m_sAy + n * this.m_sBy * this.m_sBy;
101038                    this.m_mass > 0 && (this.m_mass = 1 / this.m_mass);
101039                    this.m_springMass = 0;
101040                    this.m_bias = 0;
101041                    this.m_gamma = 0;
101042                    if (this.m_frequencyHz > 0) {
101043                      Ct.MulRV(p, this.m_localXAxisA, this.m_ax);
101044                      this.m_sAx = St.CrossVV(St.AddVV(y, f, St.s_t0), this.m_ax);
101045                      this.m_sBx = St.CrossVV(g, this.m_ax);
101046                      const r = e + i + s * this.m_sAx * this.m_sAx + n * this.m_sBx * this.m_sBx;
101047                      if (r > 0) {
101048                        this.m_springMass = 1 / r;
101049                        const e = St.DotVV(y, this.m_ax);
101050                        const i = 2 * o * this.m_frequencyHz;
101051                        const s = 2 * this.m_springMass * this.m_dampingRatio * i;
101052                        const n = this.m_springMass * i * i;
101053                        const a = t.step.dt;
101054                        this.m_gamma = a * (s + a * n);
101055                        this.m_gamma > 0 && (this.m_gamma = 1 / this.m_gamma);
101056                        this.m_bias = e * a * n * this.m_gamma;
101057                        this.m_springMass = r + this.m_gamma;
101058                        this.m_springMass > 0 && (this.m_springMass = 1 / this.m_springMass);
101059                      }
101060                    } else this.m_springImpulse = 0;
101061                    if (this.m_enableMotor) {
101062                      this.m_motorMass = s + n;
101063                      this.m_motorMass > 0 && (this.m_motorMass = 1 / this.m_motorMass);
101064                    } else {
101065                      this.m_motorMass = 0;
101066                      this.m_motorImpulse = 0;
101067                    }
101068                    if (t.step.warmStarting) {
101069                      this.m_impulse *= t.step.dtRatio;
101070                      this.m_springImpulse *= t.step.dtRatio;
101071                      this.m_motorImpulse *= t.step.dtRatio;
101072                      const e = St.AddVV(St.MulSV(this.m_impulse, this.m_ay, St.s_t0), St.MulSV(this.m_springImpulse, this.m_ax, St.s_t1), Os.InitVelocityConstraints_s_P);
101073                      const i = this.m_impulse * this.m_sAy + this.m_springImpulse * this.m_sAx + this.m_motorImpulse;
101074                      const s = this.m_impulse * this.m_sBy + this.m_springImpulse * this.m_sBx + this.m_motorImpulse;
101075                      l.SelfMulSub(this.m_invMassA, e);
101076                      h -= this.m_invIA * i;
101077                      _.SelfMulAdd(this.m_invMassB, e);
101078                      d += this.m_invIB * s;
101079                    } else {
101080                      this.m_impulse = 0;
101081                      this.m_springImpulse = 0;
101082                      this.m_motorImpulse = 0;
101083                    }
101084                    t.velocities[this.m_indexA].w = h;
101085                    t.velocities[this.m_indexB].w = d;
101086                  }
101087                  SolveVelocityConstraints(t) {
101088                    const e = this.m_invMassA, i = this.m_invMassB;
101089                    const s = this.m_invIA, n = this.m_invIB;
101090                    const r = t.velocities[this.m_indexA].v;
101091                    let o = t.velocities[this.m_indexA].w;
101092                    const a = t.velocities[this.m_indexB].v;
101093                    let l = t.velocities[this.m_indexB].w;
101094                    {
101095                      const t = St.DotVV(this.m_ax, St.SubVV(a, r, St.s_t0)) + this.m_sBx * l - this.m_sAx * o;
101096                      const h = -this.m_springMass * (t + this.m_bias + this.m_gamma * this.m_springImpulse);
101097                      this.m_springImpulse += h;
101098                      const c = St.MulSV(h, this.m_ax, Os.SolveVelocityConstraints_s_P);
101099                      const u = h * this.m_sAx;
101100                      const _ = h * this.m_sBx;
101101                      r.SelfMulSub(e, c);
101102                      o -= s * u;
101103                      a.SelfMulAdd(i, c);
101104                      l += n * _;
101105                    }
101106                    {
101107                      const e = l - o - this.m_motorSpeed;
101108                      let i = -this.m_motorMass * e;
101109                      const r = this.m_motorImpulse;
101110                      const a = t.step.dt * this.m_maxMotorTorque;
101111                      this.m_motorImpulse = it(this.m_motorImpulse + i, -a, a);
101112                      i = this.m_motorImpulse - r;
101113                      o -= s * i;
101114                      l += n * i;
101115                    }
101116                    {
101117                      const t = St.DotVV(this.m_ay, St.SubVV(a, r, St.s_t0)) + this.m_sBy * l - this.m_sAy * o;
101118                      const h = -this.m_mass * t;
101119                      this.m_impulse += h;
101120                      const c = St.MulSV(h, this.m_ay, Os.SolveVelocityConstraints_s_P);
101121                      const u = h * this.m_sAy;
101122                      const _ = h * this.m_sBy;
101123                      r.SelfMulSub(e, c);
101124                      o -= s * u;
101125                      a.SelfMulAdd(i, c);
101126                      l += n * _;
101127                    }
101128                    t.velocities[this.m_indexA].w = o;
101129                    t.velocities[this.m_indexB].w = l;
101130                  }
101131                  SolvePositionConstraints(t) {
101132                    const e = t.positions[this.m_indexA].c;
101133                    let i = t.positions[this.m_indexA].a;
101134                    const s = t.positions[this.m_indexB].c;
101135                    let n = t.positions[this.m_indexB].a;
101136                    const r = this.m_qA.SetAngle(i), o = this.m_qB.SetAngle(n);
101137                    St.SubVV(this.m_localAnchorA, this.m_localCenterA, this.m_lalcA);
101138                    const a = Ct.MulRV(r, this.m_lalcA, this.m_rA);
101139                    St.SubVV(this.m_localAnchorB, this.m_localCenterB, this.m_lalcB);
101140                    const l = Ct.MulRV(o, this.m_lalcB, this.m_rB);
101141                    const h = St.AddVV(St.SubVV(s, e, St.s_t0), St.SubVV(l, a, St.s_t1), Os.SolvePositionConstraints_s_d);
101142                    const c = Ct.MulRV(r, this.m_localYAxisA, this.m_ay);
101143                    const _ = St.CrossVV(St.AddVV(h, a, St.s_t0), c);
101144                    const d = St.CrossVV(l, c);
101145                    const p = St.DotVV(h, this.m_ay);
101146                    const m = this.m_invMassA + this.m_invMassB + this.m_invIA * this.m_sAy * this.m_sAy + this.m_invIB * this.m_sBy * this.m_sBy;
101147                    let f;
101148                    f = 0 !== m ? -p / m : 0;
101149                    const g = St.MulSV(f, c, Os.SolvePositionConstraints_s_P);
101150                    const y = f * _;
101151                    const b = f * d;
101152                    e.SelfMulSub(this.m_invMassA, g);
101153                    i -= this.m_invIA * y;
101154                    s.SelfMulAdd(this.m_invMassB, g);
101155                    n += this.m_invIB * b;
101156                    t.positions[this.m_indexA].a = i;
101157                    t.positions[this.m_indexB].a = n;
101158                    return $(p) <= u;
101159                  }
101160                  GetDefinition(t) {
101161                    return t;
101162                  }
101163                  GetAnchorA(t) {
101164                    return this.m_bodyA.GetWorldPoint(this.m_localAnchorA, t);
101165                  }
101166                  GetAnchorB(t) {
101167                    return this.m_bodyB.GetWorldPoint(this.m_localAnchorB, t);
101168                  }
101169                  GetReactionForce(t, e) {
101170                    e.x = t * (this.m_impulse * this.m_ay.x + this.m_springImpulse * this.m_ax.x);
101171                    e.y = t * (this.m_impulse * this.m_ay.y + this.m_springImpulse * this.m_ax.y);
101172                    return e;
101173                  }
101174                  GetReactionTorque(t) {
101175                    return t * this.m_motorImpulse;
101176                  }
101177                  GetLocalAnchorA() {
101178                    return this.m_localAnchorA;
101179                  }
101180                  GetLocalAnchorB() {
101181                    return this.m_localAnchorB;
101182                  }
101183                  GetLocalAxisA() {
101184                    return this.m_localXAxisA;
101185                  }
101186                  GetJointTranslation() {
101187                    return this.GetPrismaticJointTranslation();
101188                  }
101189                  GetJointLinearSpeed() {
101190                    return this.GetPrismaticJointSpeed();
101191                  }
101192                  GetJointAngle() {
101193                    return this.GetRevoluteJointAngle();
101194                  }
101195                  GetJointAngularSpeed() {
101196                    return this.GetRevoluteJointSpeed();
101197                  }
101198                  GetPrismaticJointTranslation() {
101199                    const t = this.m_bodyA;
101200                    const e = this.m_bodyB;
101201                    const i = t.GetWorldPoint(this.m_localAnchorA, new St);
101202                    const s = e.GetWorldPoint(this.m_localAnchorB, new St);
101203                    const n = St.SubVV(s, i, new St);
101204                    const r = t.GetWorldVector(this.m_localXAxisA, new St);
101205                    return St.DotVV(n, r);
101206                  }
101207                  GetPrismaticJointSpeed() {
101208                    const t = this.m_bodyA;
101209                    const e = this.m_bodyB;
101210                    St.SubVV(this.m_localAnchorA, t.m_sweep.localCenter, this.m_lalcA);
101211                    const i = Ct.MulRV(t.m_xf.q, this.m_lalcA, this.m_rA);
101212                    St.SubVV(this.m_localAnchorB, e.m_sweep.localCenter, this.m_lalcB);
101213                    const s = Ct.MulRV(e.m_xf.q, this.m_lalcB, this.m_rB);
101214                    const n = St.AddVV(t.m_sweep.c, i, St.s_t0);
101215                    const r = St.AddVV(e.m_sweep.c, s, St.s_t1);
101216                    const o = St.SubVV(r, n, St.s_t2);
101217                    const a = t.GetWorldVector(this.m_localXAxisA, new St);
101218                    const l = t.m_linearVelocity;
101219                    const h = e.m_linearVelocity;
101220                    const c = t.m_angularVelocity;
101221                    const u = e.m_angularVelocity;
101222                    return St.DotVV(o, St.CrossSV(c, a, St.s_t0)) + St.DotVV(a, St.SubVV(St.AddVCrossSV(h, u, s, St.s_t0), St.AddVCrossSV(l, c, i, St.s_t1), St.s_t0));
101223                  }
101224                  GetRevoluteJointAngle() {
101225                    return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a;
101226                  }
101227                  GetRevoluteJointSpeed() {
101228                    const t = this.m_bodyA.m_angularVelocity;
101229                    return this.m_bodyB.m_angularVelocity - t;
101230                  }
101231                  IsMotorEnabled() {
101232                    return this.m_enableMotor;
101233                  }
101234                  EnableMotor(t) {
101235                    if (t !== this.m_enableMotor) {
101236                      this.m_bodyA.SetAwake(!0);
101237                      this.m_bodyB.SetAwake(!0);
101238                      this.m_enableMotor = t;
101239                    }
101240                  }
101241                  SetMotorSpeed(t) {
101242                    if (t !== this.m_motorSpeed) {
101243                      this.m_bodyA.SetAwake(!0);
101244                      this.m_bodyB.SetAwake(!0);
101245                      this.m_motorSpeed = t;
101246                    }
101247                  }
101248                  SetMaxMotorTorque(t) {
101249                    if (t !== this.m_maxMotorTorque) {
101250                      this.m_bodyA.SetAwake(!0);
101251                      this.m_bodyB.SetAwake(!0);
101252                      this.m_maxMotorTorque = t;
101253                    }
101254                  }
101255                  GetMotorTorque(t) {
101256                    return t * this.m_motorImpulse;
101257                  }
101258                  Dump(t) {
101259                    const e = this.m_bodyA.m_islandIndex;
101260                    const i = this.m_bodyB.m_islandIndex;
101261                    t("  const jd: b2WheelJointDef = new b2WheelJointDef();\n");
101262                    t("  jd.bodyA = bodies[%d];\n", e);
101263                    t("  jd.bodyB = bodies[%d];\n", i);
101264                    t("  jd.collideConnected = %s;\n", this.m_collideConnected ? "true" : "false");
101265                    t("  jd.localAnchorA.Set(%.15f, %.15f);\n", this.m_localAnchorA.x, this.m_localAnchorA.y);
101266                    t("  jd.localAnchorB.Set(%.15f, %.15f);\n", this.m_localAnchorB.x, this.m_localAnchorB.y);
101267                    t("  jd.localAxisA.Set(%.15f, %.15f);\n", this.m_localXAxisA.x, this.m_localXAxisA.y);
101268                    t("  jd.enableMotor = %s;\n", this.m_enableMotor ? "true" : "false");
101269                    t("  jd.motorSpeed = %.15f;\n", this.m_motorSpeed);
101270                    t("  jd.maxMotorTorque = %.15f;\n", this.m_maxMotorTorque);
101271                    t("  jd.frequencyHz = %.15f;\n", this.m_frequencyHz);
101272                    t("  jd.dampingRatio = %.15f;\n", this.m_dampingRatio);
101273                    t("  joints[%d] = this.m_world.CreateJoint(jd);\n", this.m_index);
101274                  }
101275                }
101276                Os.InitVelocityConstraints_s_d = new St;
101277                Os.InitVelocityConstraints_s_P = new St;
101278                Os.SolveVelocityConstraints_s_P = new St;
101279                Os.SolvePositionConstraints_s_d = new St;
101280                Os.SolvePositionConstraints_s_P = new St;
101281                function Ns(t, e) {
101282                  return at(t * e);
101283                }
101284                function Ls(t, e) {
101285                  return t > e ? t : e;
101286                }
101287                class Fs {
101288                  constructor(t) {
101289                    this._other = null;
101290                    this.prev = null;
101291                    this.next = null;
101292                    this.contact = t;
101293                  }
101294                  get other() {
101295                    if (null === this._other) throw new Error;
101296                    return this._other;
101297                  }
101298                  set other(t) {
101299                    if (null !== this._other) throw new Error;
101300                    this._other = t;
101301                  }
101302                  Reset() {
101303                    this._other = null;
101304                    this.prev = null;
101305                    this.next = null;
101306                  }
101307                }
101308                class Vs {
101309                  constructor() {
101310                    this.m_islandFlag = !1;
101311                    this.m_touchingFlag = !1;
101312                    this.m_enabledFlag = !1;
101313                    this.m_filterFlag = !1;
101314                    this.m_bulletHitFlag = !1;
101315                    this.m_toiFlag = !1;
101316                    this.m_prev = null;
101317                    this.m_next = null;
101318                    this.m_nodeA = new Fs(this);
101319                    this.m_nodeB = new Fs(this);
101320                    this.m_indexA = 0;
101321                    this.m_indexB = 0;
101322                    this.m_manifold = new ue;
101323                    this.m_toiCount = 0;
101324                    this.m_toi = 0;
101325                    this.m_friction = 0;
101326                    this.m_restitution = 0;
101327                    this.m_tangentSpeed = 0;
101328                    this.m_oldManifold = new ue;
101329                  }
101330                  GetManifold() {
101331                    return this.m_manifold;
101332                  }
101333                  GetWorldManifold(t) {
101334                    const e = this.m_fixtureA.GetBody();
101335                    const i = this.m_fixtureB.GetBody();
101336                    const s = this.GetShapeA();
101337                    const n = this.GetShapeB();
101338                    t.Initialize(this.m_manifold, e.GetTransform(), s.m_radius, i.GetTransform(), n.m_radius);
101339                  }
101340                  IsTouching() {
101341                    return this.m_touchingFlag;
101342                  }
101343                  SetEnabled(t) {
101344                    this.m_enabledFlag = t;
101345                  }
101346                  IsEnabled() {
101347                    return this.m_enabledFlag;
101348                  }
101349                  GetNext() {
101350                    return this.m_next;
101351                  }
101352                  GetFixtureA() {
101353                    return this.m_fixtureA;
101354                  }
101355                  GetChildIndexA() {
101356                    return this.m_indexA;
101357                  }
101358                  GetShapeA() {
101359                    return this.m_fixtureA.GetShape();
101360                  }
101361                  GetFixtureB() {
101362                    return this.m_fixtureB;
101363                  }
101364                  GetChildIndexB() {
101365                    return this.m_indexB;
101366                  }
101367                  GetShapeB() {
101368                    return this.m_fixtureB.GetShape();
101369                  }
101370                  FlagForFiltering() {
101371                    this.m_filterFlag = !0;
101372                  }
101373                  SetFriction(t) {
101374                    this.m_friction = t;
101375                  }
101376                  GetFriction() {
101377                    return this.m_friction;
101378                  }
101379                  ResetFriction() {
101380                    this.m_friction = Ns(this.m_fixtureA.m_friction, this.m_fixtureB.m_friction);
101381                  }
101382                  SetRestitution(t) {
101383                    this.m_restitution = t;
101384                  }
101385                  GetRestitution() {
101386                    return this.m_restitution;
101387                  }
101388                  ResetRestitution() {
101389                    this.m_restitution = Ls(this.m_fixtureA.m_restitution, this.m_fixtureB.m_restitution);
101390                  }
101391                  SetTangentSpeed(t) {
101392                    this.m_tangentSpeed = t;
101393                  }
101394                  GetTangentSpeed() {
101395                    return this.m_tangentSpeed;
101396                  }
101397                  Reset(t, e, i, s) {
101398                    this.m_islandFlag = !1;
101399                    this.m_touchingFlag = !1;
101400                    this.m_enabledFlag = !0;
101401                    this.m_filterFlag = !1;
101402                    this.m_bulletHitFlag = !1;
101403                    this.m_toiFlag = !1;
101404                    this.m_fixtureA = t;
101405                    this.m_fixtureB = i;
101406                    this.m_indexA = e;
101407                    this.m_indexB = s;
101408                    this.m_manifold.pointCount = 0;
101409                    this.m_prev = null;
101410                    this.m_next = null;
101411                    this.m_nodeA.Reset();
101412                    this.m_nodeB.Reset();
101413                    this.m_toiCount = 0;
101414                    this.m_friction = Ns(this.m_fixtureA.m_friction, this.m_fixtureB.m_friction);
101415                    this.m_restitution = Ls(this.m_fixtureA.m_restitution, this.m_fixtureB.m_restitution);
101416                  }
101417                  Update(t) {
101418                    const e = this.m_oldManifold;
101419                    this.m_oldManifold = this.m_manifold;
101420                    this.m_manifold = e;
101421                    this.m_enabledFlag = !0;
101422                    let i = !1;
101423                    const s = this.m_touchingFlag;
101424                    const n = this.m_fixtureA.IsSensor();
101425                    const r = this.m_fixtureB.IsSensor();
101426                    const o = n || r;
101427                    const a = this.m_fixtureA.GetBody();
101428                    const l = this.m_fixtureB.GetBody();
101429                    const h = a.GetTransform();
101430                    const c = l.GetTransform();
101431                    if (o) {
101432                      const t = this.GetShapeA();
101433                      const e = this.GetShapeB();
101434                      i = ve(t, this.m_indexA, e, this.m_indexB, h, c);
101435                      this.m_manifold.pointCount = 0;
101436                    } else {
101437                      this.Evaluate(this.m_manifold, h, c);
101438                      i = this.m_manifold.pointCount > 0;
101439                      for (let t = 0; t < this.m_manifold.pointCount; ++t) {
101440                        const e = this.m_manifold.points[t];
101441                        e.normalImpulse = 0;
101442                        e.tangentImpulse = 0;
101443                        const i = e.id;
101444                        for (let t = 0; t < this.m_oldManifold.pointCount; ++t) {
101445                          const s = this.m_oldManifold.points[t];
101446                          if (s.id.key === i.key) {
101447                            e.normalImpulse = s.normalImpulse;
101448                            e.tangentImpulse = s.tangentImpulse;
101449                            break;
101450                          }
101451                        }
101452                      }
101453                      if (i !== s) {
101454                        a.SetAwake(!0);
101455                        l.SetAwake(!0);
101456                      }
101457                    }
101458                    this.m_touchingFlag = i;
101459                    !s && i && t && t.BeginContact(this);
101460                    s && !i && t && t.EndContact(this);
101461                    !o && i && t && t.PreSolve(this, this.m_oldManifold);
101462                  }
101463                  ComputeTOI(t, e) {
101464                    const i = Vs.ComputeTOI_s_input;
101465                    i.proxyA.SetShape(this.GetShapeA(), this.m_indexA);
101466                    i.proxyB.SetShape(this.GetShapeB(), this.m_indexB);
101467                    i.sweepA.Copy(t);
101468                    i.sweepB.Copy(e);
101469                    i.tMax = u;
101470                    const s = Vs.ComputeTOI_s_output;
101471                    $e(s, i);
101472                    return s.t;
101473                  }
101474                }
101475                Vs.ComputeTOI_s_input = new Ge;
101476                Vs.ComputeTOI_s_output = new ze;
101477                class ks extends Vs {
101478                  static Create() {
101479                    return new ks;
101480                  }
101481                  static Destroy(t) {}
101482                  Evaluate(t, e, i) {
101483                    ii(t, this.GetShapeA(), e, this.GetShapeB(), i);
101484                  }
101485                }
101486                class Us extends Vs {
101487                  static Create() {
101488                    return new Us;
101489                  }
101490                  static Destroy(t) {}
101491                  Evaluate(t, e, i) {
101492                    Mi(t, this.GetShapeA(), e, this.GetShapeB(), i);
101493                  }
101494                }
101495                class Gs extends Vs {
101496                  static Create() {
101497                    return new Gs;
101498                  }
101499                  static Destroy(t) {}
101500                  Evaluate(t, e, i) {
101501                    oi(t, this.GetShapeA(), e, this.GetShapeB(), i);
101502                  }
101503                }
101504                class zs extends Vs {
101505                  static Create() {
101506                    return new zs;
101507                  }
101508                  static Destroy(t) {}
101509                  Evaluate(t, e, i) {
101510                    ki(t, this.GetShapeA(), e, this.GetShapeB(), i);
101511                  }
101512                }
101513                class Hs extends Vs {
101514                  static Create() {
101515                    return new Hs;
101516                  }
101517                  static Destroy(t) {}
101518                  Evaluate(t, e, i) {
101519                    Yi(t, this.GetShapeA(), e, this.GetShapeB(), i);
101520                  }
101521                }
101522                class js extends Vs {
101523                  static Create() {
101524                    return new js;
101525                  }
101526                  static Destroy(t) {}
101527                  Evaluate(t, e, i) {
101528                    const s = js.Evaluate_s_edge;
101529                    this.GetShapeA().GetChildEdge(s, this.m_indexA);
101530                    ki(t, s, e, this.GetShapeB(), i);
101531                  }
101532                }
101533                js.Evaluate_s_edge = new Qi;
101534                class Xs extends Vs {
101535                  static Create() {
101536                    return new Xs;
101537                  }
101538                  static Destroy(t) {}
101539                  Evaluate(t, e, i) {
101540                    const s = Xs.Evaluate_s_edge;
101541                    this.GetShapeA().GetChildEdge(s, this.m_indexA);
101542                    Yi(t, s, e, this.GetShapeB(), i);
101543                  }
101544                }
101545                Xs.Evaluate_s_edge = new Qi;
101546                class Ws {
101547                  constructor() {
101548                    this.pool = [];
101549                    this.createFcn = null;
101550                    this.destroyFcn = null;
101551                    this.primary = !1;
101552                  }
101553                }
101554                class Ys {
101555                  constructor() {
101556                    this.m_registers = [];
101557                    this.InitializeRegisters();
101558                  }
101559                  AddType(t, e, i, s) {
101560                    const n = [];
101561                    function r() {
101562                      return n.pop() || t();
101563                    }
101564                    function o(t) {
101565                      n.push(t);
101566                    }
101567                    this.m_registers[i][s].pool = n;
101568                    this.m_registers[i][s].createFcn = r;
101569                    this.m_registers[i][s].destroyFcn = o;
101570                    this.m_registers[i][s].primary = !0;
101571                    if (i !== s) {
101572                      this.m_registers[s][i].pool = n;
101573                      this.m_registers[s][i].createFcn = r;
101574                      this.m_registers[s][i].destroyFcn = o;
101575                      this.m_registers[s][i].primary = !1;
101576                    }
101577                  }
101578                  InitializeRegisters() {
101579                    for (let e = 0; e < t.b2ShapeType.e_shapeTypeCount; e++) {
101580                      this.m_registers[e] = [];
101581                      for (let i = 0; i < t.b2ShapeType.e_shapeTypeCount; i++) this.m_registers[e][i] = new Ws;
101582                    }
101583                    this.AddType(ks.Create, ks.Destroy, t.b2ShapeType.e_circleShape, t.b2ShapeType.e_circleShape);
101584                    this.AddType(Gs.Create, Gs.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_circleShape);
101585                    this.AddType(Us.Create, Us.Destroy, t.b2ShapeType.e_polygonShape, t.b2ShapeType.e_polygonShape);
101586                    this.AddType(zs.Create, zs.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_circleShape);
101587                    this.AddType(Hs.Create, Hs.Destroy, t.b2ShapeType.e_edgeShape, t.b2ShapeType.e_polygonShape);
101588                    this.AddType(js.Create, js.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_circleShape);
101589                    this.AddType(Xs.Create, Xs.Destroy, t.b2ShapeType.e_chainShape, t.b2ShapeType.e_polygonShape);
101590                  }
101591                  Create(t, e, i, s) {
101592                    const n = t.GetType();
101593                    const r = i.GetType();
101594                    const o = this.m_registers[n][r];
101595                    if (o.createFcn) {
101596                      const n = o.createFcn();
101597                      o.primary ? n.Reset(t, e, i, s) : n.Reset(i, s, t, e);
101598                      return n;
101599                    }
101600                    return null;
101601                  }
101602                  Destroy(t) {
101603                    const e = t.m_fixtureA.GetType();
101604                    const i = t.m_fixtureB.GetType();
101605                    const s = this.m_registers[e][i];
101606                    s.destroyFcn && s.destroyFcn(t);
101607                  }
101608                }
101609                class qs {
101610                  SayGoodbyeJoint(t) {}
101611                  SayGoodbyeFixture(t) {}
101612                  SayGoodbyeParticleGroup(t) {}
101613                  SayGoodbyeParticle(t, e) {}
101614                }
101615                class Ks {
101616                  ShouldCollide(e, i) {
101617                    const s = e.GetBody();
101618                    const n = i.GetBody();
101619                    if (n.GetType() === t.b2BodyType.b2_staticBody && s.GetType() === t.b2BodyType.b2_staticBody) return !1;
101620                    if (!n.ShouldCollideConnected(s)) return !1;
101621                    const r = e.GetFilterData();
101622                    const o = i.GetFilterData();
101623                    return r.groupIndex === o.groupIndex && 0 !== r.groupIndex ? r.groupIndex > 0 : 0 != (r.maskBits & o.categoryBits) && 0 != (r.categoryBits & o.maskBits);
101624                  }
101625                  ShouldCollideFixtureParticle(t, e, i) {
101626                    return !0;
101627                  }
101628                  ShouldCollideParticleParticle(t, e, i) {
101629                    return !0;
101630                  }
101631                }
101632                Ks.b2_defaultFilter = new Ks;
101633                class Js {
101634                  constructor() {
101635                    this.normalImpulses = K(a);
101636                    this.tangentImpulses = K(a);
101637                    this.count = 0;
101638                  }
101639                }
101640                class Zs {
101641                  BeginContact(t) {}
101642                  EndContact(t) {}
101643                  BeginContactFixtureParticle(t, e) {}
101644                  EndContactFixtureParticle(t, e) {}
101645                  BeginContactParticleParticle(t, e) {}
101646                  EndContactParticleParticle(t, e) {}
101647                  PreSolve(t, e) {}
101648                  PostSolve(t, e) {}
101649                }
101650                Zs.b2_defaultListener = new Zs;
101651                class Qs {
101652                  ReportFixture(t) {
101653                    return !0;
101654                  }
101655                  ReportParticle(t, e) {
101656                    return !1;
101657                  }
101658                  ShouldQueryParticleSystem(t) {
101659                    return !0;
101660                  }
101661                }
101662                class $s {
101663                  ReportFixture(t, e, i, s) {
101664                    return s;
101665                  }
101666                  ReportParticle(t, e, i, s, n) {
101667                    return 0;
101668                  }
101669                  ShouldQueryParticleSystem(t) {
101670                    return !0;
101671                  }
101672                }
101673                class tn {
101674                  constructor() {
101675                    this.m_broadPhase = new Be;
101676                    this.m_contactList = null;
101677                    this.m_contactCount = 0;
101678                    this.m_contactFilter = Ks.b2_defaultFilter;
101679                    this.m_contactListener = Zs.b2_defaultListener;
101680                    this.m_contactFactory = new Ys;
101681                  }
101682                  AddPair(t, e) {
101683                    let i = t.fixture;
101684                    let s = e.fixture;
101685                    let n = t.childIndex;
101686                    let r = e.childIndex;
101687                    let o = i.GetBody();
101688                    let a = s.GetBody();
101689                    if (o === a) return;
101690                    let l = a.GetContactList();
101691                    for (;l; ) {
101692                      if (l.other === o) {
101693                        const t = l.contact.GetFixtureA();
101694                        const e = l.contact.GetFixtureB();
101695                        const o = l.contact.GetChildIndexA();
101696                        const a = l.contact.GetChildIndexB();
101697                        if (t === i && e === s && o === n && a === r) return;
101698                        if (t === s && e === i && o === r && a === n) return;
101699                      }
101700                      l = l.next;
101701                    }
101702                    if (this.m_contactFilter && !this.m_contactFilter.ShouldCollide(i, s)) return;
101703                    const h = this.m_contactFactory.Create(i, n, s, r);
101704                    if (null !== h) {
101705                      i = h.GetFixtureA();
101706                      s = h.GetFixtureB();
101707                      n = h.GetChildIndexA();
101708                      r = h.GetChildIndexB();
101709                      o = i.m_body;
101710                      a = s.m_body;
101711                      h.m_prev = null;
101712                      h.m_next = this.m_contactList;
101713                      null !== this.m_contactList && (this.m_contactList.m_prev = h);
101714                      this.m_contactList = h;
101715                      h.m_nodeA.other = a;
101716                      h.m_nodeA.prev = null;
101717                      h.m_nodeA.next = o.m_contactList;
101718                      null !== o.m_contactList && (o.m_contactList.prev = h.m_nodeA);
101719                      o.m_contactList = h.m_nodeA;
101720                      h.m_nodeB.other = o;
101721                      h.m_nodeB.prev = null;
101722                      h.m_nodeB.next = a.m_contactList;
101723                      null !== a.m_contactList && (a.m_contactList.prev = h.m_nodeB);
101724                      a.m_contactList = h.m_nodeB;
101725                      if (!i.IsSensor() && !s.IsSensor()) {
101726                        o.SetAwake(!0);
101727                        a.SetAwake(!0);
101728                      }
101729                      ++this.m_contactCount;
101730                    }
101731                  }
101732                  FindNewContacts() {
101733                    this.m_broadPhase.UpdatePairs(((t, e) => {
101734                      this.AddPair(t, e);
101735                    }));
101736                  }
101737                  Destroy(t) {
101738                    const e = t.GetFixtureA();
101739                    const i = t.GetFixtureB();
101740                    const s = e.GetBody();
101741                    const n = i.GetBody();
101742                    this.m_contactListener && t.IsTouching() && this.m_contactListener.EndContact(t);
101743                    t.m_prev && (t.m_prev.m_next = t.m_next);
101744                    t.m_next && (t.m_next.m_prev = t.m_prev);
101745                    t === this.m_contactList && (this.m_contactList = t.m_next);
101746                    t.m_nodeA.prev && (t.m_nodeA.prev.next = t.m_nodeA.next);
101747                    t.m_nodeA.next && (t.m_nodeA.next.prev = t.m_nodeA.prev);
101748                    t.m_nodeA === s.m_contactList && (s.m_contactList = t.m_nodeA.next);
101749                    t.m_nodeB.prev && (t.m_nodeB.prev.next = t.m_nodeB.next);
101750                    t.m_nodeB.next && (t.m_nodeB.next.prev = t.m_nodeB.prev);
101751                    t.m_nodeB === n.m_contactList && (n.m_contactList = t.m_nodeB.next);
101752                    if (t.m_manifold.pointCount > 0 && !e.IsSensor() && !i.IsSensor()) {
101753                      e.GetBody().SetAwake(!0);
101754                      i.GetBody().SetAwake(!0);
101755                    }
101756                    this.m_contactFactory.Destroy(t);
101757                    --this.m_contactCount;
101758                  }
101759                  Collide() {
101760                    let e = this.m_contactList;
101761                    for (;e; ) {
101762                      const i = e.GetFixtureA();
101763                      const s = e.GetFixtureB();
101764                      const n = e.GetChildIndexA();
101765                      const r = e.GetChildIndexB();
101766                      const o = i.GetBody();
101767                      const a = s.GetBody();
101768                      if (e.m_filterFlag) {
101769                        if (this.m_contactFilter && !this.m_contactFilter.ShouldCollide(i, s)) {
101770                          const t = e;
101771                          e = t.m_next;
101772                          this.Destroy(t);
101773                          continue;
101774                        }
101775                        e.m_filterFlag = !1;
101776                      }
101777                      const l = o.IsAwake() && o.m_type !== t.b2BodyType.b2_staticBody;
101778                      const h = a.IsAwake() && a.m_type !== t.b2BodyType.b2_staticBody;
101779                      if (!l && !h) {
101780                        e = e.m_next;
101781                        continue;
101782                      }
101783                      const c = i.m_proxies[n].treeNode;
101784                      const u = s.m_proxies[r].treeNode;
101785                      if (ye(c.aabb, u.aabb)) {
101786                        e.Update(this.m_contactListener);
101787                        e = e.m_next;
101788                      } else {
101789                        const t = e;
101790                        e = t.m_next;
101791                        this.Destroy(t);
101792                      }
101793                    }
101794                  }
101795                }
101796                class en {
101797                  constructor() {
101798                    this.step = 0;
101799                    this.collide = 0;
101800                    this.solve = 0;
101801                    this.solveInit = 0;
101802                    this.solveVelocity = 0;
101803                    this.solvePosition = 0;
101804                    this.broadphase = 0;
101805                    this.solveTOI = 0;
101806                  }
101807                  Reset() {
101808                    this.step = 0;
101809                    this.collide = 0;
101810                    this.solve = 0;
101811                    this.solveInit = 0;
101812                    this.solveVelocity = 0;
101813                    this.solvePosition = 0;
101814                    this.broadphase = 0;
101815                    this.solveTOI = 0;
101816                    return this;
101817                  }
101818                }
101819                class sn {
101820                  constructor() {
101821                    this.dt = 0;
101822                    this.inv_dt = 0;
101823                    this.dtRatio = 0;
101824                    this.velocityIterations = 0;
101825                    this.positionIterations = 0;
101826                    this.particleIterations = 0;
101827                    this.warmStarting = !1;
101828                  }
101829                  Copy(t) {
101830                    this.dt = t.dt;
101831                    this.inv_dt = t.inv_dt;
101832                    this.dtRatio = t.dtRatio;
101833                    this.positionIterations = t.positionIterations;
101834                    this.velocityIterations = t.velocityIterations;
101835                    this.particleIterations = t.particleIterations;
101836                    this.warmStarting = t.warmStarting;
101837                    return this;
101838                  }
101839                }
101840                class nn {
101841                  constructor() {
101842                    this.c = new St;
101843                    this.a = 0;
101844                  }
101845                  static MakeArray(t) {
101846                    return Y(t, (t => new nn));
101847                  }
101848                }
101849                class rn {
101850                  constructor() {
101851                    this.v = new St;
101852                    this.w = 0;
101853                  }
101854                  static MakeArray(t) {
101855                    return Y(t, (t => new rn));
101856                  }
101857                }
101858                class on {
101859                  constructor() {
101860                    this.step = new sn;
101861                  }
101862                }
101863                let an = !1;
101864                class ln {
101865                  constructor() {
101866                    this.rA = new St;
101867                    this.rB = new St;
101868                    this.normalImpulse = 0;
101869                    this.tangentImpulse = 0;
101870                    this.normalMass = 0;
101871                    this.tangentMass = 0;
101872                    this.velocityBias = 0;
101873                  }
101874                  static MakeArray(t) {
101875                    return Y(t, (t => new ln));
101876                  }
101877                }
101878                class hn {
101879                  constructor() {
101880                    this.points = ln.MakeArray(a);
101881                    this.normal = new St;
101882                    this.tangent = new St;
101883                    this.normalMass = new vt;
101884                    this.K = new vt;
101885                    this.indexA = 0;
101886                    this.indexB = 0;
101887                    this.invMassA = 0;
101888                    this.invMassB = 0;
101889                    this.invIA = 0;
101890                    this.invIB = 0;
101891                    this.friction = 0;
101892                    this.restitution = 0;
101893                    this.tangentSpeed = 0;
101894                    this.pointCount = 0;
101895                    this.contactIndex = 0;
101896                  }
101897                  static MakeArray(t) {
101898                    return Y(t, (t => new hn));
101899                  }
101900                }
101901                class cn {
101902                  constructor() {
101903                    this.localPoints = St.MakeArray(a);
101904                    this.localNormal = new St;
101905                    this.localPoint = new St;
101906                    this.indexA = 0;
101907                    this.indexB = 0;
101908                    this.invMassA = 0;
101909                    this.invMassB = 0;
101910                    this.localCenterA = new St;
101911                    this.localCenterB = new St;
101912                    this.invIA = 0;
101913                    this.invIB = 0;
101914                    this.type = t.b2ManifoldType.e_unknown;
101915                    this.radiusA = 0;
101916                    this.radiusB = 0;
101917                    this.pointCount = 0;
101918                  }
101919                  static MakeArray(t) {
101920                    return Y(t, (t => new cn));
101921                  }
101922                }
101923                class un {
101924                  constructor() {
101925                    this.step = new sn;
101926                    this.count = 0;
101927                  }
101928                }
101929                class _n {
101930                  constructor() {
101931                    this.normal = new St;
101932                    this.point = new St;
101933                    this.separation = 0;
101934                  }
101935                  Initialize(e, i, s, n) {
101936                    const r = _n.Initialize_s_pointA;
101937                    const o = _n.Initialize_s_pointB;
101938                    const a = _n.Initialize_s_planePoint;
101939                    const l = _n.Initialize_s_clipPoint;
101940                    switch (e.type) {
101941                     case t.b2ManifoldType.e_circles:
101942                      xt.MulXV(i, e.localPoint, r);
101943                      xt.MulXV(s, e.localPoints[0], o);
101944                      St.SubVV(o, r, this.normal).SelfNormalize();
101945                      St.MidVV(r, o, this.point);
101946                      this.separation = St.DotVV(St.SubVV(o, r, St.s_t0), this.normal) - e.radiusA - e.radiusB;
101947                      break;
101948
101949                     case t.b2ManifoldType.e_faceA:
101950                      Ct.MulRV(i.q, e.localNormal, this.normal);
101951                      xt.MulXV(i, e.localPoint, a);
101952                      xt.MulXV(s, e.localPoints[n], l);
101953                      this.separation = St.DotVV(St.SubVV(l, a, St.s_t0), this.normal) - e.radiusA - e.radiusB;
101954                      this.point.Copy(l);
101955                      break;
101956
101957                     case t.b2ManifoldType.e_faceB:
101958                      Ct.MulRV(s.q, e.localNormal, this.normal);
101959                      xt.MulXV(s, e.localPoint, a);
101960                      xt.MulXV(i, e.localPoints[n], l);
101961                      this.separation = St.DotVV(St.SubVV(l, a, St.s_t0), this.normal) - e.radiusA - e.radiusB;
101962                      this.point.Copy(l);
101963                      this.normal.SelfNeg();
101964                    }
101965                  }
101966                }
101967                _n.Initialize_s_pointA = new St;
101968                _n.Initialize_s_pointB = new St;
101969                _n.Initialize_s_planePoint = new St;
101970                _n.Initialize_s_clipPoint = new St;
101971                class dn {
101972                  constructor() {
101973                    this.m_step = new sn;
101974                    this.m_positionConstraints = cn.MakeArray(1024);
101975                    this.m_velocityConstraints = hn.MakeArray(1024);
101976                    this.m_count = 0;
101977                  }
101978                  Initialize(t) {
101979                    this.m_step.Copy(t.step);
101980                    this.m_count = t.count;
101981                    if (this.m_positionConstraints.length < this.m_count) {
101982                      const t = et(2 * this.m_positionConstraints.length, this.m_count);
101983                      for (;this.m_positionConstraints.length < t; ) this.m_positionConstraints[this.m_positionConstraints.length] = new cn;
101984                    }
101985                    if (this.m_velocityConstraints.length < this.m_count) {
101986                      const t = et(2 * this.m_velocityConstraints.length, this.m_count);
101987                      for (;this.m_velocityConstraints.length < t; ) this.m_velocityConstraints[this.m_velocityConstraints.length] = new hn;
101988                    }
101989                    this.m_positions = t.positions;
101990                    this.m_velocities = t.velocities;
101991                    this.m_contacts = t.contacts;
101992                    for (let t = 0; t < this.m_count; ++t) {
101993                      const e = this.m_contacts[t];
101994                      const i = e.m_fixtureA;
101995                      const s = e.m_fixtureB;
101996                      const n = i.GetShape();
101997                      const r = s.GetShape();
101998                      const o = n.m_radius;
101999                      const a = r.m_radius;
102000                      const l = i.GetBody();
102001                      const h = s.GetBody();
102002                      const c = e.GetManifold();
102003                      const u = c.pointCount;
102004                      const _ = this.m_velocityConstraints[t];
102005                      _.friction = e.m_friction;
102006                      _.restitution = e.m_restitution;
102007                      _.tangentSpeed = e.m_tangentSpeed;
102008                      _.indexA = l.m_islandIndex;
102009                      _.indexB = h.m_islandIndex;
102010                      _.invMassA = l.m_invMass;
102011                      _.invMassB = h.m_invMass;
102012                      _.invIA = l.m_invI;
102013                      _.invIB = h.m_invI;
102014                      _.contactIndex = t;
102015                      _.pointCount = u;
102016                      _.K.SetZero();
102017                      _.normalMass.SetZero();
102018                      const d = this.m_positionConstraints[t];
102019                      d.indexA = l.m_islandIndex;
102020                      d.indexB = h.m_islandIndex;
102021                      d.invMassA = l.m_invMass;
102022                      d.invMassB = h.m_invMass;
102023                      d.localCenterA.Copy(l.m_sweep.localCenter);
102024                      d.localCenterB.Copy(h.m_sweep.localCenter);
102025                      d.invIA = l.m_invI;
102026                      d.invIB = h.m_invI;
102027                      d.localNormal.Copy(c.localNormal);
102028                      d.localPoint.Copy(c.localPoint);
102029                      d.pointCount = u;
102030                      d.radiusA = o;
102031                      d.radiusB = a;
102032                      d.type = c.type;
102033                      for (let t = 0; t < u; ++t) {
102034                        const e = c.points[t];
102035                        const i = _.points[t];
102036                        if (this.m_step.warmStarting) {
102037                          i.normalImpulse = this.m_step.dtRatio * e.normalImpulse;
102038                          i.tangentImpulse = this.m_step.dtRatio * e.tangentImpulse;
102039                        } else {
102040                          i.normalImpulse = 0;
102041                          i.tangentImpulse = 0;
102042                        }
102043                        i.rA.SetZero();
102044                        i.rB.SetZero();
102045                        i.normalMass = 0;
102046                        i.tangentMass = 0;
102047                        i.velocityBias = 0;
102048                        d.localPoints[t].Copy(e.localPoint);
102049                      }
102050                    }
102051                    return this;
102052                  }
102053                  InitializeVelocityConstraints() {
102054                    const t = dn.InitializeVelocityConstraints_s_xfA;
102055                    const e = dn.InitializeVelocityConstraints_s_xfB;
102056                    const i = dn.InitializeVelocityConstraints_s_worldManifold;
102057                    const s = 1e3;
102058                    for (let n = 0; n < this.m_count; ++n) {
102059                      const r = this.m_velocityConstraints[n];
102060                      const o = this.m_positionConstraints[n];
102061                      const a = o.radiusA;
102062                      const l = o.radiusB;
102063                      const h = this.m_contacts[r.contactIndex].GetManifold();
102064                      const c = r.indexA;
102065                      const u = r.indexB;
102066                      const _ = r.invMassA;
102067                      const d = r.invMassB;
102068                      const p = r.invIA;
102069                      const m = r.invIB;
102070                      const g = o.localCenterA;
102071                      const y = o.localCenterB;
102072                      const b = this.m_positions[c].c;
102073                      const S = this.m_positions[c].a;
102074                      const A = this.m_velocities[c].v;
102075                      const T = this.m_velocities[c].w;
102076                      const v = this.m_positions[u].c;
102077                      const E = this.m_positions[u].a;
102078                      const C = this.m_velocities[u].v;
102079                      const x = this.m_velocities[u].w;
102080                      t.q.SetAngle(S);
102081                      e.q.SetAngle(E);
102082                      St.SubVV(b, Ct.MulRV(t.q, g, St.s_t0), t.p);
102083                      St.SubVV(v, Ct.MulRV(e.q, y, St.s_t0), e.p);
102084                      i.Initialize(h, t, a, e, l);
102085                      r.normal.Copy(i.normal);
102086                      St.CrossVOne(r.normal, r.tangent);
102087                      const w = r.pointCount;
102088                      for (let t = 0; t < w; ++t) {
102089                        const e = r.points[t];
102090                        St.SubVV(i.points[t], b, e.rA);
102091                        St.SubVV(i.points[t], v, e.rB);
102092                        const s = St.CrossVV(e.rA, r.normal);
102093                        const n = St.CrossVV(e.rB, r.normal);
102094                        const o = _ + d + p * s * s + m * n * n;
102095                        e.normalMass = o > 0 ? 1 / o : 0;
102096                        const a = r.tangent;
102097                        const l = St.CrossVV(e.rA, a);
102098                        const h = St.CrossVV(e.rB, a);
102099                        const c = _ + d + p * l * l + m * h * h;
102100                        e.tangentMass = c > 0 ? 1 / c : 0;
102101                        e.velocityBias = 0;
102102                        const u = St.DotVV(r.normal, St.SubVV(St.AddVCrossSV(C, x, e.rB, St.s_t0), St.AddVCrossSV(A, T, e.rA, St.s_t1), St.s_t0));
102103                        u < -f && (e.velocityBias += -r.restitution * u);
102104                      }
102105                      if (2 === r.pointCount && an) {
102106                        const t = r.points[0];
102107                        const e = r.points[1];
102108                        const i = St.CrossVV(t.rA, r.normal);
102109                        const n = St.CrossVV(t.rB, r.normal);
102110                        const o = St.CrossVV(e.rA, r.normal);
102111                        const a = St.CrossVV(e.rB, r.normal);
102112                        const l = _ + d + p * i * i + m * n * n;
102113                        const h = _ + d + p * o * o + m * a * a;
102114                        const c = _ + d + p * i * o + m * n * a;
102115                        if (l * l < s * (l * h - c * c)) {
102116                          r.K.ex.Set(l, c);
102117                          r.K.ey.Set(c, h);
102118                          r.K.GetInverse(r.normalMass);
102119                        } else r.pointCount = 1;
102120                      }
102121                    }
102122                  }
102123                  WarmStart() {
102124                    const t = dn.WarmStart_s_P;
102125                    for (let e = 0; e < this.m_count; ++e) {
102126                      const i = this.m_velocityConstraints[e];
102127                      const s = i.indexA;
102128                      const n = i.indexB;
102129                      const r = i.invMassA;
102130                      const o = i.invIA;
102131                      const a = i.invMassB;
102132                      const l = i.invIB;
102133                      const h = i.pointCount;
102134                      const c = this.m_velocities[s].v;
102135                      let u = this.m_velocities[s].w;
102136                      const _ = this.m_velocities[n].v;
102137                      let d = this.m_velocities[n].w;
102138                      const p = i.normal;
102139                      const m = i.tangent;
102140                      for (let e = 0; e < h; ++e) {
102141                        const s = i.points[e];
102142                        St.AddVV(St.MulSV(s.normalImpulse, p, St.s_t0), St.MulSV(s.tangentImpulse, m, St.s_t1), t);
102143                        u -= o * St.CrossVV(s.rA, t);
102144                        c.SelfMulSub(r, t);
102145                        d += l * St.CrossVV(s.rB, t);
102146                        _.SelfMulAdd(a, t);
102147                      }
102148                      this.m_velocities[s].w = u;
102149                      this.m_velocities[n].w = d;
102150                    }
102151                  }
102152                  SolveVelocityConstraints() {
102153                    const t = dn.SolveVelocityConstraints_s_dv;
102154                    const e = dn.SolveVelocityConstraints_s_dv1;
102155                    const i = dn.SolveVelocityConstraints_s_dv2;
102156                    const s = dn.SolveVelocityConstraints_s_P;
102157                    const n = dn.SolveVelocityConstraints_s_a;
102158                    const r = dn.SolveVelocityConstraints_s_b;
102159                    const o = dn.SolveVelocityConstraints_s_x;
102160                    const a = dn.SolveVelocityConstraints_s_d;
102161                    const l = dn.SolveVelocityConstraints_s_P1;
102162                    const h = dn.SolveVelocityConstraints_s_P2;
102163                    const c = dn.SolveVelocityConstraints_s_P1P2;
102164                    for (let u = 0; u < this.m_count; ++u) {
102165                      const _ = this.m_velocityConstraints[u];
102166                      const d = _.indexA;
102167                      const p = _.indexB;
102168                      const m = _.invMassA;
102169                      const f = _.invIA;
102170                      const g = _.invMassB;
102171                      const y = _.invIB;
102172                      const b = _.pointCount;
102173                      const S = this.m_velocities[d].v;
102174                      let A = this.m_velocities[d].w;
102175                      const T = this.m_velocities[p].v;
102176                      let v = this.m_velocities[p].w;
102177                      const E = _.normal;
102178                      const C = _.tangent;
102179                      const x = _.friction;
102180                      for (let e = 0; e < b; ++e) {
102181                        const i = _.points[e];
102182                        St.SubVV(St.AddVCrossSV(T, v, i.rB, St.s_t0), St.AddVCrossSV(S, A, i.rA, St.s_t1), t);
102183                        const n = St.DotVV(t, C) - _.tangentSpeed;
102184                        let r = i.tangentMass * -n;
102185                        const o = x * i.normalImpulse;
102186                        const a = it(i.tangentImpulse + r, -o, o);
102187                        r = a - i.tangentImpulse;
102188                        i.tangentImpulse = a;
102189                        St.MulSV(r, C, s);
102190                        S.SelfMulSub(m, s);
102191                        A -= f * St.CrossVV(i.rA, s);
102192                        T.SelfMulAdd(g, s);
102193                        v += y * St.CrossVV(i.rB, s);
102194                      }
102195                      if (1 === _.pointCount || !1 === an) for (let e = 0; e < b; ++e) {
102196                        const i = _.points[e];
102197                        St.SubVV(St.AddVCrossSV(T, v, i.rB, St.s_t0), St.AddVCrossSV(S, A, i.rA, St.s_t1), t);
102198                        const n = St.DotVV(t, E);
102199                        let r = -i.normalMass * (n - i.velocityBias);
102200                        const o = et(i.normalImpulse + r, 0);
102201                        r = o - i.normalImpulse;
102202                        i.normalImpulse = o;
102203                        St.MulSV(r, E, s);
102204                        S.SelfMulSub(m, s);
102205                        A -= f * St.CrossVV(i.rA, s);
102206                        T.SelfMulAdd(g, s);
102207                        v += y * St.CrossVV(i.rB, s);
102208                      } else {
102209                        const t = _.points[0];
102210                        const s = _.points[1];
102211                        n.Set(t.normalImpulse, s.normalImpulse);
102212                        St.SubVV(St.AddVCrossSV(T, v, t.rB, St.s_t0), St.AddVCrossSV(S, A, t.rA, St.s_t1), e);
102213                        St.SubVV(St.AddVCrossSV(T, v, s.rB, St.s_t0), St.AddVCrossSV(S, A, s.rA, St.s_t1), i);
102214                        let u = St.DotVV(e, E);
102215                        let d = St.DotVV(i, E);
102216                        r.x = u - t.velocityBias;
102217                        r.y = d - s.velocityBias;
102218                        r.SelfSub(vt.MulMV(_.K, n, St.s_t0));
102219                        for (;;) {
102220                          vt.MulMV(_.normalMass, r, o).SelfNeg();
102221                          if (o.x >= 0 && o.y >= 0) {
102222                            St.SubVV(o, n, a);
102223                            St.MulSV(a.x, E, l);
102224                            St.MulSV(a.y, E, h);
102225                            St.AddVV(l, h, c);
102226                            S.SelfMulSub(m, c);
102227                            A -= f * (St.CrossVV(t.rA, l) + St.CrossVV(s.rA, h));
102228                            T.SelfMulAdd(g, c);
102229                            v += y * (St.CrossVV(t.rB, l) + St.CrossVV(s.rB, h));
102230                            t.normalImpulse = o.x;
102231                            s.normalImpulse = o.y;
102232                            break;
102233                          }
102234                          o.x = -t.normalMass * r.x;
102235                          o.y = 0;
102236                          u = 0;
102237                          d = _.K.ex.y * o.x + r.y;
102238                          if (o.x >= 0 && d >= 0) {
102239                            St.SubVV(o, n, a);
102240                            St.MulSV(a.x, E, l);
102241                            St.MulSV(a.y, E, h);
102242                            St.AddVV(l, h, c);
102243                            S.SelfMulSub(m, c);
102244                            A -= f * (St.CrossVV(t.rA, l) + St.CrossVV(s.rA, h));
102245                            T.SelfMulAdd(g, c);
102246                            v += y * (St.CrossVV(t.rB, l) + St.CrossVV(s.rB, h));
102247                            t.normalImpulse = o.x;
102248                            s.normalImpulse = o.y;
102249                            break;
102250                          }
102251                          o.x = 0;
102252                          o.y = -s.normalMass * r.y;
102253                          u = _.K.ey.x * o.y + r.x;
102254                          d = 0;
102255                          if (o.y >= 0 && u >= 0) {
102256                            St.SubVV(o, n, a);
102257                            St.MulSV(a.x, E, l);
102258                            St.MulSV(a.y, E, h);
102259                            St.AddVV(l, h, c);
102260                            S.SelfMulSub(m, c);
102261                            A -= f * (St.CrossVV(t.rA, l) + St.CrossVV(s.rA, h));
102262                            T.SelfMulAdd(g, c);
102263                            v += y * (St.CrossVV(t.rB, l) + St.CrossVV(s.rB, h));
102264                            t.normalImpulse = o.x;
102265                            s.normalImpulse = o.y;
102266                            break;
102267                          }
102268                          o.x = 0;
102269                          o.y = 0;
102270                          u = r.x;
102271                          d = r.y;
102272                          if (u >= 0 && d >= 0) {
102273                            St.SubVV(o, n, a);
102274                            St.MulSV(a.x, E, l);
102275                            St.MulSV(a.y, E, h);
102276                            St.AddVV(l, h, c);
102277                            S.SelfMulSub(m, c);
102278                            A -= f * (St.CrossVV(t.rA, l) + St.CrossVV(s.rA, h));
102279                            T.SelfMulAdd(g, c);
102280                            v += y * (St.CrossVV(t.rB, l) + St.CrossVV(s.rB, h));
102281                            t.normalImpulse = o.x;
102282                            s.normalImpulse = o.y;
102283                            break;
102284                          }
102285                          break;
102286                        }
102287                      }
102288                      this.m_velocities[d].w = A;
102289                      this.m_velocities[p].w = v;
102290                    }
102291                  }
102292                  StoreImpulses() {
102293                    for (let t = 0; t < this.m_count; ++t) {
102294                      const e = this.m_velocityConstraints[t];
102295                      const i = this.m_contacts[e.contactIndex].GetManifold();
102296                      for (let t = 0; t < e.pointCount; ++t) {
102297                        i.points[t].normalImpulse = e.points[t].normalImpulse;
102298                        i.points[t].tangentImpulse = e.points[t].tangentImpulse;
102299                      }
102300                    }
102301                  }
102302                  SolvePositionConstraints() {
102303                    const t = dn.SolvePositionConstraints_s_xfA;
102304                    const e = dn.SolvePositionConstraints_s_xfB;
102305                    const i = dn.SolvePositionConstraints_s_psm;
102306                    const s = dn.SolvePositionConstraints_s_rA;
102307                    const n = dn.SolvePositionConstraints_s_rB;
102308                    const r = dn.SolvePositionConstraints_s_P;
102309                    let o = 0;
102310                    for (let a = 0; a < this.m_count; ++a) {
102311                      const l = this.m_positionConstraints[a];
102312                      const h = l.indexA;
102313                      const c = l.indexB;
102314                      const _ = l.localCenterA;
102315                      const d = l.invMassA;
102316                      const p = l.invIA;
102317                      const m = l.localCenterB;
102318                      const f = l.invMassB;
102319                      const y = l.invIB;
102320                      const b = l.pointCount;
102321                      const S = this.m_positions[h].c;
102322                      let A = this.m_positions[h].a;
102323                      const T = this.m_positions[c].c;
102324                      let E = this.m_positions[c].a;
102325                      for (let a = 0; a < b; ++a) {
102326                        t.q.SetAngle(A);
102327                        e.q.SetAngle(E);
102328                        St.SubVV(S, Ct.MulRV(t.q, _, St.s_t0), t.p);
102329                        St.SubVV(T, Ct.MulRV(e.q, m, St.s_t0), e.p);
102330                        i.Initialize(l, t, e, a);
102331                        const h = i.normal;
102332                        const c = i.point;
102333                        const b = i.separation;
102334                        St.SubVV(c, S, s);
102335                        St.SubVV(c, T, n);
102336                        o = tt(o, b);
102337                        const C = it(v * (b + u), -g, 0);
102338                        const x = St.CrossVV(s, h);
102339                        const w = St.CrossVV(n, h);
102340                        const R = d + f + p * x * x + y * w * w;
102341                        const I = R > 0 ? -C / R : 0;
102342                        St.MulSV(I, h, r);
102343                        S.SelfMulSub(d, r);
102344                        A -= p * St.CrossVV(s, r);
102345                        T.SelfMulAdd(f, r);
102346                        E += y * St.CrossVV(n, r);
102347                      }
102348                      this.m_positions[h].a = A;
102349                      this.m_positions[c].a = E;
102350                    }
102351                    return o > -3 * u;
102352                  }
102353                  SolveTOIPositionConstraints(t, e) {
102354                    const i = dn.SolveTOIPositionConstraints_s_xfA;
102355                    const s = dn.SolveTOIPositionConstraints_s_xfB;
102356                    const n = dn.SolveTOIPositionConstraints_s_psm;
102357                    const r = dn.SolveTOIPositionConstraints_s_rA;
102358                    const o = dn.SolveTOIPositionConstraints_s_rB;
102359                    const a = dn.SolveTOIPositionConstraints_s_P;
102360                    let l = 0;
102361                    for (let h = 0; h < this.m_count; ++h) {
102362                      const c = this.m_positionConstraints[h];
102363                      const _ = c.indexA;
102364                      const d = c.indexB;
102365                      const p = c.localCenterA;
102366                      const m = c.localCenterB;
102367                      const f = c.pointCount;
102368                      let y = 0;
102369                      let b = 0;
102370                      if (_ === t || _ === e) {
102371                        y = c.invMassA;
102372                        b = c.invIA;
102373                      }
102374                      let S = 0;
102375                      let A = 0;
102376                      if (d === t || d === e) {
102377                        S = c.invMassB;
102378                        A = c.invIB;
102379                      }
102380                      const T = this.m_positions[_].c;
102381                      let v = this.m_positions[_].a;
102382                      const C = this.m_positions[d].c;
102383                      let x = this.m_positions[d].a;
102384                      for (let t = 0; t < f; ++t) {
102385                        i.q.SetAngle(v);
102386                        s.q.SetAngle(x);
102387                        St.SubVV(T, Ct.MulRV(i.q, p, St.s_t0), i.p);
102388                        St.SubVV(C, Ct.MulRV(s.q, m, St.s_t0), s.p);
102389                        n.Initialize(c, i, s, t);
102390                        const e = n.normal;
102391                        const h = n.point;
102392                        const _ = n.separation;
102393                        St.SubVV(h, T, r);
102394                        St.SubVV(h, C, o);
102395                        l = tt(l, _);
102396                        const d = it(E * (_ + u), -g, 0);
102397                        const f = St.CrossVV(r, e);
102398                        const w = St.CrossVV(o, e);
102399                        const R = y + S + b * f * f + A * w * w;
102400                        const I = R > 0 ? -d / R : 0;
102401                        St.MulSV(I, e, a);
102402                        T.SelfMulSub(y, a);
102403                        v -= b * St.CrossVV(r, a);
102404                        C.SelfMulAdd(S, a);
102405                        x += A * St.CrossVV(o, a);
102406                      }
102407                      this.m_positions[_].a = v;
102408                      this.m_positions[d].a = x;
102409                    }
102410                    return l >= -1.5 * u;
102411                  }
102412                }
102413                dn.InitializeVelocityConstraints_s_xfA = new xt;
102414                dn.InitializeVelocityConstraints_s_xfB = new xt;
102415                dn.InitializeVelocityConstraints_s_worldManifold = new _e;
102416                dn.WarmStart_s_P = new St;
102417                dn.SolveVelocityConstraints_s_dv = new St;
102418                dn.SolveVelocityConstraints_s_dv1 = new St;
102419                dn.SolveVelocityConstraints_s_dv2 = new St;
102420                dn.SolveVelocityConstraints_s_P = new St;
102421                dn.SolveVelocityConstraints_s_a = new St;
102422                dn.SolveVelocityConstraints_s_b = new St;
102423                dn.SolveVelocityConstraints_s_x = new St;
102424                dn.SolveVelocityConstraints_s_d = new St;
102425                dn.SolveVelocityConstraints_s_P1 = new St;
102426                dn.SolveVelocityConstraints_s_P2 = new St;
102427                dn.SolveVelocityConstraints_s_P1P2 = new St;
102428                dn.SolvePositionConstraints_s_xfA = new xt;
102429                dn.SolvePositionConstraints_s_xfB = new xt;
102430                dn.SolvePositionConstraints_s_psm = new _n;
102431                dn.SolvePositionConstraints_s_rA = new St;
102432                dn.SolvePositionConstraints_s_rB = new St;
102433                dn.SolvePositionConstraints_s_P = new St;
102434                dn.SolveTOIPositionConstraints_s_xfA = new xt;
102435                dn.SolveTOIPositionConstraints_s_xfB = new xt;
102436                dn.SolveTOIPositionConstraints_s_psm = new _n;
102437                dn.SolveTOIPositionConstraints_s_rA = new St;
102438                dn.SolveTOIPositionConstraints_s_rB = new St;
102439                dn.SolveTOIPositionConstraints_s_P = new St;
102440                class pn {
102441                  constructor() {
102442                    this.m_bodies = [];
102443                    this.m_contacts = [];
102444                    this.m_joints = [];
102445                    this.m_positions = nn.MakeArray(1024);
102446                    this.m_velocities = rn.MakeArray(1024);
102447                    this.m_bodyCount = 0;
102448                    this.m_jointCount = 0;
102449                    this.m_contactCount = 0;
102450                    this.m_bodyCapacity = 0;
102451                    this.m_contactCapacity = 0;
102452                    this.m_jointCapacity = 0;
102453                  }
102454                  Initialize(t, e, i, s) {
102455                    this.m_bodyCapacity = t;
102456                    this.m_contactCapacity = e;
102457                    this.m_jointCapacity = i;
102458                    this.m_bodyCount = 0;
102459                    this.m_contactCount = 0;
102460                    this.m_jointCount = 0;
102461                    this.m_listener = s;
102462                    if (this.m_positions.length < t) {
102463                      const e = et(2 * this.m_positions.length, t);
102464                      for (;this.m_positions.length < e; ) this.m_positions[this.m_positions.length] = new nn;
102465                    }
102466                    if (this.m_velocities.length < t) {
102467                      const e = et(2 * this.m_velocities.length, t);
102468                      for (;this.m_velocities.length < e; ) this.m_velocities[this.m_velocities.length] = new rn;
102469                    }
102470                  }
102471                  Clear() {
102472                    this.m_bodyCount = 0;
102473                    this.m_contactCount = 0;
102474                    this.m_jointCount = 0;
102475                  }
102476                  AddBody(t) {
102477                    t.m_islandIndex = this.m_bodyCount;
102478                    this.m_bodies[this.m_bodyCount++] = t;
102479                  }
102480                  AddContact(t) {
102481                    this.m_contacts[this.m_contactCount++] = t;
102482                  }
102483                  AddJoint(t) {
102484                    this.m_joints[this.m_jointCount++] = t;
102485                  }
102486                  Solve(e, i, n, r) {
102487                    const o = pn.s_timer.Reset();
102488                    const a = i.dt;
102489                    for (let e = 0; e < this.m_bodyCount; ++e) {
102490                      const i = this.m_bodies[e];
102491                      this.m_positions[e].c.Copy(i.m_sweep.c);
102492                      const s = i.m_sweep.a;
102493                      const r = this.m_velocities[e].v.Copy(i.m_linearVelocity);
102494                      let o = i.m_angularVelocity;
102495                      i.m_sweep.c0.Copy(i.m_sweep.c);
102496                      i.m_sweep.a0 = i.m_sweep.a;
102497                      if (i.m_type === t.b2BodyType.b2_dynamicBody) {
102498                        r.x += a * (i.m_gravityScale * n.x + i.m_invMass * i.m_force.x);
102499                        r.y += a * (i.m_gravityScale * n.y + i.m_invMass * i.m_force.y);
102500                        o += a * i.m_invI * i.m_torque;
102501                        r.SelfMul(1 / (1 + a * i.m_linearDamping));
102502                        o *= 1 / (1 + a * i.m_angularDamping);
102503                      }
102504                      this.m_positions[e].a = s;
102505                      this.m_velocities[e].w = o;
102506                    }
102507                    o.Reset();
102508                    const l = pn.s_solverData;
102509                    l.step.Copy(i);
102510                    l.positions = this.m_positions;
102511                    l.velocities = this.m_velocities;
102512                    const h = pn.s_contactSolverDef;
102513                    h.step.Copy(i);
102514                    h.contacts = this.m_contacts;
102515                    h.count = this.m_contactCount;
102516                    h.positions = this.m_positions;
102517                    h.velocities = this.m_velocities;
102518                    const c = pn.s_contactSolver.Initialize(h);
102519                    c.InitializeVelocityConstraints();
102520                    i.warmStarting && c.WarmStart();
102521                    for (let t = 0; t < this.m_jointCount; ++t) this.m_joints[t].InitVelocityConstraints(l);
102522                    e.solveInit = o.GetMilliseconds();
102523                    o.Reset();
102524                    for (let t = 0; t < i.velocityIterations; ++t) {
102525                      for (let t = 0; t < this.m_jointCount; ++t) this.m_joints[t].SolveVelocityConstraints(l);
102526                      c.SolveVelocityConstraints();
102527                    }
102528                    c.StoreImpulses();
102529                    e.solveVelocity = o.GetMilliseconds();
102530                    for (let t = 0; t < this.m_bodyCount; ++t) {
102531                      const e = this.m_positions[t].c;
102532                      let i = this.m_positions[t].a;
102533                      const s = this.m_velocities[t].v;
102534                      let n = this.m_velocities[t].w;
102535                      const r = St.MulSV(a, s, pn.s_translation);
102536                      if (St.DotVV(r, r) > S) {
102537                        const t = b / r.Length();
102538                        s.SelfMul(t);
102539                      }
102540                      const o = a * n;
102541                      o * o > T && (n *= A / $(o));
102542                      e.x += a * s.x;
102543                      e.y += a * s.y;
102544                      i += a * n;
102545                      this.m_positions[t].a = i;
102546                      this.m_velocities[t].w = n;
102547                    }
102548                    o.Reset();
102549                    let u = !1;
102550                    for (let t = 0; t < i.positionIterations; ++t) {
102551                      const t = c.SolvePositionConstraints();
102552                      let e = !0;
102553                      for (let t = 0; t < this.m_jointCount; ++t) {
102554                        const i = this.m_joints[t].SolvePositionConstraints(l);
102555                        e = e && i;
102556                      }
102557                      if (t && e) {
102558                        u = !0;
102559                        break;
102560                      }
102561                    }
102562                    for (let t = 0; t < this.m_bodyCount; ++t) {
102563                      const e = this.m_bodies[t];
102564                      e.m_sweep.c.Copy(this.m_positions[t].c);
102565                      e.m_sweep.a = this.m_positions[t].a;
102566                      e.m_linearVelocity.Copy(this.m_velocities[t].v);
102567                      e.m_angularVelocity = this.m_velocities[t].w;
102568                      e.SynchronizeTransform();
102569                    }
102570                    e.solvePosition = o.GetMilliseconds();
102571                    this.Report(c.m_velocityConstraints);
102572                    if (r) {
102573                      let e = s;
102574                      const i = L * L;
102575                      const n = F * F;
102576                      for (let s = 0; s < this.m_bodyCount; ++s) {
102577                        const r = this.m_bodies[s];
102578                        if (r.GetType() !== t.b2BodyType.b2_staticBody) if (!r.m_autoSleepFlag || r.m_angularVelocity * r.m_angularVelocity > n || St.DotVV(r.m_linearVelocity, r.m_linearVelocity) > i) {
102579                          r.m_sleepTime = 0;
102580                          e = 0;
102581                        } else {
102582                          r.m_sleepTime += a;
102583                          e = tt(e, r.m_sleepTime);
102584                        }
102585                      }
102586                      if (e >= N && u) for (let t = 0; t < this.m_bodyCount; ++t) this.m_bodies[t].SetAwake(!1);
102587                    }
102588                  }
102589                  SolveTOI(t, e, i) {
102590                    for (let t = 0; t < this.m_bodyCount; ++t) {
102591                      const e = this.m_bodies[t];
102592                      this.m_positions[t].c.Copy(e.m_sweep.c);
102593                      this.m_positions[t].a = e.m_sweep.a;
102594                      this.m_velocities[t].v.Copy(e.m_linearVelocity);
102595                      this.m_velocities[t].w = e.m_angularVelocity;
102596                    }
102597                    const s = pn.s_contactSolverDef;
102598                    s.contacts = this.m_contacts;
102599                    s.count = this.m_contactCount;
102600                    s.step.Copy(t);
102601                    s.positions = this.m_positions;
102602                    s.velocities = this.m_velocities;
102603                    const n = pn.s_contactSolver.Initialize(s);
102604                    for (let s = 0; s < t.positionIterations && !n.SolveTOIPositionConstraints(e, i); ++s) ;
102605                    this.m_bodies[e].m_sweep.c0.Copy(this.m_positions[e].c);
102606                    this.m_bodies[e].m_sweep.a0 = this.m_positions[e].a;
102607                    this.m_bodies[i].m_sweep.c0.Copy(this.m_positions[i].c);
102608                    this.m_bodies[i].m_sweep.a0 = this.m_positions[i].a;
102609                    n.InitializeVelocityConstraints();
102610                    for (let e = 0; e < t.velocityIterations; ++e) n.SolveVelocityConstraints();
102611                    const r = t.dt;
102612                    for (let t = 0; t < this.m_bodyCount; ++t) {
102613                      const e = this.m_positions[t].c;
102614                      let i = this.m_positions[t].a;
102615                      const s = this.m_velocities[t].v;
102616                      let n = this.m_velocities[t].w;
102617                      const o = St.MulSV(r, s, pn.s_translation);
102618                      if (St.DotVV(o, o) > S) {
102619                        const t = b / o.Length();
102620                        s.SelfMul(t);
102621                      }
102622                      const a = r * n;
102623                      a * a > T && (n *= A / $(a));
102624                      e.SelfMulAdd(r, s);
102625                      i += r * n;
102626                      this.m_positions[t].a = i;
102627                      this.m_velocities[t].w = n;
102628                      const l = this.m_bodies[t];
102629                      l.m_sweep.c.Copy(e);
102630                      l.m_sweep.a = i;
102631                      l.m_linearVelocity.Copy(s);
102632                      l.m_angularVelocity = n;
102633                      l.SynchronizeTransform();
102634                    }
102635                    this.Report(n.m_velocityConstraints);
102636                  }
102637                  Report(t) {
102638                    if (null !== this.m_listener) for (let e = 0; e < this.m_contactCount; ++e) {
102639                      const i = this.m_contacts[e];
102640                      if (!i) continue;
102641                      const s = t[e];
102642                      const n = pn.s_impulse;
102643                      n.count = s.pointCount;
102644                      for (let t = 0; t < s.pointCount; ++t) {
102645                        n.normalImpulses[t] = s.points[t].normalImpulse;
102646                        n.tangentImpulses[t] = s.points[t].tangentImpulse;
102647                      }
102648                      this.m_listener.PostSolve(i, n);
102649                    }
102650                  }
102651                }
102652                pn.s_timer = new Mt;
102653                pn.s_solverData = new on;
102654                pn.s_contactSolverDef = new un;
102655                pn.s_contactSolver = new dn;
102656                pn.s_translation = new St;
102657                pn.s_impulse = new Js;
102658                !function(t) {
102659                  t[t.b2_waterParticle = 0] = "b2_waterParticle";
102660                  t[t.b2_zombieParticle = 2] = "b2_zombieParticle";
102661                  t[t.b2_wallParticle = 4] = "b2_wallParticle";
102662                  t[t.b2_springParticle = 8] = "b2_springParticle";
102663                  t[t.b2_elasticParticle = 16] = "b2_elasticParticle";
102664                  t[t.b2_viscousParticle = 32] = "b2_viscousParticle";
102665                  t[t.b2_powderParticle = 64] = "b2_powderParticle";
102666                  t[t.b2_tensileParticle = 128] = "b2_tensileParticle";
102667                  t[t.b2_colorMixingParticle = 256] = "b2_colorMixingParticle";
102668                  t[t.b2_destructionListenerParticle = 512] = "b2_destructionListenerParticle";
102669                  t[t.b2_barrierParticle = 1024] = "b2_barrierParticle";
102670                  t[t.b2_staticPressureParticle = 2048] = "b2_staticPressureParticle";
102671                  t[t.b2_reactiveParticle = 4096] = "b2_reactiveParticle";
102672                  t[t.b2_repulsiveParticle = 8192] = "b2_repulsiveParticle";
102673                  t[t.b2_fixtureContactListenerParticle = 16384] = "b2_fixtureContactListenerParticle";
102674                  t[t.b2_particleContactListenerParticle = 32768] = "b2_particleContactListenerParticle";
102675                  t[t.b2_fixtureContactFilterParticle = 65536] = "b2_fixtureContactFilterParticle";
102676                  t[t.b2_particleContactFilterParticle = 131072] = "b2_particleContactFilterParticle";
102677                }(t.b2ParticleFlag || (t.b2ParticleFlag = {}));
102678                class mn {
102679                  constructor() {
102680                    this.flags = 0;
102681                    this.position = new St;
102682                    this.velocity = new St;
102683                    this.color = new Rt(0, 0, 0, 0);
102684                    this.lifetime = 0;
102685                    this.userData = null;
102686                    this.group = null;
102687                  }
102688                }
102689                function fn(t, e, i) {
102690                  const s = 8;
102691                  const n = .01;
102692                  return it(Math.ceil(Math.sqrt(t / (n * e)) * i), 1, s);
102693                }
102694                class gn {
102695                  constructor() {
102696                    this.m_index = C;
102697                  }
102698                  GetIndex() {
102699                    return this.m_index;
102700                  }
102701                  SetIndex(t) {
102702                    this.m_index = t;
102703                  }
102704                }
102705                !function(t) {
102706                  t[t.b2_solidParticleGroup = 1] = "b2_solidParticleGroup";
102707                  t[t.b2_rigidParticleGroup = 2] = "b2_rigidParticleGroup";
102708                  t[t.b2_particleGroupCanBeEmpty = 4] = "b2_particleGroupCanBeEmpty";
102709                  t[t.b2_particleGroupWillBeDestroyed = 8] = "b2_particleGroupWillBeDestroyed";
102710                  t[t.b2_particleGroupNeedsUpdateDepth = 16] = "b2_particleGroupNeedsUpdateDepth";
102711                  t[t.b2_particleGroupInternalMask = 24] = "b2_particleGroupInternalMask";
102712                }(t.b2ParticleGroupFlag || (t.b2ParticleGroupFlag = {}));
102713                class yn {
102714                  constructor() {
102715                    this.flags = 0;
102716                    this.groupFlags = 0;
102717                    this.position = new St;
102718                    this.angle = 0;
102719                    this.linearVelocity = new St;
102720                    this.angularVelocity = 0;
102721                    this.color = new Rt;
102722                    this.strength = 1;
102723                    this.shapeCount = 0;
102724                    this.stride = 0;
102725                    this.particleCount = 0;
102726                    this.lifetime = 0;
102727                    this.userData = null;
102728                    this.group = null;
102729                  }
102730                }
102731                class bn {
102732                  constructor(t) {
102733                    this.m_firstIndex = 0;
102734                    this.m_lastIndex = 0;
102735                    this.m_groupFlags = 0;
102736                    this.m_strength = 1;
102737                    this.m_prev = null;
102738                    this.m_next = null;
102739                    this.m_timestamp = -1;
102740                    this.m_mass = 0;
102741                    this.m_inertia = 0;
102742                    this.m_center = new St;
102743                    this.m_linearVelocity = new St;
102744                    this.m_angularVelocity = 0;
102745                    this.m_transform = new xt;
102746                    this.m_userData = null;
102747                    this.m_system = t;
102748                  }
102749                  GetNext() {
102750                    return this.m_next;
102751                  }
102752                  GetParticleSystem() {
102753                    return this.m_system;
102754                  }
102755                  GetParticleCount() {
102756                    return this.m_lastIndex - this.m_firstIndex;
102757                  }
102758                  GetBufferIndex() {
102759                    return this.m_firstIndex;
102760                  }
102761                  ContainsParticle(t) {
102762                    return this.m_firstIndex <= t && t < this.m_lastIndex;
102763                  }
102764                  GetAllParticleFlags() {
102765                    if (!this.m_system.m_flagsBuffer.data) throw new Error;
102766                    let t = 0;
102767                    for (let e = this.m_firstIndex; e < this.m_lastIndex; e++) t |= this.m_system.m_flagsBuffer.data[e];
102768                    return t;
102769                  }
102770                  GetGroupFlags() {
102771                    return this.m_groupFlags;
102772                  }
102773                  SetGroupFlags(e) {
102774                    e |= this.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupInternalMask;
102775                    this.m_system.SetGroupFlags(this, e);
102776                  }
102777                  GetMass() {
102778                    this.UpdateStatistics();
102779                    return this.m_mass;
102780                  }
102781                  GetInertia() {
102782                    this.UpdateStatistics();
102783                    return this.m_inertia;
102784                  }
102785                  GetCenter() {
102786                    this.UpdateStatistics();
102787                    return this.m_center;
102788                  }
102789                  GetLinearVelocity() {
102790                    this.UpdateStatistics();
102791                    return this.m_linearVelocity;
102792                  }
102793                  GetAngularVelocity() {
102794                    this.UpdateStatistics();
102795                    return this.m_angularVelocity;
102796                  }
102797                  GetTransform() {
102798                    return this.m_transform;
102799                  }
102800                  GetPosition() {
102801                    return this.m_transform.p;
102802                  }
102803                  GetAngle() {
102804                    return this.m_transform.q.GetAngle();
102805                  }
102806                  GetLinearVelocityFromWorldPoint(t, e) {
102807                    const i = bn.GetLinearVelocityFromWorldPoint_s_t0;
102808                    this.UpdateStatistics();
102809                    return St.AddVCrossSV(this.m_linearVelocity, this.m_angularVelocity, St.SubVV(t, this.m_center, i), e);
102810                  }
102811                  GetUserData() {
102812                    return this.m_userData;
102813                  }
102814                  SetUserData(t) {
102815                    this.m_userData = t;
102816                  }
102817                  ApplyForce(t) {
102818                    this.m_system.ApplyForce(this.m_firstIndex, this.m_lastIndex, t);
102819                  }
102820                  ApplyLinearImpulse(t) {
102821                    this.m_system.ApplyLinearImpulse(this.m_firstIndex, this.m_lastIndex, t);
102822                  }
102823                  DestroyParticles(t) {
102824                    if (this.m_system.m_world.IsLocked()) throw new Error;
102825                    for (let e = this.m_firstIndex; e < this.m_lastIndex; e++) this.m_system.DestroyParticle(e, t);
102826                  }
102827                  UpdateStatistics() {
102828                    if (!this.m_system.m_positionBuffer.data) throw new Error;
102829                    if (!this.m_system.m_velocityBuffer.data) throw new Error;
102830                    const t = new St;
102831                    const e = new St;
102832                    if (this.m_timestamp !== this.m_system.m_timestamp) {
102833                      const i = this.m_system.GetParticleMass();
102834                      this.m_mass = i * (this.m_lastIndex - this.m_firstIndex);
102835                      this.m_center.SetZero();
102836                      this.m_linearVelocity.SetZero();
102837                      for (let t = this.m_firstIndex; t < this.m_lastIndex; t++) {
102838                        this.m_center.SelfMulAdd(i, this.m_system.m_positionBuffer.data[t]);
102839                        this.m_linearVelocity.SelfMulAdd(i, this.m_system.m_velocityBuffer.data[t]);
102840                      }
102841                      if (this.m_mass > 0) {
102842                        const t = 1 / this.m_mass;
102843                        this.m_center.SelfMul(t);
102844                        this.m_linearVelocity.SelfMul(t);
102845                      }
102846                      this.m_inertia = 0;
102847                      this.m_angularVelocity = 0;
102848                      for (let s = this.m_firstIndex; s < this.m_lastIndex; s++) {
102849                        St.SubVV(this.m_system.m_positionBuffer.data[s], this.m_center, t);
102850                        St.SubVV(this.m_system.m_velocityBuffer.data[s], this.m_linearVelocity, e);
102851                        this.m_inertia += i * St.DotVV(t, t);
102852                        this.m_angularVelocity += i * St.CrossVV(t, e);
102853                      }
102854                      this.m_inertia > 0 && (this.m_angularVelocity *= 1 / this.m_inertia);
102855                      this.m_timestamp = this.m_system.m_timestamp;
102856                    }
102857                  }
102858                }
102859                bn.GetLinearVelocityFromWorldPoint_s_t0 = new St;
102860                class Sn {
102861                  constructor(t) {
102862                    this.m_buffer = [];
102863                    this.m_front = 0;
102864                    this.m_back = 0;
102865                    this.m_buffer.fill(null, 0, t);
102866                  }
102867                  get m_capacity() {
102868                    return this.m_buffer.length;
102869                  }
102870                  Push(t) {
102871                    if (this.m_back >= this.m_capacity) {
102872                      for (let t = this.m_front; t < this.m_back; t++) this.m_buffer[t - this.m_front] = this.m_buffer[t];
102873                      this.m_back -= this.m_front;
102874                      this.m_front = 0;
102875                    }
102876                    this.m_buffer[this.m_back] = t;
102877                    this.m_back++;
102878                  }
102879                  Pop() {
102880                    this.m_buffer[this.m_front] = null;
102881                    this.m_front++;
102882                  }
102883                  Empty() {
102884                    return this.m_front === this.m_back;
102885                  }
102886                  Front() {
102887                    const t = this.m_buffer[this.m_front];
102888                    if (!t) throw new Error;
102889                    return t;
102890                  }
102891                }
102892                class An {
102893                  constructor(t) {
102894                    this.m_generatorCapacity = 0;
102895                    this.m_generatorCount = 0;
102896                    this.m_countX = 0;
102897                    this.m_countY = 0;
102898                    this.m_diagram = [];
102899                    this.m_generatorBuffer = Y(t, (t => new Tn));
102900                    this.m_generatorCapacity = t;
102901                  }
102902                  AddGenerator(t, e, i) {
102903                    const s = this.m_generatorBuffer[this.m_generatorCount++];
102904                    s.center.Copy(t);
102905                    s.tag = e;
102906                    s.necessary = i;
102907                  }
102908                  Generate(t, e) {
102909                    const i = 1 / t;
102910                    const n = new St(+s, +s);
102911                    const r = new St(-s, -s);
102912                    let o = 0;
102913                    for (let t = 0; t < this.m_generatorCount; t++) {
102914                      const e = this.m_generatorBuffer[t];
102915                      if (e.necessary) {
102916                        St.MinV(n, e.center, n);
102917                        St.MaxV(r, e.center, r);
102918                        ++o;
102919                      }
102920                    }
102921                    if (0 === o) {
102922                      this.m_countX = 0;
102923                      this.m_countY = 0;
102924                      return;
102925                    }
102926                    n.x -= e;
102927                    n.y -= e;
102928                    r.x += e;
102929                    r.y += e;
102930                    this.m_countX = 1 + Math.floor(i * (r.x - n.x));
102931                    this.m_countY = 1 + Math.floor(i * (r.y - n.y));
102932                    this.m_diagram = [];
102933                    const a = new Sn(4 * this.m_countX * this.m_countY);
102934                    for (let t = 0; t < this.m_generatorCount; t++) {
102935                      const e = this.m_generatorBuffer[t];
102936                      e.center.SelfSub(n).SelfMul(i);
102937                      const s = Math.floor(e.center.x);
102938                      const r = Math.floor(e.center.y);
102939                      s >= 0 && r >= 0 && s < this.m_countX && r < this.m_countY && a.Push(new vn(s, r, s + r * this.m_countX, e));
102940                    }
102941                    for (;!a.Empty(); ) {
102942                      const t = a.Front();
102943                      const e = t.m_x;
102944                      const i = t.m_y;
102945                      const s = t.m_i;
102946                      const n = t.m_generator;
102947                      a.Pop();
102948                      if (!this.m_diagram[s]) {
102949                        this.m_diagram[s] = n;
102950                        e > 0 && a.Push(new vn(e - 1, i, s - 1, n));
102951                        i > 0 && a.Push(new vn(e, i - 1, s - this.m_countX, n));
102952                        e < this.m_countX - 1 && a.Push(new vn(e + 1, i, s + 1, n));
102953                        i < this.m_countY - 1 && a.Push(new vn(e, i + 1, s + this.m_countX, n));
102954                      }
102955                    }
102956                    for (let t = 0; t < this.m_countY; t++) for (let e = 0; e < this.m_countX - 1; e++) {
102957                      const i = e + t * this.m_countX;
102958                      const s = this.m_diagram[i];
102959                      const n = this.m_diagram[i + 1];
102960                      if (s !== n) {
102961                        a.Push(new vn(e, t, i, n));
102962                        a.Push(new vn(e + 1, t, i + 1, s));
102963                      }
102964                    }
102965                    for (let t = 0; t < this.m_countY - 1; t++) for (let e = 0; e < this.m_countX; e++) {
102966                      const i = e + t * this.m_countX;
102967                      const s = this.m_diagram[i];
102968                      const n = this.m_diagram[i + this.m_countX];
102969                      if (s !== n) {
102970                        a.Push(new vn(e, t, i, n));
102971                        a.Push(new vn(e, t + 1, i + this.m_countX, s));
102972                      }
102973                    }
102974                    for (;!a.Empty(); ) {
102975                      const t = a.Front();
102976                      const e = t.m_x;
102977                      const i = t.m_y;
102978                      const s = t.m_i;
102979                      const n = t.m_generator;
102980                      a.Pop();
102981                      const r = this.m_diagram[s];
102982                      const o = n;
102983                      if (r !== o) {
102984                        const t = r.center.x - e;
102985                        const n = r.center.y - i;
102986                        const l = o.center.x - e;
102987                        const h = o.center.y - i;
102988                        if (t * t + n * n > l * l + h * h) {
102989                          this.m_diagram[s] = o;
102990                          e > 0 && a.Push(new vn(e - 1, i, s - 1, o));
102991                          i > 0 && a.Push(new vn(e, i - 1, s - this.m_countX, o));
102992                          e < this.m_countX - 1 && a.Push(new vn(e + 1, i, s + 1, o));
102993                          i < this.m_countY - 1 && a.Push(new vn(e, i + 1, s + this.m_countX, o));
102994                        }
102995                      }
102996                    }
102997                  }
102998                  GetNodes(t) {
102999                    for (let e = 0; e < this.m_countY - 1; e++) for (let i = 0; i < this.m_countX - 1; i++) {
103000                      const s = i + e * this.m_countX;
103001                      const n = this.m_diagram[s];
103002                      const r = this.m_diagram[s + 1];
103003                      const o = this.m_diagram[s + this.m_countX];
103004                      const a = this.m_diagram[s + 1 + this.m_countX];
103005                      if (r !== o) {
103006                        n !== r && n !== o && (n.necessary || r.necessary || o.necessary) && t(n.tag, r.tag, o.tag);
103007                        a !== r && a !== o && (n.necessary || r.necessary || o.necessary) && t(r.tag, a.tag, o.tag);
103008                      }
103009                    }
103010                  }
103011                }
103012                class Tn {
103013                  constructor() {
103014                    this.center = new St;
103015                    this.tag = 0;
103016                    this.necessary = !1;
103017                  }
103018                }
103019                class vn {
103020                  constructor(t, e, i, s) {
103021                    this.m_x = t;
103022                    this.m_y = e;
103023                    this.m_i = i;
103024                    this.m_generator = s;
103025                  }
103026                }
103027                function En(t, e, i) {
103028                  const s = t[e];
103029                  t[e] = t[i];
103030                  t[i] = s;
103031                }
103032                function Cn(t, e) {
103033                  return t < e;
103034                }
103035                function xn(t, e = 0, i = t.length - e, s = Cn) {
103036                  let n = e;
103037                  const r = [];
103038                  let o = 0;
103039                  for (;;) {
103040                    for (;n + 1 < i; i++) {
103041                      const e = t[n + Math.floor(Math.random() * (i - n))];
103042                      r[o++] = i;
103043                      for (let r = n - 1; ;) {
103044                        for (;s(t[++r], e); ) ;
103045                        for (;s(e, t[--i]); ) ;
103046                        if (r >= i) break;
103047                        En(t, r, i);
103048                      }
103049                    }
103050                    if (0 === o) break;
103051                    n = i;
103052                    i = r[--o];
103053                  }
103054                  return t;
103055                }
103056                function wn(t, e = 0, i = t.length - e, s = Cn) {
103057                  return xn(t, e, i, s);
103058                }
103059                function Rn(t, e, i = t.length) {
103060                  let s = 0;
103061                  for (let n = 0; n < i; ++n) e(t[n]) || (n !== s ? En(t, s++, n) : ++s);
103062                  return s;
103063                }
103064                function In(t, e, i, s, n) {
103065                  let r = i - e;
103066                  for (;r > 0; ) {
103067                    const i = Math.floor(r / 2);
103068                    let o = e + i;
103069                    if (n(t[o], s)) {
103070                      e = ++o;
103071                      r -= i + 1;
103072                    } else r = i;
103073                  }
103074                  return e;
103075                }
103076                function Mn(t, e, i, s, n) {
103077                  let r = i - e;
103078                  for (;r > 0; ) {
103079                    const i = Math.floor(r / 2);
103080                    let o = e + i;
103081                    if (n(s, t[o])) r = i; else {
103082                      e = ++o;
103083                      r -= i + 1;
103084                    }
103085                  }
103086                  return e;
103087                }
103088                function Bn(t, e, i, s) {
103089                  let n = i;
103090                  for (;e !== n; ) {
103091                    En(t, e++, n++);
103092                    n === s ? n = i : e === i && (i = n);
103093                  }
103094                }
103095                function Dn(t, e, i, s) {
103096                  if (e === i) return i;
103097                  let n = e;
103098                  for (;++e !== i; ) s(t[n], t[e]) || En(t, ++n, e);
103099                  return ++n;
103100                }
103101                class Pn {
103102                  constructor(t) {
103103                    this.data = [];
103104                    this.count = 0;
103105                    this.capacity = 0;
103106                    this.allocator = t;
103107                  }
103108                  Append() {
103109                    this.count >= this.capacity && this.Grow();
103110                    return this.count++;
103111                  }
103112                  Reserve(t) {
103113                    if (!(this.capacity >= t)) {
103114                      for (let e = this.capacity; e < t; ++e) this.data[e] = this.allocator();
103115                      this.capacity = t;
103116                    }
103117                  }
103118                  Grow() {
103119                    const t = this.capacity ? 2 * this.capacity : P;
103120                    this.Reserve(t);
103121                  }
103122                  Free() {
103123                    if (0 !== this.data.length) {
103124                      this.data = [];
103125                      this.capacity = 0;
103126                      this.count = 0;
103127                    }
103128                  }
103129                  Shorten(t) {}
103130                  Data() {
103131                    return this.data;
103132                  }
103133                  GetCount() {
103134                    return this.count;
103135                  }
103136                  SetCount(t) {
103137                    this.count = t;
103138                  }
103139                  GetCapacity() {
103140                    return this.capacity;
103141                  }
103142                  RemoveIf(t) {
103143                    this.count = Rn(this.data, t, this.count);
103144                  }
103145                  Unique(t) {
103146                    this.count = Dn(this.data, 0, this.count, t);
103147                  }
103148                }
103149                class On extends Qs {
103150                  constructor(t) {
103151                    super();
103152                    this.m_system = t;
103153                  }
103154                  ShouldQueryParticleSystem(t) {
103155                    return !1;
103156                  }
103157                  ReportFixture(t) {
103158                    if (t.IsSensor()) return !0;
103159                    const e = t.GetShape().GetChildCount();
103160                    for (let i = 0; i < e; i++) {
103161                      const e = t.GetAABB(i);
103162                      const s = this.m_system.GetInsideBoundsEnumerator(e);
103163                      let n;
103164                      for (;(n = s.GetNext()) >= 0; ) this.ReportFixtureAndParticle(t, i, n);
103165                    }
103166                    return !0;
103167                  }
103168                  ReportParticle(t, e) {
103169                    return !1;
103170                  }
103171                  ReportFixtureAndParticle(t, e, i) {}
103172                }
103173                class Nn {
103174                  constructor() {
103175                    this.indexA = 0;
103176                    this.indexB = 0;
103177                    this.weight = 0;
103178                    this.normal = new St;
103179                    this.flags = 0;
103180                  }
103181                  SetIndices(t, e) {
103182                    this.indexA = t;
103183                    this.indexB = e;
103184                  }
103185                  SetWeight(t) {
103186                    this.weight = t;
103187                  }
103188                  SetNormal(t) {
103189                    this.normal.Copy(t);
103190                  }
103191                  SetFlags(t) {
103192                    this.flags = t;
103193                  }
103194                  GetIndexA() {
103195                    return this.indexA;
103196                  }
103197                  GetIndexB() {
103198                    return this.indexB;
103199                  }
103200                  GetWeight() {
103201                    return this.weight;
103202                  }
103203                  GetNormal() {
103204                    return this.normal;
103205                  }
103206                  GetFlags() {
103207                    return this.flags;
103208                  }
103209                  IsEqual(t) {
103210                    return this.indexA === t.indexA && this.indexB === t.indexB && this.flags === t.flags && this.weight === t.weight && this.normal.x === t.normal.x && this.normal.y === t.normal.y;
103211                  }
103212                  IsNotEqual(t) {
103213                    return !this.IsEqual(t);
103214                  }
103215                  ApproximatelyEqual(t) {
103216                    const e = .01;
103217                    const i = 1e-4;
103218                    return this.indexA === t.indexA && this.indexB === t.indexB && this.flags === t.flags && $(this.weight - t.weight) < e && St.DistanceSquaredVV(this.normal, t.normal) < i;
103219                  }
103220                }
103221                class Ln {
103222                  constructor() {
103223                    this.index = 0;
103224                    this.weight = 0;
103225                    this.normal = new St;
103226                    this.mass = 0;
103227                  }
103228                }
103229                class Fn {
103230                  constructor() {
103231                    this.indexA = 0;
103232                    this.indexB = 0;
103233                    this.flags = 0;
103234                    this.strength = 0;
103235                    this.distance = 0;
103236                  }
103237                }
103238                class Vn {
103239                  constructor() {
103240                    this.indexA = 0;
103241                    this.indexB = 0;
103242                    this.indexC = 0;
103243                    this.flags = 0;
103244                    this.strength = 0;
103245                    this.pa = new St(0, 0);
103246                    this.pb = new St(0, 0);
103247                    this.pc = new St(0, 0);
103248                    this.ka = 0;
103249                    this.kb = 0;
103250                    this.kc = 0;
103251                    this.s = 0;
103252                  }
103253                }
103254                class kn {
103255                  constructor() {
103256                    this.strictContactCheck = !1;
103257                    this.density = 1;
103258                    this.gravityScale = 1;
103259                    this.radius = 1;
103260                    this.maxCount = 0;
103261                    this.pressureStrength = .005;
103262                    this.dampingStrength = 1;
103263                    this.elasticStrength = .25;
103264                    this.springStrength = .25;
103265                    this.viscousStrength = .25;
103266                    this.surfaceTensionPressureStrength = .2;
103267                    this.surfaceTensionNormalStrength = .2;
103268                    this.repulsiveStrength = 1;
103269                    this.powderStrength = .5;
103270                    this.ejectionStrength = .5;
103271                    this.staticPressureStrength = .2;
103272                    this.staticPressureRelaxation = .2;
103273                    this.staticPressureIterations = 8;
103274                    this.colorMixingStrength = .5;
103275                    this.destroyByAge = !0;
103276                    this.lifetimeGranularity = 1 / 60;
103277                  }
103278                  Copy(t) {
103279                    this.strictContactCheck = t.strictContactCheck;
103280                    this.density = t.density;
103281                    this.gravityScale = t.gravityScale;
103282                    this.radius = t.radius;
103283                    this.maxCount = t.maxCount;
103284                    this.pressureStrength = t.pressureStrength;
103285                    this.dampingStrength = t.dampingStrength;
103286                    this.elasticStrength = t.elasticStrength;
103287                    this.springStrength = t.springStrength;
103288                    this.viscousStrength = t.viscousStrength;
103289                    this.surfaceTensionPressureStrength = t.surfaceTensionPressureStrength;
103290                    this.surfaceTensionNormalStrength = t.surfaceTensionNormalStrength;
103291                    this.repulsiveStrength = t.repulsiveStrength;
103292                    this.powderStrength = t.powderStrength;
103293                    this.ejectionStrength = t.ejectionStrength;
103294                    this.staticPressureStrength = t.staticPressureStrength;
103295                    this.staticPressureRelaxation = t.staticPressureRelaxation;
103296                    this.staticPressureIterations = t.staticPressureIterations;
103297                    this.colorMixingStrength = t.colorMixingStrength;
103298                    this.destroyByAge = t.destroyByAge;
103299                    this.lifetimeGranularity = t.lifetimeGranularity;
103300                    return this;
103301                  }
103302                  Clone() {
103303                    return (new kn).Copy(this);
103304                  }
103305                }
103306                class Un {
103307                  constructor(t, e) {
103308                    this.m_paused = !1;
103309                    this.m_timestamp = 0;
103310                    this.m_allParticleFlags = 0;
103311                    this.m_needsUpdateAllParticleFlags = !1;
103312                    this.m_allGroupFlags = 0;
103313                    this.m_needsUpdateAllGroupFlags = !1;
103314                    this.m_hasForce = !1;
103315                    this.m_iterationIndex = 0;
103316                    this.m_inverseDensity = 0;
103317                    this.m_particleDiameter = 0;
103318                    this.m_inverseDiameter = 0;
103319                    this.m_squaredDiameter = 0;
103320                    this.m_count = 0;
103321                    this.m_internalAllocatedCapacity = 0;
103322                    this.m_handleIndexBuffer = new Gn;
103323                    this.m_flagsBuffer = new Gn;
103324                    this.m_positionBuffer = new Gn;
103325                    this.m_velocityBuffer = new Gn;
103326                    this.m_forceBuffer = [];
103327                    this.m_weightBuffer = [];
103328                    this.m_staticPressureBuffer = [];
103329                    this.m_accumulationBuffer = [];
103330                    this.m_accumulation2Buffer = [];
103331                    this.m_depthBuffer = [];
103332                    this.m_colorBuffer = new Gn;
103333                    this.m_groupBuffer = [];
103334                    this.m_userDataBuffer = new Gn;
103335                    this.m_stuckThreshold = 0;
103336                    this.m_lastBodyContactStepBuffer = new Gn;
103337                    this.m_bodyContactCountBuffer = new Gn;
103338                    this.m_consecutiveContactStepsBuffer = new Gn;
103339                    this.m_stuckParticleBuffer = new Pn((() => 0));
103340                    this.m_proxyBuffer = new Pn((() => new zn));
103341                    this.m_contactBuffer = new Pn((() => new Nn));
103342                    this.m_bodyContactBuffer = new Pn((() => new Ln));
103343                    this.m_pairBuffer = new Pn((() => new Fn));
103344                    this.m_triadBuffer = new Pn((() => new Vn));
103345                    this.m_expirationTimeBuffer = new Gn;
103346                    this.m_indexByExpirationTimeBuffer = new Gn;
103347                    this.m_timeElapsed = 0;
103348                    this.m_expirationTimeBufferRequiresSorting = !1;
103349                    this.m_groupCount = 0;
103350                    this.m_groupList = null;
103351                    this.m_def = new kn;
103352                    this.m_prev = null;
103353                    this.m_next = null;
103354                    this.UpdateBodyContacts_callback = null;
103355                    this.SolveCollision_callback = null;
103356                    this.SetStrictContactCheck(t.strictContactCheck);
103357                    this.SetDensity(t.density);
103358                    this.SetGravityScale(t.gravityScale);
103359                    this.SetRadius(t.radius);
103360                    this.SetMaxParticleCount(t.maxCount);
103361                    this.m_def = t.Clone();
103362                    this.m_world = e;
103363                    this.SetDestructionByAge(this.m_def.destroyByAge);
103364                  }
103365                  static computeTag(t, e) {
103366                    return (e + Un.yOffset >>> 0 << Un.yShift) + (Un.xScale * t + Un.xOffset >>> 0) >>> 0;
103367                  }
103368                  static computeRelativeTag(t, e, i) {
103369                    return t + (i << Un.yShift) + (e << Un.xShift) >>> 0;
103370                  }
103371                  Drop() {
103372                    for (;this.m_groupList; ) this.DestroyParticleGroup(this.m_groupList);
103373                    this.FreeUserOverridableBuffer(this.m_handleIndexBuffer);
103374                    this.FreeUserOverridableBuffer(this.m_flagsBuffer);
103375                    this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer);
103376                    this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer);
103377                    this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer);
103378                    this.FreeUserOverridableBuffer(this.m_positionBuffer);
103379                    this.FreeUserOverridableBuffer(this.m_velocityBuffer);
103380                    this.FreeUserOverridableBuffer(this.m_colorBuffer);
103381                    this.FreeUserOverridableBuffer(this.m_userDataBuffer);
103382                    this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer);
103383                    this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer);
103384                    this.FreeBuffer(this.m_forceBuffer, this.m_internalAllocatedCapacity);
103385                    this.FreeBuffer(this.m_weightBuffer, this.m_internalAllocatedCapacity);
103386                    this.FreeBuffer(this.m_staticPressureBuffer, this.m_internalAllocatedCapacity);
103387                    this.FreeBuffer(this.m_accumulationBuffer, this.m_internalAllocatedCapacity);
103388                    this.FreeBuffer(this.m_accumulation2Buffer, this.m_internalAllocatedCapacity);
103389                    this.FreeBuffer(this.m_depthBuffer, this.m_internalAllocatedCapacity);
103390                    this.FreeBuffer(this.m_groupBuffer, this.m_internalAllocatedCapacity);
103391                  }
103392                  CreateParticle(t) {
103393                    if (this.m_world.IsLocked()) throw new Error;
103394                    if (this.m_count >= this.m_internalAllocatedCapacity) {
103395                      const t = this.m_count ? 2 * this.m_count : P;
103396                      this.ReallocateInternalAllocatedBuffers(t);
103397                    }
103398                    if (this.m_count >= this.m_internalAllocatedCapacity) {
103399                      if (!this.m_def.destroyByAge) return C;
103400                      this.DestroyOldestParticle(0, !1);
103401                      this.SolveZombie();
103402                    }
103403                    const e = this.m_count++;
103404                    this.m_flagsBuffer.data[e] = 0;
103405                    this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[e] = 0);
103406                    this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[e] = 0);
103407                    this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[e] = 0);
103408                    this.m_positionBuffer.data[e] = (this.m_positionBuffer.data[e] || new St).Copy(i(t.position, St.ZERO));
103409                    this.m_velocityBuffer.data[e] = (this.m_velocityBuffer.data[e] || new St).Copy(i(t.velocity, St.ZERO));
103410                    this.m_weightBuffer[e] = 0;
103411                    this.m_forceBuffer[e] = (this.m_forceBuffer[e] || new St).SetZero();
103412                    this.m_staticPressureBuffer && (this.m_staticPressureBuffer[e] = 0);
103413                    this.m_depthBuffer && (this.m_depthBuffer[e] = 0);
103414                    const s = (new Rt).Copy(i(t.color, Rt.ZERO));
103415                    if (this.m_colorBuffer.data || !s.IsZero()) {
103416                      this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data);
103417                      this.m_colorBuffer.data[e] = (this.m_colorBuffer.data[e] || new Rt).Copy(s);
103418                    }
103419                    if (this.m_userDataBuffer.data || t.userData) {
103420                      this.m_userDataBuffer.data = this.RequestBuffer(this.m_userDataBuffer.data);
103421                      this.m_userDataBuffer.data[e] = t.userData;
103422                    }
103423                    this.m_handleIndexBuffer.data && (this.m_handleIndexBuffer.data[e] = null);
103424                    const n = this.m_proxyBuffer.data[this.m_proxyBuffer.Append()];
103425                    const r = i(t.lifetime, 0);
103426                    const o = r > 0;
103427                    if (this.m_expirationTimeBuffer.data || o) {
103428                      this.SetParticleLifetime(e, o ? r : this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed()));
103429                      this.m_indexByExpirationTimeBuffer.data[e] = e;
103430                    }
103431                    n.index = e;
103432                    const a = i(t.group, null);
103433                    this.m_groupBuffer[e] = a;
103434                    if (a) if (a.m_firstIndex < a.m_lastIndex) {
103435                      this.RotateBuffer(a.m_firstIndex, a.m_lastIndex, e);
103436                      a.m_lastIndex = e + 1;
103437                    } else {
103438                      a.m_firstIndex = e;
103439                      a.m_lastIndex = e + 1;
103440                    }
103441                    this.SetParticleFlags(e, i(t.flags, 0));
103442                    return e;
103443                  }
103444                  GetParticleHandleFromIndex(t) {
103445                    this.m_handleIndexBuffer.data = this.RequestBuffer(this.m_handleIndexBuffer.data);
103446                    let e = this.m_handleIndexBuffer.data[t];
103447                    if (e) return e;
103448                    e = new gn;
103449                    e.SetIndex(t);
103450                    this.m_handleIndexBuffer.data[t] = e;
103451                    return e;
103452                  }
103453                  DestroyParticle(e, i = !1) {
103454                    let s = t.b2ParticleFlag.b2_zombieParticle;
103455                    i && (s |= t.b2ParticleFlag.b2_destructionListenerParticle);
103456                    this.SetParticleFlags(e, this.m_flagsBuffer.data[e] | s);
103457                  }
103458                  DestroyOldestParticle(t, e = !1) {
103459                    const i = this.GetParticleCount();
103460                    const s = this.m_indexByExpirationTimeBuffer.data[i - (t + 1)];
103461                    const n = this.m_indexByExpirationTimeBuffer.data[t];
103462                    this.DestroyParticle(this.m_expirationTimeBuffer.data[s] > 0 ? s : n, e);
103463                  }
103464                  DestroyParticlesInShape(t, e, i = !1) {
103465                    const s = Un.DestroyParticlesInShape_s_aabb;
103466                    if (this.m_world.IsLocked()) throw new Error;
103467                    const n = new Zn(this, t, e, i);
103468                    const r = s;
103469                    t.ComputeAABB(r, e, 0);
103470                    this.m_world.QueryAABB(n, r);
103471                    return n.Destroyed();
103472                  }
103473                  CreateParticleGroup(t) {
103474                    const e = Un.CreateParticleGroup_s_transform;
103475                    if (this.m_world.IsLocked()) throw new Error;
103476                    const s = e;
103477                    s.SetPositionAngle(i(t.position, St.ZERO), i(t.angle, 0));
103478                    const n = this.m_count;
103479                    t.shape && this.CreateParticlesWithShapeForGroup(t.shape, t, s);
103480                    t.shapes && this.CreateParticlesWithShapesForGroup(t.shapes, i(t.shapeCount, t.shapes.length), t, s);
103481                    if (t.positionData) {
103482                      const e = i(t.particleCount, t.positionData.length);
103483                      for (let i = 0; i < e; i++) {
103484                        const e = t.positionData[i];
103485                        this.CreateParticleForGroup(t, s, e);
103486                      }
103487                    }
103488                    const r = this.m_count;
103489                    let o = new bn(this);
103490                    o.m_firstIndex = n;
103491                    o.m_lastIndex = r;
103492                    o.m_strength = i(t.strength, 1);
103493                    o.m_userData = t.userData;
103494                    o.m_transform.Copy(s);
103495                    o.m_prev = null;
103496                    o.m_next = this.m_groupList;
103497                    this.m_groupList && (this.m_groupList.m_prev = o);
103498                    this.m_groupList = o;
103499                    ++this.m_groupCount;
103500                    for (let t = n; t < r; t++) this.m_groupBuffer[t] = o;
103501                    this.SetGroupFlags(o, i(t.groupFlags, 0));
103502                    const a = new Jn;
103503                    this.UpdateContacts(!0);
103504                    this.UpdatePairsAndTriads(n, r, a);
103505                    if (t.group) {
103506                      this.JoinParticleGroups(t.group, o);
103507                      o = t.group;
103508                    }
103509                    return o;
103510                  }
103511                  JoinParticleGroups(t, e) {
103512                    if (this.m_world.IsLocked()) throw new Error;
103513                    this.RotateBuffer(e.m_firstIndex, e.m_lastIndex, this.m_count);
103514                    this.RotateBuffer(t.m_firstIndex, t.m_lastIndex, e.m_firstIndex);
103515                    const i = new Qn(e.m_firstIndex);
103516                    this.UpdateContacts(!0);
103517                    this.UpdatePairsAndTriads(t.m_firstIndex, e.m_lastIndex, i);
103518                    for (let i = e.m_firstIndex; i < e.m_lastIndex; i++) this.m_groupBuffer[i] = t;
103519                    const s = t.m_groupFlags | e.m_groupFlags;
103520                    this.SetGroupFlags(t, s);
103521                    t.m_lastIndex = e.m_lastIndex;
103522                    e.m_firstIndex = e.m_lastIndex;
103523                    this.DestroyParticleGroup(e);
103524                  }
103525                  SplitParticleGroup(t) {
103526                    this.UpdateContacts(!0);
103527                    const e = Y(t.GetParticleCount(), (t => new jn));
103528                    Un.InitializeParticleLists(t, e);
103529                    this.MergeParticleListsInContact(t, e);
103530                    const i = Un.FindLongestParticleList(t, e);
103531                    this.MergeZombieParticleListNodes(t, e, i);
103532                    this.CreateParticleGroupsFromParticleList(t, e, i);
103533                    this.UpdatePairsAndTriadsWithParticleList(t, e);
103534                  }
103535                  GetParticleGroupList() {
103536                    return this.m_groupList;
103537                  }
103538                  GetParticleGroupCount() {
103539                    return this.m_groupCount;
103540                  }
103541                  GetParticleCount() {
103542                    return this.m_count;
103543                  }
103544                  GetMaxParticleCount() {
103545                    return this.m_def.maxCount;
103546                  }
103547                  SetMaxParticleCount(t) {
103548                    this.m_def.maxCount = t;
103549                  }
103550                  GetAllParticleFlags() {
103551                    return this.m_allParticleFlags;
103552                  }
103553                  GetAllGroupFlags() {
103554                    return this.m_allGroupFlags;
103555                  }
103556                  SetPaused(t) {
103557                    this.m_paused = t;
103558                  }
103559                  GetPaused() {
103560                    return this.m_paused;
103561                  }
103562                  SetDensity(t) {
103563                    this.m_def.density = t;
103564                    this.m_inverseDensity = 1 / this.m_def.density;
103565                  }
103566                  GetDensity() {
103567                    return this.m_def.density;
103568                  }
103569                  SetGravityScale(t) {
103570                    this.m_def.gravityScale = t;
103571                  }
103572                  GetGravityScale() {
103573                    return this.m_def.gravityScale;
103574                  }
103575                  SetDamping(t) {
103576                    this.m_def.dampingStrength = t;
103577                  }
103578                  GetDamping() {
103579                    return this.m_def.dampingStrength;
103580                  }
103581                  SetStaticPressureIterations(t) {
103582                    this.m_def.staticPressureIterations = t;
103583                  }
103584                  GetStaticPressureIterations() {
103585                    return this.m_def.staticPressureIterations;
103586                  }
103587                  SetRadius(t) {
103588                    this.m_particleDiameter = 2 * t;
103589                    this.m_squaredDiameter = this.m_particleDiameter * this.m_particleDiameter;
103590                    this.m_inverseDiameter = 1 / this.m_particleDiameter;
103591                  }
103592                  GetRadius() {
103593                    return this.m_particleDiameter / 2;
103594                  }
103595                  GetPositionBuffer() {
103596                    return this.m_positionBuffer.data;
103597                  }
103598                  GetVelocityBuffer() {
103599                    return this.m_velocityBuffer.data;
103600                  }
103601                  GetColorBuffer() {
103602                    this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data);
103603                    return this.m_colorBuffer.data;
103604                  }
103605                  GetGroupBuffer() {
103606                    return this.m_groupBuffer;
103607                  }
103608                  GetWeightBuffer() {
103609                    return this.m_weightBuffer;
103610                  }
103611                  GetUserDataBuffer() {
103612                    this.m_userDataBuffer.data = this.RequestBuffer(this.m_userDataBuffer.data);
103613                    return this.m_userDataBuffer.data;
103614                  }
103615                  GetFlagsBuffer() {
103616                    return this.m_flagsBuffer.data;
103617                  }
103618                  SetParticleFlags(e, i) {
103619                    this.m_flagsBuffer.data[e] & ~i && (this.m_needsUpdateAllParticleFlags = !0);
103620                    if (~this.m_allParticleFlags & i) {
103621                      i & t.b2ParticleFlag.b2_tensileParticle && (this.m_accumulation2Buffer = this.RequestBuffer(this.m_accumulation2Buffer));
103622                      i & t.b2ParticleFlag.b2_colorMixingParticle && (this.m_colorBuffer.data = this.RequestBuffer(this.m_colorBuffer.data));
103623                      this.m_allParticleFlags |= i;
103624                    }
103625                    this.m_flagsBuffer.data[e] = i;
103626                  }
103627                  GetParticleFlags(t) {
103628                    return this.m_flagsBuffer.data[t];
103629                  }
103630                  SetFlagsBuffer(t) {
103631                    this.SetUserOverridableBuffer(this.m_flagsBuffer, t);
103632                  }
103633                  SetPositionBuffer(t) {
103634                    if (t instanceof Float32Array) {
103635                      if (t.length % 2 != 0) throw new Error;
103636                      const e = t.length / 2;
103637                      const i = new Array(e);
103638                      for (let s = 0; s < e; ++s) i[s] = new St(t.subarray(2 * s, 2 * s + 2));
103639                      t = i;
103640                    }
103641                    this.SetUserOverridableBuffer(this.m_positionBuffer, t);
103642                  }
103643                  SetVelocityBuffer(t) {
103644                    if (t instanceof Float32Array) {
103645                      if (t.length % 2 != 0) throw new Error;
103646                      const e = t.length / 2;
103647                      const i = new Array(e);
103648                      for (let s = 0; s < e; ++s) i[s] = new St(t.subarray(2 * s, 2 * s + 2));
103649                      t = i;
103650                    }
103651                    this.SetUserOverridableBuffer(this.m_velocityBuffer, t);
103652                  }
103653                  SetColorBuffer(t) {
103654                    if (t instanceof Float32Array) {
103655                      if (t.length % 4 != 0) throw new Error;
103656                      const e = t.length / 4;
103657                      const i = new Array(e);
103658                      for (let s = 0; s < e; ++s) i[s] = new Rt(t.subarray(4 * s, 4 * s + 4));
103659                      t = i;
103660                    }
103661                    this.SetUserOverridableBuffer(this.m_colorBuffer, t);
103662                  }
103663                  SetUserDataBuffer(t) {
103664                    this.SetUserOverridableBuffer(this.m_userDataBuffer, t);
103665                  }
103666                  GetContacts() {
103667                    return this.m_contactBuffer.data;
103668                  }
103669                  GetContactCount() {
103670                    return this.m_contactBuffer.count;
103671                  }
103672                  GetBodyContacts() {
103673                    return this.m_bodyContactBuffer.data;
103674                  }
103675                  GetBodyContactCount() {
103676                    return this.m_bodyContactBuffer.count;
103677                  }
103678                  GetPairs() {
103679                    return this.m_pairBuffer.data;
103680                  }
103681                  GetPairCount() {
103682                    return this.m_pairBuffer.count;
103683                  }
103684                  GetTriads() {
103685                    return this.m_triadBuffer.data;
103686                  }
103687                  GetTriadCount() {
103688                    return this.m_triadBuffer.count;
103689                  }
103690                  SetStuckThreshold(t) {
103691                    this.m_stuckThreshold = t;
103692                    if (t > 0) {
103693                      this.m_lastBodyContactStepBuffer.data = this.RequestBuffer(this.m_lastBodyContactStepBuffer.data);
103694                      this.m_bodyContactCountBuffer.data = this.RequestBuffer(this.m_bodyContactCountBuffer.data);
103695                      this.m_consecutiveContactStepsBuffer.data = this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data);
103696                    }
103697                  }
103698                  GetStuckCandidates() {
103699                    return this.m_stuckParticleBuffer.Data();
103700                  }
103701                  GetStuckCandidateCount() {
103702                    return this.m_stuckParticleBuffer.GetCount();
103703                  }
103704                  ComputeCollisionEnergy() {
103705                    const t = Un.ComputeCollisionEnergy_s_v;
103706                    const e = this.m_velocityBuffer.data;
103707                    let i = 0;
103708                    for (let s = 0; s < this.m_contactBuffer.count; s++) {
103709                      const n = this.m_contactBuffer.data[s];
103710                      const r = n.indexA;
103711                      const o = n.indexB;
103712                      const a = n.normal;
103713                      const l = St.SubVV(e[o], e[r], t);
103714                      const h = St.DotVV(l, a);
103715                      h < 0 && (i += h * h);
103716                    }
103717                    return .5 * this.GetParticleMass() * i;
103718                  }
103719                  SetStrictContactCheck(t) {
103720                    this.m_def.strictContactCheck = t;
103721                  }
103722                  GetStrictContactCheck() {
103723                    return this.m_def.strictContactCheck;
103724                  }
103725                  SetParticleLifetime(t, e) {
103726                    const i = null === this.m_indexByExpirationTimeBuffer.data;
103727                    this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data);
103728                    this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data);
103729                    if (i) {
103730                      const t = this.GetParticleCount();
103731                      for (let e = 0; e < t; ++e) this.m_indexByExpirationTimeBuffer.data[e] = e;
103732                    }
103733                    const s = e / this.m_def.lifetimeGranularity;
103734                    const n = s > 0 ? this.GetQuantizedTimeElapsed() + s : s;
103735                    if (n !== this.m_expirationTimeBuffer.data[t]) {
103736                      this.m_expirationTimeBuffer.data[t] = n;
103737                      this.m_expirationTimeBufferRequiresSorting = !0;
103738                    }
103739                  }
103740                  GetParticleLifetime(t) {
103741                    return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t]);
103742                  }
103743                  SetDestructionByAge(t) {
103744                    t && this.GetExpirationTimeBuffer();
103745                    this.m_def.destroyByAge = t;
103746                  }
103747                  GetDestructionByAge() {
103748                    return this.m_def.destroyByAge;
103749                  }
103750                  GetExpirationTimeBuffer() {
103751                    this.m_expirationTimeBuffer.data = this.RequestBuffer(this.m_expirationTimeBuffer.data);
103752                    return this.m_expirationTimeBuffer.data;
103753                  }
103754                  ExpirationTimeToLifetime(t) {
103755                    return (t > 0 ? t - this.GetQuantizedTimeElapsed() : t) * this.m_def.lifetimeGranularity;
103756                  }
103757                  GetIndexByExpirationTimeBuffer() {
103758                    this.GetParticleCount() ? this.SetParticleLifetime(0, this.GetParticleLifetime(0)) : this.m_indexByExpirationTimeBuffer.data = this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data);
103759                    return this.m_indexByExpirationTimeBuffer.data;
103760                  }
103761                  ParticleApplyLinearImpulse(t, e) {
103762                    this.ApplyLinearImpulse(t, t + 1, e);
103763                  }
103764                  ApplyLinearImpulse(t, e, i) {
103765                    const s = this.m_velocityBuffer.data;
103766                    const n = (e - t) * this.GetParticleMass();
103767                    const r = (new St).Copy(i).SelfMul(1 / n);
103768                    for (let i = t; i < e; i++) s[i].SelfAdd(r);
103769                  }
103770                  static IsSignificantForce(t) {
103771                    return 0 !== t.x || 0 !== t.y;
103772                  }
103773                  ParticleApplyForce(t, e) {
103774                    if (Un.IsSignificantForce(e) && this.ForceCanBeApplied(this.m_flagsBuffer.data[t])) {
103775                      this.PrepareForceBuffer();
103776                      this.m_forceBuffer[t].SelfAdd(e);
103777                    }
103778                  }
103779                  ApplyForce(t, e, i) {
103780                    const s = (new St).Copy(i).SelfMul(1 / (e - t));
103781                    if (Un.IsSignificantForce(s)) {
103782                      this.PrepareForceBuffer();
103783                      for (let i = t; i < e; i++) this.m_forceBuffer[i].SelfAdd(s);
103784                    }
103785                  }
103786                  GetNext() {
103787                    return this.m_next;
103788                  }
103789                  QueryAABB(t, e) {
103790                    if (0 === this.m_proxyBuffer.count) return;
103791                    const i = 0;
103792                    const s = this.m_proxyBuffer.count;
103793                    const n = In(this.m_proxyBuffer.data, i, s, Un.computeTag(this.m_inverseDiameter * e.lowerBound.x, this.m_inverseDiameter * e.lowerBound.y), zn.CompareProxyTag);
103794                    const r = Mn(this.m_proxyBuffer.data, n, s, Un.computeTag(this.m_inverseDiameter * e.upperBound.x, this.m_inverseDiameter * e.upperBound.y), zn.CompareTagProxy);
103795                    const o = this.m_positionBuffer.data;
103796                    for (let i = n; i < r; ++i) {
103797                      const s = this.m_proxyBuffer.data[i].index;
103798                      const n = o[s];
103799                      if (e.lowerBound.x < n.x && n.x < e.upperBound.x && e.lowerBound.y < n.y && n.y < e.upperBound.y && !t.ReportParticle(this, s)) break;
103800                    }
103801                  }
103802                  QueryShapeAABB(t, e, i, s = 0) {
103803                    const n = Un.QueryShapeAABB_s_aabb;
103804                    e.ComputeAABB(n, i, s);
103805                    this.QueryAABB(t, n);
103806                  }
103807                  QueryPointAABB(t, e, i = u) {
103808                    const s = Un.QueryPointAABB_s_aabb;
103809                    s.lowerBound.Set(e.x - i, e.y - i);
103810                    s.upperBound.Set(e.x + i, e.y + i);
103811                    this.QueryAABB(t, s);
103812                  }
103813                  RayCast(t, e, i) {
103814                    const s = Un.RayCast_s_aabb;
103815                    const n = Un.RayCast_s_p;
103816                    const r = Un.RayCast_s_v;
103817                    const o = Un.RayCast_s_n;
103818                    const a = Un.RayCast_s_point;
103819                    if (0 === this.m_proxyBuffer.count) return;
103820                    const l = this.m_positionBuffer.data;
103821                    const h = s;
103822                    St.MinV(e, i, h.lowerBound);
103823                    St.MaxV(e, i, h.upperBound);
103824                    let c = 1;
103825                    const u = St.SubVV(i, e, r);
103826                    const _ = St.DotVV(u, u);
103827                    const d = this.GetInsideBoundsEnumerator(h);
103828                    let p;
103829                    for (;(p = d.GetNext()) >= 0; ) {
103830                      const i = St.SubVV(e, l[p], n);
103831                      const s = St.DotVV(i, u);
103832                      const r = s * s - _ * (St.DotVV(i, i) - this.m_squaredDiameter);
103833                      if (r >= 0) {
103834                        const n = at(r);
103835                        let l = (-s - n) / _;
103836                        if (l > c) continue;
103837                        if (l < 0) {
103838                          l = (-s + n) / _;
103839                          if (l < 0 || l > c) continue;
103840                        }
103841                        const h = St.AddVMulSV(i, l, u, o);
103842                        h.Normalize();
103843                        c = tt(c, t.ReportParticle(this, p, St.AddVMulSV(e, l, u, a), h, l));
103844                        if (c <= 0) break;
103845                      }
103846                    }
103847                  }
103848                  ComputeAABB(t) {
103849                    const e = this.GetParticleCount();
103850                    t.lowerBound.x = +s;
103851                    t.lowerBound.y = +s;
103852                    t.upperBound.x = -s;
103853                    t.upperBound.y = -s;
103854                    const i = this.m_positionBuffer.data;
103855                    for (let s = 0; s < e; s++) {
103856                      const e = i[s];
103857                      St.MinV(t.lowerBound, e, t.lowerBound);
103858                      St.MaxV(t.upperBound, e, t.upperBound);
103859                    }
103860                    t.lowerBound.x -= this.m_particleDiameter;
103861                    t.lowerBound.y -= this.m_particleDiameter;
103862                    t.upperBound.x += this.m_particleDiameter;
103863                    t.upperBound.y += this.m_particleDiameter;
103864                  }
103865                  FreeBuffer(t, e) {
103866                    null !== t && (t.length = 0);
103867                  }
103868                  FreeUserOverridableBuffer(t) {
103869                    0 === t.userSuppliedCapacity && this.FreeBuffer(t.data, this.m_internalAllocatedCapacity);
103870                  }
103871                  ReallocateBuffer3(t, e, i) {
103872                    if (i <= e) throw new Error;
103873                    const s = t ? t.slice() : [];
103874                    s.length = i;
103875                    return s;
103876                  }
103877                  ReallocateBuffer5(t, e, i, s, n) {
103878                    if (s <= i) throw new Error;
103879                    if (e && !(s <= e)) throw new Error;
103880                    n && !t || e || (t = this.ReallocateBuffer3(t, i, s));
103881                    return t;
103882                  }
103883                  ReallocateBuffer4(t, e, i, s) {
103884                    return this.ReallocateBuffer5(t.data, t.userSuppliedCapacity, e, i, s);
103885                  }
103886                  RequestBuffer(t) {
103887                    if (!t) {
103888                      0 === this.m_internalAllocatedCapacity && this.ReallocateInternalAllocatedBuffers(P);
103889                      (t = []).length = this.m_internalAllocatedCapacity;
103890                    }
103891                    return t;
103892                  }
103893                  ReallocateHandleBuffers(t) {
103894                    this.m_handleIndexBuffer.data = this.ReallocateBuffer4(this.m_handleIndexBuffer, this.m_internalAllocatedCapacity, t, !0);
103895                  }
103896                  ReallocateInternalAllocatedBuffers(t) {
103897                    function e(t, e) {
103898                      return e && t > e ? e : t;
103899                    }
103900                    t = e(t, this.m_def.maxCount);
103901                    t = e(t, this.m_flagsBuffer.userSuppliedCapacity);
103902                    t = e(t, this.m_positionBuffer.userSuppliedCapacity);
103903                    t = e(t, this.m_velocityBuffer.userSuppliedCapacity);
103904                    t = e(t, this.m_colorBuffer.userSuppliedCapacity);
103905                    t = e(t, this.m_userDataBuffer.userSuppliedCapacity);
103906                    if (this.m_internalAllocatedCapacity < t) {
103907                      this.ReallocateHandleBuffers(t);
103908                      this.m_flagsBuffer.data = this.ReallocateBuffer4(this.m_flagsBuffer, this.m_internalAllocatedCapacity, t, !1);
103909                      const e = this.m_stuckThreshold > 0;
103910                      this.m_lastBodyContactStepBuffer.data = this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer, this.m_internalAllocatedCapacity, t, e);
103911                      this.m_bodyContactCountBuffer.data = this.ReallocateBuffer4(this.m_bodyContactCountBuffer, this.m_internalAllocatedCapacity, t, e);
103912                      this.m_consecutiveContactStepsBuffer.data = this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer, this.m_internalAllocatedCapacity, t, e);
103913                      this.m_positionBuffer.data = this.ReallocateBuffer4(this.m_positionBuffer, this.m_internalAllocatedCapacity, t, !1);
103914                      this.m_velocityBuffer.data = this.ReallocateBuffer4(this.m_velocityBuffer, this.m_internalAllocatedCapacity, t, !1);
103915                      this.m_forceBuffer = this.ReallocateBuffer5(this.m_forceBuffer, 0, this.m_internalAllocatedCapacity, t, !1);
103916                      this.m_weightBuffer = this.ReallocateBuffer5(this.m_weightBuffer, 0, this.m_internalAllocatedCapacity, t, !1);
103917                      this.m_staticPressureBuffer = this.ReallocateBuffer5(this.m_staticPressureBuffer, 0, this.m_internalAllocatedCapacity, t, !0);
103918                      this.m_accumulationBuffer = this.ReallocateBuffer5(this.m_accumulationBuffer, 0, this.m_internalAllocatedCapacity, t, !1);
103919                      this.m_accumulation2Buffer = this.ReallocateBuffer5(this.m_accumulation2Buffer, 0, this.m_internalAllocatedCapacity, t, !0);
103920                      this.m_depthBuffer = this.ReallocateBuffer5(this.m_depthBuffer, 0, this.m_internalAllocatedCapacity, t, !0);
103921                      this.m_colorBuffer.data = this.ReallocateBuffer4(this.m_colorBuffer, this.m_internalAllocatedCapacity, t, !0);
103922                      this.m_groupBuffer = this.ReallocateBuffer5(this.m_groupBuffer, 0, this.m_internalAllocatedCapacity, t, !1);
103923                      this.m_userDataBuffer.data = this.ReallocateBuffer4(this.m_userDataBuffer, this.m_internalAllocatedCapacity, t, !0);
103924                      this.m_expirationTimeBuffer.data = this.ReallocateBuffer4(this.m_expirationTimeBuffer, this.m_internalAllocatedCapacity, t, !0);
103925                      this.m_indexByExpirationTimeBuffer.data = this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer, this.m_internalAllocatedCapacity, t, !1);
103926                      this.m_internalAllocatedCapacity = t;
103927                    }
103928                  }
103929                  CreateParticleForGroup(t, e, s) {
103930                    const n = new mn;
103931                    n.flags = i(t.flags, 0);
103932                    xt.MulXV(e, s, n.position);
103933                    St.AddVV(i(t.linearVelocity, St.ZERO), St.CrossSV(i(t.angularVelocity, 0), St.SubVV(n.position, i(t.position, St.ZERO), St.s_t0), St.s_t0), n.velocity);
103934                    n.color.Copy(i(t.color, Rt.ZERO));
103935                    n.lifetime = i(t.lifetime, 0);
103936                    n.userData = t.userData;
103937                    this.CreateParticle(n);
103938                  }
103939                  CreateParticlesStrokeShapeForGroup(e, s, n) {
103940                    const r = Un.CreateParticlesStrokeShapeForGroup_s_edge;
103941                    const o = Un.CreateParticlesStrokeShapeForGroup_s_d;
103942                    const a = Un.CreateParticlesStrokeShapeForGroup_s_p;
103943                    let l = i(s.stride, 0);
103944                    0 === l && (l = this.GetParticleStride());
103945                    let h = 0;
103946                    const c = e.GetChildCount();
103947                    for (let i = 0; i < c; i++) {
103948                      let c = null;
103949                      if (e.GetType() === t.b2ShapeType.e_edgeShape) c = e; else {
103950                        c = r;
103951                        e.GetChildEdge(c, i);
103952                      }
103953                      const u = St.SubVV(c.m_vertex2, c.m_vertex1, o);
103954                      const _ = u.Length();
103955                      for (;h < _; ) {
103956                        const t = St.AddVMulSV(c.m_vertex1, h / _, u, a);
103957                        this.CreateParticleForGroup(s, n, t);
103958                        h += l;
103959                      }
103960                      h -= _;
103961                    }
103962                  }
103963                  CreateParticlesFillShapeForGroup(t, e, s) {
103964                    const n = Un.CreateParticlesFillShapeForGroup_s_aabb;
103965                    const r = Un.CreateParticlesFillShapeForGroup_s_p;
103966                    let o = i(e.stride, 0);
103967                    0 === o && (o = this.GetParticleStride());
103968                    const a = xt.IDENTITY;
103969                    const l = n;
103970                    t.ComputeAABB(l, a, 0);
103971                    for (let i = Math.floor(l.lowerBound.y / o) * o; i < l.upperBound.y; i += o) for (let n = Math.floor(l.lowerBound.x / o) * o; n < l.upperBound.x; n += o) {
103972                      const o = r.Set(n, i);
103973                      t.TestPoint(a, o) && this.CreateParticleForGroup(e, s, o);
103974                    }
103975                  }
103976                  CreateParticlesWithShapeForGroup(e, i, s) {
103977                    switch (e.GetType()) {
103978                     case t.b2ShapeType.e_edgeShape:
103979                     case t.b2ShapeType.e_chainShape:
103980                      this.CreateParticlesStrokeShapeForGroup(e, i, s);
103981                      break;
103982
103983                     case t.b2ShapeType.e_polygonShape:
103984                     case t.b2ShapeType.e_circleShape:
103985                      this.CreateParticlesFillShapeForGroup(e, i, s);
103986                    }
103987                  }
103988                  CreateParticlesWithShapesForGroup(t, e, i, s) {
103989                    const n = new $n(t, e);
103990                    this.CreateParticlesFillShapeForGroup(n, i, s);
103991                  }
103992                  CloneParticle(t, e) {
103993                    const i = new mn;
103994                    i.flags = this.m_flagsBuffer.data[t];
103995                    i.position.Copy(this.m_positionBuffer.data[t]);
103996                    i.velocity.Copy(this.m_velocityBuffer.data[t]);
103997                    this.m_colorBuffer.data && i.color.Copy(this.m_colorBuffer.data[t]);
103998                    this.m_userDataBuffer.data && (i.userData = this.m_userDataBuffer.data[t]);
103999                    i.group = e;
104000                    const s = this.CreateParticle(i);
104001                    if (this.m_handleIndexBuffer.data) {
104002                      const e = this.m_handleIndexBuffer.data[t];
104003                      e && e.SetIndex(s);
104004                      this.m_handleIndexBuffer.data[s] = e;
104005                      this.m_handleIndexBuffer.data[t] = null;
104006                    }
104007                    this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[s] = this.m_lastBodyContactStepBuffer.data[t]);
104008                    this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[s] = this.m_bodyContactCountBuffer.data[t]);
104009                    this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[s] = this.m_consecutiveContactStepsBuffer.data[t]);
104010                    this.m_hasForce && this.m_forceBuffer[s].Copy(this.m_forceBuffer[t]);
104011                    this.m_staticPressureBuffer && (this.m_staticPressureBuffer[s] = this.m_staticPressureBuffer[t]);
104012                    this.m_depthBuffer && (this.m_depthBuffer[s] = this.m_depthBuffer[t]);
104013                    this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[s] = this.m_expirationTimeBuffer.data[t]);
104014                    return s;
104015                  }
104016                  DestroyParticlesInGroup(t, e = !1) {
104017                    for (let i = t.m_firstIndex; i < t.m_lastIndex; i++) this.DestroyParticle(i, e);
104018                  }
104019                  DestroyParticleGroup(t) {
104020                    this.m_world.m_destructionListener && this.m_world.m_destructionListener.SayGoodbyeParticleGroup(t);
104021                    this.SetGroupFlags(t, 0);
104022                    for (let e = t.m_firstIndex; e < t.m_lastIndex; e++) this.m_groupBuffer[e] = null;
104023                    t.m_prev && (t.m_prev.m_next = t.m_next);
104024                    t.m_next && (t.m_next.m_prev = t.m_prev);
104025                    t === this.m_groupList && (this.m_groupList = t.m_next);
104026                    --this.m_groupCount;
104027                  }
104028                  static ParticleCanBeConnected(e, i) {
104029                    return 0 != (e & (t.b2ParticleFlag.b2_wallParticle | t.b2ParticleFlag.b2_springParticle | t.b2ParticleFlag.b2_elasticParticle)) || null !== i && 0 != (i.GetGroupFlags() & t.b2ParticleGroupFlag.b2_rigidParticleGroup);
104030                  }
104031                  UpdatePairsAndTriads(e, i, s) {
104032                    const n = Un.UpdatePairsAndTriads_s_dab;
104033                    const r = Un.UpdatePairsAndTriads_s_dbc;
104034                    const o = Un.UpdatePairsAndTriads_s_dca;
104035                    const a = this.m_positionBuffer.data;
104036                    let l = 0;
104037                    for (let t = e; t < i; t++) l |= this.m_flagsBuffer.data[t];
104038                    if (l & Un.k_pairFlags) for (let n = 0; n < this.m_contactBuffer.count; n++) {
104039                      const r = this.m_contactBuffer.data[n];
104040                      const o = r.indexA;
104041                      const l = r.indexB;
104042                      const h = this.m_flagsBuffer.data[o];
104043                      const c = this.m_flagsBuffer.data[l];
104044                      const u = this.m_groupBuffer[o];
104045                      const _ = this.m_groupBuffer[l];
104046                      if (o >= e && o < i && l >= e && l < i && !((h | c) & t.b2ParticleFlag.b2_zombieParticle) && (h | c) & Un.k_pairFlags && (s.IsNecessary(o) || s.IsNecessary(l)) && Un.ParticleCanBeConnected(h, u) && Un.ParticleCanBeConnected(c, _) && s.ShouldCreatePair(o, l)) {
104047                        const t = this.m_pairBuffer.data[this.m_pairBuffer.Append()];
104048                        t.indexA = o;
104049                        t.indexB = l;
104050                        t.flags = r.flags;
104051                        t.strength = tt(u ? u.m_strength : 1, _ ? _.m_strength : 1);
104052                        t.distance = St.DistanceVV(a[o], a[l]);
104053                      }
104054                      wn(this.m_pairBuffer.data, 0, this.m_pairBuffer.count, Un.ComparePairIndices);
104055                      this.m_pairBuffer.Unique(Un.MatchPairIndices);
104056                    }
104057                    if (l & Un.k_triadFlags) {
104058                      const l = new An(i - e);
104059                      for (let n = e; n < i; n++) {
104060                        const e = this.m_flagsBuffer.data[n];
104061                        const i = this.m_groupBuffer[n];
104062                        e & t.b2ParticleFlag.b2_zombieParticle || !Un.ParticleCanBeConnected(e, i) || l.AddGenerator(a[n], n, s.IsNecessary(n));
104063                      }
104064                      const h = this.GetParticleStride();
104065                      l.Generate(h / 2, 2 * h);
104066                      const c = this;
104067                      const u = (t, e, i) => {
104068                        const l = c.m_flagsBuffer.data[t];
104069                        const h = c.m_flagsBuffer.data[e];
104070                        const u = c.m_flagsBuffer.data[i];
104071                        if ((l | h | u) & Un.k_triadFlags && s.ShouldCreateTriad(t, e, i)) {
104072                          const s = a[t];
104073                          const _ = a[e];
104074                          const d = a[i];
104075                          const p = St.SubVV(s, _, n);
104076                          const m = St.SubVV(_, d, r);
104077                          const f = St.SubVV(d, s, o);
104078                          const g = D * c.m_squaredDiameter;
104079                          if (St.DotVV(p, p) > g || St.DotVV(m, m) > g || St.DotVV(f, f) > g) return;
104080                          const y = c.m_groupBuffer[t];
104081                          const b = c.m_groupBuffer[e];
104082                          const S = c.m_groupBuffer[i];
104083                          const A = c.m_triadBuffer.data[c.m_triadBuffer.Append()];
104084                          A.indexA = t;
104085                          A.indexB = e;
104086                          A.indexC = i;
104087                          A.flags = l | h | u;
104088                          A.strength = tt(tt(y ? y.m_strength : 1, b ? b.m_strength : 1), S ? S.m_strength : 1);
104089                          const T = (s.x + _.x + d.x) / 3;
104090                          const v = (s.y + _.y + d.y) / 3;
104091                          A.pa.x = s.x - T;
104092                          A.pa.y = s.y - v;
104093                          A.pb.x = _.x - T;
104094                          A.pb.y = _.y - v;
104095                          A.pc.x = d.x - T;
104096                          A.pc.y = d.y - v;
104097                          A.ka = -St.DotVV(f, p);
104098                          A.kb = -St.DotVV(p, m);
104099                          A.kc = -St.DotVV(m, f);
104100                          A.s = St.CrossVV(s, _) + St.CrossVV(_, d) + St.CrossVV(d, s);
104101                        }
104102                      };
104103                      l.GetNodes(u);
104104                      wn(this.m_triadBuffer.data, 0, this.m_triadBuffer.count, Un.CompareTriadIndices);
104105                      this.m_triadBuffer.Unique(Un.MatchTriadIndices);
104106                    }
104107                  }
104108                  UpdatePairsAndTriadsWithReactiveParticles() {
104109                    const e = new tr(this.m_flagsBuffer);
104110                    this.UpdatePairsAndTriads(0, this.m_count, e);
104111                    for (let e = 0; e < this.m_count; e++) this.m_flagsBuffer.data[e] &= ~t.b2ParticleFlag.b2_reactiveParticle;
104112                    this.m_allParticleFlags &= ~t.b2ParticleFlag.b2_reactiveParticle;
104113                  }
104114                  static ComparePairIndices(t, e) {
104115                    const i = t.indexA - e.indexA;
104116                    return 0 !== i ? i < 0 : t.indexB < e.indexB;
104117                  }
104118                  static MatchPairIndices(t, e) {
104119                    return t.indexA === e.indexA && t.indexB === e.indexB;
104120                  }
104121                  static CompareTriadIndices(t, e) {
104122                    const i = t.indexA - e.indexA;
104123                    if (0 !== i) return i < 0;
104124                    const s = t.indexB - e.indexB;
104125                    return 0 !== s ? s < 0 : t.indexC < e.indexC;
104126                  }
104127                  static MatchTriadIndices(t, e) {
104128                    return t.indexA === e.indexA && t.indexB === e.indexB && t.indexC === e.indexC;
104129                  }
104130                  static InitializeParticleLists(t, e) {
104131                    const i = t.GetBufferIndex();
104132                    const s = t.GetParticleCount();
104133                    for (let t = 0; t < s; t++) {
104134                      const s = e[t];
104135                      s.list = s;
104136                      s.next = null;
104137                      s.count = 1;
104138                      s.index = t + i;
104139                    }
104140                  }
104141                  MergeParticleListsInContact(t, e) {
104142                    const i = t.GetBufferIndex();
104143                    for (let s = 0; s < this.m_contactBuffer.count; s++) {
104144                      const n = this.m_contactBuffer.data[s];
104145                      const r = n.indexA;
104146                      const o = n.indexB;
104147                      if (!t.ContainsParticle(r) || !t.ContainsParticle(o)) continue;
104148                      let a = e[r - i].list;
104149                      let l = e[o - i].list;
104150                      if (a !== l) {
104151                        if (a.count < l.count) {
104152                          const t = a;
104153                          a = l;
104154                          l = t;
104155                        }
104156                        Un.MergeParticleLists(a, l);
104157                      }
104158                    }
104159                  }
104160                  static MergeParticleLists(t, e) {
104161                    for (let i = e; ;) {
104162                      i.list = t;
104163                      const e = i.next;
104164                      if (!e) {
104165                        i.next = t.next;
104166                        break;
104167                      }
104168                      i = e;
104169                    }
104170                    t.next = e;
104171                    t.count += e.count;
104172                    e.count = 0;
104173                  }
104174                  static FindLongestParticleList(t, e) {
104175                    const i = t.GetParticleCount();
104176                    let s = e[0];
104177                    for (let t = 0; t < i; t++) {
104178                      const i = e[t];
104179                      s.count < i.count && (s = i);
104180                    }
104181                    return s;
104182                  }
104183                  MergeZombieParticleListNodes(e, i, s) {
104184                    const n = e.GetParticleCount();
104185                    for (let e = 0; e < n; e++) {
104186                      const n = i[e];
104187                      n !== s && this.m_flagsBuffer.data[n.index] & t.b2ParticleFlag.b2_zombieParticle && Un.MergeParticleListAndNode(s, n);
104188                    }
104189                  }
104190                  static MergeParticleListAndNode(t, e) {
104191                    e.list = t;
104192                    e.next = t.next;
104193                    t.next = e;
104194                    t.count++;
104195                    e.count = 0;
104196                  }
104197                  CreateParticleGroupsFromParticleList(e, i, s) {
104198                    const n = e.GetParticleCount();
104199                    const r = new yn;
104200                    r.groupFlags = e.GetGroupFlags();
104201                    r.userData = e.GetUserData();
104202                    for (let e = 0; e < n; e++) {
104203                      const n = i[e];
104204                      if (!n.count || n === s) continue;
104205                      const o = this.CreateParticleGroup(r);
104206                      for (let e = n; e; e = e.next) {
104207                        const i = e.index;
104208                        const s = this.CloneParticle(i, o);
104209                        this.m_flagsBuffer.data[i] |= t.b2ParticleFlag.b2_zombieParticle;
104210                        e.index = s;
104211                      }
104212                    }
104213                  }
104214                  UpdatePairsAndTriadsWithParticleList(t, e) {
104215                    const i = t.GetBufferIndex();
104216                    for (let s = 0; s < this.m_pairBuffer.count; s++) {
104217                      const n = this.m_pairBuffer.data[s];
104218                      const r = n.indexA;
104219                      const o = n.indexB;
104220                      t.ContainsParticle(r) && (n.indexA = e[r - i].index);
104221                      t.ContainsParticle(o) && (n.indexB = e[o - i].index);
104222                    }
104223                    for (let s = 0; s < this.m_triadBuffer.count; s++) {
104224                      const n = this.m_triadBuffer.data[s];
104225                      const r = n.indexA;
104226                      const o = n.indexB;
104227                      const a = n.indexC;
104228                      t.ContainsParticle(r) && (n.indexA = e[r - i].index);
104229                      t.ContainsParticle(o) && (n.indexB = e[o - i].index);
104230                      t.ContainsParticle(a) && (n.indexC = e[a - i].index);
104231                    }
104232                  }
104233                  ComputeDepth() {
104234                    const e = [];
104235                    let i = 0;
104236                    for (let s = 0; s < this.m_contactBuffer.count; s++) {
104237                      const n = this.m_contactBuffer.data[s];
104238                      const r = n.indexA;
104239                      const o = n.indexB;
104240                      const a = this.m_groupBuffer[r];
104241                      const l = this.m_groupBuffer[o];
104242                      a && a === l && a.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && (e[i++] = n);
104243                    }
104244                    const n = [];
104245                    let r = 0;
104246                    for (let e = this.m_groupList; e; e = e.GetNext()) if (e.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth) {
104247                      n[r++] = e;
104248                      this.SetGroupFlags(e, e.m_groupFlags & ~t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);
104249                      for (let t = e.m_firstIndex; t < e.m_lastIndex; t++) this.m_accumulationBuffer[t] = 0;
104250                    }
104251                    for (let t = 0; t < i; t++) {
104252                      const i = e[t];
104253                      const s = i.indexA;
104254                      const n = i.indexB;
104255                      const r = i.weight;
104256                      this.m_accumulationBuffer[s] += r;
104257                      this.m_accumulationBuffer[n] += r;
104258                    }
104259                    for (let t = 0; t < r; t++) {
104260                      const e = n[t];
104261                      for (let t = e.m_firstIndex; t < e.m_lastIndex; t++) {
104262                        const e = this.m_accumulationBuffer[t];
104263                        this.m_depthBuffer[t] = e < .8 ? 0 : s;
104264                      }
104265                    }
104266                    const o = at(this.m_count) >> 0;
104267                    for (let t = 0; t < o; t++) {
104268                      let t = !1;
104269                      for (let s = 0; s < i; s++) {
104270                        const i = e[s];
104271                        const n = i.indexA;
104272                        const r = i.indexB;
104273                        const o = 1 - i.weight;
104274                        const a = this.m_depthBuffer[n];
104275                        const l = this.m_depthBuffer[r];
104276                        const h = l + o;
104277                        const c = a + o;
104278                        if (a > h) {
104279                          this.m_depthBuffer[n] = h;
104280                          t = !0;
104281                        }
104282                        if (l > c) {
104283                          this.m_depthBuffer[r] = c;
104284                          t = !0;
104285                        }
104286                      }
104287                      if (!t) break;
104288                    }
104289                    for (let t = 0; t < r; t++) {
104290                      const e = n[t];
104291                      for (let t = e.m_firstIndex; t < e.m_lastIndex; t++) this.m_depthBuffer[t] < s ? this.m_depthBuffer[t] *= this.m_particleDiameter : this.m_depthBuffer[t] = 0;
104292                    }
104293                  }
104294                  GetInsideBoundsEnumerator(t) {
104295                    const e = Un.computeTag(this.m_inverseDiameter * t.lowerBound.x - 1, this.m_inverseDiameter * t.lowerBound.y - 1);
104296                    const i = Un.computeTag(this.m_inverseDiameter * t.upperBound.x + 1, this.m_inverseDiameter * t.upperBound.y + 1);
104297                    const s = 0;
104298                    const n = this.m_proxyBuffer.count;
104299                    const r = In(this.m_proxyBuffer.data, s, n, e, zn.CompareProxyTag);
104300                    const o = Mn(this.m_proxyBuffer.data, s, n, i, zn.CompareTagProxy);
104301                    return new Hn(this, e, i, r, o);
104302                  }
104303                  UpdateAllParticleFlags() {
104304                    this.m_allParticleFlags = 0;
104305                    for (let t = 0; t < this.m_count; t++) this.m_allParticleFlags |= this.m_flagsBuffer.data[t];
104306                    this.m_needsUpdateAllParticleFlags = !1;
104307                  }
104308                  UpdateAllGroupFlags() {
104309                    this.m_allGroupFlags = 0;
104310                    for (let t = this.m_groupList; t; t = t.GetNext()) this.m_allGroupFlags |= t.m_groupFlags;
104311                    this.m_needsUpdateAllGroupFlags = !1;
104312                  }
104313                  AddContact(t, e, i) {
104314                    const s = this.m_flagsBuffer.data;
104315                    const n = this.m_positionBuffer.data;
104316                    const r = St.SubVV(n[e], n[t], Un.AddContact_s_d);
104317                    const o = St.DotVV(r, r);
104318                    if (0 < o && o < this.m_squaredDiameter) {
104319                      const i = ot(o);
104320                      const n = this.m_contactBuffer.data[this.m_contactBuffer.Append()];
104321                      n.indexA = t;
104322                      n.indexB = e;
104323                      n.flags = s[t] | s[e];
104324                      n.weight = 1 - o * i * this.m_inverseDiameter;
104325                      n.normal.x = i * r.x;
104326                      n.normal.y = i * r.y;
104327                    }
104328                  }
104329                  FindContacts_Reference(t) {
104330                    const e = 0;
104331                    const i = this.m_proxyBuffer.count;
104332                    this.m_contactBuffer.count = 0;
104333                    for (let t = e, s = e; t < i; t++) {
104334                      const e = Un.computeRelativeTag(this.m_proxyBuffer.data[t].tag, 1, 0);
104335                      for (let s = t + 1; s < i && !(e < this.m_proxyBuffer.data[s].tag); s++) this.AddContact(this.m_proxyBuffer.data[t].index, this.m_proxyBuffer.data[s].index, this.m_contactBuffer);
104336                      const n = Un.computeRelativeTag(this.m_proxyBuffer.data[t].tag, -1, 1);
104337                      for (;s < i && !(n <= this.m_proxyBuffer.data[s].tag); s++) ;
104338                      const r = Un.computeRelativeTag(this.m_proxyBuffer.data[t].tag, 1, 1);
104339                      for (let e = s; e < i && !(r < this.m_proxyBuffer.data[e].tag); e++) this.AddContact(this.m_proxyBuffer.data[t].index, this.m_proxyBuffer.data[e].index, this.m_contactBuffer);
104340                    }
104341                  }
104342                  FindContacts(t) {
104343                    this.FindContacts_Reference(t);
104344                  }
104345                  UpdateProxies_Reference(t) {
104346                    const e = this.m_positionBuffer.data;
104347                    const i = this.m_inverseDiameter;
104348                    for (let t = 0; t < this.m_proxyBuffer.count; ++t) {
104349                      const s = this.m_proxyBuffer.data[t];
104350                      const n = e[s.index];
104351                      s.tag = Un.computeTag(i * n.x, i * n.y);
104352                    }
104353                  }
104354                  UpdateProxies(t) {
104355                    this.UpdateProxies_Reference(t);
104356                  }
104357                  SortProxies(t) {
104358                    xn(this.m_proxyBuffer.data, 0, this.m_proxyBuffer.count, zn.CompareProxyProxy);
104359                  }
104360                  FilterContacts(e) {
104361                    const i = this.GetParticleContactFilter();
104362                    if (null === i) return;
104363                    const s = this;
104364                    const n = e => 0 != (e.flags & t.b2ParticleFlag.b2_particleContactFilterParticle) && !i.ShouldCollideParticleParticle(s, e.indexA, e.indexB);
104365                    this.m_contactBuffer.RemoveIf(n);
104366                  }
104367                  NotifyContactListenerPreContact(t) {
104368                    if (null !== this.GetParticleContactListener()) {
104369                      t.Initialize(this.m_contactBuffer, this.m_flagsBuffer);
104370                      throw new Error;
104371                    }
104372                  }
104373                  NotifyContactListenerPostContact(t) {
104374                    const e = this.GetParticleContactListener();
104375                    if (null !== e) {
104376                      for (let t = 0; t < this.m_contactBuffer.count; ++t) {
104377                        const i = this.m_contactBuffer.data[t];
104378                        e.BeginContactParticleParticle(this, i);
104379                      }
104380                      throw new Error;
104381                    }
104382                  }
104383                  static b2ParticleContactIsZombie(e) {
104384                    return (e.flags & t.b2ParticleFlag.b2_zombieParticle) === t.b2ParticleFlag.b2_zombieParticle;
104385                  }
104386                  UpdateContacts(t) {
104387                    this.UpdateProxies(this.m_proxyBuffer);
104388                    this.SortProxies(this.m_proxyBuffer);
104389                    const e = new Kn;
104390                    this.NotifyContactListenerPreContact(e);
104391                    this.FindContacts(this.m_contactBuffer);
104392                    this.FilterContacts(this.m_contactBuffer);
104393                    this.NotifyContactListenerPostContact(e);
104394                    t && this.m_contactBuffer.RemoveIf(Un.b2ParticleContactIsZombie);
104395                  }
104396                  NotifyBodyContactListenerPreContact(t) {
104397                    if (null !== this.GetFixtureContactListener()) {
104398                      t.Initialize(this.m_bodyContactBuffer, this.m_flagsBuffer);
104399                      throw new Error;
104400                    }
104401                  }
104402                  NotifyBodyContactListenerPostContact(t) {
104403                    const e = this.GetFixtureContactListener();
104404                    if (null !== e) {
104405                      for (let t = 0; t < this.m_bodyContactBuffer.count; t++) {
104406                        const i = this.m_bodyContactBuffer.data[t];
104407                        e.BeginContactFixtureParticle(this, i);
104408                      }
104409                      throw new Error;
104410                    }
104411                  }
104412                  UpdateBodyContacts() {
104413                    const t = Un.UpdateBodyContacts_s_aabb;
104414                    const e = new Yn;
104415                    this.NotifyBodyContactListenerPreContact(e);
104416                    if (this.m_stuckThreshold > 0) {
104417                      const t = this.GetParticleCount();
104418                      for (let e = 0; e < t; e++) {
104419                        this.m_bodyContactCountBuffer.data[e] = 0;
104420                        this.m_timestamp > this.m_lastBodyContactStepBuffer.data[e] + 1 && (this.m_consecutiveContactStepsBuffer.data[e] = 0);
104421                      }
104422                    }
104423                    this.m_bodyContactBuffer.SetCount(0);
104424                    this.m_stuckParticleBuffer.SetCount(0);
104425                    const i = t;
104426                    this.ComputeAABB(i);
104427                    null === this.UpdateBodyContacts_callback && (this.UpdateBodyContacts_callback = new er(this));
104428                    const s = this.UpdateBodyContacts_callback;
104429                    s.m_contactFilter = this.GetFixtureContactFilter();
104430                    this.m_world.QueryAABB(s, i);
104431                    this.m_def.strictContactCheck && this.RemoveSpuriousBodyContacts();
104432                    this.NotifyBodyContactListenerPostContact(e);
104433                  }
104434                  Solve(e) {
104435                    const i = Un.Solve_s_subStep;
104436                    if (0 !== this.m_count) {
104437                      this.m_expirationTimeBuffer.data && this.SolveLifetimes(e);
104438                      this.m_allParticleFlags & t.b2ParticleFlag.b2_zombieParticle && this.SolveZombie();
104439                      this.m_needsUpdateAllParticleFlags && this.UpdateAllParticleFlags();
104440                      this.m_needsUpdateAllGroupFlags && this.UpdateAllGroupFlags();
104441                      if (!this.m_paused) for (this.m_iterationIndex = 0; this.m_iterationIndex < e.particleIterations; this.m_iterationIndex++) {
104442                        ++this.m_timestamp;
104443                        const s = i.Copy(e);
104444                        s.dt /= e.particleIterations;
104445                        s.inv_dt *= e.particleIterations;
104446                        this.UpdateContacts(!1);
104447                        this.UpdateBodyContacts();
104448                        this.ComputeWeight();
104449                        this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth && this.ComputeDepth();
104450                        this.m_allParticleFlags & t.b2ParticleFlag.b2_reactiveParticle && this.UpdatePairsAndTriadsWithReactiveParticles();
104451                        this.m_hasForce && this.SolveForce(s);
104452                        this.m_allParticleFlags & t.b2ParticleFlag.b2_viscousParticle && this.SolveViscous();
104453                        this.m_allParticleFlags & t.b2ParticleFlag.b2_repulsiveParticle && this.SolveRepulsive(s);
104454                        this.m_allParticleFlags & t.b2ParticleFlag.b2_powderParticle && this.SolvePowder(s);
104455                        this.m_allParticleFlags & t.b2ParticleFlag.b2_tensileParticle && this.SolveTensile(s);
104456                        this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SolveSolid(s);
104457                        this.m_allParticleFlags & t.b2ParticleFlag.b2_colorMixingParticle && this.SolveColorMixing();
104458                        this.SolveGravity(s);
104459                        this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle && this.SolveStaticPressure(s);
104460                        this.SolvePressure(s);
104461                        this.SolveDamping(s);
104462                        this.m_allParticleFlags & Un.k_extraDampingFlags && this.SolveExtraDamping();
104463                        this.m_allParticleFlags & t.b2ParticleFlag.b2_elasticParticle && this.SolveElastic(s);
104464                        this.m_allParticleFlags & t.b2ParticleFlag.b2_springParticle && this.SolveSpring(s);
104465                        this.LimitVelocity(s);
104466                        this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigidDamping();
104467                        this.m_allParticleFlags & t.b2ParticleFlag.b2_barrierParticle && this.SolveBarrier(s);
104468                        this.SolveCollision(s);
104469                        this.m_allGroupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup && this.SolveRigid(s);
104470                        this.m_allParticleFlags & t.b2ParticleFlag.b2_wallParticle && this.SolveWall();
104471                        for (let t = 0; t < this.m_count; t++) this.m_positionBuffer.data[t].SelfMulAdd(s.dt, this.m_velocityBuffer.data[t]);
104472                      }
104473                    }
104474                  }
104475                  SolveCollision(t) {
104476                    const e = Un.SolveCollision_s_aabb;
104477                    const i = this.m_positionBuffer.data;
104478                    const n = this.m_velocityBuffer.data;
104479                    const r = e;
104480                    r.lowerBound.x = +s;
104481                    r.lowerBound.y = +s;
104482                    r.upperBound.x = -s;
104483                    r.upperBound.y = -s;
104484                    for (let e = 0; e < this.m_count; e++) {
104485                      const s = n[e];
104486                      const o = i[e];
104487                      const a = o.x + t.dt * s.x;
104488                      const l = o.y + t.dt * s.y;
104489                      r.lowerBound.x = tt(r.lowerBound.x, tt(o.x, a));
104490                      r.lowerBound.y = tt(r.lowerBound.y, tt(o.y, l));
104491                      r.upperBound.x = et(r.upperBound.x, et(o.x, a));
104492                      r.upperBound.y = et(r.upperBound.y, et(o.y, l));
104493                    }
104494                    null === this.SolveCollision_callback && (this.SolveCollision_callback = new ir(this, t));
104495                    const o = this.SolveCollision_callback;
104496                    o.m_step = t;
104497                    this.m_world.QueryAABB(o, r);
104498                  }
104499                  LimitVelocity(t) {
104500                    const e = this.m_velocityBuffer.data;
104501                    const i = this.GetCriticalVelocitySquared(t);
104502                    for (let t = 0; t < this.m_count; t++) {
104503                      const s = e[t];
104504                      const n = St.DotVV(s, s);
104505                      n > i && s.SelfMul(at(i / n));
104506                    }
104507                  }
104508                  SolveGravity(t) {
104509                    const e = Un.SolveGravity_s_gravity;
104510                    const i = this.m_velocityBuffer.data;
104511                    const s = St.MulSV(t.dt * this.m_def.gravityScale, this.m_world.GetGravity(), e);
104512                    for (let t = 0; t < this.m_count; t++) i[t].SelfAdd(s);
104513                  }
104514                  SolveBarrier(e) {
104515                    const i = Un.SolveBarrier_s_aabb;
104516                    const s = Un.SolveBarrier_s_va;
104517                    const n = Un.SolveBarrier_s_vb;
104518                    const r = Un.SolveBarrier_s_pba;
104519                    const o = Un.SolveBarrier_s_vba;
104520                    const a = Un.SolveBarrier_s_vc;
104521                    const l = Un.SolveBarrier_s_pca;
104522                    const h = Un.SolveBarrier_s_vca;
104523                    const c = Un.SolveBarrier_s_qba;
104524                    const u = Un.SolveBarrier_s_qca;
104525                    const _ = Un.SolveBarrier_s_dv;
104526                    const d = Un.SolveBarrier_s_f;
104527                    const p = this.m_positionBuffer.data;
104528                    const m = this.m_velocityBuffer.data;
104529                    for (let t = 0; t < this.m_count; t++) 0 != (this.m_flagsBuffer.data[t] & Un.k_barrierWallFlags) && m[t].SetZero();
104530                    const f = O * e.dt;
104531                    const g = this.GetParticleMass();
104532                    for (let y = 0; y < this.m_pairBuffer.count; y++) {
104533                      const b = this.m_pairBuffer.data[y];
104534                      if (b.flags & t.b2ParticleFlag.b2_barrierParticle) {
104535                        const t = b.indexA;
104536                        const y = b.indexB;
104537                        const S = p[t];
104538                        const A = p[y];
104539                        const T = i;
104540                        St.MinV(S, A, T.lowerBound);
104541                        St.MaxV(S, A, T.upperBound);
104542                        const v = this.m_groupBuffer[t];
104543                        const E = this.m_groupBuffer[y];
104544                        const C = this.GetLinearVelocity(v, t, S, s);
104545                        const x = this.GetLinearVelocity(E, y, A, n);
104546                        const w = St.SubVV(A, S, r);
104547                        const R = St.SubVV(x, C, o);
104548                        const I = this.GetInsideBoundsEnumerator(T);
104549                        let M;
104550                        for (;(M = I.GetNext()) >= 0; ) {
104551                          const t = p[M];
104552                          const i = this.m_groupBuffer[M];
104553                          if (v !== i && E !== i) {
104554                            const s = this.GetLinearVelocity(i, M, t, a);
104555                            const n = St.SubVV(t, S, l);
104556                            const r = St.SubVV(s, C, h);
104557                            const o = St.CrossVV(R, r);
104558                            const p = St.CrossVV(w, r) - St.CrossVV(n, R);
104559                            const y = St.CrossVV(w, n);
104560                            let b, A;
104561                            const T = c, v = u;
104562                            if (0 === o) {
104563                              if (0 === p) continue;
104564                              A = -y / p;
104565                              if (!(A >= 0 && A < f)) continue;
104566                              St.AddVMulSV(w, A, R, T);
104567                              St.AddVMulSV(n, A, r, v);
104568                              b = St.DotVV(T, v) / St.DotVV(T, T);
104569                              if (!(b >= 0 && b <= 1)) continue;
104570                            } else {
104571                              const t = p * p - 4 * y * o;
104572                              if (t < 0) continue;
104573                              const e = at(t);
104574                              let i = (-p - e) / (2 * o);
104575                              let s = (-p + e) / (2 * o);
104576                              if (i > s) {
104577                                const t = i;
104578                                i = s;
104579                                s = t;
104580                              }
104581                              A = i;
104582                              St.AddVMulSV(w, A, R, T);
104583                              St.AddVMulSV(n, A, r, v);
104584                              b = St.DotVV(T, v) / St.DotVV(T, T);
104585                              if (!(A >= 0 && A < f && b >= 0 && b <= 1)) {
104586                                A = s;
104587                                if (!(A >= 0 && A < f)) continue;
104588                                St.AddVMulSV(w, A, R, T);
104589                                St.AddVMulSV(n, A, r, v);
104590                                b = St.DotVV(T, v) / St.DotVV(T, T);
104591                                if (!(b >= 0 && b <= 1)) continue;
104592                              }
104593                            }
104594                            const E = _;
104595                            E.x = C.x + b * R.x - s.x;
104596                            E.y = C.y + b * R.y - s.y;
104597                            const x = St.MulSV(g, E, d);
104598                            if (i && this.IsRigidGroup(i)) {
104599                              const e = i.GetMass();
104600                              const s = i.GetInertia();
104601                              e > 0 && i.m_linearVelocity.SelfMulAdd(1 / e, x);
104602                              s > 0 && (i.m_angularVelocity += St.CrossVV(St.SubVV(t, i.GetCenter(), St.s_t0), x) / s);
104603                            } else m[M].SelfAdd(E);
104604                            this.ParticleApplyForce(M, x.SelfMul(-e.inv_dt));
104605                          }
104606                        }
104607                      }
104608                    }
104609                  }
104610                  SolveStaticPressure(e) {
104611                    this.m_staticPressureBuffer = this.RequestBuffer(this.m_staticPressureBuffer);
104612                    const i = this.GetCriticalPressure(e);
104613                    const s = this.m_def.staticPressureStrength * i;
104614                    const n = I * i;
104615                    const r = this.m_def.staticPressureRelaxation;
104616                    for (let e = 0; e < this.m_def.staticPressureIterations; e++) {
104617                      for (let t = 0; t < this.m_count; t++) this.m_accumulationBuffer[t] = 0;
104618                      for (let e = 0; e < this.m_contactBuffer.count; e++) {
104619                        const i = this.m_contactBuffer.data[e];
104620                        if (i.flags & t.b2ParticleFlag.b2_staticPressureParticle) {
104621                          const t = i.indexA;
104622                          const e = i.indexB;
104623                          const s = i.weight;
104624                          this.m_accumulationBuffer[t] += s * this.m_staticPressureBuffer[e];
104625                          this.m_accumulationBuffer[e] += s * this.m_staticPressureBuffer[t];
104626                        }
104627                      }
104628                      for (let e = 0; e < this.m_count; e++) {
104629                        const i = this.m_weightBuffer[e];
104630                        if (this.m_flagsBuffer.data[e] & t.b2ParticleFlag.b2_staticPressureParticle) {
104631                          const t = (this.m_accumulationBuffer[e] + s * (i - R)) / (i + r);
104632                          this.m_staticPressureBuffer[e] = it(t, 0, n);
104633                        } else this.m_staticPressureBuffer[e] = 0;
104634                      }
104635                    }
104636                  }
104637                  ComputeWeight() {
104638                    for (let t = 0; t < this.m_count; t++) this.m_weightBuffer[t] = 0;
104639                    for (let t = 0; t < this.m_bodyContactBuffer.count; t++) {
104640                      const e = this.m_bodyContactBuffer.data[t];
104641                      const i = e.index;
104642                      const s = e.weight;
104643                      this.m_weightBuffer[i] += s;
104644                    }
104645                    for (let t = 0; t < this.m_contactBuffer.count; t++) {
104646                      const e = this.m_contactBuffer.data[t];
104647                      const i = e.indexA;
104648                      const s = e.indexB;
104649                      const n = e.weight;
104650                      this.m_weightBuffer[i] += n;
104651                      this.m_weightBuffer[s] += n;
104652                    }
104653                  }
104654                  SolvePressure(e) {
104655                    const i = Un.SolvePressure_s_f;
104656                    const s = this.m_positionBuffer.data;
104657                    const n = this.m_velocityBuffer.data;
104658                    const r = this.GetCriticalPressure(e);
104659                    const o = this.m_def.pressureStrength * r;
104660                    const a = I * r;
104661                    for (let t = 0; t < this.m_count; t++) {
104662                      const e = o * et(0, this.m_weightBuffer[t] - R);
104663                      this.m_accumulationBuffer[t] = tt(e, a);
104664                    }
104665                    if (this.m_allParticleFlags & Un.k_noPressureFlags) for (let t = 0; t < this.m_count; t++) this.m_flagsBuffer.data[t] & Un.k_noPressureFlags && (this.m_accumulationBuffer[t] = 0);
104666                    if (this.m_allParticleFlags & t.b2ParticleFlag.b2_staticPressureParticle) for (let e = 0; e < this.m_count; e++) this.m_flagsBuffer.data[e] & t.b2ParticleFlag.b2_staticPressureParticle && (this.m_accumulationBuffer[e] += this.m_staticPressureBuffer[e]);
104667                    const l = e.dt / (this.m_def.density * this.m_particleDiameter);
104668                    const h = this.GetParticleInvMass();
104669                    for (let t = 0; t < this.m_bodyContactBuffer.count; t++) {
104670                      const e = this.m_bodyContactBuffer.data[t];
104671                      const r = e.index;
104672                      const a = e.body;
104673                      const c = e.weight;
104674                      const u = e.mass;
104675                      const _ = e.normal;
104676                      const d = s[r];
104677                      const p = this.m_accumulationBuffer[r] + o * c;
104678                      const m = St.MulSV(l * c * u * p, _, i);
104679                      n[r].SelfMulSub(h, m);
104680                      a.ApplyLinearImpulse(m, d, !0);
104681                    }
104682                    for (let t = 0; t < this.m_contactBuffer.count; t++) {
104683                      const e = this.m_contactBuffer.data[t];
104684                      const s = e.indexA;
104685                      const r = e.indexB;
104686                      const o = e.weight;
104687                      const a = e.normal;
104688                      const h = this.m_accumulationBuffer[s] + this.m_accumulationBuffer[r];
104689                      const c = St.MulSV(l * o * h, a, i);
104690                      n[s].SelfSub(c);
104691                      n[r].SelfAdd(c);
104692                    }
104693                  }
104694                  SolveDamping(t) {
104695                    const e = Un.SolveDamping_s_v;
104696                    const i = Un.SolveDamping_s_f;
104697                    const s = this.m_positionBuffer.data;
104698                    const n = this.m_velocityBuffer.data;
104699                    const r = this.m_def.dampingStrength;
104700                    const o = 1 / this.GetCriticalVelocity(t);
104701                    const a = this.GetParticleInvMass();
104702                    for (let t = 0; t < this.m_bodyContactBuffer.count; t++) {
104703                      const l = this.m_bodyContactBuffer.data[t];
104704                      const h = l.index;
104705                      const c = l.body;
104706                      const u = l.weight;
104707                      const _ = l.mass;
104708                      const d = l.normal;
104709                      const p = s[h];
104710                      const m = St.SubVV(c.GetLinearVelocityFromWorldPoint(p, St.s_t0), n[h], e);
104711                      const f = St.DotVV(m, d);
104712                      if (f < 0) {
104713                        const t = et(r * u, tt(-o * f, .5));
104714                        const e = St.MulSV(t * _ * f, d, i);
104715                        n[h].SelfMulAdd(a, e);
104716                        c.ApplyLinearImpulse(e.SelfNeg(), p, !0);
104717                      }
104718                    }
104719                    for (let t = 0; t < this.m_contactBuffer.count; t++) {
104720                      const s = this.m_contactBuffer.data[t];
104721                      const a = s.indexA;
104722                      const l = s.indexB;
104723                      const h = s.weight;
104724                      const c = s.normal;
104725                      const u = St.SubVV(n[l], n[a], e);
104726                      const _ = St.DotVV(u, c);
104727                      if (_ < 0) {
104728                        const t = et(r * h, tt(-o * _, .5));
104729                        const e = St.MulSV(t * _, c, i);
104730                        n[a].SelfAdd(e);
104731                        n[l].SelfSub(e);
104732                      }
104733                    }
104734                  }
104735                  SolveRigidDamping() {
104736                    const t = Un.SolveRigidDamping_s_t0;
104737                    const e = Un.SolveRigidDamping_s_t1;
104738                    const i = Un.SolveRigidDamping_s_p;
104739                    const s = Un.SolveRigidDamping_s_v;
104740                    const n = [ 0 ], r = [ 0 ], o = [ 0 ];
104741                    const a = [ 0 ], l = [ 0 ], h = [ 0 ];
104742                    const c = this.m_positionBuffer.data;
104743                    const u = this.m_def.dampingStrength;
104744                    for (let i = 0; i < this.m_bodyContactBuffer.count; i++) {
104745                      const _ = this.m_bodyContactBuffer.data[i];
104746                      const d = _.index;
104747                      const p = this.m_groupBuffer[d];
104748                      if (p && this.IsRigidGroup(p)) {
104749                        const i = _.body;
104750                        const m = _.normal;
104751                        const f = _.weight;
104752                        const g = c[d];
104753                        const y = St.SubVV(i.GetLinearVelocityFromWorldPoint(g, t), p.GetLinearVelocityFromWorldPoint(g, e), s);
104754                        const b = St.DotVV(y, m);
104755                        if (b < 0) {
104756                          this.InitDampingParameterWithRigidGroupOrParticle(n, r, o, !0, p, d, g, m);
104757                          this.InitDampingParameter(a, l, h, i.GetMass(), i.GetInertia() - i.GetMass() * i.GetLocalCenter().LengthSquared(), i.GetWorldCenter(), g, m);
104758                          const t = u * tt(f, 1) * this.ComputeDampingImpulse(n[0], r[0], o[0], a[0], l[0], h[0], b);
104759                          this.ApplyDamping(n[0], r[0], o[0], !0, p, d, t, m);
104760                          i.ApplyLinearImpulse(St.MulSV(-t, m, St.s_t0), g, !0);
104761                        }
104762                      }
104763                    }
104764                    for (let _ = 0; _ < this.m_contactBuffer.count; _++) {
104765                      const d = this.m_contactBuffer.data[_];
104766                      const p = d.indexA;
104767                      const m = d.indexB;
104768                      const f = d.normal;
104769                      const g = d.weight;
104770                      const y = this.m_groupBuffer[p];
104771                      const b = this.m_groupBuffer[m];
104772                      const S = this.IsRigidGroup(y);
104773                      const A = this.IsRigidGroup(b);
104774                      if (y !== b && (S || A)) {
104775                        const _ = St.MidVV(c[p], c[m], i);
104776                        const d = St.SubVV(this.GetLinearVelocity(b, m, _, t), this.GetLinearVelocity(y, p, _, e), s);
104777                        const T = St.DotVV(d, f);
104778                        if (T < 0) {
104779                          this.InitDampingParameterWithRigidGroupOrParticle(n, r, o, S, y, p, _, f);
104780                          this.InitDampingParameterWithRigidGroupOrParticle(a, l, h, A, b, m, _, f);
104781                          const t = u * g * this.ComputeDampingImpulse(n[0], r[0], o[0], a[0], l[0], h[0], T);
104782                          this.ApplyDamping(n[0], r[0], o[0], S, y, p, t, f);
104783                          this.ApplyDamping(a[0], l[0], h[0], A, b, m, -t, f);
104784                        }
104785                      }
104786                    }
104787                  }
104788                  SolveExtraDamping() {
104789                    const t = Un.SolveExtraDamping_s_v;
104790                    const e = Un.SolveExtraDamping_s_f;
104791                    const i = this.m_velocityBuffer.data;
104792                    const s = this.m_positionBuffer.data;
104793                    const n = this.GetParticleInvMass();
104794                    for (let r = 0; r < this.m_bodyContactBuffer.count; r++) {
104795                      const o = this.m_bodyContactBuffer.data[r];
104796                      const a = o.index;
104797                      if (this.m_flagsBuffer.data[a] & Un.k_extraDampingFlags) {
104798                        const r = o.body;
104799                        const l = o.mass;
104800                        const h = o.normal;
104801                        const c = s[a];
104802                        const u = St.SubVV(r.GetLinearVelocityFromWorldPoint(c, St.s_t0), i[a], t);
104803                        const _ = St.DotVV(u, h);
104804                        if (_ < 0) {
104805                          const t = St.MulSV(.5 * l * _, h, e);
104806                          i[a].SelfMulAdd(n, t);
104807                          r.ApplyLinearImpulse(t.SelfNeg(), c, !0);
104808                        }
104809                      }
104810                    }
104811                  }
104812                  SolveWall() {
104813                    const e = this.m_velocityBuffer.data;
104814                    for (let i = 0; i < this.m_count; i++) this.m_flagsBuffer.data[i] & t.b2ParticleFlag.b2_wallParticle && e[i].SetZero();
104815                  }
104816                  SolveRigid(e) {
104817                    const i = Un.SolveRigid_s_position;
104818                    const s = Un.SolveRigid_s_rotation;
104819                    const n = Un.SolveRigid_s_transform;
104820                    const r = Un.SolveRigid_s_velocityTransform;
104821                    const o = this.m_positionBuffer.data;
104822                    const a = this.m_velocityBuffer.data;
104823                    for (let l = this.m_groupList; l; l = l.GetNext()) if (l.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup) {
104824                      l.UpdateStatistics();
104825                      const t = s;
104826                      t.SetAngle(e.dt * l.m_angularVelocity);
104827                      const h = St.AddVV(l.m_center, St.SubVV(St.MulSV(e.dt, l.m_linearVelocity, St.s_t0), Ct.MulRV(t, l.m_center, St.s_t1), St.s_t0), i);
104828                      const c = n;
104829                      c.SetPositionRotation(h, t);
104830                      xt.MulXX(c, l.m_transform, l.m_transform);
104831                      const u = r;
104832                      u.p.x = e.inv_dt * c.p.x;
104833                      u.p.y = e.inv_dt * c.p.y;
104834                      u.q.s = e.inv_dt * c.q.s;
104835                      u.q.c = e.inv_dt * (c.q.c - 1);
104836                      for (let t = l.m_firstIndex; t < l.m_lastIndex; t++) xt.MulXV(u, o[t], a[t]);
104837                    }
104838                  }
104839                  SolveElastic(e) {
104840                    const i = Un.SolveElastic_s_pa;
104841                    const s = Un.SolveElastic_s_pb;
104842                    const n = Un.SolveElastic_s_pc;
104843                    const r = Un.SolveElastic_s_r;
104844                    const o = Un.SolveElastic_s_t0;
104845                    const a = this.m_positionBuffer.data;
104846                    const l = this.m_velocityBuffer.data;
104847                    const h = e.inv_dt * this.m_def.elasticStrength;
104848                    for (let c = 0; c < this.m_triadBuffer.count; c++) {
104849                      const u = this.m_triadBuffer.data[c];
104850                      if (u.flags & t.b2ParticleFlag.b2_elasticParticle) {
104851                        const t = u.indexA;
104852                        const c = u.indexB;
104853                        const _ = u.indexC;
104854                        const d = u.pa;
104855                        const p = u.pb;
104856                        const m = u.pc;
104857                        const f = i.Copy(a[t]);
104858                        const g = s.Copy(a[c]);
104859                        const y = n.Copy(a[_]);
104860                        const b = l[t];
104861                        const S = l[c];
104862                        const A = l[_];
104863                        f.SelfMulAdd(e.dt, b);
104864                        g.SelfMulAdd(e.dt, S);
104865                        y.SelfMulAdd(e.dt, A);
104866                        const T = (f.x + g.x + y.x) / 3;
104867                        const v = (f.y + g.y + y.y) / 3;
104868                        f.x -= T;
104869                        f.y -= v;
104870                        g.x -= T;
104871                        g.y -= v;
104872                        y.x -= T;
104873                        y.y -= v;
104874                        const E = r;
104875                        E.s = St.CrossVV(d, f) + St.CrossVV(p, g) + St.CrossVV(m, y);
104876                        E.c = St.DotVV(d, f) + St.DotVV(p, g) + St.DotVV(m, y);
104877                        let C = ot(E.s * E.s + E.c * E.c);
104878                        isFinite(C) || (C = 198177537e11);
104879                        E.s *= C;
104880                        E.c *= C;
104881                        const x = h * u.strength;
104882                        Ct.MulRV(E, d, o);
104883                        St.SubVV(o, f, o);
104884                        St.MulSV(x, o, o);
104885                        b.SelfAdd(o);
104886                        Ct.MulRV(E, p, o);
104887                        St.SubVV(o, g, o);
104888                        St.MulSV(x, o, o);
104889                        S.SelfAdd(o);
104890                        Ct.MulRV(E, m, o);
104891                        St.SubVV(o, y, o);
104892                        St.MulSV(x, o, o);
104893                        A.SelfAdd(o);
104894                      }
104895                    }
104896                  }
104897                  SolveSpring(e) {
104898                    const i = Un.SolveSpring_s_pa;
104899                    const s = Un.SolveSpring_s_pb;
104900                    const n = Un.SolveSpring_s_d;
104901                    const r = Un.SolveSpring_s_f;
104902                    const o = this.m_positionBuffer.data;
104903                    const a = this.m_velocityBuffer.data;
104904                    const l = e.inv_dt * this.m_def.springStrength;
104905                    for (let h = 0; h < this.m_pairBuffer.count; h++) {
104906                      const c = this.m_pairBuffer.data[h];
104907                      if (c.flags & t.b2ParticleFlag.b2_springParticle) {
104908                        const t = c.indexA;
104909                        const h = c.indexB;
104910                        const u = i.Copy(o[t]);
104911                        const _ = s.Copy(o[h]);
104912                        const d = a[t];
104913                        const p = a[h];
104914                        u.SelfMulAdd(e.dt, d);
104915                        _.SelfMulAdd(e.dt, p);
104916                        const m = St.SubVV(_, u, n);
104917                        const f = c.distance;
104918                        const g = m.Length();
104919                        const y = l * c.strength;
104920                        const b = St.MulSV(y * (f - g) / g, m, r);
104921                        d.SelfSub(b);
104922                        p.SelfAdd(b);
104923                      }
104924                    }
104925                  }
104926                  SolveTensile(e) {
104927                    const i = Un.SolveTensile_s_weightedNormal;
104928                    const s = Un.SolveTensile_s_s;
104929                    const n = Un.SolveTensile_s_f;
104930                    const r = this.m_velocityBuffer.data;
104931                    for (let t = 0; t < this.m_count; t++) {
104932                      this.m_accumulation2Buffer[t] = new St;
104933                      this.m_accumulation2Buffer[t].SetZero();
104934                    }
104935                    for (let e = 0; e < this.m_contactBuffer.count; e++) {
104936                      const s = this.m_contactBuffer.data[e];
104937                      if (s.flags & t.b2ParticleFlag.b2_tensileParticle) {
104938                        const t = s.indexA;
104939                        const e = s.indexB;
104940                        const n = s.weight;
104941                        const r = s.normal;
104942                        const o = St.MulSV((1 - n) * n, r, i);
104943                        this.m_accumulation2Buffer[t].SelfSub(o);
104944                        this.m_accumulation2Buffer[e].SelfAdd(o);
104945                      }
104946                    }
104947                    const o = this.GetCriticalVelocity(e);
104948                    const a = this.m_def.surfaceTensionPressureStrength * o;
104949                    const l = this.m_def.surfaceTensionNormalStrength * o;
104950                    const h = M * o;
104951                    for (let e = 0; e < this.m_contactBuffer.count; e++) {
104952                      const i = this.m_contactBuffer.data[e];
104953                      if (i.flags & t.b2ParticleFlag.b2_tensileParticle) {
104954                        const t = i.indexA;
104955                        const e = i.indexB;
104956                        const o = i.weight;
104957                        const c = i.normal;
104958                        const u = this.m_weightBuffer[t] + this.m_weightBuffer[e];
104959                        const _ = St.SubVV(this.m_accumulation2Buffer[e], this.m_accumulation2Buffer[t], s);
104960                        const d = tt(a * (u - 2) + l * St.DotVV(_, c), h) * o;
104961                        const p = St.MulSV(d, c, n);
104962                        r[t].SelfSub(p);
104963                        r[e].SelfAdd(p);
104964                      }
104965                    }
104966                  }
104967                  SolveViscous() {
104968                    const e = Un.SolveViscous_s_v;
104969                    const i = Un.SolveViscous_s_f;
104970                    const s = this.m_positionBuffer.data;
104971                    const n = this.m_velocityBuffer.data;
104972                    const r = this.m_def.viscousStrength;
104973                    const o = this.GetParticleInvMass();
104974                    for (let a = 0; a < this.m_bodyContactBuffer.count; a++) {
104975                      const l = this.m_bodyContactBuffer.data[a];
104976                      const h = l.index;
104977                      if (this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_viscousParticle) {
104978                        const t = l.body;
104979                        const a = l.weight;
104980                        const c = l.mass;
104981                        const u = s[h];
104982                        const _ = St.SubVV(t.GetLinearVelocityFromWorldPoint(u, St.s_t0), n[h], e);
104983                        const d = St.MulSV(r * c * a, _, i);
104984                        n[h].SelfMulAdd(o, d);
104985                        t.ApplyLinearImpulse(d.SelfNeg(), u, !0);
104986                      }
104987                    }
104988                    for (let s = 0; s < this.m_contactBuffer.count; s++) {
104989                      const o = this.m_contactBuffer.data[s];
104990                      if (o.flags & t.b2ParticleFlag.b2_viscousParticle) {
104991                        const t = o.indexA;
104992                        const s = o.indexB;
104993                        const a = o.weight;
104994                        const l = St.SubVV(n[s], n[t], e);
104995                        const h = St.MulSV(r * a, l, i);
104996                        n[t].SelfAdd(h);
104997                        n[s].SelfSub(h);
104998                      }
104999                    }
105000                  }
105001                  SolveRepulsive(e) {
105002                    const i = Un.SolveRepulsive_s_f;
105003                    const s = this.m_velocityBuffer.data;
105004                    const n = this.m_def.repulsiveStrength * this.GetCriticalVelocity(e);
105005                    for (let e = 0; e < this.m_contactBuffer.count; e++) {
105006                      const r = this.m_contactBuffer.data[e];
105007                      if (r.flags & t.b2ParticleFlag.b2_repulsiveParticle) {
105008                        const t = r.indexA;
105009                        const e = r.indexB;
105010                        if (this.m_groupBuffer[t] !== this.m_groupBuffer[e]) {
105011                          const o = r.weight;
105012                          const a = r.normal;
105013                          const l = St.MulSV(n * o, a, i);
105014                          s[t].SelfSub(l);
105015                          s[e].SelfAdd(l);
105016                        }
105017                      }
105018                    }
105019                  }
105020                  SolvePowder(e) {
105021                    const i = Un.SolvePowder_s_f;
105022                    const s = this.m_positionBuffer.data;
105023                    const n = this.m_velocityBuffer.data;
105024                    const r = this.m_def.powderStrength * this.GetCriticalVelocity(e);
105025                    const o = 1 - w;
105026                    const a = this.GetParticleInvMass();
105027                    for (let e = 0; e < this.m_bodyContactBuffer.count; e++) {
105028                      const l = this.m_bodyContactBuffer.data[e];
105029                      const h = l.index;
105030                      if (this.m_flagsBuffer.data[h] & t.b2ParticleFlag.b2_powderParticle) {
105031                        const t = l.weight;
105032                        if (t > o) {
105033                          const e = l.body;
105034                          const c = l.mass;
105035                          const u = s[h];
105036                          const _ = l.normal;
105037                          const d = St.MulSV(r * c * (t - o), _, i);
105038                          n[h].SelfMulSub(a, d);
105039                          e.ApplyLinearImpulse(d, u, !0);
105040                        }
105041                      }
105042                    }
105043                    for (let e = 0; e < this.m_contactBuffer.count; e++) {
105044                      const s = this.m_contactBuffer.data[e];
105045                      if (s.flags & t.b2ParticleFlag.b2_powderParticle) {
105046                        const t = s.weight;
105047                        if (t > o) {
105048                          const e = s.indexA;
105049                          const a = s.indexB;
105050                          const l = s.normal;
105051                          const h = St.MulSV(r * (t - o), l, i);
105052                          n[e].SelfSub(h);
105053                          n[a].SelfAdd(h);
105054                        }
105055                      }
105056                    }
105057                  }
105058                  SolveSolid(t) {
105059                    const e = Un.SolveSolid_s_f;
105060                    const i = this.m_velocityBuffer.data;
105061                    this.m_depthBuffer = this.RequestBuffer(this.m_depthBuffer);
105062                    const s = t.inv_dt * this.m_def.ejectionStrength;
105063                    for (let t = 0; t < this.m_contactBuffer.count; t++) {
105064                      const n = this.m_contactBuffer.data[t];
105065                      const r = n.indexA;
105066                      const o = n.indexB;
105067                      if (this.m_groupBuffer[r] !== this.m_groupBuffer[o]) {
105068                        const t = n.weight;
105069                        const a = n.normal;
105070                        const l = this.m_depthBuffer[r] + this.m_depthBuffer[o];
105071                        const h = St.MulSV(s * l * t, a, e);
105072                        i[r].SelfSub(h);
105073                        i[o].SelfAdd(h);
105074                      }
105075                    }
105076                  }
105077                  SolveForce(t) {
105078                    const e = this.m_velocityBuffer.data;
105079                    const i = t.dt * this.GetParticleInvMass();
105080                    for (let t = 0; t < this.m_count; t++) e[t].SelfMulAdd(i, this.m_forceBuffer[t]);
105081                    this.m_hasForce = !1;
105082                  }
105083                  SolveColorMixing() {
105084                    const e = .5 * this.m_def.colorMixingStrength;
105085                    if (e) for (let i = 0; i < this.m_contactBuffer.count; i++) {
105086                      const s = this.m_contactBuffer.data[i];
105087                      const n = s.indexA;
105088                      const r = s.indexB;
105089                      if (this.m_flagsBuffer.data[n] & this.m_flagsBuffer.data[r] & t.b2ParticleFlag.b2_colorMixingParticle) {
105090                        const t = this.m_colorBuffer.data[n];
105091                        const i = this.m_colorBuffer.data[r];
105092                        Rt.MixColors(t, i, e);
105093                      }
105094                    }
105095                  }
105096                  SolveZombie() {
105097                    let e = 0;
105098                    const i = [];
105099                    for (let t = 0; t < this.m_count; t++) i[t] = C;
105100                    let s = 0;
105101                    for (let n = 0; n < this.m_count; n++) {
105102                      const r = this.m_flagsBuffer.data[n];
105103                      if (r & t.b2ParticleFlag.b2_zombieParticle) {
105104                        const e = this.m_world.m_destructionListener;
105105                        r & t.b2ParticleFlag.b2_destructionListenerParticle && e && e.SayGoodbyeParticle(this, n);
105106                        if (this.m_handleIndexBuffer.data) {
105107                          const t = this.m_handleIndexBuffer.data[n];
105108                          if (t) {
105109                            t.SetIndex(C);
105110                            this.m_handleIndexBuffer.data[n] = null;
105111                          }
105112                        }
105113                        i[n] = C;
105114                      } else {
105115                        i[n] = e;
105116                        if (n !== e) {
105117                          if (this.m_handleIndexBuffer.data) {
105118                            const t = this.m_handleIndexBuffer.data[n];
105119                            t && t.SetIndex(e);
105120                            this.m_handleIndexBuffer.data[e] = t;
105121                          }
105122                          this.m_flagsBuffer.data[e] = this.m_flagsBuffer.data[n];
105123                          this.m_lastBodyContactStepBuffer.data && (this.m_lastBodyContactStepBuffer.data[e] = this.m_lastBodyContactStepBuffer.data[n]);
105124                          this.m_bodyContactCountBuffer.data && (this.m_bodyContactCountBuffer.data[e] = this.m_bodyContactCountBuffer.data[n]);
105125                          this.m_consecutiveContactStepsBuffer.data && (this.m_consecutiveContactStepsBuffer.data[e] = this.m_consecutiveContactStepsBuffer.data[n]);
105126                          this.m_positionBuffer.data[e].Copy(this.m_positionBuffer.data[n]);
105127                          this.m_velocityBuffer.data[e].Copy(this.m_velocityBuffer.data[n]);
105128                          this.m_groupBuffer[e] = this.m_groupBuffer[n];
105129                          this.m_hasForce && this.m_forceBuffer[e].Copy(this.m_forceBuffer[n]);
105130                          this.m_staticPressureBuffer && (this.m_staticPressureBuffer[e] = this.m_staticPressureBuffer[n]);
105131                          this.m_depthBuffer && (this.m_depthBuffer[e] = this.m_depthBuffer[n]);
105132                          this.m_colorBuffer.data && this.m_colorBuffer.data[e].Copy(this.m_colorBuffer.data[n]);
105133                          this.m_userDataBuffer.data && (this.m_userDataBuffer.data[e] = this.m_userDataBuffer.data[n]);
105134                          this.m_expirationTimeBuffer.data && (this.m_expirationTimeBuffer.data[e] = this.m_expirationTimeBuffer.data[n]);
105135                        }
105136                        e++;
105137                        s |= r;
105138                      }
105139                    }
105140                    const n = {
105141                      IsProxyInvalid: t => t.index < 0,
105142                      IsContactInvalid: t => t.indexA < 0 || t.indexB < 0,
105143                      IsBodyContactInvalid: t => t.index < 0,
105144                      IsPairInvalid: t => t.indexA < 0 || t.indexB < 0,
105145                      IsTriadInvalid: t => t.indexA < 0 || t.indexB < 0 || t.indexC < 0
105146                    };
105147                    for (let t = 0; t < this.m_proxyBuffer.count; t++) {
105148                      const e = this.m_proxyBuffer.data[t];
105149                      e.index = i[e.index];
105150                    }
105151                    this.m_proxyBuffer.RemoveIf(n.IsProxyInvalid);
105152                    for (let t = 0; t < this.m_contactBuffer.count; t++) {
105153                      const e = this.m_contactBuffer.data[t];
105154                      e.indexA = i[e.indexA];
105155                      e.indexB = i[e.indexB];
105156                    }
105157                    this.m_contactBuffer.RemoveIf(n.IsContactInvalid);
105158                    for (let t = 0; t < this.m_bodyContactBuffer.count; t++) {
105159                      const e = this.m_bodyContactBuffer.data[t];
105160                      e.index = i[e.index];
105161                    }
105162                    this.m_bodyContactBuffer.RemoveIf(n.IsBodyContactInvalid);
105163                    for (let t = 0; t < this.m_pairBuffer.count; t++) {
105164                      const e = this.m_pairBuffer.data[t];
105165                      e.indexA = i[e.indexA];
105166                      e.indexB = i[e.indexB];
105167                    }
105168                    this.m_pairBuffer.RemoveIf(n.IsPairInvalid);
105169                    for (let t = 0; t < this.m_triadBuffer.count; t++) {
105170                      const e = this.m_triadBuffer.data[t];
105171                      e.indexA = i[e.indexA];
105172                      e.indexB = i[e.indexB];
105173                      e.indexC = i[e.indexC];
105174                    }
105175                    this.m_triadBuffer.RemoveIf(n.IsTriadInvalid);
105176                    if (this.m_indexByExpirationTimeBuffer.data) {
105177                      let t = 0;
105178                      for (let e = 0; e < this.m_count; e++) {
105179                        const s = i[this.m_indexByExpirationTimeBuffer.data[e]];
105180                        s !== C && (this.m_indexByExpirationTimeBuffer.data[t++] = s);
105181                      }
105182                    }
105183                    for (let s = this.m_groupList; s; s = s.GetNext()) {
105184                      let n = e;
105185                      let r = 0;
105186                      let o = !1;
105187                      for (let t = s.m_firstIndex; t < s.m_lastIndex; t++) {
105188                        const e = i[t];
105189                        if (e >= 0) {
105190                          n = tt(n, e);
105191                          r = et(r, e + 1);
105192                        } else o = !0;
105193                      }
105194                      if (n < r) {
105195                        s.m_firstIndex = n;
105196                        s.m_lastIndex = r;
105197                        o && s.m_groupFlags & t.b2ParticleGroupFlag.b2_solidParticleGroup && this.SetGroupFlags(s, s.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);
105198                      } else {
105199                        s.m_firstIndex = 0;
105200                        s.m_lastIndex = 0;
105201                        s.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupCanBeEmpty || this.SetGroupFlags(s, s.m_groupFlags | t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed);
105202                      }
105203                    }
105204                    this.m_count = e;
105205                    this.m_allParticleFlags = s;
105206                    this.m_needsUpdateAllParticleFlags = !1;
105207                    for (let e = this.m_groupList; e; ) {
105208                      const i = e.GetNext();
105209                      e.m_groupFlags & t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed && this.DestroyParticleGroup(e);
105210                      e = i;
105211                    }
105212                  }
105213                  SolveLifetimes(t) {
105214                    this.m_timeElapsed = this.LifetimeToExpirationTime(t.dt);
105215                    const e = this.GetQuantizedTimeElapsed();
105216                    const i = this.m_expirationTimeBuffer.data;
105217                    const s = this.m_indexByExpirationTimeBuffer.data;
105218                    const n = this.GetParticleCount();
105219                    if (this.m_expirationTimeBufferRequiresSorting) {
105220                      xn(s, 0, n, ((t, e) => {
105221                        const s = i[t];
105222                        const n = i[e];
105223                        const r = s <= 0;
105224                        return r === n <= 0 ? s > n : r;
105225                      }));
105226                      this.m_expirationTimeBufferRequiresSorting = !1;
105227                    }
105228                    for (let t = n - 1; t >= 0; --t) {
105229                      const n = s[t];
105230                      const r = i[n];
105231                      if (e < r || r <= 0) break;
105232                      this.DestroyParticle(n);
105233                    }
105234                  }
105235                  RotateBuffer(t, e, i) {
105236                    if (t !== e && e !== i) {
105237                      Bn(this.m_flagsBuffer.data, t, e, i);
105238                      this.m_lastBodyContactStepBuffer.data && Bn(this.m_lastBodyContactStepBuffer.data, t, e, i);
105239                      this.m_bodyContactCountBuffer.data && Bn(this.m_bodyContactCountBuffer.data, t, e, i);
105240                      this.m_consecutiveContactStepsBuffer.data && Bn(this.m_consecutiveContactStepsBuffer.data, t, e, i);
105241                      Bn(this.m_positionBuffer.data, t, e, i);
105242                      Bn(this.m_velocityBuffer.data, t, e, i);
105243                      Bn(this.m_groupBuffer, t, e, i);
105244                      this.m_hasForce && Bn(this.m_forceBuffer, t, e, i);
105245                      this.m_staticPressureBuffer && Bn(this.m_staticPressureBuffer, t, e, i);
105246                      this.m_depthBuffer && Bn(this.m_depthBuffer, t, e, i);
105247                      this.m_colorBuffer.data && Bn(this.m_colorBuffer.data, t, e, i);
105248                      this.m_userDataBuffer.data && Bn(this.m_userDataBuffer.data, t, e, i);
105249                      if (this.m_handleIndexBuffer.data) {
105250                        Bn(this.m_handleIndexBuffer.data, t, e, i);
105251                        for (let e = t; e < i; ++e) {
105252                          const t = this.m_handleIndexBuffer.data[e];
105253                          t && t.SetIndex(s(t.GetIndex()));
105254                        }
105255                      }
105256                      if (this.m_expirationTimeBuffer.data) {
105257                        Bn(this.m_expirationTimeBuffer.data, t, e, i);
105258                        const n = this.GetParticleCount();
105259                        const r = this.m_indexByExpirationTimeBuffer.data;
105260                        for (let t = 0; t < n; ++t) r[t] = s(r[t]);
105261                      }
105262                      for (let t = 0; t < this.m_proxyBuffer.count; t++) {
105263                        const e = this.m_proxyBuffer.data[t];
105264                        e.index = s(e.index);
105265                      }
105266                      for (let t = 0; t < this.m_contactBuffer.count; t++) {
105267                        const e = this.m_contactBuffer.data[t];
105268                        e.indexA = s(e.indexA);
105269                        e.indexB = s(e.indexB);
105270                      }
105271                      for (let t = 0; t < this.m_bodyContactBuffer.count; t++) {
105272                        const e = this.m_bodyContactBuffer.data[t];
105273                        e.index = s(e.index);
105274                      }
105275                      for (let t = 0; t < this.m_pairBuffer.count; t++) {
105276                        const e = this.m_pairBuffer.data[t];
105277                        e.indexA = s(e.indexA);
105278                        e.indexB = s(e.indexB);
105279                      }
105280                      for (let t = 0; t < this.m_triadBuffer.count; t++) {
105281                        const e = this.m_triadBuffer.data[t];
105282                        e.indexA = s(e.indexA);
105283                        e.indexB = s(e.indexB);
105284                        e.indexC = s(e.indexC);
105285                      }
105286                      for (let t = this.m_groupList; t; t = t.GetNext()) {
105287                        t.m_firstIndex = s(t.m_firstIndex);
105288                        t.m_lastIndex = s(t.m_lastIndex - 1) + 1;
105289                      }
105290                    }
105291                    function s(s) {
105292                      return s < t ? s : s < e ? s + i - e : s < i ? s + t - e : s;
105293                    }
105294                  }
105295                  GetCriticalVelocity(t) {
105296                    return this.m_particleDiameter * t.inv_dt;
105297                  }
105298                  GetCriticalVelocitySquared(t) {
105299                    const e = this.GetCriticalVelocity(t);
105300                    return e * e;
105301                  }
105302                  GetCriticalPressure(t) {
105303                    return this.m_def.density * this.GetCriticalVelocitySquared(t);
105304                  }
105305                  GetParticleStride() {
105306                    return w * this.m_particleDiameter;
105307                  }
105308                  GetParticleMass() {
105309                    const t = this.GetParticleStride();
105310                    return this.m_def.density * t * t;
105311                  }
105312                  GetParticleInvMass() {
105313                    const t = this.m_inverseDiameter * (1 / w);
105314                    return this.m_inverseDensity * t * t;
105315                  }
105316                  GetFixtureContactFilter() {
105317                    return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null;
105318                  }
105319                  GetParticleContactFilter() {
105320                    return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactFilterParticle ? this.m_world.m_contactManager.m_contactFilter : null;
105321                  }
105322                  GetFixtureContactListener() {
105323                    return this.m_allParticleFlags & t.b2ParticleFlag.b2_fixtureContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null;
105324                  }
105325                  GetParticleContactListener() {
105326                    return this.m_allParticleFlags & t.b2ParticleFlag.b2_particleContactListenerParticle ? this.m_world.m_contactManager.m_contactListener : null;
105327                  }
105328                  SetUserOverridableBuffer(t, e) {
105329                    t.data = e;
105330                    t.userSuppliedCapacity = e.length;
105331                  }
105332                  SetGroupFlags(e, i) {
105333                    const s = e.m_groupFlags;
105334                    (s ^ i) & t.b2ParticleGroupFlag.b2_solidParticleGroup && (i |= t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);
105335                    s & ~i && (this.m_needsUpdateAllGroupFlags = !0);
105336                    if (~this.m_allGroupFlags & i) {
105337                      i & t.b2ParticleGroupFlag.b2_solidParticleGroup && (this.m_depthBuffer = this.RequestBuffer(this.m_depthBuffer));
105338                      this.m_allGroupFlags |= i;
105339                    }
105340                    e.m_groupFlags = i;
105341                  }
105342                  static BodyContactCompare(t, e) {
105343                    return t.index === e.index ? t.weight > e.weight : t.index < e.index;
105344                  }
105345                  RemoveSpuriousBodyContacts() {
105346                    xn(this.m_bodyContactBuffer.data, 0, this.m_bodyContactBuffer.count, Un.BodyContactCompare);
105347                    const t = Un.RemoveSpuriousBodyContacts_s_n;
105348                    const e = Un.RemoveSpuriousBodyContacts_s_pos;
105349                    const i = Un.RemoveSpuriousBodyContacts_s_normal;
105350                    const s = 3;
105351                    const n = this;
105352                    let r = -1;
105353                    let o = 0;
105354                    const a = a => {
105355                      if (a.index !== r) {
105356                        o = 0;
105357                        r = a.index;
105358                      }
105359                      if (o++ > s) return !0;
105360                      const l = t.Copy(a.normal);
105361                      l.SelfMul(n.m_particleDiameter * (1 - a.weight));
105362                      const h = St.AddVV(n.m_positionBuffer.data[a.index], l, e);
105363                      if (!a.fixture.TestPoint(h)) {
105364                        const t = a.fixture.GetShape().GetChildCount();
105365                        for (let e = 0; e < t; e++) {
105366                          const t = i;
105367                          if (a.fixture.ComputeDistance(h, t, e) < u) return !1;
105368                        }
105369                        return !0;
105370                      }
105371                      return !1;
105372                    };
105373                    this.m_bodyContactBuffer.count = Rn(this.m_bodyContactBuffer.data, a, this.m_bodyContactBuffer.count);
105374                  }
105375                  DetectStuckParticle(t) {
105376                    if (!(this.m_stuckThreshold <= 0)) {
105377                      ++this.m_bodyContactCountBuffer.data[t];
105378                      if (2 === this.m_bodyContactCountBuffer.data[t]) {
105379                        ++this.m_consecutiveContactStepsBuffer.data[t];
105380                        this.m_consecutiveContactStepsBuffer.data[t] > this.m_stuckThreshold && (this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()] = t);
105381                      }
105382                      this.m_lastBodyContactStepBuffer.data[t] = this.m_timestamp;
105383                    }
105384                  }
105385                  ValidateParticleIndex(t) {
105386                    return t >= 0 && t < this.GetParticleCount() && t !== C;
105387                  }
105388                  GetQuantizedTimeElapsed() {
105389                    return Math.floor(this.m_timeElapsed / 4294967296);
105390                  }
105391                  LifetimeToExpirationTime(t) {
105392                    return this.m_timeElapsed + Math.floor(t / this.m_def.lifetimeGranularity * 4294967296);
105393                  }
105394                  ForceCanBeApplied(e) {
105395                    return !(e & t.b2ParticleFlag.b2_wallParticle);
105396                  }
105397                  PrepareForceBuffer() {
105398                    if (!this.m_hasForce) {
105399                      for (let t = 0; t < this.m_count; t++) this.m_forceBuffer[t].SetZero();
105400                      this.m_hasForce = !0;
105401                    }
105402                  }
105403                  IsRigidGroup(e) {
105404                    return null !== e && 0 != (e.m_groupFlags & t.b2ParticleGroupFlag.b2_rigidParticleGroup);
105405                  }
105406                  GetLinearVelocity(t, e, i, s) {
105407                    return t && this.IsRigidGroup(t) ? t.GetLinearVelocityFromWorldPoint(i, s) : s.Copy(this.m_velocityBuffer.data[e]);
105408                  }
105409                  InitDampingParameter(t, e, i, s, n, r, o, a) {
105410                    t[0] = s > 0 ? 1 / s : 0;
105411                    e[0] = n > 0 ? 1 / n : 0;
105412                    i[0] = St.CrossVV(St.SubVV(o, r, St.s_t0), a);
105413                  }
105414                  InitDampingParameterWithRigidGroupOrParticle(e, i, s, n, r, o, a, l) {
105415                    if (r && n) this.InitDampingParameter(e, i, s, r.GetMass(), r.GetInertia(), r.GetCenter(), a, l); else {
105416                      const n = this.m_flagsBuffer.data[o];
105417                      this.InitDampingParameter(e, i, s, n & t.b2ParticleFlag.b2_wallParticle ? 0 : this.GetParticleMass(), 0, a, a, l);
105418                    }
105419                  }
105420                  ComputeDampingImpulse(t, e, i, s, n, r, o) {
105421                    const a = t + e * i * i + s + n * r * r;
105422                    return a > 0 ? o / a : 0;
105423                  }
105424                  ApplyDamping(t, e, i, s, n, r, o, a) {
105425                    if (n && s) {
105426                      n.m_linearVelocity.SelfMulAdd(o * t, a);
105427                      n.m_angularVelocity += o * i * e;
105428                    } else this.m_velocityBuffer.data[r].SelfMulAdd(o * t, a);
105429                  }
105430                }
105431                Un.xTruncBits = 12;
105432                Un.yTruncBits = 12;
105433                Un.tagBits = 32;
105434                Un.yOffset = 1 << Un.yTruncBits - 1;
105435                Un.yShift = Un.tagBits - Un.yTruncBits;
105436                Un.xShift = Un.tagBits - Un.yTruncBits - Un.xTruncBits;
105437                Un.xScale = 1 << Un.xShift;
105438                Un.xOffset = Un.xScale * (1 << Un.xTruncBits - 1);
105439                Un.yMask = (1 << Un.yTruncBits) - 1 << Un.yShift;
105440                Un.xMask = ~Un.yMask;
105441                Un.DestroyParticlesInShape_s_aabb = new ge;
105442                Un.CreateParticleGroup_s_transform = new xt;
105443                Un.ComputeCollisionEnergy_s_v = new St;
105444                Un.QueryShapeAABB_s_aabb = new ge;
105445                Un.QueryPointAABB_s_aabb = new ge;
105446                Un.RayCast_s_aabb = new ge;
105447                Un.RayCast_s_p = new St;
105448                Un.RayCast_s_v = new St;
105449                Un.RayCast_s_n = new St;
105450                Un.RayCast_s_point = new St;
105451                Un.k_pairFlags = t.b2ParticleFlag.b2_springParticle;
105452                Un.k_triadFlags = t.b2ParticleFlag.b2_elasticParticle;
105453                Un.k_noPressureFlags = t.b2ParticleFlag.b2_powderParticle | t.b2ParticleFlag.b2_tensileParticle;
105454                Un.k_extraDampingFlags = t.b2ParticleFlag.b2_staticPressureParticle;
105455                Un.k_barrierWallFlags = t.b2ParticleFlag.b2_barrierParticle | t.b2ParticleFlag.b2_wallParticle;
105456                Un.CreateParticlesStrokeShapeForGroup_s_edge = new Qi;
105457                Un.CreateParticlesStrokeShapeForGroup_s_d = new St;
105458                Un.CreateParticlesStrokeShapeForGroup_s_p = new St;
105459                Un.CreateParticlesFillShapeForGroup_s_aabb = new ge;
105460                Un.CreateParticlesFillShapeForGroup_s_p = new St;
105461                Un.UpdatePairsAndTriads_s_dab = new St;
105462                Un.UpdatePairsAndTriads_s_dbc = new St;
105463                Un.UpdatePairsAndTriads_s_dca = new St;
105464                Un.AddContact_s_d = new St;
105465                Un.UpdateBodyContacts_s_aabb = new ge;
105466                Un.Solve_s_subStep = new sn;
105467                Un.SolveCollision_s_aabb = new ge;
105468                Un.SolveGravity_s_gravity = new St;
105469                Un.SolveBarrier_s_aabb = new ge;
105470                Un.SolveBarrier_s_va = new St;
105471                Un.SolveBarrier_s_vb = new St;
105472                Un.SolveBarrier_s_pba = new St;
105473                Un.SolveBarrier_s_vba = new St;
105474                Un.SolveBarrier_s_vc = new St;
105475                Un.SolveBarrier_s_pca = new St;
105476                Un.SolveBarrier_s_vca = new St;
105477                Un.SolveBarrier_s_qba = new St;
105478                Un.SolveBarrier_s_qca = new St;
105479                Un.SolveBarrier_s_dv = new St;
105480                Un.SolveBarrier_s_f = new St;
105481                Un.SolvePressure_s_f = new St;
105482                Un.SolveDamping_s_v = new St;
105483                Un.SolveDamping_s_f = new St;
105484                Un.SolveRigidDamping_s_t0 = new St;
105485                Un.SolveRigidDamping_s_t1 = new St;
105486                Un.SolveRigidDamping_s_p = new St;
105487                Un.SolveRigidDamping_s_v = new St;
105488                Un.SolveExtraDamping_s_v = new St;
105489                Un.SolveExtraDamping_s_f = new St;
105490                Un.SolveRigid_s_position = new St;
105491                Un.SolveRigid_s_rotation = new Ct;
105492                Un.SolveRigid_s_transform = new xt;
105493                Un.SolveRigid_s_velocityTransform = new xt;
105494                Un.SolveElastic_s_pa = new St;
105495                Un.SolveElastic_s_pb = new St;
105496                Un.SolveElastic_s_pc = new St;
105497                Un.SolveElastic_s_r = new Ct;
105498                Un.SolveElastic_s_t0 = new St;
105499                Un.SolveSpring_s_pa = new St;
105500                Un.SolveSpring_s_pb = new St;
105501                Un.SolveSpring_s_d = new St;
105502                Un.SolveSpring_s_f = new St;
105503                Un.SolveTensile_s_weightedNormal = new St;
105504                Un.SolveTensile_s_s = new St;
105505                Un.SolveTensile_s_f = new St;
105506                Un.SolveViscous_s_v = new St;
105507                Un.SolveViscous_s_f = new St;
105508                Un.SolveRepulsive_s_f = new St;
105509                Un.SolvePowder_s_f = new St;
105510                Un.SolveSolid_s_f = new St;
105511                Un.RemoveSpuriousBodyContacts_s_n = new St;
105512                Un.RemoveSpuriousBodyContacts_s_pos = new St;
105513                Un.RemoveSpuriousBodyContacts_s_normal = new St;
105514                class Gn {
105515                  constructor() {
105516                    this._data = null;
105517                    this.userSuppliedCapacity = 0;
105518                  }
105519                  get data() {
105520                    return this._data;
105521                  }
105522                  set data(t) {
105523                    this._data = t;
105524                  }
105525                }
105526                class zn {
105527                  constructor() {
105528                    this.index = C;
105529                    this.tag = 0;
105530                  }
105531                  static CompareProxyProxy(t, e) {
105532                    return t.tag < e.tag;
105533                  }
105534                  static CompareTagProxy(t, e) {
105535                    return t < e.tag;
105536                  }
105537                  static CompareProxyTag(t, e) {
105538                    return t.tag < e;
105539                  }
105540                }
105541                class Hn {
105542                  constructor(t, e, i, s, n) {
105543                    this.m_system = t;
105544                    this.m_xLower = (e & Un.xMask) >>> 0;
105545                    this.m_xUpper = (i & Un.xMask) >>> 0;
105546                    this.m_yLower = (e & Un.yMask) >>> 0;
105547                    this.m_yUpper = (i & Un.yMask) >>> 0;
105548                    this.m_first = s;
105549                    this.m_last = n;
105550                  }
105551                  GetNext() {
105552                    for (;this.m_first < this.m_last; ) {
105553                      const t = (this.m_system.m_proxyBuffer.data[this.m_first].tag & Un.xMask) >>> 0;
105554                      if (t >= this.m_xLower && t <= this.m_xUpper) return this.m_system.m_proxyBuffer.data[this.m_first++].index;
105555                      this.m_first++;
105556                    }
105557                    return C;
105558                  }
105559                }
105560                class jn {
105561                  constructor() {
105562                    this.next = null;
105563                    this.count = 0;
105564                    this.index = 0;
105565                  }
105566                }
105567                class Xn {
105568                  Allocate(t, e) {
105569                    return e;
105570                  }
105571                  Clear() {}
105572                  GetCount() {
105573                    return 0;
105574                  }
105575                  Invalidate(t) {}
105576                  GetValidBuffer() {
105577                    return [];
105578                  }
105579                  GetBuffer() {
105580                    return [];
105581                  }
105582                  SetCount(t) {}
105583                }
105584                class Wn {
105585                  constructor(t, e) {
105586                    this.second = C;
105587                    this.first = t;
105588                    this.second = e;
105589                  }
105590                }
105591                class Yn extends Xn {
105592                  Initialize(t, e) {}
105593                  Find(t) {
105594                    return C;
105595                  }
105596                }
105597                class qn {
105598                  constructor(t, e) {
105599                    this.first = C;
105600                    this.second = C;
105601                    this.first = t;
105602                    this.second = e;
105603                  }
105604                }
105605                class Kn extends Xn {
105606                  Initialize(t, e) {}
105607                  Find(t) {
105608                    return C;
105609                  }
105610                }
105611                class Jn {
105612                  IsNecessary(t) {
105613                    return !0;
105614                  }
105615                  ShouldCreatePair(t, e) {
105616                    return !0;
105617                  }
105618                  ShouldCreateTriad(t, e, i) {
105619                    return !0;
105620                  }
105621                }
105622                class Zn extends Qs {
105623                  constructor(t, e, i, s) {
105624                    super();
105625                    this.m_callDestructionListener = !1;
105626                    this.m_destroyed = 0;
105627                    this.m_system = t;
105628                    this.m_shape = e;
105629                    this.m_xf = i;
105630                    this.m_callDestructionListener = s;
105631                    this.m_destroyed = 0;
105632                  }
105633                  ReportFixture(t) {
105634                    return !1;
105635                  }
105636                  ReportParticle(t, e) {
105637                    if (t !== this.m_system) return !1;
105638                    if (this.m_shape.TestPoint(this.m_xf, this.m_system.m_positionBuffer.data[e])) {
105639                      this.m_system.DestroyParticle(e, this.m_callDestructionListener);
105640                      this.m_destroyed++;
105641                    }
105642                    return !0;
105643                  }
105644                  Destroyed() {
105645                    return this.m_destroyed;
105646                  }
105647                }
105648                class Qn extends Jn {
105649                  constructor(t) {
105650                    super();
105651                    this.m_threshold = 0;
105652                    this.m_threshold = t;
105653                  }
105654                  ShouldCreatePair(t, e) {
105655                    return t < this.m_threshold && this.m_threshold <= e || e < this.m_threshold && this.m_threshold <= t;
105656                  }
105657                  ShouldCreateTriad(t, e, i) {
105658                    return (t < this.m_threshold || e < this.m_threshold || i < this.m_threshold) && (this.m_threshold <= t || this.m_threshold <= e || this.m_threshold <= i);
105659                  }
105660                }
105661                class $n extends Ki {
105662                  constructor(e, i = e.length) {
105663                    super(t.b2ShapeType.e_unknown, 0);
105664                    this.m_shapeCount = 0;
105665                    this.m_shapes = e;
105666                    this.m_shapeCount = i;
105667                  }
105668                  Clone() {
105669                    throw new Error;
105670                  }
105671                  GetChildCount() {
105672                    return 1;
105673                  }
105674                  TestPoint(t, e) {
105675                    for (let i = 0; i < this.m_shapeCount; i++) if (this.m_shapes[i].TestPoint(t, e)) return !0;
105676                    return !1;
105677                  }
105678                  ComputeDistance(t, e, i, s) {
105679                    return 0;
105680                  }
105681                  RayCast(t, e, i, s) {
105682                    return !1;
105683                  }
105684                  ComputeAABB(t, e, i) {
105685                    const n = new ge;
105686                    t.lowerBound.x = +s;
105687                    t.lowerBound.y = +s;
105688                    t.upperBound.x = -s;
105689                    t.upperBound.y = -s;
105690                    for (let i = 0; i < this.m_shapeCount; i++) {
105691                      const s = this.m_shapes[i].GetChildCount();
105692                      for (let r = 0; r < s; r++) {
105693                        const s = n;
105694                        this.m_shapes[i].ComputeAABB(s, e, r);
105695                        t.Combine1(s);
105696                      }
105697                    }
105698                  }
105699                  ComputeMass(t, e) {}
105700                  SetupDistanceProxy(t, e) {}
105701                  ComputeSubmergedArea(t, e, i, s) {
105702                    return 0;
105703                  }
105704                  Dump(t) {}
105705                }
105706                class tr extends Jn {
105707                  constructor(t) {
105708                    super();
105709                    this.m_flagsBuffer = t;
105710                  }
105711                  IsNecessary(e) {
105712                    return 0 != (this.m_flagsBuffer.data[e] & t.b2ParticleFlag.b2_reactiveParticle);
105713                  }
105714                }
105715                class er extends On {
105716                  constructor(t, e = null) {
105717                    super(t);
105718                    this.m_contactFilter = null;
105719                    this.m_contactFilter = e;
105720                  }
105721                  ShouldCollideFixtureParticle(e, i, s) {
105722                    return !(this.m_contactFilter && this.m_system.GetFlagsBuffer()[s] & t.b2ParticleFlag.b2_fixtureContactFilterParticle) || this.m_contactFilter.ShouldCollideFixtureParticle(e, this.m_system, s);
105723                  }
105724                  ReportFixtureAndParticle(e, i, s) {
105725                    const n = er.ReportFixtureAndParticle_s_n;
105726                    const r = er.ReportFixtureAndParticle_s_rp;
105727                    const o = this.m_system.m_positionBuffer.data[s];
105728                    const a = n;
105729                    const l = e.ComputeDistance(o, a, i);
105730                    if (l < this.m_system.m_particleDiameter && this.ShouldCollideFixtureParticle(e, this.m_system, s)) {
105731                      const i = e.GetBody();
105732                      const n = i.GetWorldCenter();
105733                      const h = i.GetMass();
105734                      const c = i.GetInertia() - h * i.GetLocalCenter().LengthSquared();
105735                      const u = h > 0 ? 1 / h : 0;
105736                      const _ = c > 0 ? 1 / c : 0;
105737                      const d = this.m_system.m_flagsBuffer.data[s] & t.b2ParticleFlag.b2_wallParticle ? 0 : this.m_system.GetParticleInvMass();
105738                      const p = St.SubVV(o, n, r);
105739                      const m = St.CrossVV(p, a);
105740                      const f = d + u + _ * m * m;
105741                      const g = this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];
105742                      g.index = s;
105743                      g.body = i;
105744                      g.fixture = e;
105745                      g.weight = 1 - l * this.m_system.m_inverseDiameter;
105746                      g.normal.Copy(a.SelfNeg());
105747                      g.mass = f > 0 ? 1 / f : 0;
105748                      this.m_system.DetectStuckParticle(s);
105749                    }
105750                  }
105751                }
105752                er.ReportFixtureAndParticle_s_n = new St;
105753                er.ReportFixtureAndParticle_s_rp = new St;
105754                class ir extends On {
105755                  constructor(t, e) {
105756                    super(t);
105757                    this.m_step = e;
105758                  }
105759                  ReportFixtureAndParticle(e, i, s) {
105760                    const n = ir.ReportFixtureAndParticle_s_p1;
105761                    const r = ir.ReportFixtureAndParticle_s_output;
105762                    const o = ir.ReportFixtureAndParticle_s_input;
105763                    const a = ir.ReportFixtureAndParticle_s_p;
105764                    const l = ir.ReportFixtureAndParticle_s_v;
105765                    const h = ir.ReportFixtureAndParticle_s_f;
105766                    const c = e.GetBody();
105767                    const _ = this.m_system.m_positionBuffer.data[s];
105768                    const d = this.m_system.m_velocityBuffer.data[s];
105769                    const p = r;
105770                    const m = o;
105771                    if (0 === this.m_system.m_iterationIndex) {
105772                      const i = xt.MulTXV(c.m_xf0, _, n);
105773                      if (e.GetShape().GetType() === t.b2ShapeType.e_circleShape) {
105774                        i.SelfSub(c.GetLocalCenter());
105775                        Ct.MulRV(c.m_xf0.q, i, i);
105776                        Ct.MulTRV(c.m_xf.q, i, i);
105777                        i.SelfAdd(c.GetLocalCenter());
105778                      }
105779                      xt.MulXV(c.m_xf, i, m.p1);
105780                    } else m.p1.Copy(_);
105781                    St.AddVMulSV(_, this.m_step.dt, d, m.p2);
105782                    m.maxFraction = 1;
105783                    if (e.RayCast(p, m, i)) {
105784                      const t = p.normal;
105785                      const e = a;
105786                      e.x = (1 - p.fraction) * m.p1.x + p.fraction * m.p2.x + u * t.x;
105787                      e.y = (1 - p.fraction) * m.p1.y + p.fraction * m.p2.y + u * t.y;
105788                      const i = l;
105789                      i.x = this.m_step.inv_dt * (e.x - _.x);
105790                      i.y = this.m_step.inv_dt * (e.y - _.y);
105791                      this.m_system.m_velocityBuffer.data[s].Copy(i);
105792                      const n = h;
105793                      n.x = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.x - i.x);
105794                      n.y = this.m_step.inv_dt * this.m_system.GetParticleMass() * (d.y - i.y);
105795                      this.m_system.ParticleApplyForce(s, n);
105796                    }
105797                  }
105798                  ReportParticle(t, e) {
105799                    return !1;
105800                  }
105801                }
105802                ir.ReportFixtureAndParticle_s_p1 = new St;
105803                ir.ReportFixtureAndParticle_s_output = new fe;
105804                ir.ReportFixtureAndParticle_s_input = new me;
105805                ir.ReportFixtureAndParticle_s_p = new St;
105806                ir.ReportFixtureAndParticle_s_v = new St;
105807                ir.ReportFixtureAndParticle_s_f = new St;
105808                class sr {
105809                  constructor(t) {
105810                    this.m_newFixture = !1;
105811                    this.m_locked = !1;
105812                    this.m_clearForces = !0;
105813                    this.m_contactManager = new tn;
105814                    this.m_bodyList = null;
105815                    this.m_jointList = null;
105816                    this.m_particleSystemList = null;
105817                    this.m_bodyCount = 0;
105818                    this.m_jointCount = 0;
105819                    this.m_gravity = new St;
105820                    this.m_allowSleep = !0;
105821                    this.m_destructionListener = null;
105822                    this.m_debugDraw = null;
105823                    this.m_inv_dt0 = 0;
105824                    this.m_warmStarting = !0;
105825                    this.m_continuousPhysics = !0;
105826                    this.m_subStepping = !1;
105827                    this.m_stepComplete = !0;
105828                    this.m_profile = new en;
105829                    this.m_island = new pn;
105830                    this.s_stack = [];
105831                    this.m_controllerList = null;
105832                    this.m_controllerCount = 0;
105833                    this.m_gravity.Copy(t);
105834                  }
105835                  SetDestructionListener(t) {
105836                    this.m_destructionListener = t;
105837                  }
105838                  SetContactFilter(t) {
105839                    this.m_contactManager.m_contactFilter = t;
105840                  }
105841                  SetContactListener(t) {
105842                    this.m_contactManager.m_contactListener = t;
105843                  }
105844                  SetDebugDraw(t) {
105845                    this.m_debugDraw = t;
105846                  }
105847                  CreateBody(t = {}) {
105848                    if (this.IsLocked()) throw new Error;
105849                    const e = new rs(t, this);
105850                    e.m_prev = null;
105851                    e.m_next = this.m_bodyList;
105852                    this.m_bodyList && (this.m_bodyList.m_prev = e);
105853                    this.m_bodyList = e;
105854                    ++this.m_bodyCount;
105855                    return e;
105856                  }
105857                  DestroyBody(t) {
105858                    if (this.IsLocked()) throw new Error;
105859                    let e = t.m_jointList;
105860                    for (;e; ) {
105861                      const i = e;
105862                      e = e.next;
105863                      this.m_destructionListener && this.m_destructionListener.SayGoodbyeJoint(i.joint);
105864                      this.DestroyJoint(i.joint);
105865                      t.m_jointList = e;
105866                    }
105867                    t.m_jointList = null;
105868                    let i = t.m_controllerList;
105869                    for (;i; ) {
105870                      const e = i;
105871                      i = i.nextController;
105872                      e.controller.RemoveBody(t);
105873                    }
105874                    let s = t.m_contactList;
105875                    for (;s; ) {
105876                      const t = s;
105877                      s = s.next;
105878                      this.m_contactManager.Destroy(t.contact);
105879                    }
105880                    t.m_contactList = null;
105881                    let n = t.m_fixtureList;
105882                    for (;n; ) {
105883                      const e = n;
105884                      n = n.m_next;
105885                      this.m_destructionListener && this.m_destructionListener.SayGoodbyeFixture(e);
105886                      e.DestroyProxies();
105887                      e.Reset();
105888                      t.m_fixtureList = n;
105889                      t.m_fixtureCount -= 1;
105890                    }
105891                    t.m_fixtureList = null;
105892                    t.m_fixtureCount = 0;
105893                    t.m_prev && (t.m_prev.m_next = t.m_next);
105894                    t.m_next && (t.m_next.m_prev = t.m_prev);
105895                    t === this.m_bodyList && (this.m_bodyList = t.m_next);
105896                    --this.m_bodyCount;
105897                  }
105898                  static _Joint_Create(e) {
105899                    switch (e.type) {
105900                     case t.b2JointType.e_distanceJoint:
105901                      return new us(e);
105902
105903                     case t.b2JointType.e_mouseJoint:
105904                      return new As(e);
105905
105906                     case t.b2JointType.e_prismaticJoint:
105907                      return new vs(e);
105908
105909                     case t.b2JointType.e_revoluteJoint:
105910                      return new Rs(e);
105911
105912                     case t.b2JointType.e_pulleyJoint:
105913                      return new xs(e);
105914
105915                     case t.b2JointType.e_gearJoint:
105916                      return new gs(e);
105917
105918                     case t.b2JointType.e_wheelJoint:
105919                      return new Os(e);
105920
105921                     case t.b2JointType.e_weldJoint:
105922                      return new Ds(e);
105923
105924                     case t.b2JointType.e_frictionJoint:
105925                      return new ms(e);
105926
105927                     case t.b2JointType.e_ropeJoint:
105928                      return new Ms(e);
105929
105930                     case t.b2JointType.e_motorJoint:
105931                      return new bs(e);
105932
105933                     case t.b2JointType.e_areaJoint:
105934                      return new ds(e);
105935                    }
105936                    throw new Error;
105937                  }
105938                  static _Joint_Destroy(t) {}
105939                  CreateJoint(t) {
105940                    if (this.IsLocked()) throw new Error;
105941                    const e = sr._Joint_Create(t);
105942                    e.m_prev = null;
105943                    e.m_next = this.m_jointList;
105944                    this.m_jointList && (this.m_jointList.m_prev = e);
105945                    this.m_jointList = e;
105946                    ++this.m_jointCount;
105947                    e.m_edgeA.prev = null;
105948                    e.m_edgeA.next = e.m_bodyA.m_jointList;
105949                    e.m_bodyA.m_jointList && (e.m_bodyA.m_jointList.prev = e.m_edgeA);
105950                    e.m_bodyA.m_jointList = e.m_edgeA;
105951                    e.m_edgeB.prev = null;
105952                    e.m_edgeB.next = e.m_bodyB.m_jointList;
105953                    e.m_bodyB.m_jointList && (e.m_bodyB.m_jointList.prev = e.m_edgeB);
105954                    e.m_bodyB.m_jointList = e.m_edgeB;
105955                    const i = e.m_bodyA;
105956                    const s = e.m_bodyB;
105957                    if (!e.m_collideConnected) {
105958                      let t = s.GetContactList();
105959                      for (;t; ) {
105960                        t.other === i && t.contact.FlagForFiltering();
105961                        t = t.next;
105962                      }
105963                    }
105964                    return e;
105965                  }
105966                  DestroyJoint(t) {
105967                    if (this.IsLocked()) throw new Error;
105968                    t.m_prev && (t.m_prev.m_next = t.m_next);
105969                    t.m_next && (t.m_next.m_prev = t.m_prev);
105970                    t === this.m_jointList && (this.m_jointList = t.m_next);
105971                    const e = t.m_bodyA;
105972                    const i = t.m_bodyB;
105973                    const s = t.m_collideConnected;
105974                    e.SetAwake(!0);
105975                    i.SetAwake(!0);
105976                    t.m_edgeA.prev && (t.m_edgeA.prev.next = t.m_edgeA.next);
105977                    t.m_edgeA.next && (t.m_edgeA.next.prev = t.m_edgeA.prev);
105978                    t.m_edgeA === e.m_jointList && (e.m_jointList = t.m_edgeA.next);
105979                    t.m_edgeA.Reset();
105980                    t.m_edgeB.prev && (t.m_edgeB.prev.next = t.m_edgeB.next);
105981                    t.m_edgeB.next && (t.m_edgeB.next.prev = t.m_edgeB.prev);
105982                    t.m_edgeB === i.m_jointList && (i.m_jointList = t.m_edgeB.next);
105983                    t.m_edgeB.Reset();
105984                    sr._Joint_Destroy(t);
105985                    --this.m_jointCount;
105986                    if (!s) {
105987                      let t = i.GetContactList();
105988                      for (;t; ) {
105989                        t.other === e && t.contact.FlagForFiltering();
105990                        t = t.next;
105991                      }
105992                    }
105993                  }
105994                  CreateParticleSystem(t) {
105995                    if (this.IsLocked()) throw new Error;
105996                    const e = new Un(t, this);
105997                    e.m_prev = null;
105998                    e.m_next = this.m_particleSystemList;
105999                    this.m_particleSystemList && (this.m_particleSystemList.m_prev = e);
106000                    this.m_particleSystemList = e;
106001                    return e;
106002                  }
106003                  DestroyParticleSystem(t) {
106004                    if (this.IsLocked()) throw new Error;
106005                    t.m_prev && (t.m_prev.m_next = t.m_next);
106006                    t.m_next && (t.m_next.m_prev = t.m_prev);
106007                    t === this.m_particleSystemList && (this.m_particleSystemList = t.m_next);
106008                  }
106009                  CalculateReasonableParticleIterations(t) {
106010                    if (null === this.m_particleSystemList) return 1;
106011                    function e(t) {
106012                      let e = s;
106013                      for (let i = t.GetParticleSystemList(); null !== i; i = i.m_next) e = tt(e, i.GetRadius());
106014                      return e;
106015                    }
106016                    return fn(this.m_gravity.Length(), e(this), t);
106017                  }
106018                  Step(t, e, i, s = this.CalculateReasonableParticleIterations(t)) {
106019                    const n = sr.Step_s_stepTimer.Reset();
106020                    if (this.m_newFixture) {
106021                      this.m_contactManager.FindNewContacts();
106022                      this.m_newFixture = !1;
106023                    }
106024                    this.m_locked = !0;
106025                    const r = sr.Step_s_step;
106026                    r.dt = t;
106027                    r.velocityIterations = e;
106028                    r.positionIterations = i;
106029                    r.particleIterations = s;
106030                    r.inv_dt = t > 0 ? 1 / t : 0;
106031                    r.dtRatio = this.m_inv_dt0 * t;
106032                    r.warmStarting = this.m_warmStarting;
106033                    const o = sr.Step_s_timer.Reset();
106034                    this.m_contactManager.Collide();
106035                    this.m_profile.collide = o.GetMilliseconds();
106036                    if (this.m_stepComplete && r.dt > 0) {
106037                      const t = sr.Step_s_timer.Reset();
106038                      for (let t = this.m_particleSystemList; t; t = t.m_next) t.Solve(r);
106039                      this.Solve(r);
106040                      this.m_profile.solve = t.GetMilliseconds();
106041                    }
106042                    if (this.m_continuousPhysics && r.dt > 0) {
106043                      const t = sr.Step_s_timer.Reset();
106044                      this.SolveTOI(r);
106045                      this.m_profile.solveTOI = t.GetMilliseconds();
106046                    }
106047                    r.dt > 0 && (this.m_inv_dt0 = r.inv_dt);
106048                    this.m_clearForces && this.ClearForces();
106049                    this.m_locked = !1;
106050                    this.m_profile.step = n.GetMilliseconds();
106051                  }
106052                  ClearForces() {
106053                    for (let t = this.m_bodyList; t; t = t.m_next) {
106054                      t.m_force.SetZero();
106055                      t.m_torque = 0;
106056                    }
106057                  }
106058                  DrawParticleSystem(t) {
106059                    if (null === this.m_debugDraw) return;
106060                    const e = t.GetParticleCount();
106061                    if (e) {
106062                      const i = t.GetRadius();
106063                      const s = t.GetPositionBuffer();
106064                      if (t.m_colorBuffer.data) {
106065                        const n = t.GetColorBuffer();
106066                        this.m_debugDraw.DrawParticles(s, i, n, e);
106067                      } else this.m_debugDraw.DrawParticles(s, i, null, e);
106068                    }
106069                  }
106070                  DrawDebugData() {
106071                    if (null === this.m_debugDraw) return;
106072                    const e = this.m_debugDraw.GetFlags();
106073                    const i = sr.DrawDebugData_s_color.SetRGB(0, 0, 0);
106074                    if (e & t.b2DrawFlags.e_shapeBit) for (let e = this.m_bodyList; e; e = e.m_next) {
106075                      const s = e.m_xf;
106076                      this.m_debugDraw.PushTransform(s);
106077                      for (let s = e.GetFixtureList(); s; s = s.m_next) if (e.IsActive()) if (e.GetType() === t.b2BodyType.b2_staticBody) {
106078                        i.SetRGB(.5, .9, .5);
106079                        this.DrawShape(s, i);
106080                      } else if (e.GetType() === t.b2BodyType.b2_kinematicBody) {
106081                        i.SetRGB(.5, .5, .9);
106082                        this.DrawShape(s, i);
106083                      } else if (e.IsAwake()) {
106084                        i.SetRGB(.9, .7, .7);
106085                        this.DrawShape(s, i);
106086                      } else {
106087                        i.SetRGB(.6, .6, .6);
106088                        this.DrawShape(s, i);
106089                      } else {
106090                        i.SetRGB(.5, .5, .3);
106091                        this.DrawShape(s, i);
106092                      }
106093                      this.m_debugDraw.PopTransform(s);
106094                    }
106095                    if (e & t.b2DrawFlags.e_particleBit) for (let t = this.m_particleSystemList; t; t = t.m_next) this.DrawParticleSystem(t);
106096                    if (e & t.b2DrawFlags.e_jointBit) for (let t = this.m_jointList; t; t = t.m_next) this.DrawJoint(t);
106097                    if (e & t.b2DrawFlags.e_aabbBit) {
106098                      i.SetRGB(.9, .3, .9);
106099                      const t = sr.DrawDebugData_s_vs;
106100                      for (let e = this.m_bodyList; e; e = e.m_next) if (e.IsActive()) for (let s = e.GetFixtureList(); s; s = s.m_next) for (let e = 0; e < s.m_proxyCount; ++e) {
106101                        const n = s.m_proxies[e].treeNode.aabb;
106102                        t[0].Set(n.lowerBound.x, n.lowerBound.y);
106103                        t[1].Set(n.upperBound.x, n.lowerBound.y);
106104                        t[2].Set(n.upperBound.x, n.upperBound.y);
106105                        t[3].Set(n.lowerBound.x, n.upperBound.y);
106106                        this.m_debugDraw.DrawPolygon(t, 4, i);
106107                      }
106108                    }
106109                    if (e & t.b2DrawFlags.e_centerOfMassBit) for (let t = this.m_bodyList; t; t = t.m_next) {
106110                      const e = sr.DrawDebugData_s_xf;
106111                      e.q.Copy(t.m_xf.q);
106112                      e.p.Copy(t.GetWorldCenter());
106113                      this.m_debugDraw.DrawTransform(e);
106114                    }
106115                    if (e & t.b2DrawFlags.e_controllerBit) for (let t = this.m_controllerList; t; t = t.m_next) t.Draw(this.m_debugDraw);
106116                  }
106117                  QueryAABB(...t) {
106118                    t[0] instanceof Qs ? this._QueryAABB(t[0], t[1]) : this._QueryAABB(null, t[0], t[1]);
106119                  }
106120                  _QueryAABB(t, e, i) {
106121                    this.m_contactManager.m_broadPhase.Query(e, (e => {
106122                      const s = e.userData.fixture;
106123                      return t ? t.ReportFixture(s) : !i || i(s);
106124                    }));
106125                    if (t instanceof Qs) for (let i = this.m_particleSystemList; i; i = i.m_next) t.ShouldQueryParticleSystem(i) && i.QueryAABB(t, e);
106126                  }
106127                  QueryAllAABB(t, e = []) {
106128                    this.QueryAABB(t, (t => {
106129                      e.push(t);
106130                      return !0;
106131                    }));
106132                    return e;
106133                  }
106134                  QueryPointAABB(...t) {
106135                    t[0] instanceof Qs ? this._QueryPointAABB(t[0], t[1]) : this._QueryPointAABB(null, t[0], t[1]);
106136                  }
106137                  _QueryPointAABB(t, e, i) {
106138                    this.m_contactManager.m_broadPhase.QueryPoint(e, (e => {
106139                      const s = e.userData.fixture;
106140                      return t ? t.ReportFixture(s) : !i || i(s);
106141                    }));
106142                    if (t instanceof Qs) for (let i = this.m_particleSystemList; i; i = i.m_next) t.ShouldQueryParticleSystem(i) && i.QueryPointAABB(t, e);
106143                  }
106144                  QueryAllPointAABB(t, e = []) {
106145                    this.QueryPointAABB(t, (t => {
106146                      e.push(t);
106147                      return !0;
106148                    }));
106149                    return e;
106150                  }
106151                  QueryFixtureShape(...t) {
106152                    t[0] instanceof Qs ? this._QueryFixtureShape(t[0], t[1], t[2], t[3]) : this._QueryFixtureShape(null, t[0], t[1], t[2], t[3]);
106153                  }
106154                  _QueryFixtureShape(t, e, i, s, n) {
106155                    const r = sr.QueryFixtureShape_s_aabb;
106156                    e.ComputeAABB(r, s, i);
106157                    this.m_contactManager.m_broadPhase.Query(r, (r => {
106158                      const o = r.userData;
106159                      const a = o.fixture;
106160                      if (ve(e, i, a.GetShape(), o.childIndex, s, a.GetBody().GetTransform())) {
106161                        if (t) return t.ReportFixture(a);
106162                        if (n) return n(a);
106163                      }
106164                      return !0;
106165                    }));
106166                    if (t instanceof Qs) for (let e = this.m_particleSystemList; e; e = e.m_next) t.ShouldQueryParticleSystem(e) && e.QueryAABB(t, r);
106167                  }
106168                  QueryAllFixtureShape(t, e, i, s = []) {
106169                    this.QueryFixtureShape(t, e, i, (t => {
106170                      s.push(t);
106171                      return !0;
106172                    }));
106173                    return s;
106174                  }
106175                  QueryFixturePoint(...t) {
106176                    t[0] instanceof Qs ? this._QueryFixturePoint(t[0], t[1]) : this._QueryFixturePoint(null, t[0], t[1]);
106177                  }
106178                  _QueryFixturePoint(t, e, i) {
106179                    this.m_contactManager.m_broadPhase.QueryPoint(e, (s => {
106180                      const n = s.userData.fixture;
106181                      if (n.TestPoint(e)) {
106182                        if (t) return t.ReportFixture(n);
106183                        if (i) return i(n);
106184                      }
106185                      return !0;
106186                    }));
106187                    if (t) for (let i = this.m_particleSystemList; i; i = i.m_next) t.ShouldQueryParticleSystem(i) && i.QueryPointAABB(t, e);
106188                  }
106189                  QueryAllFixturePoint(t, e = []) {
106190                    this.QueryFixturePoint(t, (t => {
106191                      e.push(t);
106192                      return !0;
106193                    }));
106194                    return e;
106195                  }
106196                  RayCast(...t) {
106197                    t[0] instanceof $s ? this._RayCast(t[0], t[1], t[2]) : this._RayCast(null, t[0], t[1], t[2]);
106198                  }
106199                  _RayCast(t, e, i, s) {
106200                    const n = sr.RayCast_s_input;
106201                    n.maxFraction = 1;
106202                    n.p1.Copy(e);
106203                    n.p2.Copy(i);
106204                    this.m_contactManager.m_broadPhase.RayCast(n, ((n, r) => {
106205                      const o = r.userData;
106206                      const a = o.fixture;
106207                      const l = o.childIndex;
106208                      const h = sr.RayCast_s_output;
106209                      if (a.RayCast(h, n, l)) {
106210                        const n = h.fraction;
106211                        const r = sr.RayCast_s_point;
106212                        r.Set((1 - n) * e.x + n * i.x, (1 - n) * e.y + n * i.y);
106213                        if (t) return t.ReportFixture(a, r, h.normal, n);
106214                        if (s) return s(a, r, h.normal, n);
106215                      }
106216                      return n.maxFraction;
106217                    }));
106218                    if (t) for (let s = this.m_particleSystemList; s; s = s.m_next) t.ShouldQueryParticleSystem(s) && s.RayCast(t, e, i);
106219                  }
106220                  RayCastOne(t, e) {
106221                    let i = null;
106222                    let s = 1;
106223                    this.RayCast(t, e, ((t, e, n, r) => {
106224                      if (r < s) {
106225                        s = r;
106226                        i = t;
106227                      }
106228                      return s;
106229                    }));
106230                    return i;
106231                  }
106232                  RayCastAll(t, e, i = []) {
106233                    this.RayCast(t, e, ((t, e, s, n) => {
106234                      i.push(t);
106235                      return 1;
106236                    }));
106237                    return i;
106238                  }
106239                  GetBodyList() {
106240                    return this.m_bodyList;
106241                  }
106242                  GetJointList() {
106243                    return this.m_jointList;
106244                  }
106245                  GetParticleSystemList() {
106246                    return this.m_particleSystemList;
106247                  }
106248                  GetContactList() {
106249                    return this.m_contactManager.m_contactList;
106250                  }
106251                  SetAllowSleeping(t) {
106252                    if (t !== this.m_allowSleep) {
106253                      this.m_allowSleep = t;
106254                      if (!this.m_allowSleep) for (let t = this.m_bodyList; t; t = t.m_next) t.SetAwake(!0);
106255                    }
106256                  }
106257                  GetAllowSleeping() {
106258                    return this.m_allowSleep;
106259                  }
106260                  SetWarmStarting(t) {
106261                    this.m_warmStarting = t;
106262                  }
106263                  GetWarmStarting() {
106264                    return this.m_warmStarting;
106265                  }
106266                  SetContinuousPhysics(t) {
106267                    this.m_continuousPhysics = t;
106268                  }
106269                  GetContinuousPhysics() {
106270                    return this.m_continuousPhysics;
106271                  }
106272                  SetSubStepping(t) {
106273                    this.m_subStepping = t;
106274                  }
106275                  GetSubStepping() {
106276                    return this.m_subStepping;
106277                  }
106278                  GetProxyCount() {
106279                    return this.m_contactManager.m_broadPhase.GetProxyCount();
106280                  }
106281                  GetBodyCount() {
106282                    return this.m_bodyCount;
106283                  }
106284                  GetJointCount() {
106285                    return this.m_jointCount;
106286                  }
106287                  GetContactCount() {
106288                    return this.m_contactManager.m_contactCount;
106289                  }
106290                  GetTreeHeight() {
106291                    return this.m_contactManager.m_broadPhase.GetTreeHeight();
106292                  }
106293                  GetTreeBalance() {
106294                    return this.m_contactManager.m_broadPhase.GetTreeBalance();
106295                  }
106296                  GetTreeQuality() {
106297                    return this.m_contactManager.m_broadPhase.GetTreeQuality();
106298                  }
106299                  SetGravity(t, e = !0) {
106300                    if (!St.IsEqualToV(this.m_gravity, t)) {
106301                      this.m_gravity.Copy(t);
106302                      if (e) for (let t = this.m_bodyList; t; t = t.m_next) t.SetAwake(!0);
106303                    }
106304                  }
106305                  GetGravity() {
106306                    return this.m_gravity;
106307                  }
106308                  IsLocked() {
106309                    return this.m_locked;
106310                  }
106311                  SetAutoClearForces(t) {
106312                    this.m_clearForces = t;
106313                  }
106314                  GetAutoClearForces() {
106315                    return this.m_clearForces;
106316                  }
106317                  ShiftOrigin(t) {
106318                    if (this.IsLocked()) throw new Error;
106319                    for (let e = this.m_bodyList; e; e = e.m_next) {
106320                      e.m_xf.p.SelfSub(t);
106321                      e.m_sweep.c0.SelfSub(t);
106322                      e.m_sweep.c.SelfSub(t);
106323                    }
106324                    for (let e = this.m_jointList; e; e = e.m_next) e.ShiftOrigin(t);
106325                    this.m_contactManager.m_broadPhase.ShiftOrigin(t);
106326                  }
106327                  GetContactManager() {
106328                    return this.m_contactManager;
106329                  }
106330                  GetProfile() {
106331                    return this.m_profile;
106332                  }
106333                  Dump(e) {
106334                    if (this.m_locked) return;
106335                    e("const g: b2Vec2 = new b2Vec2(%.15f, %.15f);\n", this.m_gravity.x, this.m_gravity.y);
106336                    e("this.m_world.SetGravity(g);\n");
106337                    e("const bodies: b2Body[] = [];\n");
106338                    e("const joints: b2Joint[] = [];\n");
106339                    let i = 0;
106340                    for (let t = this.m_bodyList; t; t = t.m_next) {
106341                      t.m_islandIndex = i;
106342                      t.Dump(e);
106343                      ++i;
106344                    }
106345                    i = 0;
106346                    for (let t = this.m_jointList; t; t = t.m_next) {
106347                      t.m_index = i;
106348                      ++i;
106349                    }
106350                    for (let i = this.m_jointList; i; i = i.m_next) if (i.m_type !== t.b2JointType.e_gearJoint) {
106351                      e("{\n");
106352                      i.Dump(e);
106353                      e("}\n");
106354                    }
106355                    for (let i = this.m_jointList; i; i = i.m_next) if (i.m_type === t.b2JointType.e_gearJoint) {
106356                      e("{\n");
106357                      i.Dump(e);
106358                      e("}\n");
106359                    }
106360                  }
106361                  DrawJoint(e) {
106362                    if (null === this.m_debugDraw) return;
106363                    const i = e.GetBodyA();
106364                    const s = e.GetBodyB();
106365                    const n = i.m_xf;
106366                    const r = s.m_xf;
106367                    const o = n.p;
106368                    const a = r.p;
106369                    const l = e.GetAnchorA(sr.DrawJoint_s_p1);
106370                    const h = e.GetAnchorB(sr.DrawJoint_s_p2);
106371                    const c = sr.DrawJoint_s_color.SetRGB(.5, .8, .8);
106372                    switch (e.m_type) {
106373                     case t.b2JointType.e_distanceJoint:
106374                      this.m_debugDraw.DrawSegment(l, h, c);
106375                      break;
106376
106377                     case t.b2JointType.e_pulleyJoint:
106378                      {
106379                        const t = e;
106380                        const i = t.GetGroundAnchorA();
106381                        const s = t.GetGroundAnchorB();
106382                        this.m_debugDraw.DrawSegment(i, l, c);
106383                        this.m_debugDraw.DrawSegment(s, h, c);
106384                        this.m_debugDraw.DrawSegment(i, s, c);
106385                        break;
106386                      }
106387
106388                     case t.b2JointType.e_mouseJoint:
106389                      {
106390                        const t = sr.DrawJoint_s_c;
106391                        t.Set(0, 1, 0);
106392                        this.m_debugDraw.DrawPoint(l, 4, t);
106393                        this.m_debugDraw.DrawPoint(h, 4, t);
106394                        t.Set(.8, .8, .8);
106395                        this.m_debugDraw.DrawSegment(l, h, t);
106396                        break;
106397                      }
106398
106399                     default:
106400                      this.m_debugDraw.DrawSegment(o, l, c);
106401                      this.m_debugDraw.DrawSegment(l, h, c);
106402                      this.m_debugDraw.DrawSegment(a, h, c);
106403                    }
106404                  }
106405                  DrawShape(e, i) {
106406                    if (null === this.m_debugDraw) return;
106407                    const s = e.GetShape();
106408                    switch (s.m_type) {
106409                     case t.b2ShapeType.e_circleShape:
106410                      {
106411                        const t = s;
106412                        const e = t.m_p;
106413                        const n = t.m_radius;
106414                        const r = St.UNITX;
106415                        this.m_debugDraw.DrawSolidCircle(e, n, r, i);
106416                        break;
106417                      }
106418
106419                     case t.b2ShapeType.e_edgeShape:
106420                      {
106421                        const t = s;
106422                        const e = t.m_vertex1;
106423                        const n = t.m_vertex2;
106424                        this.m_debugDraw.DrawSegment(e, n, i);
106425                        break;
106426                      }
106427
106428                     case t.b2ShapeType.e_chainShape:
106429                      {
106430                        const t = s;
106431                        const e = t.m_count;
106432                        const n = t.m_vertices;
106433                        const r = sr.DrawShape_s_ghostColor.SetRGBA(.75 * i.r, .75 * i.g, .75 * i.b, i.a);
106434                        let o = n[0];
106435                        this.m_debugDraw.DrawPoint(o, 4, i);
106436                        if (t.m_hasPrevVertex) {
106437                          const e = t.m_prevVertex;
106438                          this.m_debugDraw.DrawSegment(e, o, r);
106439                          this.m_debugDraw.DrawCircle(e, .1, r);
106440                        }
106441                        for (let t = 1; t < e; ++t) {
106442                          const e = n[t];
106443                          this.m_debugDraw.DrawSegment(o, e, i);
106444                          this.m_debugDraw.DrawPoint(e, 4, i);
106445                          o = e;
106446                        }
106447                        if (t.m_hasNextVertex) {
106448                          const e = t.m_nextVertex;
106449                          this.m_debugDraw.DrawSegment(e, o, r);
106450                          this.m_debugDraw.DrawCircle(e, .1, r);
106451                        }
106452                        break;
106453                      }
106454
106455                     case t.b2ShapeType.e_polygonShape:
106456                      {
106457                        const t = s;
106458                        const e = t.m_count;
106459                        const n = t.m_vertices;
106460                        this.m_debugDraw.DrawSolidPolygon(n, e, i);
106461                        break;
106462                      }
106463                    }
106464                  }
106465                  Solve(e) {
106466                    for (let t = this.m_bodyList; t; t = t.m_next) t.m_xf0.Copy(t.m_xf);
106467                    for (let t = this.m_controllerList; t; t = t.m_next) t.Step(e);
106468                    this.m_profile.solveInit = 0;
106469                    this.m_profile.solveVelocity = 0;
106470                    this.m_profile.solvePosition = 0;
106471                    const i = this.m_island;
106472                    i.Initialize(this.m_bodyCount, this.m_contactManager.m_contactCount, this.m_jointCount, this.m_contactManager.m_contactListener);
106473                    for (let t = this.m_bodyList; t; t = t.m_next) t.m_islandFlag = !1;
106474                    for (let t = this.m_contactManager.m_contactList; t; t = t.m_next) t.m_islandFlag = !1;
106475                    for (let t = this.m_jointList; t; t = t.m_next) t.m_islandFlag = !1;
106476                    const s = this.s_stack;
106477                    for (let n = this.m_bodyList; n; n = n.m_next) {
106478                      if (n.m_islandFlag) continue;
106479                      if (!n.IsAwake() || !n.IsActive()) continue;
106480                      if (n.GetType() === t.b2BodyType.b2_staticBody) continue;
106481                      i.Clear();
106482                      let r = 0;
106483                      s[r++] = n;
106484                      n.m_islandFlag = !0;
106485                      for (;r > 0; ) {
106486                        const e = s[--r];
106487                        if (!e) throw new Error;
106488                        i.AddBody(e);
106489                        e.m_awakeFlag = !0;
106490                        if (e.GetType() !== t.b2BodyType.b2_staticBody) {
106491                          for (let t = e.m_contactList; t; t = t.next) {
106492                            const e = t.contact;
106493                            if (e.m_islandFlag) continue;
106494                            if (!e.IsEnabled() || !e.IsTouching()) continue;
106495                            const n = e.m_fixtureA.m_isSensor;
106496                            const o = e.m_fixtureB.m_isSensor;
106497                            if (n || o) continue;
106498                            i.AddContact(e);
106499                            e.m_islandFlag = !0;
106500                            const a = t.other;
106501                            if (!a.m_islandFlag) {
106502                              s[r++] = a;
106503                              a.m_islandFlag = !0;
106504                            }
106505                          }
106506                          for (let t = e.m_jointList; t; t = t.next) {
106507                            if (t.joint.m_islandFlag) continue;
106508                            const e = t.other;
106509                            if (e.IsActive()) {
106510                              i.AddJoint(t.joint);
106511                              t.joint.m_islandFlag = !0;
106512                              if (!e.m_islandFlag) {
106513                                s[r++] = e;
106514                                e.m_islandFlag = !0;
106515                              }
106516                            }
106517                          }
106518                        }
106519                      }
106520                      const o = new en;
106521                      i.Solve(o, e, this.m_gravity, this.m_allowSleep);
106522                      this.m_profile.solveInit += o.solveInit;
106523                      this.m_profile.solveVelocity += o.solveVelocity;
106524                      this.m_profile.solvePosition += o.solvePosition;
106525                      for (let e = 0; e < i.m_bodyCount; ++e) {
106526                        const s = i.m_bodies[e];
106527                        s.GetType() === t.b2BodyType.b2_staticBody && (s.m_islandFlag = !1);
106528                      }
106529                    }
106530                    for (let t = 0; t < s.length && s[t]; ++t) s[t] = null;
106531                    const n = new Mt;
106532                    for (let e = this.m_bodyList; e; e = e.m_next) e.m_islandFlag && e.GetType() !== t.b2BodyType.b2_staticBody && e.SynchronizeFixtures();
106533                    this.m_contactManager.FindNewContacts();
106534                    this.m_profile.broadphase = n.GetMilliseconds();
106535                  }
106536                  SolveTOI(e) {
106537                    const i = this.m_island;
106538                    i.Initialize(2 * m, m, 0, this.m_contactManager.m_contactListener);
106539                    if (this.m_stepComplete) {
106540                      for (let t = this.m_bodyList; t; t = t.m_next) {
106541                        t.m_islandFlag = !1;
106542                        t.m_sweep.alpha0 = 0;
106543                      }
106544                      for (let t = this.m_contactManager.m_contactList; t; t = t.m_next) {
106545                        t.m_toiFlag = !1;
106546                        t.m_islandFlag = !1;
106547                        t.m_toiCount = 0;
106548                        t.m_toi = 1;
106549                      }
106550                    }
106551                    for (;;) {
106552                      let s = null;
106553                      let r = 1;
106554                      for (let e = this.m_contactManager.m_contactList; e; e = e.m_next) {
106555                        if (!e.IsEnabled()) continue;
106556                        if (e.m_toiCount > p) continue;
106557                        let i = 1;
106558                        if (e.m_toiFlag) i = e.m_toi; else {
106559                          const s = e.GetFixtureA();
106560                          const n = e.GetFixtureB();
106561                          if (s.IsSensor() || n.IsSensor()) continue;
106562                          const r = s.GetBody();
106563                          const o = n.GetBody();
106564                          const a = r.m_type;
106565                          const l = o.m_type;
106566                          const h = r.IsAwake() && a !== t.b2BodyType.b2_staticBody;
106567                          const c = o.IsAwake() && l !== t.b2BodyType.b2_staticBody;
106568                          if (!h && !c) continue;
106569                          const u = r.IsBullet() || a !== t.b2BodyType.b2_dynamicBody;
106570                          const _ = o.IsBullet() || l !== t.b2BodyType.b2_dynamicBody;
106571                          if (!u && !_) continue;
106572                          let d = r.m_sweep.alpha0;
106573                          if (r.m_sweep.alpha0 < o.m_sweep.alpha0) {
106574                            d = o.m_sweep.alpha0;
106575                            r.m_sweep.Advance(d);
106576                          } else if (o.m_sweep.alpha0 < r.m_sweep.alpha0) {
106577                            d = r.m_sweep.alpha0;
106578                            o.m_sweep.Advance(d);
106579                          }
106580                          const p = e.GetChildIndexA();
106581                          const m = e.GetChildIndexB();
106582                          const f = sr.SolveTOI_s_toi_input;
106583                          f.proxyA.SetShape(s.GetShape(), p);
106584                          f.proxyB.SetShape(n.GetShape(), m);
106585                          f.sweepA.Copy(r.m_sweep);
106586                          f.sweepB.Copy(o.m_sweep);
106587                          f.tMax = 1;
106588                          const g = sr.SolveTOI_s_toi_output;
106589                          $e(g, f);
106590                          const y = g.t;
106591                          i = g.state === t.b2TOIOutputState.e_touching ? tt(d + (1 - d) * y, 1) : 1;
106592                          e.m_toi = i;
106593                          e.m_toiFlag = !0;
106594                        }
106595                        if (i < r) {
106596                          s = e;
106597                          r = i;
106598                        }
106599                      }
106600                      if (null === s || 1 - 10 * n < r) {
106601                        this.m_stepComplete = !0;
106602                        break;
106603                      }
106604                      const o = s.GetFixtureA();
106605                      const a = s.GetFixtureB();
106606                      const l = o.GetBody();
106607                      const h = a.GetBody();
106608                      const c = sr.SolveTOI_s_backup1.Copy(l.m_sweep);
106609                      const u = sr.SolveTOI_s_backup2.Copy(h.m_sweep);
106610                      l.Advance(r);
106611                      h.Advance(r);
106612                      s.Update(this.m_contactManager.m_contactListener);
106613                      s.m_toiFlag = !1;
106614                      ++s.m_toiCount;
106615                      if (!s.IsEnabled() || !s.IsTouching()) {
106616                        s.SetEnabled(!1);
106617                        l.m_sweep.Copy(c);
106618                        h.m_sweep.Copy(u);
106619                        l.SynchronizeTransform();
106620                        h.SynchronizeTransform();
106621                        continue;
106622                      }
106623                      l.SetAwake(!0);
106624                      h.SetAwake(!0);
106625                      i.Clear();
106626                      i.AddBody(l);
106627                      i.AddBody(h);
106628                      i.AddContact(s);
106629                      l.m_islandFlag = !0;
106630                      h.m_islandFlag = !0;
106631                      s.m_islandFlag = !0;
106632                      for (let e = 0; e < 2; ++e) {
106633                        const s = 0 === e ? l : h;
106634                        if (s.m_type === t.b2BodyType.b2_dynamicBody) for (let e = s.m_contactList; e && i.m_bodyCount !== i.m_bodyCapacity && i.m_contactCount !== i.m_contactCapacity; e = e.next) {
106635                          const n = e.contact;
106636                          if (n.m_islandFlag) continue;
106637                          const o = e.other;
106638                          if (o.m_type === t.b2BodyType.b2_dynamicBody && !s.IsBullet() && !o.IsBullet()) continue;
106639                          const a = n.m_fixtureA.m_isSensor;
106640                          const l = n.m_fixtureB.m_isSensor;
106641                          if (a || l) continue;
106642                          const h = sr.SolveTOI_s_backup.Copy(o.m_sweep);
106643                          o.m_islandFlag || o.Advance(r);
106644                          n.Update(this.m_contactManager.m_contactListener);
106645                          if (n.IsEnabled()) if (n.IsTouching()) {
106646                            n.m_islandFlag = !0;
106647                            i.AddContact(n);
106648                            if (!o.m_islandFlag) {
106649                              o.m_islandFlag = !0;
106650                              o.m_type !== t.b2BodyType.b2_staticBody && o.SetAwake(!0);
106651                              i.AddBody(o);
106652                            }
106653                          } else {
106654                            o.m_sweep.Copy(h);
106655                            o.SynchronizeTransform();
106656                          } else {
106657                            o.m_sweep.Copy(h);
106658                            o.SynchronizeTransform();
106659                          }
106660                        }
106661                      }
106662                      const _ = sr.SolveTOI_s_subStep;
106663                      _.dt = (1 - r) * e.dt;
106664                      _.inv_dt = 1 / _.dt;
106665                      _.dtRatio = 1;
106666                      _.positionIterations = 20;
106667                      _.velocityIterations = e.velocityIterations;
106668                      _.particleIterations = e.particleIterations;
106669                      _.warmStarting = !1;
106670                      i.SolveTOI(_, l.m_islandIndex, h.m_islandIndex);
106671                      for (let e = 0; e < i.m_bodyCount; ++e) {
106672                        const s = i.m_bodies[e];
106673                        s.m_islandFlag = !1;
106674                        if (s.m_type === t.b2BodyType.b2_dynamicBody) {
106675                          s.SynchronizeFixtures();
106676                          for (let t = s.m_contactList; t; t = t.next) {
106677                            t.contact.m_toiFlag = !1;
106678                            t.contact.m_islandFlag = !1;
106679                          }
106680                        }
106681                      }
106682                      this.m_contactManager.FindNewContacts();
106683                      if (this.m_subStepping) {
106684                        this.m_stepComplete = !1;
106685                        break;
106686                      }
106687                    }
106688                  }
106689                  AddController(t) {
106690                    t.m_next = this.m_controllerList;
106691                    t.m_prev = null;
106692                    this.m_controllerList && (this.m_controllerList.m_prev = t);
106693                    this.m_controllerList = t;
106694                    ++this.m_controllerCount;
106695                    return t;
106696                  }
106697                  RemoveController(t) {
106698                    t.m_prev && (t.m_prev.m_next = t.m_next);
106699                    t.m_next && (t.m_next.m_prev = t.m_prev);
106700                    this.m_controllerList === t && (this.m_controllerList = t.m_next);
106701                    --this.m_controllerCount;
106702                    t.m_prev = null;
106703                    t.m_next = null;
106704                    return t;
106705                  }
106706                }
106707                sr.Step_s_step = new sn;
106708                sr.Step_s_stepTimer = new Mt;
106709                sr.Step_s_timer = new Mt;
106710                sr.DrawDebugData_s_color = new Rt(0, 0, 0);
106711                sr.DrawDebugData_s_vs = St.MakeArray(4);
106712                sr.DrawDebugData_s_xf = new xt;
106713                sr.QueryFixtureShape_s_aabb = new ge;
106714                sr.RayCast_s_input = new me;
106715                sr.RayCast_s_output = new fe;
106716                sr.RayCast_s_point = new St;
106717                sr.DrawJoint_s_p1 = new St;
106718                sr.DrawJoint_s_p2 = new St;
106719                sr.DrawJoint_s_color = new Rt(.5, .8, .8);
106720                sr.DrawJoint_s_c = new Rt;
106721                sr.DrawShape_s_ghostColor = new Rt;
106722                sr.SolveTOI_s_subStep = new sn;
106723                sr.SolveTOI_s_backup = new wt;
106724                sr.SolveTOI_s_backup1 = new wt;
106725                sr.SolveTOI_s_backup2 = new wt;
106726                sr.SolveTOI_s_toi_input = new Ge;
106727                sr.SolveTOI_s_toi_output = new ze;
106728                class nr {
106729                  constructor(t, e) {
106730                    this.prevBody = null;
106731                    this.nextBody = null;
106732                    this.prevController = null;
106733                    this.nextController = null;
106734                    this.controller = t;
106735                    this.body = e;
106736                  }
106737                }
106738                class rr {
106739                  constructor() {
106740                    this.m_bodyList = null;
106741                    this.m_bodyCount = 0;
106742                    this.m_prev = null;
106743                    this.m_next = null;
106744                  }
106745                  GetNext() {
106746                    return this.m_next;
106747                  }
106748                  GetPrev() {
106749                    return this.m_prev;
106750                  }
106751                  GetBodyList() {
106752                    return this.m_bodyList;
106753                  }
106754                  AddBody(t) {
106755                    const e = new nr(this, t);
106756                    e.nextBody = this.m_bodyList;
106757                    e.prevBody = null;
106758                    this.m_bodyList && (this.m_bodyList.prevBody = e);
106759                    this.m_bodyList = e;
106760                    ++this.m_bodyCount;
106761                    e.nextController = t.m_controllerList;
106762                    e.prevController = null;
106763                    t.m_controllerList && (t.m_controllerList.prevController = e);
106764                    t.m_controllerList = e;
106765                    ++t.m_controllerCount;
106766                  }
106767                  RemoveBody(t) {
106768                    if (this.m_bodyCount <= 0) throw new Error;
106769                    let e = this.m_bodyList;
106770                    for (;e && e.body !== t; ) e = e.nextBody;
106771                    if (null === e) throw new Error;
106772                    e.prevBody && (e.prevBody.nextBody = e.nextBody);
106773                    e.nextBody && (e.nextBody.prevBody = e.prevBody);
106774                    this.m_bodyList === e && (this.m_bodyList = e.nextBody);
106775                    --this.m_bodyCount;
106776                    e.nextController && (e.nextController.prevController = e.prevController);
106777                    e.prevController && (e.prevController.nextController = e.nextController);
106778                    t.m_controllerList === e && (t.m_controllerList = e.nextController);
106779                    --t.m_controllerCount;
106780                  }
106781                  Clear() {
106782                    for (;this.m_bodyList; ) this.RemoveBody(this.m_bodyList.body);
106783                    this.m_bodyCount = 0;
106784                  }
106785                }
106786                class or extends rr {
106787                  constructor() {
106788                    super(...arguments);
106789                    this.normal = new St(0, 1);
106790                    this.offset = 0;
106791                    this.density = 0;
106792                    this.velocity = new St(0, 0);
106793                    this.linearDrag = 0;
106794                    this.angularDrag = 0;
106795                    this.useDensity = !1;
106796                    this.useWorldGravity = !0;
106797                    this.gravity = new St(0, 0);
106798                  }
106799                  Step(t) {
106800                    if (this.m_bodyList) {
106801                      this.useWorldGravity && this.gravity.Copy(this.m_bodyList.body.GetWorld().GetGravity());
106802                      for (let t = this.m_bodyList; t; t = t.nextBody) {
106803                        const e = t.body;
106804                        if (!e.IsAwake()) continue;
106805                        const i = new St;
106806                        const s = new St;
106807                        let r = 0;
106808                        let o = 0;
106809                        for (let t = e.GetFixtureList(); t; t = t.m_next) {
106810                          const n = new St;
106811                          const a = t.GetShape().ComputeSubmergedArea(this.normal, this.offset, e.GetTransform(), n);
106812                          r += a;
106813                          i.x += a * n.x;
106814                          i.y += a * n.y;
106815                          let l = 0;
106816                          l = this.useDensity ? t.GetDensity() : 1;
106817                          o += a * l;
106818                          s.x += a * n.x * l;
106819                          s.y += a * n.y * l;
106820                        }
106821                        i.x /= r;
106822                        i.y /= r;
106823                        s.x /= o;
106824                        s.y /= o;
106825                        if (r < n) continue;
106826                        const a = this.gravity.Clone().SelfNeg();
106827                        a.SelfMul(this.density * r);
106828                        e.ApplyForce(a, s);
106829                        const l = e.GetLinearVelocityFromWorldPoint(i, new St);
106830                        l.SelfSub(this.velocity);
106831                        l.SelfMul(-this.linearDrag * r);
106832                        e.ApplyForce(l, i);
106833                        e.ApplyTorque(-e.GetInertia() / e.GetMass() * r * e.GetAngularVelocity() * this.angularDrag);
106834                      }
106835                    }
106836                  }
106837                  Draw(t) {
106838                    const e = 100;
106839                    const i = new St;
106840                    const s = new St;
106841                    i.x = this.normal.x * this.offset + this.normal.y * e;
106842                    i.y = this.normal.y * this.offset - this.normal.x * e;
106843                    s.x = this.normal.x * this.offset - this.normal.y * e;
106844                    s.y = this.normal.y * this.offset + this.normal.x * e;
106845                    const n = new Rt(0, 0, .8);
106846                    t.DrawSegment(i, s, n);
106847                  }
106848                }
106849                class ar extends rr {
106850                  constructor() {
106851                    super(...arguments);
106852                    this.A = new St(0, 0);
106853                  }
106854                  Step(t) {
106855                    const e = St.MulSV(t.dt, this.A, ar.Step_s_dtA);
106856                    for (let t = this.m_bodyList; t; t = t.nextBody) {
106857                      const i = t.body;
106858                      i.IsAwake() && i.SetLinearVelocity(St.AddVV(i.GetLinearVelocity(), e, St.s_t0));
106859                    }
106860                  }
106861                  Draw(t) {}
106862                }
106863                ar.Step_s_dtA = new St;
106864                class lr extends rr {
106865                  constructor() {
106866                    super(...arguments);
106867                    this.F = new St(0, 0);
106868                  }
106869                  Step(t) {
106870                    for (let t = this.m_bodyList; t; t = t.nextBody) {
106871                      const e = t.body;
106872                      e.IsAwake() && e.ApplyForce(this.F, e.GetWorldCenter());
106873                    }
106874                  }
106875                  Draw(t) {}
106876                }
106877                class hr extends rr {
106878                  constructor() {
106879                    super(...arguments);
106880                    this.G = 1;
106881                    this.invSqr = !0;
106882                  }
106883                  Step(t) {
106884                    if (this.invSqr) for (let t = this.m_bodyList; t; t = t.nextBody) {
106885                      const e = t.body;
106886                      const i = e.GetWorldCenter();
106887                      const s = e.GetMass();
106888                      for (let r = this.m_bodyList; r && r !== t; r = r.nextBody) {
106889                        const t = r.body;
106890                        const o = t.GetWorldCenter();
106891                        const a = t.GetMass();
106892                        const l = o.x - i.x;
106893                        const h = o.y - i.y;
106894                        const c = l * l + h * h;
106895                        if (c < n) continue;
106896                        const u = hr.Step_s_f.Set(l, h);
106897                        u.SelfMul(this.G / c / at(c) * s * a);
106898                        e.IsAwake() && e.ApplyForce(u, i);
106899                        t.IsAwake() && t.ApplyForce(u.SelfMul(-1), o);
106900                      }
106901                    } else for (let t = this.m_bodyList; t; t = t.nextBody) {
106902                      const e = t.body;
106903                      const i = e.GetWorldCenter();
106904                      const s = e.GetMass();
106905                      for (let r = this.m_bodyList; r && r !== t; r = r.nextBody) {
106906                        const t = r.body;
106907                        const o = t.GetWorldCenter();
106908                        const a = t.GetMass();
106909                        const l = o.x - i.x;
106910                        const h = o.y - i.y;
106911                        const c = l * l + h * h;
106912                        if (c < n) continue;
106913                        const u = hr.Step_s_f.Set(l, h);
106914                        u.SelfMul(this.G / c * s * a);
106915                        e.IsAwake() && e.ApplyForce(u, i);
106916                        t.IsAwake() && t.ApplyForce(u.SelfMul(-1), o);
106917                      }
106918                    }
106919                  }
106920                  Draw(t) {}
106921                }
106922                hr.Step_s_f = new St;
106923                class cr extends rr {
106924                  constructor() {
106925                    super(...arguments);
106926                    this.T = new vt;
106927                    this.maxTimestep = 0;
106928                  }
106929                  Step(t) {
106930                    let e = t.dt;
106931                    if (!(e <= n)) {
106932                      e > this.maxTimestep && this.maxTimestep > 0 && (e = this.maxTimestep);
106933                      for (let t = this.m_bodyList; t; t = t.nextBody) {
106934                        const i = t.body;
106935                        if (!i.IsAwake()) continue;
106936                        const s = i.GetWorldVector(vt.MulMV(this.T, i.GetLocalVector(i.GetLinearVelocity(), St.s_t0), St.s_t1), cr.Step_s_damping);
106937                        i.SetLinearVelocity(St.AddVV(i.GetLinearVelocity(), St.MulSV(e, s, St.s_t0), St.s_t1));
106938                      }
106939                    }
106940                  }
106941                  Draw(t) {}
106942                  SetAxisAligned(t, e) {
106943                    this.T.ex.x = -t;
106944                    this.T.ex.y = 0;
106945                    this.T.ey.x = 0;
106946                    this.T.ey.y = -e;
106947                    this.maxTimestep = t > 0 || e > 0 ? 1 / et(t, e) : 0;
106948                  }
106949                }
106950                cr.Step_s_damping = new St;
106951                class ur {
106952                  constructor() {
106953                    this.vertices = [];
106954                    this.count = 0;
106955                    this.masses = [];
106956                    this.gravity = new St(0, 0);
106957                    this.damping = .1;
106958                    this.k2 = .9;
106959                    this.k3 = .1;
106960                  }
106961                }
106962                class _r {
106963                  constructor() {
106964                    this.m_count = 0;
106965                    this.m_ps = [];
106966                    this.m_p0s = [];
106967                    this.m_vs = [];
106968                    this.m_ims = [];
106969                    this.m_Ls = [];
106970                    this.m_as = [];
106971                    this.m_gravity = new St;
106972                    this.m_damping = 0;
106973                    this.m_k2 = 1;
106974                    this.m_k3 = .1;
106975                  }
106976                  GetVertexCount() {
106977                    return this.m_count;
106978                  }
106979                  GetVertices() {
106980                    return this.m_ps;
106981                  }
106982                  Initialize(t) {
106983                    this.m_count = t.count;
106984                    this.m_ps = St.MakeArray(this.m_count);
106985                    this.m_p0s = St.MakeArray(this.m_count);
106986                    this.m_vs = St.MakeArray(this.m_count);
106987                    this.m_ims = K(this.m_count);
106988                    for (let e = 0; e < this.m_count; ++e) {
106989                      this.m_ps[e].Copy(t.vertices[e]);
106990                      this.m_p0s[e].Copy(t.vertices[e]);
106991                      this.m_vs[e].SetZero();
106992                      const i = t.masses[e];
106993                      this.m_ims[e] = i > 0 ? 1 / i : 0;
106994                    }
106995                    const e = this.m_count - 1;
106996                    const i = this.m_count - 2;
106997                    this.m_Ls = K(e);
106998                    this.m_as = K(i);
106999                    for (let t = 0; t < e; ++t) {
107000                      const e = this.m_ps[t];
107001                      const i = this.m_ps[t + 1];
107002                      this.m_Ls[t] = St.DistanceVV(e, i);
107003                    }
107004                    for (let t = 0; t < i; ++t) {
107005                      const e = this.m_ps[t];
107006                      const i = this.m_ps[t + 1];
107007                      const s = this.m_ps[t + 2];
107008                      const n = St.SubVV(i, e, St.s_t0);
107009                      const r = St.SubVV(s, i, St.s_t1);
107010                      const o = St.CrossVV(n, r);
107011                      const a = St.DotVV(n, r);
107012                      this.m_as[t] = mt(o, a);
107013                    }
107014                    this.m_gravity.Copy(t.gravity);
107015                    this.m_damping = t.damping;
107016                    this.m_k2 = t.k2;
107017                    this.m_k3 = t.k3;
107018                  }
107019                  Step(t, e) {
107020                    if (0 === t) return;
107021                    const i = Math.exp(-t * this.m_damping);
107022                    for (let e = 0; e < this.m_count; ++e) {
107023                      this.m_p0s[e].Copy(this.m_ps[e]);
107024                      this.m_ims[e] > 0 && this.m_vs[e].SelfMulAdd(t, this.m_gravity);
107025                      this.m_vs[e].SelfMul(i);
107026                      this.m_ps[e].SelfMulAdd(t, this.m_vs[e]);
107027                    }
107028                    for (let t = 0; t < e; ++t) {
107029                      this.SolveC2();
107030                      this.SolveC3();
107031                      this.SolveC2();
107032                    }
107033                    const s = 1 / t;
107034                    for (let t = 0; t < this.m_count; ++t) St.MulSV(s, St.SubVV(this.m_ps[t], this.m_p0s[t], St.s_t0), this.m_vs[t]);
107035                  }
107036                  SolveC2() {
107037                    const t = this.m_count - 1;
107038                    for (let e = 0; e < t; ++e) {
107039                      const t = this.m_ps[e];
107040                      const i = this.m_ps[e + 1];
107041                      const s = St.SubVV(i, t, _r.s_d);
107042                      const n = s.Normalize();
107043                      const r = this.m_ims[e];
107044                      const o = this.m_ims[e + 1];
107045                      if (r + o === 0) continue;
107046                      const a = r / (r + o);
107047                      const l = o / (r + o);
107048                      t.SelfMulSub(this.m_k2 * a * (this.m_Ls[e] - n), s);
107049                      i.SelfMulAdd(this.m_k2 * l * (this.m_Ls[e] - n), s);
107050                    }
107051                  }
107052                  SetAngle(t) {
107053                    const e = this.m_count - 2;
107054                    for (let i = 0; i < e; ++i) this.m_as[i] = t;
107055                  }
107056                  SolveC3() {
107057                    const t = this.m_count - 2;
107058                    for (let e = 0; e < t; ++e) {
107059                      const t = this.m_ps[e];
107060                      const i = this.m_ps[e + 1];
107061                      const s = this.m_ps[e + 2];
107062                      const n = this.m_ims[e];
107063                      const r = this.m_ims[e + 1];
107064                      const a = this.m_ims[e + 2];
107065                      const l = St.SubVV(i, t, _r.s_d1);
107066                      const h = St.SubVV(s, i, _r.s_d2);
107067                      const c = l.LengthSquared();
107068                      const u = h.LengthSquared();
107069                      if (c * u == 0) continue;
107070                      const _ = St.CrossVV(l, h);
107071                      const d = St.DotVV(l, h);
107072                      let p = mt(_, d);
107073                      const m = St.MulSV(-1 / c, l.SelfSkew(), _r.s_Jd1);
107074                      const f = St.MulSV(1 / u, h.SelfSkew(), _r.s_Jd2);
107075                      const g = St.NegV(m, _r.s_J1);
107076                      const y = St.SubVV(m, f, _r.s_J2);
107077                      const b = f;
107078                      let S = n * St.DotVV(g, g) + r * St.DotVV(y, y) + a * St.DotVV(b, b);
107079                      if (0 === S) continue;
107080                      S = 1 / S;
107081                      let A = p - this.m_as[e];
107082                      for (;A > o; ) {
107083                        p -= 2 * o;
107084                        A = p - this.m_as[e];
107085                      }
107086                      for (;A < -o; ) {
107087                        p += 2 * o;
107088                        A = p - this.m_as[e];
107089                      }
107090                      const T = -this.m_k3 * S * A;
107091                      t.SelfMulAdd(n * T, g);
107092                      i.SelfMulAdd(r * T, y);
107093                      s.SelfMulAdd(a * T, b);
107094                    }
107095                  }
107096                  Draw(t) {
107097                    const e = new Rt(.4, .5, .7);
107098                    for (let i = 0; i < this.m_count - 1; ++i) t.DrawSegment(this.m_ps[i], this.m_ps[i + 1], e);
107099                  }
107100                }
107101                _r.s_d = new St;
107102                _r.s_d1 = new St;
107103                _r.s_d2 = new St;
107104                _r.s_Jd1 = new St;
107105                _r.s_Jd2 = new St;
107106                _r.s_J1 = new St;
107107                _r.s_J2 = new St;
107108                t.b2AABB = ge;
107109                t.b2Abs = $;
107110                t.b2Acos = dt;
107111                t.b2Alloc = V;
107112                t.b2AreaJoint = ds;
107113                t.b2AreaJointDef = _s;
107114                t.b2Asin = pt;
107115                t.b2Assert = e;
107116                t.b2Atan2 = mt;
107117                t.b2BlockAllocator = Pt;
107118                t.b2Body = rs;
107119                t.b2BodyDef = ns;
107120                t.b2BroadPhase = Be;
107121                t.b2BuoyancyController = or;
107122                t.b2CalculateParticleIterations = fn;
107123                t.b2ChainAndCircleContact = js;
107124                t.b2ChainAndPolygonContact = Xs;
107125                t.b2ChainShape = $i;
107126                t.b2CircleContact = ks;
107127                t.b2CircleShape = Ji;
107128                t.b2Clamp = it;
107129                t.b2ClipSegmentToLine = be;
107130                t.b2ClipVertex = pe;
107131                t.b2CollideCircles = ii;
107132                t.b2CollideEdgeAndCircle = ki;
107133                t.b2CollideEdgeAndPolygon = Yi;
107134                t.b2CollidePolygonAndCircle = oi;
107135                t.b2CollidePolygons = Mi;
107136                t.b2Color = Rt;
107137                t.b2ConstantAccelController = ar;
107138                t.b2ConstantForceController = lr;
107139                t.b2Contact = Vs;
107140                t.b2ContactEdge = Fs;
107141                t.b2ContactFactory = Ys;
107142                t.b2ContactFeature = le;
107143                t.b2ContactFilter = Ks;
107144                t.b2ContactID = he;
107145                t.b2ContactImpulse = Js;
107146                t.b2ContactListener = Zs;
107147                t.b2ContactManager = tn;
107148                t.b2ContactPositionConstraint = cn;
107149                t.b2ContactRegister = Ws;
107150                t.b2ContactSolver = dn;
107151                t.b2ContactSolverDef = un;
107152                t.b2ContactVelocityConstraint = hn;
107153                t.b2Controller = rr;
107154                t.b2ControllerEdge = nr;
107155                t.b2Cos = ut;
107156                t.b2Counter = Bt;
107157                t.b2DegToRad = ht;
107158                t.b2DestructionListener = qs;
107159                t.b2Distance = Qt;
107160                t.b2DistanceInput = Ft;
107161                t.b2DistanceJoint = us;
107162                t.b2DistanceJointDef = cs;
107163                t.b2DistanceOutput = Vt;
107164                t.b2DistanceProxy = Nt;
107165                t.b2Draw = It;
107166                t.b2DynamicTree = xe;
107167                t.b2EdgeAndCircleContact = zs;
107168                t.b2EdgeAndPolygonContact = Hs;
107169                t.b2EdgeShape = Qi;
107170                t.b2Filter = ts;
107171                t.b2Fixture = ss;
107172                t.b2FixtureDef = es;
107173                t.b2FixtureParticleQueryCallback = On;
107174                t.b2FixtureProxy = is;
107175                t.b2Free = k;
107176                t.b2FrictionJoint = ms;
107177                t.b2FrictionJointDef = ps;
107178                t.b2GearJoint = gs;
107179                t.b2GearJointDef = fs;
107180                t.b2GetPointStates = de;
107181                t.b2GravityController = hr;
107182                t.b2GrowableBuffer = Pn;
107183                t.b2GrowableStack = Dt;
107184                t.b2InvSqrt = ot;
107185                t.b2IsPowerOfTwo = gt;
107186                t.b2IsValid = nt;
107187                t.b2Island = pn;
107188                t.b2Jacobian = os;
107189                t.b2Joint = hs;
107190                t.b2JointDef = ls;
107191                t.b2JointEdge = as;
107192                t.b2Log = U;
107193                t.b2MakeArray = Y;
107194                t.b2MakeNullArray = q;
107195                t.b2MakeNumberArray = K;
107196                t.b2Manifold = ue;
107197                t.b2ManifoldPoint = ce;
107198                t.b2MassData = qi;
107199                t.b2Mat22 = vt;
107200                t.b2Mat33 = Et;
107201                t.b2Max = et;
107202                t.b2Maybe = i;
107203                t.b2Min = tt;
107204                t.b2MixFriction = Ns;
107205                t.b2MixRestitution = Ls;
107206                t.b2MotorJoint = bs;
107207                t.b2MotorJointDef = ys;
107208                t.b2MouseJoint = As;
107209                t.b2MouseJointDef = Ss;
107210                t.b2NextPowerOfTwo = ft;
107211                t.b2Pair = Me;
107212                t.b2PairLessThan = De;
107213                t.b2ParseInt = X;
107214                t.b2ParseUInt = W;
107215                t.b2ParticleBodyContact = Ln;
107216                t.b2ParticleContact = Nn;
107217                t.b2ParticleDef = mn;
107218                t.b2ParticleGroup = bn;
107219                t.b2ParticleGroupDef = yn;
107220                t.b2ParticleHandle = gn;
107221                t.b2ParticlePair = Fn;
107222                t.b2ParticlePairSet = Kn;
107223                t.b2ParticleSystem = Un;
107224                t.b2ParticleSystemDef = kn;
107225                t.b2ParticleSystem_CompositeShape = $n;
107226                t.b2ParticleSystem_ConnectionFilter = Jn;
107227                t.b2ParticleSystem_DestroyParticlesInShapeCallback = Zn;
107228                t.b2ParticleSystem_FixedSetAllocator = Xn;
107229                t.b2ParticleSystem_FixtureParticle = Wn;
107230                t.b2ParticleSystem_FixtureParticleSet = Yn;
107231                t.b2ParticleSystem_InsideBoundsEnumerator = Hn;
107232                t.b2ParticleSystem_JoinParticleGroupsFilter = Qn;
107233                t.b2ParticleSystem_ParticleListNode = jn;
107234                t.b2ParticleSystem_ParticlePair = qn;
107235                t.b2ParticleSystem_Proxy = zn;
107236                t.b2ParticleSystem_ReactiveFilter = tr;
107237                t.b2ParticleSystem_SolveCollisionCallback = ir;
107238                t.b2ParticleSystem_UpdateBodyContactsCallback = er;
107239                t.b2ParticleSystem_UserOverridableBuffer = Gn;
107240                t.b2ParticleTriad = Vn;
107241                t.b2PolygonAndCircleContact = Gs;
107242                t.b2PolygonContact = Us;
107243                t.b2PolygonShape = Zi;
107244                t.b2Position = nn;
107245                t.b2PositionSolverManifold = _n;
107246                t.b2Pow = lt;
107247                t.b2PrismaticJoint = vs;
107248                t.b2PrismaticJointDef = Ts;
107249                t.b2Profile = en;
107250                t.b2PulleyJoint = xs;
107251                t.b2PulleyJointDef = Cs;
107252                t.b2QueryCallback = Qs;
107253                t.b2RadToDeg = ct;
107254                t.b2Random = yt;
107255                t.b2RandomRange = bt;
107256                t.b2RayCastCallback = $s;
107257                t.b2RayCastInput = me;
107258                t.b2RayCastOutput = fe;
107259                t.b2RevoluteJoint = Rs;
107260                t.b2RevoluteJointDef = ws;
107261                t.b2Rope = _r;
107262                t.b2RopeDef = ur;
107263                t.b2RopeJoint = Ms;
107264                t.b2RopeJointDef = Is;
107265                t.b2Rot = Ct;
107266                t.b2SeparationFunction = He;
107267                t.b2Shape = Ki;
107268                t.b2ShapeCast = ae;
107269                t.b2ShapeCastInput = kt;
107270                t.b2ShapeCastOutput = Ut;
107271                t.b2Simplex = Ht;
107272                t.b2SimplexCache = Lt;
107273                t.b2SimplexVertex = zt;
107274                t.b2Sin = _t;
107275                t.b2SolverData = on;
107276                t.b2Sq = rt;
107277                t.b2Sqrt = at;
107278                t.b2StackAllocator = Ot;
107279                t.b2Swap = st;
107280                t.b2Sweep = wt;
107281                t.b2TOIInput = Ge;
107282                t.b2TOIOutput = ze;
107283                t.b2TensorDampingController = cr;
107284                t.b2TestOverlapAABB = ye;
107285                t.b2TestOverlapShape = ve;
107286                t.b2TimeOfImpact = $e;
107287                t.b2TimeStep = sn;
107288                t.b2Timer = Mt;
107289                t.b2Transform = xt;
107290                t.b2TreeNode = Ce;
107291                t.b2Vec2 = St;
107292                t.b2Vec2_zero = At;
107293                t.b2Vec3 = Tt;
107294                t.b2Velocity = rn;
107295                t.b2VelocityConstraintPoint = ln;
107296                t.b2Version = G;
107297                t.b2WeldJoint = Ds;
107298                t.b2WeldJointDef = Bs;
107299                t.b2WheelJoint = Os;
107300                t.b2WheelJointDef = Ps;
107301                t.b2World = sr;
107302                t.b2WorldManifold = _e;
107303                t.b2_180_over_pi = Z;
107304                t.b2_aabbExtension = h;
107305                t.b2_aabbMultiplier = c;
107306                t.b2_angularSleepTolerance = F;
107307                t.b2_angularSlop = _;
107308                t.b2_barrierCollisionTime = O;
107309                t.b2_baumgarte = v;
107310                t.b2_branch = H;
107311                t.b2_commit = j;
107312                t.b2_epsilon = n;
107313                t.b2_epsilon_sq = r;
107314                t.b2_gjk_reset = Gt;
107315                t.b2_invalidParticleIndex = C;
107316                t.b2_linearSleepTolerance = L;
107317                t.b2_linearSlop = u;
107318                t.b2_maxAngularCorrection = y;
107319                t.b2_maxFloat = s;
107320                t.b2_maxLinearCorrection = g;
107321                t.b2_maxManifoldPoints = a;
107322                t.b2_maxParticleForce = M;
107323                t.b2_maxParticleIndex = x;
107324                t.b2_maxParticlePressure = I;
107325                t.b2_maxPolygonVertices = l;
107326                t.b2_maxRotation = A;
107327                t.b2_maxRotationSquared = T;
107328                t.b2_maxSubSteps = p;
107329                t.b2_maxTOIContacts = m;
107330                t.b2_maxTranslation = b;
107331                t.b2_maxTranslationSquared = S;
107332                t.b2_maxTriadDistance = B;
107333                t.b2_maxTriadDistanceSquared = D;
107334                t.b2_minParticleSystemBufferCapacity = P;
107335                t.b2_minParticleWeight = R;
107336                t.b2_minPulleyLength = Es;
107337                t.b2_particleStride = w;
107338                t.b2_pi = o;
107339                t.b2_pi_over_180 = J;
107340                t.b2_polygonRadius = d;
107341                t.b2_timeToSleep = N;
107342                t.b2_toiBaumgarte = E;
107343                t.b2_toi_reset = Pe;
107344                t.b2_two_pi = Q;
107345                t.b2_velocityThreshold = f;
107346                t.b2_version = z;
107347                t.g_blockSolve = an;
107348                Object.defineProperty(t, "__esModule", {
107349                  value: !0
107350                });
107351              }(e);
107352            }));
107353            (fbt = mbt) && fbt.__esModule && Object.prototype.hasOwnProperty.call(fbt, "default") && fbt.default;
107354            var fbt;
107355            let gbt = {};
107356            for (var ybt in mbt) {
107357              if (-1 !== ybt.indexOf("b2_")) continue;
107358              gbt[ybt.replace("b2", "")] = mbt[ybt];
107359            }
107360            var bbt = gbt;
107361            let Sbt;
107362            !function(t) {
107363              t[t.Static = 0] = "Static";
107364              t[t.Kinematic = 1] = "Kinematic";
107365              t[t.Dynamic = 2] = "Dynamic";
107366              t[t.Animated = 3] = "Animated";
107367            }(Sbt || (Sbt = t("ERigidBody2DType", {})));
107368            oe(Sbt);
107369            let Abt;
107370            !function(t) {
107371              t[t.None = 0] = "None";
107372              t[t.BOX = 1] = "BOX";
107373              t[t.CIRCLE = 2] = "CIRCLE";
107374              t[t.POLYGON = 3] = "POLYGON";
107375            }(Abt || (Abt = t("ECollider2DType", {})));
107376            oe(Abt);
107377            let Tbt;
107378            !function(t) {
107379              t[t.None = 0] = "None";
107380              t[t.DISTANCE = 1] = "DISTANCE";
107381              t[t.SPRING = 2] = "SPRING";
107382              t[t.WHEEL = 3] = "WHEEL";
107383              t[t.MOUSE = 4] = "MOUSE";
107384              t[t.FIXED = 5] = "FIXED";
107385              t[t.SLIDER = 6] = "SLIDER";
107386              t[t.RELATIVE = 7] = "RELATIVE";
107387              t[t.HINGE = 8] = "HINGE";
107388            }(Tbt || (Tbt = t("EJoint2DType", {})));
107389            oe(Tbt);
107390            let vbt;
107391            !function(t) {
107392              t[t.DEFAULT = 1] = "DEFAULT";
107393            }(vbt || (vbt = t("PhysicsGroup", {})));
107394            oe(vbt);
107395            let Ebt;
107396            !function(t) {
107397              t[t.Closest = 0] = "Closest";
107398              t[t.Any = 1] = "Any";
107399              t[t.AllClosest = 2] = "AllClosest";
107400              t[t.All = 3] = "All";
107401            }(Ebt || (Ebt = t("ERaycast2DType", {})));
107402            const Cbt = t("Contact2DType", {
107403              None: "none-contact",
107404              BEGIN_CONTACT: "begin-contact",
107405              END_CONTACT: "end-contact",
107406              PRE_SOLVE: "pre-solve",
107407              POST_SOLVE: "post-solve"
107408            });
107409            let xbt;
107410            !function(t) {
107411              t[t.None = 0] = "None";
107412              t[t.Shape = 1] = "Shape";
107413              t[t.Joint = 2] = "Joint";
107414              t[t.Aabb = 4] = "Aabb";
107415              t[t.Pair = 8] = "Pair";
107416              t[t.CenterOfMass = 16] = "CenterOfMass";
107417              t[t.Particle = 32] = "Particle";
107418              t[t.Controller = 64] = "Controller";
107419              t[t.All = 63] = "All";
107420            }(xbt || (xbt = t("EPhysics2DDrawFlags", {})));
107421            const wbt = t("PHYSICS_2D_PTM_RATIO", 32);
107422            class Rbt extends bbt.ContactListener {
107423              constructor(...t) {
107424                super(...t);
107425                this._contactFixtures = [];
107426                this._BeginContact = null;
107427                this._EndContact = null;
107428                this._PreSolve = null;
107429                this._PostSolve = null;
107430              }
107431              setBeginContact(t) {
107432                this._BeginContact = t;
107433              }
107434              setEndContact(t) {
107435                this._EndContact = t;
107436              }
107437              setPreSolve(t) {
107438                this._PreSolve = t;
107439              }
107440              setPostSolve(t) {
107441                this._PostSolve = t;
107442              }
107443              BeginContact(t) {
107444                if (!this._BeginContact) return;
107445                const e = t.GetFixtureA();
107446                const i = t.GetFixtureB();
107447                const s = this._contactFixtures;
107448                t._shouldReport = !1;
107449                if (-1 !== s.indexOf(e) || -1 !== s.indexOf(i)) {
107450                  t._shouldReport = !0;
107451                  this._BeginContact(t);
107452                }
107453              }
107454              EndContact(t) {
107455                if (this._EndContact && t._shouldReport) {
107456                  t._shouldReport = !1;
107457                  this._EndContact(t);
107458                }
107459              }
107460              PreSolve(t, e) {
107461                this._PreSolve && t._shouldReport && this._PreSolve(t, e);
107462              }
107463              PostSolve(t, e) {
107464                this._PostSolve && t._shouldReport && this._PostSolve(t, e);
107465              }
107466              registerContactFixture(t) {
107467                this._contactFixtures.push(t);
107468              }
107469              unregisterContactFixture(t) {
107470                at(this._contactFixtures, t);
107471              }
107472            }
107473            class Ibt extends bbt.QueryCallback {
107474              constructor(...t) {
107475                super(...t);
107476                this._point = new bbt.Vec2;
107477                this._isPoint = !1;
107478                this._fixtures = [];
107479              }
107480              init(t) {
107481                if (t) {
107482                  this._isPoint = !0;
107483                  this._point.x = t.x;
107484                  this._point.y = t.y;
107485                } else this._isPoint = !1;
107486                this._fixtures.length = 0;
107487              }
107488              ReportFixture(t) {
107489                this._isPoint ? t.TestPoint(this._point) && this._fixtures.push(t) : this._fixtures.push(t);
107490                return !0;
107491              }
107492              getFixture() {
107493                return this._fixtures[0];
107494              }
107495              getFixtures() {
107496                return this._fixtures;
107497              }
107498            }
107499            function Mbt(t, e) {
107500              const i = e.length;
107501              return e[t < 0 ? i - -t % i : t % i];
107502            }
107503            function Bbt(t, e, i) {
107504              const s = [];
107505              for (;e < t; ) e += i.length;
107506              for (;t <= e; ++t) s.push(Mbt(t, i));
107507              return s;
107508            }
107509            function Dbt(t) {
107510              Ubt(t);
107511              let e = [];
107512              let i;
107513              let s;
107514              let n;
107515              let r;
107516              let o = new Qi;
107517              let a = new Qi;
107518              let l = 0;
107519              let h = 0;
107520              let c;
107521              let u;
107522              for (let _ = 0; _ < t.length; ++_) if (Obt(_, t)) {
107523                s = n = 1e8;
107524                for (let e = 0; e < t.length; ++e) {
107525                  if (Lbt(Mbt(_ - 1, t), Mbt(_, t), Mbt(e, t)) && Vbt(Mbt(_ - 1, t), Mbt(_, t), Mbt(e - 1, t))) {
107526                    r = zbt(Mbt(_ - 1, t), Mbt(_, t), Mbt(e, t), Mbt(e - 1, t));
107527                    if (Nbt(Mbt(_ + 1, t), Mbt(_, t), r)) {
107528                      i = kbt(Mbt(_, t), r);
107529                      if (i < s) {
107530                        s = i;
107531                        o = r;
107532                        l = e;
107533                      }
107534                    }
107535                  }
107536                  if (Lbt(Mbt(_ + 1, t), Mbt(_, t), Mbt(e + 1, t)) && Vbt(Mbt(_ + 1, t), Mbt(_, t), Mbt(e, t))) {
107537                    r = zbt(Mbt(_ + 1, t), Mbt(_, t), Mbt(e, t), Mbt(e + 1, t));
107538                    if (Lbt(Mbt(_ - 1, t), Mbt(_, t), r)) {
107539                      i = kbt(Mbt(_, t), r);
107540                      if (i < n) {
107541                        n = i;
107542                        h = e;
107543                        a = r;
107544                      }
107545                    }
107546                  }
107547                }
107548                if (l == (h + 1) % t.length) {
107549                  const e = o.add(a).multiplyScalar(.5);
107550                  c = Bbt(_, h, t);
107551                  c.push(e);
107552                  u = Bbt(l, _, t);
107553                  u.push(e);
107554                } else {
107555                  let e = 0;
107556                  let i = l;
107557                  for (;h < l; ) h += t.length;
107558                  for (let s = l; s <= h; ++s) if (Pbt(_, s, t)) {
107559                    let n = 1 / (kbt(Mbt(_, t), Mbt(s, t)) + 1);
107560                    Obt(s, t) ? Vbt(Mbt(s - 1, t), Mbt(s, t), Mbt(_, t)) && Fbt(Mbt(s + 1, t), Mbt(s, t), Mbt(_, t)) ? n += 3 : n += 2 : n += 1;
107561                    if (n > e) {
107562                      i = s;
107563                      e = n;
107564                    }
107565                  }
107566                  c = Bbt(_, i, t);
107567                  u = Bbt(i, _, t);
107568                }
107569                e = e.concat(Dbt(c));
107570                e = e.concat(Dbt(u));
107571                return e;
107572              }
107573              e.push(t);
107574              for (let t = e.length - 1; t >= 0; t--) 0 == e[t].length && e.splice(t, 0);
107575              return e;
107576            }
107577            function Pbt(t, e, i) {
107578              if (Obt(t, i)) {
107579                if (Fbt(Mbt(t, i), Mbt(t - 1, i), Mbt(e, i)) && Vbt(Mbt(t, i), Mbt(t + 1, i), Mbt(e, i))) return !1;
107580              } else if (Vbt(Mbt(t, i), Mbt(t + 1, i), Mbt(e, i)) || Fbt(Mbt(t, i), Mbt(t - 1, i), Mbt(e, i))) return !1;
107581              if (Obt(e, i)) {
107582                if (Fbt(Mbt(e, i), Mbt(e - 1, i), Mbt(t, i)) && Vbt(Mbt(e, i), Mbt(e + 1, i), Mbt(t, i))) return !1;
107583              } else if (Vbt(Mbt(e, i), Mbt(e + 1, i), Mbt(t, i)) || Fbt(Mbt(e, i), Mbt(e - 1, i), Mbt(t, i))) return !1;
107584              for (let s = 0; s < i.length; ++s) {
107585                if ((s + 1) % i.length == t || s == t || (s + 1) % i.length == e || s == e) continue;
107586                const n = new Qi;
107587                if (Hbt(Mbt(t, i), Mbt(e, i), Mbt(s, i), Mbt(s + 1, i), n)) return !1;
107588              }
107589              return !0;
107590            }
107591            function Obt(t, e) {
107592              return Nbt(t, e);
107593            }
107594            function Nbt(t, e, i) {
107595              if (void 0 === i) {
107596                const s = t;
107597                const n = e;
107598                t = Mbt(s - 1, n);
107599                e = Mbt(s, n);
107600                void 0 === t && (t = e);
107601                void 0 === (i = Mbt(s + 1, n)) && (i = e);
107602              }
107603              return jbt(t, e, i) < 0;
107604            }
107605            function Lbt(t, e, i) {
107606              return jbt(t, e, i) > 0;
107607            }
107608            function Fbt(t, e, i) {
107609              return jbt(t, e, i) >= 0;
107610            }
107611            function Vbt(t, e, i) {
107612              return jbt(t, e, i) <= 0;
107613            }
107614            function kbt(t, e) {
107615              const i = e.x - t.x;
107616              const s = e.y - t.y;
107617              return i * i + s * s;
107618            }
107619            function Ubt(t) {
107620              Gbt(t) || t.reverse();
107621            }
107622            function Gbt(t) {
107623              return t.length < 3 || function(t) {
107624                let e;
107625                let i = 0;
107626                for (e = 0; e < t.length; e++) {
107627                  const s = (e + 1) % t.length;
107628                  i += t[e].x * t[s].y;
107629                  i -= t[e].y * t[s].x;
107630                }
107631                i /= 2;
107632                return i;
107633              }(t) > 0;
107634            }
107635            function zbt(t, e, i, s) {
107636              const n = new Qi;
107637              const r = e.y - t.y;
107638              const o = t.x - e.x;
107639              const a = r * t.x + o * t.y;
107640              const l = s.y - i.y;
107641              const h = i.x - s.x;
107642              const c = l * i.x + h * i.y;
107643              const u = r * h - l * o;
107644              if (!(_ = u, d = 0, Math.abs(_ - d) <= 1e-6)) {
107645                n.x = (h * a - o * c) / u;
107646                n.y = (r * c - l * a) / u;
107647              }
107648              var _, d;
107649              return n;
107650            }
107651            function Hbt(t, e, i, s, n) {
107652              if (t == i || t == s || e == i || e == s) return !1;
107653              const r = t.x;
107654              const o = t.y;
107655              const a = e.x;
107656              const l = e.y;
107657              const h = i.x;
107658              const c = i.y;
107659              const u = s.x;
107660              const _ = s.y;
107661              if (Math.max(r, a) < Math.min(h, u) || Math.max(h, u) < Math.min(r, a)) return !1;
107662              if (Math.max(o, l) < Math.min(c, _) || Math.max(c, _) < Math.min(o, l)) return !1;
107663              let d = (u - h) * (o - c) - (_ - c) * (r - h);
107664              let p = (a - r) * (o - c) - (l - o) * (r - h);
107665              const m = (_ - c) * (a - r) - (u - h) * (l - o);
107666              if (Math.abs(m) < 1e-6) return !1;
107667              d /= m;
107668              p /= m;
107669              if (d > 0 && d < 1 && p > 0 && p < 1) {
107670                n.x = r + d * (a - r);
107671                n.y = o + d * (l - o);
107672                return !0;
107673              }
107674              return !1;
107675            }
107676            function jbt(t, e, i) {
107677              return t.x * (e.y - i.y) + e.x * (i.y - t.y) + i.x * (t.y - e.y);
107678            }
107679            var Xbt = Object.freeze({
107680              __proto__: null,
107681              ConvexPartition: Dbt,
107682              ForceCounterClockWise: Ubt,
107683              IsCounterClockWise: Gbt
107684            });
107685            const Wbt = (...t) => 0;
107686            function Ybt(t) {
107687              if (null == t) {
107688                F(9600);
107689                return !0;
107690              }
107691              return !1;
107692            }
107693            const qbt = {
107694              impl: null,
107695              rigidBody: null,
107696              isAwake: !1,
107697              isSleeping: !1,
107698              initialize: Wbt,
107699              setType: Wbt,
107700              setLinearDamping: Wbt,
107701              setAngularDamping: Wbt,
107702              setGravityScale: Wbt,
107703              setFixedRotation: Wbt,
107704              setAllowSleep: Wbt,
107705              isActive: Wbt,
107706              setActive: Wbt,
107707              wakeUp: Wbt,
107708              sleep: Wbt,
107709              getMass: Wbt,
107710              getInertia: Wbt,
107711              getLinearVelocity: Wbt,
107712              setLinearVelocity: Wbt,
107713              getLinearVelocityFromWorldPoint: Wbt,
107714              getAngularVelocity: Wbt,
107715              setAngularVelocity: Wbt,
107716              getLocalVector: Wbt,
107717              getWorldVector: Wbt,
107718              getLocalPoint: Wbt,
107719              getWorldPoint: Wbt,
107720              getLocalCenter: Wbt,
107721              getWorldCenter: Wbt,
107722              applyForce: Wbt,
107723              applyForceToCenter: Wbt,
107724              applyTorque: Wbt,
107725              applyLinearImpulse: Wbt,
107726              applyLinearImpulseToCenter: Wbt,
107727              applyAngularImpulse: Wbt,
107728              onEnable: Wbt,
107729              onDisable: Wbt,
107730              onDestroy: Wbt
107731            };
107732            const Kbt = {
107733              INITED: !1
107734            };
107735            const Jbt = {
107736              impl: null,
107737              collider: null,
107738              worldAABB: null,
107739              worldPoints: null,
107740              worldPosition: null,
107741              worldRadius: null,
107742              initialize: Wbt,
107743              apply: Wbt,
107744              onLoad: Wbt,
107745              onEnable: Wbt,
107746              onDisable: Wbt,
107747              onDestroy: Wbt,
107748              onGroupChanged: Wbt
107749            };
107750            function Zbt(t) {
107751              !function() {
107752                if (Kbt.INITED) return;
107753                Kbt.INITED = !0;
107754                Kbt[Abt.BOX] = function() {
107755                  return Ybt(dbt.BoxShape) ? Jbt : new dbt.BoxShape;
107756                };
107757                Kbt[Abt.CIRCLE] = function() {
107758                  return Ybt(dbt.CircleShape) ? Jbt : new dbt.CircleShape;
107759                };
107760                Kbt[Abt.POLYGON] = function() {
107761                  return Ybt(dbt.PolygonShape) ? Jbt : new dbt.PolygonShape;
107762                };
107763              }();
107764              return Kbt[t]();
107765            }
107766            const Qbt = {
107767              INITED: !1
107768            };
107769            const $bt = {
107770              impl: null,
107771              initialize: Wbt,
107772              setDampingRatio: Wbt,
107773              setFrequency: Wbt,
107774              setMaxForce: Wbt,
107775              setTarget: Wbt,
107776              setDistance: Wbt,
107777              setAngularOffset: Wbt,
107778              setCorrectionFactor: Wbt,
107779              setLinearOffset: Wbt,
107780              setMaxLength: Wbt,
107781              setMaxTorque: Wbt,
107782              setLowerLimit: Wbt,
107783              setUpperLimit: Wbt,
107784              setMaxMotorForce: Wbt,
107785              setMaxMotorTorque: Wbt,
107786              setMotorSpeed: Wbt,
107787              enableLimit: Wbt,
107788              enableMotor: Wbt,
107789              setLowerAngle: Wbt,
107790              setUpperAngle: Wbt
107791            };
107792            function tSt(t) {
107793              !function() {
107794                if (Qbt.INITED) return;
107795                Qbt.INITED = !0;
107796                const t = m._global.CC_PHYSICS_2D_BUILTIN;
107797                Qbt[Tbt.SPRING] = function() {
107798                  return t || Ybt(dbt.SpringJoint) ? $bt : new dbt.SpringJoint;
107799                };
107800                Qbt[Tbt.DISTANCE] = function() {
107801                  return t || Ybt(dbt.DistanceJoint) ? $bt : new dbt.DistanceJoint;
107802                };
107803                Qbt[Tbt.FIXED] = function() {
107804                  return t || Ybt(dbt.FixedJoint) ? $bt : new dbt.FixedJoint;
107805                };
107806                Qbt[Tbt.MOUSE] = function() {
107807                  return t || Ybt(dbt.MouseJoint) ? $bt : new dbt.MouseJoint;
107808                };
107809                Qbt[Tbt.RELATIVE] = function() {
107810                  return t || Ybt(dbt.RelativeJoint) ? $bt : new dbt.RelativeJoint;
107811                };
107812                Qbt[Tbt.SLIDER] = function() {
107813                  return t || Ybt(dbt.SliderJoint) ? $bt : new dbt.SliderJoint;
107814                };
107815                Qbt[Tbt.WHEEL] = function() {
107816                  return t || Ybt(dbt.WheelJoint) ? $bt : new dbt.WheelJoint;
107817                };
107818                Qbt[Tbt.HINGE] = function() {
107819                  return t || Ybt(dbt.HingeJoint) ? $bt : new dbt.HingeJoint;
107820                };
107821              }();
107822              return Qbt[t]();
107823            }
107824            let eSt;
107825            !function(t) {
107826              t[t.DYNAMIC = 1] = "DYNAMIC";
107827              t[t.STATIC = 2] = "STATIC";
107828              t[t.KINEMATIC = 4] = "KINEMATIC";
107829            }(eSt || (eSt = t("ERigidBodyType", {})));
107830            oe(eSt);
107831            let iSt;
107832            !function(t) {
107833              t[t.X_AXIS = 0] = "X_AXIS";
107834              t[t.Y_AXIS = 1] = "Y_AXIS";
107835              t[t.Z_AXIS = 2] = "Z_AXIS";
107836            }(iSt || (iSt = t("EAxisDirection", {})));
107837            oe(iSt);
107838            let sSt;
107839            !function(t) {
107840              t[t.VERTEX = 1] = "VERTEX";
107841              t[t.LINE = 2] = "LINE";
107842              t[t.TRIANGLE = 3] = "TRIANGLE";
107843              t[t.TETRAHEDRON = 4] = "TETRAHEDRON";
107844            }(sSt || (sSt = {}));
107845            oe(sSt);
107846            let nSt;
107847            !function(t) {
107848              t[t.BOX = 0] = "BOX";
107849              t[t.SPHERE = 1] = "SPHERE";
107850              t[t.CAPSULE = 2] = "CAPSULE";
107851              t[t.CYLINDER = 3] = "CYLINDER";
107852              t[t.CONE = 4] = "CONE";
107853              t[t.MESH = 5] = "MESH";
107854              t[t.PLANE = 6] = "PLANE";
107855              t[t.SIMPLEX = 7] = "SIMPLEX";
107856              t[t.TERRAIN = 8] = "TERRAIN";
107857            }(nSt || (nSt = {}));
107858            oe(nSt);
107859            let rSt;
107860            !function(t) {
107861              t[t.POINT_TO_POINT = 0] = "POINT_TO_POINT";
107862              t[t.HINGE = 1] = "HINGE";
107863              t[t.CONE_TWIST = 2] = "CONE_TWIST";
107864            }(rSt || (rSt = {}));
107865            oe(rSt);
107866            let oSt;
107867            !function(t) {
107868              t[t.DEFAULT = 1] = "DEFAULT";
107869            }(oSt || (oSt = {}));
107870            oe(oSt);
107871            class aSt {
107872              constructor(t) {
107873                if (1 === t) {
107874                  const t = this;
107875                  for (let e = 0; e < 32; e++) {
107876                    const i = "_" + (1 << e);
107877                    t[i] = 0;
107878                    t.updateArray = [];
107879                    Object.defineProperty(t, 1 << e, {
107880                      get() {
107881                        return this[i];
107882                      },
107883                      set(t) {
107884                        if (this[i] !== t) {
107885                          this[i] = t;
107886                          this.updateArray.indexOf(e) < 0 && this.updateArray.push(e);
107887                        }
107888                      }
107889                    });
107890                  }
107891                  this._1 = oSt.DEFAULT;
107892                } else {
107893                  for (let t = 0; t < 32; t++) {
107894                    this[`${1 << t}`] = 0;
107895                  }
107896                  this[1] = oSt.DEFAULT;
107897                }
107898              }
107899            }
107900            let lSt = null;
107901            m.internal.PhysicsGroup2D = vbt;
107902            class hSt extends(To(Tg)){
107903              get enable() {
107904                return this._enable;
107905              }
107906              set enable(t) {
107907                this._enable = t;
107908              }
107909              get allowSleep() {
107910                return this._allowSleep;
107911              }
107912              set allowSleep(t) {
107913                this._allowSleep = t;
107914                this.physicsWorld.setAllowSleep(t);
107915              }
107916              get gravity() {
107917                return this._gravity;
107918              }
107919              set gravity(t) {
107920                this._gravity.set(t);
107921                this.physicsWorld.setGravity(new Qi(t.x / wbt, t.y / wbt));
107922              }
107923              get maxSubSteps() {
107924                return this._maxSubSteps;
107925              }
107926              set maxSubSteps(t) {
107927                this._maxSubSteps = t;
107928              }
107929              get fixedTimeStep() {
107930                return this._fixedTimeStep;
107931              }
107932              set fixedTimeStep(t) {
107933                this._fixedTimeStep = t;
107934              }
107935              get autoSimulation() {
107936                return this._autoSimulation;
107937              }
107938              set autoSimulation(t) {
107939                this._autoSimulation = t;
107940              }
107941              get debugDrawFlags() {
107942                return this.physicsWorld.debugDrawFlags;
107943              }
107944              set debugDrawFlags(t) {
107945                this.physicsWorld.debugDrawFlags = t;
107946              }
107947              static get PHYSICS_NONE() {
107948                return !pbt;
107949              }
107950              static get PHYSICS_BUILTIN() {
107951                return "builtin" === pbt;
107952              }
107953              static get PHYSICS_BOX2D() {
107954                return "box2d" === pbt;
107955              }
107956              static get PhysicsGroup() {
107957                return vbt;
107958              }
107959              static get instance() {
107960                lSt || (lSt = new hSt);
107961                return lSt;
107962              }
107963              get stepping() {
107964                return this._steping;
107965              }
107966              constructor() {
107967                var t, e, i, s;
107968                super();
107969                this.velocityIterations = 10;
107970                this.positionIterations = 10;
107971                this.physicsWorld = void 0;
107972                this.collisionMatrix = new aSt;
107973                this._enable = !0;
107974                this._allowSleep = !0;
107975                this._maxSubSteps = 1;
107976                this._fixedTimeStep = 1 / 60;
107977                this._autoSimulation = !0;
107978                this._accumulator = 0;
107979                this._steping = !1;
107980                this._gravity = new Qi(0, -10 * wbt);
107981                this._delayEvents = [];
107982                const n = de.querySettings(_e.Category.PHYSICS, "gravity");
107983                if (n) {
107984                  Qi.copy(this._gravity, n);
107985                  this._gravity.multiplyScalar(wbt);
107986                }
107987                this._allowSleep = null !== (t = de.querySettings(_e.Category.PHYSICS, "allowSleep")) && void 0 !== t ? t : this._allowSleep;
107988                this._fixedTimeStep = null !== (e = de.querySettings(_e.Category.PHYSICS, "fixedTimeStep")) && void 0 !== e ? e : this._fixedTimeStep;
107989                this._maxSubSteps = null !== (i = de.querySettings(_e.Category.PHYSICS, "maxSubSteps")) && void 0 !== i ? i : this._maxSubSteps;
107990                this._autoSimulation = null !== (s = de.querySettings(_e.Category.PHYSICS, "autoSimulation")) && void 0 !== s ? s : this._autoSimulation;
107991                const r = de.querySettings(_e.Category.PHYSICS, "collisionMatrix");
107992                if (r) for (const t in r) {
107993                  const e = parseInt(t);
107994                  const i = 1 << parseInt(t);
107995                  this.collisionMatrix[`${i}`] = r[e];
107996                }
107997                const o = de.querySettings(_e.Category.PHYSICS, "collisionGroups");
107998                if (o) {
107999                  const t = o;
108000                  if (t instanceof Array) {
108001                    t.forEach((t => {
108002                      vbt[t.name] = 1 << t.index;
108003                    }));
108004                    oe.update(vbt);
108005                  }
108006                }
108007                this.physicsWorld = Ybt(dbt.PhysicsWorld) ? null : new dbt.PhysicsWorld;
108008                this.gravity = this._gravity;
108009                this.allowSleep = this._allowSleep;
108010              }
108011              postUpdate(t) {
108012                if (!this._enable) return;
108013                if (!this._autoSimulation) return;
108014                IR.emit(RR.EVENT_BEFORE_PHYSICS);
108015                this._steping = !0;
108016                const e = this._fixedTimeStep;
108017                const i = this.velocityIterations;
108018                const s = this.positionIterations;
108019                this._accumulator += t;
108020                let n = 0;
108021                for (;n++ < this._maxSubSteps && this._accumulator > e; ) {
108022                  this.physicsWorld.step(e, i, s);
108023                  this._accumulator -= e;
108024                }
108025                const r = this._delayEvents;
108026                for (let t = 0, e = r.length; t < e; t++) {
108027                  const e = r[t];
108028                  e.func.call(e.target);
108029                }
108030                r.length = 0;
108031                this.physicsWorld.syncPhysicsToScene();
108032                this.debugDrawFlags && this.physicsWorld.drawDebug();
108033                this._steping = !1;
108034                IR.emit(RR.EVENT_AFTER_PHYSICS);
108035              }
108036              _callAfterStep(t, e) {
108037                this._steping ? this._delayEvents.push({
108038                  target: t,
108039                  func: e
108040                }) : e.call(t);
108041              }
108042              resetAccumulator(t = 0) {
108043                this._accumulator = t;
108044              }
108045              step(t) {
108046                this.physicsWorld.step(t, this.velocityIterations, this.positionIterations);
108047              }
108048              raycast(t, e, i = Ebt.Closest, s = 4294967295) {
108049                return this.physicsWorld.raycast(t, e, i, s);
108050              }
108051              testPoint(t) {
108052                return this.physicsWorld.testPoint(t);
108053              }
108054              testAABB(t) {
108055                return this.physicsWorld.testAABB(t);
108056              }
108057            }
108058            t("PhysicsSystem2D", hSt);
108059            hSt.ID = "PHYSICS_2D";
108060            IR.once(RR.EVENT_INIT, (() => {
108061              hSt.PHYSICS_NONE || IR.registerSystem(hSt.ID, hSt.instance, Tg.Priority.LOW);
108062            }));
108063            let cSt;
108064            !function(t) {
108065              t[t.Circles = 0] = "Circles";
108066              t[t.FaceA = 1] = "FaceA";
108067              t[t.FaceB = 2] = "FaceB";
108068            }(cSt || (cSt = t("Physics2DManifoldType", {})));
108069            var uSt, _St, dSt, pSt, mSt, fSt, gSt, ySt, bSt, SSt, ASt, TSt, vSt, ESt, CSt, xSt, wSt, RSt, ISt;
108070            const {property: MSt, type: BSt, menu: DSt} = wh;
108071            let PSt = t("RigidBody2D", (uSt = Ul("cc.RigidBody2D"), _St = DSt("Physics2D/RigidBody2D"),
108072            dSt = BSt(oSt), pSt = BSt(Sbt), uSt(mSt = _St(mSt = (fSt = (ISt = class extends Qc {
108073              constructor(...t) {
108074                super(...t);
108075                Ml(this, "enabledContactListener", gSt, this);
108076                Ml(this, "bullet", ySt, this);
108077                Ml(this, "awakeOnLoad", bSt, this);
108078                this._body = null;
108079                Ml(this, "_group", SSt, this);
108080                Ml(this, "_type", ASt, this);
108081                Ml(this, "_allowSleep", TSt, this);
108082                Ml(this, "_gravityScale", vSt, this);
108083                Ml(this, "_linearDamping", ESt, this);
108084                Ml(this, "_angularDamping", CSt, this);
108085                Ml(this, "_linearVelocity", xSt, this);
108086                Ml(this, "_angularVelocity", wSt, this);
108087                Ml(this, "_fixedRotation", RSt, this);
108088              }
108089              get group() {
108090                return this._group;
108091              }
108092              set group(t) {
108093                this._group = t;
108094              }
108095              get type() {
108096                return this._type;
108097              }
108098              set type(t) {
108099                this._type = t;
108100                this._body && (t === Sbt.Animated ? this._body.setType(Sbt.Kinematic) : this._body.setType(t));
108101              }
108102              get allowSleep() {
108103                return this._allowSleep;
108104              }
108105              set allowSleep(t) {
108106                this._allowSleep = t;
108107                this._body && this._body.setAllowSleep(t);
108108              }
108109              get gravityScale() {
108110                return this._gravityScale;
108111              }
108112              set gravityScale(t) {
108113                this._gravityScale = t;
108114                this._body && this._body.setGravityScale(t);
108115              }
108116              get linearDamping() {
108117                return this._linearDamping;
108118              }
108119              set linearDamping(t) {
108120                this._linearDamping = t;
108121                this._body && this._body.setLinearDamping(t);
108122              }
108123              get angularDamping() {
108124                return this._angularDamping;
108125              }
108126              set angularDamping(t) {
108127                this._angularDamping = t;
108128                this._body && this._body.setAngularDamping(t);
108129              }
108130              get linearVelocity() {
108131                this._body && this._body.getLinearVelocity(this._linearVelocity);
108132                return this._linearVelocity;
108133              }
108134              set linearVelocity(t) {
108135                this._linearVelocity = t;
108136                this._body && this._body.setLinearVelocity(t);
108137              }
108138              get angularVelocity() {
108139                this._body && (this._angularVelocity = this._body.getAngularVelocity());
108140                return this._angularVelocity;
108141              }
108142              set angularVelocity(t) {
108143                this._angularVelocity = t;
108144                this._body && this._body.setAngularVelocity(t);
108145              }
108146              get fixedRotation() {
108147                return this._fixedRotation;
108148              }
108149              set fixedRotation(t) {
108150                this._fixedRotation = t;
108151                this._body && this._body.setFixedRotation(t);
108152              }
108153              isAwake() {
108154                return !!this._body && this._body.isAwake;
108155              }
108156              wakeUp() {
108157                this._body && this._body.wakeUp();
108158              }
108159              sleep() {
108160                this._body && this._body.sleep();
108161              }
108162              getMass() {
108163                return this._body ? this._body.getMass() : 0;
108164              }
108165              applyForce(t, e, i) {
108166                this._body && this._body.applyForce(t, e, i);
108167              }
108168              applyForceToCenter(t, e) {
108169                this._body && this._body.applyForceToCenter(t, e);
108170              }
108171              applyTorque(t, e) {
108172                this._body && this._body.applyTorque(t, e);
108173              }
108174              applyLinearImpulse(t, e, i) {
108175                this._body && this._body.applyLinearImpulse(t, e, i);
108176              }
108177              applyLinearImpulseToCenter(t, e) {
108178                this._body && this._body.applyLinearImpulseToCenter(t, e);
108179              }
108180              applyAngularImpulse(t, e) {
108181                this._body && this._body.applyAngularImpulse(t, e);
108182              }
108183              getLinearVelocityFromWorldPoint(t, e) {
108184                return this._body ? this._body.getLinearVelocityFromWorldPoint(t, e) : e;
108185              }
108186              getLocalVector(t, e) {
108187                return this._body ? this._body.getLocalVector(t, e) : e;
108188              }
108189              getWorldVector(t, e) {
108190                return this._body ? this._body.getWorldVector(t, e) : e;
108191              }
108192              getLocalPoint(t, e) {
108193                return this._body ? this._body.getLocalPoint(t, e) : e;
108194              }
108195              getWorldPoint(t, e) {
108196                return this._body ? this._body.getWorldPoint(t, e) : e;
108197              }
108198              getLocalCenter(t) {
108199                return this._body ? this._body.getLocalCenter(t) : t;
108200              }
108201              getWorldCenter(t) {
108202                return this._body ? this._body.getWorldCenter(t) : t;
108203              }
108204              getInertia() {
108205                this._body && this._body.getInertia();
108206                return 0;
108207              }
108208              onLoad() {
108209                this._body = m._global.CC_PHYSICS_2D_BUILTIN ? qbt : Ybt(dbt.RigidBody) ? null : new dbt.RigidBody;
108210                this._body.initialize(this);
108211              }
108212              onEnable() {
108213                this._body && this._body.onEnable();
108214              }
108215              onDisable() {
108216                this._body && this._body.onDisable();
108217              }
108218              onDestroy() {
108219                this._body && this._body.onDestroy();
108220              }
108221              get impl() {
108222                return this._body;
108223              }
108224            }, ISt), Bl(fSt.prototype, "group", [ dSt ], Object.getOwnPropertyDescriptor(fSt.prototype, "group"), fSt.prototype),
108225            gSt = Bl(fSt.prototype, "enabledContactListener", [ MSt ], {
108226              configurable: !0,
108227              enumerable: !0,
108228              writable: !0,
108229              initializer: function() {
108230                return !1;
108231              }
108232            }), ySt = Bl(fSt.prototype, "bullet", [ MSt ], {
108233              configurable: !0,
108234              enumerable: !0,
108235              writable: !0,
108236              initializer: function() {
108237                return !1;
108238              }
108239            }), Bl(fSt.prototype, "type", [ pSt ], Object.getOwnPropertyDescriptor(fSt.prototype, "type"), fSt.prototype),
108240            Bl(fSt.prototype, "allowSleep", [ MSt ], Object.getOwnPropertyDescriptor(fSt.prototype, "allowSleep"), fSt.prototype),
108241            Bl(fSt.prototype, "gravityScale", [ MSt ], Object.getOwnPropertyDescriptor(fSt.prototype, "gravityScale"), fSt.prototype),
108242            Bl(fSt.prototype, "linearDamping", [ MSt ], Object.getOwnPropertyDescriptor(fSt.prototype, "linearDamping"), fSt.prototype),
108243            Bl(fSt.prototype, "angularDamping", [ MSt ], Object.getOwnPropertyDescriptor(fSt.prototype, "angularDamping"), fSt.prototype),
108244            Bl(fSt.prototype, "linearVelocity", [ MSt ], Object.getOwnPropertyDescriptor(fSt.prototype, "linearVelocity"), fSt.prototype),
108245            Bl(fSt.prototype, "angularVelocity", [ MSt ], Object.getOwnPropertyDescriptor(fSt.prototype, "angularVelocity"), fSt.prototype),
108246            Bl(fSt.prototype, "fixedRotation", [ MSt ], Object.getOwnPropertyDescriptor(fSt.prototype, "fixedRotation"), fSt.prototype),
108247            bSt = Bl(fSt.prototype, "awakeOnLoad", [ MSt ], {
108248              configurable: !0,
108249              enumerable: !0,
108250              writable: !0,
108251              initializer: function() {
108252                return !0;
108253              }
108254            }), SSt = Bl(fSt.prototype, "_group", [ MSt ], {
108255              configurable: !0,
108256              enumerable: !0,
108257              writable: !0,
108258              initializer: function() {
108259                return oSt.DEFAULT;
108260              }
108261            }), ASt = Bl(fSt.prototype, "_type", [ MSt ], {
108262              configurable: !0,
108263              enumerable: !0,
108264              writable: !0,
108265              initializer: function() {
108266                return Sbt.Dynamic;
108267              }
108268            }), TSt = Bl(fSt.prototype, "_allowSleep", [ MSt ], {
108269              configurable: !0,
108270              enumerable: !0,
108271              writable: !0,
108272              initializer: function() {
108273                return !0;
108274              }
108275            }), vSt = Bl(fSt.prototype, "_gravityScale", [ MSt ], {
108276              configurable: !0,
108277              enumerable: !0,
108278              writable: !0,
108279              initializer: function() {
108280                return 1;
108281              }
108282            }), ESt = Bl(fSt.prototype, "_linearDamping", [ MSt ], {
108283              configurable: !0,
108284              enumerable: !0,
108285              writable: !0,
108286              initializer: function() {
108287                return 0;
108288              }
108289            }), CSt = Bl(fSt.prototype, "_angularDamping", [ MSt ], {
108290              configurable: !0,
108291              enumerable: !0,
108292              writable: !0,
108293              initializer: function() {
108294                return 0;
108295              }
108296            }), xSt = Bl(fSt.prototype, "_linearVelocity", [ MSt ], {
108297              configurable: !0,
108298              enumerable: !0,
108299              writable: !0,
108300              initializer: function() {
108301                return new Qi;
108302              }
108303            }), wSt = Bl(fSt.prototype, "_angularVelocity", [ MSt ], {
108304              configurable: !0,
108305              enumerable: !0,
108306              writable: !0,
108307              initializer: function() {
108308                return 0;
108309              }
108310            }), RSt = Bl(fSt.prototype, "_fixedRotation", [ MSt ], {
108311              configurable: !0,
108312              enumerable: !0,
108313              writable: !0,
108314              initializer: function() {
108315                return !1;
108316              }
108317            }), fSt)) || mSt) || mSt));
108318            var OSt, NSt, LSt, FSt, VSt, kSt, USt, GSt, zSt, HSt, jSt, XSt, WSt;
108319            let YSt = t("Collider2D", (OSt = Ul("cc.Collider2D"), NSt = Th(oSt), OSt(LSt = (FSt = (WSt = class extends(To(Qc)){
108320              constructor(...t) {
108321                super(...t);
108322                Ml(this, "editing", VSt, this);
108323                Ml(this, "tag", kSt, this);
108324                this.TYPE = Abt.None;
108325                this._shape = null;
108326                this._body = null;
108327                Ml(this, "_group", USt, this);
108328                Ml(this, "_density", GSt, this);
108329                Ml(this, "_sensor", zSt, this);
108330                Ml(this, "_friction", HSt, this);
108331                Ml(this, "_restitution", jSt, this);
108332                Ml(this, "_offset", XSt, this);
108333              }
108334              get group() {
108335                return this._group;
108336              }
108337              set group(t) {
108338                this._group = t;
108339                this._shape && this._shape.onGroupChanged && this._shape.onGroupChanged();
108340              }
108341              get density() {
108342                return this._density;
108343              }
108344              set density(t) {
108345                this._density = t;
108346              }
108347              get sensor() {
108348                return this._sensor;
108349              }
108350              set sensor(t) {
108351                this._sensor = t;
108352              }
108353              get friction() {
108354                return this._friction;
108355              }
108356              set friction(t) {
108357                this._friction = t;
108358              }
108359              get restitution() {
108360                return this._restitution;
108361              }
108362              set restitution(t) {
108363                this._restitution = t;
108364              }
108365              get offset() {
108366                return this._offset;
108367              }
108368              set offset(t) {
108369                this._offset = t;
108370              }
108371              get body() {
108372                return this._body;
108373              }
108374              get impl() {
108375                return this._shape;
108376              }
108377              onLoad() {
108378                this._shape = Zbt(this.TYPE);
108379                this._shape.initialize(this);
108380                this._shape.onLoad && this._shape.onLoad();
108381                this._body = this.getComponent(PSt);
108382              }
108383              onEnable() {
108384                this._shape && this._shape.onEnable();
108385              }
108386              onDisable() {
108387                this._shape && this._shape.onDisable && this._shape.onDisable();
108388              }
108389              onDestroy() {
108390                this._shape && this._shape.onDestroy && this._shape.onDestroy();
108391              }
108392              apply() {
108393                this._shape && this._shape.apply && this._shape.apply();
108394              }
108395              get worldAABB() {
108396                return this._shape ? this._shape.worldAABB : new as;
108397              }
108398            }, WSt), VSt = Bl(FSt.prototype, "editing", [ nh ], {
108399              configurable: !0,
108400              enumerable: !0,
108401              writable: !0,
108402              initializer: function() {
108403                return !1;
108404              }
108405            }), kSt = Bl(FSt.prototype, "tag", [ jl ], {
108406              configurable: !0,
108407              enumerable: !0,
108408              writable: !0,
108409              initializer: function() {
108410                return 0;
108411              }
108412            }), Bl(FSt.prototype, "group", [ NSt ], Object.getOwnPropertyDescriptor(FSt.prototype, "group"), FSt.prototype),
108413            Bl(FSt.prototype, "density", [ jl ], Object.getOwnPropertyDescriptor(FSt.prototype, "density"), FSt.prototype),
108414            Bl(FSt.prototype, "sensor", [ jl ], Object.getOwnPropertyDescriptor(FSt.prototype, "sensor"), FSt.prototype),
108415            Bl(FSt.prototype, "friction", [ jl ], Object.getOwnPropertyDescriptor(FSt.prototype, "friction"), FSt.prototype),
108416            Bl(FSt.prototype, "restitution", [ jl ], Object.getOwnPropertyDescriptor(FSt.prototype, "restitution"), FSt.prototype),
108417            Bl(FSt.prototype, "offset", [ jl ], Object.getOwnPropertyDescriptor(FSt.prototype, "offset"), FSt.prototype),
108418            USt = Bl(FSt.prototype, "_group", [ jl ], {
108419              configurable: !0,
108420              enumerable: !0,
108421              writable: !0,
108422              initializer: function() {
108423                return oSt.DEFAULT;
108424              }
108425            }), GSt = Bl(FSt.prototype, "_density", [ jl ], {
108426              configurable: !0,
108427              enumerable: !0,
108428              writable: !0,
108429              initializer: function() {
108430                return 1;
108431              }
108432            }), zSt = Bl(FSt.prototype, "_sensor", [ jl ], {
108433              configurable: !0,
108434              enumerable: !0,
108435              writable: !0,
108436              initializer: function() {
108437                return !1;
108438              }
108439            }), HSt = Bl(FSt.prototype, "_friction", [ jl ], {
108440              configurable: !0,
108441              enumerable: !0,
108442              writable: !0,
108443              initializer: function() {
108444                return .2;
108445              }
108446            }), jSt = Bl(FSt.prototype, "_restitution", [ jl ], {
108447              configurable: !0,
108448              enumerable: !0,
108449              writable: !0,
108450              initializer: function() {
108451                return 0;
108452              }
108453            }), XSt = Bl(FSt.prototype, "_offset", [ jl ], {
108454              configurable: !0,
108455              enumerable: !0,
108456              writable: !0,
108457              initializer: function() {
108458                return new Qi;
108459              }
108460            }), FSt)) || LSt));
108461            var qSt, KSt, JSt, ZSt;
108462            t("BoxCollider2D", Ul("cc.BoxCollider2D")(qSt = $l()(qSt = (KSt = (ZSt = class extends YSt {
108463              constructor(...t) {
108464                super(...t);
108465                Ml(this, "_size", JSt, this);
108466                this.TYPE = Abt.BOX;
108467              }
108468              get size() {
108469                return this._size;
108470              }
108471              set size(t) {
108472                this._size = t;
108473              }
108474              get worldPoints() {
108475                return this._shape ? this._shape.worldPoints : [];
108476              }
108477            }, ZSt), JSt = Bl(KSt.prototype, "_size", [ jl ], {
108478              configurable: !0,
108479              enumerable: !0,
108480              writable: !0,
108481              initializer: function() {
108482                return new rs(1, 1);
108483              }
108484            }), Bl(KSt.prototype, "size", [ jl ], Object.getOwnPropertyDescriptor(KSt.prototype, "size"), KSt.prototype),
108485            KSt)) || qSt) || qSt);
108486            var QSt, $St, tAt, eAt;
108487            t("CircleCollider2D", Ul("cc.CircleCollider2D")(QSt = $l()(QSt = ($St = (eAt = class extends YSt {
108488              constructor(...t) {
108489                super(...t);
108490                Ml(this, "_radius", tAt, this);
108491                this.TYPE = Abt.CIRCLE;
108492              }
108493              get radius() {
108494                return this._radius;
108495              }
108496              set radius(t) {
108497                this._radius = t < 0 ? 0 : t;
108498              }
108499              get worldPosition() {
108500                return this._shape ? this._shape.worldPosition : new Qi;
108501              }
108502              get worldRadius() {
108503                return this._shape ? this._shape.worldRadius : 0;
108504              }
108505            }, eAt), tAt = Bl($St.prototype, "_radius", [ jl ], {
108506              configurable: !0,
108507              enumerable: !0,
108508              writable: !0,
108509              initializer: function() {
108510                return 1;
108511              }
108512            }), Bl($St.prototype, "radius", [ jl ], Object.getOwnPropertyDescriptor($St.prototype, "radius"), $St.prototype),
108513            $St)) || QSt) || QSt);
108514            var iAt, sAt, nAt, rAt, oAt, aAt, lAt, hAt, cAt;
108515            t("PolygonCollider2D", (iAt = Ul("cc.PolygonCollider2D"), sAt = $l(), nAt = jl({
108516              serializable: !1,
108517              displayOrder: 0
108518            }), rAt = jl({
108519              type: Qi
108520            }), iAt(oAt = sAt(oAt = (aAt = (cAt = class extends YSt {
108521              constructor(...t) {
108522                super(...t);
108523                Ml(this, "threshold", lAt, this);
108524                Ml(this, "_points", hAt, this);
108525                this.TYPE = Abt.POLYGON;
108526              }
108527              get points() {
108528                return this._points;
108529              }
108530              set points(t) {
108531                this._points = t;
108532              }
108533              get worldPoints() {
108534                return this._shape ? this._shape.worldPoints : [];
108535              }
108536            }, cAt), lAt = Bl(aAt.prototype, "threshold", [ nAt ], {
108537              configurable: !0,
108538              enumerable: !0,
108539              writable: !0,
108540              initializer: function() {
108541                return 1;
108542              }
108543            }), hAt = Bl(aAt.prototype, "_points", [ jl ], {
108544              configurable: !0,
108545              enumerable: !0,
108546              writable: !0,
108547              initializer: function() {
108548                return [ new Qi(-1, -1), new Qi(1, -1), new Qi(1, 1), new Qi(-1, 1) ];
108549              }
108550            }), Bl(aAt.prototype, "points", [ rAt ], Object.getOwnPropertyDescriptor(aAt.prototype, "points"), aAt.prototype),
108551            aAt)) || oAt) || oAt));
108552            var uAt, _At, dAt, pAt, mAt, fAt, gAt, yAt;
108553            let bAt = t("Joint2D", (uAt = Ul("cc.Joint2D"), _At = Th(PSt), uAt(dAt = (pAt = class extends Qc {
108554              constructor(...t) {
108555                super(...t);
108556                Ml(this, "anchor", mAt, this);
108557                Ml(this, "connectedAnchor", fAt, this);
108558                Ml(this, "collideConnected", gAt, this);
108559                Ml(this, "connectedBody", yAt, this);
108560                this._body = null;
108561                this._joint = null;
108562                this.TYPE = Tbt.None;
108563              }
108564              get body() {
108565                return this._body;
108566              }
108567              get impl() {
108568                return this._joint;
108569              }
108570              onLoad() {
108571                this._joint = tSt(this.TYPE);
108572                this._joint.initialize(this);
108573                this._body = this.getComponent(PSt);
108574              }
108575              onEnable() {
108576                this._joint && this._joint.onEnable && this._joint.onEnable();
108577              }
108578              onDisable() {
108579                this._joint && this._joint.onDisable && this._joint.onDisable();
108580              }
108581              start() {
108582                this._joint && this._joint.start && this._joint.start();
108583              }
108584              onDestroy() {
108585                this._joint && this._joint.onDestroy && this._joint.onDestroy();
108586              }
108587            }, mAt = Bl(pAt.prototype, "anchor", [ jl ], {
108588              configurable: !0,
108589              enumerable: !0,
108590              writable: !0,
108591              initializer: function() {
108592                return new Qi;
108593              }
108594            }), fAt = Bl(pAt.prototype, "connectedAnchor", [ jl ], {
108595              configurable: !0,
108596              enumerable: !0,
108597              writable: !0,
108598              initializer: function() {
108599                return new Qi;
108600              }
108601            }), gAt = Bl(pAt.prototype, "collideConnected", [ jl ], {
108602              configurable: !0,
108603              enumerable: !0,
108604              writable: !0,
108605              initializer: function() {
108606                return !1;
108607              }
108608            }), yAt = Bl(pAt.prototype, "connectedBody", [ _At ], {
108609              configurable: !0,
108610              enumerable: !0,
108611              writable: !0,
108612              initializer: function() {
108613                return null;
108614              }
108615            }), pAt)) || dAt));
108616            var SAt, AAt, TAt, vAt, EAt;
108617            t("DistanceJoint2D", Ul("cc.DistanceJoint2D")(SAt = $l()(SAt = (AAt = (EAt = class extends bAt {
108618              constructor(...t) {
108619                super(...t);
108620                this.TYPE = Tbt.DISTANCE;
108621                Ml(this, "_maxLength", TAt, this);
108622                Ml(this, "_autoCalcDistance", vAt, this);
108623              }
108624              get maxLength() {
108625                return this._autoCalcDistance && this.connectedBody ? Pi.distance(this.node.worldPosition, this.connectedBody.node.worldPosition) : this._maxLength;
108626              }
108627              set maxLength(t) {
108628                this._maxLength = t;
108629                this._joint && this._joint.setMaxLength(t);
108630              }
108631              get autoCalcDistance() {
108632                return this._autoCalcDistance;
108633              }
108634              set autoCalcDistance(t) {
108635                this._autoCalcDistance = t;
108636              }
108637            }, EAt), Bl(AAt.prototype, "maxLength", [ jl ], Object.getOwnPropertyDescriptor(AAt.prototype, "maxLength"), AAt.prototype),
108638            Bl(AAt.prototype, "autoCalcDistance", [ jl ], Object.getOwnPropertyDescriptor(AAt.prototype, "autoCalcDistance"), AAt.prototype),
108639            TAt = Bl(AAt.prototype, "_maxLength", [ jl ], {
108640              configurable: !0,
108641              enumerable: !0,
108642              writable: !0,
108643              initializer: function() {
108644                return 5;
108645              }
108646            }), vAt = Bl(AAt.prototype, "_autoCalcDistance", [ jl ], {
108647              configurable: !0,
108648              enumerable: !0,
108649              writable: !0,
108650              initializer: function() {
108651                return !0;
108652              }
108653            }), AAt)) || SAt) || SAt);
108654            var CAt, xAt, wAt, RAt, IAt, MAt, BAt;
108655            t("SpringJoint2D", Ul("cc.SpringJoint2D")(CAt = $l()(CAt = (xAt = (BAt = class extends bAt {
108656              constructor(...t) {
108657                super(...t);
108658                this.TYPE = Tbt.SPRING;
108659                Ml(this, "_frequency", wAt, this);
108660                Ml(this, "_dampingRatio", RAt, this);
108661                Ml(this, "_distance", IAt, this);
108662                Ml(this, "_autoCalcDistance", MAt, this);
108663              }
108664              get frequency() {
108665                return this._frequency;
108666              }
108667              set frequency(t) {
108668                this._frequency = t;
108669                this._joint && this._joint.setFrequency(t);
108670              }
108671              get dampingRatio() {
108672                return this._dampingRatio;
108673              }
108674              set dampingRatio(t) {
108675                this._dampingRatio = t;
108676                this._joint && this._joint.setDampingRatio(t);
108677              }
108678              get distance() {
108679                return this._autoCalcDistance && this.connectedBody ? Pi.distance(this.node.worldPosition, this.connectedBody.node.worldPosition) : this._distance;
108680              }
108681              set distance(t) {
108682                this._distance = t;
108683                this._joint && this._joint.setDistance(t);
108684              }
108685              get autoCalcDistance() {
108686                return this._autoCalcDistance;
108687              }
108688              set autoCalcDistance(t) {
108689                this._autoCalcDistance = t;
108690              }
108691            }, BAt), Bl(xAt.prototype, "frequency", [ jl ], Object.getOwnPropertyDescriptor(xAt.prototype, "frequency"), xAt.prototype),
108692            Bl(xAt.prototype, "dampingRatio", [ jl ], Object.getOwnPropertyDescriptor(xAt.prototype, "dampingRatio"), xAt.prototype),
108693            Bl(xAt.prototype, "distance", [ jl ], Object.getOwnPropertyDescriptor(xAt.prototype, "distance"), xAt.prototype),
108694            Bl(xAt.prototype, "autoCalcDistance", [ jl ], Object.getOwnPropertyDescriptor(xAt.prototype, "autoCalcDistance"), xAt.prototype),
108695            wAt = Bl(xAt.prototype, "_frequency", [ jl ], {
108696              configurable: !0,
108697              enumerable: !0,
108698              writable: !0,
108699              initializer: function() {
108700                return 5;
108701              }
108702            }), RAt = Bl(xAt.prototype, "_dampingRatio", [ jl ], {
108703              configurable: !0,
108704              enumerable: !0,
108705              writable: !0,
108706              initializer: function() {
108707                return .7;
108708              }
108709            }), IAt = Bl(xAt.prototype, "_distance", [ jl ], {
108710              configurable: !0,
108711              enumerable: !0,
108712              writable: !0,
108713              initializer: function() {
108714                return 10;
108715              }
108716            }), MAt = Bl(xAt.prototype, "_autoCalcDistance", [ jl ], {
108717              configurable: !0,
108718              enumerable: !0,
108719              writable: !0,
108720              initializer: function() {
108721                return !0;
108722              }
108723            }), xAt)) || CAt) || CAt);
108724            var DAt, PAt, OAt, NAt, LAt, FAt;
108725            t("MouseJoint2D", Ul("cc.MouseJoint2D")(DAt = $l()(DAt = (PAt = (FAt = class extends bAt {
108726              constructor(...t) {
108727                super(...t);
108728                this.TYPE = Tbt.MOUSE;
108729                Ml(this, "_maxForce", OAt, this);
108730                Ml(this, "_dampingRatio", NAt, this);
108731                Ml(this, "_frequency", LAt, this);
108732                this._target = new Qi;
108733              }
108734              get target() {
108735                return this._target;
108736              }
108737              set target(t) {
108738                this._target = t;
108739                this._joint && this._joint.setTarget(t);
108740              }
108741              get frequency() {
108742                return this._frequency;
108743              }
108744              set frequency(t) {
108745                this._frequency = t;
108746                this._joint && this._joint.setFrequency(t);
108747              }
108748              get dampingRatio() {
108749                return this._dampingRatio;
108750              }
108751              set dampingRatio(t) {
108752                this._dampingRatio = t;
108753                this._joint && this._joint.setDampingRatio(t);
108754              }
108755              get maxForce() {
108756                return this._maxForce;
108757              }
108758              set maxForce(t) {
108759                this._maxForce = t;
108760                this._joint && this._joint.setMaxForce(t);
108761              }
108762              update(t) {
108763                this._joint.update(t);
108764              }
108765            }, FAt), Bl(PAt.prototype, "frequency", [ jl ], Object.getOwnPropertyDescriptor(PAt.prototype, "frequency"), PAt.prototype),
108766            Bl(PAt.prototype, "dampingRatio", [ jl ], Object.getOwnPropertyDescriptor(PAt.prototype, "dampingRatio"), PAt.prototype),
108767            Bl(PAt.prototype, "maxForce", [ jl ], Object.getOwnPropertyDescriptor(PAt.prototype, "maxForce"), PAt.prototype),
108768            OAt = Bl(PAt.prototype, "_maxForce", [ jl ], {
108769              configurable: !0,
108770              enumerable: !0,
108771              writable: !0,
108772              initializer: function() {
108773                return 1e3;
108774              }
108775            }), NAt = Bl(PAt.prototype, "_dampingRatio", [ jl ], {
108776              configurable: !0,
108777              enumerable: !0,
108778              writable: !0,
108779              initializer: function() {
108780                return .7;
108781              }
108782            }), LAt = Bl(PAt.prototype, "_frequency", [ jl ], {
108783              configurable: !0,
108784              enumerable: !0,
108785              writable: !0,
108786              initializer: function() {
108787                return 5;
108788              }
108789            }), PAt)) || DAt) || DAt);
108790            var VAt, kAt, UAt, GAt, zAt, HAt, jAt, XAt, WAt;
108791            const YAt = new Pi;
108792            const qAt = new Pi;
108793            t("RelativeJoint2D", Ul("cc.RelativeJoint2D")(VAt = $l()(VAt = (kAt = (WAt = class extends bAt {
108794              constructor(...t) {
108795                super(...t);
108796                this.TYPE = Tbt.RELATIVE;
108797                Ml(this, "_maxForce", UAt, this);
108798                Ml(this, "_maxTorque", GAt, this);
108799                Ml(this, "_correctionFactor", zAt, this);
108800                Ml(this, "_angularOffset", HAt, this);
108801                Ml(this, "_linearOffset", jAt, this);
108802                Ml(this, "_autoCalcOffset", XAt, this);
108803              }
108804              get maxForce() {
108805                return this._maxForce;
108806              }
108807              set maxForce(t) {
108808                this._maxForce = t;
108809                this._joint && this._joint.setMaxForce(t);
108810              }
108811              get maxTorque() {
108812                return this._maxTorque;
108813              }
108814              set maxTorque(t) {
108815                this._maxTorque = t;
108816                this._joint && this._joint.setMaxTorque(t);
108817              }
108818              get correctionFactor() {
108819                return this._correctionFactor;
108820              }
108821              set correctionFactor(t) {
108822                this._correctionFactor = t;
108823                this._joint && this._joint.setCorrectionFactor(t);
108824              }
108825              get linearOffset() {
108826                return this._autoCalcOffset && this.connectedBody ? Qi.subtract(this._linearOffset, this.connectedBody.node.worldPosition, this.node.worldPosition) : this._linearOffset;
108827              }
108828              set linearOffset(t) {
108829                this._linearOffset.set(t);
108830                this._joint && this._joint.setLinearOffset(t);
108831              }
108832              get angularOffset() {
108833                if (this._autoCalcOffset && this.connectedBody) {
108834                  Ui.toEuler(YAt, this.node.worldRotation);
108835                  Ui.toEuler(qAt, this.connectedBody.node.worldRotation);
108836                  this._angularOffset = qAt.z - YAt.z;
108837                }
108838                return this._angularOffset;
108839              }
108840              set angularOffset(t) {
108841                this._angularOffset = t;
108842                this._joint && this._joint.setAngularOffset(t);
108843              }
108844              get autoCalcOffset() {
108845                return this._autoCalcOffset;
108846              }
108847              set autoCalcOffset(t) {
108848                this._autoCalcOffset = t;
108849              }
108850            }, WAt), Bl(kAt.prototype, "maxForce", [ jl ], Object.getOwnPropertyDescriptor(kAt.prototype, "maxForce"), kAt.prototype),
108851            Bl(kAt.prototype, "maxTorque", [ jl ], Object.getOwnPropertyDescriptor(kAt.prototype, "maxTorque"), kAt.prototype),
108852            Bl(kAt.prototype, "correctionFactor", [ jl ], Object.getOwnPropertyDescriptor(kAt.prototype, "correctionFactor"), kAt.prototype),
108853            Bl(kAt.prototype, "linearOffset", [ jl ], Object.getOwnPropertyDescriptor(kAt.prototype, "linearOffset"), kAt.prototype),
108854            Bl(kAt.prototype, "angularOffset", [ jl ], Object.getOwnPropertyDescriptor(kAt.prototype, "angularOffset"), kAt.prototype),
108855            Bl(kAt.prototype, "autoCalcOffset", [ jl ], Object.getOwnPropertyDescriptor(kAt.prototype, "autoCalcOffset"), kAt.prototype),
108856            UAt = Bl(kAt.prototype, "_maxForce", [ jl ], {
108857              configurable: !0,
108858              enumerable: !0,
108859              writable: !0,
108860              initializer: function() {
108861                return 5;
108862              }
108863            }), GAt = Bl(kAt.prototype, "_maxTorque", [ jl ], {
108864              configurable: !0,
108865              enumerable: !0,
108866              writable: !0,
108867              initializer: function() {
108868                return .7;
108869              }
108870            }), zAt = Bl(kAt.prototype, "_correctionFactor", [ jl ], {
108871              configurable: !0,
108872              enumerable: !0,
108873              writable: !0,
108874              initializer: function() {
108875                return .3;
108876              }
108877            }), HAt = Bl(kAt.prototype, "_angularOffset", [ jl ], {
108878              configurable: !0,
108879              enumerable: !0,
108880              writable: !0,
108881              initializer: function() {
108882                return 0;
108883              }
108884            }), jAt = Bl(kAt.prototype, "_linearOffset", [ jl ], {
108885              configurable: !0,
108886              enumerable: !0,
108887              writable: !0,
108888              initializer: function() {
108889                return new Qi;
108890              }
108891            }), XAt = Bl(kAt.prototype, "_autoCalcOffset", [ jl ], {
108892              configurable: !0,
108893              enumerable: !0,
108894              writable: !0,
108895              initializer: function() {
108896                return !0;
108897              }
108898            }), kAt)) || VAt) || VAt);
108899            var KAt, JAt, ZAt, QAt, $At, tTt, eTt, iTt, sTt, nTt, rTt;
108900            const oTt = new Qi;
108901            t("SliderJoint2D", Ul("cc.SliderJoint2D")(KAt = $l()(KAt = (JAt = (rTt = class extends bAt {
108902              constructor(...t) {
108903                super(...t);
108904                this.TYPE = Tbt.SLIDER;
108905                Ml(this, "_angle", ZAt, this);
108906                Ml(this, "_autoCalcAngle", QAt, this);
108907                Ml(this, "_enableMotor", $At, this);
108908                Ml(this, "_maxMotorForce", tTt, this);
108909                Ml(this, "_motorSpeed", eTt, this);
108910                Ml(this, "_enableLimit", iTt, this);
108911                Ml(this, "_lowerLimit", sTt, this);
108912                Ml(this, "_upperLimit", nTt, this);
108913              }
108914              get angle() {
108915                if (this._autoCalcAngle && this.connectedBody) {
108916                  Qi.subtract(oTt, this.connectedBody.node.worldPosition, this.node.worldPosition);
108917                  this._angle = fi(Math.atan2(oTt.y, oTt.x));
108918                }
108919                return this._angle;
108920              }
108921              set angle(t) {
108922                this._angle = t;
108923              }
108924              get autoCalcAngle() {
108925                return this._autoCalcAngle;
108926              }
108927              set autoCalcAngle(t) {
108928                this._autoCalcAngle = t;
108929              }
108930              get enableMotor() {
108931                return this._enableMotor;
108932              }
108933              set enableMotor(t) {
108934                this._enableMotor = t;
108935              }
108936              get maxMotorForce() {
108937                return this._maxMotorForce;
108938              }
108939              set maxMotorForce(t) {
108940                this._maxMotorForce = t;
108941                this._joint && this._joint.setMaxMotorForce(t);
108942              }
108943              get motorSpeed() {
108944                return this._motorSpeed;
108945              }
108946              set motorSpeed(t) {
108947                this._motorSpeed = t;
108948                this._joint && this._joint.setMotorSpeed(t);
108949              }
108950              get enableLimit() {
108951                return this._enableLimit;
108952              }
108953              set enableLimit(t) {
108954                this._enableLimit = t;
108955              }
108956              get lowerLimit() {
108957                return this._lowerLimit;
108958              }
108959              set lowerLimit(t) {
108960                this._lowerLimit = t;
108961                this._joint && this._joint.setLowerLimit(t);
108962              }
108963              get upperLimit() {
108964                return this._upperLimit;
108965              }
108966              set upperLimit(t) {
108967                this._upperLimit = t;
108968                this._joint && this._joint.setUpperLimit(t);
108969              }
108970            }, rTt), Bl(JAt.prototype, "angle", [ jl ], Object.getOwnPropertyDescriptor(JAt.prototype, "angle"), JAt.prototype),
108971            Bl(JAt.prototype, "autoCalcAngle", [ jl ], Object.getOwnPropertyDescriptor(JAt.prototype, "autoCalcAngle"), JAt.prototype),
108972            Bl(JAt.prototype, "enableMotor", [ jl ], Object.getOwnPropertyDescriptor(JAt.prototype, "enableMotor"), JAt.prototype),
108973            Bl(JAt.prototype, "maxMotorForce", [ jl ], Object.getOwnPropertyDescriptor(JAt.prototype, "maxMotorForce"), JAt.prototype),
108974            Bl(JAt.prototype, "motorSpeed", [ jl ], Object.getOwnPropertyDescriptor(JAt.prototype, "motorSpeed"), JAt.prototype),
108975            Bl(JAt.prototype, "enableLimit", [ jl ], Object.getOwnPropertyDescriptor(JAt.prototype, "enableLimit"), JAt.prototype),
108976            Bl(JAt.prototype, "lowerLimit", [ jl ], Object.getOwnPropertyDescriptor(JAt.prototype, "lowerLimit"), JAt.prototype),
108977            Bl(JAt.prototype, "upperLimit", [ jl ], Object.getOwnPropertyDescriptor(JAt.prototype, "upperLimit"), JAt.prototype),
108978            ZAt = Bl(JAt.prototype, "_angle", [ jl ], {
108979              configurable: !0,
108980              enumerable: !0,
108981              writable: !0,
108982              initializer: function() {
108983                return 0;
108984              }
108985            }), QAt = Bl(JAt.prototype, "_autoCalcAngle", [ jl ], {
108986              configurable: !0,
108987              enumerable: !0,
108988              writable: !0,
108989              initializer: function() {
108990                return !0;
108991              }
108992            }), $At = Bl(JAt.prototype, "_enableMotor", [ jl ], {
108993              configurable: !0,
108994              enumerable: !0,
108995              writable: !0,
108996              initializer: function() {
108997                return !1;
108998              }
108999            }), tTt = Bl(JAt.prototype, "_maxMotorForce", [ jl ], {
109000              configurable: !0,
109001              enumerable: !0,
109002              writable: !0,
109003              initializer: function() {
109004                return 1e3;
109005              }
109006            }), eTt = Bl(JAt.prototype, "_motorSpeed", [ jl ], {
109007              configurable: !0,
109008              enumerable: !0,
109009              writable: !0,
109010              initializer: function() {
109011                return 1e3;
109012              }
109013            }), iTt = Bl(JAt.prototype, "_enableLimit", [ jl ], {
109014              configurable: !0,
109015              enumerable: !0,
109016              writable: !0,
109017              initializer: function() {
109018                return !1;
109019              }
109020            }), sTt = Bl(JAt.prototype, "_lowerLimit", [ jl ], {
109021              configurable: !0,
109022              enumerable: !0,
109023              writable: !0,
109024              initializer: function() {
109025                return 0;
109026              }
109027            }), nTt = Bl(JAt.prototype, "_upperLimit", [ jl ], {
109028              configurable: !0,
109029              enumerable: !0,
109030              writable: !0,
109031              initializer: function() {
109032                return 0;
109033              }
109034            }), JAt)) || KAt) || KAt);
109035            var aTt, lTt, hTt, cTt, uTt;
109036            t("FixedJoint2D", Ul("cc.FixedJoint2D")(aTt = $l()(aTt = (lTt = (uTt = class extends bAt {
109037              constructor(...t) {
109038                super(...t);
109039                this.TYPE = Tbt.FIXED;
109040                Ml(this, "_frequency", hTt, this);
109041                Ml(this, "_dampingRatio", cTt, this);
109042              }
109043              get frequency() {
109044                return this._frequency;
109045              }
109046              set frequency(t) {
109047                this._frequency = t;
109048                this._joint && this._joint.setFrequency(t);
109049              }
109050              get dampingRatio() {
109051                return this._dampingRatio;
109052              }
109053              set dampingRatio(t) {
109054                this._dampingRatio = t;
109055                this._joint && this._joint.setDampingRatio(t);
109056              }
109057            }, uTt), Bl(lTt.prototype, "frequency", [ jl ], Object.getOwnPropertyDescriptor(lTt.prototype, "frequency"), lTt.prototype),
109058            Bl(lTt.prototype, "dampingRatio", [ jl ], Object.getOwnPropertyDescriptor(lTt.prototype, "dampingRatio"), lTt.prototype),
109059            hTt = Bl(lTt.prototype, "_frequency", [ jl ], {
109060              configurable: !0,
109061              enumerable: !0,
109062              writable: !0,
109063              initializer: function() {
109064                return .7;
109065              }
109066            }), cTt = Bl(lTt.prototype, "_dampingRatio", [ jl ], {
109067              configurable: !0,
109068              enumerable: !0,
109069              writable: !0,
109070              initializer: function() {
109071                return .5;
109072              }
109073            }), lTt)) || aTt) || aTt);
109074            var _Tt, dTt, pTt, mTt, fTt, gTt, yTt, bTt, STt;
109075            t("WheelJoint2D", Ul("cc.WheelJoint2D")(_Tt = $l()(_Tt = (dTt = (STt = class extends bAt {
109076              constructor(...t) {
109077                super(...t);
109078                this.TYPE = Tbt.WHEEL;
109079                Ml(this, "_angle", pTt, this);
109080                Ml(this, "_enableMotor", mTt, this);
109081                Ml(this, "_maxMotorTorque", fTt, this);
109082                Ml(this, "_motorSpeed", gTt, this);
109083                Ml(this, "_frequency", yTt, this);
109084                Ml(this, "_dampingRatio", bTt, this);
109085              }
109086              get angle() {
109087                return this._angle;
109088              }
109089              set angle(t) {
109090                this._angle = t;
109091              }
109092              get enableMotor() {
109093                return this._enableMotor;
109094              }
109095              set enableMotor(t) {
109096                this._enableMotor = t;
109097                this._joint && this._joint.enableMotor(t);
109098              }
109099              get maxMotorTorque() {
109100                return this._maxMotorTorque;
109101              }
109102              set maxMotorTorque(t) {
109103                this._maxMotorTorque = t;
109104                this._joint && this._joint.setMaxMotorTorque(t);
109105              }
109106              get motorSpeed() {
109107                return this._motorSpeed;
109108              }
109109              set motorSpeed(t) {
109110                this._motorSpeed = t;
109111                this._joint && this._joint.setMotorSpeed(t);
109112              }
109113              get frequency() {
109114                return this._frequency;
109115              }
109116              set frequency(t) {
109117                this._frequency = t;
109118                this._joint && this._joint.setFrequency(t);
109119              }
109120              get dampingRatio() {
109121                return this._dampingRatio;
109122              }
109123              set dampingRatio(t) {
109124                this._dampingRatio = t;
109125                this._joint && this._joint.setDampingRatio(t);
109126              }
109127            }, STt), Bl(dTt.prototype, "angle", [ jl ], Object.getOwnPropertyDescriptor(dTt.prototype, "angle"), dTt.prototype),
109128            Bl(dTt.prototype, "enableMotor", [ jl ], Object.getOwnPropertyDescriptor(dTt.prototype, "enableMotor"), dTt.prototype),
109129            Bl(dTt.prototype, "maxMotorTorque", [ jl ], Object.getOwnPropertyDescriptor(dTt.prototype, "maxMotorTorque"), dTt.prototype),
109130            Bl(dTt.prototype, "motorSpeed", [ jl ], Object.getOwnPropertyDescriptor(dTt.prototype, "motorSpeed"), dTt.prototype),
109131            Bl(dTt.prototype, "frequency", [ jl ], Object.getOwnPropertyDescriptor(dTt.prototype, "frequency"), dTt.prototype),
109132            Bl(dTt.prototype, "dampingRatio", [ jl ], Object.getOwnPropertyDescriptor(dTt.prototype, "dampingRatio"), dTt.prototype),
109133            pTt = Bl(dTt.prototype, "_angle", [ jl ], {
109134              configurable: !0,
109135              enumerable: !0,
109136              writable: !0,
109137              initializer: function() {
109138                return 90;
109139              }
109140            }), mTt = Bl(dTt.prototype, "_enableMotor", [ jl ], {
109141              configurable: !0,
109142              enumerable: !0,
109143              writable: !0,
109144              initializer: function() {
109145                return !1;
109146              }
109147            }), fTt = Bl(dTt.prototype, "_maxMotorTorque", [ jl ], {
109148              configurable: !0,
109149              enumerable: !0,
109150              writable: !0,
109151              initializer: function() {
109152                return 1e3;
109153              }
109154            }), gTt = Bl(dTt.prototype, "_motorSpeed", [ jl ], {
109155              configurable: !0,
109156              enumerable: !0,
109157              writable: !0,
109158              initializer: function() {
109159                return 0;
109160              }
109161            }), yTt = Bl(dTt.prototype, "_frequency", [ jl ], {
109162              configurable: !0,
109163              enumerable: !0,
109164              writable: !0,
109165              initializer: function() {
109166                return 5;
109167              }
109168            }), bTt = Bl(dTt.prototype, "_dampingRatio", [ jl ], {
109169              configurable: !0,
109170              enumerable: !0,
109171              writable: !0,
109172              initializer: function() {
109173                return .7;
109174              }
109175            }), dTt)) || _Tt) || _Tt);
109176            var ATt, TTt, vTt, ETt, CTt, xTt, wTt, RTt, ITt;
109177            t("HingeJoint2D", Ul("cc.HingeJoint2D")(ATt = $l()(ATt = (TTt = (ITt = class extends bAt {
109178              constructor(...t) {
109179                super(...t);
109180                this.TYPE = Tbt.HINGE;
109181                Ml(this, "_enableLimit", vTt, this);
109182                Ml(this, "_lowerAngle", ETt, this);
109183                Ml(this, "_upperAngle", CTt, this);
109184                Ml(this, "_enableMotor", xTt, this);
109185                Ml(this, "_maxMotorTorque", wTt, this);
109186                Ml(this, "_motorSpeed", RTt, this);
109187              }
109188              get enableLimit() {
109189                return this._enableLimit;
109190              }
109191              set enableLimit(t) {
109192                this._enableLimit = t;
109193              }
109194              get lowerAngle() {
109195                return this._lowerAngle;
109196              }
109197              set lowerAngle(t) {
109198                this._lowerAngle = t;
109199                this._joint && this._joint.setLowerAngle(t);
109200              }
109201              get upperAngle() {
109202                return this._upperAngle;
109203              }
109204              set upperAngle(t) {
109205                this._upperAngle = t;
109206                this._joint && this._joint.setUpperAngle(t);
109207              }
109208              get enableMotor() {
109209                return this._enableMotor;
109210              }
109211              set enableMotor(t) {
109212                this._enableMotor = t;
109213                this._joint && this._joint.enableMotor(t);
109214              }
109215              get maxMotorTorque() {
109216                return this._maxMotorTorque;
109217              }
109218              set maxMotorTorque(t) {
109219                this._maxMotorTorque = t;
109220                this._joint && this._joint.setMaxMotorTorque(t);
109221              }
109222              get motorSpeed() {
109223                return this._motorSpeed;
109224              }
109225              set motorSpeed(t) {
109226                this._motorSpeed = t;
109227                this._joint && this._joint.setMotorSpeed(t);
109228              }
109229            }, ITt), Bl(TTt.prototype, "enableLimit", [ jl ], Object.getOwnPropertyDescriptor(TTt.prototype, "enableLimit"), TTt.prototype),
109230            Bl(TTt.prototype, "lowerAngle", [ jl ], Object.getOwnPropertyDescriptor(TTt.prototype, "lowerAngle"), TTt.prototype),
109231            Bl(TTt.prototype, "upperAngle", [ jl ], Object.getOwnPropertyDescriptor(TTt.prototype, "upperAngle"), TTt.prototype),
109232            Bl(TTt.prototype, "enableMotor", [ jl ], Object.getOwnPropertyDescriptor(TTt.prototype, "enableMotor"), TTt.prototype),
109233            Bl(TTt.prototype, "maxMotorTorque", [ jl ], Object.getOwnPropertyDescriptor(TTt.prototype, "maxMotorTorque"), TTt.prototype),
109234            Bl(TTt.prototype, "motorSpeed", [ jl ], Object.getOwnPropertyDescriptor(TTt.prototype, "motorSpeed"), TTt.prototype),
109235            vTt = Bl(TTt.prototype, "_enableLimit", [ jl ], {
109236              configurable: !0,
109237              enumerable: !0,
109238              writable: !0,
109239              initializer: function() {
109240                return !1;
109241              }
109242            }), ETt = Bl(TTt.prototype, "_lowerAngle", [ jl ], {
109243              configurable: !0,
109244              enumerable: !0,
109245              writable: !0,
109246              initializer: function() {
109247                return 0;
109248              }
109249            }), CTt = Bl(TTt.prototype, "_upperAngle", [ jl ], {
109250              configurable: !0,
109251              enumerable: !0,
109252              writable: !0,
109253              initializer: function() {
109254                return 0;
109255              }
109256            }), xTt = Bl(TTt.prototype, "_enableMotor", [ jl ], {
109257              configurable: !0,
109258              enumerable: !0,
109259              writable: !0,
109260              initializer: function() {
109261                return !1;
109262              }
109263            }), wTt = Bl(TTt.prototype, "_maxMotorTorque", [ jl ], {
109264              configurable: !0,
109265              enumerable: !0,
109266              writable: !0,
109267              initializer: function() {
109268                return 1e3;
109269              }
109270            }), RTt = Bl(TTt.prototype, "_motorSpeed", [ jl ], {
109271              configurable: !0,
109272              enumerable: !0,
109273              writable: !0,
109274              initializer: function() {
109275                return 0;
109276              }
109277            }), TTt)) || ATt) || ATt);
109278            t("Physics2DUtils", {
109279              PolygonSeparator: Xbt
109280            });
109281            class MTt extends bbt.RayCastCallback {
109282              constructor(...t) {
109283                super(...t);
109284                this._type = Ebt.Closest;
109285                this._fixtures = [];
109286                this._points = [];
109287                this._normals = [];
109288                this._fractions = [];
109289                this._mask = 4294967295;
109290              }
109291              init(t, e) {
109292                this._type = t;
109293                this._mask = e;
109294                this._fixtures.length = 0;
109295                this._points.length = 0;
109296                this._normals.length = 0;
109297                this._fractions.length = 0;
109298              }
109299              ReportFixture(t, e, i, s) {
109300                if (0 == (t.GetFilterData().categoryBits & this._mask)) return 0;
109301                if (this._type === Ebt.Closest) {
109302                  this._fixtures[0] = t;
109303                  this._points[0] = e;
109304                  this._normals[0] = i;
109305                  this._fractions[0] = s;
109306                  return s;
109307                }
109308                this._fixtures.push(t);
109309                this._points.push(new Qi(e.x, e.y));
109310                this._normals.push(new Qi(i.x, i.y));
109311                this._fractions.push(s);
109312                return this._type === Ebt.Any ? 0 : this._type >= Ebt.All ? 1 : s;
109313              }
109314              getFixtures() {
109315                return this._fixtures;
109316              }
109317              getPoints() {
109318                return this._points;
109319              }
109320              getNormals() {
109321                return this._normals;
109322              }
109323              getFractions() {
109324                return this._fractions;
109325              }
109326            }
109327            const BTt = [];
109328            const DTt = [ new Qi, new Qi ];
109329            const PTt = new bbt.WorldManifold;
109330            const OTt = {
109331              points: [],
109332              separations: [],
109333              normal: new Qi
109334            };
109335            class NTt {
109336              constructor() {
109337                this.localPoint = new Qi;
109338                this.normalImpulse = 0;
109339                this.tangentImpulse = 0;
109340              }
109341            }
109342            const LTt = [ new NTt, new NTt ];
109343            const FTt = {
109344              type: 0,
109345              localPoint: new Qi,
109346              localNormal: new Qi,
109347              points: []
109348            };
109349            const VTt = {
109350              normalImpulses: [],
109351              tangentImpulses: []
109352            };
109353            class kTt {
109354              constructor() {
109355                this.colliderA = null;
109356                this.colliderB = null;
109357                this.disabled = !1;
109358                this.disabledOnce = !1;
109359                this._impulse = null;
109360                this._inverted = !1;
109361                this._b2contact = null;
109362              }
109363              static get(t) {
109364                let e = BTt.pop();
109365                e || (e = new kTt);
109366                e.init(t);
109367                return e;
109368              }
109369              static put(t) {
109370                const e = t.m_userData;
109371                if (e) {
109372                  BTt.push(e);
109373                  e.reset();
109374                }
109375              }
109376              _setImpulse(t) {
109377                this._impulse = t;
109378              }
109379              init(t) {
109380                this.colliderA = t.m_fixtureA.m_userData.collider;
109381                this.colliderB = t.m_fixtureB.m_userData.collider;
109382                this.disabled = !1;
109383                this.disabledOnce = !1;
109384                this._impulse = null;
109385                this._inverted = !1;
109386                this._b2contact = t;
109387                t.m_userData = this;
109388              }
109389              reset() {
109390                this.setTangentSpeed(0);
109391                this.resetFriction();
109392                this.resetRestitution();
109393                this.colliderA = null;
109394                this.colliderB = null;
109395                this.disabled = !1;
109396                this._impulse = null;
109397                this._b2contact.m_userData = null;
109398                this._b2contact = null;
109399              }
109400              getWorldManifold() {
109401                const t = OTt.points;
109402                const e = OTt.separations;
109403                const i = OTt.normal;
109404                this._b2contact.GetWorldManifold(PTt);
109405                const s = PTt.points;
109406                const n = PTt.separations;
109407                const r = this._b2contact.GetManifold().pointCount;
109408                t.length = e.length = r;
109409                for (let i = 0; i < r; i++) {
109410                  const r = DTt[i];
109411                  r.x = s[i].x * wbt;
109412                  r.y = s[i].y * wbt;
109413                  t[i] = r;
109414                  e[i] = n[i] * wbt;
109415                }
109416                i.x = PTt.normal.x;
109417                i.y = PTt.normal.y;
109418                if (this._inverted) {
109419                  i.x *= -1;
109420                  i.y *= -1;
109421                }
109422                return OTt;
109423              }
109424              getManifold() {
109425                const t = FTt.points;
109426                const e = FTt.localNormal;
109427                const i = FTt.localPoint;
109428                const s = this._b2contact.GetManifold();
109429                const n = s.points;
109430                const r = t.length = s.pointCount;
109431                for (let e = 0; e < r; e++) {
109432                  const i = LTt[e];
109433                  const s = n[e];
109434                  i.localPoint.x = s.localPoint.x * wbt;
109435                  i.localPoint.y = s.localPoint.y * wbt;
109436                  i.normalImpulse = s.normalImpulse * wbt;
109437                  i.tangentImpulse = s.tangentImpulse;
109438                  t[e] = i;
109439                }
109440                i.x = s.localPoint.x * wbt;
109441                i.y = s.localPoint.y * wbt;
109442                e.x = s.localNormal.x;
109443                e.y = s.localNormal.y;
109444                FTt.type = s.type;
109445                if (this._inverted) {
109446                  e.x *= -1;
109447                  e.y *= -1;
109448                }
109449                return FTt;
109450              }
109451              getImpulse() {
109452                const t = this._impulse;
109453                if (!t) return null;
109454                const e = VTt.normalImpulses;
109455                const i = VTt.tangentImpulses;
109456                const s = t.count;
109457                for (let n = 0; n < s; n++) {
109458                  e[n] = t.normalImpulses[n] * wbt;
109459                  i[n] = t.tangentImpulses[n];
109460                }
109461                i.length = e.length = s;
109462                return VTt;
109463              }
109464              emit(t) {
109465                const e = this.colliderA;
109466                const i = this.colliderB;
109467                const s = e.body;
109468                const n = i.body;
109469                s.enabledContactListener && (null == e || e.emit(t, e, i, this));
109470                n.enabledContactListener && (null == i || i.emit(t, i, e, this));
109471                (s.enabledContactListener || n.enabledContactListener) && hSt.instance.emit(t, e, i, this);
109472                if (this.disabled || this.disabledOnce) {
109473                  this.setEnabled(!1);
109474                  this.disabledOnce = !1;
109475                }
109476              }
109477              setEnabled(t) {
109478                this._b2contact.SetEnabled(t);
109479              }
109480              isTouching() {
109481                return this._b2contact.IsTouching();
109482              }
109483              setTangentSpeed(t) {
109484                this._b2contact.SetTangentSpeed(t);
109485              }
109486              getTangentSpeed() {
109487                return this._b2contact.GetTangentSpeed();
109488              }
109489              setFriction(t) {
109490                this._b2contact.SetFriction(t);
109491              }
109492              getFriction() {
109493                return this._b2contact.GetFriction();
109494              }
109495              resetFriction() {
109496                return this._b2contact.ResetFriction();
109497              }
109498              setRestitution(t) {
109499                this._b2contact.SetRestitution(t);
109500              }
109501              getRestitution() {
109502                return this._b2contact.GetRestitution();
109503              }
109504              resetRestitution() {
109505                return this._b2contact.ResetRestitution();
109506              }
109507            }
109508            const UTt = new bbt.Vec2;
109509            const GTt = new Bi;
109510            const zTt = Bi.GREEN;
109511            const HTt = Bi.RED;
109512            class jTt extends bbt.Draw {
109513              constructor(t) {
109514                super();
109515                this._drawer = null;
109516                this._xf = new bbt.Transform;
109517                this._dxf = new bbt.Transform;
109518                this._drawer = t;
109519              }
109520              _DrawPolygon(t, e) {
109521                const i = this._drawer;
109522                for (let s = 0; s < e; s++) {
109523                  bbt.Transform.MulXV(this._xf, t[s], UTt);
109524                  const e = UTt.x * wbt;
109525                  const n = UTt.y * wbt;
109526                  0 === s ? i.moveTo(e, n) : i.lineTo(e, n);
109527                }
109528                i.close();
109529              }
109530              DrawPolygon(t, e, i) {
109531                this._applyStrokeColor(i);
109532                this._DrawPolygon(t, e);
109533                this._drawer.stroke();
109534              }
109535              DrawSolidPolygon(t, e, i) {
109536                this._applyFillColor(i);
109537                this._DrawPolygon(t, e);
109538                this._drawer.fill();
109539                this._drawer.stroke();
109540              }
109541              _DrawCircle(t, e) {
109542                const i = this._xf.p;
109543                this._drawer.circle((t.x + i.x) * wbt, (t.y + i.y) * wbt, e * wbt);
109544              }
109545              DrawCircle(t, e, i) {
109546                this._applyStrokeColor(i);
109547                this._DrawCircle(t, e);
109548                this._drawer.stroke();
109549              }
109550              DrawSolidCircle(t, e, i, s) {
109551                this._applyFillColor(s);
109552                this._DrawCircle(t, e);
109553                this._drawer.fill();
109554              }
109555              DrawSegment(t, e, i) {
109556                const s = this._drawer;
109557                if (t.x !== e.x || t.y !== e.y) {
109558                  this._applyStrokeColor(i);
109559                  bbt.Transform.MulXV(this._xf, t, UTt);
109560                  s.moveTo(UTt.x * wbt, UTt.y * wbt);
109561                  bbt.Transform.MulXV(this._xf, e, UTt);
109562                  s.lineTo(UTt.x * wbt, UTt.y * wbt);
109563                  s.stroke();
109564                } else {
109565                  this._applyFillColor(i);
109566                  this._DrawCircle(t, 2 / wbt);
109567                  s.fill();
109568                }
109569              }
109570              DrawTransform(t) {
109571                const e = this._drawer;
109572                e.strokeColor = HTt;
109573                UTt.x = UTt.y = 0;
109574                bbt.Transform.MulXV(t, UTt, UTt);
109575                e.moveTo(UTt.x * wbt, UTt.y * wbt);
109576                UTt.x = 1;
109577                UTt.y = 0;
109578                bbt.Transform.MulXV(t, UTt, UTt);
109579                e.lineTo(UTt.x * wbt, UTt.y * wbt);
109580                e.stroke();
109581                e.strokeColor = zTt;
109582                UTt.x = UTt.y = 0;
109583                bbt.Transform.MulXV(t, UTt, UTt);
109584                e.moveTo(UTt.x * wbt, UTt.y * wbt);
109585                UTt.x = 0;
109586                UTt.y = 1;
109587                bbt.Transform.MulXV(t, UTt, UTt);
109588                e.lineTo(UTt.x * wbt, UTt.y * wbt);
109589                e.stroke();
109590              }
109591              DrawPoint(t, e, i) {}
109592              DrawParticles() {}
109593              _applyStrokeColor(t) {
109594                this._drawer.strokeColor = GTt.set(255 * t.r, 255 * t.g, 255 * t.b, 150);
109595              }
109596              _applyFillColor(t) {
109597                this._drawer.fillColor = GTt.set(255 * t.r, 255 * t.g, 255 * t.b, 150);
109598              }
109599              PushTransform(t) {
109600                this._xf = t;
109601              }
109602              PopTransform() {
109603                this._xf = this._dxf;
109604              }
109605            }
109606            const XTt = new Pi;
109607            const WTt = new Qi;
109608            const YTt = new Qi;
109609            const qTt = new bbt.BodyDef;
109610            const KTt = new bbt.AABB;
109611            const JTt = [];
109612            new Pi;
109613            const ZTt = new bbt.Vec2;
109614            const QTt = new bbt.Filter;
109615            function $Tt(t) {
109616              const e = t.collider;
109617              QTt.categoryBits = e.group === oSt.DEFAULT ? e.body.group : e.group;
109618              QTt.maskBits = hSt.instance.collisionMatrix[QTt.categoryBits];
109619              return QTt;
109620            }
109621            class tvt {
109622              constructor() {
109623                this._shapes = [];
109624                this._fixtures = [];
109625                this._collider = null;
109626                this._body = null;
109627                this._inited = !1;
109628                this._rect = new as;
109629              }
109630              get impl() {
109631                return this._shapes;
109632              }
109633              get collider() {
109634                return this._collider;
109635              }
109636              initialize(t) {
109637                this._collider = t;
109638              }
109639              onLoad() {}
109640              onEnable() {
109641                hSt.instance._callAfterStep(this, this._init);
109642              }
109643              onDisable() {
109644                hSt.instance._callAfterStep(this, this._destroy);
109645              }
109646              start() {}
109647              onGroupChanged() {
109648                const t = $Tt(this);
109649                this._fixtures.forEach((e => {
109650                  e.SetFilterData(t);
109651                }));
109652              }
109653              apply() {
109654                this._destroy();
109655                this._init();
109656              }
109657              get worldAABB() {
109658                const t = 1e7;
109659                let e = t;
109660                let i = t;
109661                let s = -t;
109662                let n = -t;
109663                const r = this._fixtures;
109664                for (let t = 0; t < r.length; t++) {
109665                  const o = r[t];
109666                  const a = o.GetShape().GetChildCount();
109667                  for (let t = 0; t < a; t++) {
109668                    const r = o.GetAABB(t);
109669                    r.lowerBound.x < e && (e = r.lowerBound.x);
109670                    r.lowerBound.y < i && (i = r.lowerBound.y);
109671                    r.upperBound.x > s && (s = r.upperBound.x);
109672                    r.upperBound.y > n && (n = r.upperBound.y);
109673                  }
109674                }
109675                e *= wbt;
109676                i *= wbt;
109677                s *= wbt;
109678                n *= wbt;
109679                const o = this._rect;
109680                o.x = e;
109681                o.y = i;
109682                o.width = s - e;
109683                o.height = n - i;
109684                return o;
109685              }
109686              getFixtureIndex(t) {
109687                return this._fixtures.indexOf(t);
109688              }
109689              _createShapes(t, e) {
109690                return [];
109691              }
109692              _init() {
109693                var t;
109694                if (this._inited) return;
109695                const e = this.collider;
109696                const i = e.getComponent(PSt);
109697                if (!i) return;
109698                const s = null === (t = i.impl) || void 0 === t ? void 0 : t.impl;
109699                if (!s) return;
109700                const n = i.node.worldScale;
109701                const r = 0 === n.x && 0 === n.y ? [] : this._createShapes(n.x, n.y);
109702                const o = $Tt(this);
109703                for (let t = 0; t < r.length; t++) {
109704                  const n = r[t];
109705                  const a = {
109706                    density: e.density,
109707                    isSensor: e.sensor,
109708                    friction: e.friction,
109709                    restitution: e.restitution,
109710                    shape: n,
109711                    filter: o
109712                  };
109713                  const l = s.CreateFixture(a);
109714                  l.m_userData = this;
109715                  i.enabledContactListener && hSt.instance.physicsWorld.registerContactFixture(l);
109716                  this._shapes.push(n);
109717                  this._fixtures.push(l);
109718                }
109719                this._body = s;
109720                this._inited = !0;
109721              }
109722              _destroy() {
109723                if (!this._inited) return;
109724                const t = this._fixtures;
109725                const e = this._body;
109726                for (let i = t.length - 1; i >= 0; i--) {
109727                  const s = t[i];
109728                  s.m_userData = null;
109729                  hSt.instance.physicsWorld.unregisterContactFixture(s);
109730                  e && e.DestroyFixture(s);
109731                }
109732                this._body = null;
109733                this._fixtures.length = 0;
109734                this._shapes.length = 0;
109735                this._inited = !1;
109736              }
109737            }
109738            const evt = new as;
109739            class ivt {
109740              constructor() {
109741                this._b2joint = null;
109742                this._jointComp = null;
109743                this._body = null;
109744                this._inited = !1;
109745              }
109746              get impl() {
109747                return this._b2joint;
109748              }
109749              get comp() {
109750                return this._jointComp;
109751              }
109752              get body() {
109753                return this._body;
109754              }
109755              initialize(t) {
109756                this._jointComp = t;
109757              }
109758              onEnable() {
109759                hSt.instance._callAfterStep(this, this._init);
109760              }
109761              onDisable() {
109762                hSt.instance._callAfterStep(this, this._destroy);
109763              }
109764              start() {
109765                hSt.instance._callAfterStep(this, this._init);
109766              }
109767              _init() {
109768                if (this._inited) return;
109769                const t = this._jointComp;
109770                if (!t.isValid) return;
109771                this._body = t.getComponent(PSt);
109772                const e = this._createJointDef();
109773                if (!e) return;
109774                const i = t.connectedBody;
109775                if (i && i.enabledInHierarchy) {
109776                  e.bodyA = this._body.impl.impl;
109777                  e.bodyB = i.impl.impl;
109778                  e.collideConnected = t.collideConnected;
109779                  this._b2joint = hSt.instance.physicsWorld.impl.CreateJoint(e);
109780                  this._inited = !0;
109781                }
109782              }
109783              _destroy() {
109784                if (this._inited) {
109785                  hSt.instance.physicsWorld.impl.DestroyJoint(this._b2joint);
109786                  this._b2joint = null;
109787                  this._inited = !1;
109788                }
109789              }
109790              _createJointDef() {
109791                return null;
109792              }
109793              isValid() {
109794                return this._b2joint && this._body && this._body.impl && this._jointComp && this._jointComp.connectedBody && this._jointComp.connectedBody.impl;
109795              }
109796            }
109797            const svt = new bbt.Vec2;
109798            !function(t, e) {
109799              pbt = t;
109800              m._global.CC_PHYSICS_2D_BUILTIN = "builtin" == t;
109801              m._global.CC_PHYSICS_2D_BOX2D = "box2d" == t;
109802              dbt = e;
109803            }("box2d", {
109804              PhysicsWorld: class {
109805                get impl() {
109806                  return this._world;
109807                }
109808                constructor() {
109809                  this._world = void 0;
109810                  this._bodies = [];
109811                  this._animatedBodies = [];
109812                  this._rotationAxis = new Pi;
109813                  this._contactListener = void 0;
109814                  this._aabbQueryCallback = void 0;
109815                  this._raycastQueryCallback = void 0;
109816                  this._debugGraphics = null;
109817                  this._b2DebugDrawer = null;
109818                  this._debugDrawFlags = 0;
109819                  this._world = new bbt.World(new bbt.Vec2(0, -10));
109820                  const t = new Rbt;
109821                  t.setBeginContact(this._onBeginContact);
109822                  t.setEndContact(this._onEndContact);
109823                  t.setPreSolve(this._onPreSolve);
109824                  t.setPostSolve(this._onPostSolve);
109825                  this._world.SetContactListener(t);
109826                  this._contactListener = t;
109827                  this._aabbQueryCallback = new Ibt;
109828                  this._raycastQueryCallback = new MTt;
109829                }
109830                get debugDrawFlags() {
109831                  return this._debugDrawFlags;
109832                }
109833                set debugDrawFlags(t) {
109834                  t || this._debugGraphics && (this._debugGraphics.node.parent = null);
109835                  this._debugDrawFlags = t;
109836                }
109837                _checkDebugDrawValid() {
109838                  if (!this._debugGraphics || !this._debugGraphics.isValid) {
109839                    let t = mv("Canvas");
109840                    if (!t) {
109841                      const e = IR.getScene();
109842                      if (!e) return;
109843                      t = new _y("Canvas");
109844                      t.addComponent(mF);
109845                      t.parent = e;
109846                    }
109847                    const e = new _y("PHYSICS_2D_DEBUG_DRAW");
109848                    e.hideFlags |= co.Flags.DontSave;
109849                    e.parent = t;
109850                    e.worldPosition = Pi.ZERO;
109851                    e.layer = mm.Enum.UI_2D;
109852                    this._debugGraphics = e.addComponent(dN);
109853                    this._debugGraphics.lineWidth = 2;
109854                    const i = new jTt(this._debugGraphics);
109855                    this._b2DebugDrawer = i;
109856                    this._world.SetDebugDraw(i);
109857                  }
109858                  const t = this._debugGraphics.node.parent;
109859                  this._debugGraphics.node.setSiblingIndex(t.children.length - 1);
109860                  this._b2DebugDrawer && this._b2DebugDrawer.SetFlags(this.debugDrawFlags);
109861                }
109862                setGravity(t) {
109863                  this._world.SetGravity(t);
109864                }
109865                setAllowSleep(t) {
109866                  this._world.SetAllowSleeping(!0);
109867                }
109868                step(t, e = 10, i = 10) {
109869                  const s = this._animatedBodies;
109870                  for (let e = 0, i = s.length; e < i; e++) s[e].animate(t);
109871                  this._world.Step(t, e, i);
109872                }
109873                raycast(t, e, i, s) {
109874                  if (t.equals(e)) return [];
109875                  i = i || Ebt.Closest;
109876                  WTt.x = t.x / wbt;
109877                  WTt.y = t.y / wbt;
109878                  YTt.x = e.x / wbt;
109879                  YTt.y = e.y / wbt;
109880                  const n = this._raycastQueryCallback;
109881                  n.init(i, s);
109882                  this._world.RayCast(n, WTt, YTt);
109883                  const r = n.getFixtures();
109884                  if (r.length > 0) {
109885                    const t = n.getPoints();
109886                    const e = n.getNormals();
109887                    const s = n.getFractions();
109888                    const o = [];
109889                    for (let n = 0, a = r.length; n < a; n++) {
109890                      const a = r[n];
109891                      const l = a.m_userData;
109892                      const h = l.collider;
109893                      if (i === Ebt.AllClosest) {
109894                        let i;
109895                        for (let t = 0; t < o.length; t++) o[t].collider === h && (i = o[t]);
109896                        if (i) {
109897                          if (s[n] < i.fraction) {
109898                            i.fixtureIndex = l.getFixtureIndex(a);
109899                            i.point.x = t[n].x * wbt;
109900                            i.point.y = t[n].y * wbt;
109901                            i.normal.x = e[n].x;
109902                            i.normal.y = e[n].y;
109903                            i.fraction = s[n];
109904                          }
109905                          continue;
109906                        }
109907                      }
109908                      o.push({
109909                        collider: h,
109910                        fixtureIndex: l.getFixtureIndex(a),
109911                        point: new Qi(t[n].x * wbt, t[n].y * wbt),
109912                        normal: new Qi(e[n].x, e[n].y),
109913                        fraction: s[n]
109914                      });
109915                    }
109916                    return o;
109917                  }
109918                  return [];
109919                }
109920                syncPhysicsToScene() {
109921                  const t = this._bodies;
109922                  for (let e = 0, i = t.length; e < i; e++) {
109923                    const i = t[e];
109924                    const s = i.rigidBody;
109925                    if (s.type === Sbt.Animated) {
109926                      i.resetVelocity();
109927                      continue;
109928                    }
109929                    const n = s.node;
109930                    const r = i.impl;
109931                    const o = r.GetPosition();
109932                    XTt.x = o.x * wbt;
109933                    XTt.y = o.y * wbt;
109934                    XTt.z = 0;
109935                    n.worldPosition = XTt;
109936                    const a = fi(r.GetAngle());
109937                    n.setWorldRotationFromEuler(0, 0, a);
109938                  }
109939                }
109940                syncSceneToPhysics() {
109941                  const t = this._bodies;
109942                  for (let e = 0; e < t.length; e++) {
109943                    t[e].syncRotationToPhysics();
109944                    t[e].syncPositionToPhysics();
109945                  }
109946                }
109947                addBody(t) {
109948                  if (this._bodies.includes(t)) return;
109949                  const e = qTt;
109950                  const i = t.rigidBody;
109951                  e.allowSleep = i.allowSleep;
109952                  e.gravityScale = i.gravityScale;
109953                  e.linearDamping = i.linearDamping;
109954                  e.angularDamping = i.angularDamping;
109955                  e.fixedRotation = i.fixedRotation;
109956                  e.bullet = i.bullet;
109957                  const s = i.node;
109958                  const n = s.worldPosition;
109959                  e.position.Set(n.x / wbt, n.y / wbt);
109960                  XTt.z = Ui.getAxisAngle(this._rotationAxis, s.worldRotation);
109961                  this._rotationAxis.z < 0 && (XTt.z = 2 * Math.PI - XTt.z);
109962                  e.angle = XTt.z;
109963                  e.awake = i.awakeOnLoad;
109964                  if (i.type === Sbt.Animated) {
109965                    e.type = Sbt.Kinematic;
109966                    this._animatedBodies.push(t);
109967                    t._animatedPos.set(e.position.x, e.position.y);
109968                    t._animatedAngle = e.angle;
109969                  } else e.type = i.type;
109970                  const r = i;
109971                  const o = r._linearVelocity;
109972                  e.linearVelocity.Set(o.x, o.y);
109973                  e.angularVelocity = mi(r._angularVelocity);
109974                  const a = this._world.CreateBody(e);
109975                  a.m_userData = t;
109976                  t._imp = a;
109977                  this._bodies.push(t);
109978                }
109979                removeBody(t) {
109980                  if (!this._bodies.includes(t)) return;
109981                  if (t.impl) {
109982                    t.impl.m_userData = null;
109983                    this._world.DestroyBody(t.impl);
109984                    t._imp = null;
109985                  }
109986                  te.remove(this._bodies, t);
109987                  t.rigidBody.type === Sbt.Animated && te.remove(this._animatedBodies, t);
109988                }
109989                registerContactFixture(t) {
109990                  this._contactListener.registerContactFixture(t);
109991                }
109992                unregisterContactFixture(t) {
109993                  this._contactListener.unregisterContactFixture(t);
109994                }
109995                testPoint(t) {
109996                  const e = WTt.x = t.x / wbt;
109997                  const i = WTt.y = t.y / wbt;
109998                  const s = .2 / wbt;
109999                  KTt.lowerBound.x = e - s;
110000                  KTt.lowerBound.y = i - s;
110001                  KTt.upperBound.x = e + s;
110002                  KTt.upperBound.y = i + s;
110003                  const n = this._aabbQueryCallback;
110004                  n.init(WTt);
110005                  this._world.QueryAABB(n, KTt);
110006                  const r = n.getFixtures();
110007                  JTt.length = 0;
110008                  for (let t = 0; t < r.length; t++) {
110009                    const e = r[t].m_userData.collider;
110010                    JTt.includes(e) || JTt.push(e);
110011                  }
110012                  return JTt;
110013                }
110014                testAABB(t) {
110015                  KTt.lowerBound.x = t.xMin / wbt;
110016                  KTt.lowerBound.y = t.yMin / wbt;
110017                  KTt.upperBound.x = t.xMax / wbt;
110018                  KTt.upperBound.y = t.yMax / wbt;
110019                  const e = this._aabbQueryCallback;
110020                  e.init();
110021                  this._world.QueryAABB(e, KTt);
110022                  const i = e.getFixtures();
110023                  JTt.length = 0;
110024                  for (let t = 0; t < i.length; t++) {
110025                    const e = i[t].m_userData.collider;
110026                    JTt.includes(e) || JTt.push(e);
110027                  }
110028                  return JTt;
110029                }
110030                drawDebug() {
110031                  this._checkDebugDrawValid();
110032                  if (this._debugGraphics) {
110033                    this._debugGraphics.clear();
110034                    this._world.DrawDebugData();
110035                  }
110036                }
110037                _onBeginContact(t) {
110038                  kTt.get(t).emit(Cbt.BEGIN_CONTACT);
110039                }
110040                _onEndContact(t) {
110041                  const e = t.m_userData;
110042                  if (e) {
110043                    e.emit(Cbt.END_CONTACT);
110044                    kTt.put(t);
110045                  }
110046                }
110047                _onPreSolve(t) {
110048                  const e = t.m_userData;
110049                  e && e.emit(Cbt.PRE_SOLVE);
110050                }
110051                _onPostSolve(t, e) {
110052                  const i = t.m_userData;
110053                  if (i) {
110054                    i._setImpulse(e);
110055                    i.emit(Cbt.POST_SOLVE);
110056                    i._setImpulse(null);
110057                  }
110058                }
110059              },
110060              RigidBody: class {
110061                constructor() {
110062                  this._animatedPos = new Qi;
110063                  this._animatedAngle = 0;
110064                  this._body = null;
110065                  this._inited = !1;
110066                }
110067                get impl() {
110068                  return this._body;
110069                }
110070                set _imp(t) {
110071                  this._body = t;
110072                }
110073                get rigidBody() {
110074                  return this._rigidBody;
110075                }
110076                get isAwake() {
110077                  return this._body.IsAwake();
110078                }
110079                get isSleeping() {
110080                  return !this._body.IsAwake();
110081                }
110082                initialize(t) {
110083                  this._rigidBody = t;
110084                  hSt.instance._callAfterStep(this, this._init);
110085                }
110086                onDestroy() {
110087                  hSt.instance._callAfterStep(this, this._destroy);
110088                }
110089                onEnable() {
110090                  this.setActive(!0);
110091                }
110092                onDisable() {
110093                  this.setActive(!1);
110094                }
110095                _registerNodeEvents() {
110096                  this.rigidBody.node.on(ny.TRANSFORM_CHANGED, this._onNodeTransformChanged, this);
110097                }
110098                _unregisterNodeEvents() {
110099                  this.rigidBody.node.off(ny.TRANSFORM_CHANGED, this._onNodeTransformChanged, this);
110100                }
110101                _onNodeTransformChanged(t) {
110102                  if (!hSt.instance.stepping) {
110103                    if (t & _y.TransformBit.SCALE) {
110104                      const t = this.rigidBody.getComponents(YSt);
110105                      for (let e = 0; e < t.length; e++) t[e].apply();
110106                    }
110107                    t & _y.TransformBit.POSITION && this.syncPositionToPhysics(!0);
110108                    t & _y.TransformBit.ROTATION && this.syncRotationToPhysics(!0);
110109                  }
110110                }
110111                _init() {
110112                  if (!this._inited) {
110113                    this._registerNodeEvents();
110114                    hSt.instance.physicsWorld.addBody(this);
110115                    this._inited = !0;
110116                  }
110117                }
110118                _destroy() {
110119                  if (this._inited) {
110120                    hSt.instance.physicsWorld.removeBody(this);
110121                    this._unregisterNodeEvents();
110122                    this._inited = !1;
110123                  }
110124                }
110125                animate(t) {
110126                  const e = this._body;
110127                  if (!e) return;
110128                  const i = e.GetPosition();
110129                  e.SetAwake(!0);
110130                  const s = 1 / t;
110131                  ZTt.x = (this._animatedPos.x - i.x) * s;
110132                  ZTt.y = (this._animatedPos.y - i.y) * s;
110133                  e.SetLinearVelocity(ZTt);
110134                  const n = e.GetAngle();
110135                  e.SetAngularVelocity((this._animatedAngle - n) * s);
110136                }
110137                syncPositionToPhysics(t = !1) {
110138                  const e = this._body;
110139                  if (!e) return;
110140                  const i = this._rigidBody.node.worldPosition;
110141                  let s;
110142                  const n = this._rigidBody.type;
110143                  s = n === Sbt.Animated ? e.GetLinearVelocity() : e.GetPosition();
110144                  s.x = i.x / wbt;
110145                  s.y = i.y / wbt;
110146                  n === Sbt.Animated && t ? this._animatedPos.set(s.x, s.y) : e.SetTransformVec(s, e.GetAngle());
110147                }
110148                syncRotationToPhysics(t = !1) {
110149                  const e = this._body;
110150                  if (!e) return;
110151                  const i = mi(this._rigidBody.node.eulerAngles.z);
110152                  this._rigidBody.type === Sbt.Animated && t ? this._animatedAngle = i : e.SetTransformVec(e.GetPosition(), i);
110153                }
110154                resetVelocity() {
110155                  const t = this._body;
110156                  if (!t) return;
110157                  const e = t.m_linearVelocity;
110158                  e.Set(0, 0);
110159                  t.SetLinearVelocity(e);
110160                  t.SetAngularVelocity(0);
110161                }
110162                setType(t) {
110163                  this._body.SetType(t);
110164                }
110165                setLinearDamping(t) {
110166                  this._body.SetLinearDamping(t);
110167                }
110168                setAngularDamping(t) {
110169                  this._body.SetAngularDamping(t);
110170                }
110171                setGravityScale(t) {
110172                  this._body.SetGravityScale(t);
110173                }
110174                setFixedRotation(t) {
110175                  this._body.SetFixedRotation(t);
110176                }
110177                setAllowSleep(t) {
110178                  this._body.SetSleepingAllowed(t);
110179                }
110180                isActive() {
110181                  return this._body.IsActive();
110182                }
110183                setActive(t) {
110184                  this._body.SetActive(t);
110185                }
110186                wakeUp() {
110187                  this._body.SetAwake(!0);
110188                }
110189                sleep() {
110190                  this._body.SetAwake(!1);
110191                }
110192                getMass() {
110193                  return this._body.GetMass();
110194                }
110195                setLinearVelocity(t) {
110196                  this._body.SetLinearVelocity(t);
110197                }
110198                getLinearVelocity(t) {
110199                  const e = this._body.GetLinearVelocity();
110200                  t.x = e.x;
110201                  t.y = e.y;
110202                  return t;
110203                }
110204                getLinearVelocityFromWorldPoint(t, e) {
110205                  ZTt.Set(t.x / wbt, t.y / wbt);
110206                  this._body.GetLinearVelocityFromWorldPoint(ZTt, e);
110207                  e.x *= wbt;
110208                  e.y *= wbt;
110209                  return e;
110210                }
110211                setAngularVelocity(t) {
110212                  this._body.SetAngularVelocity(t);
110213                }
110214                getAngularVelocity() {
110215                  return fi(this._body.GetAngularVelocity());
110216                }
110217                getLocalVector(t, e) {
110218                  e = e || new Qi;
110219                  ZTt.Set(t.x / wbt, t.y / wbt);
110220                  this._body.GetLocalVector(ZTt, e);
110221                  e.x *= wbt;
110222                  e.y *= wbt;
110223                  return e;
110224                }
110225                getWorldVector(t, e) {
110226                  ZTt.Set(t.x / wbt, t.y / wbt);
110227                  this._body.GetWorldVector(ZTt, e);
110228                  e.x *= wbt;
110229                  e.y *= wbt;
110230                  return e;
110231                }
110232                getLocalPoint(t, e) {
110233                  e = e || new Qi;
110234                  ZTt.Set(t.x / wbt, t.y / wbt);
110235                  this._body.GetLocalPoint(ZTt, e);
110236                  e.x *= wbt;
110237                  e.y *= wbt;
110238                  return e;
110239                }
110240                getWorldPoint(t, e) {
110241                  e = e || new Qi;
110242                  ZTt.Set(t.x / wbt, t.y / wbt);
110243                  this._body.GetWorldPoint(ZTt, e);
110244                  e.x *= wbt;
110245                  e.y *= wbt;
110246                  return e;
110247                }
110248                getLocalCenter(t) {
110249                  t = t || new Qi;
110250                  const e = this._body.GetLocalCenter();
110251                  t.x = e.x * wbt;
110252                  t.y = e.y * wbt;
110253                  return t;
110254                }
110255                getWorldCenter(t) {
110256                  t = t || new Qi;
110257                  const e = this._body.GetWorldCenter();
110258                  t.x = e.x * wbt;
110259                  t.y = e.y * wbt;
110260                  return t;
110261                }
110262                getInertia() {
110263                  return this._body.GetInertia();
110264                }
110265                applyForce(t, e, i) {
110266                  if (this._body) {
110267                    ZTt.Set(e.x / wbt, e.y / wbt);
110268                    this._body.ApplyForce(t, ZTt, i);
110269                  }
110270                }
110271                applyForceToCenter(t, e) {
110272                  this._body && this._body.ApplyForceToCenter(t, e);
110273                }
110274                applyTorque(t, e) {
110275                  this._body && this._body.ApplyTorque(t, e);
110276                }
110277                applyLinearImpulse(t, e, i) {
110278                  if (this._body) {
110279                    ZTt.Set(e.x / wbt, e.y / wbt);
110280                    this._body.ApplyLinearImpulse(t, ZTt, i);
110281                  }
110282                }
110283                applyLinearImpulseToCenter(t, e) {
110284                  this._body && this._body.ApplyLinearImpulse(t, this._body.GetPosition(), e);
110285                }
110286                applyAngularImpulse(t, e) {
110287                  this._body && this._body.ApplyAngularImpulse(t, e);
110288                }
110289              },
110290              BoxShape: class extends tvt {
110291                constructor(...t) {
110292                  super(...t);
110293                  this._worldPoints = [ new Qi, new Qi, new Qi, new Qi ];
110294                }
110295                get worldPoints() {
110296                  const t = evt;
110297                  const e = this.collider;
110298                  const i = e.size;
110299                  const s = e.offset;
110300                  t.x = s.x - i.width / 2;
110301                  t.y = s.y - i.height / 2;
110302                  t.width = i.width;
110303                  t.height = i.height;
110304                  const n = this._worldPoints;
110305                  const r = n[0];
110306                  const o = n[1];
110307                  const a = n[2];
110308                  const l = n[3];
110309                  t.transformMat4ToPoints(e.node.worldMatrix, r, o, a, l);
110310                  return n;
110311                }
110312                _createShapes(t, e) {
110313                  t = Math.abs(t);
110314                  e = Math.abs(e);
110315                  const i = this.collider;
110316                  const s = i.size.width / 2 / wbt * t;
110317                  const n = i.size.height / 2 / wbt * e;
110318                  const r = i.offset.x / wbt * t;
110319                  const o = i.offset.y / wbt * e;
110320                  const a = new bbt.PolygonShape;
110321                  a.SetAsBox(s, n, new bbt.Vec2(r, o), 0);
110322                  return [ a ];
110323                }
110324              },
110325              CircleShape: class extends tvt {
110326                constructor(...t) {
110327                  super(...t);
110328                  this._worldPosition = new Qi;
110329                }
110330                get worldRadius() {
110331                  return this._shapes[0].m_radius * wbt;
110332                }
110333                get worldPosition() {
110334                  const t = this._shapes[0].m_p;
110335                  return this._worldPosition.set(t.x * wbt, t.y * wbt);
110336                }
110337                _createShapes(t, e) {
110338                  t = Math.abs(t);
110339                  e = Math.abs(e);
110340                  const i = this.collider;
110341                  const s = i.offset.x / wbt * t;
110342                  const n = i.offset.y / wbt * e;
110343                  const r = new bbt.CircleShape;
110344                  r.m_radius = i.radius / wbt * t;
110345                  r.m_p.Set(s, n);
110346                  return [ r ];
110347                }
110348              },
110349              PolygonShape: class extends tvt {
110350                constructor(...t) {
110351                  super(...t);
110352                  this._worldPoints = [];
110353                }
110354                get worldPoints() {
110355                  const t = this.collider;
110356                  const e = t.points;
110357                  const i = this._worldPoints;
110358                  const s = t.node.worldMatrix;
110359                  for (let t = 0; t < e.length; t++) {
110360                    i[t] || (i[t] = new Qi);
110361                    Qi.transformMat4(i[t], e[t], s);
110362                  }
110363                  i.length = e.length;
110364                  return this._worldPoints;
110365                }
110366                _createShapes(t, e) {
110367                  const i = [];
110368                  const s = this.collider;
110369                  const n = s.points;
110370                  n.length > 0 && n[0].equals(n[n.length - 1]) && (n.length -= 1);
110371                  const r = Dbt(n);
110372                  const o = s.offset;
110373                  for (let s = 0; s < r.length; s++) {
110374                    const n = r[s];
110375                    let a = null;
110376                    let l = [];
110377                    let h = null;
110378                    for (let s = 0, r = n.length; s < r; s++) {
110379                      a || (a = new bbt.PolygonShape);
110380                      const c = n[s];
110381                      const u = (c.x + o.x) / wbt * t;
110382                      const _ = (c.y + o.y) / wbt * e;
110383                      const d = new bbt.Vec2(u, _);
110384                      l.push(d);
110385                      h || (h = d);
110386                      if (l.length === bbt.maxPolygonVertices) {
110387                        a.Set(l, l.length);
110388                        i.push(a);
110389                        a = null;
110390                        s < r - 1 && (l = [ h, l[l.length - 1] ]);
110391                      }
110392                    }
110393                    if (a) {
110394                      a.Set(l, l.length);
110395                      i.push(a);
110396                    }
110397                  }
110398                  return i;
110399                }
110400              },
110401              MouseJoint: class extends ivt {
110402                constructor(...t) {
110403                  super(...t);
110404                  this._touchPoint = new Qi;
110405                  this._isTouched = !1;
110406                }
110407                setTarget(t) {
110408                  if (this._b2joint) {
110409                    svt.x = t.x / wbt;
110410                    svt.y = t.y / wbt;
110411                    this._b2joint.SetTarget(svt);
110412                  }
110413                }
110414                setDampingRatio(t) {
110415                  this._b2joint && this._b2joint.SetDampingRatio(t);
110416                }
110417                setFrequency(t) {
110418                  this._b2joint && this._b2joint.SetFrequency(t);
110419                }
110420                setMaxForce(t) {
110421                  this._b2joint && this._b2joint.SetMaxForce(t);
110422                }
110423                _createJointDef() {
110424                  const t = new bbt.MouseJointDef;
110425                  const e = this._jointComp;
110426                  t.target.Set(this._touchPoint.x / wbt, this._touchPoint.y / wbt);
110427                  t.maxForce = e.maxForce;
110428                  t.dampingRatio = e.dampingRatio;
110429                  t.frequencyHz = e.frequency;
110430                  return t;
110431                }
110432                initialize(t) {
110433                  super.initialize(t);
110434                  const e = mv("Canvas");
110435                  if (e) {
110436                    e.on(ny.TOUCH_START, this.onTouchBegan, this);
110437                    e.on(ny.TOUCH_MOVE, this.onTouchMove, this);
110438                    e.on(ny.TOUCH_END, this.onTouchEnd, this);
110439                    e.on(ny.TOUCH_CANCEL, this.onTouchEnd, this);
110440                  }
110441                }
110442                onEnable() {}
110443                start() {}
110444                onTouchBegan(t) {
110445                  this._isTouched = !0;
110446                  const e = this._touchPoint.set(t.getUILocation());
110447                  const i = hSt.instance.physicsWorld.testPoint(e);
110448                  if (i.length <= 0) return;
110449                  const s = i[0].body;
110450                  s.wakeUp();
110451                  const n = this._jointComp;
110452                  n.connectedBody = s;
110453                  this._init();
110454                  this.setMaxForce(n.maxForce * s.getMass());
110455                  this.setTarget(e);
110456                }
110457                onTouchMove(t) {
110458                  this._touchPoint = t.getUILocation();
110459                }
110460                onTouchEnd(t) {
110461                  this._destroy();
110462                  this._isTouched = !1;
110463                }
110464                update() {
110465                  this._isTouched && this.isValid() && this.setTarget(this._touchPoint);
110466                }
110467              },
110468              DistanceJoint: class extends ivt {
110469                setMaxLength(t) {
110470                  this._b2joint && this._b2joint.SetMaxLength(t);
110471                }
110472                _createJointDef() {
110473                  const t = this._jointComp;
110474                  const e = new bbt.RopeJointDef;
110475                  e.localAnchorA.Set(t.anchor.x / wbt, t.anchor.y / wbt);
110476                  e.localAnchorB.Set(t.connectedAnchor.x / wbt, t.connectedAnchor.y / wbt);
110477                  e.maxLength = t.maxLength / wbt;
110478                  return e;
110479                }
110480              },
110481              SpringJoint: class extends ivt {
110482                setDampingRatio(t) {
110483                  this._b2joint && this._b2joint.SetDampingRatio(t);
110484                }
110485                setFrequency(t) {
110486                  this._b2joint && this._b2joint.SetFrequency(t);
110487                }
110488                setDistance(t) {
110489                  this._b2joint && this._b2joint.SetLength(t);
110490                }
110491                _createJointDef() {
110492                  const t = this._jointComp;
110493                  const e = new bbt.DistanceJointDef;
110494                  e.localAnchorA.Set(t.anchor.x / wbt, t.anchor.y / wbt);
110495                  e.localAnchorB.Set(t.connectedAnchor.x / wbt, t.connectedAnchor.y / wbt);
110496                  e.length = t.distance / wbt;
110497                  e.dampingRatio = t.dampingRatio;
110498                  e.frequencyHz = t.frequency;
110499                  return e;
110500                }
110501              },
110502              RelativeJoint: class extends ivt {
110503                setMaxForce(t) {
110504                  this._b2joint && this._b2joint.SetMaxForce(t);
110505                }
110506                setAngularOffset(t) {
110507                  this._b2joint && this._b2joint.SetAngularOffset(mi(t));
110508                }
110509                setLinearOffset(t) {
110510                  this._b2joint && this._b2joint.SetLinearOffset(new bbt.Vec2(t.x / wbt, t.y / wbt));
110511                }
110512                setCorrectionFactor(t) {
110513                  this._b2joint && (this._b2joint.m_correctionFactor = t);
110514                }
110515                setMaxTorque(t) {
110516                  this._b2joint && this._b2joint.SetMaxTorque(t);
110517                }
110518                _createJointDef() {
110519                  const t = this._jointComp;
110520                  const e = new bbt.MotorJointDef;
110521                  e.linearOffset.Set(t.linearOffset.x / wbt, t.linearOffset.y / wbt);
110522                  e.angularOffset = mi(t.angularOffset);
110523                  e.maxForce = t.maxForce;
110524                  e.maxTorque = t.maxTorque;
110525                  e.correctionFactor = t.correctionFactor;
110526                  return e;
110527                }
110528              },
110529              SliderJoint: class extends ivt {
110530                enableLimit(t) {
110531                  this._b2joint && this._b2joint.EnableLimit(t);
110532                }
110533                setLowerLimit(t) {
110534                  this.updateLimits();
110535                }
110536                setUpperLimit(t) {
110537                  this.updateLimits();
110538                }
110539                updateLimits() {
110540                  if (this._b2joint) {
110541                    const t = this._jointComp;
110542                    this._b2joint.SetLimits(t.lowerLimit / wbt, t.upperLimit / wbt);
110543                  }
110544                }
110545                enableMotor(t) {
110546                  this._b2joint && this._b2joint.EnableMotor(t);
110547                }
110548                setMaxMotorForce(t) {
110549                  this._b2joint && this._b2joint.SetMaxMotorForce(t);
110550                }
110551                setMotorSpeed(t) {
110552                  this._b2joint && this._b2joint.SetMotorSpeed(t);
110553                }
110554                _createJointDef() {
110555                  const t = this._jointComp;
110556                  const e = new bbt.PrismaticJointDef;
110557                  e.localAnchorA.Set(t.anchor.x / wbt, t.anchor.y / wbt);
110558                  e.localAnchorB.Set(t.connectedAnchor.x / wbt, t.connectedAnchor.y / wbt);
110559                  const i = mi(t.angle);
110560                  e.localAxisA.Set(Math.cos(i), Math.sin(i));
110561                  e.referenceAngle = 0;
110562                  e.enableLimit = t.enableLimit;
110563                  e.lowerTranslation = t.lowerLimit / wbt;
110564                  e.upperTranslation = t.upperLimit / wbt;
110565                  e.enableMotor = t.enableMotor;
110566                  e.maxMotorForce = t.maxMotorForce;
110567                  e.motorSpeed = t.motorSpeed;
110568                  return e;
110569                }
110570              },
110571              FixedJoint: class extends ivt {
110572                setFrequency(t) {
110573                  this._b2joint && this._b2joint.SetFrequency(t);
110574                }
110575                setDampingRatio(t) {
110576                  this._b2joint && this._b2joint.SetDampingRatio(t);
110577                }
110578                _createJointDef() {
110579                  const t = this._jointComp;
110580                  const e = new bbt.WeldJointDef;
110581                  e.localAnchorA.Set(t.anchor.x / wbt, t.anchor.y / wbt);
110582                  e.localAnchorB.Set(t.connectedAnchor.x / wbt, t.connectedAnchor.y / wbt);
110583                  e.referenceAngle = 0;
110584                  e.frequencyHz = t.frequency;
110585                  e.dampingRatio = t.dampingRatio;
110586                  return e;
110587                }
110588              },
110589              WheelJoint: class extends ivt {
110590                setDampingRatio(t) {
110591                  this._b2joint && this._b2joint.SetSpringDampingRatio(t);
110592                }
110593                setFrequency(t) {
110594                  this._b2joint && this._b2joint.SetSpringFrequencyHz(t);
110595                }
110596                enableMotor(t) {
110597                  this._b2joint && this._b2joint.EnableMotor(t);
110598                }
110599                setMaxMotorTorque(t) {
110600                  this._b2joint && this._b2joint.SetMaxMotorTorque(t);
110601                }
110602                setMotorSpeed(t) {
110603                  this._b2joint && this._b2joint.SetMotorSpeed(t);
110604                }
110605                _createJointDef() {
110606                  const t = this._jointComp;
110607                  const e = new bbt.WheelJointDef;
110608                  e.localAnchorA.Set(t.anchor.x / wbt, t.anchor.y / wbt);
110609                  e.localAnchorB.Set(t.connectedAnchor.x / wbt, t.connectedAnchor.y / wbt);
110610                  const i = mi(t.angle);
110611                  e.localAxisA.Set(Math.cos(i), Math.sin(i));
110612                  e.maxMotorTorque = t.maxMotorTorque;
110613                  e.motorSpeed = mi(t.motorSpeed);
110614                  e.enableMotor = t.enableMotor;
110615                  e.dampingRatio = t.dampingRatio;
110616                  e.frequencyHz = t.frequency;
110617                  return e;
110618                }
110619              },
110620              HingeJoint: class extends ivt {
110621                enableLimit(t) {
110622                  this._b2joint && this._b2joint.EnableLimit(t);
110623                }
110624                setLowerAngle(t) {
110625                  this.updateLimits();
110626                }
110627                setUpperAngle(t) {
110628                  this.updateLimits();
110629                }
110630                updateLimits() {
110631                  if (this._b2joint) {
110632                    const t = this._jointComp;
110633                    this._b2joint.SetLimits(mi(t.lowerAngle), mi(t.upperAngle));
110634                  }
110635                }
110636                enableMotor(t) {
110637                  this._b2joint && this._b2joint.EnableMotor(t);
110638                }
110639                setMaxMotorTorque(t) {
110640                  this._b2joint && this._b2joint.SetMaxMotorTorque(t);
110641                }
110642                setMotorSpeed(t) {
110643                  this._b2joint && this._b2joint.SetMotorSpeed(t);
110644                }
110645                _createJointDef() {
110646                  const t = this._jointComp;
110647                  const e = new bbt.RevoluteJointDef;
110648                  e.localAnchorA.Set(t.anchor.x / wbt, t.anchor.y / wbt);
110649                  e.localAnchorB.Set(t.connectedAnchor.x / wbt, t.connectedAnchor.y / wbt);
110650                  e.enableMotor = t.enableMotor;
110651                  e.maxMotorTorque = t.maxMotorTorque;
110652                  e.motorSpeed = mi(t.motorSpeed);
110653                  e.enableLimit = t.enableLimit;
110654                  e.lowerAngle = t.lowerAngle;
110655                  e.upperAngle = t.upperAngle;
110656                  return e;
110657                }
110658              }
110659            });
110660            function nvt(t) {
110661              m._global.CC_PHYSICS_BUILTIN = "builtin" === t;
110662              m._global.CC_PHYSICS_CANNON = "cannon.js" === t;
110663              m._global.CC_PHYSICS_AMMO = "bullet" === t;
110664            }
110665            let rvt;
110666            const ovt = {
110667              id: "",
110668              switchTo: function(t) {
110669                if (!ovt.runInEditor) return;
110670                const e = ovt;
110671                if (ovt.physicsWorld && t !== ovt.id && null != ovt.backend[t]) {
110672                  ovt.physicsWorld.destroy();
110673                  console.info(`[PHYSICS]: switch from ${ovt.id} to ${t}.`);
110674                  nvt(t);
110675                  e.id = t;
110676                  e.wrapper = ovt.backend[t];
110677                  e.physicsWorld = uvt();
110678                } else {
110679                  console.info(`[PHYSICS]: using ${t}.`);
110680                  e.physicsWorld = uvt();
110681                }
110682                if (rvt) {
110683                  const t = e.physicsWorld;
110684                  t.setGravity(rvt.gravity);
110685                  t.setAllowSleep(rvt.allowSleep);
110686                }
110687              },
110688              register: function(t, e) {
110689                console.info(`[PHYSICS]: register ${t}.`);
110690                ovt.backend[t] = e;
110691                if (!ovt.physicsWorld || ovt.id === t) {
110692                  nvt(t);
110693                  const i = ovt;
110694                  i.id = t;
110695                  i.wrapper = e;
110696                }
110697              },
110698              wrapper: {},
110699              backend: {},
110700              physicsWorld: null,
110701              runInEditor: !0
110702            };
110703            const avt = (...t) => 0;
110704            const lvt = {
110705              impl: null,
110706              setGravity: avt,
110707              setAllowSleep: avt,
110708              setDefaultMaterial: avt,
110709              step: avt,
110710              syncAfterEvents: avt,
110711              syncSceneToPhysics: avt,
110712              raycast: avt,
110713              raycastClosest: avt,
110714              emitEvents: avt,
110715              destroy: avt
110716            };
110717            var hvt;
110718            !function(t) {
110719              t[t.World = 0] = "World";
110720              t[t.RigidBody = 1] = "RigidBody";
110721              t[t.BoxCollider = 2] = "BoxCollider";
110722              t[t.SphereCollider = 3] = "SphereCollider";
110723              t[t.CapsuleCollider = 4] = "CapsuleCollider";
110724              t[t.MeshCollider = 5] = "MeshCollider";
110725              t[t.CylinderCollider = 6] = "CylinderCollider";
110726              t[t.ConeCollider = 7] = "ConeCollider";
110727              t[t.TerrainCollider = 8] = "TerrainCollider";
110728              t[t.SimplexCollider = 9] = "SimplexCollider";
110729              t[t.PlaneCollider = 10] = "PlaneCollider";
110730              t[t.PointToPointConstraint = 11] = "PointToPointConstraint";
110731              t[t.HingeConstraint = 12] = "HingeConstraint";
110732              t[t.ConeTwistConstraint = 13] = "ConeTwistConstraint";
110733            }(hvt || (hvt = {}));
110734            function cvt(t, e) {
110735              if (null == t) {
110736                ovt.id ? C(`${ovt.id} physics does not support ${hvt[e]}`) : F(9600);
110737                return !0;
110738              }
110739              return !1;
110740            }
110741            function uvt() {
110742              return cvt(ovt.wrapper.PhysicsWorld, hvt.World) ? lvt : new ovt.wrapper.PhysicsWorld;
110743            }
110744            const _vt = {
110745              impl: null,
110746              rigidBody: null,
110747              isAwake: !1,
110748              isSleepy: !1,
110749              isSleeping: !1,
110750              initialize: avt,
110751              onEnable: avt,
110752              onDisable: avt,
110753              onDestroy: avt,
110754              setType: avt,
110755              setMass: avt,
110756              setLinearDamping: avt,
110757              setAngularDamping: avt,
110758              useGravity: avt,
110759              setLinearFactor: avt,
110760              setAngularFactor: avt,
110761              setAllowSleep: avt,
110762              wakeUp: avt,
110763              sleep: avt,
110764              clearState: avt,
110765              clearForces: avt,
110766              clearVelocity: avt,
110767              setSleepThreshold: avt,
110768              getSleepThreshold: avt,
110769              getLinearVelocity: avt,
110770              setLinearVelocity: avt,
110771              getAngularVelocity: avt,
110772              setAngularVelocity: avt,
110773              applyForce: avt,
110774              applyLocalForce: avt,
110775              applyImpulse: avt,
110776              applyLocalImpulse: avt,
110777              applyTorque: avt,
110778              applyLocalTorque: avt,
110779              setGroup: avt,
110780              getGroup: avt,
110781              addGroup: avt,
110782              removeGroup: avt,
110783              setMask: avt,
110784              getMask: avt,
110785              addMask: avt,
110786              removeMask: avt,
110787              isUsingCCD: avt,
110788              useCCD: avt
110789            };
110790            const dvt = {
110791              INITED: !1
110792            };
110793            const pvt = {
110794              impl: null,
110795              collider: null,
110796              attachedRigidBody: null,
110797              initialize: avt,
110798              onLoad: avt,
110799              onEnable: avt,
110800              onDisable: avt,
110801              onDestroy: avt,
110802              setGroup: avt,
110803              getGroup: avt,
110804              addGroup: avt,
110805              removeGroup: avt,
110806              setMask: avt,
110807              getMask: avt,
110808              addMask: avt,
110809              removeMask: avt,
110810              setMaterial: avt,
110811              setAsTrigger: avt,
110812              setCenter: avt,
110813              getAABB: avt,
110814              getBoundingSphere: avt,
110815              updateSize: avt,
110816              updateRadius: avt,
110817              setRadius: avt,
110818              setCylinderHeight: avt,
110819              setDirection: avt,
110820              setHeight: avt,
110821              setShapeType: avt,
110822              setVertices: avt,
110823              setMesh: avt,
110824              setTerrain: avt,
110825              setNormal: avt,
110826              setConstant: avt,
110827              updateEventListener: avt
110828            };
110829            function mvt(t) {
110830              !function() {
110831                if (dvt.INITED) return;
110832                dvt.INITED = !0;
110833                dvt[nSt.BOX] = function() {
110834                  return cvt(ovt.wrapper.BoxShape, hvt.BoxCollider) ? pvt : new ovt.wrapper.BoxShape;
110835                };
110836                dvt[nSt.SPHERE] = function() {
110837                  return cvt(ovt.wrapper.SphereShape, hvt.SphereCollider) ? pvt : new ovt.wrapper.SphereShape;
110838                };
110839                dvt[nSt.CAPSULE] = function() {
110840                  return cvt(ovt.wrapper.CapsuleShape, hvt.CapsuleCollider) ? pvt : new ovt.wrapper.CapsuleShape;
110841                };
110842                dvt[nSt.CYLINDER] = function() {
110843                  return cvt(ovt.wrapper.CylinderShape, hvt.CylinderCollider) ? pvt : new ovt.wrapper.CylinderShape;
110844                };
110845                dvt[nSt.CONE] = function() {
110846                  return cvt(ovt.wrapper.ConeShape, hvt.ConeCollider) ? pvt : new ovt.wrapper.ConeShape;
110847                };
110848                dvt[nSt.MESH] = function() {
110849                  return cvt(ovt.wrapper.TrimeshShape, hvt.MeshCollider) ? pvt : new ovt.wrapper.TrimeshShape;
110850                };
110851                dvt[nSt.TERRAIN] = function() {
110852                  return cvt(ovt.wrapper.TerrainShape, hvt.TerrainCollider) ? pvt : new ovt.wrapper.TerrainShape;
110853                };
110854                dvt[nSt.SIMPLEX] = function() {
110855                  return cvt(ovt.wrapper.SimplexShape, hvt.SimplexCollider) ? pvt : new ovt.wrapper.SimplexShape;
110856                };
110857                dvt[nSt.PLANE] = function() {
110858                  return cvt(ovt.wrapper.PlaneShape, hvt.PlaneCollider) ? pvt : new ovt.wrapper.PlaneShape;
110859                };
110860              }();
110861              return dvt[t]();
110862            }
110863            const fvt = {
110864              INITED: !1
110865            };
110866            const gvt = {
110867              impl: null,
110868              initialize: avt,
110869              onLoad: avt,
110870              onEnable: avt,
110871              onDisable: avt,
110872              onDestroy: avt,
110873              setEnableCollision: avt,
110874              setConnectedBody: avt,
110875              setPivotA: avt,
110876              setPivotB: avt,
110877              setAxis: avt
110878            };
110879            function yvt(t) {
110880              !function() {
110881                if (fvt.INITED) return;
110882                fvt.INITED = !0;
110883                fvt[rSt.POINT_TO_POINT] = function() {
110884                  return cvt(ovt.wrapper.PointToPointConstraint, hvt.PointToPointConstraint) ? gvt : new ovt.wrapper.PointToPointConstraint;
110885                };
110886                fvt[rSt.HINGE] = function() {
110887                  return cvt(ovt.wrapper.HingeConstraint, hvt.HingeConstraint) ? gvt : new ovt.wrapper.HingeConstraint;
110888                };
110889                fvt[rSt.CONE_TWIST] = function() {
110890                  return cvt(ovt.wrapper.ConeTwistConstraint, hvt.ConeTwistConstraint) ? gvt : new ovt.wrapper.ConeTwistConstraint;
110891                };
110892              }();
110893              return fvt[t]();
110894            }
110895            ovt.id = "physx";
110896            var bvt, Svt, Avt, Tvt, vvt, Evt, Cvt, xvt;
110897            let wvt = function(e) {
110898              return t({
110899                PhysicsMaterial: e,
110900                PhysicMaterial: e
110901              }), e;
110902            }(Ul("cc.PhysicsMaterial")(bvt = (Svt = (xvt = Cvt = class t extends gc {
110903              get friction() {
110904                return this._friction;
110905              }
110906              set friction(e) {
110907                if (!ci(this._friction, e)) {
110908                  this._friction = e;
110909                  this.emit(t.EVENT_UPDATE);
110910                }
110911              }
110912              get rollingFriction() {
110913                return this._rollingFriction;
110914              }
110915              set rollingFriction(e) {
110916                if (!ci(this._rollingFriction, e)) {
110917                  this._rollingFriction = e;
110918                  this.emit(t.EVENT_UPDATE);
110919                }
110920              }
110921              get spinningFriction() {
110922                return this._spinningFriction;
110923              }
110924              set spinningFriction(e) {
110925                if (!ci(this._spinningFriction, e)) {
110926                  this._spinningFriction = e;
110927                  this.emit(t.EVENT_UPDATE);
110928                }
110929              }
110930              get restitution() {
110931                return this._restitution;
110932              }
110933              set restitution(e) {
110934                if (!ci(this._restitution, e)) {
110935                  this._restitution = e;
110936                  this.emit(t.EVENT_UPDATE);
110937                }
110938              }
110939              constructor() {
110940                super();
110941                this.id = void 0;
110942                Ml(this, "_friction", Avt, this);
110943                Ml(this, "_rollingFriction", Tvt, this);
110944                Ml(this, "_spinningFriction", vvt, this);
110945                Ml(this, "_restitution", Evt, this);
110946                t.allMaterials.push(this);
110947                this.id = t._idCounter++;
110948                this._uuid || (this._uuid = `pm_${this.id}`);
110949              }
110950              clone() {
110951                const e = new t;
110952                e._friction = this._friction;
110953                e._restitution = this._restitution;
110954                e._rollingFriction = this._rollingFriction;
110955                e._spinningFriction = this._spinningFriction;
110956                return e;
110957              }
110958              destroy() {
110959                if (super.destroy()) {
110960                  const e = t.allMaterials.indexOf(this);
110961                  e >= 0 && t.allMaterials.splice(e, 1);
110962                  return !0;
110963                }
110964                return !1;
110965              }
110966              setValues(e, i, s, n) {
110967                const r = this._friction !== e || this._rollingFriction !== i || this._spinningFriction !== s || this._restitution !== n;
110968                this._friction = e;
110969                this._rollingFriction = i;
110970                this._spinningFriction = s;
110971                this._restitution = n;
110972                r && this.emit(t.EVENT_UPDATE);
110973              }
110974            }, Cvt.allMaterials = [], Cvt.EVENT_UPDATE = "event_update", Cvt._idCounter = 0,
110975            xvt), Bl(Svt.prototype, "friction", [ nh ], Object.getOwnPropertyDescriptor(Svt.prototype, "friction"), Svt.prototype),
110976            Bl(Svt.prototype, "rollingFriction", [ nh ], Object.getOwnPropertyDescriptor(Svt.prototype, "rollingFriction"), Svt.prototype),
110977            Bl(Svt.prototype, "spinningFriction", [ nh ], Object.getOwnPropertyDescriptor(Svt.prototype, "spinningFriction"), Svt.prototype),
110978            Bl(Svt.prototype, "restitution", [ nh ], Object.getOwnPropertyDescriptor(Svt.prototype, "restitution"), Svt.prototype),
110979            Avt = Bl(Svt.prototype, "_friction", [ Yl ], {
110980              configurable: !0,
110981              enumerable: !0,
110982              writable: !0,
110983              initializer: function() {
110984                return .6;
110985              }
110986            }), Tvt = Bl(Svt.prototype, "_rollingFriction", [ Yl ], {
110987              configurable: !0,
110988              enumerable: !0,
110989              writable: !0,
110990              initializer: function() {
110991                return 0;
110992              }
110993            }), vvt = Bl(Svt.prototype, "_spinningFriction", [ Yl ], {
110994              configurable: !0,
110995              enumerable: !0,
110996              writable: !0,
110997              initializer: function() {
110998                return 0;
110999              }
111000            }), Evt = Bl(Svt.prototype, "_restitution", [ Yl ], {
111001              configurable: !0,
111002              enumerable: !0,
111003              writable: !0,
111004              initializer: function() {
111005                return 0;
111006              }
111007            }), Svt)) || bvt);
111008            class Rvt {
111009              constructor() {
111010                this._hitPoint = new Pi;
111011                this._hitNormal = new Pi;
111012                this._distance = 0;
111013                this._collider = null;
111014              }
111015              get hitPoint() {
111016                return this._hitPoint;
111017              }
111018              get distance() {
111019                return this._distance;
111020              }
111021              get collider() {
111022                return this._collider;
111023              }
111024              get hitNormal() {
111025                return this._hitNormal;
111026              }
111027              _assign(t, e, i, s) {
111028                Pi.copy(this._hitPoint, t);
111029                Pi.copy(this._hitNormal, s);
111030                this._distance = e;
111031                this._collider = i;
111032              }
111033              clone() {
111034                const t = new Rvt;
111035                Pi.copy(t._hitPoint, this._hitPoint);
111036                Pi.copy(t._hitNormal, this._hitNormal);
111037                t._distance = this._distance;
111038                t._collider = this._collider;
111039                return t;
111040              }
111041            }
111042            t("PhysicsRayResult", Rvt);
111043            m.internal.PhysicsGroup = oSt;
111044            class Ivt extends Tg {
111045              static get PHYSICS_NONE() {
111046                return !ovt.id;
111047              }
111048              static get PHYSICS_BUILTIN() {
111049                return "builtin" === ovt.id;
111050              }
111051              static get PHYSICS_CANNON() {
111052                return "cannon.js" === ovt.id;
111053              }
111054              static get PHYSICS_BULLET() {
111055                return "bullet" === ovt.id;
111056              }
111057              static get PHYSICS_PHYSX() {
111058                return "physx" === ovt.id;
111059              }
111060              static get PhysicsGroup() {
111061                return oSt;
111062              }
111063              static get instance() {
111064                return Ivt._instance;
111065              }
111066              get enable() {
111067                return this._enable;
111068              }
111069              set enable(t) {
111070                this._enable = t;
111071              }
111072              get allowSleep() {
111073                return this._allowSleep;
111074              }
111075              set allowSleep(t) {
111076                this._allowSleep = t;
111077                this.physicsWorld && this.physicsWorld.setAllowSleep(t);
111078              }
111079              get maxSubSteps() {
111080                return this._maxSubSteps;
111081              }
111082              set maxSubSteps(t) {
111083                this._maxSubSteps = t;
111084              }
111085              get fixedTimeStep() {
111086                return this._fixedTimeStep;
111087              }
111088              set fixedTimeStep(t) {
111089                this._fixedTimeStep = t;
111090              }
111091              get gravity() {
111092                return this._gravity;
111093              }
111094              set gravity(t) {
111095                this._gravity.set(t);
111096                this.physicsWorld && this.physicsWorld.setGravity(t);
111097              }
111098              get sleepThreshold() {
111099                return this._sleepThreshold;
111100              }
111101              set sleepThreshold(t) {
111102                this._sleepThreshold = t;
111103              }
111104              get autoSimulation() {
111105                return this._autoSimulation;
111106              }
111107              set autoSimulation(t) {
111108                this._autoSimulation = t;
111109              }
111110              get defaultMaterial() {
111111                return this._material;
111112              }
111113              initDefaultMaterial() {
111114                if (null == this._material) {
111115                  this._material = xR.get("default-physics-material");
111116                  if (null != this._material) {
111117                    this.physicsWorld.setDefaultMaterial(this._material);
111118                    this._material.on(wvt.EVENT_UPDATE, this._updateMaterial, this);
111119                    this.setDefaultMaterial(this._materialConfig);
111120                  } else console.error("PhysicsSystem initDefaultMaterial failed");
111121                }
111122              }
111123              get physicsWorld() {
111124                return ovt.physicsWorld;
111125              }
111126              constructor() {
111127                super();
111128                this.raycastClosestResult = new Rvt;
111129                this.raycastResults = [];
111130                this.collisionMatrix = new aSt(1);
111131                this.minVolumeSize = 1e-5;
111132                this.useNodeChains = !1;
111133                this._enable = !0;
111134                this._allowSleep = !0;
111135                this._maxSubSteps = 1;
111136                this._subStepCount = 0;
111137                this._fixedTimeStep = 1 / 60;
111138                this._autoSimulation = !0;
111139                this._accumulator = 0;
111140                this._sleepThreshold = .1;
111141                this._gravity = new Pi(0, -10, 0);
111142                this._materialConfig = new wvt;
111143                this.raycastOptions = {
111144                  group: -1,
111145                  mask: -1,
111146                  queryTrigger: !0,
111147                  maxDistance: 1e7
111148                };
111149                this.raycastResultPool = new to((() => new Rvt), 1);
111150              }
111151              postUpdate(t) {
111152                if (this.physicsWorld) if (this._enable) {
111153                  if (this._autoSimulation) {
111154                    this._subStepCount = 0;
111155                    this._accumulator += t;
111156                    IR.emit(RR.EVENT_BEFORE_PHYSICS);
111157                    for (;this._subStepCount < this._maxSubSteps; ) {
111158                      if (!(this._accumulator >= this._fixedTimeStep)) {
111159                        this.physicsWorld.syncSceneToPhysics();
111160                        break;
111161                      }
111162                      this.physicsWorld.syncSceneToPhysics();
111163                      this.physicsWorld.step(this._fixedTimeStep);
111164                      this.physicsWorld.emitEvents();
111165                      this.physicsWorld.syncAfterEvents();
111166                      this._accumulator -= this._fixedTimeStep;
111167                      this._subStepCount++;
111168                    }
111169                    IR.emit(RR.EVENT_AFTER_PHYSICS);
111170                  }
111171                } else this.physicsWorld.syncSceneToPhysics();
111172              }
111173              resetConfiguration(t) {
111174                const e = t ? t.allowSleep : de.querySettings(_e.Category.PHYSICS, "allowSleep");
111175                "boolean" == typeof e && (this._allowSleep = e);
111176                const i = t ? t.fixedTimeStep : de.querySettings(_e.Category.PHYSICS, "fixedTimeStep");
111177                "number" == typeof i && (this._fixedTimeStep = i);
111178                const s = t ? t.maxSubSteps : de.querySettings(_e.Category.PHYSICS, "maxSubSteps");
111179                "number" == typeof s && (this._maxSubSteps = s);
111180                const n = t ? t.sleepThreshold : de.querySettings(_e.Category.PHYSICS, "sleepThreshold");
111181                "number" == typeof n && (this._sleepThreshold = n);
111182                const r = t ? t.autoSimulation : de.querySettings(_e.Category.PHYSICS, "autoSimulation");
111183                "boolean" == typeof r && (this.autoSimulation = r);
111184                const o = t ? t.gravity : de.querySettings(_e.Category.PHYSICS, "gravity");
111185                o && Pi.copy(this._gravity, o);
111186                const a = t ? t.defaultMaterial : de.querySettings(_e.Category.PHYSICS, "defaultMaterial");
111187                this._materialConfig = a;
111188                const l = t ? t.collisionMatrix : de.querySettings(_e.Category.PHYSICS, "collisionMatrix");
111189                if (l) for (const t in l) this.collisionMatrix["" + (1 << parseInt(t))] = l[t];
111190                const h = t ? t.collisionGroups : de.querySettings(_e.Category.PHYSICS, "collisionGroups");
111191                if (h) {
111192                  const t = h;
111193                  if (t instanceof Array) {
111194                    t.forEach((t => {
111195                      oSt[t.name] = 1 << t.index;
111196                    }));
111197                    oe.update(oSt);
111198                  }
111199                }
111200                if (this.physicsWorld) {
111201                  this.physicsWorld.setGravity(this._gravity);
111202                  this.physicsWorld.setAllowSleep(this._allowSleep);
111203                }
111204              }
111205              setDefaultMaterial(t) {
111206                this._material && t && this._material.setValues(t.friction, t.rollingFriction, t.spinningFriction, t.restitution);
111207              }
111208              resetAccumulator(t = 0) {
111209                this._accumulator = t;
111210              }
111211              step(t, e, i) {
111212                this.physicsWorld && this.physicsWorld.step(t, e, i);
111213              }
111214              syncSceneToPhysics() {
111215                this.physicsWorld && this.physicsWorld.syncSceneToPhysics();
111216              }
111217              emitEvents() {
111218                this.physicsWorld && this.physicsWorld.emitEvents();
111219              }
111220              raycast(t, e = 4294967295, i = 1e7, s = !0) {
111221                if (!this.physicsWorld) return !1;
111222                this.raycastResultPool.reset();
111223                this.raycastResults.length = 0;
111224                this.raycastOptions.mask = e >>> 0;
111225                this.raycastOptions.maxDistance = i;
111226                this.raycastOptions.queryTrigger = s;
111227                return this.physicsWorld.raycast(t, this.raycastOptions, this.raycastResultPool, this.raycastResults);
111228              }
111229              raycastClosest(t, e = 4294967295, i = 1e7, s = !0) {
111230                if (!this.physicsWorld) return !1;
111231                this.raycastOptions.mask = e >>> 0;
111232                this.raycastOptions.maxDistance = i;
111233                this.raycastOptions.queryTrigger = s;
111234                return this.physicsWorld.raycastClosest(t, this.raycastOptions, this.raycastClosestResult);
111235              }
111236              _updateMaterial() {
111237                this.physicsWorld && this.physicsWorld.setDefaultMaterial(this._material);
111238              }
111239              static constructAndRegister() {
111240                if (!Ivt._instance) {
111241                  const t = new Ivt;
111242                  t.resetConfiguration();
111243                  !function(t) {
111244                    rvt || (rvt = t);
111245                    if (ovt.runInEditor && !ovt.physicsWorld) {
111246                      console.info(`[PHYSICS]: using ${ovt.id}.`);
111247                      const t = ovt.physicsWorld = uvt();
111248                      t.setGravity(rvt.gravity);
111249                      t.setAllowSleep(rvt.allowSleep);
111250                    }
111251                  }(t);
111252                  Ivt._instance = t;
111253                  IR.registerSystem(Ivt.ID, t, t.priority);
111254                  xR.get("default-physics-material") ? t.initDefaultMaterial() : BR.onPostProjectInitDelegate.add(t.initDefaultMaterial.bind(t));
111255                }
111256              }
111257            }
111258            t("PhysicsSystem", Ivt);
111259            Ivt.ID = "PHYSICS";
111260            Ivt._instance = null;
111261            IR.once(RR.EVENT_INIT, (() => {
111262              Ivt.constructAndRegister();
111263            }));
111264            var Mvt, Bvt, Dvt, Pvt, Ovt, Nvt, Lvt, Fvt, Vvt, kvt, Uvt, Gvt, zvt, Hvt, jvt, Xvt, Wvt, Yvt, qvt, Kvt, Jvt, Zvt, Qvt, $vt, tEt, eEt, iEt, sEt, nEt, rEt, oEt, aEt, lEt, hEt, cEt, uEt, _Et, dEt, pEt, mEt, fEt, gEt, yEt, bEt;
111265            let SEt = function(e) {
111266              return t({
111267                RigidBody: e,
111268                RigidBodyComponent: e
111269              }), e;
111270            }((Mvt = Ul("cc.RigidBody"), Bvt = sh(), Dvt = $l(), Pvt = zl(-1), Ovt = Th(Ivt.PhysicsGroup),
111271            Nvt = ph(), Lvt = lh(), Fvt = Th(eSt), Vvt = ph(), kvt = lh(), Uvt = rh(), Gvt = ph(),
111272            zvt = lh(), Hvt = rh(), jvt = ph(), Xvt = lh(), Wvt = rh(), Yvt = ph(), qvt = lh(),
111273            Kvt = rh(), Jvt = ph(), Zvt = lh(), Qvt = rh(), $vt = ph(), tEt = lh(), eEt = rh(),
111274            iEt = ph(), sEt = lh(), nEt = rh(), rEt = ph(), oEt = lh(), Mvt(aEt = Bvt(aEt = Dvt(aEt = Ql(aEt = Hl(aEt = Pvt(aEt = (lEt = (bEt = yEt = class extends Qc {
111275              constructor(...t) {
111276                super(...t);
111277                this._body = null;
111278                Ml(this, "_group", hEt, this);
111279                Ml(this, "_type", cEt, this);
111280                Ml(this, "_mass", uEt, this);
111281                Ml(this, "_allowSleep", _Et, this);
111282                Ml(this, "_linearDamping", dEt, this);
111283                Ml(this, "_angularDamping", pEt, this);
111284                Ml(this, "_useGravity", mEt, this);
111285                Ml(this, "_linearFactor", fEt, this);
111286                Ml(this, "_angularFactor", gEt, this);
111287              }
111288              get group() {
111289                return this._group;
111290              }
111291              set group(t) {
111292                Number.isInteger(Math.log2(t >>> 0)) || C("[Physics]: The group should only have one bit.");
111293                this._group = t;
111294                this._body && this._body.getGroup() !== t && this._body.setGroup(t);
111295              }
111296              get type() {
111297                return this._type;
111298              }
111299              set type(t) {
111300                if (this._type !== t) {
111301                  this._type = t;
111302                  this._body && this._body.setType(t);
111303                }
111304              }
111305              get mass() {
111306                return this._mass;
111307              }
111308              set mass(t) {
111309                t <= 0 && C("[Physics]: The mass should be greater than zero.");
111310                if (this._mass !== t) {
111311                  t = t <= 0 ? 1e-4 : t;
111312                  this._mass = t;
111313                  this._body && this._body.setMass(t);
111314                }
111315              }
111316              get allowSleep() {
111317                return this._allowSleep;
111318              }
111319              set allowSleep(t) {
111320                this._allowSleep = t;
111321                this._body && this._body.setAllowSleep(t);
111322              }
111323              get linearDamping() {
111324                return this._linearDamping;
111325              }
111326              set linearDamping(t) {
111327                (t < 0 || t > 1) && C("[Physics]: The damping should be between zero to one.");
111328                this._linearDamping = t;
111329                this._body && this._body.setLinearDamping(t);
111330              }
111331              get angularDamping() {
111332                return this._angularDamping;
111333              }
111334              set angularDamping(t) {
111335                (t < 0 || t > 1) && C("[Physics]: The damping should be between zero to one.");
111336                this._angularDamping = t;
111337                this._body && this._body.setAngularDamping(t);
111338              }
111339              get useGravity() {
111340                return this._useGravity;
111341              }
111342              set useGravity(t) {
111343                this._useGravity = t;
111344                this._body && this._body.useGravity(t);
111345              }
111346              get linearFactor() {
111347                return this._linearFactor;
111348              }
111349              set linearFactor(t) {
111350                Pi.copy(this._linearFactor, t);
111351                this._body && this._body.setLinearFactor(this._linearFactor);
111352              }
111353              get angularFactor() {
111354                return this._angularFactor;
111355              }
111356              set angularFactor(t) {
111357                Pi.copy(this._angularFactor, t);
111358                this._body && this._body.setAngularFactor(this._angularFactor);
111359              }
111360              get sleepThreshold() {
111361                return this._isInitialized ? this._body.getSleepThreshold() : .1;
111362              }
111363              set sleepThreshold(t) {
111364                this._isInitialized && this._body.setSleepThreshold(t);
111365              }
111366              get useCCD() {
111367                return !!this._isInitialized && this._body.isUsingCCD();
111368              }
111369              set useCCD(t) {
111370                this._isInitialized && this._body.useCCD(t);
111371              }
111372              get isAwake() {
111373                return !!this._isInitialized && this._body.isAwake;
111374              }
111375              get isSleepy() {
111376                return !!this._isInitialized && this._body.isSleepy;
111377              }
111378              get isSleeping() {
111379                return !!this._isInitialized && this._body.isSleeping;
111380              }
111381              get isStatic() {
111382                return this._type === eSt.STATIC;
111383              }
111384              set isStatic(t) {
111385                t && this.isStatic || !t && !this.isStatic || (this.type = t ? eSt.STATIC : eSt.DYNAMIC);
111386              }
111387              get isDynamic() {
111388                return this._type === eSt.DYNAMIC;
111389              }
111390              set isDynamic(t) {
111391                t && this.isDynamic || !t && !this.isDynamic || (this.type = t ? eSt.DYNAMIC : eSt.KINEMATIC);
111392              }
111393              get isKinematic() {
111394                return this._type === eSt.KINEMATIC;
111395              }
111396              set isKinematic(t) {
111397                t && this.isKinematic || !t && !this.isKinematic || (this.type = t ? eSt.KINEMATIC : eSt.DYNAMIC);
111398              }
111399              get body() {
111400                return this._body;
111401              }
111402              get _isInitialized() {
111403                const t = null === this._body;
111404                t && x("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene.");
111405                return !t;
111406              }
111407              onLoad() {
111408                if (ovt.runInEditor) {
111409                  this._body = cvt(ovt.wrapper.RigidBody, hvt.RigidBody) ? _vt : new ovt.wrapper.RigidBody;
111410                  this._body.initialize(this);
111411                }
111412              }
111413              onEnable() {
111414                this._body && this._body.onEnable();
111415              }
111416              onDisable() {
111417                this._body && this._body.onDisable();
111418              }
111419              onDestroy() {
111420                this._body && this._body.onDestroy();
111421              }
111422              applyForce(t, e) {
111423                this._isInitialized && this._body.applyForce(t, e);
111424              }
111425              applyLocalForce(t, e) {
111426                this._isInitialized && this._body.applyLocalForce(t, e);
111427              }
111428              applyImpulse(t, e) {
111429                this._isInitialized && this._body.applyImpulse(t, e);
111430              }
111431              applyLocalImpulse(t, e) {
111432                this._isInitialized && this._body.applyLocalImpulse(t, e);
111433              }
111434              applyTorque(t) {
111435                this._isInitialized && this._body.applyTorque(t);
111436              }
111437              applyLocalTorque(t) {
111438                this._isInitialized && this._body.applyLocalTorque(t);
111439              }
111440              wakeUp() {
111441                this._isInitialized && this._body.wakeUp();
111442              }
111443              sleep() {
111444                this._isInitialized && this._body.sleep();
111445              }
111446              clearState() {
111447                this._isInitialized && this._body.clearState();
111448              }
111449              clearForces() {
111450                this._isInitialized && this._body.clearForces();
111451              }
111452              clearVelocity() {
111453                this._isInitialized && this._body.clearVelocity();
111454              }
111455              getLinearVelocity(t) {
111456                this._isInitialized && this._body.getLinearVelocity(t);
111457              }
111458              setLinearVelocity(t) {
111459                this._isInitialized && this._body.setLinearVelocity(t);
111460              }
111461              getAngularVelocity(t) {
111462                this._isInitialized && this._body.getAngularVelocity(t);
111463              }
111464              setAngularVelocity(t) {
111465                this._isInitialized && this._body.setAngularVelocity(t);
111466              }
111467              getGroup() {
111468                return this._isInitialized ? this._body.getGroup() : 0;
111469              }
111470              setGroup(t) {
111471                this._isInitialized && this._body.setGroup(t);
111472              }
111473              addGroup(t) {
111474                this._isInitialized && this._body.addGroup(t);
111475              }
111476              removeGroup(t) {
111477                this._isInitialized && this._body.removeGroup(t);
111478              }
111479              getMask() {
111480                return this._isInitialized ? this._body.getMask() : 0;
111481              }
111482              setMask(t) {
111483                this._isInitialized && this._body.setMask(t);
111484              }
111485              addMask(t) {
111486                this._isInitialized && this._body.addMask(t);
111487              }
111488              removeMask(t) {
111489                this._isInitialized && this._body.removeMask(t);
111490              }
111491            }, yEt.Type = eSt, bEt), Bl(lEt.prototype, "group", [ Ovt, Nvt, Lvt ], Object.getOwnPropertyDescriptor(lEt.prototype, "group"), lEt.prototype),
111492            Bl(lEt.prototype, "type", [ Fvt, Vvt, kvt ], Object.getOwnPropertyDescriptor(lEt.prototype, "type"), lEt.prototype),
111493            Bl(lEt.prototype, "mass", [ Uvt, Gvt, zvt ], Object.getOwnPropertyDescriptor(lEt.prototype, "mass"), lEt.prototype),
111494            Bl(lEt.prototype, "allowSleep", [ Hvt, jvt, Xvt ], Object.getOwnPropertyDescriptor(lEt.prototype, "allowSleep"), lEt.prototype),
111495            Bl(lEt.prototype, "linearDamping", [ Wvt, Yvt, qvt ], Object.getOwnPropertyDescriptor(lEt.prototype, "linearDamping"), lEt.prototype),
111496            Bl(lEt.prototype, "angularDamping", [ Kvt, Jvt, Zvt ], Object.getOwnPropertyDescriptor(lEt.prototype, "angularDamping"), lEt.prototype),
111497            Bl(lEt.prototype, "useGravity", [ Qvt, $vt, tEt ], Object.getOwnPropertyDescriptor(lEt.prototype, "useGravity"), lEt.prototype),
111498            Bl(lEt.prototype, "linearFactor", [ eEt, iEt, sEt ], Object.getOwnPropertyDescriptor(lEt.prototype, "linearFactor"), lEt.prototype),
111499            Bl(lEt.prototype, "angularFactor", [ nEt, rEt, oEt ], Object.getOwnPropertyDescriptor(lEt.prototype, "angularFactor"), lEt.prototype),
111500            hEt = Bl(lEt.prototype, "_group", [ Yl ], {
111501              configurable: !0,
111502              enumerable: !0,
111503              writable: !0,
111504              initializer: function() {
111505                return Ivt.PhysicsGroup.DEFAULT;
111506              }
111507            }), cEt = Bl(lEt.prototype, "_type", [ Yl ], {
111508              configurable: !0,
111509              enumerable: !0,
111510              writable: !0,
111511              initializer: function() {
111512                return eSt.DYNAMIC;
111513              }
111514            }), uEt = Bl(lEt.prototype, "_mass", [ Yl ], {
111515              configurable: !0,
111516              enumerable: !0,
111517              writable: !0,
111518              initializer: function() {
111519                return 1;
111520              }
111521            }), _Et = Bl(lEt.prototype, "_allowSleep", [ Yl ], {
111522              configurable: !0,
111523              enumerable: !0,
111524              writable: !0,
111525              initializer: function() {
111526                return !0;
111527              }
111528            }), dEt = Bl(lEt.prototype, "_linearDamping", [ Yl ], {
111529              configurable: !0,
111530              enumerable: !0,
111531              writable: !0,
111532              initializer: function() {
111533                return .1;
111534              }
111535            }), pEt = Bl(lEt.prototype, "_angularDamping", [ Yl ], {
111536              configurable: !0,
111537              enumerable: !0,
111538              writable: !0,
111539              initializer: function() {
111540                return .1;
111541              }
111542            }), mEt = Bl(lEt.prototype, "_useGravity", [ Yl ], {
111543              configurable: !0,
111544              enumerable: !0,
111545              writable: !0,
111546              initializer: function() {
111547                return !0;
111548              }
111549            }), fEt = Bl(lEt.prototype, "_linearFactor", [ Yl ], {
111550              configurable: !0,
111551              enumerable: !0,
111552              writable: !0,
111553              initializer: function() {
111554                return new Pi(1, 1, 1);
111555              }
111556            }), gEt = Bl(lEt.prototype, "_angularFactor", [ Yl ], {
111557              configurable: !0,
111558              enumerable: !0,
111559              writable: !0,
111560              initializer: function() {
111561                return new Pi(1, 1, 1);
111562              }
111563            }), lEt)) || aEt) || aEt) || aEt) || aEt) || aEt) || aEt));
111564            SEt || (SEt = function(e) {
111565              return t({
111566                RigidBody: e,
111567                RigidBodyComponent: e
111568              }), e;
111569            }({}));
111570            var AEt, TEt, vEt, EEt, CEt, xEt, wEt, REt, IEt, MEt, BEt, DEt, PEt, OEt, NEt, LEt, FEt, VEt, kEt, UEt, GEt, zEt;
111571            let HEt = function(e) {
111572              return t({
111573                Collider: e,
111574                ColliderComponent: e
111575              }), e;
111576            }((AEt = Ul("cc.Collider"), TEt = Th(SEt), vEt = ah(), EEt = ph(), CEt = lh(), xEt = Th(wvt),
111577            wEt = ah(), REt = ph(), IEt = lh(), MEt = ph(), BEt = lh(), DEt = Th(Pi), PEt = ph(),
111578            OEt = lh(), NEt = Th(wvt), AEt(LEt = (FEt = (zEt = GEt = class extends(To(Qc)){
111579              get attachedRigidBody() {
111580                return function(t) {
111581                  const e = t.getComponent(SEt);
111582                  if (e && e.isValid) return e;
111583                  return null;
111584                }(this.node);
111585              }
111586              get sharedMaterial() {
111587                return this._material;
111588              }
111589              set sharedMaterial(t) {
111590                this.material = t;
111591              }
111592              get material() {
111593                if (this._isSharedMaterial && this._material) {
111594                  this._material.off(wvt.EVENT_UPDATE, this._updateMaterial, this);
111595                  this._material = this._material.clone();
111596                  this._material.on(wvt.EVENT_UPDATE, this._updateMaterial, this);
111597                  this._isSharedMaterial = !1;
111598                }
111599                return this._material;
111600              }
111601              set material(t) {
111602                if (this._shape) {
111603                  if (t && this._material) {
111604                    if (this._material.id !== t.id) {
111605                      this._material.off(wvt.EVENT_UPDATE, this._updateMaterial, this);
111606                      t.on(wvt.EVENT_UPDATE, this._updateMaterial, this);
111607                      this._isSharedMaterial = !1;
111608                      this._material = t;
111609                    }
111610                  } else if (t && !this._material) {
111611                    t.on(wvt.EVENT_UPDATE, this._updateMaterial, this);
111612                    this._material = t;
111613                  } else if (!t && this._material) {
111614                    this._material.off(wvt.EVENT_UPDATE, this._updateMaterial, this);
111615                    this._material = t;
111616                  }
111617                  this._updateMaterial();
111618                } else this._material = t;
111619              }
111620              get isTrigger() {
111621                return this._isTrigger;
111622              }
111623              set isTrigger(t) {
111624                this._isTrigger = t;
111625                this._shape && this._shape.setAsTrigger(this._isTrigger);
111626              }
111627              get center() {
111628                return this._center;
111629              }
111630              set center(t) {
111631                Pi.copy(this._center, t);
111632                this._shape && this._shape.setCenter(this._center);
111633              }
111634              get shape() {
111635                return this._shape;
111636              }
111637              get worldBounds() {
111638                null == this._aabb && (this._aabb = new hl);
111639                this._shape && this._shape.getAABB(this._aabb);
111640                return this._aabb;
111641              }
111642              get boundingSphere() {
111643                null == this._boundingSphere && (this._boundingSphere = new ua);
111644                this._shape && this._shape.getBoundingSphere(this._boundingSphere);
111645                return this._boundingSphere;
111646              }
111647              get needTriggerEvent() {
111648                return this._needTriggerEvent;
111649              }
111650              get needCollisionEvent() {
111651                return this._needCollisionEvent;
111652              }
111653              get _isInitialized() {
111654                const t = null === this._shape;
111655                t && x("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene.");
111656                return !t;
111657              }
111658              constructor(t) {
111659                super();
111660                this.type = void 0;
111661                this._shape = null;
111662                this._aabb = null;
111663                this._boundingSphere = null;
111664                this._isSharedMaterial = !0;
111665                this._needTriggerEvent = !1;
111666                this._needCollisionEvent = !1;
111667                Ml(this, "_material", VEt, this);
111668                Ml(this, "_isTrigger", kEt, this);
111669                Ml(this, "_center", UEt, this);
111670                this.type = t;
111671              }
111672              on(t, e, i, s) {
111673                const n = super.on(t, e, i, s);
111674                this._updateNeedEvent(t);
111675                return n;
111676              }
111677              off(t, e, i) {
111678                super.off(t, e, i);
111679                this._updateNeedEvent();
111680              }
111681              once(t, e, i) {
111682                const s = super.once(t, e, i);
111683                this._updateNeedEvent(t);
111684                return s;
111685              }
111686              removeAll(t) {
111687                super.removeAll(t);
111688                this._updateNeedEvent();
111689              }
111690              getGroup() {
111691                return this._isInitialized ? this._shape.getGroup() : 0;
111692              }
111693              setGroup(t) {
111694                this._isInitialized && this._shape.setGroup(t);
111695              }
111696              addGroup(t) {
111697                this._isInitialized && this._shape.addGroup(t);
111698              }
111699              removeGroup(t) {
111700                this._isInitialized && this._shape.removeGroup(t);
111701              }
111702              getMask() {
111703                return this._isInitialized ? this._shape.getMask() : 0;
111704              }
111705              setMask(t) {
111706                this._isInitialized && this._shape.setMask(t);
111707              }
111708              addMask(t) {
111709                this._isInitialized && this._shape.addMask(t);
111710              }
111711              removeMask(t) {
111712                this._isInitialized && this._shape.removeMask(t);
111713              }
111714              onLoad() {
111715                if (ovt.runInEditor) {
111716                  this.sharedMaterial = null == this._material ? Ivt.instance.defaultMaterial : this._material;
111717                  this._shape = mvt(this.type);
111718                  this._shape.initialize(this);
111719                  this._shape.onLoad();
111720                }
111721              }
111722              onEnable() {
111723                this._shape && this._shape.onEnable();
111724              }
111725              onDisable() {
111726                this._shape && this._shape.onDisable();
111727              }
111728              onDestroy() {
111729                if (this._shape) {
111730                  this._needTriggerEvent = !1;
111731                  this._needCollisionEvent = !1;
111732                  this._shape.updateEventListener();
111733                  this._material && this._material.off(wvt.EVENT_UPDATE, this._updateMaterial, this);
111734                  this._shape.onDestroy();
111735                }
111736                this._boundingSphere && this._boundingSphere.destroy();
111737              }
111738              _updateMaterial() {
111739                this._shape && this._shape.setMaterial(this._material);
111740              }
111741              _updateNeedEvent(t) {
111742                if (this.isValid) {
111743                  if (void 0 !== t) {
111744                    "onCollisionEnter" !== t && "onCollisionStay" !== t && "onCollisionExit" !== t || (this._needCollisionEvent = !0);
111745                    "onTriggerEnter" !== t && "onTriggerStay" !== t && "onTriggerExit" !== t || (this._needTriggerEvent = !0);
111746                  } else {
111747                    this.hasEventListener("onTriggerEnter") || this.hasEventListener("onTriggerStay") || this.hasEventListener("onTriggerExit") || (this._needTriggerEvent = !1);
111748                    this.hasEventListener("onCollisionEnter") || this.hasEventListener("onCollisionStay") || this.hasEventListener("onCollisionExit") || (this._needCollisionEvent = !1);
111749                  }
111750                  this._shape && this._shape.updateEventListener();
111751                }
111752              }
111753            }, GEt.Type = nSt, GEt.Axis = iSt, zEt), Bl(FEt.prototype, "attachedRigidBody", [ TEt, oh, vEt, EEt, CEt ], Object.getOwnPropertyDescriptor(FEt.prototype, "attachedRigidBody"), FEt.prototype),
111754            Bl(FEt.prototype, "sharedMaterial", [ xEt, wEt, REt, IEt ], Object.getOwnPropertyDescriptor(FEt.prototype, "sharedMaterial"), FEt.prototype),
111755            Bl(FEt.prototype, "isTrigger", [ MEt, BEt ], Object.getOwnPropertyDescriptor(FEt.prototype, "isTrigger"), FEt.prototype),
111756            Bl(FEt.prototype, "center", [ DEt, PEt, OEt ], Object.getOwnPropertyDescriptor(FEt.prototype, "center"), FEt.prototype),
111757            VEt = Bl(FEt.prototype, "_material", [ NEt ], {
111758              configurable: !0,
111759              enumerable: !0,
111760              writable: !0,
111761              initializer: function() {
111762                return null;
111763              }
111764            }), kEt = Bl(FEt.prototype, "_isTrigger", [ Yl ], {
111765              configurable: !0,
111766              enumerable: !0,
111767              writable: !0,
111768              initializer: function() {
111769                return !1;
111770              }
111771            }), UEt = Bl(FEt.prototype, "_center", [ Yl ], {
111772              configurable: !0,
111773              enumerable: !0,
111774              writable: !0,
111775              initializer: function() {
111776                return new Pi;
111777              }
111778            }), FEt)) || LEt));
111779            HEt || (HEt = function(e) {
111780              return t({
111781                Collider: e,
111782                ColliderComponent: e
111783              }), e;
111784            }({}));
111785            function jEt(t) {
111786              void 0 === (t = t || {}).includeNormal && (t.includeNormal = !0);
111787              void 0 === t.includeUV && (t.includeUV = !0);
111788              return t;
111789            }
111790            const XEt = new Pi;
111791            const WEt = new Pi;
111792            const YEt = new Pi;
111793            const qEt = new Pi;
111794            const KEt = new Pi;
111795            const JEt = new Pi;
111796            const ZEt = new Pi;
111797            const QEt = new Pi;
111798            const $Et = new Pi;
111799            const tCt = new Pi;
111800            const eCt = new Pi;
111801            const iCt = new Pi;
111802            const sCt = new Pi(0, 0, 0);
111803            const nCt = new Pi(0, 0, 0);
111804            function rCt(t = .5, e = .5, i = 2, s = {}) {
111805              const n = .5 * i;
111806              const r = s.radialSegments || 32;
111807              const o = s.heightSegments || 1;
111808              const a = void 0 === s.capped || s.capped;
111809              const l = s.arc || 2 * Math.PI;
111810              let h = 0;
111811              if (!a) {
111812                t > 0 && h++;
111813                e > 0 && h++;
111814              }
111815              let c = (r + 1) * (o + 1);
111816              a && (c += (r + 1) * h + r * h);
111817              let u = r * o * 2 * 3;
111818              a && (u += r * h * 3);
111819              const _ = new Array(u);
111820              const d = new Array(3 * c);
111821              const p = new Array(3 * c);
111822              const m = new Array(2 * c);
111823              const f = Math.max(t, e);
111824              const g = new Pi(-f, -n, -f);
111825              const y = new Pi(f, n, f);
111826              const b = Math.sqrt(f * f + n * n);
111827              let S = 0;
111828              let A = 0;
111829              !function() {
111830                const s = [];
111831                const a = t - e;
111832                const h = a * a / i * Math.sign(a);
111833                for (let t = 0; t <= o; t++) {
111834                  const c = [];
111835                  const u = t / o;
111836                  const _ = u * a + e;
111837                  for (let t = 0; t <= r; ++t) {
111838                    const e = t / r;
111839                    const s = e * l;
111840                    const o = Math.sin(s);
111841                    const a = Math.cos(s);
111842                    d[3 * S] = _ * o;
111843                    d[3 * S + 1] = u * i - n;
111844                    d[3 * S + 2] = _ * a;
111845                    Pi.normalize(sCt, Pi.set(nCt, o, -h, a));
111846                    p[3 * S] = sCt.x;
111847                    p[3 * S + 1] = sCt.y;
111848                    p[3 * S + 2] = sCt.z;
111849                    m[2 * S] = 2 * (1 - e) % 1;
111850                    m[2 * S + 1] = u;
111851                    c.push(S);
111852                    ++S;
111853                  }
111854                  s.push(c);
111855                }
111856                for (let t = 0; t < o; ++t) for (let e = 0; e < r; ++e) {
111857                  const i = s[t][e];
111858                  const n = s[t + 1][e];
111859                  const r = s[t + 1][e + 1];
111860                  const o = s[t][e + 1];
111861                  _[A] = i;
111862                  ++A;
111863                  _[A] = o;
111864                  ++A;
111865                  _[A] = n;
111866                  ++A;
111867                  _[A] = o;
111868                  ++A;
111869                  _[A] = r;
111870                  ++A;
111871                  _[A] = n;
111872                  ++A;
111873                }
111874              }();
111875              if (a) {
111876                e > 0 && T(!1);
111877                t > 0 && T(!0);
111878              }
111879              return {
111880                positions: d,
111881                normals: p,
111882                uvs: m,
111883                indices: _,
111884                minPos: g,
111885                maxPos: y,
111886                boundingRadius: b
111887              };
111888              function T(i) {
111889                const s = i ? t : e;
111890                const o = i ? 1 : -1;
111891                const a = S;
111892                for (let t = 1; t <= r; ++t) {
111893                  d[3 * S] = 0;
111894                  d[3 * S + 1] = n * o;
111895                  d[3 * S + 2] = 0;
111896                  p[3 * S] = 0;
111897                  p[3 * S + 1] = o;
111898                  p[3 * S + 2] = 0;
111899                  m[2 * S] = .5;
111900                  m[2 * S + 1] = .5;
111901                  ++S;
111902                }
111903                const h = S;
111904                for (let t = 0; t <= r; ++t) {
111905                  const e = t / r * l;
111906                  const i = Math.cos(e);
111907                  const a = Math.sin(e);
111908                  d[3 * S] = s * a;
111909                  d[3 * S + 1] = n * o;
111910                  d[3 * S + 2] = s * i;
111911                  p[3 * S] = 0;
111912                  p[3 * S + 1] = o;
111913                  p[3 * S + 2] = 0;
111914                  m[2 * S] = .5 - .5 * a * o;
111915                  m[2 * S + 1] = .5 + .5 * i;
111916                  ++S;
111917                }
111918                for (let t = 0; t < r; ++t) {
111919                  const e = a + t;
111920                  const s = h + t;
111921                  if (i) {
111922                    _[A] = s + 1;
111923                    ++A;
111924                    _[A] = e;
111925                    ++A;
111926                    _[A] = s;
111927                    ++A;
111928                  } else {
111929                    _[A] = e;
111930                    ++A;
111931                    _[A] = s + 1;
111932                    ++A;
111933                    _[A] = s;
111934                    ++A;
111935                  }
111936                }
111937              }
111938            }
111939            const oCt = new Pi(0, 0, 0);
111940            const aCt = new Pi(0, 0, 0);
111941            const lCt = new Pi(0, 0, 0);
111942            const hCt = new Pi(0, 0, 0);
111943            const cCt = new Pi(0, 0, 0);
111944            const uCt = new Pi(0, 0, 0);
111945            const _Ct = new Pi(0, 0, 0);
111946            const dCt = new Pi(0, 0, 0);
111947            const pCt = new Pi(0, 0, 0);
111948            var mCt = Object.freeze({
111949              __proto__: null,
111950              box: function(t) {
111951                const e = (t = t || {}).widthSegments || 1;
111952                const i = t.heightSegments || 1;
111953                const s = t.lengthSegments || 1;
111954                const n = (t.width || 1) / 2;
111955                const r = (t.height || 1) / 2;
111956                const o = (t.length || 1) / 2;
111957                const a = [ Pi.set(KEt, -n, -r, o), Pi.set(JEt, n, -r, o), Pi.set(ZEt, n, r, o), Pi.set(QEt, -n, r, o), Pi.set($Et, n, -r, -o), Pi.set(tCt, -n, -r, -o), Pi.set(eCt, -n, r, -o), Pi.set(iCt, n, r, -o) ];
111958                const l = [ [ 2, 3, 1 ], [ 4, 5, 7 ], [ 7, 6, 2 ], [ 1, 0, 4 ], [ 1, 4, 2 ], [ 5, 0, 6 ] ];
111959                const h = [ [ 0, 0, 1 ], [ 0, 0, -1 ], [ 0, 1, 0 ], [ 0, -1, 0 ], [ 1, 0, 0 ], [ -1, 0, 0 ] ];
111960                const c = [ [ -1, 0, 0, 1 ], [ -1, 0, 0, 1 ], [ -1, 0, 0, 1 ], [ -1, 0, 0, 1 ], [ 0, 0, -1, 1 ], [ 0, 0, 1, 1 ] ];
111961                const u = [];
111962                const _ = [];
111963                const d = [];
111964                const p = [];
111965                const m = [];
111966                const f = new Pi(-n, -r, -o);
111967                const g = new Pi(n, r, o);
111968                const y = Math.sqrt(n * n + r * r + o * o);
111969                function b(t, e, i) {
111970                  let s;
111971                  let n;
111972                  let r;
111973                  let o;
111974                  const f = u.length / 3;
111975                  const g = l[t];
111976                  const y = h[t];
111977                  const b = c[t];
111978                  for (o = 0; o <= i; o++) for (r = 0; r <= e; r++) {
111979                    s = r / e;
111980                    n = o / i;
111981                    Pi.lerp(XEt, a[g[0]], a[g[1]], s);
111982                    Pi.lerp(WEt, a[g[0]], a[g[2]], n);
111983                    Pi.subtract(YEt, WEt, a[g[0]]);
111984                    Pi.add(qEt, XEt, YEt);
111985                    u.push(qEt.x, qEt.y, qEt.z);
111986                    _.push(y[0], y[1], y[2]);
111987                    d.push(s, n);
111988                    p.push(b[0], b[1], b[2], b[3]);
111989                    if (r < e && o < i) {
111990                      const t = e + 1;
111991                      const i = r + o * t;
111992                      const s = r + (o + 1) * t;
111993                      const n = r + 1 + (o + 1) * t;
111994                      const a = r + 1 + o * t;
111995                      m.push(f + i, f + a, f + s);
111996                      m.push(f + s, f + a, f + n);
111997                    }
111998                  }
111999                }
112000                b(0, e, i);
112001                b(4, s, i);
112002                b(1, e, i);
112003                b(5, s, i);
112004                b(3, e, s);
112005                b(2, e, s);
112006                return {
112007                  positions: u,
112008                  normals: _,
112009                  uvs: d,
112010                  tangents: p,
112011                  indices: m,
112012                  minPos: f,
112013                  maxPos: g,
112014                  boundingRadius: y
112015                };
112016              },
112017              cone: function(t = .5, e = 1, i = {}) {
112018                return rCt(0, t, e, i);
112019              },
112020              cylinder: rCt,
112021              plane: function(t) {
112022                const e = function(t) {
112023                  (t = jEt(t)).width = t.width || 10;
112024                  t.length = t.length || 10;
112025                  t.widthSegments = t.widthSegments || 10;
112026                  t.lengthSegments = t.lengthSegments || 10;
112027                  return t;
112028                }(t);
112029                const {width: i, length: s, widthSegments: n, lengthSegments: r} = e;
112030                const o = .5 * i;
112031                const a = .5 * s;
112032                const l = [];
112033                const h = [];
112034                const c = [];
112035                const u = new Pi(-o, 0, -a);
112036                const _ = new Pi(o, 0, a);
112037                const d = Math.sqrt(i * i + s * s);
112038                Pi.set(cCt, -o, 0, a);
112039                Pi.set(uCt, o, 0, a);
112040                Pi.set(_Ct, -o, 0, -a);
112041                for (let t = 0; t <= r; t++) for (let i = 0; i <= n; i++) {
112042                  const s = i / n;
112043                  const o = t / r;
112044                  Pi.lerp(oCt, cCt, uCt, s);
112045                  Pi.lerp(aCt, cCt, _Ct, o);
112046                  Pi.subtract(lCt, aCt, cCt);
112047                  Pi.add(hCt, oCt, lCt);
112048                  l.push(hCt.x, hCt.y, hCt.z);
112049                  e.includeUV && h.push(s, o);
112050                  if (i < n && t < r) {
112051                    const e = n + 1;
112052                    const s = i + t * e;
112053                    const r = i + (t + 1) * e;
112054                    const o = i + 1 + (t + 1) * e;
112055                    const a = i + 1 + t * e;
112056                    c.push(s, a, r);
112057                    c.push(a, o, r);
112058                  }
112059                }
112060                const p = {
112061                  positions: l,
112062                  indices: c,
112063                  minPos: u,
112064                  maxPos: _,
112065                  boundingRadius: d
112066                };
112067                if (e.includeNormal) {
112068                  const t = (r + 1) * (n + 1);
112069                  const e = new Array(3 * t);
112070                  p.normals = e;
112071                  for (let i = 0; i < t; ++i) {
112072                    e[3 * i + 0] = 0;
112073                    e[3 * i + 1] = 1;
112074                    e[3 * i + 2] = 0;
112075                  }
112076                }
112077                e.includeUV && (p.uvs = h);
112078                return p;
112079              },
112080              quad: function(t) {
112081                const e = jEt(t);
112082                const i = {
112083                  positions: [ -.5, -.5, 0, -.5, .5, 0, .5, .5, 0, .5, -.5, 0 ],
112084                  indices: [ 0, 3, 1, 3, 2, 1 ],
112085                  minPos: {
112086                    x: -.5,
112087                    y: -.5,
112088                    z: 0
112089                  },
112090                  maxPos: {
112091                    x: .5,
112092                    y: .5,
112093                    z: 0
112094                  },
112095                  boundingRadius: Math.sqrt(.5)
112096                };
112097                !1 !== e.includeNormal && (i.normals = [ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1 ]);
112098                !1 !== e.includeUV && (i.uvs = [ 0, 0, 0, 1, 1, 1, 1, 0 ]);
112099                return i;
112100              },
112101              sphere: function(t = .5, e = {}) {
112102                const i = void 0 !== e.segments ? e.segments : 32;
112103                const s = [];
112104                const n = [];
112105                const r = [];
112106                const o = [];
112107                const a = new Pi(-t, -t, -t);
112108                const l = new Pi(t, t, t);
112109                const h = t;
112110                for (let e = 0; e <= i; ++e) {
112111                  const a = e * Math.PI / i;
112112                  const l = Math.sin(a);
112113                  const h = -Math.cos(a);
112114                  for (let a = 0; a <= i; ++a) {
112115                    const c = 2 * a * Math.PI / i - Math.PI / 2;
112116                    const u = Math.sin(c) * l;
112117                    const _ = h;
112118                    const d = Math.cos(c) * l;
112119                    const p = a / i;
112120                    const m = e / i;
112121                    s.push(u * t, _ * t, d * t);
112122                    n.push(u, _, d);
112123                    r.push(p, m);
112124                    if (e < i && a < i) {
112125                      const t = i + 1;
112126                      const s = t * e + a;
112127                      const n = t * (e + 1) + a;
112128                      const r = t * (e + 1) + a + 1;
112129                      const l = t * e + a + 1;
112130                      o.push(s, l, n);
112131                      o.push(l, r, n);
112132                    }
112133                  }
112134                }
112135                return {
112136                  positions: s,
112137                  indices: o,
112138                  normals: n,
112139                  uvs: r,
112140                  minPos: a,
112141                  maxPos: l,
112142                  boundingRadius: h
112143                };
112144              },
112145              torus: function(t = .4, e = .1, i = {}) {
112146                const s = i.radialSegments || 32;
112147                const n = i.tubularSegments || 32;
112148                const r = i.arc || 2 * Math.PI;
112149                const o = [];
112150                const a = [];
112151                const l = [];
112152                const h = [];
112153                const c = new Pi(-t - e, -e, -t - e);
112154                const u = new Pi(t + e, e, t + e);
112155                const _ = t + e;
112156                for (let i = 0; i <= s; i++) for (let c = 0; c <= n; c++) {
112157                  const u = c / n;
112158                  const _ = i / s;
112159                  const d = u * r;
112160                  const p = _ * Math.PI * 2;
112161                  const m = (t + e * Math.cos(p)) * Math.sin(d);
112162                  const f = e * Math.sin(p);
112163                  const g = (t + e * Math.cos(p)) * Math.cos(d);
112164                  const y = Math.sin(d) * Math.cos(p);
112165                  const b = Math.sin(p);
112166                  const S = Math.cos(d) * Math.cos(p);
112167                  o.push(m, f, g);
112168                  a.push(y, b, S);
112169                  l.push(u, _);
112170                  if (c < n && i < s) {
112171                    const t = n + 1;
112172                    const e = t * i + c;
112173                    const s = t * (i + 1) + c;
112174                    const r = t * (i + 1) + c + 1;
112175                    const o = t * i + c + 1;
112176                    h.push(e, o, s);
112177                    h.push(o, r, s);
112178                  }
112179                }
112180                return {
112181                  positions: o,
112182                  normals: a,
112183                  uvs: l,
112184                  indices: h,
112185                  minPos: c,
112186                  maxPos: u,
112187                  boundingRadius: _
112188                };
112189              },
112190              capsule: function(t = .5, e = .5, i = 2, s = {}) {
112191                const n = i - t - e;
112192                const r = s.sides || 32;
112193                const o = s.heightSegments || 32;
112194                const a = e / i;
112195                const l = n / i;
112196                const h = t / i;
112197                const c = Math.floor(o * a);
112198                const u = Math.floor(o * h);
112199                const _ = Math.floor(o * l);
112200                const d = n + e - i / 2;
112201                const p = e - i / 2;
112202                const m = e - i / 2;
112203                const f = s.arc || 2 * Math.PI;
112204                const g = [];
112205                const y = [];
112206                const b = [];
112207                const S = [];
112208                const A = Math.max(t, e);
112209                const T = new Pi(-A, -i / 2, -A);
112210                const v = new Pi(A, i / 2, A);
112211                const E = i / 2;
112212                let C = 0;
112213                const x = [];
112214                !function() {
112215                  for (let t = 0; t <= c; ++t) {
112216                    const i = t * Math.PI / c / 2;
112217                    const s = Math.sin(i);
112218                    const n = -Math.cos(i);
112219                    for (let i = 0; i <= r; ++i) {
112220                      const a = 2 * i * Math.PI / r - Math.PI / 2;
112221                      const l = Math.sin(a);
112222                      const h = Math.cos(a);
112223                      const u = l * s;
112224                      const _ = n;
112225                      const d = h * s;
112226                      const p = i / r;
112227                      const f = t / o;
112228                      g.push(u * e, _ * e + m, d * e);
112229                      y.push(u, _, d);
112230                      b.push(p, f);
112231                      if (t < c && i < r) {
112232                        const e = r + 1;
112233                        const s = e * t + i;
112234                        const n = e * (t + 1) + i;
112235                        const o = e * (t + 1) + i + 1;
112236                        const a = e * t + i + 1;
112237                        S.push(s, a, n);
112238                        S.push(a, o, n);
112239                      }
112240                      ++C;
112241                    }
112242                  }
112243                }();
112244                !function() {
112245                  const i = (t - e) / n;
112246                  for (let s = 0; s <= _; s++) {
112247                    const o = [];
112248                    const h = s / _;
112249                    const c = h * (t - e) + e;
112250                    for (let t = 0; t <= r; ++t) {
112251                      const e = t / r;
112252                      const s = h * l + a;
112253                      const u = e * f - f / 4;
112254                      const _ = Math.sin(u);
112255                      const d = Math.cos(u);
112256                      g.push(c * _);
112257                      g.push(h * n + p);
112258                      g.push(c * d);
112259                      Pi.normalize(dCt, Pi.set(pCt, _, -i, d));
112260                      y.push(dCt.x);
112261                      y.push(dCt.y);
112262                      y.push(dCt.z);
112263                      b.push(e, s);
112264                      o.push(C);
112265                      ++C;
112266                    }
112267                    x.push(o);
112268                  }
112269                  for (let t = 0; t < _; ++t) for (let e = 0; e < r; ++e) {
112270                    const i = x[t][e];
112271                    const s = x[t + 1][e];
112272                    const n = x[t + 1][e + 1];
112273                    const r = x[t][e + 1];
112274                    S.push(i);
112275                    S.push(r);
112276                    S.push(s);
112277                    S.push(r);
112278                    S.push(n);
112279                    S.push(s);
112280                  }
112281                }();
112282                !function() {
112283                  for (let e = 0; e <= u; ++e) {
112284                    const i = e * Math.PI / u / 2 + Math.PI / 2;
112285                    const s = Math.sin(i);
112286                    const n = -Math.cos(i);
112287                    for (let i = 0; i <= r; ++i) {
112288                      const a = 2 * i * Math.PI / r - Math.PI / 2;
112289                      const l = Math.sin(a);
112290                      const c = Math.cos(a);
112291                      const p = l * s;
112292                      const m = n;
112293                      const f = c * s;
112294                      const A = i / r;
112295                      const T = e / o + (1 - h);
112296                      g.push(p * t, m * t + d, f * t);
112297                      y.push(p, m, f);
112298                      b.push(A, T);
112299                      if (e < u && i < r) {
112300                        const t = r + 1;
112301                        const s = t * e + i + x[_][r] + 1;
112302                        const n = t * (e + 1) + i + x[_][r] + 1;
112303                        const o = t * (e + 1) + i + 1 + x[_][r] + 1;
112304                        const a = t * e + i + 1 + x[_][r] + 1;
112305                        S.push(s, a, n);
112306                        S.push(a, o, n);
112307                      }
112308                    }
112309                  }
112310                }();
112311                return {
112312                  positions: g,
112313                  normals: y,
112314                  uvs: b,
112315                  indices: S,
112316                  minPos: T,
112317                  maxPos: v,
112318                  boundingRadius: E
112319                };
112320              },
112321              circle: function(t) {
112322                const e = function(t) {
112323                  (t = jEt(t)).segments = 64;
112324                  return t;
112325                }(t);
112326                const i = e.segments;
112327                const s = new Array(3 * (i + 1));
112328                s[0] = 0;
112329                s[1] = 0;
112330                s[2] = 0;
112331                const n = new Array(1 + 2 * i);
112332                n[0] = 0;
112333                const r = 2 * Math.PI / i;
112334                for (let t = 0; t < i; ++t) {
112335                  const e = r * t;
112336                  const i = Math.cos(e);
112337                  const o = Math.sin(e);
112338                  const a = 3 * (t + 1);
112339                  s[a + 0] = i;
112340                  s[a + 1] = o;
112341                  s[a + 2] = 0;
112342                  const l = 2 * t;
112343                  n[1 + l] = t + 1;
112344                  n[1 + (l + 1)] = t + 2;
112345                }
112346                i > 0 && (n[n.length - 1] = 1);
112347                return {
112348                  positions: s,
112349                  indices: n,
112350                  minPos: {
112351                    x: 1,
112352                    y: 1,
112353                    z: 0
112354                  },
112355                  maxPos: {
112356                    x: -1,
112357                    y: -1,
112358                    z: 0
112359                  },
112360                  boundingRadius: 1,
112361                  primitiveMode: Xs.TRIANGLE_FAN
112362                };
112363              },
112364              translate: function(t, e) {
112365                const i = e.x || 0;
112366                const s = e.y || 0;
112367                const n = e.z || 0;
112368                const r = Math.floor(t.positions.length / 3);
112369                for (let e = 0; e < r; ++e) {
112370                  const r = 3 * e;
112371                  const o = 3 * e + 1;
112372                  const a = 3 * e + 2;
112373                  t.positions[r] += i;
112374                  t.positions[o] += s;
112375                  t.positions[a] += n;
112376                }
112377                if (t.minPos) {
112378                  t.minPos.x += i;
112379                  t.minPos.y += s;
112380                  t.minPos.z += n;
112381                }
112382                if (t.maxPos) {
112383                  t.maxPos.x += i;
112384                  t.maxPos.y += s;
112385                  t.maxPos.z += n;
112386                }
112387                return t;
112388              },
112389              scale: function(t, e) {
112390                const i = e.x || 0;
112391                const s = e.y || 0;
112392                const n = e.z || 0;
112393                const r = Math.floor(t.positions.length / 3);
112394                for (let e = 0; e < r; ++e) {
112395                  const r = 3 * e;
112396                  const o = 3 * e + 1;
112397                  const a = 3 * e + 2;
112398                  t.positions[r] *= i;
112399                  t.positions[o] *= s;
112400                  t.positions[a] *= n;
112401                }
112402                if (t.minPos) {
112403                  t.minPos.x *= i;
112404                  t.minPos.y *= s;
112405                  t.minPos.z *= n;
112406                }
112407                if (t.maxPos) {
112408                  t.maxPos.x *= i;
112409                  t.maxPos.y *= s;
112410                  t.maxPos.z *= n;
112411                }
112412                t.boundingRadius = Math.max(Math.max(i, s), n);
112413                return t;
112414              },
112415              wireframed: function(t) {
112416                const {indices: e} = t;
112417                if (!e) return t;
112418                if (t.primitiveMode && t.primitiveMode !== Xs.TRIANGLE_LIST) return t;
112419                const i = [ [ 0, 1 ], [ 1, 2 ], [ 2, 0 ] ];
112420                const s = [];
112421                const n = {};
112422                for (let t = 0; t < e.length; t += 3) for (let r = 0; r < 3; ++r) {
112423                  const o = e[t + i[r][0]];
112424                  const a = e[t + i[r][1]];
112425                  const l = o > a ? a << 16 | o : o << 16 | a;
112426                  if (void 0 === n[l]) {
112427                    n[l] = 0;
112428                    s.push(o, a);
112429                  }
112430                }
112431                t.indices = s;
112432                t.primitiveMode = Xs.LINE_LIST;
112433                return t;
112434              },
112435              wireframe: function(t) {
112436                const e = [ [ 0, 1 ], [ 1, 2 ], [ 2, 0 ] ];
112437                const i = [];
112438                const s = {};
112439                for (let n = 0; n < t.length; n += 3) for (let r = 0; r < 3; ++r) {
112440                  const o = t[n + e[r][0]];
112441                  const a = t[n + e[r][1]];
112442                  const l = o > a ? a << 16 | o : o << 16 | a;
112443                  if (void 0 === s[l]) {
112444                    s[l] = 0;
112445                    i.push(o, a);
112446                  }
112447                }
112448                return i;
112449              },
112450              invWinding: function(t) {
112451                const e = [];
112452                for (let i = 0; i < t.length; i += 3) e.push(t[i], t[i + 2], t[i + 1]);
112453                return e;
112454              },
112455              toWavefrontOBJ: function(t, e = 1) {
112456                if (!t.indices || !t.uvs || !t.normals || void 0 !== t.primitiveMode && t.primitiveMode !== Xs.TRIANGLE_LIST) return "";
112457                const i = t.positions;
112458                const s = t.uvs;
112459                const n = t.normals;
112460                const r = t.indices;
112461                const o = t => `${r[t] + 1}/${r[t] + 1}/${r[t] + 1}`;
112462                let a = "";
112463                for (let t = 0; t < i.length; t += 3) a += `v ${i[t] * e} ${i[t + 1] * e} ${i[t + 2] * e}\n`;
112464                for (let t = 0; t < s.length; t += 2) a += `vt ${s[t]} ${s[t + 1]}\n`;
112465                for (let t = 0; t < n.length; t += 3) a += `vn ${n[t]} ${n[t + 1]} ${n[t + 2]}\n`;
112466                for (let t = 0; t < r.length; t += 3) a += `f ${o(t)} ${o(t + 1)} ${o(t + 2)}\n`;
112467                return a;
112468              },
112469              normals: function(t, e, i = 1) {
112470                const s = new Array(2 * t.length);
112471                for (let n = 0; n < t.length / 3; ++n) {
112472                  const r = 3 * n;
112473                  const o = 6 * n;
112474                  s[o + 0] = t[r + 0];
112475                  s[o + 1] = t[r + 1];
112476                  s[o + 2] = t[r + 2];
112477                  s[o + 3] = t[r + 0] + e[r + 0] * i;
112478                  s[o + 4] = t[r + 1] + e[r + 1] * i;
112479                  s[o + 5] = t[r + 2] + e[r + 2] * i;
112480                }
112481                return s;
112482              },
112483              applyDefaultGeometryOptions: jEt
112484            });
112485            t("primitives", mCt);
112486            const fCt = new Pi;
112487            function gCt(t) {
112488              t.x = Math.abs(t.x);
112489              t.y = Math.abs(t.y);
112490              t.z = Math.abs(t.z);
112491              return t;
112492            }
112493            var yCt = Object.freeze({
112494              __proto__: null,
112495              setWrap: function(t, e) {
112496                t.__cc_wrapper__ = e;
112497              },
112498              getWrap: function(t) {
112499                return t.__cc_wrapper__;
112500              },
112501              maxComponent: function(t) {
112502                return Math.max(t.x, Math.max(t.y, t.z));
112503              },
112504              VEC3_0: fCt,
112505              TriggerEventObject: {
112506                type: "onTriggerEnter",
112507                selfCollider: null,
112508                otherCollider: null,
112509                impl: null
112510              },
112511              CollisionEventObject: {
112512                type: "onCollisionEnter",
112513                selfCollider: null,
112514                otherCollider: null,
112515                contacts: [],
112516                impl: null
112517              },
112518              shrinkPositions: function(t) {
112519                const e = [];
112520                if (t.length >= 3) {
112521                  e[0] = t[0], e[1] = t[1], e[2] = t[2];
112522                  const i = t.length;
112523                  for (let s = 3; s < i; s += 3) {
112524                    const i = t[s];
112525                    const n = t[s + 1];
112526                    const r = t[s + 2];
112527                    const o = e.length;
112528                    let a = !0;
112529                    for (let t = 0; t < o; t += 3) if (ci(i, e[t]) && ci(n, e[t + 1]) && ci(r, e[t + 2])) {
112530                      a = !1;
112531                      break;
112532                    }
112533                    if (a) {
112534                      e.push(i);
112535                      e.push(n);
112536                      e.push(r);
112537                    }
112538                  }
112539                }
112540                return e;
112541              },
112542              absolute: gCt,
112543              cylinder: rCt
112544            });
112545            var bCt, SCt, ACt, TCt, vCt, ECt, CCt, xCt, wCt;
112546            let RCt = function(e) {
112547              return t({
112548                BoxCollider: e,
112549                BoxColliderComponent: e
112550              }), e;
112551            }((bCt = Ul("cc.BoxCollider"), SCt = sh(), ACt = $l(), TCt = Th(Pi), vCt = lh(),
112552            bCt(ECt = SCt(ECt = ACt(ECt = Ql(ECt = (CCt = (wCt = class extends HEt {
112553              get size() {
112554                return this._size;
112555              }
112556              set size(t) {
112557                if (!Pi.strictEquals(this._size, t)) {
112558                  Pi.copy(this._size, t);
112559                  gCt(this._size);
112560                  this._shape && this.shape.updateSize();
112561                }
112562              }
112563              get shape() {
112564                return this._shape;
112565              }
112566              constructor() {
112567                super(nSt.BOX);
112568                Ml(this, "_size", xCt, this);
112569              }
112570            }, wCt), Bl(CCt.prototype, "size", [ TCt, vCt ], Object.getOwnPropertyDescriptor(CCt.prototype, "size"), CCt.prototype),
112571            xCt = Bl(CCt.prototype, "_size", [ Yl ], {
112572              configurable: !0,
112573              enumerable: !0,
112574              writable: !0,
112575              initializer: function() {
112576                return new Pi(1, 1, 1);
112577              }
112578            }), CCt)) || ECt) || ECt) || ECt) || ECt));
112579            var ICt, MCt, BCt, DCt, PCt, OCt, NCt, LCt;
112580            let FCt = function(e) {
112581              return t({
112582                SphereCollider: e,
112583                SphereColliderComponent: e
112584              }), e;
112585            }((ICt = Ul("cc.SphereCollider"), MCt = sh(), BCt = $l(), DCt = lh(), ICt(PCt = MCt(PCt = BCt(PCt = Ql(PCt = (OCt = (LCt = class extends HEt {
112586              get radius() {
112587                return this._radius;
112588              }
112589              set radius(t) {
112590                if (this._radius !== t) {
112591                  this._radius = Math.abs(t);
112592                  this._shape && this.shape.updateRadius();
112593                }
112594              }
112595              get shape() {
112596                return this._shape;
112597              }
112598              constructor() {
112599                super(nSt.SPHERE);
112600                Ml(this, "_radius", NCt, this);
112601              }
112602            }, LCt), Bl(OCt.prototype, "radius", [ DCt ], Object.getOwnPropertyDescriptor(OCt.prototype, "radius"), OCt.prototype),
112603            NCt = Bl(OCt.prototype, "_radius", [ Yl ], {
112604              configurable: !0,
112605              enumerable: !0,
112606              writable: !0,
112607              initializer: function() {
112608                return .5;
112609              }
112610            }), OCt)) || PCt) || PCt) || PCt) || PCt));
112611            var VCt, kCt, UCt, GCt, zCt, HCt, jCt, XCt, WCt, YCt, qCt, KCt, JCt;
112612            let ZCt = function(e) {
112613              return t({
112614                CapsuleCollider: e,
112615                CapsuleColliderComponent: e
112616              }), e;
112617            }((VCt = Ul("cc.CapsuleCollider"), kCt = sh(), UCt = $l(), GCt = lh(), zCt = lh(),
112618            HCt = Th(iSt), jCt = lh(), VCt(XCt = kCt(XCt = UCt(XCt = Ql(XCt = (WCt = (JCt = class extends HEt {
112619              get radius() {
112620                return this._radius;
112621              }
112622              set radius(t) {
112623                if (this._radius !== t) {
112624                  this._radius = Math.abs(t);
112625                  this._shape && this.shape.setRadius(t);
112626                }
112627              }
112628              get cylinderHeight() {
112629                return this._cylinderHeight;
112630              }
112631              set cylinderHeight(t) {
112632                if (this._cylinderHeight !== t) {
112633                  this._cylinderHeight = Math.abs(t);
112634                  this._shape && this.shape.setCylinderHeight(t);
112635                }
112636              }
112637              get direction() {
112638                return this._direction;
112639              }
112640              set direction(t) {
112641                if (!((t = Math.floor(t)) < iSt.X_AXIS || t > iSt.Z_AXIS) && this._direction !== t) {
112642                  this._direction = t;
112643                  this._shape && this.shape.setDirection(t);
112644                }
112645              }
112646              get height() {
112647                return 2 * this._radius + this._cylinderHeight;
112648              }
112649              set height(t) {
112650                let e = t - 2 * this._radius;
112651                e < 0 && (e = 0);
112652                this.cylinderHeight = e;
112653              }
112654              get worldHeight() {
112655                return 2 * this._radius * this._getRadiusScale() + this._cylinderHeight * this._getHeightScale();
112656              }
112657              get shape() {
112658                return this._shape;
112659              }
112660              constructor() {
112661                super(nSt.CAPSULE);
112662                Ml(this, "_radius", YCt, this);
112663                Ml(this, "_cylinderHeight", qCt, this);
112664                Ml(this, "_direction", KCt, this);
112665              }
112666              _getRadiusScale() {
112667                if (null == this.node) return 1;
112668                const t = this.node.worldScale;
112669                return this._direction === iSt.Y_AXIS ? Math.abs(Ri(t.x, t.z)) : this._direction === iSt.X_AXIS ? Math.abs(Ri(t.y, t.z)) : Math.abs(Ri(t.x, t.y));
112670              }
112671              _getHeightScale() {
112672                if (null == this.node) return 1;
112673                const t = this.node.worldScale;
112674                return this._direction === iSt.Y_AXIS ? Math.abs(t.y) : this._direction === iSt.X_AXIS ? Math.abs(t.x) : Math.abs(t.z);
112675              }
112676            }, JCt), Bl(WCt.prototype, "radius", [ GCt ], Object.getOwnPropertyDescriptor(WCt.prototype, "radius"), WCt.prototype),
112677            Bl(WCt.prototype, "cylinderHeight", [ zCt ], Object.getOwnPropertyDescriptor(WCt.prototype, "cylinderHeight"), WCt.prototype),
112678            Bl(WCt.prototype, "direction", [ HCt, jCt ], Object.getOwnPropertyDescriptor(WCt.prototype, "direction"), WCt.prototype),
112679            YCt = Bl(WCt.prototype, "_radius", [ Yl ], {
112680              configurable: !0,
112681              enumerable: !0,
112682              writable: !0,
112683              initializer: function() {
112684                return .5;
112685              }
112686            }), qCt = Bl(WCt.prototype, "_cylinderHeight", [ Yl ], {
112687              configurable: !0,
112688              enumerable: !0,
112689              writable: !0,
112690              initializer: function() {
112691                return 1;
112692              }
112693            }), KCt = Bl(WCt.prototype, "_direction", [ Yl ], {
112694              configurable: !0,
112695              enumerable: !0,
112696              writable: !0,
112697              initializer: function() {
112698                return iSt.Y_AXIS;
112699              }
112700            }), WCt)) || XCt) || XCt) || XCt) || XCt));
112701            var QCt, $Ct, txt, ext, ixt, sxt, nxt, rxt, oxt, axt, lxt, hxt, cxt;
112702            let uxt = function(e) {
112703              return t({
112704                CylinderCollider: e,
112705                CylinderColliderComponent: e
112706              }), e;
112707            }((QCt = Ul("cc.CylinderCollider"), $Ct = sh(), txt = $l(), ext = lh(), ixt = lh(),
112708            sxt = Th(iSt), nxt = lh(), QCt(rxt = $Ct(rxt = txt(rxt = Ql(rxt = (oxt = (cxt = class extends HEt {
112709              get radius() {
112710                return this._radius;
112711              }
112712              set radius(t) {
112713                if (this._radius !== t) {
112714                  this._radius = Math.abs(t);
112715                  this._shape && this.shape.setRadius(t);
112716                }
112717              }
112718              get height() {
112719                return this._height;
112720              }
112721              set height(t) {
112722                if (this._height !== t) {
112723                  this._height = Math.abs(t);
112724                  this._shape && this.shape.setHeight(t);
112725                }
112726              }
112727              get direction() {
112728                return this._direction;
112729              }
112730              set direction(t) {
112731                if (this._direction !== t && !(t < iSt.X_AXIS || t > iSt.Z_AXIS)) {
112732                  this._direction = t;
112733                  this._shape && this.shape.setDirection(t);
112734                }
112735              }
112736              get shape() {
112737                return this._shape;
112738              }
112739              constructor() {
112740                super(nSt.CYLINDER);
112741                Ml(this, "_radius", axt, this);
112742                Ml(this, "_height", lxt, this);
112743                Ml(this, "_direction", hxt, this);
112744              }
112745            }, cxt), Bl(oxt.prototype, "radius", [ ext ], Object.getOwnPropertyDescriptor(oxt.prototype, "radius"), oxt.prototype),
112746            Bl(oxt.prototype, "height", [ ixt ], Object.getOwnPropertyDescriptor(oxt.prototype, "height"), oxt.prototype),
112747            Bl(oxt.prototype, "direction", [ sxt, nxt ], Object.getOwnPropertyDescriptor(oxt.prototype, "direction"), oxt.prototype),
112748            axt = Bl(oxt.prototype, "_radius", [ Yl ], {
112749              configurable: !0,
112750              enumerable: !0,
112751              writable: !0,
112752              initializer: function() {
112753                return .5;
112754              }
112755            }), lxt = Bl(oxt.prototype, "_height", [ Yl ], {
112756              configurable: !0,
112757              enumerable: !0,
112758              writable: !0,
112759              initializer: function() {
112760                return 2;
112761              }
112762            }), hxt = Bl(oxt.prototype, "_direction", [ Yl ], {
112763              configurable: !0,
112764              enumerable: !0,
112765              writable: !0,
112766              initializer: function() {
112767                return iSt.Y_AXIS;
112768              }
112769            }), oxt)) || rxt) || rxt) || rxt) || rxt));
112770            var _xt, dxt, pxt, mxt, fxt, gxt, yxt, bxt, Sxt, Axt, Txt, vxt, Ext;
112771            let Cxt = t("ConeCollider", (_xt = Ul("cc.ConeCollider"), dxt = sh(), pxt = $l(),
112772            mxt = lh(), fxt = lh(), gxt = Th(iSt), yxt = lh(), _xt(bxt = dxt(bxt = pxt(bxt = Ql(bxt = (Sxt = (Ext = class extends HEt {
112773              get radius() {
112774                return this._radius;
112775              }
112776              set radius(t) {
112777                if (this._radius !== t) {
112778                  this._radius = Math.abs(t);
112779                  this._shape && this.shape.setRadius(t);
112780                }
112781              }
112782              get height() {
112783                return this._height;
112784              }
112785              set height(t) {
112786                if (this._height !== t) {
112787                  t < 0 && (t = 0);
112788                  this._height = t;
112789                  this._shape && this.shape.setHeight(t);
112790                }
112791              }
112792              get direction() {
112793                return this._direction;
112794              }
112795              set direction(t) {
112796                if (this._direction !== t && !(t < iSt.X_AXIS || t > iSt.Z_AXIS)) {
112797                  this._direction = t;
112798                  this._shape && this.shape.setDirection(t);
112799                }
112800              }
112801              get shape() {
112802                return this._shape;
112803              }
112804              constructor() {
112805                super(nSt.CONE);
112806                Ml(this, "_radius", Axt, this);
112807                Ml(this, "_height", Txt, this);
112808                Ml(this, "_direction", vxt, this);
112809              }
112810            }, Ext), Bl(Sxt.prototype, "radius", [ mxt ], Object.getOwnPropertyDescriptor(Sxt.prototype, "radius"), Sxt.prototype),
112811            Bl(Sxt.prototype, "height", [ fxt ], Object.getOwnPropertyDescriptor(Sxt.prototype, "height"), Sxt.prototype),
112812            Bl(Sxt.prototype, "direction", [ gxt, yxt ], Object.getOwnPropertyDescriptor(Sxt.prototype, "direction"), Sxt.prototype),
112813            Axt = Bl(Sxt.prototype, "_radius", [ Yl ], {
112814              configurable: !0,
112815              enumerable: !0,
112816              writable: !0,
112817              initializer: function() {
112818                return .5;
112819              }
112820            }), Txt = Bl(Sxt.prototype, "_height", [ Yl ], {
112821              configurable: !0,
112822              enumerable: !0,
112823              writable: !0,
112824              initializer: function() {
112825                return 1;
112826              }
112827            }), vxt = Bl(Sxt.prototype, "_direction", [ Yl ], {
112828              configurable: !0,
112829              enumerable: !0,
112830              writable: !0,
112831              initializer: function() {
112832                return iSt.Y_AXIS;
112833              }
112834            }), Sxt)) || bxt) || bxt) || bxt) || bxt));
112835            var xxt, wxt, Rxt, Ixt, Mxt, Bxt, Dxt, Pxt, Oxt, Nxt, Lxt;
112836            let Fxt = function(e) {
112837              return t({
112838                MeshCollider: e,
112839                MeshColliderComponent: e
112840              }), e;
112841            }((xxt = Ul("cc.MeshCollider"), wxt = sh(), Rxt = $l(), Ixt = Th(Ez), Mxt = lh(),
112842            Bxt = lh(), xxt(Dxt = wxt(Dxt = Rxt(Dxt = Ql(Dxt = (Pxt = (Lxt = class extends HEt {
112843              get mesh() {
112844                return this._mesh;
112845              }
112846              set mesh(t) {
112847                if (this._mesh !== t) {
112848                  this._mesh = t;
112849                  this._shape && this.shape.setMesh(this._mesh);
112850                }
112851              }
112852              get convex() {
112853                return this._convex;
112854              }
112855              set convex(t) {
112856                this._convex !== t && (this._convex = t);
112857              }
112858              get shape() {
112859                return this._shape;
112860              }
112861              constructor() {
112862                super(nSt.MESH);
112863                Ml(this, "_mesh", Oxt, this);
112864                Ml(this, "_convex", Nxt, this);
112865              }
112866            }, Lxt), Bl(Pxt.prototype, "mesh", [ Ixt, Mxt ], Object.getOwnPropertyDescriptor(Pxt.prototype, "mesh"), Pxt.prototype),
112867            Bl(Pxt.prototype, "convex", [ nh, Bxt ], Object.getOwnPropertyDescriptor(Pxt.prototype, "convex"), Pxt.prototype),
112868            Oxt = Bl(Pxt.prototype, "_mesh", [ Yl ], {
112869              configurable: !0,
112870              enumerable: !0,
112871              writable: !0,
112872              initializer: function() {
112873                return null;
112874              }
112875            }), Nxt = Bl(Pxt.prototype, "_convex", [ Yl ], {
112876              configurable: !0,
112877              enumerable: !0,
112878              writable: !0,
112879              initializer: function() {
112880                return !1;
112881              }
112882            }), Pxt)) || Dxt) || Dxt) || Dxt) || Dxt));
112883            var Vxt, kxt, Uxt, Gxt, zxt, Hxt, jxt, Xxt, Wxt, Yxt, qxt, Kxt, Jxt, Zxt, Qxt, $xt, twt, ewt, iwt;
112884            let swt = t("ConstantForce", (Vxt = Ul("cc.ConstantForce"), kxt = sh(), Uxt = Gl(SEt),
112885            Gxt = $l(), zxt = ph(), Hxt = lh(), jxt = ph(), Xxt = lh(), Wxt = ph(), Yxt = lh(),
112886            qxt = ph(), Kxt = lh(), Vxt(Jxt = kxt(Jxt = Uxt(Jxt = Gxt(Jxt = Hl(Jxt = Ql(Jxt = (Zxt = (iwt = class extends Qc {
112887              constructor(...t) {
112888                super(...t);
112889                this._rigidBody = null;
112890                Ml(this, "_force", Qxt, this);
112891                Ml(this, "_localForce", $xt, this);
112892                Ml(this, "_torque", twt, this);
112893                Ml(this, "_localTorque", ewt, this);
112894                this._mask = 0;
112895              }
112896              get force() {
112897                return this._force;
112898              }
112899              set force(t) {
112900                Pi.copy(this._force, t);
112901                this._maskUpdate(this._force, 1);
112902              }
112903              get localForce() {
112904                return this._localForce;
112905              }
112906              set localForce(t) {
112907                Pi.copy(this._localForce, t);
112908                this._maskUpdate(this.localForce, 2);
112909              }
112910              get torque() {
112911                return this._torque;
112912              }
112913              set torque(t) {
112914                Pi.copy(this._torque, t);
112915                this._maskUpdate(this._torque, 4);
112916              }
112917              get localTorque() {
112918                return this._localTorque;
112919              }
112920              set localTorque(t) {
112921                Pi.copy(this._localTorque, t);
112922                this._maskUpdate(this._localTorque, 8);
112923              }
112924              onLoad() {
112925                this._rigidBody = this.node.getComponent(SEt);
112926                this._maskUpdate(this._force, 1);
112927                this._maskUpdate(this._localForce, 2);
112928                this._maskUpdate(this._torque, 4);
112929                this._maskUpdate(this._localTorque, 8);
112930              }
112931              lateUpdate(t) {
112932                if (null != this._rigidBody && 0 !== this._mask) {
112933                  1 & this._mask && this._rigidBody.applyForce(this._force);
112934                  2 & this._mask && this._rigidBody.applyLocalForce(this.localForce);
112935                  4 & this._mask && this._rigidBody.applyTorque(this._torque);
112936                  8 & this._mask && this._rigidBody.applyLocalTorque(this._localTorque);
112937                }
112938              }
112939              _maskUpdate(t, e) {
112940                t.strictEquals(Pi.ZERO) ? this._mask &= ~e : this._mask |= e;
112941              }
112942            }, iwt), Qxt = Bl(Zxt.prototype, "_force", [ Yl ], {
112943              configurable: !0,
112944              enumerable: !0,
112945              writable: !0,
112946              initializer: function() {
112947                return new Pi;
112948              }
112949            }), $xt = Bl(Zxt.prototype, "_localForce", [ Yl ], {
112950              configurable: !0,
112951              enumerable: !0,
112952              writable: !0,
112953              initializer: function() {
112954                return new Pi;
112955              }
112956            }), twt = Bl(Zxt.prototype, "_torque", [ Yl ], {
112957              configurable: !0,
112958              enumerable: !0,
112959              writable: !0,
112960              initializer: function() {
112961                return new Pi;
112962              }
112963            }), ewt = Bl(Zxt.prototype, "_localTorque", [ Yl ], {
112964              configurable: !0,
112965              enumerable: !0,
112966              writable: !0,
112967              initializer: function() {
112968                return new Pi;
112969              }
112970            }), Bl(Zxt.prototype, "force", [ zxt, Hxt ], Object.getOwnPropertyDescriptor(Zxt.prototype, "force"), Zxt.prototype),
112971            Bl(Zxt.prototype, "localForce", [ jxt, Xxt ], Object.getOwnPropertyDescriptor(Zxt.prototype, "localForce"), Zxt.prototype),
112972            Bl(Zxt.prototype, "torque", [ Wxt, Yxt ], Object.getOwnPropertyDescriptor(Zxt.prototype, "torque"), Zxt.prototype),
112973            Bl(Zxt.prototype, "localTorque", [ qxt, Kxt ], Object.getOwnPropertyDescriptor(Zxt.prototype, "localTorque"), Zxt.prototype),
112974            Zxt)) || Jxt) || Jxt) || Jxt) || Jxt) || Jxt) || Jxt));
112975            var nwt, rwt, owt, awt, lwt, hwt, cwt, uwt, _wt, dwt, pwt, mwt, fwt;
112976            t("TERRAIN_MAX_LEVELS", 4);
112977            const gwt = t("TERRAIN_MAX_BLEND_LAYERS", 4);
112978            const ywt = t("TERRAIN_MAX_LAYER_COUNT", 256);
112979            const bwt = t("TERRAIN_BLOCK_TILE_COMPLEXITY", 32);
112980            const Swt = t("TERRAIN_BLOCK_VERTEX_COMPLEXITY", 33);
112981            const Awt = t("TERRAIN_BLOCK_VERTEX_SIZE", 8);
112982            const Twt = t("TERRAIN_HEIGHT_BASE", 32768);
112983            const vwt = t("TERRAIN_HEIGHT_FACTORY", 1 / 512);
112984            const Ewt = t("TERRAIN_HEIGHT_FMIN", -Twt * vwt);
112985            const Cwt = t("TERRAIN_HEIGHT_FMAX", (65535 - Twt) * vwt);
112986            t("TERRAIN_NORTH_INDEX", 0);
112987            t("TERRAIN_SOUTH_INDEX", 1);
112988            t("TERRAIN_WEST_INDEX", 2);
112989            t("TERRAIN_EAST_INDEX", 3);
112990            const xwt = t("TERRAIN_DATA_VERSION", 16842753);
112991            const wwt = t("TERRAIN_DATA_VERSION2", 16842754);
112992            const Rwt = t("TERRAIN_DATA_VERSION3", 16842755);
112993            const Iwt = t("TERRAIN_DATA_VERSION4", 16842756);
112994            const Mwt = t("TERRAIN_DATA_VERSION5", 16842757);
112995            const Bwt = t("TERRAIN_DATA_VERSION6", 16842758);
112996            const Dwt = t("TERRAIN_DATA_VERSION_DEFAULT", 16843025);
112997            class Pwt {
112998              constructor() {
112999                this.length = 0;
113000                this.buffer = new Uint8Array(2048);
113001                this._buffView = new DataView(this.buffer.buffer);
113002                this._seekPos = 0;
113003              }
113004              reserve(t) {
113005                if (this.buffer.byteLength > t) return;
113006                let e = this.buffer.byteLength;
113007                for (;e < t; ) e += e;
113008                const i = new Uint8Array(e);
113009                for (let t = 0; t < this.length; ++t) i[t] = this.buffer[t];
113010                this.buffer = i;
113011                this._buffView = new DataView(this.buffer.buffer);
113012              }
113013              assign(t) {
113014                this.buffer = t;
113015                this.length = t.length;
113016                this._seekPos = t.byteOffset;
113017                this._buffView = new DataView(t.buffer);
113018              }
113019              writeInt8(t) {
113020                this.reserve(this.length + 1);
113021                this._buffView.setInt8(this.length, t);
113022                this.length += 1;
113023              }
113024              writeInt16(t) {
113025                this.reserve(this.length + 2);
113026                this._buffView.setInt16(this.length, t, !0);
113027                this.length += 2;
113028              }
113029              writeInt32(t) {
113030                this.reserve(this.length + 4);
113031                this._buffView.setInt32(this.length, t, !0);
113032                this.length += 4;
113033              }
113034              writeIntArray(t) {
113035                this.reserve(this.length + 4 * t.length);
113036                for (let e = 0; e < t.length; ++e) this._buffView.setInt32(this.length + 4 * e, t[e], !0);
113037                this.length += 4 * t.length;
113038              }
113039              writeFloat(t) {
113040                this.reserve(this.length + 4);
113041                this._buffView.setFloat32(this.length, t, !0);
113042                this.length += 4;
113043              }
113044              writeFloatArray(t) {
113045                this.reserve(this.length + 4 * t.length);
113046                for (let e = 0; e < t.length; ++e) this._buffView.setFloat32(this.length + 4 * e, t[e], !0);
113047                this.length += 4 * t.length;
113048              }
113049              writeString(t) {
113050                this.reserve(this.length + t.length + 4);
113051                this._buffView.setInt32(this.length, t.length, !0);
113052                for (let e = 0; e < t.length; ++e) this._buffView.setInt8(this.length + 4 + e, t.charCodeAt(e));
113053                this.length += t.length + 4;
113054              }
113055              readInt8() {
113056                const t = this._buffView.getInt8(this._seekPos);
113057                this._seekPos += 1;
113058                return t;
113059              }
113060              readInt16() {
113061                const t = this._buffView.getInt16(this._seekPos, !0);
113062                this._seekPos += 2;
113063                return t;
113064              }
113065              readInt() {
113066                const t = this._buffView.getInt32(this._seekPos, !0);
113067                this._seekPos += 4;
113068                return t;
113069              }
113070              readIntArray(t) {
113071                for (let e = 0; e < t.length; ++e) t[e] = this._buffView.getInt32(this._seekPos + 4 * e, !0);
113072                this._seekPos += 4 * t.length;
113073                return t;
113074              }
113075              readFloat() {
113076                const t = this._buffView.getFloat32(this._seekPos, !0);
113077                this._seekPos += 4;
113078                return t;
113079              }
113080              readFloatArray(t) {
113081                for (let e = 0; e < t.length; ++e) t[e] = this._buffView.getFloat32(this._seekPos + 4 * e, !0);
113082                this._seekPos += 4 * t.length;
113083                return t;
113084              }
113085              readString() {
113086                const t = this.readInt();
113087                let e = "";
113088                for (let i = 0; i < t; ++i) e += String.fromCharCode(this.readInt8());
113089                return e;
113090              }
113091            }
113092            let Owt = t("TerrainLayerInfo", Ul("cc.TerrainLayerInfo")(nwt = (rwt = class {
113093              constructor() {
113094                Ml(this, "slot", owt, this);
113095                Ml(this, "tileSize", awt, this);
113096                Ml(this, "detailMap", lwt, this);
113097                Ml(this, "normalMap", hwt, this);
113098                Ml(this, "roughness", cwt, this);
113099                Ml(this, "metallic", uwt, this);
113100              }
113101            }, owt = Bl(rwt.prototype, "slot", [ Yl ], {
113102              configurable: !0,
113103              enumerable: !0,
113104              writable: !0,
113105              initializer: function() {
113106                return 0;
113107              }
113108            }), awt = Bl(rwt.prototype, "tileSize", [ Yl ], {
113109              configurable: !0,
113110              enumerable: !0,
113111              writable: !0,
113112              initializer: function() {
113113                return 1;
113114              }
113115            }), lwt = Bl(rwt.prototype, "detailMap", [ Yl ], {
113116              configurable: !0,
113117              enumerable: !0,
113118              writable: !0,
113119              initializer: function() {
113120                return null;
113121              }
113122            }), hwt = Bl(rwt.prototype, "normalMap", [ Yl ], {
113123              configurable: !0,
113124              enumerable: !0,
113125              writable: !0,
113126              initializer: function() {
113127                return null;
113128              }
113129            }), cwt = Bl(rwt.prototype, "roughness", [ Yl ], {
113130              configurable: !0,
113131              enumerable: !0,
113132              writable: !0,
113133              initializer: function() {
113134                return 1;
113135              }
113136            }), uwt = Bl(rwt.prototype, "metallic", [ Yl ], {
113137              configurable: !0,
113138              enumerable: !0,
113139              writable: !0,
113140              initializer: function() {
113141                return 0;
113142              }
113143            }), rwt)) || nwt);
113144            let Nwt = t("TerrainLayerBinaryInfo", Ul("cc.TerrainLayerBinaryInfo")(_wt = class {
113145              constructor() {
113146                this.slot = 0;
113147                this.tileSize = 1;
113148                this.roughness = 1;
113149                this.metallic = 0;
113150                this.detailMapId = "";
113151                this.normalMapId = "";
113152              }
113153            }) || _wt);
113154            let Lwt = t("TerrainAsset", Ul("cc.TerrainAsset")(dwt = (pwt = (fwt = class extends gc {
113155              constructor() {
113156                super();
113157                this._version = 0;
113158                this._data = null;
113159                this._tileSize = 1;
113160                this._blockCount = [ 1, 1 ];
113161                this._weightMapSize = 128;
113162                this._lightMapSize = 128;
113163                this._heights = new Uint16Array;
113164                this._normals = new Float32Array;
113165                this._weights = new Uint8Array;
113166                this._layerBuffer = [ -1, -1, -1, -1 ];
113167                this._layerBinaryInfos = [];
113168                Ml(this, "_layerInfos", mwt, this);
113169              }
113170              get _nativeAsset() {
113171                return this._data.buffer;
113172              }
113173              set _nativeAsset(t) {
113174                this._data && this._data.byteLength === t.byteLength ? this._data.set(new Uint8Array(t)) : this._data = new Uint8Array(t);
113175                this._loadNativeData(this._data);
113176              }
113177              get version() {
113178                return this._version;
113179              }
113180              set tileSize(t) {
113181                this._tileSize = t;
113182              }
113183              get tileSize() {
113184                return this._tileSize;
113185              }
113186              set blockCount(t) {
113187                this._blockCount = t;
113188              }
113189              get blockCount() {
113190                return this._blockCount;
113191              }
113192              set lightMapSize(t) {
113193                this._lightMapSize = t;
113194              }
113195              get lightMapSize() {
113196                return this._lightMapSize;
113197              }
113198              set weightMapSize(t) {
113199                this._weightMapSize = t;
113200              }
113201              get weightMapSize() {
113202                return this._weightMapSize;
113203              }
113204              set heights(t) {
113205                this._heights = t;
113206              }
113207              get heights() {
113208                return this._heights;
113209              }
113210              set normals(t) {
113211                this._normals = t;
113212              }
113213              get normals() {
113214                return this._normals;
113215              }
113216              set weights(t) {
113217                this._weights = t;
113218              }
113219              get weights() {
113220                return this._weights;
113221              }
113222              set layerBuffer(t) {
113223                this._layerBuffer = t;
113224              }
113225              get layerBuffer() {
113226                return this._layerBuffer;
113227              }
113228              set layerInfos(t) {
113229                this._layerInfos = t;
113230              }
113231              get layerInfos() {
113232                return this._layerInfos;
113233              }
113234              get layerBinaryInfos() {
113235                return this._layerBinaryInfos;
113236              }
113237              getLayer(t, e, i) {
113238                const s = 4 * (e * this.blockCount[0] + t) + i;
113239                return t < this.blockCount[0] && e < this.blockCount[1] && s < this._layerBuffer.length ? this._layerBuffer[s] : -1;
113240              }
113241              getHeight(t, e) {
113242                const i = this._blockCount[0] * bwt + 1;
113243                return (this._heights[e * i + t] - Twt) * vwt;
113244              }
113245              getVertexCountI() {
113246                return this._blockCount.length < 1 ? 0 : this._blockCount[0] * bwt + 1;
113247              }
113248              getVertexCountJ() {
113249                return this._blockCount.length < 2 ? 0 : this._blockCount[1] * bwt + 1;
113250              }
113251              _setNativeData(t) {
113252                this._data = t;
113253              }
113254              _loadNativeData(t) {
113255                if (!t || 0 === t.length) return !1;
113256                const e = new Pwt;
113257                e.assign(t);
113258                this._version = e.readInt();
113259                if (this._version === Dwt) return !0;
113260                if (this._version !== xwt && this._version !== wwt && this._version !== Rwt && this._version !== Iwt && this._version !== Mwt && this._version !== Bwt) return !1;
113261                this.tileSize = e.readFloat();
113262                e.readIntArray(this._blockCount);
113263                this.weightMapSize = e.readInt16();
113264                this.lightMapSize = e.readInt16();
113265                const i = e.readInt();
113266                this.heights = new Uint16Array(i);
113267                for (let t = 0; t < this.heights.length; ++t) this.heights[t] = e.readInt16();
113268                if (this._version >= Bwt) {
113269                  const t = e.readInt();
113270                  this.normals = new Float32Array(t);
113271                  for (let t = 0; t < this.normals.length; ++t) this.normals[t] = e.readFloat();
113272                }
113273                const s = e.readInt();
113274                this.weights = new Uint8Array(s);
113275                for (let t = 0; t < this.weights.length; ++t) this.weights[t] = e.readInt8();
113276                if (this._version >= wwt) {
113277                  const t = e.readInt();
113278                  this.layerBuffer = new Array(t);
113279                  for (let t = 0; t < this.layerBuffer.length; ++t) this.layerBuffer[t] = e.readInt16();
113280                }
113281                if (this._version >= Rwt) {
113282                  const t = e.readInt();
113283                  this._layerBinaryInfos = new Array(t);
113284                  for (let t = 0; t < this._layerBinaryInfos.length; ++t) {
113285                    this._layerBinaryInfos[t] = new Nwt;
113286                    this._layerBinaryInfos[t].slot = e.readInt();
113287                    this._layerBinaryInfos[t].tileSize = e.readFloat();
113288                    this._layerBinaryInfos[t].detailMapId = e.readString();
113289                    if (this._version >= Iwt) {
113290                      this._layerBinaryInfos[t].normalMapId = e.readString();
113291                      this._layerBinaryInfos[t].roughness = e.readFloat();
113292                      this._layerBinaryInfos[t].metallic = e.readFloat();
113293                    }
113294                  }
113295                }
113296                return !0;
113297              }
113298              _exportNativeData() {
113299                const t = new Pwt;
113300                t.writeInt32(Bwt);
113301                t.writeFloat(this.tileSize);
113302                t.writeIntArray(this._blockCount);
113303                t.writeInt16(this.weightMapSize);
113304                t.writeInt16(this.lightMapSize);
113305                t.writeInt32(this.heights.length);
113306                for (let e = 0; e < this.heights.length; ++e) t.writeInt16(this.heights[e]);
113307                t.writeInt32(this.normals.length);
113308                for (let e = 0; e < this.normals.length; ++e) t.writeFloat(this.normals[e]);
113309                t.writeInt32(this.weights.length);
113310                for (let e = 0; e < this.weights.length; ++e) t.writeInt8(this.weights[e]);
113311                t.writeInt32(this.layerBuffer.length);
113312                for (let e = 0; e < this.layerBuffer.length; ++e) t.writeInt16(this.layerBuffer[e]);
113313                const e = [];
113314                e.length = this.layerInfos.length;
113315                for (let t = 0; t < e.length; ++t) {
113316                  const i = this.layerInfos[t];
113317                  const s = new Nwt;
113318                  s.slot = t;
113319                  s.tileSize = i.tileSize;
113320                  s.detailMapId = i.detailMap ? i.detailMap._uuid : "";
113321                  s.normalMapId = i.normalMap ? i.normalMap._uuid : "";
113322                  s.metallic = i.metallic;
113323                  s.roughness = i.roughness;
113324                  e[t] = s;
113325                }
113326                t.writeInt32(e.length);
113327                for (let i = 0; i < e.length; ++i) {
113328                  t.writeInt32(e[i].slot);
113329                  t.writeFloat(e[i].tileSize);
113330                  t.writeString(e[i].detailMapId);
113331                  t.writeString(e[i].normalMapId);
113332                  t.writeFloat(e[i].roughness);
113333                  t.writeFloat(e[i].metallic);
113334                }
113335                return t.buffer;
113336              }
113337              _exportDefaultNativeData() {
113338                const t = new Pwt;
113339                t.writeInt32(Dwt);
113340                return t.buffer;
113341              }
113342            }, fwt), mwt = Bl(pwt.prototype, "_layerInfos", [ Yl ], {
113343              configurable: !0,
113344              enumerable: !0,
113345              writable: !0,
113346              initializer: function() {
113347                return [];
113348              }
113349            }), pwt)) || dwt);
113350            var Fwt, Vwt, kwt, Uwt, Gwt, zwt, Hwt, jwt, Xwt;
113351            let Wwt = t("TerrainCollider", (Fwt = Ul("cc.TerrainCollider"), Vwt = sh(), kwt = $l(),
113352            Uwt = Th(Lwt), Gwt = lh(), Fwt(zwt = Vwt(zwt = kwt(zwt = Ql(zwt = (Hwt = (Xwt = class extends HEt {
113353              get terrain() {
113354                return this._terrain;
113355              }
113356              set terrain(t) {
113357                this._terrain = t;
113358                this._shape && this.shape.setTerrain(this._terrain);
113359              }
113360              get shape() {
113361                return this._shape;
113362              }
113363              constructor() {
113364                super(nSt.TERRAIN);
113365                Ml(this, "_terrain", jwt, this);
113366              }
113367            }, Xwt), Bl(Hwt.prototype, "terrain", [ Uwt, Gwt ], Object.getOwnPropertyDescriptor(Hwt.prototype, "terrain"), Hwt.prototype),
113368            jwt = Bl(Hwt.prototype, "_terrain", [ Yl ], {
113369              configurable: !0,
113370              enumerable: !0,
113371              writable: !0,
113372              initializer: function() {
113373                return null;
113374              }
113375            }), Hwt)) || zwt) || zwt) || zwt) || zwt));
113376            var Ywt, qwt, Kwt, Jwt, Zwt, Qwt, $wt, tRt, eRt, iRt, sRt, nRt, rRt, oRt, aRt, lRt, hRt, cRt;
113377            let uRt = t("SimplexCollider", (Ywt = Ul("cc.SimplexCollider"), qwt = sh(), Kwt = $l(),
113378            Jwt = Th(sSt), Zwt = lh(), Qwt = lh(), $wt = rh(), tRt = lh(), eRt = rh(), iRt = lh(),
113379            sRt = rh(), nRt = lh(), Ywt(rRt = qwt(rRt = Kwt(rRt = Ql(rRt = (oRt = (cRt = hRt = class extends HEt {
113380              get shapeType() {
113381                return this._shapeType;
113382              }
113383              set shapeType(t) {
113384                this._shapeType = t;
113385                this._shape && this.shape.setShapeType(t);
113386              }
113387              get vertex0() {
113388                return this._vertices[0];
113389              }
113390              set vertex0(t) {
113391                Pi.copy(this._vertices[0], t);
113392                this.updateVertices();
113393              }
113394              get vertex1() {
113395                return this._vertices[1];
113396              }
113397              set vertex1(t) {
113398                Pi.copy(this._vertices[1], t);
113399                this.updateVertices();
113400              }
113401              get vertex2() {
113402                return this._vertices[2];
113403              }
113404              set vertex2(t) {
113405                Pi.copy(this._vertices[2], t);
113406                this.updateVertices();
113407              }
113408              get vertex3() {
113409                return this._vertices[3];
113410              }
113411              set vertex3(t) {
113412                Pi.copy(this._vertices[3], t);
113413                this.updateVertices();
113414              }
113415              get shape() {
113416                return this._shape;
113417              }
113418              get vertices() {
113419                return this._vertices;
113420              }
113421              constructor() {
113422                super(nSt.SIMPLEX);
113423                Ml(this, "_shapeType", aRt, this);
113424                Ml(this, "_vertices", lRt, this);
113425              }
113426              updateVertices() {
113427                this._shape && this.shape.setVertices(this._vertices);
113428              }
113429            }, hRt.ESimplexType = sSt, cRt), Bl(oRt.prototype, "shapeType", [ Jwt, Zwt ], Object.getOwnPropertyDescriptor(oRt.prototype, "shapeType"), oRt.prototype),
113430            Bl(oRt.prototype, "vertex0", [ nh, Qwt ], Object.getOwnPropertyDescriptor(oRt.prototype, "vertex0"), oRt.prototype),
113431            Bl(oRt.prototype, "vertex1", [ $wt, tRt ], Object.getOwnPropertyDescriptor(oRt.prototype, "vertex1"), oRt.prototype),
113432            Bl(oRt.prototype, "vertex2", [ eRt, iRt ], Object.getOwnPropertyDescriptor(oRt.prototype, "vertex2"), oRt.prototype),
113433            Bl(oRt.prototype, "vertex3", [ sRt, nRt ], Object.getOwnPropertyDescriptor(oRt.prototype, "vertex3"), oRt.prototype),
113434            aRt = Bl(oRt.prototype, "_shapeType", [ Yl ], {
113435              configurable: !0,
113436              enumerable: !0,
113437              writable: !0,
113438              initializer: function() {
113439                return sSt.TETRAHEDRON;
113440              }
113441            }), lRt = Bl(oRt.prototype, "_vertices", [ Yl ], {
113442              configurable: !0,
113443              enumerable: !0,
113444              writable: !0,
113445              initializer: function() {
113446                return [ new Pi(0, 0, 0), new Pi(0, 0, 1), new Pi(1, 0, 0), new Pi(0, 1, 0) ];
113447              }
113448            }), oRt)) || rRt) || rRt) || rRt) || rRt));
113449            uRt || (uRt = t("SimplexCollider", {}));
113450            var _Rt, dRt, pRt, mRt, fRt, gRt, yRt, bRt, SRt, ARt, TRt;
113451            let vRt = t("PlaneCollider", (_Rt = Ul("cc.PlaneCollider"), dRt = sh(), pRt = $l(),
113452            mRt = Th(Pi), fRt = lh(), gRt = lh(), _Rt(yRt = dRt(yRt = pRt(yRt = Ql(yRt = (bRt = (TRt = class extends HEt {
113453              get normal() {
113454                return this._normal;
113455              }
113456              set normal(t) {
113457                if (!Pi.strictEquals(this._normal, t)) {
113458                  Pi.copy(this._normal, t);
113459                  this._shape && this.shape.setNormal(this._normal);
113460                }
113461              }
113462              get constant() {
113463                return this._constant;
113464              }
113465              set constant(t) {
113466                if (this._constant !== t) {
113467                  this._constant = t;
113468                  this._shape && this.shape.setConstant(this._constant);
113469                }
113470              }
113471              get shape() {
113472                return this._shape;
113473              }
113474              constructor() {
113475                super(nSt.PLANE);
113476                Ml(this, "_normal", SRt, this);
113477                Ml(this, "_constant", ARt, this);
113478              }
113479            }, TRt), Bl(bRt.prototype, "normal", [ mRt, fRt ], Object.getOwnPropertyDescriptor(bRt.prototype, "normal"), bRt.prototype),
113480            Bl(bRt.prototype, "constant", [ nh, gRt ], Object.getOwnPropertyDescriptor(bRt.prototype, "constant"), bRt.prototype),
113481            SRt = Bl(bRt.prototype, "_normal", [ Yl ], {
113482              configurable: !0,
113483              enumerable: !0,
113484              writable: !0,
113485              initializer: function() {
113486                return new Pi(0, 1, 0);
113487              }
113488            }), ARt = Bl(bRt.prototype, "_constant", [ Yl ], {
113489              configurable: !0,
113490              enumerable: !0,
113491              writable: !0,
113492              initializer: function() {
113493                return 0;
113494              }
113495            }), bRt)) || yRt) || yRt) || yRt) || yRt));
113496            var ERt, CRt, xRt, wRt, RRt, IRt, MRt, BRt, DRt, PRt, ORt, NRt, LRt, FRt;
113497            let VRt = t("Constraint", (ERt = Ul("cc.Constraint"), CRt = Gl(SEt), xRt = Th(SEt),
113498            wRt = ph(), RRt = Th(SEt), IRt = ph(), MRt = ph(), BRt = Th(SEt), ERt(DRt = CRt(DRt = (PRt = (FRt = LRt = class extends(To(Qc)){
113499              get attachedBody() {
113500                return this.getComponent(SEt);
113501              }
113502              get connectedBody() {
113503                return this._connectedBody;
113504              }
113505              set connectedBody(t) {
113506                this._connectedBody = t;
113507                this._constraint && this._constraint.setConnectedBody(t);
113508              }
113509              get enableCollision() {
113510                return this._enableCollision;
113511              }
113512              set enableCollision(t) {
113513                this._enableCollision = t;
113514                this._constraint && this._constraint.setEnableCollision(t);
113515              }
113516              constructor(t) {
113517                super();
113518                this.TYPE = void 0;
113519                Ml(this, "_enableCollision", ORt, this);
113520                Ml(this, "_connectedBody", NRt, this);
113521                this._constraint = null;
113522                this.TYPE = t;
113523              }
113524              onLoad() {
113525                if (ovt.runInEditor) {
113526                  this._constraint = yvt(this.TYPE);
113527                  this._constraint.initialize(this);
113528                }
113529              }
113530              onEnable() {
113531                this._constraint && this._constraint.onEnable();
113532              }
113533              onDisable() {
113534                this._constraint && this._constraint.onDisable();
113535              }
113536              onDestroy() {
113537                this._constraint && this._constraint.onDestroy();
113538              }
113539            }, LRt.Type = rSt, FRt), Bl(PRt.prototype, "attachedBody", [ xRt, oh, wRt ], Object.getOwnPropertyDescriptor(PRt.prototype, "attachedBody"), PRt.prototype),
113540            Bl(PRt.prototype, "connectedBody", [ RRt, IRt ], Object.getOwnPropertyDescriptor(PRt.prototype, "connectedBody"), PRt.prototype),
113541            Bl(PRt.prototype, "enableCollision", [ MRt ], Object.getOwnPropertyDescriptor(PRt.prototype, "enableCollision"), PRt.prototype),
113542            ORt = Bl(PRt.prototype, "_enableCollision", [ Yl ], {
113543              configurable: !0,
113544              enumerable: !0,
113545              writable: !0,
113546              initializer: function() {
113547                return !0;
113548              }
113549            }), NRt = Bl(PRt.prototype, "_connectedBody", [ BRt ], {
113550              configurable: !0,
113551              enumerable: !0,
113552              writable: !0,
113553              initializer: function() {
113554                return null;
113555              }
113556            }), PRt)) || DRt) || DRt));
113557            VRt || (VRt = t("Constraint", {}));
113558            var kRt, URt, GRt, zRt, HRt, jRt, XRt, WRt, YRt, qRt, KRt, JRt, ZRt, QRt, $Rt;
113559            let tIt = t("HingeConstraint", (kRt = Ul("cc.HingeConstraint"), URt = sh(), GRt = $l(),
113560            zRt = Th(Pi), HRt = Th(Pi), jRt = Th(Pi), XRt = ql("axisA"), WRt = ql("pivotA"),
113561            YRt = ql("pivotB"), kRt(qRt = URt(qRt = GRt(qRt = (KRt = ($Rt = class extends VRt {
113562              get pivotA() {
113563                return this._pivotA;
113564              }
113565              set pivotA(t) {
113566                Pi.copy(this._pivotA, t);
113567                this.constraint.setPivotA(this._pivotA);
113568              }
113569              get pivotB() {
113570                return this._pivotB;
113571              }
113572              set pivotB(t) {
113573                Pi.copy(this._pivotB, t);
113574                this.constraint.setPivotB(this._pivotB);
113575              }
113576              get axis() {
113577                return this._axis;
113578              }
113579              set axis(t) {
113580                Pi.copy(this._axis, t);
113581                this.constraint.setAxis(this._axis);
113582              }
113583              get constraint() {
113584                return this._constraint;
113585              }
113586              constructor() {
113587                super(rSt.HINGE);
113588                Ml(this, "_axis", JRt, this);
113589                Ml(this, "_pivotA", ZRt, this);
113590                Ml(this, "_pivotB", QRt, this);
113591              }
113592            }, $Rt), Bl(KRt.prototype, "pivotA", [ zRt ], Object.getOwnPropertyDescriptor(KRt.prototype, "pivotA"), KRt.prototype),
113593            Bl(KRt.prototype, "pivotB", [ HRt ], Object.getOwnPropertyDescriptor(KRt.prototype, "pivotB"), KRt.prototype),
113594            Bl(KRt.prototype, "axis", [ jRt ], Object.getOwnPropertyDescriptor(KRt.prototype, "axis"), KRt.prototype),
113595            JRt = Bl(KRt.prototype, "_axis", [ Yl, XRt ], {
113596              configurable: !0,
113597              enumerable: !0,
113598              writable: !0,
113599              initializer: function() {
113600                return new Pi;
113601              }
113602            }), ZRt = Bl(KRt.prototype, "_pivotA", [ Yl, WRt ], {
113603              configurable: !0,
113604              enumerable: !0,
113605              writable: !0,
113606              initializer: function() {
113607                return new Pi;
113608              }
113609            }), QRt = Bl(KRt.prototype, "_pivotB", [ Yl, YRt ], {
113610              configurable: !0,
113611              enumerable: !0,
113612              writable: !0,
113613              initializer: function() {
113614                return new Pi;
113615              }
113616            }), KRt)) || qRt) || qRt) || qRt));
113617            var eIt, iIt, sIt, nIt, rIt, oIt, aIt, lIt, hIt, cIt;
113618            let uIt = t("PointToPointConstraint", (eIt = Ul("cc.PointToPointConstraint"), iIt = sh(),
113619            sIt = $l(), nIt = Th(Pi), rIt = Th(Pi), eIt(oIt = iIt(oIt = sIt(oIt = (aIt = (cIt = class extends VRt {
113620              get pivotA() {
113621                return this._pivotA;
113622              }
113623              set pivotA(t) {
113624                Pi.copy(this._pivotA, t);
113625                this.constraint.setPivotA(this._pivotA);
113626              }
113627              get pivotB() {
113628                return this._pivotB;
113629              }
113630              set pivotB(t) {
113631                Pi.copy(this._pivotB, t);
113632                this.constraint.setPivotB(this._pivotB);
113633              }
113634              get constraint() {
113635                return this._constraint;
113636              }
113637              constructor() {
113638                super(rSt.POINT_TO_POINT);
113639                Ml(this, "_pivotA", lIt, this);
113640                Ml(this, "_pivotB", hIt, this);
113641              }
113642            }, cIt), Bl(aIt.prototype, "pivotA", [ nIt ], Object.getOwnPropertyDescriptor(aIt.prototype, "pivotA"), aIt.prototype),
113643            Bl(aIt.prototype, "pivotB", [ rIt ], Object.getOwnPropertyDescriptor(aIt.prototype, "pivotB"), aIt.prototype),
113644            lIt = Bl(aIt.prototype, "_pivotA", [ Yl ], {
113645              configurable: !0,
113646              enumerable: !0,
113647              writable: !0,
113648              initializer: function() {
113649                return new Pi;
113650              }
113651            }), hIt = Bl(aIt.prototype, "_pivotB", [ Yl ], {
113652              configurable: !0,
113653              enumerable: !0,
113654              writable: !0,
113655              initializer: function() {
113656                return new Pi;
113657              }
113658            }), aIt)) || oIt) || oIt) || oIt));
113659            m.PhysicsSystem = Ivt;
113660            m.PhysicsMaterial = wvt;
113661            m.PhysicsRayResult = Rvt;
113662            m.ConstantForce = swt;
113663            var _It = Object.freeze({
113664              __proto__: null,
113665              PhysicsSystem: Ivt,
113666              PhysicsRayResult: Rvt,
113667              get Collider() {
113668                return HEt;
113669              },
113670              BoxCollider: RCt,
113671              SphereCollider: FCt,
113672              CapsuleCollider: ZCt,
113673              MeshCollider: Fxt,
113674              CylinderCollider: uxt,
113675              ConeCollider: Cxt,
113676              TerrainCollider: Wwt,
113677              get SimplexCollider() {
113678                return uRt;
113679              },
113680              PlaneCollider: vRt,
113681              get Constraint() {
113682                return VRt;
113683              },
113684              HingeConstraint: tIt,
113685              PointToPointConstraint: uIt,
113686              get RigidBody() {
113687                return SEt;
113688              },
113689              PhysicsMaterial: wvt,
113690              ConstantForce: swt,
113691              selector: ovt,
113692              utils: yCt,
113693              get ERigidBodyType() {
113694                return eSt;
113695              },
113696              get EAxisDirection() {
113697                return iSt;
113698              },
113699              get ESimplexType() {
113700                return sSt;
113701              },
113702              get EColliderType() {
113703                return nSt;
113704              },
113705              get EConstraintType() {
113706                return rSt;
113707              },
113708              get PhysicsGroup() {
113709                return oSt;
113710              }
113711            });
113712            t("physics", _It);
113713            W(Ivt, "PhysicsSystem", [ {
113714              name: "ins",
113715              newName: "instance"
113716            }, {
113717              name: "PHYSICS_AMMO",
113718              newName: "PHYSICS_BULLET"
113719            } ]);
113720            W(Ivt.prototype, "PhysicsSystem.prototype", [ {
113721              name: "deltaTime",
113722              newName: "fixedTimeStep"
113723            }, {
113724              name: "maxSubStep",
113725              newName: "maxSubSteps"
113726            } ]);
113727            Y(Ivt.prototype, "PhysicsSystem.prototype", [ {
113728              name: "useFixedTime"
113729            }, {
113730              name: "useCollisionMatrix"
113731            }, {
113732              name: "updateCollisionMatrix"
113733            }, {
113734              name: "resetCollisionMatrix"
113735            }, {
113736              name: "isCollisionGroup"
113737            }, {
113738              name: "setCollisionGroup"
113739            } ]);
113740            W(HEt.prototype, "Collider.prototype", [ {
113741              name: "attachedRigidbody",
113742              newName: "attachedRigidBody"
113743            }, {
113744              name: "TYPE",
113745              newName: "type"
113746            } ]);
113747            W(HEt, "Collider", [ {
113748              name: "EColliderType",
113749              newName: "Type"
113750            }, {
113751              name: "EAxisDirection",
113752              newName: "Axis"
113753            } ]);
113754            W(VRt, "Constraint", [ {
113755              name: "EConstraintType",
113756              newName: "Type"
113757            } ]);
113758            W(RCt.prototype, "BoxCollider.prototype", [ {
113759              name: "boxShape",
113760              newName: "shape"
113761            } ]);
113762            W(FCt.prototype, "SphereCollider.prototype", [ {
113763              name: "sphereShape",
113764              newName: "shape"
113765            } ]);
113766            W(ZCt.prototype, "CapsuleCollider.prototype", [ {
113767              name: "capsuleShape",
113768              newName: "shape"
113769            } ]);
113770            W(SEt.prototype, "RigidBody.prototype", [ {
113771              name: "rigidBody",
113772              newName: "body"
113773            } ]);
113774            W(SEt, "RigidBody", [ {
113775              name: "ERigidBodyType",
113776              newName: "Type"
113777            } ]);
113778            Y(SEt.prototype, "RigidBody.prototype", [ {
113779              name: "fixedRotation"
113780            } ]);
113781            m.RigidBodyComponent = SEt;
113782            ee.setClassAlias(SEt, "cc.RigidBodyComponent");
113783            m.ColliderComponent = HEt;
113784            ee.setClassAlias(HEt, "cc.ColliderComponent");
113785            m.BoxColliderComponent = RCt;
113786            ee.setClassAlias(RCt, "cc.BoxColliderComponent");
113787            m.SphereColliderComponent = FCt;
113788            ee.setClassAlias(FCt, "cc.SphereColliderComponent");
113789            ee.setClassAlias(ZCt, "cc.CapsuleColliderComponent");
113790            ee.setClassAlias(Fxt, "cc.MeshColliderComponent");
113791            ee.setClassAlias(uxt, "cc.CylinderColliderComponent");
113792            m.PhysicMaterial = wvt;
113793            ee.setClassAlias(wvt, "cc.PhysicMaterial");
113794            m.physics = _It;
113795            var dIt, pIt, mIt, fIt, gIt, yIt, bIt, SIt;
113796            var AIt;
113797            !function(t) {
113798              t[t.BOX = 0] = "BOX";
113799              t[t.SPHERE = 1] = "SPHERE";
113800              t[t.CYLINDER = 2] = "CYLINDER";
113801              t[t.CONE = 3] = "CONE";
113802              t[t.CAPSULE = 4] = "CAPSULE";
113803              t[t.TORUS = 5] = "TORUS";
113804              t[t.PLANE = 6] = "PLANE";
113805              t[t.QUAD = 7] = "QUAD";
113806            }(AIt || (AIt = {}));
113807            he(AIt);
113808            let TIt = t("Primitive", (dIt = Ul("cc.Primitive"), pIt = Th(AIt), dIt(mIt = (fIt = (SIt = bIt = class extends Ez {
113809              constructor(t = AIt.BOX) {
113810                super();
113811                Ml(this, "type", gIt, this);
113812                Ml(this, "info", yIt, this);
113813                this.type = t;
113814              }
113815              onLoaded() {
113816                DI(mCt[AIt[this.type].toLowerCase()](this.info), this);
113817              }
113818            }, bIt.PrimitiveType = AIt, SIt), gIt = Bl(fIt.prototype, "type", [ pIt ], {
113819              configurable: !0,
113820              enumerable: !0,
113821              writable: !0,
113822              initializer: function() {
113823                return AIt.BOX;
113824              }
113825            }), yIt = Bl(fIt.prototype, "info", [ Yl, nh ], {
113826              configurable: !0,
113827              enumerable: !0,
113828              writable: !0,
113829              initializer: function() {
113830                return {};
113831              }
113832            }), fIt)) || mIt));
113833            m.Primitive = TIt;
113834            m.primitives = mCt;
113835            var vIt, EIt;
113836            let CIt = Ul("cc.PerfCounter")(vIt = (EIt = class extends class {
113837              get value() {
113838                return this._value;
113839              }
113840              set value(t) {
113841                this._value = t;
113842              }
113843              constructor(t, e, i) {
113844                this._id = void 0;
113845                this._opts = void 0;
113846                this._accumStart = void 0;
113847                this._total = 0;
113848                this._value = 0;
113849                this._averageValue = 0;
113850                this._accumValue = 0;
113851                this._accumSamples = 0;
113852                this._id = t;
113853                this._opts = e;
113854                this._accumStart = i;
113855              }
113856              sample(t) {
113857                this._average(this._value, t);
113858              }
113859              human() {
113860                const {average: t, isInteger: e} = this._opts;
113861                const i = t ? this._averageValue : this._value;
113862                return e ? Math.round(i) : Math.round(100 * i) / 100;
113863              }
113864              alarm() {
113865                return this._opts.below && this._value < this._opts.below || this._opts.over && this._value > this._opts.over;
113866              }
113867              _average(t, e = 0) {
113868                if (this._opts.average) {
113869                  this._accumValue += t;
113870                  ++this._accumSamples;
113871                  const i = e;
113872                  if (i - this._accumStart >= this._opts.average) {
113873                    this._averageValue = this._accumValue / this._accumSamples;
113874                    this._accumValue = 0;
113875                    this._accumStart = i;
113876                    this._accumSamples = 0;
113877                  }
113878                }
113879              }
113880            } {
113881              constructor(t, e, i) {
113882                super(t, e, i);
113883                this._time = void 0;
113884                this._time = i;
113885              }
113886              start(t = 0) {
113887                this._time = t;
113888              }
113889              end(t = 0) {
113890                this._value = t - this._time;
113891                this._average(this._value);
113892              }
113893              tick() {
113894                this.end();
113895                this.start();
113896              }
113897              frame(t) {
113898                const e = t;
113899                const i = e - this._time;
113900                this._total++;
113901                if (i > (this._opts.average || 1e3)) {
113902                  this._value = 1e3 * this._total / i;
113903                  this._total = 0;
113904                  this._time = e;
113905                  this._average(this._value);
113906                }
113907              }
113908            }, EIt)) || vIt;
113909            const xIt = "0123456789. ";
113910            const wIt = 500;
113911            const RIt = {
113912              0: 0,
113913              1: 1,
113914              2: 2,
113915              3: 3,
113916              4: 4,
113917              5: 5,
113918              6: 6,
113919              7: 7,
113920              8: 8,
113921              9: 9,
113922              ".": 10
113923            };
113924            const IIt = {
113925              fps: {
113926                desc: "Framerate (FPS)",
113927                below: 30,
113928                average: wIt,
113929                isInteger: !0
113930              },
113931              draws: {
113932                desc: "Draw call",
113933                isInteger: !0
113934              },
113935              frame: {
113936                desc: "Frame time (ms)",
113937                min: 0,
113938                max: 50,
113939                average: wIt
113940              },
113941              instances: {
113942                desc: "Instance Count",
113943                isInteger: !0
113944              },
113945              tricount: {
113946                desc: "Triangle",
113947                isInteger: !0
113948              },
113949              logic: {
113950                desc: "Game Logic (ms)",
113951                min: 0,
113952                max: 50,
113953                average: wIt,
113954                color: "#080"
113955              },
113956              physics: {
113957                desc: "Physics (ms)",
113958                min: 0,
113959                max: 50,
113960                average: wIt
113961              },
113962              render: {
113963                desc: "Renderer (ms)",
113964                min: 0,
113965                max: 50,
113966                average: wIt,
113967                color: "#f90"
113968              },
113969              textureMemory: {
113970                desc: "GFX Texture Mem(M)"
113971              },
113972              bufferMemory: {
113973                desc: "GFX Buffer Mem(M)"
113974              }
113975            };
113976            const MIt = {
113977              fontSize: 23,
113978              quadHeight: .4,
113979              segmentsPerLine: 8,
113980              textureWidth: 256,
113981              textureHeight: 256
113982            };
113983            class BIt extends Tg {
113984              constructor() {
113985                super();
113986                this._stats = null;
113987                this._showFPS = !1;
113988                this._rootNode = null;
113989                this._device = null;
113990                this._swapchain = null;
113991                this._pipeline = null;
113992                this._meshRenderer = null;
113993                this._canvas = null;
113994                this._ctx = null;
113995                this._texture = null;
113996                this._region = new mn;
113997                this._canvasArr = [];
113998                this._regionArr = [ this._region ];
113999                this.digitsData = null;
114000                this.offsetData = null;
114001                this.pass = null;
114002                this._canvasDone = !1;
114003                this._statsDone = !1;
114004                this._inited = !1;
114005                this._lineHeight = MIt.textureHeight / (Object.keys(IIt).length + 1);
114006                this._wordHeight = 0;
114007                this._eachNumWidth = 0;
114008                this._totalLines = 0;
114009                this.lastTime = 0;
114010                this._canvas = document.createElement("canvas");
114011                this._ctx = this._canvas.getContext("2d");
114012                this._canvasArr.push(this._canvas);
114013              }
114014              init() {
114015                !!de.querySettings(_e.Category.PROFILING, "showFPS") ? this.showStats() : this.hideStats();
114016              }
114017              isShowingStats() {
114018                return this._showFPS;
114019              }
114020              hideStats() {
114021                if (this._showFPS) {
114022                  this._rootNode && (this._rootNode.active = !1);
114023                  m.director.off(m.Director.EVENT_BEFORE_UPDATE, this.beforeUpdate, this);
114024                  m.director.off(m.Director.EVENT_AFTER_UPDATE, this.afterUpdate, this);
114025                  m.director.off(m.Director.EVENT_BEFORE_PHYSICS, this.beforePhysics, this);
114026                  m.director.off(m.Director.EVENT_AFTER_PHYSICS, this.afterPhysics, this);
114027                  m.director.off(m.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this);
114028                  m.director.off(m.Director.EVENT_AFTER_DRAW, this.afterDraw, this);
114029                  this._showFPS = !1;
114030                  IR.root.pipeline.profiler = null;
114031                  m.game.config.showFPS = !1;
114032                }
114033              }
114034              showStats() {
114035                if (!this._showFPS) {
114036                  if (!this._device) {
114037                    const t = m.director.root;
114038                    this._device = zo.gfxDevice;
114039                    this._swapchain = t.mainWindow.swapchain;
114040                    this._pipeline = t.pipeline;
114041                  }
114042                  this.generateCanvas();
114043                  this.generateStats();
114044                  m.game.once(m.Game.EVENT_ENGINE_INITED, this.generateNode, this);
114045                  m.game.on(m.Game.EVENT_RESTART, this.generateNode, this);
114046                  this._rootNode && (this._rootNode.active = !0);
114047                  m.director.on(m.Director.EVENT_BEFORE_UPDATE, this.beforeUpdate, this);
114048                  m.director.on(m.Director.EVENT_AFTER_UPDATE, this.afterUpdate, this);
114049                  m.director.on(m.Director.EVENT_BEFORE_PHYSICS, this.beforePhysics, this);
114050                  m.director.on(m.Director.EVENT_AFTER_PHYSICS, this.afterPhysics, this);
114051                  m.director.on(m.Director.EVENT_BEFORE_DRAW, this.beforeDraw, this);
114052                  m.director.on(m.Director.EVENT_AFTER_DRAW, this.afterDraw, this);
114053                  this._showFPS = !0;
114054                  this._canvasDone = !0;
114055                  this._statsDone = !0;
114056                  m.game.config.showFPS = !0;
114057                }
114058              }
114059              generateCanvas() {
114060                if (this._canvasDone) return;
114061                const {textureWidth: t, textureHeight: e} = MIt;
114062                if (this._ctx && this._canvas) {
114063                  this._canvas.width = t;
114064                  this._canvas.height = e;
114065                  this._canvas.style.width = `${this._canvas.width}`;
114066                  this._canvas.style.height = `${this._canvas.height}`;
114067                  this._ctx.font = `${MIt.fontSize}px Arial`;
114068                  this._ctx.textBaseline = "top";
114069                  this._ctx.fillStyle = "#fff";
114070                  this._texture = this._device.createTexture(new xn(xs.TEX2D, ws.SAMPLED | ws.TRANSFER_DST, bs.RGBA8, t, e));
114071                  this._region.texExtent.width = t;
114072                  this._region.texExtent.height = e;
114073                }
114074              }
114075              generateStats() {
114076                if (this._statsDone || !this._ctx || !this._canvas) return;
114077                this._stats = null;
114078                const t = performance.now();
114079                this._ctx.textAlign = "left";
114080                let e = 0;
114081                for (const i in IIt) {
114082                  const s = IIt[i];
114083                  this._ctx.fillText(s.desc, 0, e * this._lineHeight);
114084                  s.counter = new CIt(i, s, t);
114085                  e++;
114086                }
114087                this._totalLines = e;
114088                this._wordHeight = this._totalLines * this._lineHeight / this._canvas.height;
114089                for (let t = 0; t < xIt.length; ++t) {
114090                  const e = this._ctx.measureText(xIt[t]).width;
114091                  this._eachNumWidth = Math.max(this._eachNumWidth, e);
114092                }
114093                for (let t = 0; t < xIt.length; ++t) this._ctx.fillText(xIt[t], t * this._eachNumWidth, this._totalLines * this._lineHeight);
114094                this._eachNumWidth /= this._canvas.width;
114095                this._stats = IIt;
114096                this._canvasArr[0] = this._canvas;
114097                this._device.copyTexImagesToTexture(this._canvasArr, this._texture, this._regionArr);
114098              }
114099              generateNode() {
114100                if (this._rootNode && this._rootNode.isValid) return;
114101                this._rootNode = new _y("PROFILER_NODE");
114102                this._rootNode._objFlags = m.Object.Flags.DontSave | m.Object.Flags.HideInHierarchy;
114103                m.game.addPersistRootNode(this._rootNode);
114104                const t = new _y("Profiler_Root");
114105                t.parent = this._rootNode;
114106                const e = MIt.quadHeight;
114107                const i = e / this._totalLines;
114108                const s = e / this._wordHeight;
114109                const n = i / MIt.fontSize;
114110                const r = this._eachNumWidth * this._canvas.width * n;
114111                const o = [ 0, e, 0, s, e, 0, s, 0, 0, 0, 0, 0 ];
114112                const a = [ 0, 2, 1, 0, 3, 2 ];
114113                const l = [ 0, 0, -1, 0, 1, 0, -1, 0, 1, this._wordHeight, -1, 0, 0, this._wordHeight, -1, 0 ];
114114                let h = 0;
114115                for (let t = 0; t < this._totalLines; t++) for (let n = 0; n < MIt.segmentsPerLine; n++) {
114116                  o.push(s + n * r, e - t * i, 0);
114117                  o.push(s + (n + 1) * r, e - t * i, 0);
114118                  o.push(s + (n + 1) * r, e - (t + 1) * i, 0);
114119                  o.push(s + n * r, e - (t + 1) * i, 0);
114120                  h = 4 * (t * MIt.segmentsPerLine + n + 1);
114121                  a.push(0 + h, 2 + h, 1 + h, 0 + h, 3 + h, 2 + h);
114122                  const c = t * MIt.segmentsPerLine + n;
114123                  const u = Math.floor(c / 4);
114124                  const _ = c - 4 * u;
114125                  l.push(0, this._wordHeight, u, _);
114126                  l.push(this._eachNumWidth, this._wordHeight, u, _);
114127                  l.push(this._eachNumWidth, 1, u, _);
114128                  l.push(0, 1, u, _);
114129                }
114130                this._meshRenderer = t.addComponent(bH);
114131                this._meshRenderer.mesh = DI({
114132                  positions: o,
114133                  indices: a,
114134                  colors: l
114135                });
114136                const c = new hm;
114137                c.initialize({
114138                  effectName: "util/profiler"
114139                });
114140                const u = this.pass = c.passes[0];
114141                const _ = u.getBinding("mainTexture");
114142                const d = u.getBinding("digits");
114143                const p = u.getBinding("offset");
114144                u.bindTexture(_, this._texture);
114145                this.digitsData = u.blocks[d];
114146                this.offsetData = u.blocks[p];
114147                this.offsetData[3] = -1;
114148                this._meshRenderer.material = c;
114149                this._meshRenderer.node.layer = mm.Enum.PROFILER;
114150                this._inited = !0;
114151              }
114152              beforeUpdate() {
114153                if (!this._stats) return;
114154                const t = performance.now();
114155                this._stats.frame.counter.start(t);
114156                this._stats.logic.counter.start(t);
114157              }
114158              afterUpdate() {
114159                if (!this._stats) return;
114160                const t = performance.now();
114161                m.director.isPaused() ? this._stats.frame.counter.start(t) : this._stats.logic.counter.end(t);
114162              }
114163              beforePhysics() {
114164                if (!this._stats) return;
114165                const t = performance.now();
114166                this._stats.physics.counter.start(t);
114167              }
114168              afterPhysics() {
114169                if (!this._stats) return;
114170                const t = performance.now();
114171                this._stats.physics.counter.end(t);
114172              }
114173              beforeDraw() {
114174                if (!this._stats || !this._inited) return;
114175                {
114176                  const t = this._swapchain.surfaceTransform;
114177                  const e = this._device.capabilities.clipSpaceSignY;
114178                  if (t !== this.offsetData[3]) {
114179                    const i = Yi[t];
114180                    let s = -.9;
114181                    let n = -.9 * e;
114182                    if (Vo.isXR) {
114183                      s = -.5;
114184                      n = -.5 * e;
114185                    }
114186                    this.offsetData[0] = s * i[0] + n * i[2];
114187                    this.offsetData[1] = s * i[1] + n * i[3];
114188                    this.offsetData[2] = this._eachNumWidth;
114189                    this.offsetData[3] = t;
114190                  }
114191                  this.pass._rootBufferDirty = !0;
114192                }
114193                this._meshRenderer.model ? IR.root.pipeline.profiler = this._meshRenderer.model : IR.root.pipeline.profiler = null;
114194                const t = performance.now();
114195                this._stats.render.counter.start(t);
114196              }
114197              afterDraw() {
114198                if (!this._stats || !this._inited) return;
114199                const t = performance.now();
114200                this._stats.frame.counter.end(t);
114201                this._stats.fps.counter.frame(t);
114202                this._stats.render.counter.end(t);
114203                if (t - this.lastTime < wIt) return;
114204                this.lastTime = t;
114205                const e = this._device;
114206                this._stats.draws.counter.value = e.numDrawCalls;
114207                this._stats.instances.counter.value = e.numInstances;
114208                this._stats.bufferMemory.counter.value = e.memoryStatus.bufferSize / 1048576;
114209                this._stats.textureMemory.counter.value = e.memoryStatus.textureSize / 1048576;
114210                this._stats.tricount.counter.value = e.numTris;
114211                let i = 0;
114212                {
114213                  const e = this.digitsData;
114214                  for (const s in this._stats) {
114215                    const n = this._stats[s];
114216                    n.counter.sample(t);
114217                    const r = n.counter.human().toString();
114218                    for (let t = MIt.segmentsPerLine - 1; t >= 0; t--) {
114219                      const s = i * MIt.segmentsPerLine + t;
114220                      const n = r[r.length - (MIt.segmentsPerLine - t)];
114221                      let o = RIt[n];
114222                      void 0 === o && (o = 11);
114223                      e[s] = o;
114224                    }
114225                    i++;
114226                  }
114227                }
114228              }
114229            }
114230            t("Profiler", BIt);
114231            const DIt = t("profiler", new BIt);
114232            IR.registerSystem("profiler", DIt, 0);
114233            m.profiler = DIt;
114234            new Rn(Ds.POINT, Ds.POINT, Ds.NONE, Ps.CLAMP, Ps.CLAMP, Ps.CLAMP);
114235            const PIt = function(t, e, i, s) {
114236              t[e + 0] = i.m00;
114237              t[e + 1] = i.m01;
114238              t[e + 2] = i.m02;
114239              t[e + 3] = i.m12;
114240              t[e + 4] = i.m04;
114241              t[e + 5] = i.m05;
114242              t[e + 6] = i.m06;
114243              t[e + 7] = i.m13;
114244              t[e + 8] = i.m08;
114245              t[e + 9] = i.m09;
114246              t[e + 10] = i.m10;
114247              t[e + 11] = i.m14;
114248            };
114249            new Ui;
114250            new Ui;
114251            new Pi;
114252            new Ui;
114253            new Pi;
114254            function OIt(t, e) {
114255              const i = 4 / Math.sqrt(e);
114256              return 12 * Math.ceil(Math.max(480 * i, t) / 12);
114257            }
114258            const NIt = new Pi;
114259            const LIt = new Pi;
114260            const FIt = new Pi;
114261            const VIt = new Pi;
114262            const kIt = new qi;
114263            const UIt = new qi;
114264            const GIt = new hl;
114265            const zIt = Number.MAX_SAFE_INTEGER;
114266            class HIt {
114267              get pixelsPerJoint() {
114268                return this._pixelsPerJoint;
114269              }
114270              constructor(t) {
114271                this._device = void 0;
114272                this._pool = void 0;
114273                this._textureBuffers = new Map;
114274                this._formatSize = void 0;
114275                this._pixelsPerJoint = void 0;
114276                this._customPool = void 0;
114277                this._chunkIdxMap = new Map;
114278                this._device = t;
114279                const e = function(t) {
114280                  return t.getFormatFeatures(bs.RGBA32F) & Is.SAMPLED_TEXTURE ? bs.RGBA32F : bs.RGBA8;
114281                }(this._device);
114282                this._formatSize = ur[e].size;
114283                this._pixelsPerJoint = 48 / this._formatSize;
114284                this._pool = new KP(t);
114285                this._pool.initialize({
114286                  format: e,
114287                  roundUpFn: OIt
114288                });
114289                this._customPool = new KP(t);
114290                this._customPool.initialize({
114291                  format: e,
114292                  roundUpFn: OIt
114293                });
114294              }
114295              clear() {
114296                this._pool.destroy();
114297                this._textureBuffers.clear();
114298              }
114299              registerCustomTextureLayouts(t) {
114300                for (let e = 0; e < t.length; e++) {
114301                  const i = t[e];
114302                  const s = this._customPool.createChunk(i.textureLength);
114303                  for (let t = 0; t < i.contents.length; t++) {
114304                    const e = i.contents[t];
114305                    const {skeleton: n} = e;
114306                    this._chunkIdxMap.set(n, s);
114307                    for (let t = 0; t < e.clips.length; t++) {
114308                      const i = e.clips[t];
114309                      this._chunkIdxMap.set(n ^ i, s);
114310                    }
114311                  }
114312                }
114313              }
114314              getDefaultPoseTexture(t, e, i) {
114315                const s = 0 ^ t.hash;
114316                let n = this._textureBuffers.get(s) || null;
114317                if (n && n.bounds.has(e.hash)) {
114318                  n.refCount++;
114319                  return n;
114320                }
114321                const {joints: r, bindposes: o} = t;
114322                let a = null;
114323                let l = !1;
114324                const h = r.length;
114325                if (n) n.refCount++; else {
114326                  const e = 12 * h;
114327                  const i = this._chunkIdxMap.get(s);
114328                  const r = void 0 !== i ? this._customPool.alloc(e * Float32Array.BYTES_PER_ELEMENT, i) : this._pool.alloc(e * Float32Array.BYTES_PER_ELEMENT);
114329                  if (!r) return n;
114330                  n = {
114331                    pixelOffset: r.start / this._formatSize,
114332                    refCount: 1,
114333                    bounds: new Map,
114334                    skeletonHash: t.hash,
114335                    clipHash: 0,
114336                    readyToBeDeleted: !1,
114337                    handle: r
114338                  };
114339                  a = new Float32Array(e);
114340                  l = !0;
114341                }
114342                Pi.set(FIt, zIt, zIt, zIt);
114343                Pi.set(VIt, -zIt, -zIt, -zIt);
114344                const c = e.getBoneSpaceBounds(t);
114345                for (let e = 0, s = 0; e < h; e++, s += 12) {
114346                  const n = i.getChildByPath(r[e]);
114347                  const h = n ? KW(n, i, kIt) : t.inverseBindposes[e];
114348                  const u = c[e];
114349                  if (u) {
114350                    hl.transform(GIt, u, h);
114351                    GIt.getBoundary(NIt, LIt);
114352                    Pi.min(FIt, FIt, NIt);
114353                    Pi.max(VIt, VIt, LIt);
114354                  }
114355                  if (l) {
114356                    n && qi.multiply(h, h, o[e]);
114357                    PIt(a, s, n ? h : qi.IDENTITY);
114358                  }
114359                }
114360                const u = [ new hl ];
114361                n.bounds.set(e.hash, u);
114362                hl.fromPoints(u[0], FIt, VIt);
114363                if (l) {
114364                  this._pool.update(n.handle, a.buffer);
114365                  this._textureBuffers.set(s, n);
114366                }
114367                return n;
114368              }
114369              getSequencePoseTexture(t, e, i, s) {
114370                const n = t.hash ^ e.hash;
114371                let r = this._textureBuffers.get(n) || null;
114372                if (r && r.bounds.has(i.hash)) {
114373                  r.refCount++;
114374                  return r;
114375                }
114376                const {joints: o, bindposes: a} = t;
114377                const l = XZ.getOrExtract(e);
114378                const {frames: h} = l;
114379                let c = null;
114380                let u = !1;
114381                const _ = o.length;
114382                if (r) r.refCount++; else {
114383                  const i = 12 * _ * h;
114384                  const o = this._chunkIdxMap.get(n);
114385                  const a = void 0 !== o ? this._customPool.alloc(i * Float32Array.BYTES_PER_ELEMENT, o) : this._pool.alloc(i * Float32Array.BYTES_PER_ELEMENT);
114386                  if (!a) return null;
114387                  const l = this._createAnimInfos(t, e, s);
114388                  r = {
114389                    pixelOffset: a.start / this._formatSize,
114390                    refCount: 1,
114391                    bounds: new Map,
114392                    skeletonHash: t.hash,
114393                    clipHash: e.hash,
114394                    readyToBeDeleted: !1,
114395                    handle: a,
114396                    animInfos: l
114397                  };
114398                  c = new Float32Array(i);
114399                  u = !0;
114400                }
114401                const d = i.getBoneSpaceBounds(t);
114402                const p = [];
114403                r.bounds.set(i.hash, p);
114404                for (let t = 0; t < h; t++) p.push(new hl(zIt, zIt, zIt, -zIt, -zIt, -zIt));
114405                for (let e = 0, i = 0; e < h; e++) {
114406                  const s = p[e];
114407                  for (let n = 0; n < _; n++, i += 12) {
114408                    const {curveData: o, downstream: l, bindposeIdx: h, bindposeCorrection: _} = r.animInfos[n];
114409                    let p;
114410                    let m = !0;
114411                    if (o && l) p = qi.multiply(kIt, o[e], l); else if (o) p = o[e]; else if (l) p = l; else {
114412                      p = t.inverseBindposes[h];
114413                      m = !1;
114414                    }
114415                    const f = d[n];
114416                    if (f) {
114417                      const t = _ ? qi.multiply(UIt, p, _) : p;
114418                      hl.transform(GIt, f, t);
114419                      GIt.getBoundary(NIt, LIt);
114420                      Pi.min(s.center, s.center, NIt);
114421                      Pi.max(s.halfExtents, s.halfExtents, LIt);
114422                    }
114423                    if (u) {
114424                      m && qi.multiply(kIt, p, a[h]);
114425                      PIt(c, i, m ? kIt : qi.IDENTITY);
114426                    }
114427                  }
114428                  hl.fromPoints(s, s.center, s.halfExtents);
114429                }
114430                if (u) {
114431                  this._pool.update(r.handle, c.buffer);
114432                  this._textureBuffers.set(n, r);
114433                }
114434                return r;
114435              }
114436              releaseHandle(t) {
114437                t.refCount > 0 && t.refCount--;
114438                if (!t.refCount && t.readyToBeDeleted) {
114439                  const e = t.skeletonHash ^ t.clipHash;
114440                  (void 0 !== this._chunkIdxMap.get(e) ? this._customPool : this._pool).free(t.handle);
114441                  this._textureBuffers.get(e) === t && this._textureBuffers.delete(e);
114442                }
114443              }
114444              releaseSkeleton(t) {
114445                const e = this._textureBuffers.values();
114446                let i = e.next();
114447                for (;!i.done; ) {
114448                  const s = i.value;
114449                  if (s.skeletonHash === t.hash) {
114450                    s.readyToBeDeleted = !0;
114451                    s.refCount ? this._textureBuffers.delete(s.skeletonHash ^ s.clipHash) : this.releaseHandle(s);
114452                  }
114453                  i = e.next();
114454                }
114455              }
114456              releaseAnimationClip(t) {
114457                const e = this._textureBuffers.values();
114458                let i = e.next();
114459                for (;!i.done; ) {
114460                  const s = i.value;
114461                  if (s.clipHash === t.hash) {
114462                    s.readyToBeDeleted = !0;
114463                    s.refCount ? this._textureBuffers.delete(s.skeletonHash ^ s.clipHash) : this.releaseHandle(s);
114464                  }
114465                  i = e.next();
114466                }
114467              }
114468              _createAnimInfos(t, e, i) {
114469                const s = [];
114470                const {joints: n, bindposes: r} = t;
114471                const o = n.length;
114472                const a = XZ.getOrExtract(e);
114473                for (let e = 0; e < o; e++) {
114474                  let l = n[e];
114475                  let h = a.joints[l];
114476                  let c = i.getChildByPath(l);
114477                  let u;
114478                  let _;
114479                  for (;!h; ) {
114480                    const t = l.lastIndexOf("/");
114481                    l = l.substring(0, t);
114482                    h = a.joints[l];
114483                    if (c) {
114484                      u || (u = new qi);
114485                      qi.fromRTS(kIt, c.rotation, c.position, c.scale);
114486                      qi.multiply(u, kIt, u);
114487                      c = c.parent;
114488                    } else _ = l;
114489                    if (t < 0) break;
114490                  }
114491                  let d = e;
114492                  let p;
114493                  if (void 0 !== _ && h) {
114494                    d = e - 1;
114495                    for (let i = 0; i < o; i++) if (n[i] === _) {
114496                      d = i;
114497                      p = new qi;
114498                      qi.multiply(p, r[i], t.inverseBindposes[e]);
114499                      break;
114500                    }
114501                  }
114502                  s.push({
114503                    curveData: h && h.transforms,
114504                    downstream: u,
114505                    bindposeIdx: d,
114506                    bindposeCorrection: p
114507                  });
114508                }
114509                return s;
114510              }
114511            }
114512            class jIt {
114513              constructor(t) {
114514                this._pool = new Map;
114515                this._device = void 0;
114516                this._device = t;
114517              }
114518              getData(t = "-1") {
114519                const e = this._pool.get(t);
114520                if (e) return e;
114521                const i = this._device.createBuffer(new An(Ts.UNIFORM | Ts.TRANSFER_DST, Cs.HOST | Cs.DEVICE, ef.SIZE, ef.SIZE));
114522                const s = new Float32Array([ 0, 0, 0, 0 ]);
114523                i.update(s);
114524                const n = {
114525                  buffer: i,
114526                  data: s,
114527                  dirty: !1,
114528                  dirtyForJSB: new Uint8Array([ 0 ]),
114529                  currentClip: null
114530                };
114531                this._pool.set(t, n);
114532                return n;
114533              }
114534              destroy(t) {
114535                const e = this._pool.get(t);
114536                if (e) {
114537                  e.buffer.destroy();
114538                  this._pool.delete(t);
114539                }
114540              }
114541              switchClip(t, e) {
114542                t.currentClip = e;
114543                t.data[0] = -1;
114544                t.buffer.update(t.data);
114545                t.dirty = !1;
114546                t.dirtyForJSB[0] = 0;
114547                return t;
114548              }
114549              clear() {
114550                for (const t of this._pool.values()) t.buffer.destroy();
114551                this._pool.clear();
114552              }
114553            }
114554            m.internal.DataPoolManager = class {
114555              constructor(t) {
114556                this.jointTexturePool = void 0;
114557                this.jointAnimationInfo = void 0;
114558                this.jointTexturePool = new HIt(t);
114559                this.jointAnimationInfo = new jIt(t);
114560              }
114561              releaseSkeleton(t) {
114562                this.jointTexturePool.releaseSkeleton(t);
114563              }
114564              releaseAnimationClip(t) {
114565                this.jointTexturePool.releaseAnimationClip(t);
114566              }
114567              clear() {
114568                this.jointTexturePool.clear();
114569                this.jointAnimationInfo.clear();
114570              }
114571            };
114572            const XIt = new qi;
114573            const WIt = new qi;
114574            class YIt extends YY {
114575              constructor(t, e = "") {
114576                super(t, e);
114577                this._frames = 1;
114578                this._bakedDuration = 0;
114579                this._animInfo = null;
114580                this._sockets = [];
114581                this._animInfoMgr = void 0;
114582                this._parent = null;
114583                this._curvesInited = !1;
114584                this._animInfoMgr = m.director.root.dataPoolManager.jointAnimationInfo;
114585              }
114586              initialize(t) {
114587                if (this._curveLoaded) return;
114588                this._parent = t.getComponent("cc.SkeletalAnimation");
114589                const e = this._parent.useBakedAnimation;
114590                this._doNotCreateEval = e;
114591                super.initialize(t);
114592                this._curvesInited = !e;
114593                const {frames: i, samples: s} = XZ.getOrExtract(this.clip);
114594                this._frames = i - 1;
114595                this._animInfo = this._animInfoMgr.getData(t.uuid);
114596                this._bakedDuration = this._frames / s;
114597                this.setUseBaked(e);
114598              }
114599              setUseBaked(t) {
114600                if (t) {
114601                  this._sampleCurves = this._sampleCurvesBaked;
114602                  this.duration = this._bakedDuration;
114603                } else {
114604                  this._sampleCurves = super._sampleCurves;
114605                  this.duration = this.clip.duration;
114606                  if (!this._curvesInited) {
114607                    this._curveLoaded = !1;
114608                    super.initialize(this._targetNode);
114609                    this._curvesInited = !0;
114610                  }
114611                }
114612              }
114613              rebuildSocketCurves(t) {
114614                this._sockets.length = 0;
114615                if (!this._targetNode) return;
114616                const e = this._targetNode;
114617                for (let i = 0; i < t.length; ++i) {
114618                  const s = t[i];
114619                  const n = e.getChildByPath(s.path);
114620                  if (!s.target) continue;
114621                  const r = XZ.getOrExtract(this.clip);
114622                  let o = s.path;
114623                  let a = r.joints[o];
114624                  let l = n;
114625                  let h;
114626                  for (;!a; ) {
114627                    const t = o.lastIndexOf("/");
114628                    o = o.substring(0, t);
114629                    a = r.joints[o];
114630                    if (l) {
114631                      h || (h = qi.identity(WIt));
114632                      qi.fromRTS(XIt, l.rotation, l.position, l.scale);
114633                      qi.multiply(h, XIt, h);
114634                      l = l.parent;
114635                    }
114636                    if (t < 0) break;
114637                  }
114638                  const c = a && a.transforms;
114639                  const {frames: u} = r;
114640                  const _ = [];
114641                  for (let t = 0; t < u; t++) {
114642                    let e;
114643                    e = c && h ? qi.multiply(XIt, c[t], h) : c ? c[t] : h || new qi;
114644                    const i = {
114645                      pos: new Pi,
114646                      rot: new Ui,
114647                      scale: new Pi
114648                    };
114649                    qi.toRTS(e, i.rot, i.pos, i.scale);
114650                    _.push(i);
114651                  }
114652                  this._sockets.push({
114653                    target: s.target,
114654                    frames: _
114655                  });
114656                }
114657              }
114658              _sampleCurvesBaked(t) {
114659                const e = t / this.duration;
114660                const i = this._animInfo;
114661                const s = this.clip;
114662                if (i.currentClip !== s) {
114663                  this._animInfoMgr.switchClip(this._animInfo, s);
114664                  this._parent.getUsers().forEach((t => {
114665                    t.uploadAnimation(s);
114666                  }));
114667                }
114668                const n = e * this._frames + .5 | 0;
114669                if (n !== i.data[0]) {
114670                  i.data[0] = n;
114671                  i.dirty = !0;
114672                  i.dirtyForJSB[0] = 1;
114673                  for (let t = 0; t < this._sockets.length; ++t) {
114674                    const {target: e, frames: i} = this._sockets[t];
114675                    const {pos: s, rot: r, scale: o} = i[n];
114676                    e.setRTS(r, s, o);
114677                  }
114678                }
114679              }
114680            }
114681            t("SkeletalAnimationState", YIt);
114682            var qIt, KIt, JIt, ZIt, QIt, $It, tMt, eMt, iMt, sMt, nMt, rMt, oMt, aMt, lMt, hMt, cMt, uMt, _Mt, dMt, pMt;
114683            let mMt = t("Socket", (qIt = Ul("cc.SkeletalAnimation.Socket"), KIt = Th(_y), qIt(JIt = (ZIt = (tMt = class {
114684              constructor(t = "", e = null) {
114685                Ml(this, "path", QIt, this);
114686                Ml(this, "target", $It, this);
114687                this.path = t;
114688                this.target = e;
114689              }
114690            }, tMt), QIt = Bl(ZIt.prototype, "path", [ Yl, nh ], {
114691              configurable: !0,
114692              enumerable: !0,
114693              writable: !0,
114694              initializer: function() {
114695                return "";
114696              }
114697            }), $It = Bl(ZIt.prototype, "target", [ KIt ], {
114698              configurable: !0,
114699              enumerable: !0,
114700              writable: !0,
114701              initializer: function() {
114702                return null;
114703              }
114704            }), ZIt)) || JIt));
114705            ee.setClassAlias(mMt, "cc.SkeletalAnimationComponent.Socket");
114706            const fMt = new qi;
114707            const gMt = new qi;
114708            function yMt(t, e = "", i = []) {
114709              for (let s = 0; s < t.children.length; s++) {
114710                const n = t.children[s];
114711                if (!n) continue;
114712                const r = e ? `${e}/${n.name}` : n.name;
114713                i.push(r);
114714                yMt(n, r, i);
114715              }
114716              return i;
114717            }
114718            let bMt = function(e) {
114719              return t({
114720                SkeletalAnimation: e,
114721                SkeletalAnimationComponent: e
114722              }), e;
114723            }((eMt = Ul("cc.SkeletalAnimation"), iMt = sh(), sMt = zl(99), nMt = $l(), rMt = Th([ mMt ]),
114724            oMt = lh(), aMt = lh(), lMt = Th([ mMt ]), eMt(hMt = iMt(hMt = sMt(hMt = Ql(hMt = nMt(hMt = (cMt = (pMt = dMt = class extends o3 {
114725              constructor(...t) {
114726                super(...t);
114727                Ml(this, "_useBakedAnimation", uMt, this);
114728                Ml(this, "_sockets", _Mt, this);
114729                this._users = new Set;
114730                this._currentBakedState = null;
114731              }
114732              get sockets() {
114733                return this._sockets;
114734              }
114735              set sockets(t) {
114736                if (!this._useBakedAnimation) {
114737                  const e = XY();
114738                  e.removeSockets(this.node, this._sockets);
114739                  e.addSockets(this.node, t);
114740                }
114741                this._sockets = t;
114742                this.rebuildSocketAnimations();
114743              }
114744              get useBakedAnimation() {
114745                return this._useBakedAnimation;
114746              }
114747              set useBakedAnimation(t) {
114748                this._useBakedAnimation = t;
114749                for (const e in this._nameToState) {
114750                  this._nameToState[e].setUseBaked(t);
114751                }
114752                this._users.forEach((e => {
114753                  e.setUseBakedAnimation(t);
114754                }));
114755                if (this._useBakedAnimation) XY().removeSockets(this.node, this._sockets); else {
114756                  XY().addSockets(this.node, this._sockets);
114757                  this._currentBakedState = null;
114758                }
114759              }
114760              onLoad() {
114761                super.onLoad();
114762                const t = this.node.getComponentsInChildren(YW);
114763                for (let e = 0; e < t.length; ++e) {
114764                  const i = t[e];
114765                  i.skinningRoot === this.node && this.notifySkinnedMeshAdded(i);
114766                }
114767              }
114768              onDestroy() {
114769                super.onDestroy();
114770                m.director.root.dataPoolManager.jointAnimationInfo.destroy(this.node.uuid);
114771                XY().removeSockets(this.node, this._sockets);
114772                this._removeAllUsers();
114773              }
114774              onEnable() {
114775                var t;
114776                super.onEnable();
114777                null === (t = this._currentBakedState) || void 0 === t || t.resume();
114778              }
114779              onDisable() {
114780                var t;
114781                super.onDisable();
114782                null === (t = this._currentBakedState) || void 0 === t || t.pause();
114783              }
114784              start() {
114785                this.sockets = this._sockets;
114786                this.useBakedAnimation = this._useBakedAnimation;
114787                super.start();
114788              }
114789              pause() {
114790                if (this._useBakedAnimation) {
114791                  var t;
114792                  null === (t = this._currentBakedState) || void 0 === t || t.pause();
114793                } else super.pause();
114794              }
114795              resume() {
114796                if (this._useBakedAnimation) {
114797                  var t;
114798                  null === (t = this._currentBakedState) || void 0 === t || t.resume();
114799                } else super.resume();
114800              }
114801              stop() {
114802                if (this._useBakedAnimation) {
114803                  if (this._currentBakedState) {
114804                    this._currentBakedState.stop();
114805                    this._currentBakedState = null;
114806                  }
114807                } else super.stop();
114808              }
114809              querySockets() {
114810                const t = this._defaultClip && Object.keys(XZ.getOrExtract(this._defaultClip).joints).sort().reduce(((t, e) => (e.startsWith(t[t.length - 1]) || t.push(e),
114811                t)), []) || [];
114812                if (!t.length) return [ "please specify a valid default animation clip first" ];
114813                const e = [];
114814                for (let i = 0; i < t.length; i++) {
114815                  const s = t[i];
114816                  const n = this.node.getChildByPath(s);
114817                  if (n) {
114818                    e.push(s);
114819                    yMt(n, s, e);
114820                  }
114821                }
114822                return e;
114823              }
114824              rebuildSocketAnimations() {
114825                for (const t of this._sockets) {
114826                  const e = this.node.getChildByPath(t.path);
114827                  const {target: i} = t;
114828                  if (e && i) {
114829                    i.name = `${t.path.substring(t.path.lastIndexOf("/") + 1)} Socket`;
114830                    i.parent = this.node;
114831                    KW(e, this.node, fMt);
114832                    qi.fromRTS(gMt, i.rotation, i.position, i.scale);
114833                    qi.equals(gMt, fMt) || (i.matrix = fMt);
114834                  }
114835                }
114836                for (const t of Object.keys(this._nameToState)) {
114837                  this._nameToState[t].rebuildSocketCurves(this._sockets);
114838                }
114839              }
114840              createSocket(t) {
114841                const e = this._sockets.find((e => e.path === t));
114842                if (e) return e.target;
114843                if (!this.node.getChildByPath(t)) {
114844                  console.warn("illegal socket path");
114845                  return null;
114846                }
114847                const i = new _y;
114848                i.parent = this.node;
114849                this._sockets.push(new mMt(t, i));
114850                this.rebuildSocketAnimations();
114851                return i;
114852              }
114853              notifySkinnedMeshAdded(t) {
114854                const {_useBakedAnimation: e} = this;
114855                const i = t.associatedAnimation;
114856                i && i._users.delete(t);
114857                t.associatedAnimation = this;
114858                t.setUseBakedAnimation(e, !0);
114859                if (e) {
114860                  const {_currentBakedState: e} = this;
114861                  e && t.uploadAnimation(e.clip);
114862                }
114863                this._users.add(t);
114864              }
114865              notifySkinnedMeshRemoved(t) {
114866                ne(t.associatedAnimation === this || null === t.associatedAnimation);
114867                t.setUseBakedAnimation(!1);
114868                t.associatedAnimation = null;
114869                this._users.delete(t);
114870              }
114871              getUsers() {
114872                return this._users;
114873              }
114874              _createState(t, e) {
114875                return new YIt(t, e);
114876              }
114877              _doCreateState(t, e) {
114878                const i = super._doCreateState(t, e);
114879                i.rebuildSocketCurves(this._sockets);
114880                return i;
114881              }
114882              doPlayOrCrossFade(t, e) {
114883                if (this._useBakedAnimation) {
114884                  this._currentBakedState && this._currentBakedState.stop();
114885                  const e = t;
114886                  this._currentBakedState = e;
114887                  e.play();
114888                } else super.doPlayOrCrossFade(t, e);
114889              }
114890              _removeAllUsers() {
114891                Array.from(this._users).forEach((t => {
114892                  this.notifySkinnedMeshRemoved(t);
114893                }));
114894              }
114895            }, dMt.Socket = mMt, pMt), Bl(cMt.prototype, "sockets", [ rMt, oMt ], Object.getOwnPropertyDescriptor(cMt.prototype, "sockets"), cMt.prototype),
114896            Bl(cMt.prototype, "useBakedAnimation", [ aMt ], Object.getOwnPropertyDescriptor(cMt.prototype, "useBakedAnimation"), cMt.prototype),
114897            uMt = Bl(cMt.prototype, "_useBakedAnimation", [ Yl ], {
114898              configurable: !0,
114899              enumerable: !0,
114900              writable: !0,
114901              initializer: function() {
114902                return !0;
114903              }
114904            }), _Mt = Bl(cMt.prototype, "_sockets", [ lMt ], {
114905              configurable: !0,
114906              enumerable: !0,
114907              writable: !0,
114908              initializer: function() {
114909                return [];
114910              }
114911            }), cMt)) || hMt) || hMt) || hMt) || hMt) || hMt));
114912            m.SkeletalAnimationComponent = bMt;
114913            ee.setClassAlias(bMt, "cc.SkeletalAnimationComponent");
114914            class SMt {
114915              constructor() {
114916                this.start = void 0;
114917                this.interrupt = void 0;
114918                this.end = void 0;
114919                this.dispose = void 0;
114920                this.complete = void 0;
114921                this.event = void 0;
114922              }
114923              static getListeners(t) {
114924                t.listener || (t.listener = new SMt);
114925                return t.listener;
114926              }
114927            }
114928            var AMt = function() {
114929              var t = function(e, i) {
114930                t = Object.setPrototypeOf || {
114931                  __proto__: []
114932                } instanceof Array && function(t, e) {
114933                  t.__proto__ = e;
114934                } || function(t, e) {
114935                  for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
114936                };
114937                return t(e, i);
114938              };
114939              return function(e, i) {
114940                t(e, i);
114941                function s() {
114942                  this.constructor = e;
114943                }
114944                e.prototype = null === i ? Object.create(i) : (s.prototype = i.prototype, new s);
114945              };
114946            }();
114947            !function(t) {
114948              var e = function() {
114949                function t(t, e, i) {
114950                  if (null == t) throw new Error("name cannot be null.");
114951                  if (null == e) throw new Error("timelines cannot be null.");
114952                  this.name = t;
114953                  this.timelines = e;
114954                  this.timelineIds = [];
114955                  for (var s = 0; s < e.length; s++) this.timelineIds[e[s].getPropertyId()] = !0;
114956                  this.duration = i;
114957                }
114958                t.prototype.hasTimeline = function(t) {
114959                  return 1 == this.timelineIds[t];
114960                };
114961                t.prototype.apply = function(t, e, i, s, n, r, o, a) {
114962                  if (null == t) throw new Error("skeleton cannot be null.");
114963                  if (s && 0 != this.duration) {
114964                    i %= this.duration;
114965                    e > 0 && (e %= this.duration);
114966                  }
114967                  var l = this.timelines;
114968                  for (var h = 0, c = l.length; h < c; h++) l[h].apply(t, e, i, n, r, o, a);
114969                };
114970                t.binarySearch = function(t, e, i) {
114971                  void 0 === i && (i = 1);
114972                  var s = 0;
114973                  var n = t.length / i - 2;
114974                  if (0 == n) return i;
114975                  var r = n >>> 1;
114976                  for (;;) {
114977                    t[(r + 1) * i] <= e ? s = r + 1 : n = r;
114978                    if (s == n) return (s + 1) * i;
114979                    r = s + n >>> 1;
114980                  }
114981                };
114982                t.linearSearch = function(t, e, i) {
114983                  for (var s = 0, n = t.length - i; s <= n; s += i) if (t[s] > e) return s;
114984                  return -1;
114985                };
114986                return t;
114987              }();
114988              t.Animation = e;
114989              var i;
114990              !function(t) {
114991                t[t.setup = 0] = "setup";
114992                t[t.first = 1] = "first";
114993                t[t.replace = 2] = "replace";
114994                t[t.add = 3] = "add";
114995              }(i = t.MixBlend || (t.MixBlend = {}));
114996              var s;
114997              !function(t) {
114998                t[t.mixIn = 0] = "mixIn";
114999                t[t.mixOut = 1] = "mixOut";
115000              }(s = t.MixDirection || (t.MixDirection = {}));
115001              var n;
115002              !function(t) {
115003                t[t.rotate = 0] = "rotate";
115004                t[t.translate = 1] = "translate";
115005                t[t.scale = 2] = "scale";
115006                t[t.shear = 3] = "shear";
115007                t[t.attachment = 4] = "attachment";
115008                t[t.color = 5] = "color";
115009                t[t.deform = 6] = "deform";
115010                t[t.event = 7] = "event";
115011                t[t.drawOrder = 8] = "drawOrder";
115012                t[t.ikConstraint = 9] = "ikConstraint";
115013                t[t.transformConstraint = 10] = "transformConstraint";
115014                t[t.pathConstraintPosition = 11] = "pathConstraintPosition";
115015                t[t.pathConstraintSpacing = 12] = "pathConstraintSpacing";
115016                t[t.pathConstraintMix = 13] = "pathConstraintMix";
115017                t[t.twoColor = 14] = "twoColor";
115018              }(n = t.TimelineType || (t.TimelineType = {}));
115019              var r = function() {
115020                function e(i) {
115021                  if (i <= 0) throw new Error("frameCount must be > 0: " + i);
115022                  this.curves = t.Utils.newFloatArray((i - 1) * e.BEZIER_SIZE);
115023                }
115024                e.prototype.getFrameCount = function() {
115025                  return this.curves.length / e.BEZIER_SIZE + 1;
115026                };
115027                e.prototype.setLinear = function(t) {
115028                  this.curves[t * e.BEZIER_SIZE] = e.LINEAR;
115029                };
115030                e.prototype.setStepped = function(t) {
115031                  this.curves[t * e.BEZIER_SIZE] = e.STEPPED;
115032                };
115033                e.prototype.getCurveType = function(t) {
115034                  var i = t * e.BEZIER_SIZE;
115035                  if (i == this.curves.length) return e.LINEAR;
115036                  var s = this.curves[i];
115037                  return s == e.LINEAR ? e.LINEAR : s == e.STEPPED ? e.STEPPED : e.BEZIER;
115038                };
115039                e.prototype.setCurve = function(t, i, s, n, r) {
115040                  var o = .03 * (2 * -i + n), a = .03 * (2 * -s + r);
115041                  var l = .006 * (3 * (i - n) + 1), h = .006 * (3 * (s - r) + 1);
115042                  var c = 2 * o + l, u = 2 * a + h;
115043                  var _ = .3 * i + o + .16666667 * l, d = .3 * s + a + .16666667 * h;
115044                  var p = t * e.BEZIER_SIZE;
115045                  var m = this.curves;
115046                  m[p++] = e.BEZIER;
115047                  var f = _, g = d;
115048                  for (var y = p + e.BEZIER_SIZE - 1; p < y; p += 2) {
115049                    m[p] = f;
115050                    m[p + 1] = g;
115051                    _ += c;
115052                    d += u;
115053                    c += l;
115054                    u += h;
115055                    f += _;
115056                    g += d;
115057                  }
115058                };
115059                e.prototype.getCurvePercent = function(i, s) {
115060                  s = t.MathUtils.clamp(s, 0, 1);
115061                  var n = this.curves;
115062                  var r = i * e.BEZIER_SIZE;
115063                  var o = n[r];
115064                  if (o == e.LINEAR) return s;
115065                  if (o == e.STEPPED) return 0;
115066                  var a = 0;
115067                  for (var l = ++r, h = r + e.BEZIER_SIZE - 1; r < h; r += 2) if ((a = n[r]) >= s) {
115068                    var c = void 0, u = void 0;
115069                    if (r == l) {
115070                      c = 0;
115071                      u = 0;
115072                    } else {
115073                      c = n[r - 2];
115074                      u = n[r - 1];
115075                    }
115076                    return u + (n[r + 1] - u) * (s - c) / (a - c);
115077                  }
115078                  var _ = n[r - 1];
115079                  return _ + (1 - _) * (s - a) / (1 - a);
115080                };
115081                e.LINEAR = 0;
115082                e.STEPPED = 1;
115083                e.BEZIER = 2;
115084                e.BEZIER_SIZE = 19;
115085                return e;
115086              }();
115087              t.CurveTimeline = r;
115088              var o = function(s) {
115089                AMt(r, s);
115090                function r(e) {
115091                  var i = s.call(this, e) || this;
115092                  i.frames = t.Utils.newFloatArray(e << 1);
115093                  return i;
115094                }
115095                r.prototype.getPropertyId = function() {
115096                  return (n.rotate << 24) + this.boneIndex;
115097                };
115098                r.prototype.setFrame = function(t, e, i) {
115099                  t <<= 1;
115100                  this.frames[t] = e;
115101                  this.frames[t + r.ROTATION] = i;
115102                };
115103                r.prototype.apply = function(t, s, n, o, a, l, h) {
115104                  var c = this.frames;
115105                  var u = t.bones[this.boneIndex];
115106                  if (u.active) if (n < c[0]) switch (l) {
115107                   case i.setup:
115108                    u.rotation = u.data.rotation;
115109                    return;
115110
115111                   case i.first:
115112                    var _ = u.data.rotation - u.rotation;
115113                    u.rotation += (_ - 360 * (16384 - (16384.499999999996 - _ / 360 | 0))) * a;
115114                  } else if (n >= c[c.length - r.ENTRIES]) {
115115                    var d = c[c.length + r.PREV_ROTATION];
115116                    switch (l) {
115117                     case i.setup:
115118                      u.rotation = u.data.rotation + d * a;
115119                      break;
115120
115121                     case i.first:
115122                     case i.replace:
115123                      d += u.data.rotation - u.rotation;
115124                      d -= 360 * (16384 - (16384.499999999996 - d / 360 | 0));
115125
115126                     case i.add:
115127                      u.rotation += d * a;
115128                    }
115129                  } else {
115130                    var p = e.binarySearch(c, n, r.ENTRIES);
115131                    var m = c[p + r.PREV_ROTATION];
115132                    var f = c[p];
115133                    var g = this.getCurvePercent((p >> 1) - 1, 1 - (n - f) / (c[p + r.PREV_TIME] - f));
115134                    var y = c[p + r.ROTATION] - m;
115135                    y = m + (y - 360 * (16384 - (16384.499999999996 - y / 360 | 0))) * g;
115136                    switch (l) {
115137                     case i.setup:
115138                      u.rotation = u.data.rotation + (y - 360 * (16384 - (16384.499999999996 - y / 360 | 0))) * a;
115139                      break;
115140
115141                     case i.first:
115142                     case i.replace:
115143                      y += u.data.rotation - u.rotation;
115144
115145                     case i.add:
115146                      u.rotation += (y - 360 * (16384 - (16384.499999999996 - y / 360 | 0))) * a;
115147                    }
115148                  }
115149                };
115150                r.ENTRIES = 2;
115151                r.PREV_TIME = -2;
115152                r.PREV_ROTATION = -1;
115153                r.ROTATION = 1;
115154                return r;
115155              }(r);
115156              t.RotateTimeline = o;
115157              var a = function(s) {
115158                AMt(r, s);
115159                function r(e) {
115160                  var i = s.call(this, e) || this;
115161                  i.frames = t.Utils.newFloatArray(e * r.ENTRIES);
115162                  return i;
115163                }
115164                r.prototype.getPropertyId = function() {
115165                  return (n.translate << 24) + this.boneIndex;
115166                };
115167                r.prototype.setFrame = function(t, e, i, s) {
115168                  t *= r.ENTRIES;
115169                  this.frames[t] = e;
115170                  this.frames[t + r.X] = i;
115171                  this.frames[t + r.Y] = s;
115172                };
115173                r.prototype.apply = function(t, s, n, o, a, l, h) {
115174                  var c = this.frames;
115175                  var u = t.bones[this.boneIndex];
115176                  if (u.active) if (n < c[0]) switch (l) {
115177                   case i.setup:
115178                    u.x = u.data.x;
115179                    u.y = u.data.y;
115180                    return;
115181
115182                   case i.first:
115183                    u.x += (u.data.x - u.x) * a;
115184                    u.y += (u.data.y - u.y) * a;
115185                  } else {
115186                    var _ = 0, d = 0;
115187                    if (n >= c[c.length - r.ENTRIES]) {
115188                      _ = c[c.length + r.PREV_X];
115189                      d = c[c.length + r.PREV_Y];
115190                    } else {
115191                      var p = e.binarySearch(c, n, r.ENTRIES);
115192                      _ = c[p + r.PREV_X];
115193                      d = c[p + r.PREV_Y];
115194                      var m = c[p];
115195                      var f = this.getCurvePercent(p / r.ENTRIES - 1, 1 - (n - m) / (c[p + r.PREV_TIME] - m));
115196                      _ += (c[p + r.X] - _) * f;
115197                      d += (c[p + r.Y] - d) * f;
115198                    }
115199                    switch (l) {
115200                     case i.setup:
115201                      u.x = u.data.x + _ * a;
115202                      u.y = u.data.y + d * a;
115203                      break;
115204
115205                     case i.first:
115206                     case i.replace:
115207                      u.x += (u.data.x + _ - u.x) * a;
115208                      u.y += (u.data.y + d - u.y) * a;
115209                      break;
115210
115211                     case i.add:
115212                      u.x += _ * a;
115213                      u.y += d * a;
115214                    }
115215                  }
115216                };
115217                r.ENTRIES = 3;
115218                r.PREV_TIME = -3;
115219                r.PREV_X = -2;
115220                r.PREV_Y = -1;
115221                r.X = 1;
115222                r.Y = 2;
115223                return r;
115224              }(r);
115225              t.TranslateTimeline = a;
115226              var l = function(r) {
115227                AMt(o, r);
115228                function o(t) {
115229                  return r.call(this, t) || this;
115230                }
115231                o.prototype.getPropertyId = function() {
115232                  return (n.scale << 24) + this.boneIndex;
115233                };
115234                o.prototype.apply = function(n, r, a, l, h, c, u) {
115235                  var _ = this.frames;
115236                  var d = n.bones[this.boneIndex];
115237                  if (d.active) if (a < _[0]) switch (c) {
115238                   case i.setup:
115239                    d.scaleX = d.data.scaleX;
115240                    d.scaleY = d.data.scaleY;
115241                    return;
115242
115243                   case i.first:
115244                    d.scaleX += (d.data.scaleX - d.scaleX) * h;
115245                    d.scaleY += (d.data.scaleY - d.scaleY) * h;
115246                  } else {
115247                    var p = 0, m = 0;
115248                    if (a >= _[_.length - o.ENTRIES]) {
115249                      p = _[_.length + o.PREV_X] * d.data.scaleX;
115250                      m = _[_.length + o.PREV_Y] * d.data.scaleY;
115251                    } else {
115252                      var f = e.binarySearch(_, a, o.ENTRIES);
115253                      p = _[f + o.PREV_X];
115254                      m = _[f + o.PREV_Y];
115255                      var g = _[f];
115256                      var y = this.getCurvePercent(f / o.ENTRIES - 1, 1 - (a - g) / (_[f + o.PREV_TIME] - g));
115257                      p = (p + (_[f + o.X] - p) * y) * d.data.scaleX;
115258                      m = (m + (_[f + o.Y] - m) * y) * d.data.scaleY;
115259                    }
115260                    if (1 == h) if (c == i.add) {
115261                      d.scaleX += p - d.data.scaleX;
115262                      d.scaleY += m - d.data.scaleY;
115263                    } else {
115264                      d.scaleX = p;
115265                      d.scaleY = m;
115266                    } else {
115267                      var b = 0, S = 0;
115268                      if (u == s.mixOut) switch (c) {
115269                       case i.setup:
115270                        b = d.data.scaleX;
115271                        S = d.data.scaleY;
115272                        d.scaleX = b + (Math.abs(p) * t.MathUtils.signum(b) - b) * h;
115273                        d.scaleY = S + (Math.abs(m) * t.MathUtils.signum(S) - S) * h;
115274                        break;
115275
115276                       case i.first:
115277                       case i.replace:
115278                        b = d.scaleX;
115279                        S = d.scaleY;
115280                        d.scaleX = b + (Math.abs(p) * t.MathUtils.signum(b) - b) * h;
115281                        d.scaleY = S + (Math.abs(m) * t.MathUtils.signum(S) - S) * h;
115282                        break;
115283
115284                       case i.add:
115285                        b = d.scaleX;
115286                        S = d.scaleY;
115287                        d.scaleX = b + (Math.abs(p) * t.MathUtils.signum(b) - d.data.scaleX) * h;
115288                        d.scaleY = S + (Math.abs(m) * t.MathUtils.signum(S) - d.data.scaleY) * h;
115289                      } else switch (c) {
115290                       case i.setup:
115291                        b = Math.abs(d.data.scaleX) * t.MathUtils.signum(p);
115292                        S = Math.abs(d.data.scaleY) * t.MathUtils.signum(m);
115293                        d.scaleX = b + (p - b) * h;
115294                        d.scaleY = S + (m - S) * h;
115295                        break;
115296
115297                       case i.first:
115298                       case i.replace:
115299                        b = Math.abs(d.scaleX) * t.MathUtils.signum(p);
115300                        S = Math.abs(d.scaleY) * t.MathUtils.signum(m);
115301                        d.scaleX = b + (p - b) * h;
115302                        d.scaleY = S + (m - S) * h;
115303                        break;
115304
115305                       case i.add:
115306                        b = t.MathUtils.signum(p);
115307                        S = t.MathUtils.signum(m);
115308                        d.scaleX = Math.abs(d.scaleX) * b + (p - Math.abs(d.data.scaleX) * b) * h;
115309                        d.scaleY = Math.abs(d.scaleY) * S + (m - Math.abs(d.data.scaleY) * S) * h;
115310                      }
115311                    }
115312                  }
115313                };
115314                return o;
115315              }(a);
115316              t.ScaleTimeline = l;
115317              var h = function(t) {
115318                AMt(s, t);
115319                function s(e) {
115320                  return t.call(this, e) || this;
115321                }
115322                s.prototype.getPropertyId = function() {
115323                  return (n.shear << 24) + this.boneIndex;
115324                };
115325                s.prototype.apply = function(t, n, r, o, a, l, h) {
115326                  var c = this.frames;
115327                  var u = t.bones[this.boneIndex];
115328                  if (u.active) if (r < c[0]) switch (l) {
115329                   case i.setup:
115330                    u.shearX = u.data.shearX;
115331                    u.shearY = u.data.shearY;
115332                    return;
115333
115334                   case i.first:
115335                    u.shearX += (u.data.shearX - u.shearX) * a;
115336                    u.shearY += (u.data.shearY - u.shearY) * a;
115337                  } else {
115338                    var _ = 0, d = 0;
115339                    if (r >= c[c.length - s.ENTRIES]) {
115340                      _ = c[c.length + s.PREV_X];
115341                      d = c[c.length + s.PREV_Y];
115342                    } else {
115343                      var p = e.binarySearch(c, r, s.ENTRIES);
115344                      _ = c[p + s.PREV_X];
115345                      d = c[p + s.PREV_Y];
115346                      var m = c[p];
115347                      var f = this.getCurvePercent(p / s.ENTRIES - 1, 1 - (r - m) / (c[p + s.PREV_TIME] - m));
115348                      _ += (c[p + s.X] - _) * f;
115349                      d += (c[p + s.Y] - d) * f;
115350                    }
115351                    switch (l) {
115352                     case i.setup:
115353                      u.shearX = u.data.shearX + _ * a;
115354                      u.shearY = u.data.shearY + d * a;
115355                      break;
115356
115357                     case i.first:
115358                     case i.replace:
115359                      u.shearX += (u.data.shearX + _ - u.shearX) * a;
115360                      u.shearY += (u.data.shearY + d - u.shearY) * a;
115361                      break;
115362
115363                     case i.add:
115364                      u.shearX += _ * a;
115365                      u.shearY += d * a;
115366                    }
115367                  }
115368                };
115369                return s;
115370              }(a);
115371              t.ShearTimeline = h;
115372              var c = function(s) {
115373                AMt(r, s);
115374                function r(e) {
115375                  var i = s.call(this, e) || this;
115376                  i.frames = t.Utils.newFloatArray(e * r.ENTRIES);
115377                  return i;
115378                }
115379                r.prototype.getPropertyId = function() {
115380                  return (n.color << 24) + this.slotIndex;
115381                };
115382                r.prototype.setFrame = function(t, e, i, s, n, o) {
115383                  t *= r.ENTRIES;
115384                  this.frames[t] = e;
115385                  this.frames[t + r.R] = i;
115386                  this.frames[t + r.G] = s;
115387                  this.frames[t + r.B] = n;
115388                  this.frames[t + r.A] = o;
115389                };
115390                r.prototype.apply = function(t, s, n, o, a, l, h) {
115391                  var c = t.slots[this.slotIndex];
115392                  if (c.bone.active) {
115393                    var u = this.frames;
115394                    if (n < u[0]) switch (l) {
115395                     case i.setup:
115396                      c.color.setFromColor(c.data.color);
115397                      return;
115398
115399                     case i.first:
115400                      var _ = c.color, d = c.data.color;
115401                      _.add((d.r - _.r) * a, (d.g - _.g) * a, (d.b - _.b) * a, (d.a - _.a) * a);
115402                    } else {
115403                      var p = 0, m = 0, f = 0, g = 0;
115404                      if (n >= u[u.length - r.ENTRIES]) {
115405                        var y = u.length;
115406                        p = u[y + r.PREV_R];
115407                        m = u[y + r.PREV_G];
115408                        f = u[y + r.PREV_B];
115409                        g = u[y + r.PREV_A];
115410                      } else {
115411                        var b = e.binarySearch(u, n, r.ENTRIES);
115412                        p = u[b + r.PREV_R];
115413                        m = u[b + r.PREV_G];
115414                        f = u[b + r.PREV_B];
115415                        g = u[b + r.PREV_A];
115416                        var S = u[b];
115417                        var A = this.getCurvePercent(b / r.ENTRIES - 1, 1 - (n - S) / (u[b + r.PREV_TIME] - S));
115418                        p += (u[b + r.R] - p) * A;
115419                        m += (u[b + r.G] - m) * A;
115420                        f += (u[b + r.B] - f) * A;
115421                        g += (u[b + r.A] - g) * A;
115422                      }
115423                      if (1 == a) c.color.set(p, m, f, g); else {
115424                        _ = c.color;
115425                        l == i.setup && _.setFromColor(c.data.color);
115426                        _.add((p - _.r) * a, (m - _.g) * a, (f - _.b) * a, (g - _.a) * a);
115427                      }
115428                    }
115429                  }
115430                };
115431                r.ENTRIES = 5;
115432                r.PREV_TIME = -5;
115433                r.PREV_R = -4;
115434                r.PREV_G = -3;
115435                r.PREV_B = -2;
115436                r.PREV_A = -1;
115437                r.R = 1;
115438                r.G = 2;
115439                r.B = 3;
115440                r.A = 4;
115441                return r;
115442              }(r);
115443              t.ColorTimeline = c;
115444              var u = function(s) {
115445                AMt(r, s);
115446                function r(e) {
115447                  var i = s.call(this, e) || this;
115448                  i.frames = t.Utils.newFloatArray(e * r.ENTRIES);
115449                  return i;
115450                }
115451                r.prototype.getPropertyId = function() {
115452                  return (n.twoColor << 24) + this.slotIndex;
115453                };
115454                r.prototype.setFrame = function(t, e, i, s, n, o, a, l, h) {
115455                  t *= r.ENTRIES;
115456                  this.frames[t] = e;
115457                  this.frames[t + r.R] = i;
115458                  this.frames[t + r.G] = s;
115459                  this.frames[t + r.B] = n;
115460                  this.frames[t + r.A] = o;
115461                  this.frames[t + r.R2] = a;
115462                  this.frames[t + r.G2] = l;
115463                  this.frames[t + r.B2] = h;
115464                };
115465                r.prototype.apply = function(t, s, n, o, a, l, h) {
115466                  var c = t.slots[this.slotIndex];
115467                  if (c.bone.active) {
115468                    var u = this.frames;
115469                    if (n < u[0]) switch (l) {
115470                     case i.setup:
115471                      c.color.setFromColor(c.data.color);
115472                      c.darkColor.setFromColor(c.data.darkColor);
115473                      return;
115474
115475                     case i.first:
115476                      var _ = c.color, d = c.darkColor, p = c.data.color, m = c.data.darkColor;
115477                      _.add((p.r - _.r) * a, (p.g - _.g) * a, (p.b - _.b) * a, (p.a - _.a) * a);
115478                      d.add((m.r - d.r) * a, (m.g - d.g) * a, (m.b - d.b) * a, 0);
115479                    } else {
115480                      var f = 0, g = 0, y = 0, b = 0, S = 0, A = 0, T = 0;
115481                      if (n >= u[u.length - r.ENTRIES]) {
115482                        var v = u.length;
115483                        f = u[v + r.PREV_R];
115484                        g = u[v + r.PREV_G];
115485                        y = u[v + r.PREV_B];
115486                        b = u[v + r.PREV_A];
115487                        S = u[v + r.PREV_R2];
115488                        A = u[v + r.PREV_G2];
115489                        T = u[v + r.PREV_B2];
115490                      } else {
115491                        var E = e.binarySearch(u, n, r.ENTRIES);
115492                        f = u[E + r.PREV_R];
115493                        g = u[E + r.PREV_G];
115494                        y = u[E + r.PREV_B];
115495                        b = u[E + r.PREV_A];
115496                        S = u[E + r.PREV_R2];
115497                        A = u[E + r.PREV_G2];
115498                        T = u[E + r.PREV_B2];
115499                        var C = u[E];
115500                        var x = this.getCurvePercent(E / r.ENTRIES - 1, 1 - (n - C) / (u[E + r.PREV_TIME] - C));
115501                        f += (u[E + r.R] - f) * x;
115502                        g += (u[E + r.G] - g) * x;
115503                        y += (u[E + r.B] - y) * x;
115504                        b += (u[E + r.A] - b) * x;
115505                        S += (u[E + r.R2] - S) * x;
115506                        A += (u[E + r.G2] - A) * x;
115507                        T += (u[E + r.B2] - T) * x;
115508                      }
115509                      if (1 == a) {
115510                        c.color.set(f, g, y, b);
115511                        c.darkColor.set(S, A, T, 1);
115512                      } else {
115513                        _ = c.color, d = c.darkColor;
115514                        if (l == i.setup) {
115515                          _.setFromColor(c.data.color);
115516                          d.setFromColor(c.data.darkColor);
115517                        }
115518                        _.add((f - _.r) * a, (g - _.g) * a, (y - _.b) * a, (b - _.a) * a);
115519                        d.add((S - d.r) * a, (A - d.g) * a, (T - d.b) * a, 0);
115520                      }
115521                    }
115522                  }
115523                };
115524                r.ENTRIES = 8;
115525                r.PREV_TIME = -8;
115526                r.PREV_R = -7;
115527                r.PREV_G = -6;
115528                r.PREV_B = -5;
115529                r.PREV_A = -4;
115530                r.PREV_R2 = -3;
115531                r.PREV_G2 = -2;
115532                r.PREV_B2 = -1;
115533                r.R = 1;
115534                r.G = 2;
115535                r.B = 3;
115536                r.A = 4;
115537                r.R2 = 5;
115538                r.G2 = 6;
115539                r.B2 = 7;
115540                return r;
115541              }(r);
115542              t.TwoColorTimeline = u;
115543              var _ = function() {
115544                function r(e) {
115545                  this.frames = t.Utils.newFloatArray(e);
115546                  this.attachmentNames = new Array(e);
115547                }
115548                r.prototype.getPropertyId = function() {
115549                  return (n.attachment << 24) + this.slotIndex;
115550                };
115551                r.prototype.getFrameCount = function() {
115552                  return this.frames.length;
115553                };
115554                r.prototype.setFrame = function(t, e, i) {
115555                  this.frames[t] = e;
115556                  this.attachmentNames[t] = i;
115557                };
115558                r.prototype.apply = function(t, n, r, o, a, l, h) {
115559                  var c = t.slots[this.slotIndex];
115560                  if (c.bone.active) if (h != s.mixOut || l != i.setup) {
115561                    var u = this.frames;
115562                    if (r < u[0]) {
115563                      if (l == i.setup || l == i.first) {
115564                        var _ = c.data.attachmentName;
115565                        c.setAttachment(null == _ ? null : t.getAttachment(this.slotIndex, _));
115566                      }
115567                    } else {
115568                      var d = 0;
115569                      d = r >= u[u.length - 1] ? u.length - 1 : e.binarySearch(u, r, 1) - 1;
115570                      var p = this.attachmentNames[d];
115571                      t.slots[this.slotIndex].setAttachment(null == p ? null : t.getAttachment(this.slotIndex, p));
115572                    }
115573                  } else {
115574                    var m = c.data.attachmentName;
115575                    c.setAttachment(null == m ? null : t.getAttachment(this.slotIndex, m));
115576                  }
115577                };
115578                return r;
115579              }();
115580              t.AttachmentTimeline = _;
115581              var d = null;
115582              var p = function(s) {
115583                AMt(r, s);
115584                function r(e) {
115585                  var i = s.call(this, e) || this;
115586                  i.frames = t.Utils.newFloatArray(e);
115587                  i.frameVertices = new Array(e);
115588                  null == d && (d = t.Utils.newFloatArray(64));
115589                  return i;
115590                }
115591                r.prototype.getPropertyId = function() {
115592                  return (n.deform << 27) + +this.attachment.id + this.slotIndex;
115593                };
115594                r.prototype.setFrame = function(t, e, i) {
115595                  this.frames[t] = e;
115596                  this.frameVertices[t] = i;
115597                };
115598                r.prototype.apply = function(s, n, r, o, a, l, h) {
115599                  var c = s.slots[this.slotIndex];
115600                  if (c.bone.active) {
115601                    var u = c.getAttachment();
115602                    if (u instanceof t.VertexAttachment && u.deformAttachment == this.attachment) {
115603                      var _ = c.deform;
115604                      0 == _.length && (l = i.setup);
115605                      var d = this.frameVertices;
115606                      var p = d[0].length;
115607                      var m = this.frames;
115608                      if (r < m[0]) {
115609                        var f = u;
115610                        switch (l) {
115611                         case i.setup:
115612                          _.length = 0;
115613                          return;
115614
115615                         case i.first:
115616                          if (1 == a) {
115617                            _.length = 0;
115618                            break;
115619                          }
115620                          var g = t.Utils.setArraySize(_, p);
115621                          if (null == f.bones) {
115622                            var y = f.vertices;
115623                            for (var b = 0; b < p; b++) g[b] += (y[b] - g[b]) * a;
115624                          } else {
115625                            a = 1 - a;
115626                            for (b = 0; b < p; b++) g[b] *= a;
115627                          }
115628                        }
115629                      } else {
115630                        var S = t.Utils.setArraySize(_, p);
115631                        if (r >= m[m.length - 1]) {
115632                          var A = d[m.length - 1];
115633                          if (1 == a) if (l == i.add) {
115634                            if (null == (f = u).bones) {
115635                              y = f.vertices;
115636                              for (var T = 0; T < p; T++) S[T] += A[T] - y[T];
115637                            } else for (var v = 0; v < p; v++) S[v] += A[v];
115638                          } else t.Utils.arrayCopy(A, 0, S, 0, p); else switch (l) {
115639                           case i.setup:
115640                            var E = u;
115641                            if (null == E.bones) {
115642                              y = E.vertices;
115643                              for (var C = 0; C < p; C++) {
115644                                var x = y[C];
115645                                S[C] = x + (A[C] - x) * a;
115646                              }
115647                            } else for (var w = 0; w < p; w++) S[w] = A[w] * a;
115648                            break;
115649
115650                           case i.first:
115651                           case i.replace:
115652                            for (var R = 0; R < p; R++) S[R] += (A[R] - S[R]) * a;
115653
115654                           case i.add:
115655                            if (null == (f = u).bones) {
115656                              y = f.vertices;
115657                              for (var I = 0; I < p; I++) S[I] += (A[I] - y[I]) * a;
115658                            } else for (var M = 0; M < p; M++) S[M] += A[M] * a;
115659                          }
115660                        } else {
115661                          var B = e.binarySearch(m, r);
115662                          var D = d[B - 1];
115663                          var P = d[B];
115664                          var O = m[B];
115665                          var N = this.getCurvePercent(B - 1, 1 - (r - O) / (m[B - 1] - O));
115666                          if (1 == a) if (l == i.add) {
115667                            if (null == (f = u).bones) {
115668                              y = f.vertices;
115669                              for (var L = 0; L < p; L++) {
115670                                var F = D[L];
115671                                S[L] += F + (P[L] - F) * N - y[L];
115672                              }
115673                            } else for (var V = 0; V < p; V++) {
115674                              F = D[V];
115675                              S[V] += F + (P[V] - F) * N;
115676                            }
115677                          } else for (var k = 0; k < p; k++) {
115678                            F = D[k];
115679                            S[k] = F + (P[k] - F) * N;
115680                          } else switch (l) {
115681                           case i.setup:
115682                            var U = u;
115683                            if (null == U.bones) {
115684                              y = U.vertices;
115685                              for (var G = 0; G < p; G++) {
115686                                F = D[G], x = y[G];
115687                                S[G] = x + (F + (P[G] - F) * N - x) * a;
115688                              }
115689                            } else for (var z = 0; z < p; z++) {
115690                              F = D[z];
115691                              S[z] = (F + (P[z] - F) * N) * a;
115692                            }
115693                            break;
115694
115695                           case i.first:
115696                           case i.replace:
115697                            for (var H = 0; H < p; H++) {
115698                              F = D[H];
115699                              S[H] += (F + (P[H] - F) * N - S[H]) * a;
115700                            }
115701                            break;
115702
115703                           case i.add:
115704                            if (null == (f = u).bones) {
115705                              y = f.vertices;
115706                              for (var j = 0; j < p; j++) {
115707                                F = D[j];
115708                                S[j] += (F + (P[j] - F) * N - y[j]) * a;
115709                              }
115710                            } else for (var X = 0; X < p; X++) {
115711                              F = D[X];
115712                              S[X] += (F + (P[X] - F) * N) * a;
115713                            }
115714                          }
115715                        }
115716                      }
115717                    }
115718                  }
115719                };
115720                return r;
115721              }(r);
115722              t.DeformTimeline = p;
115723              var m = function() {
115724                function i(e) {
115725                  this.frames = t.Utils.newFloatArray(e);
115726                  this.events = new Array(e);
115727                }
115728                i.prototype.getPropertyId = function() {
115729                  return n.event << 24;
115730                };
115731                i.prototype.getFrameCount = function() {
115732                  return this.frames.length;
115733                };
115734                i.prototype.setFrame = function(t, e) {
115735                  this.frames[t] = e.time;
115736                  this.events[t] = e;
115737                };
115738                i.prototype.apply = function(t, i, s, n, r, o, a) {
115739                  if (null != n) {
115740                    var l = this.frames;
115741                    var h = this.frames.length;
115742                    if (i > s) {
115743                      this.apply(t, i, Number.MAX_VALUE, n, r, o, a);
115744                      i = -1;
115745                    } else if (i >= l[h - 1]) return;
115746                    if (!(s < l[0])) {
115747                      var c = 0;
115748                      if (i < l[0]) c = 0; else {
115749                        var u = l[c = e.binarySearch(l, i)];
115750                        for (;c > 0 && l[c - 1] == u; ) c--;
115751                      }
115752                      for (;c < h && s >= l[c]; c++) n.push(this.events[c]);
115753                    }
115754                  }
115755                };
115756                return i;
115757              }();
115758              t.EventTimeline = m;
115759              var f = function() {
115760                function r(e) {
115761                  this.frames = t.Utils.newFloatArray(e);
115762                  this.drawOrders = new Array(e);
115763                }
115764                r.prototype.getPropertyId = function() {
115765                  return n.drawOrder << 24;
115766                };
115767                r.prototype.getFrameCount = function() {
115768                  return this.frames.length;
115769                };
115770                r.prototype.setFrame = function(t, e, i) {
115771                  this.frames[t] = e;
115772                  this.drawOrders[t] = i;
115773                };
115774                r.prototype.apply = function(n, r, o, a, l, h, c) {
115775                  var u = n.drawOrder;
115776                  var _ = n.slots;
115777                  if (c != s.mixOut || h != i.setup) {
115778                    var d = this.frames;
115779                    if (o < d[0]) h != i.setup && h != i.first || t.Utils.arrayCopy(n.slots, 0, n.drawOrder, 0, n.slots.length); else {
115780                      var p = 0;
115781                      p = o >= d[d.length - 1] ? d.length - 1 : e.binarySearch(d, o) - 1;
115782                      var m = this.drawOrders[p];
115783                      if (null == m) t.Utils.arrayCopy(_, 0, u, 0, _.length); else for (var f = 0, g = m.length; f < g; f++) u[f] = _[m[f]];
115784                    }
115785                  } else t.Utils.arrayCopy(n.slots, 0, n.drawOrder, 0, n.slots.length);
115786                };
115787                return r;
115788              }();
115789              t.DrawOrderTimeline = f;
115790              var g = function(r) {
115791                AMt(o, r);
115792                function o(e) {
115793                  var i = r.call(this, e) || this;
115794                  i.frames = t.Utils.newFloatArray(e * o.ENTRIES);
115795                  return i;
115796                }
115797                o.prototype.getPropertyId = function() {
115798                  return (n.ikConstraint << 24) + this.ikConstraintIndex;
115799                };
115800                o.prototype.setFrame = function(t, e, i, s, n, r, a) {
115801                  t *= o.ENTRIES;
115802                  this.frames[t] = e;
115803                  this.frames[t + o.MIX] = i;
115804                  this.frames[t + o.SOFTNESS] = s;
115805                  this.frames[t + o.BEND_DIRECTION] = n;
115806                  this.frames[t + o.COMPRESS] = r ? 1 : 0;
115807                  this.frames[t + o.STRETCH] = a ? 1 : 0;
115808                };
115809                o.prototype.apply = function(t, n, r, a, l, h, c) {
115810                  var u = this.frames;
115811                  var _ = t.ikConstraints[this.ikConstraintIndex];
115812                  if (_.active) if (r < u[0]) switch (h) {
115813                   case i.setup:
115814                    _.mix = _.data.mix;
115815                    _.softness = _.data.softness;
115816                    _.bendDirection = _.data.bendDirection;
115817                    _.compress = _.data.compress;
115818                    _.stretch = _.data.stretch;
115819                    return;
115820
115821                   case i.first:
115822                    _.mix += (_.data.mix - _.mix) * l;
115823                    _.softness += (_.data.softness - _.softness) * l;
115824                    _.bendDirection = _.data.bendDirection;
115825                    _.compress = _.data.compress;
115826                    _.stretch = _.data.stretch;
115827                  } else if (r >= u[u.length - o.ENTRIES]) if (h == i.setup) {
115828                    _.mix = _.data.mix + (u[u.length + o.PREV_MIX] - _.data.mix) * l;
115829                    _.softness = _.data.softness + (u[u.length + o.PREV_SOFTNESS] - _.data.softness) * l;
115830                    if (c == s.mixOut) {
115831                      _.bendDirection = _.data.bendDirection;
115832                      _.compress = _.data.compress;
115833                      _.stretch = _.data.stretch;
115834                    } else {
115835                      _.bendDirection = u[u.length + o.PREV_BEND_DIRECTION];
115836                      _.compress = 0 != u[u.length + o.PREV_COMPRESS];
115837                      _.stretch = 0 != u[u.length + o.PREV_STRETCH];
115838                    }
115839                  } else {
115840                    _.mix += (u[u.length + o.PREV_MIX] - _.mix) * l;
115841                    _.softness += (u[u.length + o.PREV_SOFTNESS] - _.softness) * l;
115842                    if (c == s.mixIn) {
115843                      _.bendDirection = u[u.length + o.PREV_BEND_DIRECTION];
115844                      _.compress = 0 != u[u.length + o.PREV_COMPRESS];
115845                      _.stretch = 0 != u[u.length + o.PREV_STRETCH];
115846                    }
115847                  } else {
115848                    var d = e.binarySearch(u, r, o.ENTRIES);
115849                    var p = u[d + o.PREV_MIX];
115850                    var m = u[d + o.PREV_SOFTNESS];
115851                    var f = u[d];
115852                    var g = this.getCurvePercent(d / o.ENTRIES - 1, 1 - (r - f) / (u[d + o.PREV_TIME] - f));
115853                    if (h == i.setup) {
115854                      _.mix = _.data.mix + (p + (u[d + o.MIX] - p) * g - _.data.mix) * l;
115855                      _.softness = _.data.softness + (m + (u[d + o.SOFTNESS] - m) * g - _.data.softness) * l;
115856                      if (c == s.mixOut) {
115857                        _.bendDirection = _.data.bendDirection;
115858                        _.compress = _.data.compress;
115859                        _.stretch = _.data.stretch;
115860                      } else {
115861                        _.bendDirection = u[d + o.PREV_BEND_DIRECTION];
115862                        _.compress = 0 != u[d + o.PREV_COMPRESS];
115863                        _.stretch = 0 != u[d + o.PREV_STRETCH];
115864                      }
115865                    } else {
115866                      _.mix += (p + (u[d + o.MIX] - p) * g - _.mix) * l;
115867                      _.softness += (m + (u[d + o.SOFTNESS] - m) * g - _.softness) * l;
115868                      if (c == s.mixIn) {
115869                        _.bendDirection = u[d + o.PREV_BEND_DIRECTION];
115870                        _.compress = 0 != u[d + o.PREV_COMPRESS];
115871                        _.stretch = 0 != u[d + o.PREV_STRETCH];
115872                      }
115873                    }
115874                  }
115875                };
115876                o.ENTRIES = 6;
115877                o.PREV_TIME = -6;
115878                o.PREV_MIX = -5;
115879                o.PREV_SOFTNESS = -4;
115880                o.PREV_BEND_DIRECTION = -3;
115881                o.PREV_COMPRESS = -2;
115882                o.PREV_STRETCH = -1;
115883                o.MIX = 1;
115884                o.SOFTNESS = 2;
115885                o.BEND_DIRECTION = 3;
115886                o.COMPRESS = 4;
115887                o.STRETCH = 5;
115888                return o;
115889              }(r);
115890              t.IkConstraintTimeline = g;
115891              var y = function(s) {
115892                AMt(r, s);
115893                function r(e) {
115894                  var i = s.call(this, e) || this;
115895                  i.frames = t.Utils.newFloatArray(e * r.ENTRIES);
115896                  return i;
115897                }
115898                r.prototype.getPropertyId = function() {
115899                  return (n.transformConstraint << 24) + this.transformConstraintIndex;
115900                };
115901                r.prototype.setFrame = function(t, e, i, s, n, o) {
115902                  t *= r.ENTRIES;
115903                  this.frames[t] = e;
115904                  this.frames[t + r.ROTATE] = i;
115905                  this.frames[t + r.TRANSLATE] = s;
115906                  this.frames[t + r.SCALE] = n;
115907                  this.frames[t + r.SHEAR] = o;
115908                };
115909                r.prototype.apply = function(t, s, n, o, a, l, h) {
115910                  var c = this.frames;
115911                  var u = t.transformConstraints[this.transformConstraintIndex];
115912                  if (u.active) if (n < c[0]) {
115913                    var _ = u.data;
115914                    switch (l) {
115915                     case i.setup:
115916                      u.rotateMix = _.rotateMix;
115917                      u.translateMix = _.translateMix;
115918                      u.scaleMix = _.scaleMix;
115919                      u.shearMix = _.shearMix;
115920                      return;
115921
115922                     case i.first:
115923                      u.rotateMix += (_.rotateMix - u.rotateMix) * a;
115924                      u.translateMix += (_.translateMix - u.translateMix) * a;
115925                      u.scaleMix += (_.scaleMix - u.scaleMix) * a;
115926                      u.shearMix += (_.shearMix - u.shearMix) * a;
115927                    }
115928                  } else {
115929                    var d = 0, p = 0, m = 0, f = 0;
115930                    if (n >= c[c.length - r.ENTRIES]) {
115931                      var g = c.length;
115932                      d = c[g + r.PREV_ROTATE];
115933                      p = c[g + r.PREV_TRANSLATE];
115934                      m = c[g + r.PREV_SCALE];
115935                      f = c[g + r.PREV_SHEAR];
115936                    } else {
115937                      var y = e.binarySearch(c, n, r.ENTRIES);
115938                      d = c[y + r.PREV_ROTATE];
115939                      p = c[y + r.PREV_TRANSLATE];
115940                      m = c[y + r.PREV_SCALE];
115941                      f = c[y + r.PREV_SHEAR];
115942                      var b = c[y];
115943                      var S = this.getCurvePercent(y / r.ENTRIES - 1, 1 - (n - b) / (c[y + r.PREV_TIME] - b));
115944                      d += (c[y + r.ROTATE] - d) * S;
115945                      p += (c[y + r.TRANSLATE] - p) * S;
115946                      m += (c[y + r.SCALE] - m) * S;
115947                      f += (c[y + r.SHEAR] - f) * S;
115948                    }
115949                    if (l == i.setup) {
115950                      _ = u.data;
115951                      u.rotateMix = _.rotateMix + (d - _.rotateMix) * a;
115952                      u.translateMix = _.translateMix + (p - _.translateMix) * a;
115953                      u.scaleMix = _.scaleMix + (m - _.scaleMix) * a;
115954                      u.shearMix = _.shearMix + (f - _.shearMix) * a;
115955                    } else {
115956                      u.rotateMix += (d - u.rotateMix) * a;
115957                      u.translateMix += (p - u.translateMix) * a;
115958                      u.scaleMix += (m - u.scaleMix) * a;
115959                      u.shearMix += (f - u.shearMix) * a;
115960                    }
115961                  }
115962                };
115963                r.ENTRIES = 5;
115964                r.PREV_TIME = -5;
115965                r.PREV_ROTATE = -4;
115966                r.PREV_TRANSLATE = -3;
115967                r.PREV_SCALE = -2;
115968                r.PREV_SHEAR = -1;
115969                r.ROTATE = 1;
115970                r.TRANSLATE = 2;
115971                r.SCALE = 3;
115972                r.SHEAR = 4;
115973                return r;
115974              }(r);
115975              t.TransformConstraintTimeline = y;
115976              var b = function(s) {
115977                AMt(r, s);
115978                function r(e) {
115979                  var i = s.call(this, e) || this;
115980                  i.frames = t.Utils.newFloatArray(e * r.ENTRIES);
115981                  return i;
115982                }
115983                r.prototype.getPropertyId = function() {
115984                  return (n.pathConstraintPosition << 24) + this.pathConstraintIndex;
115985                };
115986                r.prototype.setFrame = function(t, e, i) {
115987                  t *= r.ENTRIES;
115988                  this.frames[t] = e;
115989                  this.frames[t + r.VALUE] = i;
115990                };
115991                r.prototype.apply = function(t, s, n, o, a, l, h) {
115992                  var c = this.frames;
115993                  var u = t.pathConstraints[this.pathConstraintIndex];
115994                  if (u.active) if (n < c[0]) switch (l) {
115995                   case i.setup:
115996                    u.position = u.data.position;
115997                    return;
115998
115999                   case i.first:
116000                    u.position += (u.data.position - u.position) * a;
116001                  } else {
116002                    var _ = 0;
116003                    if (n >= c[c.length - r.ENTRIES]) _ = c[c.length + r.PREV_VALUE]; else {
116004                      var d = e.binarySearch(c, n, r.ENTRIES);
116005                      _ = c[d + r.PREV_VALUE];
116006                      var p = c[d];
116007                      var m = this.getCurvePercent(d / r.ENTRIES - 1, 1 - (n - p) / (c[d + r.PREV_TIME] - p));
116008                      _ += (c[d + r.VALUE] - _) * m;
116009                    }
116010                    l == i.setup ? u.position = u.data.position + (_ - u.data.position) * a : u.position += (_ - u.position) * a;
116011                  }
116012                };
116013                r.ENTRIES = 2;
116014                r.PREV_TIME = -2;
116015                r.PREV_VALUE = -1;
116016                r.VALUE = 1;
116017                return r;
116018              }(r);
116019              t.PathConstraintPositionTimeline = b;
116020              var S = function(t) {
116021                AMt(s, t);
116022                function s(e) {
116023                  return t.call(this, e) || this;
116024                }
116025                s.prototype.getPropertyId = function() {
116026                  return (n.pathConstraintSpacing << 24) + this.pathConstraintIndex;
116027                };
116028                s.prototype.apply = function(t, n, r, o, a, l, h) {
116029                  var c = this.frames;
116030                  var u = t.pathConstraints[this.pathConstraintIndex];
116031                  if (u.active) if (r < c[0]) switch (l) {
116032                   case i.setup:
116033                    u.spacing = u.data.spacing;
116034                    return;
116035
116036                   case i.first:
116037                    u.spacing += (u.data.spacing - u.spacing) * a;
116038                  } else {
116039                    var _ = 0;
116040                    if (r >= c[c.length - s.ENTRIES]) _ = c[c.length + s.PREV_VALUE]; else {
116041                      var d = e.binarySearch(c, r, s.ENTRIES);
116042                      _ = c[d + s.PREV_VALUE];
116043                      var p = c[d];
116044                      var m = this.getCurvePercent(d / s.ENTRIES - 1, 1 - (r - p) / (c[d + s.PREV_TIME] - p));
116045                      _ += (c[d + s.VALUE] - _) * m;
116046                    }
116047                    l == i.setup ? u.spacing = u.data.spacing + (_ - u.data.spacing) * a : u.spacing += (_ - u.spacing) * a;
116048                  }
116049                };
116050                return s;
116051              }(b);
116052              t.PathConstraintSpacingTimeline = S;
116053              var A = function(s) {
116054                AMt(r, s);
116055                function r(e) {
116056                  var i = s.call(this, e) || this;
116057                  i.frames = t.Utils.newFloatArray(e * r.ENTRIES);
116058                  return i;
116059                }
116060                r.prototype.getPropertyId = function() {
116061                  return (n.pathConstraintMix << 24) + this.pathConstraintIndex;
116062                };
116063                r.prototype.setFrame = function(t, e, i, s) {
116064                  t *= r.ENTRIES;
116065                  this.frames[t] = e;
116066                  this.frames[t + r.ROTATE] = i;
116067                  this.frames[t + r.TRANSLATE] = s;
116068                };
116069                r.prototype.apply = function(t, s, n, o, a, l, h) {
116070                  var c = this.frames;
116071                  var u = t.pathConstraints[this.pathConstraintIndex];
116072                  if (u.active) if (n < c[0]) switch (l) {
116073                   case i.setup:
116074                    u.rotateMix = u.data.rotateMix;
116075                    u.translateMix = u.data.translateMix;
116076                    return;
116077
116078                   case i.first:
116079                    u.rotateMix += (u.data.rotateMix - u.rotateMix) * a;
116080                    u.translateMix += (u.data.translateMix - u.translateMix) * a;
116081                  } else {
116082                    var _ = 0, d = 0;
116083                    if (n >= c[c.length - r.ENTRIES]) {
116084                      _ = c[c.length + r.PREV_ROTATE];
116085                      d = c[c.length + r.PREV_TRANSLATE];
116086                    } else {
116087                      var p = e.binarySearch(c, n, r.ENTRIES);
116088                      _ = c[p + r.PREV_ROTATE];
116089                      d = c[p + r.PREV_TRANSLATE];
116090                      var m = c[p];
116091                      var f = this.getCurvePercent(p / r.ENTRIES - 1, 1 - (n - m) / (c[p + r.PREV_TIME] - m));
116092                      _ += (c[p + r.ROTATE] - _) * f;
116093                      d += (c[p + r.TRANSLATE] - d) * f;
116094                    }
116095                    if (l == i.setup) {
116096                      u.rotateMix = u.data.rotateMix + (_ - u.data.rotateMix) * a;
116097                      u.translateMix = u.data.translateMix + (d - u.data.translateMix) * a;
116098                    } else {
116099                      u.rotateMix += (_ - u.rotateMix) * a;
116100                      u.translateMix += (d - u.translateMix) * a;
116101                    }
116102                  }
116103                };
116104                r.ENTRIES = 3;
116105                r.PREV_TIME = -3;
116106                r.PREV_ROTATE = -2;
116107                r.PREV_TRANSLATE = -1;
116108                r.ROTATE = 1;
116109                r.TRANSLATE = 2;
116110                return r;
116111              }(r);
116112              t.PathConstraintMixTimeline = A;
116113            }(TMt || (TMt = {}));
116114            !function(t) {
116115              var e = function() {
116116                function e(e) {
116117                  this.tracks = new Array;
116118                  this.timeScale = 1;
116119                  this.events = new Array;
116120                  this.listeners = new Array;
116121                  this.queue = new s(this);
116122                  this.propertyIDs = new t.IntSet;
116123                  this.animationsChanged = !1;
116124                  this.trackEntryPool = new t.Pool((function() {
116125                    return new i;
116126                  }));
116127                  this.data = e;
116128                }
116129                e.prototype.update = function(t) {
116130                  t *= this.timeScale;
116131                  var e = this.tracks;
116132                  for (var i = 0, s = e.length; i < s; i++) {
116133                    var n = e[i];
116134                    if (null != n) {
116135                      n.animationLast = n.nextAnimationLast;
116136                      n.trackLast = n.nextTrackLast;
116137                      var r = t * n.timeScale;
116138                      if (n.delay > 0) {
116139                        n.delay -= r;
116140                        if (n.delay > 0) continue;
116141                        r = -n.delay;
116142                        n.delay = 0;
116143                      }
116144                      var o = n.next;
116145                      if (null != o) {
116146                        var a = n.trackLast - o.delay;
116147                        if (a >= 0) {
116148                          o.delay = 0;
116149                          o.trackTime += 0 == n.timeScale ? 0 : (a / n.timeScale + t) * o.timeScale;
116150                          n.trackTime += r;
116151                          this.setCurrent(i, o, !0);
116152                          for (;null != o.mixingFrom; ) {
116153                            o.mixTime += t;
116154                            o = o.mixingFrom;
116155                          }
116156                          continue;
116157                        }
116158                      } else if (n.trackLast >= n.trackEnd && null == n.mixingFrom) {
116159                        e[i] = null;
116160                        this.queue.end(n);
116161                        this.disposeNext(n);
116162                        continue;
116163                      }
116164                      if (null != n.mixingFrom && this.updateMixingFrom(n, t)) {
116165                        var l = n.mixingFrom;
116166                        n.mixingFrom = null;
116167                        null != l && (l.mixingTo = null);
116168                        for (;null != l; ) {
116169                          this.queue.end(l);
116170                          l = l.mixingFrom;
116171                        }
116172                      }
116173                      n.trackTime += r;
116174                    }
116175                  }
116176                  this.queue.drain();
116177                };
116178                e.prototype.updateMixingFrom = function(t, e) {
116179                  var i = t.mixingFrom;
116180                  if (null == i) return !0;
116181                  var s = this.updateMixingFrom(i, e);
116182                  i.animationLast = i.nextAnimationLast;
116183                  i.trackLast = i.nextTrackLast;
116184                  if (t.mixTime > 0 && t.mixTime >= t.mixDuration) {
116185                    if (0 == i.totalAlpha || 0 == t.mixDuration) {
116186                      t.mixingFrom = i.mixingFrom;
116187                      null != i.mixingFrom && (i.mixingFrom.mixingTo = t);
116188                      t.interruptAlpha = i.interruptAlpha;
116189                      this.queue.end(i);
116190                    }
116191                    return s;
116192                  }
116193                  i.trackTime += e * i.timeScale;
116194                  t.mixTime += e;
116195                  return !1;
116196                };
116197                e.prototype.apply = function(i) {
116198                  if (null == i) throw new Error("skeleton cannot be null.");
116199                  this.animationsChanged && this._animationsChanged();
116200                  var s = this.events;
116201                  var n = this.tracks;
116202                  var r = !1;
116203                  for (var o = 0, a = n.length; o < a; o++) {
116204                    var l = n[o];
116205                    if (!(null == l || l.delay > 0)) {
116206                      r = !0;
116207                      var h = 0 == o ? t.MixBlend.first : l.mixBlend;
116208                      var c = l.alpha;
116209                      null != l.mixingFrom ? c *= this.applyMixingFrom(l, i, h) : l.trackTime >= l.trackEnd && null == l.next && (c = 0);
116210                      var u = l.animationLast, _ = l.getAnimationTime();
116211                      var d = l.animation.timelines.length;
116212                      var p = l.animation.timelines;
116213                      if (0 == o && 1 == c || h == t.MixBlend.add) for (var m = 0; m < d; m++) {
116214                        t.Utils.webkit602BugfixHelper(c, h);
116215                        p[m].apply(i, u, _, s, c, h, t.MixDirection.mixIn);
116216                      } else {
116217                        var f = l.timelineMode;
116218                        var g = 0 == l.timelinesRotation.length;
116219                        g && t.Utils.setArraySize(l.timelinesRotation, d << 1, null);
116220                        var y = l.timelinesRotation;
116221                        for (m = 0; m < d; m++) {
116222                          var b = p[m];
116223                          var S = (f[m] & e.NOT_LAST - 1) == e.SUBSEQUENT ? h : t.MixBlend.setup;
116224                          if (b instanceof t.RotateTimeline) this.applyRotateTimeline(b, i, _, c, S, y, m << 1, g); else {
116225                            t.Utils.webkit602BugfixHelper(c, h);
116226                            b.apply(i, u, _, s, c, S, t.MixDirection.mixIn);
116227                          }
116228                        }
116229                      }
116230                      this.queueEvents(l, _);
116231                      s.length = 0;
116232                      l.nextAnimationLast = _;
116233                      l.nextTrackLast = l.trackTime;
116234                    }
116235                  }
116236                  this.queue.drain();
116237                  return r;
116238                };
116239                e.prototype.applyMixingFrom = function(i, s, n) {
116240                  var r = i.mixingFrom;
116241                  null != r.mixingFrom && this.applyMixingFrom(r, s, n);
116242                  var o = 0;
116243                  if (0 == i.mixDuration) {
116244                    o = 1;
116245                    n == t.MixBlend.first && (n = t.MixBlend.setup);
116246                  } else {
116247                    (o = i.mixTime / i.mixDuration) > 1 && (o = 1);
116248                    n != t.MixBlend.first && (n = r.mixBlend);
116249                  }
116250                  var a = o < r.eventThreshold ? this.events : null;
116251                  var l = o < r.attachmentThreshold, h = o < r.drawOrderThreshold;
116252                  var c = r.animationLast, u = r.getAnimationTime();
116253                  var _ = r.animation.timelines.length;
116254                  var d = r.animation.timelines;
116255                  var p = r.alpha * i.interruptAlpha, m = p * (1 - o);
116256                  if (n == t.MixBlend.add) for (var f = 0; f < _; f++) d[f].apply(s, c, u, a, m, n, t.MixDirection.mixOut); else {
116257                    var g = r.timelineMode;
116258                    var y = r.timelineHoldMix;
116259                    var b = 0 == r.timelinesRotation.length;
116260                    b && t.Utils.setArraySize(r.timelinesRotation, _ << 1, null);
116261                    var S = r.timelinesRotation;
116262                    r.totalAlpha = 0;
116263                    for (f = 0; f < _; f++) {
116264                      var A = d[f];
116265                      var T = t.MixDirection.mixOut;
116266                      var v = void 0;
116267                      var E = 0;
116268                      switch (g[f] & e.NOT_LAST - 1) {
116269                       case e.SUBSEQUENT:
116270                        v = n;
116271                        if (!l && A instanceof t.AttachmentTimeline) {
116272                          if ((g[f] & e.NOT_LAST) == e.NOT_LAST) continue;
116273                          v = t.MixBlend.setup;
116274                        }
116275                        if (!h && A instanceof t.DrawOrderTimeline) continue;
116276                        E = m;
116277                        break;
116278
116279                       case e.FIRST:
116280                        v = t.MixBlend.setup;
116281                        E = m;
116282                        break;
116283
116284                       case e.HOLD:
116285                        v = t.MixBlend.setup;
116286                        E = p;
116287                        break;
116288
116289                       default:
116290                        v = t.MixBlend.setup;
116291                        var C = y[f];
116292                        E = p * Math.max(0, 1 - C.mixTime / C.mixDuration);
116293                      }
116294                      r.totalAlpha += E;
116295                      if (A instanceof t.RotateTimeline) this.applyRotateTimeline(A, s, u, E, v, S, f << 1, b); else {
116296                        t.Utils.webkit602BugfixHelper(E, n);
116297                        v == t.MixBlend.setup && (A instanceof t.AttachmentTimeline ? (l || (g[f] & e.NOT_LAST) == e.NOT_LAST) && (T = t.MixDirection.mixIn) : A instanceof t.DrawOrderTimeline && h && (T = t.MixDirection.mixIn));
116298                        A.apply(s, c, u, a, E, v, T);
116299                      }
116300                    }
116301                  }
116302                  i.mixDuration > 0 && this.queueEvents(r, u);
116303                  this.events.length = 0;
116304                  r.nextAnimationLast = u;
116305                  r.nextTrackLast = r.trackTime;
116306                  return o;
116307                };
116308                e.prototype.applyRotateTimeline = function(e, i, s, n, r, o, a, l) {
116309                  l && (o[a] = 0);
116310                  if (1 != n) {
116311                    var h = e;
116312                    var c = h.frames;
116313                    var u = i.bones[h.boneIndex];
116314                    if (u.active) {
116315                      var _ = 0, d = 0;
116316                      if (s < c[0]) switch (r) {
116317                       case t.MixBlend.setup:
116318                        u.rotation = u.data.rotation;
116319
116320                       default:
116321                        return;
116322
116323                       case t.MixBlend.first:
116324                        _ = u.rotation;
116325                        d = u.data.rotation;
116326                      } else {
116327                        _ = r == t.MixBlend.setup ? u.data.rotation : u.rotation;
116328                        if (s >= c[c.length - t.RotateTimeline.ENTRIES]) d = u.data.rotation + c[c.length + t.RotateTimeline.PREV_ROTATION]; else {
116329                          var p = t.Animation.binarySearch(c, s, t.RotateTimeline.ENTRIES);
116330                          var m = c[p + t.RotateTimeline.PREV_ROTATION];
116331                          var f = c[p];
116332                          var g = h.getCurvePercent((p >> 1) - 1, 1 - (s - f) / (c[p + t.RotateTimeline.PREV_TIME] - f));
116333                          d = c[p + t.RotateTimeline.ROTATION] - m;
116334                          d = m + (d -= 360 * (16384 - (16384.499999999996 - d / 360 | 0))) * g + u.data.rotation;
116335                          d -= 360 * (16384 - (16384.499999999996 - d / 360 | 0));
116336                        }
116337                      }
116338                      var y = 0, b = d - _;
116339                      if (0 == (b -= 360 * (16384 - (16384.499999999996 - b / 360 | 0)))) y = o[a]; else {
116340                        var S = 0, A = 0;
116341                        if (l) {
116342                          S = 0;
116343                          A = b;
116344                        } else {
116345                          S = o[a];
116346                          A = o[a + 1];
116347                        }
116348                        var T = b > 0, v = S >= 0;
116349                        if (t.MathUtils.signum(A) != t.MathUtils.signum(b) && Math.abs(A) <= 90) {
116350                          Math.abs(S) > 180 && (S += 360 * t.MathUtils.signum(S));
116351                          v = T;
116352                        }
116353                        y = b + S - S % 360;
116354                        v != T && (y += 360 * t.MathUtils.signum(S));
116355                        o[a] = y;
116356                      }
116357                      o[a + 1] = b;
116358                      _ += y * n;
116359                      u.rotation = _ - 360 * (16384 - (16384.499999999996 - _ / 360 | 0));
116360                    }
116361                  } else e.apply(i, 0, s, null, 1, r, t.MixDirection.mixIn);
116362                };
116363                e.prototype.queueEvents = function(t, e) {
116364                  var i = t.animationStart, s = t.animationEnd;
116365                  var n = s - i;
116366                  var r = t.trackLast % n;
116367                  var o = this.events;
116368                  var a = 0, l = o.length;
116369                  for (;a < l; a++) {
116370                    var h = o[a];
116371                    if (h.time < r) break;
116372                    h.time > s || this.queue.event(t, h);
116373                  }
116374                  (t.loop ? 0 == n || r > t.trackTime % n : e >= s && t.animationLast < s) && this.queue.complete(t);
116375                  for (;a < l; a++) {
116376                    o[a].time < i || this.queue.event(t, o[a]);
116377                  }
116378                };
116379                e.prototype.clearTracks = function() {
116380                  var t = this.queue.drainDisabled;
116381                  this.queue.drainDisabled = !0;
116382                  for (var e = 0, i = this.tracks.length; e < i; e++) this.clearTrack(e);
116383                  this.tracks.length = 0;
116384                  this.queue.drainDisabled = t;
116385                  this.queue.drain();
116386                };
116387                e.prototype.clearTrack = function(t) {
116388                  if (!(t >= this.tracks.length)) {
116389                    var e = this.tracks[t];
116390                    if (null != e) {
116391                      this.queue.end(e);
116392                      this.disposeNext(e);
116393                      var i = e;
116394                      for (;;) {
116395                        var s = i.mixingFrom;
116396                        if (null == s) break;
116397                        this.queue.end(s);
116398                        i.mixingFrom = null;
116399                        i.mixingTo = null;
116400                        i = s;
116401                      }
116402                      this.tracks[e.trackIndex] = null;
116403                      this.queue.drain();
116404                    }
116405                  }
116406                };
116407                e.prototype.setCurrent = function(t, e, i) {
116408                  var s = this.expandToIndex(t);
116409                  this.tracks[t] = e;
116410                  if (null != s) {
116411                    i && this.queue.interrupt(s);
116412                    e.mixingFrom = s;
116413                    s.mixingTo = e;
116414                    e.mixTime = 0;
116415                    null != s.mixingFrom && s.mixDuration > 0 && (e.interruptAlpha *= Math.min(1, s.mixTime / s.mixDuration));
116416                    s.timelinesRotation.length = 0;
116417                  }
116418                  this.queue.start(e);
116419                };
116420                e.prototype.setAnimation = function(t, e, i) {
116421                  var s = this.data.skeletonData.findAnimation(e);
116422                  if (null == s) throw new Error("Animation not found: " + e);
116423                  return this.setAnimationWith(t, s, i);
116424                };
116425                e.prototype.setAnimationWith = function(t, e, i) {
116426                  if (null == e) throw new Error("animation cannot be null.");
116427                  var s = !0;
116428                  var n = this.expandToIndex(t);
116429                  if (null != n) if (-1 == n.nextTrackLast) {
116430                    this.tracks[t] = n.mixingFrom;
116431                    this.queue.interrupt(n);
116432                    this.queue.end(n);
116433                    this.disposeNext(n);
116434                    n = n.mixingFrom;
116435                    s = !1;
116436                  } else this.disposeNext(n);
116437                  var r = this.trackEntry(t, e, i, n);
116438                  this.setCurrent(t, r, s);
116439                  this.queue.drain();
116440                  return r;
116441                };
116442                e.prototype.addAnimation = function(t, e, i, s) {
116443                  var n = this.data.skeletonData.findAnimation(e);
116444                  if (null == n) throw new Error("Animation not found: " + e);
116445                  return this.addAnimationWith(t, n, i, s);
116446                };
116447                e.prototype.addAnimationWith = function(t, e, i, s) {
116448                  if (null == e) throw new Error("animation cannot be null.");
116449                  var n = this.expandToIndex(t);
116450                  if (null != n) for (;null != n.next; ) n = n.next;
116451                  var r = this.trackEntry(t, e, i, n);
116452                  if (null == n) {
116453                    this.setCurrent(t, r, !0);
116454                    this.queue.drain();
116455                  } else {
116456                    n.next = r;
116457                    if (s <= 0) {
116458                      var o = n.animationEnd - n.animationStart;
116459                      if (0 != o) {
116460                        n.loop ? s += o * (1 + (n.trackTime / o | 0)) : s += Math.max(o, n.trackTime);
116461                        s -= this.data.getMix(n.animation, e);
116462                      } else s = n.trackTime;
116463                    }
116464                  }
116465                  r.delay = s;
116466                  return r;
116467                };
116468                e.prototype.setEmptyAnimation = function(t, i) {
116469                  var s = this.setAnimationWith(t, e.emptyAnimation, !1);
116470                  s.mixDuration = i;
116471                  s.trackEnd = i;
116472                  return s;
116473                };
116474                e.prototype.addEmptyAnimation = function(t, i, s) {
116475                  s <= 0 && (s -= i);
116476                  var n = this.addAnimationWith(t, e.emptyAnimation, !1, s);
116477                  n.mixDuration = i;
116478                  n.trackEnd = i;
116479                  return n;
116480                };
116481                e.prototype.setEmptyAnimations = function(t) {
116482                  var e = this.queue.drainDisabled;
116483                  this.queue.drainDisabled = !0;
116484                  for (var i = 0, s = this.tracks.length; i < s; i++) {
116485                    var n = this.tracks[i];
116486                    null != n && this.setEmptyAnimation(n.trackIndex, t);
116487                  }
116488                  this.queue.drainDisabled = e;
116489                  this.queue.drain();
116490                };
116491                e.prototype.expandToIndex = function(e) {
116492                  if (e < this.tracks.length) return this.tracks[e];
116493                  t.Utils.ensureArrayCapacity(this.tracks, e + 1, null);
116494                  this.tracks.length = e + 1;
116495                  return null;
116496                };
116497                e.prototype.trackEntry = function(t, e, i, s) {
116498                  var n = this.trackEntryPool.obtain();
116499                  n.trackIndex = t;
116500                  n.animation = e;
116501                  n.loop = i;
116502                  n.holdPrevious = !1;
116503                  n.eventThreshold = 0;
116504                  n.attachmentThreshold = 0;
116505                  n.drawOrderThreshold = 0;
116506                  n.animationStart = 0;
116507                  n.animationEnd = e.duration;
116508                  n.animationLast = -1;
116509                  n.nextAnimationLast = -1;
116510                  n.delay = 0;
116511                  n.trackTime = 0;
116512                  n.trackLast = -1;
116513                  n.nextTrackLast = -1;
116514                  n.trackEnd = Number.MAX_VALUE;
116515                  n.timeScale = 1;
116516                  n.alpha = 1;
116517                  n.interruptAlpha = 1;
116518                  n.mixTime = 0;
116519                  n.mixDuration = null == s ? 0 : this.data.getMix(s.animation, e);
116520                  return n;
116521                };
116522                e.prototype.disposeNext = function(t) {
116523                  var e = t.next;
116524                  for (;null != e; ) {
116525                    this.queue.dispose(e);
116526                    e = e.next;
116527                  }
116528                  t.next = null;
116529                };
116530                e.prototype._animationsChanged = function() {
116531                  this.animationsChanged = !1;
116532                  this.propertyIDs.clear();
116533                  for (var e = 0, i = this.tracks.length; e < i; e++) {
116534                    if (null != (s = this.tracks[e])) {
116535                      for (;null != s.mixingFrom; ) s = s.mixingFrom;
116536                      do {
116537                        null != s.mixingFrom && s.mixBlend == t.MixBlend.add || this.computeHold(s);
116538                        s = s.mixingTo;
116539                      } while (null != s);
116540                    }
116541                  }
116542                  this.propertyIDs.clear();
116543                  for (e = this.tracks.length - 1; e >= 0; e--) {
116544                    var s = this.tracks[e];
116545                    for (;null != s; ) {
116546                      this.computeNotLast(s);
116547                      s = s.mixingFrom;
116548                    }
116549                  }
116550                };
116551                e.prototype.computeHold = function(i) {
116552                  var s = i.mixingTo;
116553                  var n = i.animation.timelines;
116554                  var r = i.animation.timelines.length;
116555                  var o = t.Utils.setArraySize(i.timelineMode, r);
116556                  i.timelineHoldMix.length = 0;
116557                  var a = t.Utils.setArraySize(i.timelineHoldMix, r);
116558                  var l = this.propertyIDs;
116559                  if (null != s && s.holdPrevious) for (var h = 0; h < r; h++) {
116560                    l.add(n[h].getPropertyId());
116561                    o[h] = e.HOLD;
116562                  } else t: for (h = 0; h < r; h++) {
116563                    var c = n[h];
116564                    var u = c.getPropertyId();
116565                    if (l.add(u)) if (null == s || c instanceof t.AttachmentTimeline || c instanceof t.DrawOrderTimeline || c instanceof t.EventTimeline || !s.animation.hasTimeline(u)) o[h] = e.FIRST; else {
116566                      for (var _ = s.mixingTo; null != _; _ = _.mixingTo) if (!_.animation.hasTimeline(u)) {
116567                        if (i.mixDuration > 0) {
116568                          o[h] = e.HOLD_MIX;
116569                          a[h] = _;
116570                          continue t;
116571                        }
116572                        break;
116573                      }
116574                      o[h] = e.HOLD;
116575                    } else o[h] = e.SUBSEQUENT;
116576                  }
116577                };
116578                e.prototype.computeNotLast = function(i) {
116579                  var s = i.animation.timelines;
116580                  var n = i.animation.timelines.length;
116581                  var r = i.timelineMode;
116582                  var o = this.propertyIDs;
116583                  for (var a = 0; a < n; a++) if (s[a] instanceof t.AttachmentTimeline) {
116584                    var l = s[a];
116585                    o.add(l.slotIndex) || (r[a] |= e.NOT_LAST);
116586                  }
116587                };
116588                e.prototype.getCurrent = function(t) {
116589                  return t >= this.tracks.length ? null : this.tracks[t];
116590                };
116591                e.prototype.addListener = function(t) {
116592                  if (null == t) throw new Error("listener cannot be null.");
116593                  this.listeners.push(t);
116594                };
116595                e.prototype.removeListener = function(t) {
116596                  var e = this.listeners.indexOf(t);
116597                  e >= 0 && this.listeners.splice(e, 1);
116598                };
116599                e.prototype.clearListeners = function() {
116600                  this.listeners.length = 0;
116601                };
116602                e.prototype.clearListenerNotifications = function() {
116603                  this.queue.clear();
116604                };
116605                e.emptyAnimation = new t.Animation("<empty>", [], 0);
116606                e.SUBSEQUENT = 0;
116607                e.FIRST = 1;
116608                e.HOLD = 2;
116609                e.HOLD_MIX = 3;
116610                e.NOT_LAST = 4;
116611                return e;
116612              }();
116613              t.AnimationState = e;
116614              var i = function() {
116615                function e() {
116616                  this.mixBlend = t.MixBlend.replace;
116617                  this.timelineMode = new Array;
116618                  this.timelineHoldMix = new Array;
116619                  this.timelinesRotation = new Array;
116620                }
116621                e.prototype.reset = function() {
116622                  this.next = null;
116623                  this.mixingFrom = null;
116624                  this.mixingTo = null;
116625                  this.animation = null;
116626                  this.listener = null;
116627                  this.timelineMode.length = 0;
116628                  this.timelineHoldMix.length = 0;
116629                  this.timelinesRotation.length = 0;
116630                };
116631                e.prototype.getAnimationTime = function() {
116632                  if (this.loop) {
116633                    var t = this.animationEnd - this.animationStart;
116634                    return 0 == t ? this.animationStart : this.trackTime % t + this.animationStart;
116635                  }
116636                  return Math.min(this.trackTime + this.animationStart, this.animationEnd);
116637                };
116638                e.prototype.setAnimationLast = function(t) {
116639                  this.animationLast = t;
116640                  this.nextAnimationLast = t;
116641                };
116642                e.prototype.isComplete = function() {
116643                  return this.trackTime >= this.animationEnd - this.animationStart;
116644                };
116645                e.prototype.resetRotationDirections = function() {
116646                  this.timelinesRotation.length = 0;
116647                };
116648                return e;
116649              }();
116650              t.TrackEntry = i;
116651              var s = function() {
116652                function t(t) {
116653                  this.objects = [];
116654                  this.drainDisabled = !1;
116655                  this.animState = t;
116656                }
116657                t.prototype.start = function(t) {
116658                  this.objects.push(n.start);
116659                  this.objects.push(t);
116660                  this.animState.animationsChanged = !0;
116661                };
116662                t.prototype.interrupt = function(t) {
116663                  this.objects.push(n.interrupt);
116664                  this.objects.push(t);
116665                };
116666                t.prototype.end = function(t) {
116667                  this.objects.push(n.end);
116668                  this.objects.push(t);
116669                  this.animState.animationsChanged = !0;
116670                };
116671                t.prototype.dispose = function(t) {
116672                  this.objects.push(n.dispose);
116673                  this.objects.push(t);
116674                };
116675                t.prototype.complete = function(t) {
116676                  this.objects.push(n.complete);
116677                  this.objects.push(t);
116678                };
116679                t.prototype.event = function(t, e) {
116680                  this.objects.push(n.event);
116681                  this.objects.push(t);
116682                  this.objects.push(e);
116683                };
116684                t.prototype.drain = function() {
116685                  if (!this.drainDisabled) {
116686                    this.drainDisabled = !0;
116687                    var t = this.objects;
116688                    var e = this.animState.listeners;
116689                    for (var i = 0; i < t.length; i += 2) {
116690                      var s = t[i];
116691                      var r = t[i + 1];
116692                      switch (s) {
116693                       case n.start:
116694                        null != r.listener && r.listener.start && r.listener.start(r);
116695                        for (var o = 0; o < e.length; o++) e[o].start && e[o].start(r);
116696                        break;
116697
116698                       case n.interrupt:
116699                        null != r.listener && r.listener.interrupt && r.listener.interrupt(r);
116700                        for (o = 0; o < e.length; o++) e[o].interrupt && e[o].interrupt(r);
116701                        break;
116702
116703                       case n.end:
116704                        null != r.listener && r.listener.end && r.listener.end(r);
116705                        for (o = 0; o < e.length; o++) e[o].end && e[o].end(r);
116706
116707                       case n.dispose:
116708                        null != r.listener && r.listener.dispose && r.listener.dispose(r);
116709                        for (o = 0; o < e.length; o++) e[o].dispose && e[o].dispose(r);
116710                        this.animState.trackEntryPool.free(r);
116711                        break;
116712
116713                       case n.complete:
116714                        null != r.listener && r.listener.complete && r.listener.complete(r);
116715                        for (o = 0; o < e.length; o++) e[o].complete && e[o].complete(r);
116716                        break;
116717
116718                       case n.event:
116719                        var a = t[2 + i++];
116720                        null != r.listener && r.listener.event && r.listener.event(r, a);
116721                        for (o = 0; o < e.length; o++) e[o].event && e[o].event(r, a);
116722                      }
116723                    }
116724                    this.clear();
116725                    this.drainDisabled = !1;
116726                  }
116727                };
116728                t.prototype.clear = function() {
116729                  this.objects.length = 0;
116730                };
116731                return t;
116732              }();
116733              t.EventQueue = s;
116734              var n;
116735              !function(t) {
116736                t[t.start = 0] = "start";
116737                t[t.interrupt = 1] = "interrupt";
116738                t[t.end = 2] = "end";
116739                t[t.dispose = 3] = "dispose";
116740                t[t.complete = 4] = "complete";
116741                t[t.event = 5] = "event";
116742              }(n = t.EventType || (t.EventType = {}));
116743              var r = function() {
116744                function t() {}
116745                t.prototype.start = function(t) {};
116746                t.prototype.interrupt = function(t) {};
116747                t.prototype.end = function(t) {};
116748                t.prototype.dispose = function(t) {};
116749                t.prototype.complete = function(t) {};
116750                t.prototype.event = function(t, e) {};
116751                return t;
116752              }();
116753              t.AnimationStateAdapter = r;
116754            }(TMt || (TMt = {}));
116755            !function(t) {
116756              var e = function() {
116757                function t(t) {
116758                  this.animationToMixTime = {};
116759                  this.defaultMix = 0;
116760                  if (null == t) throw new Error("skeletonData cannot be null.");
116761                  this.skeletonData = t;
116762                }
116763                t.prototype.setMix = function(t, e, i) {
116764                  var s = this.skeletonData.findAnimation(t);
116765                  if (null == s) throw new Error("Animation not found: " + t);
116766                  var n = this.skeletonData.findAnimation(e);
116767                  if (null == n) throw new Error("Animation not found: " + e);
116768                  this.setMixWith(s, n, i);
116769                };
116770                t.prototype.setMixWith = function(t, e, i) {
116771                  if (null == t) throw new Error("from cannot be null.");
116772                  if (null == e) throw new Error("to cannot be null.");
116773                  var s = t.name + "." + e.name;
116774                  this.animationToMixTime[s] = i;
116775                };
116776                t.prototype.getMix = function(t, e) {
116777                  var i = t.name + "." + e.name;
116778                  var s = this.animationToMixTime[i];
116779                  return void 0 === s ? this.defaultMix : s;
116780                };
116781                return t;
116782              }();
116783              t.AnimationStateData = e;
116784            }(TMt || (TMt = {}));
116785            !function(t) {
116786              var e = function() {
116787                function e(t, e) {
116788                  void 0 === e && (e = "");
116789                  this.assets = {};
116790                  this.errors = {};
116791                  this.toLoad = 0;
116792                  this.loaded = 0;
116793                  this.textureLoader = t;
116794                  this.pathPrefix = e;
116795                }
116796                e.downloadText = function(t, e, i) {
116797                  var s = new XMLHttpRequest;
116798                  s.open("GET", t, !0);
116799                  s.onload = function() {
116800                    200 == s.status ? e(s.responseText) : i(s.status, s.responseText);
116801                  };
116802                  s.onerror = function() {
116803                    i(s.status, s.responseText);
116804                  };
116805                  s.send();
116806                };
116807                e.downloadBinary = function(t, e, i) {
116808                  var s = new XMLHttpRequest;
116809                  s.open("GET", t, !0);
116810                  s.responseType = "arraybuffer";
116811                  s.onload = function() {
116812                    200 == s.status ? e(new Uint8Array(s.response)) : i(s.status, s.responseText);
116813                  };
116814                  s.onerror = function() {
116815                    i(s.status, s.responseText);
116816                  };
116817                  s.send();
116818                };
116819                e.prototype.loadBinary = function(t, i, s) {
116820                  var n = this;
116821                  void 0 === i && (i = null);
116822                  void 0 === s && (s = null);
116823                  t = this.pathPrefix + t;
116824                  this.toLoad++;
116825                  e.downloadBinary(t, (function(e) {
116826                    n.assets[t] = e;
116827                    i && i(t, e);
116828                    n.toLoad--;
116829                    n.loaded++;
116830                  }), (function(e, i) {
116831                    n.errors[t] = "Couldn't load binary " + t + ": status " + status + ", " + i;
116832                    s && s(t, "Couldn't load binary " + t + ": status " + status + ", " + i);
116833                    n.toLoad--;
116834                    n.loaded++;
116835                  }));
116836                };
116837                e.prototype.loadText = function(t, i, s) {
116838                  var n = this;
116839                  void 0 === i && (i = null);
116840                  void 0 === s && (s = null);
116841                  t = this.pathPrefix + t;
116842                  this.toLoad++;
116843                  e.downloadText(t, (function(e) {
116844                    n.assets[t] = e;
116845                    i && i(t, e);
116846                    n.toLoad--;
116847                    n.loaded++;
116848                  }), (function(e, i) {
116849                    n.errors[t] = "Couldn't load text " + t + ": status " + status + ", " + i;
116850                    s && s(t, "Couldn't load text " + t + ": status " + status + ", " + i);
116851                    n.toLoad--;
116852                    n.loaded++;
116853                  }));
116854                };
116855                e.prototype.loadTexture = function(t, e, i) {
116856                  var s = this;
116857                  void 0 === e && (e = null);
116858                  void 0 === i && (i = null);
116859                  t = this.pathPrefix + t;
116860                  this.toLoad++;
116861                  var n = new Image;
116862                  n.crossOrigin = "anonymous";
116863                  n.onload = function(i) {
116864                    var r = s.textureLoader(n);
116865                    s.assets[t] = r;
116866                    s.toLoad--;
116867                    s.loaded++;
116868                    e && e(t, n);
116869                  };
116870                  n.onerror = function(e) {
116871                    s.errors[t] = "Couldn't load image " + t;
116872                    s.toLoad--;
116873                    s.loaded++;
116874                    i && i(t, "Couldn't load image " + t);
116875                  };
116876                  n.src = t;
116877                };
116878                e.prototype.loadTextureData = function(t, e, i, s) {
116879                  var n = this;
116880                  void 0 === i && (i = null);
116881                  void 0 === s && (s = null);
116882                  t = this.pathPrefix + t;
116883                  this.toLoad++;
116884                  var r = new Image;
116885                  r.onload = function(e) {
116886                    var s = n.textureLoader(r);
116887                    n.assets[t] = s;
116888                    n.toLoad--;
116889                    n.loaded++;
116890                    i && i(t, r);
116891                  };
116892                  r.onerror = function(e) {
116893                    n.errors[t] = "Couldn't load image " + t;
116894                    n.toLoad--;
116895                    n.loaded++;
116896                    s && s(t, "Couldn't load image " + t);
116897                  };
116898                  r.src = e;
116899                };
116900                e.prototype.loadTextureAtlas = function(i, s, n) {
116901                  var r = this;
116902                  void 0 === s && (s = null);
116903                  void 0 === n && (n = null);
116904                  var o = i.lastIndexOf("/") >= 0 ? i.substring(0, i.lastIndexOf("/")) : "";
116905                  i = this.pathPrefix + i;
116906                  this.toLoad++;
116907                  e.downloadText(i, (function(e) {
116908                    var a = {
116909                      count: 0
116910                    };
116911                    var l = new Array;
116912                    try {
116913                      new t.TextureAtlas(e, (function(e) {
116914                        l.push(o + "/" + e);
116915                        var i = document.createElement("img");
116916                        i.width = 16;
116917                        i.height = 16;
116918                        return new t.FakeTexture(i);
116919                      }));
116920                    } catch (t) {
116921                      var h = t;
116922                      r.errors[i] = "Couldn't load texture atlas " + i + ": " + h.message;
116923                      n && n(i, "Couldn't load texture atlas " + i + ": " + h.message);
116924                      r.toLoad--;
116925                      r.loaded++;
116926                      return;
116927                    }
116928                    var c = function(h) {
116929                      var c = !1;
116930                      r.loadTexture(h, (function(h, u) {
116931                        a.count++;
116932                        if (a.count == l.length) if (c) {
116933                          r.errors[i] = "Couldn't load texture atlas page " + h + "} of atlas " + i;
116934                          n && n(i, "Couldn't load texture atlas page " + h + " of atlas " + i);
116935                          r.toLoad--;
116936                          r.loaded++;
116937                        } else try {
116938                          var _ = new t.TextureAtlas(e, (function(t) {
116939                            return r.get(o + "/" + t);
116940                          }));
116941                          r.assets[i] = _;
116942                          s && s(i, _);
116943                          r.toLoad--;
116944                          r.loaded++;
116945                        } catch (t) {
116946                          var d = t;
116947                          r.errors[i] = "Couldn't load texture atlas " + i + ": " + d.message;
116948                          n && n(i, "Couldn't load texture atlas " + i + ": " + d.message);
116949                          r.toLoad--;
116950                          r.loaded++;
116951                        }
116952                      }), (function(t, e) {
116953                        c = !0;
116954                        a.count++;
116955                        if (a.count == l.length) {
116956                          r.errors[i] = "Couldn't load texture atlas page " + t + "} of atlas " + i;
116957                          n && n(i, "Couldn't load texture atlas page " + t + " of atlas " + i);
116958                          r.toLoad--;
116959                          r.loaded++;
116960                        }
116961                      }));
116962                    };
116963                    for (var u = 0, _ = l; u < _.length; u++) {
116964                      c(_[u]);
116965                    }
116966                  }), (function(t, e) {
116967                    r.errors[i] = "Couldn't load texture atlas " + i + ": status " + status + ", " + e;
116968                    n && n(i, "Couldn't load texture atlas " + i + ": status " + status + ", " + e);
116969                    r.toLoad--;
116970                    r.loaded++;
116971                  }));
116972                };
116973                e.prototype.get = function(t) {
116974                  t = this.pathPrefix + t;
116975                  return this.assets[t];
116976                };
116977                e.prototype.remove = function(t) {
116978                  t = this.pathPrefix + t;
116979                  var e = this.assets[t];
116980                  e.dispose && e.dispose();
116981                  this.assets[t] = null;
116982                };
116983                e.prototype.removeAll = function() {
116984                  for (var t in this.assets) {
116985                    var e = this.assets[t];
116986                    e.dispose && e.dispose();
116987                  }
116988                  this.assets = {};
116989                };
116990                e.prototype.isLoadingComplete = function() {
116991                  return 0 == this.toLoad;
116992                };
116993                e.prototype.getToLoad = function() {
116994                  return this.toLoad;
116995                };
116996                e.prototype.getLoaded = function() {
116997                  return this.loaded;
116998                };
116999                e.prototype.dispose = function() {
117000                  this.removeAll();
117001                };
117002                e.prototype.hasErrors = function() {
117003                  return Object.keys(this.errors).length > 0;
117004                };
117005                e.prototype.getErrors = function() {
117006                  return this.errors;
117007                };
117008                return e;
117009              }();
117010              t.AssetManager = e;
117011            }(TMt || (TMt = {}));
117012            !function(t) {
117013              var e = function() {
117014                function e(t) {
117015                  this.atlas = t;
117016                }
117017                e.prototype.newRegionAttachment = function(e, i, s) {
117018                  var n = this.atlas.findRegion(s);
117019                  if (null == n) return null;
117020                  n.renderObject = n;
117021                  var r = new t.RegionAttachment(i);
117022                  r.setRegion(n);
117023                  return r;
117024                };
117025                e.prototype.newMeshAttachment = function(e, i, s) {
117026                  var n = this.atlas.findRegion(s);
117027                  if (null == n) return null;
117028                  n.renderObject = n;
117029                  var r = new t.MeshAttachment(i);
117030                  r.region = n;
117031                  return r;
117032                };
117033                e.prototype.newBoundingBoxAttachment = function(e, i) {
117034                  return new t.BoundingBoxAttachment(i);
117035                };
117036                e.prototype.newPathAttachment = function(e, i) {
117037                  return new t.PathAttachment(i);
117038                };
117039                e.prototype.newPointAttachment = function(e, i) {
117040                  return new t.PointAttachment(i);
117041                };
117042                e.prototype.newClippingAttachment = function(e, i) {
117043                  return new t.ClippingAttachment(i);
117044                };
117045                return e;
117046              }();
117047              t.AtlasAttachmentLoader = e;
117048            }(TMt || (TMt = {}));
117049            !function(t) {
117050              !function(t) {
117051                t[t.Normal = 0] = "Normal";
117052                t[t.Additive = 1] = "Additive";
117053                t[t.Multiply = 2] = "Multiply";
117054                t[t.Screen = 3] = "Screen";
117055              }(t.BlendMode || (t.BlendMode = {}));
117056            }(TMt || (TMt = {}));
117057            !function(t) {
117058              var e = function() {
117059                function e(t, e, i) {
117060                  this.children = new Array;
117061                  this.x = 0;
117062                  this.y = 0;
117063                  this.rotation = 0;
117064                  this.scaleX = 0;
117065                  this.scaleY = 0;
117066                  this.shearX = 0;
117067                  this.shearY = 0;
117068                  this.ax = 0;
117069                  this.ay = 0;
117070                  this.arotation = 0;
117071                  this.ascaleX = 0;
117072                  this.ascaleY = 0;
117073                  this.ashearX = 0;
117074                  this.ashearY = 0;
117075                  this.appliedValid = !1;
117076                  this.a = 0;
117077                  this.b = 0;
117078                  this.c = 0;
117079                  this.d = 0;
117080                  this.worldY = 0;
117081                  this.worldX = 0;
117082                  this.sorted = !1;
117083                  this.active = !1;
117084                  if (null == t) throw new Error("data cannot be null.");
117085                  if (null == e) throw new Error("skeleton cannot be null.");
117086                  this.data = t;
117087                  this.skeleton = e;
117088                  this.parent = i;
117089                  this.setToSetupPose();
117090                }
117091                e.prototype.isActive = function() {
117092                  return this.active;
117093                };
117094                e.prototype.update = function() {
117095                  this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
117096                };
117097                e.prototype.updateWorldTransform = function() {
117098                  this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
117099                };
117100                e.prototype.updateWorldTransformWith = function(e, i, s, n, r, o, a) {
117101                  this.ax = e;
117102                  this.ay = i;
117103                  this.arotation = s;
117104                  this.ascaleX = n;
117105                  this.ascaleY = r;
117106                  this.ashearX = o;
117107                  this.ashearY = a;
117108                  this.appliedValid = !0;
117109                  var l = this.parent;
117110                  if (null != l) {
117111                    var h = l.a, c = l.b, u = l.c, _ = l.d;
117112                    this.worldX = h * e + c * i + l.worldX;
117113                    this.worldY = u * e + _ * i + l.worldY;
117114                    switch (this.data.transformMode) {
117115                     case t.TransformMode.Normal:
117116                      I = s + 90 + a;
117117                      var d = t.MathUtils.cosDeg(s + o) * n;
117118                      var p = t.MathUtils.cosDeg(I) * r;
117119                      var m = t.MathUtils.sinDeg(s + o) * n;
117120                      var f = t.MathUtils.sinDeg(I) * r;
117121                      this.a = h * d + c * m;
117122                      this.b = h * p + c * f;
117123                      this.c = u * d + _ * m;
117124                      this.d = u * p + _ * f;
117125                      return;
117126
117127                     case t.TransformMode.OnlyTranslation:
117128                      I = s + 90 + a;
117129                      this.a = t.MathUtils.cosDeg(s + o) * n;
117130                      this.b = t.MathUtils.cosDeg(I) * r;
117131                      this.c = t.MathUtils.sinDeg(s + o) * n;
117132                      this.d = t.MathUtils.sinDeg(I) * r;
117133                      break;
117134
117135                     case t.TransformMode.NoRotationOrReflection:
117136                      var g = 0;
117137                      if ((E = h * h + u * u) > 1e-4) {
117138                        c = u * (E = Math.abs(h * _ - c * u) / E);
117139                        _ = h * E;
117140                        g = Math.atan2(u, h) * t.MathUtils.radDeg;
117141                      } else {
117142                        h = 0;
117143                        u = 0;
117144                        g = 90 - Math.atan2(_, c) * t.MathUtils.radDeg;
117145                      }
117146                      var y = s + o - g;
117147                      var b = s + a - g + 90;
117148                      d = t.MathUtils.cosDeg(y) * n;
117149                      p = t.MathUtils.cosDeg(b) * r;
117150                      m = t.MathUtils.sinDeg(y) * n;
117151                      f = t.MathUtils.sinDeg(b) * r;
117152                      this.a = h * d - c * m;
117153                      this.b = h * p - c * f;
117154                      this.c = u * d + _ * m;
117155                      this.d = u * p + _ * f;
117156                      break;
117157
117158                     case t.TransformMode.NoScale:
117159                     case t.TransformMode.NoScaleOrReflection:
117160                      var S = t.MathUtils.cosDeg(s);
117161                      var A = t.MathUtils.sinDeg(s);
117162                      var T = (h * S + c * A) / this.skeleton.scaleX;
117163                      var v = (u * S + _ * A) / this.skeleton.scaleY;
117164                      var E;
117165                      (E = Math.sqrt(T * T + v * v)) > 1e-5 && (E = 1 / E);
117166                      T *= E;
117167                      v *= E;
117168                      E = Math.sqrt(T * T + v * v);
117169                      this.data.transformMode == t.TransformMode.NoScale && h * _ - c * u < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0) && (E = -E);
117170                      var C = Math.PI / 2 + Math.atan2(v, T);
117171                      var x = Math.cos(C) * E;
117172                      var w = Math.sin(C) * E;
117173                      d = t.MathUtils.cosDeg(o) * n;
117174                      p = t.MathUtils.cosDeg(90 + a) * r;
117175                      m = t.MathUtils.sinDeg(o) * n;
117176                      f = t.MathUtils.sinDeg(90 + a) * r;
117177                      this.a = T * d + x * m;
117178                      this.b = T * p + x * f;
117179                      this.c = v * d + w * m;
117180                      this.d = v * p + w * f;
117181                    }
117182                    this.a *= this.skeleton.scaleX;
117183                    this.b *= this.skeleton.scaleX;
117184                    this.c *= this.skeleton.scaleY;
117185                    this.d *= this.skeleton.scaleY;
117186                  } else {
117187                    var R = this.skeleton;
117188                    var I = s + 90 + a;
117189                    var M = R.scaleX;
117190                    var B = R.scaleY;
117191                    this.a = t.MathUtils.cosDeg(s + o) * n * M;
117192                    this.b = t.MathUtils.cosDeg(I) * r * M;
117193                    this.c = t.MathUtils.sinDeg(s + o) * n * B;
117194                    this.d = t.MathUtils.sinDeg(I) * r * B;
117195                    this.worldX = e * M + R.x;
117196                    this.worldY = i * B + R.y;
117197                  }
117198                };
117199                e.prototype.setToSetupPose = function() {
117200                  var t = this.data;
117201                  this.x = t.x;
117202                  this.y = t.y;
117203                  this.rotation = t.rotation;
117204                  this.scaleX = t.scaleX;
117205                  this.scaleY = t.scaleY;
117206                  this.shearX = t.shearX;
117207                  this.shearY = t.shearY;
117208                };
117209                e.prototype.getWorldRotationX = function() {
117210                  return Math.atan2(this.c, this.a) * t.MathUtils.radDeg;
117211                };
117212                e.prototype.getWorldRotationY = function() {
117213                  return Math.atan2(this.d, this.b) * t.MathUtils.radDeg;
117214                };
117215                e.prototype.getWorldScaleX = function() {
117216                  return Math.sqrt(this.a * this.a + this.c * this.c);
117217                };
117218                e.prototype.getWorldScaleY = function() {
117219                  return Math.sqrt(this.b * this.b + this.d * this.d);
117220                };
117221                e.prototype.updateAppliedTransform = function() {
117222                  this.appliedValid = !0;
117223                  var e = this.parent;
117224                  if (null != e) {
117225                    var i = e.a, s = e.b, n = e.c, r = e.d;
117226                    var o = 1 / (i * r - s * n);
117227                    var a = this.worldX - e.worldX, l = this.worldY - e.worldY;
117228                    this.ax = a * r * o - l * s * o;
117229                    this.ay = l * i * o - a * n * o;
117230                    var h = o * r;
117231                    var c = o * i;
117232                    var u = o * s;
117233                    var _ = o * n;
117234                    var d = h * this.a - u * this.c;
117235                    var p = h * this.b - u * this.d;
117236                    var m = c * this.c - _ * this.a;
117237                    var f = c * this.d - _ * this.b;
117238                    this.ashearX = 0;
117239                    this.ascaleX = Math.sqrt(d * d + m * m);
117240                    if (this.ascaleX > 1e-4) {
117241                      var g = d * f - p * m;
117242                      this.ascaleY = g / this.ascaleX;
117243                      this.ashearY = Math.atan2(d * p + m * f, g) * t.MathUtils.radDeg;
117244                      this.arotation = Math.atan2(m, d) * t.MathUtils.radDeg;
117245                    } else {
117246                      this.ascaleX = 0;
117247                      this.ascaleY = Math.sqrt(p * p + f * f);
117248                      this.ashearY = 0;
117249                      this.arotation = 90 - Math.atan2(f, p) * t.MathUtils.radDeg;
117250                    }
117251                  } else {
117252                    this.ax = this.worldX;
117253                    this.ay = this.worldY;
117254                    this.arotation = Math.atan2(this.c, this.a) * t.MathUtils.radDeg;
117255                    this.ascaleX = Math.sqrt(this.a * this.a + this.c * this.c);
117256                    this.ascaleY = Math.sqrt(this.b * this.b + this.d * this.d);
117257                    this.ashearX = 0;
117258                    this.ashearY = Math.atan2(this.a * this.b + this.c * this.d, this.a * this.d - this.b * this.c) * t.MathUtils.radDeg;
117259                  }
117260                };
117261                e.prototype.worldToLocal = function(t) {
117262                  var e = this.a, i = this.b, s = this.c, n = this.d;
117263                  var r = 1 / (e * n - i * s);
117264                  var o = t.x - this.worldX, a = t.y - this.worldY;
117265                  t.x = o * n * r - a * i * r;
117266                  t.y = a * e * r - o * s * r;
117267                  return t;
117268                };
117269                e.prototype.localToWorld = function(t) {
117270                  var e = t.x, i = t.y;
117271                  t.x = e * this.a + i * this.b + this.worldX;
117272                  t.y = e * this.c + i * this.d + this.worldY;
117273                  return t;
117274                };
117275                e.prototype.worldToLocalRotation = function(e) {
117276                  var i = t.MathUtils.sinDeg(e), s = t.MathUtils.cosDeg(e);
117277                  return Math.atan2(this.a * i - this.c * s, this.d * s - this.b * i) * t.MathUtils.radDeg + this.rotation - this.shearX;
117278                };
117279                e.prototype.localToWorldRotation = function(e) {
117280                  e -= this.rotation - this.shearX;
117281                  var i = t.MathUtils.sinDeg(e), s = t.MathUtils.cosDeg(e);
117282                  return Math.atan2(s * this.c + i * this.d, s * this.a + i * this.b) * t.MathUtils.radDeg;
117283                };
117284                e.prototype.rotateWorld = function(e) {
117285                  var i = this.a, s = this.b, n = this.c, r = this.d;
117286                  var o = t.MathUtils.cosDeg(e), a = t.MathUtils.sinDeg(e);
117287                  this.a = o * i - a * n;
117288                  this.b = o * s - a * r;
117289                  this.c = a * i + o * n;
117290                  this.d = a * s + o * r;
117291                  this.appliedValid = !1;
117292                };
117293                return e;
117294              }();
117295              t.Bone = e;
117296            }(TMt || (TMt = {}));
117297            !function(t) {
117298              var e = function(e, s, n) {
117299                this.x = 0;
117300                this.y = 0;
117301                this.rotation = 0;
117302                this.scaleX = 1;
117303                this.scaleY = 1;
117304                this.shearX = 0;
117305                this.shearY = 0;
117306                this.transformMode = i.Normal;
117307                this.skinRequired = !1;
117308                this.color = new t.Color;
117309                if (e < 0) throw new Error("index must be >= 0.");
117310                if (null == s) throw new Error("name cannot be null.");
117311                this.index = e;
117312                this.name = s;
117313                this.parent = n;
117314              };
117315              t.BoneData = e;
117316              var i;
117317              !function(t) {
117318                t[t.Normal = 0] = "Normal";
117319                t[t.OnlyTranslation = 1] = "OnlyTranslation";
117320                t[t.NoRotationOrReflection = 2] = "NoRotationOrReflection";
117321                t[t.NoScale = 3] = "NoScale";
117322                t[t.NoScaleOrReflection = 4] = "NoScaleOrReflection";
117323              }(i = t.TransformMode || (t.TransformMode = {}));
117324            }(TMt || (TMt = {}));
117325            !function(t) {
117326              var e = function(t, e, i) {
117327                this.name = t;
117328                this.order = e;
117329                this.skinRequired = i;
117330              };
117331              t.ConstraintData = e;
117332            }(TMt || (TMt = {}));
117333            !function(t) {
117334              var e = function(t, e) {
117335                if (null == e) throw new Error("data cannot be null.");
117336                this.time = t;
117337                this.data = e;
117338              };
117339              t.Event = e;
117340            }(TMt || (TMt = {}));
117341            !function(t) {
117342              var e = function(t) {
117343                this.name = t;
117344              };
117345              t.EventData = e;
117346            }(TMt || (TMt = {}));
117347            !function(t) {
117348              var e = function() {
117349                function e(t, e) {
117350                  this.bendDirection = 0;
117351                  this.compress = !1;
117352                  this.stretch = !1;
117353                  this.mix = 1;
117354                  this.softness = 0;
117355                  this.active = !1;
117356                  if (null == t) throw new Error("data cannot be null.");
117357                  if (null == e) throw new Error("skeleton cannot be null.");
117358                  this.data = t;
117359                  this.mix = t.mix;
117360                  this.softness = t.softness;
117361                  this.bendDirection = t.bendDirection;
117362                  this.compress = t.compress;
117363                  this.stretch = t.stretch;
117364                  this.bones = new Array;
117365                  for (var i = 0; i < t.bones.length; i++) this.bones.push(e.findBone(t.bones[i].name));
117366                  this.target = e.findBone(t.target.name);
117367                }
117368                e.prototype.isActive = function() {
117369                  return this.active;
117370                };
117371                e.prototype.apply = function() {
117372                  this.update();
117373                };
117374                e.prototype.update = function() {
117375                  var t = this.target;
117376                  var e = this.bones;
117377                  switch (e.length) {
117378                   case 1:
117379                    this.apply1(e[0], t.worldX, t.worldY, this.compress, this.stretch, this.data.uniform, this.mix);
117380                    break;
117381
117382                   case 2:
117383                    this.apply2(e[0], e[1], t.worldX, t.worldY, this.bendDirection, this.stretch, this.softness, this.mix);
117384                  }
117385                };
117386                e.prototype.apply1 = function(e, i, s, n, r, o, a) {
117387                  e.appliedValid || e.updateAppliedTransform();
117388                  var l = e.parent;
117389                  var h = 1 / (l.a * l.d - l.b * l.c);
117390                  var c = i - l.worldX, u = s - l.worldY;
117391                  var _ = (c * l.d - u * l.b) * h - e.ax, d = (u * l.a - c * l.c) * h - e.ay;
117392                  var p = Math.atan2(d, _) * t.MathUtils.radDeg - e.ashearX - e.arotation;
117393                  e.ascaleX < 0 && (p += 180);
117394                  p > 180 ? p -= 360 : p < -180 && (p += 360);
117395                  var m = e.ascaleX, f = e.ascaleY;
117396                  if (n || r) {
117397                    var g = e.data.length * m, y = Math.sqrt(_ * _ + d * d);
117398                    if (n && y < g || r && y > g && g > 1e-4) {
117399                      var b = (y / g - 1) * a + 1;
117400                      m *= b;
117401                      o && (f *= b);
117402                    }
117403                  }
117404                  e.updateWorldTransformWith(e.ax, e.ay, e.arotation + p * a, m, f, e.ashearX, e.ashearY);
117405                };
117406                e.prototype.apply2 = function(e, i, s, n, r, o, a, l) {
117407                  if (0 != l) {
117408                    e.appliedValid || e.updateAppliedTransform();
117409                    i.appliedValid || i.updateAppliedTransform();
117410                    var h = e.ax, c = e.ay, u = e.ascaleX, _ = u, d = e.ascaleY, p = i.ascaleX;
117411                    var m = 0, f = 0, g = 0;
117412                    if (u < 0) {
117413                      u = -u;
117414                      m = 180;
117415                      g = -1;
117416                    } else {
117417                      m = 0;
117418                      g = 1;
117419                    }
117420                    if (d < 0) {
117421                      d = -d;
117422                      g = -g;
117423                    }
117424                    if (p < 0) {
117425                      p = -p;
117426                      f = 180;
117427                    } else f = 0;
117428                    var y = i.ax, b = 0, S = 0, A = 0, T = e.a, v = e.b, E = e.c, C = e.d;
117429                    var x = Math.abs(u - d) <= 1e-4;
117430                    if (x) {
117431                      S = T * y + v * (b = i.ay) + e.worldX;
117432                      A = E * y + C * b + e.worldY;
117433                    } else {
117434                      b = 0;
117435                      S = T * y + e.worldX;
117436                      A = E * y + e.worldY;
117437                    }
117438                    var w = e.parent;
117439                    T = w.a;
117440                    v = w.b;
117441                    E = w.c;
117442                    var R = 1 / (T * (C = w.d) - v * E), I = S - w.worldX, M = A - w.worldY;
117443                    var B = (I * C - M * v) * R - h, D = (M * T - I * E) * R - c;
117444                    var P, O, N = Math.sqrt(B * B + D * D), L = i.data.length * p;
117445                    if (N < 1e-4) {
117446                      this.apply1(e, s, n, !1, o, !1, l);
117447                      i.updateWorldTransformWith(y, b, 0, i.ascaleX, i.ascaleY, i.ashearX, i.ashearY);
117448                    } else {
117449                      var F = ((I = s - w.worldX) * C - (M = n - w.worldY) * v) * R - h, V = (M * T - I * E) * R - c;
117450                      var k = F * F + V * V;
117451                      if (0 != a) {
117452                        a *= u * (p + 1) / 2;
117453                        var U = Math.sqrt(k), G = U - N - L * u + a;
117454                        if (G > 0) {
117455                          var z = Math.min(1, G / (2 * a)) - 1;
117456                          k = (F -= (z = (G - a * (1 - z * z)) / U) * F) * F + (V -= z * V) * V;
117457                        }
117458                      }
117459                      t: if (x) {
117460                        var H = (k - N * N - (L *= u) * L) / (2 * N * L);
117461                        if (H < -1) H = -1; else if (H > 1) {
117462                          H = 1;
117463                          o && (_ *= (Math.sqrt(k) / (N + L) - 1) * l + 1);
117464                        }
117465                        O = Math.acos(H) * r;
117466                        T = N + L * H;
117467                        v = L * Math.sin(O);
117468                        P = Math.atan2(V * T - F * v, F * T + V * v);
117469                      } else {
117470                        var j = (T = u * L) * T, X = (v = d * L) * v, W = Math.atan2(V, F);
117471                        var Y = -2 * X * N, q = X - j;
117472                        if ((C = Y * Y - 4 * q * (E = X * N * N + j * k - j * X)) >= 0) {
117473                          var K = Math.sqrt(C);
117474                          Y < 0 && (K = -K);
117475                          var J = (K = -(Y + K) / 2) / q, Z = E / K;
117476                          var Q = Math.abs(J) < Math.abs(Z) ? J : Z;
117477                          if (Q * Q <= k) {
117478                            M = Math.sqrt(k - Q * Q) * r;
117479                            P = W - Math.atan2(M, Q);
117480                            O = Math.atan2(M / d, (Q - N) / u);
117481                            break t;
117482                          }
117483                        }
117484                        var $ = t.MathUtils.PI, tt = N - T, et = tt * tt, it = 0;
117485                        var st = 0, nt = N + T, rt = nt * nt, ot = 0;
117486                        if ((E = -T * N / (j - X)) >= -1 && E <= 1) {
117487                          E = Math.acos(E);
117488                          if ((C = (I = T * Math.cos(E) + N) * I + (M = v * Math.sin(E)) * M) < et) {
117489                            $ = E;
117490                            et = C;
117491                            tt = I;
117492                            it = M;
117493                          }
117494                          if (C > rt) {
117495                            st = E;
117496                            rt = C;
117497                            nt = I;
117498                            ot = M;
117499                          }
117500                        }
117501                        if (k <= (et + rt) / 2) {
117502                          P = W - Math.atan2(it * r, tt);
117503                          O = $ * r;
117504                        } else {
117505                          P = W - Math.atan2(ot * r, nt);
117506                          O = st * r;
117507                        }
117508                      }
117509                      var at = Math.atan2(b, y) * g;
117510                      var lt = e.arotation;
117511                      (P = (P - at) * t.MathUtils.radDeg + m - lt) > 180 ? P -= 360 : P < -180 && (P += 360);
117512                      e.updateWorldTransformWith(h, c, lt + P * l, _, e.ascaleY, 0, 0);
117513                      lt = i.arotation;
117514                      (O = ((O + at) * t.MathUtils.radDeg - i.ashearX) * g + f - lt) > 180 ? O -= 360 : O < -180 && (O += 360);
117515                      i.updateWorldTransformWith(y, b, lt + O * l, i.ascaleX, i.ascaleY, i.ashearX, i.ashearY);
117516                    }
117517                  } else i.updateWorldTransform();
117518                };
117519                return e;
117520              }();
117521              t.IkConstraint = e;
117522            }(TMt || (TMt = {}));
117523            !function(t) {
117524              var e = function(t) {
117525                AMt(e, t);
117526                function e(e) {
117527                  var i = t.call(this, e, 0, !1) || this;
117528                  i.bones = new Array;
117529                  i.bendDirection = 1;
117530                  i.compress = !1;
117531                  i.stretch = !1;
117532                  i.uniform = !1;
117533                  i.mix = 1;
117534                  i.softness = 0;
117535                  return i;
117536                }
117537                return e;
117538              }(t.ConstraintData);
117539              t.IkConstraintData = e;
117540            }(TMt || (TMt = {}));
117541            !function(t) {
117542              var e = function() {
117543                function e(t, e) {
117544                  this.position = 0;
117545                  this.spacing = 0;
117546                  this.rotateMix = 0;
117547                  this.translateMix = 0;
117548                  this.spaces = new Array;
117549                  this.positions = new Array;
117550                  this.world = new Array;
117551                  this.curves = new Array;
117552                  this.lengths = new Array;
117553                  this.segments = new Array;
117554                  this.active = !1;
117555                  if (null == t) throw new Error("data cannot be null.");
117556                  if (null == e) throw new Error("skeleton cannot be null.");
117557                  this.data = t;
117558                  this.bones = new Array;
117559                  for (var i = 0, s = t.bones.length; i < s; i++) this.bones.push(e.findBone(t.bones[i].name));
117560                  this.target = e.findSlot(t.target.name);
117561                  this.position = t.position;
117562                  this.spacing = t.spacing;
117563                  this.rotateMix = t.rotateMix;
117564                  this.translateMix = t.translateMix;
117565                }
117566                e.prototype.isActive = function() {
117567                  return this.active;
117568                };
117569                e.prototype.apply = function() {
117570                  this.update();
117571                };
117572                e.prototype.update = function() {
117573                  var i = this.target.getAttachment();
117574                  if (i instanceof t.PathAttachment) {
117575                    var s = this.rotateMix, n = this.translateMix;
117576                    var r = s > 0;
117577                    if (n > 0 || r) {
117578                      var o = this.data;
117579                      var a = o.spacingMode == t.SpacingMode.Percent;
117580                      var l = o.rotateMode;
117581                      var h = l == t.RotateMode.Tangent, c = l == t.RotateMode.ChainScale;
117582                      var u = this.bones.length, _ = h ? u : u + 1;
117583                      var d = this.bones;
117584                      var p = t.Utils.setArraySize(this.spaces, _), m = null;
117585                      var f = this.spacing;
117586                      if (c || !a) {
117587                        c && (m = t.Utils.setArraySize(this.lengths, u));
117588                        var g = o.spacingMode == t.SpacingMode.Length;
117589                        for (var y = 0, b = _ - 1; y < b; ) {
117590                          var S = (B = d[y]).data.length;
117591                          if (S < e.epsilon) {
117592                            c && (m[y] = 0);
117593                            p[++y] = 0;
117594                          } else if (a) {
117595                            if (c) {
117596                              var A = S * B.a, T = S * B.c;
117597                              var v = Math.sqrt(A * A + T * T);
117598                              m[y] = v;
117599                            }
117600                            p[++y] = f;
117601                          } else {
117602                            A = S * B.a, T = S * B.c;
117603                            var E = Math.sqrt(A * A + T * T);
117604                            c && (m[y] = E);
117605                            p[++y] = (g ? S + f : f) * E / S;
117606                          }
117607                        }
117608                      } else for (y = 1; y < _; y++) p[y] = f;
117609                      var C = this.computeWorldPositions(i, _, h, o.positionMode == t.PositionMode.Percent, a);
117610                      var x = C[0], w = C[1], R = o.offsetRotation;
117611                      var I = !1;
117612                      if (0 == R) I = l == t.RotateMode.Chain; else {
117613                        I = !1;
117614                        R *= (M = this.target.bone).a * M.d - M.b * M.c > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad;
117615                      }
117616                      y = 0;
117617                      for (var M = 3; y < u; y++, M += 3) {
117618                        var B;
117619                        (B = d[y]).worldX += (x - B.worldX) * n;
117620                        B.worldY += (w - B.worldY) * n;
117621                        var D = (A = C[M]) - x, P = (T = C[M + 1]) - w;
117622                        if (c) {
117623                          var O = m[y];
117624                          if (0 != O) {
117625                            var N = (Math.sqrt(D * D + P * P) / O - 1) * s + 1;
117626                            B.a *= N;
117627                            B.c *= N;
117628                          }
117629                        }
117630                        x = A;
117631                        w = T;
117632                        if (r) {
117633                          var L = B.a, F = B.b, V = B.c, k = B.d, U = 0, G = 0, z = 0;
117634                          U = h ? C[M - 1] : 0 == p[y + 1] ? C[M + 2] : Math.atan2(P, D);
117635                          U -= Math.atan2(V, L);
117636                          if (I) {
117637                            G = Math.cos(U);
117638                            z = Math.sin(U);
117639                            var H = B.data.length;
117640                            x += (H * (G * L - z * V) - D) * s;
117641                            w += (H * (z * L + G * V) - P) * s;
117642                          } else U += R;
117643                          U > t.MathUtils.PI ? U -= t.MathUtils.PI2 : U < -t.MathUtils.PI && (U += t.MathUtils.PI2);
117644                          U *= s;
117645                          G = Math.cos(U);
117646                          z = Math.sin(U);
117647                          B.a = G * L - z * V;
117648                          B.b = G * F - z * k;
117649                          B.c = z * L + G * V;
117650                          B.d = z * F + G * k;
117651                        }
117652                        B.appliedValid = !1;
117653                      }
117654                    }
117655                  }
117656                };
117657                e.prototype.computeWorldPositions = function(i, s, n, r, o) {
117658                  var a = this.target;
117659                  var l = this.position;
117660                  var h = this.spaces, c = t.Utils.setArraySize(this.positions, 3 * s + 2), u = null;
117661                  var _ = i.closed;
117662                  var d = i.worldVerticesLength, p = d / 6, m = e.NONE;
117663                  if (!i.constantSpeed) {
117664                    var f = i.lengths;
117665                    var g = f[p -= _ ? 1 : 2];
117666                    r && (l *= g);
117667                    if (o) for (var y = 1; y < s; y++) h[y] *= g;
117668                    u = t.Utils.setArraySize(this.world, 8);
117669                    y = 0;
117670                    for (var b = 0, S = 0; y < s; y++, b += 3) {
117671                      var A = l += X = h[y];
117672                      if (_) {
117673                        (A %= g) < 0 && (A += g);
117674                        S = 0;
117675                      } else {
117676                        if (A < 0) {
117677                          if (m != e.BEFORE) {
117678                            m = e.BEFORE;
117679                            i.computeWorldVertices(a, 2, 4, u, 0, 2);
117680                          }
117681                          this.addBeforePosition(A, u, 0, c, b);
117682                          continue;
117683                        }
117684                        if (A > g) {
117685                          if (m != e.AFTER) {
117686                            m = e.AFTER;
117687                            i.computeWorldVertices(a, d - 6, 4, u, 0, 2);
117688                          }
117689                          this.addAfterPosition(A - g, u, 0, c, b);
117690                          continue;
117691                        }
117692                      }
117693                      for (;;S++) {
117694                        var T = f[S];
117695                        if (!(A > T)) {
117696                          if (0 == S) A /= T; else {
117697                            A = (A - (K = f[S - 1])) / (T - K);
117698                          }
117699                          break;
117700                        }
117701                      }
117702                      if (S != m) {
117703                        m = S;
117704                        if (_ && S == p) {
117705                          i.computeWorldVertices(a, d - 4, 4, u, 0, 2);
117706                          i.computeWorldVertices(a, 0, 4, u, 4, 2);
117707                        } else i.computeWorldVertices(a, 6 * S + 2, 8, u, 0, 2);
117708                      }
117709                      this.addCurvePosition(A, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], c, b, n || y > 0 && 0 == X);
117710                    }
117711                    return c;
117712                  }
117713                  if (_) {
117714                    d += 2;
117715                    u = t.Utils.setArraySize(this.world, d);
117716                    i.computeWorldVertices(a, 2, d - 4, u, 0, 2);
117717                    i.computeWorldVertices(a, 0, 2, u, d - 4, 2);
117718                    u[d - 2] = u[0];
117719                    u[d - 1] = u[1];
117720                  } else {
117721                    p--;
117722                    d -= 4;
117723                    u = t.Utils.setArraySize(this.world, d);
117724                    i.computeWorldVertices(a, 2, d, u, 0, 2);
117725                  }
117726                  var v = t.Utils.setArraySize(this.curves, p);
117727                  var E = 0;
117728                  var C = u[0], x = u[1], w = 0, R = 0, I = 0, M = 0, B = 0, D = 0;
117729                  var P = 0, O = 0, N = 0, L = 0, F = 0, V = 0, k = 0, U = 0;
117730                  y = 0;
117731                  for (var G = 2; y < p; y++, G += 6) {
117732                    w = u[G];
117733                    R = u[G + 1];
117734                    I = u[G + 2];
117735                    M = u[G + 3];
117736                    F = 2 * (P = .1875 * (C - 2 * w + I)) + (N = .09375 * (3 * (w - I) - C + (B = u[G + 4])));
117737                    V = 2 * (O = .1875 * (x - 2 * R + M)) + (L = .09375 * (3 * (R - M) - x + (D = u[G + 5])));
117738                    k = .75 * (w - C) + P + .16666667 * N;
117739                    U = .75 * (R - x) + O + .16666667 * L;
117740                    E += Math.sqrt(k * k + U * U);
117741                    k += F;
117742                    U += V;
117743                    F += N;
117744                    V += L;
117745                    E += Math.sqrt(k * k + U * U);
117746                    k += F;
117747                    U += V;
117748                    E += Math.sqrt(k * k + U * U);
117749                    k += F + N;
117750                    U += V + L;
117751                    E += Math.sqrt(k * k + U * U);
117752                    v[y] = E;
117753                    C = B;
117754                    x = D;
117755                  }
117756                  l *= r ? E : E / i.lengths[p - 1];
117757                  if (o) for (y = 1; y < s; y++) h[y] *= E;
117758                  var z = this.segments;
117759                  var H = 0;
117760                  y = 0, b = 0, S = 0;
117761                  for (var j = 0; y < s; y++, b += 3) {
117762                    var X;
117763                    A = l += X = h[y];
117764                    if (_) {
117765                      (A %= E) < 0 && (A += E);
117766                      S = 0;
117767                    } else {
117768                      if (A < 0) {
117769                        this.addBeforePosition(A, u, 0, c, b);
117770                        continue;
117771                      }
117772                      if (A > E) {
117773                        this.addAfterPosition(A - E, u, d - 4, c, b);
117774                        continue;
117775                      }
117776                    }
117777                    for (;;S++) {
117778                      var W = v[S];
117779                      if (!(A > W)) {
117780                        if (0 == S) A /= W; else {
117781                          A = (A - (K = v[S - 1])) / (W - K);
117782                        }
117783                        break;
117784                      }
117785                    }
117786                    if (S != m) {
117787                      m = S;
117788                      var Y = 6 * S;
117789                      C = u[Y];
117790                      x = u[Y + 1];
117791                      w = u[Y + 2];
117792                      R = u[Y + 3];
117793                      I = u[Y + 4];
117794                      M = u[Y + 5];
117795                      F = 2 * (P = .03 * (C - 2 * w + I)) + (N = .006 * (3 * (w - I) - C + (B = u[Y + 6])));
117796                      V = 2 * (O = .03 * (x - 2 * R + M)) + (L = .006 * (3 * (R - M) - x + (D = u[Y + 7])));
117797                      k = .3 * (w - C) + P + .16666667 * N;
117798                      U = .3 * (R - x) + O + .16666667 * L;
117799                      H = Math.sqrt(k * k + U * U);
117800                      z[0] = H;
117801                      for (Y = 1; Y < 8; Y++) {
117802                        k += F;
117803                        U += V;
117804                        F += N;
117805                        V += L;
117806                        H += Math.sqrt(k * k + U * U);
117807                        z[Y] = H;
117808                      }
117809                      k += F;
117810                      U += V;
117811                      H += Math.sqrt(k * k + U * U);
117812                      z[8] = H;
117813                      k += F + N;
117814                      U += V + L;
117815                      H += Math.sqrt(k * k + U * U);
117816                      z[9] = H;
117817                      j = 0;
117818                    }
117819                    A *= H;
117820                    for (;;j++) {
117821                      var q = z[j];
117822                      if (!(A > q)) {
117823                        if (0 == j) A /= q; else {
117824                          var K;
117825                          A = j + (A - (K = z[j - 1])) / (q - K);
117826                        }
117827                        break;
117828                      }
117829                    }
117830                    this.addCurvePosition(.1 * A, C, x, w, R, I, M, B, D, c, b, n || y > 0 && 0 == X);
117831                  }
117832                  return c;
117833                };
117834                e.prototype.addBeforePosition = function(t, e, i, s, n) {
117835                  var r = e[i], o = e[i + 1], a = e[i + 2] - r, l = e[i + 3] - o, h = Math.atan2(l, a);
117836                  s[n] = r + t * Math.cos(h);
117837                  s[n + 1] = o + t * Math.sin(h);
117838                  s[n + 2] = h;
117839                };
117840                e.prototype.addAfterPosition = function(t, e, i, s, n) {
117841                  var r = e[i + 2], o = e[i + 3], a = r - e[i], l = o - e[i + 1], h = Math.atan2(l, a);
117842                  s[n] = r + t * Math.cos(h);
117843                  s[n + 1] = o + t * Math.sin(h);
117844                  s[n + 2] = h;
117845                };
117846                e.prototype.addCurvePosition = function(t, e, i, s, n, r, o, a, l, h, c, u) {
117847                  if (0 == t || isNaN(t)) {
117848                    h[c] = e;
117849                    h[c + 1] = i;
117850                    h[c + 2] = Math.atan2(n - i, s - e);
117851                  } else {
117852                    var _ = t * t, d = _ * t, p = 1 - t, m = p * p, f = m * p;
117853                    var g = p * t, y = 3 * g, b = p * y, S = y * t;
117854                    var A = e * f + s * b + r * S + a * d, T = i * f + n * b + o * S + l * d;
117855                    h[c] = A;
117856                    h[c + 1] = T;
117857                    u && (h[c + 2] = t < .001 ? Math.atan2(n - i, s - e) : Math.atan2(T - (i * m + n * g * 2 + o * _), A - (e * m + s * g * 2 + r * _)));
117858                  }
117859                };
117860                e.NONE = -1;
117861                e.BEFORE = -2;
117862                e.AFTER = -3;
117863                e.epsilon = 1e-5;
117864                return e;
117865              }();
117866              t.PathConstraint = e;
117867            }(TMt || (TMt = {}));
117868            !function(t) {
117869              var e = function(t) {
117870                AMt(e, t);
117871                function e(e) {
117872                  var i = t.call(this, e, 0, !1) || this;
117873                  i.bones = new Array;
117874                  return i;
117875                }
117876                return e;
117877              }(t.ConstraintData);
117878              t.PathConstraintData = e;
117879              !function(t) {
117880                t[t.Fixed = 0] = "Fixed";
117881                t[t.Percent = 1] = "Percent";
117882              }(t.PositionMode || (t.PositionMode = {}));
117883              !function(t) {
117884                t[t.Length = 0] = "Length";
117885                t[t.Fixed = 1] = "Fixed";
117886                t[t.Percent = 2] = "Percent";
117887              }(t.SpacingMode || (t.SpacingMode = {}));
117888              !function(t) {
117889                t[t.Tangent = 0] = "Tangent";
117890                t[t.Chain = 1] = "Chain";
117891                t[t.ChainScale = 2] = "ChainScale";
117892              }(t.RotateMode || (t.RotateMode = {}));
117893            }(TMt || (TMt = {}));
117894            !function(t) {
117895              var e = function() {
117896                function t(t) {
117897                  this.toLoad = new Array;
117898                  this.assets = {};
117899                  this.clientId = t;
117900                }
117901                t.prototype.loaded = function() {
117902                  var t = 0;
117903                  for (var e in this.assets) t++;
117904                  return t;
117905                };
117906                return t;
117907              }();
117908              var i = function() {
117909                function t(t) {
117910                  void 0 === t && (t = "");
117911                  this.clientAssets = {};
117912                  this.queuedAssets = {};
117913                  this.rawAssets = {};
117914                  this.errors = {};
117915                  this.pathPrefix = t;
117916                }
117917                t.prototype.queueAsset = function(t, i, s) {
117918                  var n = this.clientAssets[t];
117919                  if (null == n) {
117920                    n = new e(t);
117921                    this.clientAssets[t] = n;
117922                  }
117923                  null !== i && (n.textureLoader = i);
117924                  n.toLoad.push(s);
117925                  if (this.queuedAssets[s] === s) return !1;
117926                  this.queuedAssets[s] = s;
117927                  return !0;
117928                };
117929                t.prototype.loadText = function(t, e) {
117930                  var i = this;
117931                  e = this.pathPrefix + e;
117932                  if (this.queueAsset(t, null, e)) {
117933                    var s = new XMLHttpRequest;
117934                    s.onreadystatechange = function() {
117935                      s.readyState == XMLHttpRequest.DONE && (s.status >= 200 && s.status < 300 ? i.rawAssets[e] = s.responseText : i.errors[e] = "Couldn't load text " + e + ": status " + s.status + ", " + s.responseText);
117936                    };
117937                    s.open("GET", e, !0);
117938                    s.send();
117939                  }
117940                };
117941                t.prototype.loadJson = function(t, e) {
117942                  var i = this;
117943                  e = this.pathPrefix + e;
117944                  if (this.queueAsset(t, null, e)) {
117945                    var s = new XMLHttpRequest;
117946                    s.onreadystatechange = function() {
117947                      s.readyState == XMLHttpRequest.DONE && (s.status >= 200 && s.status < 300 ? i.rawAssets[e] = JSON.parse(s.responseText) : i.errors[e] = "Couldn't load text " + e + ": status " + s.status + ", " + s.responseText);
117948                    };
117949                    s.open("GET", e, !0);
117950                    s.send();
117951                  }
117952                };
117953                t.prototype.loadTexture = function(t, e, i) {
117954                  var s = this;
117955                  i = this.pathPrefix + i;
117956                  if (this.queueAsset(t, e, i)) {
117957                    var n = new Image;
117958                    n.src = i;
117959                    n.crossOrigin = "anonymous";
117960                    n.onload = function(t) {
117961                      s.rawAssets[i] = n;
117962                    };
117963                    n.onerror = function(t) {
117964                      s.errors[i] = "Couldn't load image " + i;
117965                    };
117966                  }
117967                };
117968                t.prototype.get = function(t, e) {
117969                  e = this.pathPrefix + e;
117970                  var i = this.clientAssets[t];
117971                  return null == i || i.assets[e];
117972                };
117973                t.prototype.updateClientAssets = function(t) {
117974                  for (var e = 0; e < t.toLoad.length; e++) {
117975                    var i = t.toLoad[e];
117976                    var s = t.assets[i];
117977                    if (null == s) {
117978                      var n = this.rawAssets[i];
117979                      if (null == n) continue;
117980                      n instanceof HTMLImageElement ? t.assets[i] = t.textureLoader(n) : t.assets[i] = n;
117981                    }
117982                  }
117983                };
117984                t.prototype.isLoadingComplete = function(t) {
117985                  var e = this.clientAssets[t];
117986                  if (null == e) return !0;
117987                  this.updateClientAssets(e);
117988                  return e.toLoad.length == e.loaded();
117989                };
117990                t.prototype.dispose = function() {};
117991                t.prototype.hasErrors = function() {
117992                  return Object.keys(this.errors).length > 0;
117993                };
117994                t.prototype.getErrors = function() {
117995                  return this.errors;
117996                };
117997                return t;
117998              }();
117999              t.SharedAssetManager = i;
118000            }(TMt || (TMt = {}));
118001            !function(t) {
118002              var e = function() {
118003                function e(e) {
118004                  this._updateCache = new Array;
118005                  this.updateCacheReset = new Array;
118006                  this.time = 0;
118007                  this.scaleX = 1;
118008                  this.scaleY = 1;
118009                  this.x = 0;
118010                  this.y = 0;
118011                  if (null == e) throw new Error("data cannot be null.");
118012                  this.data = e;
118013                  this.bones = new Array;
118014                  for (var i = 0; i < e.bones.length; i++) {
118015                    var s = e.bones[i];
118016                    var n = void 0;
118017                    if (null == s.parent) n = new t.Bone(s, this, null); else {
118018                      var r = this.bones[s.parent.index];
118019                      n = new t.Bone(s, this, r);
118020                      r.children.push(n);
118021                    }
118022                    this.bones.push(n);
118023                  }
118024                  this.slots = new Array;
118025                  this.drawOrder = new Array;
118026                  for (i = 0; i < e.slots.length; i++) {
118027                    var o = e.slots[i];
118028                    n = this.bones[o.boneData.index];
118029                    var a = new t.Slot(o, n);
118030                    this.slots.push(a);
118031                    this.drawOrder.push(a);
118032                  }
118033                  this.ikConstraints = new Array;
118034                  for (i = 0; i < e.ikConstraints.length; i++) {
118035                    var l = e.ikConstraints[i];
118036                    this.ikConstraints.push(new t.IkConstraint(l, this));
118037                  }
118038                  this.transformConstraints = new Array;
118039                  for (i = 0; i < e.transformConstraints.length; i++) {
118040                    var h = e.transformConstraints[i];
118041                    this.transformConstraints.push(new t.TransformConstraint(h, this));
118042                  }
118043                  this.pathConstraints = new Array;
118044                  for (i = 0; i < e.pathConstraints.length; i++) {
118045                    var c = e.pathConstraints[i];
118046                    this.pathConstraints.push(new t.PathConstraint(c, this));
118047                  }
118048                  this.color = new t.Color(1, 1, 1, 1);
118049                  this.updateCache();
118050                }
118051                e.prototype.updateCache = function() {
118052                  this._updateCache.length = 0;
118053                  this.updateCacheReset.length = 0;
118054                  var t = this.bones;
118055                  for (var e = 0, i = t.length; e < i; e++) {
118056                    (n = t[e]).sorted = n.data.skinRequired;
118057                    n.active = !n.sorted;
118058                  }
118059                  if (null != this.skin) {
118060                    var s = this.skin.bones;
118061                    for (e = 0, i = this.skin.bones.length; e < i; e++) {
118062                      var n = this.bones[s[e].index];
118063                      do {
118064                        n.sorted = !1;
118065                        n.active = !0;
118066                        n = n.parent;
118067                      } while (null != n);
118068                    }
118069                  }
118070                  var r = this.ikConstraints;
118071                  var o = this.transformConstraints;
118072                  var a = this.pathConstraints;
118073                  var l = r.length, h = o.length, c = a.length;
118074                  var u = l + h + c;
118075                  t: for (e = 0; e < u; e++) {
118076                    for (var _ = 0; _ < l; _++) {
118077                      if ((d = r[_]).data.order == e) {
118078                        this.sortIkConstraint(d);
118079                        continue t;
118080                      }
118081                    }
118082                    for (_ = 0; _ < h; _++) {
118083                      if ((d = o[_]).data.order == e) {
118084                        this.sortTransformConstraint(d);
118085                        continue t;
118086                      }
118087                    }
118088                    for (_ = 0; _ < c; _++) {
118089                      var d;
118090                      if ((d = a[_]).data.order == e) {
118091                        this.sortPathConstraint(d);
118092                        continue t;
118093                      }
118094                    }
118095                  }
118096                  for (e = 0, i = t.length; e < i; e++) this.sortBone(t[e]);
118097                };
118098                e.prototype.sortIkConstraint = function(e) {
118099                  e.active = e.target.isActive() && (!e.data.skinRequired || null != this.skin && t.Utils.contains(this.skin.constraints, e.data, !0));
118100                  if (e.active) {
118101                    var i = e.target;
118102                    this.sortBone(i);
118103                    var s = e.bones;
118104                    var n = s[0];
118105                    this.sortBone(n);
118106                    if (s.length > 1) {
118107                      var r = s[s.length - 1];
118108                      this._updateCache.indexOf(r) > -1 || this.updateCacheReset.push(r);
118109                    }
118110                    this._updateCache.push(e);
118111                    this.sortReset(n.children);
118112                    s[s.length - 1].sorted = !0;
118113                  }
118114                };
118115                e.prototype.sortPathConstraint = function(e) {
118116                  e.active = e.target.bone.isActive() && (!e.data.skinRequired || null != this.skin && t.Utils.contains(this.skin.constraints, e.data, !0));
118117                  if (e.active) {
118118                    var i = e.target;
118119                    var s = i.data.index;
118120                    var n = i.bone;
118121                    null != this.skin && this.sortPathConstraintAttachment(this.skin, s, n);
118122                    null != this.data.defaultSkin && this.data.defaultSkin != this.skin && this.sortPathConstraintAttachment(this.data.defaultSkin, s, n);
118123                    for (var r = 0, o = this.data.skins.length; r < o; r++) this.sortPathConstraintAttachment(this.data.skins[r], s, n);
118124                    var a = i.getAttachment();
118125                    a instanceof t.PathAttachment && this.sortPathConstraintAttachmentWith(a, n);
118126                    var l = e.bones;
118127                    var h = l.length;
118128                    for (r = 0; r < h; r++) this.sortBone(l[r]);
118129                    this._updateCache.push(e);
118130                    for (r = 0; r < h; r++) this.sortReset(l[r].children);
118131                    for (r = 0; r < h; r++) l[r].sorted = !0;
118132                  }
118133                };
118134                e.prototype.sortTransformConstraint = function(e) {
118135                  e.active = e.target.isActive() && (!e.data.skinRequired || null != this.skin && t.Utils.contains(this.skin.constraints, e.data, !0));
118136                  if (e.active) {
118137                    this.sortBone(e.target);
118138                    var i = e.bones;
118139                    var s = i.length;
118140                    if (e.data.local) for (var n = 0; n < s; n++) {
118141                      var r = i[n];
118142                      this.sortBone(r.parent);
118143                      this._updateCache.indexOf(r) > -1 || this.updateCacheReset.push(r);
118144                    } else for (n = 0; n < s; n++) this.sortBone(i[n]);
118145                    this._updateCache.push(e);
118146                    for (var o = 0; o < s; o++) this.sortReset(i[o].children);
118147                    for (o = 0; o < s; o++) i[o].sorted = !0;
118148                  }
118149                };
118150                e.prototype.sortPathConstraintAttachment = function(t, e, i) {
118151                  var s = t.attachments[e];
118152                  if (s) for (var n in s) this.sortPathConstraintAttachmentWith(s[n], i);
118153                };
118154                e.prototype.sortPathConstraintAttachmentWith = function(e, i) {
118155                  if (e instanceof t.PathAttachment) {
118156                    var s = e.bones;
118157                    if (null == s) this.sortBone(i); else {
118158                      var n = this.bones;
118159                      var r = 0;
118160                      for (;r < s.length; ) {
118161                        var o = s[r++];
118162                        for (var a = r + o; r < a; r++) {
118163                          var l = s[r];
118164                          this.sortBone(n[l]);
118165                        }
118166                      }
118167                    }
118168                  }
118169                };
118170                e.prototype.sortBone = function(t) {
118171                  if (!t.sorted) {
118172                    var e = t.parent;
118173                    null != e && this.sortBone(e);
118174                    t.sorted = !0;
118175                    this._updateCache.push(t);
118176                  }
118177                };
118178                e.prototype.sortReset = function(t) {
118179                  for (var e = 0, i = t.length; e < i; e++) {
118180                    var s = t[e];
118181                    if (s.active) {
118182                      s.sorted && this.sortReset(s.children);
118183                      s.sorted = !1;
118184                    }
118185                  }
118186                };
118187                e.prototype.updateWorldTransform = function() {
118188                  var t = this.updateCacheReset;
118189                  for (var e = 0, i = t.length; e < i; e++) {
118190                    var s = t[e];
118191                    s.ax = s.x;
118192                    s.ay = s.y;
118193                    s.arotation = s.rotation;
118194                    s.ascaleX = s.scaleX;
118195                    s.ascaleY = s.scaleY;
118196                    s.ashearX = s.shearX;
118197                    s.ashearY = s.shearY;
118198                    s.appliedValid = !0;
118199                  }
118200                  var n = this._updateCache;
118201                  for (e = 0, i = n.length; e < i; e++) n[e].update();
118202                };
118203                e.prototype.setToSetupPose = function() {
118204                  this.setBonesToSetupPose();
118205                  this.setSlotsToSetupPose();
118206                };
118207                e.prototype.setBonesToSetupPose = function() {
118208                  var t = this.bones;
118209                  for (var e = 0, i = t.length; e < i; e++) t[e].setToSetupPose();
118210                  var s = this.ikConstraints;
118211                  for (e = 0, i = s.length; e < i; e++) {
118212                    (a = s[e]).mix = a.data.mix;
118213                    a.softness = a.data.softness;
118214                    a.bendDirection = a.data.bendDirection;
118215                    a.compress = a.data.compress;
118216                    a.stretch = a.data.stretch;
118217                  }
118218                  var n = this.transformConstraints;
118219                  for (e = 0, i = n.length; e < i; e++) {
118220                    var r = (a = n[e]).data;
118221                    a.rotateMix = r.rotateMix;
118222                    a.translateMix = r.translateMix;
118223                    a.scaleMix = r.scaleMix;
118224                    a.shearMix = r.shearMix;
118225                  }
118226                  var o = this.pathConstraints;
118227                  for (e = 0, i = o.length; e < i; e++) {
118228                    var a;
118229                    r = (a = o[e]).data;
118230                    a.position = r.position;
118231                    a.spacing = r.spacing;
118232                    a.rotateMix = r.rotateMix;
118233                    a.translateMix = r.translateMix;
118234                  }
118235                };
118236                e.prototype.setSlotsToSetupPose = function() {
118237                  var e = this.slots;
118238                  t.Utils.arrayCopy(e, 0, this.drawOrder, 0, e.length);
118239                  for (var i = 0, s = e.length; i < s; i++) e[i].setToSetupPose();
118240                };
118241                e.prototype.getRootBone = function() {
118242                  return 0 == this.bones.length ? null : this.bones[0];
118243                };
118244                e.prototype.findBone = function(t) {
118245                  if (null == t) throw new Error("boneName cannot be null.");
118246                  var e = this.bones;
118247                  for (var i = 0, s = e.length; i < s; i++) {
118248                    var n = e[i];
118249                    if (n.data.name == t) return n;
118250                  }
118251                  return null;
118252                };
118253                e.prototype.findBoneIndex = function(t) {
118254                  if (null == t) throw new Error("boneName cannot be null.");
118255                  var e = this.bones;
118256                  for (var i = 0, s = e.length; i < s; i++) if (e[i].data.name == t) return i;
118257                  return -1;
118258                };
118259                e.prototype.findSlot = function(t) {
118260                  if (null == t) throw new Error("slotName cannot be null.");
118261                  var e = this.slots;
118262                  for (var i = 0, s = e.length; i < s; i++) {
118263                    var n = e[i];
118264                    if (n.data.name == t) return n;
118265                  }
118266                  return null;
118267                };
118268                e.prototype.findSlotIndex = function(t) {
118269                  if (null == t) throw new Error("slotName cannot be null.");
118270                  var e = this.slots;
118271                  for (var i = 0, s = e.length; i < s; i++) if (e[i].data.name == t) return i;
118272                  return -1;
118273                };
118274                e.prototype.setSkinByName = function(t) {
118275                  var e = this.data.findSkin(t);
118276                  if (null == e) throw new Error("Skin not found: " + t);
118277                  this.setSkin(e);
118278                };
118279                e.prototype.setSkin = function(t) {
118280                  if (t != this.skin) {
118281                    if (null != t) if (null != this.skin) t.attachAll(this, this.skin); else {
118282                      var e = this.slots;
118283                      for (var i = 0, s = e.length; i < s; i++) {
118284                        var n = e[i];
118285                        var r = n.data.attachmentName;
118286                        if (null != r) {
118287                          var o = t.getAttachment(i, r);
118288                          null != o && n.setAttachment(o);
118289                        }
118290                      }
118291                    }
118292                    this.skin = t;
118293                    this.updateCache();
118294                  }
118295                };
118296                e.prototype.getAttachmentByName = function(t, e) {
118297                  return this.getAttachment(this.data.findSlotIndex(t), e);
118298                };
118299                e.prototype.getAttachment = function(t, e) {
118300                  if (null == e) throw new Error("attachmentName cannot be null.");
118301                  if (null != this.skin) {
118302                    var i = this.skin.getAttachment(t, e);
118303                    if (null != i) return i;
118304                  }
118305                  return null != this.data.defaultSkin ? this.data.defaultSkin.getAttachment(t, e) : null;
118306                };
118307                e.prototype.setAttachment = function(t, e) {
118308                  if (null == t) throw new Error("slotName cannot be null.");
118309                  var i = this.slots;
118310                  for (var s = 0, n = i.length; s < n; s++) {
118311                    var r = i[s];
118312                    if (r.data.name == t) {
118313                      var o = null;
118314                      if (null != e && null == (o = this.getAttachment(s, e))) throw new Error("Attachment not found: " + e + ", for slot: " + t);
118315                      r.setAttachment(o);
118316                      return;
118317                    }
118318                  }
118319                  throw new Error("Slot not found: " + t);
118320                };
118321                e.prototype.findIkConstraint = function(t) {
118322                  if (null == t) throw new Error("constraintName cannot be null.");
118323                  var e = this.ikConstraints;
118324                  for (var i = 0, s = e.length; i < s; i++) {
118325                    var n = e[i];
118326                    if (n.data.name == t) return n;
118327                  }
118328                  return null;
118329                };
118330                e.prototype.findTransformConstraint = function(t) {
118331                  if (null == t) throw new Error("constraintName cannot be null.");
118332                  var e = this.transformConstraints;
118333                  for (var i = 0, s = e.length; i < s; i++) {
118334                    var n = e[i];
118335                    if (n.data.name == t) return n;
118336                  }
118337                  return null;
118338                };
118339                e.prototype.findPathConstraint = function(t) {
118340                  if (null == t) throw new Error("constraintName cannot be null.");
118341                  var e = this.pathConstraints;
118342                  for (var i = 0, s = e.length; i < s; i++) {
118343                    var n = e[i];
118344                    if (n.data.name == t) return n;
118345                  }
118346                  return null;
118347                };
118348                e.prototype.getBounds = function(e, i, s) {
118349                  void 0 === s && (s = new Array(2));
118350                  if (null == e) throw new Error("offset cannot be null.");
118351                  if (null == i) throw new Error("size cannot be null.");
118352                  var n = this.drawOrder;
118353                  var r = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY, a = Number.NEGATIVE_INFINITY, l = Number.NEGATIVE_INFINITY;
118354                  for (var h = 0, c = n.length; h < c; h++) {
118355                    var u = n[h];
118356                    if (u.bone.active) {
118357                      var _ = 0;
118358                      var d = null;
118359                      var p = u.getAttachment();
118360                      if (p instanceof t.RegionAttachment) {
118361                        _ = 8;
118362                        d = t.Utils.setArraySize(s, _, 0);
118363                        p.computeWorldVertices(u.bone, d, 0, 2);
118364                      } else if (p instanceof t.MeshAttachment) {
118365                        var m = p;
118366                        _ = m.worldVerticesLength;
118367                        d = t.Utils.setArraySize(s, _, 0);
118368                        m.computeWorldVertices(u, 0, _, d, 0, 2);
118369                      }
118370                      if (null != d) for (var f = 0, g = d.length; f < g; f += 2) {
118371                        var y = d[f], b = d[f + 1];
118372                        r = Math.min(r, y);
118373                        o = Math.min(o, b);
118374                        a = Math.max(a, y);
118375                        l = Math.max(l, b);
118376                      }
118377                    }
118378                  }
118379                  e.set(r, o);
118380                  i.set(a - r, l - o);
118381                };
118382                e.prototype.update = function(t) {
118383                  this.time += t;
118384                };
118385                return e;
118386              }();
118387              t.Skeleton = e;
118388            }(TMt || (TMt = {}));
118389            !function(t) {
118390              var e = function() {
118391                function e(t) {
118392                  this.scale = 1;
118393                  this.linkedMeshes = new Array;
118394                  this.attachmentLoader = t;
118395                }
118396                e.prototype.readSkeletonData = function(s) {
118397                  var n = this.scale;
118398                  var r = new t.SkeletonData;
118399                  r.name = "";
118400                  var o = new i(s);
118401                  r.hash = o.readString();
118402                  r.version = o.readString();
118403                  r.x = o.readFloat();
118404                  r.y = o.readFloat();
118405                  r.width = o.readFloat();
118406                  r.height = o.readFloat();
118407                  var a = o.readBoolean();
118408                  if (a) {
118409                    r.fps = o.readFloat();
118410                    r.imagesPath = o.readString();
118411                    r.audioPath = o.readString();
118412                  }
118413                  var l = 0;
118414                  l = o.readInt(!0);
118415                  for (var h = 0; h < l; h++) o.strings.push(o.readString());
118416                  l = o.readInt(!0);
118417                  for (h = 0; h < l; h++) {
118418                    var c = o.readString();
118419                    var u = 0 == h ? null : r.bones[o.readInt(!0)];
118420                    (p = new t.BoneData(h, c, u)).rotation = o.readFloat();
118421                    p.x = o.readFloat() * n;
118422                    p.y = o.readFloat() * n;
118423                    p.scaleX = o.readFloat();
118424                    p.scaleY = o.readFloat();
118425                    p.shearX = o.readFloat();
118426                    p.shearY = o.readFloat();
118427                    p.length = o.readFloat() * n;
118428                    p.transformMode = e.TransformModeValues[o.readInt(!0)];
118429                    p.skinRequired = o.readBoolean();
118430                    a && t.Color.rgba8888ToColor(p.color, o.readInt32());
118431                    r.bones.push(p);
118432                  }
118433                  l = o.readInt(!0);
118434                  for (h = 0; h < l; h++) {
118435                    var _ = o.readString();
118436                    var d = r.bones[o.readInt(!0)];
118437                    var p = new t.SlotData(h, _, d);
118438                    t.Color.rgba8888ToColor(p.color, o.readInt32());
118439                    var m = o.readInt32();
118440                    -1 != m && t.Color.rgb888ToColor(p.darkColor = new t.Color, m);
118441                    p.attachmentName = o.readStringRef();
118442                    p.blendMode = e.BlendModeValues[o.readInt(!0)];
118443                    r.slots.push(p);
118444                  }
118445                  l = o.readInt(!0);
118446                  h = 0;
118447                  for (var f = void 0; h < l; h++) {
118448                    (p = new t.IkConstraintData(o.readString())).order = o.readInt(!0);
118449                    p.skinRequired = o.readBoolean();
118450                    f = o.readInt(!0);
118451                    for (var g = 0; g < f; g++) p.bones.push(r.bones[o.readInt(!0)]);
118452                    p.target = r.bones[o.readInt(!0)];
118453                    p.mix = o.readFloat();
118454                    p.softness = o.readFloat() * n;
118455                    p.bendDirection = o.readByte();
118456                    p.compress = o.readBoolean();
118457                    p.stretch = o.readBoolean();
118458                    p.uniform = o.readBoolean();
118459                    r.ikConstraints.push(p);
118460                  }
118461                  l = o.readInt(!0);
118462                  for (h = 0, f = void 0; h < l; h++) {
118463                    (p = new t.TransformConstraintData(o.readString())).order = o.readInt(!0);
118464                    p.skinRequired = o.readBoolean();
118465                    f = o.readInt(!0);
118466                    for (g = 0; g < f; g++) p.bones.push(r.bones[o.readInt(!0)]);
118467                    p.target = r.bones[o.readInt(!0)];
118468                    p.local = o.readBoolean();
118469                    p.relative = o.readBoolean();
118470                    p.offsetRotation = o.readFloat();
118471                    p.offsetX = o.readFloat() * n;
118472                    p.offsetY = o.readFloat() * n;
118473                    p.offsetScaleX = o.readFloat();
118474                    p.offsetScaleY = o.readFloat();
118475                    p.offsetShearY = o.readFloat();
118476                    p.rotateMix = o.readFloat();
118477                    p.translateMix = o.readFloat();
118478                    p.scaleMix = o.readFloat();
118479                    p.shearMix = o.readFloat();
118480                    r.transformConstraints.push(p);
118481                  }
118482                  l = o.readInt(!0);
118483                  for (h = 0, f = void 0; h < l; h++) {
118484                    (p = new t.PathConstraintData(o.readString())).order = o.readInt(!0);
118485                    p.skinRequired = o.readBoolean();
118486                    f = o.readInt(!0);
118487                    for (g = 0; g < f; g++) p.bones.push(r.bones[o.readInt(!0)]);
118488                    p.target = r.slots[o.readInt(!0)];
118489                    p.positionMode = e.PositionModeValues[o.readInt(!0)];
118490                    p.spacingMode = e.SpacingModeValues[o.readInt(!0)];
118491                    p.rotateMode = e.RotateModeValues[o.readInt(!0)];
118492                    p.offsetRotation = o.readFloat();
118493                    p.position = o.readFloat();
118494                    p.positionMode == t.PositionMode.Fixed && (p.position *= n);
118495                    p.spacing = o.readFloat();
118496                    p.spacingMode != t.SpacingMode.Length && p.spacingMode != t.SpacingMode.Fixed || (p.spacing *= n);
118497                    p.rotateMix = o.readFloat();
118498                    p.translateMix = o.readFloat();
118499                    r.pathConstraints.push(p);
118500                  }
118501                  var y = this.readSkin(o, r, !0, a);
118502                  if (null != y) {
118503                    r.defaultSkin = y;
118504                    r.skins.push(y);
118505                  }
118506                  h = r.skins.length;
118507                  t.Utils.setArraySize(r.skins, l = h + o.readInt(!0));
118508                  for (;h < l; h++) r.skins[h] = this.readSkin(o, r, !1, a);
118509                  l = this.linkedMeshes.length;
118510                  for (h = 0; h < l; h++) {
118511                    var b = this.linkedMeshes[h];
118512                    var S = null == b.skin ? r.defaultSkin : r.findSkin(b.skin);
118513                    if (null == S) throw new Error("Skin not found: " + b.skin);
118514                    var A = S.getAttachment(b.slotIndex, b.parent);
118515                    if (null == A) throw new Error("Parent mesh not found: " + b.parent);
118516                    b.mesh.deformAttachment = b.inheritDeform ? A : b.mesh;
118517                    b.mesh.setParentMesh(A);
118518                    b.mesh.updateUVs();
118519                  }
118520                  this.linkedMeshes.length = 0;
118521                  l = o.readInt(!0);
118522                  for (h = 0; h < l; h++) {
118523                    (p = new t.EventData(o.readStringRef())).intValue = o.readInt(!1);
118524                    p.floatValue = o.readFloat();
118525                    p.stringValue = o.readString();
118526                    p.audioPath = o.readString();
118527                    if (null != p.audioPath) {
118528                      p.volume = o.readFloat();
118529                      p.balance = o.readFloat();
118530                    }
118531                    r.events.push(p);
118532                  }
118533                  l = o.readInt(!0);
118534                  for (h = 0; h < l; h++) r.animations.push(this.readAnimation(o, o.readString(), r));
118535                  return r;
118536                };
118537                e.prototype.readSkin = function(e, i, s, n) {
118538                  var r = null;
118539                  var o = 0;
118540                  if (s) {
118541                    if (0 == (o = e.readInt(!0))) return null;
118542                    r = new t.Skin("default");
118543                  } else {
118544                    (r = new t.Skin(e.readStringRef())).bones.length = e.readInt(!0);
118545                    for (var a = 0, l = r.bones.length; a < l; a++) r.bones[a] = i.bones[e.readInt(!0)];
118546                    for (a = 0, l = e.readInt(!0); a < l; a++) r.constraints.push(i.ikConstraints[e.readInt(!0)]);
118547                    for (a = 0, l = e.readInt(!0); a < l; a++) r.constraints.push(i.transformConstraints[e.readInt(!0)]);
118548                    for (a = 0, l = e.readInt(!0); a < l; a++) r.constraints.push(i.pathConstraints[e.readInt(!0)]);
118549                    o = e.readInt(!0);
118550                  }
118551                  for (a = 0; a < o; a++) {
118552                    var h = e.readInt(!0);
118553                    for (var c = 0, u = e.readInt(!0); c < u; c++) {
118554                      var _ = e.readStringRef();
118555                      var d = this.readAttachment(e, i, r, h, _, n);
118556                      null != d && r.setAttachment(h, _, d);
118557                    }
118558                  }
118559                  return r;
118560                };
118561                e.prototype.readAttachment = function(i, n, r, o, a, l) {
118562                  var h = this.scale;
118563                  var c = i.readStringRef();
118564                  null == c && (c = a);
118565                  var u = i.readByte();
118566                  switch (e.AttachmentTypeValues[u]) {
118567                   case t.AttachmentType.Region:
118568                    var _ = i.readStringRef();
118569                    var d = i.readFloat();
118570                    var p = i.readFloat();
118571                    var m = i.readFloat();
118572                    var f = i.readFloat();
118573                    var g = i.readFloat();
118574                    var y = i.readFloat();
118575                    var b = i.readFloat();
118576                    var S = i.readInt32();
118577                    null == _ && (_ = c);
118578                    var A = this.attachmentLoader.newRegionAttachment(r, c, _);
118579                    if (null == A) return null;
118580                    A.path = _;
118581                    A.x = p * h;
118582                    A.y = m * h;
118583                    A.scaleX = f;
118584                    A.scaleY = g;
118585                    A.rotation = d;
118586                    A.width = y * h;
118587                    A.height = b * h;
118588                    t.Color.rgba8888ToColor(A.color, S);
118589                    A.updateOffset();
118590                    return A;
118591
118592                   case t.AttachmentType.BoundingBox:
118593                    var T = i.readInt(!0);
118594                    var v = this.readVertices(i, T);
118595                    S = l ? i.readInt32() : 0;
118596                    var E = this.attachmentLoader.newBoundingBoxAttachment(r, c);
118597                    if (null == E) return null;
118598                    E.worldVerticesLength = T << 1;
118599                    E.vertices = v.vertices;
118600                    E.bones = v.bones;
118601                    l && t.Color.rgba8888ToColor(E.color, S);
118602                    return E;
118603
118604                   case t.AttachmentType.Mesh:
118605                    _ = i.readStringRef();
118606                    S = i.readInt32();
118607                    T = i.readInt(!0);
118608                    var C = this.readFloatArray(i, T << 1, 1);
118609                    var x = this.readShortArray(i);
118610                    v = this.readVertices(i, T);
118611                    var w = i.readInt(!0);
118612                    var R = null;
118613                    y = 0, b = 0;
118614                    if (l) {
118615                      R = this.readShortArray(i);
118616                      y = i.readFloat();
118617                      b = i.readFloat();
118618                    }
118619                    null == _ && (_ = c);
118620                    if (null == (D = this.attachmentLoader.newMeshAttachment(r, c, _))) return null;
118621                    D.path = _;
118622                    t.Color.rgba8888ToColor(D.color, S);
118623                    D.bones = v.bones;
118624                    D.vertices = v.vertices;
118625                    D.worldVerticesLength = T << 1;
118626                    D.triangles = x;
118627                    D.regionUVs = C;
118628                    D.updateUVs();
118629                    D.hullLength = w << 1;
118630                    if (l) {
118631                      D.edges = R;
118632                      D.width = y * h;
118633                      D.height = b * h;
118634                    }
118635                    return D;
118636
118637                   case t.AttachmentType.LinkedMesh:
118638                    _ = i.readStringRef();
118639                    S = i.readInt32();
118640                    var I = i.readStringRef();
118641                    var M = i.readStringRef();
118642                    var B = i.readBoolean();
118643                    y = 0, b = 0;
118644                    if (l) {
118645                      y = i.readFloat();
118646                      b = i.readFloat();
118647                    }
118648                    null == _ && (_ = c);
118649                    var D;
118650                    if (null == (D = this.attachmentLoader.newMeshAttachment(r, c, _))) return null;
118651                    D.path = _;
118652                    t.Color.rgba8888ToColor(D.color, S);
118653                    if (l) {
118654                      D.width = y * h;
118655                      D.height = b * h;
118656                    }
118657                    this.linkedMeshes.push(new s(D, I, o, M, B));
118658                    return D;
118659
118660                   case t.AttachmentType.Path:
118661                    var P = i.readBoolean();
118662                    var O = i.readBoolean();
118663                    T = i.readInt(!0);
118664                    v = this.readVertices(i, T);
118665                    var N = t.Utils.newArray(T / 3, 0);
118666                    for (var L = 0, F = N.length; L < F; L++) N[L] = i.readFloat() * h;
118667                    S = l ? i.readInt32() : 0;
118668                    if (null == (_ = this.attachmentLoader.newPathAttachment(r, c))) return null;
118669                    _.closed = P;
118670                    _.constantSpeed = O;
118671                    _.worldVerticesLength = T << 1;
118672                    _.vertices = v.vertices;
118673                    _.bones = v.bones;
118674                    _.lengths = N;
118675                    l && t.Color.rgba8888ToColor(_.color, S);
118676                    return _;
118677
118678                   case t.AttachmentType.Point:
118679                    d = i.readFloat();
118680                    p = i.readFloat();
118681                    m = i.readFloat();
118682                    S = l ? i.readInt32() : 0;
118683                    var V = this.attachmentLoader.newPointAttachment(r, c);
118684                    if (null == V) return null;
118685                    V.x = p * h;
118686                    V.y = m * h;
118687                    V.rotation = d;
118688                    l && t.Color.rgba8888ToColor(V.color, S);
118689                    return V;
118690
118691                   case t.AttachmentType.Clipping:
118692                    var k = i.readInt(!0);
118693                    T = i.readInt(!0);
118694                    v = this.readVertices(i, T);
118695                    S = l ? i.readInt32() : 0;
118696                    var U = this.attachmentLoader.newClippingAttachment(r, c);
118697                    if (null == U) return null;
118698                    U.endSlot = n.slots[k];
118699                    U.worldVerticesLength = T << 1;
118700                    U.vertices = v.vertices;
118701                    U.bones = v.bones;
118702                    l && t.Color.rgba8888ToColor(U.color, S);
118703                    return U;
118704                  }
118705                  return null;
118706                };
118707                e.prototype.readVertices = function(e, i) {
118708                  var s = i << 1;
118709                  var r = new n;
118710                  var o = this.scale;
118711                  if (!e.readBoolean()) {
118712                    r.vertices = this.readFloatArray(e, s, o);
118713                    return r;
118714                  }
118715                  var a = new Array;
118716                  var l = new Array;
118717                  for (var h = 0; h < i; h++) {
118718                    var c = e.readInt(!0);
118719                    l.push(c);
118720                    for (var u = 0; u < c; u++) {
118721                      l.push(e.readInt(!0));
118722                      a.push(e.readFloat() * o);
118723                      a.push(e.readFloat() * o);
118724                      a.push(e.readFloat());
118725                    }
118726                  }
118727                  r.vertices = t.Utils.toFloatArray(a);
118728                  r.bones = l;
118729                  return r;
118730                };
118731                e.prototype.readFloatArray = function(t, e, i) {
118732                  var s = new Array(e);
118733                  if (1 == i) for (var n = 0; n < e; n++) s[n] = t.readFloat(); else for (n = 0; n < e; n++) s[n] = t.readFloat() * i;
118734                  return s;
118735                };
118736                e.prototype.readShortArray = function(t) {
118737                  var e = t.readInt(!0);
118738                  var i = new Array(e);
118739                  for (var s = 0; s < e; s++) i[s] = t.readShort();
118740                  return i;
118741                };
118742                e.prototype.readAnimation = function(i, s, n) {
118743                  var r = new Array;
118744                  var o = this.scale;
118745                  var a = 0;
118746                  var l = new t.Color;
118747                  var h = new t.Color;
118748                  for (var c = 0, u = i.readInt(!0); c < u; c++) {
118749                    var _ = i.readInt(!0);
118750                    for (var d = 0, p = i.readInt(!0); d < p; d++) {
118751                      var m = i.readByte();
118752                      var f = i.readInt(!0);
118753                      switch (m) {
118754                       case e.SLOT_ATTACHMENT:
118755                        (S = new t.AttachmentTimeline(f)).slotIndex = _;
118756                        for (var g = 0; g < f; g++) S.setFrame(g, i.readFloat(), i.readStringRef());
118757                        r.push(S);
118758                        a = Math.max(a, S.frames[f - 1]);
118759                        break;
118760
118761                       case e.SLOT_COLOR:
118762                        (S = new t.ColorTimeline(f)).slotIndex = _;
118763                        for (g = 0; g < f; g++) {
118764                          var y = i.readFloat();
118765                          t.Color.rgba8888ToColor(l, i.readInt32());
118766                          S.setFrame(g, y, l.r, l.g, l.b, l.a);
118767                          g < f - 1 && this.readCurve(i, g, S);
118768                        }
118769                        r.push(S);
118770                        a = Math.max(a, S.frames[(f - 1) * t.ColorTimeline.ENTRIES]);
118771                        break;
118772
118773                       case e.SLOT_TWO_COLOR:
118774                        (S = new t.TwoColorTimeline(f)).slotIndex = _;
118775                        for (g = 0; g < f; g++) {
118776                          y = i.readFloat();
118777                          t.Color.rgba8888ToColor(l, i.readInt32());
118778                          t.Color.rgb888ToColor(h, i.readInt32());
118779                          S.setFrame(g, y, l.r, l.g, l.b, l.a, h.r, h.g, h.b);
118780                          g < f - 1 && this.readCurve(i, g, S);
118781                        }
118782                        r.push(S);
118783                        a = Math.max(a, S.frames[(f - 1) * t.TwoColorTimeline.ENTRIES]);
118784                      }
118785                    }
118786                  }
118787                  for (c = 0, u = i.readInt(!0); c < u; c++) {
118788                    var b = i.readInt(!0);
118789                    for (d = 0, p = i.readInt(!0); d < p; d++) {
118790                      m = i.readByte();
118791                      f = i.readInt(!0);
118792                      switch (m) {
118793                       case e.BONE_ROTATE:
118794                        (S = new t.RotateTimeline(f)).boneIndex = b;
118795                        for (g = 0; g < f; g++) {
118796                          S.setFrame(g, i.readFloat(), i.readFloat());
118797                          g < f - 1 && this.readCurve(i, g, S);
118798                        }
118799                        r.push(S);
118800                        a = Math.max(a, S.frames[(f - 1) * t.RotateTimeline.ENTRIES]);
118801                        break;
118802
118803                       case e.BONE_TRANSLATE:
118804                       case e.BONE_SCALE:
118805                       case e.BONE_SHEAR:
118806                        var S = void 0;
118807                        var A = 1;
118808                        if (m == e.BONE_SCALE) S = new t.ScaleTimeline(f); else if (m == e.BONE_SHEAR) S = new t.ShearTimeline(f); else {
118809                          S = new t.TranslateTimeline(f);
118810                          A = o;
118811                        }
118812                        S.boneIndex = b;
118813                        for (g = 0; g < f; g++) {
118814                          S.setFrame(g, i.readFloat(), i.readFloat() * A, i.readFloat() * A);
118815                          g < f - 1 && this.readCurve(i, g, S);
118816                        }
118817                        r.push(S);
118818                        a = Math.max(a, S.frames[(f - 1) * t.TranslateTimeline.ENTRIES]);
118819                      }
118820                    }
118821                  }
118822                  for (c = 0, u = i.readInt(!0); c < u; c++) {
118823                    var T = i.readInt(!0);
118824                    f = i.readInt(!0);
118825                    (S = new t.IkConstraintTimeline(f)).ikConstraintIndex = T;
118826                    for (g = 0; g < f; g++) {
118827                      S.setFrame(g, i.readFloat(), i.readFloat(), i.readFloat() * o, i.readByte(), i.readBoolean(), i.readBoolean());
118828                      g < f - 1 && this.readCurve(i, g, S);
118829                    }
118830                    r.push(S);
118831                    a = Math.max(a, S.frames[(f - 1) * t.IkConstraintTimeline.ENTRIES]);
118832                  }
118833                  for (c = 0, u = i.readInt(!0); c < u; c++) {
118834                    T = i.readInt(!0);
118835                    f = i.readInt(!0);
118836                    (S = new t.TransformConstraintTimeline(f)).transformConstraintIndex = T;
118837                    for (g = 0; g < f; g++) {
118838                      S.setFrame(g, i.readFloat(), i.readFloat(), i.readFloat(), i.readFloat(), i.readFloat());
118839                      g < f - 1 && this.readCurve(i, g, S);
118840                    }
118841                    r.push(S);
118842                    a = Math.max(a, S.frames[(f - 1) * t.TransformConstraintTimeline.ENTRIES]);
118843                  }
118844                  for (c = 0, u = i.readInt(!0); c < u; c++) {
118845                    T = i.readInt(!0);
118846                    var v = n.pathConstraints[T];
118847                    for (d = 0, p = i.readInt(!0); d < p; d++) {
118848                      m = i.readByte();
118849                      f = i.readInt(!0);
118850                      switch (m) {
118851                       case e.PATH_POSITION:
118852                       case e.PATH_SPACING:
118853                        S = void 0;
118854                        A = 1;
118855                        if (m == e.PATH_SPACING) {
118856                          S = new t.PathConstraintSpacingTimeline(f);
118857                          v.spacingMode != t.SpacingMode.Length && v.spacingMode != t.SpacingMode.Fixed || (A = o);
118858                        } else {
118859                          S = new t.PathConstraintPositionTimeline(f);
118860                          v.positionMode == t.PositionMode.Fixed && (A = o);
118861                        }
118862                        S.pathConstraintIndex = T;
118863                        for (g = 0; g < f; g++) {
118864                          S.setFrame(g, i.readFloat(), i.readFloat() * A);
118865                          g < f - 1 && this.readCurve(i, g, S);
118866                        }
118867                        r.push(S);
118868                        a = Math.max(a, S.frames[(f - 1) * t.PathConstraintPositionTimeline.ENTRIES]);
118869                        break;
118870
118871                       case e.PATH_MIX:
118872                        (S = new t.PathConstraintMixTimeline(f)).pathConstraintIndex = T;
118873                        for (g = 0; g < f; g++) {
118874                          S.setFrame(g, i.readFloat(), i.readFloat(), i.readFloat());
118875                          g < f - 1 && this.readCurve(i, g, S);
118876                        }
118877                        r.push(S);
118878                        a = Math.max(a, S.frames[(f - 1) * t.PathConstraintMixTimeline.ENTRIES]);
118879                      }
118880                    }
118881                  }
118882                  for (c = 0, u = i.readInt(!0); c < u; c++) {
118883                    var E = n.skins[i.readInt(!0)];
118884                    for (d = 0, p = i.readInt(!0); d < p; d++) {
118885                      _ = i.readInt(!0);
118886                      for (var C = 0, x = i.readInt(!0); C < x; C++) {
118887                        var w = E.getAttachment(_, i.readStringRef());
118888                        var R = null != w.bones;
118889                        var I = w.vertices;
118890                        var M = R ? I.length / 3 * 2 : I.length;
118891                        f = i.readInt(!0);
118892                        (S = new t.DeformTimeline(f)).slotIndex = _;
118893                        S.attachment = w;
118894                        for (g = 0; g < f; g++) {
118895                          y = i.readFloat();
118896                          var B = void 0;
118897                          var D = i.readInt(!0);
118898                          if (0 == D) B = R ? t.Utils.newFloatArray(M) : I; else {
118899                            B = t.Utils.newFloatArray(M);
118900                            var P = i.readInt(!0);
118901                            D += P;
118902                            if (1 == o) for (var O = P; O < D; O++) B[O] = i.readFloat(); else for (O = P; O < D; O++) B[O] = i.readFloat() * o;
118903                            if (!R) {
118904                              O = 0;
118905                              for (var N = B.length; O < N; O++) B[O] += I[O];
118906                            }
118907                          }
118908                          S.setFrame(g, y, B);
118909                          g < f - 1 && this.readCurve(i, g, S);
118910                        }
118911                        r.push(S);
118912                        a = Math.max(a, S.frames[f - 1]);
118913                      }
118914                    }
118915                  }
118916                  var L = i.readInt(!0);
118917                  if (L > 0) {
118918                    S = new t.DrawOrderTimeline(L);
118919                    var F = n.slots.length;
118920                    for (c = 0; c < L; c++) {
118921                      y = i.readFloat();
118922                      var V = i.readInt(!0);
118923                      var k = t.Utils.newArray(F, 0);
118924                      for (d = F - 1; d >= 0; d--) k[d] = -1;
118925                      var U = t.Utils.newArray(F - V, 0);
118926                      var G = 0, z = 0;
118927                      for (d = 0; d < V; d++) {
118928                        _ = i.readInt(!0);
118929                        for (;G != _; ) U[z++] = G++;
118930                        k[G + i.readInt(!0)] = G++;
118931                      }
118932                      for (;G < F; ) U[z++] = G++;
118933                      for (d = F - 1; d >= 0; d--) -1 == k[d] && (k[d] = U[--z]);
118934                      S.setFrame(c, y, k);
118935                    }
118936                    r.push(S);
118937                    a = Math.max(a, S.frames[L - 1]);
118938                  }
118939                  var H = i.readInt(!0);
118940                  if (H > 0) {
118941                    S = new t.EventTimeline(H);
118942                    for (c = 0; c < H; c++) {
118943                      y = i.readFloat();
118944                      var j = n.events[i.readInt(!0)];
118945                      var X = new t.Event(y, j);
118946                      X.intValue = i.readInt(!1);
118947                      X.floatValue = i.readFloat();
118948                      X.stringValue = i.readBoolean() ? i.readString() : j.stringValue;
118949                      if (null != X.data.audioPath) {
118950                        X.volume = i.readFloat();
118951                        X.balance = i.readFloat();
118952                      }
118953                      S.setFrame(c, X);
118954                    }
118955                    r.push(S);
118956                    a = Math.max(a, S.frames[H - 1]);
118957                  }
118958                  return new t.Animation(s, r, a);
118959                };
118960                e.prototype.readCurve = function(t, i, s) {
118961                  switch (t.readByte()) {
118962                   case e.CURVE_STEPPED:
118963                    s.setStepped(i);
118964                    break;
118965
118966                   case e.CURVE_BEZIER:
118967                    this.setCurve(s, i, t.readFloat(), t.readFloat(), t.readFloat(), t.readFloat());
118968                  }
118969                };
118970                e.prototype.setCurve = function(t, e, i, s, n, r) {
118971                  t.setCurve(e, i, s, n, r);
118972                };
118973                e.AttachmentTypeValues = [ 0, 1, 2, 3, 4, 5, 6 ];
118974                e.TransformModeValues = [ t.TransformMode.Normal, t.TransformMode.OnlyTranslation, t.TransformMode.NoRotationOrReflection, t.TransformMode.NoScale, t.TransformMode.NoScaleOrReflection ];
118975                e.PositionModeValues = [ t.PositionMode.Fixed, t.PositionMode.Percent ];
118976                e.SpacingModeValues = [ t.SpacingMode.Length, t.SpacingMode.Fixed, t.SpacingMode.Percent ];
118977                e.RotateModeValues = [ t.RotateMode.Tangent, t.RotateMode.Chain, t.RotateMode.ChainScale ];
118978                e.BlendModeValues = [ t.BlendMode.Normal, t.BlendMode.Additive, t.BlendMode.Multiply, t.BlendMode.Screen ];
118979                e.BONE_ROTATE = 0;
118980                e.BONE_TRANSLATE = 1;
118981                e.BONE_SCALE = 2;
118982                e.BONE_SHEAR = 3;
118983                e.SLOT_ATTACHMENT = 0;
118984                e.SLOT_COLOR = 1;
118985                e.SLOT_TWO_COLOR = 2;
118986                e.PATH_POSITION = 0;
118987                e.PATH_SPACING = 1;
118988                e.PATH_MIX = 2;
118989                e.CURVE_LINEAR = 0;
118990                e.CURVE_STEPPED = 1;
118991                e.CURVE_BEZIER = 2;
118992                return e;
118993              }();
118994              t.SkeletonBinary = e;
118995              var i = function() {
118996                function t(t, e, i, s) {
118997                  void 0 === e && (e = new Array);
118998                  void 0 === i && (i = 0);
118999                  void 0 === s && (s = new DataView(t.buffer));
119000                  this.strings = e;
119001                  this.index = i;
119002                  this.buffer = s;
119003                }
119004                t.prototype.readByte = function() {
119005                  return this.buffer.getInt8(this.index++);
119006                };
119007                t.prototype.readShort = function() {
119008                  var t = this.buffer.getInt16(this.index);
119009                  this.index += 2;
119010                  return t;
119011                };
119012                t.prototype.readInt32 = function() {
119013                  var t = this.buffer.getInt32(this.index);
119014                  this.index += 4;
119015                  return t;
119016                };
119017                t.prototype.readInt = function(t) {
119018                  var e = this.readByte();
119019                  var i = 127 & e;
119020                  if (0 != (128 & e)) {
119021                    i |= (127 & (e = this.readByte())) << 7;
119022                    if (0 != (128 & e)) {
119023                      i |= (127 & (e = this.readByte())) << 14;
119024                      if (0 != (128 & e)) {
119025                        i |= (127 & (e = this.readByte())) << 21;
119026                        0 != (128 & e) && (i |= (127 & (e = this.readByte())) << 28);
119027                      }
119028                    }
119029                  }
119030                  return t ? i : i >>> 1 ^ -(1 & i);
119031                };
119032                t.prototype.readStringRef = function() {
119033                  var t = this.readInt(!0);
119034                  return 0 == t ? null : this.strings[t - 1];
119035                };
119036                t.prototype.readString = function() {
119037                  var t = this.readInt(!0);
119038                  switch (t) {
119039                   case 0:
119040                    return null;
119041
119042                   case 1:
119043                    return "";
119044                  }
119045                  t--;
119046                  var e = "";
119047                  for (var i = 0; i < t; ) {
119048                    var s = this.readByte();
119049                    switch (s >> 4) {
119050                     case 12:
119051                     case 13:
119052                      e += String.fromCharCode((31 & s) << 6 | 63 & this.readByte());
119053                      i += 2;
119054                      break;
119055
119056                     case 14:
119057                      e += String.fromCharCode((15 & s) << 12 | (63 & this.readByte()) << 6 | 63 & this.readByte());
119058                      i += 3;
119059                      break;
119060
119061                     default:
119062                      e += String.fromCharCode(s);
119063                      i++;
119064                    }
119065                  }
119066                  return e;
119067                };
119068                t.prototype.readFloat = function() {
119069                  var t = this.buffer.getFloat32(this.index);
119070                  this.index += 4;
119071                  return t;
119072                };
119073                t.prototype.readBoolean = function() {
119074                  return 0 != this.readByte();
119075                };
119076                return t;
119077              }();
119078              var s = function(t, e, i, s, n) {
119079                this.mesh = t;
119080                this.skin = e;
119081                this.slotIndex = i;
119082                this.parent = s;
119083                this.inheritDeform = n;
119084              };
119085              var n = function(t, e) {
119086                void 0 === t && (t = null);
119087                void 0 === e && (e = null);
119088                this.bones = t;
119089                this.vertices = e;
119090              };
119091            }(TMt || (TMt = {}));
119092            !function(t) {
119093              var e = function() {
119094                function e() {
119095                  this.minX = 0;
119096                  this.minY = 0;
119097                  this.maxX = 0;
119098                  this.maxY = 0;
119099                  this.boundingBoxes = new Array;
119100                  this.polygons = new Array;
119101                  this.polygonPool = new t.Pool((function() {
119102                    return t.Utils.newFloatArray(16);
119103                  }));
119104                }
119105                e.prototype.update = function(e, i) {
119106                  if (null == e) throw new Error("skeleton cannot be null.");
119107                  var s = this.boundingBoxes;
119108                  var n = this.polygons;
119109                  var r = this.polygonPool;
119110                  var o = e.slots;
119111                  var a = o.length;
119112                  s.length = 0;
119113                  r.freeAll(n);
119114                  n.length = 0;
119115                  for (var l = 0; l < a; l++) {
119116                    var h = o[l];
119117                    if (h.bone.active) {
119118                      var c = h.getAttachment();
119119                      if (c instanceof t.BoundingBoxAttachment) {
119120                        var u = c;
119121                        s.push(u);
119122                        var _ = r.obtain();
119123                        _.length != u.worldVerticesLength && (_ = t.Utils.newFloatArray(u.worldVerticesLength));
119124                        n.push(_);
119125                        u.computeWorldVertices(h, 0, u.worldVerticesLength, _, 0, 2);
119126                      }
119127                    }
119128                  }
119129                  if (i) this.aabbCompute(); else {
119130                    this.minX = Number.POSITIVE_INFINITY;
119131                    this.minY = Number.POSITIVE_INFINITY;
119132                    this.maxX = Number.NEGATIVE_INFINITY;
119133                    this.maxY = Number.NEGATIVE_INFINITY;
119134                  }
119135                };
119136                e.prototype.aabbCompute = function() {
119137                  var t = Number.POSITIVE_INFINITY, e = Number.POSITIVE_INFINITY, i = Number.NEGATIVE_INFINITY, s = Number.NEGATIVE_INFINITY;
119138                  var n = this.polygons;
119139                  for (var r = 0, o = n.length; r < o; r++) {
119140                    var a = n[r];
119141                    var l = a;
119142                    for (var h = 0, c = a.length; h < c; h += 2) {
119143                      var u = l[h];
119144                      var _ = l[h + 1];
119145                      t = Math.min(t, u);
119146                      e = Math.min(e, _);
119147                      i = Math.max(i, u);
119148                      s = Math.max(s, _);
119149                    }
119150                  }
119151                  this.minX = t;
119152                  this.minY = e;
119153                  this.maxX = i;
119154                  this.maxY = s;
119155                };
119156                e.prototype.aabbContainsPoint = function(t, e) {
119157                  return t >= this.minX && t <= this.maxX && e >= this.minY && e <= this.maxY;
119158                };
119159                e.prototype.aabbIntersectsSegment = function(t, e, i, s) {
119160                  var n = this.minX;
119161                  var r = this.minY;
119162                  var o = this.maxX;
119163                  var a = this.maxY;
119164                  if (t <= n && i <= n || e <= r && s <= r || t >= o && i >= o || e >= a && s >= a) return !1;
119165                  var l = (s - e) / (i - t);
119166                  var h = l * (n - t) + e;
119167                  if (h > r && h < a) return !0;
119168                  if ((h = l * (o - t) + e) > r && h < a) return !0;
119169                  var c = (r - e) / l + t;
119170                  return c > n && c < o || (c = (a - e) / l + t) > n && c < o;
119171                };
119172                e.prototype.aabbIntersectsSkeleton = function(t) {
119173                  return this.minX < t.maxX && this.maxX > t.minX && this.minY < t.maxY && this.maxY > t.minY;
119174                };
119175                e.prototype.containsPoint = function(t, e) {
119176                  var i = this.polygons;
119177                  for (var s = 0, n = i.length; s < n; s++) if (this.containsPointPolygon(i[s], t, e)) return this.boundingBoxes[s];
119178                  return null;
119179                };
119180                e.prototype.containsPointPolygon = function(t, e, i) {
119181                  var s = t;
119182                  var n = t.length;
119183                  var r = n - 2;
119184                  var o = !1;
119185                  for (var a = 0; a < n; a += 2) {
119186                    var l = s[a + 1];
119187                    var h = s[r + 1];
119188                    if (l < i && h >= i || h < i && l >= i) {
119189                      var c = s[a];
119190                      c + (i - l) / (h - l) * (s[r] - c) < e && (o = !o);
119191                    }
119192                    r = a;
119193                  }
119194                  return o;
119195                };
119196                e.prototype.intersectsSegment = function(t, e, i, s) {
119197                  var n = this.polygons;
119198                  for (var r = 0, o = n.length; r < o; r++) if (this.intersectsSegmentPolygon(n[r], t, e, i, s)) return this.boundingBoxes[r];
119199                  return null;
119200                };
119201                e.prototype.intersectsSegmentPolygon = function(t, e, i, s, n) {
119202                  var r = t;
119203                  var o = t.length;
119204                  var a = e - s, l = i - n;
119205                  var h = e * n - i * s;
119206                  var c = r[o - 2], u = r[o - 1];
119207                  for (var _ = 0; _ < o; _ += 2) {
119208                    var d = r[_], p = r[_ + 1];
119209                    var m = c * p - u * d;
119210                    var f = c - d, g = u - p;
119211                    var y = a * g - l * f;
119212                    var b = (h * f - a * m) / y;
119213                    if ((b >= c && b <= d || b >= d && b <= c) && (b >= e && b <= s || b >= s && b <= e)) {
119214                      var S = (h * g - l * m) / y;
119215                      if ((S >= u && S <= p || S >= p && S <= u) && (S >= i && S <= n || S >= n && S <= i)) return !0;
119216                    }
119217                    c = d;
119218                    u = p;
119219                  }
119220                  return !1;
119221                };
119222                e.prototype.getPolygon = function(t) {
119223                  if (null == t) throw new Error("boundingBox cannot be null.");
119224                  var e = this.boundingBoxes.indexOf(t);
119225                  return -1 == e ? null : this.polygons[e];
119226                };
119227                e.prototype.getWidth = function() {
119228                  return this.maxX - this.minX;
119229                };
119230                e.prototype.getHeight = function() {
119231                  return this.maxY - this.minY;
119232                };
119233                return e;
119234              }();
119235              t.SkeletonBounds = e;
119236            }(TMt || (TMt = {}));
119237            !function(t) {
119238              var e = function() {
119239                function e() {
119240                  this.triangulator = new t.Triangulator;
119241                  this.clippingPolygon = new Array;
119242                  this.clipOutput = new Array;
119243                  this.clippedVertices = new Array;
119244                  this.clippedTriangles = new Array;
119245                  this.scratch = new Array;
119246                }
119247                e.prototype.clipStart = function(i, s) {
119248                  if (null != this.clipAttachment) return 0;
119249                  this.clipAttachment = s;
119250                  var n = s.worldVerticesLength;
119251                  var r = t.Utils.setArraySize(this.clippingPolygon, n);
119252                  s.computeWorldVertices(i, 0, n, r, 0, 2);
119253                  var o = this.clippingPolygon;
119254                  e.makeClockwise(o);
119255                  var a = this.clippingPolygons = this.triangulator.decompose(o, this.triangulator.triangulate(o));
119256                  for (var l = 0, h = a.length; l < h; l++) {
119257                    var c = a[l];
119258                    e.makeClockwise(c);
119259                    c.push(c[0]);
119260                    c.push(c[1]);
119261                  }
119262                  return a.length;
119263                };
119264                e.prototype.clipEndWithSlot = function(t) {
119265                  null != this.clipAttachment && this.clipAttachment.endSlot == t.data && this.clipEnd();
119266                };
119267                e.prototype.clipEnd = function() {
119268                  if (null != this.clipAttachment) {
119269                    this.clipAttachment = null;
119270                    this.clippingPolygons = null;
119271                    this.clippedVertices.length = 0;
119272                    this.clippedTriangles.length = 0;
119273                    this.clippingPolygon.length = 0;
119274                  }
119275                };
119276                e.prototype.isClipping = function() {
119277                  return null != this.clipAttachment;
119278                };
119279                e.prototype.clipTriangles = function(e, i, s, n, r, o, a, l, h, c, u) {
119280                  void 0 === h && (h = 2);
119281                  void 0 === c && (c = 0);
119282                  void 0 === u && (u = 0);
119283                  var _ = this.clipOutput, d = this.clippedVertices;
119284                  var p = this.clippedTriangles;
119285                  var m = this.clippingPolygons;
119286                  var f = this.clippingPolygons.length;
119287                  var g = l ? 12 : 8;
119288                  var y = 0;
119289                  d.length = 0;
119290                  p.length = 0;
119291                  t: for (var b = 0; b < n; b += 3) {
119292                    var S = s[b] * h;
119293                    var A = e[S + c], T = e[S + c + 1];
119294                    var v = r[S + u], E = r[S + u + 1];
119295                    var C = e[(S = s[b + 1] * h) + c], x = e[S + c + 1];
119296                    var w = r[S + u], R = r[S + u + 1];
119297                    var I = e[(S = s[b + 2] * h) + c], M = e[S + c + 1];
119298                    var B = r[S + u], D = r[S + u + 1];
119299                    for (var P = 0; P < f; P++) {
119300                      var O = d.length;
119301                      if (!this.clip(A, T, C, x, I, M, m[P], _)) {
119302                        (H = t.Utils.setArraySize(d, O + 3 * g))[O] = A;
119303                        H[O + 1] = T;
119304                        H[O + 2] = o.r;
119305                        H[O + 3] = o.g;
119306                        H[O + 4] = o.b;
119307                        H[O + 5] = o.a;
119308                        if (l) {
119309                          H[O + 6] = v;
119310                          H[O + 7] = E;
119311                          H[O + 8] = a.r;
119312                          H[O + 9] = a.g;
119313                          H[O + 10] = a.b;
119314                          H[O + 11] = a.a;
119315                          H[O + 12] = C;
119316                          H[O + 13] = x;
119317                          H[O + 14] = o.r;
119318                          H[O + 15] = o.g;
119319                          H[O + 16] = o.b;
119320                          H[O + 17] = o.a;
119321                          H[O + 18] = w;
119322                          H[O + 19] = R;
119323                          H[O + 20] = a.r;
119324                          H[O + 21] = a.g;
119325                          H[O + 22] = a.b;
119326                          H[O + 23] = a.a;
119327                          H[O + 24] = I;
119328                          H[O + 25] = M;
119329                          H[O + 26] = o.r;
119330                          H[O + 27] = o.g;
119331                          H[O + 28] = o.b;
119332                          H[O + 29] = o.a;
119333                          H[O + 30] = B;
119334                          H[O + 31] = D;
119335                          H[O + 32] = a.r;
119336                          H[O + 33] = a.g;
119337                          H[O + 34] = a.b;
119338                          H[O + 35] = a.a;
119339                        } else {
119340                          H[O + 6] = v;
119341                          H[O + 7] = E;
119342                          H[O + 8] = C;
119343                          H[O + 9] = x;
119344                          H[O + 10] = o.r;
119345                          H[O + 11] = o.g;
119346                          H[O + 12] = o.b;
119347                          H[O + 13] = o.a;
119348                          H[O + 14] = w;
119349                          H[O + 15] = R;
119350                          H[O + 16] = I;
119351                          H[O + 17] = M;
119352                          H[O + 18] = o.r;
119353                          H[O + 19] = o.g;
119354                          H[O + 20] = o.b;
119355                          H[O + 21] = o.a;
119356                          H[O + 22] = B;
119357                          H[O + 23] = D;
119358                        }
119359                        O = p.length;
119360                        (Q = t.Utils.setArraySize(p, O + 3))[O] = y;
119361                        Q[O + 1] = y + 1;
119362                        Q[O + 2] = y + 2;
119363                        y += 3;
119364                        continue t;
119365                      }
119366                      var N = _.length;
119367                      if (0 != N) {
119368                        var L = x - M, F = I - C, V = A - I, k = M - T;
119369                        var U = 1 / (L * V + F * (T - M));
119370                        var G = N >> 1;
119371                        var z = this.clipOutput;
119372                        var H = t.Utils.setArraySize(d, O + G * g);
119373                        for (var j = 0; j < N; j += 2) {
119374                          var X = z[j], W = z[j + 1];
119375                          H[O] = X;
119376                          H[O + 1] = W;
119377                          H[O + 2] = o.r;
119378                          H[O + 3] = o.g;
119379                          H[O + 4] = o.b;
119380                          H[O + 5] = o.a;
119381                          var Y = X - I, q = W - M;
119382                          var K = (L * Y + F * q) * U;
119383                          var J = (k * Y + V * q) * U;
119384                          var Z = 1 - K - J;
119385                          H[O + 6] = v * K + w * J + B * Z;
119386                          H[O + 7] = E * K + R * J + D * Z;
119387                          if (l) {
119388                            H[O + 8] = a.r;
119389                            H[O + 9] = a.g;
119390                            H[O + 10] = a.b;
119391                            H[O + 11] = a.a;
119392                          }
119393                          O += g;
119394                        }
119395                        O = p.length;
119396                        var Q = t.Utils.setArraySize(p, O + 3 * (G - 2));
119397                        G--;
119398                        for (j = 1; j < G; j++) {
119399                          Q[O] = y;
119400                          Q[O + 1] = y + j;
119401                          Q[O + 2] = y + j + 1;
119402                          O += 3;
119403                        }
119404                        y += G + 1;
119405                      }
119406                    }
119407                  }
119408                };
119409                e.prototype.clip = function(t, e, i, s, n, r, o, a) {
119410                  var l = a;
119411                  var h = !1;
119412                  var c = null;
119413                  if (o.length % 4 >= 2) {
119414                    c = a;
119415                    a = this.scratch;
119416                  } else c = this.scratch;
119417                  c.length = 0;
119418                  c.push(t);
119419                  c.push(e);
119420                  c.push(i);
119421                  c.push(s);
119422                  c.push(n);
119423                  c.push(r);
119424                  c.push(t);
119425                  c.push(e);
119426                  a.length = 0;
119427                  var u = o;
119428                  var _ = o.length - 4;
119429                  for (var d = 0; ;d += 2) {
119430                    var p = u[d], m = u[d + 1];
119431                    var f = u[d + 2], g = u[d + 3];
119432                    var y = p - f, b = m - g;
119433                    var S = c;
119434                    var A = c.length - 2, T = a.length;
119435                    for (var v = 0; v < A; v += 2) {
119436                      var E = S[v], C = S[v + 1];
119437                      var x = S[v + 2], w = S[v + 3];
119438                      var R = y * (w - g) - b * (x - f) > 0;
119439                      if (y * (C - g) - b * (E - f) > 0) {
119440                        if (R) {
119441                          a.push(x);
119442                          a.push(w);
119443                          continue;
119444                        }
119445                        var I = (B = w - C) * (f - p) - (D = x - E) * (g - m);
119446                        if (Math.abs(I) > 1e-6) {
119447                          var M = (D * (m - C) - B * (p - E)) / I;
119448                          a.push(p + (f - p) * M);
119449                          a.push(m + (g - m) * M);
119450                        } else {
119451                          a.push(p);
119452                          a.push(m);
119453                        }
119454                      } else if (R) {
119455                        var B, D;
119456                        I = (B = w - C) * (f - p) - (D = x - E) * (g - m);
119457                        if (Math.abs(I) > 1e-6) {
119458                          M = (D * (m - C) - B * (p - E)) / I;
119459                          a.push(p + (f - p) * M);
119460                          a.push(m + (g - m) * M);
119461                        } else {
119462                          a.push(p);
119463                          a.push(m);
119464                        }
119465                        a.push(x);
119466                        a.push(w);
119467                      }
119468                      h = !0;
119469                    }
119470                    if (T == a.length) {
119471                      l.length = 0;
119472                      return !0;
119473                    }
119474                    a.push(a[0]);
119475                    a.push(a[1]);
119476                    if (d == _) break;
119477                    var P = a;
119478                    (a = c).length = 0;
119479                    c = P;
119480                  }
119481                  if (l != a) {
119482                    l.length = 0;
119483                    d = 0;
119484                    for (var O = a.length - 2; d < O; d++) l[d] = a[d];
119485                  } else l.length = l.length - 2;
119486                  return h;
119487                };
119488                e.makeClockwise = function(t) {
119489                  var e = t;
119490                  var i = t.length;
119491                  var s = e[i - 2] * e[1] - e[0] * e[i - 1], n = 0, r = 0, o = 0;
119492                  for (var a = 0, l = i - 3; a < l; a += 2) {
119493                    n = e[a];
119494                    r = e[a + 1];
119495                    o = e[a + 2];
119496                    s += n * e[a + 3] - o * r;
119497                  }
119498                  if (!(s < 0)) {
119499                    a = 0;
119500                    var h = i - 2;
119501                    for (l = i >> 1; a < l; a += 2) {
119502                      var c = e[a], u = e[a + 1];
119503                      var _ = h - a;
119504                      e[a] = e[_];
119505                      e[a + 1] = e[_ + 1];
119506                      e[_] = c;
119507                      e[_ + 1] = u;
119508                    }
119509                  }
119510                };
119511                return e;
119512              }();
119513              t.SkeletonClipping = e;
119514            }(TMt || (TMt = {}));
119515            !function(t) {
119516              var e = function() {
119517                function t() {
119518                  this.bones = new Array;
119519                  this.slots = new Array;
119520                  this.skins = new Array;
119521                  this.events = new Array;
119522                  this.animations = new Array;
119523                  this.ikConstraints = new Array;
119524                  this.transformConstraints = new Array;
119525                  this.pathConstraints = new Array;
119526                  this.fps = 0;
119527                }
119528                t.prototype.findBone = function(t) {
119529                  if (null == t) throw new Error("boneName cannot be null.");
119530                  var e = this.bones;
119531                  for (var i = 0, s = e.length; i < s; i++) {
119532                    var n = e[i];
119533                    if (n.name == t) return n;
119534                  }
119535                  return null;
119536                };
119537                t.prototype.findBoneIndex = function(t) {
119538                  if (null == t) throw new Error("boneName cannot be null.");
119539                  var e = this.bones;
119540                  for (var i = 0, s = e.length; i < s; i++) if (e[i].name == t) return i;
119541                  return -1;
119542                };
119543                t.prototype.findSlot = function(t) {
119544                  if (null == t) throw new Error("slotName cannot be null.");
119545                  var e = this.slots;
119546                  for (var i = 0, s = e.length; i < s; i++) {
119547                    var n = e[i];
119548                    if (n.name == t) return n;
119549                  }
119550                  return null;
119551                };
119552                t.prototype.findSlotIndex = function(t) {
119553                  if (null == t) throw new Error("slotName cannot be null.");
119554                  var e = this.slots;
119555                  for (var i = 0, s = e.length; i < s; i++) if (e[i].name == t) return i;
119556                  return -1;
119557                };
119558                t.prototype.findSkin = function(t) {
119559                  if (null == t) throw new Error("skinName cannot be null.");
119560                  var e = this.skins;
119561                  for (var i = 0, s = e.length; i < s; i++) {
119562                    var n = e[i];
119563                    if (n.name == t) return n;
119564                  }
119565                  return null;
119566                };
119567                t.prototype.findEvent = function(t) {
119568                  if (null == t) throw new Error("eventDataName cannot be null.");
119569                  var e = this.events;
119570                  for (var i = 0, s = e.length; i < s; i++) {
119571                    var n = e[i];
119572                    if (n.name == t) return n;
119573                  }
119574                  return null;
119575                };
119576                t.prototype.findAnimation = function(t) {
119577                  if (null == t) throw new Error("animationName cannot be null.");
119578                  var e = this.animations;
119579                  for (var i = 0, s = e.length; i < s; i++) {
119580                    var n = e[i];
119581                    if (n.name == t) return n;
119582                  }
119583                  return null;
119584                };
119585                t.prototype.findIkConstraint = function(t) {
119586                  if (null == t) throw new Error("constraintName cannot be null.");
119587                  var e = this.ikConstraints;
119588                  for (var i = 0, s = e.length; i < s; i++) {
119589                    var n = e[i];
119590                    if (n.name == t) return n;
119591                  }
119592                  return null;
119593                };
119594                t.prototype.findTransformConstraint = function(t) {
119595                  if (null == t) throw new Error("constraintName cannot be null.");
119596                  var e = this.transformConstraints;
119597                  for (var i = 0, s = e.length; i < s; i++) {
119598                    var n = e[i];
119599                    if (n.name == t) return n;
119600                  }
119601                  return null;
119602                };
119603                t.prototype.findPathConstraint = function(t) {
119604                  if (null == t) throw new Error("constraintName cannot be null.");
119605                  var e = this.pathConstraints;
119606                  for (var i = 0, s = e.length; i < s; i++) {
119607                    var n = e[i];
119608                    if (n.name == t) return n;
119609                  }
119610                  return null;
119611                };
119612                t.prototype.findPathConstraintIndex = function(t) {
119613                  if (null == t) throw new Error("pathConstraintName cannot be null.");
119614                  var e = this.pathConstraints;
119615                  for (var i = 0, s = e.length; i < s; i++) if (e[i].name == t) return i;
119616                  return -1;
119617                };
119618                return t;
119619              }();
119620              t.SkeletonData = e;
119621            }(TMt || (TMt = {}));
119622            !function(t) {
119623              var e = function() {
119624                function e(t) {
119625                  this.scale = 1;
119626                  this.linkedMeshes = new Array;
119627                  this.attachmentLoader = t;
119628                }
119629                e.prototype.readSkeletonData = function(i) {
119630                  var s = this.scale;
119631                  var n = new t.SkeletonData;
119632                  var r = "string" == typeof i ? JSON.parse(i) : i;
119633                  var o = r.skeleton;
119634                  if (null != o) {
119635                    n.hash = o.hash;
119636                    n.version = o.spine;
119637                    n.x = o.x;
119638                    n.y = o.y;
119639                    n.width = o.width;
119640                    n.height = o.height;
119641                    n.fps = o.fps;
119642                    n.imagesPath = o.images;
119643                  }
119644                  if (r.bones) for (var a = 0; a < r.bones.length; a++) {
119645                    var l = r.bones[a];
119646                    var h = null;
119647                    var c = this.getValue(l, "parent", null);
119648                    if (null != c && null == (h = n.findBone(c))) throw new Error("Parent bone not found: " + c);
119649                    (p = new t.BoneData(n.bones.length, l.name, h)).length = this.getValue(l, "length", 0) * s;
119650                    p.x = this.getValue(l, "x", 0) * s;
119651                    p.y = this.getValue(l, "y", 0) * s;
119652                    p.rotation = this.getValue(l, "rotation", 0);
119653                    p.scaleX = this.getValue(l, "scaleX", 1);
119654                    p.scaleY = this.getValue(l, "scaleY", 1);
119655                    p.shearX = this.getValue(l, "shearX", 0);
119656                    p.shearY = this.getValue(l, "shearY", 0);
119657                    p.transformMode = e.transformModeFromString(this.getValue(l, "transform", "normal"));
119658                    p.skinRequired = this.getValue(l, "skin", !1);
119659                    n.bones.push(p);
119660                  }
119661                  if (r.slots) for (a = 0; a < r.slots.length; a++) {
119662                    var u = (I = r.slots[a]).name;
119663                    var _ = I.bone;
119664                    var d = n.findBone(_);
119665                    if (null == d) throw new Error("Slot bone not found: " + _);
119666                    var p = new t.SlotData(n.slots.length, u, d);
119667                    var m = this.getValue(I, "color", null);
119668                    null != m && p.color.setFromString(m);
119669                    var f = this.getValue(I, "dark", null);
119670                    if (null != f) {
119671                      p.darkColor = new t.Color(1, 1, 1, 1);
119672                      p.darkColor.setFromString(f);
119673                    }
119674                    p.attachmentName = this.getValue(I, "attachment", null);
119675                    p.blendMode = e.blendModeFromString(this.getValue(I, "blend", "normal"));
119676                    n.slots.push(p);
119677                  }
119678                  if (r.ik) for (a = 0; a < r.ik.length; a++) {
119679                    var g = r.ik[a];
119680                    (p = new t.IkConstraintData(g.name)).order = this.getValue(g, "order", 0);
119681                    p.skinRequired = this.getValue(g, "skin", !1);
119682                    for (var y = 0; y < g.bones.length; y++) {
119683                      _ = g.bones[y];
119684                      if (null == (x = n.findBone(_))) throw new Error("IK bone not found: " + _);
119685                      p.bones.push(x);
119686                    }
119687                    var b = g.target;
119688                    p.target = n.findBone(b);
119689                    if (null == p.target) throw new Error("IK target bone not found: " + b);
119690                    p.mix = this.getValue(g, "mix", 1);
119691                    p.softness = this.getValue(g, "softness", 0) * s;
119692                    p.bendDirection = this.getValue(g, "bendPositive", !0) ? 1 : -1;
119693                    p.compress = this.getValue(g, "compress", !1);
119694                    p.stretch = this.getValue(g, "stretch", !1);
119695                    p.uniform = this.getValue(g, "uniform", !1);
119696                    n.ikConstraints.push(p);
119697                  }
119698                  if (r.transform) for (a = 0; a < r.transform.length; a++) {
119699                    g = r.transform[a];
119700                    (p = new t.TransformConstraintData(g.name)).order = this.getValue(g, "order", 0);
119701                    p.skinRequired = this.getValue(g, "skin", !1);
119702                    for (y = 0; y < g.bones.length; y++) {
119703                      _ = g.bones[y];
119704                      if (null == (x = n.findBone(_))) throw new Error("Transform constraint bone not found: " + _);
119705                      p.bones.push(x);
119706                    }
119707                    b = g.target;
119708                    p.target = n.findBone(b);
119709                    if (null == p.target) throw new Error("Transform constraint target bone not found: " + b);
119710                    p.local = this.getValue(g, "local", !1);
119711                    p.relative = this.getValue(g, "relative", !1);
119712                    p.offsetRotation = this.getValue(g, "rotation", 0);
119713                    p.offsetX = this.getValue(g, "x", 0) * s;
119714                    p.offsetY = this.getValue(g, "y", 0) * s;
119715                    p.offsetScaleX = this.getValue(g, "scaleX", 0);
119716                    p.offsetScaleY = this.getValue(g, "scaleY", 0);
119717                    p.offsetShearY = this.getValue(g, "shearY", 0);
119718                    p.rotateMix = this.getValue(g, "rotateMix", 1);
119719                    p.translateMix = this.getValue(g, "translateMix", 1);
119720                    p.scaleMix = this.getValue(g, "scaleMix", 1);
119721                    p.shearMix = this.getValue(g, "shearMix", 1);
119722                    n.transformConstraints.push(p);
119723                  }
119724                  if (r.path) for (a = 0; a < r.path.length; a++) {
119725                    g = r.path[a];
119726                    (p = new t.PathConstraintData(g.name)).order = this.getValue(g, "order", 0);
119727                    p.skinRequired = this.getValue(g, "skin", !1);
119728                    for (y = 0; y < g.bones.length; y++) {
119729                      _ = g.bones[y];
119730                      if (null == (x = n.findBone(_))) throw new Error("Transform constraint bone not found: " + _);
119731                      p.bones.push(x);
119732                    }
119733                    b = g.target;
119734                    p.target = n.findSlot(b);
119735                    if (null == p.target) throw new Error("Path target slot not found: " + b);
119736                    p.positionMode = e.positionModeFromString(this.getValue(g, "positionMode", "percent"));
119737                    p.spacingMode = e.spacingModeFromString(this.getValue(g, "spacingMode", "length"));
119738                    p.rotateMode = e.rotateModeFromString(this.getValue(g, "rotateMode", "tangent"));
119739                    p.offsetRotation = this.getValue(g, "rotation", 0);
119740                    p.position = this.getValue(g, "position", 0);
119741                    p.positionMode == t.PositionMode.Fixed && (p.position *= s);
119742                    p.spacing = this.getValue(g, "spacing", 0);
119743                    p.spacingMode != t.SpacingMode.Length && p.spacingMode != t.SpacingMode.Fixed || (p.spacing *= s);
119744                    p.rotateMix = this.getValue(g, "rotateMix", 1);
119745                    p.translateMix = this.getValue(g, "translateMix", 1);
119746                    n.pathConstraints.push(p);
119747                  }
119748                  if (r.skins) {
119749                    var S = r.skins;
119750                    if (!(S instanceof Array)) {
119751                      var A = [];
119752                      for (var T in S) A.push({
119753                        name: T,
119754                        attachments: S[T]
119755                      });
119756                      S = A;
119757                    }
119758                    for (a = 0; a < S.length; a++) {
119759                      var v = S[a];
119760                      var E = new t.Skin(v.name);
119761                      if (v.bones) for (var C = 0; C < v.bones.length; C++) {
119762                        var x;
119763                        if (null == (x = n.findBone(v.bones[C]))) throw new Error("Skin bone not found: " + v.bones[C]);
119764                        E.bones.push(x);
119765                      }
119766                      if (v.ik) for (C = 0; C < v.ik.length; C++) {
119767                        if (null == (w = n.findIkConstraint(v.ik[C]))) throw new Error("Skin IK constraint not found: " + v.ik[C]);
119768                        E.constraints.push(w);
119769                      }
119770                      if (v.transform) for (C = 0; C < v.transform.length; C++) {
119771                        if (null == (w = n.findTransformConstraint(v.transform[C]))) throw new Error("Skin transform constraint not found: " + v.transform[C]);
119772                        E.constraints.push(w);
119773                      }
119774                      if (v.path) for (C = 0; C < v.path.length; C++) {
119775                        var w;
119776                        if (null == (w = n.findPathConstraint(v.path[C]))) throw new Error("Skin path constraint not found: " + v.path[C]);
119777                        E.constraints.push(w);
119778                      }
119779                      for (var u in v.attachments) {
119780                        var R = n.findSlot(u);
119781                        if (null == R) throw new Error("Slot not found: " + u);
119782                        var I = v.attachments[u];
119783                        for (var M in I) {
119784                          var B = this.readAttachment(I[M], E, R.index, M, n);
119785                          null != B && E.setAttachment(R.index, M, B);
119786                        }
119787                      }
119788                      n.skins.push(E);
119789                      "default" == E.name && (n.defaultSkin = E);
119790                    }
119791                  }
119792                  a = 0;
119793                  for (var D = this.linkedMeshes.length; a < D; a++) {
119794                    var P = this.linkedMeshes[a];
119795                    if (null == (E = null == P.skin ? n.defaultSkin : n.findSkin(P.skin))) throw new Error("Skin not found: " + P.skin);
119796                    var O = E.getAttachment(P.slotIndex, P.parent);
119797                    if (null == O) throw new Error("Parent mesh not found: " + P.parent);
119798                    P.mesh.deformAttachment = P.inheritDeform ? O : P.mesh;
119799                    P.mesh.setParentMesh(O);
119800                    P.mesh.updateUVs();
119801                  }
119802                  this.linkedMeshes.length = 0;
119803                  if (r.events) for (var N in r.events) {
119804                    var L = r.events[N];
119805                    (p = new t.EventData(N)).intValue = this.getValue(L, "int", 0);
119806                    p.floatValue = this.getValue(L, "float", 0);
119807                    p.stringValue = this.getValue(L, "string", "");
119808                    p.audioPath = this.getValue(L, "audio", null);
119809                    if (null != p.audioPath) {
119810                      p.volume = this.getValue(L, "volume", 1);
119811                      p.balance = this.getValue(L, "balance", 0);
119812                    }
119813                    n.events.push(p);
119814                  }
119815                  if (r.animations) for (var F in r.animations) {
119816                    var V = r.animations[F];
119817                    this.readAnimation(V, F, n);
119818                  }
119819                  return n;
119820                };
119821                e.prototype.readAttachment = function(e, s, n, r, o) {
119822                  var a = this.scale;
119823                  r = this.getValue(e, "name", r);
119824                  switch (this.getValue(e, "type", "region")) {
119825                   case "region":
119826                    var l = this.getValue(e, "path", r);
119827                    var h = this.attachmentLoader.newRegionAttachment(s, r, l);
119828                    if (null == h) return null;
119829                    h.path = l;
119830                    h.x = this.getValue(e, "x", 0) * a;
119831                    h.y = this.getValue(e, "y", 0) * a;
119832                    h.scaleX = this.getValue(e, "scaleX", 1);
119833                    h.scaleY = this.getValue(e, "scaleY", 1);
119834                    h.rotation = this.getValue(e, "rotation", 0);
119835                    h.width = e.width * a;
119836                    h.height = e.height * a;
119837                    null != (A = this.getValue(e, "color", null)) && h.color.setFromString(A);
119838                    h.updateOffset();
119839                    return h;
119840
119841                   case "boundingbox":
119842                    var c = this.attachmentLoader.newBoundingBoxAttachment(s, r);
119843                    if (null == c) return null;
119844                    this.readVertices(e, c, e.vertexCount << 1);
119845                    null != (A = this.getValue(e, "color", null)) && c.color.setFromString(A);
119846                    return c;
119847
119848                   case "mesh":
119849                   case "linkedmesh":
119850                    l = this.getValue(e, "path", r);
119851                    var u = this.attachmentLoader.newMeshAttachment(s, r, l);
119852                    if (null == u) return null;
119853                    u.path = l;
119854                    null != (A = this.getValue(e, "color", null)) && u.color.setFromString(A);
119855                    u.width = this.getValue(e, "width", 0) * a;
119856                    u.height = this.getValue(e, "height", 0) * a;
119857                    var _ = this.getValue(e, "parent", null);
119858                    if (null != _) {
119859                      this.linkedMeshes.push(new i(u, this.getValue(e, "skin", null), n, _, this.getValue(e, "deform", !0)));
119860                      return u;
119861                    }
119862                    var d = e.uvs;
119863                    this.readVertices(e, u, d.length);
119864                    u.triangles = e.triangles;
119865                    u.regionUVs = d;
119866                    u.updateUVs();
119867                    u.edges = this.getValue(e, "edges", null);
119868                    u.hullLength = 2 * this.getValue(e, "hull", 0);
119869                    return u;
119870
119871                   case "path":
119872                    if (null == (l = this.attachmentLoader.newPathAttachment(s, r))) return null;
119873                    l.closed = this.getValue(e, "closed", !1);
119874                    l.constantSpeed = this.getValue(e, "constantSpeed", !0);
119875                    var p = e.vertexCount;
119876                    this.readVertices(e, l, p << 1);
119877                    var m = t.Utils.newArray(p / 3, 0);
119878                    for (var f = 0; f < e.lengths.length; f++) m[f] = e.lengths[f] * a;
119879                    l.lengths = m;
119880                    null != (A = this.getValue(e, "color", null)) && l.color.setFromString(A);
119881                    return l;
119882
119883                   case "point":
119884                    var g = this.attachmentLoader.newPointAttachment(s, r);
119885                    if (null == g) return null;
119886                    g.x = this.getValue(e, "x", 0) * a;
119887                    g.y = this.getValue(e, "y", 0) * a;
119888                    g.rotation = this.getValue(e, "rotation", 0);
119889                    null != (A = this.getValue(e, "color", null)) && g.color.setFromString(A);
119890                    return g;
119891
119892                   case "clipping":
119893                    var y = this.attachmentLoader.newClippingAttachment(s, r);
119894                    if (null == y) return null;
119895                    var b = this.getValue(e, "end", null);
119896                    if (null != b) {
119897                      var S = o.findSlot(b);
119898                      if (null == S) throw new Error("Clipping end slot not found: " + b);
119899                      y.endSlot = S;
119900                    }
119901                    p = e.vertexCount;
119902                    this.readVertices(e, y, p << 1);
119903                    var A;
119904                    null != (A = this.getValue(e, "color", null)) && y.color.setFromString(A);
119905                    return y;
119906                  }
119907                  return null;
119908                };
119909                e.prototype.readVertices = function(e, i, s) {
119910                  var n = this.scale;
119911                  i.worldVerticesLength = s;
119912                  var r = e.vertices;
119913                  if (s != r.length) {
119914                    var o = new Array;
119915                    var a = new Array;
119916                    for (u = 0, _ = r.length; u < _; ) {
119917                      var l = r[u++];
119918                      a.push(l);
119919                      for (var h = u + 4 * l; u < h; u += 4) {
119920                        a.push(r[u]);
119921                        o.push(r[u + 1] * n);
119922                        o.push(r[u + 2] * n);
119923                        o.push(r[u + 3]);
119924                      }
119925                    }
119926                    i.bones = a;
119927                    i.vertices = t.Utils.toFloatArray(o);
119928                  } else {
119929                    var c = t.Utils.toFloatArray(r);
119930                    if (1 != n) for (var u = 0, _ = r.length; u < _; u++) c[u] *= n;
119931                    i.vertices = c;
119932                  }
119933                };
119934                e.prototype.readAnimation = function(e, i, s) {
119935                  var n = this.scale;
119936                  var r = new Array;
119937                  var o = 0;
119938                  if (e.slots) for (var a in e.slots) {
119939                    var l = e.slots[a];
119940                    if (-1 == (Q = s.findSlotIndex(a))) throw new Error("Slot not found: " + a);
119941                    for (var h in l) {
119942                      var c = l[h];
119943                      if ("attachment" == h) {
119944                        (S = new t.AttachmentTimeline(c.length)).slotIndex = Q;
119945                        var u = 0;
119946                        for (var _ = 0; _ < c.length; _++) {
119947                          var d = c[_];
119948                          S.setFrame(u++, this.getValue(d, "time", 0), d.name);
119949                        }
119950                        r.push(S);
119951                        o = Math.max(o, S.frames[S.getFrameCount() - 1]);
119952                      } else if ("color" == h) {
119953                        (S = new t.ColorTimeline(c.length)).slotIndex = Q;
119954                        u = 0;
119955                        for (_ = 0; _ < c.length; _++) {
119956                          d = c[_];
119957                          var p = new t.Color;
119958                          p.setFromString(d.color);
119959                          S.setFrame(u, this.getValue(d, "time", 0), p.r, p.g, p.b, p.a);
119960                          this.readCurve(d, S, u);
119961                          u++;
119962                        }
119963                        r.push(S);
119964                        o = Math.max(o, S.frames[(S.getFrameCount() - 1) * t.ColorTimeline.ENTRIES]);
119965                      } else {
119966                        if ("twoColor" != h) throw new Error("Invalid timeline type for a slot: " + h + " (" + a + ")");
119967                        (S = new t.TwoColorTimeline(c.length)).slotIndex = Q;
119968                        u = 0;
119969                        for (_ = 0; _ < c.length; _++) {
119970                          d = c[_];
119971                          var m = new t.Color;
119972                          var f = new t.Color;
119973                          m.setFromString(d.light);
119974                          f.setFromString(d.dark);
119975                          S.setFrame(u, this.getValue(d, "time", 0), m.r, m.g, m.b, m.a, f.r, f.g, f.b);
119976                          this.readCurve(d, S, u);
119977                          u++;
119978                        }
119979                        r.push(S);
119980                        o = Math.max(o, S.frames[(S.getFrameCount() - 1) * t.TwoColorTimeline.ENTRIES]);
119981                      }
119982                    }
119983                  }
119984                  if (e.bones) for (var g in e.bones) {
119985                    var y = e.bones[g];
119986                    var b = s.findBoneIndex(g);
119987                    if (-1 == b) throw new Error("Bone not found: " + g);
119988                    for (var h in y) {
119989                      c = y[h];
119990                      if ("rotate" === h) {
119991                        (S = new t.RotateTimeline(c.length)).boneIndex = b;
119992                        u = 0;
119993                        for (_ = 0; _ < c.length; _++) {
119994                          d = c[_];
119995                          S.setFrame(u, this.getValue(d, "time", 0), this.getValue(d, "angle", 0));
119996                          this.readCurve(d, S, u);
119997                          u++;
119998                        }
119999                        r.push(S);
120000                        o = Math.max(o, S.frames[(S.getFrameCount() - 1) * t.RotateTimeline.ENTRIES]);
120001                      } else {
120002                        if ("translate" !== h && "scale" !== h && "shear" !== h) throw new Error("Invalid timeline type for a bone: " + h + " (" + g + ")");
120003                        var S = null;
120004                        var A = 1, T = 0;
120005                        if ("scale" === h) {
120006                          S = new t.ScaleTimeline(c.length);
120007                          T = 1;
120008                        } else if ("shear" === h) S = new t.ShearTimeline(c.length); else {
120009                          S = new t.TranslateTimeline(c.length);
120010                          A = n;
120011                        }
120012                        S.boneIndex = b;
120013                        u = 0;
120014                        for (_ = 0; _ < c.length; _++) {
120015                          d = c[_];
120016                          var v = this.getValue(d, "x", T), E = this.getValue(d, "y", T);
120017                          S.setFrame(u, this.getValue(d, "time", 0), v * A, E * A);
120018                          this.readCurve(d, S, u);
120019                          u++;
120020                        }
120021                        r.push(S);
120022                        o = Math.max(o, S.frames[(S.getFrameCount() - 1) * t.TranslateTimeline.ENTRIES]);
120023                      }
120024                    }
120025                  }
120026                  if (e.ik) for (var C in e.ik) {
120027                    var x = e.ik[C];
120028                    var w = s.findIkConstraint(C);
120029                    (S = new t.IkConstraintTimeline(x.length)).ikConstraintIndex = s.ikConstraints.indexOf(w);
120030                    u = 0;
120031                    for (_ = 0; _ < x.length; _++) {
120032                      d = x[_];
120033                      S.setFrame(u, this.getValue(d, "time", 0), this.getValue(d, "mix", 1), this.getValue(d, "softness", 0) * n, this.getValue(d, "bendPositive", !0) ? 1 : -1, this.getValue(d, "compress", !1), this.getValue(d, "stretch", !1));
120034                      this.readCurve(d, S, u);
120035                      u++;
120036                    }
120037                    r.push(S);
120038                    o = Math.max(o, S.frames[(S.getFrameCount() - 1) * t.IkConstraintTimeline.ENTRIES]);
120039                  }
120040                  if (e.transform) for (var C in e.transform) {
120041                    x = e.transform[C];
120042                    w = s.findTransformConstraint(C);
120043                    (S = new t.TransformConstraintTimeline(x.length)).transformConstraintIndex = s.transformConstraints.indexOf(w);
120044                    u = 0;
120045                    for (_ = 0; _ < x.length; _++) {
120046                      d = x[_];
120047                      S.setFrame(u, this.getValue(d, "time", 0), this.getValue(d, "rotateMix", 1), this.getValue(d, "translateMix", 1), this.getValue(d, "scaleMix", 1), this.getValue(d, "shearMix", 1));
120048                      this.readCurve(d, S, u);
120049                      u++;
120050                    }
120051                    r.push(S);
120052                    o = Math.max(o, S.frames[(S.getFrameCount() - 1) * t.TransformConstraintTimeline.ENTRIES]);
120053                  }
120054                  let R = e.path || e.paths;
120055                  if (R) for (var C in R) {
120056                    x = R[C];
120057                    var I = s.findPathConstraintIndex(C);
120058                    if (-1 == I) throw new Error("Path constraint not found: " + C);
120059                    var M = s.pathConstraints[I];
120060                    for (var h in x) {
120061                      c = x[h];
120062                      if ("position" === h || "spacing" === h) {
120063                        S = null;
120064                        A = 1;
120065                        if ("spacing" === h) {
120066                          S = new t.PathConstraintSpacingTimeline(c.length);
120067                          M.spacingMode != t.SpacingMode.Length && M.spacingMode != t.SpacingMode.Fixed || (A = n);
120068                        } else {
120069                          S = new t.PathConstraintPositionTimeline(c.length);
120070                          M.positionMode == t.PositionMode.Fixed && (A = n);
120071                        }
120072                        S.pathConstraintIndex = I;
120073                        u = 0;
120074                        for (_ = 0; _ < c.length; _++) {
120075                          d = c[_];
120076                          S.setFrame(u, this.getValue(d, "time", 0), this.getValue(d, h, 0) * A);
120077                          this.readCurve(d, S, u);
120078                          u++;
120079                        }
120080                        r.push(S);
120081                        o = Math.max(o, S.frames[(S.getFrameCount() - 1) * t.PathConstraintPositionTimeline.ENTRIES]);
120082                      } else if ("mix" === h) {
120083                        (S = new t.PathConstraintMixTimeline(c.length)).pathConstraintIndex = I;
120084                        u = 0;
120085                        for (_ = 0; _ < c.length; _++) {
120086                          d = c[_];
120087                          S.setFrame(u, this.getValue(d, "time", 0), this.getValue(d, "rotateMix", 1), this.getValue(d, "translateMix", 1));
120088                          this.readCurve(d, S, u);
120089                          u++;
120090                        }
120091                        r.push(S);
120092                        o = Math.max(o, S.frames[(S.getFrameCount() - 1) * t.PathConstraintMixTimeline.ENTRIES]);
120093                      }
120094                    }
120095                  }
120096                  if (e.deform) for (var B in e.deform) {
120097                    var D = e.deform[B];
120098                    var P = s.findSkin(B);
120099                    if (null == P) throw new Error("Skin not found: " + B);
120100                    for (var a in D) {
120101                      l = D[a];
120102                      if (-1 == (Q = s.findSlotIndex(a))) throw new Error("Slot not found: " + l.name);
120103                      for (var h in l) {
120104                        c = l[h];
120105                        var O = P.getAttachment(Q, h);
120106                        if (null != O) {
120107                          var N = null != O.bones;
120108                          var L = O.vertices;
120109                          var F = N ? L.length / 3 * 2 : L.length;
120110                          (S = new t.DeformTimeline(c.length)).slotIndex = Q;
120111                          S.attachment = O;
120112                          u = 0;
120113                          for (var V = 0; V < c.length; V++) {
120114                            d = c[V];
120115                            var k = void 0;
120116                            var U = this.getValue(d, "vertices", null);
120117                            if (null == U) k = N ? t.Utils.newFloatArray(F) : L; else {
120118                              k = t.Utils.newFloatArray(F);
120119                              var G = this.getValue(d, "offset", 0);
120120                              t.Utils.arrayCopy(U, 0, k, G, U.length);
120121                              if (1 != n) for (var z = (_ = G) + U.length; _ < z; _++) k[_] *= n;
120122                              if (!N) for (_ = 0; _ < F; _++) k[_] += L[_];
120123                            }
120124                            S.setFrame(u, this.getValue(d, "time", 0), k);
120125                            this.readCurve(d, S, u);
120126                            u++;
120127                          }
120128                          r.push(S);
120129                          o = Math.max(o, S.frames[S.getFrameCount() - 1]);
120130                        }
120131                      }
120132                    }
120133                  }
120134                  var H = e.drawOrder;
120135                  null == H && (H = e.draworder);
120136                  if (null != H) {
120137                    S = new t.DrawOrderTimeline(H.length);
120138                    var j = s.slots.length;
120139                    u = 0;
120140                    for (V = 0; V < H.length; V++) {
120141                      var X = H[V];
120142                      var W = null;
120143                      var Y = this.getValue(X, "offsets", null);
120144                      if (null != Y) {
120145                        W = t.Utils.newArray(j, -1);
120146                        var q = t.Utils.newArray(j - Y.length, 0);
120147                        var K = 0, J = 0;
120148                        for (_ = 0; _ < Y.length; _++) {
120149                          var Z = Y[_];
120150                          var Q;
120151                          if (-1 == (Q = s.findSlotIndex(Z.slot))) throw new Error("Slot not found: " + Z.slot);
120152                          for (;K != Q; ) q[J++] = K++;
120153                          W[K + Z.offset] = K++;
120154                        }
120155                        for (;K < j; ) q[J++] = K++;
120156                        for (_ = j - 1; _ >= 0; _--) -1 == W[_] && (W[_] = q[--J]);
120157                      }
120158                      S.setFrame(u++, this.getValue(X, "time", 0), W);
120159                    }
120160                    r.push(S);
120161                    o = Math.max(o, S.frames[S.getFrameCount() - 1]);
120162                  }
120163                  if (e.events) {
120164                    S = new t.EventTimeline(e.events.length);
120165                    u = 0;
120166                    for (_ = 0; _ < e.events.length; _++) {
120167                      var $ = e.events[_];
120168                      var tt = s.findEvent($.name);
120169                      if (null == tt) throw new Error("Event not found: " + $.name);
120170                      var et = new t.Event(t.Utils.toSinglePrecision(this.getValue($, "time", 0)), tt);
120171                      et.intValue = this.getValue($, "int", tt.intValue);
120172                      et.floatValue = this.getValue($, "float", tt.floatValue);
120173                      et.stringValue = this.getValue($, "string", tt.stringValue);
120174                      if (null != et.data.audioPath) {
120175                        et.volume = this.getValue($, "volume", 1);
120176                        et.balance = this.getValue($, "balance", 0);
120177                      }
120178                      S.setFrame(u++, et);
120179                    }
120180                    r.push(S);
120181                    o = Math.max(o, S.frames[S.getFrameCount() - 1]);
120182                  }
120183                  if (isNaN(o)) throw new Error("Error while parsing animation, duration is NaN");
120184                  s.animations.push(new t.Animation(i, r, o));
120185                };
120186                e.prototype.readCurve = function(t, e, i) {
120187                  var s = t.curve;
120188                  s && ("stepped" == s ? e.setStepped(i) : "[object Array]" === Object.prototype.toString.call(s) ? e.setCurve(i, s[0], s[1], s[2], s[3]) : e.setCurve(i, s, this.getValue(t, "c2", 0), this.getValue(t, "c3", 1), this.getValue(t, "c4", 1)));
120189                };
120190                e.prototype.getValue = function(t, e, i) {
120191                  return void 0 !== t[e] ? t[e] : i;
120192                };
120193                e.blendModeFromString = function(e) {
120194                  if ("normal" == (e = e.toLowerCase())) return t.BlendMode.Normal;
120195                  if ("additive" == e) return t.BlendMode.Additive;
120196                  if ("multiply" == e) return t.BlendMode.Multiply;
120197                  if ("screen" == e) return t.BlendMode.Screen;
120198                  throw new Error("Unknown blend mode: " + e);
120199                };
120200                e.positionModeFromString = function(e) {
120201                  if ("fixed" == (e = e.toLowerCase())) return t.PositionMode.Fixed;
120202                  if ("percent" == e) return t.PositionMode.Percent;
120203                  throw new Error("Unknown position mode: " + e);
120204                };
120205                e.spacingModeFromString = function(e) {
120206                  if ("length" == (e = e.toLowerCase())) return t.SpacingMode.Length;
120207                  if ("fixed" == e) return t.SpacingMode.Fixed;
120208                  if ("percent" == e) return t.SpacingMode.Percent;
120209                  throw new Error("Unknown position mode: " + e);
120210                };
120211                e.rotateModeFromString = function(e) {
120212                  if ("tangent" == (e = e.toLowerCase())) return t.RotateMode.Tangent;
120213                  if ("chain" == e) return t.RotateMode.Chain;
120214                  if ("chainscale" == e) return t.RotateMode.ChainScale;
120215                  throw new Error("Unknown rotate mode: " + e);
120216                };
120217                e.transformModeFromString = function(e) {
120218                  if ("normal" == (e = e.toLowerCase())) return t.TransformMode.Normal;
120219                  if ("onlytranslation" == e) return t.TransformMode.OnlyTranslation;
120220                  if ("norotationorreflection" == e) return t.TransformMode.NoRotationOrReflection;
120221                  if ("noscale" == e) return t.TransformMode.NoScale;
120222                  if ("noscaleorreflection" == e) return t.TransformMode.NoScaleOrReflection;
120223                  throw new Error("Unknown transform mode: " + e);
120224                };
120225                return e;
120226              }();
120227              t.SkeletonJson = e;
120228              var i = function(t, e, i, s, n) {
120229                this.mesh = t;
120230                this.skin = e;
120231                this.slotIndex = i;
120232                this.parent = s;
120233                this.inheritDeform = n;
120234              };
120235            }(TMt || (TMt = {}));
120236            !function(t) {
120237              var e = function(t, e, i) {
120238                this.slotIndex = t;
120239                this.name = e;
120240                this.attachment = i;
120241              };
120242              t.SkinEntry = e;
120243              var i = function() {
120244                function i(t) {
120245                  this.attachments = new Array;
120246                  this.bones = Array();
120247                  this.constraints = new Array;
120248                  if (null == t) throw new Error("name cannot be null.");
120249                  this.name = t;
120250                }
120251                i.prototype.setAttachment = function(t, e, i) {
120252                  if (null == i) throw new Error("attachment cannot be null.");
120253                  var s = this.attachments;
120254                  t >= s.length && (s.length = t + 1);
120255                  s[t] || (s[t] = {});
120256                  s[t][e] = i;
120257                };
120258                i.prototype.addSkin = function(t) {
120259                  for (var e = 0; e < t.bones.length; e++) {
120260                    var i = t.bones[e];
120261                    var s = !1;
120262                    for (var n = 0; n < this.bones.length; n++) if (this.bones[n] == i) {
120263                      s = !0;
120264                      break;
120265                    }
120266                    s || this.bones.push(i);
120267                  }
120268                  for (e = 0; e < t.constraints.length; e++) {
120269                    var r = t.constraints[e];
120270                    s = !1;
120271                    for (n = 0; n < this.constraints.length; n++) if (this.constraints[n] == r) {
120272                      s = !0;
120273                      break;
120274                    }
120275                    s || this.constraints.push(r);
120276                  }
120277                  var o = t.getAttachments();
120278                  for (e = 0; e < o.length; e++) {
120279                    var a = o[e];
120280                    this.setAttachment(a.slotIndex, a.name, a.attachment);
120281                  }
120282                };
120283                i.prototype.copySkin = function(e) {
120284                  for (var i = 0; i < e.bones.length; i++) {
120285                    var s = e.bones[i];
120286                    var n = !1;
120287                    for (var r = 0; r < this.bones.length; r++) if (this.bones[r] == s) {
120288                      n = !0;
120289                      break;
120290                    }
120291                    n || this.bones.push(s);
120292                  }
120293                  for (i = 0; i < e.constraints.length; i++) {
120294                    var o = e.constraints[i];
120295                    n = !1;
120296                    for (r = 0; r < this.constraints.length; r++) if (this.constraints[r] == o) {
120297                      n = !0;
120298                      break;
120299                    }
120300                    n || this.constraints.push(o);
120301                  }
120302                  var a = e.getAttachments();
120303                  for (i = 0; i < a.length; i++) {
120304                    var l = a[i];
120305                    if (null != l.attachment) if (l.attachment instanceof t.MeshAttachment) {
120306                      l.attachment = l.attachment.newLinkedMesh();
120307                      this.setAttachment(l.slotIndex, l.name, l.attachment);
120308                    } else {
120309                      l.attachment = l.attachment.copy();
120310                      this.setAttachment(l.slotIndex, l.name, l.attachment);
120311                    }
120312                  }
120313                };
120314                i.prototype.getAttachment = function(t, e) {
120315                  var i = this.attachments[t];
120316                  return i ? i[e] : null;
120317                };
120318                i.prototype.removeAttachment = function(t, e) {
120319                  var i = this.attachments[t];
120320                  i && (i[e] = null);
120321                };
120322                i.prototype.getAttachments = function() {
120323                  var t = new Array;
120324                  for (var i = 0; i < this.attachments.length; i++) {
120325                    var s = this.attachments[i];
120326                    if (s) for (var n in s) {
120327                      var r = s[n];
120328                      r && t.push(new e(i, n, r));
120329                    }
120330                  }
120331                  return t;
120332                };
120333                i.prototype.getAttachmentsForSlot = function(t, i) {
120334                  var s = this.attachments[t];
120335                  if (s) for (var n in s) {
120336                    var r = s[n];
120337                    r && i.push(new e(t, n, r));
120338                  }
120339                };
120340                i.prototype.clear = function() {
120341                  this.attachments.length = 0;
120342                  this.bones.length = 0;
120343                  this.constraints.length = 0;
120344                };
120345                i.prototype.attachAll = function(t, e) {
120346                  var i = 0;
120347                  for (var s = 0; s < t.slots.length; s++) {
120348                    var n = t.slots[s];
120349                    var r = n.getAttachment();
120350                    if (r && i < e.attachments.length) {
120351                      var o = e.attachments[i];
120352                      for (var a in o) {
120353                        if (r == o[a]) {
120354                          var l = this.getAttachment(i, a);
120355                          null != l && n.setAttachment(l);
120356                          break;
120357                        }
120358                      }
120359                    }
120360                    i++;
120361                  }
120362                };
120363                return i;
120364              }();
120365              t.Skin = i;
120366            }(TMt || (TMt = {}));
120367            !function(t) {
120368              var e = function() {
120369                function e(e, i) {
120370                  this.deform = new Array;
120371                  if (null == e) throw new Error("data cannot be null.");
120372                  if (null == i) throw new Error("bone cannot be null.");
120373                  this.data = e;
120374                  this.bone = i;
120375                  this.color = new t.Color;
120376                  this.darkColor = null == e.darkColor ? null : new t.Color;
120377                  this.setToSetupPose();
120378                }
120379                e.prototype.getSkeleton = function() {
120380                  return this.bone.skeleton;
120381                };
120382                e.prototype.getAttachment = function() {
120383                  return this.attachment;
120384                };
120385                e.prototype.setAttachment = function(t) {
120386                  if (this.attachment != t) {
120387                    this.attachment = t;
120388                    this.attachmentTime = this.bone.skeleton.time;
120389                    this.deform.length = 0;
120390                  }
120391                };
120392                e.prototype.setAttachmentTime = function(t) {
120393                  this.attachmentTime = this.bone.skeleton.time - t;
120394                };
120395                e.prototype.getAttachmentTime = function() {
120396                  return this.bone.skeleton.time - this.attachmentTime;
120397                };
120398                e.prototype.setToSetupPose = function() {
120399                  this.color.setFromColor(this.data.color);
120400                  null != this.darkColor && this.darkColor.setFromColor(this.data.darkColor);
120401                  if (null == this.data.attachmentName) this.attachment = null; else {
120402                    this.attachment = null;
120403                    this.setAttachment(this.bone.skeleton.getAttachment(this.data.index, this.data.attachmentName));
120404                  }
120405                };
120406                return e;
120407              }();
120408              t.Slot = e;
120409            }(TMt || (TMt = {}));
120410            !function(t) {
120411              var e = function(e, i, s) {
120412                this.color = new t.Color(1, 1, 1, 1);
120413                if (e < 0) throw new Error("index must be >= 0.");
120414                if (null == i) throw new Error("name cannot be null.");
120415                if (null == s) throw new Error("boneData cannot be null.");
120416                this.index = e;
120417                this.name = i;
120418                this.boneData = s;
120419              };
120420              t.SlotData = e;
120421            }(TMt || (TMt = {}));
120422            !function(t) {
120423              var e = function() {
120424                function t(t) {
120425                  this._image = t;
120426                }
120427                t.prototype.getImage = function() {
120428                  return this._image;
120429                };
120430                t.filterFromString = function(t) {
120431                  switch (t.toLowerCase()) {
120432                   case "nearest":
120433                    return i.Nearest;
120434
120435                   case "linear":
120436                    return i.Linear;
120437
120438                   case "mipmap":
120439                    return i.MipMap;
120440
120441                   case "mipmapnearestnearest":
120442                    return i.MipMapNearestNearest;
120443
120444                   case "mipmaplinearnearest":
120445                    return i.MipMapLinearNearest;
120446
120447                   case "mipmapnearestlinear":
120448                    return i.MipMapNearestLinear;
120449
120450                   case "mipmaplinearlinear":
120451                    return i.MipMapLinearLinear;
120452
120453                   default:
120454                    throw new Error("Unknown texture filter " + t);
120455                  }
120456                };
120457                t.wrapFromString = function(t) {
120458                  switch (t.toLowerCase()) {
120459                   case "mirroredtepeat":
120460                    return s.MirroredRepeat;
120461
120462                   case "clamptoedge":
120463                    return s.ClampToEdge;
120464
120465                   case "repeat":
120466                    return s.Repeat;
120467
120468                   default:
120469                    throw new Error("Unknown texture wrap " + t);
120470                  }
120471                };
120472                return t;
120473              }();
120474              t.Texture = e;
120475              var i;
120476              !function(t) {
120477                t[t.Nearest = 9728] = "Nearest";
120478                t[t.Linear = 9729] = "Linear";
120479                t[t.MipMap = 9987] = "MipMap";
120480                t[t.MipMapNearestNearest = 9984] = "MipMapNearestNearest";
120481                t[t.MipMapLinearNearest = 9985] = "MipMapLinearNearest";
120482                t[t.MipMapNearestLinear = 9986] = "MipMapNearestLinear";
120483                t[t.MipMapLinearLinear = 9987] = "MipMapLinearLinear";
120484              }(i = t.TextureFilter || (t.TextureFilter = {}));
120485              var s;
120486              !function(t) {
120487                t[t.MirroredRepeat = 33648] = "MirroredRepeat";
120488                t[t.ClampToEdge = 33071] = "ClampToEdge";
120489                t[t.Repeat = 10497] = "Repeat";
120490              }(s = t.TextureWrap || (t.TextureWrap = {}));
120491              var n = function() {
120492                this.u = 0;
120493                this.v = 0;
120494                this.u2 = 0;
120495                this.v2 = 0;
120496                this.width = 0;
120497                this.height = 0;
120498                this.rotate = !1;
120499                this.offsetX = 0;
120500                this.offsetY = 0;
120501                this.originalWidth = 0;
120502                this.originalHeight = 0;
120503              };
120504              t.TextureRegion = n;
120505              var r = function(t) {
120506                AMt(e, t);
120507                function e() {
120508                  return null !== t && t.apply(this, arguments) || this;
120509                }
120510                e.prototype.setFilters = function(t, e) {};
120511                e.prototype.setWraps = function(t, e) {};
120512                e.prototype.dispose = function() {};
120513                return e;
120514              }(e);
120515              t.FakeTexture = r;
120516            }(TMt || (TMt = {}));
120517            !function(t) {
120518              var e = function() {
120519                function e(t, e) {
120520                  this.pages = new Array;
120521                  this.regions = new Array;
120522                  this.load(t, e);
120523                }
120524                e.prototype.load = function(e, r) {
120525                  if (null == r) throw new Error("textureLoader cannot be null.");
120526                  var o = new i(e);
120527                  var a = new Array(4);
120528                  var l = null;
120529                  for (;;) {
120530                    var h = o.readLine();
120531                    if (null == h) break;
120532                    if (0 == (h = h.trim()).length) l = null; else if (l) {
120533                      var c = new n;
120534                      c.name = h;
120535                      c.page = l;
120536                      var u = o.readValue();
120537                      "true" == u.toLocaleLowerCase() ? c.degrees = 90 : "false" == u.toLocaleLowerCase() ? c.degrees = 0 : c.degrees = parseFloat(u);
120538                      c.rotate = 90 == c.degrees;
120539                      o.readTuple(a);
120540                      var _ = parseInt(a[0]);
120541                      var d = parseInt(a[1]);
120542                      o.readTuple(a);
120543                      var p = parseInt(a[0]);
120544                      var m = parseInt(a[1]);
120545                      c.u = _ / l.width;
120546                      c.v = d / l.height;
120547                      if (c.rotate) {
120548                        c.u2 = (_ + m) / l.width;
120549                        c.v2 = (d + p) / l.height;
120550                      } else {
120551                        c.u2 = (_ + p) / l.width;
120552                        c.v2 = (d + m) / l.height;
120553                      }
120554                      c.x = _;
120555                      c.y = d;
120556                      c.width = Math.abs(p);
120557                      c.height = Math.abs(m);
120558                      4 == o.readTuple(a) && 4 == o.readTuple(a) && o.readTuple(a);
120559                      c.originalWidth = parseInt(a[0]);
120560                      c.originalHeight = parseInt(a[1]);
120561                      o.readTuple(a);
120562                      c.offsetX = parseInt(a[0]);
120563                      c.offsetY = parseInt(a[1]);
120564                      c.index = parseInt(o.readValue());
120565                      c.texture = l.texture;
120566                      this.regions.push(c);
120567                    } else {
120568                      (l = new s).name = h;
120569                      if (2 == o.readTuple(a)) {
120570                        l.width = parseInt(a[0]);
120571                        l.height = parseInt(a[1]);
120572                        o.readTuple(a);
120573                      }
120574                      o.readTuple(a);
120575                      l.minFilter = t.Texture.filterFromString(a[0]);
120576                      l.magFilter = t.Texture.filterFromString(a[1]);
120577                      var f = o.readValue();
120578                      l.uWrap = t.TextureWrap.ClampToEdge;
120579                      l.vWrap = t.TextureWrap.ClampToEdge;
120580                      "x" == f ? l.uWrap = t.TextureWrap.Repeat : "y" == f ? l.vWrap = t.TextureWrap.Repeat : "xy" == f && (l.uWrap = l.vWrap = t.TextureWrap.Repeat);
120581                      l.texture = r(h);
120582                      l.texture.setFilters(l.minFilter, l.magFilter);
120583                      l.texture.setWraps(l.uWrap, l.vWrap);
120584                      l.width = l.texture.getImage().width;
120585                      l.height = l.texture.getImage().height;
120586                      this.pages.push(l);
120587                    }
120588                  }
120589                };
120590                e.prototype.findRegion = function(t) {
120591                  for (var e = 0; e < this.regions.length; e++) if (this.regions[e].name == t) return this.regions[e];
120592                  return null;
120593                };
120594                e.prototype.dispose = function() {
120595                  for (var t = 0; t < this.pages.length; t++) this.pages[t].texture.dispose();
120596                };
120597                return e;
120598              }();
120599              t.TextureAtlas = e;
120600              var i = function() {
120601                function t(t) {
120602                  this.index = 0;
120603                  this.lines = t.split(/\r\n|\r|\n/);
120604                }
120605                t.prototype.readLine = function() {
120606                  return this.index >= this.lines.length ? null : this.lines[this.index++];
120607                };
120608                t.prototype.readValue = function() {
120609                  var t = this.readLine();
120610                  var e = t.indexOf(":");
120611                  if (-1 == e) throw new Error("Invalid line: " + t);
120612                  return t.substring(e + 1).trim();
120613                };
120614                t.prototype.readTuple = function(t) {
120615                  var e = this.readLine();
120616                  var i = e.indexOf(":");
120617                  if (-1 == i) throw new Error("Invalid line: " + e);
120618                  var s = 0, n = i + 1;
120619                  for (;s < 3; s++) {
120620                    var r = e.indexOf(",", n);
120621                    if (-1 == r) break;
120622                    t[s] = e.substr(n, r - n).trim();
120623                    n = r + 1;
120624                  }
120625                  t[s] = e.substring(n).trim();
120626                  return s + 1;
120627                };
120628                return t;
120629              }();
120630              var s = function() {};
120631              t.TextureAtlasPage = s;
120632              var n = function(t) {
120633                AMt(e, t);
120634                function e() {
120635                  return null !== t && t.apply(this, arguments) || this;
120636                }
120637                return e;
120638              }(t.TextureRegion);
120639              t.TextureAtlasRegion = n;
120640            }(TMt || (TMt = {}));
120641            !function(t) {
120642              var e = function() {
120643                function e(e, i) {
120644                  this.rotateMix = 0;
120645                  this.translateMix = 0;
120646                  this.scaleMix = 0;
120647                  this.shearMix = 0;
120648                  this.temp = new t.Vector2;
120649                  this.active = !1;
120650                  if (null == e) throw new Error("data cannot be null.");
120651                  if (null == i) throw new Error("skeleton cannot be null.");
120652                  this.data = e;
120653                  this.rotateMix = e.rotateMix;
120654                  this.translateMix = e.translateMix;
120655                  this.scaleMix = e.scaleMix;
120656                  this.shearMix = e.shearMix;
120657                  this.bones = new Array;
120658                  for (var s = 0; s < e.bones.length; s++) this.bones.push(i.findBone(e.bones[s].name));
120659                  this.target = i.findBone(e.target.name);
120660                }
120661                e.prototype.isActive = function() {
120662                  return this.active;
120663                };
120664                e.prototype.apply = function() {
120665                  this.update();
120666                };
120667                e.prototype.update = function() {
120668                  this.data.local ? this.data.relative ? this.applyRelativeLocal() : this.applyAbsoluteLocal() : this.data.relative ? this.applyRelativeWorld() : this.applyAbsoluteWorld();
120669                };
120670                e.prototype.applyAbsoluteWorld = function() {
120671                  var e = this.rotateMix, i = this.translateMix, s = this.scaleMix, n = this.shearMix;
120672                  var r = this.target;
120673                  var o = r.a, a = r.b, l = r.c, h = r.d;
120674                  var c = o * h - a * l > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad;
120675                  var u = this.data.offsetRotation * c;
120676                  var _ = this.data.offsetShearY * c;
120677                  var d = this.bones;
120678                  for (var p = 0, m = d.length; p < m; p++) {
120679                    var f = d[p];
120680                    var g = !1;
120681                    if (0 != e) {
120682                      var y = f.a, b = f.b, S = f.c, A = f.d;
120683                      (R = Math.atan2(l, o) - Math.atan2(S, y) + u) > t.MathUtils.PI ? R -= t.MathUtils.PI2 : R < -t.MathUtils.PI && (R += t.MathUtils.PI2);
120684                      R *= e;
120685                      var T = Math.cos(R), v = Math.sin(R);
120686                      f.a = T * y - v * S;
120687                      f.b = T * b - v * A;
120688                      f.c = v * y + T * S;
120689                      f.d = v * b + T * A;
120690                      g = !0;
120691                    }
120692                    if (0 != i) {
120693                      var E = this.temp;
120694                      r.localToWorld(E.set(this.data.offsetX, this.data.offsetY));
120695                      f.worldX += (E.x - f.worldX) * i;
120696                      f.worldY += (E.y - f.worldY) * i;
120697                      g = !0;
120698                    }
120699                    if (s > 0) {
120700                      var C = Math.sqrt(f.a * f.a + f.c * f.c);
120701                      var x = Math.sqrt(o * o + l * l);
120702                      C > 1e-5 && (C = (C + (x - C + this.data.offsetScaleX) * s) / C);
120703                      f.a *= C;
120704                      f.c *= C;
120705                      C = Math.sqrt(f.b * f.b + f.d * f.d);
120706                      x = Math.sqrt(a * a + h * h);
120707                      C > 1e-5 && (C = (C + (x - C + this.data.offsetScaleY) * s) / C);
120708                      f.b *= C;
120709                      f.d *= C;
120710                      g = !0;
120711                    }
120712                    if (n > 0) {
120713                      b = f.b, A = f.d;
120714                      var w = Math.atan2(A, b);
120715                      var R;
120716                      (R = Math.atan2(h, a) - Math.atan2(l, o) - (w - Math.atan2(f.c, f.a))) > t.MathUtils.PI ? R -= t.MathUtils.PI2 : R < -t.MathUtils.PI && (R += t.MathUtils.PI2);
120717                      R = w + (R + _) * n;
120718                      C = Math.sqrt(b * b + A * A);
120719                      f.b = Math.cos(R) * C;
120720                      f.d = Math.sin(R) * C;
120721                      g = !0;
120722                    }
120723                    g && (f.appliedValid = !1);
120724                  }
120725                };
120726                e.prototype.applyRelativeWorld = function() {
120727                  var e = this.rotateMix, i = this.translateMix, s = this.scaleMix, n = this.shearMix;
120728                  var r = this.target;
120729                  var o = r.a, a = r.b, l = r.c, h = r.d;
120730                  var c = o * h - a * l > 0 ? t.MathUtils.degRad : -t.MathUtils.degRad;
120731                  var u = this.data.offsetRotation * c, _ = this.data.offsetShearY * c;
120732                  var d = this.bones;
120733                  for (var p = 0, m = d.length; p < m; p++) {
120734                    var f = d[p];
120735                    var g = !1;
120736                    if (0 != e) {
120737                      var y = f.a, b = f.b, S = f.c, A = f.d;
120738                      (x = Math.atan2(l, o) + u) > t.MathUtils.PI ? x -= t.MathUtils.PI2 : x < -t.MathUtils.PI && (x += t.MathUtils.PI2);
120739                      x *= e;
120740                      var T = Math.cos(x), v = Math.sin(x);
120741                      f.a = T * y - v * S;
120742                      f.b = T * b - v * A;
120743                      f.c = v * y + T * S;
120744                      f.d = v * b + T * A;
120745                      g = !0;
120746                    }
120747                    if (0 != i) {
120748                      var E = this.temp;
120749                      r.localToWorld(E.set(this.data.offsetX, this.data.offsetY));
120750                      f.worldX += E.x * i;
120751                      f.worldY += E.y * i;
120752                      g = !0;
120753                    }
120754                    if (s > 0) {
120755                      var C = (Math.sqrt(o * o + l * l) - 1 + this.data.offsetScaleX) * s + 1;
120756                      f.a *= C;
120757                      f.c *= C;
120758                      C = (Math.sqrt(a * a + h * h) - 1 + this.data.offsetScaleY) * s + 1;
120759                      f.b *= C;
120760                      f.d *= C;
120761                      g = !0;
120762                    }
120763                    if (n > 0) {
120764                      var x;
120765                      (x = Math.atan2(h, a) - Math.atan2(l, o)) > t.MathUtils.PI ? x -= t.MathUtils.PI2 : x < -t.MathUtils.PI && (x += t.MathUtils.PI2);
120766                      b = f.b, A = f.d;
120767                      x = Math.atan2(A, b) + (x - t.MathUtils.PI / 2 + _) * n;
120768                      C = Math.sqrt(b * b + A * A);
120769                      f.b = Math.cos(x) * C;
120770                      f.d = Math.sin(x) * C;
120771                      g = !0;
120772                    }
120773                    g && (f.appliedValid = !1);
120774                  }
120775                };
120776                e.prototype.applyAbsoluteLocal = function() {
120777                  var t = this.rotateMix, e = this.translateMix, i = this.scaleMix, s = this.shearMix;
120778                  var n = this.target;
120779                  n.appliedValid || n.updateAppliedTransform();
120780                  var r = this.bones;
120781                  for (var o = 0, a = r.length; o < a; o++) {
120782                    var l = r[o];
120783                    l.appliedValid || l.updateAppliedTransform();
120784                    var h = l.arotation;
120785                    if (0 != t) {
120786                      var c = n.arotation - h + this.data.offsetRotation;
120787                      h += (c -= 360 * (16384 - (16384.499999999996 - c / 360 | 0))) * t;
120788                    }
120789                    var u = l.ax, _ = l.ay;
120790                    if (0 != e) {
120791                      u += (n.ax - u + this.data.offsetX) * e;
120792                      _ += (n.ay - _ + this.data.offsetY) * e;
120793                    }
120794                    var d = l.ascaleX, p = l.ascaleY;
120795                    if (0 != i) {
120796                      d > 1e-5 && (d = (d + (n.ascaleX - d + this.data.offsetScaleX) * i) / d);
120797                      p > 1e-5 && (p = (p + (n.ascaleY - p + this.data.offsetScaleY) * i) / p);
120798                    }
120799                    var m = l.ashearY;
120800                    if (0 != s) {
120801                      c = n.ashearY - m + this.data.offsetShearY;
120802                      c -= 360 * (16384 - (16384.499999999996 - c / 360 | 0));
120803                      l.shearY += c * s;
120804                    }
120805                    l.updateWorldTransformWith(u, _, h, d, p, l.ashearX, m);
120806                  }
120807                };
120808                e.prototype.applyRelativeLocal = function() {
120809                  var t = this.rotateMix, e = this.translateMix, i = this.scaleMix, s = this.shearMix;
120810                  var n = this.target;
120811                  n.appliedValid || n.updateAppliedTransform();
120812                  var r = this.bones;
120813                  for (var o = 0, a = r.length; o < a; o++) {
120814                    var l = r[o];
120815                    l.appliedValid || l.updateAppliedTransform();
120816                    var h = l.arotation;
120817                    0 != t && (h += (n.arotation + this.data.offsetRotation) * t);
120818                    var c = l.ax, u = l.ay;
120819                    if (0 != e) {
120820                      c += (n.ax + this.data.offsetX) * e;
120821                      u += (n.ay + this.data.offsetY) * e;
120822                    }
120823                    var _ = l.ascaleX, d = l.ascaleY;
120824                    if (0 != i) {
120825                      _ > 1e-5 && (_ *= (n.ascaleX - 1 + this.data.offsetScaleX) * i + 1);
120826                      d > 1e-5 && (d *= (n.ascaleY - 1 + this.data.offsetScaleY) * i + 1);
120827                    }
120828                    var p = l.ashearY;
120829                    0 != s && (p += (n.ashearY + this.data.offsetShearY) * s);
120830                    l.updateWorldTransformWith(c, u, h, _, d, l.ashearX, p);
120831                  }
120832                };
120833                return e;
120834              }();
120835              t.TransformConstraint = e;
120836            }(TMt || (TMt = {}));
120837            !function(t) {
120838              var e = function(t) {
120839                AMt(e, t);
120840                function e(e) {
120841                  var i = t.call(this, e, 0, !1) || this;
120842                  i.bones = new Array;
120843                  i.rotateMix = 0;
120844                  i.translateMix = 0;
120845                  i.scaleMix = 0;
120846                  i.shearMix = 0;
120847                  i.offsetRotation = 0;
120848                  i.offsetX = 0;
120849                  i.offsetY = 0;
120850                  i.offsetScaleX = 0;
120851                  i.offsetScaleY = 0;
120852                  i.offsetShearY = 0;
120853                  i.relative = !1;
120854                  i.local = !1;
120855                  return i;
120856                }
120857                return e;
120858              }(t.ConstraintData);
120859              t.TransformConstraintData = e;
120860            }(TMt || (TMt = {}));
120861            !function(t) {
120862              var e = function() {
120863                function e() {
120864                  this.convexPolygons = new Array;
120865                  this.convexPolygonsIndices = new Array;
120866                  this.indicesArray = new Array;
120867                  this.isConcaveArray = new Array;
120868                  this.triangles = new Array;
120869                  this.polygonPool = new t.Pool((function() {
120870                    return new Array;
120871                  }));
120872                  this.polygonIndicesPool = new t.Pool((function() {
120873                    return new Array;
120874                  }));
120875                }
120876                e.prototype.triangulate = function(t) {
120877                  var i = t;
120878                  var s = t.length >> 1;
120879                  var n = this.indicesArray;
120880                  n.length = 0;
120881                  for (var r = 0; r < s; r++) n[r] = r;
120882                  var o = this.isConcaveArray;
120883                  o.length = 0;
120884                  r = 0;
120885                  for (var a = s; r < a; ++r) o[r] = e.isConcave(r, s, i, n);
120886                  var l = this.triangles;
120887                  l.length = 0;
120888                  for (;s > 3; ) {
120889                    var h = s - 1, c = (r = 0, 1);
120890                    for (;;) {
120891                      t: if (!o[r]) {
120892                        var u = n[h] << 1, _ = n[r] << 1, d = n[c] << 1;
120893                        var p = i[u], m = i[u + 1];
120894                        var f = i[_], g = i[_ + 1];
120895                        var y = i[d], b = i[d + 1];
120896                        for (var S = (c + 1) % s; S != h; S = (S + 1) % s) if (o[S]) {
120897                          var A = n[S] << 1;
120898                          var T = i[A], v = i[A + 1];
120899                          if (e.positiveArea(y, b, p, m, T, v) && e.positiveArea(p, m, f, g, T, v) && e.positiveArea(f, g, y, b, T, v)) break t;
120900                        }
120901                        break;
120902                      }
120903                      if (0 == c) {
120904                        do {
120905                          if (!o[r]) break;
120906                          r--;
120907                        } while (r > 0);
120908                        break;
120909                      }
120910                      h = r;
120911                      r = c;
120912                      c = (c + 1) % s;
120913                    }
120914                    l.push(n[(s + r - 1) % s]);
120915                    l.push(n[r]);
120916                    l.push(n[(r + 1) % s]);
120917                    n.splice(r, 1);
120918                    o.splice(r, 1);
120919                    var E = (--s + r - 1) % s;
120920                    var C = r == s ? 0 : r;
120921                    o[E] = e.isConcave(E, s, i, n);
120922                    o[C] = e.isConcave(C, s, i, n);
120923                  }
120924                  if (3 == s) {
120925                    l.push(n[2]);
120926                    l.push(n[0]);
120927                    l.push(n[1]);
120928                  }
120929                  return l;
120930                };
120931                e.prototype.decompose = function(t, i) {
120932                  var s = t;
120933                  var n = this.convexPolygons;
120934                  this.polygonPool.freeAll(n);
120935                  n.length = 0;
120936                  var r = this.convexPolygonsIndices;
120937                  this.polygonIndicesPool.freeAll(r);
120938                  r.length = 0;
120939                  var o = this.polygonIndicesPool.obtain();
120940                  o.length = 0;
120941                  var a = this.polygonPool.obtain();
120942                  a.length = 0;
120943                  var l = -1, h = 0;
120944                  for (var c = 0, u = i.length; c < u; c += 3) {
120945                    var _ = i[c] << 1, d = i[c + 1] << 1, p = i[c + 2] << 1;
120946                    var m = s[_], f = s[_ + 1];
120947                    var g = s[d], y = s[d + 1];
120948                    var b = s[p], S = s[p + 1];
120949                    var A = !1;
120950                    if (l == _) {
120951                      var T = a.length - 4;
120952                      var v = e.winding(a[T], a[T + 1], a[T + 2], a[T + 3], b, S);
120953                      var E = e.winding(b, S, a[0], a[1], a[2], a[3]);
120954                      if (v == h && E == h) {
120955                        a.push(b);
120956                        a.push(S);
120957                        o.push(p);
120958                        A = !0;
120959                      }
120960                    }
120961                    if (!A) {
120962                      if (a.length > 0) {
120963                        n.push(a);
120964                        r.push(o);
120965                      } else {
120966                        this.polygonPool.free(a);
120967                        this.polygonIndicesPool.free(o);
120968                      }
120969                      (a = this.polygonPool.obtain()).length = 0;
120970                      a.push(m);
120971                      a.push(f);
120972                      a.push(g);
120973                      a.push(y);
120974                      a.push(b);
120975                      a.push(S);
120976                      (o = this.polygonIndicesPool.obtain()).length = 0;
120977                      o.push(_);
120978                      o.push(d);
120979                      o.push(p);
120980                      h = e.winding(m, f, g, y, b, S);
120981                      l = _;
120982                    }
120983                  }
120984                  if (a.length > 0) {
120985                    n.push(a);
120986                    r.push(o);
120987                  }
120988                  for (c = 0, u = n.length; c < u; c++) if (0 != (o = r[c]).length) {
120989                    var C = o[0];
120990                    var x = o[o.length - 1];
120991                    var w = (a = n[c])[T = a.length - 4], R = a[T + 1];
120992                    var I = a[T + 2], M = a[T + 3];
120993                    var B = a[0], D = a[1];
120994                    var P = a[2], O = a[3];
120995                    var N = e.winding(w, R, I, M, B, D);
120996                    for (var L = 0; L < u; L++) if (L != c) {
120997                      var F = r[L];
120998                      if (3 == F.length) {
120999                        var V = F[0];
121000                        var k = F[1];
121001                        var U = F[2];
121002                        var G = n[L];
121003                        b = G[G.length - 2], S = G[G.length - 1];
121004                        if (V == C && k == x) {
121005                          v = e.winding(w, R, I, M, b, S);
121006                          E = e.winding(b, S, B, D, P, O);
121007                          if (v == N && E == N) {
121008                            G.length = 0;
121009                            F.length = 0;
121010                            a.push(b);
121011                            a.push(S);
121012                            o.push(U);
121013                            w = I;
121014                            R = M;
121015                            I = b;
121016                            M = S;
121017                            L = 0;
121018                          }
121019                        }
121020                      }
121021                    }
121022                  }
121023                  for (c = n.length - 1; c >= 0; c--) if (0 == (a = n[c]).length) {
121024                    n.splice(c, 1);
121025                    this.polygonPool.free(a);
121026                    o = r[c];
121027                    r.splice(c, 1);
121028                    this.polygonIndicesPool.free(o);
121029                  }
121030                  return n;
121031                };
121032                e.isConcave = function(t, e, i, s) {
121033                  var n = s[(e + t - 1) % e] << 1;
121034                  var r = s[t] << 1;
121035                  var o = s[(t + 1) % e] << 1;
121036                  return !this.positiveArea(i[n], i[n + 1], i[r], i[r + 1], i[o], i[o + 1]);
121037                };
121038                e.positiveArea = function(t, e, i, s, n, r) {
121039                  return t * (r - s) + i * (e - r) + n * (s - e) >= 0;
121040                };
121041                e.winding = function(t, e, i, s, n, r) {
121042                  var o = i - t, a = s - e;
121043                  return n * a - r * o + o * e - t * a >= 0 ? 1 : -1;
121044                };
121045                return e;
121046              }();
121047              t.Triangulator = e;
121048            }(TMt || (TMt = {}));
121049            !function(t) {
121050              var e = function() {
121051                function t() {
121052                  this.array = new Array;
121053                }
121054                t.prototype.add = function(t) {
121055                  var e = this.contains(t);
121056                  this.array[0 | t] = 0 | t;
121057                  return !e;
121058                };
121059                t.prototype.contains = function(t) {
121060                  return null != this.array[0 | t];
121061                };
121062                t.prototype.remove = function(t) {
121063                  this.array[0 | t] = void 0;
121064                };
121065                t.prototype.clear = function() {
121066                  this.array.length = 0;
121067                };
121068                return t;
121069              }();
121070              t.IntSet = e;
121071              var i = function() {
121072                function t(t, e, i, s) {
121073                  void 0 === t && (t = 0);
121074                  void 0 === e && (e = 0);
121075                  void 0 === i && (i = 0);
121076                  void 0 === s && (s = 0);
121077                  this.r = t;
121078                  this.g = e;
121079                  this.b = i;
121080                  this.a = s;
121081                }
121082                t.prototype.set = function(t, e, i, s) {
121083                  this.r = t;
121084                  this.g = e;
121085                  this.b = i;
121086                  this.a = s;
121087                  this.clamp();
121088                  return this;
121089                };
121090                t.prototype.setFromColor = function(t) {
121091                  this.r = t.r;
121092                  this.g = t.g;
121093                  this.b = t.b;
121094                  this.a = t.a;
121095                  return this;
121096                };
121097                t.prototype.setFromString = function(t) {
121098                  t = "#" == t.charAt(0) ? t.substr(1) : t;
121099                  this.r = parseInt(t.substr(0, 2), 16) / 255;
121100                  this.g = parseInt(t.substr(2, 2), 16) / 255;
121101                  this.b = parseInt(t.substr(4, 2), 16) / 255;
121102                  this.a = (8 != t.length ? 255 : parseInt(t.substr(6, 2), 16)) / 255;
121103                  return this;
121104                };
121105                t.prototype.add = function(t, e, i, s) {
121106                  this.r += t;
121107                  this.g += e;
121108                  this.b += i;
121109                  this.a += s;
121110                  this.clamp();
121111                  return this;
121112                };
121113                t.prototype.clamp = function() {
121114                  this.r < 0 ? this.r = 0 : this.r > 1 && (this.r = 1);
121115                  this.g < 0 ? this.g = 0 : this.g > 1 && (this.g = 1);
121116                  this.b < 0 ? this.b = 0 : this.b > 1 && (this.b = 1);
121117                  this.a < 0 ? this.a = 0 : this.a > 1 && (this.a = 1);
121118                  return this;
121119                };
121120                t.rgba8888ToColor = function(t, e) {
121121                  t.r = ((4278190080 & e) >>> 24) / 255;
121122                  t.g = ((16711680 & e) >>> 16) / 255;
121123                  t.b = ((65280 & e) >>> 8) / 255;
121124                  t.a = (255 & e) / 255;
121125                };
121126                t.rgb888ToColor = function(t, e) {
121127                  t.r = ((16711680 & e) >>> 16) / 255;
121128                  t.g = ((65280 & e) >>> 8) / 255;
121129                  t.b = (255 & e) / 255;
121130                };
121131                t.WHITE = new t(1, 1, 1, 1);
121132                t.RED = new t(1, 0, 0, 1);
121133                t.GREEN = new t(0, 1, 0, 1);
121134                t.BLUE = new t(0, 0, 1, 1);
121135                t.MAGENTA = new t(1, 0, 1, 1);
121136                return t;
121137              }();
121138              t.Color = i;
121139              var s = function() {
121140                function t() {}
121141                t.clamp = function(t, e, i) {
121142                  return t < e ? e : t > i ? i : t;
121143                };
121144                t.cosDeg = function(e) {
121145                  return Math.cos(e * t.degRad);
121146                };
121147                t.sinDeg = function(e) {
121148                  return Math.sin(e * t.degRad);
121149                };
121150                t.signum = function(t) {
121151                  return t > 0 ? 1 : t < 0 ? -1 : 0;
121152                };
121153                t.toInt = function(t) {
121154                  return t > 0 ? Math.floor(t) : Math.ceil(t);
121155                };
121156                t.cbrt = function(t) {
121157                  var e = Math.pow(Math.abs(t), 1 / 3);
121158                  return t < 0 ? -e : e;
121159                };
121160                t.randomTriangular = function(e, i) {
121161                  return t.randomTriangularWith(e, i, .5 * (e + i));
121162                };
121163                t.randomTriangularWith = function(t, e, i) {
121164                  var s = Math.random();
121165                  var n = e - t;
121166                  return s <= (i - t) / n ? t + Math.sqrt(s * n * (i - t)) : e - Math.sqrt((1 - s) * n * (e - i));
121167                };
121168                t.PI = 3.1415927;
121169                t.PI2 = 2 * t.PI;
121170                t.radiansToDegrees = 180 / t.PI;
121171                t.radDeg = t.radiansToDegrees;
121172                t.degreesToRadians = t.PI / 180;
121173                t.degRad = t.degreesToRadians;
121174                return t;
121175              }();
121176              t.MathUtils = s;
121177              var n = function() {
121178                function t() {}
121179                t.prototype.apply = function(t, e, i) {
121180                  return t + (e - t) * this.applyInternal(i);
121181                };
121182                return t;
121183              }();
121184              t.Interpolation = n;
121185              var r = function(t) {
121186                AMt(e, t);
121187                function e(e) {
121188                  var i = t.call(this) || this;
121189                  i.power = 2;
121190                  i.power = e;
121191                  return i;
121192                }
121193                e.prototype.applyInternal = function(t) {
121194                  return t <= .5 ? Math.pow(2 * t, this.power) / 2 : Math.pow(2 * (t - 1), this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;
121195                };
121196                return e;
121197              }(n);
121198              t.Pow = r;
121199              var o = function(t) {
121200                AMt(e, t);
121201                function e(e) {
121202                  return t.call(this, e) || this;
121203                }
121204                e.prototype.applyInternal = function(t) {
121205                  return Math.pow(t - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;
121206                };
121207                return e;
121208              }(r);
121209              t.PowOut = o;
121210              var a = function() {
121211                function t() {}
121212                t.arrayCopy = function(t, e, i, s, n) {
121213                  for (var r = e, o = s; r < e + n; r++, o++) i[o] = t[r];
121214                };
121215                t.setArraySize = function(t, e, i) {
121216                  void 0 === i && (i = 0);
121217                  var s = t.length;
121218                  if (s == e) return t;
121219                  t.length = e;
121220                  if (s < e) for (var n = s; n < e; n++) t[n] = i;
121221                  return t;
121222                };
121223                t.ensureArrayCapacity = function(e, i, s) {
121224                  void 0 === s && (s = 0);
121225                  return e.length >= i ? e : t.setArraySize(e, i, s);
121226                };
121227                t.newArray = function(t, e) {
121228                  var i = new Array(t);
121229                  for (var s = 0; s < t; s++) i[s] = e;
121230                  return i;
121231                };
121232                t.newFloatArray = function(e) {
121233                  if (t.SUPPORTS_TYPED_ARRAYS) return new Float32Array(e);
121234                  var i = new Array(e);
121235                  for (var s = 0; s < i.length; s++) i[s] = 0;
121236                  return i;
121237                };
121238                t.newShortArray = function(e) {
121239                  if (t.SUPPORTS_TYPED_ARRAYS) return new Int16Array(e);
121240                  var i = new Array(e);
121241                  for (var s = 0; s < i.length; s++) i[s] = 0;
121242                  return i;
121243                };
121244                t.toFloatArray = function(e) {
121245                  return t.SUPPORTS_TYPED_ARRAYS ? new Float32Array(e) : e;
121246                };
121247                t.toSinglePrecision = function(e) {
121248                  return t.SUPPORTS_TYPED_ARRAYS ? Math.fround(e) : e;
121249                };
121250                t.webkit602BugfixHelper = function(t, e) {};
121251                t.contains = function(t, e, i) {
121252                  for (var s = 0; s < t.length; s++) if (t[s] == e) return !0;
121253                  return !1;
121254                };
121255                t.SUPPORTS_TYPED_ARRAYS = "undefined" != typeof Float32Array;
121256                return t;
121257              }();
121258              t.Utils = a;
121259              var l = function() {
121260                function t() {}
121261                t.logBones = function(t) {
121262                  for (var e = 0; e < t.bones.length; e++) {
121263                    var i = t.bones[e];
121264                    console.log(i.data.name + ", " + i.a + ", " + i.b + ", " + i.c + ", " + i.d + ", " + i.worldX + ", " + i.worldY);
121265                  }
121266                };
121267                return t;
121268              }();
121269              t.DebugUtils = l;
121270              var h = function() {
121271                function t(t) {
121272                  this.items = new Array;
121273                  this.instantiator = t;
121274                }
121275                t.prototype.obtain = function() {
121276                  return this.items.length > 0 ? this.items.pop() : this.instantiator();
121277                };
121278                t.prototype.free = function(t) {
121279                  t.reset && t.reset();
121280                  this.items.push(t);
121281                };
121282                t.prototype.freeAll = function(t) {
121283                  for (var e = 0; e < t.length; e++) {
121284                    t[e].reset && t[e].reset();
121285                    this.items[e] = t[e];
121286                  }
121287                };
121288                t.prototype.clear = function() {
121289                  this.items.length = 0;
121290                };
121291                return t;
121292              }();
121293              t.Pool = h;
121294              var c = function() {
121295                function t(t, e) {
121296                  void 0 === t && (t = 0);
121297                  void 0 === e && (e = 0);
121298                  this.x = t;
121299                  this.y = e;
121300                }
121301                t.prototype.set = function(t, e) {
121302                  this.x = t;
121303                  this.y = e;
121304                  return this;
121305                };
121306                t.prototype.length = function() {
121307                  var t = this.x;
121308                  var e = this.y;
121309                  return Math.sqrt(t * t + e * e);
121310                };
121311                t.prototype.normalize = function() {
121312                  var t = this.length();
121313                  if (0 != t) {
121314                    this.x /= t;
121315                    this.y /= t;
121316                  }
121317                  return this;
121318                };
121319                return t;
121320              }();
121321              t.Vector2 = c;
121322              var u = function() {
121323                function t() {
121324                  this.maxDelta = .064;
121325                  this.framesPerSecond = 0;
121326                  this.delta = 0;
121327                  this.totalTime = 0;
121328                  this.lastTime = Date.now() / 1e3;
121329                  this.frameCount = 0;
121330                  this.frameTime = 0;
121331                }
121332                t.prototype.update = function() {
121333                  var t = Date.now() / 1e3;
121334                  this.delta = t - this.lastTime;
121335                  this.frameTime += this.delta;
121336                  this.totalTime += this.delta;
121337                  this.delta > this.maxDelta && (this.delta = this.maxDelta);
121338                  this.lastTime = t;
121339                  this.frameCount++;
121340                  if (this.frameTime > 1) {
121341                    this.framesPerSecond = this.frameCount / this.frameTime;
121342                    this.frameTime = 0;
121343                    this.frameCount = 0;
121344                  }
121345                };
121346                return t;
121347              }();
121348              t.TimeKeeper = u;
121349              var _ = function() {
121350                function t(t) {
121351                  void 0 === t && (t = 32);
121352                  this.addedValues = 0;
121353                  this.lastValue = 0;
121354                  this.mean = 0;
121355                  this.dirty = !0;
121356                  this.values = new Array(t);
121357                }
121358                t.prototype.hasEnoughData = function() {
121359                  return this.addedValues >= this.values.length;
121360                };
121361                t.prototype.addValue = function(t) {
121362                  this.addedValues < this.values.length && this.addedValues++;
121363                  this.values[this.lastValue++] = t;
121364                  this.lastValue > this.values.length - 1 && (this.lastValue = 0);
121365                  this.dirty = !0;
121366                };
121367                t.prototype.getMean = function() {
121368                  if (this.hasEnoughData()) {
121369                    if (this.dirty) {
121370                      var t = 0;
121371                      for (var e = 0; e < this.values.length; e++) t += this.values[e];
121372                      this.mean = t / this.values.length;
121373                      this.dirty = !1;
121374                    }
121375                    return this.mean;
121376                  }
121377                  return 0;
121378                };
121379                return t;
121380              }();
121381              t.WindowedMean = _;
121382            }(TMt || (TMt = {}));
121383            Math.fround || (Math.fround = function(t) {
121384              return function(e) {
121385                return t[0] = e, t[0];
121386              };
121387            }(new Float32Array(1)));
121388            !function(t) {
121389              var e = function(t) {
121390                if (null == t) throw new Error("name cannot be null.");
121391                this.name = t;
121392              };
121393              t.Attachment = e;
121394              var i = function(e) {
121395                AMt(i, e);
121396                function i(t) {
121397                  var s = e.call(this, t) || this;
121398                  s.id = (65535 & i.nextID++) << 11;
121399                  s.worldVerticesLength = 0;
121400                  s.deformAttachment = s;
121401                  return s;
121402                }
121403                i.prototype.computeWorldVertices = function(t, e, i, s, n, r) {
121404                  i = n + (i >> 1) * r;
121405                  var o = t.bone.skeleton;
121406                  var a = t.deform;
121407                  var l = this.vertices;
121408                  var h = this.bones;
121409                  if (null != h) {
121410                    var c = 0, u = 0;
121411                    for (var _ = 0; _ < e; _ += 2) {
121412                      c += (f = h[c]) + 1;
121413                      u += f;
121414                    }
121415                    var d = o.bones;
121416                    if (0 == a.length) for (R = n, E = 3 * u; R < i; R += r) {
121417                      var p = 0, m = 0;
121418                      var f = h[c++];
121419                      f += c;
121420                      for (;c < f; c++, E += 3) {
121421                        S = d[h[c]];
121422                        I = l[E], M = l[E + 1];
121423                        var g = l[E + 2];
121424                        p += (I * S.a + M * S.b + S.worldX) * g;
121425                        m += (I * S.c + M * S.d + S.worldY) * g;
121426                      }
121427                      s[R] = p;
121428                      s[R + 1] = m;
121429                    } else {
121430                      var y = a;
121431                      R = n, E = 3 * u;
121432                      for (var b = u << 1; R < i; R += r) {
121433                        p = 0, m = 0;
121434                        f = h[c++];
121435                        f += c;
121436                        for (;c < f; c++, E += 3, b += 2) {
121437                          S = d[h[c]];
121438                          I = l[E] + y[b], M = l[E + 1] + y[b + 1], g = l[E + 2];
121439                          p += (I * S.a + M * S.b + S.worldX) * g;
121440                          m += (I * S.c + M * S.d + S.worldY) * g;
121441                        }
121442                        s[R] = p;
121443                        s[R + 1] = m;
121444                      }
121445                    }
121446                  } else {
121447                    a.length > 0 && (l = a);
121448                    var S;
121449                    var A = (S = t.bone).worldX;
121450                    var T = S.worldY;
121451                    var v = S.a, E = S.b, C = S.c, x = S.d;
121452                    for (var w = e, R = n; R < i; w += 2, R += r) {
121453                      var I = l[w], M = l[w + 1];
121454                      s[R] = I * v + M * E + A;
121455                      s[R + 1] = I * C + M * x + T;
121456                    }
121457                  }
121458                };
121459                i.prototype.copyTo = function(e) {
121460                  if (null != this.bones) {
121461                    e.bones = new Array(this.bones.length);
121462                    t.Utils.arrayCopy(this.bones, 0, e.bones, 0, this.bones.length);
121463                  } else e.bones = null;
121464                  if (null != this.vertices) {
121465                    e.vertices = t.Utils.newFloatArray(this.vertices.length);
121466                    t.Utils.arrayCopy(this.vertices, 0, e.vertices, 0, this.vertices.length);
121467                  } else e.vertices = null;
121468                  e.worldVerticesLength = this.worldVerticesLength;
121469                  e.deformAttachment = this.deformAttachment;
121470                };
121471                i.nextID = 0;
121472                return i;
121473              }(e);
121474              t.VertexAttachment = i;
121475            }(TMt || (TMt = {}));
121476            !function(t) {
121477              !function(t) {
121478                t[t.Region = 0] = "Region";
121479                t[t.BoundingBox = 1] = "BoundingBox";
121480                t[t.Mesh = 2] = "Mesh";
121481                t[t.LinkedMesh = 3] = "LinkedMesh";
121482                t[t.Path = 4] = "Path";
121483                t[t.Point = 5] = "Point";
121484                t[t.Clipping = 6] = "Clipping";
121485              }(t.AttachmentType || (t.AttachmentType = {}));
121486            }(TMt || (TMt = {}));
121487            !function(t) {
121488              var e = function(e) {
121489                AMt(i, e);
121490                function i(i) {
121491                  var s = e.call(this, i) || this;
121492                  s.color = new t.Color(1, 1, 1, 1);
121493                  return s;
121494                }
121495                i.prototype.copy = function() {
121496                  var t = new i(this.name);
121497                  this.copyTo(t);
121498                  t.color.setFromColor(this.color);
121499                  return t;
121500                };
121501                return i;
121502              }(t.VertexAttachment);
121503              t.BoundingBoxAttachment = e;
121504            }(TMt || (TMt = {}));
121505            !function(t) {
121506              var e = function(e) {
121507                AMt(i, e);
121508                function i(i) {
121509                  var s = e.call(this, i) || this;
121510                  s.color = new t.Color(.2275, .2275, .8078, 1);
121511                  return s;
121512                }
121513                i.prototype.copy = function() {
121514                  var t = new i(this.name);
121515                  this.copyTo(t);
121516                  t.endSlot = this.endSlot;
121517                  t.color.setFromColor(this.color);
121518                  return t;
121519                };
121520                return i;
121521              }(t.VertexAttachment);
121522              t.ClippingAttachment = e;
121523            }(TMt || (TMt = {}));
121524            !function(t) {
121525              var e = function(e) {
121526                AMt(i, e);
121527                function i(i) {
121528                  var s = e.call(this, i) || this;
121529                  s.color = new t.Color(1, 1, 1, 1);
121530                  s.tempColor = new t.Color(0, 0, 0, 0);
121531                  return s;
121532                }
121533                i.prototype.updateUVs = function() {
121534                  var e = this.regionUVs;
121535                  null != this.uvs && this.uvs.length == e.length || (this.uvs = t.Utils.newFloatArray(e.length));
121536                  var i = this.uvs;
121537                  var s = this.uvs.length;
121538                  var n = this.region.u, r = this.region.v, o = 0, a = 0;
121539                  if (this.region instanceof t.TextureAtlasRegion) {
121540                    var l = this.region;
121541                    var h = l.texture.getImage().width, c = l.texture.getImage().height;
121542                    switch (l.degrees) {
121543                     case 90:
121544                      n -= (l.originalHeight - l.offsetY - l.height) / h;
121545                      r -= (l.originalWidth - l.offsetX - l.width) / c;
121546                      o = l.originalHeight / h;
121547                      a = l.originalWidth / c;
121548                      for (var u = 0; u < s; u += 2) {
121549                        i[u] = n + e[u + 1] * o;
121550                        i[u + 1] = r + (1 - e[u]) * a;
121551                      }
121552                      return;
121553
121554                     case 180:
121555                      n -= (l.originalWidth - l.offsetX - l.width) / h;
121556                      r -= l.offsetY / c;
121557                      o = l.originalWidth / h;
121558                      a = l.originalHeight / c;
121559                      for (u = 0; u < s; u += 2) {
121560                        i[u] = n + (1 - e[u]) * o;
121561                        i[u + 1] = r + (1 - e[u + 1]) * a;
121562                      }
121563                      return;
121564
121565                     case 270:
121566                      n -= l.offsetY / h;
121567                      r -= l.offsetX / c;
121568                      o = l.originalHeight / h;
121569                      a = l.originalWidth / c;
121570                      for (u = 0; u < s; u += 2) {
121571                        i[u] = n + (1 - e[u + 1]) * o;
121572                        i[u + 1] = r + e[u] * a;
121573                      }
121574                      return;
121575                    }
121576                    n -= l.offsetX / h;
121577                    r -= (l.originalHeight - l.offsetY - l.height) / c;
121578                    o = l.originalWidth / h;
121579                    a = l.originalHeight / c;
121580                  } else if (null == this.region) {
121581                    n = r = 0;
121582                    o = a = 1;
121583                  } else {
121584                    o = this.region.u2 - n;
121585                    a = this.region.v2 - r;
121586                  }
121587                  for (u = 0; u < s; u += 2) {
121588                    i[u] = n + e[u] * o;
121589                    i[u + 1] = r + e[u + 1] * a;
121590                  }
121591                };
121592                i.prototype.getParentMesh = function() {
121593                  return this.parentMesh;
121594                };
121595                i.prototype.setParentMesh = function(t) {
121596                  this.parentMesh = t;
121597                  if (null != t) {
121598                    this.bones = t.bones;
121599                    this.vertices = t.vertices;
121600                    this.worldVerticesLength = t.worldVerticesLength;
121601                    this.regionUVs = t.regionUVs;
121602                    this.triangles = t.triangles;
121603                    this.hullLength = t.hullLength;
121604                    this.worldVerticesLength = t.worldVerticesLength;
121605                  }
121606                };
121607                i.prototype.copy = function() {
121608                  if (null != this.parentMesh) return this.newLinkedMesh();
121609                  var e = new i(this.name);
121610                  e.region = this.region;
121611                  e.path = this.path;
121612                  e.color.setFromColor(this.color);
121613                  this.copyTo(e);
121614                  e.regionUVs = new Array(this.regionUVs.length);
121615                  t.Utils.arrayCopy(this.regionUVs, 0, e.regionUVs, 0, this.regionUVs.length);
121616                  e.uvs = new Array(this.uvs.length);
121617                  t.Utils.arrayCopy(this.uvs, 0, e.uvs, 0, this.uvs.length);
121618                  e.triangles = new Array(this.triangles.length);
121619                  t.Utils.arrayCopy(this.triangles, 0, e.triangles, 0, this.triangles.length);
121620                  e.hullLength = this.hullLength;
121621                  if (null != this.edges) {
121622                    e.edges = new Array(this.edges.length);
121623                    t.Utils.arrayCopy(this.edges, 0, e.edges, 0, this.edges.length);
121624                  }
121625                  e.width = this.width;
121626                  e.height = this.height;
121627                  return e;
121628                };
121629                i.prototype.newLinkedMesh = function() {
121630                  var t = new i(this.name);
121631                  t.region = this.region;
121632                  t.path = this.path;
121633                  t.color.setFromColor(this.color);
121634                  t.deformAttachment = this.deformAttachment;
121635                  t.setParentMesh(null != this.parentMesh ? this.parentMesh : this);
121636                  t.updateUVs();
121637                  return t;
121638                };
121639                return i;
121640              }(t.VertexAttachment);
121641              t.MeshAttachment = e;
121642            }(TMt || (TMt = {}));
121643            !function(t) {
121644              var e = function(e) {
121645                AMt(i, e);
121646                function i(i) {
121647                  var s = e.call(this, i) || this;
121648                  s.closed = !1;
121649                  s.constantSpeed = !1;
121650                  s.color = new t.Color(1, 1, 1, 1);
121651                  return s;
121652                }
121653                i.prototype.copy = function() {
121654                  var e = new i(this.name);
121655                  this.copyTo(e);
121656                  e.lengths = new Array(this.lengths.length);
121657                  t.Utils.arrayCopy(this.lengths, 0, e.lengths, 0, this.lengths.length);
121658                  e.closed = closed;
121659                  e.constantSpeed = this.constantSpeed;
121660                  e.color.setFromColor(this.color);
121661                  return e;
121662                };
121663                return i;
121664              }(t.VertexAttachment);
121665              t.PathAttachment = e;
121666            }(TMt || (TMt = {}));
121667            !function(t) {
121668              var e = function(e) {
121669                AMt(i, e);
121670                function i(i) {
121671                  var s = e.call(this, i) || this;
121672                  s.color = new t.Color(.38, .94, 0, 1);
121673                  return s;
121674                }
121675                i.prototype.computeWorldPosition = function(t, e) {
121676                  e.x = this.x * t.a + this.y * t.b + t.worldX;
121677                  e.y = this.x * t.c + this.y * t.d + t.worldY;
121678                  return e;
121679                };
121680                i.prototype.computeWorldRotation = function(e) {
121681                  var i = t.MathUtils.cosDeg(this.rotation), s = t.MathUtils.sinDeg(this.rotation);
121682                  var n = i * e.a + s * e.b;
121683                  var r = i * e.c + s * e.d;
121684                  return Math.atan2(r, n) * t.MathUtils.radDeg;
121685                };
121686                i.prototype.copy = function() {
121687                  var t = new i(this.name);
121688                  t.x = this.x;
121689                  t.y = this.y;
121690                  t.rotation = this.rotation;
121691                  t.color.setFromColor(this.color);
121692                  return t;
121693                };
121694                return i;
121695              }(t.VertexAttachment);
121696              t.PointAttachment = e;
121697            }(TMt || (TMt = {}));
121698            !function(t) {
121699              var e = function(e) {
121700                AMt(i, e);
121701                function i(i) {
121702                  var s = e.call(this, i) || this;
121703                  s.x = 0;
121704                  s.y = 0;
121705                  s.scaleX = 1;
121706                  s.scaleY = 1;
121707                  s.rotation = 0;
121708                  s.width = 0;
121709                  s.height = 0;
121710                  s.color = new t.Color(1, 1, 1, 1);
121711                  s.offset = t.Utils.newFloatArray(8);
121712                  s.uvs = t.Utils.newFloatArray(8);
121713                  s.tempColor = new t.Color(1, 1, 1, 1);
121714                  return s;
121715                }
121716                i.prototype.updateOffset = function() {
121717                  var t = this.width / this.region.originalWidth * this.scaleX;
121718                  var e = this.height / this.region.originalHeight * this.scaleY;
121719                  var s = -this.width / 2 * this.scaleX + this.region.offsetX * t;
121720                  var n = -this.height / 2 * this.scaleY + this.region.offsetY * e;
121721                  var r = s + this.region.width * t;
121722                  var o = n + this.region.height * e;
121723                  var a = this.rotation * Math.PI / 180;
121724                  var l = Math.cos(a);
121725                  var h = Math.sin(a);
121726                  var c = s * l + this.x;
121727                  var u = s * h;
121728                  var _ = n * l + this.y;
121729                  var d = n * h;
121730                  var p = r * l + this.x;
121731                  var m = r * h;
121732                  var f = o * l + this.y;
121733                  var g = o * h;
121734                  var y = this.offset;
121735                  y[i.OX1] = c - d;
121736                  y[i.OY1] = _ + u;
121737                  y[i.OX2] = c - g;
121738                  y[i.OY2] = f + u;
121739                  y[i.OX3] = p - g;
121740                  y[i.OY3] = f + m;
121741                  y[i.OX4] = p - d;
121742                  y[i.OY4] = _ + m;
121743                };
121744                i.prototype.setRegion = function(t) {
121745                  this.region = t;
121746                  var e = this.uvs;
121747                  if (t.rotate) {
121748                    e[2] = t.u;
121749                    e[3] = t.v2;
121750                    e[4] = t.u;
121751                    e[5] = t.v;
121752                    e[6] = t.u2;
121753                    e[7] = t.v;
121754                    e[0] = t.u2;
121755                    e[1] = t.v2;
121756                  } else {
121757                    e[0] = t.u;
121758                    e[1] = t.v2;
121759                    e[2] = t.u;
121760                    e[3] = t.v;
121761                    e[4] = t.u2;
121762                    e[5] = t.v;
121763                    e[6] = t.u2;
121764                    e[7] = t.v2;
121765                  }
121766                };
121767                i.prototype.computeWorldVertices = function(t, e, s, n) {
121768                  var r = this.offset;
121769                  var o = t.worldX, a = t.worldY;
121770                  var l = t.a, h = t.b, c = t.c, u = t.d;
121771                  var _ = 0, d = 0;
121772                  _ = r[i.OX1];
121773                  d = r[i.OY1];
121774                  e[s] = _ * l + d * h + o;
121775                  e[s + 1] = _ * c + d * u + a;
121776                  s += n;
121777                  _ = r[i.OX2];
121778                  d = r[i.OY2];
121779                  e[s] = _ * l + d * h + o;
121780                  e[s + 1] = _ * c + d * u + a;
121781                  s += n;
121782                  _ = r[i.OX3];
121783                  d = r[i.OY3];
121784                  e[s] = _ * l + d * h + o;
121785                  e[s + 1] = _ * c + d * u + a;
121786                  s += n;
121787                  _ = r[i.OX4];
121788                  d = r[i.OY4];
121789                  e[s] = _ * l + d * h + o;
121790                  e[s + 1] = _ * c + d * u + a;
121791                };
121792                i.prototype.copy = function() {
121793                  var e = new i(this.name);
121794                  e.region = this.region;
121795                  e.rendererObject = this.rendererObject;
121796                  e.path = this.path;
121797                  e.x = this.x;
121798                  e.y = this.y;
121799                  e.scaleX = this.scaleX;
121800                  e.scaleY = this.scaleY;
121801                  e.rotation = this.rotation;
121802                  e.width = this.width;
121803                  e.height = this.height;
121804                  t.Utils.arrayCopy(this.uvs, 0, e.uvs, 0, 8);
121805                  t.Utils.arrayCopy(this.offset, 0, e.offset, 0, 8);
121806                  e.color.setFromColor(this.color);
121807                  return e;
121808                };
121809                i.OX1 = 0;
121810                i.OY1 = 1;
121811                i.OX2 = 2;
121812                i.OY2 = 3;
121813                i.OX3 = 4;
121814                i.OY3 = 5;
121815                i.OX4 = 6;
121816                i.OY4 = 7;
121817                i.X1 = 0;
121818                i.Y1 = 1;
121819                i.C1R = 2;
121820                i.C1G = 3;
121821                i.C1B = 4;
121822                i.C1A = 5;
121823                i.U1 = 6;
121824                i.V1 = 7;
121825                i.X2 = 8;
121826                i.Y2 = 9;
121827                i.C2R = 10;
121828                i.C2G = 11;
121829                i.C2B = 12;
121830                i.C2A = 13;
121831                i.U2 = 14;
121832                i.V2 = 15;
121833                i.X3 = 16;
121834                i.Y3 = 17;
121835                i.C3R = 18;
121836                i.C3G = 19;
121837                i.C3B = 20;
121838                i.C3A = 21;
121839                i.U3 = 22;
121840                i.V3 = 23;
121841                i.X4 = 24;
121842                i.Y4 = 25;
121843                i.C4R = 26;
121844                i.C4G = 27;
121845                i.C4B = 28;
121846                i.C4A = 29;
121847                i.U4 = 30;
121848                i.V4 = 31;
121849                return i;
121850              }(t.Attachment);
121851              t.RegionAttachment = e;
121852            }(TMt || (TMt = {}));
121853            !function(t) {
121854              var e = function() {
121855                function e(t, e) {
121856                  this.jitterX = 0;
121857                  this.jitterY = 0;
121858                  this.jitterX = t;
121859                  this.jitterY = e;
121860                }
121861                e.prototype.begin = function(t) {};
121862                e.prototype.transform = function(e, i, s, n) {
121863                  e.x += t.MathUtils.randomTriangular(-this.jitterX, this.jitterY);
121864                  e.y += t.MathUtils.randomTriangular(-this.jitterX, this.jitterY);
121865                };
121866                e.prototype.end = function() {};
121867                return e;
121868              }();
121869              t.JitterEffect = e;
121870            }(TMt || (TMt = {}));
121871            var TMt;
121872            !function(t) {
121873              var e = function() {
121874                function e(t, e) {
121875                  this.centerX = 0;
121876                  this.centerY = 0;
121877                  this.radius = 0;
121878                  this.angle = 0;
121879                  this.worldX = 0;
121880                  this.worldY = 0;
121881                  this.radius = t;
121882                  this.interpolation = e;
121883                }
121884                e.prototype.begin = function(t) {
121885                  this.worldX = t.x + this.centerX;
121886                  this.worldY = t.y + this.centerY;
121887                };
121888                e.prototype.transform = function(e, i, s, n) {
121889                  var r = this.angle * t.MathUtils.degreesToRadians;
121890                  var o = e.x - this.worldX;
121891                  var a = e.y - this.worldY;
121892                  var l = Math.sqrt(o * o + a * a);
121893                  if (l < this.radius) {
121894                    var h = this.interpolation.apply(0, r, (this.radius - l) / this.radius);
121895                    var c = Math.cos(h);
121896                    var u = Math.sin(h);
121897                    e.x = c * o - u * a + this.worldX;
121898                    e.y = u * o + c * a + this.worldY;
121899                  }
121900                };
121901                e.prototype.end = function() {};
121902                e.interpolation = new t.PowOut(2);
121903                return e;
121904              }();
121905              t.SwirlEffect = e;
121906            }(TMt || (TMt = {}));
121907            var vMt = TMt;
121908            const EMt = 1 / 60;
121909            const CMt = [];
121910            const xMt = [];
121911            let wMt = 0;
121912            let RMt = 0;
121913            let IMt = 0;
121914            let MMt = null;
121915            let BMt = null;
121916            let DMt = 0;
121917            let PMt = 0;
121918            let OMt = 0;
121919            let NMt = 0;
121920            let LMt = null;
121921            let FMt = null;
121922            let VMt = 0;
121923            let kMt = 0;
121924            let UMt;
121925            let GMt;
121926            let zMt;
121927            let HMt;
121928            let jMt;
121929            let XMt;
121930            const WMt = new vMt.Color(1, 1, 1, 1);
121931            const YMt = new vMt.Color(1, 1, 1, 1);
121932            const qMt = [ 0, 1, 2, 2, 3, 0 ];
121933            class KMt {
121934              constructor() {
121935                this.frames = [];
121936                this.totalTime = 0;
121937                this.isCompleted = !1;
121938                this.maxVertexCount = 0;
121939                this.maxIndexCount = 0;
121940                this._privateMode = !1;
121941                this._inited = !1;
121942                this._invalid = !0;
121943                this._enableCacheAttachedInfo = !1;
121944                this._frameIdx = -1;
121945                this._skeletonInfo = null;
121946                this._animationName = null;
121947                this._tempSegments = null;
121948                this._tempColors = null;
121949                this._tempBoneInfos = null;
121950                this._privateMode = !1;
121951                this._inited = !1;
121952                this._invalid = !0;
121953                this._enableCacheAttachedInfo = !1;
121954                this.frames = [];
121955                this.totalTime = 0;
121956                this._frameIdx = -1;
121957                this.isCompleted = !1;
121958                this._skeletonInfo = null;
121959                this._animationName = null;
121960                this._tempSegments = null;
121961                this._tempColors = null;
121962                this._tempBoneInfos = null;
121963              }
121964              init(t, e) {
121965                this._inited = !0;
121966                this._animationName = e;
121967                this._skeletonInfo = t;
121968              }
121969              clear() {
121970                this._inited = !1;
121971                for (let t = 0, e = this.frames.length; t < e; t++) {
121972                  this.frames[t].segments.length = 0;
121973                }
121974                this.invalidAllFrame();
121975              }
121976              bind(t) {
121977                t.complete = t => {
121978                  t && t.animation.name === this._animationName && (this.isCompleted = !0);
121979                };
121980              }
121981              unbind(t) {
121982                t.complete = null;
121983              }
121984              begin() {
121985                if (!this._invalid) return;
121986                const t = this._skeletonInfo;
121987                const e = null == t ? void 0 : t.curAnimationCache;
121988                e && e !== this && (this._privateMode ? e.invalidAllFrame() : e.updateToFrame());
121989                const i = null == t ? void 0 : t.skeleton;
121990                const s = null == t ? void 0 : t.listener;
121991                const n = null == t ? void 0 : t.state;
121992                const r = null == i ? void 0 : i.data.findAnimation(this._animationName);
121993                null == n || n.setAnimationWith(0, r, !1);
121994                this.bind(s);
121995                t.curAnimationCache = this;
121996                this._frameIdx = -1;
121997                this.isCompleted = !1;
121998                this.totalTime = 0;
121999                this._invalid = !1;
122000              }
122001              end() {
122002                if (!this.needToUpdate()) {
122003                  this._skeletonInfo.curAnimationCache = null;
122004                  this.frames.length = this._frameIdx + 1;
122005                  this.isCompleted = !0;
122006                  this.unbind(this._skeletonInfo.listener);
122007                }
122008              }
122009              updateToFrame(t) {
122010                if (!this._inited) return;
122011                this.begin();
122012                if (!this.needToUpdate(t)) return;
122013                const e = this._skeletonInfo;
122014                const i = null == e ? void 0 : e.skeleton;
122015                const s = null == e ? void 0 : e.clipper;
122016                const n = null == e ? void 0 : e.state;
122017                do {
122018                  null == i || i.update(EMt);
122019                  null == n || n.update(EMt);
122020                  null == n || n.apply(i);
122021                  null == i || i.updateWorldTransform();
122022                  this._frameIdx++;
122023                  this.updateFrame(i, s, this._frameIdx);
122024                  this.totalTime += EMt;
122025                } while (this.needToUpdate(t));
122026                this.end();
122027              }
122028              isInited() {
122029                return this._inited;
122030              }
122031              isInvalid() {
122032                return this._invalid;
122033              }
122034              invalidAllFrame() {
122035                this.isCompleted = !1;
122036                this._invalid = !0;
122037              }
122038              updateAllFrame() {
122039                this.invalidAllFrame();
122040                this.updateToFrame();
122041              }
122042              enableCacheAttachedInfo() {
122043                if (!this._enableCacheAttachedInfo) {
122044                  this._enableCacheAttachedInfo = !0;
122045                  this.invalidAllFrame();
122046                }
122047              }
122048              fillVertices(t, e, i, s, n) {
122049                HMt = i.a * e.a * t.a * 255;
122050                UMt = e.r * t.r * 255;
122051                GMt = e.g * t.g * 255;
122052                zMt = e.b * t.b * 255;
122053                WMt.r = UMt * i.r;
122054                WMt.g = GMt * i.g;
122055                WMt.b = zMt * i.b;
122056                WMt.a = HMt;
122057                if (null == n.darkColor) YMt.set(0, 0, 0, 1); else {
122058                  YMt.r = n.darkColor.r * UMt;
122059                  YMt.g = n.darkColor.g * GMt;
122060                  YMt.b = n.darkColor.b * zMt;
122061                }
122062                YMt.a = 0;
122063                jMt = (WMt.a << 24 >>> 0) + (WMt.b << 16) + (WMt.g << 8) + WMt.r;
122064                XMt = (YMt.a << 24 >>> 0) + (YMt.b << 16) + (YMt.g << 8) + YMt.r;
122065                if (LMt !== jMt || FMt !== XMt) {
122066                  const t = this._tempColors;
122067                  LMt = jMt;
122068                  FMt = XMt;
122069                  NMt > 0 && (t[NMt - 1].vfOffset = IMt);
122070                  t[NMt++] = {
122071                    fr: WMt.r,
122072                    fg: WMt.g,
122073                    fb: WMt.b,
122074                    fa: WMt.a,
122075                    dr: YMt.r,
122076                    dg: YMt.g,
122077                    db: YMt.b,
122078                    da: YMt.a,
122079                    vfOffset: 0
122080                  };
122081                }
122082                if (s.isClipping()) {
122083                  s.clipTriangles(CMt, VMt, xMt, kMt, CMt, WMt, YMt, !0, 6, IMt, IMt + 2);
122084                  const t = s.clippedVertices;
122085                  const e = s.clippedTriangles;
122086                  kMt = e.length;
122087                  VMt = t.length / 12 * 6;
122088                  for (let t = 0, i = RMt, s = e.length; t < s; ) xMt[i++] = e[t++];
122089                  for (let e = 0, i = t.length, s = IMt; e < i; e += 12, s += 6) {
122090                    CMt[s] = t[e];
122091                    CMt[s + 1] = t[e + 1];
122092                    CMt[s + 2] = t[e + 6];
122093                    CMt[s + 3] = t[e + 7];
122094                    CMt[s + 4] = jMt;
122095                    CMt[s + 5] = XMt;
122096                  }
122097                } else for (let t = IMt, e = IMt + VMt; t < e; t += 6) {
122098                  CMt[t + 4] = jMt;
122099                  CMt[t + 5] = XMt;
122100                }
122101              }
122102              updateFrame(t, e, i) {
122103                IMt = 0;
122104                wMt = 0;
122105                RMt = 0;
122106                MMt = null;
122107                BMt = null;
122108                DMt = 0;
122109                PMt = 0;
122110                OMt = 0;
122111                NMt = 0;
122112                LMt = null;
122113                FMt = null;
122114                this.frames[i] = this.frames[i] || {
122115                  segments: [],
122116                  colors: [],
122117                  boneInfos: [],
122118                  vertices: null,
122119                  uintVert: null,
122120                  indices: null
122121                };
122122                const s = this.frames[i];
122123                const n = this._tempSegments = s.segments;
122124                const r = this._tempColors = s.colors;
122125                const o = this._tempBoneInfos = s.boneInfos;
122126                this.traverseSkeleton(t, e);
122127                NMt > 0 && (r[NMt - 1].vfOffset = IMt);
122128                r.length = NMt;
122129                o.length = wMt;
122130                const a = OMt - 1;
122131                if (a >= 0) if (PMt > 0) {
122132                  const t = n[a];
122133                  t.indexCount = PMt;
122134                  t.vfCount = 7 * DMt;
122135                  t.vertexCount = DMt;
122136                  n.length = OMt;
122137                } else n.length = OMt - 1;
122138                if (0 === n.length) return;
122139                let l = s.vertices;
122140                const h = IMt / 6;
122141                const c = 7 * h;
122142                (!l || l.length < c) && (l = s.vertices = new Float32Array(c));
122143                const u = new Uint32Array(l.buffer);
122144                for (let t = 0, e = 0; t < c; ) {
122145                  l[t] = CMt[e++];
122146                  l[t + 1] = CMt[e++];
122147                  l[t + 3] = CMt[e++];
122148                  l[t + 4] = CMt[e++];
122149                  u[t + 5] = CMt[e++];
122150                  u[t + 6] = CMt[e++];
122151                  t += 7;
122152                }
122153                let _ = s.indices;
122154                (!_ || _.length < RMt) && (_ = s.indices = new Uint16Array(RMt));
122155                for (let t = 0; t < RMt; t++) _[t] = xMt[t];
122156                s.vertices = l;
122157                s.indices = _;
122158                this.maxVertexCount = h > this.maxVertexCount ? h : this.maxVertexCount;
122159                this.maxIndexCount = _.length > this.maxIndexCount ? _.length : this.maxIndexCount;
122160              }
122161              needToUpdate(t) {
122162                return !this.isCompleted && this.totalTime < 30 && (void 0 === t || this._frameIdx < t);
122163              }
122164              traverseSkeleton(t, e) {
122165                const i = this._tempSegments;
122166                const s = this._tempBoneInfos;
122167                const n = t.color;
122168                let r;
122169                let o;
122170                let a;
122171                let l;
122172                let h;
122173                let c;
122174                let u;
122175                let _;
122176                let d;
122177                let p;
122178                let m;
122179                let f;
122180                let g;
122181                const y = t.bones;
122182                if (this._enableCacheAttachedInfo) for (let t = 0, e = y.length; t < e; t++, wMt++) {
122183                  const e = y[t];
122184                  let i = s[wMt];
122185                  i || (i = s[wMt] = {});
122186                  i.a = e.a;
122187                  i.b = e.b;
122188                  i.c = e.c;
122189                  i.d = e.d;
122190                  i.worldX = e.worldX;
122191                  i.worldY = e.worldY;
122192                }
122193                for (let s = 0, y = t.drawOrder.length; s < y; s++) {
122194                  g = t.drawOrder[s];
122195                  if (g.bone.active) {
122196                    VMt = 0;
122197                    kMt = 0;
122198                    r = g.getAttachment();
122199                    if (r) {
122200                      c = r instanceof vMt.RegionAttachment;
122201                      u = r instanceof vMt.MeshAttachment;
122202                      _ = r instanceof vMt.ClippingAttachment;
122203                      if (_) e.clipStart(g, r); else if (c || u) {
122204                        d = r.region.texture.getRealTexture();
122205                        if (d) {
122206                          f = g.data.blendMode;
122207                          if (MMt !== d.getId() || BMt !== f) {
122208                            MMt = d.getId();
122209                            BMt = f;
122210                            p = OMt - 1;
122211                            if (p >= 0) if (PMt > 0) {
122212                              m = i[p];
122213                              m.indexCount = PMt;
122214                              m.vertexCount = DMt;
122215                              m.vfCount = 7 * DMt;
122216                            } else OMt--;
122217                            i[OMt] = {
122218                              tex: d,
122219                              blendMode: f,
122220                              indexCount: 0,
122221                              vertexCount: 0,
122222                              vfCount: 0
122223                            };
122224                            OMt++;
122225                            PMt = 0;
122226                            DMt = 0;
122227                          }
122228                          if (c) {
122229                            h = qMt;
122230                            VMt = 24;
122231                            kMt = 6;
122232                            r.computeWorldVertices(g.bone, CMt, IMt, 6);
122233                          } else if (u) {
122234                            const t = r;
122235                            h = t.triangles;
122236                            VMt = 6 * (t.worldVerticesLength >> 1);
122237                            kMt = h.length;
122238                            t.computeWorldVertices(g, 0, t.worldVerticesLength, CMt, IMt, 6);
122239                          }
122240                          if (0 !== VMt && 0 !== kMt) {
122241                            for (let t = 0, e = RMt, i = h.length; t < i; ) xMt[e++] = h[t++];
122242                            l = r.uvs;
122243                            for (let t = IMt, e = IMt + VMt, i = 0; t < e; t += 6, i += 2) {
122244                              CMt[t + 2] = l[i];
122245                              CMt[t + 3] = l[i + 1];
122246                            }
122247                            o = r.color;
122248                            a = g.color;
122249                            this.fillVertices(n, o, a, e, g);
122250                            if (kMt > 0) {
122251                              for (let t = RMt, e = RMt + kMt; t < e; t++) xMt[t] += DMt;
122252                              RMt += kMt;
122253                              IMt += VMt;
122254                              PMt += kMt;
122255                              DMt += VMt / 6;
122256                            }
122257                            e.clipEndWithSlot(g);
122258                          } else e.clipEndWithSlot(g);
122259                        } else e.clipEndWithSlot(g);
122260                      } else e.clipEndWithSlot(g);
122261                    } else e.clipEndWithSlot(g);
122262                  }
122263                }
122264                e.clipEnd();
122265              }
122266            }
122267            class JMt {
122268              constructor() {
122269                this._privateMode = void 0;
122270                this._skeletonCache = void 0;
122271                this._animationPool = void 0;
122272                this._privateMode = !1;
122273                this._animationPool = {};
122274                this._skeletonCache = {};
122275              }
122276              enablePrivateMode() {
122277                this._privateMode = !0;
122278              }
122279              clear() {
122280                this._animationPool = {};
122281                this._skeletonCache = {};
122282              }
122283              removeSkeleton(t) {
122284                const e = this._skeletonCache[t];
122285                if (!e) return;
122286                const i = e.animationsCache;
122287                for (const e in i) {
122288                  const s = i[e];
122289                  if (s) {
122290                    this._animationPool[`${t}#${e}`] = s;
122291                    s.clear();
122292                  }
122293                }
122294                delete this._skeletonCache[t];
122295              }
122296              getSkeletonCache(t, e) {
122297                let i = this._skeletonCache[t];
122298                if (!i) {
122299                  const s = new vMt.Skeleton(e);
122300                  const n = new vMt.SkeletonClipping;
122301                  const r = new vMt.AnimationStateData(s.data);
122302                  const o = new vMt.AnimationState(r);
122303                  const a = new SMt;
122304                  o.addListener(a);
122305                  this._skeletonCache[t] = i = {
122306                    skeleton: s,
122307                    clipper: n,
122308                    state: o,
122309                    listener: a,
122310                    animationsCache: {},
122311                    curAnimationCache: null
122312                  };
122313                }
122314                return i;
122315              }
122316              getAnimationCache(t, e) {
122317                const i = this._skeletonCache[t];
122318                if (!i) return null;
122319                return i.animationsCache[e];
122320              }
122321              invalidAnimationCache(t) {
122322                const e = this._skeletonCache[t];
122323                if (!(e && e.skeleton)) return;
122324                const i = e.animationsCache;
122325                for (const t in i) {
122326                  i[t].invalidAllFrame();
122327                }
122328              }
122329              initAnimationCache(t, e) {
122330                if (!e) return null;
122331                const i = this._skeletonCache[t];
122332                const s = i && i.skeleton;
122333                if (!s) return null;
122334                if (!s.data.findAnimation(e)) return null;
122335                const n = i.animationsCache;
122336                let r = n[e];
122337                if (!r) {
122338                  const s = `${t}#${e}`;
122339                  r = this._animationPool[s];
122340                  if (r) delete this._animationPool[s]; else {
122341                    r = new KMt;
122342                    r._privateMode = this._privateMode;
122343                  }
122344                  r.init(i, e);
122345                  n[e] = r;
122346                }
122347                return r;
122348              }
122349              updateAnimationCache(t, e) {
122350                if (e) {
122351                  const i = this.initAnimationCache(t, e);
122352                  if (!i) return;
122353                  i.updateAllFrame();
122354                } else {
122355                  const e = this._skeletonCache[t];
122356                  if (!(e && e.skeleton)) return;
122357                  const i = e.animationsCache;
122358                  for (const t in i) {
122359                    i[t].updateAllFrame();
122360                  }
122361                }
122362              }
122363            }
122364            JMt.FrameTime = EMt;
122365            JMt.sharedCache = new JMt;
122366            const ZMt = new qi;
122367            class QMt {
122368              constructor() {
122369                this._inited = !1;
122370                this._skeleton = null;
122371                this._skeletonNode = null;
122372                this._skeletonComp = null;
122373                this._inited = !1;
122374                this._skeleton = null;
122375                this._skeletonNode = null;
122376                this._skeletonComp = null;
122377              }
122378              init(t) {
122379                this._inited = !0;
122380                this._skeleton = t._skeleton;
122381                this._skeletonNode = t.node;
122382                this._skeletonComp = t;
122383              }
122384              reset() {
122385                this._inited = !1;
122386                this._skeleton = null;
122387                this._skeletonNode = null;
122388                this._skeletonComp = null;
122389              }
122390              _syncAttachedNode() {
122391                if (!this._inited) return;
122392                const t = this._skeletonComp.socketNodes;
122393                if (0 === t.size) return;
122394                let e = null;
122395                e = this._skeletonComp.isAnimationCached() ? this._skeletonComp._curFrame && this._skeletonComp._curFrame.boneInfos : this._skeleton.bones;
122396                if (!e) return;
122397                const i = (t, e) => {
122398                  const i = ZMt;
122399                  i.m00 = e.a;
122400                  i.m01 = e.c;
122401                  i.m04 = e.b;
122402                  i.m05 = e.d;
122403                  i.m12 = e.worldX;
122404                  i.m13 = e.worldY;
122405                  t.matrix = ZMt;
122406                };
122407                for (const s of t.keys()) {
122408                  const n = t.get(s);
122409                  if (!n || !n.isValid) {
122410                    t.delete(s);
122411                    continue;
122412                  }
122413                  const r = e[s];
122414                  if (r) i(n, r); else {
122415                    n.removeFromParent();
122416                    n.destroy();
122417                    t.delete(s);
122418                  }
122419                }
122420              }
122421            }
122422            class $Mt extends vMt.Texture {
122423              constructor(t) {
122424                super(t);
122425                this.name = "sp.SkeletonTexture";
122426                this._texture = null;
122427                this._material = null;
122428              }
122429              setRealTexture(t) {
122430                this._texture = t;
122431              }
122432              getRealTexture() {
122433                return this._texture;
122434              }
122435              setFilters(t, e) {
122436                this._texture && this.getRealTexture().setFilters(tBt(t), tBt(e));
122437              }
122438              setWraps(t, e) {
122439                this._texture && this.getRealTexture().setWrapMode(eBt(t), eBt(e));
122440              }
122441              dispose() {}
122442            }
122443            function tBt(t) {
122444              switch (t) {
122445               case vMt.TextureFilter.Nearest:
122446               case vMt.TextureFilter.MipMapNearestNearest:
122447               case vMt.TextureFilter.MipMapLinearNearest:
122448                return Qp.NEAREST;
122449
122450               case vMt.TextureFilter.MipMap:
122451               case vMt.TextureFilter.MipMapNearestLinear:
122452               case vMt.TextureFilter.MipMapLinearLinear:
122453               case vMt.TextureFilter.Linear:
122454               default:
122455                return Qp.LINEAR;
122456              }
122457            }
122458            function eBt(t) {
122459              switch (t) {
122460               case vMt.TextureWrap.MirroredRepeat:
122461                return Zp.MIRRORED_REPEAT;
122462
122463               case vMt.TextureWrap.ClampToEdge:
122464                return Zp.CLAMP_TO_EDGE;
122465
122466               case vMt.TextureWrap.Repeat:
122467               default:
122468                return Zp.REPEAT;
122469              }
122470            }
122471            var iBt, sBt, nBt, rBt, oBt, aBt, lBt, hBt, cBt, uBt, _Bt;
122472            let dBt = (iBt = Ul("sp.SkeletonData"), sBt = Th([ LC ]), nBt = Th([ Fe ]), iBt(rBt = (oBt = (_Bt = class extends gc {
122473              get skeletonJsonStr() {
122474                return this._skeletonJson ? JSON.stringify(this._skeletonJson) : "";
122475              }
122476              get skeletonJson() {
122477                return this._skeletonJson;
122478              }
122479              set skeletonJson(t) {
122480                this.reset();
122481                this._skeletonJson = "string" == typeof t ? JSON.parse(t) : t;
122482                !this._uuid && t.skeleton && (this._uuid = t.skeleton.hash);
122483              }
122484              get atlasText() {
122485                return this._atlasText;
122486              }
122487              set atlasText(t) {
122488                this._atlasText = t;
122489                this.reset();
122490              }
122491              get _nativeAsset() {
122492                return this._buffer;
122493              }
122494              set _nativeAsset(t) {
122495                this._buffer = t;
122496                this.reset();
122497              }
122498              constructor() {
122499                super();
122500                Ml(this, "_skeletonJson", aBt, this);
122501                Ml(this, "textures", lBt, this);
122502                Ml(this, "textureNames", hBt, this);
122503                Ml(this, "scale", cBt, this);
122504                Ml(this, "_atlasText", uBt, this);
122505                this._buffer = void 0;
122506                this._skeletonCache = null;
122507                this._atlasCache = null;
122508                this._skinsEnum = null;
122509                this._animsEnum = null;
122510                this.reset();
122511              }
122512              createNode(t) {
122513                const e = new _y(this.name);
122514                e.addComponent("cc.Skeleton").skeletonData = this;
122515                return t(null, e);
122516              }
122517              reset() {
122518                this._skeletonCache = null;
122519                this._atlasCache = null;
122520              }
122521              resetEnums() {}
122522              getRuntimeData(t) {
122523                if (this._skeletonCache) return this._skeletonCache;
122524                if (!(this.textures && this.textures.length > 0) && this.textureNames && this.textureNames.length > 0) {
122525                  t || console.error(`${this.name} no textures found!`);
122526                  return null;
122527                }
122528                const e = this._getAtlas(t);
122529                if (!e) return null;
122530                const i = new vMt.AtlasAttachmentLoader(e);
122531                let s = null;
122532                let n = null;
122533                if (this.skeletonJson) {
122534                  n = new vMt.SkeletonJson(i);
122535                  s = this.skeletonJson;
122536                } else {
122537                  n = new vMt.SkeletonBinary(i);
122538                  s = new Uint8Array(this._nativeAsset);
122539                }
122540                n.scale = this.scale;
122541                this._skeletonCache = n.readSkeletonData(s);
122542                e.dispose();
122543                return this._skeletonCache;
122544              }
122545              getSkinsEnum() {
122546                if (this._skinsEnum) return this._skinsEnum;
122547                const t = this.getRuntimeData(!0);
122548                if (t) {
122549                  const e = t.skins;
122550                  const i = {};
122551                  for (let t = 0; t < e.length; t++) {
122552                    i[e[t].name] = t;
122553                  }
122554                  return this._skinsEnum = oe(i);
122555                }
122556                return null;
122557              }
122558              getAnimsEnum() {
122559                if (this._animsEnum && Object.keys(this._animsEnum).length > 1) return this._animsEnum;
122560                const t = this.getRuntimeData(!0);
122561                if (t) {
122562                  const e = {
122563                    "<None>": 0
122564                  };
122565                  const i = t.animations;
122566                  for (let t = 0; t < i.length; t++) {
122567                    e[i[t].name] = t + 1;
122568                  }
122569                  return this._animsEnum = oe(e);
122570                }
122571                return null;
122572              }
122573              destroy() {
122574                JMt.sharedCache.removeSkeleton(this._uuid);
122575                return super.destroy();
122576              }
122577              _getTexture(t) {
122578                const e = this.textureNames;
122579                for (let i = 0; i < e.length; i++) if (e[i] === t) {
122580                  const t = this.textures[i];
122581                  const e = new $Mt({
122582                    width: t.width,
122583                    height: t.height
122584                  });
122585                  e.setRealTexture(t);
122586                  return e;
122587                }
122588                console.error(`${this.name} no textures found!`);
122589                return null;
122590              }
122591              _getAtlas(t) {
122592                if (this._atlasCache) return this._atlasCache;
122593                if (!this.atlasText) {
122594                  t || console.error(`${this.name} no atlas found!`);
122595                  return null;
122596                }
122597                return this._atlasCache = new vMt.TextureAtlas(this.atlasText, this._getTexture.bind(this));
122598              }
122599            }, _Bt), aBt = Bl(oBt.prototype, "_skeletonJson", [ Yl ], {
122600              configurable: !0,
122601              enumerable: !0,
122602              writable: !0,
122603              initializer: function() {
122604                return null;
122605              }
122606            }), lBt = Bl(oBt.prototype, "textures", [ Yl, sBt ], {
122607              configurable: !0,
122608              enumerable: !0,
122609              writable: !0,
122610              initializer: function() {
122611                return [];
122612              }
122613            }), hBt = Bl(oBt.prototype, "textureNames", [ Yl, nBt ], {
122614              configurable: !0,
122615              enumerable: !0,
122616              writable: !0,
122617              initializer: function() {
122618                return [];
122619              }
122620            }), cBt = Bl(oBt.prototype, "scale", [ Yl ], {
122621              configurable: !0,
122622              enumerable: !0,
122623              writable: !0,
122624              initializer: function() {
122625                return 1;
122626              }
122627            }), uBt = Bl(oBt.prototype, "_atlasText", [ Yl ], {
122628              configurable: !0,
122629              enumerable: !0,
122630              writable: !0,
122631              initializer: function() {
122632                return "";
122633              }
122634            }), oBt)) || rBt);
122635            m.internal.SpineSkeletonData = dBt;
122636            class pBt extends Tg {
122637              constructor() {
122638                super();
122639                this._skeletons = new Set;
122640              }
122641              static getInstance() {
122642                if (!pBt._instance) {
122643                  pBt._instance = new pBt;
122644                  IR.registerSystem(pBt.ID, pBt._instance, Tg.Priority.HIGH);
122645                }
122646                return pBt._instance;
122647              }
122648              add(t) {
122649                t && (this._skeletons.has(t) || this._skeletons.add(t));
122650              }
122651              remove(t) {
122652                t && this._skeletons.has(t) && this._skeletons.delete(t);
122653              }
122654              postUpdate(t) {
122655                this._skeletons && this._skeletons.forEach((e => {
122656                  e.updateAnimation(t);
122657                }));
122658              }
122659              prepareRenderData() {
122660                this._skeletons && this._skeletons.forEach((t => {
122661                  t.markForUpdateRenderData();
122662                }));
122663              }
122664            }
122665            pBt.ID = "SKELETON";
122666            pBt._instance = void 0;
122667            m.internal.SpineSkeletonSystem = pBt;
122668            var mBt, fBt, gBt, yBt, bBt, SBt, ABt, TBt, vBt, EBt, CBt, xBt, wBt, RBt, IBt, MBt, BBt, DBt, PBt, OBt, NBt, LBt, FBt, VBt, kBt, UBt, GBt, zBt, HBt, jBt, XBt, WBt, YBt, qBt, KBt, JBt, ZBt, QBt, $Bt, tDt, eDt, iDt, sDt, nDt, rDt, oDt, aDt, lDt, hDt, cDt, uDt, _Dt;
122669            let dDt;
122670            !function(t) {
122671              t[t.default = 0] = "default";
122672            }(dDt || (dDt = {}));
122673            he(dDt);
122674            let pDt;
122675            !function(t) {
122676              t[t["<None>"] = 0] = "<None>";
122677            }(pDt || (pDt = {}));
122678            he(pDt);
122679            let mDt;
122680            !function(t) {
122681              t[t.REALTIME = 0] = "REALTIME";
122682              t[t.SHARED_CACHE = 1] = "SHARED_CACHE";
122683              t[t.PRIVATE_CACHE = 2] = "PRIVATE_CACHE";
122684            }(mDt || (mDt = {}));
122685            he(mDt);
122686            function fDt(t, e, i) {
122687              si.Attr.setClassAttr(t, e, "type", "Enum");
122688              si.Attr.setClassAttr(t, e, "enumList", oe.getList(i));
122689            }
122690            let gDt;
122691            !function(t) {
122692              t[t.COLORED_TEXTURED = 0] = "COLORED_TEXTURED";
122693              t[t.TWO_COLORED = 1] = "TWO_COLORED";
122694            }(gDt || (gDt = {}));
122695            let yDt = (mBt = Ul("sp.Skeleton.SpineSocket"), fBt = Th(_y), mBt(gBt = (yBt = (ABt = class {
122696              constructor(t = "", e = null) {
122697                Ml(this, "path", bBt, this);
122698                Ml(this, "target", SBt, this);
122699                this.path = t;
122700                this.target = e;
122701              }
122702            }, ABt), bBt = Bl(yBt.prototype, "path", [ Yl, nh ], {
122703              configurable: !0,
122704              enumerable: !0,
122705              writable: !0,
122706              initializer: function() {
122707                return "";
122708              }
122709            }), SBt = Bl(yBt.prototype, "target", [ fBt, nh, Yl ], {
122710              configurable: !0,
122711              enumerable: !0,
122712              writable: !0,
122713              initializer: function() {
122714                return null;
122715              }
122716            }), yBt)) || gBt);
122717            ee.setClassAlias(yDt, "sp.Skeleton.SpineSocket");
122718            let bDt = (TBt = Ul("sp.Skeleton"), vBt = sh(), EBt = $l(), CBt = Th(hm), xBt = ph(),
122719            wBt = ah(), RBt = Th(dBt), IBt = ah(), MBt = Th(dDt), BBt = lh(), DBt = ah(), PBt = Th(pDt),
122720            OBt = lh(), NBt = ah(), LBt = lh(), FBt = Th(mDt), VBt = lh(), kBt = lh(), UBt = lh(),
122721            GBt = lh(), zBt = lh(), HBt = lh(), jBt = lh(), XBt = Th([ yDt ]), WBt = lh(), YBt = rh(),
122722            qBt = rh(), TBt(KBt = vBt(KBt = EBt(KBt = Ql(KBt = (JBt = (_Dt = uDt = class t extends uD {
122723              get drawList() {
122724                return this._drawList;
122725              }
122726              get customMaterial() {
122727                return this._customMaterial;
122728              }
122729              set customMaterial(t) {
122730                this._customMaterial = t;
122731                this._cleanMaterialCache();
122732                this.setMaterial(this._customMaterial, 0);
122733                this.markForUpdateRenderData();
122734              }
122735              get paused() {
122736                return this._paused;
122737              }
122738              set paused(t) {
122739                this._paused = t;
122740              }
122741              get skeletonData() {
122742                return this._skeletonData;
122743              }
122744              set skeletonData(t) {
122745                t && t.resetEnums();
122746                if (this._skeletonData !== t) {
122747                  this.destroyRenderData();
122748                  this._skeletonData = t;
122749                  this._needUpdateSkeltonData = !0;
122750                  this.defaultSkin = "";
122751                  this.defaultAnimation = "";
122752                  this._updateSkeletonData();
122753                }
122754              }
122755              get animation() {
122756                if (this.isAnimationCached()) return this._animationName;
122757                const t = this.getCurrent(0);
122758                return t && t.animation.name || "";
122759              }
122760              set animation(t) {
122761                if (t) {
122762                  this.setAnimation(0, t, this.loop);
122763                  this.markForUpdateRenderData();
122764                } else if (!this.isAnimationCached()) {
122765                  this.clearTrack(0);
122766                  this.setToSetupPose();
122767                }
122768              }
122769              get _defaultSkinIndex() {
122770                if (this.skeletonData) {
122771                  const t = this.skeletonData.getSkinsEnum();
122772                  if (t) if ("" === this.defaultSkin) {
122773                    if (t.hasOwnProperty(0)) {
122774                      this._defaultSkinIndex = 0;
122775                      return 0;
122776                    }
122777                  } else {
122778                    const e = t[this.defaultSkin];
122779                    if (void 0 !== e) return e;
122780                  }
122781                }
122782                return 0;
122783              }
122784              set _defaultSkinIndex(t) {
122785                let e;
122786                this.skeletonData && (e = this.skeletonData.getSkinsEnum());
122787                if (!e) {
122788                  console.error(`${this.name} skin enums are invalid`);
122789                  return;
122790                }
122791                const i = e[t];
122792                if (void 0 !== i) {
122793                  this.defaultSkin = i;
122794                  this.setSkin(this.defaultSkin);
122795                } else console.error(`${this.name} skin enums are invalid`);
122796              }
122797              get _animationIndex() {
122798                const t = this.animation;
122799                if (this.skeletonData) if (t) {
122800                  const e = this.skeletonData.getAnimsEnum();
122801                  if (e) {
122802                    const i = e[t];
122803                    if (void 0 !== i) return i;
122804                  }
122805                } else this._refreshInspector();
122806                return 0;
122807              }
122808              set _animationIndex(t) {
122809                let e;
122810                this.skeletonData && (e = this.skeletonData.getAnimsEnum());
122811                if (!e) {
122812                  console.error(`${this.name} animation enums are invalid`);
122813                  return;
122814                }
122815                const i = e[t];
122816                if (void 0 !== i) {
122817                  this.animation = i;
122818                  this.animation = i;
122819                } else console.error(`${this.name} animation enums are invalid`);
122820              }
122821              get defaultCacheMode() {
122822                return this._defaultCacheMode;
122823              }
122824              set defaultCacheMode(t) {
122825                this._defaultCacheMode = t;
122826                this.setAnimationCacheMode(this._defaultCacheMode);
122827              }
122828              get premultipliedAlpha() {
122829                return this._premultipliedAlpha;
122830              }
122831              set premultipliedAlpha(t) {
122832                if (t !== this._premultipliedAlpha) {
122833                  this._premultipliedAlpha = t;
122834                  this.markForUpdateRenderData();
122835                }
122836              }
122837              get timeScale() {
122838                return this._timeScale;
122839              }
122840              set timeScale(t) {
122841                t !== this._timeScale && (this._timeScale = t);
122842              }
122843              get debugSlots() {
122844                return this._debugSlots;
122845              }
122846              set debugSlots(t) {
122847                if (t !== this._debugSlots) {
122848                  this._debugSlots = t;
122849                  this._updateDebugDraw();
122850                  this.markForUpdateRenderData();
122851                }
122852              }
122853              get debugBones() {
122854                return this._debugBones;
122855              }
122856              set debugBones(t) {
122857                if (t !== this._debugBones) {
122858                  this._debugBones = t;
122859                  this._updateDebugDraw();
122860                  this.markForUpdateRenderData();
122861                }
122862              }
122863              get debugMesh() {
122864                return this._debugMesh;
122865              }
122866              set debugMesh(t) {
122867                if (t !== this._debugMesh) {
122868                  this._debugMesh = t;
122869                  this._updateDebugDraw();
122870                  this.markForUpdateRenderData();
122871                }
122872              }
122873              get useTint() {
122874                return this._useTint;
122875              }
122876              set useTint(t) {
122877                if (t !== this._useTint) {
122878                  this._useTint = t;
122879                  this._updateUseTint();
122880                }
122881              }
122882              get sockets() {
122883                return this._sockets;
122884              }
122885              set sockets(t) {
122886                this._sockets = t;
122887                this._updateSocketBindings();
122888                this.attachUtil._syncAttachedNode();
122889              }
122890              get socketNodes() {
122891                return this._socketNodes;
122892              }
122893              requestDrawInfo(t) {
122894                this._drawInfoList[t] || (this._drawInfoList[t] = new aB);
122895                return this._drawInfoList[t];
122896              }
122897              constructor() {
122898                super();
122899                Ml(this, "loop", ZBt, this);
122900                this._frameCache = null;
122901                this._curFrame = null;
122902                this._effectDelegate = null;
122903                this._skeleton = void 0;
122904                this._clipper = void 0;
122905                this._debugRenderer = void 0;
122906                this._startSlotIndex = void 0;
122907                this._endSlotIndex = void 0;
122908                this._startEntry = void 0;
122909                this._endEntry = void 0;
122910                this.attachUtil = void 0;
122911                this.maxVertexCount = 0;
122912                this.maxIndexCount = 0;
122913                this._materialCache = {};
122914                this._enumSkins = oe({});
122915                this._enumAnimations = oe({});
122916                this._playTimes = 0;
122917                Ml(this, "_timeScale", QBt, this);
122918                this._paused = !1;
122919                this._accTime = 0;
122920                this._playCount = 0;
122921                this._skeletonCache = null;
122922                this._animationName = "";
122923                this._animationQueue = [];
122924                this._headAniInfo = null;
122925                this._isAniComplete = !0;
122926                this._needUpdateSkeltonData = !0;
122927                Ml(this, "_useTint", $Bt, this);
122928                Ml(this, "_preCacheMode", tDt, this);
122929                Ml(this, "_cacheMode", eDt, this);
122930                Ml(this, "_defaultCacheMode", iDt, this);
122931                Ml(this, "_debugBones", sDt, this);
122932                Ml(this, "_debugSlots", nDt, this);
122933                Ml(this, "_skeletonData", rDt, this);
122934                Ml(this, "_premultipliedAlpha", oDt, this);
122935                Ml(this, "defaultSkin", aDt, this);
122936                Ml(this, "defaultAnimation", lDt, this);
122937                Ml(this, "_sockets", hDt, this);
122938                this._drawIdx = 0;
122939                this._drawList = new to((() => ({
122940                  material: null,
122941                  texture: null,
122942                  indexOffset: 0,
122943                  indexCount: 0
122944                })), 1);
122945                Ml(this, "_debugMesh", cDt, this);
122946                this._rootBone = void 0;
122947                this._state = void 0;
122948                this._listener = void 0;
122949                this._socketNodes = new Map;
122950                this._cachedSockets = new Map;
122951                this._drawInfoList = [];
122952                this._effectDelegate = null;
122953                this._skeleton = null;
122954                this._rootBone = null;
122955                this._listener = null;
122956                this._debugRenderer = null;
122957                this._startSlotIndex = -1;
122958                this._endSlotIndex = -1;
122959                this._startEntry = {
122960                  animation: {
122961                    name: ""
122962                  },
122963                  trackIndex: 0
122964                };
122965                this._endEntry = {
122966                  animation: {
122967                    name: ""
122968                  },
122969                  trackIndex: 0
122970                };
122971                this.attachUtil = new QMt;
122972                fDt(this, "_defaultSkinIndex", this._enumSkins);
122973                fDt(this, "_animationIndex", this._enumAnimations);
122974                this._useVertexOpacity = !0;
122975              }
122976              setSkeletonData(t) {
122977                const e = this.node._uiProps.uiTransformComp;
122978                null != t.width && null != t.height && e.setContentSize(t.width, t.height);
122979                if (this._cacheMode === mDt.SHARED_CACHE) this._skeletonCache = JMt.sharedCache; else if (this._cacheMode === mDt.PRIVATE_CACHE) {
122980                  this._skeletonCache = new JMt;
122981                  this._skeletonCache.enablePrivateMode();
122982                }
122983                if (this.isAnimationCached()) {
122984                  (this.debugBones || this.debugSlots) && C("Debug bones or slots is invalid in cached mode");
122985                  const e = this._skeletonCache.getSkeletonCache(this.skeletonData._uuid, t);
122986                  this._skeleton = e.skeleton;
122987                  this._clipper = e.clipper;
122988                  this._rootBone = this._skeleton.getRootBone();
122989                } else {
122990                  this._skeleton = new vMt.Skeleton(t);
122991                  this._clipper = new vMt.SkeletonClipping;
122992                  this._rootBone = this._skeleton.getRootBone();
122993                }
122994                this._flushAssembler();
122995              }
122996              setSlotsRange(t, e) {
122997                if (this.isAnimationCached()) C("Slots visible range can not be modified in cached mode."); else {
122998                  this._startSlotIndex = t;
122999                  this._endSlotIndex = e;
123000                }
123001              }
123002              setAnimationStateData(t) {
123003                if (this.isAnimationCached()) C("'setAnimationStateData' interface can not be invoked in cached mode."); else {
123004                  const e = new vMt.AnimationState(t);
123005                  if (this._listener) {
123006                    this._state && this._state.removeListener(this._listener);
123007                    e.addListener(this._listener);
123008                  }
123009                  this._state = e;
123010                }
123011              }
123012              __preload() {
123013                super.__preload();
123014                const t = this.node.children;
123015                for (let e = 0, i = t.length; e < i; e++) {
123016                  const i = t[e];
123017                  i && "DEBUG_DRAW_NODE" === i.name && i.destroy();
123018                }
123019                this._updateSkeletonData();
123020                this._updateDebugDraw();
123021                this._indexBoneSockets();
123022                this._updateSocketBindings();
123023              }
123024              setAnimationCacheMode(t) {
123025                if (this._preCacheMode !== t) {
123026                  this._cacheMode = t;
123027                  this._needUpdateSkeltonData = !0;
123028                  this._updateSkeletonData();
123029                  this._updateUseTint();
123030                  this._updateSocketBindings();
123031                  this.markForUpdateRenderData();
123032                }
123033              }
123034              isAnimationCached() {
123035                return this._cacheMode !== mDt.REALTIME;
123036              }
123037              updateAnimation(t) {
123038                this.markForUpdateRenderData();
123039                if (!this.paused) {
123040                  t *= 1 * this._timeScale;
123041                  if (this.isAnimationCached()) {
123042                    if (this._isAniComplete) {
123043                      if (0 === this._animationQueue.length && !this._headAniInfo) {
123044                        const t = this._frameCache;
123045                        if (t && t.isInvalid()) {
123046                          t.updateToFrame();
123047                          const e = t.frames;
123048                          this._curFrame = e[e.length - 1];
123049                        }
123050                        return;
123051                      }
123052                      this._headAniInfo || (this._headAniInfo = this._animationQueue.shift());
123053                      this._accTime += t;
123054                      if (this._accTime > this._headAniInfo.delay) {
123055                        const t = this._headAniInfo;
123056                        this._headAniInfo = null;
123057                        this.setAnimation(0, t.animationName, t.loop);
123058                      }
123059                      return;
123060                    }
123061                    this._updateCache(t);
123062                  } else this._updateRealtime(t);
123063                }
123064              }
123065              setVertexEffectDelegate(t) {
123066                this._effectDelegate = t;
123067              }
123068              setToSetupPose() {
123069                this._skeleton && this._skeleton.setToSetupPose();
123070              }
123071              setBonesToSetupPose() {
123072                this._skeleton && this._skeleton.setBonesToSetupPose();
123073              }
123074              setSlotsToSetupPose() {
123075                this._skeleton && this._skeleton.setSlotsToSetupPose();
123076              }
123077              updateAnimationCache(t) {
123078                if (!this.isAnimationCached()) return;
123079                const e = this._skeletonData._uuid;
123080                this._skeletonCache && this._skeletonCache.updateAnimationCache(e, t);
123081              }
123082              invalidAnimationCache() {
123083                this.isAnimationCached() && this._skeletonCache && this._skeletonCache.invalidAnimationCache(this._skeletonData._uuid);
123084              }
123085              findBone(t) {
123086                return this._skeleton ? this._skeleton.findBone(t) : null;
123087              }
123088              findSlot(t) {
123089                return this._skeleton ? this._skeleton.findSlot(t) : null;
123090              }
123091              setSkin(t) {
123092                if (this._skeleton) {
123093                  this._skeleton.setSkinByName(t);
123094                  this._skeleton.setSlotsToSetupPose();
123095                }
123096                this.invalidAnimationCache();
123097              }
123098              getAttachment(t, e) {
123099                return this._skeleton ? this._skeleton.getAttachmentByName(t, e) : null;
123100              }
123101              setAttachment(t, e) {
123102                this._skeleton && this._skeleton.setAttachment(t, e);
123103                this.invalidAnimationCache();
123104              }
123105              getTextureAtlas(t) {
123106                return t.region;
123107              }
123108              setMix(t, e, i) {
123109                this._state && this._state.data.setMix(t, e, i);
123110              }
123111              setAnimation(t, e, i) {
123112                this._playTimes = i ? 0 : 1;
123113                this._animationName = e;
123114                if (this.isAnimationCached()) {
123115                  0 !== t && C("Track index can not greater than 0 in cached mode.");
123116                  if (!this._skeletonCache) return null;
123117                  let i = this._skeletonCache.getAnimationCache(this._skeletonData._uuid, e);
123118                  i || (i = this._skeletonCache.initAnimationCache(this._skeletonData._uuid, e));
123119                  if (i) {
123120                    this._isAniComplete = !1;
123121                    this._accTime = 0;
123122                    this._playCount = 0;
123123                    this._frameCache = i;
123124                    this._socketNodes.size > 0 && this._frameCache.enableCacheAttachedInfo();
123125                    this._frameCache.updateToFrame(0);
123126                    this._curFrame = this._frameCache.frames[0];
123127                  }
123128                } else if (this._skeleton) {
123129                  const s = this._skeleton.data.findAnimation(e);
123130                  if (!s) {
123131                    P(7509, e);
123132                    return null;
123133                  }
123134                  const n = this._state.setAnimationWith(t, s, i);
123135                  this._state.apply(this._skeleton);
123136                  return n;
123137                }
123138                return null;
123139              }
123140              addAnimation(t, e, i, s) {
123141                s = s || 0;
123142                if (this.isAnimationCached()) {
123143                  0 !== t && C("Track index can not greater than 0 in cached mode.");
123144                  this._animationQueue.push({
123145                    animationName: e,
123146                    loop: i,
123147                    delay: s
123148                  });
123149                } else if (this._skeleton) {
123150                  var n;
123151                  const r = this._skeleton.data.findAnimation(e);
123152                  if (!r) {
123153                    P(7510, e);
123154                    return null;
123155                  }
123156                  return null === (n = this._state) || void 0 === n ? void 0 : n.addAnimationWith(t, r, i, s);
123157                }
123158                return null;
123159              }
123160              findAnimation(t) {
123161                return this._skeleton ? this._skeleton.data.findAnimation(t) : null;
123162              }
123163              getCurrent(t) {
123164                if (this.isAnimationCached()) C("'getCurrent' interface can not be invoked in cached mode."); else if (this._state) return this._state.getCurrent(t);
123165                return null;
123166              }
123167              clearTracks() {
123168                if (this.isAnimationCached()) C("'clearTracks' interface can not be invoked in cached mode."); else if (this._state) {
123169                  this._state.clearTracks();
123170                  this.setToSetupPose();
123171                }
123172              }
123173              clearTrack(t) {
123174                this.isAnimationCached() ? C("'clearTrack' interface can not be invoked in cached mode.") : this._state && this._state.clearTrack(t);
123175              }
123176              setStartListener(t) {
123177                this._ensureListener();
123178                this._listener.start = t;
123179              }
123180              setInterruptListener(t) {
123181                this._ensureListener();
123182                this._listener.interrupt = t;
123183              }
123184              setEndListener(t) {
123185                this._ensureListener();
123186                this._listener.end = t;
123187              }
123188              setDisposeListener(t) {
123189                this._ensureListener();
123190                this._listener.dispose = t;
123191              }
123192              setCompleteListener(t) {
123193                this._ensureListener();
123194                this._listener.complete = t;
123195              }
123196              setEventListener(t) {
123197                this._ensureListener();
123198                this._listener.event = t;
123199              }
123200              setTrackStartListener(t, e) {
123201                SMt.getListeners(t).start = e;
123202              }
123203              setTrackInterruptListener(t, e) {
123204                SMt.getListeners(t).interrupt = e;
123205              }
123206              setTrackEndListener(t, e) {
123207                SMt.getListeners(t).end = e;
123208              }
123209              setTrackDisposeListener(t, e) {
123210                SMt.getListeners(t).dispose = e;
123211              }
123212              setTrackCompleteListener(t, e) {
123213                SMt.getListeners(t).complete = function(t) {
123214                  const i = Math.floor(t.trackTime / t.animationEnd);
123215                  e(t, i);
123216                };
123217              }
123218              setTrackEventListener(t, e) {
123219                SMt.getListeners(t).event = e;
123220              }
123221              getState() {
123222                return this._state;
123223              }
123224              onEnable() {
123225                super.onEnable();
123226                this._flushAssembler();
123227                pBt.getInstance().add(this);
123228              }
123229              onDisable() {
123230                super.onDisable();
123231                pBt.getInstance().remove(this);
123232              }
123233              onDestroy() {
123234                this._cleanMaterialCache();
123235                this._drawList.destroy();
123236                super.onDestroy();
123237              }
123238              destroyRenderData() {
123239                this._drawList.reset();
123240                super.destroyRenderData();
123241              }
123242              getMaterialForBlendAndTint(t, e, i) {
123243                const s = `${i}/${t}/${e}`;
123244                let n = this._materialCache[s];
123245                if (n) return n;
123246                let r = this.customMaterial;
123247                null === r && (r = xR.get("default-spine-material"));
123248                let o = !1;
123249                switch (i) {
123250                 case gDt.TWO_COLORED:
123251                  o = !0;
123252
123253                 case gDt.COLORED_TEXTURED:
123254                }
123255                n = new uS({
123256                  parent: r,
123257                  subModelIdx: 0,
123258                  owner: this
123259                });
123260                this._materialCache[s] = n;
123261                n.overridePipelineStates({
123262                  blendState: {
123263                    blendColor: Bi.WHITE,
123264                    targets: [ {
123265                      blendEq: Fs.ADD,
123266                      blendAlphaEq: Fs.ADD,
123267                      blendSrc: t,
123268                      blendDst: e,
123269                      blendSrcAlpha: t,
123270                      blendDstAlpha: e
123271                    } ]
123272                  }
123273                });
123274                n.recompileShaders({
123275                  TWO_COLORED: o,
123276                  USE_LOCAL: !0
123277                });
123278                return n;
123279              }
123280              onRestore() {
123281                this.updateMaterial();
123282                this.markForUpdateRenderData();
123283              }
123284              querySockets() {
123285                if (!this._skeleton) return [];
123286                0 === this._cachedSockets.size && this._indexBoneSockets();
123287                return this._cachedSockets.size > 0 ? Array.from(this._cachedSockets.keys()).sort() : [];
123288              }
123289              _requestDrawData(t, e, i, s) {
123290                const n = this._drawList.add();
123291                n.material = t;
123292                n.texture = e;
123293                n.indexOffset = i;
123294                n.indexCount = s;
123295                return n;
123296              }
123297              _render(t) {
123298                if (this.renderData && this._drawList) {
123299                  const e = this.renderData;
123300                  const i = e.chunk;
123301                  const s = i.vertexAccessor;
123302                  const n = e.getMeshBuffer();
123303                  const r = n.indexOffset;
123304                  s.appendIndices(i.bufferId, e.indices);
123305                  for (let e = 0; e < this._drawList.length; e++) {
123306                    this._drawIdx = e;
123307                    const i = this._drawList.data[e];
123308                    if (i.texture) {
123309                      const e = n.requireFreeIA(t.device);
123310                      e.firstIndex = r + i.indexOffset;
123311                      e.indexCount = i.indexCount;
123312                      t.commitIA(this, e, i.texture, i.material, this.node);
123313                    }
123314                  }
123315                }
123316              }
123317              updateWorldTransform() {
123318                this.isAnimationCached() && this._skeleton && this._skeleton.updateWorldTransform();
123319              }
123320              _emitCacheCompleteEvent() {
123321                if (this._listener) {
123322                  this._endEntry.animation.name = this._animationName;
123323                  this._listener.complete && this._listener.complete(this._endEntry);
123324                  this._listener.end && this._listener.end(this._endEntry);
123325                }
123326              }
123327              _updateCache(t) {
123328                const e = this._frameCache;
123329                if (!e.isInited()) return;
123330                const i = e.frames;
123331                const s = JMt.FrameTime;
123332                if (0 === this._accTime && 0 === this._playCount) {
123333                  this._startEntry.animation.name = this._animationName;
123334                  this._listener && this._listener.start && this._listener.start(this._startEntry);
123335                }
123336                this._accTime += t;
123337                let n = Math.floor(this._accTime / s);
123338                if (!e.isCompleted) {
123339                  e.updateToFrame(n);
123340                  if (this.renderData && (this.renderData.vertexCount < e.maxVertexCount || this.renderData.indexCount < e.maxIndexCount)) {
123341                    this.maxVertexCount = e.maxVertexCount > this.maxVertexCount ? e.maxVertexCount : this.maxVertexCount;
123342                    this.maxIndexCount = e.maxIndexCount > this.maxIndexCount ? e.maxIndexCount : this.maxIndexCount;
123343                    this.renderData.resize(this.maxVertexCount, this.maxIndexCount);
123344                    (!this.renderData.indices || this.maxIndexCount > this.renderData.indices.length) && (this.renderData.indices = new Uint16Array(this.maxIndexCount));
123345                  }
123346                }
123347                if (e.isCompleted && n >= i.length) {
123348                  this._playCount++;
123349                  if (this._playTimes > 0 && this._playCount >= this._playTimes) {
123350                    this._curFrame = i[i.length - 1];
123351                    this._accTime = 0;
123352                    this._playCount = 0;
123353                    this._isAniComplete = !0;
123354                    this._emitCacheCompleteEvent();
123355                    return;
123356                  }
123357                  this._accTime = 0;
123358                  n = 0;
123359                  this._emitCacheCompleteEvent();
123360                }
123361                this._curFrame = i[n];
123362              }
123363              _updateRealtime(t) {
123364                const e = this._skeleton;
123365                const i = this._state;
123366                if (e) {
123367                  e.update(t);
123368                  if (i) {
123369                    i.update(t);
123370                    i.apply(e);
123371                  }
123372                }
123373              }
123374              _indexBoneSockets() {
123375                if (!this._skeleton) return;
123376                this._cachedSockets.clear();
123377                const t = this._skeleton.bones;
123378                const e = i => null == i.parent ? i.data.name || "<Unamed>" : `${e(t[i.parent.data.index])}/${i.data.name}`;
123379                for (let i = 0, s = t.length; i < s; i++) {
123380                  const s = t[i].data;
123381                  const n = e(t[i]);
123382                  this._cachedSockets.set(n, s.index);
123383                }
123384              }
123385              _updateUseTint() {
123386                this._cleanMaterialCache();
123387                this.destroyRenderData();
123388                if (this._assembler && this._skeleton) {
123389                  this._renderData = this._assembler.createData(this);
123390                  this.markForUpdateRenderData();
123391                }
123392              }
123393              _updateBatch() {
123394                this.markForUpdateRenderData();
123395              }
123396              _updateAnimEnum() {
123397                let t;
123398                t = this.skeletonData ? this.skeletonData.getAnimsEnum() : pDt;
123399                this._enumAnimations = oe({});
123400                Object.assign(this._enumAnimations, t);
123401                oe.update(this._enumAnimations);
123402                fDt(this, "_animationIndex", this._enumAnimations);
123403              }
123404              _updateSkinEnum() {
123405                let t;
123406                t = this.skeletonData ? this.skeletonData.getSkinsEnum() : dDt;
123407                this._enumSkins = oe({});
123408                Object.assign(this._enumSkins, t);
123409                oe.update(this._enumSkins);
123410                fDt(this, "_defaultSkinIndex", this._enumSkins);
123411              }
123412              _ensureListener() {
123413                if (!this._listener) {
123414                  this._listener = new SMt;
123415                  this._state && this._state.addListener(this._listener);
123416                }
123417              }
123418              _updateSkeletonData() {
123419                if (!this.skeletonData || !1 === this._needUpdateSkeltonData) return;
123420                this._needUpdateSkeltonData = !1;
123421                const t = this.skeletonData.getRuntimeData();
123422                if (t) {
123423                  try {
123424                    this.setSkeletonData(t);
123425                    this.isAnimationCached() || this.setAnimationStateData(new vMt.AnimationStateData(this._skeleton.data));
123426                    this.defaultSkin && this.setSkin(this.defaultSkin);
123427                  } catch (t) {
123428                    C(t);
123429                  }
123430                  this._indexBoneSockets();
123431                  this.attachUtil.init(this);
123432                  this._preCacheMode = this._cacheMode;
123433                  this.animation = this.defaultAnimation;
123434                }
123435              }
123436              _refreshInspector() {
123437                this._updateAnimEnum();
123438                this._updateSkinEnum();
123439              }
123440              _updateDebugDraw() {
123441                if (this.debugBones || this.debugSlots || this.debugMesh) {
123442                  if (!this._debugRenderer) {
123443                    const t = new _y("DEBUG_DRAW_NODE");
123444                    t.hideFlags |= co.Flags.DontSave | co.Flags.HideInHierarchy;
123445                    const e = t.addComponent(dN);
123446                    e.lineWidth = 1;
123447                    e.strokeColor = new Bi(255, 0, 0, 255);
123448                    this._debugRenderer = e;
123449                    t.parent = this.node;
123450                  }
123451                  this.isAnimationCached() && C("Debug bones or slots is invalid in cached mode");
123452                } else if (this._debugRenderer) {
123453                  this._debugRenderer.node.destroy();
123454                  this._debugRenderer = null;
123455                }
123456              }
123457              _flushAssembler() {
123458                const e = t.Assembler.getAssembler(this);
123459                this._assembler !== e && (this._assembler = e);
123460                if (this._skeleton && this._assembler) {
123461                  this._renderData = this._assembler.createData(this);
123462                  this.markForUpdateRenderData();
123463                  this._updateColor();
123464                }
123465              }
123466              _updateSocketBindings() {
123467                if (this._skeleton) {
123468                  this._socketNodes.clear();
123469                  for (let t = 0, e = this._sockets.length; t < e; t++) {
123470                    const e = this._sockets[t];
123471                    if (e.path && e.target) {
123472                      const t = this._cachedSockets.get(e.path);
123473                      if (!t) {
123474                        console.error(`Skeleton data does not contain path ${e.path}`);
123475                        continue;
123476                      }
123477                      this._socketNodes.set(t, e.target);
123478                    }
123479                  }
123480                }
123481              }
123482              _verifySockets(t) {
123483                for (let e = 0, i = t.length; e < i; e++) {
123484                  const i = t[e].target;
123485                  !i || i.parent && i.parent === this.node || console.error(`Target node ${i.name} is expected to be a direct child of ${this.node.name}`);
123486                }
123487                const e = new Map;
123488                t.forEach((t => {
123489                  t.target && (e.get(t.target) ? console.error(`Target node ${t.target.name} has existed.`) : e.set(t.target, !0));
123490                }));
123491              }
123492              _cleanMaterialCache() {
123493                for (const t in this._materialCache) this._materialCache[t].destroy();
123494                this._materialCache = {};
123495              }
123496              createRenderEntity() {
123497                const t = new fB(uB.DYNAMIC);
123498                t.setUseLocal(!0);
123499                return t;
123500              }
123501              markForUpdateRenderData(t = !0) {
123502                super.markForUpdateRenderData(t);
123503                this._debugRenderer && this._debugRenderer.markForUpdateRenderData(t);
123504              }
123505            }, uDt.SpineSocket = yDt, uDt.AnimationCacheMode = mDt, _Dt), Bl(JBt.prototype, "customMaterial", [ vh, CBt, xBt, wBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "customMaterial"), JBt.prototype),
123506            Bl(JBt.prototype, "skeletonData", [ nh, RBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "skeletonData"), JBt.prototype),
123507            Bl(JBt.prototype, "_defaultSkinIndex", [ IBt, MBt, BBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "_defaultSkinIndex"), JBt.prototype),
123508            Bl(JBt.prototype, "_animationIndex", [ DBt, PBt, OBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "_animationIndex"), JBt.prototype),
123509            Bl(JBt.prototype, "defaultCacheMode", [ NBt, LBt, nh, FBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "defaultCacheMode"), JBt.prototype),
123510            ZBt = Bl(JBt.prototype, "loop", [ Yl, VBt ], {
123511              configurable: !0,
123512              enumerable: !0,
123513              writable: !0,
123514              initializer: function() {
123515                return !0;
123516              }
123517            }), Bl(JBt.prototype, "premultipliedAlpha", [ nh, kBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "premultipliedAlpha"), JBt.prototype),
123518            Bl(JBt.prototype, "timeScale", [ UBt, nh ], Object.getOwnPropertyDescriptor(JBt.prototype, "timeScale"), JBt.prototype),
123519            Bl(JBt.prototype, "debugSlots", [ nh, GBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "debugSlots"), JBt.prototype),
123520            Bl(JBt.prototype, "debugBones", [ nh, zBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "debugBones"), JBt.prototype),
123521            Bl(JBt.prototype, "debugMesh", [ nh, HBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "debugMesh"), JBt.prototype),
123522            Bl(JBt.prototype, "useTint", [ nh, jBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "useTint"), JBt.prototype),
123523            Bl(JBt.prototype, "sockets", [ XBt, WBt ], Object.getOwnPropertyDescriptor(JBt.prototype, "sockets"), JBt.prototype),
123524            QBt = Bl(JBt.prototype, "_timeScale", [ Yl ], {
123525              configurable: !0,
123526              enumerable: !0,
123527              writable: !0,
123528              initializer: function() {
123529                return 1;
123530              }
123531            }), $Bt = Bl(JBt.prototype, "_useTint", [ Yl ], {
123532              configurable: !0,
123533              enumerable: !0,
123534              writable: !0,
123535              initializer: function() {
123536                return !1;
123537              }
123538            }), tDt = Bl(JBt.prototype, "_preCacheMode", [ Yl ], {
123539              configurable: !0,
123540              enumerable: !0,
123541              writable: !0,
123542              initializer: function() {
123543                return -1;
123544              }
123545            }), eDt = Bl(JBt.prototype, "_cacheMode", [ Yl ], {
123546              configurable: !0,
123547              enumerable: !0,
123548              writable: !0,
123549              initializer: function() {
123550                return mDt.REALTIME;
123551              }
123552            }), iDt = Bl(JBt.prototype, "_defaultCacheMode", [ Yl ], {
123553              configurable: !0,
123554              enumerable: !0,
123555              writable: !0,
123556              initializer: function() {
123557                return mDt.REALTIME;
123558              }
123559            }), sDt = Bl(JBt.prototype, "_debugBones", [ Yl ], {
123560              configurable: !0,
123561              enumerable: !0,
123562              writable: !0,
123563              initializer: function() {
123564                return !1;
123565              }
123566            }), nDt = Bl(JBt.prototype, "_debugSlots", [ Yl ], {
123567              configurable: !0,
123568              enumerable: !0,
123569              writable: !0,
123570              initializer: function() {
123571                return !1;
123572              }
123573            }), rDt = Bl(JBt.prototype, "_skeletonData", [ Yl ], {
123574              configurable: !0,
123575              enumerable: !0,
123576              writable: !0,
123577              initializer: function() {
123578                return null;
123579              }
123580            }), oDt = Bl(JBt.prototype, "_premultipliedAlpha", [ Yl ], {
123581              configurable: !0,
123582              enumerable: !0,
123583              writable: !0,
123584              initializer: function() {
123585                return !0;
123586              }
123587            }), aDt = Bl(JBt.prototype, "defaultSkin", [ Yl, YBt ], {
123588              configurable: !0,
123589              enumerable: !0,
123590              writable: !0,
123591              initializer: function() {
123592                return "";
123593              }
123594            }), lDt = Bl(JBt.prototype, "defaultAnimation", [ qBt, Yl ], {
123595              configurable: !0,
123596              enumerable: !0,
123597              writable: !0,
123598              initializer: function() {
123599                return "";
123600              }
123601            }), hDt = Bl(JBt.prototype, "_sockets", [ Yl ], {
123602              configurable: !0,
123603              enumerable: !0,
123604              writable: !0,
123605              initializer: function() {
123606                return [];
123607              }
123608            }), cDt = Bl(JBt.prototype, "_debugMesh", [ Yl ], {
123609              configurable: !0,
123610              enumerable: !0,
123611              writable: !0,
123612              initializer: function() {
123613                return !1;
123614              }
123615            }), JBt)) || KBt) || KBt) || KBt) || KBt);
123616            m.internal.SpineSkeleton = bDt;
123617            const SDt = [ 0, 1, 2, 2, 3, 0 ];
123618            const ADt = new Bi(0, 0, 255, 255);
123619            const TDt = new Bi(255, 0, 0, 255);
123620            const vDt = new Bi(0, 255, 0, 255);
123621            const EDt = new Bi(255, 255, 0, 255);
123622            const CDt = new vMt.Color(1, 1, 1, 1);
123623            const xDt = new vMt.Color(1, 1, 1, 1);
123624            const wDt = new vMt.Vector2;
123625            const RDt = new vMt.Vector2;
123626            let IDt;
123627            let MDt;
123628            let BDt;
123629            let DDt;
123630            let PDt;
123631            let ODt;
123632            let NDt;
123633            let LDt;
123634            let FDt;
123635            let VDt;
123636            let kDt;
123637            let UDt;
123638            let GDt;
123639            let zDt;
123640            let HDt;
123641            let jDt;
123642            let XDt = 0;
123643            let WDt = 0;
123644            let YDt = 0;
123645            let qDt = 0;
123646            let KDt = 0;
123647            let JDt = 0;
123648            let ZDt = 0;
123649            let QDt = 0;
123650            let $Dt;
123651            let tPt;
123652            let ePt;
123653            let iPt;
123654            let sPt;
123655            let nPt;
123656            let rPt;
123657            let oPt;
123658            let aPt;
123659            let lPt;
123660            let hPt;
123661            let cPt;
123662            let uPt;
123663            let _Pt;
123664            let dPt;
123665            let pPt;
123666            let mPt;
123667            let fPt;
123668            let gPt;
123669            let yPt;
123670            let bPt;
123671            let SPt;
123672            let APt = null;
123673            let TPt = null;
123674            let vPt = null;
123675            function EPt(t) {
123676              let e;
123677              let i;
123678              switch (t) {
123679               case vMt.BlendMode.Additive:
123680                e = IDt ? Ls.ONE : Ls.SRC_ALPHA;
123681                i = Ls.ONE;
123682                break;
123683
123684               case vMt.BlendMode.Multiply:
123685                e = Ls.DST_COLOR;
123686                i = Ls.ONE_MINUS_SRC_ALPHA;
123687                break;
123688
123689               case vMt.BlendMode.Screen:
123690                e = Ls.ONE;
123691                i = Ls.ONE_MINUS_SRC_COLOR;
123692                break;
123693
123694               case vMt.BlendMode.Normal:
123695               default:
123696                e = IDt ? Ls.ONE : Ls.SRC_ALPHA;
123697                i = Ls.ONE_MINUS_SRC_ALPHA;
123698              }
123699              return mPt.getMaterialForBlendAndTint(e, i, PDt ? gDt.TWO_COLORED : gDt.COLORED_TEXTURED);
123700            }
123701            function CPt(t) {
123702              cPt = t.fa * UDt;
123703              MDt = IDt ? cPt / 255 : 1;
123704              nPt = FDt * MDt;
123705              rPt = VDt * MDt;
123706              oPt = kDt * MDt;
123707              aPt = t.fr * nPt;
123708              lPt = t.fg * rPt;
123709              hPt = t.fb * oPt;
123710              GDt = (cPt << 24 >>> 0) + (hPt << 16) + (lPt << 8) + aPt;
123711              uPt = t.dr * nPt;
123712              _Pt = t.dg * rPt;
123713              dPt = t.db * oPt;
123714              pPt = IDt ? 255 : 0;
123715              zDt = (pPt << 24 >>> 0) + (dPt << 16) + (_Pt << 8) + uPt;
123716            }
123717            function xPt(t) {
123718              return (t.a << 24 >>> 0) + (t.b << 16) + (t.g << 8) + t.r;
123719            }
123720            function wPt(t, e, i, s) {
123721              return (s << 24 >>> 0) + (i << 16) + (e << 8) + t;
123722            }
123723            let RPt = null;
123724            let IPt = null;
123725            const MPt = {
123726              vCount: 32767,
123727              ensureAccessor(t) {
123728                let e = t ? IPt : RPt;
123729                if (!e) {
123730                  const i = IR.root.device;
123731                  const s = IR.root.batcher2D;
123732                  const n = t ? XM : HM;
123733                  if (t) {
123734                    e = IPt = new iB(i, n, this.vCount);
123735                    s.registerBufferAccessor(Number.parseInt("SPINETINT", 36), IPt);
123736                  } else {
123737                    e = RPt = new iB(i, n, this.vCount);
123738                    s.registerBufferAccessor(Number.parseInt("SPINE", 36), RPt);
123739                  }
123740                }
123741                return e;
123742              },
123743              createData(t) {
123744                let e = t.renderData;
123745                if (!e) {
123746                  const i = t.useTint || t.isAnimationCached();
123747                  const s = this.ensureAccessor(i);
123748                  const n = t._skeleton.data.skins;
123749                  let r = 0;
123750                  let o = 0;
123751                  for (let t = 0; t < n.length; ++t) {
123752                    const e = n[t].attachments;
123753                    for (let t = 0; t < e.length; t++) {
123754                      const i = e[t];
123755                      for (const t in i) {
123756                        const e = i[t];
123757                        if (e instanceof vMt.RegionAttachment) {
123758                          r += 4;
123759                          o += 6;
123760                        } else if (e instanceof vMt.MeshAttachment) {
123761                          r += e.worldVerticesLength >> 1;
123762                          o += e.triangles.length;
123763                        }
123764                      }
123765                    }
123766                  }
123767                  e = SB.add(i ? XM : HM, s);
123768                  e.resize(r, o);
123769                  e.indices && o === e.indices.length || (e.indices = new Uint16Array(o));
123770                  t.maxVertexCount = r;
123771                  t.maxIndexCount = o;
123772                }
123773                return e;
123774              },
123775              updateRenderData(t, e) {
123776                mPt = t;
123777                const i = t._skeleton;
123778                !t.isAnimationCached() && i && i.updateWorldTransform();
123779                i && function(t, e) {
123780                  if (!t._skeleton) return;
123781                  const i = t.color;
123782                  FDt = i.r / 255;
123783                  VDt = i.g / 255;
123784                  kDt = i.b / 255;
123785                  UDt = t.node._uiProps.opacity;
123786                  PDt = t.useTint || t.isAnimationCached();
123787                  HDt = (s = PDt, YM(s ? XM : HM) >> 2);
123788                  var s;
123789                  t.drawList.reset();
123790                  mPt = t;
123791                  fPt = t.renderData;
123792                  TPt = null;
123793                  sPt = !0;
123794                  IDt = t.premultipliedAlpha;
123795                  MDt = 1;
123796                  SPt = !1;
123797                  APt = t._effectDelegate && t._effectDelegate._vertexEffect;
123798                  (4294967295 !== i._val || IDt) && (SPt = !0);
123799                  if (t.isAnimationCached()) !function() {
123800                    const t = mPt._curFrame;
123801                    if (!t) return;
123802                    const e = t.segments;
123803                    if (0 === e.length) return;
123804                    jDt = 12;
123805                    qDt = 0;
123806                    KDt = 0;
123807                    YDt = 0;
123808                    JDt = 0;
123809                    let i = null;
123810                    const s = t.vertices;
123811                    const n = t.indices;
123812                    let r = 0;
123813                    let o = 0;
123814                    let a = 0;
123815                    let l = 0;
123816                    const h = t.colors;
123817                    let c = 0;
123818                    let u = h[c++];
123819                    let _ = u.vfOffset;
123820                    CPt(u);
123821                    let d = 0;
123822                    const p = fPt;
123823                    const m = p.chunk.vb;
123824                    const f = p.indices;
123825                    for (let t = 0, g = e.length; t < g; t++) {
123826                      const g = e[t];
123827                      i = EPt(g.blendMode);
123828                      if (i) {
123829                        TPt || (TPt = i);
123830                        if (sPt || i.hash !== TPt.hash || g.tex && g.tex !== vPt) {
123831                          sPt = !1;
123832                          const t = JDt - d;
123833                          if (t > 0) {
123834                            mPt._requestDrawData(TPt, vPt, d, t);
123835                            d = JDt;
123836                          }
123837                          TPt = i;
123838                          vPt = g.tex;
123839                        }
123840                        WDt = g.vertexCount;
123841                        KDt = g.indexCount;
123842                        r = p.chunk.vertexOffset;
123843                        for (let t = JDt, e = JDt + KDt; t < e; t++) f[t] = r + YDt + n[a++];
123844                        l = g.vfCount;
123845                        m.set(s.subarray(o, o + l), o);
123846                        if (SPt) {
123847                          let t = o / 7 * 6;
123848                          for (let e = o, i = o + l; e < i; e += HDt, t += 6) {
123849                            if (t >= _) {
123850                              u = h[c++];
123851                              CPt(u);
123852                              _ = u.vfOffset;
123853                            }
123854                            bPt[e + 5] = GDt;
123855                            bPt[e + 6] = zDt;
123856                          }
123857                        }
123858                        o += l;
123859                        YDt += WDt;
123860                        JDt += KDt;
123861                        WDt = 0;
123862                        KDt = 0;
123863                      }
123864                    }
123865                    const g = JDt - d;
123866                    vPt && g > 0 && mPt._requestDrawData(TPt, vPt, d, g);
123867                  }(); else {
123868                    APt && APt.begin(t._skeleton);
123869                    !function(t) {
123870                      const e = fPt;
123871                      yPt = e.chunk.vb;
123872                      bPt = new Uint32Array(yPt.buffer, yPt.byteOffset, yPt.length);
123873                      gPt = e.indices;
123874                      ZDt = mPt.maxVertexCount;
123875                      QDt = mPt.maxIndexCount;
123876                      const i = mPt._skeleton;
123877                      const s = i.color;
123878                      const n = mPt._debugRenderer;
123879                      const r = mPt._clipper;
123880                      let o = null;
123881                      let a;
123882                      let l;
123883                      let h;
123884                      let c;
123885                      let u;
123886                      let _;
123887                      let d;
123888                      BDt = mPt._startSlotIndex;
123889                      DDt = mPt._endSlotIndex;
123890                      iPt = !1;
123891                      -1 === BDt && (iPt = !0);
123892                      ODt = mPt.debugSlots;
123893                      NDt = mPt.debugBones;
123894                      LDt = mPt.debugMesh;
123895                      if (n && (NDt || ODt || LDt)) {
123896                        n.clear();
123897                        n.lineWidth = 5;
123898                      }
123899                      jDt = 12;
123900                      XDt = 0;
123901                      YDt = 0;
123902                      qDt = 0;
123903                      KDt = 0;
123904                      JDt = 0;
123905                      let p = 0;
123906                      for (let t = 0, m = i.drawOrder.length; t < m; t++) {
123907                        d = i.drawOrder[t];
123908                        if (void 0 === d || !d.bone.active) continue;
123909                        BDt >= 0 && BDt === d.data.index && (iPt = !0);
123910                        if (!iPt) {
123911                          r.clipEndWithSlot(d);
123912                          continue;
123913                        }
123914                        DDt >= 0 && DDt === d.data.index && (iPt = !1);
123915                        XDt = 0;
123916                        KDt = 0;
123917                        a = d.getAttachment();
123918                        if (!a) {
123919                          r.clipEndWithSlot(d);
123920                          continue;
123921                        }
123922                        c = a instanceof vMt.RegionAttachment;
123923                        u = a instanceof vMt.MeshAttachment;
123924                        _ = a instanceof vMt.ClippingAttachment;
123925                        if (_) {
123926                          r.clipStart(d, a);
123927                          continue;
123928                        }
123929                        if (!c && !u) {
123930                          r.clipEndWithSlot(d);
123931                          continue;
123932                        }
123933                        const m = a.region.texture.getRealTexture();
123934                        o = EPt(d.data.blendMode);
123935                        if (!o) {
123936                          r.clipEndWithSlot(d);
123937                          continue;
123938                        }
123939                        TPt || (TPt = o);
123940                        if (sPt || o.hash !== TPt.hash || m && vPt !== m) {
123941                          sPt = !1;
123942                          const t = JDt - p;
123943                          if (t > 0) {
123944                            mPt._requestDrawData(TPt, vPt, p, t);
123945                            p = JDt;
123946                          }
123947                          vPt = m;
123948                          TPt = o;
123949                        }
123950                        if (c) {
123951                          h = SDt;
123952                          WDt = 4;
123953                          XDt = WDt * HDt;
123954                          KDt = 6;
123955                          a.computeWorldVertices(d.bone, yPt, qDt, HDt);
123956                          if (n && ODt) {
123957                            n.strokeColor = ADt;
123958                            n.moveTo(yPt[qDt], yPt[qDt + 1]);
123959                            for (let t = qDt + HDt, e = qDt + XDt; t < e; t += HDt) n.lineTo(yPt[t], yPt[t + 1]);
123960                            n.close();
123961                            n.stroke();
123962                          }
123963                        } else if (u) {
123964                          const t = a;
123965                          h = t.triangles;
123966                          WDt = t.worldVerticesLength >> 1;
123967                          XDt = WDt * HDt;
123968                          KDt = h.length;
123969                          t.computeWorldVertices(d, 0, t.worldVerticesLength, yPt, qDt, HDt);
123970                          if (n && LDt) {
123971                            n.strokeColor = EDt;
123972                            for (let t = 0, e = h.length; t < e; t += 3) {
123973                              const e = h[t] * HDt + qDt;
123974                              const i = h[t + 1] * HDt + qDt;
123975                              const s = h[t + 2] * HDt + qDt;
123976                              n.moveTo(yPt[e], yPt[e + 1]);
123977                              n.lineTo(yPt[i], yPt[i + 1]);
123978                              n.lineTo(yPt[s], yPt[s + 1]);
123979                              n.close();
123980                              n.stroke();
123981                            }
123982                          }
123983                        }
123984                        if (0 === XDt || 0 === KDt) {
123985                          r.clipEndWithSlot(d);
123986                          continue;
123987                        }
123988                        const f = a;
123989                        gPt = e.indices;
123990                        gPt.set(h, JDt);
123991                        l = f.uvs;
123992                        for (let t = qDt, e = qDt + XDt, i = 0; t < e; t += HDt, i += 2) {
123993                          yPt[t + 3] = l[i];
123994                          yPt[t + 4] = l[i + 1];
123995                        }
123996                        DPt(s, f.color, d.color, r, d);
123997                        if (KDt > 0) {
123998                          const t = e.chunk.vertexOffset;
123999                          for (let e = JDt, i = JDt + KDt; e < i; e++) gPt[e] += YDt + t;
124000                        }
124001                        qDt += XDt;
124002                        YDt += WDt;
124003                        JDt += KDt;
124004                        WDt = 0;
124005                        KDt = 0;
124006                        r.clipEndWithSlot(d);
124007                      }
124008                      const m = JDt - p;
124009                      vPt && m > 0 && mPt._requestDrawData(TPt, vPt, p, m);
124010                      r.clipEnd();
124011                      if (n && NDt) {
124012                        let t;
124013                        n.strokeColor = TDt;
124014                        n.fillColor = ADt;
124015                        for (let e = 0, s = i.bones.length; e < s; e++) {
124016                          t = i.bones[e];
124017                          const s = t.data.length * t.a + t.worldX;
124018                          const r = t.data.length * t.c + t.worldY;
124019                          n.moveTo(t.worldX, t.worldY);
124020                          n.lineTo(s, r);
124021                          n.stroke();
124022                          n.circle(t.worldX, t.worldY, 1.5 * Math.PI);
124023                          n.fill();
124024                          0 === e && (n.fillColor = vDt);
124025                        }
124026                      }
124027                    }();
124028                    APt && APt.end();
124029                  }
124030                  (PDt ? IPt : RPt).getMeshBuffer(fPt.chunk.bufferId).setDirty();
124031                  t.attachUtil._syncAttachedNode();
124032                  mPt = void 0;
124033                  APt = null;
124034                }(t);
124035              },
124036              updateColor(t) {
124037                if (t) {
124038                  mPt = t;
124039                  mPt.markForUpdateRenderData();
124040                }
124041              },
124042              fillBuffers(t, e) {}
124043            };
124044            function BPt(t, e) {
124045              const i = WDt;
124046              const s = KDt;
124047              const n = fPt;
124048              KDt = e.length;
124049              WDt = t.length / jDt;
124050              XDt = WDt * HDt;
124051              ZDt += WDt - i;
124052              QDt += KDt - s;
124053              const r = gPt;
124054              const o = n.chunk.vertexOffset;
124055              let a = !1;
124056              if (ZDt > n.vertexCount) {
124057                n.resizeAndCopy(ZDt, QDt > n.indexCount ? QDt : n.indexCount);
124058                yPt = n.chunk.vb;
124059                bPt = new Uint32Array(yPt.buffer, yPt.byteOffset, yPt.length);
124060                a = !0;
124061              }
124062              if (QDt > gPt.length) {
124063                gPt = n.indices = new Uint16Array(QDt);
124064                a = !0;
124065              }
124066              if (a) {
124067                const t = n.chunk.vertexOffset - o;
124068                for (let e = 0; e < JDt; ++e) gPt[e] = r[e] + t;
124069              }
124070            }
124071            function DPt(t, e, i, s, n) {
124072              CDt.a = i.a * e.a * t.a * UDt * 255;
124073              MDt = IDt ? CDt.a : 255;
124074              $Dt = FDt * e.r * t.r * MDt;
124075              tPt = VDt * e.g * t.g * MDt;
124076              ePt = kDt * e.b * t.b * MDt;
124077              CDt.r = $Dt * i.r;
124078              CDt.g = tPt * i.g;
124079              CDt.b = ePt * i.b;
124080              if (null == n.darkColor) xDt.set(0, 0, 0, 1); else {
124081                xDt.r = n.darkColor.r * $Dt;
124082                xDt.g = n.darkColor.g * tPt;
124083                xDt.b = n.darkColor.b * ePt;
124084              }
124085              xDt.a = IDt ? 255 : 0;
124086              if (PDt) if (s.isClipping()) {
124087                jDt = PDt ? 12 : 8;
124088                const t = yPt.subarray(qDt);
124089                const e = yPt.subarray(qDt + 3);
124090                s.clipTriangles(t, XDt, gPt.subarray(JDt), KDt, e, CDt, xDt, PDt, HDt);
124091                const i = s.clippedVertices;
124092                const n = s.clippedTriangles;
124093                BPt(i, n);
124094                n.length > 0 && gPt.set(n, JDt);
124095                if (APt) for (let t = 0, e = i.length, s = qDt; t < e; t += jDt, s += HDt) {
124096                  wDt.x = i[t];
124097                  wDt.y = i[t + 1];
124098                  RDt.x = i[t + 6];
124099                  RDt.y = i[t + 7];
124100                  APt.transform(wDt, RDt, CDt, xDt);
124101                  yPt[s] = wDt.x;
124102                  yPt[s + 1] = wDt.y;
124103                  yPt[s + 3] = RDt.x;
124104                  yPt[s + 4] = RDt.y;
124105                  bPt[s + 5] = wPt(i[t + 2], i[t + 3], i[t + 4], i[t + 5]);
124106                  bPt[s + 6] = wPt(i[t + 8], i[t + 9], i[t + 10], i[t + 11]);
124107                } else for (let t = 0, e = i.length, s = qDt; t < e; t += jDt, s += HDt) {
124108                  yPt[s] = i[t];
124109                  yPt[s + 1] = i[t + 1];
124110                  yPt[s + 3] = i[t + 6];
124111                  yPt[s + 4] = i[t + 7];
124112                  bPt[s + 5] = wPt(i[t + 2], i[t + 3], i[t + 4], i[t + 5]);
124113                  bPt[s + 6] = wPt(i[t + 8], i[t + 9], i[t + 10], i[t + 11]);
124114                }
124115              } else {
124116                GDt = xPt(CDt);
124117                zDt = xPt(xDt);
124118                if (APt) for (let t = qDt, e = qDt + XDt; t < e; t += HDt) {
124119                  wDt.x = yPt[t];
124120                  wDt.y = yPt[t + 1];
124121                  RDt.x = yPt[t + 3];
124122                  RDt.y = yPt[t + 4];
124123                  APt.transform(wDt, RDt, CDt, xDt);
124124                  yPt[t] = wDt.x;
124125                  yPt[t + 1] = wDt.y;
124126                  yPt[t + 3] = RDt.x;
124127                  yPt[t + 4] = RDt.y;
124128                  bPt[t + 5] = GDt;
124129                  bPt[t + 6] = zDt;
124130                } else for (let t = qDt, e = qDt + XDt; t < e; t += HDt) {
124131                  bPt[t + 5] = GDt;
124132                  bPt[t + 6] = zDt;
124133                }
124134              } else if (s.isClipping()) {
124135                jDt = PDt ? 12 : 8;
124136                const t = yPt.subarray(qDt);
124137                const e = yPt.subarray(qDt + 3);
124138                s.clipTriangles(t, XDt, gPt.subarray(JDt), KDt, e, CDt, xDt, PDt, HDt);
124139                const i = s.clippedVertices;
124140                const n = s.clippedTriangles;
124141                BPt(i, n);
124142                n.length > 0 && gPt.set(n, JDt);
124143                if (APt) for (let t = 0, e = i.length, s = qDt; t < e; t += jDt, s += HDt) {
124144                  wDt.x = i[t];
124145                  wDt.y = i[t + 1];
124146                  RDt.x = i[t + 6];
124147                  RDt.y = i[t + 7];
124148                  APt.transform(wDt, RDt, CDt, xDt);
124149                  yPt[s] = wDt.x;
124150                  yPt[s + 1] = wDt.y;
124151                  yPt[s + 3] = RDt.x;
124152                  yPt[s + 4] = RDt.y;
124153                  bPt[s + 5] = wPt(i[t + 2], i[t + 3], i[t + 4], i[t + 5]);
124154                } else for (let t = 0, e = i.length, s = qDt; t < e; t += jDt, s += HDt) {
124155                  yPt[s] = i[t];
124156                  yPt[s + 1] = i[t + 1];
124157                  yPt[s + 3] = i[t + 6];
124158                  yPt[s + 4] = i[t + 7];
124159                  bPt[s + 5] = wPt(i[t + 2], i[t + 3], i[t + 4], i[t + 5]);
124160                }
124161              } else {
124162                GDt = xPt(CDt);
124163                if (APt) for (let t = qDt, e = qDt + XDt; t < e; t += HDt) {
124164                  wDt.x = yPt[t];
124165                  wDt.y = yPt[t + 1];
124166                  RDt.x = yPt[t + 3];
124167                  RDt.y = yPt[t + 4];
124168                  APt.transform(wDt, RDt, CDt, xDt);
124169                  yPt[t] = wDt.x;
124170                  yPt[t + 1] = wDt.y;
124171                  yPt[t + 3] = RDt.x;
124172                  yPt[t + 4] = RDt.y;
124173                  bPt[t + 5] = GDt;
124174                } else for (let t = qDt, e = qDt + XDt; t < e; t += HDt) bPt[t + 5] = GDt;
124175              }
124176            }
124177            m.internal.SpineAssembler = MPt;
124178            const PPt = {
124179              getAssembler: () => MPt
124180            };
124181            bDt.Assembler = PPt;
124182            const OPt = window.spine;
124183            const NPt = OPt.VertexEffectDelegate;
124184            let LPt;
124185            !function(t) {
124186              t[t.REGION = 0] = "REGION";
124187              t[t.BOUNDING_BOX = 1] = "BOUNDING_BOX";
124188              t[t.MESH = 2] = "MESH";
124189              t[t.SKINNED_MESH = 3] = "SKINNED_MESH";
124190            }(LPt || (LPt = {}));
124191            he(LPt);
124192            let FPt;
124193            !function(t) {
124194              t[t.START = 0] = "START";
124195              t[t.INTERRUPT = 1] = "INTERRUPT";
124196              t[t.END = 2] = "END";
124197              t[t.DISPOSE = 3] = "DISPOSE";
124198              t[t.COMPLETE = 4] = "COMPLETE";
124199              t[t.EVENT = 5] = "EVENT";
124200            }(FPt || (FPt = {}));
124201            he(FPt);
124202            m.internal.SpineAnimationEventType = FPt;
124203            t("sp", Object.freeze({
124204              __proto__: null,
124205              timeScale: 1,
124206              get DefaultSkinsEnum() {
124207                return dDt;
124208              },
124209              get DefaultAnimsEnum() {
124210                return pDt;
124211              },
124212              get AnimationCacheMode() {
124213                return mDt;
124214              },
124215              get SpineMaterialType() {
124216                return gDt;
124217              },
124218              SpineSocket: yDt,
124219              Skeleton: bDt,
124220              SkeletonData: dBt,
124221              simpleSpineAssembler: PPt,
124222              spine: OPt,
124223              VertexEffectDelegate: NPt,
124224              get ATTACHMENT_TYPE() {
124225                return LPt;
124226              },
124227              get AnimationEventType() {
124228                return FPt;
124229              }
124230            }));
124231            t("HeightField", class {
124232              constructor(t, e) {
124233                this.data = new Uint16Array;
124234                this.w = 0;
124235                this.h = 0;
124236                this.w = t;
124237                this.h = e;
124238                this.data = new Uint16Array(t * e);
124239                for (let i = 0; i < t * e; ++i) this.data[i] = 0;
124240              }
124241              set(t, e, i) {
124242                this.data[e * this.w + t] = i;
124243              }
124244              get(t, e) {
124245                return this.data[e * this.w + t];
124246              }
124247              getClamp(t, e) {
124248                t = _i(t, 0, this.w - 1);
124249                e = _i(e, 0, this.h - 1);
124250                return this.get(t, e);
124251              }
124252              getAt(t, e) {
124253                const i = t;
124254                const s = e;
124255                let n = Math.floor(i);
124256                let r = Math.floor(s);
124257                let o = n + 1;
124258                let a = r + 1;
124259                const l = i - n;
124260                const h = s - r;
124261                n = _i(n, 0, this.w - 1);
124262                r = _i(r, 0, this.h - 1);
124263                o = _i(o, 0, this.w - 1);
124264                a = _i(a, 0, this.h - 1);
124265                let c = this.get(n, r);
124266                const u = this.get(o, r);
124267                const _ = this.get(n, a);
124268                let d = this.get(o, a);
124269                const p = .5 * (u + _);
124270                l + h <= 1 ? d = p + (p - c) : c = p + (p - d);
124271                return (c * (1 - l) + u * l) * (1 - h) + (_ * (1 - l) + d * l) * h;
124272              }
124273            });
124274            const VPt = 33;
124275            const kPt = 32;
124276            const UPt = 1e14;
124277            class GPt {
124278              constructor() {
124279                this.level = 0;
124280                this.north = 0;
124281                this.south = 0;
124282                this.west = 0;
124283                this.east = 0;
124284              }
124285              equals(t) {
124286                return this.level === t.level && this.north === t.north && this.south === t.south && this.west === t.west && this.east === t.east;
124287              }
124288            }
124289            class zPt {
124290              constructor() {
124291                this.size = 0;
124292                this.indices = null;
124293              }
124294            }
124295            class HPt {
124296              constructor() {
124297                this.key = new GPt;
124298                this.start = 0;
124299                this.size = 0;
124300                this.buffer = null;
124301                this.primCount = 0;
124302              }
124303            }
124304            class jPt {
124305              static mapIndex(t, e, i) {
124306                return 16 * t + 4 * e + i;
124307              }
124308              constructor() {
124309                this._bodyIndexPool = void 0;
124310                this._connecterIndexPool = void 0;
124311                this._indexMap = [];
124312                this._indexBuffer = new Uint16Array;
124313                this._bodyIndexPool = new Array(4);
124314                for (let t = 0; t < 4; ++t) this._bodyIndexPool[t] = new zPt;
124315                this._connecterIndexPool = new Array(64);
124316                for (let t = 0; t < 4; ++t) for (let e = 0; e < 4; ++e) for (let i = 0; i < 4; ++i) this._connecterIndexPool[jPt.mapIndex(t, e, i)] = new zPt;
124317                for (let t = 0; t < 4; ++t) this._genBodyIndex(t);
124318                for (let t = 0; t < 4; ++t) for (let e = 0; e < 4; ++e) {
124319                  this._genConnecterIndexNorth(t, e);
124320                  this._genConnecterIndexSouth(t, e);
124321                  this._genConnecterIndexWest(t, e);
124322                  this._genConnecterIndexEast(t, e);
124323                }
124324                for (let t = 0; t < 4; ++t) for (let e = 0; e < 4; ++e) if (!(e < t)) for (let i = 0; i < 4; ++i) if (!(i < t)) for (let s = 0; s < 4; ++s) if (!(s < t)) for (let n = 0; n < 4; ++n) {
124325                  if (n < t) continue;
124326                  const r = new GPt;
124327                  r.level = t;
124328                  r.north = e;
124329                  r.south = i;
124330                  r.west = s;
124331                  r.east = n;
124332                  this._genIndexData(r);
124333                }
124334              }
124335              getIndexData(t) {
124336                for (let e = 0; e < this._indexMap.length; ++e) if (this._indexMap[e].key.equals(t)) return this._indexMap[e];
124337                return null;
124338              }
124339              _genBodyIndex(t) {
124340                const e = 1 << t;
124341                let i = kPt >> t;
124342                let s = 0;
124343                if (t < 3) {
124344                  i -= 2;
124345                  s = e * VPt + e;
124346                }
124347                if (0 === i || 0 === i) return;
124348                const n = i * i * 6;
124349                this._bodyIndexPool[t].indices = new Uint16Array(n);
124350                let r = 0;
124351                const o = new Uint16Array(n);
124352                let a = s;
124353                let l = a + VPt * e;
124354                for (let t = 0; t < i; ++t) {
124355                  for (let t = 0; t < i; ++t) {
124356                    o[r++] = l + t * e;
124357                    o[r++] = l + (t + 1) * e;
124358                    o[r++] = a + t * e;
124359                    o[r++] = l + (t + 1) * e;
124360                    o[r++] = a + (t + 1) * e;
124361                    o[r++] = a + t * e;
124362                  }
124363                  a += VPt * e;
124364                  l += VPt * e;
124365                }
124366                this._bodyIndexPool[t].size = r;
124367                this._bodyIndexPool[t].indices = o;
124368              }
124369              _genConnecterIndexNorth(t, e) {
124370                const i = jPt.mapIndex(t, e, 0);
124371                if (e < t || 3 === t) {
124372                  this._connecterIndexPool[i].size = 0;
124373                  this._connecterIndexPool[i].indices = null;
124374                  return;
124375                }
124376                const s = 1 << t;
124377                const n = 1 << e;
124378                const r = kPt >> t;
124379                let o = 0;
124380                const a = new Uint16Array(2 * r + 2);
124381                a[o++] = 0;
124382                a[o++] = 0;
124383                for (let t = 1; t < r; ++t) {
124384                  const e = t * s;
124385                  const i = s * VPt + e;
124386                  const r = (s - s) * VPt + e / n * n;
124387                  a[o++] = i;
124388                  a[o++] = r;
124389                }
124390                a[o++] = 32;
124391                a[o++] = 32;
124392                this._connecterIndexPool[i].size = o;
124393                this._connecterIndexPool[i].indices = a;
124394              }
124395              _genConnecterIndexSouth(t, e) {
124396                const i = jPt.mapIndex(t, e, 1);
124397                if (e < t || 3 === t) {
124398                  this._connecterIndexPool[i].size = 0;
124399                  this._connecterIndexPool[i].indices = null;
124400                  return;
124401                }
124402                const s = 1 << t;
124403                const n = 1 << e;
124404                const r = kPt >> t;
124405                let o = 0;
124406                const a = new Uint16Array(2 * r + 2);
124407                a[o++] = 1056;
124408                a[o++] = 1056;
124409                for (let t = 1; t < r; ++t) {
124410                  const e = t * s;
124411                  const i = 32 - s;
124412                  const r = (i + s) * VPt + e / n * n;
124413                  const l = i * VPt + e;
124414                  a[o++] = r;
124415                  a[o++] = l;
124416                }
124417                a[o++] = 1088;
124418                a[o++] = 1088;
124419                this._connecterIndexPool[i].size = o;
124420                this._connecterIndexPool[i].indices = a;
124421              }
124422              _genConnecterIndexWest(t, e) {
124423                const i = jPt.mapIndex(t, e, 2);
124424                if (e < t || 3 === t) {
124425                  this._connecterIndexPool[i].size = 0;
124426                  this._connecterIndexPool[i].indices = null;
124427                  return;
124428                }
124429                const s = 1 << t;
124430                const n = 1 << e;
124431                const r = kPt >> t;
124432                let o = 0;
124433                const a = new Uint16Array(2 * r + 2);
124434                a[o++] = 0;
124435                a[o++] = 0;
124436                for (let t = 1; t < r; ++t) {
124437                  const e = t * s / n * n * VPt + 0;
124438                  const i = t * s * VPt + s;
124439                  a[o++] = e;
124440                  a[o++] = i;
124441                }
124442                a[o++] = 1056;
124443                a[o++] = 1056;
124444                this._connecterIndexPool[i].size = o;
124445                this._connecterIndexPool[i].indices = a;
124446              }
124447              _genConnecterIndexEast(t, e) {
124448                const i = jPt.mapIndex(t, e, 3);
124449                if (e < t || 3 === t) {
124450                  this._connecterIndexPool[i].size = 0;
124451                  this._connecterIndexPool[i].indices = null;
124452                  return;
124453                }
124454                const s = 1 << t;
124455                const n = 1 << e;
124456                const r = kPt >> t;
124457                let o = 0;
124458                const a = new Uint16Array(2 * r + 2);
124459                a[o++] = 32;
124460                a[o++] = 32;
124461                for (let t = 1; t < r; ++t) {
124462                  const e = t * s * VPt + (32 - s);
124463                  const i = t * s / n * n * VPt + 32;
124464                  a[o++] = e;
124465                  a[o++] = i;
124466                }
124467                a[o++] = 1088;
124468                a[o++] = 1088;
124469                this._connecterIndexPool[i].size = o;
124470                this._connecterIndexPool[i].indices = a;
124471              }
124472              _getConnenterIndex(t, e, i) {
124473                return this._connecterIndexPool[jPt.mapIndex(t, e, i)];
124474              }
124475              _genIndexData(t) {
124476                let e = this.getIndexData(t);
124477                if (null != e) return e;
124478                const i = this._bodyIndexPool[t.level];
124479                const s = this._getConnenterIndex(t.level, t.north, 0);
124480                const n = this._getConnenterIndex(t.level, t.south, 1);
124481                const r = this._getConnenterIndex(t.level, t.west, 2);
124482                const o = this._getConnenterIndex(t.level, t.east, 3);
124483                e = new HPt;
124484                e.size = 0;
124485                e.primCount = 0;
124486                null != i.indices && (e.size += i.size);
124487                s.indices && (e.size += 3 * (s.size - 2));
124488                n.indices && (e.size += 3 * (n.size - 2));
124489                r.indices && (e.size += 3 * (r.size - 2));
124490                o.indices && (e.size += 3 * (o.size - 2));
124491                if (0 === e.size) return null;
124492                let a = 0;
124493                e.buffer = new Uint16Array(e.size);
124494                e.key.level = t.level;
124495                e.key.east = t.east;
124496                e.key.west = t.west;
124497                e.key.north = t.north;
124498                e.key.south = t.south;
124499                if (i.indices) for (let t = 0; t < i.size; ++t) e.buffer[a++] = i.indices[t];
124500                if (s.indices) for (let t = 0; t < s.size - 2; t += 2) {
124501                  const i = s.indices[t + 0];
124502                  const n = s.indices[t + 1];
124503                  const r = s.indices[t + 2];
124504                  const o = s.indices[t + 3];
124505                  e.buffer[a++] = i;
124506                  e.buffer[a++] = r;
124507                  e.buffer[a++] = n;
124508                  e.buffer[a++] = r;
124509                  e.buffer[a++] = o;
124510                  e.buffer[a++] = n;
124511                }
124512                if (n.indices) for (let t = 0; t < n.size - 2; t += 2) {
124513                  const i = n.indices[t + 0];
124514                  const s = n.indices[t + 1];
124515                  const r = n.indices[t + 2];
124516                  const o = n.indices[t + 3];
124517                  e.buffer[a++] = i;
124518                  e.buffer[a++] = r;
124519                  e.buffer[a++] = s;
124520                  e.buffer[a++] = r;
124521                  e.buffer[a++] = o;
124522                  e.buffer[a++] = s;
124523                }
124524                if (r.indices) for (let t = 0; t < r.size - 2; t += 2) {
124525                  const i = r.indices[t + 0];
124526                  const s = r.indices[t + 1];
124527                  const n = r.indices[t + 2];
124528                  const o = r.indices[t + 3];
124529                  e.buffer[a++] = i;
124530                  e.buffer[a++] = n;
124531                  e.buffer[a++] = s;
124532                  e.buffer[a++] = n;
124533                  e.buffer[a++] = o;
124534                  e.buffer[a++] = s;
124535                }
124536                if (o.indices) for (let t = 0; t < o.size - 2; t += 2) {
124537                  const i = o.indices[t + 0];
124538                  const s = o.indices[t + 1];
124539                  const n = o.indices[t + 2];
124540                  const r = o.indices[t + 3];
124541                  e.buffer[a++] = i;
124542                  e.buffer[a++] = n;
124543                  e.buffer[a++] = s;
124544                  e.buffer[a++] = n;
124545                  e.buffer[a++] = r;
124546                  e.buffer[a++] = s;
124547                }
124548                e.primCount = a / 3;
124549                e.start = this._indexBuffer.length;
124550                this._indexMap.push(e);
124551                const l = new Uint16Array(e.start + e.size);
124552                l.set(this._indexBuffer, 0);
124553                l.set(e.buffer, e.start);
124554                this._indexBuffer = l;
124555                return e;
124556              }
124557            }
124558            var XPt, WPt, YPt, qPt, KPt, JPt, ZPt, QPt, $Pt, tOt, eOt, iOt, sOt, nOt, rOt, oOt, aOt, lOt, hOt, cOt, uOt, _Ot, dOt, pOt, mOt, fOt, gOt, yOt, bOt, SOt, AOt, TOt, vOt, EOt, COt, xOt, wOt, ROt, IOt, MOt, BOt, DOt, POt, OOt, NOt, LOt, FOt, VOt;
124559            let kOt = t("TerrainInfo", Ul("cc.TerrainInfo")(XPt = (WPt = (ZPt = class {
124560              constructor() {
124561                Ml(this, "tileSize", YPt, this);
124562                Ml(this, "blockCount", qPt, this);
124563                Ml(this, "weightMapSize", KPt, this);
124564                Ml(this, "lightMapSize", JPt, this);
124565              }
124566              get size() {
124567                const t = new rs(0, 0);
124568                t.width = this.blockCount[0] * bwt * this.tileSize;
124569                t.height = this.blockCount[1] * bwt * this.tileSize;
124570                return t;
124571              }
124572              get tileCount() {
124573                const t = [ 0, 0 ];
124574                t[0] = this.blockCount[0] * bwt;
124575                t[1] = this.blockCount[1] * bwt;
124576                return t;
124577              }
124578              get vertexCount() {
124579                const t = this.tileCount;
124580                t[0] += 1;
124581                t[1] += 1;
124582                return t;
124583              }
124584            }, ZPt), YPt = Bl(WPt.prototype, "tileSize", [ Yl, nh ], {
124585              configurable: !0,
124586              enumerable: !0,
124587              writable: !0,
124588              initializer: function() {
124589                return 1;
124590              }
124591            }), qPt = Bl(WPt.prototype, "blockCount", [ Yl, nh ], {
124592              configurable: !0,
124593              enumerable: !0,
124594              writable: !0,
124595              initializer: function() {
124596                return [ 1, 1 ];
124597              }
124598            }), KPt = Bl(WPt.prototype, "weightMapSize", [ Yl, nh ], {
124599              configurable: !0,
124600              enumerable: !0,
124601              writable: !0,
124602              initializer: function() {
124603                return 128;
124604              }
124605            }), JPt = Bl(WPt.prototype, "lightMapSize", [ Yl, nh ], {
124606              configurable: !0,
124607              enumerable: !0,
124608              writable: !0,
124609              initializer: function() {
124610                return 128;
124611              }
124612            }), WPt)) || XPt);
124613            let UOt = t("TerrainLayer", Ul("cc.TerrainLayer")(QPt = ($Pt = class {
124614              constructor() {
124615                Ml(this, "detailMap", tOt, this);
124616                Ml(this, "normalMap", eOt, this);
124617                Ml(this, "tileSize", iOt, this);
124618                Ml(this, "metallic", sOt, this);
124619                Ml(this, "roughness", nOt, this);
124620              }
124621            }, tOt = Bl($Pt.prototype, "detailMap", [ Yl, nh ], {
124622              configurable: !0,
124623              enumerable: !0,
124624              writable: !0,
124625              initializer: function() {
124626                return null;
124627              }
124628            }), eOt = Bl($Pt.prototype, "normalMap", [ Yl, nh ], {
124629              configurable: !0,
124630              enumerable: !0,
124631              writable: !0,
124632              initializer: function() {
124633                return null;
124634              }
124635            }), iOt = Bl($Pt.prototype, "tileSize", [ Yl, nh ], {
124636              configurable: !0,
124637              enumerable: !0,
124638              writable: !0,
124639              initializer: function() {
124640                return 1;
124641              }
124642            }), sOt = Bl($Pt.prototype, "metallic", [ Yl, nh ], {
124643              configurable: !0,
124644              enumerable: !0,
124645              writable: !0,
124646              initializer: function() {
124647                return 0;
124648              }
124649            }), nOt = Bl($Pt.prototype, "roughness", [ Yl, nh ], {
124650              configurable: !0,
124651              enumerable: !0,
124652              writable: !0,
124653              initializer: function() {
124654                return 1;
124655              }
124656            }), $Pt)) || QPt);
124657            class GOt extends wS {
124658              constructor(...t) {
124659                super(...t);
124660                this._model = null;
124661                this._meshData = null;
124662                this._brushPass = null;
124663                this._brushMaterial = null;
124664                this._currentMaterial = null;
124665                this._currentMaterialLayers = 0;
124666              }
124667              destroy() {
124668                if (null != this._model) {
124669                  m.director.root.destroyModel(this._model);
124670                  this._model = null;
124671                }
124672                return super.destroy();
124673              }
124674              _destroyModel() {
124675                if (null != this._model) {
124676                  m.director.root.destroyModel(this._model);
124677                  this._model = null;
124678                }
124679              }
124680              _invalidMaterial() {
124681                if (null != this._currentMaterial) {
124682                  this._clearMaterials();
124683                  this._brushPass = null;
124684                  this._currentMaterial = null;
124685                  null != this._model && (this._model.enabled = !1);
124686                }
124687              }
124688              _updateMaterial(t, e) {
124689                if (null == this._meshData || null == this._model) return !1;
124690                const i = t.getMaxLayer();
124691                if (null == this._currentMaterial || i !== this._currentMaterialLayers) {
124692                  this._currentMaterial = new hm;
124693                  this._currentMaterial.initialize({
124694                    effectAsset: t.getTerrain().getEffectAsset(),
124695                    defines: t._getMaterialDefines(i)
124696                  });
124697                  if (null !== this._brushMaterial) {
124698                    const t = new hm;
124699                    t.copy(this._brushMaterial);
124700                    this._brushPass = null;
124701                    if (null !== t.passes && t.passes.length > 0) {
124702                      this._brushPass = t.passes[0];
124703                      this._currentMaterial.passes.push(this._brushPass);
124704                      t.passes.pop();
124705                    }
124706                  }
124707                  e && this._model.initSubModel(0, this._meshData, this._currentMaterial);
124708                  this.setMaterial(this._currentMaterial, 0);
124709                  this._currentMaterialLayers = i;
124710                  this._model.enabled = !0;
124711                  this._model.receiveShadow = t.getTerrain().receiveShadow;
124712                  return !0;
124713                }
124714                return !1;
124715              }
124716              _onMaterialModified(t, e) {
124717                null != this._model && this._onRebuildPSO(t, e || this._getBuiltinMaterial());
124718              }
124719              _onRebuildPSO(t, e) {
124720                this._model && this._model.setSubModelMaterial(t, e);
124721              }
124722              _clearMaterials() {
124723                null != this._model && this._onMaterialModified(0, null);
124724              }
124725              _getBuiltinMaterial() {
124726                return xR.get("missing-material");
124727              }
124728            }
124729            let zOt = t("TerrainBlockLightmapInfo", Ul("cc.TerrainBlockLightmapInfo")(rOt = (oOt = class {
124730              constructor() {
124731                Ml(this, "texture", aOt, this);
124732                Ml(this, "UOff", lOt, this);
124733                Ml(this, "VOff", hOt, this);
124734                Ml(this, "UScale", cOt, this);
124735                Ml(this, "VScale", uOt, this);
124736              }
124737            }, aOt = Bl(oOt.prototype, "texture", [ Yl, nh ], {
124738              configurable: !0,
124739              enumerable: !0,
124740              writable: !0,
124741              initializer: function() {
124742                return null;
124743              }
124744            }), lOt = Bl(oOt.prototype, "UOff", [ Yl, nh ], {
124745              configurable: !0,
124746              enumerable: !0,
124747              writable: !0,
124748              initializer: function() {
124749                return 0;
124750              }
124751            }), hOt = Bl(oOt.prototype, "VOff", [ Yl, nh ], {
124752              configurable: !0,
124753              enumerable: !0,
124754              writable: !0,
124755              initializer: function() {
124756                return 0;
124757              }
124758            }), cOt = Bl(oOt.prototype, "UScale", [ Yl, nh ], {
124759              configurable: !0,
124760              enumerable: !0,
124761              writable: !0,
124762              initializer: function() {
124763                return 0;
124764              }
124765            }), uOt = Bl(oOt.prototype, "VScale", [ Yl, nh ], {
124766              configurable: !0,
124767              enumerable: !0,
124768              writable: !0,
124769              initializer: function() {
124770                return 0;
124771              }
124772            }), oOt)) || rOt);
124773            class HOt {
124774              constructor(t, e, i) {
124775                this._terrain = void 0;
124776                this._node = void 0;
124777                this._renderable = void 0;
124778                this._index = [ 1, 1 ];
124779                this._weightMap = null;
124780                this._lightmapInfo = null;
124781                this._lodLevel = 0;
124782                this._lodKey = new GPt;
124783                this._errorMetrics = [ 0, 0, 0, 0 ];
124784                this._LevelDistances = [ UPt, UPt, UPt, UPt ];
124785                this._bbMin = new Pi;
124786                this._bbMax = new Pi;
124787                this._terrain = t;
124788                this._index[0] = e;
124789                this._index[1] = i;
124790                this._lightmapInfo = t._getLightmapInfo(e, i);
124791                this._node = new _y("TerrainBlock");
124792                this._node.setParent(this._terrain.node);
124793                this._node.hideFlags |= co.Flags.DontSave | co.Flags.HideInHierarchy;
124794                this._node.layer = this._terrain.node.layer;
124795                this._renderable = this._node.addComponent(GOt);
124796              }
124797              build() {
124798                const t = IR.root.device;
124799                const e = new Float32Array(Awt * Swt * Swt);
124800                this._buildVertexData(e);
124801                const i = t.createBuffer(new An(Ts.VERTEX | Ts.TRANSFER_DST, Cs.DEVICE, Awt * Float32Array.BYTES_PER_ELEMENT * Swt * Swt, Awt * Float32Array.BYTES_PER_ELEMENT));
124802                i.update(e);
124803                this._buildBoundingBox();
124804                const s = [ new Vn(cr.ATTR_POSITION, bs.RGB32F), new Vn(cr.ATTR_NORMAL, bs.RGB32F), new Vn(cr.ATTR_TEX_COORD, bs.RG32F) ];
124805                this._renderable._meshData = new fC([ i ], s, Xs.TRIANGLE_LIST, this._terrain._getSharedIndexBuffer(), null, !1);
124806                this._renderable._model = m.director.root.createModel(wA);
124807                this._renderable._model.createBoundingShape(this._bbMin, this._bbMax);
124808                this._renderable._model.node = this._renderable._model.transform = this._node;
124809                null != this._renderable.node.scene && (this.visible = !0);
124810                this._updateWeightMap();
124811                this._updateMaterial(!0);
124812                if (this._terrain.lodEnable) {
124813                  this._updateLodBuffer(e);
124814                  this._updateIndexBuffer();
124815                }
124816              }
124817              rebuild() {
124818                this._updateHeight();
124819                this._updateWeightMap();
124820                this._renderable._invalidMaterial();
124821                this._updateMaterial(!1);
124822              }
124823              destroy() {
124824                this.visible = !1;
124825                this._renderable._destroyModel();
124826                null != this._node && this._node.isValid && this._node.destroy();
124827                null != this._weightMap && this._weightMap.destroy();
124828              }
124829              update() {
124830                this._updateMaterial(!1);
124831                const t = this._terrain.useNormalMap;
124832                const e = this._terrain.usePBR;
124833                const i = t => null !== t ? t.detailMap : null;
124834                const s = t => {
124835                  let e = null !== t ? t.normalMap : null;
124836                  null === e && (e = m.builtinResMgr.get("normal-texture"));
124837                  return e;
124838                };
124839                const n = this._renderable._currentMaterial;
124840                if (null !== n) {
124841                  const r = this.getMaxLayer();
124842                  const o = new is(1, 1, 1, 1);
124843                  const a = new is(1, 1, 1, 1);
124844                  const l = new is(0, 0, 0, 0);
124845                  if (0 === r) if (-1 !== this.layers[0]) {
124846                    const e = this._terrain.getLayer(this.layers[0]);
124847                    if (null !== e) {
124848                      o.x = 1 / e.tileSize;
124849                      a.x = e.roughness;
124850                      l.x = e.metallic;
124851                    }
124852                    n.setProperty("detailMap0", i(e));
124853                    t && n.setProperty("normalMap0", s(e));
124854                  } else {
124855                    n.setProperty("detailMap0", m.builtinResMgr.get("default-texture"));
124856                    t && n.setProperty("normalMap0", m.builtinResMgr.get("normal-texture"));
124857                  } else if (1 === r) {
124858                    const e = this._terrain.getLayer(this.layers[0]);
124859                    const r = this._terrain.getLayer(this.layers[1]);
124860                    if (null !== e) {
124861                      o.x = 1 / e.tileSize;
124862                      a.x = e.roughness;
124863                      l.x = e.metallic;
124864                    }
124865                    if (null !== r) {
124866                      o.y = 1 / r.tileSize;
124867                      a.y = r.roughness;
124868                      l.y = r.metallic;
124869                    }
124870                    n.setProperty("weightMap", this._weightMap);
124871                    n.setProperty("detailMap0", i(e));
124872                    n.setProperty("detailMap1", i(r));
124873                    if (t) {
124874                      n.setProperty("normalMap0", s(e));
124875                      n.setProperty("normalMap1", s(r));
124876                    }
124877                  } else if (2 === r) {
124878                    const e = this._terrain.getLayer(this.layers[0]);
124879                    const r = this._terrain.getLayer(this.layers[1]);
124880                    const h = this._terrain.getLayer(this.layers[2]);
124881                    if (null !== e) {
124882                      o.x = 1 / e.tileSize;
124883                      a.x = e.roughness;
124884                      l.x = e.metallic;
124885                    }
124886                    if (null !== r) {
124887                      o.y = 1 / r.tileSize;
124888                      a.y = r.roughness;
124889                      l.y = r.metallic;
124890                    }
124891                    if (null !== h) {
124892                      o.z = 1 / h.tileSize;
124893                      a.z = h.roughness;
124894                      l.z = h.metallic;
124895                    }
124896                    n.setProperty("weightMap", this._weightMap);
124897                    n.setProperty("detailMap0", i(e));
124898                    n.setProperty("detailMap1", i(r));
124899                    n.setProperty("detailMap2", i(h));
124900                    if (t) {
124901                      n.setProperty("normalMap0", s(e));
124902                      n.setProperty("normalMap1", s(r));
124903                      n.setProperty("normalMap2", s(h));
124904                    }
124905                  } else if (3 === r) {
124906                    const e = this._terrain.getLayer(this.layers[0]);
124907                    const r = this._terrain.getLayer(this.layers[1]);
124908                    const h = this._terrain.getLayer(this.layers[2]);
124909                    const c = this._terrain.getLayer(this.layers[3]);
124910                    if (null !== e) {
124911                      o.x = 1 / e.tileSize;
124912                      a.x = e.roughness;
124913                      l.x = e.metallic;
124914                    }
124915                    if (null !== r) {
124916                      o.y = 1 / r.tileSize;
124917                      a.y = r.roughness;
124918                      l.y = r.metallic;
124919                    }
124920                    if (null !== h) {
124921                      o.z = 1 / h.tileSize;
124922                      a.z = h.roughness;
124923                      l.z = h.metallic;
124924                    }
124925                    if (null !== c) {
124926                      o.w = 1 / c.tileSize;
124927                      a.w = c.roughness;
124928                      l.w = c.metallic;
124929                    }
124930                    n.setProperty("weightMap", this._weightMap);
124931                    n.setProperty("detailMap0", i(e));
124932                    n.setProperty("detailMap1", i(r));
124933                    n.setProperty("detailMap2", i(h));
124934                    n.setProperty("detailMap3", i(c));
124935                    if (t) {
124936                      n.setProperty("normalMap0", s(e));
124937                      n.setProperty("normalMap1", s(r));
124938                      n.setProperty("normalMap2", s(h));
124939                      n.setProperty("normalMap3", s(c));
124940                    }
124941                  }
124942                  n.setProperty("UVScale", o);
124943                  if (e) {
124944                    n.setProperty("roughness", a);
124945                    n.setProperty("metallic", l);
124946                  }
124947                  if (null !== this.lightmap) {
124948                    n.setProperty("lightMap", this.lightmap);
124949                    n.setProperty("lightMapUVParam", this.lightmapUVParam);
124950                  }
124951                }
124952              }
124953              _updateLevel(t) {
124954                const e = new Pi;
124955                const i = new Pi;
124956                Pi.add(e, this._bbMin, this._terrain.node.getWorldPosition());
124957                Pi.add(i, this._bbMax, this._terrain.node.getWorldPosition());
124958                const s = Pi.distance(e, t);
124959                const n = Pi.distance(i, t);
124960                let r = Math.min(s, n);
124961                r -= this._terrain.LodBias;
124962                this._lodLevel = 0;
124963                for (;this._lodLevel < 3; ) {
124964                  if (r <= this._LevelDistances[this._lodLevel + 1]) break;
124965                  ++this._lodLevel;
124966                }
124967              }
124968              setBrushMaterial(t) {
124969                if (this._renderable._brushMaterial !== t) {
124970                  this._renderable._invalidMaterial();
124971                  this._renderable._brushMaterial = t;
124972                }
124973              }
124974              _getBrushMaterial() {
124975                return this._renderable ? this._renderable._brushMaterial : null;
124976              }
124977              _getBrushPass() {
124978                return this._renderable ? this._renderable._brushPass : null;
124979              }
124980              get valid() {
124981                if (null === this._terrain) return !1;
124982                const t = this._terrain.getBlocks();
124983                for (let e = 0; e < t.length; ++e) if (t[e] === this) return !0;
124984                return !1;
124985              }
124986              get material() {
124987                return this._renderable ? this._renderable._currentMaterial : null;
124988              }
124989              get layers() {
124990                return this._terrain.getBlockLayers(this._index[0], this._index[1]);
124991              }
124992              get weightmap() {
124993                return this._weightMap;
124994              }
124995              get lightmap() {
124996                return this._lightmapInfo ? this._lightmapInfo.texture : null;
124997              }
124998              get lightmapUVParam() {
124999                return null != this._lightmapInfo ? new is(this._lightmapInfo.UOff, this._lightmapInfo.VOff, this._lightmapInfo.UScale, this._lightmapInfo.VScale) : new is(0, 0, 0, 0);
125000              }
125001              set visible(t) {
125002                null !== this._renderable._model && (t ? null != this._terrain.node && null != this._terrain.node.scene && null != this._terrain.node.scene.renderScene && null == this._renderable._model.scene && this._terrain.node.scene.renderScene.addModel(this._renderable._model) : null !== this._renderable._model.scene && this._renderable._model.scene.removeModel(this._renderable._model));
125003              }
125004              get visible() {
125005                return null !== this._renderable._model && null !== this._renderable._model.scene;
125006              }
125007              getTerrain() {
125008                return this._terrain;
125009              }
125010              getIndex() {
125011                return this._index;
125012              }
125013              getRect() {
125014                const t = new as;
125015                t.x = this._index[0] * bwt;
125016                t.y = this._index[1] * bwt;
125017                t.width = bwt;
125018                t.height = bwt;
125019                return t;
125020              }
125021              setLayer(t, e) {
125022                if (this.layers[t] !== e) {
125023                  this._terrain.setBlockLayer(this._index[0], this._index[1], t, e);
125024                  this._renderable._invalidMaterial();
125025                  this._updateMaterial(!1);
125026                }
125027              }
125028              getLayer(t) {
125029                return this.layers[t];
125030              }
125031              getMaxLayer() {
125032                return this.layers[3] >= 0 ? 3 : this.layers[2] >= 0 ? 2 : this.layers[1] >= 0 ? 1 : 0;
125033              }
125034              _getMaterialDefines(t) {
125035                return {
125036                  LAYERS: t + 1,
125037                  CC_USE_LIGHTMAP: null !== this.lightmap ? 1 : 0,
125038                  USE_NORMALMAP: this._terrain.useNormalMap ? 1 : 0,
125039                  USE_PBR: this._terrain.usePBR ? 1 : 0
125040                };
125041              }
125042              _invalidMaterial() {
125043                this._renderable._invalidMaterial();
125044              }
125045              _updateMaterial(t) {
125046                this._renderable._updateMaterial(this, t) && null !== this.lightmap && this.lightmap.setWrapMode(Zp.CLAMP_TO_BORDER, Zp.CLAMP_TO_BORDER);
125047              }
125048              _updateHeight() {
125049                if (null == this._renderable._meshData) return;
125050                const t = new Float32Array(Awt * Swt * Swt);
125051                this._buildVertexData(t);
125052                this._renderable._meshData.vertexBuffers[0].update(t);
125053                this._buildBoundingBox();
125054                this._renderable._model.createBoundingShape(this._bbMin, this._bbMax);
125055                this._renderable._model.updateWorldBound();
125056                this._updateLodBuffer(t);
125057                this._updateIndexBuffer();
125058              }
125059              _updateWeightMap() {
125060                if (0 === this.getMaxLayer()) {
125061                  if (null != this._weightMap) {
125062                    this._weightMap.destroy();
125063                    this._weightMap = null;
125064                  }
125065                  return;
125066                }
125067                if (null == this._weightMap) {
125068                  this._weightMap = new LC;
125069                  this._weightMap.create(this._terrain.weightMapSize, this._terrain.weightMapSize, Jp.RGBA8888);
125070                  this._weightMap.setFilters(Qp.LINEAR, Qp.LINEAR);
125071                  this._weightMap.setWrapMode(Zp.CLAMP_TO_EDGE, Zp.CLAMP_TO_EDGE);
125072                }
125073                const t = new Uint8Array(this._terrain.weightMapSize * this._terrain.weightMapSize * 4);
125074                let e = 0;
125075                for (let i = 0; i < this._terrain.weightMapSize; ++i) for (let s = 0; s < this._terrain.weightMapSize; ++s) {
125076                  const n = this._index[0] * this._terrain.weightMapSize + s;
125077                  const r = this._index[1] * this._terrain.weightMapSize + i;
125078                  const o = this._terrain.getWeight(n, r);
125079                  t[4 * e + 0] = Math.floor(255 * o.x);
125080                  t[4 * e + 1] = Math.floor(255 * o.y);
125081                  t[4 * e + 2] = Math.floor(255 * o.z);
125082                  t[4 * e + 3] = Math.floor(255 * o.w);
125083                  e += 1;
125084                }
125085                this._weightMap.uploadData(t);
125086              }
125087              _updateLightmap(t) {
125088                this._lightmapInfo = t;
125089                this._invalidMaterial();
125090              }
125091              _updateLod() {
125092                const t = new GPt;
125093                t.level = this._lodLevel;
125094                t.north = this._lodLevel;
125095                t.south = this._lodLevel;
125096                t.west = this._lodLevel;
125097                t.east = this._lodLevel;
125098                if (this._index[0] > 0) {
125099                  const e = this.getTerrain().getBlock(this._index[0] - 1, this._index[1]);
125100                  t.west = e._lodLevel;
125101                  t.west < this._lodLevel && (t.west = this._lodLevel);
125102                }
125103                if (this._index[0] < this._terrain.info.blockCount[0] - 1) {
125104                  const e = this.getTerrain().getBlock(this._index[0] + 1, this._index[1]);
125105                  t.east = e._lodLevel;
125106                  t.east < this._lodLevel && (t.east = this._lodLevel);
125107                }
125108                if (this._index[1] > 0) {
125109                  const e = this.getTerrain().getBlock(this._index[0], this._index[1] - 1);
125110                  t.north = e._lodLevel;
125111                  t.north < this._lodLevel && (t.north = this._lodLevel);
125112                }
125113                if (this._index[1] < this._terrain.info.blockCount[1] - 1) {
125114                  const e = this.getTerrain().getBlock(this._index[0], this._index[1] + 1);
125115                  t.south = e._lodLevel;
125116                  t.south < this._lodLevel && (t.south = this._lodLevel);
125117                }
125118                if (!this._lodKey.equals(t)) {
125119                  this._lodKey = t;
125120                  this._updateIndexBuffer();
125121                }
125122              }
125123              _resetLod() {
125124                const t = new GPt;
125125                t.level = 0;
125126                t.north = 0;
125127                t.south = 0;
125128                t.west = 0;
125129                t.east = 0;
125130                if (!this._lodKey.equals(t)) {
125131                  this._lodKey = t;
125132                  this._updateIndexBuffer();
125133                }
125134              }
125135              _updateIndexBuffer() {
125136                if (null === this._renderable._meshData) return;
125137                if (null === this._renderable._model) return;
125138                if (0 === this._renderable._model.subModels.length) return;
125139                const t = this._terrain._getIndexData(this._lodKey);
125140                if (null === t) return;
125141                const e = this._renderable._model.subModels[0];
125142                e.inputAssembler.firstIndex = t.start;
125143                e.inputAssembler.indexCount = t.size;
125144              }
125145              _getHeight(t, e, i) {
125146                return i[(Swt * e + t) * Awt + 1];
125147              }
125148              _updateLodBuffer(t) {
125149                this._lodLevel = 0;
125150                this._lodKey = new GPt;
125151                this._calcErrorMetrics(t);
125152                this._calcLevelDistances(t);
125153              }
125154              _calcErrorMetrics(t) {
125155                this._errorMetrics[0] = 0;
125156                for (let e = 1; e < 4; ++e) this._errorMetrics[e] = this._calcErrorMetric(e, t);
125157                for (let t = 2; t < 4; ++t) this._errorMetrics[t] = Math.max(this._errorMetrics[t], this._errorMetrics[t - 1]);
125158              }
125159              _calcErrorMetric(t, e) {
125160                let i = 0;
125161                const s = 1 << t;
125162                const n = Swt;
125163                const r = Swt;
125164                const o = n - 1 >> t;
125165                const a = r - 1 >> t;
125166                for (let t = 0; t < r; t += s) for (let n = 0; n < o; ++n) {
125167                  const r = n * s;
125168                  const o = r + s;
125169                  const a = (o + r) / 2;
125170                  const l = this._getHeight(r, t, e);
125171                  const h = this._getHeight(o, t, e);
125172                  const c = this._getHeight(a, t, e);
125173                  const u = (l + h) / 2;
125174                  const _ = Math.abs(c - u);
125175                  i = Math.max(i, _);
125176                }
125177                for (let t = 0; t < n; t += s) for (let n = 0; n < a; ++n) {
125178                  const r = n * s;
125179                  const o = r + s;
125180                  const a = (r + o) / 2;
125181                  const l = this._getHeight(t, r, e);
125182                  const h = this._getHeight(t, o, e);
125183                  const c = this._getHeight(t, a, e);
125184                  const u = (l + h) / 2;
125185                  const _ = Math.abs(c - u);
125186                  i = Math.max(i, _);
125187                }
125188                for (let t = 0; t < a; ++t) {
125189                  const n = t * s;
125190                  const r = n + s;
125191                  const a = (n + r) / 2;
125192                  for (let t = 0; t < o; ++t) {
125193                    const o = t * s;
125194                    const l = o + s;
125195                    const h = (o + l) / 2;
125196                    const c = this._getHeight(o, n, e);
125197                    const u = this._getHeight(l, r, e);
125198                    const _ = this._getHeight(h, a, e);
125199                    const d = (c + u) / 2;
125200                    const p = Math.abs(_ - d);
125201                    i = Math.max(i, p);
125202                  }
125203                }
125204                return i;
125205              }
125206              _calcLevelDistances(t) {
125207                for (let t = 1; t < 4; ++t) {
125208                  const e = 96 * this._errorMetrics[t];
125209                  this._LevelDistances[t] = e;
125210                }
125211              }
125212              _buildVertexData(t) {
125213                let e = 0;
125214                for (let i = 0; i < Swt; ++i) for (let s = 0; s < Swt; ++s) {
125215                  const n = this._index[0] * bwt + s;
125216                  const r = this._index[1] * bwt + i;
125217                  const o = this._terrain.getPosition(n, r);
125218                  const a = this._terrain.getNormal(n, r);
125219                  const l = new Qi(s / bwt, i / bwt);
125220                  t[e++] = o.x;
125221                  t[e++] = o.y;
125222                  t[e++] = o.z;
125223                  t[e++] = a.x;
125224                  t[e++] = a.y;
125225                  t[e++] = a.z;
125226                  t[e++] = l.x;
125227                  t[e++] = l.y;
125228                }
125229              }
125230              _buildBoundingBox() {
125231                this._bbMin.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
125232                this._bbMax.set(Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE);
125233                for (let t = 0; t < Swt; ++t) for (let e = 0; e < Swt; ++e) {
125234                  const i = this._index[0] * bwt + e;
125235                  const s = this._index[1] * bwt + t;
125236                  const n = this._terrain.getPosition(i, s);
125237                  Pi.min(this._bbMin, this._bbMin, n);
125238                  Pi.max(this._bbMax, this._bbMax, n);
125239                }
125240              }
125241            }
125242            t("TerrainBlock", HOt);
125243            t("Terrain", (_Ot = Ul("cc.Terrain"), dOt = sh(), pOt = Th(Lwt), mOt = Th(Yp), fOt = rh(),
125244            gOt = Th(zOt), yOt = Th(Le), bOt = Th(Le), SOt = Th(Le), AOt = Th(Le), TOt = Th(Ne),
125245            vOt = Th(Lwt), EOt = rh(), COt = Th(Yp), xOt = rh(), wOt = Th(kOt), _Ot(ROt = dOt(ROt = Ql(ROt = Hl(ROt = (IOt = (VOt = class extends Qc {
125246              constructor() {
125247                super();
125248                Ml(this, "__asset", MOt, this);
125249                Ml(this, "_effectAsset", BOt, this);
125250                Ml(this, "_lightmapInfos", DOt, this);
125251                Ml(this, "_receiveShadow", POt, this);
125252                Ml(this, "_useNormalmap", OOt, this);
125253                Ml(this, "_usePBR", NOt, this);
125254                Ml(this, "_lodEnable", LOt, this);
125255                Ml(this, "_lodBias", FOt, this);
125256                this._buitinAsset = null;
125257                this._tileSize = 1;
125258                this._blockCount = [ 1, 1 ];
125259                this._weightMapSize = 128;
125260                this._lightMapSize = 128;
125261                this._heights = new Uint16Array;
125262                this._weights = new Uint8Array;
125263                this._normals = new Float32Array;
125264                this._layerList = [];
125265                this._layerBuffer = [];
125266                this._blocks = [];
125267                this._lod = null;
125268                this._sharedIndexBuffer = null;
125269                this._sharedLodIndexBuffer = null;
125270                for (let t = 0; t < ywt; ++t) this._layerList.push(null);
125271              }
125272              set _asset(t) {
125273                this.__asset = t;
125274                if (this._buitinAsset !== this.__asset) {
125275                  this._buitinAsset = this.__asset;
125276                  for (let t = 0; t < this._blocks.length; ++t) this._blocks[t].destroy();
125277                  this._blocks = [];
125278                  if (null === this.__asset) {
125279                    this._effectAsset = null;
125280                    this._lightmapInfos = [];
125281                    this._receiveShadow = !1;
125282                    this._useNormalmap = !1;
125283                    this._usePBR = !1;
125284                    this._tileSize = 1;
125285                    this._blockCount = [ 1, 1 ];
125286                    this._weightMapSize = 128;
125287                    this._lightMapSize = 128;
125288                    this._heights = new Uint16Array;
125289                    this._weights = new Uint8Array;
125290                    this._normals = new Float32Array;
125291                    this._layerBuffer = [];
125292                    this._blocks = [];
125293                    this._layerList = [];
125294                    for (let t = 0; t < ywt; ++t) this._layerList.push(null);
125295                  }
125296                  zo.gfxDevice && this._buildImp();
125297                }
125298              }
125299              get _asset() {
125300                return this.__asset;
125301              }
125302              set effectAsset(t) {
125303                if (this._effectAsset !== t) {
125304                  this._effectAsset = t;
125305                  for (let t = 0; t < this._blocks.length; ++t) this._blocks[t]._invalidMaterial();
125306                }
125307              }
125308              get effectAsset() {
125309                return this._effectAsset;
125310              }
125311              get receiveShadow() {
125312                return this._receiveShadow;
125313              }
125314              set receiveShadow(t) {
125315                this._receiveShadow = t;
125316                for (let t = 0; t < this._blocks.length; t++) this._blocks[t]._invalidMaterial();
125317              }
125318              get useNormalMap() {
125319                return this._useNormalmap;
125320              }
125321              set useNormalMap(t) {
125322                this._useNormalmap = t;
125323                for (let t = 0; t < this._blocks.length; t++) this._blocks[t]._invalidMaterial();
125324              }
125325              get usePBR() {
125326                return this._usePBR;
125327              }
125328              set usePBR(t) {
125329                this._usePBR = t;
125330                for (let t = 0; t < this._blocks.length; t++) this._blocks[t]._invalidMaterial();
125331              }
125332              get lodEnable() {
125333                return this._lodEnable;
125334              }
125335              set lodEnable(t) {
125336                this._lodEnable = t;
125337                this._lodEnable && null === this._lod && (this._lod = new jPt);
125338                if (!this._lodEnable) for (let t = 0; t < this._blocks.length; t++) this._blocks[t]._resetLod();
125339              }
125340              get LodBias() {
125341                return this._lodBias;
125342              }
125343              set LodBias(t) {
125344                this._lodBias = t;
125345              }
125346              get size() {
125347                const t = new rs(0, 0);
125348                t.width = this.blockCount[0] * bwt * this.tileSize;
125349                t.height = this.blockCount[1] * bwt * this.tileSize;
125350                return t;
125351              }
125352              get tileSize() {
125353                return this._tileSize;
125354              }
125355              get tileCount() {
125356                return [ this.blockCount[0] * bwt, this.blockCount[1] * bwt ];
125357              }
125358              get vertexCount() {
125359                const t = this.tileCount;
125360                t[0] += 1;
125361                t[1] += 1;
125362                return t;
125363              }
125364              get blockCount() {
125365                return this._blockCount;
125366              }
125367              get lightMapSize() {
125368                return this._lightMapSize;
125369              }
125370              get weightMapSize() {
125371                return this._weightMapSize;
125372              }
125373              get heights() {
125374                return this._heights;
125375              }
125376              get weights() {
125377                return this._weights;
125378              }
125379              get valid() {
125380                return this._blocks.length > 0;
125381              }
125382              get info() {
125383                const t = new kOt;
125384                t.tileSize = this.tileSize;
125385                t.blockCount[0] = this.blockCount[0];
125386                t.blockCount[1] = this.blockCount[1];
125387                t.weightMapSize = this.weightMapSize;
125388                t.lightMapSize = this.lightMapSize;
125389                return t;
125390              }
125391              build(t) {
125392                this._tileSize = t.tileSize;
125393                this._blockCount[0] = t.blockCount[0];
125394                this._blockCount[1] = t.blockCount[1];
125395                this._weightMapSize = t.weightMapSize;
125396                this._lightMapSize = t.lightMapSize;
125397                return this._buildImp();
125398              }
125399              rebuild(t) {
125400                for (let t = 0; t < this._blocks.length; ++t) this._blocks[t].destroy();
125401                this._blocks = [];
125402                this._resetLightmap(!1);
125403                this._rebuildLayerBuffer(t);
125404                this._rebuildHeights(t);
125405                this._rebuildWeights(t);
125406                this._tileSize = t.tileSize;
125407                this._blockCount[0] = t.blockCount[0];
125408                this._blockCount[1] = t.blockCount[1];
125409                this._weightMapSize = t.weightMapSize;
125410                this._lightMapSize = t.lightMapSize;
125411                this._buildNormals();
125412                for (let t = 0; t < this._blockCount[1]; ++t) for (let e = 0; e < this._blockCount[0]; ++e) this._blocks.push(new HOt(this, e, t));
125413                for (let t = 0; t < this._blocks.length; ++t) this._blocks[t].build();
125414              }
125415              importHeightField(t, e) {
125416                let i = 0;
125417                for (let s = 0; s < this.vertexCount[1]; ++s) for (let n = 0; n < this.vertexCount[0]; ++n) {
125418                  const r = n / this.tileCount[0];
125419                  const o = s / this.tileCount[1];
125420                  const a = t.getAt(r * t.w, o * t.h) * e;
125421                  this._heights[i++] = a;
125422                }
125423                this._buildNormals();
125424                for (let t = 0; t < this._blocks.length; ++t) this._blocks[t]._updateHeight();
125425              }
125426              exportHeightField(t, e) {
125427                let i = 0;
125428                for (let s = 0; s < t.h; ++s) for (let n = 0; n < t.w; ++n) {
125429                  const r = n / (t.w - 1);
125430                  const o = s / (t.h - 1);
125431                  const a = r * this.size.width;
125432                  const l = o * this.size.height;
125433                  const h = this.getHeightAt(a, l);
125434                  null != h && (t.data[i++] = h * e);
125435                }
125436              }
125437              exportAsset() {
125438                const t = new Lwt;
125439                t.tileSize = this.tileSize;
125440                t.blockCount = this.blockCount;
125441                t.lightMapSize = this.lightMapSize;
125442                t.weightMapSize = this.weightMapSize;
125443                t.heights = this.heights;
125444                t.weights = this.weights;
125445                t.layerBuffer = new Array(4 * this._blocks.length);
125446                for (let e = 0; e < this._blocks.length; ++e) {
125447                  t.layerBuffer[4 * e + 0] = this._blocks[e].layers[0];
125448                  t.layerBuffer[4 * e + 1] = this._blocks[e].layers[1];
125449                  t.layerBuffer[4 * e + 2] = this._blocks[e].layers[2];
125450                  t.layerBuffer[4 * e + 3] = this._blocks[e].layers[3];
125451                }
125452                this.exportLayerListToAsset(t);
125453                return t;
125454              }
125455              exportLayerListToAsset(t) {
125456                t.layerInfos.length = 0;
125457                for (let e = 0; e < this._layerList.length; ++e) {
125458                  const i = this._layerList[e];
125459                  if (i && i.detailMap && po(i.detailMap)) {
125460                    const s = new Owt;
125461                    s.slot = e;
125462                    s.tileSize = i.tileSize;
125463                    s.detailMap = i.detailMap;
125464                    s.normalMap = i.normalMap;
125465                    s.metallic = i.metallic;
125466                    s.roughness = i.roughness;
125467                    t.layerInfos.push(s);
125468                  }
125469                }
125470              }
125471              getEffectAsset() {
125472                return null === this._effectAsset ? m.EffectAsset.get("builtin-terrain") : this._effectAsset;
125473              }
125474              onEnable() {
125475                0 === this._blocks.length && this._buildImp();
125476                for (let t = 0; t < this._blocks.length; ++t) this._blocks[t].visible = !0;
125477                m.director.root.pipelineEvent.on(Wf.RENDER_CAMERA_BEGIN, this.onUpdateFromCamera, this);
125478              }
125479              onDisable() {
125480                m.director.root.pipelineEvent.off(Wf.RENDER_CAMERA_BEGIN, this.onUpdateFromCamera, this);
125481                for (let t = 0; t < this._blocks.length; ++t) this._blocks[t].visible = !1;
125482              }
125483              onDestroy() {
125484                for (let t = 0; t < this._blocks.length; ++t) this._blocks[t].destroy();
125485                this._blocks = [];
125486                for (let t = 0; t < this._layerList.length; ++t) this._layerList[t] = null;
125487                null != this._sharedIndexBuffer && this._sharedIndexBuffer.destroy();
125488              }
125489              onRestore() {
125490                this.onEnable();
125491                this._buildImp(!0);
125492              }
125493              update(t) {
125494                for (let t = 0; t < this._blocks.length; ++t) this._blocks[t].update();
125495              }
125496              onUpdateFromCamera(t) {
125497                if (this.lodEnable && null != this._sharedLodIndexBuffer && t.scene === this._getRenderScene()) {
125498                  for (let e = 0; e < this._blocks.length; ++e) this._blocks[e]._updateLevel(t.position);
125499                  for (let t = 0; t < this._blocks.length; ++t) this._blocks[t]._updateLod();
125500                }
125501              }
125502              addLayer(t) {
125503                for (let i = 0; i < this._layerList.length; ++i) {
125504                  var e;
125505                  if (null === this._layerList[i] || this._layerList[i] && null === (null === (e = this._layerList[i]) || void 0 === e ? void 0 : e.detailMap)) {
125506                    this._layerList[i] = t;
125507                    this._asset && this.exportLayerListToAsset(this._asset);
125508                    return i;
125509                  }
125510                }
125511                return -1;
125512              }
125513              setLayer(t, e) {
125514                this._layerList[t] = e;
125515                this._asset && this.exportLayerListToAsset(this._asset);
125516              }
125517              removeLayer(t) {
125518                this._layerList[t] = null;
125519                this._asset && this.exportLayerListToAsset(this._asset);
125520              }
125521              getLayer(t) {
125522                return -1 === t ? null : this._layerList[t];
125523              }
125524              getPosition(t, e) {
125525                const i = t * this._tileSize;
125526                const s = e * this._tileSize;
125527                const n = this.getHeight(t, e);
125528                return new Pi(i, n, s);
125529              }
125530              getHeightField() {
125531                return this._heights;
125532              }
125533              setHeight(t, e, i) {
125534                i = _i(i, Ewt, Cwt);
125535                this._heights[e * this.vertexCount[0] + t] = Twt + i / vwt;
125536              }
125537              getHeight(t, e) {
125538                return (this._heights[e * this.vertexCount[0] + t] - Twt) * vwt;
125539              }
125540              getHeightClamp(t, e) {
125541                t = _i(t, 0, this.vertexCount[0] - 1);
125542                e = _i(e, 0, this.vertexCount[1] - 1);
125543                return this.getHeight(t, e);
125544              }
125545              getHeightAt(t, e) {
125546                const i = t / this.tileSize;
125547                const s = e / this.tileSize;
125548                let n = Math.floor(i);
125549                let r = Math.floor(s);
125550                let o = n + 1;
125551                let a = r + 1;
125552                const l = i - n;
125553                const h = s - r;
125554                if (n < 0 || n > this.vertexCount[0] - 1 || r < 0 || r > this.vertexCount[1] - 1) return null;
125555                n = _i(n, 0, this.vertexCount[0] - 1);
125556                r = _i(r, 0, this.vertexCount[1] - 1);
125557                o = _i(o, 0, this.vertexCount[0] - 1);
125558                a = _i(a, 0, this.vertexCount[1] - 1);
125559                let c = this.getHeight(n, r);
125560                const u = this.getHeight(o, r);
125561                const _ = this.getHeight(n, a);
125562                let d = this.getHeight(o, a);
125563                const p = .5 * (u + _);
125564                l + h <= 1 ? d = p + (p - c) : c = p + (p - d);
125565                return (c * (1 - l) + u * l) * (1 - h) + (_ * (1 - l) + d * l) * h;
125566              }
125567              _setNormal(t, e, i) {
125568                const s = e * this.vertexCount[0] + t;
125569                this._normals[3 * s + 0] = i.x;
125570                this._normals[3 * s + 1] = i.y;
125571                this._normals[3 * s + 2] = i.z;
125572              }
125573              getNormal(t, e) {
125574                const i = e * this.vertexCount[0] + t;
125575                const s = new Pi;
125576                s.x = this._normals[3 * i + 0];
125577                s.y = this._normals[3 * i + 1];
125578                s.z = this._normals[3 * i + 2];
125579                return s;
125580              }
125581              getNormalAt(t, e) {
125582                const i = t / this.tileSize;
125583                const s = e / this.tileSize;
125584                let n = Math.floor(i);
125585                let r = Math.floor(s);
125586                let o = n + 1;
125587                let a = r + 1;
125588                const l = i - n;
125589                const h = s - r;
125590                if (n < 0 || n > this.vertexCount[0] - 1 || r < 0 || r > this.vertexCount[1] - 1) return null;
125591                n = _i(n, 0, this.vertexCount[0] - 1);
125592                r = _i(r, 0, this.vertexCount[1] - 1);
125593                o = _i(o, 0, this.vertexCount[0] - 1);
125594                a = _i(a, 0, this.vertexCount[1] - 1);
125595                const c = this.getNormal(n, r);
125596                const u = this.getNormal(o, r);
125597                const _ = this.getNormal(n, a);
125598                const d = this.getNormal(o, a);
125599                const p = new Pi;
125600                Pi.add(p, u, _).multiplyScalar(.5);
125601                if (l + h <= 1) {
125602                  d.set(p);
125603                  d.subtract(c);
125604                  d.add(p);
125605                } else {
125606                  c.set(p);
125607                  c.subtract(d);
125608                  c.add(p);
125609                }
125610                const m = new Pi;
125611                const f = new Pi;
125612                const g = new Pi;
125613                Pi.lerp(m, c, u, l);
125614                Pi.lerp(f, _, d, l);
125615                Pi.lerp(g, m, f, h);
125616                return g;
125617              }
125618              setWeight(t, e, i) {
125619                const s = e * this._weightMapSize * this._blockCount[0] + t;
125620                this._weights[4 * s + 0] = 255 * i.x;
125621                this._weights[4 * s + 1] = 255 * i.y;
125622                this._weights[4 * s + 2] = 255 * i.z;
125623                this._weights[4 * s + 3] = 255 * i.w;
125624              }
125625              getWeight(t, e) {
125626                const i = e * this._weightMapSize * this._blockCount[0] + t;
125627                const s = new is;
125628                s.x = this._weights[4 * i + 0] / 255;
125629                s.y = this._weights[4 * i + 1] / 255;
125630                s.z = this._weights[4 * i + 2] / 255;
125631                s.w = this._weights[4 * i + 3] / 255;
125632                return s;
125633              }
125634              getWeightAt(t, e) {
125635                const i = this.weightMapSize * this.blockCount[0];
125636                const s = this.weightMapSize * this.blockCount[1];
125637                if (0 === i || 0 === s) return null;
125638                const n = t / i;
125639                const r = e / s;
125640                let o = Math.floor(n);
125641                let a = Math.floor(r);
125642                let l = o + 1;
125643                let h = a + 1;
125644                const c = n - o;
125645                const u = r - a;
125646                if (o < 0 || o > i - 1 || a < 0 || a > s - 1) return null;
125647                o = _i(o, 0, i - 1);
125648                a = _i(a, 0, s - 1);
125649                l = _i(l, 0, i - 1);
125650                h = _i(h, 0, s - 1);
125651                let _ = this.getWeight(o, a);
125652                const d = this.getWeight(l, a);
125653                const p = this.getWeight(o, h);
125654                let m = this.getWeight(l, h);
125655                const f = new is;
125656                is.add(f, d, p).multiplyScalar(.5);
125657                if (c + u <= 1) {
125658                  m = new is;
125659                  is.subtract(m, f, _).add(f);
125660                } else {
125661                  _ = new is;
125662                  is.subtract(_, f, m).add(f);
125663                }
125664                const g = new is;
125665                const y = new is;
125666                const b = new is;
125667                is.lerp(g, _, d, c);
125668                is.lerp(y, p, m, c);
125669                is.lerp(b, g, y, u);
125670                return b;
125671              }
125672              getMaxWeightLayerAt(t, e) {
125673                const i = this.weightMapSize * this.blockCount[0];
125674                const s = this.weightMapSize * this.blockCount[1];
125675                if (0 === i || 0 === s) return null;
125676                const n = t / i;
125677                const r = e / s;
125678                const o = Math.floor(n);
125679                const a = Math.floor(r);
125680                if (o < 0 || o > i - 1 || a < 0 || a > s - 1) return null;
125681                const l = this.getWeight(o, a);
125682                const h = Math.floor(t / this.weightMapSize);
125683                const c = Math.floor(e / this.weightMapSize);
125684                const u = this.getBlock(h, c);
125685                let _ = 0;
125686                l.y > l[_] && -1 !== u.getLayer(1) && (_ = 1);
125687                l.y > l[_] && -1 !== u.getLayer(2) && (_ = 2);
125688                l.z > l[_] && -1 !== u.getLayer(3) && (_ = 3);
125689                _ = u.getLayer(_);
125690                return this.getLayer(_);
125691              }
125692              getBlockLayers(t, e) {
125693                const i = (e * this._blockCount[0] + t) * gwt;
125694                return [ this._layerBuffer[i], this._layerBuffer[i + 1], this._layerBuffer[i + 2], this._layerBuffer[i + 3] ];
125695              }
125696              getBlockLayer(t, e, i) {
125697                const s = (e * this._blockCount[0] + t) * gwt;
125698                return this._layerBuffer[s + i];
125699              }
125700              setBlockLayer(t, e, i, s) {
125701                const n = (e * this._blockCount[0] + t) * gwt;
125702                this._layerBuffer[n + i] = s;
125703              }
125704              getBlock(t, e) {
125705                return this._blocks[e * this._blockCount[0] + t];
125706              }
125707              getBlocks() {
125708                return this._blocks;
125709              }
125710              rayCheck(t, e, i, s = !0) {
125711                const n = t;
125712                s && Pi.subtract(n, t, this.node.getWorldPosition());
125713                const r = new Pi;
125714                r.set(e);
125715                r.multiplyScalar(i);
125716                let o = null;
125717                if (e.equals(new Pi(0, 1, 0))) {
125718                  const t = this.getHeightAt(n.x, n.z);
125719                  null != t && n.y <= t && (o = new Pi(n.x, t, n.z));
125720                } else if (e.equals(new Pi(0, -1, 0))) {
125721                  const t = this.getHeightAt(n.x, n.z);
125722                  null != t && n.y >= t && (o = new Pi(n.x, t, n.z));
125723                } else {
125724                  let t = 0;
125725                  for (;t++ < 2e3; ) {
125726                    const t = this.getHeightAt(n.x, n.z);
125727                    if (null != t && n.y <= t) break;
125728                    n.add(e);
125729                  }
125730                  for (;t++ < 2e3; ) {
125731                    const t = this.getHeightAt(n.x, n.z);
125732                    if (null != t && n.y <= t) {
125733                      o = new Pi(n.x, t, n.z);
125734                      break;
125735                    }
125736                    n.add(r);
125737                  }
125738                }
125739                return o;
125740              }
125741              _createSharedIndexBuffer() {
125742                const t = zo.gfxDevice;
125743                if (null !== this._lod) {
125744                  const e = t.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, Uint16Array.BYTES_PER_ELEMENT * this._lod._indexBuffer.length, Uint16Array.BYTES_PER_ELEMENT));
125745                  e.update(this._lod._indexBuffer);
125746                  return e;
125747                }
125748                {
125749                  const e = new Uint16Array(bwt * bwt * 6);
125750                  let i = 0;
125751                  for (let t = 0; t < bwt; ++t) for (let s = 0; s < bwt; ++s) {
125752                    const n = t * Swt + s;
125753                    const r = t * Swt + s + 1;
125754                    const o = (t + 1) * Swt + s;
125755                    const a = (t + 1) * Swt + s + 1;
125756                    e[i++] = n;
125757                    e[i++] = o;
125758                    e[i++] = r;
125759                    e[i++] = r;
125760                    e[i++] = o;
125761                    e[i++] = a;
125762                  }
125763                  const s = t.createBuffer(new An(Ts.INDEX | Ts.TRANSFER_DST, Cs.DEVICE, Uint16Array.BYTES_PER_ELEMENT * e.length, Uint16Array.BYTES_PER_ELEMENT));
125764                  s.update(e);
125765                  return s;
125766                }
125767              }
125768              _getSharedIndexBuffer() {
125769                if (null !== this._sharedIndexBuffer) return this._sharedIndexBuffer;
125770                if (null !== this._sharedLodIndexBuffer) return this._sharedLodIndexBuffer;
125771                if (null !== this._lod) {
125772                  this._sharedLodIndexBuffer = this._createSharedIndexBuffer();
125773                  return this._sharedLodIndexBuffer;
125774                }
125775                this._sharedIndexBuffer = this._createSharedIndexBuffer();
125776                return this._sharedIndexBuffer;
125777              }
125778              _getIndexData(t) {
125779                return null !== this._sharedLodIndexBuffer && null !== this._lod ? this._lod.getIndexData(t) : null;
125780              }
125781              _resetLightmap(t) {
125782                this._lightmapInfos.length = 0;
125783                if (t) for (let t = 0; t < this._blockCount[0] * this._blockCount[1]; ++t) this._lightmapInfos.push(new zOt);
125784              }
125785              _updateLightmap(t, e, i, s, n, r) {
125786                this._lightmapInfos[t].texture = e;
125787                this._lightmapInfos[t].UOff = i;
125788                this._lightmapInfos[t].VOff = s;
125789                this._lightmapInfos[t].UScale = n;
125790                this._lightmapInfos[t].VScale = r;
125791                this._blocks[t]._updateLightmap(this._lightmapInfos[t]);
125792              }
125793              _getLightmapInfo(t, e) {
125794                const i = e * this._blockCount[0] + t;
125795                return i < this._lightmapInfos.length ? this._lightmapInfos[i] : null;
125796              }
125797              _calcNormal(t, e) {
125798                let i = 1;
125799                const s = this.getPosition(t, e);
125800                let n;
125801                let r;
125802                if (t < this.vertexCount[0] - 1) n = this.getPosition(t + 1, e); else {
125803                  i *= -1;
125804                  n = this.getPosition(t - 1, e);
125805                }
125806                if (e < this.vertexCount[1] - 1) r = this.getPosition(t, e + 1); else {
125807                  i *= -1;
125808                  r = this.getPosition(t, e - 1);
125809                }
125810                n.subtract(s);
125811                r.subtract(s);
125812                const o = new Pi;
125813                o.set(r);
125814                o.cross(n);
125815                o.multiplyScalar(i);
125816                o.normalize();
125817                return o;
125818              }
125819              _buildNormals() {
125820                let t = 0;
125821                for (let e = 0; e < this.vertexCount[1]; ++e) for (let i = 0; i < this.vertexCount[0]; ++i) {
125822                  const s = this._calcNormal(i, e);
125823                  this._normals[3 * t + 0] = s.x;
125824                  this._normals[3 * t + 1] = s.y;
125825                  this._normals[3 * t + 2] = s.z;
125826                  t += 1;
125827                }
125828              }
125829              _buildImp(t = !1) {
125830                if (this.valid) return;
125831                const e = this.__asset;
125832                this._buitinAsset !== e && (this._buitinAsset = e);
125833                if (!t && null !== e) {
125834                  this._tileSize = e.tileSize;
125835                  this._blockCount = e.blockCount;
125836                  this._weightMapSize = e.weightMapSize;
125837                  this._lightMapSize = e.lightMapSize;
125838                  this._heights = e.heights;
125839                  this._normals = e.normals;
125840                  this._weights = e.weights;
125841                  this._layerBuffer = e.layerBuffer;
125842                  for (let t = 0; t < this._layerList.length; ++t) this._layerList[t] = null;
125843                  if (e.version < Mwt) for (let t = 0; t < e.layerBinaryInfos.length; ++t) {
125844                    const i = new UOt;
125845                    const s = e.layerBinaryInfos[t];
125846                    i.tileSize = s.tileSize;
125847                    m.assetManager.loadAny(s.detailMapId, ((t, e) => {
125848                      i.detailMap = e;
125849                    }));
125850                    "" !== s.normalMapId && m.assetManager.loadAny(s.normalMapId, ((t, e) => {
125851                      i.normalMap = e;
125852                    }));
125853                    i.roughness = s.roughness;
125854                    i.metallic = s.metallic;
125855                    this._layerList[s.slot] = i;
125856                  } else for (let t = 0; t < e.layerInfos.length; ++t) {
125857                    const i = new UOt;
125858                    const s = e.layerInfos[t];
125859                    i.tileSize = s.tileSize;
125860                    i.detailMap = s.detailMap;
125861                    i.normalMap = s.normalMap;
125862                    i.roughness = s.roughness;
125863                    i.metallic = s.metallic;
125864                    this._layerList[s.slot] = i;
125865                  }
125866                }
125867                if (0 === this._blockCount[0] || 0 === this._blockCount[1]) return;
125868                const i = this.vertexCount[0] * this.vertexCount[1];
125869                if (null === this._heights || this._heights.length !== i) {
125870                  this._heights = new Uint16Array(i);
125871                  this._normals = new Float32Array(3 * i);
125872                  for (let t = 0; t < i; ++t) {
125873                    this._heights[t] = Twt;
125874                    this._normals[3 * t + 0] = 0;
125875                    this._normals[3 * t + 1] = 1;
125876                    this._normals[3 * t + 2] = 0;
125877                  }
125878                }
125879                if (null === this._normals || this._normals.length !== 3 * i) {
125880                  this._normals = new Float32Array(3 * i);
125881                  this._buildNormals();
125882                }
125883                const s = this.blockCount[0] * this.blockCount[1] * gwt;
125884                if (null === this._layerBuffer || this._layerBuffer.length !== s) {
125885                  this._layerBuffer = new Array(s);
125886                  for (let t = 0; t < s; ++t) this._layerBuffer[t] = -1;
125887                }
125888                const n = this._weightMapSize * this._blockCount[0];
125889                const r = this._weightMapSize * this._blockCount[1];
125890                if (this._weights.length !== n * r * 4) {
125891                  this._weights = new Uint8Array(n * r * 4);
125892                  for (let t = 0; t < n * r; ++t) {
125893                    this._weights[4 * t + 0] = 255;
125894                    this._weights[4 * t + 1] = 0;
125895                    this._weights[4 * t + 2] = 0;
125896                    this._weights[4 * t + 3] = 0;
125897                  }
125898                }
125899                for (let t = 0; t < this._blockCount[1]; ++t) for (let e = 0; e < this._blockCount[0]; ++e) this._blocks.push(new HOt(this, e, t));
125900                for (let t = 0; t < this._blocks.length; ++t) this._blocks[t].build();
125901              }
125902              _rebuildHeights(t) {
125903                if (this.vertexCount[0] === t.vertexCount[0] && this.vertexCount[1] === t.vertexCount[1]) return !1;
125904                const e = new Uint16Array(t.vertexCount[0] * t.vertexCount[1]);
125905                for (let t = 0; t < e.length; ++t) e[t] = Twt;
125906                const i = Math.min(this.vertexCount[0], t.vertexCount[0]);
125907                const s = Math.min(this.vertexCount[1], t.vertexCount[1]);
125908                for (let n = 0; n < s; ++n) for (let s = 0; s < i; ++s) {
125909                  const i = n * t.vertexCount[0] + s;
125910                  const r = n * this.vertexCount[0] + s;
125911                  e[i] = this._heights[r];
125912                }
125913                this._heights = e;
125914                return !0;
125915              }
125916              _rebuildLayerBuffer(t) {
125917                if (this.blockCount[0] === t.blockCount[0] && this.blockCount[1] === t.blockCount[1]) return !1;
125918                const e = [];
125919                e.length = t.blockCount[0] * t.blockCount[1] * gwt;
125920                for (let t = 0; t < e.length; ++t) e[t] = -1;
125921                const i = Math.min(this.blockCount[0], t.blockCount[0]);
125922                const s = Math.min(this.blockCount[1], t.blockCount[1]);
125923                for (let n = 0; n < s; ++n) for (let s = 0; s < i; ++s) {
125924                  const i = n * t.blockCount[0] + s;
125925                  const r = n * this.blockCount[0] + s;
125926                  for (let t = 0; t < gwt; ++t) e[i * gwt + t] = this._layerBuffer[r * gwt + t];
125927                }
125928                this._layerBuffer = e;
125929                return !0;
125930              }
125931              _rebuildWeights(t) {
125932                const e = this._weightMapSize;
125933                const i = this._weightMapSize * this._blockCount[0];
125934                const s = this._weightMapSize * this._blockCount[1];
125935                const n = t.weightMapSize * t.blockCount[0];
125936                const r = t.weightMapSize * t.blockCount[1];
125937                if (n === i && r === s) return !1;
125938                const o = new Uint8Array(n * r * 4);
125939                for (let t = 0; t < n * r; ++t) {
125940                  o[4 * t + 0] = 255;
125941                  o[4 * t + 1] = 0;
125942                  o[4 * t + 2] = 0;
125943                  o[4 * t + 3] = 0;
125944                }
125945                const a = Math.min(t.blockCount[0], this._blockCount[0]);
125946                const l = Math.min(t.blockCount[1], this._blockCount[1]);
125947                const h = (t, e, s) => {
125948                  const n = e * i + t;
125949                  const r = new is;
125950                  r.x = s[4 * n + 0] / 255;
125951                  r.y = s[4 * n + 1] / 255;
125952                  r.z = s[4 * n + 2] / 255;
125953                  r.w = s[4 * n + 3] / 255;
125954                  return r;
125955                };
125956                const c = (t, i, s, n, r) => {
125957                  const o = Math.floor(t);
125958                  const a = Math.floor(i);
125959                  const l = Math.min(o + 1, e - 1);
125960                  const c = Math.min(a + 1, e - 1);
125961                  const u = t - o;
125962                  const _ = i - a;
125963                  const d = h(o + s, a + n, this._weights);
125964                  const p = h(l + s, a + n, this._weights);
125965                  const m = h(o + s, c + n, this._weights);
125966                  const f = h(l + s, c + n, this._weights);
125967                  const g = new is;
125968                  is.add(g, p, m).multiplyScalar(.5);
125969                  if (u + _ <= 1) {
125970                    f.set(g);
125971                    f.subtract(d);
125972                    f.add(g);
125973                  } else {
125974                    d.set(g);
125975                    d.subtract(f);
125976                    d.add(g);
125977                  }
125978                  const y = new is;
125979                  const b = new is;
125980                  const S = new is;
125981                  is.lerp(y, d, p, u);
125982                  is.lerp(b, m, f, u);
125983                  is.lerp(S, y, b, _);
125984                  return S;
125985                };
125986                for (let i = 0; i < l; ++i) for (let s = 0; s < a; ++s) {
125987                  const r = s * e;
125988                  const a = i * e;
125989                  for (let l = 0; l < t.weightMapSize; ++l) for (let u = 0; u < t.weightMapSize; ++u) {
125990                    let _;
125991                    if (t.weightMapSize === e) _ = h(u + r, l + a, this._weights); else {
125992                      _ = c(u / (t.weightMapSize - 1) * (e - 1), l / (t.weightMapSize - 1) * (e - 1), r, a, this._weights);
125993                    }
125994                    const d = s * t.weightMapSize + u;
125995                    const p = (i * t.weightMapSize + l) * n + d;
125996                    o[4 * p + 0] = 255 * _.x;
125997                    o[4 * p + 1] = 255 * _.y;
125998                    o[4 * p + 2] = 255 * _.z;
125999                    o[4 * p + 3] = 255 * _.w;
126000                  }
126001                }
126002                this._weights = o;
126003                return !0;
126004              }
126005            }, VOt), MOt = Bl(IOt.prototype, "__asset", [ pOt, Yl, gh ], {
126006              configurable: !0,
126007              enumerable: !0,
126008              writable: !0,
126009              initializer: function() {
126010                return null;
126011              }
126012            }), BOt = Bl(IOt.prototype, "_effectAsset", [ mOt, Yl, gh, fOt ], {
126013              configurable: !0,
126014              enumerable: !0,
126015              writable: !0,
126016              initializer: function() {
126017                return null;
126018              }
126019            }), DOt = Bl(IOt.prototype, "_lightmapInfos", [ gOt, Yl, gh ], {
126020              configurable: !0,
126021              enumerable: !0,
126022              writable: !0,
126023              initializer: function() {
126024                return [];
126025              }
126026            }), POt = Bl(IOt.prototype, "_receiveShadow", [ yOt, Yl, gh ], {
126027              configurable: !0,
126028              enumerable: !0,
126029              writable: !0,
126030              initializer: function() {
126031                return !1;
126032              }
126033            }), OOt = Bl(IOt.prototype, "_useNormalmap", [ bOt, Yl, gh ], {
126034              configurable: !0,
126035              enumerable: !0,
126036              writable: !0,
126037              initializer: function() {
126038                return !1;
126039              }
126040            }), NOt = Bl(IOt.prototype, "_usePBR", [ SOt, Yl, gh ], {
126041              configurable: !0,
126042              enumerable: !0,
126043              writable: !0,
126044              initializer: function() {
126045                return !1;
126046              }
126047            }), LOt = Bl(IOt.prototype, "_lodEnable", [ AOt, Yl, gh ], {
126048              configurable: !0,
126049              enumerable: !0,
126050              writable: !0,
126051              initializer: function() {
126052                return !1;
126053              }
126054            }), FOt = Bl(IOt.prototype, "_lodBias", [ TOt, Yl, gh ], {
126055              configurable: !0,
126056              enumerable: !0,
126057              writable: !0,
126058              initializer: function() {
126059                return 0;
126060              }
126061            }), Bl(IOt.prototype, "_asset", [ vOt, EOt ], Object.getOwnPropertyDescriptor(IOt.prototype, "_asset"), IOt.prototype),
126062            Bl(IOt.prototype, "effectAsset", [ COt, xOt ], Object.getOwnPropertyDescriptor(IOt.prototype, "effectAsset"), IOt.prototype),
126063            Bl(IOt.prototype, "receiveShadow", [ nh ], Object.getOwnPropertyDescriptor(IOt.prototype, "receiveShadow"), IOt.prototype),
126064            Bl(IOt.prototype, "useNormalMap", [ nh ], Object.getOwnPropertyDescriptor(IOt.prototype, "useNormalMap"), IOt.prototype),
126065            Bl(IOt.prototype, "usePBR", [ nh ], Object.getOwnPropertyDescriptor(IOt.prototype, "usePBR"), IOt.prototype),
126066            Bl(IOt.prototype, "lodEnable", [ nh ], Object.getOwnPropertyDescriptor(IOt.prototype, "lodEnable"), IOt.prototype),
126067            Bl(IOt.prototype, "LodBias", [ nh ], Object.getOwnPropertyDescriptor(IOt.prototype, "LodBias"), IOt.prototype),
126068            Bl(IOt.prototype, "info", [ wOt ], Object.getOwnPropertyDescriptor(IOt.prototype, "info"), IOt.prototype),
126069            IOt)) || ROt) || ROt) || ROt) || ROt));
126070            let jOt;
126071            !function(t) {
126072              t[t.ORTHO = 0] = "ORTHO";
126073              t[t.HEX = 1] = "HEX";
126074              t[t.ISO = 2] = "ISO";
126075            }(jOt || (jOt = {}));
126076            he(jOt);
126077            let XOt;
126078            !function(t) {
126079              t[t.NONE = 0] = "NONE";
126080              t[t.MAP = 1] = "MAP";
126081              t[t.LAYER = 2] = "LAYER";
126082              t[t.OBJECTGROUP = 3] = "OBJECTGROUP";
126083              t[t.OBJECT = 4] = "OBJECT";
126084              t[t.TILE = 5] = "TILE";
126085            }(XOt || (XOt = {}));
126086            he(XOt);
126087            let WOt;
126088            !function(t) {
126089              t[t.HORIZONTAL = 2147483648] = "HORIZONTAL";
126090              t[t.VERTICAL = 1073741824] = "VERTICAL";
126091              t[t.DIAGONAL = 536870912] = "DIAGONAL";
126092              t[t.FLIPPED_ALL = 4026531840] = "FLIPPED_ALL";
126093              t[t.FLIPPED_MASK = 268435455] = "FLIPPED_MASK";
126094            }(WOt || (WOt = {}));
126095            he(WOt);
126096            let YOt;
126097            !function(t) {
126098              t[t.STAGGERAXIS_X = 0] = "STAGGERAXIS_X";
126099              t[t.STAGGERAXIS_Y = 1] = "STAGGERAXIS_Y";
126100            }(YOt || (YOt = {}));
126101            he(YOt);
126102            let qOt;
126103            !function(t) {
126104              t[t.STAGGERINDEX_ODD = 0] = "STAGGERINDEX_ODD";
126105              t[t.STAGGERINDEX_EVEN = 1] = "STAGGERINDEX_EVEN";
126106            }(qOt || (qOt = {}));
126107            he(qOt);
126108            let KOt;
126109            !function(t) {
126110              t[t.RightDown = 0] = "RightDown";
126111              t[t.RightUp = 1] = "RightUp";
126112              t[t.LeftDown = 2] = "LeftDown";
126113              t[t.LeftUp = 3] = "LeftUp";
126114            }(KOt || (KOt = {}));
126115            he(KOt);
126116            let JOt;
126117            !function(t) {
126118              t[t.RECT = 0] = "RECT";
126119              t[t.ELLIPSE = 1] = "ELLIPSE";
126120              t[t.POLYGON = 2] = "POLYGON";
126121              t[t.POLYLINE = 3] = "POLYLINE";
126122              t[t.IMAGE = 4] = "IMAGE";
126123              t[t.TEXT = 5] = "TEXT";
126124            }(JOt || (JOt = {}));
126125            he(JOt);
126126            class ZOt {
126127              constructor() {
126128                this.name = "";
126129                this.firstGid = 0;
126130                this.spacing = 0;
126131                this.margin = 0;
126132                this.sourceImage = void 0;
126133                this.imageName = null;
126134                this.imageSize = new rs(0, 0);
126135                this.tileOffset = new Qi(0, 0);
126136                this._tileSize = new rs(0, 0);
126137                this.collection = !1;
126138              }
126139              rectForGID(t, e) {
126140                const i = e || new as(0, 0, 0, 0);
126141                i.width = this._tileSize.width;
126142                i.height = this._tileSize.height;
126143                let s = t;
126144                s &= WOt.FLIPPED_MASK;
126145                s -= this.firstGid;
126146                const n = Math.floor((this.imageSize.width - 2 * this.margin + this.spacing) / (this._tileSize.width + this.spacing));
126147                i.x = Math.round(s % n * (this._tileSize.width + this.spacing) + this.margin);
126148                i.y = Math.round(Math.floor(s / n) * (this._tileSize.height + this.spacing) + this.margin);
126149                return i;
126150              }
126151            }
126152            class QOt {
126153              constructor() {
126154                this.properties = {};
126155                this.name = "";
126156                this.objects = [];
126157                this.visible = !0;
126158                this.opacity = 0;
126159                this.color = new Bi(255, 255, 255, 255);
126160                this.offset = new Qi(0, 0);
126161                this.draworder = "topdown";
126162                this.tintColor = null;
126163              }
126164              getProperties() {
126165                return this.properties;
126166              }
126167              setProperties(t) {
126168                this.properties = t;
126169              }
126170            }
126171            class $Ot {
126172              constructor() {
126173                this.properties = {};
126174                this.name = "";
126175                this.layerSize = null;
126176                this.tiles = [];
126177                this.visible = !0;
126178                this.opacity = 0;
126179                this.ownTiles = !0;
126180                this.minGID = 1e5;
126181                this.maxGID = 0;
126182                this.offset = new Qi(0, 0);
126183                this.tintColor = null;
126184              }
126185              getProperties() {
126186                return this.properties;
126187              }
126188              setProperties(t) {
126189                this.properties = t;
126190              }
126191            }
126192            $Ot.ATTRIB_NONE = 1;
126193            $Ot.ATTRIB_BASE64 = 2;
126194            $Ot.ATTRIB_GZIP = 4;
126195            $Ot.ATTRIB_ZLIB = 8;
126196            class tNt {
126197              constructor() {
126198                this.name = "";
126199                this.visible = !0;
126200                this.width = 0;
126201                this.height = 0;
126202                this.offset = new Qi(0, 0);
126203                this.opacity = 0;
126204                this.trans = new Bi(255, 255, 255, 255);
126205                this.sourceImage = void 0;
126206                this.tintColor = null;
126207              }
126208            }
126209            function eNt(t) {
126210              const e = IP.HorizontalAlign;
126211              switch (t) {
126212               case "center":
126213                return e.CENTER;
126214
126215               case "right":
126216                return e.RIGHT;
126217
126218               default:
126219                return e.LEFT;
126220              }
126221            }
126222            function iNt(t) {
126223              const e = IP.VerticalAlign;
126224              switch (t) {
126225               case "center":
126226                return e.CENTER;
126227
126228               case "bottom":
126229                return e.BOTTOM;
126230
126231               default:
126232                return e.TOP;
126233              }
126234            }
126235            function sNt(t) {
126236              if (!t) return new Bi(0, 0, 0, 255);
126237              if (8 === (t = -1 !== t.indexOf("#") ? t.substring(1) : t).length) {
126238                const e = parseInt(t.substr(0, 2), 16) || 255;
126239                const i = parseInt(t.substr(2, 2), 16) || 0;
126240                const s = parseInt(t.substr(4, 2), 16) || 0;
126241                const n = parseInt(t.substr(6, 2), 16) || 0;
126242                return new Bi(i, s, n, e);
126243              }
126244              {
126245                const e = parseInt(t.substr(0, 2), 16) || 0;
126246                const i = parseInt(t.substr(2, 2), 16) || 0;
126247                const s = parseInt(t.substr(4, 2), 16) || 0;
126248                return new Bi(e, i, s, 255);
126249              }
126250            }
126251            function nNt(t, e) {
126252              const i = [];
126253              const s = t.getElementsByTagName("properties");
126254              for (let t = 0; t < s.length; ++t) {
126255                const e = s[t].getElementsByTagName("property");
126256                for (let t = 0; t < e.length; ++t) i.push(e[t]);
126257              }
126258              e = e || {};
126259              for (let t = 0; t < i.length; t++) {
126260                const s = i[t];
126261                const n = s.getAttribute("name");
126262                const r = s.getAttribute("type") || "string";
126263                let o = s.getAttribute("value");
126264                "int" === r ? o = parseInt(o) : "float" === r ? o = parseFloat(o) : "bool" === r ? o = "true" === o : "color" === r && (o = sNt(o));
126265                e[n] = o;
126266              }
126267              return e;
126268            }
126269            class rNt {
126270              get mapSize() {
126271                return this._mapSize;
126272              }
126273              get tileSize() {
126274                return this._tileSize;
126275              }
126276              constructor(t, e, i, s, n) {
126277                this.properties = {};
126278                this.orientation = null;
126279                this.parentElement = null;
126280                this.parentGID = 0;
126281                this.layerAttrs = 0;
126282                this.storingCharacters = !1;
126283                this.currentString = null;
126284                this.renderOrder = KOt.RightDown;
126285                this._supportVersion = [ 1, 4, 0 ];
126286                this._objectGroups = [];
126287                this._allChildren = [];
126288                this._mapSize = new rs(0, 0);
126289                this._tileSize = new rs(0, 0);
126290                this._layers = [];
126291                this._tilesets = [];
126292                this._imageLayers = [];
126293                this._tileProperties = new Map;
126294                this._tileAnimations = {};
126295                this._tsxContentMap = null;
126296                this._spriteFrameMap = null;
126297                this._spfSizeMap = {};
126298                this._staggerAxis = null;
126299                this._staggerIndex = null;
126300                this._hexSideLength = 0;
126301                this._imageLayerSPF = null;
126302                this.initWithXML(t, e, i, s, n);
126303              }
126304              getOrientation() {
126305                return this.orientation;
126306              }
126307              setOrientation(t) {
126308                this.orientation = t;
126309              }
126310              getStaggerAxis() {
126311                return this._staggerAxis;
126312              }
126313              setStaggerAxis(t) {
126314                this._staggerAxis = t;
126315              }
126316              getStaggerIndex() {
126317                return this._staggerIndex;
126318              }
126319              setStaggerIndex(t) {
126320                this._staggerIndex = t;
126321              }
126322              getHexSideLength() {
126323                return this._hexSideLength;
126324              }
126325              setHexSideLength(t) {
126326                this._hexSideLength = t;
126327              }
126328              getMapSize() {
126329                return new rs(this._mapSize.width, this._mapSize.height);
126330              }
126331              setMapSize(t) {
126332                this._mapSize.width = t.width;
126333                this._mapSize.height = t.height;
126334              }
126335              get mapWidth() {
126336                return this._mapSize.width;
126337              }
126338              set mapWidth(t) {
126339                this._mapSize.width = t;
126340              }
126341              get mapHeight() {
126342                return this._mapSize.height;
126343              }
126344              set mapHeight(t) {
126345                this._mapSize.height = t;
126346              }
126347              getTileSize() {
126348                return new rs(this._tileSize.width, this._tileSize.height);
126349              }
126350              setTileSize(t) {
126351                this._tileSize.width = t.width;
126352                this._tileSize.height = t.height;
126353              }
126354              get tileWidth() {
126355                return this._tileSize.width;
126356              }
126357              set tileWidth(t) {
126358                this._tileSize.width = t;
126359              }
126360              get tileHeight() {
126361                return this._tileSize.height;
126362              }
126363              set tileHeight(t) {
126364                this._tileSize.height = t;
126365              }
126366              getLayers() {
126367                return this._layers;
126368              }
126369              setLayers(t) {
126370                this._allChildren.push(t);
126371                this._layers.push(t);
126372              }
126373              getImageLayers() {
126374                return this._imageLayers;
126375              }
126376              setImageLayers(t) {
126377                this._allChildren.push(t);
126378                this._imageLayers.push(t);
126379              }
126380              getTilesets() {
126381                return this._tilesets;
126382              }
126383              setTilesets(t) {
126384                this._tilesets.push(t);
126385              }
126386              getObjectGroups() {
126387                return this._objectGroups;
126388              }
126389              setObjectGroups(t) {
126390                this._allChildren.push(t);
126391                this._objectGroups.push(t);
126392              }
126393              getAllChildren() {
126394                return this._allChildren;
126395              }
126396              getParentElement() {
126397                return this.parentElement;
126398              }
126399              setParentElement(t) {
126400                this.parentElement = t;
126401              }
126402              getParentGID() {
126403                return this.parentGID;
126404              }
126405              setParentGID(t) {
126406                this.parentGID = t;
126407              }
126408              getLayerAttribs() {
126409                return this.layerAttrs;
126410              }
126411              setLayerAttribs(t) {
126412                this.layerAttrs = t;
126413              }
126414              getStoringCharacters() {
126415                return this.storingCharacters;
126416              }
126417              setStoringCharacters(t) {
126418                this.storingCharacters = t;
126419              }
126420              getProperties() {
126421                return this.properties;
126422              }
126423              setProperties(t) {
126424                this.properties = t;
126425              }
126426              initWithXML(t, e, i, s, n) {
126427                this._tilesets.length = 0;
126428                this._layers.length = 0;
126429                this._imageLayers.length = 0;
126430                this._tsxContentMap = e;
126431                this._spriteFrameMap = i;
126432                this._imageLayerSPF = n;
126433                this._spfSizeMap = s;
126434                this._objectGroups.length = 0;
126435                this._allChildren.length = 0;
126436                this.properties = {};
126437                this._tileProperties = new Map;
126438                this._tileAnimations = new Map;
126439                this.currentString = "";
126440                this.storingCharacters = !1;
126441                this.layerAttrs = $Ot.ATTRIB_NONE;
126442                this.parentElement = null;
126443                return this.parseXMLString(t);
126444              }
126445              parseXMLString(t, e) {
126446                let i;
126447                const s = (new aR).parse(t).documentElement;
126448                const n = s.getAttribute("orientation");
126449                const r = s.getAttribute("staggeraxis");
126450                const o = s.getAttribute("staggerindex");
126451                const a = s.getAttribute("hexsidelength");
126452                const l = s.getAttribute("renderorder");
126453                const h = s.getAttribute("version") || "1.0.0";
126454                if ("map" === s.nodeName) {
126455                  const t = h.split(".");
126456                  const e = this._supportVersion;
126457                  for (i = 0; i < e.length; i++) {
126458                    const s = parseInt(t[i]) || 0;
126459                    if (e[i] < s) {
126460                      P(7216, h);
126461                      break;
126462                    }
126463                  }
126464                  "orthogonal" === n ? this.orientation = jOt.ORTHO : "isometric" === n ? this.orientation = jOt.ISO : "hexagonal" === n ? this.orientation = jOt.HEX : null !== n && P(7217, n);
126465                  this.renderOrder = "right-up" === l ? KOt.RightUp : "left-up" === l ? KOt.LeftUp : "left-down" === l ? KOt.LeftDown : KOt.RightDown;
126466                  "x" === r ? this.setStaggerAxis(YOt.STAGGERAXIS_X) : "y" === r && this.setStaggerAxis(YOt.STAGGERAXIS_Y);
126467                  "odd" === o ? this.setStaggerIndex(qOt.STAGGERINDEX_ODD) : "even" === o && this.setStaggerIndex(qOt.STAGGERINDEX_EVEN);
126468                  a && this.setHexSideLength(parseFloat(a));
126469                  let c = new rs(0, 0);
126470                  c.width = parseFloat(s.getAttribute("width"));
126471                  c.height = parseFloat(s.getAttribute("height"));
126472                  this.setMapSize(c);
126473                  c = new rs(0, 0);
126474                  c.width = parseFloat(s.getAttribute("tilewidth"));
126475                  c.height = parseFloat(s.getAttribute("tileheight"));
126476                  this.setTileSize(c);
126477                  this.properties = nNt(s);
126478                }
126479                let c = s.getElementsByTagName("tileset");
126480                if ("map" !== s.nodeName) {
126481                  c = [];
126482                  c.push(s);
126483                }
126484                for (i = 0; i < c.length; i++) {
126485                  const t = c[i];
126486                  const s = t.getAttribute("source");
126487                  if (s) {
126488                    const e = parseInt(t.getAttribute("firstgid"));
126489                    const i = this._tsxContentMap[s];
126490                    i && this.parseXMLString(i, e);
126491                  } else {
126492                    const i = t.getElementsByTagName("image");
126493                    const s = i.length > 1;
126494                    const n = i[0];
126495                    let r = n.getAttribute("source");
126496                    r = r.replace(/\\/g, "/");
126497                    const o = t.getElementsByTagName("tile");
126498                    const a = o && o.length || 1;
126499                    let l = null;
126500                    const h = t.getAttribute("name") || "";
126501                    const c = parseInt(t.getAttribute("spacing")) || 0;
126502                    const u = parseInt(t.getAttribute("margin")) || 0;
126503                    const _ = e || parseInt(t.getAttribute("firstgid")) || 0;
126504                    const d = new rs(0, 0);
126505                    d.width = parseFloat(t.getAttribute("tilewidth"));
126506                    d.height = parseFloat(t.getAttribute("tileheight"));
126507                    const p = t.getElementsByTagName("tileoffset")[0];
126508                    let m = 0;
126509                    let f = 0;
126510                    if (p) {
126511                      m = parseFloat(p.getAttribute("x")) || 0;
126512                      f = parseFloat(p.getAttribute("y")) || 0;
126513                    }
126514                    let g = null;
126515                    for (let t = 0; t < a; t++) {
126516                      const e = i[t] ? i[t] : n;
126517                      if (!e) continue;
126518                      let r = e.getAttribute("source");
126519                      r = r.replace(/\\/g, "/");
126520                      if (!g || s) {
126521                        g = new ZOt;
126522                        g.name = h;
126523                        g.firstGid = _ & WOt.FLIPPED_MASK;
126524                        g.tileOffset.x = m;
126525                        g.tileOffset.y = f;
126526                        g.collection = s;
126527                        if (!s) {
126528                          g.imageName = r;
126529                          g.imageSize.width = parseFloat(e.getAttribute("width")) || 0;
126530                          g.imageSize.height = parseFloat(e.getAttribute("height")) || 0;
126531                          g.sourceImage = this._spriteFrameMap[r];
126532                          if (!g.sourceImage) {
126533                            const t = rNt.getNameWithPostfix(r);
126534                            g.imageName = t;
126535                            g.sourceImage = this._spriteFrameMap[t];
126536                            if (!g.sourceImage) {
126537                              const t = rNt.getShortName(r);
126538                              g.imageName = t;
126539                              g.sourceImage = this._spriteFrameMap[t];
126540                              if (!g.sourceImage) {
126541                                console.error(`[error]: ${t} not find in [${Object.keys(this._spriteFrameMap).join(", ")}]`);
126542                                F(7221, r);
126543                                console.warn(`Please try asset type of ${r} to 'sprite-frame'`);
126544                              }
126545                            }
126546                          }
126547                        }
126548                        g.spacing = c;
126549                        g.margin = u;
126550                        g._tileSize.width = d.width;
126551                        g._tileSize.height = d.height;
126552                        this.setTilesets(g);
126553                      }
126554                      l = o && o[t];
126555                      if (!l) continue;
126556                      this.parentGID = _ + (parseInt(l.getAttribute("id")) || 0);
126557                      const a = l.getElementsByTagName("image");
126558                      if (a && a.length > 0) {
126559                        const t = a[0];
126560                        let e = t.getAttribute("source");
126561                        e = e.replace(/\\/g, "/");
126562                        g.imageName = e;
126563                        g.imageSize.width = parseFloat(t.getAttribute("width")) || 0;
126564                        g.imageSize.height = parseFloat(t.getAttribute("height")) || 0;
126565                        g._tileSize.width = g.imageSize.width;
126566                        g._tileSize.height = g.imageSize.height;
126567                        g.sourceImage = this._spriteFrameMap[e];
126568                        if (!g.sourceImage) {
126569                          const t = rNt.getNameWithPostfix(e);
126570                          g.imageName = t;
126571                          g.sourceImage = this._spriteFrameMap[t];
126572                          if (!g.sourceImage) {
126573                            const t = rNt.getShortName(e);
126574                            g.imageName = t;
126575                            g.sourceImage = this._spriteFrameMap[t];
126576                            if (!g.sourceImage) {
126577                              F(7221, e);
126578                              console.warn(`Please try asset type of ${e} to 'sprite-frame'`);
126579                            }
126580                          }
126581                        }
126582                        g.firstGid = this.parentGID & WOt.FLIPPED_MASK;
126583                      }
126584                      const p = (WOt.FLIPPED_MASK & this.parentGID) >>> 0;
126585                      this._tileProperties.set(p, nNt(l));
126586                      const y = l.getElementsByTagName("animation");
126587                      if (y && y.length > 0) {
126588                        const t = y[0].getElementsByTagName("frame");
126589                        const e = {
126590                          frames: [],
126591                          dt: 0,
126592                          frameIdx: 0
126593                        };
126594                        this._tileAnimations.set(p, e);
126595                        const i = e.frames;
126596                        for (let e = 0; e < t.length; e++) {
126597                          const s = t[e];
126598                          const n = _ + (parseInt(s.getAttribute("tileid")) || 0);
126599                          const r = parseFloat(s.getAttribute("duration")) || 0;
126600                          i.push({
126601                            tileid: n,
126602                            duration: r / 1e3,
126603                            grid: null
126604                          });
126605                        }
126606                      }
126607                    }
126608                  }
126609                }
126610                const u = s.childNodes;
126611                for (i = 0; i < u.length; i++) {
126612                  const t = u[i];
126613                  if (!this._shouldIgnoreNode(t)) {
126614                    if ("imagelayer" === t.nodeName) {
126615                      const e = this._parseImageLayer(t);
126616                      e && this.setImageLayers(e);
126617                    }
126618                    if ("layer" === t.nodeName) {
126619                      const e = this._parseLayer(t);
126620                      this.setLayers(e);
126621                    }
126622                    if ("objectgroup" === t.nodeName) {
126623                      const e = this._parseObjectGroup(t);
126624                      this.setObjectGroups(e);
126625                    }
126626                  }
126627                }
126628                return s;
126629              }
126630              _shouldIgnoreNode(t) {
126631                return 3 === t.nodeType || 8 === t.nodeType || 4 === t.nodeType;
126632              }
126633              _parseImageLayer(t) {
126634                const e = t.getElementsByTagName("image");
126635                if (!e || 0 === e.length) return null;
126636                const i = new tNt;
126637                i.name = t.getAttribute("name");
126638                i.offset.x = parseFloat(t.getAttribute("offsetx")) || 0;
126639                i.offset.y = parseFloat(t.getAttribute("offsety")) || 0;
126640                const s = t.getAttribute("visible");
126641                i.visible = !("0" === s);
126642                const n = t.getAttribute("opacity");
126643                i.opacity = n ? Math.round(255 * parseFloat(n)) : 255;
126644                const r = t.getAttribute("tintcolor");
126645                i.tintColor = r ? sNt(r) : null;
126646                const o = e[0];
126647                const a = o.getAttribute("source");
126648                i.sourceImage = this._imageLayerSPF[a];
126649                i.width = parseInt(o.getAttribute("width")) || 0;
126650                i.height = parseInt(o.getAttribute("height")) || 0;
126651                i.trans = sNt(o.getAttribute("trans"));
126652                if (!i.sourceImage) {
126653                  F(7221, a);
126654                  console.warn(`Please try asset type of ${a} to 'sprite-frame'`);
126655                  return null;
126656                }
126657                return i;
126658              }
126659              _parseLayer(t) {
126660                const e = t.getElementsByTagName("data")[0];
126661                const i = new $Ot;
126662                i.name = t.getAttribute("name");
126663                const s = new rs(0, 0);
126664                s.width = parseFloat(t.getAttribute("width"));
126665                s.height = parseFloat(t.getAttribute("height"));
126666                i.layerSize = s;
126667                const n = t.getAttribute("visible");
126668                i.visible = !("0" === n);
126669                const r = t.getAttribute("opacity");
126670                i.opacity = r ? Math.round(255 * parseFloat(r)) : 255;
126671                i.offset = new Qi(parseFloat(t.getAttribute("offsetx")) || 0, parseFloat(t.getAttribute("offsety")) || 0);
126672                const o = t.getAttribute("tintcolor");
126673                i.tintColor = o ? sNt(o) : null;
126674                let a = "";
126675                for (let t = 0; t < e.childNodes.length; t++) a += e.childNodes[t].nodeValue;
126676                a = a.trim();
126677                const l = e.getAttribute("compression");
126678                const h = e.getAttribute("encoding");
126679                if (l && "gzip" !== l && "zlib" !== l) {
126680                  P(7218);
126681                  return null;
126682                }
126683                let c;
126684                switch (l) {
126685                 case "gzip":
126686                  c = Wft.unzipBase64AsArray(a, 4);
126687                  break;
126688
126689                 case "zlib":
126690                  c = function(t) {
126691                    if (t.length % 4 != 0) return null;
126692                    const e = t.length / 4;
126693                    const i = window.Uint32Array ? new Uint32Array(e) : [];
126694                    for (let s = 0; s < e; s++) {
126695                      const e = 4 * s;
126696                      i[s] = t[e] + 256 * t[e + 1] + 65536 * t[e + 2] + t[e + 3] * (1 << 24);
126697                    }
126698                    return i;
126699                  }(new Vft.Inflate(Wft.Base64.decodeAsArray(a, 1)).decompress());
126700                  break;
126701
126702                 case null:
126703                 case "":
126704                  if ("base64" === h) c = Wft.Base64.decodeAsArray(a, 4); else if ("csv" === h) {
126705                    c = [];
126706                    const t = a.split(",");
126707                    for (let e = 0; e < t.length; e++) c.push(parseInt(t[e]));
126708                  } else {
126709                    const t = e.getElementsByTagName("tile");
126710                    c = [];
126711                    for (let e = 0; e < t.length; e++) c.push(parseInt(t[e].getAttribute("gid")));
126712                  }
126713                  break;
126714
126715                 default:
126716                  this.layerAttrs === $Ot.ATTRIB_NONE && P(7219);
126717                }
126718                c && (i.tiles = new Uint32Array(c));
126719                i.properties = nNt(t);
126720                return i;
126721              }
126722              _parseObjectGroup(t) {
126723                const e = new QOt;
126724                e.name = t.getAttribute("name") || "";
126725                e.offset = new Qi(parseFloat(t.getAttribute("offsetx")), parseFloat(t.getAttribute("offsety")));
126726                const i = t.getAttribute("opacity");
126727                e.opacity = i ? Math.round(255 * parseFloat(i)) : 255;
126728                const s = t.getAttribute("tintcolor");
126729                e.tintColor = s ? sNt(s) : null;
126730                const n = t.getAttribute("visible");
126731                n && 0 === parseInt(n) && (e.visible = !1);
126732                const r = t.getAttribute("color");
126733                r && e.color.fromHEX(r);
126734                const o = t.getAttribute("draworder");
126735                o && (e.draworder = o);
126736                e.setProperties(nNt(t));
126737                const a = t.getElementsByTagName("object");
126738                if (a) {
126739                  for (let t = 0; t < a.length; t++) {
126740                    const i = a[t];
126741                    const s = {};
126742                    s.id = i.getAttribute("id") || t;
126743                    s.name = i.getAttribute("name") || "";
126744                    s.width = parseFloat(i.getAttribute("width")) || 0;
126745                    s.height = parseFloat(i.getAttribute("height")) || 0;
126746                    s.x = parseFloat(i.getAttribute("x")) || 0;
126747                    s.y = parseFloat(i.getAttribute("y")) || 0;
126748                    s.rotation = parseFloat(i.getAttribute("rotation")) || 0;
126749                    nNt(i, s);
126750                    const n = i.getAttribute("visible");
126751                    s.visible = !(n && 0 === parseInt(n));
126752                    const r = i.getElementsByTagName("text");
126753                    if (r && r.length > 0) {
126754                      const t = r[0];
126755                      s.type = JOt.TEXT;
126756                      s.wrap = "1" === t.getAttribute("wrap");
126757                      s.color = sNt(t.getAttribute("color"));
126758                      s.halign = eNt(t.getAttribute("halign"));
126759                      s.valign = iNt(t.getAttribute("valign"));
126760                      s.pixelsize = parseInt(t.getAttribute("pixelsize")) || 16;
126761                      s.text = t.childNodes[0].nodeValue;
126762                    }
126763                    const o = i.getAttribute("gid");
126764                    if (o) {
126765                      s.gid = parseInt(o);
126766                      s.type = JOt.IMAGE;
126767                    }
126768                    const l = i.getElementsByTagName("ellipse");
126769                    l && l.length > 0 && (s.type = JOt.ELLIPSE);
126770                    const h = i.getElementsByTagName("polygon");
126771                    if (h && h.length > 0) {
126772                      s.type = JOt.POLYGON;
126773                      const t = h[0].getAttribute("points");
126774                      t && (s.points = this._parsePointsString(t));
126775                    }
126776                    const c = i.getElementsByTagName("polyline");
126777                    if (c && c.length > 0) {
126778                      s.type = JOt.POLYLINE;
126779                      const t = c[0].getAttribute("points");
126780                      t && (s.polylinePoints = this._parsePointsString(t));
126781                    }
126782                    s.type || (s.type = JOt.RECT);
126783                    e.objects.push(s);
126784                  }
126785                  "index" !== o && e.objects.sort(((t, e) => t.y - e.y));
126786                }
126787                return e;
126788              }
126789              _parsePointsString(t) {
126790                if (!t) return null;
126791                const e = [];
126792                const i = t.split(" ");
126793                for (let t = 0; t < i.length; t++) {
126794                  const s = i[t].split(",");
126795                  e.push({
126796                    x: parseFloat(s[0]),
126797                    y: parseFloat(s[1])
126798                  });
126799                }
126800                return e;
126801              }
126802              setTileAnimations(t) {
126803                this._tileAnimations = t;
126804              }
126805              getTileAnimations() {
126806                return this._tileAnimations;
126807              }
126808              getTileProperties() {
126809                return this._tileProperties;
126810              }
126811              setTileProperties(t) {
126812                this._tileProperties = t;
126813              }
126814              getCurrentString() {
126815                return this.currentString;
126816              }
126817              setCurrentString(t) {
126818                this.currentString = t;
126819              }
126820              static getNameWithPostfix(t) {
126821                const e = (t = t.replace(/\\/g, "/")).lastIndexOf("/") + 1;
126822                const i = t.length;
126823                return t.substring(e, i);
126824              }
126825              static getShortName(t) {
126826                const e = (t = t.replace(/\\/g, "/")).lastIndexOf("/") + 1;
126827                let i = t.lastIndexOf(".");
126828                i = i < 0 ? t.length : i;
126829                return t.substring(e, i);
126830              }
126831            }
126832            var oNt, aNt, lNt, hNt, cNt, uNt, _Nt, dNt, pNt, mNt, fNt, gNt, yNt, bNt;
126833            let SNt = t("TiledTile", (oNt = Ul("cc.TiledTile"), aNt = sh(), lNt = $l(), hNt = Gl(jB),
126834            cNt = Th(Oe), uNt = Th(Oe), _Nt = Th(Oe), dNt = Th(Oe), pNt = Th(Oe), oNt(mNt = aNt(mNt = lNt(mNt = hNt(mNt = Ql(mNt = (fNt = (bNt = class extends Qc {
126835              constructor() {
126836                super();
126837                this._layer = null;
126838                Ml(this, "_x", gNt, this);
126839                Ml(this, "_y", yNt, this);
126840              }
126841              get x() {
126842                return this._x;
126843              }
126844              set x(t) {
126845                if (t !== this._x) if (this._layer && this._layer.isInvalidPosition(t, this._y)) C("Invalid x, the valid value is between [%s] ~ [%s]", 0, this._layer.layerSize.width); else {
126846                  this._resetTile();
126847                  this._x = t;
126848                  this.updateInfo();
126849                }
126850              }
126851              get y() {
126852                return this._y;
126853              }
126854              set y(t) {
126855                if (t !== this._y) if (this._layer && this._layer.isInvalidPosition(this._x, t)) C("Invalid y, the valid value is between [%s] ~ [%s]", 0, this._layer.layerSize.height); else {
126856                  this._resetTile();
126857                  this._y = t;
126858                  this.updateInfo();
126859                }
126860              }
126861              get grid() {
126862                return this._layer ? this._layer.getTileGIDAt(this._x, this._y) : 0;
126863              }
126864              set grid(t) {
126865                this._layer && this._layer.setTileGIDAt(t, this._x, this._y);
126866              }
126867              onEnable() {
126868                const t = this.node.parent;
126869                this._layer = t.getComponent("cc.TiledLayer");
126870                this.node.on(ny.TRANSFORM_CHANGED, this._updatePosition, this);
126871                this.node.on(ny.SIZE_CHANGED, this._updatePosition, this);
126872                this._resetTile();
126873                this.updateInfo();
126874              }
126875              onDisable() {
126876                this._resetTile();
126877                this.node.off(ny.TRANSFORM_CHANGED, this._updatePosition, this);
126878                this.node.off(ny.SIZE_CHANGED, this._updatePosition, this);
126879              }
126880              _resetTile() {
126881                this._layer && this._layer.getTiledTileAt(this._x, this._y) === this && this._layer.setTiledTileAt(this._x, this._y, null);
126882              }
126883              updateInfo() {
126884                if (!this._layer) return;
126885                const t = this._x;
126886                const e = this._y;
126887                if (this._layer.getTiledTileAt(t, e)) {
126888                  C("There is already a TiledTile at [%s, %s]", t, e);
126889                  return;
126890                }
126891                const i = this._layer.getPositionAt(t, e);
126892                this.node.setPosition(i.x, i.y);
126893                this._layer.setTiledTileAt(t, e, this);
126894                this._layer.markForUpdateRenderData();
126895              }
126896              _updatePosition() {
126897                this._layer.markForUpdateRenderData();
126898              }
126899            }, bNt), gNt = Bl(fNt.prototype, "_x", [ cNt ], {
126900              configurable: !0,
126901              enumerable: !0,
126902              writable: !0,
126903              initializer: function() {
126904                return 0;
126905              }
126906            }), yNt = Bl(fNt.prototype, "_y", [ uNt ], {
126907              configurable: !0,
126908              enumerable: !0,
126909              writable: !0,
126910              initializer: function() {
126911                return 0;
126912              }
126913            }), Bl(fNt.prototype, "x", [ _Nt ], Object.getOwnPropertyDescriptor(fNt.prototype, "x"), fNt.prototype),
126914            Bl(fNt.prototype, "y", [ dNt ], Object.getOwnPropertyDescriptor(fNt.prototype, "y"), fNt.prototype),
126915            Bl(fNt.prototype, "grid", [ pNt ], Object.getOwnPropertyDescriptor(fNt.prototype, "grid"), fNt.prototype),
126916            fNt)) || mNt) || mNt) || mNt) || mNt) || mNt));
126917            function ANt(t, e, i) {
126918              const s = i || t.sourceImage;
126919              const n = s.texture;
126920              const r = t.collection;
126921              if (!t.imageSize.width || !t.imageSize.height) {
126922                const e = t.sourceImage;
126923                t.imageSize.width = e.width;
126924                t.imageSize.height = e.height;
126925              }
126926              const o = t.imageSize.width;
126927              const a = t.imageSize.height;
126928              const l = t._tileSize.width;
126929              const h = t._tileSize.height;
126930              const c = s.width;
126931              const u = s.height;
126932              const _ = t.spacing;
126933              const d = t.margin;
126934              let p = 1;
126935              if (!r) {
126936                const t = Math.floor((o - 2 * d + _) / (l + _));
126937                const e = Math.floor((a - 2 * d + _) / (h + _));
126938                p = Math.max(1, e * t);
126939              }
126940              const m = t.firstGid;
126941              let f = null;
126942              let g = !!e.get(m);
126943              const y = t.firstGid + p;
126944              let b = m;
126945              for (;b < y; ++b) {
126946                g && !e.get(b) && (g = !1);
126947                if (!g && e.get(b)) break;
126948                f = {
126949                  tileset: t,
126950                  x: 0,
126951                  y: 0,
126952                  width: l,
126953                  height: h,
126954                  t: 0,
126955                  l: 0,
126956                  r: 0,
126957                  b: 0,
126958                  cx: 0,
126959                  cy: 0,
126960                  offsetX: 0,
126961                  offsetY: 0,
126962                  rotated: !1,
126963                  gid: b,
126964                  spriteFrame: s,
126965                  texture: n
126966                };
126967                t.rectForGID(b, f);
126968                if (!i || p > 1) if (i) {
126969                  f._name = i.name;
126970                  const t = i.unbiasUV[0];
126971                  const e = i.rotated ? i.unbiasUV[1] : i.unbiasUV[5];
126972                  f.l = t + (f.x + .5) / c;
126973                  f.t = e + (f.y + .5) / u;
126974                  f.r = t + (f.x + f.width - .5) / c;
126975                  f.b = e + (f.y + f.height - .5) / u;
126976                  f._rect = new as(f.x, f.y, f.width, f.height);
126977                } else {
126978                  f.l = f.x / c;
126979                  f.t = f.y / u;
126980                  f.r = (f.x + f.width) / c;
126981                  f.b = (f.y + f.height) / u;
126982                  f._rect = new as(f.x, f.y, f.width, f.height);
126983                } else if (i.rotated) {
126984                  f._rotated = !0;
126985                  f._name = i.name;
126986                  f._rect = i.getRect();
126987                  f.l = i.unbiasUV[0];
126988                  f.t = i.unbiasUV[1];
126989                  f.r = i.unbiasUV[4];
126990                  f.b = i.unbiasUV[3];
126991                } else {
126992                  f._name = i.name;
126993                  f._rect = i.getRect();
126994                  f.l = i.unbiasUV[0];
126995                  f.t = i.unbiasUV[5];
126996                  f.r = i.unbiasUV[2];
126997                  f.b = i.unbiasUV[1];
126998                }
126999                f.cx = (f.l + f.r) / 2;
127000                f.cy = (f.t + f.b) / 2;
127001                e.set(b, f);
127002              }
127003            }
127004            var TNt, vNt, ENt;
127005            const CNt = new qi;
127006            const xNt = new Qi;
127007            const wNt = new Pi;
127008            const RNt = new Pi;
127009            const INt = {
127010              row: 0,
127011              col: 0
127012            };
127013            let MNt = t("TiledUserNodeData", Ul("cc.TiledUserNodeData")(TNt = class extends Qc {
127014              constructor() {
127015                super();
127016                this._index = -1;
127017                this._row = -1;
127018                this._col = -1;
127019                this._tiledLayer = null;
127020              }
127021            }) || TNt);
127022            let BNt = t("TiledLayer", Ul("cc.TiledLayer")(vNt = (ENt = class t extends uD {
127023              get cullingRect() {
127024                return this._cullingRect;
127025              }
127026              get rightTop() {
127027                return this._rightTop;
127028              }
127029              get layerSize() {
127030                return this._layerSize;
127031              }
127032              get tiledDataArray() {
127033                return this._tiledDataArray;
127034              }
127035              get leftDownToCenterX() {
127036                return this._leftDownToCenterX;
127037              }
127038              get leftDownToCenterY() {
127039                return this._leftDownToCenterY;
127040              }
127041              requestDrawInfo(t) {
127042                if (!this._drawInfoList[t]) {
127043                  this._drawInfoList[t] = new aB;
127044                  this._drawInfoList[t].setDrawInfoType(oB.IA);
127045                }
127046                return this._drawInfoList[t];
127047              }
127048              constructor() {
127049                super();
127050                this._userNodeGrid = {};
127051                this._userNodeMap = {};
127052                this._userNodeDirty = !1;
127053                this.tiledTiles = [];
127054                this._viewPort = {
127055                  x: -1,
127056                  y: -1,
127057                  width: -1,
127058                  height: -1
127059                };
127060                this._cullingRect = {
127061                  leftDown: {
127062                    row: -1,
127063                    col: -1
127064                  },
127065                  rightTop: {
127066                    row: -1,
127067                    col: -1
127068                  }
127069                };
127070                this._cullingDirty = !0;
127071                this._rightTop = {
127072                  row: -1,
127073                  col: -1
127074                };
127075                this._layerInfo = null;
127076                this._mapInfo = null;
127077                this._topOffset = 0;
127078                this._downOffset = 0;
127079                this._leftOffset = 0;
127080                this._rightOffset = 0;
127081                this.tiles = [];
127082                this.vertices = [];
127083                this._verticesDirty = !0;
127084                this._layerName = "";
127085                this._layerSize = void 0;
127086                this._minGID = void 0;
127087                this._maxGID = void 0;
127088                this._layerOrientation = null;
127089                this._opacity = void 0;
127090                this._tintColor = void 0;
127091                this.texGrids = null;
127092                this._textures = [];
127093                this._tilesets = [];
127094                this._leftDownToCenterX = 0;
127095                this._leftDownToCenterY = 0;
127096                this._hasTiledNodeGrid = !1;
127097                this._hasAniGrid = !1;
127098                this._animations = null;
127099                this._enableCulling = void 0;
127100                this.colorChanged = !1;
127101                this._properties = void 0;
127102                this.renderOrder = void 0;
127103                this._staggerAxis = void 0;
127104                this._staggerIndex = void 0;
127105                this._hexSideLength = void 0;
127106                this._mapTileSize = void 0;
127107                this._odd_even = void 0;
127108                this._diffX1 = void 0;
127109                this._diffY1 = void 0;
127110                this._useAutomaticVertexZ = void 0;
127111                this._vertexZvalue = void 0;
127112                this._offset = void 0;
127113                this._tiledDataArray = [];
127114                this._drawInfoList = [];
127115                this._tiledDataArrayIdx = 0;
127116              }
127117              hasTiledNode() {
127118                return this._hasTiledNodeGrid;
127119              }
127120              hasAnimation() {
127121                return this._hasAniGrid;
127122              }
127123              set enableCulling(t) {
127124                if (this._enableCulling !== t) {
127125                  this._enableCulling = t;
127126                  this._cullingDirty = !0;
127127                  this.markForUpdateRenderData();
127128                }
127129              }
127130              get enableCulling() {
127131                return this._enableCulling;
127132              }
127133              addUserNode(t) {
127134                let e = t.getComponent(MNt);
127135                if (e) {
127136                  C("CCTiledLayer:addUserNode node has been added");
127137                  return !1;
127138                }
127139                e = t.addComponent(MNt);
127140                t.parent = this.node;
127141                this._userNodeMap[t.uuid] = e;
127142                e._row = -1;
127143                e._col = -1;
127144                e._tiledLayer = this;
127145                this._nodeLocalPosToLayerPos(t.getPosition(), xNt);
127146                this._positionToRowCol(xNt.x, xNt.y, INt);
127147                this._addUserNodeToGrid(e, INt);
127148                this._updateCullingOffsetByUserNode(t);
127149                t.on(ny.TRANSFORM_CHANGED, this._userNodePosChange, e);
127150                t.on(ny.SIZE_CHANGED, this._userNodeSizeChange, e);
127151                return !0;
127152              }
127153              removeUserNode(t) {
127154                const e = t.getComponent(MNt);
127155                if (!e) {
127156                  C("CCTiledLayer:removeUserNode node is not exist");
127157                  return !1;
127158                }
127159                t.off(ny.TRANSFORM_CHANGED, this._userNodePosChange, e);
127160                t.off(ny.SIZE_CHANGED, this._userNodeSizeChange, e);
127161                this._removeUserNodeFromGrid(e);
127162                delete this._userNodeMap[t.uuid];
127163                t._removeComponent(e);
127164                e.destroy();
127165                t.removeFromParent();
127166                return !0;
127167              }
127168              destroyUserNode(t) {
127169                this.removeUserNode(t);
127170                t.destroy();
127171              }
127172              _nodeLocalPosToLayerPos(t, e) {
127173                e.x = t.x + this._leftDownToCenterX;
127174                e.y = t.y + this._leftDownToCenterY;
127175              }
127176              getNodesByRowCol(t, e) {
127177                const i = this._userNodeGrid[t];
127178                return i ? i[e] : null;
127179              }
127180              getNodesCountByRow(t) {
127181                const e = this._userNodeGrid[t];
127182                return e ? e.count : 0;
127183              }
127184              _updateAllUserNode() {
127185                this._userNodeGrid = {};
127186                for (const t in this._userNodeMap) {
127187                  const e = this._userNodeMap[t];
127188                  this._nodeLocalPosToLayerPos(e.node.getPosition(), xNt);
127189                  this._positionToRowCol(xNt.x, xNt.y, INt);
127190                  this._addUserNodeToGrid(e, INt);
127191                  this._updateCullingOffsetByUserNode(e.node);
127192                }
127193              }
127194              _updateCullingOffsetByUserNode(t) {
127195                const e = t._uiProps.uiTransformComp.contentSize;
127196                this._topOffset < e.height && (this._topOffset = e.height);
127197                this._downOffset < e.height && (this._downOffset = e.height);
127198                this._leftOffset < e.width && (this._leftOffset = e.width);
127199                this._rightOffset < e.width && (this._rightOffset = e.width);
127200              }
127201              _userNodeSizeChange() {
127202                const t = this.node;
127203                const e = this._tiledLayer;
127204                e._updateCullingOffsetByUserNode(t);
127205                e._userNodeDirty = !0;
127206                e.markForUpdateRenderData();
127207              }
127208              _userNodePosChange() {
127209                const t = this;
127210                const e = t.node;
127211                const i = t._tiledLayer;
127212                i._nodeLocalPosToLayerPos(e.getPosition(), xNt);
127213                i._positionToRowCol(xNt.x, xNt.y, INt);
127214                i._limitInLayer(INt);
127215                if (INt.row !== t._row || INt.col !== t._col) {
127216                  i._removeUserNodeFromGrid(t);
127217                  i._addUserNodeToGrid(t, INt);
127218                }
127219              }
127220              _removeUserNodeFromGrid(t) {
127221                const e = t._row;
127222                const i = t._col;
127223                const s = t._index;
127224                const n = this._userNodeGrid[e];
127225                const r = n && n[i];
127226                if (r) {
127227                  n.count--;
127228                  r.count--;
127229                  r.list[s] = null;
127230                  if (r.count <= 0) {
127231                    r.list.length = 0;
127232                    r.count = 0;
127233                  }
127234                }
127235                t._row = -1;
127236                t._col = -1;
127237                t._index = -1;
127238                this._userNodeDirty = !0;
127239                this.markForUpdateRenderData();
127240              }
127241              _limitInLayer(t) {
127242                const e = t.row;
127243                const i = t.col;
127244                e < 0 && (t.row = 0);
127245                e > this._rightTop.row && (t.row = this._rightTop.row);
127246                i < 0 && (t.col = 0);
127247                i > this._rightTop.col && (t.col = this._rightTop.col);
127248              }
127249              _addUserNodeToGrid(t, e) {
127250                const i = e.row;
127251                const s = e.col;
127252                const n = this._userNodeGrid[i] = this._userNodeGrid[i] || {
127253                  count: 0
127254                };
127255                const r = n[s] = n[s] || {
127256                  count: 0,
127257                  list: []
127258                };
127259                t._row = i;
127260                t._col = s;
127261                t._index = r.list.length;
127262                n.count++;
127263                r.count++;
127264                r.list.push(t);
127265                this._userNodeDirty = !0;
127266              }
127267              isUserNodeDirty() {
127268                return this._userNodeDirty;
127269              }
127270              setUserNodeDirty(t) {
127271                this._userNodeDirty = t;
127272              }
127273              onEnable() {
127274                super.onEnable();
127275                this.node.on(ny.ANCHOR_CHANGED, this._syncAnchorPoint, this);
127276                this.node.on(ny.TRANSFORM_CHANGED, this.updateCulling, this);
127277                this.node.on(ny.SIZE_CHANGED, this.updateCulling, this);
127278                this.node.parent.on(ny.TRANSFORM_CHANGED, this.updateCulling, this);
127279                this.node.parent.on(ny.SIZE_CHANGED, this.updateCulling, this);
127280                this.markForUpdateRenderData();
127281                this.scheduleOnce(this.updateCulling.bind(this));
127282              }
127283              onDisable() {
127284                var t, e;
127285                super.onDisable();
127286                null === (t = this.node.parent) || void 0 === t || t.off(ny.SIZE_CHANGED, this.updateCulling, this);
127287                null === (e = this.node.parent) || void 0 === e || e.off(ny.TRANSFORM_CHANGED, this.updateCulling, this);
127288                this.node.off(ny.SIZE_CHANGED, this.updateCulling, this);
127289                this.node.off(ny.TRANSFORM_CHANGED, this.updateCulling, this);
127290                this.node.off(ny.ANCHOR_CHANGED, this._syncAnchorPoint, this);
127291              }
127292              _syncAnchorPoint() {
127293                const t = this.node;
127294                const e = t._uiProps.uiTransformComp;
127295                const i = t.getScale();
127296                this._leftDownToCenterX = e.width * e.anchorX * i.x;
127297                this._leftDownToCenterY = e.height * e.anchorY * i.y;
127298                this._cullingDirty = !0;
127299                this.markForUpdateRenderData();
127300              }
127301              getLayerName() {
127302                return this._layerName;
127303              }
127304              setLayerName(t) {
127305                this._layerName = t;
127306              }
127307              getProperty(t) {
127308                return this._properties[t];
127309              }
127310              getPositionAt(t, e) {
127311                let i;
127312                if (void 0 !== e) {
127313                  i = Math.floor(t);
127314                  e = Math.floor(e);
127315                } else {
127316                  i = Math.floor(t.x);
127317                  e = Math.floor(t.y);
127318                }
127319                switch (this._layerOrientation) {
127320                 case jOt.ORTHO:
127321                  return this._positionForOrthoAt(i, e);
127322
127323                 case jOt.ISO:
127324                  return this._positionForIsoAt(i, e);
127325
127326                 case jOt.HEX:
127327                  return this._positionForHexAt(i, e);
127328                }
127329                return null;
127330              }
127331              isInvalidPosition(t, e) {
127332                return t >= this._layerSize.width || e >= this._layerSize.height || t < 0 || e < 0;
127333              }
127334              _positionForIsoAt(t, e) {
127335                let i = 0;
127336                let s = 0;
127337                const n = Math.floor(t) + Math.floor(e) * this._layerSize.width;
127338                const r = this.tiles[n];
127339                if (r) {
127340                  const t = (r & WOt.FLIPPED_MASK) >>> 0;
127341                  const e = this.texGrids.get(t).tileset.tileOffset;
127342                  i = e.x;
127343                  s = e.y;
127344                }
127345                return new Qi(.5 * this._mapTileSize.width * (this._layerSize.height + t - e - 1) + i, .5 * this._mapTileSize.height * (this._layerSize.width - t + this._layerSize.height - e - 2) - s);
127346              }
127347              _positionForOrthoAt(t, e) {
127348                let i = 0;
127349                let s = 0;
127350                const n = Math.floor(t) + Math.floor(e) * this._layerSize.width;
127351                const r = this.tiles[n];
127352                if (r) {
127353                  const t = (r & WOt.FLIPPED_MASK) >>> 0;
127354                  const e = this.texGrids.get(t).tileset.tileOffset;
127355                  i = e.x;
127356                  s = e.y;
127357                }
127358                return new Qi(t * this._mapTileSize.width + i, (this._layerSize.height - e - 1) * this._mapTileSize.height - s);
127359              }
127360              _positionForHexAt(t, e) {
127361                const i = this._mapTileSize.width;
127362                const s = this._mapTileSize.height;
127363                const n = this._layerSize.height;
127364                const r = Math.floor(t) + Math.floor(e) * this._layerSize.width;
127365                const o = (this.tiles[r] & WOt.FLIPPED_MASK) >>> 0;
127366                let a;
127367                a = this.texGrids.get(o) ? this.texGrids.get(o).tileset.tileOffset : {
127368                  x: 0,
127369                  y: 0
127370                };
127371                const l = this._staggerIndex === qOt.STAGGERINDEX_ODD ? 1 : -1;
127372                let h = 0;
127373                let c = 0;
127374                let u = 0;
127375                let _ = 0;
127376                switch (this._staggerAxis) {
127377                 case YOt.STAGGERAXIS_Y:
127378                  u = 0;
127379                  e % 2 == 1 && (u = i / 2 * l);
127380                  h = t * i + u + a.x;
127381                  c = (n - e - 1) * (s - (s - this._hexSideLength) / 2) - a.y;
127382                  break;
127383
127384                 case YOt.STAGGERAXIS_X:
127385                  _ = 0;
127386                  t % 2 == 1 && (_ = s / 2 * -l);
127387                  h = t * (i - (i - this._hexSideLength) / 2) + a.x;
127388                  c = (n - e - 1) * s + _ - a.y;
127389                }
127390                return new Qi(h, c);
127391              }
127392              setTilesGIDAt(t, e, i, s) {
127393                if (!t || 0 === t.length || s <= 0) return;
127394                i < 0 && (i = 0);
127395                e < 0 && (e = 0);
127396                let n = 0;
127397                const r = e + s;
127398                for (let s = i; ;s++) for (let i = e; i < r; i++) {
127399                  if (n >= t.length) return;
127400                  this._updateTileForGID(t[n], i, s);
127401                  n++;
127402                }
127403              }
127404              setTileGIDAt(t, e, i, s) {
127405                const n = (t & WOt.FLIPPED_MASK) >>> 0;
127406                e = Math.floor(e);
127407                i = Math.floor(i);
127408                if (this.isInvalidPosition(e, i)) throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position");
127409                if (this.tiles && this._tilesets && 0 !== this._tilesets.length) if (0 !== n && n < this._tilesets[0].firstGid) P(7239, t); else {
127410                  s = s || 0;
127411                  this._updateTileForGID((n | s) >>> 0, e, i);
127412                } else P(7238);
127413              }
127414              _updateTileForGID(t, e, i) {
127415                const s = 0 | e + i * this._layerSize.width;
127416                if (s >= this.tiles.length) return;
127417                if (t === this.tiles[s]) return;
127418                const n = (t & WOt.FLIPPED_MASK) >>> 0;
127419                if (this.texGrids.get(n)) {
127420                  this.tiles[s] = t;
127421                  this._updateVertex(e, i);
127422                } else this.tiles[s] = 0;
127423                this._cullingDirty = !0;
127424              }
127425              getTileGIDAt(t, e) {
127426                if (this.isInvalidPosition(t, e)) throw new Error("cc.TiledLayer.getTileGIDAt(): invalid position");
127427                if (!this.tiles) {
127428                  P(7237);
127429                  return null;
127430                }
127431                const i = Math.floor(t) + Math.floor(e) * this._layerSize.width;
127432                return (this.tiles[i] & WOt.FLIPPED_MASK) >>> 0;
127433              }
127434              getTileFlagsAt(t, e) {
127435                if (this.isInvalidPosition(t, e)) throw new Error("TiledLayer.getTileFlagsAt: invalid position");
127436                if (!this.tiles) {
127437                  P(7240);
127438                  return null;
127439                }
127440                const i = Math.floor(t) + Math.floor(e) * this._layerSize.width;
127441                return (this.tiles[i] & WOt.FLIPPED_ALL) >>> 0;
127442              }
127443              setCullingDirty(t) {
127444                this._cullingDirty = t;
127445              }
127446              isCullingDirty() {
127447                return this._cullingDirty;
127448              }
127449              updateViewPort(t, e, i, s) {
127450                if (this._viewPort.width === i && this._viewPort.height === s && this._viewPort.x === t && this._viewPort.y === e) return;
127451                this._viewPort.x = t;
127452                this._viewPort.y = e;
127453                this._viewPort.width = i;
127454                this._viewPort.height = s;
127455                let n = 1;
127456                this._layerOrientation === jOt.ISO && (n = 2);
127457                const r = this._viewPort.x - this._offset.x + this._leftDownToCenterX;
127458                const o = this._viewPort.y - this._offset.y + this._leftDownToCenterY;
127459                let a = r - this._leftOffset;
127460                let l = o - this._downOffset;
127461                const h = r + i + this._rightOffset;
127462                const c = o + s + this._topOffset;
127463                const u = this._cullingRect.leftDown;
127464                const _ = this._cullingRect.rightTop;
127465                a < 0 && (a = 0);
127466                l < 0 && (l = 0);
127467                this._positionToRowCol(a, l, INt);
127468                INt.row -= n;
127469                INt.col -= n;
127470                INt.row = INt.row > 0 ? INt.row : 0;
127471                INt.col = INt.col > 0 ? INt.col : 0;
127472                if (INt.row !== u.row || INt.col !== u.col) {
127473                  u.row = INt.row;
127474                  u.col = INt.col;
127475                  this._cullingDirty = !0;
127476                }
127477                if (h < 0 || c < 0) {
127478                  INt.row = -1;
127479                  INt.col = -1;
127480                } else {
127481                  this._positionToRowCol(h, c, INt);
127482                  INt.row++;
127483                  INt.col++;
127484                }
127485                INt.row > this._rightTop.row && (INt.row = this._rightTop.row);
127486                INt.col > this._rightTop.col && (INt.col = this._rightTop.col);
127487                if (INt.row !== _.row || INt.col !== _.col) {
127488                  _.row = INt.row;
127489                  _.col = INt.col;
127490                  this._cullingDirty = !0;
127491                  this.markForUpdateRenderData();
127492                }
127493              }
127494              _positionToRowCol(t, e, i) {
127495                const s = this._mapTileSize.width;
127496                const n = this._mapTileSize.height;
127497                const r = .5 * s;
127498                const o = .5 * n;
127499                let a = 0;
127500                let l = 0;
127501                let h = 0;
127502                let c = 0;
127503                const u = this._staggerAxis;
127504                switch (this._layerOrientation) {
127505                 case jOt.ORTHO:
127506                  l = Math.floor(t / s);
127507                  a = Math.floor(e / n);
127508                  break;
127509
127510                 case jOt.ISO:
127511                  l = Math.floor(t / r);
127512                  a = Math.floor(e / o);
127513                  break;
127514
127515                 case jOt.HEX:
127516                  if (u === YOt.STAGGERAXIS_Y) {
127517                    a = Math.floor(e / (n - this._diffY1));
127518                    h = a % 2 == 1 ? r * this._odd_even : 0;
127519                    l = Math.floor((t - h) / s);
127520                  } else {
127521                    l = Math.floor(t / (s - this._diffX1));
127522                    c = l % 2 == 1 ? o * -this._odd_even : 0;
127523                    a = Math.floor((e - c) / n);
127524                  }
127525                }
127526                i.row = a;
127527                i.col = l;
127528                return i;
127529              }
127530              updateCulling() {
127531                if (this._enableCulling) {
127532                  this.node.updateWorldTransform();
127533                  qi.invert(CNt, this.node.getWorldMatrix());
127534                  const t = IR.root.batcher2D.getFirstRenderCamera(this.node);
127535                  if (t) {
127536                    wNt.x = 0;
127537                    wNt.y = 0;
127538                    wNt.z = 0;
127539                    RNt.x = t.width;
127540                    RNt.y = t.height;
127541                    RNt.z = 0;
127542                    t.screenToWorld(wNt, wNt);
127543                    t.screenToWorld(RNt, RNt);
127544                    Pi.transformMat4(wNt, wNt, CNt);
127545                    Pi.transformMat4(RNt, RNt, CNt);
127546                    this.updateViewPort(wNt.x, wNt.y, RNt.x - wNt.x, RNt.y - wNt.y);
127547                  }
127548                }
127549              }
127550              getLayerOrientation() {
127551                return this._layerOrientation;
127552              }
127553              getProperties() {
127554                return this._properties;
127555              }
127556              _updateVertex(t, e) {
127557                const i = WOt.FLIPPED_MASK;
127558                const s = this.vertices;
127559                const n = this._layerOrientation;
127560                const r = this.tiles;
127561                if (!r) return;
127562                const o = this._rightTop;
127563                const a = this._mapTileSize.width;
127564                const l = this._mapTileSize.height;
127565                const h = .5 * a;
127566                const c = .5 * l;
127567                const u = this._layerSize.height;
127568                const _ = this._layerSize.width;
127569                const d = this.texGrids;
127570                let p = 0;
127571                let m = 0;
127572                let f;
127573                let g;
127574                let y;
127575                let b;
127576                let S;
127577                let A;
127578                if (n === jOt.HEX) {
127579                  f = this._staggerAxis;
127580                  g = this._diffX1;
127581                  y = this._diffY1;
127582                  b = this._odd_even;
127583                }
127584                let T = 0;
127585                let v = 0;
127586                let E = 0;
127587                let C = 0;
127588                let x = 0;
127589                let w = 0;
127590                let R = 0;
127591                const I = e * _ + t;
127592                E = (r[I] & i) >>> 0;
127593                const M = d.get(E);
127594                if (!M) return;
127595                this._animations.get(E) && (this._hasAniGrid = this._hasAniGrid || !0);
127596                switch (n) {
127597                 case jOt.ORTHO:
127598                  T = t;
127599                  v = u - e - 1;
127600                  p = T * a;
127601                  m = v * l;
127602                  break;
127603
127604                 case jOt.ISO:
127605                  T = u + t - e - 1;
127606                  v = u + _ - t - e - 2;
127607                  p = h * T;
127608                  m = c * v;
127609                  break;
127610
127611                 case jOt.HEX:
127612                  S = f === YOt.STAGGERAXIS_Y && e % 2 == 1 ? h * b : 0;
127613                  A = f === YOt.STAGGERAXIS_X && t % 2 == 1 ? c * -b : 0;
127614                  p = t * (a - g) + S;
127615                  m = (u - e - 1) * (l - y) + A;
127616                  T = t;
127617                  v = u - e - 1;
127618                }
127619                const B = s[v] = s[v] || {
127620                  minCol: 0,
127621                  maxCol: 0
127622                };
127623                const D = B[T] = B[T] || {};
127624                B.minCol > T && (B.minCol = T);
127625                B.maxCol < T && (B.maxCol = T);
127626                if (o.row < v) {
127627                  o.row = v;
127628                  n === jOt.ISO && (o.row += 1);
127629                }
127630                if (o.col < T) {
127631                  o.col = T;
127632                  n === jOt.ISO && (o.col += 1);
127633                }
127634                const P = M.tileset.tileOffset;
127635                p += this._offset.x + P.x + M.offsetX;
127636                m += this._offset.y - P.y - M.offsetY;
127637                C = -P.y + M.tileset._tileSize.height - l;
127638                C = C < 0 ? 0 : C;
127639                x = P.y < 0 ? 0 : P.y;
127640                w = -P.x < 0 ? 0 : -P.x;
127641                R = P.x + M.tileset._tileSize.width - a;
127642                R = R < 0 ? 0 : R;
127643                this._rightOffset < w && (this._rightOffset = w);
127644                this._leftOffset < R && (this._leftOffset = R);
127645                this._topOffset < x && (this._topOffset = x);
127646                this._downOffset < C && (this._downOffset = C);
127647                D.left = p;
127648                D.bottom = m;
127649                D.index = I;
127650                this._cullingDirty = !0;
127651              }
127652              _updateVertices() {
127653                this.vertices.length = 0;
127654                if (!this.tiles) return;
127655                const t = this._rightTop;
127656                t.row = -1;
127657                t.col = -1;
127658                const e = this._layerSize.height;
127659                const i = this._layerSize.width;
127660                this._topOffset = 0;
127661                this._downOffset = 0;
127662                this._leftOffset = 0;
127663                this._rightOffset = 0;
127664                this._hasAniGrid = !1;
127665                for (let t = 0; t < e; ++t) for (let e = 0; e < i; ++e) this._updateVertex(e, t);
127666                this._verticesDirty = !1;
127667              }
127668              getTiledTileAt(t, e, i) {
127669                if (this.isInvalidPosition(t, e)) throw new Error("TiledLayer.getTiledTileAt: invalid position");
127670                if (!this.tiles) {
127671                  P(7236);
127672                  return null;
127673                }
127674                const s = Math.floor(t) + Math.floor(e) * this._layerSize.width;
127675                let n = this.tiledTiles[s];
127676                if (!n && i) {
127677                  const i = new _y;
127678                  n = i.addComponent(SNt);
127679                  n._x = t;
127680                  n._y = e;
127681                  n._layer = this;
127682                  n.updateInfo();
127683                  i.parent = this.node;
127684                  return n;
127685                }
127686                return n;
127687              }
127688              setTiledTileAt(t, e, i) {
127689                if (this.isInvalidPosition(t, e)) throw new Error("TiledLayer.setTiledTileAt: invalid position");
127690                if (!this.tiles) {
127691                  P(7236);
127692                  return null;
127693                }
127694                const s = Math.floor(t) + Math.floor(e) * this._layerSize.width;
127695                this.tiledTiles[s] = i;
127696                this._cullingDirty = !0;
127697                this._hasTiledNodeGrid = !!i || this.tiledTiles.some((t => !!t));
127698                return i;
127699              }
127700              getTexture(t) {
127701                t = t || 0;
127702                return this._textures && t >= 0 && this._textures.length > t ? this._textures[t] : null;
127703              }
127704              getTextures() {
127705                return this._textures;
127706              }
127707              setTexture(t) {
127708                this.setTextures([ t ]);
127709              }
127710              setTextures(t) {
127711                this._textures = t;
127712                this.markForUpdateRenderData();
127713              }
127714              getLayerSize() {
127715                return this._layerSize;
127716              }
127717              getMapTileSize() {
127718                return this._mapTileSize;
127719              }
127720              getTileSet(t) {
127721                t = t || 0;
127722                return this._tilesets && t >= 0 && this._tilesets.length > t ? this._tilesets[t] : null;
127723              }
127724              getTileSets() {
127725                return this._tilesets;
127726              }
127727              setTileSet(t) {
127728                this.setTileSets([ t ]);
127729              }
127730              setTileSets(t) {
127731                this._tilesets = t;
127732                const e = this._textures = [];
127733                const i = this.texGrids;
127734                i.clear();
127735                for (let i = 0; i < t.length; i++) {
127736                  const s = t[i];
127737                  s && (e[i] = s.sourceImage);
127738                }
127739                for (let e = 0, s = t.length; e < s; ++e) {
127740                  const s = t[e];
127741                  s && ANt(s, i, s.sourceImage);
127742                }
127743                this._prepareToRender();
127744              }
127745              init(t, e, i, s, n) {
127746                this._cullingDirty = !0;
127747                this._layerInfo = t;
127748                this._mapInfo = e;
127749                const r = t.layerSize;
127750                this._layerName = t.name;
127751                this.tiles = t.tiles;
127752                this._properties = t.properties;
127753                this._layerSize = r;
127754                this._minGID = t.minGID;
127755                this._maxGID = t.maxGID;
127756                this._opacity = t.opacity;
127757                t.tintColor && (this._tintColor = t.tintColor);
127758                this.renderOrder = e.renderOrder;
127759                this._staggerAxis = e.getStaggerAxis();
127760                this._staggerIndex = e.getStaggerIndex();
127761                this._hexSideLength = e.getHexSideLength();
127762                this._animations = e.getTileAnimations();
127763                this._tilesets = i;
127764                this._textures = s;
127765                this.texGrids = n;
127766                this._layerOrientation = e.orientation;
127767                this._mapTileSize = e.getTileSize();
127768                const o = this._mapTileSize.width;
127769                const a = this._mapTileSize.height;
127770                const l = this._layerSize.width;
127771                const h = this._layerSize.height;
127772                if (this._layerOrientation === jOt.HEX) {
127773                  let t = 0;
127774                  let e = 0;
127775                  this._odd_even = this._staggerIndex === qOt.STAGGERINDEX_ODD ? 1 : -1;
127776                  if (this._staggerAxis === YOt.STAGGERAXIS_X) {
127777                    this._diffX1 = (o - this._hexSideLength) / 2;
127778                    this._diffY1 = 0;
127779                    e = a * (h + .5);
127780                    t = (o + this._hexSideLength) * Math.floor(l / 2) + o * (l % 2);
127781                  } else {
127782                    this._diffX1 = 0;
127783                    this._diffY1 = (a - this._hexSideLength) / 2;
127784                    t = o * (l + .5);
127785                    e = (a + this._hexSideLength) * Math.floor(h / 2) + a * (h % 2);
127786                  }
127787                  this.node._uiProps.uiTransformComp.setContentSize(t, e);
127788                } else if (this._layerOrientation === jOt.ISO) {
127789                  const t = l + h;
127790                  this.node._uiProps.uiTransformComp.setContentSize(.5 * o * t, .5 * a * t);
127791                } else this.node._uiProps.uiTransformComp.setContentSize(l * o, h * a);
127792                this._offset = new Qi(t.offset.x, -t.offset.y);
127793                this._useAutomaticVertexZ = !1;
127794                this._vertexZvalue = 0;
127795                this._syncAnchorPoint();
127796                this._prepareToRender();
127797              }
127798              _prepareToRender() {
127799                this._updateVertices();
127800                this._updateAllUserNode();
127801              }
127802              requestTiledRenderData() {
127803                const t = this._tiledDataArray;
127804                for (;t.length > 0 && t[t.length - 1].subNodes && 0 === t[t.length - 1].subNodes.length; ) t.pop();
127805                if (t.length > 0) {
127806                  const e = t[t.length - 1];
127807                  if (e.renderData && 0 === e.renderData.vertexCount) return e;
127808                }
127809                const e = {
127810                  renderData: null,
127811                  texture: null
127812                };
127813                this._tiledDataArray.push(e);
127814                return e;
127815              }
127816              requestSubNodesData() {
127817                const t = this._tiledDataArray;
127818                if (t.length > 0 && t[t.length - 1].subNodes && 0 === t[t.length - 1].subNodes.length) return t[t.length - 1];
127819                const e = {
127820                  subNodes: []
127821                };
127822                this._tiledDataArray.push(e);
127823                return e;
127824              }
127825              destroyRenderData() {
127826                this._tiledDataArray.forEach((t => {
127827                  const e = t.renderData;
127828                  e && SB.remove(e);
127829                }));
127830                this._tiledDataArray.length = 0;
127831                super.destroyRenderData();
127832              }
127833              _flushAssembler() {
127834                const e = t.Assembler.getAssembler(this);
127835                if (this._assembler !== e) {
127836                  this._assembler = e;
127837                  this._assembler.createData(this);
127838                }
127839                if (0 === this._tiledDataArray.length) {
127840                  this.markForUpdateRenderData();
127841                  this._updateColor();
127842                }
127843              }
127844              _render(t) {
127845                for (let e = 0; e < this._tiledDataArray.length; e++) {
127846                  this._tiledDataArrayIdx = e;
127847                  const i = this._tiledDataArray[e];
127848                  if (i.subNodes) i.subNodes.forEach((e => {
127849                    e && t.walk(e.node);
127850                  })); else {
127851                    const e = i;
127852                    e.texture && t.commitComp(this, e.renderData, e.texture, this._assembler, null);
127853                  }
127854                }
127855                this.node._static = !0;
127856              }
127857              createRenderEntity() {
127858                return new fB(uB.CROSSED);
127859              }
127860              fillIndicesBuffer(t, e) {
127861                const i = t.chunk.meshBuffer.iData;
127862                let s = t.chunk.meshBuffer.indexOffset;
127863                e.setIndexOffset(s);
127864                let n = t.chunk.vertexOffset;
127865                const r = t.vertexCount / 4;
127866                for (let t = 0; t < r; t += 1) {
127867                  i[s] = n;
127868                  i[s + 1] = n + 1;
127869                  i[s + 2] = n + 2;
127870                  i[s + 3] = n + 2;
127871                  i[s + 4] = n + 1;
127872                  i[s + 5] = n + 3;
127873                  s += 6;
127874                  n += 4;
127875                }
127876                t.chunk.meshBuffer.indexOffset = s;
127877                e.setIBCount(6 * r);
127878              }
127879              prepareDrawData() {
127880                this._drawInfoList.length = 0;
127881                const t = this.renderEntity;
127882                t.clearDynamicRenderDrawInfos();
127883                const e = this._tiledDataArray;
127884                let i = 0;
127885                e.forEach((e => {
127886                  if (e.subNodes) e.subNodes.forEach((e => {
127887                    if (e) {
127888                      this._drawInfoList[i] || (this._drawInfoList[i] = new aB);
127889                      const s = this._drawInfoList[i];
127890                      s.setDrawInfoType(oB.SUB_NODE);
127891                      s.setSubNode(e.node);
127892                      t.setDynamicRenderDrawInfo(s, i);
127893                      i++;
127894                    }
127895                  })); else {
127896                    const s = e;
127897                    if (s.texture) {
127898                      this._drawInfoList[i] || (this._drawInfoList[i] = new aB);
127899                      const e = this._drawInfoList[i];
127900                      s.renderData.fillDrawInfoAttributes(e);
127901                      e.setTexture(s.texture.getGFXTexture());
127902                      e.setSampler(s.texture.getGFXSampler());
127903                      e.setMaterial(this.getRenderMaterial(0));
127904                      this.fillIndicesBuffer(s.renderData, e);
127905                      t.setDynamicRenderDrawInfo(e, i);
127906                      i++;
127907                    }
127908                  }
127909                }));
127910              }
127911            }, ENt)) || vNt);
127912            var DNt, PNt, ONt, NNt, LNt, FNt, VNt;
127913            let kNt = t("TiledObjectGroup", (DNt = Ul("cc.TiledObjectGroup"), PNt = sh(), ONt = Gl(jB),
127914            NNt = Th(Le), DNt(LNt = PNt(LNt = ONt(LNt = (FNt = (VNt = class extends Qc {
127915              constructor(...t) {
127916                super(...t);
127917                this._premultiplyAlpha = !1;
127918                this._groupName = void 0;
127919                this._positionOffset = void 0;
127920                this._mapInfo = void 0;
127921                this._properties = void 0;
127922                this._offset = void 0;
127923                this._opacity = void 0;
127924                this._tintColor = null;
127925                this._animations = void 0;
127926                this._hasAniObj = void 0;
127927                this._texGrids = void 0;
127928                this.aniObjects = void 0;
127929                this._objects = [];
127930              }
127931              get premultiplyAlpha() {
127932                return this._premultiplyAlpha;
127933              }
127934              set premultiplyAlpha(t) {
127935                this._premultiplyAlpha = t;
127936              }
127937              getPositionOffset() {
127938                return this._positionOffset;
127939              }
127940              getProperties() {
127941                return this._properties;
127942              }
127943              getGroupName() {
127944                return this._groupName;
127945              }
127946              getProperty(t) {
127947                return this._properties[t.toString()];
127948              }
127949              getObject(t) {
127950                for (let e = 0, i = this._objects.length; e < i; e++) {
127951                  const i = this._objects[e];
127952                  if (i && i.name === t) return i;
127953                }
127954                return null;
127955              }
127956              getObjects() {
127957                return this._objects;
127958              }
127959              get offset() {
127960                return this._offset;
127961              }
127962              _init(t, e, i) {
127963                const s = WOt.FLIPPED_MASK;
127964                const n = WOt.HORIZONTAL;
127965                const r = WOt.VERTICAL;
127966                this._groupName = t.name;
127967                this._positionOffset = t.offset;
127968                this._mapInfo = e;
127969                this._properties = t.getProperties();
127970                this._offset = new Qi(t.offset.x, -t.offset.y);
127971                this._opacity = t.opacity;
127972                t.tintColor && (this._tintColor = t.tintColor);
127973                this._texGrids = i;
127974                this._animations = e.getTileAnimations();
127975                this.aniObjects = [];
127976                this._hasAniObj = !1;
127977                const o = e.mapSize;
127978                const a = e.tileSize;
127979                let l = 0;
127980                let h = 0;
127981                const c = new Bi;
127982                const u = jOt.ISO === e.orientation;
127983                if (e.orientation === jOt.HEX) if (e.getStaggerAxis() === YOt.STAGGERAXIS_X) {
127984                  h = a.height * (o.height + .5);
127985                  l = (a.width + e.getHexSideLength()) * Math.floor(o.width / 2) + a.width * (o.width % 2);
127986                } else {
127987                  l = a.width * (o.width + .5);
127988                  h = (a.height + e.getHexSideLength()) * Math.floor(o.height / 2) + a.height * (o.height % 2);
127989                } else if (u) {
127990                  const t = o.width + o.height;
127991                  l = .5 * a.width * t;
127992                  h = .5 * a.height * t;
127993                } else {
127994                  l = o.width * a.width;
127995                  h = o.height * a.height;
127996                }
127997                const _ = this.node._uiProps.uiTransformComp;
127998                _.setContentSize(l, h);
127999                const d = l * _.anchorX;
128000                const p = h * (1 - _.anchorY);
128001                const m = t.objects;
128002                const f = {};
128003                for (let t = 0, e = m.length; t < e; t++) {
128004                  const e = m[t];
128005                  const l = e.type;
128006                  e.offset = new Qi(e.x, e.y);
128007                  const _ = e.points || e.polylinePoints;
128008                  if (_) for (let t = 0; t < _.length; t++) _[t].y *= -1;
128009                  if (u) {
128010                    const t = e.x / a.height;
128011                    const i = e.y / a.height;
128012                    e.x = .5 * a.width * (o.height + t - i);
128013                    e.y = .5 * a.height * (o.width + o.height - t - i);
128014                  } else e.y = h - e.y;
128015                  if (l === JOt.TEXT) {
128016                    const i = `text${e.id}`;
128017                    f[i] = !0;
128018                    let s = this.node.getChildByName(i);
128019                    s || (s = new _y);
128020                    s.setRotationFromEuler(0, 0, -e.rotation);
128021                    s.setPosition(e.x - d, e.y - p);
128022                    s.name = i;
128023                    s.parent = this.node;
128024                    s.setSiblingIndex(t);
128025                    let n = s.getComponent(IP);
128026                    n || (n = s.addComponent(IP));
128027                    const r = s._uiProps.uiTransformComp;
128028                    s.active = e.visible;
128029                    r.anchorX = 0;
128030                    r.anchorY = 1;
128031                    if (this._tintColor) {
128032                      c.set(this._tintColor);
128033                      c.a *= this._opacity / 255;
128034                      n.color.set(c);
128035                    } else {
128036                      n.color.a *= this._opacity / 255;
128037                    }
128038                    n.overflow = IP.Overflow.SHRINK;
128039                    n.lineHeight = e.height;
128040                    n.string = e.text;
128041                    n.horizontalAlign = e.halign;
128042                    n.verticalAlign = e.valign;
128043                    n.fontSize = e.pixelsize;
128044                    r.setContentSize(e.width, e.height);
128045                  } else if (l === JOt.IMAGE) {
128046                    const o = e.gid;
128047                    const a = (o & s) >>> 0;
128048                    const l = i.get(a);
128049                    if (!l) continue;
128050                    const h = l.tileset;
128051                    const _ = `img${e.id}`;
128052                    f[_] = !0;
128053                    let m = this.node.getChildByName(_);
128054                    e.width = e.width || l.width;
128055                    e.height = e.height || l.height;
128056                    if (m && m._objFlags & co.Flags.HideInHierarchy) {
128057                      m.removeFromParent();
128058                      m.hideFlags |= co.Flags.DontSave;
128059                      m.destroy();
128060                      m = null;
128061                    }
128062                    m || (m = new _y);
128063                    if (this._animations.get(a)) {
128064                      this.aniObjects.push({
128065                        object: e,
128066                        imgNode: m,
128067                        gridGID: a
128068                      });
128069                      this._hasAniObj = !0;
128070                    }
128071                    const g = h.tileOffset.x;
128072                    const y = h.tileOffset.y;
128073                    m.active = e.visible;
128074                    m.setRotationFromEuler(0, 0, -e.rotation);
128075                    m.setPosition(e.x - d, e.y - p);
128076                    m.name = _;
128077                    m.parent = this.node;
128078                    m.setSiblingIndex(t);
128079                    let b = m.getComponent(cL);
128080                    b || (b = m.addComponent(cL));
128081                    const S = m._uiProps.uiTransformComp;
128082                    if (u) {
128083                      S.anchorX = .5 + g / e.width;
128084                      S.anchorY = y / e.height;
128085                    } else {
128086                      S.anchorX = g / e.width;
128087                      S.anchorY = y / e.height;
128088                    }
128089                    if (this._tintColor) {
128090                      c.set(this._tintColor);
128091                      c.a *= this._opacity / 255;
128092                      b.color.set(c);
128093                    } else {
128094                      b.color.a *= this._opacity / 255;
128095                    }
128096                    b.sizeMode = cL.SizeMode.CUSTOM;
128097                    const A = this._premultiplyAlpha ? Ls.ONE : Ls.SRC_ALPHA;
128098                    if (b._srcBlendFactor !== A) {
128099                      b._srcBlendFactor = A;
128100                      b.material && b._updateBlendFunc();
128101                    }
128102                    let T = l.spriteFrame;
128103                    T = T ? T.clone() : new GI;
128104                    (o & n) >>> 0 && (T.flipUVX = !T.flipUVX);
128105                    (o & r) >>> 0 && (T.flipUVY = !T.flipUVY);
128106                    T.rotated = l._rotated;
128107                    T.rect = l._rect;
128108                    b.spriteFrame = T;
128109                    S.setContentSize(e.width, e.height);
128110                    b.markForUpdateRenderData();
128111                  }
128112                }
128113                this._objects = m;
128114                const g = this.node.children;
128115                const y = /^(?:img|text)\d+$/;
128116                for (let t = 0, e = g.length; t < e; t++) {
128117                  const e = g[t];
128118                  const i = e.name;
128119                  y.test(i) && !f[i] && e.destroy();
128120                }
128121              }
128122              update(t) {
128123                if (!this._hasAniObj) return;
128124                const e = this.aniObjects;
128125                const i = this._texGrids;
128126                const s = jOt.ISO === this._mapInfo.orientation;
128127                for (let t = 0, n = e.length; t < n; t++) {
128128                  const n = e[t];
128129                  const r = n.gridGID;
128130                  const o = i.get(r);
128131                  if (!o) continue;
128132                  const a = o.tileset;
128133                  const l = n.object;
128134                  const h = n.imgNode;
128135                  const c = a.tileOffset.x;
128136                  const u = a.tileOffset.y;
128137                  const _ = h._uiProps.uiTransformComp;
128138                  if (s) {
128139                    _.anchorX = .5 + c / l.width;
128140                    _.anchorY = u / l.height;
128141                  } else {
128142                    _.anchorX = c / l.width;
128143                    _.anchorY = u / l.height;
128144                  }
128145                  const d = h.getComponent(cL);
128146                  const p = d.spriteFrame;
128147                  p.rotated = o._rotated;
128148                  p.rect = o._rect;
128149                  d.spriteFrame = p;
128150                  d.markForUpdateRenderData();
128151                }
128152              }
128153            }, VNt), Bl(FNt.prototype, "premultiplyAlpha", [ NNt ], Object.getOwnPropertyDescriptor(FNt.prototype, "premultiplyAlpha"), FNt.prototype),
128154            FNt)) || LNt) || LNt) || LNt));
128155            var UNt, GNt, zNt, HNt, jNt, XNt, WNt, YNt, qNt, KNt, JNt, ZNt, QNt, $Nt, tLt, eLt, iLt, sLt;
128156            let nLt = t("TiledMapAsset", (UNt = Ul("cc.TiledMapAsset"), GNt = Th([ EC ]), zNt = Th([ Fe ]),
128157            HNt = Th([ GI ]), jNt = Th([ GI ]), XNt = Th([ Fe ]), WNt = Th([ Fe ]), YNt = Th([ rs ]),
128158            UNt(qNt = (KNt = class extends gc {
128159              constructor(...t) {
128160                super(...t);
128161                Ml(this, "tmxXmlStr", JNt, this);
128162                Ml(this, "tsxFiles", ZNt, this);
128163                Ml(this, "tsxFileNames", QNt, this);
128164                Ml(this, "spriteFrames", $Nt, this);
128165                Ml(this, "imageLayerSpriteFrame", tLt, this);
128166                Ml(this, "imageLayerSpriteFrameNames", eLt, this);
128167                Ml(this, "spriteFrameNames", iLt, this);
128168                Ml(this, "spriteFrameSizes", sLt, this);
128169              }
128170            }, JNt = Bl(KNt.prototype, "tmxXmlStr", [ Yl ], {
128171              configurable: !0,
128172              enumerable: !0,
128173              writable: !0,
128174              initializer: function() {
128175                return "";
128176              }
128177            }), ZNt = Bl(KNt.prototype, "tsxFiles", [ Yl, GNt ], {
128178              configurable: !0,
128179              enumerable: !0,
128180              writable: !0,
128181              initializer: function() {
128182                return [];
128183              }
128184            }), QNt = Bl(KNt.prototype, "tsxFileNames", [ Yl, zNt ], {
128185              configurable: !0,
128186              enumerable: !0,
128187              writable: !0,
128188              initializer: function() {
128189                return [];
128190              }
128191            }), $Nt = Bl(KNt.prototype, "spriteFrames", [ Yl, HNt ], {
128192              configurable: !0,
128193              enumerable: !0,
128194              writable: !0,
128195              initializer: function() {
128196                return [];
128197              }
128198            }), tLt = Bl(KNt.prototype, "imageLayerSpriteFrame", [ Yl, jNt ], {
128199              configurable: !0,
128200              enumerable: !0,
128201              writable: !0,
128202              initializer: function() {
128203                return [];
128204              }
128205            }), eLt = Bl(KNt.prototype, "imageLayerSpriteFrameNames", [ Yl, XNt ], {
128206              configurable: !0,
128207              enumerable: !0,
128208              writable: !0,
128209              initializer: function() {
128210                return [];
128211              }
128212            }), iLt = Bl(KNt.prototype, "spriteFrameNames", [ Yl, WNt ], {
128213              configurable: !0,
128214              enumerable: !0,
128215              writable: !0,
128216              initializer: function() {
128217                return [];
128218              }
128219            }), sLt = Bl(KNt.prototype, "spriteFrameSizes", [ Yl, YNt ], {
128220              configurable: !0,
128221              enumerable: !0,
128222              writable: !0,
128223              initializer: function() {
128224                return [];
128225              }
128226            }), KNt)) || qNt));
128227            var rLt, oLt, aLt, lLt, hLt, cLt, uLt, _Lt, dLt, pLt, mLt, fLt, gLt;
128228            t("TiledMap", (rLt = Ul("cc.TiledMap"), oLt = sh(), aLt = $l(), lLt = Gl(jB), hLt = Th(nLt),
128229            cLt = ph(), rLt(uLt = oLt(uLt = aLt(uLt = lLt(uLt = Ql(uLt = (_Lt = (gLt = fLt = class extends Qc {
128230              constructor(...t) {
128231                super(...t);
128232                this._texGrids = new Map;
128233                this._textures = [];
128234                this._tilesets = [];
128235                this._animations = new Map;
128236                this._imageLayers = [];
128237                this._layers = [];
128238                this._groups = [];
128239                this._images = [];
128240                this._properties = {};
128241                this._tileProperties = new Map;
128242                this._mapInfo = null;
128243                this._mapSize = new rs(0, 0);
128244                this._tileSize = new rs(0, 0);
128245                this._mapOrientation = jOt.ORTHO;
128246                this._isApplied = !1;
128247                Ml(this, "_tmxFile", dLt, this);
128248                Ml(this, "_enableCulling", pLt, this);
128249                Ml(this, "cleanupImageCache", mLt, this);
128250              }
128251              get tmxAsset() {
128252                return this._tmxFile;
128253              }
128254              set tmxAsset(t) {
128255                if (this._tmxFile !== t) {
128256                  this._tmxFile = t;
128257                  this._applyFile();
128258                  this._isApplied = !0;
128259                }
128260              }
128261              get enableCulling() {
128262                return this._enableCulling;
128263              }
128264              set enableCulling(t) {
128265                this._enableCulling = t;
128266                const e = this._layers;
128267                for (let i = 0; i < e.length; ++i) e[i].enableCulling = t;
128268              }
128269              getMapSize() {
128270                return this._mapSize;
128271              }
128272              getTileSize() {
128273                return this._tileSize;
128274              }
128275              getMapOrientation() {
128276                return this._mapOrientation;
128277              }
128278              getObjectGroups() {
128279                return this._groups;
128280              }
128281              getObjectGroup(t) {
128282                const e = this._groups;
128283                for (let i = 0, s = e.length; i < s; i++) {
128284                  const s = e[i];
128285                  if (s && s.getGroupName() === t) return s;
128286                }
128287                return null;
128288              }
128289              getProperties() {
128290                return this._properties;
128291              }
128292              getLayers() {
128293                return this._layers;
128294              }
128295              getLayer(t) {
128296                const e = this._layers;
128297                for (let i = 0, s = e.length; i < s; i++) {
128298                  const s = e[i];
128299                  if (s && s.getLayerName() === t) return s;
128300                }
128301                return null;
128302              }
128303              _changeLayer(t, e) {
128304                const i = this._layers;
128305                for (let s = 0, n = i.length; s < n; s++) {
128306                  const n = i[s];
128307                  if (n && n.getLayerName() === t) {
128308                    i[s] = e;
128309                    return;
128310                  }
128311                }
128312              }
128313              getProperty(t) {
128314                return this._properties[t.toString()];
128315              }
128316              getPropertiesForGID(t) {
128317                return this._tileProperties.get(t);
128318              }
128319              __preload() {
128320                if (this._tmxFile && !1 === this._isApplied) {
128321                  this._applyFile();
128322                  this._isApplied = !0;
128323                }
128324              }
128325              onEnable() {
128326                this.node.on(ny.ANCHOR_CHANGED, this._syncAnchorPoint, this);
128327              }
128328              onDisable() {
128329                this.node.off(ny.ANCHOR_CHANGED, this._syncAnchorPoint, this);
128330              }
128331              _applyFile() {
128332                const t = [];
128333                const e = {};
128334                const i = this._tmxFile;
128335                if (i) {
128336                  let s = i.spriteFrameNames;
128337                  const n = i.spriteFrameSizes;
128338                  const r = i.spriteFrames;
128339                  const o = {};
128340                  const a = {};
128341                  for (let i = 0; i < s.length; ++i) {
128342                    const l = s[i];
128343                    a[l] = n[i];
128344                    t[i] = r[i];
128345                    const h = t[i];
128346                    if (h) {
128347                      e[h.name] = h;
128348                      o[l] = h;
128349                    }
128350                  }
128351                  const l = {};
128352                  const h = i.imageLayerSpriteFrame;
128353                  s = i.imageLayerSpriteFrameNames;
128354                  for (let t = 0; t < h.length; ++t) l[s[t]] = h[t];
128355                  const c = i.tsxFileNames;
128356                  const u = i.tsxFiles;
128357                  const _ = {};
128358                  for (let t = 0; t < c.length; ++t) c[t].length > 0 && (_[c[t]] = u[t].text);
128359                  const d = new rNt(i.tmxXmlStr, _, o, a, l);
128360                  const p = d.getTilesets();
128361                  p && 0 !== p.length || P(7241);
128362                  this._buildWithMapInfo(d);
128363                } else this._releaseMapInfo();
128364              }
128365              _releaseMapInfo() {
128366                const t = this._layers;
128367                for (let s = 0, n = t.length; s < n; s++) {
128368                  var e, i;
128369                  null === (e = t[s].node.parent) || void 0 === e || e.off(ny.SIZE_CHANGED, t[s].updateCulling, t[s]);
128370                  null === (i = t[s].node.parent) || void 0 === i || i.off(ny.TRANSFORM_CHANGED, t[s].updateCulling, t[s]);
128371                  t[s].node.removeFromParent();
128372                  t[s].node.destroy();
128373                }
128374                t.length = 0;
128375                const s = this._groups;
128376                for (let t = 0, e = s.length; t < e; t++) {
128377                  s[t].node.removeFromParent();
128378                  s[t].node.destroy();
128379                }
128380                s.length = 0;
128381                const n = this._images;
128382                for (let t = 0, e = n.length; t < e; t++) {
128383                  n[t].removeFromParent();
128384                  n[t].destroy();
128385                }
128386                n.length = 0;
128387              }
128388              _syncAnchorPoint() {
128389                const t = this.node._uiProps.uiTransformComp.anchorPoint;
128390                const e = this.node._uiProps.uiTransformComp.width * t.x;
128391                const i = this.node._uiProps.uiTransformComp.height * (1 - t.y);
128392                let s;
128393                let n;
128394                for (s = 0, n = this._layers.length; s < n; s++) {
128395                  this._layers[s].node._uiProps.uiTransformComp.setAnchorPoint(t);
128396                }
128397                for (s = 0, n = this._groups.length; s < n; s++) {
128398                  const t = this._groups[s];
128399                  const n = t.node._uiProps.uiTransformComp;
128400                  n.anchorX = .5;
128401                  n.anchorY = .5;
128402                  const r = t.offset.x - e + n.width * n.anchorX;
128403                  const o = t.offset.y + i - n.height * n.anchorY;
128404                  t.node.setPosition(r, o);
128405                }
128406                for (s = 0, n = this._images.length; s < n; s++) {
128407                  const t = this._images[s]._uiProps.uiTransformComp;
128408                  t.anchorX = .5;
128409                  t.anchorY = .5;
128410                  const n = this._images[s]._offset.x - e + t.width * t.anchorX;
128411                  const r = this._images[s]._offset.y + i - t.height * t.anchorY;
128412                  this._images[s].setPosition(n, r);
128413                }
128414              }
128415              _fillAniGrids(t, e) {
128416                for (const i of e.keys()) {
128417                  const s = e.get(i);
128418                  if (!s) continue;
128419                  const n = s.frames;
128420                  for (let e = 0; e < n.length; e++) {
128421                    const i = n[e];
128422                    i.grid = t.get(i.tileid);
128423                  }
128424                }
128425              }
128426              _buildLayerAndGroup() {
128427                const t = this._tilesets;
128428                const e = this._texGrids;
128429                const i = this._animations;
128430                e.clear();
128431                for (let i = 0, s = t.length; i < s; ++i) {
128432                  const s = t[i];
128433                  s && (s.sourceImage ? ANt(s, e, s.sourceImage) : console.warn(`Can't find the spriteFrame of tilesets ${i}`));
128434                }
128435                this._fillAniGrids(e, i);
128436                let s = this._layers;
128437                let n = this._groups;
128438                let r = this._images;
128439                const o = {};
128440                for (let t = 0, e = s.length; t < e; t++) o[s[t].node.name] = !0;
128441                for (let t = 0, e = n.length; t < e; t++) o[n[t].node.name] = !0;
128442                for (let t = 0, e = r.length; t < e; t++) o[r[t].name] = !0;
128443                s = this._layers = [];
128444                n = this._groups = [];
128445                r = this._images = [];
128446                const a = this._mapInfo;
128447                const l = this.node;
128448                const h = a.getAllChildren();
128449                const c = this._textures;
128450                let u = 0;
128451                let _ = 0;
128452                if (h && h.length > 0) for (let i = 0, d = h.length; i < d; i++) {
128453                  const d = h[i];
128454                  const p = d.name;
128455                  let m = this.node.getChildByName(p);
128456                  o[p] = !1;
128457                  if (!m) {
128458                    m = new _y;
128459                    m.name = p;
128460                    m.layer = l.layer;
128461                    l.addChild(m);
128462                  }
128463                  m.setSiblingIndex(i);
128464                  m.active = d.visible;
128465                  if (d instanceof $Ot) {
128466                    let i = m.getComponent(BNt);
128467                    i || (i = m.addComponent(BNt));
128468                    i.init(d, a, t, c, e);
128469                    i.enableCulling = this._enableCulling;
128470                    d.ownTiles = !1;
128471                    s.push(i);
128472                  } else if (d instanceof QOt) {
128473                    let t = m.getComponent(kNt);
128474                    t || (t = m.addComponent(kNt));
128475                    t._init(d, a, e);
128476                    n.push(t);
128477                  } else if (d instanceof tNt) {
128478                    const t = d.sourceImage;
128479                    m.layerInfo = d;
128480                    m._offset = new Qi(d.offset.x, -d.offset.y);
128481                    let e = m.getComponent(cL);
128482                    e || (e = m.addComponent(cL));
128483                    e.color.a *= d.opacity;
128484                    e.spriteFrame = t;
128485                    let i = t.width;
128486                    let s = t.height;
128487                    if (t.original) {
128488                      i = t.originalSize.width;
128489                      s = t.originalSize.height;
128490                    }
128491                    m._uiProps.uiTransformComp.setContentSize(i, s);
128492                    r.push(m);
128493                  }
128494                  u = Math.max(u, m._uiProps.uiTransformComp.width);
128495                  _ = Math.max(_, m._uiProps.uiTransformComp.height);
128496                }
128497                const d = l.children;
128498                for (let t = 0, e = d.length; t < e; t++) {
128499                  const e = d[t];
128500                  o[e.name] && e.destroy();
128501                }
128502                this.node._uiProps.uiTransformComp.setContentSize(u, _);
128503                this._syncAnchorPoint();
128504              }
128505              _buildWithMapInfo(t) {
128506                this._mapInfo = t;
128507                this._mapSize = t.getMapSize();
128508                this._tileSize = t.getTileSize();
128509                this._mapOrientation = t.orientation;
128510                this._properties = t.properties;
128511                this._tileProperties = t.getTileProperties();
128512                this._imageLayers = t.getImageLayers();
128513                this._animations = t.getTileAnimations();
128514                this._tilesets = t.getTilesets();
128515                const e = this._tilesets;
128516                this._textures.length = 0;
128517                const i = [];
128518                for (let t = 0, s = e.length; t < s; ++t) {
128519                  const s = e[t];
128520                  if (s && s.sourceImage) {
128521                    this._textures[t] = s.sourceImage;
128522                    i.push(s.sourceImage);
128523                  }
128524                }
128525                for (let t = 0; t < this._imageLayers.length; t++) {
128526                  const e = this._imageLayers[t];
128527                  e && e.sourceImage && i.push(e.sourceImage);
128528                }
128529                this._buildLayerAndGroup();
128530                this.cleanupImageCache && this._textures.forEach((t => {
128531                  this.doCleanupImageCache(t);
128532                }));
128533              }
128534              doCleanupImageCache(t) {
128535                if (t._image instanceof HTMLImageElement) {
128536                  t._image.src = "";
128537                  t._image.destroy();
128538                } else Vo.hasFeature(Vo.Feature.IMAGE_BITMAP) && t._image instanceof ImageBitmap && t._image.close && t._image.close();
128539                t._image = null;
128540              }
128541              lateUpdate(t) {
128542                const e = this._animations;
128543                const i = this._texGrids;
128544                for (const s of e.keys()) {
128545                  const n = e.get(s);
128546                  const r = n.frames;
128547                  let o = r[n.frameIdx];
128548                  n.dt += t;
128549                  if (o.duration < n.dt) {
128550                    n.dt = 0;
128551                    n.frameIdx++;
128552                    n.frameIdx >= r.length && (n.frameIdx = 0);
128553                    o = r[n.frameIdx];
128554                  }
128555                  i.set(s, o.grid);
128556                }
128557                const s = this.getLayers();
128558                for (let t = 0, e = s.length; t < e; t++) {
128559                  const e = s[t];
128560                  (e.hasAnimation() || e.node.hasChangedFlags) && e.markForUpdateRenderData();
128561                }
128562              }
128563            }, fLt.Orientation = jOt, fLt.Property = XOt, fLt.TileFlag = WOt, fLt.StaggerAxis = YOt,
128564            fLt.StaggerIndex = qOt, fLt.TMXObjectType = JOt, fLt.RenderOrder = KOt, gLt), dLt = Bl(_Lt.prototype, "_tmxFile", [ Yl ], {
128565              configurable: !0,
128566              enumerable: !0,
128567              writable: !0,
128568              initializer: function() {
128569                return null;
128570              }
128571            }), Bl(_Lt.prototype, "tmxAsset", [ hLt, cLt ], Object.getOwnPropertyDescriptor(_Lt.prototype, "tmxAsset"), _Lt.prototype),
128572            pLt = Bl(_Lt.prototype, "_enableCulling", [ Yl ], {
128573              configurable: !0,
128574              enumerable: !0,
128575              writable: !0,
128576              initializer: function() {
128577                return !0;
128578              }
128579            }), Bl(_Lt.prototype, "enableCulling", [ nh ], Object.getOwnPropertyDescriptor(_Lt.prototype, "enableCulling"), _Lt.prototype),
128580            mLt = Bl(_Lt.prototype, "cleanupImageCache", [ Yl ], {
128581              configurable: !0,
128582              enumerable: !0,
128583              writable: !0,
128584              initializer: function() {
128585                return !0;
128586              }
128587            }), _Lt)) || uLt) || uLt) || uLt) || uLt) || uLt));
128588            const yLt = Math.ceil(10922.5);
128589            const bLt = [];
128590            for (let t = 0; t < 4; t++) bLt.push(new Pi);
128591            const SLt = new qi;
128592            const ALt = new Pi;
128593            const TLt = {
128594              row: 0,
128595              col: 0
128596            };
128597            let vLt = {
128598              x: 0,
128599              y: 0
128600            };
128601            let ELt = {
128602              x: 0,
128603              y: 0
128604            };
128605            let CLt = {
128606              x: 0,
128607              y: 0
128608            };
128609            let xLt = {
128610              x: 0,
128611              y: 0
128612            };
128613            let wLt = 0;
128614            let RLt = 0;
128615            let ILt = 0;
128616            let MLt = 0;
128617            let BLt = null;
128618            let DLt;
128619            let PLt;
128620            let OLt;
128621            let NLt = null;
128622            const LLt = {
128623              ensureAccessor() {
128624                if (!NLt) {
128625                  const t = IR.root.device;
128626                  IR.root.batcher2D;
128627                  NLt = new iB(t, zM, this.vCount);
128628                  IR.on(RR.EVENT_BEFORE_DRAW, (() => {
128629                    NLt.reset();
128630                  }));
128631                }
128632              },
128633              createData(t) {
128634                this.ensureAccessor();
128635              },
128636              fillBuffers(t, e) {
128637                if (!t || 0 === t.tiledDataArray.length) return;
128638                const i = t.tiledDataArray[t._tiledDataArrayIdx].renderData;
128639                const s = i.chunk.meshBuffer.iData;
128640                let n = i.chunk.meshBuffer.indexOffset;
128641                let r = i.chunk.vertexOffset;
128642                const o = i.vertexCount / 4;
128643                for (let t = 0; t < o; t += 1) {
128644                  s[n] = r;
128645                  s[n + 1] = r + 1;
128646                  s[n + 2] = r + 2;
128647                  s[n + 3] = r + 2;
128648                  s[n + 4] = r + 1;
128649                  s[n + 5] = r + 3;
128650                  n += 6;
128651                  r += 4;
128652                }
128653                i.chunk.meshBuffer.indexOffset = n;
128654              },
128655              updateRenderData(t) {
128656                t.updateCulling();
128657                RLt = t.leftDownToCenterX;
128658                ILt = t.leftDownToCenterY;
128659                if (t.colorChanged || t.isCullingDirty() || t.isUserNodeDirty() || t.hasAnimation() || t.hasTiledNode() || t.node.hasChangedFlags) {
128660                  t.colorChanged = !1;
128661                  t.destroyRenderData();
128662                  let e;
128663                  let i;
128664                  if (t.enableCulling) {
128665                    const s = t.cullingRect;
128666                    e = s.leftDown;
128667                    i = s.rightTop;
128668                  } else {
128669                    e = TLt;
128670                    i = t.rightTop;
128671                  }
128672                  switch (t.renderOrder) {
128673                   case KOt.RightDown:
128674                    kLt(e, i, -1, 1, t);
128675                    break;
128676
128677                   case KOt.LeftDown:
128678                    kLt(e, i, -1, -1, t);
128679                    break;
128680
128681                   case KOt.RightUp:
128682                    kLt(e, i, 1, 1, t);
128683                    break;
128684
128685                   case KOt.LeftUp:
128686                   default:
128687                    kLt(e, i, 1, -1, t);
128688                  }
128689                  t.setCullingDirty(!1);
128690                  t.setUserNodeDirty(!1);
128691                }
128692                t.prepareDrawData();
128693              },
128694              updateColor(t) {
128695                const e = t.color;
128696                const i = new Float32Array(4);
128697                i[0] = e.r / 255;
128698                i[1] = e.g / 255;
128699                i[2] = e.b / 255;
128700                i[3] = e.a / 255;
128701                const s = t.tiledDataArray;
128702                for (const t of s) {
128703                  if (!t.renderData) continue;
128704                  const e = t.renderData;
128705                  const s = e.vData;
128706                  for (let t = e.vertexStart, n = e.vertexCount; t < n; t++) s.set(i, 9 * t + 5);
128707                }
128708              }
128709            };
128710            function FLt(t, e) {
128711              if (t._rotated) {
128712                vLt.x = t.r;
128713                vLt.y = t.t;
128714                ELt.x = t.l;
128715                ELt.y = t.t;
128716                CLt.x = t.r;
128717                CLt.y = t.b;
128718                xLt.x = t.l;
128719                xLt.y = t.b;
128720              } else {
128721                vLt.x = t.l;
128722                vLt.y = t.t;
128723                ELt.x = t.l;
128724                ELt.y = t.b;
128725                CLt.x = t.r;
128726                CLt.y = t.t;
128727                xLt.x = t.r;
128728                xLt.y = t.b;
128729              }
128730              let i;
128731              if ((e & WOt.DIAGONAL) >>> 0) {
128732                i = ELt;
128733                ELt = CLt;
128734                CLt = i;
128735              }
128736              if ((e & WOt.HORIZONTAL) >>> 0) {
128737                i = vLt;
128738                vLt = CLt;
128739                CLt = i;
128740                i = ELt;
128741                ELt = xLt;
128742                xLt = i;
128743              }
128744              if ((e & WOt.VERTICAL) >>> 0) {
128745                i = vLt;
128746                vLt = ELt;
128747                ELt = i;
128748                i = CLt;
128749                CLt = xLt;
128750                xLt = i;
128751              }
128752            }
128753            function VLt() {
128754              if (MLt < 1 || !BLt) return;
128755              const t = 4 * MLt;
128756              const e = 6 * MLt;
128757              const i = PLt.requestTiledRenderData();
128758              i.renderData = SB.add(zM, NLt);
128759              i.renderData.drawInfoType = oB.IA;
128760              i.texture = BLt;
128761              const s = i.renderData;
128762              s.resize(t, e);
128763              s.chunk.vb.set(DLt.subarray(0, 9 * t), 0);
128764              MLt = 0;
128765              BLt = null;
128766            }
128767            function kLt(t, e, i, s, n) {
128768              if (e.row < 0 || e.col < 0) return;
128769              PLt = n;
128770              const r = n.node.worldMatrix;
128771              wLt = 0;
128772              const o = n.tiledTiles;
128773              const a = n.texGrids;
128774              const l = n.tiles;
128775              const h = 18;
128776              const c = 27;
128777              const u = n.vertices;
128778              let _;
128779              let d;
128780              let p;
128781              let m;
128782              let f;
128783              let g;
128784              let y;
128785              let b;
128786              let S = 0;
128787              let A = 0;
128788              let T = 0;
128789              let v = 0;
128790              let E = 0;
128791              let C;
128792              let x = 0;
128793              let w = !0;
128794              OLt = FLt;
128795              const R = new Float32Array(4);
128796              R[0] = n.color.r / 255;
128797              R[1] = n.color.g / 255;
128798              R[2] = n.color.b / 255;
128799              R[3] = n.color.a / 255;
128800              if (-1 === i) {
128801                m = e.row;
128802                f = t.row;
128803              } else {
128804                m = t.row;
128805                f = e.row;
128806              }
128807              const I = Math.abs(t.row - e.row) + 1;
128808              const M = Math.abs(e.col - t.col) + 1;
128809              DLt = new Float32Array(I * M * 9 * 4);
128810              MLt = 0;
128811              const B = DLt;
128812              for (;(f - m) * i >= 0; m += i) {
128813                _ = u[m];
128814                x = n.getNodesCountByRow(m);
128815                w = _ && 0 === x;
128816                if (1 === s) {
128817                  d = w && t.col < _.minCol ? _.minCol : t.col;
128818                  p = w && e.col > _.maxCol ? _.maxCol : e.col;
128819                } else {
128820                  d = w && e.col > _.maxCol ? _.maxCol : e.col;
128821                  p = w && t.col < _.minCol ? _.minCol : t.col;
128822                }
128823                for (;(p - d) * s >= 0; d += s) {
128824                  g = _ && _[d];
128825                  if (x > 0) {
128826                    VLt();
128827                    const t = n.requestSubNodesData();
128828                    const e = n.getNodesByRowCol(m, d);
128829                    e && e.count > 0 && (t.subNodes = e.list);
128830                  }
128831                  if (g) {
128832                    S = l[g.index];
128833                    b = a.get((S & WOt.FLIPPED_MASK) >>> 0);
128834                    if (b) {
128835                      if (BLt !== b.texture) {
128836                        VLt();
128837                        BLt = b.texture;
128838                      }
128839                      y = b.tileset._tileSize;
128840                      A = g.left - RLt;
128841                      T = g.bottom - ILt;
128842                      v = A + y.width;
128843                      E = T + y.height;
128844                      C = o[g.index];
128845                      wLt = 4 * MLt * 9;
128846                      if (C) C.node.active && ULt(C.node, R, B, A, v, E, T, false); else {
128847                        bLt[0].x = A;
128848                        bLt[0].y = E;
128849                        bLt[1].x = A;
128850                        bLt[1].y = T;
128851                        bLt[2].x = v;
128852                        bLt[2].y = E;
128853                        bLt[3].x = v;
128854                        bLt[3].y = T;
128855                        bLt[0].transformMat4(r);
128856                        B[wLt] = bLt[0].x;
128857                        B[wLt + 1] = bLt[0].y;
128858                        B[wLt + 2] = bLt[0].z;
128859                        bLt[1].transformMat4(r);
128860                        B[wLt + 9] = bLt[1].x;
128861                        B[wLt + 9 + 1] = bLt[1].y;
128862                        B[wLt + 9 + 2] = bLt[1].z;
128863                        bLt[2].transformMat4(r);
128864                        B[wLt + h] = bLt[2].x;
128865                        B[wLt + h + 1] = bLt[2].y;
128866                        B[wLt + h + 2] = bLt[2].z;
128867                        bLt[3].transformMat4(r);
128868                        B[wLt + c] = bLt[3].x;
128869                        B[wLt + c + 1] = bLt[3].y;
128870                        B[wLt + c + 2] = bLt[3].z;
128871                        B.set(R, wLt + 5);
128872                        B.set(R, wLt + 9 + 5);
128873                        B.set(R, wLt + h + 5);
128874                        B.set(R, wLt + c + 5);
128875                      }
128876                      OLt(b, S);
128877                      B[wLt + 3] = vLt.x;
128878                      B[wLt + 4] = vLt.y;
128879                      B[wLt + 9 + 3] = ELt.x;
128880                      B[wLt + 9 + 4] = ELt.y;
128881                      B[wLt + h + 3] = CLt.x;
128882                      B[wLt + h + 4] = CLt.y;
128883                      B[wLt + c + 3] = xLt.x;
128884                      B[wLt + c + 4] = xLt.y;
128885                      MLt++;
128886                      MLt >= yLt && VLt();
128887                    }
128888                  }
128889                }
128890              }
128891              VLt();
128892            }
128893            function ULt(t, e, i, s, n, r, o, a) {
128894              const l = 18;
128895              const h = 27;
128896              t.updateWorldTransform();
128897              qi.fromRTS(SLt, t.rotation, t.position, t.scale);
128898              Pi.set(ALt, -(s + RLt), -(o + ILt), 0);
128899              qi.transform(SLt, SLt, ALt);
128900              qi.multiply(SLt, t.parent.worldMatrix, SLt);
128901              const c = SLt;
128902              const u = c.m12;
128903              const _ = c.m13;
128904              const d = c.m00;
128905              const p = c.m01;
128906              const m = c.m04;
128907              const f = c.m05;
128908              const g = 1 === d && 0 === p && 0 === m && 1 === f;
128909              if (a) {
128910                const t = (s + n) / 2;
128911                const e = (r + o) / 2;
128912                if (g) {
128913                  i[wLt] = t + u;
128914                  i[wLt + 1] = r + _;
128915                  i[wLt + 9] = s + u;
128916                  i[wLt + 9 + 1] = e + _;
128917                  i[wLt + l] = n + u;
128918                  i[wLt + l + 1] = e + _;
128919                  i[wLt + h] = t + u;
128920                  i[wLt + h + 1] = o + _;
128921                } else {
128922                  i[wLt] = t * d + r * m + u;
128923                  i[wLt + 1] = t * p + r * f + _;
128924                  i[wLt + 9] = s * d + e * m + u;
128925                  i[wLt + 9 + 1] = s * p + e * f + _;
128926                  i[wLt + l] = n * d + e * m + u;
128927                  i[wLt + l + 1] = n * p + e * f + _;
128928                  i[wLt + h] = t * d + o * m + u;
128929                  i[wLt + h + 1] = t * p + o * f + _;
128930                }
128931              } else if (g) {
128932                i[wLt] = s + u;
128933                i[wLt + 1] = r + _;
128934                i[wLt + 9] = s + u;
128935                i[wLt + 9 + 1] = o + _;
128936                i[wLt + l] = n + u;
128937                i[wLt + l + 1] = r + _;
128938                i[wLt + h] = n + u;
128939                i[wLt + h + 1] = o + _;
128940              } else {
128941                i[wLt] = s * d + r * m + u;
128942                i[wLt + 1] = s * p + r * f + _;
128943                i[wLt + 9] = s * d + o * m + u;
128944                i[wLt + 9 + 1] = s * p + o * f + _;
128945                i[wLt + l] = n * d + r * m + u;
128946                i[wLt + l + 1] = n * p + r * f + _;
128947                i[wLt + h] = n * d + o * m + u;
128948                i[wLt + h + 1] = n * p + o * f + _;
128949              }
128950              i.set(e, wLt + 5);
128951              i.set(e, wLt + 9 + 5);
128952              i.set(e, wLt + l + 5);
128953              i.set(e, wLt + h + 5);
128954            }
128955            const GLt = t("tiledLayerAssembler", {
128956              getAssembler: () => LLt
128957            });
128958            BNt.Assembler = GLt;
128959            class zLt {
128960              constructor() {
128961                this.originalTarget = null;
128962                this.target = null;
128963                this.tag = zLt.TAG_INVALID;
128964              }
128965              clone() {
128966                const t = new zLt;
128967                t.originalTarget = null;
128968                t.target = null;
128969                t.tag = this.tag;
128970                return t;
128971              }
128972              isDone() {
128973                return !0;
128974              }
128975              startWithTarget(t) {
128976                this.originalTarget = t;
128977                this.target = t;
128978              }
128979              stop() {
128980                this.target = null;
128981              }
128982              step(t) {
128983                P(1006);
128984              }
128985              update(t) {
128986                P(1007);
128987              }
128988              getTarget() {
128989                return this.target;
128990              }
128991              setTarget(t) {
128992                this.target = t;
128993              }
128994              getOriginalTarget() {
128995                return this.originalTarget;
128996              }
128997              setOriginalTarget(t) {
128998                this.originalTarget = t;
128999              }
129000              getTag() {
129001                return this.tag;
129002              }
129003              setTag(t) {
129004                this.tag = t;
129005              }
129006              reverse() {
129007                P(1008);
129008                return null;
129009              }
129010              retain() {}
129011              release() {}
129012            }
129013            zLt.TAG_INVALID = -1;
129014            class HLt extends zLt {
129015              constructor(...t) {
129016                super(...t);
129017                this._duration = 0;
129018                this._timesForRepeat = 1;
129019              }
129020              getDuration() {
129021                return this._duration * (this._timesForRepeat || 1);
129022              }
129023              setDuration(t) {
129024                this._duration = t;
129025              }
129026              clone() {
129027                return new HLt;
129028              }
129029            }
129030            let jLt = 0;
129031            class XLt {
129032              constructor() {
129033                this.actions = [];
129034                this.target = null;
129035                this.actionIndex = 0;
129036                this.currentAction = null;
129037                this.paused = !1;
129038                this.lock = !1;
129039              }
129040            }
129041            class WLt {
129042              constructor() {
129043                this._hashTargets = new Map;
129044                this._arrayTargets = [];
129045                this._elementPool = [];
129046              }
129047              _searchElementByTarget(t, e) {
129048                for (let i = 0; i < t.length; i++) if (e === t[i].target) return t[i];
129049                return null;
129050              }
129051              _getElement(t, e) {
129052                let i = this._elementPool.pop();
129053                i || (i = new XLt);
129054                i.target = t;
129055                i.paused = !!e;
129056                return i;
129057              }
129058              _putElement(t) {
129059                t.actions.length = 0;
129060                t.actionIndex = 0;
129061                t.currentAction = null;
129062                t.paused = !1;
129063                t.target = null;
129064                t.lock = !1;
129065                this._elementPool.push(t);
129066              }
129067              addAction(t, e, i) {
129068                if (!t || !e) {
129069                  F(1e3);
129070                  return;
129071                }
129072                null == e.uuid && (e.uuid = "_TWEEN_UUID_" + jLt++);
129073                let s = this._hashTargets.get(e);
129074                if (s) s.actions || (s.actions = []); else {
129075                  s = this._getElement(e, i);
129076                  this._hashTargets.set(e, s);
129077                  this._arrayTargets.push(s);
129078                }
129079                s.target = e;
129080                s.actions.push(t);
129081                t.startWithTarget(e);
129082              }
129083              removeAllActions() {
129084                const t = this._arrayTargets;
129085                for (let e = 0; e < t.length; e++) {
129086                  const i = t[e];
129087                  i && this._putElement(i);
129088                }
129089                this._arrayTargets.length = 0;
129090                this._hashTargets = new Map;
129091              }
129092              removeAllActionsFromTarget(t) {
129093                if (null == t) return;
129094                const e = this._hashTargets.get(t);
129095                if (e) {
129096                  e.actions.length = 0;
129097                  this._deleteHashElement(e);
129098                }
129099              }
129100              removeAction(t) {
129101                if (null == t) return;
129102                const e = t.getOriginalTarget();
129103                const i = this._hashTargets.get(e);
129104                if (i) for (let e = 0; e < i.actions.length; e++) if (i.actions[e] === t) {
129105                  i.actions.splice(e, 1);
129106                  i.actionIndex >= e && i.actionIndex--;
129107                  break;
129108                }
129109              }
129110              _removeActionByTag(t, e, i) {
129111                for (let s = 0, n = e.actions.length; s < n; ++s) {
129112                  const n = e.actions[s];
129113                  if (n && n.getTag() === t) {
129114                    if (i && n.getOriginalTarget() !== i) continue;
129115                    this._removeActionAtIndex(s, e);
129116                    break;
129117                  }
129118                }
129119              }
129120              _removeAllActionsByTag(t, e, i) {
129121                for (let s = e.actions.length - 1; s >= 0; --s) {
129122                  const n = e.actions[s];
129123                  if (n && n.getTag() === t) {
129124                    if (i && n.getOriginalTarget() !== i) continue;
129125                    this._removeActionAtIndex(s, e);
129126                  }
129127                }
129128              }
129129              removeActionByTag(t, e) {
129130                t === zLt.TAG_INVALID && P(1002);
129131                const i = this._hashTargets;
129132                if (e) {
129133                  const s = i.get(e);
129134                  s && this._removeActionByTag(t, s, e);
129135                } else i.forEach((e => {
129136                  this._removeActionByTag(t, e);
129137                }));
129138              }
129139              removeAllActionsByTag(t, e) {
129140                t === zLt.TAG_INVALID && P(1002);
129141                const i = this._hashTargets;
129142                if (e) {
129143                  const s = i.get(e);
129144                  s && this._removeAllActionsByTag(t, s, e);
129145                } else i.forEach((e => {
129146                  this._removeAllActionsByTag(t, e);
129147                }));
129148              }
129149              getActionByTag(t, e) {
129150                t === zLt.TAG_INVALID && P(1004);
129151                const i = this._hashTargets.get(e);
129152                if (i) {
129153                  if (null != i.actions) for (let e = 0; e < i.actions.length; ++e) {
129154                    const s = i.actions[e];
129155                    if (s && s.getTag() === t) return s;
129156                  }
129157                  P(1005, t);
129158                }
129159                return null;
129160              }
129161              getNumberOfRunningActionsInTarget(t) {
129162                const e = this._hashTargets.get(t);
129163                return e && e.actions ? e.actions.length : 0;
129164              }
129165              pauseTarget(t) {
129166                const e = this._hashTargets.get(t);
129167                e && (e.paused = !0);
129168              }
129169              resumeTarget(t) {
129170                const e = this._hashTargets.get(t);
129171                e && (e.paused = !1);
129172              }
129173              pauseAllRunningActions() {
129174                const t = [];
129175                const e = this._arrayTargets;
129176                for (let i = 0; i < e.length; i++) {
129177                  const s = e[i];
129178                  if (s && !s.paused) {
129179                    s.paused = !0;
129180                    t.push(s.target);
129181                  }
129182                }
129183                return t;
129184              }
129185              resumeTargets(t) {
129186                if (t) for (let e = 0; e < t.length; e++) t[e] && this.resumeTarget(t[e]);
129187              }
129188              pauseTargets(t) {
129189                if (t) for (let e = 0; e < t.length; e++) t[e] && this.pauseTarget(t[e]);
129190              }
129191              purgeSharedManager() {
129192                m.director.getScheduler().unscheduleUpdate(this);
129193              }
129194              _removeActionAtIndex(t, e) {
129195                e.actions[t];
129196                e.actions.splice(t, 1);
129197                e.actionIndex >= t && e.actionIndex--;
129198                0 === e.actions.length && this._deleteHashElement(e);
129199              }
129200              _deleteHashElement(t) {
129201                let e = !1;
129202                if (t && !t.lock && this._hashTargets.get(t.target)) {
129203                  this._hashTargets.delete(t.target);
129204                  const i = this._arrayTargets;
129205                  for (let e = 0, s = i.length; e < s; e++) if (i[e] === t) {
129206                    i.splice(e, 1);
129207                    break;
129208                  }
129209                  this._putElement(t);
129210                  e = !0;
129211                }
129212                return e;
129213              }
129214              update(t) {
129215                const e = this._arrayTargets;
129216                let i;
129217                for (let s = 0; s < e.length; s++) {
129218                  this._currentTarget = e[s];
129219                  i = this._currentTarget;
129220                  const n = i.target;
129221                  if (!_o(n) || n.isValid) {
129222                    if (!i.paused && i.actions) {
129223                      i.lock = !0;
129224                      for (i.actionIndex = 0; i.actionIndex < i.actions.length; i.actionIndex++) {
129225                        i.currentAction = i.actions[i.actionIndex];
129226                        if (i.currentAction) {
129227                          i.currentAction.step(t * (i.currentAction._speedMethod ? i.currentAction._speed : 1));
129228                          if (i.currentAction && i.currentAction.isDone()) {
129229                            i.currentAction.stop();
129230                            const t = i.currentAction;
129231                            i.currentAction = null;
129232                            this.removeAction(t);
129233                          }
129234                          i.currentAction = null;
129235                        }
129236                      }
129237                      i.lock = !1;
129238                    }
129239                    0 === i.actions.length && this._deleteHashElement(i) && s--;
129240                  } else {
129241                    this.removeAllActionsFromTarget(n);
129242                    s--;
129243                  }
129244                }
129245              }
129246            }
129247            class YLt extends Tg {
129248              constructor(...t) {
129249                super(...t);
129250                this.actionMgr = new WLt;
129251              }
129252              get ActionManager() {
129253                return this.actionMgr;
129254              }
129255              update(t) {
129256                this.actionMgr.update(t);
129257              }
129258            }
129259            t("TweenSystem", YLt);
129260            YLt.ID = "TWEEN";
129261            YLt.instance = void 0;
129262            IR.on(RR.EVENT_INIT, (() => {
129263              const t = new YLt;
129264              YLt.instance = t;
129265              IR.registerSystem(YLt.ID, t, Tg.Priority.MEDIUM);
129266            }));
129267            class qLt extends HLt {
129268              isDone() {
129269                return !0;
129270              }
129271              step(t) {
129272                this.update(1);
129273              }
129274              update(t) {}
129275              reverse() {
129276                return this.clone();
129277              }
129278              clone() {
129279                return new qLt;
129280              }
129281            }
129282            class KLt extends qLt {
129283              update(t) {
129284                const e = this.target.getComponentsInChildren(vS);
129285                for (let t = 0; t < e.length; ++t) {
129286                  e[t].enabled = !0;
129287                }
129288              }
129289              reverse() {
129290                return new JLt;
129291              }
129292              clone() {
129293                return new KLt;
129294              }
129295            }
129296            class JLt extends qLt {
129297              update(t) {
129298                const e = this.target.getComponentsInChildren(vS);
129299                for (let t = 0; t < e.length; ++t) {
129300                  e[t].enabled = !1;
129301                }
129302              }
129303              reverse() {
129304                return new KLt;
129305              }
129306              clone() {
129307                return new JLt;
129308              }
129309            }
129310            class ZLt extends qLt {
129311              constructor(t) {
129312                super();
129313                this._isNeedCleanUp = !0;
129314                void 0 !== t && this.init(t);
129315              }
129316              update(t) {
129317                this.target.removeFromParent();
129318                this._isNeedCleanUp && this.target.destroy();
129319              }
129320              init(t) {
129321                this._isNeedCleanUp = t;
129322                return !0;
129323              }
129324              reverse() {
129325                return new ZLt(this._isNeedCleanUp);
129326              }
129327              clone() {
129328                return new ZLt(this._isNeedCleanUp);
129329              }
129330            }
129331            class QLt extends qLt {
129332              constructor(t, e, i) {
129333                super();
129334                this._selectorTarget = null;
129335                this._function = null;
129336                this._data = null;
129337                this.initWithFunction(t, e, i);
129338              }
129339              initWithFunction(t, e, i) {
129340                t && (this._function = t);
129341                e && (this._selectorTarget = e);
129342                void 0 !== i && (this._data = i);
129343                return !0;
129344              }
129345              execute() {
129346                this._function && this._function.call(this._selectorTarget, this.target, this._data);
129347              }
129348              update(t) {
129349                this.execute();
129350              }
129351              getTargetCallback() {
129352                return this._selectorTarget;
129353              }
129354              setTargetCallback(t) {
129355                if (t !== this._selectorTarget) {
129356                  this._selectorTarget && (this._selectorTarget = null);
129357                  this._selectorTarget = t;
129358                }
129359              }
129360              clone() {
129361                const t = new QLt;
129362                t.initWithFunction(this._function, this._selectorTarget, this._data);
129363                return t;
129364              }
129365            }
129366            class $Lt extends HLt {
129367              constructor(t) {
129368                super();
129369                this.MAX_VALUE = 2;
129370                this._elapsed = 0;
129371                this._firstTick = !1;
129372                this._easeList = [];
129373                this._speed = 1;
129374                this._repeatForever = !1;
129375                this._repeatMethod = !1;
129376                this._speedMethod = !1;
129377                void 0 === t || isNaN(t) || this.initWithDuration(t);
129378              }
129379              getElapsed() {
129380                return this._elapsed;
129381              }
129382              initWithDuration(t) {
129383                this._duration = 0 === t ? pe.FLT_EPSILON : t;
129384                this._elapsed = 0;
129385                this._firstTick = !0;
129386                return !0;
129387              }
129388              isDone() {
129389                return this._elapsed >= this._duration;
129390              }
129391              _cloneDecoration(t) {
129392                t._repeatForever = this._repeatForever;
129393                t._speed = this._speed;
129394                t._timesForRepeat = this._timesForRepeat;
129395                t._easeList = this._easeList;
129396                t._speedMethod = this._speedMethod;
129397                t._repeatMethod = this._repeatMethod;
129398              }
129399              _reverseEaseList(t) {
129400                if (this._easeList) {
129401                  t._easeList = [];
129402                  for (let e = 0; e < this._easeList.length; e++) t._easeList.push(this._easeList[e]);
129403                }
129404              }
129405              clone() {
129406                const t = new $Lt(this._duration);
129407                this._cloneDecoration(t);
129408                return t;
129409              }
129410              easing(t) {
129411                this._easeList ? this._easeList.length = 0 : this._easeList = [];
129412                for (let t = 0; t < arguments.length; t++) this._easeList.push(arguments[t]);
129413                return this;
129414              }
129415              _computeEaseTime(t) {
129416                return t;
129417              }
129418              step(t) {
129419                if (this._firstTick) {
129420                  this._firstTick = !1;
129421                  this._elapsed = 0;
129422                } else this._elapsed += t;
129423                let e = this._elapsed / (this._duration > 1.192092896e-7 ? this._duration : 1.192092896e-7);
129424                e = e < 1 ? e : 1;
129425                this.update(e > 0 ? e : 0);
129426                if (this._repeatMethod && this._timesForRepeat > 1 && this.isDone()) {
129427                  this._repeatForever || this._timesForRepeat--;
129428                  this.startWithTarget(this.target);
129429                  this.step(this._elapsed - this._duration);
129430                }
129431              }
129432              startWithTarget(t) {
129433                zLt.prototype.startWithTarget.call(this, t);
129434                this._elapsed = 0;
129435                this._firstTick = !0;
129436              }
129437              reverse() {
129438                P(1010);
129439                return this;
129440              }
129441              setAmplitudeRate(t) {
129442                P(1011);
129443              }
129444              getAmplitudeRate() {
129445                P(1012);
129446                return 0;
129447              }
129448              speed(t) {
129449                if (t <= 0) {
129450                  P(1013);
129451                  return this;
129452                }
129453                this._speedMethod = !0;
129454                this._speed *= t;
129455                return this;
129456              }
129457              getSpeed() {
129458                return this._speed;
129459              }
129460              setSpeed(t) {
129461                this._speed = t;
129462                return this;
129463              }
129464              repeat(t) {
129465                t = Math.round(t);
129466                if (isNaN(t) || t < 1) {
129467                  P(1014);
129468                  return this;
129469                }
129470                this._repeatMethod = !0;
129471                this._timesForRepeat *= t;
129472                return this;
129473              }
129474              repeatForever() {
129475                this._repeatMethod = !0;
129476                this._timesForRepeat = this.MAX_VALUE;
129477                this._repeatForever = !0;
129478                return this;
129479              }
129480            }
129481            class tFt extends $Lt {
129482              constructor(t) {
129483                super();
129484                this._actions = [];
129485                this._split = 0;
129486                this._last = 0;
129487                this._reversed = !1;
129488                const e = t instanceof Array ? t : arguments;
129489                if (1 === e.length) {
129490                  F(1019);
129491                  return;
129492                }
129493                const i = e.length - 1;
129494                i >= 0 && null == e[i] && P(1015);
129495                if (i >= 0) {
129496                  let t = e[0];
129497                  let s;
129498                  for (let n = 1; n < i; n++) if (e[n]) {
129499                    s = t;
129500                    t = tFt._actionOneTwo(s, e[n]);
129501                  }
129502                  this.initWithTwoActions(t, e[i]);
129503                }
129504              }
129505              initWithTwoActions(t, e) {
129506                if (!t || !e) {
129507                  F(1025);
129508                  return !1;
129509                }
129510                let i = t._duration;
129511                let s = e._duration;
129512                i *= t._repeatMethod ? t._timesForRepeat : 1;
129513                s *= e._repeatMethod ? e._timesForRepeat : 1;
129514                const n = i + s;
129515                this.initWithDuration(n);
129516                this._actions[0] = t;
129517                this._actions[1] = e;
129518                return !0;
129519              }
129520              clone() {
129521                const t = new tFt;
129522                this._cloneDecoration(t);
129523                t.initWithTwoActions(this._actions[0].clone(), this._actions[1].clone());
129524                return t;
129525              }
129526              startWithTarget(t) {
129527                $Lt.prototype.startWithTarget.call(this, t);
129528                this._split = this._actions[0]._duration / this._duration;
129529                this._split *= this._actions[0]._repeatMethod ? this._actions[0]._timesForRepeat : 1;
129530                this._last = -1;
129531              }
129532              stop() {
129533                -1 !== this._last && this._actions[this._last].stop();
129534                zLt.prototype.stop.call(this);
129535              }
129536              update(t) {
129537                let e;
129538                let i = 0;
129539                const s = this._split;
129540                const n = this._actions;
129541                const r = this._last;
129542                let o;
129543                if ((t = this._computeEaseTime(t)) < s) {
129544                  e = 0 !== s ? t / s : 1;
129545                  if (0 === i && 1 === r && this._reversed) {
129546                    n[1].update(0);
129547                    n[1].stop();
129548                  }
129549                } else {
129550                  i = 1;
129551                  e = 1 === s ? 1 : (t - s) / (1 - s);
129552                  if (-1 === r) {
129553                    n[0].startWithTarget(this.target);
129554                    n[0].update(1);
129555                    n[0].stop();
129556                  }
129557                  if (0 === r) {
129558                    n[0].update(1);
129559                    n[0].stop();
129560                  }
129561                }
129562                o = n[i];
129563                if (r !== i || !o.isDone()) {
129564                  r !== i && o.startWithTarget(this.target);
129565                  e *= o._timesForRepeat;
129566                  o.update(e > 1 ? e % 1 : e);
129567                  this._last = i;
129568                }
129569              }
129570              reverse() {
129571                const t = tFt._actionOneTwo(this._actions[1].reverse(), this._actions[0].reverse());
129572                this._cloneDecoration(t);
129573                this._reverseEaseList(t);
129574                t._reversed = !0;
129575                return t;
129576              }
129577            }
129578            tFt._actionOneTwo = function(t, e) {
129579              const i = new tFt;
129580              i.initWithTwoActions(t, e);
129581              return i;
129582            };
129583            function eFt(t) {
129584              const e = t instanceof Array ? t : arguments;
129585              if (1 === e.length) {
129586                F(1019);
129587                return null;
129588              }
129589              const i = e.length - 1;
129590              i >= 0 && null == e[i] && P(1015);
129591              let s = null;
129592              if (i >= 0) {
129593                s = e[0];
129594                for (let t = 1; t <= i; t++) e[t] && (s = tFt._actionOneTwo(s, e[t]));
129595              }
129596              return s;
129597            }
129598            class iFt extends $Lt {
129599              constructor(t, e) {
129600                super();
129601                this._times = 0;
129602                this._total = 0;
129603                this._nextDt = 0;
129604                this._actionInstant = !1;
129605                this._innerAction = null;
129606                void 0 !== e && this.initWithAction(t, e);
129607              }
129608              initWithAction(t, e) {
129609                const i = t._duration * e;
129610                if (this.initWithDuration(i)) {
129611                  this._times = e;
129612                  this._innerAction = t;
129613                  if (t instanceof qLt) {
129614                    this._actionInstant = !0;
129615                    this._times -= 1;
129616                  }
129617                  this._total = 0;
129618                  return !0;
129619                }
129620                return !1;
129621              }
129622              clone() {
129623                const t = new iFt;
129624                this._cloneDecoration(t);
129625                t.initWithAction(this._innerAction.clone(), this._times);
129626                return t;
129627              }
129628              startWithTarget(t) {
129629                this._total = 0;
129630                this._nextDt = this._innerAction._duration / this._duration;
129631                $Lt.prototype.startWithTarget.call(this, t);
129632                this._innerAction.startWithTarget(t);
129633              }
129634              stop() {
129635                this._innerAction.stop();
129636                zLt.prototype.stop.call(this);
129637              }
129638              update(t) {
129639                t = this._computeEaseTime(t);
129640                const e = this._innerAction;
129641                const i = this._duration;
129642                const s = this._times;
129643                let n = this._nextDt;
129644                if (t >= n) {
129645                  for (;t > n && this._total < s; ) {
129646                    e.update(1);
129647                    this._total++;
129648                    e.stop();
129649                    e.startWithTarget(this.target);
129650                    n += e._duration / i;
129651                    this._nextDt = n > 1 ? 1 : n;
129652                  }
129653                  if (t >= 1 && this._total < s) {
129654                    e.update(1);
129655                    this._total++;
129656                  }
129657                  this._actionInstant || (this._total === s ? e.stop() : e.update(t - (n - e._duration / i)));
129658                } else e.update(t * s % 1);
129659              }
129660              isDone() {
129661                return this._total === this._times;
129662              }
129663              reverse() {
129664                const t = new iFt(this._innerAction.reverse(), this._times);
129665                this._cloneDecoration(t);
129666                this._reverseEaseList(t);
129667                return t;
129668              }
129669              setInnerAction(t) {
129670                this._innerAction !== t && (this._innerAction = t);
129671              }
129672              getInnerAction() {
129673                return this._innerAction;
129674              }
129675            }
129676            class sFt extends $Lt {
129677              constructor(t) {
129678                super();
129679                this._innerAction = null;
129680                t && this.initWithAction(t);
129681              }
129682              initWithAction(t) {
129683                if (!t) {
129684                  F(1026);
129685                  return !1;
129686                }
129687                this._innerAction = t;
129688                return !0;
129689              }
129690              clone() {
129691                const t = new sFt;
129692                this._cloneDecoration(t);
129693                t.initWithAction(this._innerAction.clone());
129694                return t;
129695              }
129696              startWithTarget(t) {
129697                $Lt.prototype.startWithTarget.call(this, t);
129698                this._innerAction.startWithTarget(t);
129699              }
129700              step(t) {
129701                const e = this._innerAction;
129702                e.step(t);
129703                if (e.isDone()) {
129704                  e.startWithTarget(this.target);
129705                  e.step(e.getElapsed() - e._duration);
129706                }
129707              }
129708              isDone() {
129709                return !1;
129710              }
129711              reverse() {
129712                const t = new sFt(this._innerAction.reverse());
129713                this._cloneDecoration(t);
129714                this._reverseEaseList(t);
129715                return t;
129716              }
129717              setInnerAction(t) {
129718                this._innerAction !== t && (this._innerAction = t);
129719              }
129720              getInnerAction() {
129721                return this._innerAction;
129722              }
129723            }
129724            class nFt extends $Lt {
129725              constructor(t) {
129726                super();
129727                this._one = null;
129728                this._two = null;
129729                const e = t instanceof Array ? t : arguments;
129730                if (1 === e.length) {
129731                  F(1020);
129732                  return;
129733                }
129734                const i = e.length - 1;
129735                i >= 0 && null == e[i] && P(1015);
129736                if (i >= 0) {
129737                  let t = e[0];
129738                  let s;
129739                  for (let n = 1; n < i; n++) if (e[n]) {
129740                    s = t;
129741                    t = nFt._actionOneTwo(s, e[n]);
129742                  }
129743                  this.initWithTwoActions(t, e[i]);
129744                }
129745              }
129746              initWithTwoActions(t, e) {
129747                if (!t || !e) {
129748                  F(1027);
129749                  return !1;
129750                }
129751                let i = !1;
129752                const s = t._duration;
129753                const n = e._duration;
129754                if (this.initWithDuration(Math.max(s, n))) {
129755                  this._one = t;
129756                  this._two = e;
129757                  s > n ? this._two = tFt._actionOneTwo(e, aFt(s - n)) : s < n && (this._one = tFt._actionOneTwo(t, aFt(n - s)));
129758                  i = !0;
129759                }
129760                return i;
129761              }
129762              clone() {
129763                const t = new nFt;
129764                this._cloneDecoration(t);
129765                t.initWithTwoActions(this._one.clone(), this._two.clone());
129766                return t;
129767              }
129768              startWithTarget(t) {
129769                $Lt.prototype.startWithTarget.call(this, t);
129770                this._one.startWithTarget(t);
129771                this._two.startWithTarget(t);
129772              }
129773              stop() {
129774                this._one.stop();
129775                this._two.stop();
129776                zLt.prototype.stop.call(this);
129777              }
129778              update(t) {
129779                t = this._computeEaseTime(t);
129780                this._one && this._one.update(t);
129781                this._two && this._two.update(t);
129782              }
129783              reverse() {
129784                const t = nFt._actionOneTwo(this._one.reverse(), this._two.reverse());
129785                this._cloneDecoration(t);
129786                this._reverseEaseList(t);
129787                return t;
129788              }
129789            }
129790            nFt._actionOneTwo = function(t, e) {
129791              const i = new nFt;
129792              i.initWithTwoActions(t, e);
129793              return i;
129794            };
129795            function rFt(t) {
129796              const e = t instanceof Array ? t : arguments;
129797              if (1 === e.length) {
129798                F(1020);
129799                return null;
129800              }
129801              e.length > 0 && null == e[e.length - 1] && P(1015);
129802              let i = e[0];
129803              for (let t = 1; t < e.length; t++) null != e[t] && (i = nFt._actionOneTwo(i, e[t]));
129804              return i;
129805            }
129806            class oFt extends $Lt {
129807              update(t) {}
129808              reverse() {
129809                const t = new oFt(this._duration);
129810                this._cloneDecoration(t);
129811                this._reverseEaseList(t);
129812                return t;
129813              }
129814              clone() {
129815                const t = new oFt;
129816                this._cloneDecoration(t);
129817                t.initWithDuration(this._duration);
129818                return t;
129819              }
129820            }
129821            function aFt(t) {
129822              return new oFt(t);
129823            }
129824            class lFt extends $Lt {
129825              constructor(t) {
129826                super();
129827                this._other = null;
129828                t && this.initWithAction(t);
129829              }
129830              initWithAction(t) {
129831                if (!t) {
129832                  F(1028);
129833                  return !1;
129834                }
129835                if (t === this._other) {
129836                  F(1029);
129837                  return !1;
129838                }
129839                if ($Lt.prototype.initWithDuration.call(this, t._duration)) {
129840                  this._other = t;
129841                  return !0;
129842                }
129843                return !1;
129844              }
129845              clone() {
129846                const t = new lFt;
129847                this._cloneDecoration(t);
129848                t.initWithAction(this._other.clone());
129849                return t;
129850              }
129851              startWithTarget(t) {
129852                $Lt.prototype.startWithTarget.call(this, t);
129853                this._other.startWithTarget(t);
129854              }
129855              update(t) {
129856                t = this._computeEaseTime(t);
129857                this._other && this._other.update(1 - t);
129858              }
129859              reverse() {
129860                return this._other.clone();
129861              }
129862              stop() {
129863                this._other.stop();
129864                zLt.prototype.stop.call(this);
129865              }
129866            }
129867            class hFt extends $Lt {
129868              constructor(t, e, i) {
129869                super();
129870                this._opts = void 0;
129871                this._props = void 0;
129872                this._originProps = void 0;
129873                if (null == i) i = Object.create(null); else {
129874                  !function(t) {
129875                    const e = " [Tween:] ";
129876                    const i = ` option is not support in v + ${f}`;
129877                    const s = t;
129878                    s.delay && C(`${e}delay${i}`);
129879                    s.repeat && C(`${e}repeat${i}`);
129880                    s.repeatDelay && C(`${e}repeatDelay${i}`);
129881                    s.interpolation && C(`${e}interpolation${i}`);
129882                    s.onStop && C(`${e}onStop${i}`);
129883                  }(i);
129884                  i.easing && "string" == typeof i.easing && (i.easing = function(t) {
129885                    const e = t.charAt(0);
129886                    if (/[A-Z]/.test(e)) {
129887                      const i = (t = t.replace(e, e.toLowerCase())).split("-");
129888                      if (2 === i.length) {
129889                        const e = i[0];
129890                        if ("linear" === e) t = "linear"; else {
129891                          const s = i[1];
129892                          switch (e) {
129893                           case "quadratic":
129894                            t = `quad${s}`;
129895                            break;
129896
129897                           case "quartic":
129898                            t = `quart${s}`;
129899                            break;
129900
129901                           case "quintic":
129902                            t = `quint${s}`;
129903                            break;
129904
129905                           case "sinusoidal":
129906                            t = `sine${s}`;
129907                            break;
129908
129909                           case "exponential":
129910                            t = `expo${s}`;
129911                            break;
129912
129913                           case "circular":
129914                            t = `circ${s}`;
129915                            break;
129916
129917                           default:
129918                            t = e + s;
129919                          }
129920                        }
129921                      }
129922                    }
129923                    return t;
129924                  }(i.easing));
129925                  i.progress || (i.progress = this.progress);
129926                  if (i.easing && "string" == typeof i.easing) {
129927                    const t = i.easing;
129928                    i.easing = Td[t];
129929                    i.easing || N(1031, t);
129930                  }
129931                }
129932                this._opts = i;
129933                this._props = Object.create(null);
129934                for (const t in e) {
129935                  if (!e.hasOwnProperty(t)) continue;
129936                  let i = e[t];
129937                  "function" == typeof i && (i = i());
129938                  if (null == i || "string" == typeof i) continue;
129939                  let s;
129940                  let n;
129941                  if (void 0 !== i.value && (i.easing || i.progress)) {
129942                    if ("string" == typeof i.easing) {
129943                      s = Td[i.easing];
129944                      s || N(1031, i.easing);
129945                    } else s = i.easing;
129946                    n = i.progress;
129947                    i = i.value;
129948                  }
129949                  const r = Object.create(null);
129950                  r.value = i;
129951                  r.easing = s;
129952                  r.progress = n;
129953                  this._props[t] = r;
129954                }
129955                this._originProps = e;
129956                this.initWithDuration(t);
129957              }
129958              clone() {
129959                const t = new hFt(this._duration, this._originProps, this._opts);
129960                this._cloneDecoration(t);
129961                return t;
129962              }
129963              startWithTarget(t) {
129964                $Lt.prototype.startWithTarget.call(this, t);
129965                const e = !!this._opts.relative;
129966                const i = this._props;
129967                for (const s in i) {
129968                  const n = t[s];
129969                  if (void 0 === n) continue;
129970                  const r = i[s];
129971                  const o = r.value;
129972                  if ("number" == typeof n) {
129973                    r.start = n;
129974                    r.current = n;
129975                    r.end = e ? n + o : o;
129976                  } else if ("object" == typeof n) {
129977                    if (null == r.start) {
129978                      r.start = {};
129979                      r.current = {};
129980                      r.end = {};
129981                    }
129982                    for (const t in o) if (!isNaN(n[t])) {
129983                      r.start[t] = n[t];
129984                      r.current[t] = n[t];
129985                      r.end[t] = e ? n[t] + o[t] : o[t];
129986                    }
129987                  }
129988                }
129989                this._opts.onStart && this._opts.onStart(this.target);
129990              }
129991              update(t) {
129992                const e = this.target;
129993                if (!e) return;
129994                const i = this._props;
129995                const s = this._opts;
129996                let n = t;
129997                s.easing && (n = s.easing(t));
129998                const r = s.progress;
129999                for (const s in i) {
130000                  const o = i[s];
130001                  const a = o.easing ? o.easing(t) : n;
130002                  const l = o.progress ? o.progress : r;
130003                  const h = o.start;
130004                  const c = o.end;
130005                  if ("number" == typeof h) o.current = l(h, c, o.current, a); else if ("object" == typeof h) for (const t in h) o.current[t] = l(h[t], c[t], o.current[t], a);
130006                  e[s] = o.current;
130007                }
130008                s.onUpdate && s.onUpdate(this.target, t);
130009                1 === t && s.onComplete && s.onComplete(this.target);
130010              }
130011              progress(t, e, i, s) {
130012                return t + (e - t) * s;
130013              }
130014            }
130015            t("TweenAction", hFt);
130016            class cFt extends qLt {
130017              constructor(t) {
130018                super();
130019                this._props = void 0;
130020                this._props = {};
130021                void 0 !== t && this.init(t);
130022              }
130023              init(t) {
130024                for (const e in t) this._props[e] = t[e];
130025                return !0;
130026              }
130027              update() {
130028                const t = this._props;
130029                const e = this.target;
130030                for (const i in t) e[i] = t[i];
130031              }
130032              clone() {
130033                const t = new cFt;
130034                t.init(this._props);
130035                return t;
130036              }
130037            }
130038            class uFt {
130039              constructor(t) {
130040                this._actions = [];
130041                this._finalAction = null;
130042                this._target = null;
130043                this._tag = zLt.TAG_INVALID;
130044                this._target = void 0 === t ? null : t;
130045              }
130046              tag(t) {
130047                this._tag = t;
130048                return this;
130049              }
130050              then(t) {
130051                t instanceof zLt ? this._actions.push(t.clone()) : this._actions.push(t._union());
130052                return this;
130053              }
130054              target(t) {
130055                this._target = t;
130056                return this;
130057              }
130058              start() {
130059                if (!this._target) {
130060                  C("Please set target to tween first");
130061                  return this;
130062                }
130063                this._finalAction && YLt.instance.ActionManager.removeAction(this._finalAction);
130064                this._finalAction = this._union();
130065                this._finalAction.setTag(this._tag);
130066                YLt.instance.ActionManager.addAction(this._finalAction, this._target, !1);
130067                return this;
130068              }
130069              stop() {
130070                this._finalAction && YLt.instance.ActionManager.removeAction(this._finalAction);
130071                return this;
130072              }
130073              clone(t) {
130074                const e = this._union();
130075                return _Ft(t).then(e.clone());
130076              }
130077              union() {
130078                const t = this._union();
130079                this._actions.length = 0;
130080                this._actions.push(t);
130081                return this;
130082              }
130083              to(t, e, i) {
130084                (i = i || Object.create(null)).relative = !1;
130085                const s = new hFt(t, e, i);
130086                this._actions.push(s);
130087                return this;
130088              }
130089              by(t, e, i) {
130090                (i = i || Object.create(null)).relative = !0;
130091                const s = new hFt(t, e, i);
130092                this._actions.push(s);
130093                return this;
130094              }
130095              set(t) {
130096                const e = new cFt(t);
130097                this._actions.push(e);
130098                return this;
130099              }
130100              delay(t) {
130101                const e = aFt(t);
130102                this._actions.push(e);
130103                return this;
130104              }
130105              call(t) {
130106                const e = function(t, e, i) {
130107                  return new QLt(t, e, i);
130108                }(t);
130109                this._actions.push(e);
130110                return this;
130111              }
130112              sequence(...t) {
130113                const e = uFt._wrappedSequence(...t);
130114                this._actions.push(e);
130115                return this;
130116              }
130117              parallel(...t) {
130118                const e = uFt._wrappedParallel(...t);
130119                this._actions.push(e);
130120                return this;
130121              }
130122              repeat(t, e) {
130123                if (t === 1 / 0) return this.repeatForever(e);
130124                const i = this._actions;
130125                let s;
130126                s = e instanceof uFt ? e._union() : i.pop();
130127                i.push(function(t, e) {
130128                  return new iFt(t, e);
130129                }(s, t));
130130                return this;
130131              }
130132              repeatForever(t) {
130133                const e = this._actions;
130134                let i;
130135                i = t instanceof uFt ? t._union() : e.pop();
130136                e.push(function(t) {
130137                  return new sFt(t);
130138                }(i));
130139                return this;
130140              }
130141              reverseTime(t) {
130142                const e = this._actions;
130143                let i;
130144                i = t instanceof uFt ? t._union() : e.pop();
130145                e.push(function(t) {
130146                  return new lFt(t);
130147                }(i));
130148                return this;
130149              }
130150              hide() {
130151                const t = new JLt;
130152                this._actions.push(t);
130153                return this;
130154              }
130155              show() {
130156                const t = new KLt;
130157                this._actions.push(t);
130158                return this;
130159              }
130160              removeSelf() {
130161                const t = new ZLt(!1);
130162                this._actions.push(t);
130163                return this;
130164              }
130165              static stopAll() {
130166                YLt.instance.ActionManager.removeAllActions();
130167              }
130168              static stopAllByTag(t, e) {
130169                YLt.instance.ActionManager.removeAllActionsByTag(t, e);
130170              }
130171              static stopAllByTarget(t) {
130172                YLt.instance.ActionManager.removeAllActionsFromTarget(t);
130173              }
130174              _union() {
130175                const t = this._actions;
130176                let e;
130177                e = 1 === t.length ? t[0] : eFt(t);
130178                return e;
130179              }
130180              _destroy() {
130181                this.stop();
130182              }
130183              static _wrappedSequence(...t) {
130184                const e = uFt._tmp_args;
130185                e.length = 0;
130186                for (let i = t.length, s = 0; s < i; s++) {
130187                  const i = e[s] = t[s];
130188                  i instanceof uFt && (e[s] = i._union());
130189                }
130190                return eFt.apply(eFt, e);
130191              }
130192              static _wrappedParallel(...t) {
130193                const e = uFt._tmp_args;
130194                e.length = 0;
130195                for (let i = t.length, s = 0; s < i; s++) {
130196                  const i = e[s] = t[s];
130197                  i instanceof uFt && (e[s] = i._union());
130198                }
130199                return rFt.apply(rFt, e);
130200              }
130201            }
130202            t("Tween", uFt);
130203            uFt._tmp_args = [];
130204            m.Tween = uFt;
130205            function _Ft(t) {
130206              return new uFt(t);
130207            }
130208            m.tween = _Ft;
130209            function dFt(t) {
130210              C("tweenUtil' is deprecated, please use 'tween' instead ");
130211              return new uFt(t);
130212            }
130213            m.tweenUtil = dFt;
130214            let pFt;
130215            !function(t) {
130216              t[t.Other = 0] = "Other";
130217              t[t.Left = 1] = "Left";
130218              t[t.Right = 2] = "Right";
130219            }(pFt || (pFt = t("DeviceType", {})));
130220            let mFt;
130221            !function(t) {
130222              t.SELECT_ENTERED = "select-entered";
130223              t.SELECT_EXITED = "select-exited";
130224              t.SELECT_CANCELED = "select-canceled";
130225              t.ACTIVATED = "OnActivited";
130226              t.DEACTIVITED = "Deactivited";
130227              t.ACTIVATE_CANCELED = "activate-canceled";
130228              t.UIPRESS_ENTERED = "UI-press-entered";
130229              t.UIPRESS_EXITED = "UI-press-exited";
130230              t.UIPRESS_CANCELED = "UI-press-canceled";
130231              t.HOVER_ENTERED = "hover-entered";
130232              t.HOVER_EXITED = "hover-exited";
130233              t.HOVER_STAY = "hover-stay";
130234              t.HOVER_CANCELED = "hover-canceled";
130235            }(mFt || (mFt = t("XrControlEventType", {})));
130236            t("XrEventHandle", class extends RS {
130237              constructor(...t) {
130238                super(...t);
130239                this.deviceType = pFt.Other;
130240                this.hitPoint = new Pi;
130241                this.model = null;
130242                this.eventHandle = 0;
130243                this.triggerId = "";
130244                this.attachNode = null;
130245                this.forceGrab = !0;
130246              }
130247            });
130248            let fFt;
130249            !function(t) {
130250              t.XRUI_HOVER_ENTERED = "xrui-hover-entered";
130251              t.XRUI_HOVER_EXITED = "xrui-hover-exited";
130252              t.XRUI_HOVER_STAY = "xrui-hover-stay";
130253              t.XRUI_CLICK = "xrui-click";
130254              t.XRUI_UNCLICK = "xrui-unclick";
130255            }(fFt || (fFt = t("XrUIPressEventType", {})));
130256            let gFt;
130257            !function(t) {
130258              t.XR_CAPS_LOCK = "xr-caps-lock";
130259              t.XR_KEYBOARD_INIT = "xr-keyboard-init";
130260              t.XR_KEYBOARD_INPUT = "xr-keyboard-input";
130261              t.TO_LATIN = "to-latin";
130262              t.TO_SYMBOL = "to-symbol";
130263              t.TO_MATH_SYMBOL = "to-math-symbol";
130264            }(gFt || (gFt = t("XrKeyboardEventType", {})));
130265            t("XrUIPressEvent", class extends RS {
130266              constructor(...t) {
130267                super(...t);
130268                this.deviceType = pFt.Other;
130269                this.hitPoint = new Pi;
130270              }
130271            });
130272            var yFt, bFt, SFt, AFt, TFt, vFt, EFt, CFt, xFt, wFt, RFt, IFt, MFt, BFt, DFt, PFt, OFt, NFt, LFt, FFt, VFt, kFt, UFt, GFt, zFt, HFt, jFt, XFt, WFt, YFt, qFt, KFt, JFt, ZFt, QFt, $Ft, tVt, eVt, iVt, sVt, nVt, rVt, oVt, aVt, lVt, hVt, cVt, uVt, _Vt, dVt, pVt, mVt, fVt, gVt, yVt, bVt, SVt, AVt, TVt, vVt;
130273            const EVt = new Bi;
130274            var CVt;
130275            !function(t) {
130276              t[t.NONE = 0] = "NONE";
130277              t[t.COLOR = 1] = "COLOR";
130278              t[t.SPRITE = 2] = "SPRITE";
130279              t[t.SCALE = 3] = "SCALE";
130280            }(CVt || (CVt = {}));
130281            he(CVt);
130282            var xVt;
130283            !function(t) {
130284              t.NORMAL = "normal";
130285              t.HOVER = "hover";
130286              t.PRESSED = "pressed";
130287              t.DISABLED = "disabled";
130288            }(xVt || (xVt = {}));
130289            let wVt;
130290            !function(t) {
130291              t.CLICK = "click";
130292            }(wVt || (wVt = {}));
130293            let RVt = function(e) {
130294              return t({
130295                Button: e,
130296                ButtonComponent: e
130297              }), e;
130298            }((yFt = Ul("cc.Button"), bFt = sh(), SFt = zl(110), AFt = $l(), TFt = Gl(jB), vFt = Th(_y),
130299            EFt = ph(), CFt = lh(), xFt = ph(), wFt = lh(), RFt = Th(CVt), IFt = ph(), MFt = lh(),
130300            BFt = ph(), DFt = lh(), PFt = ph(), OFt = lh(), NFt = ph(), LFt = lh(), FFt = ph(),
130301            VFt = lh(), kFt = ch(), UFt = uh(), GFt = ph(), zFt = lh(), HFt = ph(), jFt = lh(),
130302            XFt = Th(GI), WFt = ph(), YFt = lh(), qFt = Th(GI), KFt = ph(), JFt = lh(), ZFt = Th(GI),
130303            QFt = ph(), $Ft = lh(), tVt = Th(GI), eVt = ph(), iVt = lh(), sVt = Th([ Vc ]),
130304            nVt = ph(), rVt = lh(), yFt(oVt = bFt(oVt = SFt(oVt = AFt(oVt = TFt(oVt = Ql(oVt = (aVt = (vVt = TVt = class extends Qc {
130305              constructor(...t) {
130306                super(...t);
130307                Ml(this, "clickEvents", lVt, this);
130308                Ml(this, "_interactable", hVt, this);
130309                Ml(this, "_transition", cVt, this);
130310                Ml(this, "_normalColor", uVt, this);
130311                Ml(this, "_hoverColor", _Vt, this);
130312                Ml(this, "_pressedColor", dVt, this);
130313                Ml(this, "_disabledColor", pVt, this);
130314                Ml(this, "_normalSprite", mVt, this);
130315                Ml(this, "_hoverSprite", fVt, this);
130316                Ml(this, "_pressedSprite", gVt, this);
130317                Ml(this, "_disabledSprite", yVt, this);
130318                Ml(this, "_duration", bVt, this);
130319                Ml(this, "_zoomScale", SVt, this);
130320                Ml(this, "_target", AVt, this);
130321                this._pressed = !1;
130322                this._hovered = !1;
130323                this._fromColor = new Bi;
130324                this._toColor = new Bi;
130325                this._time = 0;
130326                this._transitionFinished = !0;
130327                this._fromScale = new Pi;
130328                this._toScale = new Pi;
130329                this._originalScale = null;
130330                this._sprite = null;
130331                this._targetScale = new Pi;
130332              }
130333              get target() {
130334                return this._target || this.node;
130335              }
130336              set target(t) {
130337                if (this._target !== t) {
130338                  this._target && this._unregisterTargetEvent(this._target);
130339                  this._target = t;
130340                  this._applyTarget();
130341                }
130342              }
130343              get interactable() {
130344                return this._interactable;
130345              }
130346              set interactable(t) {
130347                if (this._interactable !== t) {
130348                  this._interactable = t;
130349                  this._updateState();
130350                  this._interactable || this._resetState();
130351                }
130352              }
130353              set _resizeToTarget(t) {
130354                t && this._resizeNodeToTargetNode();
130355              }
130356              get transition() {
130357                return this._transition;
130358              }
130359              set transition(t) {
130360                if (this._transition !== t) {
130361                  this._transition === CVt.COLOR ? this._updateColorTransition(xVt.NORMAL) : this._transition === CVt.SPRITE && this._updateSpriteTransition(xVt.NORMAL);
130362                  this._transition = t;
130363                  this._updateState();
130364                }
130365              }
130366              get normalColor() {
130367                return this._normalColor;
130368              }
130369              set normalColor(t) {
130370                if (this._normalColor !== t) {
130371                  this._normalColor.set(t);
130372                  this._updateState();
130373                }
130374              }
130375              get pressedColor() {
130376                return this._pressedColor;
130377              }
130378              set pressedColor(t) {
130379                this._pressedColor !== t && this._pressedColor.set(t);
130380              }
130381              get hoverColor() {
130382                return this._hoverColor;
130383              }
130384              set hoverColor(t) {
130385                this._hoverColor !== t && this._hoverColor.set(t);
130386              }
130387              get disabledColor() {
130388                return this._disabledColor;
130389              }
130390              set disabledColor(t) {
130391                if (this._disabledColor !== t) {
130392                  this._disabledColor.set(t);
130393                  this._updateState();
130394                }
130395              }
130396              get duration() {
130397                return this._duration;
130398              }
130399              set duration(t) {
130400                this._duration !== t && (this._duration = t);
130401              }
130402              get zoomScale() {
130403                return this._zoomScale;
130404              }
130405              set zoomScale(t) {
130406                this._zoomScale !== t && (this._zoomScale = t);
130407              }
130408              get normalSprite() {
130409                return this._normalSprite;
130410              }
130411              set normalSprite(t) {
130412                if (this._normalSprite === t) return;
130413                this._normalSprite = t;
130414                const e = this.node.getComponent(cL);
130415                e && (e.spriteFrame = t);
130416                this._updateState();
130417              }
130418              get pressedSprite() {
130419                return this._pressedSprite;
130420              }
130421              set pressedSprite(t) {
130422                if (this._pressedSprite !== t) {
130423                  this._pressedSprite = t;
130424                  this._updateState();
130425                }
130426              }
130427              get hoverSprite() {
130428                return this._hoverSprite;
130429              }
130430              set hoverSprite(t) {
130431                if (this._hoverSprite !== t) {
130432                  this._hoverSprite = t;
130433                  this._updateState();
130434                }
130435              }
130436              get disabledSprite() {
130437                return this._disabledSprite;
130438              }
130439              set disabledSprite(t) {
130440                if (this._disabledSprite !== t) {
130441                  this._disabledSprite = t;
130442                  this._updateState();
130443                }
130444              }
130445              __preload() {
130446                this.target || (this.target = this.node);
130447                const t = this.node.getComponent(cL);
130448                t && (this._normalSprite = t.spriteFrame);
130449                this._applyTarget();
130450                this._resetState();
130451              }
130452              onEnable() {
130453                this._registerNodeEvent();
130454              }
130455              onDisable() {
130456                this._resetState();
130457                this._unregisterNodeEvent();
130458              }
130459              onDestroy() {
130460                this.target.isValid && this._unregisterTargetEvent(this.target);
130461              }
130462              update(t) {
130463                const e = this.target;
130464                if (this._transitionFinished || !e) return;
130465                if (this._transition !== CVt.COLOR && this._transition !== CVt.SCALE) return;
130466                this._time += t;
130467                let i = 1;
130468                this._duration > 0 && (i = this._time / this._duration);
130469                i >= 1 && (i = 1);
130470                if (this._transition === CVt.COLOR) {
130471                  const t = e._uiProps.uiComp;
130472                  Bi.lerp(EVt, this._fromColor, this._toColor, i);
130473                  t && (t.color = EVt);
130474                } else if (this.transition === CVt.SCALE) {
130475                  e.getScale(this._targetScale);
130476                  this._targetScale.x = pi(this._fromScale.x, this._toScale.x, i);
130477                  this._targetScale.y = pi(this._fromScale.y, this._toScale.y, i);
130478                  e.setScale(this._targetScale);
130479                }
130480                1 === i && (this._transitionFinished = !0);
130481              }
130482              _resizeNodeToTargetNode() {
130483                if (!this.target) return;
130484                this.target._uiProps.uiTransformComp;
130485              }
130486              _resetState() {
130487                this._pressed = !1;
130488                this._hovered = !1;
130489                const t = this.target;
130490                if (!t) return;
130491                const e = this._transition;
130492                if (e === CVt.COLOR && this._interactable) {
130493                  const e = t.getComponent(uD);
130494                  e && (e.color = this._normalColor);
130495                } else e === CVt.SCALE && this._originalScale && t.setScale(this._originalScale);
130496                this._transitionFinished = !0;
130497              }
130498              _registerNodeEvent() {
130499                this.node.on(ny.TOUCH_START, this._onTouchBegan, this);
130500                this.node.on(ny.TOUCH_MOVE, this._onTouchMove, this);
130501                this.node.on(ny.TOUCH_END, this._onTouchEnded, this);
130502                this.node.on(ny.TOUCH_CANCEL, this._onTouchCancel, this);
130503                this.node.on(ny.MOUSE_ENTER, this._onMouseMoveIn, this);
130504                this.node.on(ny.MOUSE_LEAVE, this._onMouseMoveOut, this);
130505                this.node.on(fFt.XRUI_HOVER_ENTERED, this._xrHoverEnter, this);
130506                this.node.on(fFt.XRUI_HOVER_EXITED, this._xrHoverExit, this);
130507                this.node.on(fFt.XRUI_CLICK, this._xrClick, this);
130508                this.node.on(fFt.XRUI_UNCLICK, this._xrUnClick, this);
130509              }
130510              _registerTargetEvent(t) {
130511                t.on(ny.TRANSFORM_CHANGED, this._onTargetTransformChanged, this);
130512              }
130513              _unregisterNodeEvent() {
130514                this.node.off(ny.TOUCH_START, this._onTouchBegan, this);
130515                this.node.off(ny.TOUCH_MOVE, this._onTouchMove, this);
130516                this.node.off(ny.TOUCH_END, this._onTouchEnded, this);
130517                this.node.off(ny.TOUCH_CANCEL, this._onTouchCancel, this);
130518                this.node.off(ny.MOUSE_ENTER, this._onMouseMoveIn, this);
130519                this.node.off(ny.MOUSE_LEAVE, this._onMouseMoveOut, this);
130520                this.node.off(fFt.XRUI_HOVER_ENTERED, this._xrHoverEnter, this);
130521                this.node.off(fFt.XRUI_HOVER_EXITED, this._xrHoverExit, this);
130522                this.node.off(fFt.XRUI_CLICK, this._xrClick, this);
130523                this.node.off(fFt.XRUI_UNCLICK, this._xrUnClick, this);
130524              }
130525              _unregisterTargetEvent(t) {
130526                t.off(ny.TRANSFORM_CHANGED);
130527              }
130528              _getTargetSprite(t) {
130529                let e = null;
130530                t && (e = t.getComponent(cL));
130531                return e;
130532              }
130533              _applyTarget() {
130534                if (this.target) {
130535                  this._sprite = this._getTargetSprite(this.target);
130536                  this._originalScale || (this._originalScale = new Pi);
130537                  Pi.copy(this._originalScale, this.target.getScale());
130538                  this._registerTargetEvent(this.target);
130539                }
130540              }
130541              _onTargetSpriteFrameChanged(t) {
130542                this._transition === CVt.SPRITE && this._setCurrentStateSpriteFrame(t.spriteFrame);
130543              }
130544              _setCurrentStateSpriteFrame(t) {
130545                if (t) switch (this._getButtonState()) {
130546                 case xVt.NORMAL:
130547                  this._normalSprite = t;
130548                  break;
130549
130550                 case xVt.HOVER:
130551                  this._hoverSprite = t;
130552                  break;
130553
130554                 case xVt.PRESSED:
130555                  this._pressedSprite = t;
130556                  break;
130557
130558                 case xVt.DISABLED:
130559                  this._disabledSprite = t;
130560                }
130561              }
130562              _onTargetColorChanged(t) {
130563                this._transition === CVt.COLOR && this._setCurrentStateColor(t);
130564              }
130565              _setCurrentStateColor(t) {
130566                switch (this._getButtonState()) {
130567                 case xVt.NORMAL:
130568                  this._normalColor = t;
130569                  break;
130570
130571                 case xVt.HOVER:
130572                  this._hoverColor = t;
130573                  break;
130574
130575                 case xVt.PRESSED:
130576                  this._pressedColor = t;
130577                  break;
130578
130579                 case xVt.DISABLED:
130580                  this._disabledColor = t;
130581                }
130582              }
130583              _onTargetTransformChanged(t) {
130584                t & ay.SCALE && this._originalScale && this._transition === CVt.SCALE && this._transitionFinished && Pi.copy(this._originalScale, this.target.getScale());
130585              }
130586              _onTouchBegan(t) {
130587                if (this._interactable && this.enabledInHierarchy) {
130588                  this._pressed = !0;
130589                  this._updateState();
130590                  t && (t.propagationStopped = !0);
130591                }
130592              }
130593              _onTouchMove(t) {
130594                if (!this._interactable || !this.enabledInHierarchy || !this._pressed) return;
130595                if (!t) return;
130596                const e = t.touch;
130597                if (!e) return;
130598                const i = this.node._uiProps.uiTransformComp.hitTest(e.getLocation());
130599                if (this._transition === CVt.SCALE && this.target && this._originalScale) if (i) {
130600                  Pi.copy(this._fromScale, this._originalScale);
130601                  Pi.multiplyScalar(this._toScale, this._originalScale, this._zoomScale);
130602                  this._transitionFinished = !1;
130603                } else {
130604                  this._time = 0;
130605                  this._transitionFinished = !0;
130606                  this.target.setScale(this._originalScale);
130607                } else {
130608                  let t;
130609                  t = i ? xVt.PRESSED : xVt.NORMAL;
130610                  this._applyTransition(t);
130611                }
130612                t && (t.propagationStopped = !0);
130613              }
130614              _onTouchEnded(t) {
130615                if (this._interactable && this.enabledInHierarchy) {
130616                  if (this._pressed) {
130617                    Vc.emitEvents(this.clickEvents, t);
130618                    this.node.emit(wVt.CLICK, this);
130619                  }
130620                  this._pressed = !1;
130621                  this._updateState();
130622                  t && (t.propagationStopped = !0);
130623                }
130624              }
130625              _onTouchCancel(t) {
130626                if (this._interactable && this.enabledInHierarchy) {
130627                  this._pressed = !1;
130628                  this._updateState();
130629                }
130630              }
130631              _onMouseMoveIn(t) {
130632                if (!this._pressed && this.interactable && this.enabledInHierarchy && (this._transition !== CVt.SPRITE || this._hoverSprite) && !this._hovered) {
130633                  this._hovered = !0;
130634                  this._updateState();
130635                }
130636              }
130637              _onMouseMoveOut(t) {
130638                if (this._hovered) {
130639                  this._hovered = !1;
130640                  this._updateState();
130641                }
130642              }
130643              _updateState() {
130644                const t = this._getButtonState();
130645                this._applyTransition(t);
130646              }
130647              _getButtonState() {
130648                let t = xVt.NORMAL;
130649                this._interactable ? this._pressed ? t = xVt.PRESSED : this._hovered && (t = xVt.HOVER) : t = xVt.DISABLED;
130650                return t.toString();
130651              }
130652              _updateColorTransition(t) {
130653                var e;
130654                const i = this[`${t}Color`];
130655                const s = null === (e = this.target) || void 0 === e ? void 0 : e.getComponent(uD);
130656                if (s) if (t === xVt.DISABLED) s.color = i; else {
130657                  this._fromColor = s.color.clone();
130658                  this._toColor = i;
130659                  this._time = 0;
130660                  this._transitionFinished = !1;
130661                }
130662              }
130663              _updateSpriteTransition(t) {
130664                const e = this[`${t}Sprite`];
130665                this._sprite && e && (this._sprite.spriteFrame = e);
130666              }
130667              _updateScaleTransition(t) {
130668                this._interactable && (t === xVt.PRESSED ? this._zoomUp() : this._zoomBack());
130669              }
130670              _zoomUp() {
130671                if (this._originalScale) {
130672                  Pi.copy(this._fromScale, this._originalScale);
130673                  Pi.multiplyScalar(this._toScale, this._originalScale, this._zoomScale);
130674                  this._time = 0;
130675                  this._transitionFinished = !1;
130676                }
130677              }
130678              _zoomBack() {
130679                if (this.target && this._originalScale) {
130680                  Pi.copy(this._fromScale, this.target.getScale());
130681                  Pi.copy(this._toScale, this._originalScale);
130682                  this._time = 0;
130683                  this._transitionFinished = !1;
130684                }
130685              }
130686              _applyTransition(t) {
130687                const e = this._transition;
130688                e === CVt.COLOR ? this._updateColorTransition(t) : e === CVt.SPRITE ? this._updateSpriteTransition(t) : e === CVt.SCALE && this._updateScaleTransition(t);
130689              }
130690              _xrHoverEnter() {
130691                this._onMouseMoveIn();
130692                this._updateState();
130693              }
130694              _xrHoverExit() {
130695                this._onMouseMoveOut();
130696                if (this._pressed) {
130697                  this._pressed = !1;
130698                  this._updateState();
130699                }
130700              }
130701              _xrClick() {
130702                if (this._interactable && this.enabledInHierarchy) {
130703                  this._pressed = !0;
130704                  this._updateState();
130705                }
130706              }
130707              _xrUnClick() {
130708                if (this._interactable && this.enabledInHierarchy) {
130709                  if (this._pressed) {
130710                    Vc.emitEvents(this.clickEvents, this);
130711                    this.node.emit(wVt.CLICK, this);
130712                  }
130713                  this._pressed = !1;
130714                  this._updateState();
130715                }
130716              }
130717            }, TVt.Transition = CVt, TVt.EventType = wVt, vVt), Bl(aVt.prototype, "target", [ vFt, EFt, CFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "target"), aVt.prototype),
130718            Bl(aVt.prototype, "interactable", [ xFt, wFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "interactable"), aVt.prototype),
130719            Bl(aVt.prototype, "transition", [ RFt, IFt, MFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "transition"), aVt.prototype),
130720            Bl(aVt.prototype, "normalColor", [ BFt, DFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "normalColor"), aVt.prototype),
130721            Bl(aVt.prototype, "pressedColor", [ PFt, OFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "pressedColor"), aVt.prototype),
130722            Bl(aVt.prototype, "hoverColor", [ NFt, LFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "hoverColor"), aVt.prototype),
130723            Bl(aVt.prototype, "disabledColor", [ FFt, VFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "disabledColor"), aVt.prototype),
130724            Bl(aVt.prototype, "duration", [ kFt, UFt, GFt, zFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "duration"), aVt.prototype),
130725            Bl(aVt.prototype, "zoomScale", [ HFt, jFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "zoomScale"), aVt.prototype),
130726            Bl(aVt.prototype, "normalSprite", [ XFt, WFt, YFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "normalSprite"), aVt.prototype),
130727            Bl(aVt.prototype, "pressedSprite", [ qFt, KFt, JFt ], Object.getOwnPropertyDescriptor(aVt.prototype, "pressedSprite"), aVt.prototype),
130728            Bl(aVt.prototype, "hoverSprite", [ ZFt, QFt, $Ft ], Object.getOwnPropertyDescriptor(aVt.prototype, "hoverSprite"), aVt.prototype),
130729            Bl(aVt.prototype, "disabledSprite", [ tVt, eVt, iVt ], Object.getOwnPropertyDescriptor(aVt.prototype, "disabledSprite"), aVt.prototype),
130730            lVt = Bl(aVt.prototype, "clickEvents", [ sVt, Yl, nVt, rVt ], {
130731              configurable: !0,
130732              enumerable: !0,
130733              writable: !0,
130734              initializer: function() {
130735                return [];
130736              }
130737            }), hVt = Bl(aVt.prototype, "_interactable", [ Yl ], {
130738              configurable: !0,
130739              enumerable: !0,
130740              writable: !0,
130741              initializer: function() {
130742                return !0;
130743              }
130744            }), cVt = Bl(aVt.prototype, "_transition", [ Yl ], {
130745              configurable: !0,
130746              enumerable: !0,
130747              writable: !0,
130748              initializer: function() {
130749                return CVt.NONE;
130750              }
130751            }), uVt = Bl(aVt.prototype, "_normalColor", [ Yl ], {
130752              configurable: !0,
130753              enumerable: !0,
130754              writable: !0,
130755              initializer: function() {
130756                return Bi.WHITE.clone();
130757              }
130758            }), _Vt = Bl(aVt.prototype, "_hoverColor", [ Yl ], {
130759              configurable: !0,
130760              enumerable: !0,
130761              writable: !0,
130762              initializer: function() {
130763                return new Bi(211, 211, 211, 255);
130764              }
130765            }), dVt = Bl(aVt.prototype, "_pressedColor", [ Yl ], {
130766              configurable: !0,
130767              enumerable: !0,
130768              writable: !0,
130769              initializer: function() {
130770                return Bi.WHITE.clone();
130771              }
130772            }), pVt = Bl(aVt.prototype, "_disabledColor", [ Yl ], {
130773              configurable: !0,
130774              enumerable: !0,
130775              writable: !0,
130776              initializer: function() {
130777                return new Bi(124, 124, 124, 255);
130778              }
130779            }), mVt = Bl(aVt.prototype, "_normalSprite", [ Yl ], {
130780              configurable: !0,
130781              enumerable: !0,
130782              writable: !0,
130783              initializer: function() {
130784                return null;
130785              }
130786            }), fVt = Bl(aVt.prototype, "_hoverSprite", [ Yl ], {
130787              configurable: !0,
130788              enumerable: !0,
130789              writable: !0,
130790              initializer: function() {
130791                return null;
130792              }
130793            }), gVt = Bl(aVt.prototype, "_pressedSprite", [ Yl ], {
130794              configurable: !0,
130795              enumerable: !0,
130796              writable: !0,
130797              initializer: function() {
130798                return null;
130799              }
130800            }), yVt = Bl(aVt.prototype, "_disabledSprite", [ Yl ], {
130801              configurable: !0,
130802              enumerable: !0,
130803              writable: !0,
130804              initializer: function() {
130805                return null;
130806              }
130807            }), bVt = Bl(aVt.prototype, "_duration", [ Yl ], {
130808              configurable: !0,
130809              enumerable: !0,
130810              writable: !0,
130811              initializer: function() {
130812                return .1;
130813              }
130814            }), SVt = Bl(aVt.prototype, "_zoomScale", [ Yl ], {
130815              configurable: !0,
130816              enumerable: !0,
130817              writable: !0,
130818              initializer: function() {
130819                return 1.2;
130820              }
130821            }), AVt = Bl(aVt.prototype, "_target", [ Yl ], {
130822              configurable: !0,
130823              enumerable: !0,
130824              writable: !0,
130825              initializer: function() {
130826                return null;
130827              }
130828            }), aVt)) || oVt) || oVt) || oVt) || oVt) || oVt) || oVt));
130829            m.Button = RVt;
130830            class IVt {
130831              static add(t) {
130832                const e = this._tabIndexList;
130833                -1 === e.indexOf(t) && e.push(t);
130834              }
130835              static remove(t) {
130836                const e = this._tabIndexList;
130837                const i = e.indexOf(t);
130838                -1 !== i && e.splice(i, 1);
130839              }
130840              static resort() {
130841                this._tabIndexList.sort(((t, e) => t._delegate.tabIndex - e._delegate.tabIndex));
130842              }
130843              static next(t) {
130844                const e = this._tabIndexList;
130845                const i = e.indexOf(t);
130846                t.setFocus(!1);
130847                if (-1 !== i) {
130848                  const t = e[i + 1];
130849                  t && t._delegate.tabIndex >= 0 && t.setFocus(!0);
130850                }
130851              }
130852            }
130853            IVt._tabIndexList = [];
130854            let MVt;
130855            !function(t) {
130856              t[t.DEFAULT = 0] = "DEFAULT";
130857              t[t.DONE = 1] = "DONE";
130858              t[t.SEND = 2] = "SEND";
130859              t[t.SEARCH = 3] = "SEARCH";
130860              t[t.GO = 4] = "GO";
130861              t[t.NEXT = 5] = "NEXT";
130862            }(MVt || (MVt = {}));
130863            oe(MVt);
130864            let BVt;
130865            !function(t) {
130866              t[t.ANY = 0] = "ANY";
130867              t[t.EMAIL_ADDR = 1] = "EMAIL_ADDR";
130868              t[t.NUMERIC = 2] = "NUMERIC";
130869              t[t.PHONE_NUMBER = 3] = "PHONE_NUMBER";
130870              t[t.URL = 4] = "URL";
130871              t[t.DECIMAL = 5] = "DECIMAL";
130872              t[t.SINGLE_LINE = 6] = "SINGLE_LINE";
130873            }(BVt || (BVt = {}));
130874            oe(BVt);
130875            let DVt;
130876            !function(t) {
130877              t[t.PASSWORD = 0] = "PASSWORD";
130878              t[t.SENSITIVE = 1] = "SENSITIVE";
130879              t[t.INITIAL_CAPS_WORD = 2] = "INITIAL_CAPS_WORD";
130880              t[t.INITIAL_CAPS_SENTENCE = 3] = "INITIAL_CAPS_SENTENCE";
130881              t[t.INITIAL_CAPS_ALL_CHARACTERS = 4] = "INITIAL_CAPS_ALL_CHARACTERS";
130882              t[t.DEFAULT = 5] = "DEFAULT";
130883            }(DVt || (DVt = {}));
130884            oe(DVt);
130885            class PVt {
130886              constructor() {
130887                this._editing = !1;
130888                this._delegate = null;
130889              }
130890              init(t) {}
130891              onEnable() {}
130892              update() {}
130893              onDisable() {
130894                this._editing && this.endEditing();
130895              }
130896              clear() {
130897                this._delegate = null;
130898              }
130899              setTabIndex(t) {}
130900              setSize(t, e) {}
130901              setFocus(t) {
130902                t ? this.beginEditing() : this.endEditing();
130903              }
130904              isFocused() {
130905                return this._editing;
130906              }
130907              beginEditing() {}
130908              endEditing() {}
130909            }
130910            new qi;
130911            new qi;
130912            new Pi;
130913            var OVt, NVt, LVt, FVt, VVt, kVt, UVt, GVt, zVt, HVt, jVt, XVt, WVt, YVt, qVt, KVt, JVt, ZVt, QVt, $Vt, tkt, ekt, ikt, skt, nkt, rkt, okt, akt, lkt, hkt, ckt, ukt, _kt, dkt, pkt, mkt, fkt, gkt, ykt, bkt, Skt, Akt, Tkt, vkt, Ekt, Ckt, xkt, wkt, Rkt, Ikt, Mkt, Bkt, Dkt, Pkt, Okt, Nkt, Lkt, Fkt, Vkt, kkt;
130914            var Ukt;
130915            !function(t) {
130916              t.EDITING_DID_BEGAN = "editing-did-began";
130917              t.EDITING_DID_ENDED = "editing-did-ended";
130918              t.TEXT_CHANGED = "text-changed";
130919              t.EDITING_RETURN = "editing-return";
130920              t.XR_EDITING_DID_BEGAN = "xr-editing-did-began";
130921              t.XR_EDITING_DID_ENDED = "xr-editing-did-ended";
130922            }(Ukt || (Ukt = {}));
130923            let Gkt = function(e) {
130924              return t({
130925                EditBox: e,
130926                EditBoxComponent: e
130927              }), e;
130928            }((OVt = Ul("cc.EditBox"), NVt = sh(), LVt = zl(110), FVt = $l(), VVt = Gl(jB),
130929            kVt = ph(), UVt = lh(), GVt = ph(), zVt = lh(), HVt = Th(IP), jVt = ph(), XVt = lh(),
130930            WVt = Th(IP), YVt = ph(), qVt = lh(), KVt = Th(GI), JVt = ph(), ZVt = lh(), QVt = Th(DVt),
130931            $Vt = ph(), tkt = lh(), ekt = Th(BVt), ikt = ph(), skt = lh(), nkt = Th(MVt), rkt = ph(),
130932            okt = lh(), akt = ph(), lkt = lh(), hkt = ph(), ckt = lh(), ukt = Th([ Vc ]), _kt = ph(),
130933            dkt = lh(), pkt = Th([ Vc ]), mkt = ph(), fkt = lh(), gkt = Th([ Vc ]), ykt = ph(),
130934            bkt = lh(), Skt = Th([ Vc ]), Akt = ph(), Tkt = lh(), OVt(vkt = NVt(vkt = LVt(vkt = FVt(vkt = VVt(vkt = Ql(vkt = (Ekt = (kkt = Vkt = class t extends Qc {
130935              constructor(...t) {
130936                super(...t);
130937                Ml(this, "editingDidBegan", Ckt, this);
130938                Ml(this, "textChanged", xkt, this);
130939                Ml(this, "editingDidEnded", wkt, this);
130940                Ml(this, "editingReturn", Rkt, this);
130941                this._impl = null;
130942                this._background = null;
130943                Ml(this, "_textLabel", Ikt, this);
130944                Ml(this, "_placeholderLabel", Mkt, this);
130945                Ml(this, "_returnType", Bkt, this);
130946                Ml(this, "_string", Dkt, this);
130947                Ml(this, "_tabIndex", Pkt, this);
130948                Ml(this, "_backgroundImage", Okt, this);
130949                Ml(this, "_inputFlag", Nkt, this);
130950                Ml(this, "_inputMode", Lkt, this);
130951                Ml(this, "_maxLength", Fkt, this);
130952                this._isLabelVisible = !1;
130953              }
130954              get string() {
130955                return this._string;
130956              }
130957              set string(t) {
130958                this._maxLength >= 0 && t.length >= this._maxLength && (t = t.slice(0, this._maxLength));
130959                if (this._string !== t) {
130960                  this._string = t;
130961                  this._updateString(t);
130962                }
130963              }
130964              get placeholder() {
130965                return this._placeholderLabel ? this._placeholderLabel.string : "";
130966              }
130967              set placeholder(t) {
130968                this._placeholderLabel && (this._placeholderLabel.string = t);
130969              }
130970              get textLabel() {
130971                return this._textLabel;
130972              }
130973              set textLabel(t) {
130974                if (this._textLabel !== t) {
130975                  this._textLabel = t;
130976                  if (this._textLabel) {
130977                    this._updateTextLabel();
130978                    this._updateLabels();
130979                  }
130980                }
130981              }
130982              get placeholderLabel() {
130983                return this._placeholderLabel;
130984              }
130985              set placeholderLabel(t) {
130986                if (this._placeholderLabel !== t) {
130987                  this._placeholderLabel = t;
130988                  if (this._placeholderLabel) {
130989                    this._updatePlaceholderLabel();
130990                    this._updateLabels();
130991                  }
130992                }
130993              }
130994              get backgroundImage() {
130995                return this._backgroundImage;
130996              }
130997              set backgroundImage(t) {
130998                if (this._backgroundImage !== t) {
130999                  this._backgroundImage = t;
131000                  this._ensureBackgroundSprite();
131001                  this._background.spriteFrame = t;
131002                }
131003              }
131004              get inputFlag() {
131005                return this._inputFlag;
131006              }
131007              set inputFlag(t) {
131008                if (this._inputFlag !== t) {
131009                  this._inputFlag = t;
131010                  this._updateString(this._string);
131011                }
131012              }
131013              get inputMode() {
131014                return this._inputMode;
131015              }
131016              set inputMode(t) {
131017                if (this._inputMode !== t) {
131018                  this._inputMode = t;
131019                  this._updateTextLabel();
131020                  this._updatePlaceholderLabel();
131021                }
131022              }
131023              get returnType() {
131024                return this._returnType;
131025              }
131026              set returnType(t) {
131027                this._returnType = t;
131028              }
131029              get maxLength() {
131030                return this._maxLength;
131031              }
131032              set maxLength(t) {
131033                this._maxLength = t;
131034              }
131035              get tabIndex() {
131036                return this._tabIndex;
131037              }
131038              set tabIndex(t) {
131039                if (this._tabIndex !== t) {
131040                  this._tabIndex = t;
131041                  this._impl && this._impl.setTabIndex(t);
131042                }
131043              }
131044              __preload() {
131045                this._init();
131046              }
131047              onEnable() {
131048                this._registerEvent();
131049                this._ensureBackgroundSprite();
131050                this._impl && this._impl.onEnable();
131051              }
131052              update() {
131053                this._impl && this._impl.update();
131054              }
131055              onDisable() {
131056                this._unregisterEvent();
131057                this._unregisterBackgroundEvent();
131058                this._impl && this._impl.onDisable();
131059              }
131060              onDestroy() {
131061                this._impl && this._impl.clear();
131062              }
131063              setFocus() {
131064                this._impl && this._impl.setFocus(!0);
131065              }
131066              focus() {
131067                this._impl && this._impl.setFocus(!0);
131068              }
131069              blur() {
131070                this._impl && this._impl.setFocus(!1);
131071              }
131072              isFocused() {
131073                return !!this._impl && this._impl.isFocused();
131074              }
131075              _editBoxEditingDidBegan() {
131076                Vc.emitEvents(this.editingDidBegan, this);
131077                this.node.emit(Ukt.EDITING_DID_BEGAN, this);
131078              }
131079              _editBoxEditingDidEnded() {
131080                Vc.emitEvents(this.editingDidEnded, this);
131081                this.node.emit(Ukt.EDITING_DID_ENDED, this);
131082              }
131083              _editBoxTextChanged(t) {
131084                t = this._updateLabelStringStyle(t, !0);
131085                this.string = t;
131086                Vc.emitEvents(this.textChanged, t, this);
131087                this.node.emit(Ukt.TEXT_CHANGED, this);
131088              }
131089              _editBoxEditingReturn() {
131090                Vc.emitEvents(this.editingReturn, this);
131091                this.node.emit(Ukt.EDITING_RETURN, this);
131092              }
131093              _showLabels() {
131094                this._isLabelVisible = !0;
131095                this._updateLabels();
131096              }
131097              _hideLabels() {
131098                this._isLabelVisible = !1;
131099                this._textLabel && (this._textLabel.node.active = !1);
131100                this._placeholderLabel && (this._placeholderLabel.node.active = !1);
131101              }
131102              _onTouchBegan(t) {
131103                t.propagationStopped = !0;
131104              }
131105              _onTouchCancel(t) {
131106                t.propagationStopped = !0;
131107              }
131108              _onTouchEnded(t) {
131109                this._impl && this._impl.beginEditing();
131110                t.propagationStopped = !0;
131111              }
131112              _init() {
131113                this._updatePlaceholderLabel();
131114                this._updateTextLabel();
131115                this._isLabelVisible = !0;
131116                this.node.on(ny.SIZE_CHANGED, this._resizeChildNodes, this);
131117                (this._impl = new t._EditBoxImpl).init(this);
131118                this._updateString(this._string);
131119                this._syncSize();
131120              }
131121              _ensureBackgroundSprite() {
131122                if (!this._background) {
131123                  let t = this.node.getComponent(cL);
131124                  t || (t = this.node.addComponent(cL));
131125                  if (t !== this._background) {
131126                    t.type = cL.Type.SLICED;
131127                    t.spriteFrame = this._backgroundImage;
131128                    this._background = t;
131129                    this._registerBackgroundEvent();
131130                  }
131131                }
131132              }
131133              _updateTextLabel() {
131134                let t = this._textLabel;
131135                if (!t) {
131136                  let e = this.node.getChildByName("TEXT_LABEL");
131137                  if (!e) {
131138                    e = new _y("TEXT_LABEL");
131139                    e.layer = this.node.layer;
131140                  }
131141                  t = e.getComponent(IP);
131142                  t || (t = e.addComponent(IP));
131143                  e.parent = this.node;
131144                  this._textLabel = t;
131145                }
131146                this._textLabel.node._uiProps.uiTransformComp.setAnchorPoint(0, 1);
131147                t.overflow = IP.Overflow.CLAMP;
131148                if (this._inputMode === BVt.ANY) {
131149                  t.verticalAlign = xP.TOP;
131150                  t.enableWrapText = !0;
131151                } else t.enableWrapText = !1;
131152                t.string = this._updateLabelStringStyle(this._string);
131153              }
131154              _updatePlaceholderLabel() {
131155                let t = this._placeholderLabel;
131156                if (!t) {
131157                  let e = this.node.getChildByName("PLACEHOLDER_LABEL");
131158                  if (!e) {
131159                    e = new _y("PLACEHOLDER_LABEL");
131160                    e.layer = this.node.layer;
131161                  }
131162                  t = e.getComponent(IP);
131163                  t || (t = e.addComponent(IP));
131164                  e.parent = this.node;
131165                  this._placeholderLabel = t;
131166                }
131167                this._placeholderLabel.node._uiProps.uiTransformComp.setAnchorPoint(0, 1);
131168                this._inputMode === BVt.ANY ? t.enableWrapText = !0 : t.enableWrapText = !1;
131169                t.string = this.placeholder;
131170              }
131171              _syncSize() {
131172                const t = this.node._uiProps.uiTransformComp;
131173                const e = t.contentSize;
131174                if (this._background) {
131175                  const i = this._background.node._uiProps.uiTransformComp;
131176                  i.anchorPoint = t.anchorPoint;
131177                  i.setContentSize(e);
131178                }
131179                this._updateLabelPosition(e);
131180                this._impl && this._impl.setSize(e.width, e.height);
131181              }
131182              _updateLabels() {
131183                if (this._isLabelVisible) {
131184                  const t = this._string;
131185                  this._textLabel && (this._textLabel.node.active = "" !== t);
131186                  this._placeholderLabel && (this._placeholderLabel.node.active = "" === t);
131187                }
131188              }
131189              _updateString(t) {
131190                const e = this._textLabel;
131191                if (!e) return;
131192                let i = t;
131193                i && (i = this._updateLabelStringStyle(i));
131194                e.string = i;
131195                this._updateLabels();
131196              }
131197              _updateLabelStringStyle(t, e = !1) {
131198                const i = this._inputFlag;
131199                if (e || i !== DVt.PASSWORD) i === DVt.INITIAL_CAPS_ALL_CHARACTERS ? t = t.toUpperCase() : i === DVt.INITIAL_CAPS_WORD ? t = t.replace(/(?:^|\s)\S/g, (t => t.toUpperCase())) : i === DVt.INITIAL_CAPS_SENTENCE && (t = function(t) {
131200                  return t.charAt(0).toUpperCase() + t.slice(1);
131201                }(t)); else {
131202                  let e = "";
131203                  const i = t.length;
131204                  for (let t = 0; t < i; ++t) e += "";
131205                  t = e;
131206                }
131207                return t;
131208              }
131209              _registerEvent() {
131210                this.node.on(ny.TOUCH_START, this._onTouchBegan, this);
131211                this.node.on(ny.TOUCH_END, this._onTouchEnded, this);
131212                this.node.on(fFt.XRUI_UNCLICK, this._xrUnClick, this);
131213                this.node.on(gFt.XR_KEYBOARD_INPUT, this._xrKeyBoardInput, this);
131214              }
131215              _unregisterEvent() {
131216                this.node.off(ny.TOUCH_START, this._onTouchBegan, this);
131217                this.node.off(ny.TOUCH_END, this._onTouchEnded, this);
131218                this.node.off(fFt.XRUI_UNCLICK, this._xrUnClick, this);
131219                this.node.off(gFt.XR_KEYBOARD_INPUT, this._xrKeyBoardInput, this);
131220              }
131221              _onBackgroundSpriteFrameChanged() {
131222                this._background && (this.backgroundImage = this._background.spriteFrame);
131223              }
131224              _registerBackgroundEvent() {
131225                const t = this._background && this._background.node;
131226                null == t || t.on(cL.EventType.SPRITE_FRAME_CHANGED, this._onBackgroundSpriteFrameChanged, this);
131227              }
131228              _unregisterBackgroundEvent() {
131229                const t = this._background && this._background.node;
131230                null == t || t.off(cL.EventType.SPRITE_FRAME_CHANGED, this._onBackgroundSpriteFrameChanged, this);
131231              }
131232              _updateLabelPosition(t) {
131233                const e = this.node._uiProps.uiTransformComp;
131234                const i = -e.anchorX * e.width;
131235                const s = -e.anchorY * e.height;
131236                const n = this._placeholderLabel;
131237                const r = this._textLabel;
131238                if (r) {
131239                  r.node._uiProps.uiTransformComp.setContentSize(t.width - 2, t.height);
131240                  r.node.setPosition(i + 2, s + t.height, r.node.position.z);
131241                  this._inputMode === BVt.ANY && (r.verticalAlign = xP.TOP);
131242                  r.enableWrapText = this._inputMode === BVt.ANY;
131243                }
131244                if (n) {
131245                  n.node._uiProps.uiTransformComp.setContentSize(t.width - 2, t.height);
131246                  n.lineHeight = t.height;
131247                  n.node.setPosition(i + 2, s + t.height, n.node.position.z);
131248                  n.enableWrapText = this._inputMode === BVt.ANY;
131249                }
131250              }
131251              _resizeChildNodes() {
131252                const t = this.node._uiProps.uiTransformComp;
131253                const e = this._textLabel && this._textLabel.node;
131254                if (e) {
131255                  e.setPosition(-t.width / 2, t.height / 2, e.position.z);
131256                  e._uiProps.uiTransformComp.setContentSize(t.contentSize);
131257                }
131258                const i = this._placeholderLabel && this._placeholderLabel.node;
131259                if (i) {
131260                  i.setPosition(-t.width / 2, t.height / 2, i.position.z);
131261                  i._uiProps.uiTransformComp.setContentSize(t.contentSize);
131262                }
131263                const s = this._background && this._background.node;
131264                s && s._uiProps.uiTransformComp.setContentSize(t.contentSize);
131265                this._syncSize();
131266              }
131267              _xrUnClick() {
131268                this.node.emit(Ukt.XR_EDITING_DID_BEGAN, this._maxLength, this.string);
131269              }
131270              _xrKeyBoardInput(t) {
131271                this.string = t;
131272              }
131273            }, Vkt._EditBoxImpl = PVt, Vkt.KeyboardReturnType = MVt, Vkt.InputFlag = DVt, Vkt.InputMode = BVt,
131274            Vkt.EventType = Ukt, kkt), Bl(Ekt.prototype, "string", [ kVt, UVt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "string"), Ekt.prototype),
131275            Bl(Ekt.prototype, "placeholder", [ GVt, zVt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "placeholder"), Ekt.prototype),
131276            Bl(Ekt.prototype, "textLabel", [ HVt, jVt, XVt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "textLabel"), Ekt.prototype),
131277            Bl(Ekt.prototype, "placeholderLabel", [ WVt, YVt, qVt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "placeholderLabel"), Ekt.prototype),
131278            Bl(Ekt.prototype, "backgroundImage", [ KVt, JVt, ZVt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "backgroundImage"), Ekt.prototype),
131279            Bl(Ekt.prototype, "inputFlag", [ QVt, $Vt, tkt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "inputFlag"), Ekt.prototype),
131280            Bl(Ekt.prototype, "inputMode", [ ekt, ikt, skt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "inputMode"), Ekt.prototype),
131281            Bl(Ekt.prototype, "returnType", [ nkt, rkt, okt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "returnType"), Ekt.prototype),
131282            Bl(Ekt.prototype, "maxLength", [ akt, lkt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "maxLength"), Ekt.prototype),
131283            Bl(Ekt.prototype, "tabIndex", [ hkt, ckt ], Object.getOwnPropertyDescriptor(Ekt.prototype, "tabIndex"), Ekt.prototype),
131284            Ckt = Bl(Ekt.prototype, "editingDidBegan", [ ukt, Yl, _kt, dkt ], {
131285              configurable: !0,
131286              enumerable: !0,
131287              writable: !0,
131288              initializer: function() {
131289                return [];
131290              }
131291            }), xkt = Bl(Ekt.prototype, "textChanged", [ pkt, Yl, mkt, fkt ], {
131292              configurable: !0,
131293              enumerable: !0,
131294              writable: !0,
131295              initializer: function() {
131296                return [];
131297              }
131298            }), wkt = Bl(Ekt.prototype, "editingDidEnded", [ gkt, Yl, ykt, bkt ], {
131299              configurable: !0,
131300              enumerable: !0,
131301              writable: !0,
131302              initializer: function() {
131303                return [];
131304              }
131305            }), Rkt = Bl(Ekt.prototype, "editingReturn", [ Skt, Yl, Akt, Tkt ], {
131306              configurable: !0,
131307              enumerable: !0,
131308              writable: !0,
131309              initializer: function() {
131310                return [];
131311              }
131312            }), Ikt = Bl(Ekt.prototype, "_textLabel", [ Yl ], {
131313              configurable: !0,
131314              enumerable: !0,
131315              writable: !0,
131316              initializer: function() {
131317                return null;
131318              }
131319            }), Mkt = Bl(Ekt.prototype, "_placeholderLabel", [ Yl ], {
131320              configurable: !0,
131321              enumerable: !0,
131322              writable: !0,
131323              initializer: function() {
131324                return null;
131325              }
131326            }), Bkt = Bl(Ekt.prototype, "_returnType", [ Yl ], {
131327              configurable: !0,
131328              enumerable: !0,
131329              writable: !0,
131330              initializer: function() {
131331                return MVt.DEFAULT;
131332              }
131333            }), Dkt = Bl(Ekt.prototype, "_string", [ Yl ], {
131334              configurable: !0,
131335              enumerable: !0,
131336              writable: !0,
131337              initializer: function() {
131338                return "";
131339              }
131340            }), Pkt = Bl(Ekt.prototype, "_tabIndex", [ Yl ], {
131341              configurable: !0,
131342              enumerable: !0,
131343              writable: !0,
131344              initializer: function() {
131345                return 0;
131346              }
131347            }), Okt = Bl(Ekt.prototype, "_backgroundImage", [ Yl ], {
131348              configurable: !0,
131349              enumerable: !0,
131350              writable: !0,
131351              initializer: function() {
131352                return null;
131353              }
131354            }), Nkt = Bl(Ekt.prototype, "_inputFlag", [ Yl ], {
131355              configurable: !0,
131356              enumerable: !0,
131357              writable: !0,
131358              initializer: function() {
131359                return DVt.DEFAULT;
131360              }
131361            }), Lkt = Bl(Ekt.prototype, "_inputMode", [ Yl ], {
131362              configurable: !0,
131363              enumerable: !0,
131364              writable: !0,
131365              initializer: function() {
131366                return BVt.ANY;
131367              }
131368            }), Fkt = Bl(Ekt.prototype, "_maxLength", [ Yl ], {
131369              configurable: !0,
131370              enumerable: !0,
131371              writable: !0,
131372              initializer: function() {
131373                return 20;
131374              }
131375            }), Ekt)) || vkt) || vkt) || vkt) || vkt) || vkt) || vkt));
131376            0;
131377            m.internal.EditBox = Gkt;
131378            var zkt, Hkt, jkt, Xkt, Wkt, Ykt, qkt, Kkt, Jkt, Zkt, Qkt, $kt, tUt, eUt, iUt, sUt, nUt, rUt, oUt, aUt, lUt, hUt, cUt, uUt, _Ut, dUt, pUt, mUt, fUt, gUt, yUt, bUt, SUt, AUt, TUt, vUt, EUt, CUt, xUt, wUt, RUt, IUt, MUt, BUt, DUt, PUt, OUt, NUt, LUt, FUt, VUt, kUt, UUt, GUt, zUt;
131379            var HUt;
131380            !function(t) {
131381              t[t.NONE = 0] = "NONE";
131382              t[t.HORIZONTAL = 1] = "HORIZONTAL";
131383              t[t.VERTICAL = 2] = "VERTICAL";
131384              t[t.GRID = 3] = "GRID";
131385            }(HUt || (HUt = {}));
131386            he(HUt);
131387            var jUt;
131388            !function(t) {
131389              t[t.NONE = 0] = "NONE";
131390              t[t.CONTAINER = 1] = "CONTAINER";
131391              t[t.CHILDREN = 2] = "CHILDREN";
131392            }(jUt || (jUt = {}));
131393            he(jUt);
131394            var XUt;
131395            !function(t) {
131396              t[t.HORIZONTAL = 0] = "HORIZONTAL";
131397              t[t.VERTICAL = 1] = "VERTICAL";
131398            }(XUt || (XUt = {}));
131399            he(XUt);
131400            var WUt;
131401            !function(t) {
131402              t[t.BOTTOM_TO_TOP = 0] = "BOTTOM_TO_TOP";
131403              t[t.TOP_TO_BOTTOM = 1] = "TOP_TO_BOTTOM";
131404            }(WUt || (WUt = {}));
131405            he(WUt);
131406            var YUt;
131407            !function(t) {
131408              t[t.LEFT_TO_RIGHT = 0] = "LEFT_TO_RIGHT";
131409              t[t.RIGHT_TO_LEFT = 1] = "RIGHT_TO_LEFT";
131410            }(YUt || (YUt = {}));
131411            he(YUt);
131412            var qUt;
131413            !function(t) {
131414              t[t.NONE = 0] = "NONE";
131415              t[t.FIXED_ROW = 1] = "FIXED_ROW";
131416              t[t.FIXED_COL = 2] = "FIXED_COL";
131417            }(qUt || (qUt = {}));
131418            he(qUt);
131419            const KUt = new Pi;
131420            let JUt = function(e) {
131421              return t({
131422                Layout: e,
131423                LayoutComponent: e
131424              }), e;
131425            }((zkt = Ul("cc.Layout"), Hkt = sh(), jkt = zl(110), Xkt = $l(), Wkt = Gl(jB), Ykt = rh(),
131426            qkt = lh(), Kkt = rh(), Jkt = lh(), Zkt = Th(HUt), Qkt = ph(), $kt = lh(), tUt = Th(jUt),
131427            eUt = rh(), iUt = lh(), sUt = rh(), nUt = lh(), rUt = Th(XUt), oUt = lh(), aUt = lh(),
131428            lUt = lh(), hUt = lh(), cUt = lh(), uUt = lh(), _Ut = lh(), dUt = Th(WUt), pUt = lh(),
131429            mUt = Th(YUt), fUt = lh(), gUt = Th(qUt), yUt = rh(), bUt = lh(), SUt = rh(), AUt = lh(),
131430            TUt = lh(), zkt(vUt = Hkt(vUt = jkt(vUt = Xkt(vUt = Wkt(vUt = Ql(vUt = (EUt = (zUt = GUt = class extends Qc {
131431              constructor(...t) {
131432                super(...t);
131433                Ml(this, "_resizeMode", CUt, this);
131434                Ml(this, "_layoutType", xUt, this);
131435                Ml(this, "_cellSize", wUt, this);
131436                Ml(this, "_startAxis", RUt, this);
131437                Ml(this, "_paddingLeft", IUt, this);
131438                Ml(this, "_paddingRight", MUt, this);
131439                Ml(this, "_paddingTop", BUt, this);
131440                Ml(this, "_paddingBottom", DUt, this);
131441                Ml(this, "_spacingX", PUt, this);
131442                Ml(this, "_spacingY", OUt, this);
131443                Ml(this, "_verticalDirection", NUt, this);
131444                Ml(this, "_horizontalDirection", LUt, this);
131445                Ml(this, "_constraint", FUt, this);
131446                Ml(this, "_constraintNum", VUt, this);
131447                Ml(this, "_affectedByScale", kUt, this);
131448                Ml(this, "_isAlign", UUt, this);
131449                this._layoutSize = new rs(300, 200);
131450                this._layoutDirty = !0;
131451                this._childrenDirty = !1;
131452                this._usefulLayoutObj = [];
131453                this._init = !1;
131454              }
131455              get alignHorizontal() {
131456                return this._isAlign;
131457              }
131458              set alignHorizontal(t) {
131459                if (this._layoutType === HUt.HORIZONTAL) {
131460                  this._isAlign = t;
131461                  this._doLayoutDirty();
131462                }
131463              }
131464              get alignVertical() {
131465                return this._isAlign;
131466              }
131467              set alignVertical(t) {
131468                if (this._layoutType === HUt.VERTICAL) {
131469                  this._isAlign = t;
131470                  this._doLayoutDirty();
131471                }
131472              }
131473              get type() {
131474                return this._layoutType;
131475              }
131476              set type(t) {
131477                this._layoutType = t;
131478                this._doLayoutDirty();
131479              }
131480              get resizeMode() {
131481                return this._resizeMode;
131482              }
131483              set resizeMode(t) {
131484                if (this._layoutType !== HUt.NONE) {
131485                  this._resizeMode = t;
131486                  this._doLayoutDirty();
131487                }
131488              }
131489              get cellSize() {
131490                return this._cellSize;
131491              }
131492              set cellSize(t) {
131493                if (this._cellSize !== t) {
131494                  this._cellSize.set(t);
131495                  this._doLayoutDirty();
131496                }
131497              }
131498              get startAxis() {
131499                return this._startAxis;
131500              }
131501              set startAxis(t) {
131502                if (this._startAxis !== t) {
131503                  this._startAxis = t;
131504                  this._doLayoutDirty();
131505                }
131506              }
131507              get paddingLeft() {
131508                return this._paddingLeft;
131509              }
131510              set paddingLeft(t) {
131511                if (this._paddingLeft !== t) {
131512                  this._paddingLeft = t;
131513                  this._doLayoutDirty();
131514                }
131515              }
131516              get paddingRight() {
131517                return this._paddingRight;
131518              }
131519              set paddingRight(t) {
131520                if (this._paddingRight !== t) {
131521                  this._paddingRight = t;
131522                  this._doLayoutDirty();
131523                }
131524              }
131525              get paddingTop() {
131526                return this._paddingTop;
131527              }
131528              set paddingTop(t) {
131529                if (this._paddingTop !== t) {
131530                  this._paddingTop = t;
131531                  this._doLayoutDirty();
131532                }
131533              }
131534              get paddingBottom() {
131535                return this._paddingBottom;
131536              }
131537              set paddingBottom(t) {
131538                if (this._paddingBottom !== t) {
131539                  this._paddingBottom = t;
131540                  this._doLayoutDirty();
131541                }
131542              }
131543              get spacingX() {
131544                return this._spacingX;
131545              }
131546              set spacingX(t) {
131547                if (this._spacingX !== t) {
131548                  this._spacingX = t;
131549                  this._doLayoutDirty();
131550                }
131551              }
131552              get spacingY() {
131553                return this._spacingY;
131554              }
131555              set spacingY(t) {
131556                if (this._spacingY !== t) {
131557                  this._spacingY = t;
131558                  this._doLayoutDirty();
131559                }
131560              }
131561              get verticalDirection() {
131562                return this._verticalDirection;
131563              }
131564              set verticalDirection(t) {
131565                if (this._verticalDirection !== t) {
131566                  this._verticalDirection = t;
131567                  this._doLayoutDirty();
131568                }
131569              }
131570              get horizontalDirection() {
131571                return this._horizontalDirection;
131572              }
131573              set horizontalDirection(t) {
131574                if (this._horizontalDirection !== t) {
131575                  this._horizontalDirection = t;
131576                  this._doLayoutDirty();
131577                }
131578              }
131579              get padding() {
131580                return this._paddingLeft;
131581              }
131582              set padding(t) {
131583                if (this.paddingLeft !== t || this._paddingRight !== t || this._paddingTop !== t || this._paddingBottom !== t) {
131584                  this._paddingLeft = this._paddingRight = this._paddingTop = this._paddingBottom = t;
131585                  this._doLayoutDirty();
131586                }
131587              }
131588              get constraint() {
131589                return this._constraint;
131590              }
131591              set constraint(t) {
131592                if (this._layoutType !== HUt.NONE && this._constraint !== t) {
131593                  this._constraint = t;
131594                  this._doLayoutDirty();
131595                }
131596              }
131597              get constraintNum() {
131598                return this._constraintNum;
131599              }
131600              set constraintNum(t) {
131601                if (this._constraint !== qUt.NONE && this._constraintNum !== t) {
131602                  t <= 0 && C("Limit values to be greater than 0");
131603                  this._constraintNum = t;
131604                  this._doLayoutDirty();
131605                }
131606              }
131607              get affectedByScale() {
131608                return this._affectedByScale;
131609              }
131610              set affectedByScale(t) {
131611                this._affectedByScale = t;
131612                this._doLayoutDirty();
131613              }
131614              updateLayout(t = !1) {
131615                if ((this._layoutDirty || t) && this.node.children.length > 0) {
131616                  this._doLayout();
131617                  this._layoutDirty = !1;
131618                }
131619              }
131620              onEnable() {
131621                this._addEventListeners();
131622                const t = this.node._uiProps.uiTransformComp;
131623                t.contentSize.equals(rs.ZERO) && t.setContentSize(this._layoutSize);
131624                this._childrenChanged();
131625              }
131626              onDisable() {
131627                this._usefulLayoutObj.length = 0;
131628                this._removeEventListeners();
131629              }
131630              _checkUsefulObj() {
131631                this._usefulLayoutObj.length = 0;
131632                const t = this.node.children;
131633                for (let e = 0; e < t.length; ++e) {
131634                  const i = t[e];
131635                  const s = i._uiProps.uiTransformComp;
131636                  i.activeInHierarchy && s && this._usefulLayoutObj.push(s);
131637                }
131638              }
131639              _addEventListeners() {
131640                IR.on(RR.EVENT_AFTER_UPDATE, this.updateLayout, this);
131641                this.node.on(ny.SIZE_CHANGED, this._resized, this);
131642                this.node.on(ny.ANCHOR_CHANGED, this._doLayoutDirty, this);
131643                this.node.on(ny.CHILD_ADDED, this._childAdded, this);
131644                this.node.on(ny.CHILD_REMOVED, this._childRemoved, this);
131645                this.node.on(ny.SIBLING_ORDER_CHANGED, this._childrenChanged, this);
131646                this.node.on("childrenSiblingOrderChanged", this.updateLayout, this);
131647                this._addChildrenEventListeners();
131648              }
131649              _removeEventListeners() {
131650                IR.off(RR.EVENT_AFTER_UPDATE, this.updateLayout, this);
131651                this.node.off(ny.SIZE_CHANGED, this._resized, this);
131652                this.node.off(ny.ANCHOR_CHANGED, this._doLayoutDirty, this);
131653                this.node.off(ny.CHILD_ADDED, this._childAdded, this);
131654                this.node.off(ny.CHILD_REMOVED, this._childRemoved, this);
131655                this.node.off(ny.SIBLING_ORDER_CHANGED, this._childrenChanged, this);
131656                this.node.off("childrenSiblingOrderChanged", this.updateLayout, this);
131657                this._removeChildrenEventListeners();
131658              }
131659              _addChildrenEventListeners() {
131660                const t = this.node.children;
131661                for (let e = 0; e < t.length; ++e) {
131662                  const i = t[e];
131663                  i.on(ny.SIZE_CHANGED, this._doLayoutDirty, this);
131664                  i.on(ny.TRANSFORM_CHANGED, this._transformDirty, this);
131665                  i.on(ny.ANCHOR_CHANGED, this._doLayoutDirty, this);
131666                  i.on(ny.ACTIVE_IN_HIERARCHY_CHANGED, this._childrenChanged, this);
131667                }
131668              }
131669              _removeChildrenEventListeners() {
131670                const t = this.node.children;
131671                for (let e = 0; e < t.length; ++e) {
131672                  const i = t[e];
131673                  i.off(ny.SIZE_CHANGED, this._doLayoutDirty, this);
131674                  i.off(ny.TRANSFORM_CHANGED, this._transformDirty, this);
131675                  i.off(ny.ANCHOR_CHANGED, this._doLayoutDirty, this);
131676                  i.off(ny.ACTIVE_IN_HIERARCHY_CHANGED, this._childrenChanged, this);
131677                }
131678              }
131679              _childAdded(t) {
131680                t.on(ny.SIZE_CHANGED, this._doLayoutDirty, this);
131681                t.on(ny.TRANSFORM_CHANGED, this._transformDirty, this);
131682                t.on(ny.ANCHOR_CHANGED, this._doLayoutDirty, this);
131683                t.on(ny.ACTIVE_IN_HIERARCHY_CHANGED, this._childrenChanged, this);
131684                this._childrenChanged();
131685              }
131686              _childRemoved(t) {
131687                t.off(ny.SIZE_CHANGED, this._doLayoutDirty, this);
131688                t.off(ny.TRANSFORM_CHANGED, this._transformDirty, this);
131689                t.off(ny.ANCHOR_CHANGED, this._doLayoutDirty, this);
131690                t.off(ny.ACTIVE_IN_HIERARCHY_CHANGED, this._childrenChanged, this);
131691                this._childrenChanged();
131692              }
131693              _resized() {
131694                this._layoutSize.set(this.node._uiProps.uiTransformComp.contentSize);
131695                this._doLayoutDirty();
131696              }
131697              _doLayoutHorizontally(t, e, i, s) {
131698                const n = this.node._uiProps.uiTransformComp.anchorPoint;
131699                const r = this._getFixedBreakingNum();
131700                let o = 1;
131701                let a = this._paddingLeft;
131702                if (this._horizontalDirection === YUt.RIGHT_TO_LEFT) {
131703                  o = -1;
131704                  a = this._paddingRight;
131705                }
131706                const l = (this._horizontalDirection - n.x) * t + o * a;
131707                let h = l - o * this._spacingX;
131708                let c = 0;
131709                let u = 0;
131710                let _ = 0;
131711                let d = 0;
131712                let p = !1;
131713                const m = this._usefulLayoutObj.length;
131714                let f = this._cellSize.width;
131715                const g = this._getPaddingH();
131716                this._layoutType !== HUt.GRID && this._resizeMode === jUt.CHILDREN && (f = (t - g - (m - 1) * this._spacingX) / m);
131717                const y = this._usefulLayoutObj;
131718                for (let a = 0; a < y.length; ++a) {
131719                  const m = y[a];
131720                  const b = m.node;
131721                  const S = b.scale;
131722                  const A = this._getUsedScaleValue(S.x);
131723                  const T = this._getUsedScaleValue(S.y);
131724                  if (this._resizeMode === jUt.CHILDREN) {
131725                    m.width = f / A;
131726                    this._layoutType === HUt.GRID && (m.height = this._cellSize.height / T);
131727                  }
131728                  const v = Math.abs(this._horizontalDirection - m.anchorX);
131729                  const E = m.width * A;
131730                  const C = m.height * T;
131731                  if (C > _) {
131732                    d = Math.max(_, d);
131733                    u = _ || C;
131734                    _ = C;
131735                  }
131736                  h += o * (v * E + this._spacingX);
131737                  const x = o * (1 - v) * E;
131738                  if (e) {
131739                    if (r > 0) {
131740                      p = a / r > 0 && a % r == 0;
131741                      p && (u = _ > C ? _ : u);
131742                    } else if (E > t - g) h > l + o * (v * E) && (p = !0); else {
131743                      const e = (1 - this._horizontalDirection - n.x) * t;
131744                      const i = h + x + o * (o > 0 ? this._paddingRight : this._paddingLeft);
131745                      p = Math.abs(i) > Math.abs(e);
131746                    }
131747                    if (p) {
131748                      h = l + o * (v * E);
131749                      C !== _ && (u = _);
131750                      c += u + this._spacingY;
131751                      u = _ = C;
131752                    }
131753                  }
131754                  const w = i(b, m, c);
131755                  s && b.setPosition(h, w);
131756                  h += x;
131757                }
131758                u = Math.max(u, _);
131759                return Math.max(d, c + u) + this._getPaddingV();
131760              }
131761              _doLayoutVertically(t, e, i, s) {
131762                const n = this.node._uiProps.uiTransformComp.anchorPoint;
131763                const r = this._getFixedBreakingNum();
131764                let o = 1;
131765                let a = this._paddingBottom;
131766                if (this._verticalDirection === WUt.TOP_TO_BOTTOM) {
131767                  o = -1;
131768                  a = this._paddingTop;
131769                }
131770                const l = (this._verticalDirection - n.y) * t + o * a;
131771                let h = l - o * this._spacingY;
131772                let c = 0;
131773                let u = 0;
131774                let _ = 0;
131775                let d = 0;
131776                let p = !1;
131777                const m = this._usefulLayoutObj.length;
131778                let f = this._cellSize.height;
131779                const g = this._getPaddingV();
131780                this._layoutType !== HUt.GRID && this._resizeMode === jUt.CHILDREN && (f = (t - g - (m - 1) * this._spacingY) / m);
131781                const y = this._usefulLayoutObj;
131782                for (let a = 0; a < y.length; ++a) {
131783                  const m = y[a];
131784                  const b = m.node;
131785                  const S = b.scale;
131786                  const A = this._getUsedScaleValue(S.x);
131787                  const T = this._getUsedScaleValue(S.y);
131788                  if (this._resizeMode === jUt.CHILDREN) {
131789                    m.height = f / T;
131790                    this._layoutType === HUt.GRID && (m.width = this._cellSize.width / A);
131791                  }
131792                  const v = Math.abs(this._verticalDirection - m.anchorY);
131793                  const E = m.width * A;
131794                  const C = m.height * T;
131795                  if (E > c) {
131796                    u = Math.max(c, u);
131797                    _ = c || E;
131798                    c = E;
131799                  }
131800                  h += o * (v * C + this._spacingY);
131801                  const x = o * (1 - v) * C;
131802                  if (e) {
131803                    if (r > 0) {
131804                      p = a / r > 0 && a % r == 0;
131805                      p && (_ = c > C ? c : _);
131806                    } else if (C > t - g) h > l + o * (v * C) && (p = !0); else {
131807                      const e = (1 - this._verticalDirection - n.y) * t;
131808                      const i = h + x + o * (o > 0 ? this._paddingTop : this._paddingBottom);
131809                      p = Math.abs(i) > Math.abs(e);
131810                    }
131811                    if (p) {
131812                      h = l + o * (v * C);
131813                      E !== c && (_ = c);
131814                      d += _ + this._spacingX;
131815                      _ = c = E;
131816                    }
131817                  }
131818                  const w = i(b, m, d);
131819                  if (s) {
131820                    b.getPosition(KUt);
131821                    b.setPosition(w, h, KUt.z);
131822                  }
131823                  h += x;
131824                }
131825                _ = Math.max(_, c);
131826                return Math.max(u, d + _) + this._getPaddingH();
131827              }
131828              _doLayoutGridAxisHorizontal(t, e) {
131829                const i = e.width;
131830                let s = 1;
131831                let n = -t.y * e.height;
131832                let r = this._paddingBottom;
131833                if (this._verticalDirection === WUt.TOP_TO_BOTTOM) {
131834                  s = -1;
131835                  n = (1 - t.y) * e.height;
131836                  r = this._paddingTop;
131837                }
131838                const o = (t, e, i) => n + s * (i + (1 - e.anchorY) * e.height * this._getUsedScaleValue(t.scale.y) + r);
131839                let a = 0;
131840                if (this._resizeMode === jUt.CONTAINER) {
131841                  a = this._doLayoutHorizontally(i, !0, o, !1);
131842                  n = -t.y * a;
131843                  if (this._verticalDirection === WUt.TOP_TO_BOTTOM) {
131844                    s = -1;
131845                    n = (1 - t.y) * a;
131846                  }
131847                }
131848                this._doLayoutHorizontally(i, !0, o, !0);
131849                this._resizeMode === jUt.CONTAINER && this.node._uiProps.uiTransformComp.setContentSize(i, a);
131850              }
131851              _doLayoutGridAxisVertical(t, e) {
131852                const i = e.height;
131853                let s = 1;
131854                let n = -t.x * e.width;
131855                let r = this._paddingLeft;
131856                if (this._horizontalDirection === YUt.RIGHT_TO_LEFT) {
131857                  s = -1;
131858                  n = (1 - t.x) * e.width;
131859                  r = this._paddingRight;
131860                }
131861                const o = (t, e, i) => n + s * (i + (1 - e.anchorX) * e.width * this._getUsedScaleValue(t.scale.x) + r);
131862                let a = 0;
131863                if (this._resizeMode === jUt.CONTAINER) {
131864                  a = this._doLayoutVertically(i, !0, o, !1);
131865                  n = -t.x * a;
131866                  if (this._horizontalDirection === YUt.RIGHT_TO_LEFT) {
131867                    s = -1;
131868                    n = (1 - t.x) * a;
131869                  }
131870                }
131871                this._doLayoutVertically(i, !0, o, !0);
131872                this._resizeMode === jUt.CONTAINER && this.node._uiProps.uiTransformComp.setContentSize(a, i);
131873              }
131874              _doLayoutGrid() {
131875                const t = this.node._uiProps.uiTransformComp;
131876                const e = t.anchorPoint;
131877                const i = t.contentSize;
131878                this.startAxis === XUt.HORIZONTAL ? this._doLayoutGridAxisHorizontal(e, i) : this.startAxis === XUt.VERTICAL && this._doLayoutGridAxisVertical(e, i);
131879              }
131880              _getHorizontalBaseWidth(t = !0) {
131881                const e = this._usefulLayoutObj;
131882                let i = 0;
131883                const s = e.length;
131884                if (this._resizeMode === jUt.CONTAINER) {
131885                  for (let t = 0; t < e.length; ++t) {
131886                    const s = e[t];
131887                    const n = s.node.scale;
131888                    i += s.width * this._getUsedScaleValue(n.x);
131889                  }
131890                  i += (s - 1) * this._spacingX + this._getPaddingH();
131891                } else i = this.node._uiProps.uiTransformComp.width;
131892                return i;
131893              }
131894              _getVerticalBaseHeight() {
131895                const t = this._usefulLayoutObj;
131896                let e = 0;
131897                const i = t.length;
131898                if (this._resizeMode === jUt.CONTAINER) {
131899                  for (let i = 0; i < t.length; ++i) {
131900                    const s = t[i];
131901                    const n = s.node.scale;
131902                    e += s.height * this._getUsedScaleValue(n.y);
131903                  }
131904                  e += (i - 1) * this._spacingY + this._getPaddingV();
131905                } else e = this.node._uiProps.uiTransformComp.height;
131906                return e;
131907              }
131908              _doLayout() {
131909                if (!this._init || this._childrenDirty) {
131910                  this._checkUsefulObj();
131911                  this._init = !0;
131912                  this._childrenDirty = !1;
131913                }
131914                if (this._layoutType === HUt.HORIZONTAL) {
131915                  const t = this._getHorizontalBaseWidth();
131916                  const e = t => (this._isAlign ? Pi.ZERO : t.position).y;
131917                  this._doLayoutHorizontally(t, !1, e, !0);
131918                  this.node._uiProps.uiTransformComp.width = t;
131919                } else if (this._layoutType === HUt.VERTICAL) {
131920                  const t = this._getVerticalBaseHeight();
131921                  const e = t => (this._isAlign ? Pi.ZERO : t.position).x;
131922                  this._doLayoutVertically(t, !1, e, !0);
131923                  this.node._uiProps.uiTransformComp.height = t;
131924                } else this._layoutType === HUt.GRID && this._doLayoutGrid();
131925              }
131926              _getUsedScaleValue(t) {
131927                return this._affectedByScale ? Math.abs(t) : 1;
131928              }
131929              _transformDirty(t) {
131930                t & ay.SCALE && t & ay.POSITION && this._affectedByScale && this._doLayoutDirty();
131931              }
131932              _doLayoutDirty() {
131933                this._layoutDirty = !0;
131934              }
131935              _childrenChanged() {
131936                this._childrenDirty = !0;
131937                this._doLayoutDirty();
131938              }
131939              _getPaddingH() {
131940                return this._paddingLeft + this._paddingRight;
131941              }
131942              _getPaddingV() {
131943                return this._paddingTop + this._paddingBottom;
131944              }
131945              _getFixedBreakingNum() {
131946                if (this._layoutType !== HUt.GRID || this._constraint === qUt.NONE || this._constraintNum <= 0) return 0;
131947                let t = this._constraint === qUt.FIXED_ROW ? Math.ceil(this._usefulLayoutObj.length / this._constraintNum) : this._constraintNum;
131948                this._startAxis === XUt.VERTICAL && (t = this._constraint === qUt.FIXED_COL ? Math.ceil(this._usefulLayoutObj.length / this._constraintNum) : this._constraintNum);
131949                return t;
131950              }
131951            }, GUt.Type = HUt, GUt.VerticalDirection = WUt, GUt.HorizontalDirection = YUt, GUt.ResizeMode = jUt,
131952            GUt.AxisDirection = XUt, GUt.Constraint = qUt, zUt), Bl(EUt.prototype, "alignHorizontal", [ Ykt, qkt ], Object.getOwnPropertyDescriptor(EUt.prototype, "alignHorizontal"), EUt.prototype),
131953            Bl(EUt.prototype, "alignVertical", [ Kkt, Jkt ], Object.getOwnPropertyDescriptor(EUt.prototype, "alignVertical"), EUt.prototype),
131954            Bl(EUt.prototype, "type", [ Zkt, Qkt, $kt ], Object.getOwnPropertyDescriptor(EUt.prototype, "type"), EUt.prototype),
131955            Bl(EUt.prototype, "resizeMode", [ tUt, eUt, iUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "resizeMode"), EUt.prototype),
131956            Bl(EUt.prototype, "cellSize", [ sUt, nUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "cellSize"), EUt.prototype),
131957            Bl(EUt.prototype, "startAxis", [ rUt, oUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "startAxis"), EUt.prototype),
131958            Bl(EUt.prototype, "paddingLeft", [ aUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "paddingLeft"), EUt.prototype),
131959            Bl(EUt.prototype, "paddingRight", [ lUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "paddingRight"), EUt.prototype),
131960            Bl(EUt.prototype, "paddingTop", [ hUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "paddingTop"), EUt.prototype),
131961            Bl(EUt.prototype, "paddingBottom", [ cUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "paddingBottom"), EUt.prototype),
131962            Bl(EUt.prototype, "spacingX", [ uUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "spacingX"), EUt.prototype),
131963            Bl(EUt.prototype, "spacingY", [ _Ut ], Object.getOwnPropertyDescriptor(EUt.prototype, "spacingY"), EUt.prototype),
131964            Bl(EUt.prototype, "verticalDirection", [ dUt, pUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "verticalDirection"), EUt.prototype),
131965            Bl(EUt.prototype, "horizontalDirection", [ mUt, fUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "horizontalDirection"), EUt.prototype),
131966            Bl(EUt.prototype, "constraint", [ gUt, yUt, bUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "constraint"), EUt.prototype),
131967            Bl(EUt.prototype, "constraintNum", [ SUt, AUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "constraintNum"), EUt.prototype),
131968            Bl(EUt.prototype, "affectedByScale", [ TUt ], Object.getOwnPropertyDescriptor(EUt.prototype, "affectedByScale"), EUt.prototype),
131969            CUt = Bl(EUt.prototype, "_resizeMode", [ Yl ], {
131970              configurable: !0,
131971              enumerable: !0,
131972              writable: !0,
131973              initializer: function() {
131974                return jUt.NONE;
131975              }
131976            }), xUt = Bl(EUt.prototype, "_layoutType", [ Yl ], {
131977              configurable: !0,
131978              enumerable: !0,
131979              writable: !0,
131980              initializer: function() {
131981                return HUt.NONE;
131982              }
131983            }), wUt = Bl(EUt.prototype, "_cellSize", [ Yl ], {
131984              configurable: !0,
131985              enumerable: !0,
131986              writable: !0,
131987              initializer: function() {
131988                return new rs(40, 40);
131989              }
131990            }), RUt = Bl(EUt.prototype, "_startAxis", [ Yl ], {
131991              configurable: !0,
131992              enumerable: !0,
131993              writable: !0,
131994              initializer: function() {
131995                return XUt.HORIZONTAL;
131996              }
131997            }), IUt = Bl(EUt.prototype, "_paddingLeft", [ Yl ], {
131998              configurable: !0,
131999              enumerable: !0,
132000              writable: !0,
132001              initializer: function() {
132002                return 0;
132003              }
132004            }), MUt = Bl(EUt.prototype, "_paddingRight", [ Yl ], {
132005              configurable: !0,
132006              enumerable: !0,
132007              writable: !0,
132008              initializer: function() {
132009                return 0;
132010              }
132011            }), BUt = Bl(EUt.prototype, "_paddingTop", [ Yl ], {
132012              configurable: !0,
132013              enumerable: !0,
132014              writable: !0,
132015              initializer: function() {
132016                return 0;
132017              }
132018            }), DUt = Bl(EUt.prototype, "_paddingBottom", [ Yl ], {
132019              configurable: !0,
132020              enumerable: !0,
132021              writable: !0,
132022              initializer: function() {
132023                return 0;
132024              }
132025            }), PUt = Bl(EUt.prototype, "_spacingX", [ Yl ], {
132026              configurable: !0,
132027              enumerable: !0,
132028              writable: !0,
132029              initializer: function() {
132030                return 0;
132031              }
132032            }), OUt = Bl(EUt.prototype, "_spacingY", [ Yl ], {
132033              configurable: !0,
132034              enumerable: !0,
132035              writable: !0,
132036              initializer: function() {
132037                return 0;
132038              }
132039            }), NUt = Bl(EUt.prototype, "_verticalDirection", [ Yl ], {
132040              configurable: !0,
132041              enumerable: !0,
132042              writable: !0,
132043              initializer: function() {
132044                return WUt.TOP_TO_BOTTOM;
132045              }
132046            }), LUt = Bl(EUt.prototype, "_horizontalDirection", [ Yl ], {
132047              configurable: !0,
132048              enumerable: !0,
132049              writable: !0,
132050              initializer: function() {
132051                return YUt.LEFT_TO_RIGHT;
132052              }
132053            }), FUt = Bl(EUt.prototype, "_constraint", [ Yl ], {
132054              configurable: !0,
132055              enumerable: !0,
132056              writable: !0,
132057              initializer: function() {
132058                return qUt.NONE;
132059              }
132060            }), VUt = Bl(EUt.prototype, "_constraintNum", [ Yl ], {
132061              configurable: !0,
132062              enumerable: !0,
132063              writable: !0,
132064              initializer: function() {
132065                return 2;
132066              }
132067            }), kUt = Bl(EUt.prototype, "_affectedByScale", [ Yl ], {
132068              configurable: !0,
132069              enumerable: !0,
132070              writable: !0,
132071              initializer: function() {
132072                return !1;
132073              }
132074            }), UUt = Bl(EUt.prototype, "_isAlign", [ Yl ], {
132075              configurable: !0,
132076              enumerable: !0,
132077              writable: !0,
132078              initializer: function() {
132079                return !1;
132080              }
132081            }), EUt)) || vUt) || vUt) || vUt) || vUt) || vUt) || vUt));
132082            m.Layout = JUt;
132083            var ZUt, QUt, $Ut, tGt, eGt, iGt, sGt, nGt, rGt, oGt, aGt, lGt, hGt, cGt, uGt, _Gt, dGt, pGt, mGt, fGt, gGt, yGt;
132084            var bGt;
132085            !function(t) {
132086              t[t.HORIZONTAL = 0] = "HORIZONTAL";
132087              t[t.VERTICAL = 1] = "VERTICAL";
132088              t[t.FILLED = 2] = "FILLED";
132089            }(bGt || (bGt = {}));
132090            oe(bGt);
132091            let SGt = function(e) {
132092              return t({
132093                ProgressBar: e,
132094                ProgressBarComponent: e
132095              }), e;
132096            }((ZUt = Ul("cc.ProgressBar"), QUt = sh(), $Ut = zl(110), tGt = $l(), eGt = Gl(jB),
132097            iGt = Th(cL), sGt = lh(), nGt = Th(bGt), rGt = lh(), oGt = lh(), aGt = hh(), lGt = lh(),
132098            hGt = lh(), ZUt(cGt = QUt(cGt = $Ut(cGt = tGt(cGt = eGt(cGt = (uGt = (yGt = gGt = class extends Qc {
132099              constructor(...t) {
132100                super(...t);
132101                Ml(this, "_barSprite", _Gt, this);
132102                Ml(this, "_mode", dGt, this);
132103                Ml(this, "_totalLength", pGt, this);
132104                Ml(this, "_progress", mGt, this);
132105                Ml(this, "_reverse", fGt, this);
132106              }
132107              get barSprite() {
132108                return this._barSprite;
132109              }
132110              set barSprite(t) {
132111                if (this._barSprite !== t) {
132112                  this._barSprite = t;
132113                  this._initBarSprite();
132114                }
132115              }
132116              get mode() {
132117                return this._mode;
132118              }
132119              set mode(t) {
132120                if (this._mode !== t) {
132121                  this._mode = t;
132122                  if (this._barSprite) {
132123                    const t = this._barSprite.node;
132124                    if (!t) return;
132125                    const e = t._uiProps.uiTransformComp.contentSize;
132126                    this._mode === bGt.HORIZONTAL ? this.totalLength = e.width : this._mode === bGt.VERTICAL ? this.totalLength = e.height : this._mode === bGt.FILLED && (this.totalLength = this._barSprite.fillRange);
132127                  }
132128                }
132129              }
132130              get totalLength() {
132131                return this._totalLength;
132132              }
132133              set totalLength(t) {
132134                this._mode === bGt.FILLED && (t = di(t));
132135                if (this._totalLength !== t) {
132136                  this._totalLength = t;
132137                  this._updateBarStatus();
132138                }
132139              }
132140              get progress() {
132141                return this._progress;
132142              }
132143              set progress(t) {
132144                if (this._progress !== t) {
132145                  this._progress = t;
132146                  this._updateBarStatus();
132147                }
132148              }
132149              get reverse() {
132150                return this._reverse;
132151              }
132152              set reverse(t) {
132153                if (this._reverse !== t) {
132154                  this._reverse = t;
132155                  this._barSprite && (this._barSprite.fillStart = 1 - this._barSprite.fillStart);
132156                  this._updateBarStatus();
132157                }
132158              }
132159              _initBarSprite() {
132160                if (this._barSprite) {
132161                  const t = this._barSprite.node;
132162                  if (!t) return;
132163                  const e = this.node._uiProps.uiTransformComp;
132164                  const i = e.contentSize;
132165                  const s = e.anchorPoint;
132166                  const n = t._uiProps.uiTransformComp.contentSize;
132167                  this._barSprite.fillType === cL.FillType.RADIAL && (this._mode = bGt.FILLED);
132168                  this._mode === bGt.HORIZONTAL ? this.totalLength = n.width : this._mode === bGt.VERTICAL ? this.totalLength = n.height : this.totalLength = this._barSprite.fillRange;
132169                  if (t.parent === this.node) {
132170                    const e = -i.width * s.x;
132171                    t.setPosition(e, 0, 0);
132172                  }
132173                }
132174              }
132175              _updateBarStatus() {
132176                if (this._barSprite) {
132177                  const t = this._barSprite.node;
132178                  if (!t) return;
132179                  const e = t._uiProps.uiTransformComp;
132180                  const i = e.anchorPoint;
132181                  const s = e.contentSize;
132182                  const n = t.getPosition();
132183                  let r = new Qi(0, .5);
132184                  const o = di(this._progress);
132185                  let a = this._totalLength * o;
132186                  let l = s;
132187                  let h = 0;
132188                  let c = 0;
132189                  switch (this._mode) {
132190                   case bGt.HORIZONTAL:
132191                    this._reverse && (r = new Qi(1, .5));
132192                    l = new rs(a, s.height);
132193                    h = this._totalLength;
132194                    c = s.height;
132195                    break;
132196
132197                   case bGt.VERTICAL:
132198                    r = this._reverse ? new Qi(.5, 1) : new Qi(.5, 0);
132199                    l = new rs(s.width, a);
132200                    h = s.width;
132201                    c = this._totalLength;
132202                  }
132203                  if (this._mode === bGt.FILLED) if (this._barSprite.type !== cL.Type.FILLED) C("ProgressBar FILLED mode only works when barSprite's Type is FILLED!"); else {
132204                    this._reverse && (a *= -1);
132205                    this._barSprite.fillRange = a;
132206                  } else if (this._barSprite.type !== cL.Type.FILLED) {
132207                    const s = r.x - i.x;
132208                    const o = r.y - i.y;
132209                    const a = new Pi(h * s, c * o, 0);
132210                    t.setPosition(n.x + a.x, n.y + a.y, n.z);
132211                    e.setAnchorPoint(r);
132212                    e.setContentSize(l);
132213                  } else C("ProgressBar non-FILLED mode only works when barSprite's Type is non-FILLED!");
132214                }
132215              }
132216            }, gGt.Mode = bGt, yGt), Bl(uGt.prototype, "barSprite", [ iGt, sGt ], Object.getOwnPropertyDescriptor(uGt.prototype, "barSprite"), uGt.prototype),
132217            Bl(uGt.prototype, "mode", [ nGt, rGt ], Object.getOwnPropertyDescriptor(uGt.prototype, "mode"), uGt.prototype),
132218            Bl(uGt.prototype, "totalLength", [ oGt ], Object.getOwnPropertyDescriptor(uGt.prototype, "totalLength"), uGt.prototype),
132219            Bl(uGt.prototype, "progress", [ aGt, dh, lGt ], Object.getOwnPropertyDescriptor(uGt.prototype, "progress"), uGt.prototype),
132220            Bl(uGt.prototype, "reverse", [ hGt ], Object.getOwnPropertyDescriptor(uGt.prototype, "reverse"), uGt.prototype),
132221            _Gt = Bl(uGt.prototype, "_barSprite", [ Yl ], {
132222              configurable: !0,
132223              enumerable: !0,
132224              writable: !0,
132225              initializer: function() {
132226                return null;
132227              }
132228            }), dGt = Bl(uGt.prototype, "_mode", [ Yl ], {
132229              configurable: !0,
132230              enumerable: !0,
132231              writable: !0,
132232              initializer: function() {
132233                return bGt.HORIZONTAL;
132234              }
132235            }), pGt = Bl(uGt.prototype, "_totalLength", [ Yl ], {
132236              configurable: !0,
132237              enumerable: !0,
132238              writable: !0,
132239              initializer: function() {
132240                return 1;
132241              }
132242            }), mGt = Bl(uGt.prototype, "_progress", [ Yl ], {
132243              configurable: !0,
132244              enumerable: !0,
132245              writable: !0,
132246              initializer: function() {
132247                return .1;
132248              }
132249            }), fGt = Bl(uGt.prototype, "_reverse", [ Yl ], {
132250              configurable: !0,
132251              enumerable: !0,
132252              writable: !0,
132253              initializer: function() {
132254                return !1;
132255              }
132256            }), uGt)) || cGt) || cGt) || cGt) || cGt) || cGt));
132257            m.ProgressBar = SGt;
132258            var AGt, TGt, vGt, EGt, CGt, xGt, wGt, RGt, IGt, MGt, BGt, DGt, PGt, OGt, NGt, LGt, FGt, VGt, kGt, UGt, GGt, zGt, HGt, jGt;
132259            const XGt = new Pi;
132260            const WGt = new Pi;
132261            const YGt = new Pi;
132262            const qGt = new Qi;
132263            const KGt = new Bi;
132264            const JGt = new Qi;
132265            var ZGt;
132266            !function(t) {
132267              t[t.HORIZONTAL = 0] = "HORIZONTAL";
132268              t[t.VERTICAL = 1] = "VERTICAL";
132269            }(ZGt || (ZGt = {}));
132270            he(ZGt);
132271            let QGt = function(e) {
132272              return t({
132273                ScrollBar: e,
132274                ScrollBarComponent: e
132275              }), e;
132276            }((AGt = Ul("cc.ScrollBar"), TGt = sh(), vGt = zl(110), EGt = $l(), CGt = Gl(jB),
132277            xGt = Th(cL), wGt = ph(), RGt = lh(), IGt = Th(ZGt), MGt = ph(), BGt = lh(), DGt = ph(),
132278            PGt = lh(), OGt = ph(), NGt = lh(), AGt(LGt = TGt(LGt = vGt(LGt = EGt(LGt = CGt(LGt = (FGt = (jGt = HGt = class extends Qc {
132279              constructor(...t) {
132280                super(...t);
132281                Ml(this, "_scrollView", VGt, this);
132282                Ml(this, "_handle", kGt, this);
132283                Ml(this, "_direction", UGt, this);
132284                Ml(this, "_enableAutoHide", GGt, this);
132285                Ml(this, "_autoHideTime", zGt, this);
132286                this._touching = !1;
132287                this._opacity = 255;
132288                this._autoHideRemainingTime = 0;
132289              }
132290              get handle() {
132291                return this._handle;
132292              }
132293              set handle(t) {
132294                if (this._handle !== t) {
132295                  this._handle = t;
132296                  this.onScroll(Qi.ZERO);
132297                }
132298              }
132299              get direction() {
132300                return this._direction;
132301              }
132302              set direction(t) {
132303                if (this._direction !== t) {
132304                  this._direction = t;
132305                  this.onScroll(Qi.ZERO);
132306                }
132307              }
132308              get enableAutoHide() {
132309                return this._enableAutoHide;
132310              }
132311              set enableAutoHide(t) {
132312                if (this._enableAutoHide !== t) {
132313                  this._enableAutoHide = t;
132314                  this._enableAutoHide && this._setOpacity(0);
132315                }
132316              }
132317              get autoHideTime() {
132318                return this._autoHideTime;
132319              }
132320              set autoHideTime(t) {
132321                this._autoHideTime !== t && (this._autoHideTime = t);
132322              }
132323              hide() {
132324                this._autoHideRemainingTime = 0;
132325                this._setOpacity(0);
132326              }
132327              show() {
132328                this._autoHideRemainingTime = this._autoHideTime;
132329                this._setOpacity(this._opacity);
132330              }
132331              onScroll(t) {
132332                if (!this._scrollView) return;
132333                const e = this._scrollView.content;
132334                if (!e) return;
132335                const i = e._uiProps.uiTransformComp.contentSize;
132336                const s = this._scrollView.node._uiProps.uiTransformComp.contentSize;
132337                const n = this.node._uiProps.uiTransformComp.contentSize;
132338                if (this._conditionalDisableScrollBar(i, s)) return;
132339                if (this._enableAutoHide) {
132340                  this._autoHideRemainingTime = this._autoHideTime;
132341                  this._setOpacity(this._opacity);
132342                }
132343                let r = 0;
132344                let o = 0;
132345                let a = 0;
132346                let l = 0;
132347                let h = 0;
132348                const c = JGt;
132349                c.set(0, 0);
132350                if (this._direction === ZGt.HORIZONTAL) {
132351                  r = i.width;
132352                  o = s.width;
132353                  h = n.width;
132354                  a = t.x;
132355                  this._convertToScrollViewSpace(c, e);
132356                  l = -c.x;
132357                } else if (this._direction === ZGt.VERTICAL) {
132358                  r = i.height;
132359                  o = s.height;
132360                  h = n.height;
132361                  a = t.y;
132362                  this._convertToScrollViewSpace(c, e);
132363                  l = -c.y;
132364                }
132365                const u = this._calculateLength(r, o, h, a);
132366                const _ = JGt;
132367                this._calculatePosition(_, r, o, h, l, a, u);
132368                this._updateLength(u);
132369                this._updateHandlerPosition(_);
132370              }
132371              setScrollView(t) {
132372                this._scrollView = t;
132373              }
132374              onTouchBegan() {
132375                this._enableAutoHide && (this._touching = !0);
132376              }
132377              onTouchEnded() {
132378                if (this._enableAutoHide) {
132379                  this._touching = !1;
132380                  if (!(this._autoHideTime <= 0)) {
132381                    if (this._scrollView) {
132382                      const t = this._scrollView.content;
132383                      if (t) {
132384                        const e = t._uiProps.uiTransformComp.contentSize;
132385                        const i = this._scrollView.node._uiProps.uiTransformComp.contentSize;
132386                        if (this._conditionalDisableScrollBar(e, i)) return;
132387                      }
132388                    }
132389                    this._autoHideRemainingTime = this._autoHideTime;
132390                  }
132391                }
132392              }
132393              onEnable() {
132394                const t = this.node.getComponent(cL);
132395                t && (this._opacity = t.color.a);
132396              }
132397              start() {
132398                this._enableAutoHide && this._setOpacity(0);
132399              }
132400              update(t) {
132401                this._processAutoHide(t);
132402              }
132403              _convertToScrollViewSpace(t, e) {
132404                const i = this._scrollView && this._scrollView.node._uiProps.uiTransformComp;
132405                const s = e._uiProps.uiTransformComp;
132406                if (i && s) {
132407                  XGt.set(-s.anchorX * s.width, -s.anchorY * s.height, 0);
132408                  s.convertToWorldSpaceAR(XGt, WGt);
132409                  const e = i.convertToNodeSpaceAR(WGt);
132410                  e.x += i.anchorX * i.width;
132411                  e.y += i.anchorY * i.height;
132412                  t.set(e.x, e.y);
132413                } else t.set(Qi.ZERO);
132414              }
132415              _setOpacity(t) {
132416                if (this._handle) {
132417                  let e = this.node.getComponent(cL);
132418                  if (e) {
132419                    KGt.set(e.color);
132420                    KGt.a = t;
132421                    e.color = KGt;
132422                  }
132423                  e = this._handle.getComponent(cL);
132424                  if (e) {
132425                    KGt.set(e.color);
132426                    KGt.a = t;
132427                    e.color = KGt;
132428                  }
132429                }
132430              }
132431              _updateHandlerPosition(t) {
132432                if (this._handle) {
132433                  const e = YGt;
132434                  this._fixupHandlerPosition(e);
132435                  this._handle.node.setPosition(t.x + e.x, t.y + e.y, e.z);
132436                }
132437              }
132438              _fixupHandlerPosition(t) {
132439                const e = this.node._uiProps.uiTransformComp;
132440                const i = e.contentSize;
132441                const s = e.anchorPoint;
132442                const n = this.handle.node._uiProps.uiTransformComp.contentSize;
132443                const r = this.handle.node.parent;
132444                Pi.set(XGt, -i.width * s.x, -i.height * s.y, 0);
132445                const o = this.node._uiProps.uiTransformComp.convertToWorldSpaceAR(XGt, WGt);
132446                const a = t;
132447                a.set(0, 0, 0);
132448                r._uiProps.uiTransformComp.convertToNodeSpaceAR(o, a);
132449                this.direction === ZGt.HORIZONTAL ? a.set(a.x, a.y + (i.height - n.height) / 2, a.z) : this.direction === ZGt.VERTICAL && a.set(a.x + (i.width - n.width) / 2, a.y, a.z);
132450                this.handle.node.setPosition(a);
132451              }
132452              _conditionalDisableScrollBar(t, e) {
132453                return t.width <= e.width && this._direction === ZGt.HORIZONTAL || t.height <= e.height && this._direction === ZGt.VERTICAL;
132454              }
132455              _calculateLength(t, e, i, s) {
132456                let n = t;
132457                s && (n += 20 * (s > 0 ? s : -s));
132458                return i * (e / n);
132459              }
132460              _calculatePosition(t, e, i, s, n, r, o) {
132461                let a = e - i;
132462                r && (a += Math.abs(r));
132463                let l = 0;
132464                if (a) {
132465                  l = n / a;
132466                  l = di(l);
132467                }
132468                const h = (s - o) * l;
132469                this._direction === ZGt.VERTICAL ? t.set(0, h) : t.set(h, 0);
132470              }
132471              _updateLength(t) {
132472                if (this._handle) {
132473                  const e = this._handle.node._uiProps.uiTransformComp;
132474                  const i = e.contentSize;
132475                  const s = e.anchorPoint;
132476                  s.x === qGt.x && s.y === qGt.y || e.setAnchorPoint(qGt);
132477                  this._direction === ZGt.HORIZONTAL ? e.setContentSize(t, i.height) : e.setContentSize(i.width, t);
132478                }
132479              }
132480              _processAutoHide(t) {
132481                if (this._enableAutoHide && !(this._autoHideRemainingTime <= 0) && !this._touching) {
132482                  this._autoHideRemainingTime -= t;
132483                  if (this._autoHideRemainingTime <= this._autoHideTime) {
132484                    this._autoHideRemainingTime = Math.max(0, this._autoHideRemainingTime);
132485                    const t = this._opacity * (this._autoHideRemainingTime / this._autoHideTime);
132486                    this._setOpacity(t);
132487                  }
132488                }
132489              }
132490            }, HGt.Direction = ZGt, jGt), Bl(FGt.prototype, "handle", [ xGt, wGt, RGt ], Object.getOwnPropertyDescriptor(FGt.prototype, "handle"), FGt.prototype),
132491            Bl(FGt.prototype, "direction", [ IGt, MGt, BGt ], Object.getOwnPropertyDescriptor(FGt.prototype, "direction"), FGt.prototype),
132492            Bl(FGt.prototype, "enableAutoHide", [ DGt, PGt ], Object.getOwnPropertyDescriptor(FGt.prototype, "enableAutoHide"), FGt.prototype),
132493            Bl(FGt.prototype, "autoHideTime", [ OGt, NGt ], Object.getOwnPropertyDescriptor(FGt.prototype, "autoHideTime"), FGt.prototype),
132494            VGt = Bl(FGt.prototype, "_scrollView", [ Yl ], {
132495              configurable: !0,
132496              enumerable: !0,
132497              writable: !0,
132498              initializer: function() {
132499                return null;
132500              }
132501            }), kGt = Bl(FGt.prototype, "_handle", [ Yl ], {
132502              configurable: !0,
132503              enumerable: !0,
132504              writable: !0,
132505              initializer: function() {
132506                return null;
132507              }
132508            }), UGt = Bl(FGt.prototype, "_direction", [ Yl ], {
132509              configurable: !0,
132510              enumerable: !0,
132511              writable: !0,
132512              initializer: function() {
132513                return ZGt.HORIZONTAL;
132514              }
132515            }), GGt = Bl(FGt.prototype, "_enableAutoHide", [ Yl ], {
132516              configurable: !0,
132517              enumerable: !0,
132518              writable: !0,
132519              initializer: function() {
132520                return !1;
132521              }
132522            }), zGt = Bl(FGt.prototype, "_autoHideTime", [ Yl ], {
132523              configurable: !0,
132524              enumerable: !0,
132525              writable: !0,
132526              initializer: function() {
132527                return 1;
132528              }
132529            }), FGt)) || LGt) || LGt) || LGt) || LGt) || LGt));
132530            m.ScrollBar = QGt;
132531            var $Gt;
132532            let tzt = t("ViewGroup", Ul("cc.ViewGroup")($Gt = zl(110)($Gt = class extends Qc {}) || $Gt) || $Gt);
132533            m.ViewGroup = tzt;
132534            var ezt, izt, szt, nzt, rzt, ozt, azt, lzt, hzt, czt, uzt, _zt, dzt, pzt, mzt, fzt, gzt, yzt, bzt, Szt, Azt, Tzt, vzt, Ezt, Czt, xzt, wzt, Rzt, Izt, Mzt, Bzt, Dzt, Pzt, Ozt, Nzt, Lzt, Fzt, Vzt, kzt, Uzt, Gzt, zzt, Hzt, jzt, Xzt, Wzt, Yzt, qzt;
132535            const Kzt = 1e-4;
132536            const Jzt = new Pi;
132537            const Zzt = new Pi;
132538            const Qzt = new Qi;
132539            const $zt = new Qi;
132540            const tHt = () => (new Date).getMilliseconds();
132541            const eHt = {
132542              "scroll-to-top": 0,
132543              "scroll-to-bottom": 1,
132544              "scroll-to-left": 2,
132545              "scroll-to-right": 3,
132546              scrolling: 4,
132547              "bounce-bottom": 6,
132548              "bounce-left": 7,
132549              "bounce-right": 8,
132550              "bounce-top": 5,
132551              "scroll-ended": 9,
132552              "touch-up": 10,
132553              "scroll-ended-with-threshold": 11,
132554              "scroll-began": 12
132555            };
132556            let iHt;
132557            !function(t) {
132558              t.SCROLL_TO_TOP = "scroll-to-top";
132559              t.SCROLL_TO_BOTTOM = "scroll-to-bottom";
132560              t.SCROLL_TO_LEFT = "scroll-to-left";
132561              t.SCROLL_TO_RIGHT = "scroll-to-right";
132562              t.SCROLL_BEGAN = "scroll-began";
132563              t.SCROLL_ENDED = "scroll-ended";
132564              t.BOUNCE_TOP = "bounce-top";
132565              t.BOUNCE_BOTTOM = "bounce-bottom";
132566              t.BOUNCE_LEFT = "bounce-left";
132567              t.BOUNCE_RIGHT = "bounce-right";
132568              t.SCROLLING = "scrolling";
132569              t.SCROLL_ENG_WITH_THRESHOLD = "scroll-ended-with-threshold";
132570              t.TOUCH_UP = "touch-up";
132571            }(iHt || (iHt = {}));
132572            var sHt;
132573            !function(t) {
132574              t[t.NONE = 0] = "NONE";
132575              t[t.LEFT = 1] = "LEFT";
132576              t[t.RIGHT = 2] = "RIGHT";
132577            }(sHt || (sHt = {}));
132578            let nHt = function(e) {
132579              return t({
132580                ScrollView: e,
132581                ScrollViewComponent: e
132582              }), e;
132583            }((ezt = Ul("cc.ScrollView"), izt = sh(), szt = zl(110), nzt = $l(), rzt = Gl(jB),
132584            ozt = hh(), azt = ph(), lzt = lh(), hzt = hh(), czt = ph(), uzt = lh(), _zt = ph(),
132585            dzt = lh(), pzt = ph(), mzt = lh(), fzt = Th(_y), gzt = ph(), yzt = lh(), bzt = ph(),
132586            Szt = lh(), Azt = Th(QGt), Tzt = ph(), vzt = lh(), Ezt = ph(), Czt = lh(), xzt = Th(QGt),
132587            wzt = ph(), Rzt = lh(), Izt = ph(), Mzt = lh(), Bzt = Th([ Vc ]), Dzt = ph(), Pzt = lh(),
132588            ezt(Ozt = izt(Ozt = szt(Ozt = nzt(Ozt = rzt(Ozt = (Nzt = (qzt = Yzt = class extends tzt {
132589              constructor(...t) {
132590                super(...t);
132591                Ml(this, "bounceDuration", Lzt, this);
132592                Ml(this, "brake", Fzt, this);
132593                Ml(this, "elastic", Vzt, this);
132594                Ml(this, "inertia", kzt, this);
132595                Ml(this, "horizontal", Uzt, this);
132596                Ml(this, "vertical", Gzt, this);
132597                Ml(this, "cancelInnerEvents", zzt, this);
132598                Ml(this, "scrollEvents", Hzt, this);
132599                this._autoScrolling = !1;
132600                this._scrolling = !1;
132601                Ml(this, "_content", jzt, this);
132602                Ml(this, "_horizontalScrollBar", Xzt, this);
132603                Ml(this, "_verticalScrollBar", Wzt, this);
132604                this._topBoundary = 0;
132605                this._bottomBoundary = 0;
132606                this._leftBoundary = 0;
132607                this._rightBoundary = 0;
132608                this._touchMoveDisplacements = [];
132609                this._touchMoveTimeDeltas = [];
132610                this._touchMovePreviousTimestamp = 0;
132611                this._touchMoved = !1;
132612                this._autoScrollAttenuate = !1;
132613                this._autoScrollStartPosition = new Pi;
132614                this._autoScrollTargetDelta = new Pi;
132615                this._autoScrollTotalTime = 0;
132616                this._autoScrollAccumulatedTime = 0;
132617                this._autoScrollCurrentlyOutOfBoundary = !1;
132618                this._autoScrollBraking = !1;
132619                this._autoScrollBrakingStartPosition = new Pi;
132620                this._outOfBoundaryAmount = new Pi;
132621                this._outOfBoundaryAmountDirty = !0;
132622                this._stopMouseWheel = !1;
132623                this._mouseWheelEventElapsedTime = 0;
132624                this._isScrollEndedWithThresholdEventFired = !1;
132625                this._scrollEventEmitMask = 0;
132626                this._isBouncing = !1;
132627                this._contentPos = new Pi;
132628                this._deltaPos = new Pi;
132629                this._hoverIn = sHt.NONE;
132630                this._scrollState = new Qi(0, 0);
132631              }
132632              get content() {
132633                return this._content;
132634              }
132635              set content(t) {
132636                if (this._content === t) return;
132637                const e = t && t.parent && t.parent._uiProps.uiTransformComp;
132638                if (!t || t && e) {
132639                  this._content = t;
132640                  this._calculateBoundary();
132641                } else P(4302);
132642              }
132643              get horizontalScrollBar() {
132644                return this._horizontalScrollBar;
132645              }
132646              set horizontalScrollBar(t) {
132647                if (this._horizontalScrollBar !== t) {
132648                  this._horizontalScrollBar = t;
132649                  if (this._horizontalScrollBar) {
132650                    this._horizontalScrollBar.setScrollView(this);
132651                    this._updateScrollBar(Qi.ZERO);
132652                  }
132653                }
132654              }
132655              get verticalScrollBar() {
132656                return this._verticalScrollBar;
132657              }
132658              set verticalScrollBar(t) {
132659                if (this._verticalScrollBar !== t) {
132660                  this._verticalScrollBar = t;
132661                  if (this._verticalScrollBar) {
132662                    this._verticalScrollBar.setScrollView(this);
132663                    this._updateScrollBar(Qi.ZERO);
132664                  }
132665                }
132666              }
132667              get view() {
132668                const t = this._content && this._content.parent;
132669                return t ? t._uiProps.uiTransformComp : null;
132670              }
132671              scrollToBottom(t, e = !0) {
132672                const i = this._calculateMovePercentDelta({
132673                  anchor: new Qi(0, 0),
132674                  applyToHorizontal: !1,
132675                  applyToVertical: !0
132676                });
132677                t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i, !0);
132678              }
132679              scrollToTop(t, e = !0) {
132680                const i = this._calculateMovePercentDelta({
132681                  anchor: new Qi(0, 1),
132682                  applyToHorizontal: !1,
132683                  applyToVertical: !0
132684                });
132685                t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i);
132686              }
132687              scrollToLeft(t, e = !0) {
132688                const i = this._calculateMovePercentDelta({
132689                  anchor: new Qi(0, 0),
132690                  applyToHorizontal: !0,
132691                  applyToVertical: !1
132692                });
132693                t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i);
132694              }
132695              scrollToRight(t, e = !0) {
132696                const i = this._calculateMovePercentDelta({
132697                  anchor: new Qi(1, 0),
132698                  applyToHorizontal: !0,
132699                  applyToVertical: !1
132700                });
132701                t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i);
132702              }
132703              scrollToTopLeft(t, e = !0) {
132704                const i = this._calculateMovePercentDelta({
132705                  anchor: new Qi(0, 1),
132706                  applyToHorizontal: !0,
132707                  applyToVertical: !0
132708                });
132709                t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i);
132710              }
132711              scrollToTopRight(t, e = !0) {
132712                const i = this._calculateMovePercentDelta({
132713                  anchor: new Qi(1, 1),
132714                  applyToHorizontal: !0,
132715                  applyToVertical: !0
132716                });
132717                t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i);
132718              }
132719              scrollToBottomLeft(t, e = !0) {
132720                const i = this._calculateMovePercentDelta({
132721                  anchor: new Qi(0, 0),
132722                  applyToHorizontal: !0,
132723                  applyToVertical: !0
132724                });
132725                t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i);
132726              }
132727              scrollToBottomRight(t, e = !0) {
132728                const i = this._calculateMovePercentDelta({
132729                  anchor: new Qi(1, 0),
132730                  applyToHorizontal: !0,
132731                  applyToVertical: !0
132732                });
132733                t ? this._startAutoScroll(i, t, !1 !== e) : this._moveContent(i);
132734              }
132735              scrollToOffset(t, e, i = !0) {
132736                const s = this.getMaxScrollOffset();
132737                const n = new Qi(0, 0);
132738                0 === s.x ? n.x = 0 : n.x = t.x / s.x;
132739                0 === s.y ? n.y = 1 : n.y = (s.y - t.y) / s.y;
132740                this.scrollTo(n, e, i);
132741              }
132742              getScrollOffset() {
132743                const t = this._getContentTopBoundary() - this._topBoundary;
132744                const e = this._getContentLeftBoundary() - this._leftBoundary;
132745                return new Qi(e, t);
132746              }
132747              getMaxScrollOffset() {
132748                if (!this._content || !this.view) return Qi.ZERO;
132749                const t = this._content._uiProps.uiTransformComp.contentSize;
132750                let e = t.width - this.view.width;
132751                let i = t.height - this.view.height;
132752                e = e >= 0 ? e : 0;
132753                i = i >= 0 ? i : 0;
132754                return new Qi(e, i);
132755              }
132756              scrollToPercentHorizontal(t, e, i) {
132757                const s = this._calculateMovePercentDelta({
132758                  anchor: new Qi(t, 0),
132759                  applyToHorizontal: !0,
132760                  applyToVertical: !1
132761                });
132762                e ? this._startAutoScroll(s, e, !1 !== i) : this._moveContent(s);
132763              }
132764              scrollTo(t, e, i) {
132765                const s = this._calculateMovePercentDelta({
132766                  anchor: new Qi(t),
132767                  applyToHorizontal: !0,
132768                  applyToVertical: !0
132769                });
132770                e ? this._startAutoScroll(s, e, i) : this._moveContent(s);
132771              }
132772              scrollToPercentVertical(t, e, i) {
132773                const s = this._calculateMovePercentDelta({
132774                  anchor: new Qi(0, t),
132775                  applyToHorizontal: !1,
132776                  applyToVertical: !0
132777                });
132778                e ? this._startAutoScroll(s, e, i) : this._moveContent(s);
132779              }
132780              stopAutoScroll() {
132781                this._autoScrolling = !1;
132782                this._autoScrollAccumulatedTime = this._autoScrollTotalTime;
132783              }
132784              setContentPosition(t) {
132785                this._setContentPosition(t);
132786              }
132787              _setContentPosition(t) {
132788                if (!this._content) return;
132789                const e = this._getContentPosition();
132790                if (!(Math.abs(t.x - e.x) < Kzt && Math.abs(t.y - e.y) < Kzt)) {
132791                  this._content.setPosition(t);
132792                  this._outOfBoundaryAmountDirty = !0;
132793                }
132794              }
132795              getContentPosition() {
132796                return this._getContentPosition();
132797              }
132798              _getContentPosition() {
132799                if (!this._content) return Pi.ZERO.clone();
132800                this._contentPos.set(this._content.position);
132801                return this._contentPos;
132802              }
132803              isScrolling() {
132804                return this._scrolling;
132805              }
132806              isAutoScrolling() {
132807                return this._autoScrolling;
132808              }
132809              getScrollEndedEventTiming() {
132810                return Kzt;
132811              }
132812              start() {
132813                this._calculateBoundary();
132814                this._content && IR.once(RR.EVENT_BEFORE_DRAW, this._adjustContentOutOfBoundary, this);
132815              }
132816              onEnable() {
132817                this._registerEvent();
132818                if (this._content) {
132819                  this._content.on(ny.SIZE_CHANGED, this._calculateBoundary, this);
132820                  this._content.on(ny.TRANSFORM_CHANGED, this._scaleChanged, this);
132821                  if (this.view) {
132822                    this.view.node.on(ny.TRANSFORM_CHANGED, this._scaleChanged, this);
132823                    this.view.node.on(ny.SIZE_CHANGED, this._calculateBoundary, this);
132824                  }
132825                }
132826                this._calculateBoundary();
132827                this._updateScrollBarState();
132828              }
132829              update(t) {
132830                this._autoScrolling && this._processAutoScrolling(t);
132831              }
132832              onDisable() {
132833                this._unregisterEvent();
132834                if (this._content) {
132835                  this._content.off(ny.SIZE_CHANGED, this._calculateBoundary, this);
132836                  this._content.off(ny.TRANSFORM_CHANGED, this._scaleChanged, this);
132837                  if (this.view) {
132838                    this.view.node.off(ny.TRANSFORM_CHANGED, this._scaleChanged, this);
132839                    this.view.node.off(ny.SIZE_CHANGED, this._calculateBoundary, this);
132840                  }
132841                }
132842                this._hideScrollBar();
132843                this.stopAutoScroll();
132844              }
132845              _registerEvent() {
132846                this.node.on(ny.TOUCH_START, this._onTouchBegan, this, !0);
132847                this.node.on(ny.TOUCH_MOVE, this._onTouchMoved, this, !0);
132848                this.node.on(ny.TOUCH_END, this._onTouchEnded, this, !0);
132849                this.node.on(ny.TOUCH_CANCEL, this._onTouchCancelled, this, !0);
132850                this.node.on(ny.MOUSE_WHEEL, this._onMouseWheel, this, !0);
132851                this.node.on(fFt.XRUI_HOVER_ENTERED, this._xrHoverEnter, this);
132852                this.node.on(fFt.XRUI_HOVER_EXITED, this._xrHoverExit, this);
132853                lv.on(av.EventType.HANDLE_INPUT, this._dispatchEventHandleInput, this);
132854                lv.on(av.EventType.GAMEPAD_INPUT, this._dispatchEventHandleInput, this);
132855              }
132856              _unregisterEvent() {
132857                this.node.off(ny.TOUCH_START, this._onTouchBegan, this, !0);
132858                this.node.off(ny.TOUCH_MOVE, this._onTouchMoved, this, !0);
132859                this.node.off(ny.TOUCH_END, this._onTouchEnded, this, !0);
132860                this.node.off(ny.TOUCH_CANCEL, this._onTouchCancelled, this, !0);
132861                this.node.off(ny.MOUSE_WHEEL, this._onMouseWheel, this, !0);
132862                this.node.off(fFt.XRUI_HOVER_ENTERED, this._xrHoverEnter, this);
132863                this.node.off(fFt.XRUI_HOVER_EXITED, this._xrHoverExit, this);
132864                lv.off(av.EventType.HANDLE_INPUT, this._dispatchEventHandleInput, this);
132865                lv.off(av.EventType.GAMEPAD_INPUT, this._dispatchEventHandleInput, this);
132866              }
132867              _onMouseWheel(t, e) {
132868                if (!this.enabledInHierarchy) return;
132869                if (this._hasNestedViewGroup(t, e)) return;
132870                const i = new Pi;
132871                const s = t.getScrollY();
132872                this.vertical ? i.set(0, -.1 * s, 0) : this.horizontal && i.set(-.1 * s, 0, 0);
132873                this._mouseWheelEventElapsedTime = 0;
132874                this._processDeltaMove(i);
132875                if (!this._stopMouseWheel) {
132876                  this._handlePressLogic();
132877                  this.schedule(this._checkMouseWheel, 1 / 60, NaN, 0);
132878                  this._stopMouseWheel = !0;
132879                }
132880                this._stopPropagationIfTargetIsMe(t);
132881              }
132882              _onTouchBegan(t, e) {
132883                if (this.enabledInHierarchy && this._content && !this._hasNestedViewGroup(t, e)) {
132884                  this._handlePressLogic();
132885                  this._touchMoved = !1;
132886                  this._stopPropagationIfTargetIsMe(t);
132887                }
132888              }
132889              _onTouchMoved(t, e) {
132890                if (!this.enabledInHierarchy || !this._content) return;
132891                if (this._hasNestedViewGroup(t, e)) return;
132892                const i = t.touch;
132893                this._handleMoveLogic(i);
132894                if (!this.cancelInnerEvents) return;
132895                const s = i.getUILocation(Qzt);
132896                s.subtract(i.getUIStartLocation($zt));
132897                if (s.length() > 7 && !this._touchMoved && t.target !== this.node) {
132898                  const e = new NS(t.getTouches(), t.bubbles, IS.TOUCH_CANCEL);
132899                  e.touch = t.touch;
132900                  e.simulate = !0;
132901                  t.target.dispatchEvent(e);
132902                  this._touchMoved = !0;
132903                }
132904                this._stopPropagationIfTargetIsMe(t);
132905              }
132906              _onTouchEnded(t, e) {
132907                if (!this.enabledInHierarchy || !this._content || !t) return;
132908                if (this._hasNestedViewGroup(t, e)) return;
132909                this._dispatchEvent(iHt.TOUCH_UP);
132910                const i = t.touch;
132911                this._handleReleaseLogic(i);
132912                this._touchMoved ? t.propagationStopped = !0 : this._stopPropagationIfTargetIsMe(t);
132913              }
132914              _onTouchCancelled(t, e) {
132915                if (this.enabledInHierarchy && this._content && !this._hasNestedViewGroup(t, e)) {
132916                  if (t && !t.simulate) {
132917                    const e = t.touch;
132918                    this._handleReleaseLogic(e);
132919                  }
132920                  this._stopPropagationIfTargetIsMe(t);
132921                }
132922              }
132923              _calculateBoundary() {
132924                if (this._content && this.view) {
132925                  const t = this._content.getComponent(JUt);
132926                  t && t.enabledInHierarchy && t.updateLayout();
132927                  const e = this.view;
132928                  const i = e.width * e.anchorX;
132929                  const s = e.height * e.anchorY;
132930                  this._leftBoundary = -i;
132931                  this._bottomBoundary = -s;
132932                  this._rightBoundary = this._leftBoundary + e.width;
132933                  this._topBoundary = this._bottomBoundary + e.height;
132934                  this._moveContentToTopLeft(e.contentSize);
132935                }
132936              }
132937              _hasNestedViewGroup(t, e) {
132938                if (!t || t.eventPhase !== RS.CAPTURING_PHASE) return !1;
132939                if (e) for (const i of e) {
132940                  const e = i;
132941                  if (this.node === e) return !(!t.target || !t.target.getComponent(tzt));
132942                  if (e.getComponent(tzt)) return !0;
132943                }
132944                return !1;
132945              }
132946              _startInertiaScroll(t) {
132947                const e = new Pi(t);
132948                e.multiplyScalar(.7);
132949                this._startAttenuatingAutoScroll(e, t);
132950              }
132951              _calculateAttenuatedFactor(t) {
132952                return this.brake <= 0 ? 1 - this.brake : (1 - this.brake) * (1 / (1 + 14e-6 * t + t * t * 8e-9));
132953              }
132954              _startAttenuatingAutoScroll(t, e) {
132955                const i = t.clone();
132956                i.normalize();
132957                if (this._content && this.view) {
132958                  const t = this._content._uiProps.uiTransformComp.contentSize;
132959                  const e = this.view.contentSize;
132960                  const s = t.width - e.width;
132961                  const n = t.height - e.height;
132962                  const r = this._calculateAttenuatedFactor(s);
132963                  const o = this._calculateAttenuatedFactor(n);
132964                  i.x = i.x * s * (1 - this.brake) * r;
132965                  i.y = i.y * n * o * (1 - this.brake);
132966                  i.z = 0;
132967                }
132968                const s = t.length();
132969                let n = i.length() / s;
132970                i.add(t);
132971                if (this.brake > 0 && n > 7) {
132972                  n = Math.sqrt(n);
132973                  const e = t.clone();
132974                  e.multiplyScalar(n);
132975                  i.set(e);
132976                  i.add(t);
132977                }
132978                let r = this._calculateAutoScrollTimeByInitialSpeed(e.length());
132979                if (this.brake > 0 && n > 3) {
132980                  n = 3;
132981                  r *= n;
132982                }
132983                0 === this.brake && n > 1 && (r *= n);
132984                this._startAutoScroll(i, r, !0);
132985              }
132986              _calculateAutoScrollTimeByInitialSpeed(t) {
132987                return Math.sqrt(Math.sqrt(t / 5));
132988              }
132989              _startAutoScroll(t, e, i = !1) {
132990                const s = this._flattenVectorByDirection(t);
132991                this._autoScrolling = !0;
132992                this._autoScrollTargetDelta = s;
132993                this._autoScrollAttenuate = i;
132994                Pi.copy(this._autoScrollStartPosition, this._getContentPosition());
132995                this._autoScrollTotalTime = e;
132996                this._autoScrollAccumulatedTime = 0;
132997                this._autoScrollBraking = !1;
132998                this._isScrollEndedWithThresholdEventFired = !1;
132999                this._autoScrollBrakingStartPosition.set(0, 0, 0);
133000                this._getHowMuchOutOfBoundary().equals(Pi.ZERO, Kzt) || (this._autoScrollCurrentlyOutOfBoundary = !0);
133001              }
133002              _calculateTouchMoveVelocity() {
133003                const t = new Pi;
133004                let e = 0;
133005                e = this._touchMoveTimeDeltas.reduce(((t, e) => t + e), e);
133006                if (e <= 0 || e >= .5) t.set(Pi.ZERO); else {
133007                  let i = new Pi;
133008                  i = this._touchMoveDisplacements.reduce(((t, e) => {
133009                    t.add(e);
133010                    return t;
133011                  }), i);
133012                  t.set(i.x * (1 - this.brake) / e, i.y * (1 - this.brake) / e, i.z);
133013                }
133014                return t;
133015              }
133016              _flattenVectorByDirection(t) {
133017                const e = t;
133018                e.x = this.horizontal ? e.x : 0;
133019                e.y = this.vertical ? e.y : 0;
133020                return e;
133021              }
133022              _moveContent(t, e) {
133023                const i = this._flattenVectorByDirection(t);
133024                Jzt.set(this._getContentPosition());
133025                Jzt.add(i);
133026                Jzt.set(Math.round(1e4 * Jzt.x) * Kzt, Math.round(1e4 * Jzt.y) * Kzt, Jzt.z);
133027                this._setContentPosition(Jzt);
133028                const s = this._getHowMuchOutOfBoundary();
133029                Qzt.set(s.x, s.y);
133030                this._updateScrollBar(Qzt);
133031                this.elastic && e && this._startBounceBackIfNeeded();
133032              }
133033              _getContentLeftBoundary() {
133034                if (!this._content) return -1;
133035                const t = this._getContentPosition();
133036                const e = this._content._uiProps.uiTransformComp;
133037                return t.x - e.anchorX * e.width;
133038              }
133039              _getContentRightBoundary() {
133040                if (!this._content) return -1;
133041                const t = this._content._uiProps.uiTransformComp;
133042                return this._getContentLeftBoundary() + t.width;
133043              }
133044              _getContentTopBoundary() {
133045                if (!this._content) return -1;
133046                const t = this._content._uiProps.uiTransformComp;
133047                return this._getContentBottomBoundary() + t.height;
133048              }
133049              _getContentBottomBoundary() {
133050                if (!this._content) return -1;
133051                const t = this._getContentPosition();
133052                const e = this._content._uiProps.uiTransformComp;
133053                return t.y - e.anchorY * e.height;
133054              }
133055              _getHowMuchOutOfBoundary(t) {
133056                if ((t = t || new Pi).equals(Pi.ZERO, Kzt) && !this._outOfBoundaryAmountDirty) return this._outOfBoundaryAmount;
133057                const e = new Pi;
133058                const i = this._getContentLeftBoundary();
133059                const s = this._getContentRightBoundary();
133060                i + t.x > this._leftBoundary ? e.x = this._leftBoundary - (i + t.x) : s + t.x < this._rightBoundary && (e.x = this._rightBoundary - (s + t.x));
133061                const n = this._getContentTopBoundary();
133062                const r = this._getContentBottomBoundary();
133063                n + t.y < this._topBoundary ? e.y = this._topBoundary - (n + t.y) : r + t.y > this._bottomBoundary && (e.y = this._bottomBoundary - (r + t.y));
133064                if (t.equals(Pi.ZERO, Kzt)) {
133065                  this._outOfBoundaryAmount = e;
133066                  this._outOfBoundaryAmountDirty = !1;
133067                }
133068                this._clampDelta(e);
133069                return e;
133070              }
133071              _updateScrollBar(t) {
133072                this._horizontalScrollBar && this._horizontalScrollBar.onScroll(t);
133073                this.verticalScrollBar && this.verticalScrollBar.onScroll(t);
133074              }
133075              _onScrollBarTouchBegan() {
133076                this._horizontalScrollBar && this._horizontalScrollBar.onTouchBegan();
133077                this.verticalScrollBar && this.verticalScrollBar.onTouchBegan();
133078              }
133079              _onScrollBarTouchEnded() {
133080                this._horizontalScrollBar && this._horizontalScrollBar.onTouchEnded();
133081                this.verticalScrollBar && this.verticalScrollBar.onTouchEnded();
133082              }
133083              _dispatchEvent(t) {
133084                if (t === iHt.SCROLL_ENDED) this._scrollEventEmitMask = 0; else if (t === iHt.SCROLL_TO_TOP || t === iHt.SCROLL_TO_BOTTOM || t === iHt.SCROLL_TO_LEFT || t === iHt.SCROLL_TO_RIGHT) {
133085                  const e = 1 << eHt[t];
133086                  if (this._scrollEventEmitMask & e) return;
133087                  this._scrollEventEmitMask |= e;
133088                }
133089                Vc.emitEvents(this.scrollEvents, this, eHt[t]);
133090                this.node.emit(t, this);
133091              }
133092              _adjustContentOutOfBoundary() {
133093                if (this._content) {
133094                  this._outOfBoundaryAmountDirty = !0;
133095                  if (this._isOutOfBoundary()) {
133096                    const t = this._getHowMuchOutOfBoundary();
133097                    Jzt.set(this._getContentPosition());
133098                    Jzt.add(t);
133099                    this._content.setPosition(Jzt);
133100                    this._updateScrollBar(Qi.ZERO);
133101                  }
133102                }
133103              }
133104              _hideScrollBar() {
133105                this._horizontalScrollBar && this._horizontalScrollBar.hide();
133106                this._verticalScrollBar && this._verticalScrollBar.hide();
133107              }
133108              _updateScrollBarState() {
133109                if (!this._content || !this.view) return;
133110                const t = this.view;
133111                const e = this._content._uiProps.uiTransformComp;
133112                this.verticalScrollBar && (e.height < t.height ? this.verticalScrollBar.hide() : this.verticalScrollBar.show());
133113                this.horizontalScrollBar && (e.width < t.width ? this.horizontalScrollBar.hide() : this.horizontalScrollBar.show());
133114              }
133115              _stopPropagationIfTargetIsMe(t) {
133116                t.eventPhase === RS.AT_TARGET && t.target === this.node && (t.propagationStopped = !0);
133117              }
133118              _processDeltaMove(t) {
133119                this._scrollChildren(t);
133120                this._gatherTouchMove(t);
133121              }
133122              _handleMoveLogic(t) {
133123                this._getLocalAxisAlignDelta(this._deltaPos, t);
133124                this._processDeltaMove(this._deltaPos);
133125              }
133126              _handleReleaseLogic(t) {
133127                this._getLocalAxisAlignDelta(this._deltaPos, t);
133128                this._gatherTouchMove(this._deltaPos);
133129                this._processInertiaScroll();
133130                if (this._scrolling) {
133131                  this._scrolling = !1;
133132                  this._autoScrolling || this._dispatchEvent(iHt.SCROLL_ENDED);
133133                }
133134              }
133135              _getLocalAxisAlignDelta(t, e) {
133136                const i = this.node._uiProps.uiTransformComp;
133137                const s = new Pi;
133138                if (i) {
133139                  e.getUILocation(Qzt);
133140                  e.getUIPreviousLocation($zt);
133141                  Jzt.set(Qzt.x, Qzt.y, 0);
133142                  Zzt.set($zt.x, $zt.y, 0);
133143                  i.convertToNodeSpaceAR(Jzt, Jzt);
133144                  i.convertToNodeSpaceAR(Zzt, Zzt);
133145                  Pi.subtract(s, Jzt, Zzt);
133146                }
133147                t.set(s);
133148              }
133149              _scrollChildren(t) {
133150                this._clampDelta(t);
133151                const e = t;
133152                let i;
133153                if (this.elastic) {
133154                  i = this._getHowMuchOutOfBoundary();
133155                  e.x *= 0 === i.x ? 1 : .5;
133156                  e.y *= 0 === i.y ? 1 : .5;
133157                }
133158                if (!this.elastic) {
133159                  i = this._getHowMuchOutOfBoundary(e);
133160                  e.add(i);
133161                }
133162                let s = "";
133163                let n = "";
133164                if (this._content) {
133165                  const {anchorX: t, anchorY: i, width: r, height: o} = this._content._uiProps.uiTransformComp;
133166                  const a = this._content.position || Pi.ZERO;
133167                  if (this.vertical) if (e.y > 0) {
133168                    a.y - i * o + e.y >= this._bottomBoundary && (s = iHt.SCROLL_TO_BOTTOM);
133169                  } else if (e.y < 0) {
133170                    a.y - i * o + o + e.y <= this._topBoundary && (s = iHt.SCROLL_TO_TOP);
133171                  }
133172                  if (this.horizontal) if (e.x < 0) {
133173                    a.x - t * r + r + e.x <= this._rightBoundary && (n = iHt.SCROLL_TO_RIGHT);
133174                  } else if (e.x > 0) {
133175                    a.x - t * r + e.x >= this._leftBoundary && (n = iHt.SCROLL_TO_LEFT);
133176                  }
133177                }
133178                this._moveContent(e, !1);
133179                if (this.horizontal && 0 !== e.x || this.vertical && 0 !== e.y) {
133180                  if (!this._scrolling) {
133181                    this._scrolling = !0;
133182                    this._dispatchEvent(iHt.SCROLL_BEGAN);
133183                  }
133184                  this._dispatchEvent(iHt.SCROLLING);
133185                }
133186                "" !== s && this._dispatchEvent(s);
133187                "" !== n && this._dispatchEvent(n);
133188              }
133189              _handlePressLogic() {
133190                this._autoScrolling && this._dispatchEvent(iHt.SCROLL_ENDED);
133191                this._autoScrolling = !1;
133192                this._isBouncing = !1;
133193                this._touchMovePreviousTimestamp = tHt();
133194                this._touchMoveDisplacements.length = 0;
133195                this._touchMoveTimeDeltas.length = 0;
133196                this._onScrollBarTouchBegan();
133197              }
133198              _clampDelta(t) {
133199                if (this._content && this.view) {
133200                  const e = this.view.contentSize;
133201                  const i = this._content._uiProps.uiTransformComp;
133202                  i.width < e.width && (t.x = 0);
133203                  i.height < e.height && (t.y = 0);
133204                }
133205              }
133206              _gatherTouchMove(t) {
133207                const e = t.clone();
133208                this._clampDelta(e);
133209                for (;this._touchMoveDisplacements.length >= 5; ) {
133210                  this._touchMoveDisplacements.shift();
133211                  this._touchMoveTimeDeltas.shift();
133212                }
133213                this._touchMoveDisplacements.push(e);
133214                const i = tHt();
133215                this._touchMoveTimeDeltas.push((i - this._touchMovePreviousTimestamp) / 1e3);
133216                this._touchMovePreviousTimestamp = i;
133217              }
133218              _startBounceBackIfNeeded() {
133219                if (!this.elastic) return !1;
133220                const t = this._getHowMuchOutOfBoundary();
133221                this._clampDelta(t);
133222                if (t.equals(Pi.ZERO, Kzt)) return !1;
133223                const e = Math.max(this.bounceDuration, 0);
133224                this._startAutoScroll(t, e, !0);
133225                if (!this._isBouncing) {
133226                  t.y > 0 && this._dispatchEvent(iHt.BOUNCE_TOP);
133227                  t.y < 0 && this._dispatchEvent(iHt.BOUNCE_BOTTOM);
133228                  t.x > 0 && this._dispatchEvent(iHt.BOUNCE_RIGHT);
133229                  t.x < 0 && this._dispatchEvent(iHt.BOUNCE_LEFT);
133230                  this._isBouncing = !0;
133231                }
133232                return !0;
133233              }
133234              _processInertiaScroll() {
133235                if (!this._startBounceBackIfNeeded() && this.inertia) {
133236                  const t = this._calculateTouchMoveVelocity();
133237                  !t.equals(Jzt, Kzt) && this.brake < 1 && this._startInertiaScroll(t);
133238                }
133239                this._onScrollBarTouchEnded();
133240              }
133241              _isOutOfBoundary() {
133242                return !this._getHowMuchOutOfBoundary().equals(Pi.ZERO, Kzt);
133243              }
133244              _isNecessaryAutoScrollBrake() {
133245                if (this._autoScrollBraking) return !0;
133246                if (this._isOutOfBoundary()) {
133247                  if (!this._autoScrollCurrentlyOutOfBoundary) {
133248                    this._autoScrollCurrentlyOutOfBoundary = !0;
133249                    this._autoScrollBraking = !0;
133250                    Pi.copy(this._autoScrollBrakingStartPosition, this._getContentPosition());
133251                    return !0;
133252                  }
133253                } else this._autoScrollCurrentlyOutOfBoundary = !1;
133254                return !1;
133255              }
133256              _processAutoScrolling(t) {
133257                const e = this._isNecessaryAutoScrollBrake();
133258                const i = e ? .05 : 1;
133259                this._autoScrollAccumulatedTime += t * (1 / i);
133260                let s = Math.min(1, this._autoScrollAccumulatedTime / this._autoScrollTotalTime);
133261                this._autoScrollAttenuate && (s = (n = s, (n -= 1) * n * n * n * n + 1));
133262                var n;
133263                const r = this._autoScrollTargetDelta.clone();
133264                r.multiplyScalar(s);
133265                const o = this._autoScrollStartPosition.clone();
133266                o.add(r);
133267                let a = Math.abs(s - 1) <= Kzt;
133268                if (Math.abs(s - 1) <= this.getScrollEndedEventTiming() && !this._isScrollEndedWithThresholdEventFired) {
133269                  this._dispatchEvent(iHt.SCROLL_ENG_WITH_THRESHOLD);
133270                  this._isScrollEndedWithThresholdEventFired = !0;
133271                }
133272                if (this.elastic) {
133273                  const t = o.clone();
133274                  t.subtract(this._autoScrollBrakingStartPosition);
133275                  e && t.multiplyScalar(i);
133276                  o.set(this._autoScrollBrakingStartPosition);
133277                  o.add(t);
133278                } else {
133279                  const t = o.clone();
133280                  t.subtract(this.getContentPosition());
133281                  const e = this._getHowMuchOutOfBoundary(t);
133282                  if (!e.equals(Pi.ZERO, Kzt)) {
133283                    o.add(e);
133284                    a = !0;
133285                  }
133286                }
133287                a && (this._autoScrolling = !1);
133288                const l = o.clone();
133289                l.subtract(this._getContentPosition());
133290                this._clampDelta(l);
133291                this._moveContent(l, a);
133292                this._dispatchEvent(iHt.SCROLLING);
133293                if (!this._autoScrolling) {
133294                  this._isBouncing = !1;
133295                  this._scrolling = !1;
133296                  this._dispatchEvent(iHt.SCROLL_ENDED);
133297                }
133298              }
133299              _checkMouseWheel(t) {
133300                if (this._getHowMuchOutOfBoundary().equals(Pi.ZERO, Kzt)) {
133301                  this._mouseWheelEventElapsedTime += t;
133302                  if (this._mouseWheelEventElapsedTime > .1) {
133303                    this._onScrollBarTouchEnded();
133304                    this.unschedule(this._checkMouseWheel);
133305                    this._dispatchEvent(iHt.SCROLL_ENDED);
133306                    this._stopMouseWheel = !1;
133307                  }
133308                } else {
133309                  this._processInertiaScroll();
133310                  this.unschedule(this._checkMouseWheel);
133311                  this._dispatchEvent(iHt.SCROLL_ENDED);
133312                  this._stopMouseWheel = !1;
133313                }
133314              }
133315              _calculateMovePercentDelta(t) {
133316                const e = t.anchor;
133317                const i = t.applyToHorizontal;
133318                const s = t.applyToVertical;
133319                this._calculateBoundary();
133320                e.clampf(Qi.ZERO, Qi.ONE);
133321                let n = this._getContentBottomBoundary() - this._bottomBoundary;
133322                n = -n;
133323                let r = this._getContentLeftBoundary() - this._leftBoundary;
133324                r = -r;
133325                const o = new Pi;
133326                if (this._content && this.view) {
133327                  let t = 0;
133328                  const a = this._content._uiProps.uiTransformComp.contentSize;
133329                  const l = this.view.contentSize;
133330                  if (i) {
133331                    t = a.width - l.width;
133332                    o.x = r - t * e.x;
133333                  }
133334                  if (s) {
133335                    t = a.height - l.height;
133336                    o.y = n - t * e.y;
133337                  }
133338                }
133339                return o;
133340              }
133341              _moveContentToTopLeft(t) {
133342                let e = this._getContentBottomBoundary() - this._bottomBoundary;
133343                e = -e;
133344                const i = new Pi;
133345                let s = 0;
133346                let n = this._getContentLeftBoundary() - this._leftBoundary;
133347                n = -n;
133348                if (this._content) {
133349                  const r = this._content._uiProps.uiTransformComp.contentSize;
133350                  if (r.height < t.height) {
133351                    s = r.height - t.height;
133352                    i.y = e - s;
133353                  }
133354                  if (r.width < t.width) {
133355                    s = r.width - t.width;
133356                    i.x = n;
133357                  }
133358                }
133359                this._updateScrollBarState();
133360                this._moveContent(i);
133361                this._adjustContentOutOfBoundary();
133362              }
133363              _scaleChanged(t) {
133364                t === ay.SCALE && this._calculateBoundary();
133365              }
133366              _xrHoverEnter(t) {
133367                t.deviceType === pFt.Left ? this._hoverIn = sHt.LEFT : t.deviceType === pFt.Right && (this._hoverIn = sHt.RIGHT);
133368                this._autoScrolling = !1;
133369                this._dispatchEvent(iHt.SCROLL_BEGAN);
133370              }
133371              _xrHoverExit() {
133372                this._hoverIn = sHt.NONE;
133373                this._autoScrolling = !0;
133374                this._dispatchEvent(iHt.SCROLL_ENDED);
133375              }
133376              _dispatchEventHandleInput(t) {
133377                let e;
133378                t instanceof LS ? e = t.gamepad : t instanceof FS && (e = t.handleInputDevice);
133379                let i;
133380                if (this.enabledInHierarchy && this._hoverIn !== sHt.NONE) {
133381                  if (this._hoverIn === sHt.LEFT) {
133382                    i = e.leftStick.getValue();
133383                    i.equals(Qi.ZERO) || this._xrThumbStickMove(i);
133384                  } else if (this._hoverIn === sHt.RIGHT) {
133385                    i = e.rightStick.getValue();
133386                    i.equals(Qi.ZERO) || this._xrThumbStickMove(i);
133387                  }
133388                  if (!i && this._scrollState.equals(Qi.ZERO)) {
133389                    this._xrThumbStickMoveEnd();
133390                    this._scrollState.set(i);
133391                  }
133392                }
133393              }
133394              _xrThumbStickMove(t) {
133395                const e = new Pi;
133396                const i = t.y;
133397                this.vertical ? e.set(0, -62.5 * i, 0) : this.horizontal && e.set(-62.5 * i, 0, 0);
133398                this._mouseWheelEventElapsedTime = 0;
133399                this._processDeltaMove(e);
133400                this._dispatchEvent(iHt.SCROLLING);
133401              }
133402              _xrThumbStickMoveEnd() {
133403                this._autoScrolling = !0;
133404                this._dispatchEvent(iHt.TOUCH_UP);
133405              }
133406            }, Yzt.EventType = iHt, qzt), Lzt = Bl(Nzt.prototype, "bounceDuration", [ Yl, ozt, azt, lzt ], {
133407              configurable: !0,
133408              enumerable: !0,
133409              writable: !0,
133410              initializer: function() {
133411                return 1;
133412              }
133413            }), Fzt = Bl(Nzt.prototype, "brake", [ Yl, hzt, czt, uzt ], {
133414              configurable: !0,
133415              enumerable: !0,
133416              writable: !0,
133417              initializer: function() {
133418                return .5;
133419              }
133420            }), Vzt = Bl(Nzt.prototype, "elastic", [ Yl, _zt, dzt ], {
133421              configurable: !0,
133422              enumerable: !0,
133423              writable: !0,
133424              initializer: function() {
133425                return !0;
133426              }
133427            }), kzt = Bl(Nzt.prototype, "inertia", [ Yl, pzt, mzt ], {
133428              configurable: !0,
133429              enumerable: !0,
133430              writable: !0,
133431              initializer: function() {
133432                return !0;
133433              }
133434            }), Bl(Nzt.prototype, "content", [ fzt, gzt, yzt ], Object.getOwnPropertyDescriptor(Nzt.prototype, "content"), Nzt.prototype),
133435            Uzt = Bl(Nzt.prototype, "horizontal", [ Yl, bzt, Szt ], {
133436              configurable: !0,
133437              enumerable: !0,
133438              writable: !0,
133439              initializer: function() {
133440                return !0;
133441              }
133442            }), Bl(Nzt.prototype, "horizontalScrollBar", [ Azt, Tzt, vzt ], Object.getOwnPropertyDescriptor(Nzt.prototype, "horizontalScrollBar"), Nzt.prototype),
133443            Gzt = Bl(Nzt.prototype, "vertical", [ Yl, Ezt, Czt ], {
133444              configurable: !0,
133445              enumerable: !0,
133446              writable: !0,
133447              initializer: function() {
133448                return !0;
133449              }
133450            }), Bl(Nzt.prototype, "verticalScrollBar", [ xzt, wzt, Rzt ], Object.getOwnPropertyDescriptor(Nzt.prototype, "verticalScrollBar"), Nzt.prototype),
133451            zzt = Bl(Nzt.prototype, "cancelInnerEvents", [ Yl, Izt, Mzt ], {
133452              configurable: !0,
133453              enumerable: !0,
133454              writable: !0,
133455              initializer: function() {
133456                return !0;
133457              }
133458            }), Hzt = Bl(Nzt.prototype, "scrollEvents", [ Bzt, Yl, Dzt, Pzt ], {
133459              configurable: !0,
133460              enumerable: !0,
133461              writable: !0,
133462              initializer: function() {
133463                return [];
133464              }
133465            }), jzt = Bl(Nzt.prototype, "_content", [ Yl ], {
133466              configurable: !0,
133467              enumerable: !0,
133468              writable: !0,
133469              initializer: function() {
133470                return null;
133471              }
133472            }), Xzt = Bl(Nzt.prototype, "_horizontalScrollBar", [ Yl ], {
133473              configurable: !0,
133474              enumerable: !0,
133475              writable: !0,
133476              initializer: function() {
133477                return null;
133478              }
133479            }), Wzt = Bl(Nzt.prototype, "_verticalScrollBar", [ Yl ], {
133480              configurable: !0,
133481              enumerable: !0,
133482              writable: !0,
133483              initializer: function() {
133484                return null;
133485              }
133486            }), Nzt)) || Ozt) || Ozt) || Ozt) || Ozt) || Ozt));
133487            m.ScrollView = nHt;
133488            var rHt, oHt, aHt, lHt, hHt, cHt, uHt, _Ht, dHt, pHt, mHt, fHt, gHt, yHt, bHt, SHt, AHt, THt, vHt, EHt, CHt;
133489            const xHt = new Pi;
133490            var wHt;
133491            !function(t) {
133492              t[t.Horizontal = 0] = "Horizontal";
133493              t[t.Vertical = 1] = "Vertical";
133494            }(wHt || (wHt = {}));
133495            he(wHt);
133496            let RHt = function(e) {
133497              return t({
133498                Slider: e,
133499                SliderComponent: e
133500              }), e;
133501            }((rHt = Ul("cc.Slider"), oHt = sh(), aHt = zl(110), lHt = $l(), hHt = Gl(jB), cHt = Th(cL),
133502            uHt = lh(), _Ht = Th(wHt), dHt = lh(), pHt = hh(), mHt = lh(), fHt = Th([ Vc ]),
133503            gHt = lh(), rHt(yHt = oHt(yHt = aHt(yHt = lHt(yHt = hHt(yHt = (bHt = (CHt = EHt = class extends Qc {
133504              constructor(...t) {
133505                super(...t);
133506                Ml(this, "slideEvents", SHt, this);
133507                Ml(this, "_handle", AHt, this);
133508                Ml(this, "_direction", THt, this);
133509                Ml(this, "_progress", vHt, this);
133510                this._offset = new Pi;
133511                this._dragging = !1;
133512                this._touchHandle = !1;
133513                this._handleLocalPos = new Pi;
133514                this._touchPos = new Pi;
133515              }
133516              get handle() {
133517                return this._handle;
133518              }
133519              set handle(t) {
133520                this._handle !== t && (this._handle = t);
133521              }
133522              get direction() {
133523                return this._direction;
133524              }
133525              set direction(t) {
133526                if (this._direction !== t) {
133527                  this._direction = t;
133528                  this._changeLayout();
133529                }
133530              }
133531              get progress() {
133532                return this._progress;
133533              }
133534              set progress(t) {
133535                if (this._progress !== t) {
133536                  this._progress = t;
133537                  this._updateHandlePosition();
133538                }
133539              }
133540              __preload() {
133541                this._updateHandlePosition();
133542              }
133543              onEnable() {
133544                this._updateHandlePosition();
133545                this.node.on(ny.TOUCH_START, this._onTouchBegan, this);
133546                this.node.on(ny.TOUCH_MOVE, this._onTouchMoved, this);
133547                this.node.on(ny.TOUCH_END, this._onTouchEnded, this);
133548                this.node.on(ny.TOUCH_CANCEL, this._onTouchCancelled, this);
133549                this.node.on(fFt.XRUI_HOVER_STAY, this._xrHoverStay, this);
133550                this.node.on(fFt.XRUI_CLICK, this._xrClick, this);
133551                this.node.on(fFt.XRUI_UNCLICK, this._xrUnClick, this);
133552                if (this._handle && this._handle.isValid) {
133553                  this._handle.node.on(ny.TOUCH_START, this._onHandleDragStart, this);
133554                  this._handle.node.on(ny.TOUCH_MOVE, this._onTouchMoved, this);
133555                  this._handle.node.on(ny.TOUCH_END, this._onTouchEnded, this);
133556                }
133557              }
133558              onDisable() {
133559                this.node.off(ny.TOUCH_START, this._onTouchBegan, this);
133560                this.node.off(ny.TOUCH_MOVE, this._onTouchMoved, this);
133561                this.node.off(ny.TOUCH_END, this._onTouchEnded, this);
133562                this.node.off(ny.TOUCH_CANCEL, this._onTouchCancelled, this);
133563                this.node.off(fFt.XRUI_HOVER_STAY, this._xrHoverStay, this);
133564                this.node.off(fFt.XRUI_CLICK, this._xrClick, this);
133565                this.node.off(fFt.XRUI_UNCLICK, this._xrUnClick, this);
133566                if (this._handle && this._handle.isValid) {
133567                  this._handle.node.off(ny.TOUCH_START, this._onHandleDragStart, this);
133568                  this._handle.node.off(ny.TOUCH_MOVE, this._onTouchMoved, this);
133569                  this._handle.node.off(ny.TOUCH_END, this._onTouchEnded, this);
133570                }
133571              }
133572              _onHandleDragStart(t) {
133573                if (!t || !this._handle || !this._handle.node._uiProps.uiTransformComp) return;
133574                this._dragging = !0;
133575                this._touchHandle = !0;
133576                const e = t.touch.getUILocation();
133577                Pi.set(this._touchPos, e.x, e.y, 0);
133578                this._handle.node._uiProps.uiTransformComp.convertToNodeSpaceAR(this._touchPos, this._offset);
133579                t.propagationStopped = !0;
133580              }
133581              _onTouchBegan(t) {
133582                if (this._handle && t) {
133583                  this._dragging = !0;
133584                  this._touchHandle || this._handleSliderLogic(t.touch);
133585                  t.propagationStopped = !0;
133586                }
133587              }
133588              _onTouchMoved(t) {
133589                if (this._dragging && t) {
133590                  this._handleSliderLogic(t.touch);
133591                  t.propagationStopped = !0;
133592                }
133593              }
133594              _onTouchEnded(t) {
133595                this._dragging = !1;
133596                this._touchHandle = !1;
133597                this._offset = new Pi;
133598                t && (t.propagationStopped = !0);
133599              }
133600              _onTouchCancelled(t) {
133601                this._dragging = !1;
133602                t && (t.propagationStopped = !0);
133603              }
133604              _handleSliderLogic(t) {
133605                this._updateProgress(t);
133606                this._emitSlideEvent();
133607              }
133608              _emitSlideEvent() {
133609                Vc.emitEvents(this.slideEvents, this);
133610                this.node.emit("slide", this);
133611              }
133612              _updateProgress(t) {
133613                if (!this._handle || !t) return;
133614                const e = t.getUILocation();
133615                Pi.set(this._touchPos, e.x, e.y, 0);
133616                const i = this.node._uiProps.uiTransformComp;
133617                const s = i.convertToNodeSpaceAR(this._touchPos, xHt);
133618                this.direction === wHt.Horizontal ? this.progress = di(.5 + (s.x - this._offset.x) / i.width) : this.progress = di(.5 + (s.y - this._offset.y) / i.height);
133619              }
133620              _updateHandlePosition() {
133621                if (!this._handle) return;
133622                this._handleLocalPos.set(this._handle.node.getPosition());
133623                const t = this.node._uiProps.uiTransformComp;
133624                this._direction === wHt.Horizontal ? this._handleLocalPos.x = -t.width * t.anchorX + this.progress * t.width : this._handleLocalPos.y = -t.height * t.anchorY + this.progress * t.height;
133625                this._handle.node.setPosition(this._handleLocalPos);
133626              }
133627              _changeLayout() {
133628                const t = this.node._uiProps.uiTransformComp;
133629                const e = t.contentSize;
133630                t.setContentSize(e.height, e.width);
133631                if (this._handle) {
133632                  const t = this._handle.node.position;
133633                  this._direction === wHt.Horizontal ? this._handle.node.setPosition(t.x, 0, t.z) : this._handle.node.setPosition(0, t.y, t.z);
133634                  this._updateHandlePosition();
133635                }
133636              }
133637              _xrHandleProgress(t) {
133638                if (!this._touchHandle) {
133639                  const e = this.node._uiProps.uiTransformComp;
133640                  e.convertToNodeSpaceAR(t, xHt);
133641                  this.direction === wHt.Horizontal ? this.progress = di(.5 + (xHt.x - this.node.position.x) / e.width) : this.progress = di(.5 + (xHt.y - this.node.position.y) / e.height);
133642                }
133643              }
133644              _xrClick(t) {
133645                if (this._handle) {
133646                  this._dragging = !0;
133647                  this._xrHandleProgress(t.hitPoint);
133648                  this._emitSlideEvent();
133649                }
133650              }
133651              _xrUnClick() {
133652                this._dragging = !1;
133653                this._touchHandle = !1;
133654              }
133655              _xrHoverStay(t) {
133656                if (this._dragging) {
133657                  this._xrHandleProgress(t.hitPoint);
133658                  this._emitSlideEvent();
133659                }
133660              }
133661            }, EHt.Direction = wHt, CHt), Bl(bHt.prototype, "handle", [ cHt, uHt ], Object.getOwnPropertyDescriptor(bHt.prototype, "handle"), bHt.prototype),
133662            Bl(bHt.prototype, "direction", [ _Ht, dHt ], Object.getOwnPropertyDescriptor(bHt.prototype, "direction"), bHt.prototype),
133663            Bl(bHt.prototype, "progress", [ dh, pHt, mHt ], Object.getOwnPropertyDescriptor(bHt.prototype, "progress"), bHt.prototype),
133664            SHt = Bl(bHt.prototype, "slideEvents", [ fHt, Yl, gHt ], {
133665              configurable: !0,
133666              enumerable: !0,
133667              writable: !0,
133668              initializer: function() {
133669                return [];
133670              }
133671            }), AHt = Bl(bHt.prototype, "_handle", [ Yl ], {
133672              configurable: !0,
133673              enumerable: !0,
133674              writable: !0,
133675              initializer: function() {
133676                return null;
133677              }
133678            }), THt = Bl(bHt.prototype, "_direction", [ Yl ], {
133679              configurable: !0,
133680              enumerable: !0,
133681              writable: !0,
133682              initializer: function() {
133683                return wHt.Horizontal;
133684              }
133685            }), vHt = Bl(bHt.prototype, "_progress", [ Yl ], {
133686              configurable: !0,
133687              enumerable: !0,
133688              writable: !0,
133689              initializer: function() {
133690                return .1;
133691              }
133692            }), bHt)) || yHt) || yHt) || yHt) || yHt) || yHt));
133693            m.Slider = RHt;
133694            function IHt(...t) {
133695              return Object.assign({}, ...t);
133696            }
133697            var MHt, BHt, DHt, PHt, OHt, NHt, LHt, FHt, VHt, kHt, UHt, GHt, zHt, HHt, jHt, XHt, WHt, YHt, qHt;
133698            var KHt;
133699            !function(t) {
133700              t.TOGGLE = "toggle";
133701            }(KHt || (KHt = {}));
133702            let JHt = function(e) {
133703              return t({
133704                Toggle: e,
133705                ToggleComponent: e
133706              }), e;
133707            }((MHt = Ul("cc.Toggle"), BHt = sh(), DHt = zl(110), PHt = $l(), OHt = Gl(jB), NHt = ph(),
133708            LHt = lh(), FHt = Th(cL), VHt = ph(), kHt = lh(), UHt = Th([ Vc ]), GHt = lh(),
133709            MHt(zHt = BHt(zHt = DHt(zHt = PHt(zHt = OHt(zHt = (HHt = (qHt = YHt = class t extends RVt {
133710              constructor(...t) {
133711                super(...t);
133712                Ml(this, "checkEvents", jHt, this);
133713                Ml(this, "_isChecked", XHt, this);
133714                Ml(this, "_checkMark", WHt, this);
133715              }
133716              get isChecked() {
133717                return this._isChecked;
133718              }
133719              set isChecked(t) {
133720                this._set(t);
133721              }
133722              get checkMark() {
133723                return this._checkMark;
133724              }
133725              set checkMark(t) {
133726                this._checkMark !== t && (this._checkMark = t);
133727              }
133728              set _resizeToTarget(t) {
133729                t && this._resizeNodeToTargetNode();
133730              }
133731              get _toggleContainer() {
133732                const t = this.node.parent;
133733                return m.Node.isNode(t) ? t.getComponent("cc.ToggleContainer") : null;
133734              }
133735              _internalToggle() {
133736                this.isChecked = !this.isChecked;
133737              }
133738              _set(t, e = !0) {
133739                if (this._isChecked == t) return;
133740                this._isChecked = t;
133741                const i = this._toggleContainer;
133742                if (i && i.enabled && this.enabled && (t || !i.anyTogglesChecked() && !i.allowSwitchOff)) {
133743                  this._isChecked = !0;
133744                  i.notifyToggleCheck(this, e);
133745                }
133746                this.playEffect();
133747                e && this._emitToggleEvents();
133748              }
133749              playEffect() {
133750                this._checkMark && (this._checkMark.node.active = this._isChecked);
133751              }
133752              setIsCheckedWithoutNotify(t) {
133753                this._set(t, !1);
133754              }
133755              onEnable() {
133756                super.onEnable();
133757                this.playEffect();
133758                this.node.on(t.EventType.CLICK, this._internalToggle, this);
133759              }
133760              onDisable() {
133761                super.onDisable();
133762                this.node.off(t.EventType.CLICK, this._internalToggle, this);
133763              }
133764              OnDestroy() {
133765                const t = this._toggleContainer;
133766                t && t.ensureValidState();
133767              }
133768              _emitToggleEvents() {
133769                this.node.emit(t.EventType.TOGGLE, this);
133770                this.checkEvents && Vc.emitEvents(this.checkEvents, this);
133771              }
133772            }, YHt.EventType = IHt(KHt, wVt), qHt), Bl(HHt.prototype, "isChecked", [ NHt, LHt ], Object.getOwnPropertyDescriptor(HHt.prototype, "isChecked"), HHt.prototype),
133773            Bl(HHt.prototype, "checkMark", [ FHt, VHt, kHt ], Object.getOwnPropertyDescriptor(HHt.prototype, "checkMark"), HHt.prototype),
133774            jHt = Bl(HHt.prototype, "checkEvents", [ UHt, Yl, GHt ], {
133775              configurable: !0,
133776              enumerable: !0,
133777              writable: !0,
133778              initializer: function() {
133779                return [];
133780              }
133781            }), XHt = Bl(HHt.prototype, "_isChecked", [ Yl ], {
133782              configurable: !0,
133783              enumerable: !0,
133784              writable: !0,
133785              initializer: function() {
133786                return !0;
133787              }
133788            }), WHt = Bl(HHt.prototype, "_checkMark", [ Yl ], {
133789              configurable: !0,
133790              enumerable: !0,
133791              writable: !0,
133792              initializer: function() {
133793                return null;
133794              }
133795            }), HHt)) || zHt) || zHt) || zHt) || zHt) || zHt));
133796            m.Toggle = JHt;
133797            var ZHt, QHt, $Ht, tjt, ejt, ijt, sjt, njt, rjt, ojt, ajt, ljt;
133798            let hjt = function(e) {
133799              return t({
133800                ToggleContainer: e,
133801                ToggleContainerComponent: e
133802              }), e;
133803            }((ZHt = Ul("cc.ToggleContainer"), QHt = sh(), $Ht = zl(110), tjt = $l(), ejt = lh(),
133804            ijt = Th([ Vc ]), sjt = lh(), ZHt(njt = QHt(njt = $Ht(njt = tjt(njt = Ql(njt = (rjt = (ljt = class extends Qc {
133805              constructor(...t) {
133806                super(...t);
133807                Ml(this, "_allowSwitchOff", ojt, this);
133808                Ml(this, "checkEvents", ajt, this);
133809              }
133810              get allowSwitchOff() {
133811                return this._allowSwitchOff;
133812              }
133813              set allowSwitchOff(t) {
133814                this._allowSwitchOff = t;
133815              }
133816              get toggleItems() {
133817                return this.node.children.map((t => {
133818                  const e = t.getComponent("cc.Toggle");
133819                  return e && e.enabled ? e : null;
133820                })).filter(Boolean);
133821              }
133822              onEnable() {
133823                this.ensureValidState();
133824                this.node.on(ny.CHILD_ADDED, this.ensureValidState, this);
133825                this.node.on(ny.CHILD_REMOVED, this.ensureValidState, this);
133826              }
133827              onDisable() {
133828                this.node.off(ny.CHILD_ADDED, this.ensureValidState, this);
133829                this.node.off(ny.CHILD_REMOVED, this.ensureValidState, this);
133830              }
133831              activeToggles() {
133832                return this.toggleItems.filter((t => t.isChecked));
133833              }
133834              anyTogglesChecked() {
133835                return !!this.toggleItems.find((t => t.isChecked));
133836              }
133837              notifyToggleCheck(t, e = !0) {
133838                if (this.enabledInHierarchy) {
133839                  for (let i = 0; i < this.toggleItems.length; i++) {
133840                    const s = this.toggleItems[i];
133841                    s !== t && (e ? s.isChecked = !1 : s.setIsCheckedWithoutNotify(!1));
133842                  }
133843                  this.checkEvents && m.Component.EventHandler.emitEvents(this.checkEvents, t);
133844                }
133845              }
133846              ensureValidState() {
133847                const t = this.toggleItems;
133848                if (!this._allowSwitchOff && !this.anyTogglesChecked() && 0 !== t.length) {
133849                  const e = t[0];
133850                  e.isChecked = !0;
133851                  this.notifyToggleCheck(e);
133852                }
133853                const e = this.activeToggles();
133854                if (e.length > 1) {
133855                  const t = e[0];
133856                  for (let i = 0; i < e.length; ++i) {
133857                    const s = e[i];
133858                    s !== t && (s.isChecked = !1);
133859                  }
133860                }
133861              }
133862            }, ljt), ojt = Bl(rjt.prototype, "_allowSwitchOff", [ Yl ], {
133863              configurable: !0,
133864              enumerable: !0,
133865              writable: !0,
133866              initializer: function() {
133867                return !1;
133868              }
133869            }), Bl(rjt.prototype, "allowSwitchOff", [ ejt ], Object.getOwnPropertyDescriptor(rjt.prototype, "allowSwitchOff"), rjt.prototype),
133870            ajt = Bl(rjt.prototype, "checkEvents", [ ijt, Yl, sjt ], {
133871              configurable: !0,
133872              enumerable: !0,
133873              writable: !0,
133874              initializer: function() {
133875                return [];
133876              }
133877            }), rjt)) || njt) || njt) || njt) || njt) || njt));
133878            m.ToggleContainer = hjt;
133879            var cjt, ujt, _jt, djt, pjt, mjt, fjt, gjt, yjt, bjt, Sjt, Ajt, Tjt, vjt, Ejt, Cjt, xjt, wjt, Rjt, Ijt, Mjt, Bjt, Djt, Pjt, Ojt, Njt, Ljt, Fjt, Vjt, kjt, Ujt, Gjt, zjt, Hjt, jjt, Xjt, Wjt, Yjt, qjt, Kjt, Jjt, Zjt, Qjt, $jt, tXt;
133880            const eXt = new Qi;
133881            function iXt(t) {
133882              return t instanceof oA ? HR : t._uiProps.uiTransformComp ? t._uiProps.uiTransformComp.contentSize : rs.ZERO;
133883            }
133884            function sXt(t, e, i, s) {
133885              t.parent ? eXt.set(t.parent.getScale().x, t.parent.getScale().y) : eXt.set(0, 0);
133886              let n = eXt.x;
133887              let r = eXt.y;
133888              let o = 0;
133889              let a = 0;
133890              for (let l = t.parent; ;) {
133891                if (!l) {
133892                  i.x = i.y = 0;
133893                  s.x = s.y = 1;
133894                  return;
133895                }
133896                const t = l.getPosition();
133897                o += t.x;
133898                a += t.y;
133899                l = l.parent;
133900                if (l === e) break;
133901                {
133902                  l ? eXt.set(l.getScale().x, l.getScale().y) : eXt.set(0, 0);
133903                  const t = eXt.x;
133904                  const e = eXt.y;
133905                  o *= t;
133906                  a *= e;
133907                  n *= t;
133908                  r *= e;
133909                }
133910              }
133911              s.x = 0 !== n ? 1 / n : 1;
133912              s.y = 0 !== r ? 1 / r : 1;
133913              i.x = -o;
133914              i.y = -a;
133915            }
133916            let nXt;
133917            !function(t) {
133918              t[t.ONCE = 0] = "ONCE";
133919              t[t.ALWAYS = 1] = "ALWAYS";
133920              t[t.ON_WINDOW_RESIZE = 2] = "ON_WINDOW_RESIZE";
133921            }(nXt || (nXt = {}));
133922            he(nXt);
133923            let rXt;
133924            !function(t) {
133925              t[t.TOP = 1] = "TOP";
133926              t[t.MID = 2] = "MID";
133927              t[t.BOT = 4] = "BOT";
133928              t[t.LEFT = 8] = "LEFT";
133929              t[t.CENTER = 16] = "CENTER";
133930              t[t.RIGHT = 32] = "RIGHT";
133931              t[t.HORIZONTAL = 56] = "HORIZONTAL";
133932              t[t.VERTICAL = 7] = "VERTICAL";
133933            }(rXt || (rXt = {}));
133934            const oXt = rXt.TOP | rXt.BOT;
133935            const aXt = rXt.LEFT | rXt.RIGHT;
133936            let lXt = function(e) {
133937              return t({
133938                Widget: e,
133939                WidgetComponent: e
133940              }), e;
133941            }((cjt = Ul("cc.Widget"), ujt = sh(), _jt = zl(110), djt = $l(), pjt = Gl(jB), mjt = Th(_y),
133942            fjt = lh(), gjt = lh(), yjt = lh(), bjt = lh(), Sjt = lh(), Ajt = lh(), Tjt = lh(),
133943            vjt = rh(), Ejt = rh(), Cjt = lh(), xjt = lh(), wjt = lh(), Rjt = lh(), Ijt = lh(),
133944            Mjt = lh(), Bjt = Th(nXt), Djt = lh(), cjt(Pjt = ujt(Pjt = _jt(Pjt = djt(Pjt = pjt(Pjt = Ql(Pjt = (Ojt = (tXt = $jt = class extends Qc {
133945              constructor(...t) {
133946                super(...t);
133947                this._lastPos = new Pi;
133948                this._lastSize = new rs;
133949                this._dirty = !0;
133950                this._hadAlignOnce = !1;
133951                Ml(this, "_alignFlags", Njt, this);
133952                Ml(this, "_target", Ljt, this);
133953                Ml(this, "_left", Fjt, this);
133954                Ml(this, "_right", Vjt, this);
133955                Ml(this, "_top", kjt, this);
133956                Ml(this, "_bottom", Ujt, this);
133957                Ml(this, "_horizontalCenter", Gjt, this);
133958                Ml(this, "_verticalCenter", zjt, this);
133959                Ml(this, "_isAbsLeft", Hjt, this);
133960                Ml(this, "_isAbsRight", jjt, this);
133961                Ml(this, "_isAbsTop", Xjt, this);
133962                Ml(this, "_isAbsBottom", Wjt, this);
133963                Ml(this, "_isAbsHorizontalCenter", Yjt, this);
133964                Ml(this, "_isAbsVerticalCenter", qjt, this);
133965                Ml(this, "_originalWidth", Kjt, this);
133966                Ml(this, "_originalHeight", Jjt, this);
133967                Ml(this, "_alignMode", Zjt, this);
133968                Ml(this, "_lockFlags", Qjt, this);
133969              }
133970              get target() {
133971                return this._target;
133972              }
133973              set target(t) {
133974                if (this._target !== t) {
133975                  this._unregisterTargetEvents();
133976                  this._target = t;
133977                  this._registerTargetEvents();
133978                  this._validateTargetInDEV();
133979                  this._recursiveDirty();
133980                }
133981              }
133982              get isAlignTop() {
133983                return (this._alignFlags & rXt.TOP) > 0;
133984              }
133985              set isAlignTop(t) {
133986                this._setAlign(rXt.TOP, t);
133987                this._recursiveDirty();
133988              }
133989              get isAlignBottom() {
133990                return (this._alignFlags & rXt.BOT) > 0;
133991              }
133992              set isAlignBottom(t) {
133993                this._setAlign(rXt.BOT, t);
133994                this._recursiveDirty();
133995              }
133996              get isAlignLeft() {
133997                return (this._alignFlags & rXt.LEFT) > 0;
133998              }
133999              set isAlignLeft(t) {
134000                this._setAlign(rXt.LEFT, t);
134001                this._recursiveDirty();
134002              }
134003              get isAlignRight() {
134004                return (this._alignFlags & rXt.RIGHT) > 0;
134005              }
134006              set isAlignRight(t) {
134007                this._setAlign(rXt.RIGHT, t);
134008                this._recursiveDirty();
134009              }
134010              get isAlignVerticalCenter() {
134011                return (this._alignFlags & rXt.MID) > 0;
134012              }
134013              set isAlignVerticalCenter(t) {
134014                if (t) {
134015                  this.isAlignTop = !1;
134016                  this.isAlignBottom = !1;
134017                  this._alignFlags |= rXt.MID;
134018                } else this._alignFlags &= ~rXt.MID;
134019                this._recursiveDirty();
134020              }
134021              get isAlignHorizontalCenter() {
134022                return (this._alignFlags & rXt.CENTER) > 0;
134023              }
134024              set isAlignHorizontalCenter(t) {
134025                if (t) {
134026                  this.isAlignLeft = !1;
134027                  this.isAlignRight = !1;
134028                  this._alignFlags |= rXt.CENTER;
134029                } else this._alignFlags &= ~rXt.CENTER;
134030                this._recursiveDirty();
134031              }
134032              get isStretchWidth() {
134033                return (this._alignFlags & aXt) === aXt;
134034              }
134035              get isStretchHeight() {
134036                return (this._alignFlags & oXt) === oXt;
134037              }
134038              get top() {
134039                return this._top;
134040              }
134041              set top(t) {
134042                this._top = t;
134043                this._recursiveDirty();
134044              }
134045              get editorTop() {
134046                return this._isAbsTop ? this._top : 100 * this._top;
134047              }
134048              set editorTop(t) {
134049                this._top = this._isAbsTop ? t : t / 100;
134050                this._recursiveDirty();
134051              }
134052              get bottom() {
134053                return this._bottom;
134054              }
134055              set bottom(t) {
134056                this._bottom = t;
134057                this._recursiveDirty();
134058              }
134059              get editorBottom() {
134060                return this._isAbsBottom ? this._bottom : 100 * this._bottom;
134061              }
134062              set editorBottom(t) {
134063                this._bottom = this._isAbsBottom ? t : t / 100;
134064                this._recursiveDirty();
134065              }
134066              get left() {
134067                return this._left;
134068              }
134069              set left(t) {
134070                this._left = t;
134071                this._recursiveDirty();
134072              }
134073              get editorLeft() {
134074                return this._isAbsLeft ? this._left : 100 * this._left;
134075              }
134076              set editorLeft(t) {
134077                this._left = this._isAbsLeft ? t : t / 100;
134078                this._recursiveDirty();
134079              }
134080              get right() {
134081                return this._right;
134082              }
134083              set right(t) {
134084                this._right = t;
134085                this._recursiveDirty();
134086              }
134087              get editorRight() {
134088                return this._isAbsRight ? this._right : 100 * this._right;
134089              }
134090              set editorRight(t) {
134091                this._right = this._isAbsRight ? t : t / 100;
134092                this._recursiveDirty();
134093              }
134094              get horizontalCenter() {
134095                return this._horizontalCenter;
134096              }
134097              set horizontalCenter(t) {
134098                this._horizontalCenter = t;
134099                this._recursiveDirty();
134100              }
134101              get editorHorizontalCenter() {
134102                return this._isAbsHorizontalCenter ? this._horizontalCenter : 100 * this._horizontalCenter;
134103              }
134104              set editorHorizontalCenter(t) {
134105                this._horizontalCenter = this._isAbsHorizontalCenter ? t : t / 100;
134106                this._recursiveDirty();
134107              }
134108              get verticalCenter() {
134109                return this._verticalCenter;
134110              }
134111              set verticalCenter(t) {
134112                this._verticalCenter = t;
134113                this._recursiveDirty();
134114              }
134115              get editorVerticalCenter() {
134116                return this._isAbsVerticalCenter ? this._verticalCenter : 100 * this._verticalCenter;
134117              }
134118              set editorVerticalCenter(t) {
134119                this._verticalCenter = this._isAbsVerticalCenter ? t : t / 100;
134120                this._recursiveDirty();
134121              }
134122              get isAbsoluteTop() {
134123                return this._isAbsTop;
134124              }
134125              set isAbsoluteTop(t) {
134126                if (this._isAbsTop !== t) {
134127                  this._isAbsTop = t;
134128                  this._autoChangedValue(rXt.TOP, this._isAbsTop);
134129                }
134130              }
134131              get isAbsoluteBottom() {
134132                return this._isAbsBottom;
134133              }
134134              set isAbsoluteBottom(t) {
134135                if (this._isAbsBottom !== t) {
134136                  this._isAbsBottom = t;
134137                  this._autoChangedValue(rXt.BOT, this._isAbsBottom);
134138                }
134139              }
134140              get isAbsoluteLeft() {
134141                return this._isAbsLeft;
134142              }
134143              set isAbsoluteLeft(t) {
134144                if (this._isAbsLeft !== t) {
134145                  this._isAbsLeft = t;
134146                  this._autoChangedValue(rXt.LEFT, this._isAbsLeft);
134147                }
134148              }
134149              get isAbsoluteRight() {
134150                return this._isAbsRight;
134151              }
134152              set isAbsoluteRight(t) {
134153                if (this._isAbsRight !== t) {
134154                  this._isAbsRight = t;
134155                  this._autoChangedValue(rXt.RIGHT, this._isAbsRight);
134156                }
134157              }
134158              get isAbsoluteHorizontalCenter() {
134159                return this._isAbsHorizontalCenter;
134160              }
134161              set isAbsoluteHorizontalCenter(t) {
134162                if (this._isAbsHorizontalCenter !== t) {
134163                  this._isAbsHorizontalCenter = t;
134164                  this._autoChangedValue(rXt.CENTER, this._isAbsHorizontalCenter);
134165                }
134166              }
134167              get isAbsoluteVerticalCenter() {
134168                return this._isAbsVerticalCenter;
134169              }
134170              set isAbsoluteVerticalCenter(t) {
134171                if (this._isAbsVerticalCenter !== t) {
134172                  this._isAbsVerticalCenter = t;
134173                  this._autoChangedValue(rXt.MID, this._isAbsVerticalCenter);
134174                }
134175              }
134176              get alignMode() {
134177                return this._alignMode;
134178              }
134179              set alignMode(t) {
134180                this._alignMode = t;
134181                this._recursiveDirty();
134182              }
134183              get alignFlags() {
134184                return this._alignFlags;
134185              }
134186              set alignFlags(t) {
134187                if (this._alignFlags !== t) {
134188                  this._alignFlags = t;
134189                  this._recursiveDirty();
134190                }
134191              }
134192              updateAlignment() {
134193                m._widgetManager.updateAlignment(this.node);
134194              }
134195              _validateTargetInDEV() {}
134196              setDirty() {
134197                this._recursiveDirty();
134198              }
134199              onEnable() {
134200                this.node.getPosition(this._lastPos);
134201                this._lastSize.set(this.node._uiProps.uiTransformComp.contentSize);
134202                m._widgetManager.add(this);
134203                this._hadAlignOnce = !1;
134204                this._registerEvent();
134205                this._registerTargetEvents();
134206              }
134207              onDisable() {
134208                m._widgetManager.remove(this);
134209                this._unregisterEvent();
134210                this._unregisterTargetEvents();
134211              }
134212              onDestroy() {
134213                this._removeParentEvent();
134214              }
134215              _adjustWidgetToAllowMovingInEditor(t) {}
134216              _adjustWidgetToAllowResizingInEditor() {}
134217              _adjustWidgetToAnchorChanged() {
134218                this.setDirty();
134219              }
134220              _adjustTargetToParentChanged(t) {
134221                t && this._unregisterOldParentEvents(t);
134222                this.node.getParent() && this._registerTargetEvents();
134223                this._setDirtyByMode();
134224              }
134225              _registerEvent() {
134226                this.node.on(ny.TRANSFORM_CHANGED, this._setDirtyByMode, this);
134227                this.node.on(ny.SIZE_CHANGED, this._setDirtyByMode, this);
134228                this.node.on(ny.ANCHOR_CHANGED, this._adjustWidgetToAnchorChanged, this);
134229                this.node.on(ny.PARENT_CHANGED, this._adjustTargetToParentChanged, this);
134230              }
134231              _unregisterEvent() {
134232                this.node.off(ny.TRANSFORM_CHANGED, this._setDirtyByMode, this);
134233                this.node.off(ny.SIZE_CHANGED, this._setDirtyByMode, this);
134234                this.node.off(ny.ANCHOR_CHANGED, this._adjustWidgetToAnchorChanged, this);
134235              }
134236              _removeParentEvent() {
134237                this.node.off(ny.PARENT_CHANGED, this._adjustTargetToParentChanged, this);
134238              }
134239              _autoChangedValue(t, e) {
134240                if (!((this._alignFlags & t) > 0)) return;
134241                const i = this.node.parent && this.node.parent._uiProps;
134242                const s = i && i.uiTransformComp;
134243                const n = s ? s.contentSize : HR;
134244                this.isAlignLeft && t === rXt.LEFT ? this._left = e ? this._left * n.width : this._left / n.width : this.isAlignRight && t === rXt.RIGHT ? this._right = e ? this._right * n.width : this._right / n.width : this.isAlignHorizontalCenter && t === rXt.CENTER ? this._horizontalCenter = e ? this._horizontalCenter * n.width : this._horizontalCenter / n.width : this.isAlignTop && t === rXt.TOP ? this._top = e ? this._top * n.height : this._top / n.height : this.isAlignBottom && t === rXt.BOT ? this._bottom = e ? this._bottom * n.height : this._bottom / n.height : this.isAbsoluteVerticalCenter && t === rXt.MID && (this._verticalCenter = this._verticalCenter / n.height);
134245                this._recursiveDirty();
134246              }
134247              _registerTargetEvents() {
134248                const t = this._target || this.node.parent;
134249                if (t && t.getComponent(jB)) {
134250                  t.on(ny.TRANSFORM_CHANGED, this._setDirtyByMode, this);
134251                  t.on(ny.SIZE_CHANGED, this._setDirtyByMode, this);
134252                  t.on(ny.ANCHOR_CHANGED, this._setDirtyByMode, this);
134253                }
134254              }
134255              _unregisterTargetEvents() {
134256                const t = this._target || this.node.parent;
134257                if (t) {
134258                  t.off(ny.TRANSFORM_CHANGED, this._setDirtyByMode, this);
134259                  t.off(ny.SIZE_CHANGED, this._setDirtyByMode, this);
134260                  t.off(ny.ANCHOR_CHANGED, this._setDirtyByMode, this);
134261                }
134262              }
134263              _unregisterOldParentEvents(t) {
134264                const e = this._target || t;
134265                if (e) {
134266                  e.off(ny.TRANSFORM_CHANGED, this._setDirtyByMode, this);
134267                  e.off(ny.SIZE_CHANGED, this._setDirtyByMode, this);
134268                }
134269              }
134270              _setDirtyByMode() {
134271                this.alignMode === nXt.ALWAYS && this._recursiveDirty();
134272              }
134273              _setAlign(t, e) {
134274                if (e === (this._alignFlags & t) > 0) return;
134275                const i = (t & aXt) > 0;
134276                const s = this.node._uiProps.uiTransformComp;
134277                if (e) {
134278                  this._alignFlags |= t;
134279                  if (i) {
134280                    this.isAlignHorizontalCenter = !1;
134281                    this.isStretchWidth && (this._originalWidth = s.width);
134282                  } else {
134283                    this.isAlignVerticalCenter = !1;
134284                    this.isStretchHeight && (this._originalHeight = s.height);
134285                  }
134286                } else {
134287                  i ? this.isStretchWidth && (s.width = this._originalWidth) : this.isStretchHeight && (s.height = this._originalHeight);
134288                  this._alignFlags &= ~t;
134289                }
134290              }
134291              _recursiveDirty() {
134292                this._dirty || (this._dirty = !0);
134293              }
134294            }, $jt.AlignMode = nXt, tXt), Bl(Ojt.prototype, "target", [ mjt, fjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "target"), Ojt.prototype),
134295            Bl(Ojt.prototype, "isAlignTop", [ gjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAlignTop"), Ojt.prototype),
134296            Bl(Ojt.prototype, "isAlignBottom", [ yjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAlignBottom"), Ojt.prototype),
134297            Bl(Ojt.prototype, "isAlignLeft", [ bjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAlignLeft"), Ojt.prototype),
134298            Bl(Ojt.prototype, "isAlignRight", [ Sjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAlignRight"), Ojt.prototype),
134299            Bl(Ojt.prototype, "isAlignVerticalCenter", [ Ajt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAlignVerticalCenter"), Ojt.prototype),
134300            Bl(Ojt.prototype, "isAlignHorizontalCenter", [ Tjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAlignHorizontalCenter"), Ojt.prototype),
134301            Bl(Ojt.prototype, "isStretchWidth", [ vjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isStretchWidth"), Ojt.prototype),
134302            Bl(Ojt.prototype, "isStretchHeight", [ Ejt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isStretchHeight"), Ojt.prototype),
134303            Bl(Ojt.prototype, "top", [ Cjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "top"), Ojt.prototype),
134304            Bl(Ojt.prototype, "editorTop", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "editorTop"), Ojt.prototype),
134305            Bl(Ojt.prototype, "bottom", [ xjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "bottom"), Ojt.prototype),
134306            Bl(Ojt.prototype, "editorBottom", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "editorBottom"), Ojt.prototype),
134307            Bl(Ojt.prototype, "left", [ wjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "left"), Ojt.prototype),
134308            Bl(Ojt.prototype, "editorLeft", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "editorLeft"), Ojt.prototype),
134309            Bl(Ojt.prototype, "right", [ Rjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "right"), Ojt.prototype),
134310            Bl(Ojt.prototype, "editorRight", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "editorRight"), Ojt.prototype),
134311            Bl(Ojt.prototype, "horizontalCenter", [ Ijt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "horizontalCenter"), Ojt.prototype),
134312            Bl(Ojt.prototype, "editorHorizontalCenter", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "editorHorizontalCenter"), Ojt.prototype),
134313            Bl(Ojt.prototype, "verticalCenter", [ Mjt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "verticalCenter"), Ojt.prototype),
134314            Bl(Ojt.prototype, "editorVerticalCenter", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "editorVerticalCenter"), Ojt.prototype),
134315            Bl(Ojt.prototype, "isAbsoluteTop", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAbsoluteTop"), Ojt.prototype),
134316            Bl(Ojt.prototype, "isAbsoluteBottom", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAbsoluteBottom"), Ojt.prototype),
134317            Bl(Ojt.prototype, "isAbsoluteLeft", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAbsoluteLeft"), Ojt.prototype),
134318            Bl(Ojt.prototype, "isAbsoluteRight", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAbsoluteRight"), Ojt.prototype),
134319            Bl(Ojt.prototype, "isAbsoluteHorizontalCenter", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAbsoluteHorizontalCenter"), Ojt.prototype),
134320            Bl(Ojt.prototype, "isAbsoluteVerticalCenter", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "isAbsoluteVerticalCenter"), Ojt.prototype),
134321            Bl(Ojt.prototype, "alignMode", [ Bjt, Djt ], Object.getOwnPropertyDescriptor(Ojt.prototype, "alignMode"), Ojt.prototype),
134322            Bl(Ojt.prototype, "alignFlags", [ nh ], Object.getOwnPropertyDescriptor(Ojt.prototype, "alignFlags"), Ojt.prototype),
134323            Njt = Bl(Ojt.prototype, "_alignFlags", [ Yl ], {
134324              configurable: !0,
134325              enumerable: !0,
134326              writable: !0,
134327              initializer: function() {
134328                return 0;
134329              }
134330            }), Ljt = Bl(Ojt.prototype, "_target", [ Yl ], {
134331              configurable: !0,
134332              enumerable: !0,
134333              writable: !0,
134334              initializer: function() {
134335                return null;
134336              }
134337            }), Fjt = Bl(Ojt.prototype, "_left", [ Yl ], {
134338              configurable: !0,
134339              enumerable: !0,
134340              writable: !0,
134341              initializer: function() {
134342                return 0;
134343              }
134344            }), Vjt = Bl(Ojt.prototype, "_right", [ Yl ], {
134345              configurable: !0,
134346              enumerable: !0,
134347              writable: !0,
134348              initializer: function() {
134349                return 0;
134350              }
134351            }), kjt = Bl(Ojt.prototype, "_top", [ Yl ], {
134352              configurable: !0,
134353              enumerable: !0,
134354              writable: !0,
134355              initializer: function() {
134356                return 0;
134357              }
134358            }), Ujt = Bl(Ojt.prototype, "_bottom", [ Yl ], {
134359              configurable: !0,
134360              enumerable: !0,
134361              writable: !0,
134362              initializer: function() {
134363                return 0;
134364              }
134365            }), Gjt = Bl(Ojt.prototype, "_horizontalCenter", [ Yl ], {
134366              configurable: !0,
134367              enumerable: !0,
134368              writable: !0,
134369              initializer: function() {
134370                return 0;
134371              }
134372            }), zjt = Bl(Ojt.prototype, "_verticalCenter", [ Yl ], {
134373              configurable: !0,
134374              enumerable: !0,
134375              writable: !0,
134376              initializer: function() {
134377                return 0;
134378              }
134379            }), Hjt = Bl(Ojt.prototype, "_isAbsLeft", [ Yl ], {
134380              configurable: !0,
134381              enumerable: !0,
134382              writable: !0,
134383              initializer: function() {
134384                return !0;
134385              }
134386            }), jjt = Bl(Ojt.prototype, "_isAbsRight", [ Yl ], {
134387              configurable: !0,
134388              enumerable: !0,
134389              writable: !0,
134390              initializer: function() {
134391                return !0;
134392              }
134393            }), Xjt = Bl(Ojt.prototype, "_isAbsTop", [ Yl ], {
134394              configurable: !0,
134395              enumerable: !0,
134396              writable: !0,
134397              initializer: function() {
134398                return !0;
134399              }
134400            }), Wjt = Bl(Ojt.prototype, "_isAbsBottom", [ Yl ], {
134401              configurable: !0,
134402              enumerable: !0,
134403              writable: !0,
134404              initializer: function() {
134405                return !0;
134406              }
134407            }), Yjt = Bl(Ojt.prototype, "_isAbsHorizontalCenter", [ Yl ], {
134408              configurable: !0,
134409              enumerable: !0,
134410              writable: !0,
134411              initializer: function() {
134412                return !0;
134413              }
134414            }), qjt = Bl(Ojt.prototype, "_isAbsVerticalCenter", [ Yl ], {
134415              configurable: !0,
134416              enumerable: !0,
134417              writable: !0,
134418              initializer: function() {
134419                return !0;
134420              }
134421            }), Kjt = Bl(Ojt.prototype, "_originalWidth", [ Yl ], {
134422              configurable: !0,
134423              enumerable: !0,
134424              writable: !0,
134425              initializer: function() {
134426                return 0;
134427              }
134428            }), Jjt = Bl(Ojt.prototype, "_originalHeight", [ Yl ], {
134429              configurable: !0,
134430              enumerable: !0,
134431              writable: !0,
134432              initializer: function() {
134433                return 0;
134434              }
134435            }), Zjt = Bl(Ojt.prototype, "_alignMode", [ Yl ], {
134436              configurable: !0,
134437              enumerable: !0,
134438              writable: !0,
134439              initializer: function() {
134440                return nXt.ON_WINDOW_RESIZE;
134441              }
134442            }), Qjt = Bl(Ojt.prototype, "_lockFlags", [ Yl, Kl ], {
134443              configurable: !0,
134444              enumerable: !0,
134445              writable: !0,
134446              initializer: function() {
134447                return 0;
134448              }
134449            }), Ojt)) || Pjt) || Pjt) || Pjt) || Pjt) || Pjt) || Pjt));
134450            m.internal.computeInverseTransForTarget = sXt;
134451            m.internal.getReadonlyNodeSize = iXt;
134452            m.Widget = lXt;
134453            var hXt, cXt, uXt, _Xt, dXt, pXt, mXt, fXt, gXt, yXt, bXt, SXt, AXt, TXt, vXt, EXt, CXt, xXt, wXt;
134454            const RXt = new Bi;
134455            var IXt;
134456            !function(t) {
134457              t[t.HORIZONTAL = 0] = "HORIZONTAL";
134458              t[t.VERTICAL = 1] = "VERTICAL";
134459            }(IXt || (IXt = {}));
134460            he(IXt);
134461            let MXt = function(e) {
134462              return t({
134463                PageViewIndicator: e,
134464                PageViewIndicatorComponent: e
134465              }), e;
134466            }((hXt = Ul("cc.PageViewIndicator"), cXt = sh(), uXt = zl(110), _Xt = $l(), dXt = Th(GI),
134467            pXt = lh(), mXt = Th(IXt), fXt = lh(), gXt = Th(rs), yXt = lh(), bXt = lh(), hXt(SXt = cXt(SXt = uXt(SXt = _Xt(SXt = (AXt = (wXt = xXt = class extends Qc {
134468              constructor(...t) {
134469                super(...t);
134470                Ml(this, "spacing", TXt, this);
134471                Ml(this, "_spriteFrame", vXt, this);
134472                Ml(this, "_direction", EXt, this);
134473                Ml(this, "_cellSize", CXt, this);
134474                this._layout = null;
134475                this._pageView = null;
134476                this._indicators = [];
134477              }
134478              get spriteFrame() {
134479                return this._spriteFrame;
134480              }
134481              set spriteFrame(t) {
134482                this._spriteFrame !== t && (this._spriteFrame = t);
134483              }
134484              get direction() {
134485                return this._direction;
134486              }
134487              set direction(t) {
134488                this._direction !== t && (this._direction = t);
134489              }
134490              get cellSize() {
134491                return this._cellSize;
134492              }
134493              set cellSize(t) {
134494                this._cellSize !== t && (this._cellSize = t);
134495              }
134496              onLoad() {
134497                this._updateLayout();
134498              }
134499              setPageView(t) {
134500                this._pageView = t;
134501                this._refresh();
134502              }
134503              _updateLayout() {
134504                this._layout = this.getComponent(JUt);
134505                this._layout || (this._layout = this.addComponent(JUt));
134506                const t = this._layout;
134507                if (this.direction === IXt.HORIZONTAL) {
134508                  t.type = JUt.Type.HORIZONTAL;
134509                  t.spacingX = this.spacing;
134510                } else if (this.direction === IXt.VERTICAL) {
134511                  t.type = JUt.Type.VERTICAL;
134512                  t.spacingY = this.spacing;
134513                }
134514                t.resizeMode = JUt.ResizeMode.CONTAINER;
134515              }
134516              _createIndicator() {
134517                const t = new _y;
134518                t.layer = this.node.layer;
134519                const e = t.addComponent(cL);
134520                e.spriteFrame = this.spriteFrame;
134521                e.sizeMode = cL.SizeMode.CUSTOM;
134522                t.parent = this.node;
134523                t._uiProps.uiTransformComp.setContentSize(this._cellSize);
134524                return t;
134525              }
134526              _changedState() {
134527                const t = this._indicators;
134528                if (0 === t.length || !this._pageView) return;
134529                const e = this._pageView.curPageIdx;
134530                if (!(e >= t.length)) {
134531                  for (let e = 0; e < t.length; ++e) {
134532                    const i = t[e];
134533                    if (!i._uiProps.uiComp) continue;
134534                    const s = i._uiProps.uiComp;
134535                    RXt.set(s.color);
134536                    RXt.a = 127.5;
134537                    s.color = RXt;
134538                  }
134539                  if (t[e]._uiProps.uiComp) {
134540                    const i = t[e]._uiProps.uiComp;
134541                    RXt.set(i.color);
134542                    RXt.a = 255;
134543                    i.color = RXt;
134544                  }
134545                }
134546              }
134547              _refresh() {
134548                if (!this._pageView) return;
134549                const t = this._indicators;
134550                const e = this._pageView.getPages();
134551                if (e.length === t.length) return;
134552                let i = 0;
134553                if (e.length > t.length) for (i = 0; i < e.length; ++i) t[i] || (t[i] = this._createIndicator()); else {
134554                  for (i = t.length - e.length; i > 0; --i) {
134555                    const e = t[i - 1];
134556                    this.node.removeChild(e);
134557                    t.splice(i - 1, 1);
134558                  }
134559                }
134560                this._layout && this._layout.enabledInHierarchy && this._layout.updateLayout();
134561                this._changedState();
134562              }
134563            }, xXt.Direction = IXt, wXt), Bl(AXt.prototype, "spriteFrame", [ dXt, pXt ], Object.getOwnPropertyDescriptor(AXt.prototype, "spriteFrame"), AXt.prototype),
134564            Bl(AXt.prototype, "direction", [ mXt, fXt ], Object.getOwnPropertyDescriptor(AXt.prototype, "direction"), AXt.prototype),
134565            Bl(AXt.prototype, "cellSize", [ gXt, yXt ], Object.getOwnPropertyDescriptor(AXt.prototype, "cellSize"), AXt.prototype),
134566            TXt = Bl(AXt.prototype, "spacing", [ Yl, bXt ], {
134567              configurable: !0,
134568              enumerable: !0,
134569              writable: !0,
134570              initializer: function() {
134571                return 0;
134572              }
134573            }), vXt = Bl(AXt.prototype, "_spriteFrame", [ Yl ], {
134574              configurable: !0,
134575              enumerable: !0,
134576              writable: !0,
134577              initializer: function() {
134578                return null;
134579              }
134580            }), EXt = Bl(AXt.prototype, "_direction", [ Yl ], {
134581              configurable: !0,
134582              enumerable: !0,
134583              writable: !0,
134584              initializer: function() {
134585                return IXt.HORIZONTAL;
134586              }
134587            }), CXt = Bl(AXt.prototype, "_cellSize", [ Yl ], {
134588              configurable: !0,
134589              enumerable: !0,
134590              writable: !0,
134591              initializer: function() {
134592                return new rs(20, 20);
134593              }
134594            }), AXt)) || SXt) || SXt) || SXt) || SXt));
134595            m.PageViewIndicator = MXt;
134596            var BXt, DXt, PXt, OXt, NXt, LXt, FXt, VXt, kXt, UXt, GXt, zXt, HXt, jXt, XXt, WXt, YXt, qXt, KXt, JXt, ZXt, QXt, $Xt, tWt, eWt, iWt, sWt, nWt, rWt, oWt, aWt, lWt, hWt, cWt, uWt, _Wt, dWt, pWt, mWt, fWt, gWt, yWt, bWt;
134597            const SWt = new Qi;
134598            var AWt;
134599            !function(t) {
134600              t[t.Unified = 0] = "Unified";
134601              t[t.Free = 1] = "Free";
134602            }(AWt || (AWt = {}));
134603            he(AWt);
134604            var TWt;
134605            !function(t) {
134606              t[t.Horizontal = 0] = "Horizontal";
134607              t[t.Vertical = 1] = "Vertical";
134608            }(TWt || (TWt = {}));
134609            he(TWt);
134610            var vWt;
134611            !function(t) {
134612              t.PAGE_TURNING = "page-turning";
134613            }(vWt || (vWt = {}));
134614            let EWt = function(e) {
134615              return t({
134616                PageView: e,
134617                PageViewComponent: e
134618              }), e;
134619            }((BXt = Ul("cc.PageView"), DXt = sh(), PXt = zl(110), OXt = $l(), NXt = Th(AWt),
134620            LXt = lh(), FXt = Th(TWt), VXt = lh(), kXt = hh(), UXt = lh(), GXt = hh(), zXt = lh(),
134621            HXt = Th(MXt), jXt = lh(), XXt = lh(), WXt = Th(QGt), YXt = rh(), qXt = Th(QGt),
134622            KXt = rh(), JXt = rh(), ZXt = rh(), QXt = rh(), $Xt = Th([ Vc ]), tWt = rh(), eWt = lh(),
134623            iWt = Th([ Vc ]), sWt = lh(), BXt(nWt = DXt(nWt = PXt(nWt = OXt(nWt = (rWt = (bWt = yWt = class t extends nHt {
134624              constructor(...t) {
134625                super(...t);
134626                Ml(this, "autoPageTurningThreshold", oWt, this);
134627                Ml(this, "horizontal", aWt, this);
134628                Ml(this, "vertical", lWt, this);
134629                Ml(this, "cancelInnerEvents", hWt, this);
134630                Ml(this, "scrollEvents", cWt, this);
134631                Ml(this, "pageTurningSpeed", uWt, this);
134632                Ml(this, "pageEvents", _Wt, this);
134633                Ml(this, "_sizeMode", dWt, this);
134634                Ml(this, "_direction", pWt, this);
134635                Ml(this, "_scrollThreshold", mWt, this);
134636                Ml(this, "_pageTurningEventTiming", fWt, this);
134637                Ml(this, "_indicator", gWt, this);
134638                this._curPageIdx = 0;
134639                this._lastPageIdx = 0;
134640                this._pages = [];
134641                this._initContentPos = new Pi;
134642                this._scrollCenterOffsetX = [];
134643                this._scrollCenterOffsetY = [];
134644                this._touchBeganPosition = new Qi;
134645                this._touchEndPosition = new Qi;
134646              }
134647              get sizeMode() {
134648                return this._sizeMode;
134649              }
134650              set sizeMode(t) {
134651                if (this._sizeMode !== t) {
134652                  this._sizeMode = t;
134653                  this._syncSizeMode();
134654                }
134655              }
134656              get direction() {
134657                return this._direction;
134658              }
134659              set direction(t) {
134660                if (this._direction !== t) {
134661                  this._direction = t;
134662                  this._syncScrollDirection();
134663                }
134664              }
134665              get scrollThreshold() {
134666                return this._scrollThreshold;
134667              }
134668              set scrollThreshold(t) {
134669                this._scrollThreshold !== t && (this._scrollThreshold = t);
134670              }
134671              get pageTurningEventTiming() {
134672                return this._pageTurningEventTiming;
134673              }
134674              set pageTurningEventTiming(t) {
134675                this._pageTurningEventTiming !== t && (this._pageTurningEventTiming = t);
134676              }
134677              get indicator() {
134678                return this._indicator;
134679              }
134680              set indicator(t) {
134681                if (this._indicator !== t) {
134682                  this._indicator = t;
134683                  this.indicator && this.indicator.setPageView(this);
134684                }
134685              }
134686              get curPageIdx() {
134687                return this._curPageIdx;
134688              }
134689              get verticalScrollBar() {
134690                return super.verticalScrollBar;
134691              }
134692              set verticalScrollBar(t) {
134693                super.verticalScrollBar = t;
134694              }
134695              get horizontalScrollBar() {
134696                return super.horizontalScrollBar;
134697              }
134698              set horizontalScrollBar(t) {
134699                super.horizontalScrollBar = t;
134700              }
134701              onEnable() {
134702                super.onEnable();
134703                this.node.on(ny.SIZE_CHANGED, this._updateAllPagesSize, this);
134704                this.node.on(t.EventType.SCROLL_ENG_WITH_THRESHOLD, this._dispatchPageTurningEvent, this);
134705              }
134706              onDisable() {
134707                super.onDisable();
134708                this.node.off(ny.SIZE_CHANGED, this._updateAllPagesSize, this);
134709                this.node.off(t.EventType.SCROLL_ENG_WITH_THRESHOLD, this._dispatchPageTurningEvent, this);
134710              }
134711              onLoad() {
134712                this._initPages();
134713                this.indicator && this.indicator.setPageView(this);
134714              }
134715              getCurrentPageIndex() {
134716                return this._curPageIdx;
134717              }
134718              setCurrentPageIndex(t) {
134719                this.scrollToPage(t, 1);
134720              }
134721              getPages() {
134722                return this._pages;
134723              }
134724              addPage(t) {
134725                if (t && -1 === this._pages.indexOf(t) && this.content) if (t._uiProps.uiTransformComp) {
134726                  this.content.addChild(t);
134727                  this._pages.push(t);
134728                  this._updatePageView();
134729                } else P(4301);
134730              }
134731              insertPage(t, e) {
134732                if (e < 0 || !t || -1 !== this._pages.indexOf(t) || !this.content) return;
134733                if (e >= this._pages.length) this.addPage(t); else {
134734                  if (!t._uiProps.uiTransformComp) {
134735                    P(4301);
134736                    return;
134737                  }
134738                  this._pages.splice(e, 0, t);
134739                  this.content.insertChild(t, e);
134740                  this._updatePageView();
134741                }
134742              }
134743              removePage(t) {
134744                if (!t || !this.content) return;
134745                const e = this._pages.indexOf(t);
134746                -1 !== e ? this.removePageAtIndex(e) : N(4300, t.name);
134747              }
134748              removePageAtIndex(t) {
134749                const e = this._pages;
134750                if (t < 0 || t >= e.length) return;
134751                const i = e[t];
134752                if (i && this.content) {
134753                  this.content.removeChild(i);
134754                  e.splice(t, 1);
134755                  this._updatePageView();
134756                }
134757              }
134758              removeAllPages() {
134759                if (!this.content) return;
134760                const t = this._pages;
134761                for (let e = 0, i = t.length; e < i; e++) this.content.removeChild(t[e]);
134762                this._pages.length = 0;
134763                this._updatePageView();
134764              }
134765              scrollToPage(t, e = .3) {
134766                if (!(t < 0 || t >= this._pages.length)) {
134767                  this._curPageIdx = t;
134768                  this.scrollToOffset(this._moveOffsetValue(t), e, !0);
134769                  this.indicator && this.indicator._changedState();
134770                }
134771              }
134772              getScrollEndedEventTiming() {
134773                return this.pageTurningEventTiming;
134774              }
134775              _updatePageView() {
134776                if (!this.content) return;
134777                const t = this.content.getComponent(JUt);
134778                t && t.enabled && t.updateLayout();
134779                const e = this._pages.length;
134780                if (this._curPageIdx >= e) {
134781                  this._curPageIdx = 0 === e ? 0 : e - 1;
134782                  this._lastPageIdx = this._curPageIdx;
134783                }
134784                const i = this._initContentPos;
134785                for (let t = 0; t < e; ++t) {
134786                  const e = this._pages[t].position;
134787                  this.direction === TWt.Horizontal ? this._scrollCenterOffsetX[t] = Math.abs(i.x + e.x) : this._scrollCenterOffsetY[t] = Math.abs(i.y + e.y);
134788                }
134789                this.indicator && this.indicator._refresh();
134790              }
134791              _updateAllPagesSize() {
134792                const t = this.view;
134793                if (!this.content || !t) return;
134794                if (this._sizeMode !== AWt.Unified) return;
134795                const e = this._pages;
134796                const i = t.contentSize;
134797                for (let t = 0, s = e.length; t < s; t++) e[t]._uiProps.uiTransformComp.setContentSize(i);
134798              }
134799              _handleReleaseLogic() {
134800                this._autoScrollToPage();
134801                if (this._scrolling) {
134802                  this._scrolling = !1;
134803                  this._autoScrolling || this._dispatchEvent(t.EventType.SCROLL_ENDED);
134804                }
134805              }
134806              _onTouchBegan(t, e) {
134807                t.touch.getUILocation(SWt);
134808                Qi.set(this._touchBeganPosition, SWt.x, SWt.y);
134809                super._onTouchBegan(t, e);
134810              }
134811              _onTouchMoved(t, e) {
134812                super._onTouchMoved(t, e);
134813              }
134814              _onTouchEnded(t, e) {
134815                t.touch.getUILocation(SWt);
134816                Qi.set(this._touchEndPosition, SWt.x, SWt.y);
134817                super._onTouchEnded(t, e);
134818              }
134819              _onTouchCancelled(t, e) {
134820                t.touch.getUILocation(SWt);
134821                Qi.set(this._touchEndPosition, SWt.x, SWt.y);
134822                super._onTouchCancelled(t, e);
134823              }
134824              _onMouseWheel() {}
134825              _syncScrollDirection() {
134826                this.horizontal = this.direction === TWt.Horizontal;
134827                this.vertical = this.direction === TWt.Vertical;
134828              }
134829              _syncSizeMode() {
134830                const t = this.view;
134831                if (!this.content || !t) return;
134832                const e = this.content.getComponent(JUt);
134833                if (e) {
134834                  if (this._sizeMode === AWt.Free && this._pages.length > 0) {
134835                    const i = this._pages[0]._uiProps.uiTransformComp;
134836                    const s = this._pages[this._pages.length - 1]._uiProps.uiTransformComp;
134837                    if (this.direction === TWt.Horizontal) {
134838                      e.paddingLeft = (t.width - i.width) / 2;
134839                      e.paddingRight = (t.width - s.width) / 2;
134840                    } else if (this.direction === TWt.Vertical) {
134841                      e.paddingTop = (t.height - i.height) / 2;
134842                      e.paddingBottom = (t.height - s.height) / 2;
134843                    }
134844                  }
134845                  e.updateLayout();
134846                }
134847              }
134848              _initPages() {
134849                if (!this.content) return;
134850                this._initContentPos = this.content.position;
134851                const t = this.content.children;
134852                for (let e = 0; e < t.length; ++e) {
134853                  const i = t[e];
134854                  this._pages.indexOf(i) >= 0 || this._pages.push(i);
134855                }
134856                this._syncScrollDirection();
134857                this._syncSizeMode();
134858                this._updatePageView();
134859              }
134860              _dispatchPageTurningEvent() {
134861                if (this._lastPageIdx !== this._curPageIdx) {
134862                  this._lastPageIdx = this._curPageIdx;
134863                  Vc.emitEvents(this.pageEvents, this, vWt.PAGE_TURNING);
134864                  this.node.emit(vWt.PAGE_TURNING, this);
134865                }
134866              }
134867              _isQuicklyScrollable(t) {
134868                if (this.direction === TWt.Horizontal) {
134869                  if (Math.abs(t.x) > this.autoPageTurningThreshold) return !0;
134870                } else if (this.direction === TWt.Vertical && Math.abs(t.y) > this.autoPageTurningThreshold) return !0;
134871                return !1;
134872              }
134873              _moveOffsetValue(t) {
134874                const e = new Qi;
134875                if (this._sizeMode === AWt.Free) this.direction === TWt.Horizontal ? e.x = this._scrollCenterOffsetX[t] : this.direction === TWt.Vertical && (e.y = this._scrollCenterOffsetY[t]); else {
134876                  const i = this.view;
134877                  if (!i) return e;
134878                  this.direction === TWt.Horizontal ? e.x = t * i.width : this.direction === TWt.Vertical && (e.y = t * i.height);
134879                }
134880                return e;
134881              }
134882              _getDragDirection(t) {
134883                return this._direction === TWt.Horizontal ? 0 === t.x ? 0 : t.x > 0 ? 1 : -1 : 0 === t.y ? 0 : t.y < 0 ? 1 : -1;
134884              }
134885              _isScrollable(t, e, i) {
134886                if (this._sizeMode === AWt.Free) {
134887                  let s = 0;
134888                  let n = 0;
134889                  if (this.direction === TWt.Horizontal) {
134890                    s = this._scrollCenterOffsetX[e];
134891                    n = this._scrollCenterOffsetX[i];
134892                    return Math.abs(t.x) >= Math.abs(s - n) * this.scrollThreshold;
134893                  }
134894                  if (this.direction === TWt.Vertical) {
134895                    s = this._scrollCenterOffsetY[e];
134896                    n = this._scrollCenterOffsetY[i];
134897                    return Math.abs(t.y) >= Math.abs(s - n) * this.scrollThreshold;
134898                  }
134899                } else {
134900                  const e = this.view;
134901                  if (!e) return !1;
134902                  if (this.direction === TWt.Horizontal) return Math.abs(t.x) >= e.width * this.scrollThreshold;
134903                  if (this.direction === TWt.Vertical) return Math.abs(t.y) >= e.height * this.scrollThreshold;
134904                }
134905                return !1;
134906              }
134907              _autoScrollToPage() {
134908                if (this._startBounceBackIfNeeded()) {
134909                  const t = this._getHowMuchOutOfBoundary();
134910                  this._clampDelta(t);
134911                  (t.x > 0 || t.y < 0) && (this._curPageIdx = 0 === this._pages.length ? 0 : this._pages.length - 1);
134912                  (t.x < 0 || t.y > 0) && (this._curPageIdx = 0);
134913                  this.indicator && this.indicator._changedState();
134914                } else {
134915                  const t = new Qi;
134916                  Qi.subtract(t, this._touchBeganPosition, this._touchEndPosition);
134917                  const e = this._curPageIdx;
134918                  const i = e + this._getDragDirection(t);
134919                  const s = this.pageTurningSpeed * Math.abs(e - i);
134920                  if (i < this._pages.length) {
134921                    if (this._isScrollable(t, e, i)) {
134922                      this.scrollToPage(i, s);
134923                      return;
134924                    }
134925                    {
134926                      const t = this._calculateTouchMoveVelocity();
134927                      if (this._isQuicklyScrollable(t)) {
134928                        this.scrollToPage(i, s);
134929                        return;
134930                      }
134931                    }
134932                  }
134933                  this.scrollToPage(e, s);
134934                }
134935              }
134936            }, yWt.SizeMode = AWt, yWt.Direction = TWt, yWt.EventType = IHt(vWt, iHt), bWt),
134937            Bl(rWt.prototype, "sizeMode", [ NXt, LXt ], Object.getOwnPropertyDescriptor(rWt.prototype, "sizeMode"), rWt.prototype),
134938            Bl(rWt.prototype, "direction", [ FXt, VXt ], Object.getOwnPropertyDescriptor(rWt.prototype, "direction"), rWt.prototype),
134939            Bl(rWt.prototype, "scrollThreshold", [ dh, kXt, UXt ], Object.getOwnPropertyDescriptor(rWt.prototype, "scrollThreshold"), rWt.prototype),
134940            Bl(rWt.prototype, "pageTurningEventTiming", [ dh, GXt, zXt ], Object.getOwnPropertyDescriptor(rWt.prototype, "pageTurningEventTiming"), rWt.prototype),
134941            Bl(rWt.prototype, "indicator", [ HXt, jXt ], Object.getOwnPropertyDescriptor(rWt.prototype, "indicator"), rWt.prototype),
134942            oWt = Bl(rWt.prototype, "autoPageTurningThreshold", [ Yl, XXt ], {
134943              configurable: !0,
134944              enumerable: !0,
134945              writable: !0,
134946              initializer: function() {
134947                return 100;
134948              }
134949            }), Bl(rWt.prototype, "verticalScrollBar", [ WXt, vh, YXt ], Object.getOwnPropertyDescriptor(rWt.prototype, "verticalScrollBar"), rWt.prototype),
134950            Bl(rWt.prototype, "horizontalScrollBar", [ qXt, vh, KXt ], Object.getOwnPropertyDescriptor(rWt.prototype, "horizontalScrollBar"), rWt.prototype),
134951            aWt = Bl(rWt.prototype, "horizontal", [ vh, Yl, JXt ], {
134952              configurable: !0,
134953              enumerable: !0,
134954              writable: !0,
134955              initializer: function() {
134956                return !0;
134957              }
134958            }), lWt = Bl(rWt.prototype, "vertical", [ vh, Yl, ZXt ], {
134959              configurable: !0,
134960              enumerable: !0,
134961              writable: !0,
134962              initializer: function() {
134963                return !0;
134964              }
134965            }), hWt = Bl(rWt.prototype, "cancelInnerEvents", [ vh, Yl, QXt ], {
134966              configurable: !0,
134967              enumerable: !0,
134968              writable: !0,
134969              initializer: function() {
134970                return !0;
134971              }
134972            }), cWt = Bl(rWt.prototype, "scrollEvents", [ $Xt, Yl, vh, tWt ], {
134973              configurable: !0,
134974              enumerable: !0,
134975              writable: !0,
134976              initializer: function() {
134977                return [];
134978              }
134979            }), uWt = Bl(rWt.prototype, "pageTurningSpeed", [ Yl, nh, eWt ], {
134980              configurable: !0,
134981              enumerable: !0,
134982              writable: !0,
134983              initializer: function() {
134984                return .3;
134985              }
134986            }), _Wt = Bl(rWt.prototype, "pageEvents", [ iWt, Yl, sWt ], {
134987              configurable: !0,
134988              enumerable: !0,
134989              writable: !0,
134990              initializer: function() {
134991                return [];
134992              }
134993            }), dWt = Bl(rWt.prototype, "_sizeMode", [ Yl ], {
134994              configurable: !0,
134995              enumerable: !0,
134996              writable: !0,
134997              initializer: function() {
134998                return AWt.Unified;
134999              }
135000            }), pWt = Bl(rWt.prototype, "_direction", [ Yl ], {
135001              configurable: !0,
135002              enumerable: !0,
135003              writable: !0,
135004              initializer: function() {
135005                return TWt.Horizontal;
135006              }
135007            }), mWt = Bl(rWt.prototype, "_scrollThreshold", [ Yl ], {
135008              configurable: !0,
135009              enumerable: !0,
135010              writable: !0,
135011              initializer: function() {
135012                return .5;
135013              }
135014            }), fWt = Bl(rWt.prototype, "_pageTurningEventTiming", [ Yl ], {
135015              configurable: !0,
135016              enumerable: !0,
135017              writable: !0,
135018              initializer: function() {
135019                return .1;
135020              }
135021            }), gWt = Bl(rWt.prototype, "_indicator", [ Yl ], {
135022              configurable: !0,
135023              enumerable: !0,
135024              writable: !0,
135025              initializer: function() {
135026                return null;
135027              }
135028            }), rWt)) || nWt) || nWt) || nWt) || nWt));
135029            m.PageView = EWt;
135030            const CWt = new Pi;
135031            const xWt = new Qi;
135032            const wWt = new Qi;
135033            const RWt = new Qi(1, 1);
135034            const IWt = new Qi;
135035            const MWt = new Qi;
135036            function BWt(t, e) {
135037              if (e._hadAlignOnce) return;
135038              e.alignMode === nXt.ONCE && (e._hadAlignOnce = !0);
135039              const i = e.target;
135040              let s;
135041              const n = wWt;
135042              const r = RWt;
135043              if (i) {
135044                s = i;
135045                sXt(t, s, n, r);
135046              } else s = t.parent;
135047              const o = iXt(s);
135048              const a = s instanceof oA || !s.getComponent(jB);
135049              const l = a ? xWt : s.getComponent(jB).anchorPoint;
135050              const h = a;
135051              t.getPosition(CWt);
135052              const c = t._uiProps.uiTransformComp;
135053              let u = CWt.x;
135054              let _ = CWt.y;
135055              const d = c.anchorPoint;
135056              const p = t.getScale();
135057              if (e.alignFlags & rXt.HORIZONTAL) {
135058                let t = 0;
135059                let s = 0;
135060                const a = o.width;
135061                if (h) {
135062                  t = HR.left.x;
135063                  s = HR.right.x;
135064                } else {
135065                  t = -l.x * a;
135066                  s = t + a;
135067                }
135068                t += e.isAbsoluteLeft ? e.left : e.left * a;
135069                s -= e.isAbsoluteRight ? e.right : e.right * a;
135070                if (i) {
135071                  t += n.x;
135072                  t *= r.x;
135073                  s += n.x;
135074                  s *= r.x;
135075                }
135076                let _ = 0;
135077                let m = d.x;
135078                let f = p.x;
135079                if (f < 0) {
135080                  m = 1 - m;
135081                  f = -f;
135082                }
135083                if (e.isStretchWidth) {
135084                  _ = s - t;
135085                  0 !== f && (c.width = _ / f);
135086                  u = t + m * _;
135087                } else {
135088                  _ = c.width * f;
135089                  if (e.isAlignHorizontalCenter) {
135090                    let t = e.isAbsoluteHorizontalCenter ? e.horizontalCenter : e.horizontalCenter * a;
135091                    let s = (.5 - l.x) * o.width;
135092                    if (i) {
135093                      t *= r.x;
135094                      s += n.x;
135095                      s *= r.x;
135096                    }
135097                    u = s + (m - .5) * _ + t;
135098                  } else u = e.isAlignLeft ? t + m * _ : s + (m - 1) * _;
135099                }
135100                e._lastSize.width = _;
135101              }
135102              if (e.alignFlags & rXt.VERTICAL) {
135103                let t = 0;
135104                let s = 0;
135105                const a = o.height;
135106                if (h) {
135107                  s = HR.bottom.y;
135108                  t = HR.top.y;
135109                } else {
135110                  s = -l.y * a;
135111                  t = s + a;
135112                }
135113                s += e.isAbsoluteBottom ? e.bottom : e.bottom * a;
135114                t -= e.isAbsoluteTop ? e.top : e.top * a;
135115                if (i) {
135116                  s += n.y;
135117                  s *= r.y;
135118                  t += n.y;
135119                  t *= r.y;
135120                }
135121                let u = 0;
135122                let m = d.y;
135123                let f = p.y;
135124                if (f < 0) {
135125                  m = 1 - m;
135126                  f = -f;
135127                }
135128                if (e.isStretchHeight) {
135129                  u = t - s;
135130                  0 !== f && (c.height = u / f);
135131                  _ = s + m * u;
135132                } else {
135133                  u = c.height * f;
135134                  if (e.isAlignVerticalCenter) {
135135                    let t = e.isAbsoluteVerticalCenter ? e.verticalCenter : e.verticalCenter * a;
135136                    let s = (.5 - l.y) * o.height;
135137                    if (i) {
135138                      t *= r.y;
135139                      s += n.y;
135140                      s *= r.y;
135141                    }
135142                    _ = s + (m - .5) * u + t;
135143                  } else _ = e.isAlignBottom ? s + m * u : t + (m - 1) * u;
135144                }
135145                e._lastSize.height = u;
135146              }
135147              t.setPosition(u, _, CWt.z);
135148              Pi.set(e._lastPos, u, _, CWt.z);
135149            }
135150            function DWt(t) {
135151              const e = t.getComponent(lXt);
135152              if (e && e.enabled) {
135153                if (!m.isValid(t, !0)) return;
135154                OWt.push(e);
135155              }
135156              const i = t.children;
135157              for (const t of i) t.active && DWt(t);
135158            }
135159            function PWt() {
135160              const t = IR.getScene();
135161              if (t) {
135162                NWt.isAligning = !0;
135163                if (NWt._nodesOrderDirty) {
135164                  OWt.length = 0;
135165                  DWt(t);
135166                  NWt._nodesOrderDirty = !1;
135167                }
135168                let e = null;
135169                const i = NWt._activeWidgetsIterator;
135170                for (i.i = 0; i.i < OWt.length; ++i.i) {
135171                  e = OWt[i.i];
135172                  if (e._dirty) {
135173                    BWt(e.node, e);
135174                    e._dirty = !1;
135175                  }
135176                }
135177                NWt.isAligning = !1;
135178              }
135179            }
135180            const OWt = [];
135181            const NWt = t("widgetManager", m._widgetManager = {
135182              isAligning: !1,
135183              _nodesOrderDirty: !1,
135184              _activeWidgetsIterator: new te.MutableForwardIterator(OWt),
135185              animationState: null,
135186              init() {
135187                IR.on(RR.EVENT_AFTER_SCENE_LAUNCH, PWt);
135188                IR.on(RR.EVENT_AFTER_UPDATE, PWt);
135189                WR.instance.on("design-resolution-changed", this.onResized, this);
135190                {
135191                  const t = this.onResized.bind(this);
135192                  WR.instance.on("canvas-resize", t);
135193                  Lo.on("orientation-change", t);
135194                }
135195              },
135196              add(t) {
135197                this._nodesOrderDirty = !0;
135198              },
135199              remove(t) {
135200                this._activeWidgetsIterator.remove(t);
135201              },
135202              onResized() {
135203                const t = IR.getScene();
135204                t && this.refreshWidgetOnResized(t);
135205              },
135206              refreshWidgetOnResized(t) {
135207                const e = _y.isNode(t) && t.getComponent(lXt);
135208                e && e.enabled && (e.alignMode === nXt.ON_WINDOW_RESIZE || e.alignMode === nXt.ALWAYS) && e.setDirty();
135209                const i = t.children;
135210                for (const t of i) this.refreshWidgetOnResized(t);
135211              },
135212              updateOffsetsToStayPut(t, e) {
135213                function i(t, e) {
135214                  return Math.abs(t - e) > 1e-10 ? e : t;
135215                }
135216                const s = t.node;
135217                let n = s.parent;
135218                if (n) {
135219                  const r = IWt;
135220                  r.set(0, 0);
135221                  const o = MWt;
135222                  o.set(1, 1);
135223                  if (t.target) {
135224                    n = t.target;
135225                    sXt(s, n, r, o);
135226                  }
135227                  if (!e) return;
135228                  const a = n._uiProps && n._uiProps.uiTransformComp;
135229                  const l = a ? a.anchorPoint : xWt;
135230                  const h = s._uiProps.uiTransformComp;
135231                  const c = iXt(n);
135232                  const u = h.anchorPoint;
135233                  const _ = s.getPosition();
135234                  const d = rXt;
135235                  const p = s.getScale();
135236                  let m = 0;
135237                  if (e & d.LEFT) {
135238                    let e = -l.x * c.width;
135239                    e += r.x;
135240                    e *= o.x;
135241                    m = _.x - u.x * h.width * Math.abs(p.x) - e;
135242                    t.isAbsoluteLeft || (m /= c.width);
135243                    m /= o.x;
135244                    t.left = i(t.left, m);
135245                  }
135246                  if (e & d.RIGHT) {
135247                    let e = (1 - l.x) * c.width;
135248                    e += r.x;
135249                    m = (e *= o.x) - (_.x + (1 - u.x) * h.width * Math.abs(p.x));
135250                    t.isAbsoluteRight || (m /= c.width);
135251                    m /= o.x;
135252                    t.right = i(t.right, m);
135253                  }
135254                  if (e & d.TOP) {
135255                    let e = (1 - l.y) * c.height;
135256                    e += r.y;
135257                    m = (e *= o.y) - (_.y + (1 - u.y) * h.height * Math.abs(p.y));
135258                    t.isAbsoluteTop || (m /= c.height);
135259                    m /= o.y;
135260                    t.top = i(t.top, m);
135261                  }
135262                  if (e & d.BOT) {
135263                    let e = -l.y * c.height;
135264                    e += r.y;
135265                    e *= o.y;
135266                    m = _.y - u.y * h.height * Math.abs(p.y) - e;
135267                    t.isAbsoluteBottom || (m /= c.height);
135268                    m /= o.y;
135269                    t.bottom = i(t.bottom, m);
135270                  }
135271                }
135272              },
135273              updateAlignment: function t(e) {
135274                const i = e.parent;
135275                i && _y.isNode(i) && t(i);
135276                const s = e.getComponent(lXt);
135277                s && i && BWt(e, s);
135278              },
135279              AlignMode: nXt,
135280              AlignFlags: rXt
135281            });
135282            IR.on(RR.EVENT_INIT, (() => {
135283              NWt.init();
135284            }));
135285            var LWt;
135286            let FWt = function(e) {
135287              return t({
135288                SafeArea: e,
135289                SafeAreaComponent: e
135290              }), e;
135291            }(Ul("cc.SafeArea")(LWt = sh()(LWt = zl(110)(LWt = Ql(LWt = $l()(LWt = Gl(lXt)(LWt = class extends Qc {
135292              onEnable() {
135293                this.updateArea();
135294                Lo.on("window-resize", this.updateArea, this);
135295                Lo.on("orientation-change", this.updateArea, this);
135296              }
135297              onDisable() {
135298                Lo.off("window-resize", this.updateArea, this);
135299                Lo.off("orientation-change", this.updateArea, this);
135300              }
135301              updateArea() {
135302                const t = this.node.getComponent(lXt);
135303                const e = this.node.getComponent(jB);
135304                if (!t || !e) return;
135305                t.updateAlignment();
135306                const i = this.node.position.clone();
135307                const s = e.anchorPoint.clone();
135308                t.isAlignTop = t.isAlignBottom = t.isAlignLeft = t.isAlignRight = !0;
135309                const n = JR.getVisibleSize();
135310                const r = n.width;
135311                const o = n.height;
135312                const a = Vo.getSafeAreaRect();
135313                t.top = o - a.y - a.height;
135314                t.bottom = a.y;
135315                t.left = a.x;
135316                t.right = r - a.x - a.width;
135317                t.updateAlignment();
135318                const l = this.node.position.clone();
135319                const h = s.x - (l.x - i.x) / e.width;
135320                const c = s.y - (l.y - i.y) / e.height;
135321                e.setAnchorPoint(h, c);
135322                NWt.add(t);
135323              }
135324            }) || LWt) || LWt) || LWt) || LWt) || LWt) || LWt);
135325            m.SafeArea = FWt;
135326            var VWt, kWt, UWt, GWt, zWt, HWt, jWt, XWt, WWt, YWt, qWt, KWt, JWt, ZWt, QWt, $Wt, tYt, eYt, iYt, sYt;
135327            let nYt = function(e) {
135328              return t({
135329                UICoordinateTracker: e,
135330                UICoordinateTrackerComponent: e
135331              }), e;
135332            }((VWt = Ul("cc.UICoordinateTracker"), kWt = sh(), UWt = $l(), GWt = zl(110), zWt = Th(_y),
135333            HWt = lh(), jWt = Th(hS), XWt = lh(), WWt = lh(), YWt = lh(), qWt = Th([ Vc ]),
135334            KWt = lh(), VWt(JWt = kWt(JWt = UWt(JWt = GWt(JWt = (ZWt = (sYt = class extends Qc {
135335              constructor(...t) {
135336                super(...t);
135337                Ml(this, "syncEvents", QWt, this);
135338                Ml(this, "_target", $Wt, this);
135339                Ml(this, "_camera", tYt, this);
135340                Ml(this, "_useScale", eYt, this);
135341                Ml(this, "_distance", iYt, this);
135342                this._transformPos = new Pi;
135343                this._viewPos = new Pi;
135344                this._canMove = !0;
135345                this._lastWPos = new Pi;
135346                this._lastCameraPos = new Pi;
135347              }
135348              get target() {
135349                return this._target;
135350              }
135351              set target(t) {
135352                if (this._target !== t) {
135353                  this._target = t;
135354                  this._checkCanMove();
135355                }
135356              }
135357              get camera() {
135358                return this._camera;
135359              }
135360              set camera(t) {
135361                if (this._camera !== t) {
135362                  this._camera = t;
135363                  this._checkCanMove();
135364                }
135365              }
135366              get useScale() {
135367                return this._useScale;
135368              }
135369              set useScale(t) {
135370                this._useScale !== t && (this._useScale = t);
135371              }
135372              get distance() {
135373                return this._distance;
135374              }
135375              set distance(t) {
135376                this._distance !== t && (this._distance = t);
135377              }
135378              onEnable() {
135379                this._checkCanMove();
135380              }
135381              update() {
135382                const t = this.node.worldPosition;
135383                const e = this._camera;
135384                if (this._canMove && e && e.camera && (!this._lastWPos.equals(t) || !this._lastCameraPos.equals(e.node.worldPosition))) {
135385                  this._lastWPos.set(t);
135386                  this._lastCameraPos.set(e.node.worldPosition);
135387                  e.camera.update();
135388                  e.convertToUINode(t, this._target, this._transformPos);
135389                  this._useScale && Pi.transformMat4(this._viewPos, this.node.worldPosition, e.camera.matView);
135390                  if (this.syncEvents.length > 0) {
135391                    const t = this._distance / Math.abs(this._viewPos.z);
135392                    Vc.emitEvents(this.syncEvents, this._transformPos, t);
135393                  }
135394                }
135395              }
135396              _checkCanMove() {
135397                this._canMove = !(!this._camera || !this._target);
135398              }
135399            }, sYt), Bl(ZWt.prototype, "target", [ zWt, HWt ], Object.getOwnPropertyDescriptor(ZWt.prototype, "target"), ZWt.prototype),
135400            Bl(ZWt.prototype, "camera", [ jWt, XWt ], Object.getOwnPropertyDescriptor(ZWt.prototype, "camera"), ZWt.prototype),
135401            Bl(ZWt.prototype, "useScale", [ WWt ], Object.getOwnPropertyDescriptor(ZWt.prototype, "useScale"), ZWt.prototype),
135402            Bl(ZWt.prototype, "distance", [ YWt ], Object.getOwnPropertyDescriptor(ZWt.prototype, "distance"), ZWt.prototype),
135403            QWt = Bl(ZWt.prototype, "syncEvents", [ qWt, Yl, KWt ], {
135404              configurable: !0,
135405              enumerable: !0,
135406              writable: !0,
135407              initializer: function() {
135408                return [];
135409              }
135410            }), $Wt = Bl(ZWt.prototype, "_target", [ Yl ], {
135411              configurable: !0,
135412              enumerable: !0,
135413              writable: !0,
135414              initializer: function() {
135415                return null;
135416              }
135417            }), tYt = Bl(ZWt.prototype, "_camera", [ Yl ], {
135418              configurable: !0,
135419              enumerable: !0,
135420              writable: !0,
135421              initializer: function() {
135422                return null;
135423              }
135424            }), eYt = Bl(ZWt.prototype, "_useScale", [ Yl ], {
135425              configurable: !0,
135426              enumerable: !0,
135427              writable: !0,
135428              initializer: function() {
135429                return !0;
135430              }
135431            }), iYt = Bl(ZWt.prototype, "_distance", [ Yl ], {
135432              configurable: !0,
135433              enumerable: !0,
135434              writable: !0,
135435              initializer: function() {
135436                return 1;
135437              }
135438            }), ZWt)) || JWt) || JWt) || JWt) || JWt));
135439            var rYt;
135440            const oYt = [ ny.TOUCH_START, ny.TOUCH_END, ny.TOUCH_MOVE, ny.MOUSE_DOWN, ny.MOUSE_MOVE, ny.MOUSE_UP, ny.MOUSE_ENTER, ny.MOUSE_LEAVE, ny.MOUSE_WHEEL ];
135441            function aYt(t) {
135442              t.propagationStopped = !0;
135443            }
135444            let lYt = function(e) {
135445              return t({
135446                BlockInputEvents: e,
135447                BlockInputEventsComponent: e
135448              }), e;
135449            }(Ul("cc.BlockInputEvents")(rYt = sh()(rYt = $l()(rYt = class extends Qc {
135450              onEnable() {
135451                for (let t = 0; t < oYt.length; t++) this.node.on(oYt[t], aYt, this);
135452              }
135453              onDisable() {
135454                for (let t = 0; t < oYt.length; t++) this.node.off(oYt[t], aYt, this);
135455              }
135456            }) || rYt) || rYt) || rYt);
135457            var hYt, cYt, uYt, _Yt, dYt, pYt, mYt, fYt, gYt, yYt, bYt, SYt;
135458            let AYt = t("SubContextView", (hYt = Ul("cc.SubContextView"), cYt = sh(), uYt = zl(110),
135459            _Yt = Gl(jB), dYt = $l(), pYt = lh(), mYt = lh(), hYt(fYt = cYt(fYt = uYt(fYt = _Yt(fYt = dYt(fYt = (gYt = (SYt = class extends Qc {
135460              get designResolutionSize() {
135461                return this._designResolutionSize;
135462              }
135463              set designResolutionSize(t) {}
135464              get fps() {
135465                return this._fps;
135466              }
135467              set fps(t) {
135468                if (this._fps !== t) {
135469                  this._fps = t;
135470                  this._updateInterval = 1e3 / t;
135471                }
135472              }
135473              constructor() {
135474                super();
135475                Ml(this, "_fps", yYt, this);
135476                this._sprite = void 0;
135477                this._imageAsset = void 0;
135478                this._texture = void 0;
135479                this._updatedTime = 0;
135480                this._updateInterval = 0;
135481                this._openDataContext = void 0;
135482                this._content = void 0;
135483                Ml(this, "_designResolutionSize", bYt, this);
135484                this._content = new _y("content");
135485                this._content.hideFlags |= co.Flags.DontSave | co.Flags.HideInHierarchy;
135486                this._sprite = null;
135487                this._imageAsset = new IC;
135488                this._openDataContext = null;
135489                this._updatedTime = performance.now();
135490                this._texture = new LC;
135491              }
135492              onLoad() {
135493                if (SI.getOpenDataContext) {
135494                  this._updateInterval = 1e3 / this._fps;
135495                  this._openDataContext = SI.getOpenDataContext();
135496                  this._initSharedCanvas();
135497                  this._initContentNode();
135498                  this._updateSubContextView();
135499                  this._updateContentLayer();
135500                } else this.enabled = !1;
135501              }
135502              onEnable() {
135503                this._registerNodeEvent();
135504              }
135505              onDisable() {
135506                this._unregisterNodeEvent();
135507              }
135508              _initSharedCanvas() {
135509                if (this._openDataContext) {
135510                  const t = this._openDataContext.canvas;
135511                  let e = this._designResolutionSize.width;
135512                  let i = this._designResolutionSize.height;
135513                  t.width = e;
135514                  t.height = i;
135515                }
135516              }
135517              _initContentNode() {
135518                if (this._openDataContext) {
135519                  const t = this._openDataContext.canvas;
135520                  const e = this._imageAsset;
135521                  e.reset(t);
135522                  this._texture.image = e;
135523                  this._texture.create(t.width, t.height);
135524                  this._sprite = this._content.getComponent(cL);
135525                  this._sprite || (this._sprite = this._content.addComponent(cL));
135526                  if (this._sprite.spriteFrame) this._sprite.spriteFrame.texture = this._texture; else {
135527                    const t = new GI;
135528                    t.texture = this._texture;
135529                    this._sprite.spriteFrame = t;
135530                  }
135531                  this._content.parent = this.node;
135532                }
135533              }
135534              _updateSubContextView() {
135535                if (!this._openDataContext) return;
135536                const t = this.node.getComponent(jB);
135537                const e = this._content.getComponent(jB);
135538                const i = t.width / e.width;
135539                const s = t.height / e.height;
135540                const n = i > s ? s : i;
135541                e.width *= n;
135542                e.height *= n;
135543                const r = JR.getViewportRect();
135544                const o = e.getBoundingBoxToWorld();
135545                const a = JR.getVisibleSize();
135546                const l = Lo.devicePixelRatio;
135547                const h = (r.width * (o.x / a.width) + r.x) / l;
135548                const c = (r.height * (o.y / a.height) + r.y) / l;
135549                const u = r.width * (o.width / a.width) / l;
135550                const _ = r.height * (o.height / a.height) / l;
135551                this._openDataContext.postMessage({
135552                  fromEngine: !0,
135553                  type: "engine",
135554                  event: "viewport",
135555                  x: h,
135556                  y: c,
135557                  width: u,
135558                  height: _
135559                });
135560              }
135561              _updateSubContextTexture() {
135562                const t = this._imageAsset;
135563                if (!t || !this._openDataContext) return;
135564                if (t.width <= 0 || t.height <= 0) return;
135565                const e = this._openDataContext.canvas;
135566                t.reset(e);
135567                (e.width > t.width || e.height > t.height) && this._texture.create(e.width, e.height);
135568                this._texture.uploadData(e);
135569              }
135570              _registerNodeEvent() {
135571                this.node.on(ny.TRANSFORM_CHANGED, this._updateSubContextView, this);
135572                this.node.on(ny.SIZE_CHANGED, this._updateSubContextView, this);
135573                this.node.on(ny.LAYER_CHANGED, this._updateContentLayer, this);
135574              }
135575              _unregisterNodeEvent() {
135576                this.node.off(ny.TRANSFORM_CHANGED, this._updateSubContextView, this);
135577                this.node.off(ny.SIZE_CHANGED, this._updateSubContextView, this);
135578                this.node.off(ny.LAYER_CHANGED, this._updateContentLayer, this);
135579              }
135580              _updateContentLayer() {
135581                this._content.layer = this.node.layer;
135582              }
135583              update(t) {
135584                if (void 0 === t) {
135585                  this._updateSubContextTexture();
135586                  return;
135587                }
135588                if (performance.now() - this._updatedTime >= this._updateInterval) {
135589                  this._updatedTime += this._updateInterval;
135590                  this._updateSubContextTexture();
135591                }
135592              }
135593              onDestroy() {
135594                this._content.destroy();
135595                this._texture.destroy();
135596                this._sprite && this._sprite.destroy();
135597                this._imageAsset.destroy();
135598                this._openDataContext = null;
135599              }
135600            }, SYt), Bl(gYt.prototype, "designResolutionSize", [ pYt ], Object.getOwnPropertyDescriptor(gYt.prototype, "designResolutionSize"), gYt.prototype),
135601            Bl(gYt.prototype, "fps", [ mYt ], Object.getOwnPropertyDescriptor(gYt.prototype, "fps"), gYt.prototype),
135602            yYt = Bl(gYt.prototype, "_fps", [ Yl ], {
135603              configurable: !0,
135604              enumerable: !0,
135605              writable: !0,
135606              initializer: function() {
135607                return 60;
135608              }
135609            }), bYt = Bl(gYt.prototype, "_designResolutionSize", [ Yl ], {
135610              configurable: !0,
135611              enumerable: !0,
135612              writable: !0,
135613              initializer: function() {
135614                return new rs(640, 960);
135615              }
135616            }), gYt)) || fYt) || fYt) || fYt) || fYt) || fYt));
135617            m.SubContextView = AYt;
135618            et({
135619              ButtonComponent: {
135620                newName: "Button",
135621                since: "1.2.0",
135622                removed: !1
135623              },
135624              EditBoxComponent: {
135625                newName: "EditBox",
135626                since: "1.2.0",
135627                removed: !1
135628              },
135629              LayoutComponent: {
135630                newName: "Layout",
135631                since: "1.2.0",
135632                removed: !1
135633              },
135634              ProgressBarComponent: {
135635                newName: "ProgressBar",
135636                since: "1.2.0",
135637                removed: !1
135638              },
135639              ScrollViewComponent: {
135640                newName: "ScrollView",
135641                since: "1.2.0",
135642                removed: !1
135643              },
135644              ScrollBarComponent: {
135645                newName: "ScrollBar",
135646                since: "1.2.0",
135647                removed: !1
135648              },
135649              SliderComponent: {
135650                newName: "Slider",
135651                since: "1.2.0",
135652                removed: !1
135653              },
135654              ToggleComponent: {
135655                newName: "Toggle",
135656                since: "1.2.0",
135657                removed: !1
135658              },
135659              ToggleContainerComponent: {
135660                newName: "ToggleContainer",
135661                since: "1.2.0",
135662                removed: !1
135663              },
135664              WidgetComponent: {
135665                newName: "Widget",
135666                since: "1.2.0",
135667                removed: !1
135668              },
135669              PageViewComponent: {
135670                newName: "PageView",
135671                since: "1.2.0",
135672                removed: !1
135673              },
135674              PageViewIndicatorComponent: {
135675                newName: "PageViewIndicator",
135676                since: "1.2.0",
135677                removed: !1
135678              },
135679              SafeAreaComponent: {
135680                newName: "SafeArea",
135681                since: "1.2.0",
135682                removed: !1
135683              },
135684              UICoordinateTrackerComponent: {
135685                newName: "UICoordinateTracker",
135686                since: "1.2.0",
135687                removed: !1
135688              },
135689              BlockInputEventsComponent: {
135690                newName: "BlockInputEvents",
135691                since: "1.2.0",
135692                removed: !1
135693              }
135694            });
135695            var TYt;
135696            let vYt = t("UIReorderComponent", Ul("cc.UIReorderComponent")(TYt = class {
135697              constructor() {
135698                N(1408, "UIReorderComponent");
135699              }
135700            }) || TYt);
135701            m.UIReorderComponent = vYt;
135702            m.ButtonComponent = RVt;
135703            ee.setClassAlias(RVt, "cc.ButtonComponent");
135704            m.EditBoxComponent = Gkt;
135705            ee.setClassAlias(Gkt, "cc.EditBoxComponent");
135706            m.LayoutComponent = JUt;
135707            ee.setClassAlias(JUt, "cc.LayoutComponent");
135708            m.ProgressBarComponent = SGt;
135709            ee.setClassAlias(SGt, "cc.ProgressBarComponent");
135710            m.ScrollViewComponent = nHt;
135711            ee.setClassAlias(nHt, "cc.ScrollViewComponent");
135712            m.ScrollBarComponent = QGt;
135713            ee.setClassAlias(QGt, "cc.ScrollBarComponent");
135714            m.SliderComponent = RHt;
135715            ee.setClassAlias(RHt, "cc.SliderComponent");
135716            m.ToggleComponent = JHt;
135717            ee.setClassAlias(JHt, "cc.ToggleComponent");
135718            m.ToggleContainerComponent = hjt;
135719            ee.setClassAlias(hjt, "cc.ToggleContainerComponent");
135720            m.WidgetComponent = lXt;
135721            ee.setClassAlias(lXt, "cc.WidgetComponent");
135722            m.PageViewComponent = EWt;
135723            ee.setClassAlias(EWt, "cc.PageViewComponent");
135724            m.PageViewIndicatorComponent = MXt;
135725            ee.setClassAlias(MXt, "cc.PageViewIndicatorComponent");
135726            m.SafeAreaComponent = FWt;
135727            ee.setClassAlias(FWt, "cc.SafeAreaComponent");
135728            ee.setClassAlias(nYt, "cc.UICoordinateTrackerComponent");
135729            m.BlockInputEventsComponent = lYt;
135730            ee.setClassAlias(lYt, "cc.BlockInputEventsComponent");
135731            var EYt, CYt, xYt;
135732            let wYt = t("VideoClip", Ul("cc.VideoClip")(EYt = (CYt = class extends gc {
135733              constructor() {
135734                super();
135735                Ml(this, "_duration", xYt, this);
135736                this._video = null;
135737              }
135738              set _nativeAsset(t) {
135739                this._video = t;
135740                this._duration = t ? t.duration : 0;
135741              }
135742              get _nativeAsset() {
135743                return this._video;
135744              }
135745            }, xYt = Bl(CYt.prototype, "_duration", [ Yl ], {
135746              configurable: !0,
135747              enumerable: !0,
135748              writable: !0,
135749              initializer: function() {
135750                return 0;
135751              }
135752            }), CYt)) || EYt);
135753            function RYt(t, e, i) {
135754              const s = document.createElement("video");
135755              const n = document.createElement("source");
135756              s.appendChild(n);
135757              const r = new XMLHttpRequest;
135758              r.open("GET", t, !0);
135759              r.responseType = "blob";
135760              r.onload = function() {
135761                if (200 === this.status || 0 === this.status) {
135762                  n.src = URL.createObjectURL(this.response);
135763                  i(null, s);
135764                } else i(new Error(`${r.status}(no response)`));
135765              };
135766              r.onerror = function() {
135767                const e = `load video failure - ${t}`;
135768                E(e);
135769                i(new Error(e));
135770              };
135771              r.send();
135772            }
135773            function IYt(t, e, i, s) {
135774              const n = new wYt;
135775              n._nativeUrl = t;
135776              n._nativeAsset = e;
135777              s(null, n);
135778            }
135779            Jw.register({
135780              ".mp4": RYt,
135781              ".avi": RYt,
135782              ".mov": RYt,
135783              ".mpg": RYt,
135784              ".mpeg": RYt,
135785              ".rm": RYt,
135786              ".rmvb": RYt
135787            });
135788            sR.register({
135789              ".mp4": IYt,
135790              ".avi": IYt,
135791              ".mov": IYt,
135792              ".mpg": IYt,
135793              ".mpeg": IYt,
135794              ".rm": IYt,
135795              ".rmvb": IYt
135796            });
135797            const MYt = oe({
135798              REMOTE: 0,
135799              LOCAL: 1
135800            });
135801            let BYt;
135802            !function(t) {
135803              t.NONE = "none";
135804              t.PLAYING = "playing";
135805              t.PAUSED = "paused";
135806              t.STOPPED = "stopped";
135807              t.COMPLETED = "completed";
135808              t.META_LOADED = "meta-loaded";
135809              t.READY_TO_PLAY = "ready-to-play";
135810              t.ERROR = "error";
135811              t.CLICKED = "clicked";
135812            }(BYt || (BYt = {}));
135813            let DYt;
135814            !function(t) {
135815              t[t.HAVE_NOTHING = 0] = "HAVE_NOTHING";
135816              t[t.HAVE_METADATA = 1] = "HAVE_METADATA";
135817              t[t.HAVE_CURRENT_DATA = 2] = "HAVE_CURRENT_DATA";
135818              t[t.HAVE_FUTURE_DATA = 3] = "HAVE_FUTURE_DATA";
135819              t[t.HAVE_ENOUGH_DATA = 4] = "HAVE_ENOUGH_DATA";
135820            }(DYt || (DYt = {}));
135821            class PYt {
135822              constructor(t) {
135823                this._componentEventList = new Map;
135824                this._state = BYt.NONE;
135825                this._video = null;
135826                this._onHide = void 0;
135827                this._onShow = void 0;
135828                this._interrupted = !1;
135829                this._loaded = !1;
135830                this._loadedMeta = !1;
135831                this._ignorePause = !1;
135832                this._fullScreenOnAwake = !1;
135833                this._visible = !0;
135834                this._playing = !1;
135835                this._cachedCurrentTime = -1;
135836                this._waitingFullscreen = !1;
135837                this._waitingPlay = !1;
135838                this._keepAspectRatio = !1;
135839                this._component = null;
135840                this._uiTrans = null;
135841                this._node = null;
135842                this._stayOnBottom = !1;
135843                this._dirty = !1;
135844                this._forceUpdate = !1;
135845                this._w = 0;
135846                this._h = 0;
135847                this._m00 = 0;
135848                this._m01 = 0;
135849                this._m04 = 0;
135850                this._m05 = 0;
135851                this._m12 = 0;
135852                this._m13 = 0;
135853                this._component = t;
135854                this._node = t.node;
135855                this._uiTrans = t.node.getComponent(jB);
135856                this._onHide = () => {
135857                  if (this.video && this._state === BYt.PLAYING) {
135858                    this.video.pause();
135859                    this._interrupted = !0;
135860                  }
135861                };
135862                this._onShow = () => {
135863                  if (this._interrupted && this.video) {
135864                    this.video.play();
135865                    this._interrupted = !1;
135866                  }
135867                };
135868                m.game.on(m.Game.EVENT_HIDE, this._onHide);
135869                m.game.on(m.Game.EVENT_SHOW, this._onShow);
135870              }
135871              get fullScreenOnAwake() {
135872                return this._fullScreenOnAwake;
135873              }
135874              get loaded() {
135875                return this._loaded;
135876              }
135877              get componentEventList() {
135878                return this._componentEventList;
135879              }
135880              get video() {
135881                return this._video;
135882              }
135883              get state() {
135884                return this._state;
135885              }
135886              get isPlaying() {
135887                return this._playing;
135888              }
135889              get UICamera() {
135890                return IR.root.batcher2D.getFirstRenderCamera(this._node);
135891              }
135892              onLoadedMetadata(t) {
135893                this._loadedMeta = !0;
135894                this._forceUpdate = !0;
135895                this._visible ? this.enable() : this.disable();
135896                this.dispatchEvent(BYt.META_LOADED);
135897                const e = t.target;
135898                this._keepAspectRatio && e && this.syncUITransform(e.videoWidth, e.videoHeight);
135899                this.delayedFullScreen();
135900                this.delayedPlay();
135901              }
135902              onCanPlay(t) {
135903                this._loaded = !0;
135904                this.dispatchEvent(BYt.READY_TO_PLAY);
135905              }
135906              onPlay(t) {
135907                this._playing = !0;
135908                this.dispatchEvent(BYt.PLAYING);
135909              }
135910              onPlaying(t) {
135911                this.dispatchEvent(BYt.PLAYING);
135912              }
135913              onPause(t) {
135914                if (this._ignorePause) this._ignorePause = !1; else {
135915                  this._playing = !1;
135916                  this.dispatchEvent(BYt.PAUSED);
135917                }
135918              }
135919              onStoped(t) {
135920                this._playing = !1;
135921                this._ignorePause = !1;
135922                this.dispatchEvent(BYt.STOPPED);
135923              }
135924              onEnded(t) {
135925                this.dispatchEvent(BYt.COMPLETED);
135926              }
135927              onClick(t) {
135928                this.dispatchEvent(BYt.CLICKED);
135929              }
135930              onError(t) {
135931                this.dispatchEvent(BYt.ERROR);
135932                const e = t.target;
135933                e && e.error && x(`Error ${e.error.code}; details: ${e.error.message}`);
135934              }
135935              play() {
135936                this._loadedMeta || this._loaded ? this.canPlay() : this._waitingPlay = !0;
135937              }
135938              delayedPlay() {
135939                if (this._waitingPlay) {
135940                  this.canPlay();
135941                  this._waitingPlay = !1;
135942                }
135943              }
135944              syncFullScreenOnAwake(t) {
135945                this._fullScreenOnAwake = t;
135946                this._loadedMeta || this._loaded ? this.canFullScreen(t) : this._waitingFullscreen = !0;
135947              }
135948              delayedFullScreen() {
135949                if (this._waitingFullscreen) {
135950                  this.canFullScreen(this._fullScreenOnAwake);
135951                  this._waitingFullscreen = !1;
135952                }
135953              }
135954              dispatchEvent(t) {
135955                const e = this._componentEventList.get(t);
135956                if (e) {
135957                  this._state = t;
135958                  e.call(this);
135959                }
135960              }
135961              syncUITransform(t, e) {
135962                if (this._uiTrans) {
135963                  this._uiTrans.width = t;
135964                  this._uiTrans.height = e;
135965                }
135966              }
135967              syncCurrentTime() {
135968                if (this.video && -1 !== this._cachedCurrentTime && this.video.currentTime !== this._cachedCurrentTime) {
135969                  this.seekTo(this._cachedCurrentTime);
135970                  this._cachedCurrentTime = -1;
135971                }
135972              }
135973              destroy() {
135974                this.removeVideoPlayer();
135975                this._componentEventList.clear();
135976                m.game.off(m.Game.EVENT_HIDE, this._onHide);
135977                m.game.off(m.Game.EVENT_SHOW, this._onShow);
135978              }
135979            }
135980            m.internal.VideoPlayerImpl = PYt;
135981            const OYt = Zi();
135982            class NYt extends PYt {
135983              constructor(t) {
135984                super(t);
135985                this._eventList = new Map;
135986                this._clearColorA = -1;
135987                this._clearFlag = void 0;
135988              }
135989              addListener(t, e) {
135990                if (this._video) {
135991                  this._eventList.set(t, e);
135992                  this._video.addEventListener(t, e);
135993                }
135994              }
135995              removeAllListeners() {
135996                this._eventList.forEach(((t, e) => {
135997                  this._video && this._video.removeEventListener(e, t);
135998                }));
135999                this._eventList.clear();
136000              }
136001              canPlay() {
136002                if (this.video) {
136003                  const t = this.video.play();
136004                  window.Promise && t instanceof Promise && t.catch((t => {})).then((() => {
136005                    this.syncCurrentTime();
136006                  }));
136007                }
136008              }
136009              pause() {
136010                if (this.video) {
136011                  this.video.pause();
136012                  this._cachedCurrentTime = this.video.currentTime;
136013                }
136014              }
136015              resume() {
136016                this.play();
136017              }
136018              stop() {
136019                if (this.video) {
136020                  this._ignorePause = !0;
136021                  this.video.currentTime = 0;
136022                  this.video.pause();
136023                  this._cachedCurrentTime = 0;
136024                  setTimeout((() => {
136025                    this._ignorePause = !1;
136026                    this.dispatchEvent(BYt.STOPPED);
136027                  }), 0);
136028                }
136029              }
136030              syncClip(t) {
136031                this.removeVideoPlayer();
136032                t && this.createVideoPlayer(t.nativeUrl);
136033              }
136034              syncURL(t) {
136035                this.removeVideoPlayer();
136036                t && this.createVideoPlayer(t);
136037              }
136038              syncPlaybackRate(t) {
136039                Vo.browserType !== Co.UC ? this.video && (this.video.playbackRate = t) : C("playbackRate is not supported by the uc mobile browser.");
136040              }
136041              syncVolume(t) {
136042                this.video && (this.video.volume = t);
136043              }
136044              syncMute(t) {
136045                this.video && (this.video.muted = t);
136046              }
136047              syncLoop(t) {
136048                this.video && (this.video.loop = t);
136049              }
136050              getDuration() {
136051                return this.video ? this.video.duration : 0;
136052              }
136053              getCurrentTime() {
136054                return this.video ? this.video.currentTime : -1;
136055              }
136056              seekTo(t) {
136057                this.video && (this.video.currentTime = t);
136058              }
136059              canFullScreen(t) {
136060                const e = this._video;
136061                if (e && e.readyState === DYt.HAVE_ENOUGH_DATA) if (Vo.os === Ro.IOS && Vo.isBrowser) {
136062                  t ? e.webkitEnterFullscreen && e.webkitEnterFullscreen() : e.webkitExitFullscreen && e.webkitExitFullscreen();
136063                  this._fullScreenOnAwake = e.webkitDisplayingFullscreen;
136064                } else if (Fo.supportsFullScreen) if (t) {
136065                  Vo.browserType === Co.IE && (e.style.transform = "");
136066                  e.setAttribute("x5-video-player-fullscreen", "true");
136067                  Fo.requestFullScreen(e, (t => {
136068                    const i = Vo.browserType === Co.IE ? t.msFullscreenElement : t.fullscreenElement;
136069                    this._fullScreenOnAwake = i === e;
136070                  }), (() => {
136071                    this._fullScreenOnAwake = !1;
136072                  }));
136073                } else {
136074                  e.removeAttribute("x5-video-player-fullscreen");
136075                  Fo.exitFullScreen();
136076                } else {
136077                  this._fullScreenOnAwake = t;
136078                  this._forceUpdate = !0;
136079                  this.syncMatrix();
136080                }
136081              }
136082              syncStayOnBottom(t) {
136083                if (this._video) {
136084                  this._video.style["z-index"] = t ? -32768 : 0;
136085                  this._stayOnBottom = t;
136086                }
136087                this._dirty = !0;
136088              }
136089              syncKeepAspectRatio(t) {
136090                this._keepAspectRatio = t;
136091                t && this._loadedMeta && this._video && this.syncUITransform(this._video.videoWidth, this._video.videoHeight);
136092              }
136093              removeVideoPlayer() {
136094                const t = this._video;
136095                if (t && Se(BR.container, t)) {
136096                  BR.container.removeChild(t);
136097                  this.removeAllListeners();
136098                }
136099                this._cachedCurrentTime = 0;
136100                this._playing = !1;
136101                this._loaded = !1;
136102                this._loadedMeta = !1;
136103                this._video = null;
136104              }
136105              createVideoPlayer(t) {
136106                const e = this._video = document.createElement("video");
136107                e.className = "cocosVideo";
136108                e.style.visibility = "hidden";
136109                e.style.position = "absolute";
136110                e.style.bottom = "0px";
136111                e.style.left = "0px";
136112                e.style["transform-origin"] = "0px 100% 0px";
136113                e.style["-webkit-transform-origin"] = "0px 100% 0px";
136114                e.setAttribute("preload", "auto");
136115                e.setAttribute("webkit-playsinline", "");
136116                e.setAttribute("x5-playsinline", "");
136117                e.setAttribute("playsinline", "");
136118                this._bindDomEvent();
136119                BR.container.appendChild(e);
136120                const i = document.createElement("source");
136121                e.appendChild(i);
136122                i.src = t;
136123              }
136124              _bindDomEvent() {
136125                this._video;
136126                this.addListener("loadedmetadata", this.onLoadedMetadata.bind(this));
136127                this.addListener("canplay", this.onCanPlay.bind(this));
136128                this.addListener("canplaythrough", this.onCanPlay.bind(this));
136129                this.addListener("play", this.onPlay.bind(this));
136130                this.addListener("playing", this.onPlaying.bind(this));
136131                this.addListener("pause", this.onPause.bind(this));
136132                this.addListener("click", this.onClick.bind(this));
136133                this.addListener("ended", this.onEnded.bind(this));
136134                this.addListener("error", this.onError.bind(this));
136135              }
136136              onCanPlay(t) {
136137                const e = t.target;
136138                if (!this._loaded || !e) switch (e.readyState) {
136139                 case DYt.HAVE_METADATA:
136140                 case DYt.HAVE_ENOUGH_DATA:
136141                  super.onCanPlay(t);
136142                }
136143              }
136144              enable() {
136145                if (this._video) {
136146                  this._visible = !0;
136147                  if ("visible" === this._video.style.visibility) return;
136148                  this._video.style.visibility = "visible";
136149                }
136150              }
136151              disable(t) {
136152                if (this._video) {
136153                  !t && this._playing && this._video.pause();
136154                  this._visible = !1;
136155                  if ("hidden" === this._video.style.visibility) return;
136156                  this._video.style.visibility = "hidden";
136157                }
136158              }
136159              syncMatrix() {
136160                if (!this._video || !this._visible || !this._component) return;
136161                const t = this.UICamera;
136162                if (!t) return;
136163                if (Fo.fullScreen()) return;
136164                if (this._dirty) {
136165                  this._dirty = !1;
136166                  if (this._stayOnBottom) {
136167                    this._clearColorA = t.clearColor.w;
136168                    this._clearFlag = t.clearFlag;
136169                    t.clearColor.w = 0;
136170                    t.clearFlag = en.ALL;
136171                  } else if (this._clearFlag) {
136172                    t.clearColor.w = this._clearColorA;
136173                    t.clearFlag = this._clearFlag;
136174                    this._clearColorA = -1;
136175                    this._clearFlag = null;
136176                  }
136177                }
136178                this._component.node.getWorldMatrix(OYt);
136179                t.update(!0);
136180                t.worldMatrixToScreen(OYt, OYt, BR.canvas.width, BR.canvas.height);
136181                let e = 0;
136182                let i = 0;
136183                if (this._fullScreenOnAwake) {
136184                  e = HR.width;
136185                  i = HR.height;
136186                } else {
136187                  e = this._uiTrans.contentSize.width;
136188                  i = this._uiTrans.contentSize.height;
136189                }
136190                if (!this._forceUpdate && this._m00 === OYt.m00 && this._m01 === OYt.m01 && this._m04 === OYt.m04 && this._m05 === OYt.m05 && this._m12 === OYt.m12 && this._m13 === OYt.m13 && this._w === e && this._h === i) return;
136191                this._m00 = OYt.m00;
136192                this._m01 = OYt.m01;
136193                this._m04 = OYt.m04;
136194                this._m05 = OYt.m05;
136195                this._m12 = OYt.m12;
136196                this._m13 = OYt.m13;
136197                this._w = e;
136198                this._h = i;
136199                const s = Lo.devicePixelRatio;
136200                const n = 1 / s;
136201                const r = 1 / s;
136202                const o = BR.container;
136203                const a = OYt.m00 * n;
136204                const l = OYt.m01;
136205                const h = OYt.m04;
136206                const c = OYt.m05 * r;
136207                this._video.style.width = `${this._w}px`;
136208                this._video.style.height = `${this._h}px`;
136209                Vo.browserType !== Co.MOBILE_QQ ? this._video.style.objectFit = this._keepAspectRatio ? "none" : "fill" : C("keepAspectRatio is not supported by the qq mobile browser.");
136210                const u = this._w * n;
136211                const _ = this._h * r;
136212                const {x: d, y: p} = this._uiTrans.anchorPoint;
136213                const m = u * OYt.m00 * d;
136214                const f = _ * OYt.m05 * p;
136215                const g = o && o.style.paddingLeft ? parseInt(o.style.paddingLeft) : 0;
136216                const y = o && o.style.paddingBottom ? parseInt(o.style.paddingBottom) : 0;
136217                const b = `matrix(${a},${-l},${-h},${c},${OYt.m12 * n - m + g},${-(OYt.m13 * r - f + y)})`;
136218                this._video.style.transform = b;
136219                this._video.style["-webkit-transform"] = b;
136220                Vo.browserType !== Co.IE && (this._forceUpdate = !1);
136221              }
136222            }
136223            class LYt {
136224              static getImpl(t) {
136225                return new NYt(t);
136226              }
136227            }
136228            m.internal.VideoPlayerImplManager = LYt;
136229            var FYt, VYt, kYt, UYt, GYt, zYt, HYt, jYt, XYt, WYt, YYt, qYt, KYt, JYt, ZYt, QYt, $Yt, tqt, eqt, iqt, sqt, nqt, rqt, oqt, aqt, lqt, hqt, cqt, uqt, _qt, dqt, pqt, mqt, fqt, gqt, yqt, bqt, Sqt, Aqt;
136230            let Tqt = t("VideoPlayer", (FYt = Ul("cc.VideoPlayer"), VYt = sh(), kYt = $l(),
136231            UYt = Gl(jB), GYt = Th(wYt), zYt = Th(MYt), HYt = lh(), jYt = lh(), XYt = Th(wYt),
136232            WYt = lh(), YYt = lh(), qYt = hh(), KYt = lh(), JYt = hh(), ZYt = lh(), QYt = lh(),
136233            $Yt = lh(), tqt = lh(), eqt = lh(), iqt = lh(), sqt = Th([ Vc ]), nqt = ph(), rqt = lh(),
136234            FYt(oqt = VYt(oqt = kYt(oqt = UYt(oqt = Ql(oqt = (aqt = (Aqt = Sqt = class extends Qc {
136235              constructor(...t) {
136236                super(...t);
136237                Ml(this, "_resourceType", lqt, this);
136238                Ml(this, "_remoteURL", hqt, this);
136239                Ml(this, "_clip", cqt, this);
136240                Ml(this, "_playOnAwake", uqt, this);
136241                Ml(this, "_volume", _qt, this);
136242                Ml(this, "_mute", dqt, this);
136243                Ml(this, "_playbackRate", pqt, this);
136244                Ml(this, "_loop", mqt, this);
136245                Ml(this, "_fullScreenOnAwake", fqt, this);
136246                Ml(this, "_stayOnBottom", gqt, this);
136247                Ml(this, "_keepAspectRatio", yqt, this);
136248                this._impl = null;
136249                this._cachedCurrentTime = 0;
136250                Ml(this, "videoPlayerEvent", bqt, this);
136251              }
136252              get resourceType() {
136253                return this._resourceType;
136254              }
136255              set resourceType(t) {
136256                if (this._resourceType !== t) {
136257                  this._resourceType = t;
136258                  this.syncSource();
136259                }
136260              }
136261              get remoteURL() {
136262                return this._remoteURL;
136263              }
136264              set remoteURL(t) {
136265                if (this._remoteURL !== t) {
136266                  this._remoteURL = t;
136267                  this.syncSource();
136268                }
136269              }
136270              get clip() {
136271                return this._clip;
136272              }
136273              set clip(t) {
136274                if (this._clip !== t) {
136275                  this._clip = t;
136276                  this.syncSource();
136277                }
136278              }
136279              get playOnAwake() {
136280                return this._playOnAwake;
136281              }
136282              set playOnAwake(t) {
136283                this._playOnAwake = t;
136284              }
136285              get playbackRate() {
136286                return this._playbackRate;
136287              }
136288              set playbackRate(t) {
136289                this._playbackRate = t;
136290                this._impl && this._impl.syncPlaybackRate(t);
136291              }
136292              get volume() {
136293                return this._volume;
136294              }
136295              set volume(t) {
136296                this._volume = t;
136297                this._impl && this._impl.syncVolume(t);
136298              }
136299              get mute() {
136300                return this._mute;
136301              }
136302              set mute(t) {
136303                this._mute = t;
136304                this._impl && this._impl.syncMute(t);
136305              }
136306              get loop() {
136307                return this._loop;
136308              }
136309              set loop(t) {
136310                this._loop = t;
136311                this._impl && this._impl.syncLoop(t);
136312              }
136313              get keepAspectRatio() {
136314                return this._keepAspectRatio;
136315              }
136316              set keepAspectRatio(t) {
136317                if (this._keepAspectRatio !== t) {
136318                  this._keepAspectRatio = t;
136319                  this._impl && this._impl.syncKeepAspectRatio(t);
136320                }
136321              }
136322              get fullScreenOnAwake() {
136323                if (this._impl) {
136324                  this._fullScreenOnAwake = this._impl.fullScreenOnAwake;
136325                  return this._fullScreenOnAwake;
136326                }
136327                return this._fullScreenOnAwake;
136328              }
136329              set fullScreenOnAwake(t) {
136330                if (this._fullScreenOnAwake !== t) {
136331                  this._fullScreenOnAwake = t;
136332                  this._impl && this._impl.syncFullScreenOnAwake(t);
136333                }
136334              }
136335              get stayOnBottom() {
136336                return this._stayOnBottom;
136337              }
136338              set stayOnBottom(t) {
136339                if (this._stayOnBottom !== t) {
136340                  this._stayOnBottom = t;
136341                  this._impl && this._impl.syncStayOnBottom(t);
136342                }
136343              }
136344              get nativeVideo() {
136345                return this._impl && this._impl.video || null;
136346              }
136347              get currentTime() {
136348                return this._impl ? this._impl.getCurrentTime() : this._cachedCurrentTime;
136349              }
136350              set currentTime(t) {
136351                if (Number.isNaN(t)) C(`illegal video time! value:${t}`); else {
136352                  t = _i(t, 0, this.duration);
136353                  this._cachedCurrentTime = t;
136354                  this._impl && this._impl.seekTo(t);
136355                }
136356              }
136357              get duration() {
136358                return this._impl ? this._impl.getDuration() : 0;
136359              }
136360              get state() {
136361                return this._impl ? this._impl.state : BYt.NONE;
136362              }
136363              get isPlaying() {
136364                return !!this._impl && this._impl.isPlaying;
136365              }
136366              syncSource() {
136367                this._impl && (this._resourceType === MYt.REMOTE ? this._impl.syncURL(this._remoteURL) : this._impl.syncClip(this._clip));
136368              }
136369              __preload() {
136370                this._impl = LYt.getImpl(this);
136371                this.syncSource();
136372                this._impl.syncLoop(this._loop);
136373                this._impl.syncVolume(this._volume);
136374                this._impl.syncMute(this._mute);
136375                this._impl.seekTo(this._cachedCurrentTime);
136376                this._impl.syncPlaybackRate(this._playbackRate);
136377                this._impl.syncStayOnBottom(this._stayOnBottom);
136378                this._impl.syncKeepAspectRatio(this._keepAspectRatio);
136379                this._impl.syncFullScreenOnAwake(this._fullScreenOnAwake);
136380                this._impl.componentEventList.set(BYt.META_LOADED, this.onMetaLoaded.bind(this));
136381                this._impl.componentEventList.set(BYt.READY_TO_PLAY, this.onReadyToPlay.bind(this));
136382                this._impl.componentEventList.set(BYt.PLAYING, this.onPlaying.bind(this));
136383                this._impl.componentEventList.set(BYt.PAUSED, this.onPaused.bind(this));
136384                this._impl.componentEventList.set(BYt.STOPPED, this.onStopped.bind(this));
136385                this._impl.componentEventList.set(BYt.COMPLETED, this.onCompleted.bind(this));
136386                this._impl.componentEventList.set(BYt.ERROR, this.onError.bind(this));
136387                this._playOnAwake && this._impl.loaded && this.play();
136388              }
136389              onEnable() {
136390                this._impl && this._impl.enable();
136391              }
136392              onDisable() {
136393                this._impl && this._impl.disable();
136394              }
136395              onDestroy() {
136396                if (this._impl) {
136397                  this._impl.destroy();
136398                  this._impl = null;
136399                }
136400              }
136401              update(t) {
136402                this._impl && this._impl.syncMatrix();
136403              }
136404              onMetaLoaded() {
136405                Vc.emitEvents(this.videoPlayerEvent, this, BYt.META_LOADED);
136406                this.node.emit("meta-loaded", this);
136407              }
136408              onReadyToPlay() {
136409                this._playOnAwake && !this.isPlaying && this.play();
136410                Vc.emitEvents(this.videoPlayerEvent, this, BYt.READY_TO_PLAY);
136411                this.node.emit(BYt.READY_TO_PLAY, this);
136412              }
136413              onPlaying() {
136414                Vc.emitEvents(this.videoPlayerEvent, this, BYt.PLAYING);
136415                this.node.emit(BYt.PLAYING, this);
136416              }
136417              onPaused() {
136418                Vc.emitEvents(this.videoPlayerEvent, this, BYt.PAUSED);
136419                this.node.emit(BYt.PAUSED, this);
136420              }
136421              onStopped() {
136422                Vc.emitEvents(this.videoPlayerEvent, this, BYt.STOPPED);
136423                this.node.emit(BYt.STOPPED, this);
136424              }
136425              onCompleted() {
136426                Vc.emitEvents(this.videoPlayerEvent, this, BYt.COMPLETED);
136427                this.node.emit(BYt.COMPLETED, this);
136428              }
136429              onError() {
136430                Vc.emitEvents(this.videoPlayerEvent, this, BYt.ERROR);
136431                this.node.emit(BYt.ERROR, this);
136432              }
136433              play() {
136434                this._impl && this._impl.play();
136435              }
136436              resume() {
136437                this._impl && this._impl.resume();
136438              }
136439              pause() {
136440                this._impl && this._impl.pause();
136441              }
136442              stop() {
136443                this._impl && this._impl.stop();
136444              }
136445            }, Sqt.EventType = BYt, Sqt.ResourceType = MYt, Aqt), lqt = Bl(aqt.prototype, "_resourceType", [ Yl ], {
136446              configurable: !0,
136447              enumerable: !0,
136448              writable: !0,
136449              initializer: function() {
136450                return MYt.LOCAL;
136451              }
136452            }), hqt = Bl(aqt.prototype, "_remoteURL", [ Yl ], {
136453              configurable: !0,
136454              enumerable: !0,
136455              writable: !0,
136456              initializer: function() {
136457                return "";
136458              }
136459            }), cqt = Bl(aqt.prototype, "_clip", [ GYt, Yl ], {
136460              configurable: !0,
136461              enumerable: !0,
136462              writable: !0,
136463              initializer: function() {
136464                return null;
136465              }
136466            }), uqt = Bl(aqt.prototype, "_playOnAwake", [ Yl ], {
136467              configurable: !0,
136468              enumerable: !0,
136469              writable: !0,
136470              initializer: function() {
136471                return !0;
136472              }
136473            }), _qt = Bl(aqt.prototype, "_volume", [ Yl ], {
136474              configurable: !0,
136475              enumerable: !0,
136476              writable: !0,
136477              initializer: function() {
136478                return 1;
136479              }
136480            }), dqt = Bl(aqt.prototype, "_mute", [ Yl ], {
136481              configurable: !0,
136482              enumerable: !0,
136483              writable: !0,
136484              initializer: function() {
136485                return !1;
136486              }
136487            }), pqt = Bl(aqt.prototype, "_playbackRate", [ Yl ], {
136488              configurable: !0,
136489              enumerable: !0,
136490              writable: !0,
136491              initializer: function() {
136492                return 1;
136493              }
136494            }), mqt = Bl(aqt.prototype, "_loop", [ Yl ], {
136495              configurable: !0,
136496              enumerable: !0,
136497              writable: !0,
136498              initializer: function() {
136499                return !1;
136500              }
136501            }), fqt = Bl(aqt.prototype, "_fullScreenOnAwake", [ Yl ], {
136502              configurable: !0,
136503              enumerable: !0,
136504              writable: !0,
136505              initializer: function() {
136506                return !1;
136507              }
136508            }), gqt = Bl(aqt.prototype, "_stayOnBottom", [ Yl ], {
136509              configurable: !0,
136510              enumerable: !0,
136511              writable: !0,
136512              initializer: function() {
136513                return !1;
136514              }
136515            }), yqt = Bl(aqt.prototype, "_keepAspectRatio", [ Yl ], {
136516              configurable: !0,
136517              enumerable: !0,
136518              writable: !0,
136519              initializer: function() {
136520                return !0;
136521              }
136522            }), Bl(aqt.prototype, "resourceType", [ zYt, HYt ], Object.getOwnPropertyDescriptor(aqt.prototype, "resourceType"), aqt.prototype),
136523            Bl(aqt.prototype, "remoteURL", [ jYt ], Object.getOwnPropertyDescriptor(aqt.prototype, "remoteURL"), aqt.prototype),
136524            Bl(aqt.prototype, "clip", [ XYt, WYt ], Object.getOwnPropertyDescriptor(aqt.prototype, "clip"), aqt.prototype),
136525            Bl(aqt.prototype, "playOnAwake", [ YYt ], Object.getOwnPropertyDescriptor(aqt.prototype, "playOnAwake"), aqt.prototype),
136526            Bl(aqt.prototype, "playbackRate", [ dh, qYt, KYt ], Object.getOwnPropertyDescriptor(aqt.prototype, "playbackRate"), aqt.prototype),
136527            Bl(aqt.prototype, "volume", [ dh, JYt, ZYt ], Object.getOwnPropertyDescriptor(aqt.prototype, "volume"), aqt.prototype),
136528            Bl(aqt.prototype, "mute", [ QYt ], Object.getOwnPropertyDescriptor(aqt.prototype, "mute"), aqt.prototype),
136529            Bl(aqt.prototype, "loop", [ $Yt ], Object.getOwnPropertyDescriptor(aqt.prototype, "loop"), aqt.prototype),
136530            Bl(aqt.prototype, "keepAspectRatio", [ tqt ], Object.getOwnPropertyDescriptor(aqt.prototype, "keepAspectRatio"), aqt.prototype),
136531            Bl(aqt.prototype, "fullScreenOnAwake", [ eqt ], Object.getOwnPropertyDescriptor(aqt.prototype, "fullScreenOnAwake"), aqt.prototype),
136532            Bl(aqt.prototype, "stayOnBottom", [ iqt ], Object.getOwnPropertyDescriptor(aqt.prototype, "stayOnBottom"), aqt.prototype),
136533            bqt = Bl(aqt.prototype, "videoPlayerEvent", [ Yl, sqt, nqt, rqt ], {
136534              configurable: !0,
136535              enumerable: !0,
136536              writable: !0,
136537              initializer: function() {
136538                return [];
136539              }
136540            }), aqt)) || oqt) || oqt) || oqt) || oqt) || oqt));
136541            m.internal.VideoPlayer = Tqt;
136542            W(Tqt.prototype, "VideoPlayer.prototype", [ {
136543              name: "onPasued",
136544              newName: "onPaused"
136545            } ]);
136546            let vqt;
136547            !function(t) {
136548              t.NONE = "none";
136549              t.LOADING = "loading";
136550              t.LOADED = "loaded";
136551              t.ERROR = "error";
136552            }(vqt || (vqt = {}));
136553            class Eqt {
136554              constructor(t) {
136555                this._componentEventList = new Map;
136556                this._state = vqt.NONE;
136557                this._wrapper = void 0;
136558                this._webview = null;
136559                this._loaded = !1;
136560                this._forceUpdate = !1;
136561                this._component = null;
136562                this._uiTrans = null;
136563                this._node = null;
136564                this._w = 0;
136565                this._h = 0;
136566                this._m00 = 0;
136567                this._m01 = 0;
136568                this._m04 = 0;
136569                this._m05 = 0;
136570                this._m12 = 0;
136571                this._m13 = 0;
136572                this._component = t;
136573                this._node = t.node;
136574                this._uiTrans = t.node.getComponent(jB);
136575                this.reset();
136576                this.createWebView();
136577              }
136578              reset() {
136579                this._wrapper = null;
136580                this._webview = null;
136581                this._loaded = !1;
136582                this._w = 0;
136583                this._h = 0;
136584                this._m00 = 0;
136585                this._m01 = 0;
136586                this._m04 = 0;
136587                this._m05 = 0;
136588                this._m12 = 0;
136589                this._m13 = 0;
136590                this._state = vqt.NONE;
136591                this._forceUpdate = !1;
136592              }
136593              get loaded() {
136594                return this._loaded;
136595              }
136596              get componentEventList() {
136597                return this._componentEventList;
136598              }
136599              get webview() {
136600                return this._webview;
136601              }
136602              get state() {
136603                return this._state;
136604              }
136605              get UICamera() {
136606                return IR.root.batcher2D.getFirstRenderCamera(this._node);
136607              }
136608              dispatchEvent(t, ...e) {
136609                const i = this._componentEventList.get(t);
136610                if (i) {
136611                  this._state = t;
136612                  i.call(this, e);
136613                }
136614              }
136615              destroy() {
136616                this.removeWebView();
136617                this._wrapper = null;
136618                this._webview = null;
136619                this._loaded = !1;
136620                this._component = null;
136621                this._uiTrans = null;
136622                this._forceUpdate = !1;
136623                this._componentEventList.clear();
136624              }
136625            }
136626            m.internal.WebViewImpl = Eqt;
136627            const Cqt = Zi();
136628            class xqt extends Eqt {
136629              constructor(t) {
136630                super(t);
136631              }
136632              _bindDomEvent() {
136633                if (!this.webview) return;
136634                this.webview.addEventListener("load", (t => {
136635                  this._forceUpdate = !0;
136636                  this.dispatchEvent(vqt.LOADED);
136637                  const e = t.target;
136638                  const i = e.contentDocument && e.contentDocument.body;
136639                  i && i.innerHTML.includes("404") && this.dispatchEvent(vqt.ERROR, i.innerHTML);
136640                }));
136641              }
136642              loadURL(t) {
136643                if (this.webview) {
136644                  this.webview.src = t;
136645                  this.dispatchEvent(vqt.LOADING);
136646                }
136647              }
136648              createWebView() {
136649                const t = document.createElement("div");
136650                this._wrapper = t;
136651                t.id = "webview-wrapper";
136652                t.style["-webkit-overflow"] = "auto";
136653                t.style["-webkit-overflow-scrolling"] = "touch";
136654                t.style.position = "absolute";
136655                t.style.bottom = "0px";
136656                t.style.left = "0px";
136657                t.style.transformOrigin = "0px 100% 0px";
136658                t.style["-webkit-transform-origin"] = "0px 100% 0px";
136659                BR.container.appendChild(t);
136660                const e = document.createElement("iframe");
136661                this._webview = e;
136662                e.id = "webview";
136663                e.style.border = "none";
136664                e.style.width = "100%";
136665                e.style.height = "100%";
136666                t.appendChild(e);
136667                this._bindDomEvent();
136668              }
136669              removeWebView() {
136670                const t = this._wrapper;
136671                Se(BR.container, t) && BR.container.removeChild(t);
136672                this.reset();
136673              }
136674              enable() {
136675                this._wrapper && (this._wrapper.style.visibility = "visible");
136676              }
136677              disable() {
136678                this._wrapper && (this._wrapper.style.visibility = "hidden");
136679              }
136680              evaluateJS(t) {
136681                if (this.webview) {
136682                  const e = this.webview.contentWindow;
136683                  if (e) try {
136684                    e.eval(t);
136685                  } catch (t) {
136686                    this.dispatchEvent(vqt.ERROR, t);
136687                    x(t);
136688                  }
136689                }
136690              }
136691              setOnJSCallback(t) {
136692                C("The platform does not support");
136693              }
136694              setJavascriptInterfaceScheme(t) {
136695                C("The platform does not support");
136696              }
136697              syncMatrix() {
136698                if (!this._wrapper || !this._uiTrans || !this._component || "hidden" === this._wrapper.style.visibility) return;
136699                const t = this.UICamera;
136700                if (!t) return;
136701                this._component.node.getWorldMatrix(Cqt);
136702                t.update(!0);
136703                t.worldMatrixToScreen(Cqt, Cqt, BR.canvas.width, BR.canvas.height);
136704                const {width: e, height: i} = this._uiTrans.contentSize;
136705                if (!this._forceUpdate && this._m00 === Cqt.m00 && this._m01 === Cqt.m01 && this._m04 === Cqt.m04 && this._m05 === Cqt.m05 && this._m12 === Cqt.m12 && this._m13 === Cqt.m13 && this._w === e && this._h === i) return;
136706                this._m00 = Cqt.m00;
136707                this._m01 = Cqt.m01;
136708                this._m04 = Cqt.m04;
136709                this._m05 = Cqt.m05;
136710                this._m12 = Cqt.m12;
136711                this._m13 = Cqt.m13;
136712                this._w = e;
136713                this._h = i;
136714                const s = Lo.devicePixelRatio;
136715                const n = 1 / s;
136716                const r = 1 / s;
136717                const o = BR.container;
136718                const a = Cqt.m00 * n;
136719                const l = Cqt.m01;
136720                const h = Cqt.m04;
136721                const c = Cqt.m05 * r;
136722                this._wrapper.style.width = `${e}px`;
136723                this._wrapper.style.height = `${i}px`;
136724                const u = this._w * n;
136725                const _ = this._h * r;
136726                const d = u * Cqt.m00 * this._uiTrans.anchorX;
136727                const p = _ * Cqt.m05 * this._uiTrans.anchorY;
136728                const m = o && o.style.paddingLeft ? parseInt(o.style.paddingLeft) : 0;
136729                const f = o && o.style.paddingBottom ? parseInt(o.style.paddingBottom) : 0;
136730                const g = `matrix(${a},${-l},${-h},${c},${Cqt.m12 * n - d + m},${-(Cqt.m13 * r - p + f)})`;
136731                this._wrapper.style.transform = g;
136732                this._wrapper.style["-webkit-transform"] = g;
136733                this._forceUpdate = !1;
136734              }
136735            }
136736            class wqt {
136737              static getImpl(t) {
136738                return new xqt(t);
136739              }
136740            }
136741            m.internal.WebViewImplManager = wqt;
136742            var Rqt, Iqt, Mqt, Bqt, Dqt, Pqt, Oqt, Nqt, Lqt, Fqt, Vqt, kqt, Uqt, Gqt;
136743            let zqt = t("WebView", (Rqt = Ul("cc.WebView"), Iqt = sh(), Mqt = $l(), Bqt = Gl(jB),
136744            Dqt = lh(), Pqt = Th([ Vc ]), Oqt = ph(), Nqt = lh(), Rqt(Lqt = Iqt(Lqt = Mqt(Lqt = Bqt(Lqt = Ql(Lqt = (Fqt = (Gqt = Uqt = class extends Qc {
136745              constructor(...t) {
136746                super(...t);
136747                Ml(this, "_url", Vqt, this);
136748                this._impl = null;
136749                Ml(this, "webviewEvents", kqt, this);
136750              }
136751              get url() {
136752                return this._url;
136753              }
136754              set url(t) {
136755                this._url = t;
136756                this._impl && this._impl.loadURL(t);
136757              }
136758              get nativeWebView() {
136759                return this._impl && this._impl.webview || null;
136760              }
136761              get state() {
136762                return this._impl ? this._impl.state : vqt.NONE;
136763              }
136764              setJavascriptInterfaceScheme(t) {
136765                this._impl && this._impl.setJavascriptInterfaceScheme(t);
136766              }
136767              setOnJSCallback(t) {
136768                this._impl && this._impl.setOnJSCallback(t);
136769              }
136770              evaluateJS(t) {
136771                this._impl && this._impl.evaluateJS(t);
136772              }
136773              __preload() {
136774                this._impl = wqt.getImpl(this);
136775                this._impl.componentEventList.set(vqt.LOADING, this.onLoading.bind(this));
136776                this._impl.componentEventList.set(vqt.LOADED, this.onLoaded.bind(this));
136777                this._impl.componentEventList.set(vqt.ERROR, this.onError.bind(this));
136778                this._impl.loadURL(this._url);
136779              }
136780              onLoading() {
136781                Vc.emitEvents(this.webviewEvents, this, vqt.LOADING);
136782                this.node.emit(vqt.LOADING, this);
136783              }
136784              onLoaded() {
136785                Vc.emitEvents(this.webviewEvents, this, vqt.LOADED);
136786                this.node.emit(vqt.LOADED, this);
136787              }
136788              onError(...t) {
136789                Vc.emitEvents(this.webviewEvents, this, vqt.ERROR, t);
136790                this.node.emit(vqt.ERROR, this, t);
136791              }
136792              onEnable() {
136793                this._impl && this._impl.enable();
136794              }
136795              onDisable() {
136796                this._impl && this._impl.disable();
136797              }
136798              onDestroy() {
136799                if (this._impl) {
136800                  this._impl.destroy();
136801                  this._impl = null;
136802                }
136803              }
136804              update(t) {
136805                this._impl && this._impl.syncMatrix();
136806              }
136807            }, Uqt.EventType = vqt, Gqt), Vqt = Bl(Fqt.prototype, "_url", [ Yl ], {
136808              configurable: !0,
136809              enumerable: !0,
136810              writable: !0,
136811              initializer: function() {
136812                return "https://cocos.com";
136813              }
136814            }), Bl(Fqt.prototype, "url", [ Dqt ], Object.getOwnPropertyDescriptor(Fqt.prototype, "url"), Fqt.prototype),
136815            kqt = Bl(Fqt.prototype, "webviewEvents", [ Yl, Pqt, Oqt, Nqt ], {
136816              configurable: !0,
136817              enumerable: !0,
136818              writable: !0,
136819              initializer: function() {
136820                return [];
136821              }
136822            }), Fqt)) || Lqt) || Lqt) || Lqt) || Lqt) || Lqt));
136823            m.internal.WebView = zqt;
136824          }
136825        };
136826      }));
136827    },
136828    582: (t, e) => {
136829      "use strict";
136830      Object.defineProperty(e, "__esModule", {
136831        value: !0
136832      });
136833      e.default = void 0;
136834      e.default = {
136835        imports: {
136836          cc: "./cocos-js/cc.js"
136837        }
136838      };
136839    },
136840    457: () => {
136841      "use strict";
136842      !function() {
136843        function t(t, e) {
136844          return (e || "") + " (SystemJS Error#" + t + " https://git.io/JvFET#" + t + ")";
136845        }
136846        var e = "undefined" != typeof Symbol;
136847        var i = "undefined" != typeof self;
136848        var s = "undefined" != typeof document;
136849        var n = i ? self : global;
136850        var r;
136851        if (s) {
136852          var o = document.querySelector("base[href]");
136853          o && (r = o.href);
136854        }
136855        if (!r && "undefined" != typeof location) {
136856          var a = (r = location.href.split("#")[0].split("?")[0]).lastIndexOf("/");
136857          -1 !== a && (r = r.slice(0, a + 1));
136858        }
136859        var l = /\\/g;
136860        function h(t, e) {
136861          -1 !== t.indexOf("\\") && (t = t.replace(l, "/"));
136862          if ("/" === t[0] && "/" === t[1]) return e.slice(0, e.indexOf(":") + 1) + t;
136863          if ("." === t[0] && ("/" === t[1] || "." === t[1] && ("/" === t[2] || 2 === t.length && (t += "/")) || 1 === t.length && (t += "/")) || "/" === t[0]) {
136864            var i = e.slice(0, e.indexOf(":") + 1);
136865            var s;
136866            s = "/" === e[i.length + 1] ? "file:" !== i ? (s = e.slice(i.length + 2)).slice(s.indexOf("/") + 1) : e.slice(8) : e.slice(i.length + ("/" === e[i.length]));
136867            if ("/" === t[0]) return e.slice(0, e.length - s.length - 1) + t;
136868            var n = s.slice(0, s.lastIndexOf("/") + 1) + t;
136869            var r = [];
136870            var o = -1;
136871            for (var a = 0; a < n.length; a++) if (-1 !== o) {
136872              if ("/" === n[a]) {
136873                r.push(n.slice(o, a + 1));
136874                o = -1;
136875              }
136876            } else if ("." === n[a]) if ("." !== n[a + 1] || "/" !== n[a + 2] && a + 2 !== n.length) "/" === n[a + 1] || a + 1 === n.length ? a += 1 : o = a; else {
136877              r.pop();
136878              a += 2;
136879            } else o = a;
136880            -1 !== o && r.push(n.slice(o));
136881            return e.slice(0, e.length - s.length) + r.join("");
136882          }
136883        }
136884        function c(t, e) {
136885          return h(t, e) || (-1 !== t.indexOf(":") ? t : h("./" + t, e));
136886        }
136887        function u(t, e, i, s, n) {
136888          for (var r in t) {
136889            var o = h(r, i) || r;
136890            var a = t[r];
136891            if ("string" == typeof a) {
136892              var l = m(s, h(a, i) || a, n);
136893              l ? e[o] = l : p("W1", r, a, "bare specifier did not resolve");
136894            }
136895          }
136896        }
136897        function _(t, e) {
136898          if (e[t]) return t;
136899          var i = t.length;
136900          do {
136901            var s = t.slice(0, i + 1);
136902            if (s in e) return s;
136903          } while (-1 !== (i = t.lastIndexOf("/", i - 1)));
136904        }
136905        function d(t, e) {
136906          var i = _(t, e);
136907          if (i) {
136908            var s = e[i];
136909            if (null === s) return;
136910            if (!(t.length > i.length && "/" !== s[s.length - 1])) return s + t.slice(i.length);
136911            p("W2", i, s, "should have a trailing '/'");
136912          }
136913        }
136914        function p(e, i, s, n) {
136915          console.warn(t(e, "Package target " + n + ", resolving target '" + s + "' for " + i));
136916        }
136917        function m(t, e, i) {
136918          var s = t.scopes;
136919          var n = i && _(i, s);
136920          for (;n; ) {
136921            var r = d(e, s[n]);
136922            if (r) return r;
136923            n = _(n.slice(0, n.lastIndexOf("/")), s);
136924          }
136925          return d(e, t.imports) || -1 !== e.indexOf(":") && e;
136926        }
136927        var f = e && Symbol.toStringTag;
136928        var g = e ? Symbol() : "@";
136929        function y() {
136930          this[g] = {};
136931        }
136932        var b = y.prototype;
136933        b.import = function(t, e) {
136934          var i = this;
136935          return Promise.resolve(i.prepareImport()).then((function() {
136936            return i.resolve(t, e);
136937          })).then((function(t) {
136938            var e = v(i, t);
136939            return e.C || function(t, e) {
136940              return e.C = E(t, e, e, {}).then((function() {
136941                return w(t, e, {});
136942              })).then((function() {
136943                return e.n;
136944              }));
136945            }(i, e);
136946          }));
136947        };
136948        b.createContext = function(t) {
136949          var e = this;
136950          return {
136951            url: t,
136952            resolve: function(i, s) {
136953              return Promise.resolve(e.resolve(i, s || t));
136954            }
136955          };
136956        };
136957        b.onload = function() {};
136958        function S(t) {
136959          return t.id;
136960        }
136961        function A(t, e, i, s) {
136962          t.onload(i, e.id, e.d && e.d.map(S), !!s);
136963          if (i) throw i;
136964        }
136965        var T;
136966        b.register = function(t, e) {
136967          T = [ t, e ];
136968        };
136969        b.getRegister = function() {
136970          var t = T;
136971          T = void 0;
136972          return t;
136973        };
136974        function v(e, i, s) {
136975          var n = e[g][i];
136976          if (n) return n;
136977          var r = [];
136978          var o = Object.create(null);
136979          f && Object.defineProperty(o, f, {
136980            value: "Module"
136981          });
136982          var a = Promise.resolve().then((function() {
136983            return e.instantiate(i, s);
136984          })).then((function(s) {
136985            if (!s) throw Error(t(2, "Module " + i + " did not instantiate"));
136986            var a = s[1]((function(t, e) {
136987              n.h = !0;
136988              var i = !1;
136989              if ("string" == typeof t) {
136990                if (!(t in o) || o[t] !== e) {
136991                  o[t] = e;
136992                  i = !0;
136993                }
136994              } else {
136995                for (var s in t) {
136996                  e = t[s];
136997                  if (!(s in o) || o[s] !== e) {
136998                    o[s] = e;
136999                    i = !0;
137000                  }
137001                }
137002                t.__esModule && (o.__esModule = t.__esModule);
137003              }
137004              if (i) for (var a = 0; a < r.length; a++) {
137005                var l = r[a];
137006                l && l(o);
137007              }
137008              return e;
137009            }), 2 === s[1].length ? {
137010              import: function(t) {
137011                return e.import(t, i);
137012              },
137013              meta: e.createContext(i)
137014            } : void 0);
137015            n.e = a.execute || function() {};
137016            return [ s[0], a.setters || [] ];
137017          }), (function(t) {
137018            n.e = null;
137019            n.er = t;
137020            A(e, n, t, !0);
137021            throw t;
137022          }));
137023          var l = a.then((function(t) {
137024            return Promise.all(t[0].map((function(s, n) {
137025              var r = t[1][n];
137026              return Promise.resolve(e.resolve(s, i)).then((function(t) {
137027                var s = v(e, t, i);
137028                return Promise.resolve(s.I).then((function() {
137029                  if (r) {
137030                    s.i.push(r);
137031                    !s.h && s.I || r(s.n);
137032                  }
137033                  return s;
137034                }));
137035              }));
137036            }))).then((function(t) {
137037              n.d = t;
137038            }));
137039          }));
137040          return n = e[g][i] = {
137041            id: i,
137042            i: r,
137043            n: o,
137044            I: a,
137045            L: l,
137046            h: !1,
137047            d: void 0,
137048            e: void 0,
137049            er: void 0,
137050            E: void 0,
137051            C: void 0,
137052            p: void 0
137053          };
137054        }
137055        function E(t, e, i, s) {
137056          if (!s[e.id]) {
137057            s[e.id] = !0;
137058            return Promise.resolve(e.L).then((function() {
137059              e.p && null !== e.p.e || (e.p = i);
137060              return Promise.all(e.d.map((function(e) {
137061                return E(t, e, i, s);
137062              })));
137063            })).catch((function(i) {
137064              if (e.er) throw i;
137065              e.e = null;
137066              A(t, e, i, !1);
137067              throw i;
137068            }));
137069          }
137070        }
137071        var C = Object.freeze(Object.create(null));
137072        var x = Promise.prototype.finally || function(t) {
137073          if ("function" != typeof t) return this.then(t, t);
137074          const e = this.constructor || Promise;
137075          return this.then((i => e.resolve(t()).then((() => i))), (i => e.resolve(t()).then((() => {
137076            throw i;
137077          }))));
137078        };
137079        function w(t, e, i) {
137080          if (i[e.id]) return e.E;
137081          i[e.id] = !0;
137082          if (!e.e) {
137083            if (e.er) throw e.er;
137084            return e.E ? e.E : void 0;
137085          }
137086          const s = e.e;
137087          e.e = null;
137088          var n;
137089          e.d.forEach((function(s) {
137090            try {
137091              var r = w(t, s, i);
137092              r && (n = n || []).push(r);
137093            } catch (i) {
137094              e.er = i;
137095              A(t, e, i, !1);
137096              throw i;
137097            }
137098          }));
137099          if (n) return e.E = x.call(Promise.all(n).then(o), (function() {
137100            e.E = null;
137101          }));
137102          var r = o();
137103          if (r) return e.E = x.call(r, (function() {
137104            e.E = null;
137105          }));
137106          function o() {
137107            try {
137108              var i = s.call(C);
137109              if (i) return i = i.then((function() {
137110                e.C = e.n;
137111                A(t, e, null, !0);
137112              }), (function(i) {
137113                e.er = i;
137114                A(t, e, i, !0);
137115                throw i;
137116              }));
137117              e.C = e.n;
137118              e.L = e.I = void 0;
137119            } catch (t) {
137120              e.er = t;
137121              throw t;
137122            } finally {
137123              A(t, e, e.er, !0);
137124            }
137125          }
137126        }
137127        n.System = new y;
137128        b.instantiate = function(t, e) {
137129          throw new Error(`Unable to instantiate ${t} from ${e}`);
137130        };
137131        let R = r;
137132        const I = {
137133          imports: {},
137134          scopes: {}
137135        };
137136        function M(t, e) {
137137          !function(t, e, i) {
137138            t.imports && u(t.imports, i.imports, e, i, null);
137139            var s;
137140            for (s in t.scopes || {}) {
137141              var n = c(s, e);
137142              u(t.scopes[s], i.scopes[n] || (i.scopes[n] = {}), e, i, n);
137143            }
137144            for (s in t.depcache || {}) i.depcache[c(s, e)] = t.depcache[s];
137145            for (s in t.integrity || {}) i.integrity[c(s, e)] = t.integrity[s];
137146          }(t, e || R, I);
137147        }
137148        b.resolve = function(t, e) {
137149          return m(I, h(t, e = e || R) || t, e) || function(t, e) {
137150            throw new Error(`Unresolved id: ${t} from parentUrl: ${e}`);
137151          }(t, e);
137152        };
137153        function B(t) {
137154          return function(e) {
137155            const i = this;
137156            let s;
137157            try {
137158              s = t(e);
137159            } catch (t) {
137160              return Promise.reject(t);
137161            }
137162            return function(t) {
137163              return Boolean(t && "function" == typeof t.then);
137164            }(s) ? new Promise((t => s.then((() => {
137165              t(i.getRegister());
137166            })))) : i.getRegister();
137167          };
137168        }
137169        function D(t, e) {
137170          const i = b.instantiate;
137171          b.instantiate = function(s, n) {
137172            const r = s.substr(0, t.length) === t ? s.substr(t.length) : null;
137173            return null === r ? i.call(this, s, n) : e.call(this, r, n);
137174          };
137175        }
137176        !function(t) {
137177          var e = t.System;
137178          o(e);
137179          var i = e.constructor.prototype;
137180          var s = e.constructor;
137181          var n = function() {
137182            s.call(this);
137183            o(this);
137184          };
137185          n.prototype = i;
137186          e.constructor = n;
137187          var r;
137188          function o(t) {
137189            t.registerRegistry = Object.create(null);
137190          }
137191          var a = i.register;
137192          i.register = function(t, e, i) {
137193            if ("string" != typeof t) return a.apply(this, arguments);
137194            var s = [ e, i ];
137195            this.registerRegistry[t] = s;
137196            if (!r) {
137197              r = s;
137198              Promise.resolve().then((function() {
137199                r = null;
137200              }));
137201            }
137202            return a.apply(this, arguments);
137203          };
137204          var l = i.resolve;
137205          i.resolve = function(t, e) {
137206            try {
137207              return l.call(this, t, e);
137208            } catch (e) {
137209              if (t in this.registerRegistry) return t;
137210              throw e;
137211            }
137212          };
137213          var h = i.instantiate;
137214          i.instantiate = function(t, e) {
137215            var i = this.registerRegistry[t];
137216            if (i) {
137217              this.registerRegistry[t] = null;
137218              return i;
137219            }
137220            return h.call(this, t, e);
137221          };
137222          var c = i.getRegister;
137223          i.getRegister = function() {
137224            var t = c.call(this);
137225            var e = r || t;
137226            r = null;
137227            return e;
137228          };
137229        }("undefined" != typeof self ? self : global);
137230        b.prepareImport = function(t) {};
137231        b.warmup = function({pathname: t = "/", importMap: e, importMapUrl: i, defaultHandler: s, handlers: n}) {
137232          if (function(t) {
137233            R = t;
137234          }(`no-schema:${t}`), M(e, `no-schema:/${i}`), s && D("no-schema:", B(s)), n) for (const t of Object.keys(n)) D(t, B(n[t]));
137235        };
137236      }();
137237    },
137238    260: t => {
137239      function e(t) {
137240        var e = new Error("Cannot find module '" + t + "'");
137241        e.code = "MODULE_NOT_FOUND";
137242        throw e;
137243      }
137244      e.keys = () => [];
137245      e.resolve = e;
137246      e.id = 260;
137247      t.exports = e;
137248    },
137249    266: t => {
137250      "use strict";
137251      t.exports = JSON.parse();
137252    }
137253  };
137254  var e = {};
137255  function i(s) {
137256    var n = globalThis.__common_module_cache___050c3e31727995d1749ba30b8ad948d6 ? globalThis.__common_module_cache___050c3e31727995d1749ba30b8ad948d6[s] : null;
137257    if (n) return n.exports;
137258    var r = e[s];
137259    if (void 0 !== r) return r.exports;
137260    var o = e[s] = {
137261      exports: {}
137262    };
137263    globalThis.__common_module_cache___050c3e31727995d1749ba30b8ad948d6 && String(s).indexOf("?name=") < 0 && function(t) {
137264      if (globalThis.webpackChunk_050c3e31727995d1749ba30b8ad948d6) {
137265        switch (globalThis.webpackChunk_050c3e31727995d1749ba30b8ad948d6.length) {
137266         case 1:
137267          return globalThis.webpackChunk_050c3e31727995d1749ba30b8ad948d6[0][1][t];
137268
137269         case 2:
137270          return globalThis.webpackChunk_050c3e31727995d1749ba30b8ad948d6[0][1][t] || globalThis.webpackChunk_050c3e31727995d1749ba30b8ad948d6[1][1][t];
137271        }
137272      }
137273    }(s) && (globalThis.__common_module_cache___050c3e31727995d1749ba30b8ad948d6[s] = o);
137274    t[s].call(o.exports, o, o.exports, i);
137275    return o.exports;
137276  }
137277  i.o = (t, e) => Object.prototype.hasOwnProperty.call(t, e);
137278  var s = i(565);
137279  _050c3e31727995d1749ba30b8ad948d6 = s;
137280};
137281
137282print("compiling done");